Example for creating a textured 3D plane using BIAS classes ,ThreeDOut
- Author
- MIP
#include <Utils/TriangleMesh.hh>
#include <Utils/ThreeDOut.hh>
#include <Base/Image/ImageIO.hh>
#include <Image/Camera.hh>
#include <iostream>
using namespace std;
using namespace BIAS;
void usage(char* name)
{
cout<<"usage:\n";
cout<<name<<" <texture> <projection> [outputFile]\n";
}
int main(int argc, char* argv[])
{
if(argc<2) {
usage(argv[0]);
return -1;
}
if(ImageIO::Load(argv[1], texture)!=0) {
cout<<"texture could not be loaded!\n";
usage(argv[0]);
return -1;
}
}
else if(P.
Load(argv[2])!=0) {
cout<<"Projection could not be loaded!\n";
usage(argv[0]);
return -1;
}
cout<<"meshing..."; cout.flush();
#ifdef QUAD_ONLY
mesh.GenerateImagePlane(P, texture);
#else
double downsamplingfactor = 8.0;
texture, 1.0, 1.0, downsamplingfactor);
#endif
cout<<"finished\n";
vrmlOut.AddTriangleMesh(mesh, "mesh_from_"+string(argv[1]),
argv[1], true);
cout<<"Writing VRML to ";
if(argc>3) {
cout<<argv[3]<<"... ";cout.flush();
vrmlOut.VRMLOut(argv[3]);
} else {
cout<<"DenseTriangleMesh.wrl... ";cout.flush();
vrmlOut.VRMLOut("DenseTriangleMesh.wrl");
}
cout<<"finished\n";
return 0;
}