diff --git a/.hgignore b/.hgignore index 8110e0eac..42e5b7c4a 100644 --- a/.hgignore +++ b/.hgignore @@ -8,6 +8,7 @@ syntax: glob example examples/bbw/bbw_demo_selfcontained/* examples/bbw/bbw_demo_selfcontained.zip +examples/quicklook-mesh/Mesh.qlgenerator/* example_static example_header_only example1 diff --git a/VERSION.txt b/VERSION.txt index bd3f480d3..85fd8a889 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -3,4 +3,4 @@ # Anyone may increment Minor to indicate a small change. # Major indicates a large change or large number of changes (upload to website) # World indicates a substantial change or release -0.3.1 +0.3.2 diff --git a/examples/quicklook-mesh/Info.plist b/examples/quicklook-mesh/Info.plist index e8c0c1703..622ea996a 100755 --- a/examples/quicklook-mesh/Info.plist +++ b/examples/quicklook-mesh/Info.plist @@ -14,6 +14,7 @@ org.mesh org.obj org.off + org.wrl @@ -120,6 +121,25 @@ + + UTTypeConformsTo + + public.image + + UTTypeDescription + Virtual Reality Modeling Language + UTTypeIdentifier + org.wrl + UTTypeReferenceURL + http://en.wikipedia.org/wiki/VRML#WRL_File_Format + UTTypeTagSpecification + + public.filename-extension + + wrl + + + diff --git a/examples/quicklook-mesh/Makefile b/examples/quicklook-mesh/Makefile index b315d66d2..9f6bfe0bf 100644 --- a/examples/quicklook-mesh/Makefile +++ b/examples/quicklook-mesh/Makefile @@ -49,7 +49,7 @@ INC+=$(EIGEN3_INC) $(LIBIGL_INC) $(GLU_INC) $(MESA_INC) .PHONY: Mesh.qlgenerator: Mesh.qlgenerator/Contents/MacOS/ \ - Mesh.qlgenerator/Contents/Resources \ + Mesh.qlgenerator/Contents/Resources/ \ Mesh.qlgenerator/Contents/MacOS/Mesh \ Mesh.qlgenerator/Contents/Info.plist diff --git a/examples/quicklook-mesh/README b/examples/quicklook-mesh/README index 1be227394..db40b5e56 100644 --- a/examples/quicklook-mesh/README +++ b/examples/quicklook-mesh/README @@ -15,3 +15,11 @@ To install issue: This will copy the directory ./Mesh.qlgenerator/ into /Library/QuickLook/ and reload the Quicklook Manager (so that you see your changes in Finder). + += Dependencies = + +Install Mesa3D using macports. + + sudo port install mesa + +Then re-install mesa's GLU à la http://www.alecjacobson.com/weblog/?p=2827 diff --git a/examples/quicklook-mesh/src/GeneratePreviewForURL.m b/examples/quicklook-mesh/src/GeneratePreviewForURL.m index 0a1a4b161..323bcff11 100755 --- a/examples/quicklook-mesh/src/GeneratePreviewForURL.m +++ b/examples/quicklook-mesh/src/GeneratePreviewForURL.m @@ -47,7 +47,8 @@ OSStatus GeneratePreviewForURL( cs = cs_buf; } - render_to_buffer(cs,bwidth,bheight,buffer); + const float TRANSPARENT_BLACK[4] = {0,0,0,0}; + render_to_buffer(cs,TRANSPARENT_BLACK,bwidth,bheight,buffer); CGColorSpaceRef colorspace = CGColorSpaceCreateDeviceRGB(); CFDataRef rgbData = CFDataCreate(NULL, buffer, bwidth * bheight * 4); CGDataProviderRef provider = CGDataProviderCreateWithCFData(rgbData); diff --git a/examples/quicklook-mesh/src/GenerateThumbnailForURL.m b/examples/quicklook-mesh/src/GenerateThumbnailForURL.m index 2041078c3..1a4988aa5 100755 --- a/examples/quicklook-mesh/src/GenerateThumbnailForURL.m +++ b/examples/quicklook-mesh/src/GenerateThumbnailForURL.m @@ -114,7 +114,8 @@ OSStatus GenerateThumbnailForURL( CFStringGetCString(file, cs_buf, [(NSString*)file length]+1, kCFStringEncodingUTF8); cs = cs_buf; } - render_to_buffer(cs,bwidth,bheight,buffer); + const float OPAQUE_WHITE[4] = {1,1,1,1}; + render_to_buffer(cs,OPAQUE_WHITE,bwidth,bheight,buffer); CGColorSpaceRef colorspace = CGColorSpaceCreateDeviceRGB(); CFDataRef rgbData = CFDataCreate(NULL, buffer, bwidth * bheight * 4); CGDataProviderRef provider = CGDataProviderCreateWithCFData(rgbData); diff --git a/examples/quicklook-mesh/src/render_to_buffer.cpp b/examples/quicklook-mesh/src/render_to_buffer.cpp index 3c430c42c..a467e1520 100644 --- a/examples/quicklook-mesh/src/render_to_buffer.cpp +++ b/examples/quicklook-mesh/src/render_to_buffer.cpp @@ -13,6 +13,8 @@ extern "C" { #include #include #include +#include +#include #include #include #include @@ -34,6 +36,7 @@ static Eigen::MatrixXi F; static double bbd; static Eigen::Vector3d Vmean, Vmax,Vmin; static bool invert = false; +static float background_color[4] = {0,0,0,1}; // Small viewports struct for keeping track of size and camera info #define NUM_VIEWPORTS 6 @@ -243,7 +246,11 @@ void display() { using namespace std; using namespace igl; - glClearColor(0,0,0,0); + glClearColor( + background_color[0], + background_color[1], + background_color[2], + background_color[3]); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glEnable(GL_DEPTH_TEST); glEnable(GL_NORMALIZE); @@ -329,6 +336,7 @@ void display() bool render_to_buffer( const char * filename, + const float * background_color, const int width, const int height, GLubyte * buffer) @@ -338,16 +346,20 @@ bool render_to_buffer( using namespace Eigen; double ts = get_seconds(); + copy(background_color,background_color+4,::background_color); + // Read and prepare mesh // dirname, basename, extension and filename string d,b,ext,f; pathinfo(filename,d,b,ext,f); // Convert extension to lower case transform(ext.begin(), ext.end(), ext.begin(), ::tolower); + vector > vV,vN,vTC; + vector > vF,vFTC,vFN; if(ext == "obj") { // Convert extension to lower case - if(!igl::readOBJ(filename,V,F)) + if(!igl::readOBJ(filename,vV,vTC,vN,vF,vFTC,vFN)) { red(width,height,buffer); return false; @@ -355,7 +367,15 @@ bool render_to_buffer( }else if(ext == "off") { // Convert extension to lower case - if(!igl::readOFF(filename,V,F)) + if(!igl::readOFF(filename,vV,vF,vN)) + { + red(width,height,buffer); + return false; + } + }else if(ext == "wrl") + { + // Convert extension to lower case + if(!igl::readWRL(filename,vV,vF)) { red(width,height,buffer); return false; @@ -374,6 +394,15 @@ bool render_to_buffer( boundary_faces(T,F); } } + if(vV.size() > 0) + { + if(!list_to_matrix(vV,V)) + { + red(width,height,buffer); + return false; + } + triangulate(vF,F); + } cout<<"IO: "<<(get_seconds()-ts)<<"s"< +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +int main(int argc, char * argv[]) +{ + using namespace Eigen; + using namespace std; + using namespace igl; + //MatrixXd X; + //if(!readDMAT("X.dmat",X)) + //{ + // X = MatrixXd::Random(766443,2); + // for(int x = 0;x.rbr ASCII files for saving state of ReAntTweakBar
  • .tga Truevision TGA or TARGA image file format. IGLLIB supports only very basic reading and writing RGB/RGBA files without colormaps and (unverified) run-length compression.
  • .tgf ASCII files for representing control handle graphs
  • -
  • .xml XMLSerializer's file format containing the serialization of object data structures.
  • +
  • .wrl + VRML (Virtual Reality Modeling Language) file format for 3D scenes.
  • +
  • .xml XMLSerializer's file format containing the serialization of object data structures.
  • Triangle mesh file format performance