Ejemplo n.º 1
0
void PortionDrawer::drawGraph(DiagramDrawer &drawer)
    {
    if(mGraph)
        {
        // This must be set for svg
        drawer.setDiagramSize(getDrawingSize(drawer));

        drawNodes(drawer);
        drawer.groupShapes(true, Color(0,0,0), Color(245,245,255));
        drawConnections(drawer);
        drawer.groupShapes(false, 0, 0);

        std::vector<DrawString> drawStrings;
        std::vector<bool> virtOpers;
        getNodeText(drawer, drawStrings, virtOpers);

        drawer.groupText(true, false);
        drawNodeText(drawer, false, drawStrings, virtOpers);
        drawer.groupText(false, false);

        drawer.groupText(true, true);
        drawNodeText(drawer, true, drawStrings, virtOpers);
        drawer.groupText(false, false);
        }
    }
Ejemplo n.º 2
0
void OpenGLWidget::paintGL()
{

  glClearColor(0,0,0,0);
  //glClearColor(255,255,255,0);
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

  glMatrixMode( GL_PROJECTION );
  glLoadIdentity();
  gluPerspective(70,(double)600/440,1,1000);

  glMatrixMode( GL_MODELVIEW );
  glLoadIdentity();

  gluLookAt(camera[0], camera[1], camera[2], camera[3], camera[4], camera[5],camera[6],camera[7],camera[8]);

  drawGrid();
  drawNodes();

  if (draw_connections)
    drawConnections();

}
Ejemplo n.º 3
0
void
GNEVariableSpeedSignal::drawGL(const GUIVisualizationSettings& s) const {
    // Start drawing adding an gl identificator
    glPushName(getGlID());

    // Add a draw matrix for drawing logo
    glPushMatrix();
    glTranslated(myShape[0].x(), myShape[0].y(), getType());
    glColor3d(1, 1, 1);
    glRotated(180, 0, 0, 1);

    // Draw icon depending of rerouter is or isn't selected
    if (isAdditionalSelected()) {
        GUITexturesHelper::drawTexturedBox(GUITextureSubSys::getTexture(GNETEXTURE_VARIABLESPEEDSIGNALSELECTED), 1);
    } else {
        GUITexturesHelper::drawTexturedBox(GUITextureSubSys::getTexture(GNETEXTURE_VARIABLESPEEDSIGNAL), 1);
    }

    // Pop draw icon matrix
    glPopMatrix();

    // Show Lock icon depending of the Edit mode
    drawLockIcon(0.4);

    // Push matrix to draw every symbol over lane
    glPushMatrix();

    // Traslate to 0,0
    glTranslated(0, 0, getType());

    // Obtain exaggeration
    const SUMOReal exaggeration = s.addSize.getExaggeration(s);

    // Iterate over lanes
    for (childLanes::const_iterator i = myChildLanes.begin(); i != myChildLanes.end(); i++) {
        // Draw every signal over Lane
        glPushMatrix();
        glScaled(exaggeration, exaggeration, 1);
        glTranslated(i->positionOverLane.x(), i->positionOverLane.y(), 0);
        glRotated(i->rotationOverLane, 0, 0, 1);
        glTranslated(0, -1.5, 0);

        int noPoints = 9;
        if (s.scale > 25) {
            noPoints = (int)(9.0 + s.scale / 10.0);
            if (noPoints > 36) {
                noPoints = 36;
            }
        }
        glColor3d(1, 0, 0);
        GLHelper::drawFilledCircle((SUMOReal) 1.3, noPoints);
        if (s.scale >= 5) {
            glTranslated(0, 0, .1);
            glColor3d(0, 0, 0);
            GLHelper::drawFilledCircle((SUMOReal) 1.1, noPoints);
            // Draw speed
            SUMOReal speed = i->lane->getSpeed();
            // Show as Km/h
            speed *= 3.6f;
            if (((int) speed + 1) % 10 == 0) {
                speed = (SUMOReal)(((int) speed + 1) / 10 * 10);
            }
            // draw the speed string
            std::string speedToDraw = toString<SUMOReal>(speed);
            glColor3d(1, 1, 0);
            glTranslated(0, 0, .1);
            glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
            pfSetPosition(0, 0);
            pfSetScale(1.2f);
            SUMOReal w = pfdkGetStringWidth(speedToDraw.c_str());
            glRotated(180, 0, 1, 0);
            glTranslated(-w / 2., 0.3, 0);
            pfDrawString(speedToDraw.c_str());
        }
        glPopMatrix();
    }

    // Pop symbol matrix
    glPopMatrix();

    // Draw connections
    drawConnections();

    // Draw name
    drawName(getCenteringBoundary().getCenter(), s.scale, s.addName);

    // Pop name
    glPopName();
}
Ejemplo n.º 4
0
int main (int argc, char** argv)
{
	if(argc>1)
	{
		OSCConn::setServer(argv[1]);
		if(argc>2)
		{
			OSCConn::setPort(atoi(argv[2])); 
		}
	}
	else
	{
		if(getSCPath() && launchSuperCollider());
		else
		{
			fprintf(stderr, "Cant get sclang patch - exiting\n");
			exit(0);
		}
	}
	
	registerEffects();
	registerControllers();
	
	if(!OSCConn::connect()) exit(1);
	
	if(!OSCConn::startServer()) exit(2);
	
	if(!checkEffectsList()) {OSCConn::quitServer(); exit(3);}
	
	saveSCPath();
	
	initSDL();
	
	effectCreator.init();
	
	recordingInfoTex=generateText("Recording", COLOR_SELECTED_TEXT);
	
	auto effectInstanceList=getEffectInstanceList();
	
	auto controllerInstanceList=getControllerInstanceList();
	
	
	while (!checkInputs())
	{
		for(auto it=controllerInstanceList->rbegin();it!=controllerInstanceList->rend();++it)
		{
			it->second->step();
		}
		
		setColor(COLOR_CLEARCOLOR);
		SDL_RenderClear(render);
		drawRecordingInfo();
		
		for(auto it=effectInstanceList->begin();it!=effectInstanceList->end();++it)
		{
			it->second->doSomething();
		}
		
		for(auto it=effectInstanceList->begin();it!=effectInstanceList->end();++it)
		{
			it->second->draw();
		}
		
		for(auto it=controllerInstanceList->rbegin();it!=controllerInstanceList->rend();++it)
		{
			it->second->draw();
		}

		drawConnections();
		
		int screen_width;
		SDL_GetWindowSize(window, &screen_width, NULL);

		effectCreator.draw(screen_width-EffectCreator::menu_period, 0);
		
		SDL_RenderPresent(render);
	}
	
	Effect::saveToFile("last_session.cello");
	
	Effect::clearAll();
	
	quitSDL();
	
	OSCConn::quitServer();
	fprintf(stderr, "Done\n");
}
Ejemplo n.º 5
0
//--------------------------------------------------------------
void testApp::draw(){
	ofNoFill();

	ofSetColor(0, 0, 0);
	
	//-------------------------------
	
	ofSetBackgroundAuto(drawFluid);
	
	if(drawFluid) {
		glColor3f(1, 1, 1);
		fluidDrawer.draw(0, 0, window.width, window.height);
	}
	
	if(drawParticles) particleSystem.updateAndDraw();
	
	drawWaves();
	drawConnections();
	drawSmurfs();
	drawFingers();
		
	gui.draw();
	
	if (smurfFloor->isVerbose()) {
		ofDrawBitmapString(
						   "BPM     : " + 
						   ofToString((int)smurfFloor->getBPM()), 
						   15, 45
		);

		ofDrawBitmapString(
						   "OSC out : " + 
						   smurfCfg->getOscSendAddress() + 
						   ":" + 
						   ofToString((int)smurfCfg->getOscSendPort()),
						   15, 60
		);
		
		ofDrawBitmapString(
						   "OSC in  : " + 
						   ofToString((int)smurfCfg->getOscReceivePort()), 
						   15, 75
		);
		
		ofDrawBitmapString(
						   "TUIO    : " + 
						   ofToString((int)smurfCfg->getTuioPort()), 
						   15, 90
		);
		
		ofDrawBitmapString("      q : quicken the beat", 15, 105);
		ofDrawBitmapString("      s : slow down the beat", 15, 120);
		ofDrawBitmapString("      f : toggle fullscreen", 15, 135);
		ofDrawBitmapString("  space : ui menu", 15, 150);
		ofDrawBitmapString("    esc : quit", 15, 165);
		
#ifdef TARGET_OS_MAC
		string gestMode = smurfFloor->isGesture()?"ON":"OFF";
		ofDrawBitmapString("      g : toggle gesture mode (" + gestMode + ")", 15, 180);
#endif
		ofDrawBitmapString("      h : toggle this help menu", 15, 195);

		string connMode = smurfFloor->isConnectionModeOn()?"ON":"OFF";
		ofDrawBitmapString("      c : toggle connections mode(" + connMode + ")", 15, 210);
		ofDrawBitmapString("      x : quicken the wave", 15, 225);
		ofDrawBitmapString("      w : slow down the wave", 15, 240);

#ifdef TARGET_OS_MAC
		ofDrawBitmapString("Gesture : " + smurfFloor->brain->getGestures()->getLatestGestureLabel(), 15, 255);
#endif
		
//		float fps = ofGetFrameRate();
//		
//		ofDrawBitmapString("FPS : " + (int)fps, 5, 65);
	}
}