mirror of
https://github.com/lucaspalomodevelop/meshlab.git
synced 2026-03-14 16:44:37 +00:00
raster_model file
This commit is contained in:
parent
05369f1668
commit
3b87eecb7e
@ -17,6 +17,8 @@ set(SOURCES
|
||||
mesh_data_structures/cmesh.cpp
|
||||
mesh_data_structures/mesh_document.cpp
|
||||
mesh_data_structures/mesh_model.cpp
|
||||
mesh_data_structures/raster_model.cpp
|
||||
mesh_data_structures/render_raster.cpp
|
||||
GLExtensionsManager.cpp
|
||||
GLLogStream.cpp
|
||||
filterscript.cpp
|
||||
@ -44,6 +46,8 @@ set(HEADERS
|
||||
mesh_data_structures/cmesh.h
|
||||
mesh_data_structures/mesh_document.h
|
||||
mesh_data_structures/mesh_model.h
|
||||
mesh_data_structures/raster_model.h
|
||||
mesh_data_structures/render_raster.h
|
||||
GLExtensionsManager.h
|
||||
GLLogStream.h
|
||||
filterscript.h
|
||||
|
||||
@ -56,6 +56,8 @@ HEADERS += \
|
||||
mesh_data_structures/cmesh.h \
|
||||
mesh_data_structures/mesh_model.h \
|
||||
mesh_data_structures/mesh_document.h \
|
||||
mesh_data_structures/raster_model.h \
|
||||
mesh_data_structures/render_raster.h \
|
||||
pluginmanager.h \
|
||||
mlexception.h \
|
||||
mlapplication.h \
|
||||
@ -77,6 +79,8 @@ SOURCES += \
|
||||
mesh_data_structures/cmesh.cpp \
|
||||
mesh_data_structures/mesh_model.cpp \
|
||||
mesh_data_structures/mesh_document.cpp \
|
||||
mesh_data_structures/raster_model.cpp \
|
||||
mesh_data_structures/render_raster.cpp \
|
||||
pluginmanager.cpp \
|
||||
mlapplication.cpp \
|
||||
searcher.cpp \
|
||||
|
||||
@ -67,6 +67,59 @@ QString NameDisambiguator(QList<LayerElement*> &elemList, QString meshLabel )
|
||||
return newName;
|
||||
}
|
||||
|
||||
MeshDocumentStateData::MeshDocumentStateData()
|
||||
:_lock(QReadWriteLock::Recursive)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
MeshDocumentStateData::~MeshDocumentStateData()
|
||||
{
|
||||
QWriteLocker locker(&_lock);
|
||||
_existingmeshesbeforeoperation.clear();
|
||||
}
|
||||
|
||||
void MeshDocumentStateData::create(MeshDocument& md)
|
||||
{
|
||||
QWriteLocker locker(&_lock);
|
||||
for (int ii = 0; ii < md.meshList.size(); ++ii)
|
||||
{
|
||||
MeshModel* mm = md.meshList[ii];
|
||||
if (mm != NULL)
|
||||
insert(mm->id(), MeshModelStateData(mm->dataMask(), mm->cm.VN(), mm->cm.FN(), mm->cm.EN()));
|
||||
}
|
||||
}
|
||||
|
||||
QMap<int, MeshModelStateData>::iterator MeshDocumentStateData::insert(const int key, const MeshModelStateData & value)
|
||||
{
|
||||
QWriteLocker locker(&_lock);
|
||||
return _existingmeshesbeforeoperation.insert(key,value);
|
||||
}
|
||||
|
||||
QMap<int, MeshModelStateData>::iterator MeshDocumentStateData::find(const int key)
|
||||
{
|
||||
QReadLocker locker(&_lock);
|
||||
return _existingmeshesbeforeoperation.find(key);
|
||||
}
|
||||
|
||||
QMap<int, MeshModelStateData>::iterator MeshDocumentStateData::begin()
|
||||
{
|
||||
QReadLocker locker(&_lock);
|
||||
return _existingmeshesbeforeoperation.begin();
|
||||
}
|
||||
|
||||
QMap<int, MeshModelStateData>::iterator MeshDocumentStateData::end()
|
||||
{
|
||||
QReadLocker locker(&_lock);
|
||||
return _existingmeshesbeforeoperation.end();
|
||||
}
|
||||
|
||||
void MeshDocumentStateData::clear()
|
||||
{
|
||||
QWriteLocker locker(&_lock);
|
||||
_existingmeshesbeforeoperation.clear();
|
||||
}
|
||||
|
||||
MeshDocument::MeshDocument()
|
||||
{
|
||||
meshIdCounter=0;
|
||||
|
||||
@ -25,6 +25,25 @@
|
||||
#define MESH_DOCUMENT_H
|
||||
|
||||
#include "mesh_model.h"
|
||||
#include "raster_model.h"
|
||||
|
||||
class MeshDocumentStateData
|
||||
{
|
||||
public:
|
||||
MeshDocumentStateData();
|
||||
~MeshDocumentStateData();
|
||||
|
||||
void create(MeshDocument& md);
|
||||
QMap<int, MeshModelStateData>::iterator insert(const int key, const MeshModelStateData & value);
|
||||
QMap<int, MeshModelStateData>::iterator find(const int key);
|
||||
QMap<int, MeshModelStateData>::iterator begin();
|
||||
QMap<int, MeshModelStateData>::iterator end();
|
||||
void clear();
|
||||
|
||||
private:
|
||||
mutable QReadWriteLock _lock;
|
||||
QMap<int, MeshModelStateData> _existingmeshesbeforeoperation;
|
||||
};
|
||||
|
||||
class MeshDocument : public QObject
|
||||
{
|
||||
|
||||
@ -132,63 +132,12 @@ int MeshModel::io2mm(int single_iobit)
|
||||
} ;
|
||||
}
|
||||
|
||||
Plane::Plane(const Plane& pl)
|
||||
{
|
||||
semantic = pl.semantic;
|
||||
fullPathFileName = pl.fullPathFileName;
|
||||
image = QImage(pl.image);
|
||||
}
|
||||
|
||||
Plane::Plane(const QString& pathName, const int _semantic)
|
||||
{
|
||||
semantic =_semantic;
|
||||
fullPathFileName = pathName;
|
||||
|
||||
image = QImage(pathName);
|
||||
}
|
||||
|
||||
RasterModel::RasterModel(MeshDocument *parent, QString _rasterName)
|
||||
{
|
||||
_id=parent->newRasterId();
|
||||
par = parent;
|
||||
this->_label= std::move(_rasterName);
|
||||
visible=true;
|
||||
}
|
||||
|
||||
RasterModel::RasterModel()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
MeshLabRenderRaster::MeshLabRenderRaster()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
MeshLabRenderRaster::MeshLabRenderRaster( const MeshLabRenderRaster& rm )
|
||||
:shot(rm.shot)
|
||||
{
|
||||
for(QList<Plane*>::const_iterator it = rm.planeList.begin();it != rm.planeList.end();++it)
|
||||
{
|
||||
planeList.push_back(new Plane(**it));
|
||||
if (rm.currentPlane == *it)
|
||||
currentPlane = planeList[planeList.size() - 1];
|
||||
}
|
||||
}
|
||||
|
||||
void MeshLabRenderRaster::addPlane(Plane *plane)
|
||||
{
|
||||
planeList.append(plane);
|
||||
currentPlane = plane;
|
||||
}
|
||||
|
||||
MeshLabRenderRaster::~MeshLabRenderRaster()
|
||||
{
|
||||
currentPlane = NULL;
|
||||
for(int ii = 0;ii < planeList.size();++ii)
|
||||
delete planeList[ii];
|
||||
}
|
||||
|
||||
void MeshModelState::create(int _mask, MeshModel* _m)
|
||||
{
|
||||
@ -473,56 +422,3 @@ int MeshModel::dataMask() const
|
||||
{
|
||||
return currentDataMask;
|
||||
}
|
||||
|
||||
MeshDocumentStateData::MeshDocumentStateData()
|
||||
:_lock(QReadWriteLock::Recursive)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
MeshDocumentStateData::~MeshDocumentStateData()
|
||||
{
|
||||
QWriteLocker locker(&_lock);
|
||||
_existingmeshesbeforeoperation.clear();
|
||||
}
|
||||
|
||||
void MeshDocumentStateData::create(MeshDocument& md)
|
||||
{
|
||||
QWriteLocker locker(&_lock);
|
||||
for (int ii = 0; ii < md.meshList.size(); ++ii)
|
||||
{
|
||||
MeshModel* mm = md.meshList[ii];
|
||||
if (mm != NULL)
|
||||
insert(mm->id(), MeshModelStateData(mm->dataMask(), mm->cm.VN(), mm->cm.FN(), mm->cm.EN()));
|
||||
}
|
||||
}
|
||||
|
||||
QMap<int, MeshModelStateData>::iterator MeshDocumentStateData::insert(const int key, const MeshModelStateData & value)
|
||||
{
|
||||
QWriteLocker locker(&_lock);
|
||||
return _existingmeshesbeforeoperation.insert(key,value);
|
||||
}
|
||||
|
||||
QMap<int, MeshModelStateData>::iterator MeshDocumentStateData::find(const int key)
|
||||
{
|
||||
QReadLocker locker(&_lock);
|
||||
return _existingmeshesbeforeoperation.find(key);
|
||||
}
|
||||
|
||||
QMap<int, MeshModelStateData>::iterator MeshDocumentStateData::begin()
|
||||
{
|
||||
QReadLocker locker(&_lock);
|
||||
return _existingmeshesbeforeoperation.begin();
|
||||
}
|
||||
|
||||
QMap<int, MeshModelStateData>::iterator MeshDocumentStateData::end()
|
||||
{
|
||||
QReadLocker locker(&_lock);
|
||||
return _existingmeshesbeforeoperation.end();
|
||||
}
|
||||
|
||||
void MeshDocumentStateData::clear()
|
||||
{
|
||||
QWriteLocker locker(&_lock);
|
||||
_existingmeshesbeforeoperation.clear();
|
||||
}
|
||||
|
||||
@ -227,221 +227,6 @@ public:
|
||||
};// end class MeshModel
|
||||
|
||||
|
||||
/*
|
||||
Plane Class
|
||||
the base class for a registered image that contains the path, the semantic and the data of the image
|
||||
*/
|
||||
|
||||
class Plane
|
||||
{
|
||||
public:
|
||||
|
||||
enum PlaneSemantic
|
||||
{
|
||||
NONE = 0x0000,
|
||||
RGBA = 0x0001,
|
||||
MASK_UB = 0x0002,
|
||||
MASK_F = 0x0004,
|
||||
DEPTH_F = 0x0008,
|
||||
EXTRA00_F = 0x0100,
|
||||
EXTRA01_F = 0x0200,
|
||||
EXTRA02_F = 0x0400,
|
||||
EXTRA03_F = 0x0800,
|
||||
EXTRA00_RGBA = 0x1000,
|
||||
EXTRA01_RGBA = 0x2000,
|
||||
EXTRA02_RGBA = 0x4000,
|
||||
EXTRA03_RGBA = 0x8000
|
||||
};
|
||||
|
||||
int semantic;
|
||||
QString fullPathFileName;
|
||||
QImage image;
|
||||
QImage thumb;
|
||||
float *buf;
|
||||
|
||||
bool IsInCore() { return !image.isNull(); }
|
||||
void Load();
|
||||
void Discard(); //discard the loaded image freeing the mem.
|
||||
|
||||
/// The whole full path name of the mesh
|
||||
const QString fullName() const {return fullPathFileName;}
|
||||
/// just the name of the file
|
||||
const QString shortName() const { return QFileInfo(fullPathFileName).fileName(); }
|
||||
|
||||
Plane(const Plane& pl);
|
||||
Plane(const QString& pathName, const int _semantic);
|
||||
|
||||
}; //end class Plane
|
||||
|
||||
|
||||
class MeshLabRenderRaster
|
||||
{
|
||||
public:
|
||||
MeshLabRenderRaster();
|
||||
MeshLabRenderRaster(const MeshLabRenderRaster& rm);
|
||||
~MeshLabRenderRaster();
|
||||
|
||||
Shotm shot;
|
||||
|
||||
///The list of the registered images
|
||||
QList<Plane *> planeList;
|
||||
Plane *currentPlane;
|
||||
|
||||
void addPlane(Plane * plane);
|
||||
};
|
||||
|
||||
/*
|
||||
RasterModel Class
|
||||
The base class for keeping a set of "registered" images (e.g. images that can be projected onto a 3D space).
|
||||
Each Raster model is composed by a list of registered images, each image with its own "semantic" (color, depth, normals, quality, masks)
|
||||
and with all the images sharing the same shot.
|
||||
*/
|
||||
|
||||
class RasterModel : public MeshLabRenderRaster
|
||||
{
|
||||
public:
|
||||
RasterModel();
|
||||
MeshDocument* par;
|
||||
|
||||
private:
|
||||
int _id;
|
||||
QString _label;
|
||||
|
||||
public:
|
||||
bool visible;
|
||||
inline int id() const {return _id;}
|
||||
|
||||
RasterModel(MeshDocument *parent, QString _rasterName=QString());
|
||||
|
||||
void setLabel(QString newLabel) {_label = newLabel;}
|
||||
|
||||
const QString label() const {
|
||||
if(!_label.isEmpty()) return _label;
|
||||
if(!planeList.empty()) return planeList.first()->shortName();
|
||||
return "Error!";
|
||||
}
|
||||
|
||||
enum RasterElement
|
||||
{
|
||||
RM_NONE = 0x00000000,
|
||||
RM_ALL = 0xffffffff
|
||||
};
|
||||
};// end class RasterModel
|
||||
|
||||
//class RenderMode
|
||||
//{
|
||||
//private:
|
||||
// QList<QAction*> declist;
|
||||
//
|
||||
//public:
|
||||
// vcg::GLW::DrawMode drawMode;
|
||||
// vcg::GLW::ColorMode colorMode;
|
||||
// vcg::GLW::TextureMode textureMode;
|
||||
//
|
||||
//
|
||||
//
|
||||
// MLRenderingData::PRIMITIVE_MODALITY_MASK pmmask;
|
||||
// MLRenderingData::RendAtts atts;
|
||||
//
|
||||
// bool lighting;
|
||||
// bool backFaceCull;
|
||||
// bool doubleSideLighting;
|
||||
// bool fancyLighting;
|
||||
//
|
||||
// RenderMode(vcg::GLW::DrawMode dm) // :declist()
|
||||
// {
|
||||
// Init();
|
||||
// drawMode=dm;
|
||||
// }
|
||||
//
|
||||
// RenderMode() { Init(); }
|
||||
//
|
||||
// void Init()
|
||||
// {
|
||||
// drawMode = vcg::GLW::DMSmooth;
|
||||
// colorMode = vcg::GLW::CMNone;
|
||||
// textureMode = vcg::GLW::TMNone;
|
||||
//
|
||||
// pmmask = MLRenderingData::PR_SOLID;
|
||||
// atts = MLRenderingData::RendAtts();
|
||||
// atts[MLRenderingData::ATT_NAMES::ATT_VERTPOSITION] = true;
|
||||
// atts[MLRenderingData::ATT_NAMES::ATT_VERTNORMAL] = true;
|
||||
//
|
||||
// lighting = true;
|
||||
// backFaceCull = false;
|
||||
// doubleSideLighting = false;
|
||||
// fancyLighting = false;
|
||||
// }
|
||||
//
|
||||
// inline void addPrimitiveModality(MLRenderingData::PRIMITIVE_MODALITY addedpm)
|
||||
// {
|
||||
// pmmask = pmmask | addedpm;
|
||||
// }
|
||||
//
|
||||
// inline void removePrimitiveModality(MLRenderingData::PRIMITIVE_MODALITY removedpm)
|
||||
// {
|
||||
// pmmask = pmmask & (~removedpm);
|
||||
// }
|
||||
//
|
||||
// inline void setDrawMode(const vcg::GLW::DrawMode dm)
|
||||
// {
|
||||
// drawMode = dm;
|
||||
// }
|
||||
//
|
||||
// inline void setColorMode(const vcg::GLW::ColorMode cm)
|
||||
// {
|
||||
// colorMode = cm;
|
||||
// }
|
||||
//
|
||||
// inline void setTextureMode(const vcg::GLW::TextureMode tm)
|
||||
// {
|
||||
// textureMode = tm;
|
||||
// }
|
||||
//
|
||||
// inline void setLighting(const bool ison)
|
||||
// {
|
||||
// lighting = ison;
|
||||
// }
|
||||
//
|
||||
// inline void setBackFaceCull(const bool ison)
|
||||
// {
|
||||
// backFaceCull = ison;
|
||||
// }
|
||||
//
|
||||
// inline void setDoubleFaceLighting(const bool ison)
|
||||
// {
|
||||
// doubleSideLighting = ison;
|
||||
// }
|
||||
//
|
||||
// inline void setFancyLighting(const bool ison)
|
||||
// {
|
||||
// fancyLighting = ison;
|
||||
// }
|
||||
//
|
||||
// inline QList<QAction*>& decoratorList()
|
||||
// {
|
||||
// return declist;
|
||||
// }
|
||||
//
|
||||
// static RenderMode defaultRenderingAtts();
|
||||
//}; // end class RenderMode
|
||||
//Q_DECLARE_METATYPE(RenderMode)
|
||||
|
||||
//class RasterModelState : public QObject
|
||||
//{
|
||||
// Q_OBJECT
|
||||
//public:
|
||||
// MeshLabRenderState();
|
||||
// ~MeshLabRenderState();
|
||||
//
|
||||
//private:
|
||||
// //for quickness I added a RasterModel, but should be something less.
|
||||
// QMap<int,RasterModel*> _rendermap;
|
||||
// QReadWriteLock _mutdoc;
|
||||
//};
|
||||
//class FilterScript;
|
||||
|
||||
|
||||
struct MeshModelStateData
|
||||
{
|
||||
int _mask;
|
||||
@ -454,24 +239,6 @@ struct MeshModelStateData
|
||||
{}
|
||||
};
|
||||
|
||||
class MeshDocumentStateData
|
||||
{
|
||||
public:
|
||||
MeshDocumentStateData();
|
||||
~MeshDocumentStateData();
|
||||
|
||||
void create(MeshDocument& md);
|
||||
QMap<int, MeshModelStateData>::iterator insert(const int key, const MeshModelStateData & value);
|
||||
QMap<int, MeshModelStateData>::iterator find(const int key);
|
||||
QMap<int, MeshModelStateData>::iterator begin();
|
||||
QMap<int, MeshModelStateData>::iterator end();
|
||||
void clear();
|
||||
|
||||
private:
|
||||
mutable QReadWriteLock _lock;
|
||||
QMap<int, MeshModelStateData> _existingmeshesbeforeoperation;
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
A class designed to save partial aspects of the state of a mesh, such as vertex colors, current selections, vertex positions
|
||||
|
||||
39
src/common/mesh_data_structures/raster_model.cpp
Normal file
39
src/common/mesh_data_structures/raster_model.cpp
Normal file
@ -0,0 +1,39 @@
|
||||
/****************************************************************************
|
||||
* MeshLab o o *
|
||||
* Visual and Computer Graphics Library o o *
|
||||
* _ O _ *
|
||||
* Copyright(C) 2004-2020 \/)\/ *
|
||||
* Visual Computing Lab /\/| *
|
||||
* ISTI - Italian National Research Council | *
|
||||
* \ *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt) *
|
||||
* for more details. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
|
||||
#include "raster_model.h"
|
||||
|
||||
#include "mesh_document.h"
|
||||
|
||||
RasterModel::RasterModel(MeshDocument *parent, QString _rasterName)
|
||||
{
|
||||
_id=parent->newRasterId();
|
||||
par = parent;
|
||||
this->_label= std::move(_rasterName);
|
||||
visible=true;
|
||||
}
|
||||
|
||||
RasterModel::RasterModel()
|
||||
{
|
||||
|
||||
}
|
||||
69
src/common/mesh_data_structures/raster_model.h
Normal file
69
src/common/mesh_data_structures/raster_model.h
Normal file
@ -0,0 +1,69 @@
|
||||
/****************************************************************************
|
||||
* MeshLab o o *
|
||||
* Visual and Computer Graphics Library o o *
|
||||
* _ O _ *
|
||||
* Copyright(C) 2004-2020 \/)\/ *
|
||||
* Visual Computing Lab /\/| *
|
||||
* ISTI - Italian National Research Council | *
|
||||
* \ *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt) *
|
||||
* for more details. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef RASTER_MODEL_H
|
||||
#define RASTER_MODEL_H
|
||||
|
||||
#include "render_raster.h"
|
||||
|
||||
class MeshDocument;
|
||||
|
||||
/*
|
||||
RasterModel Class
|
||||
The base class for keeping a set of "registered" images (e.g. images that can be projected onto a 3D space).
|
||||
Each Raster model is composed by a list of registered images, each image with its own "semantic" (color, depth, normals, quality, masks)
|
||||
and with all the images sharing the same shot.
|
||||
*/
|
||||
|
||||
class RasterModel : public MeshLabRenderRaster
|
||||
{
|
||||
public:
|
||||
RasterModel();
|
||||
MeshDocument* par;
|
||||
|
||||
private:
|
||||
int _id;
|
||||
QString _label;
|
||||
|
||||
public:
|
||||
bool visible;
|
||||
inline int id() const {return _id;}
|
||||
|
||||
RasterModel(MeshDocument *parent, QString _rasterName=QString());
|
||||
|
||||
void setLabel(QString newLabel) {_label = newLabel;}
|
||||
|
||||
const QString label() const {
|
||||
if(!_label.isEmpty()) return _label;
|
||||
if(!planeList.empty()) return planeList.first()->shortName();
|
||||
return "Error!";
|
||||
}
|
||||
|
||||
enum RasterElement
|
||||
{
|
||||
RM_NONE = 0x00000000,
|
||||
RM_ALL = 0xffffffff
|
||||
};
|
||||
};// end class RasterModel
|
||||
|
||||
#endif // RASTER_MODEL_H
|
||||
68
src/common/mesh_data_structures/render_raster.cpp
Normal file
68
src/common/mesh_data_structures/render_raster.cpp
Normal file
@ -0,0 +1,68 @@
|
||||
/****************************************************************************
|
||||
* MeshLab o o *
|
||||
* Visual and Computer Graphics Library o o *
|
||||
* _ O _ *
|
||||
* Copyright(C) 2004-2020 \/)\/ *
|
||||
* Visual Computing Lab /\/| *
|
||||
* ISTI - Italian National Research Council | *
|
||||
* \ *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt) *
|
||||
* for more details. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
|
||||
#include "render_raster.h"
|
||||
|
||||
RasterPlane::RasterPlane(const RasterPlane& pl)
|
||||
{
|
||||
semantic = pl.semantic;
|
||||
fullPathFileName = pl.fullPathFileName;
|
||||
image = QImage(pl.image);
|
||||
}
|
||||
|
||||
RasterPlane::RasterPlane(const QString& pathName, const int _semantic)
|
||||
{
|
||||
semantic =_semantic;
|
||||
fullPathFileName = pathName;
|
||||
|
||||
image = QImage(pathName);
|
||||
}
|
||||
|
||||
MeshLabRenderRaster::MeshLabRenderRaster()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
MeshLabRenderRaster::MeshLabRenderRaster( const MeshLabRenderRaster& rm )
|
||||
:shot(rm.shot)
|
||||
{
|
||||
for(QList<RasterPlane*>::const_iterator it = rm.planeList.begin();it != rm.planeList.end();++it)
|
||||
{
|
||||
planeList.push_back(new RasterPlane(**it));
|
||||
if (rm.currentPlane == *it)
|
||||
currentPlane = planeList[planeList.size() - 1];
|
||||
}
|
||||
}
|
||||
|
||||
void MeshLabRenderRaster::addPlane(RasterPlane *plane)
|
||||
{
|
||||
planeList.append(plane);
|
||||
currentPlane = plane;
|
||||
}
|
||||
|
||||
MeshLabRenderRaster::~MeshLabRenderRaster()
|
||||
{
|
||||
currentPlane = NULL;
|
||||
for(int ii = 0;ii < planeList.size();++ii)
|
||||
delete planeList[ii];
|
||||
}
|
||||
95
src/common/mesh_data_structures/render_raster.h
Normal file
95
src/common/mesh_data_structures/render_raster.h
Normal file
@ -0,0 +1,95 @@
|
||||
/****************************************************************************
|
||||
* MeshLab o o *
|
||||
* Visual and Computer Graphics Library o o *
|
||||
* _ O _ *
|
||||
* Copyright(C) 2004-2020 \/)\/ *
|
||||
* Visual Computing Lab /\/| *
|
||||
* ISTI - Italian National Research Council | *
|
||||
* \ *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt) *
|
||||
* for more details. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef RENDER_RASTER_H
|
||||
#define RENDER_RASTER_H
|
||||
|
||||
#include <QString>
|
||||
#include <QImage>
|
||||
#include <QFileInfo>
|
||||
#include "cmesh.h"
|
||||
|
||||
/*
|
||||
RasterPlane Class
|
||||
the base class for a registered image that contains the path, the semantic and the data of the image
|
||||
*/
|
||||
|
||||
class RasterPlane
|
||||
{
|
||||
public:
|
||||
|
||||
enum PlaneSemantic
|
||||
{
|
||||
NONE = 0x0000,
|
||||
RGBA = 0x0001,
|
||||
MASK_UB = 0x0002,
|
||||
MASK_F = 0x0004,
|
||||
DEPTH_F = 0x0008,
|
||||
EXTRA00_F = 0x0100,
|
||||
EXTRA01_F = 0x0200,
|
||||
EXTRA02_F = 0x0400,
|
||||
EXTRA03_F = 0x0800,
|
||||
EXTRA00_RGBA = 0x1000,
|
||||
EXTRA01_RGBA = 0x2000,
|
||||
EXTRA02_RGBA = 0x4000,
|
||||
EXTRA03_RGBA = 0x8000
|
||||
};
|
||||
|
||||
int semantic;
|
||||
QString fullPathFileName;
|
||||
QImage image;
|
||||
QImage thumb;
|
||||
float *buf;
|
||||
|
||||
bool IsInCore() { return !image.isNull(); }
|
||||
void Load();
|
||||
void Discard(); //discard the loaded image freeing the mem.
|
||||
|
||||
/// The whole full path name of the mesh
|
||||
const QString fullName() const {return fullPathFileName;}
|
||||
/// just the name of the file
|
||||
const QString shortName() const { return QFileInfo(fullPathFileName).fileName(); }
|
||||
|
||||
RasterPlane(const RasterPlane& pl);
|
||||
RasterPlane(const QString& pathName, const int _semantic);
|
||||
|
||||
}; //end class Plane
|
||||
|
||||
class MeshLabRenderRaster
|
||||
{
|
||||
public:
|
||||
MeshLabRenderRaster();
|
||||
MeshLabRenderRaster(const MeshLabRenderRaster& rm);
|
||||
~MeshLabRenderRaster();
|
||||
|
||||
Shotm shot;
|
||||
|
||||
///The list of the registered images
|
||||
QList<RasterPlane *> planeList;
|
||||
RasterPlane *currentPlane;
|
||||
|
||||
void addPlane(RasterPlane * plane);
|
||||
};
|
||||
|
||||
|
||||
#endif // RENDER_RASTER_H
|
||||
@ -45,7 +45,7 @@ bool MeshDocumentFromBundler(MeshDocument &md, QString filename_out,QString imag
|
||||
{
|
||||
md.addNewRaster();
|
||||
const QString fullpath_image_filename = image_filenames_q[int(i)];
|
||||
md.rm()->addPlane(new Plane(fullpath_image_filename,Plane::RGBA));
|
||||
md.rm()->addPlane(new RasterPlane(fullpath_image_filename,RasterPlane::RGBA));
|
||||
int count=fullpath_image_filename.count('\\');
|
||||
if (count==0)
|
||||
{
|
||||
@ -83,7 +83,7 @@ bool MeshDocumentFromNvm(MeshDocument &md, QString filename_nvm, QString model_f
|
||||
for(size_t i=0 ; i<shots.size() ; i++){
|
||||
md.addNewRaster();
|
||||
const QString fullpath_image_filename = image_filenames_q[int(i)];
|
||||
md.rm()->addPlane(new Plane(fullpath_image_filename,Plane::RGBA));
|
||||
md.rm()->addPlane(new RasterPlane(fullpath_image_filename,RasterPlane::RGBA));
|
||||
md.rm()->setLabel(image_filenames_q[int(i)].section('/',1,2));
|
||||
md.rm()->shot = shots[int(i)];
|
||||
/*md.rm()->shot.Intrinsics.ViewportPx[0]=md.rm()->currentPlane->image.width();
|
||||
|
||||
@ -162,7 +162,7 @@ bool MeshDocumentFromXML(MeshDocument &md, QString filename, bool binary, std::m
|
||||
QFileInfo fi(filen);
|
||||
QString sem = el.attribute("semantic");
|
||||
QString nm = fi.absoluteFilePath();
|
||||
md.rm()->addPlane(new Plane(fi.absoluteFilePath(), Plane::RGBA));
|
||||
md.rm()->addPlane(new RasterPlane(fi.absoluteFilePath(), RasterPlane::RGBA));
|
||||
el = node.nextSiblingElement("Plane");
|
||||
}
|
||||
raster = raster.nextSibling();
|
||||
@ -223,7 +223,7 @@ QDomElement RasterModelToXML(RasterModel *mp, QDomDocument &doc, bool binary)
|
||||
return rasterElem;
|
||||
}
|
||||
|
||||
QDomElement PlaneToXML(Plane* pl, const QString& basePath, QDomDocument& doc)
|
||||
QDomElement PlaneToXML(RasterPlane* pl, const QString& basePath, QDomDocument& doc)
|
||||
{
|
||||
QDomElement planeElem = doc.createElement("Plane");
|
||||
QDir dir(basePath);
|
||||
|
||||
@ -12,5 +12,5 @@ QDomDocument MeshDocumentToXML(MeshDocument &md, bool onlyVisibleLayers, bool sa
|
||||
bool MeshDocumentToXMLFile(MeshDocument &md, QString filename, bool onlyVisibleLayers, bool saveViewState, bool binary, const std::map<int, MLRenderingData>& rendOpt = std::map<int, MLRenderingData>());
|
||||
bool MeshDocumentFromXML(MeshDocument &md, QString filename, bool binary, std::map<int, MLRenderingData>& rendOpt);
|
||||
QDomElement RasterModelToXML(RasterModel *mp,QDomDocument &doc, bool binary);
|
||||
QDomElement PlaneToXML(Plane* pl,const QString& basePath,QDomDocument& doc);
|
||||
QDomElement PlaneToXML(RasterPlane* pl,const QString& basePath,QDomDocument& doc);
|
||||
#endif // __MESHLABDOC_XML_H
|
||||
|
||||
@ -2014,7 +2014,7 @@ bool MainWindow::importRaster(const QString& fileImg)
|
||||
this->meshDoc()->setBusy(true);
|
||||
RasterModel *rm= meshDoc()->addNewRaster();
|
||||
rm->setLabel(fileImg);
|
||||
rm->addPlane(new Plane(fileName,Plane::RGBA));
|
||||
rm->addPlane(new RasterPlane(fileName,RasterPlane::RGBA));
|
||||
meshDoc()->setBusy(false);
|
||||
showLayerDlg(true);
|
||||
|
||||
|
||||
@ -29,7 +29,7 @@
|
||||
#include <QObject>
|
||||
#include <common/interfaces/decorate_plugin_interface.h>
|
||||
#include <common/ml_shared_data_context.h>
|
||||
#include <common/mesh_data_structures/mesh_model.h>
|
||||
#include <common/mesh_data_structures/raster_model.h>
|
||||
#include <wrap/glw/glw.h>
|
||||
|
||||
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
|
||||
|
||||
|
||||
#include <common/mesh_data_structures/mesh_model.h>
|
||||
#include <common/mesh_data_structures/raster_model.h>
|
||||
|
||||
|
||||
struct TriangleUV
|
||||
|
||||
@ -27,7 +27,8 @@
|
||||
|
||||
|
||||
|
||||
#include <common/mesh_data_structures/mesh_model.h>
|
||||
#include <common/mesh_data_structures/raster_model.h>
|
||||
#include <common/ml_shared_data_context.h>
|
||||
#include <wrap/glw/glw.h>
|
||||
|
||||
#define USE_VBO
|
||||
|
||||
@ -27,7 +27,8 @@
|
||||
|
||||
|
||||
|
||||
#include <common/mesh_data_structures/mesh_model.h>
|
||||
#include <common/mesh_data_structures/raster_model.h>
|
||||
#include <common/ml_shared_data_context.h>
|
||||
#include <wrap/glw/glw.h>
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user