Exemplo n.º 1
0
Arquivo: cApp.cpp Projeto: stdmtb/n9
void cApp::setup(){
    
    int w = win_w*master_scale;
    int h = win_h*master_scale;
    
    setFrameRate( fps );
    setWindowSize( w*0.5, h*0.5 );
    setWindowPos( 0, 0 );
    mExp.setup( w, h, 0, 3000, GL_RGB, mt::getRenderPath(), 0);
    
    CameraPersp cam( w, h, 54.4f, 1, 10000 );
    cam.lookAt( Vec3f(0,0, 1300), Vec3f(0,0,0) );
    cam.setCenterOfInterestPoint( Vec3f(0,0,0) );
    camUi.setCurrentCam( cam );

    assetDir = mt::getAssetPath();
    simDir.push_back( assetDir/"sim"/"red_particle3"/"rpc2");
    
    int nSim = simDir.size();
    vbo.assign( nSim, VboSet() );
    
#ifdef RENDER
    mExp.startRender();
#endif
}
Exemplo n.º 2
0
void ExportDialog::on_buttonBox_accepted() {
  QString filter;
  switch(outputFormatComboBox->currentIndex()) {
  case ExportDialog::pdf: filter = "PDF-Files (*.pdf)"; break;
  case ExportDialog::png: filter = "PNG-Files (*.png)"; break;
  }
  QString filename = QFileDialog::getSaveFileName(this, "Export to filename...", QDir::currentPath(), filter);
  if(filename.isEmpty())
    return;

  // extract values from export_dialog
  double width = widthSpinBox->value(),
    height = heightSpinBox->value();
  if(measureComboBox->currentIndex()==ExportDialog::cm) {
    width  /= 2.54;
    height /= 2.54;
  };

  int res_dpi = resSpinBox->value();
  if(resRatioComboBox->currentIndex()==ExportDialog::cm_px)
    res_dpi /= 2.54; 

  // export to file
  Exporter* exporter;
  if(outputFormatComboBox->currentIndex() == ExportDialog::pdf)
    exporter = ExportPDF::getExportPDF();
  else
    exporter = ExportPNG::getExportPNG();

  exporter->save(filename, mExp, width, height, res_dpi);
}
Exemplo n.º 3
0
void cApp::keyDown( KeyEvent event ){
    switch( event.getChar() ){
        case 'S': mExp.startRender(); break;
        case 's': mExp.snapShot(); break;
        case ' ': bStart = !bStart; break;
    }
}
Exemplo n.º 4
0
void cApp::draw(){
    
    bOrtho ? mExp.beginOrtho( true ) : mExp.begin( camUi.getCamera() ); {
        
        gl::clear();    
        gl::enableDepthRead();
        gl::enableDepthWrite();
        gl::enableAlphaBlending();
        glPointSize(1);
        glLineWidth(1);
    
        if( !mExp.bRender && !mExp.bSnap ){ mt::drawCoordinate(10); }
        for( int i=0; i<rms.size(); i++){
            rms[rms.size()-i-1].draw();
        }
        
        norms.draw();
        
    }mExp.end();
    
    mExp.draw();
    
    if(gui) gui->draw();

    if( bStart && !bFall )frame++;
}
Exemplo n.º 5
0
Map* FileFormatTest::saveAndLoadMap(Map* input, const FileFormat* format)
{
	try {
		QBuffer buffer;
		buffer.open(QIODevice::ReadWrite);
		
		Exporter* exporter = format->createExporter(&buffer, input, NULL);
		if (!exporter)
			return NULL;
		exporter->doExport();
		delete exporter;
		
		buffer.seek(0);
		
		Map* out = new Map;
		Importer* importer = format->createImporter(&buffer, out, NULL);
		if (!importer)
			return NULL;
		importer->doImport(false);
		importer->finishImport();
		delete importer;
		
		buffer.close();
		
		return out;
	}
	catch (std::exception& e)
	{
		return NULL;
	}
}
Exemplo n.º 6
0
void cApp::draw(){
    
    gl::enableAlphaBlending();
    glPointSize(1);
    glLineWidth(1);
    
    //bOrtho ? mExp.beginOrtho( true ) : mExp.begin( camUi.getCamera() ); {
    {
        mExp.bind();
        gl::clear();
        gl::enableDepthRead();
        gl::enableDepthWrite();

        for( int i=0; i<6; i++){
            gl::pushMatrices();
            gl::setMatrices( cams[i] );
            
            if( !mExp.bRender && !mExp.bSnap ){
                mt::drawCoordinate(160);
            }
            
            rms[i].draw();
            
            gl::popMatrices();
        }
    }mExp.end();

    mExp.draw();

    if(gui) gui->draw();

    if( bStart)frame++;
}
Exemplo n.º 7
0
void cApp::draw(){
    
    //gl::setMatrices( camUi.getCamera() );
    mExp.begin( camUi.getCamera() );
    {
        gl::clear( Color(0,0,0) );
        gl::pointSize(1);
        gl::lineWidth(1);
        gl::enableAlphaBlending();

        gl::color(1,1,1);
        gl::TextureRef tex = gl::Texture::create( sur );
        gl::draw( tex );
        
        // feature key point
        //gl::enableAdditiveBlending();
        nline.draw();
        vbo.draw();
    }
    mExp.end();
    
    mExp.draw();
    
    frame+=1;
}
Exemplo n.º 8
0
    virtual bool exporterTest() {
        Importer importer;
        Exporter exporter;
        const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/PLY/cube.ply", 0);
        EXPECT_NE(nullptr, scene);
        EXPECT_EQ(aiReturn_SUCCESS, exporter.Export(scene, "ply", ASSIMP_TEST_MODELS_DIR "/PLY/cube_test.ply"));

        return true;
    }
Exemplo n.º 9
0
// ------------------------------------------------------------------------------------------------
ASSIMP_API aiReturn aiExportSceneEx( const aiScene* pScene, const char* pFormatId, const char* pFileName, aiFileIO* pIO, unsigned int pPreprocessing )
{
	Exporter exp;

	if (pIO) {
		exp.SetIOHandler(new CIOSystemWrapper(pIO));
	}
	return exp.Export(pScene,pFormatId,pFileName,pPreprocessing);
}
Exemplo n.º 10
0
void MainWindow::on_butExport_clicked()
{
    using namespace Assimp;

#ifndef ASSIMP_BUILD_NO_EXPORT
    QString filename, filter, format_id;
    Exporter exporter;
    QTime time_begin;
    aiReturn rv;
    QStringList exportersList;
    QMap<QString, const aiExportFormatDesc*> exportersMap;


	if(mScene == nullptr)
	{
		QMessageBox::critical(this, "Export error", "Scene is empty");

		return;
	}

	for (size_t i = 0; i < exporter.GetExportFormatCount(); ++i)
	{
		const aiExportFormatDesc* desc = exporter.GetExportFormatDescription(i);
		exportersList.push_back(desc->id + QString(": ") + desc->description);
		exportersMap.insert(desc->id, desc);
	}

	// get an exporter
	bool dialogSelectExporterOk;
	QString selectedExporter = QInputDialog::getItem(this, "Export format", "Select the exporter : ", exportersList, 0, false, &dialogSelectExporterOk);
	if (!dialogSelectExporterOk)
		return;

	// build the filter
	QString selectedId = selectedExporter.left(selectedExporter.indexOf(':'));
	filter = QString("*.") + exportersMap[selectedId]->fileExtension;

	// get file path
	filename = QFileDialog::getSaveFileName(this, "Set file name", "", filter);
	// if it's canceled
	if (filename == "")
		return;

	// begin export
	time_begin = QTime::currentTime();
	rv = exporter.Export(mScene, selectedId.toLocal8Bit(), filename.toLocal8Bit(), aiProcess_FlipUVs);
	ui->lblExportTime->setText(QString::number(time_begin.secsTo(QTime::currentTime())));
	if(rv == aiReturn_SUCCESS)
		LogInfo("Export done: " + filename);
	else
	{
		QString errorMessage = QString("Export failed: ") + filename;
		LogError(errorMessage);
		QMessageBox::critical(this, "Export error", errorMessage);
	}
#endif
}
Exemplo n.º 11
0
void cApp::keyDown( KeyEvent event ) {
    char key = event.getChar();
    switch (key) {
        case 'S': mExp.startRender();  break;
        case 'T': mExp.stopRender();  break;
        case 's': mExp.snapShot();  break;
        case ' ': bStart = !bStart; break;
        case 'c': mt::printCamera( camUi.getCamera() ); break;
    }
}
Exemplo n.º 12
0
Arquivo: cApp.cpp Projeto: stdmtb/n9
void cApp::draw(){

    float transx = getWindowWidth()/2 - mFpb/2/2;
    float transy = getWindowHeight()/2;
    
    mExp.beginPersp();
    {
        gl::clear( Colorf(0,0,0) );
        
        glPushMatrix();
        {
            glTranslatef( transx, transy, 0 );
            
            for( int w=0; w<mWaves.size(); w++ ){

                for( int i=0; i<mWaves[w].posL.size(); i++ ){
                    
                    float noise = mPln.noise( mWaves[w].posR[i].y*mWaves[w].posL[i].y*0.5, i*0.5 );
                    if( noise<0.67 ){
                        glPointSize( 1 );
                    }else if( noise<0.72 ){
                        glPointSize( 2 );
                    }else if( noise<0.8 ){
                        glPointSize( 3 );
                    }else{
                        glPointSize( 1 );
                        gl::drawStrokedCircle( Vec2f(mWaves[w].posL[i].x, mWaves[w].posL[i].y), MAX(1, (noise-0.8f)*200.0f) );
                    }
                    
                    if(randFloat()<0.97f) glColor3f( mWaves[w].colorL[ i ].r, mWaves[w].colorL[ i ].g, mWaves[w].colorL[ i ].b );
                    else glColor3f(1, 0, 0);

                    glBegin( GL_POINTS );
                    glVertex2f( mWaves[w].posL[i].x,  mWaves[w].posL[i].y );
                    glEnd();
                    
                    if(randFloat()<0.97f) glColor3f( mWaves[w].colorR[i].r, mWaves[w].colorR[i].g, mWaves[w].colorR[i].b );
                    else glColor3f(1, 0, 0);

                    glBegin( GL_POINTS );
                    glVertex2f( mWaves[w].posR[i].x, mWaves[w].posR[i].y );
                    glEnd();
                }
            }
        }
        glPopMatrix();
        
    }
    mExp.end();
    

    gl::clear( Colorf(1,1,1) );
    gl::color( Colorf(1,1,1) );
    mExp.draw();
}
Exemplo n.º 13
0
int	Ss3exp::DoExport(const TCHAR *name,ExpInterface *ei,Interface *i, BOOL suppressPrompts, DWORD options)	// Export file
{
	//TODO: Implement the actual file import here and 
	//		return TRUE If the file is imported properly

	if(!suppressPrompts)
	{
		if(!DialogBoxParam(hInstance, 
				MAKEINTRESOURCE(IDD_PANEL), 
				GetActiveWindow(), 
				Ss3expOptionsDlgProc, (LPARAM)this))
				return true;
	}


	DWORD start,end;

	start=timeGetTime();
	BEInitLog(NULL,hInstance);
	log("Export Started ( %d )\n",start);
	Exporter exporter;
	RSMObject rsm;
	exporter.DoExport(name,i,&rsm);
	log("Model exported.\n");
	rsm.Optimize(bVertex);
	log("Model Optimized.\n");

	if(bAnimation)
	{
		log("Constructing Animation.\n");
		AnimConstructor *ac=new AnimConstructor;
		ac->BuildAnimation(i,"default",1.0f,bVertex);
		rsm.AddAnimation(ac);
		log("Animation built.\n");
	}

	FILE *file=fopen(name,"wb+");
	if(!file) return false;

	rsm.SaveRML(file);
	rsm.SaveRSM(file);
	rsm.SaveCameraInfo(file);

	fputc(bSky ? 1 : 0,file);
	fclose(file);
/*
	rsm.SaveRML("ss3test.rml");
	rsm.SaveRSM("ss3test.rsm");
*/
	end=timeGetTime();
	log("Export Ended ( %d ) %d seconds elapsed \n",end, (end-start)/1000);
	BECloseLog();
	return true;
}
Exemplo n.º 14
0
// ------------------------------------------------------------------------------------------------
ASSIMP_API const C_STRUCT aiExportDataBlob* aiExportSceneToBlob( const aiScene* pScene, const char* pFormatId, unsigned int pPreprocessing  )
{
	Exporter exp;
	if (!exp.ExportToBlob(pScene,pFormatId,pPreprocessing)) {
		return NULL;
	}
	const aiExportDataBlob* blob = exp.GetOrphanedBlob();
	ai_assert(blob);

	return blob;
}
Exemplo n.º 15
0
void EditorState::exportData(const ExportOptions &options) const
{
	Exporter exporter;
	HeightmapData &heightmapData = data->terrainMode.loadHeightmap();

	exporter.getScene().setHeightmap(heightmapData.heightMap, heightmapData.mapSize, heightmapData.realSize);

	for(unsigned int i = 0; i < data->modes.size(); ++i)
		data->modes[i]->doExport(exporter);

	exporter.save(options);
}
Exemplo n.º 16
0
void AsyncLoader::saveTask(FileEvent *event, DataSetPackage *package)
{

	_currentEvent = event;

	QString path = event->path();
	if (event->IsOnlineNode())
		path = _odm->getLocalPath(path);

	QString tempPath = path + QString(".tmp");

	try
	{
		int maxSleepTime = 2000;
		int sleepTime = 100;
		int delay = 0;
		while (package->isReady() == false)
		{
			if (delay > maxSleepTime)
				break;

			Utils::sleep(sleepTime);
			delay += sleepTime;
		}

		Exporter *exporter = event->getExporter();
		if (exporter)
		{
			exporter->saveDataSet(fq(tempPath), package, boost::bind(&AsyncLoader::progressHandler, this, _1, _2));
		} else {
			throw runtime_error("No Exporter found!");
		}

		if ( ! Utils::renameOverwrite(fq(tempPath), fq(path)))
			throw runtime_error("File '" + fq(path) + "' is being used by another application.");

		if (event->IsOnlineNode())
			QMetaObject::invokeMethod(_odm, "beginUploadFile", Qt::AutoConnection, Q_ARG(QString, event->path()), Q_ARG(QString, "asyncloader"), Q_ARG(QString, tq(package->id)), Q_ARG(QString, tq(package->initalMD5)));
		else
			event->setComplete();
	}
	catch (runtime_error e)
	{
		Utils::removeFile(fq(tempPath));
		event->setComplete(false, e.what());
	}
	catch (exception e)
	{
		Utils::removeFile(fq(tempPath));
		event->setComplete(false, e.what());
	}
}
Exemplo n.º 17
0
Arquivo: cApp.cpp Projeto: stdmtb/n9
void cApp::keyDown( KeyEvent event ){
    switch (event.getChar()) {
        case '1': camUi.setCurrentCam(cams[0]);     break;
        case '2': camUi.setCurrentCam(cams[1]);     break;
        case '3': camUi.setCurrentCam(cams[2]);     break;
        case '4': camUi.setCurrentCam(cams[3]);     break;
        case '5': camUi.setCurrentCam(cams[4]);     break;
        case 'R': mExp.startRender();               break;
        case 'T': mExp.stopRender();                break;
        case 'f': frame+=100;                       break;
        case '0': frame=0; simDirNum++;             break;
    }
}
Exemplo n.º 18
0
Arquivo: cApp.cpp Projeto: stdmtb/n9
void cApp::setup(){
    setWindowPos( 0, 0 );
    setWindowSize( mW*mScale, mH*mScale );
    setFrameRate(25);
    assetDir = mt::getAssetPath();
    
    mExp.setup( mW, mH, 0, 2999, GL_RGB, mt::getRenderPath(), 0 );
    
    setupFromBlender();
    
#ifdef RENDER
    mExp.startRender();
#endif

}
Exemplo n.º 19
0
Arquivo: cApp.cpp Projeto: stdmtb/n9
void cApp::setup(){
    
    setFrameRate( 25 );
    setWindowSize( win_w*0.5, win_h*0.5 );
    setWindowPos( 0, 0 );
    mExp.setup( win_w, win_h, 0, 3000, GL_RGB, mt::getRenderPath(), 0);
    
    assetDir = mt::getAssetPath();
    mt::loadColorSample("img/colorSample/n5pickCol_2.png", mColorSample1 );
    mt::loadColorSample("img/colorSample/n5pickCol_3.png", mColorSample2 );
    
    guide.load( assetDir/"svg"/"n5_guide.svg" );
    
#ifdef RENDER
    mExp.startRender();
#endif
}
bool ExportCommand::Apply(CommandExecutionContext context)
{
   wxString mode = GetString(wxT("Mode"));
   wxString filename = GetString(wxT("Filename"));
   long numChannels = GetLong(wxT("Channels"));

   bool selection = mode.IsSameAs(wxT("Selection"));

   double t0, t1;
   if (selection)
   {
      t0 = context.GetProject()->mViewInfo.selectedRegion.t0();
      t1 = context.GetProject()->mViewInfo.selectedRegion.t1();
   }
   else
   {
      t0 = 0.0;
      t1 = context.GetProject()->GetTracks()->GetEndTime();
   }

   // Find the extension and check it's valid
   int splitAt = filename.Find(wxUniChar('.'), true);
   if (splitAt < 0)
   {
      Error(wxT("Export filename must have an extension!"));
      return false;
   }
   wxString extension = filename.Mid(splitAt+1).MakeUpper();

   Exporter exporter;

   bool exportSuccess = exporter.Process(context.GetProject(),
                                         std::max(0L, numChannels),
                                         extension, filename,
                                         selection, t0, t1);

   if (exportSuccess)
   {
      Status(wxString::Format(wxT("Exported to %s format: %s"),
                              extension, filename));
      return true;
   }

   Error(wxString::Format(wxT("Could not export to %s format!"), extension));
   return false;
}
Exemplo n.º 21
0
Arquivo: cApp.cpp Projeto: stdmtb/n9
void cApp::setup(){
    
    setWindowPos( 0, 0 );
    setWindowSize( mW*0.5, mH*0.5 );
    mExp.setup( mW*mScale, mH*mScale,0, 2999, GL_RGB, mt::getRenderPath() );
    
    mPln.setOctaves(4);
    mPln.setSeed(1332);

    randSeed( mt::getSeed() );
    
    int count = 0;
    for( int i=0; i<100; i++){
        StrangeAgent sa;
        sa.setRandom();
        mSAs.push_back( sa );

        for(int j=0; j<sa.points.size(); j++){
            mPlnPts.push_back( Vec3f(count*scale,0,0) );
            count++;
        }
    }
    
    total = count;
    
    if( 1 ){
        CameraPersp cam;
        cam.setNearClip(0.1);
        cam.setFarClip(1000000);
        cam.setFov(60);
        cam.setEyePoint( Vec3f(0,0,-30 ) );
        cam.setCenterOfInterestPoint( Vec3f(0,0,0) );
        cam.setAspectRatio( (float)mW/mH );
        mCamUi.setCurrentCam(cam);
    }else{
        ortho.setNearClip(0.1);
        ortho.setFarClip(1000000);
        ortho.setEyePoint( Vec3f(0,0,-7 ) );
        ortho.setCenterOfInterestPoint( Vec3f(0,0,0) );
        ortho.setAspectRatio( (float)mW/mH );
    }
    
#ifdef RENDER
    mExp.startRender();
#endif
}
Exemplo n.º 22
0
void GUICutRenderWindow::OnExportCSV(wxCommandEvent &event) {
	wxFileDialog *SaveDialog = new wxFileDialog(this, wxT("Speichern unter..."),
			_(""), _(""), _("Character-separated values (*.csv)|*.csv"),
			wxFD_SAVE | wxFD_OVERWRITE_PROMPT);

	//Speichern bestätigt?
	if (SaveDialog->ShowModal() == wxID_OK) {
		Exporter exporter;
		CutRender_info* info = getCutRenderProperties();
		exporter.ExportCutCSV(string(SaveDialog->GetPath().ToUTF8().data()),
				value_img, info);
		delete info;
	}

	SaveDialog->Close();
	SaveDialog->Destroy();
}
Exemplo n.º 23
0
// Save
status_t
BitmapSetSaver::Save(Document* document)
{
	entry_ref actualRef(fRef);
	char name[B_OS_NAME_LENGTH];

	// 64x64
	snprintf(name, sizeof(name), "%s_64.png", fRef.name);
	actualRef.set_name(name);
	Exporter* exporter = new BitmapExporter(64);
	exporter->SetSelfDestroy(true);
	exporter->Export(document, actualRef);

	// 16x16
	snprintf(name, sizeof(name), "%s_16.png", fRef.name);
	actualRef.set_name(name);
	exporter = new BitmapExporter(16);
	exporter->SetSelfDestroy(true);
	exporter->Export(document, actualRef);

	// 32x32
	snprintf(name, sizeof(name), "%s_32.png", fRef.name);
	actualRef.set_name(name);
	exporter = new BitmapExporter(32);
	exporter->SetSelfDestroy(true);
	exporter->Export(document, actualRef);

	return B_OK;
}
Exemplo n.º 24
0
void MainWindow::on_butExport_clicked()
{
using namespace Assimp;

QString filename, filter, format_id;
Exporter exporter;
QTime time_begin;
aiReturn rv;

	if(mScene == nullptr)
	{
		QMessageBox::critical(this, "Export error", "Scene is empty");

		return;
	}

	// build filter
	{
		aiString filter_temp;

		mImporter.GetExtensionList(filter_temp);
		filter = filter_temp.C_Str();
		filter.replace(';', ' ');
	}

	// get file path
	filename = QFileDialog::getSaveFileName(this, "Set file name", "", filter);
	// extract format ID
	format_id = filename.right(filename.length() - filename.lastIndexOf('.') - 1);
	if(format_id.isEmpty())
	{
		QMessageBox::critical(this, "Export error", "File name must has extension.");

		return;
	}

	// begin export
	time_begin = QTime::currentTime();
	rv = exporter.Export(mScene, format_id.toLocal8Bit(), filename.toLocal8Bit());
	ui->lblExportTime->setText(QString("%1").arg(time_begin.secsTo(QTime::currentTime())));
	if(rv == aiReturn_SUCCESS)
		LogInfo("Export done: " + filename);
	else
		LogError("Export failed: " + filename);
}
Exemplo n.º 25
0
Arquivo: cApp.cpp Projeto: stdmtb/n9
void cApp::draw(){
    mExp.beginOrtho();{
        gl::clear();
        gl::enableAlphaBlending();
        glPushMatrix();
        gl::translate( mExp.mFbo.getWidth()/2, mExp.mFbo.getHeight()/2 );
        
        if( mExp.mFrame==1 || (!mExp.bRender && !mExp.bSnap) ){
            //guide.draw();
            mt::drawScreenGuide();
        }
        
        /*
            draw particle
        */
        glBegin( GL_POINTS );
        glPointSize(1);
        for( int i=0; i<ps.size(); i++ ){
            Vec2f & p = ps[i];
            ColorAf & c = cs[i];
            //ColorAf c( 0.7, 0.7, 0.7, 0.5 );
            glColor4f( c );
            
            glVertex2f( p );
        }
        glPopMatrix();
        glEnd();
        
        
    }mExp.end();

    gl::clear( ColorA(0,0,0,1) );
    gl::color( Color::white() );
    mExp.draw();

    gl::drawString("Frame: " + to_string(frame), Vec2f(50, 50) );
    
#ifdef RENDER
    frame+=1;
#else
    frame+=5;
#endif

}
Exemplo n.º 26
0
Arquivo: cApp.cpp Projeto: stdmtb/n9
void cApp::draw(){

    mExp.begin( mCamUi.getCamera() );
    {
        gl::clear( Colorf(0,0,0) );
    
        if(0){
            glPushMatrix();
            glTranslatef( 5, 0, 0);
            gl::color(1, 1, 1);
            glBegin( GL_POINTS );
            for( int i=0; i<mSAs.size(); i++ ){
                for (int j=0; j<mSAs[i].points.size(); j++) {
                    glVertex3f( mSAs[i].points[j] );
                }
            }
            glEnd();
            glPopMatrix();
        }
        
        glPushMatrix();
        glTranslatef( -total*scale*0.5, 0, 0);
        gl::color(0, 0, 1, 0.35);
        glBegin( GL_POINTS );
        for( int i=0; i<mPlnPts.size(); i++ ){
            glVertex3f( mPlnPts[i] );
        }
        glEnd();
        glPopMatrix();
        
        glPushMatrix();
        glColor3f(1, 0, 0);
        glBegin( GL_LINES );
        glVertex3f(-100, 0, 0);
        glVertex3f(100, 0, 0);
        glEnd();
        glPopMatrix();
    }
    mExp.end();
    
    gl::clear( Colorf(1,1,1) );
    gl::color( Colorf(1,1,1) );
    mExp.draw();
}
Exemplo n.º 27
0
void cApp::setup(){
    setWindowPos( 0, 0 );
    
    float w = 1920;
    float h = 1080*3;
    
    setWindowSize( w*0.2, h*0.2 );
    mExp.setup( w, h, 0, 550-1, GL_RGB, mt::getRenderPath(), 0);
    
    cam = CameraPersp(w, h, 55.0f, 0.1, 1000000 );
    
    if(0){
        cam.lookAt( vec3(0,0,800), vec3(0,0,0) );
        cam.setLensShift( 0,0 );
    }else{
        cam.setNearClip(0.100000);
        cam.setFarClip(1000000.000000);
        cam.setAspectRatio(0.592593);
        cam.setFov(55.000000);
        cam.setEyePoint(vec3(326.924622,-381.081604,259.431519));
        cam.setWorldUp(vec3(0.000000,1.000000,0.000000));
        cam.setLensShift(vec2(0.000000,0.000000));
        cam.setViewDirection(vec3(-0.578462,0.674288,-0.459040));
        cam.lookAt(vec3(326.924622,-381.081604,259.431519)+vec3(-0.578462,0.674288,-0.459040));
    }
    
    camUi.setCamera( &cam );
    
    mPln.setSeed(123);
    mPln.setOctaves(4);
    
    for( int i=0; i<6; i++){
        Ramses r(eSimType,i);
        rms.push_back( r );
    }

    makeGui();
    
#ifdef RENDER
    mExp.startRender();
#endif
    
}
Exemplo n.º 28
0
Arquivo: cApp.cpp Projeto: stdmtb/n9
void cApp::setup(){
    setFrameRate( 25 );
    setWindowPos( 0, 0 );
    setWindowSize( mW*mScale, mH*mScale );
    mExp.setup( mW*mScale, mH*mScale, 0, 2999, GL_RGB, mt::getRenderPath() );
    
    mPln.setOctaves( 3 );
    mPln.setSeed( 551 );
    
    mt::loadColorSample("img/Mx80_2_org_B.jpg", mColorSample1 );
    mt::loadColorSample("img/Mx80_2_org_B.jpg", mColorSample2 );

    
    {
        // Audio Setup
        auto ctx = audio::Context::master();
        audio::DeviceRef device = audio::Device::getDefaultOutput();
        audio::Device::Format format;
        format.sampleRate( 192000 );
        format.framesPerBlock( mFpb );
        device->updateFormat( format );
        
        cout << "--- Audio Setting --- " << endl;
        cout << "device name      : " << device->getName() << endl;
        cout << "Sample Rate      : " << ctx->getSampleRate() << endl;
        cout << "frames per Block : " << ctx->getFramesPerBlock() << endl;

        mWaves.assign( 7, Wave() );
        
        for( int i=0; i<mWaves.size(); i++ ){
            mWaves[i].create( "snd/test/3s1e_192k_" + toString(i+1)+ ".wav" );
        }

        ctx->enable();
    }
    
    
#ifdef RENDER
    mExp.startRender();
#endif

}
Exemplo n.º 29
0
void cApp::keyDown( KeyEvent event ) {
    char key = event.getChar();
    switch (key) {
        case 'S':
            mExp.snapShot();
            break;
        
        case 'R':
            mExp.startRender();
            break;

         case 'T':
            mExp.stopRender();
            break;
            
        case ' ':
            bStart = !bStart;
            break;
    }
}
Exemplo n.º 30
0
Arquivo: cApp.cpp Projeto: stdmtb/n9
void cApp::keyDown( KeyEvent event ){

    switch (event.getChar()) {
        
        case 'R':
            mExp.startRender();
            break;

        case 'T':
            mExp.stopRender();
            break;

        case 'f':
            frame+=100;
            break;
            
        default:
            break;
    }
}