updated embree, fixed cmakefiles, still some bugs in the tutorial example
This commit is contained in:
+40
-4
@@ -1,5 +1,5 @@
|
||||
// ======================================================================== //
|
||||
// Copyright 2009-2013 Intel Corporation //
|
||||
// Copyright 2009-2014 Intel Corporation //
|
||||
// //
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); //
|
||||
// you may not use this file except in compliance with the License. //
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
#include "tutorial/tutorial.h"
|
||||
#include "sys/taskscheduler.h"
|
||||
#include "image/image.h"
|
||||
|
||||
namespace embree
|
||||
{
|
||||
@@ -24,12 +25,13 @@ namespace embree
|
||||
|
||||
/* configuration */
|
||||
static std::string g_rtcore = "";
|
||||
static size_t g_numThreads = 0;
|
||||
|
||||
/* output settings */
|
||||
static size_t g_width = 512;
|
||||
static size_t g_height = 512;
|
||||
static bool g_fullscreen = false;
|
||||
static size_t g_numThreads = 0;
|
||||
static FileName outFilename = "";
|
||||
|
||||
static void parseCommandLine(Ref<ParseStream> cin, const FileName& path)
|
||||
{
|
||||
@@ -61,6 +63,10 @@ namespace embree
|
||||
else if (tag == "-fullscreen")
|
||||
g_fullscreen = true;
|
||||
|
||||
/* output filename */
|
||||
else if (tag == "-o")
|
||||
outFilename = cin->getFileName();
|
||||
|
||||
/* rtcore configuration */
|
||||
else if (tag == "-rtcore")
|
||||
g_rtcore = cin->getString();
|
||||
@@ -78,9 +84,30 @@ namespace embree
|
||||
}
|
||||
}
|
||||
|
||||
void renderToFile(const FileName& fileName)
|
||||
{
|
||||
resize(g_width,g_height);
|
||||
AffineSpace3fa pixel2world = g_camera.pixel2world(g_width,g_height);
|
||||
|
||||
render(0.0f,
|
||||
pixel2world.l.vx,
|
||||
pixel2world.l.vy,
|
||||
pixel2world.l.vz,
|
||||
pixel2world.p);
|
||||
|
||||
void* ptr = map();
|
||||
Ref<Image> image = new Image4c(g_width, g_height, (Col4c*)ptr);
|
||||
storeImage(image, fileName);
|
||||
unmap();
|
||||
}
|
||||
|
||||
/* main function in embree namespace */
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
/* set default camera */
|
||||
g_camera.from = Vec3fa(1.5f,1.5f,-1.5f);
|
||||
g_camera.to = Vec3fa(0.0f,0.0f,0.0f);
|
||||
|
||||
/* create stream for parsing */
|
||||
Ref<ParseStream> stream = new ParseStream(new CommandLineStream(argc, argv));
|
||||
|
||||
@@ -90,16 +117,25 @@ namespace embree
|
||||
g_rtcore += ",threads=" + std::stringOf(g_numThreads);
|
||||
|
||||
/* initialize task scheduler */
|
||||
#if !defined(__EXPORT_ALL_SYMBOLS__)
|
||||
#if !defined(RTCORE_EXPORT_ALL_SYMBOLS)
|
||||
TaskScheduler::create(g_numThreads);
|
||||
#endif
|
||||
|
||||
/* initialize ray tracing core */
|
||||
init(g_rtcore.c_str());
|
||||
|
||||
/* render to disk */
|
||||
if (outFilename.str() != "") {
|
||||
renderToFile(outFilename);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* initialize GLUT */
|
||||
initGlut(tutorialName,g_width,g_height,g_fullscreen,true);
|
||||
initWindowState(argc,argv,tutorialName, g_width, g_height, g_fullscreen);
|
||||
|
||||
/* enter the GLUT run loop */
|
||||
enterWindowRunLoop();
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user