Ejemplo n.º 1
0
PUSphereRender* PUSphereRender::create( const std::string &texFile)
{
    auto ret = new (std::nothrow) PUSphereRender();
    if (ret && ret->initRender(texFile))
    {
        ret->autorelease();
    }
    else
    {
        CC_SAFE_DELETE(ret);
    }
    return ret;
}
Ejemplo n.º 2
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow),
    mDiabdat(NULL),
    mIsAnimation(false),
    mSettingsFile(QApplication::applicationDirPath() + "/celview.ini")
{
    mSettings.loadFromFile(mSettingsFile.toStdString());
    ui->setupUi(this);
    this->setWindowTitle("Celview");
    connect(ui->listView, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(itemDoubleClicked(QListWidgetItem * )));
    connect(&mRenderTimer, SIGNAL(timeout()), this, SLOT(updateRender()));

    ui->currentFrame->setValidator(new QIntValidator(0, 9999999, this));
    ui->currentFrame->setText("0");
    
    qDebug() << mSettingsFile;

    loadSettings();
    initRender();    
}
Ejemplo n.º 3
0
/***********************************************************
					MAINLOOP
************************************************************/
int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow)
{

	glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA);
	glutInitWindowPosition(200, 0);
	glutInitWindowSize(w,h);
	glutCreateWindow("Sculpteo");

	glutKeyboardFunc(processNormalKeys);
	glutReshapeFunc(reshape);
	glutDisplayFunc(display);
	glutIdleFunc(display);
	glutMouseFunc(mouse);

	NUIinit();
	initRender();
	uiInit();
	createGLUTMenus();
	glutMainLoop();

	
	return 0;
}
Ejemplo n.º 4
0
	Model(aiMesh *mesh_) : importedMesh(mesh_)
	{
		initRender();
    }
Ejemplo n.º 5
0
int main(int argc, char **argv)
{
	bool keepGoing = true;

	srand(time(NULL)); //seed random generator

	parseArguments(argc, argv);

	allocWorld();
	fillWorld();
	
	Timer renderTimer = makeTimer(1.0 / config.framerate);

	if (config.render)
		initRender();

	if (config.measureSamples < 0) {
		/* Loop forever, or until the user quits the renderer */
		while (stepSimulation(&renderTimer));
	} else {
		printf("Waiting for system to relax.\n");
		for (double t = 0; keepGoing && t < config.measureWait; t += config.timeStep) {
			keepGoing = stepSimulation(&renderTimer);
			if (fmod(t, config.measureWait / 100) < config.timeStep) {
				printf("\rRelax time %13f of %f",
						(t + config.measureWait/100) / TIME_FACTOR, 
						config.measureWait / TIME_FACTOR);
				fflush(stdout);
			}
		}

		/* Perform the measurements */
		printf("\nStarting measurement.\n");
		FILE *outstream = fopen(DATA_FILE_NAME, "w");
		//plotHeader(outstream);
		double intervalTime = 0;
		for (long sample = 0; keepGoing && sample < config.measureSamples; sample++) {
			while (keepGoing && intervalTime <= config.measureInterval) {
				keepGoing = stepSimulation(&renderTimer);
				intervalTime += config.timeStep;
			}
			if (!keepGoing)
				break;

			/* Check for numerical drift (or bugs) before 
			 * commiting measurement. */
			if (!physicsCheck())
				die("You broke physics!\n");

			dumpEnergies(outstream);
			printf("\rMeasured sample %ld/%ld", sample + 1, config.measureSamples);
			fflush(stdout);
			intervalTime -= config.measureInterval;
		}
		printf("\n");
		fclose(outstream);
	}

	freeWorld();
	return 0;
}
Ejemplo n.º 6
0
	int SDL_main (int argc,char* argv[]) {
#elif __APPLE__
	int SDL_main (int argc,char* argv[]) {
#else
	#ifdef main
	#undef main
	#endif
	int main(int argc,char* argv[]) {
#endif

    printf("[INFO] Entering main\n");

    uint32_t flags=SDL_INIT_VIDEO;
#ifndef WIN32
    flags|=SDL_INIT_EVENTTHREAD;
#endif
#ifdef __MACH__
	flags = SDL_INIT_EVERYTHING;
#endif
    if (SDL_Init(flags)==-1) {
        printf("SDL_Init: %s\n", SDL_GetError ());
        return -1;
    }
    screen=SDL_SetVideoMode(SCREEN_WIDTH,SCREEN_HEIGHT, 32, SDL_SWSURFACE);
    if(screen == NULL) {
        printf("SDL_SetVideoMode failed!\n");
        return -2;
    }
    SDL_WM_SetCaption ("Pebble Local Simulator - 24H Style",0);
    pebbleScreen = createScreen;

    if(TTF_Init()==-1) {
        printf("TTF_Init: %s\n", TTF_GetError());
        return -3;
    }

    if (IMG_Init (IMG_INIT_PNG)==-1) {
        printf("IMG_Init: %s\n", IMG_GetError());
        return -4;
    }

    if (!loadSimulatorImages())
        return -5;
    bodyImg=getSimulatorImage(SIM_IMG_BODY);
    shadowImg=getSimulatorImage(SIM_IMG_SCREEN_SHADOW);
    vibeImg=getSimulatorImage(SIM_IMG_VIBE);
    lightImg=getSimulatorImage(SIM_IMG_BACKLIGHT);
    logFile=fopen (LOG_FILE,"a");

    if (!initRender(pebbleScreen))
        return -9;
    persistent_storage_load();

    if (!setup_js_app()) {
        printf("[ERROR] Failed to Initialize Connection to JS app\n");
        return -10;
    }

    initHardwareOutput ();
    initButtons();
    pbl_main();
    unloadSystemFonts ();
    quitRender();
    persistent_storage_free();

    if (logFile!=0)
        fclose(logFile);

    freeSimulatorImages();
    IMG_Quit ();
    TTF_Quit ();
    SDL_Quit ();
    return 0;
}
Ejemplo n.º 7
0
static void *renderTaskStart(void *initialData)
{
	assert(initialData != NULL);
	initRender();
	return initialData;
}