Commit 404daac7 authored by Pierre Kraemer's avatar Pierre Kraemer

Merge cgogn:~vanhoey/CGoGN

parents 74b5d94e 132c1266
......@@ -76,7 +76,37 @@ bool exportTrian(typename PFP::MAP& map, const typename PFP::TVEC3& position, ch
* @return true
*/
template <typename PFP>
bool exportPlyPTMgeneric(typename PFP::MAP& map, const char* filename, const typename PFP::TVEC3& position, const FunctorSelect& good = allDarts) ;
bool exportPlySLFgeneric(typename PFP::MAP& map, const typename PFP::TVEC3& position, const char* filename, const FunctorSelect& good = allDarts) ;
/**
* export the map into a PLYPTMgeneric file (K. Vanhoey generic format).
*
* exports position + any attribute named : "frame_T" (frame tangent : VEC3), "frame_B" (frame binormal : VEC3), "frame_N" (frame normal : VEC3),
* "colorPTM_a<i> : VEC3" (coefficient number i of the 3 polynomials - one per channel - ; the max i depends on the degree of the PTM polynomial),
* "errL2 : REAL" (L2 fitting error), "errLmax : REAL" (maximal fitting error), "stdDev : REAL" (standard deviation of the L2 fitting errors).
*
* @param map map to be exported
* @param filename filename of ply file
* @param position the position container
* @return true
*/
template <typename PFP>
bool exportPlySLFgenericBin(typename PFP::MAP& map, const typename PFP::TVEC3& position, const char* filename, const FunctorSelect& good = allDarts) ;
/**
* export the map into a PLYSLF file (K. Vanhoey generic format).
*
* exports position + any attribute named : "frame_T" (frame tangent : VEC3), "frame_B" (frame binormal : VEC3), "frame_N" (frame normal : VEC3),
* "SLF_<i> : VEC3" (coefficient number i of the 3 - one per channel - ; the max i is nbCoefs),
*
* @param map map to be exported
* @param filename filename of ply file
* @param position the position container
* @param nbCoefs the number of coefficients of the representation
* @return true
*/
template <typename PFP>
bool exportPlyPTMgeneric(typename PFP::MAP& map, const typename PFP::TVEC3& position, const char* filename, const FunctorSelect& good = allDarts) ;
/**
* export the map into a PLYPTMgeneric file (K. Vanhoey generic format)
......@@ -88,7 +118,7 @@ bool exportPlyPTMgeneric(typename PFP::MAP& map, const char* filename, const typ
* @return true
*/
template <typename PFP>
bool exportPLYPTM(typename PFP::MAP& map, const char* filename, const typename PFP::TVEC3& position, const typename PFP::TVEC3 frame[3], const typename PFP::TVEC3 colorPTM[6], const FunctorSelect& good) ;
bool exportPLYPTM(typename PFP::MAP& map, const char* filename, const typename PFP::TVEC3& position, const typename PFP::TVEC3 frame[3], const typename PFP::TVEC3 colorPTM[6], const FunctorSelect& good = allDarts) ;
} // namespace Export
......
This diff is collapsed.
......@@ -52,7 +52,7 @@ namespace Import
namespace ImportSurfacique
{
enum ImportType { UNKNOWNSURFACE, TRIAN, TRIANBGZ, PLY, PLYPTM, PLYPTMgeneric, OFF, OBJ, VRML, AHEM };
enum ImportType { UNKNOWNSURFACE, TRIAN, TRIANBGZ, MESHBIN, PLY, PLYPTM, PLYSLFgeneric, PLYSLFgenericBin, OFF, OBJ, VRML, AHEM };
}
namespace ImportVolumique
......@@ -109,12 +109,16 @@ public:
bool importOff(const std::string& filename, std::vector<std::string>& attrNames);
bool importMeshBin(const std::string& filename, std::vector<std::string>& attrNames);
bool importObj(const std::string& filename, std::vector<std::string>& attrNames);
bool importPly(const std::string& filename, std::vector<std::string>& attrNames);
bool importPlyPTM(const std::string& filename, std::vector<std::string>& attrNames);
bool importPlyPTMgeneric(const std::string& filename, std::vector<std::string>& attrNames);
bool importPlySLFgeneric(const std::string& filename, std::vector<std::string>& attrNames);
bool importPlySLFgenericBin(const std::string& filename, std::vector<std::string>& attrNames);
#ifdef WITH_ASSIMP
bool importASSIMP(const std::string& filename, std::vector<std::string>& attrNames);
#endif
......
......@@ -47,7 +47,10 @@ public:
void vertexNormal(int i, VEC& N) { N[0] = vlist[i]->nx; N[1] = vlist[i]->ny; N[2] = vlist[i]->nz;}
template <typename VEC>
void vertexColor(int i, VEC& C) { C[0] = vlist[i]->r; C[1] = vlist[i]->g; C[2] = vlist[i]->b;}
void vertexColorUint8(int i, VEC& C) { C[0] = vlist[i]->red; C[1] = vlist[i]->green; C[2] = vlist[i]->blue;}
template <typename VEC>
void vertexColorFloat32(int i, VEC& C) { C[0] = vlist[i]->r; C[1] = vlist[i]->g; C[2] = vlist[i]->b;}
int nbVertices() { return nverts;}
......@@ -62,7 +65,9 @@ public:
/**
* each vertex has a color vector
*/
bool hasColors() { return per_vertex_color!=0;}
bool hasColors() { return hasColorsUint8() || hasColorsFloat32() ;}
bool hasColorsUint8() { return per_vertex_color_uint8 != 0 ;}
bool hasColorsFloat32() { return per_vertex_color_float32 != 0 ;}
/**
* get the number of edges of a face
......@@ -88,6 +93,7 @@ protected:
typedef struct Vertex {
float x,y,z;
float r,g,b;
unsigned char red,green,blue;
float nx,ny,nz;
void *other_props; /* other properties */
} Vertex;
......@@ -113,7 +119,7 @@ protected:
PlyOtherProp *vert_other,*face_other;
int per_vertex_color;
int per_vertex_color_float32, per_vertex_color_uint8 ;
int has_normals;
};
......
......@@ -402,7 +402,7 @@ public:
*/
std::string selectFileSave(const std::string& title = "open file", const std::string& dir = ".", const std::string& filters = "all (*.*)");
void snapshot(const QString& filename);
void snapshot(const QString& filename, const char* format = 0, const int& quality = -1);
public slots:
virtual void cb_New() { std::cerr << "callback not implemented" << std::endl; }
......
......@@ -37,6 +37,9 @@ PlyProperty PlyImportData::vert_props[] = { /* list of property information for
{(char*) "x", PLY_Float32, PLY_Float32, offsetof(Vertex,x), 0, 0, 0, 0},
{(char*) "y", PLY_Float32, PLY_Float32, offsetof(Vertex,y), 0, 0, 0, 0},
{(char*) "z", PLY_Float32, PLY_Float32, offsetof(Vertex,z), 0, 0, 0, 0},
{(char*) "red", PLY_Uint8, PLY_Uint8, offsetof(Vertex,red), 0, 0, 0, 0},
{(char*) "green", PLY_Uint8, PLY_Uint8, offsetof(Vertex,green), 0, 0, 0, 0},
{(char*) "blue", PLY_Uint8, PLY_Uint8, offsetof(Vertex,blue), 0, 0, 0, 0},
{(char*) "r", PLY_Float32, PLY_Float32, offsetof(Vertex,r), 0, 0, 0, 0},
{(char*) "g", PLY_Float32, PLY_Float32, offsetof(Vertex,g), 0, 0, 0, 0},
{(char*) "b", PLY_Float32, PLY_Float32, offsetof(Vertex,b), 0, 0, 0, 0},
......@@ -57,7 +60,8 @@ PlyImportData::PlyImportData():
flist(NULL),
vert_other(NULL),
face_other(NULL),
per_vertex_color(0),
per_vertex_color_uint8(0),
per_vertex_color_float32(0),
has_normals(0)
{
}
......@@ -126,28 +130,40 @@ bool PlyImportData::read_file(const std::string& filename)
{
PlyProperty *prop;
prop = in_ply->elems[i]->props[j];
if (equal_strings ((char*) "r", prop->name)) {
if (equal_strings ((char*) "red", prop->name)) {
setup_property_ply (in_ply, &vert_props[3]);
per_vertex_color = 1;
per_vertex_color_uint8 = 1;
}
if (equal_strings ((char*) "g", prop->name)) {
if (equal_strings ((char*) "green", prop->name)) {
setup_property_ply (in_ply, &vert_props[4]);
per_vertex_color = 1;
per_vertex_color_uint8 = 1;
}
if (equal_strings ((char*) "b", prop->name)) {
if (equal_strings ((char*) "blue", prop->name)) {
setup_property_ply (in_ply, &vert_props[5]);
per_vertex_color = 1;
per_vertex_color_uint8 = 1;
}
if (equal_strings ((char*) "nx", prop->name)) {
if (equal_strings ((char*) "r", prop->name)) {
setup_property_ply (in_ply, &vert_props[6]);
per_vertex_color_float32 = 1;
}
if (equal_strings ((char*) "g", prop->name)) {
setup_property_ply (in_ply, &vert_props[7]);
per_vertex_color_float32 = 1;
}
if (equal_strings ((char*) "b", prop->name)) {
setup_property_ply (in_ply, &vert_props[8]);
per_vertex_color_float32 = 1;
}
if (equal_strings ((char*) "nx", prop->name)) {
setup_property_ply (in_ply, &vert_props[9]);
has_normals = 1;
}
if (equal_strings ((char*) "ny", prop->name)) {
setup_property_ply (in_ply, &vert_props[7]);
setup_property_ply (in_ply, &vert_props[10]);
has_normals = 1;
}
if (equal_strings ((char*) "nz", prop->name)) {
setup_property_ply (in_ply, &vert_props[8]);
setup_property_ply (in_ply, &vert_props[11]);
has_normals = 1;
}
}
......
......@@ -514,10 +514,10 @@ void SimpleQT::cb_about()
QMessageBox::about(this, tr("About App"), m_helpString.c_str());
}
void SimpleQT::snapshot(const QString& filename)
void SimpleQT::snapshot(const QString& filename, const char* format, const int& quality)
{
QImage im = m_glWidget->grabFrameBuffer(false);
im.save(filename);
im.save(filename, format, quality);
}
void SimpleQT::setGeometry(int x, int y, int w, int h)
......
......@@ -117,7 +117,7 @@ void GLWidget::recalcModelView()
oglTranslate(m_obj_pos[0], m_obj_pos[1], m_obj_pos[2]);
// ajout transformation
// m_cbs->modelViewMatrix() *=m_cbs->transfoMatrix();
// m_cbs->modelViewMatrix() *= m_cbs->transfoMatrix();
newModel = 0;
......@@ -487,6 +487,7 @@ float GLWidget::getWidthInWorld(unsigned int pixel_width, const Geom::Vec3f& cen
void GLWidget::transfoRotate(float angle, float x, float y, float z)
{
m_cbs->transfoMatrix() = glm::rotate( m_cbs->transfoMatrix(), angle, glm::vec3(x,y,z));
recalcModelView() ;
}
void GLWidget::transfoTranslate(float tx, float ty, float tz)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment