RenderPanel::RenderPanel(CommandQueue *c, MainWindow *mw)
{  
    cmdq = c;
    fundolb = new QLabel(this);

    screenW = 750;
    screenH = 550;

    Render *r = new Render(screenW, screenH, c);
    connect(r, SIGNAL(renderizado(const QImage &)), this, SLOT(update(const QImage &)), Qt::QueuedConnection);
    connect(r, SIGNAL(feedBackBondary(bool)),this, SLOT(feedBackBondary(bool)));
    connect(this, SIGNAL(atualizaTamanho(int, int)), r, SLOT(updateScreen(int, int)), Qt::QueuedConnection);
    connect(this, SIGNAL(enviaArquivo(const QString &)), r, SLOT(recebeArquivo(const QString &)), Qt::QueuedConnection);
    
    QImage tmp(screenW, screenH,QImage::Format_ARGB32_Premultiplied);
    QPainter p;
    p.begin(&tmp);
    p.fillRect(tmp.rect(), Qt::white);
    p.end();
    fundolb->setPixmap(QPixmap::fromImage(tmp));
    fundolb->show();

    m_mw = mw;

    repaint();
    r->start();
}
Beispiel #2
0
int main()
{
	GOOGLE_PROTOBUF_VERIFY_VERSION;
	shiny::RenderRequest renreq;
  
	Render render;
	
	nextStage();
	
	render.eye    = Vector3(0, 1, 0);
	render.target = Vector3(0, 1, -1);
	
	render.scene.addSphere(-3, 1, -8, 3);
	render.scene.addSphere(3, 1.5, -7, 2);
	render.scene.spheres[1].material.emission = Vector3(0.5, 0.5, 0);
	
	render.start();
	
	cout << "Serializing..." << endl;
	
	auto script = stages;
	
	/*
	[
		[
			["add", "vector", {
				"n": 1,                              // Number of vectors
				"data": [[1, 1, 1], [1, 2, 3]],                        // Array of alternating start and end points,
				"line": true,                        // Whether to draw vector lines
				"arrow": true,                       // Whether to draw arrowheads
				"size": 0.07,                         // Size of the arrowhead relative to the stage
			}],
		]
	]
	*/
	
	ujson::value jsonScript{ script };
	ujson::value jsonScene = to_json(render.scene);
	
  	ofstream dataFile;
	dataFile.open (OUTPUT_FILE);
	dataFile << "window.mathboxScript = " << jsonScript << ";" << endl;
	dataFile << "window.mathboxScene = " << jsonScene << ";" << endl;
	dataFile.close();
  	
	
	
	/*
	Server server;
	
	server.start();
	
	while (!server.exit) {
		shSleep(1);
	}
	
	server.stop();
	//*/
	
  	google::protobuf::ShutdownProtobufLibrary();
	
	cout << "Done!" << endl;
	  
	/*
	thrust::host_vector<Vector3f> h_rpos(n);
	thrust::host_vector<Vector3f> h_rdir(n);
	
	thrust::host_vector<Vector3i> h_pos(n);
	thrust::host_vector<Vector3i> h_step(n);
	thrust::host_vector<Vector3f> h_tmax(n);
	thrust::host_vector<Vector3f> h_tdelta(n);
	thrust::host_vector<CubeSide> h_side(n);
	
	for (int i = 0; i < n; i++) {
		Vector3f *p;
		p = &h_rpos[i];
		p->set(0.5f, 0.5f, 0.5f);
		p = &h_rdir[i];
		p->set(0.01f, 1.f, -0.01f);
	}
	
	initTrace(n, h_rpos, h_rdir, h_pos, h_step, h_tmax, h_tdelta, h_side);
	
	printElement(0, h_rpos, h_rdir, h_pos, h_step, h_tmax, h_tdelta, h_side);
	
	step(n, h_pos, h_step, h_tmax, h_tdelta, h_side);
	
	printElement(0, h_rpos, h_rdir, h_pos, h_step, h_tmax, h_tdelta, h_side);
	*/
	
	return 0;
}
Beispiel #3
0
int main(int argc, char** argv)
{
	gEngine.init(&argc, argv, "display OBJ model", "off/model.off");
	gEngine.start();
	return 0;
}