Example #1
0
  /* main function in embree namespace */
  int main(int argc, char** argv) 
  {
    /* create stream for parsing */
    Ref<ParseStream> stream = new ParseStream(new CommandLineStream(argc, argv));

    /* parse command line */  
    parseCommandLine(stream, FileName());
    if (g_numThreads) 
      g_rtcore += ",threads=" + std::stringOf(g_numThreads);

    /* initialize task scheduler */
#if !defined(__EXPORT_ALL_SYMBOLS__)
    TaskScheduler::create(g_numThreads);
#endif

    /* load scene */
    loadOBJ(filename,g_obj_scene);

    /* initialize ray tracing core */
    init(g_rtcore.c_str());
    
    /* send model */
    set_scene(&g_obj_scene);

    /* initialize GLUT */
    initGlut(tutorialName,g_width,g_height,g_fullscreen,true);
    
    return 0;
  }
Example #2
0
/* main function in embree namespace */
int main(int argc, char** argv)
{
    /* for best performance set FTZ and DAZ flags in MXCSR control and status register */
    _MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_ON);
    _MM_SET_DENORMALS_ZERO_MODE(_MM_DENORMALS_ZERO_ON);

    /* create stream for parsing */
    Ref<ParseStream> stream = new ParseStream(new CommandLineStream(argc, argv));

    /* parse command line */
    parseCommandLine(stream, FileName());

    /* load default scene if none specified */
    if (filename.ext() == "") {
        FileName file = FileName::executableFolder() + FileName("models/cornell_box.ecs");
        parseCommandLine(new ParseStream(new LineCommentFilter(file, "#")), file.path());
    }

    /* configure number of threads */
    if (g_numThreads)
        g_rtcore += ",threads=" + std::to_string((long long)g_numThreads);
    if (g_numBenchmarkFrames)
        g_rtcore += ",benchmark=1";

    g_rtcore += g_subdiv_mode;

    /* load scene */
    if (strlwr(filename.ext()) == std::string("obj")) {
        g_scene->add(loadOBJ(filename,g_subdiv_mode != ""));
    }
    else if (strlwr(filename.ext()) == std::string("xml")) {
        g_scene->add(loadXML(filename,one));
    }
    else if (filename.ext() != "")
        THROW_RUNTIME_ERROR("invalid scene type: "+strlwr(filename.ext()));

    /* initialize ray tracing core */
    init(g_rtcore.c_str());

    /* send model */
    g_obj_scene.add(g_scene.dynamicCast<SceneGraph::Node>(),g_instancing_mode);
    g_scene = nullptr;
    set_scene(&g_obj_scene);

    /* benchmark mode */
    if (g_numBenchmarkFrames)
        renderBenchmark(outFilename);

    /* render to disk */
    if (outFilename.str() != "")
        renderToFile(outFilename);

    /* interactive mode */
    if (g_interactive) {
        initWindowState(argc,argv,tutorialName, g_width, g_height, g_fullscreen);
        enterWindowRunLoop(g_anim_mode);
    }

    return 0;
}
void KnotsViewer::update_view()
{
    Bbox_2 box_2 = surfacedata->get_box();
    Bbox_3 box_3(box_2.xmin(), box_2.ymin(), 0, box_2.xmax(), box_2.ymax(), 1);
    set_scene(box_3);
    bmeshdomainview= true;
    updateGL();
}
Example #4
0
  /* main function in embree namespace */
  int main(int argc, char** argv) 
  {
    /* create stream for parsing */
    Ref<ParseStream> stream = new ParseStream(new CommandLineStream(argc, argv));

    /* parse command line */  
    parseCommandLine(stream, FileName());
    
    if (g_numThreads) 
      g_rtcore += ",threads=" + std::stringOf(g_numThreads);
    if (g_numBenchmarkFrames)
      g_rtcore += ",benchmark=1";

     g_rtcore += g_subdiv_mode;

    /* load scene */
     if (strlwr(filename.ext()) == std::string("obj"))
       {
         if (g_subdiv_mode != "")
           {
             std::cout << "enabling subdiv mode" << std::endl;
             loadOBJ(filename,one,g_obj_scene,true);	
           }
         else
           loadOBJ(filename,one,g_obj_scene);
       }
    else if (strlwr(filename.ext()) == std::string("xml"))
      loadXML(filename,one,g_obj_scene);
    else if (filename.ext() != "")
      THROW_RUNTIME_ERROR("invalid scene type: "+strlwr(filename.ext()));

    /* initialize ray tracing core */
    init(g_rtcore.c_str());

    /* convert triangle meshes to subdiv meshes */
    if (g_only_subdivs)
      g_obj_scene.convert_to_subdiv();

    /* send model */
    set_scene(&g_obj_scene);
    
    /* benchmark mode */
    if (g_numBenchmarkFrames)
      renderBenchmark(outFilename);
    
    /* render to disk */
    if (outFilename.str() != "")
      renderToFile(outFilename);
    
    /* interactive mode */
    if (g_interactive) {
      initWindowState(argc,argv,tutorialName, g_width, g_height, g_fullscreen);
      enterWindowRunLoop(g_anim_mode);

    }

    return 0;
  }
Example #5
0
g1_movie_flow_class::advance_status g1_movie_flow_class::advance_movie_with_time()
{
	poll_scores();

	advance_status stat=PLAYING;

	if (t_cut_scenes)
	{
		i4_time_class now;
		sw32 md;

		do
		{
			md=now.milli_diff(frame_time);
			if (md>(1000/G1_MOVIE_HZ))
			{
				frame_time.add_milli((1000/G1_MOVIE_HZ));

				if (frame+1<current()->total_frames())
				{
					set_frame(frame+1);
				}
				else if (scene+1<t_cut_scenes)
				{
					do
					{
						set_scene(scene+1);
						start();
						set_frame(0);
						stat=NEXT_SCENE;

						if (scene+1==t_cut_scenes && current()->total_frames()==0)
						{
							stop();
							return DONE;
						}

					}
					while (current()->total_frames()==0);
				}
				else
				{
					stop();
					return DONE;
				}
			}
		}
		while (md>(1000/G1_MOVIE_HZ));
	}
	return stat;
}
Example #6
0
  /* main function in embree namespace */
  int main(int argc, char** argv) 
  {
    /* create stream for parsing */
    Ref<ParseStream> stream = new ParseStream(new CommandLineStream(argc, argv));

    /* parse command line */  
    parseCommandLine(stream, FileName());
    if (g_numThreads) 
      g_rtcore += ",threads=" + std::stringOf(g_numThreads);
    if (g_numBenchmarkFrames)
      g_rtcore += ",benchmark=1";

    /* initialize task scheduler */
#if !defined(__EXPORT_ALL_SYMBOLS__)
    TaskScheduler::create(g_numThreads);
#endif

    /* load scene */
    if (filename.str() != "")
      loadOBJ(filename,one,g_obj_scene);

    /* initialize ray tracing core */
    init(g_rtcore.c_str());

    /* send model */
    set_scene(&g_obj_scene);
    
    /* benchmark mode */
    if (g_numBenchmarkFrames)
      renderBenchmark(outFilename);
    
    /* render to disk */
    if (outFilename.str() != "")
      renderToFile(outFilename);
    
    /* interactive mode */
    if (g_interactive) {
      initWindowState(argc,argv,tutorialName, g_width, g_height, g_fullscreen);
      enterWindowRunLoop();
    }

    return 0;
  }
void KnotsViewer::set_knots_view(bool kv)
{
    bknotsview = kv;
    if(kv)
    {
        if(surfacedata==NULL)
            return;
        parameter2 = surfacedata->getparameter();

        /*if (parameter2==NULL)
        	return;*/
        B_parameter p(0,0,0,0);
        if(*parameter2==p)
            return;
        if (!parameter2->configure_knots())
            return;
        uknot=parameter2->getuknot();
        vknot=parameter2->getvknot();
        Bbox_3 box_3(0,0,0, 1, 1, 1);
        set_scene(box_3);
    }
    updateGL();
}
Example #8
0
Scene::Scene(GLFWwindow *window)
    : GameObject(nullptr)
    , camera_(nullptr)
    , window_(window) {
  set_scene(this);
}
Example #9
0
  /* main function in embree namespace */
  int main(int argc, char** argv) 
  {
    /* for best performance set FTZ and DAZ flags in MXCSR control and status register */
    _MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_ON);
    _MM_SET_DENORMALS_ZERO_MODE(_MM_DENORMALS_ZERO_ON);

    /* create stream for parsing */
    Ref<ParseStream> stream = new ParseStream(new CommandLineStream(argc, argv));

    /* parse command line */  
    parseCommandLine(stream, FileName());

    /* load default scene if none specified */
    if (filename.ext() == "") {
      FileName file = FileName::executableFolder() + FileName("models/cornell_box.ecs");
      parseCommandLine(new ParseStream(new LineCommentFilter(file, "#")), file.path());
    }

    /* configure number of threads */
    if (g_numThreads) 
      g_rtcore += ",threads=" + std::to_string((long long)g_numThreads);
    if (g_numBenchmarkFrames)
      g_rtcore += ",benchmark=1";

    g_rtcore += g_subdiv_mode;

    /* load scene */
    if (strlwr(filename.ext()) == std::string("obj"))
    {
      if (g_subdiv_mode != "") {
        std::cout << "enabling subdiv mode" << std::endl;
        loadOBJ(filename,one,g_obj_scene,true);	
      }
      else
        loadOBJ(filename,one,g_obj_scene);
    }
    else if (strlwr(filename.ext()) == std::string("xml"))
      loadXML(filename,one,g_obj_scene);
    else if (filename.ext() != "")
      THROW_RUNTIME_ERROR("invalid scene type: "+strlwr(filename.ext()));
    
    /* load keyframes */
    if (keyframeList.str() != "")
      loadKeyFrameAnimation(keyframeList);
    
    /* initialize ray tracing core */
    init(g_rtcore.c_str());

    /* set shader mode */
    switch (g_shader) {
    case SHADER_EYELIGHT: key_pressed(GLUT_KEY_F2); break;
    case SHADER_UV      : key_pressed(GLUT_KEY_F4); break;
    case SHADER_NG      : key_pressed(GLUT_KEY_F5); break;
    case SHADER_GEOMID  : key_pressed(GLUT_KEY_F6); break;
    case SHADER_GEOMID_PRIMID: key_pressed(GLUT_KEY_F7); break;
    };
    
    /* convert triangle meshes to subdiv meshes */
    if (g_only_subdivs)
      g_obj_scene.convert_to_subdiv();

    /* send model */
    set_scene(&g_obj_scene);
    
    /* send keyframes */
    if (g_keyframes.size())
      set_scene_keyframes(&*g_keyframes.begin(),g_keyframes.size());

    /* benchmark mode */
    if (g_numBenchmarkFrames)
      renderBenchmark(outFilename);
    
    /* render to disk */
    if (outFilename.str() != "")
      renderToFile(outFilename);
    
    /* interactive mode */
    if (g_interactive) {
      initWindowState(argc,argv,tutorialName, g_width, g_height, g_fullscreen);
      enterWindowRunLoop(g_anim_mode);

    }

    return 0;
  }