Commit 4a11dd11 authored by Sylvain Thery's avatar Sylvain Thery

Merge branch 'develop' into 'develop'

Develop



See merge request !77
parents 0df500ca d67fd741
......@@ -3,15 +3,15 @@
using namespace CGoGN;
template struct Utils::CodeVector<Geom::Vec3f>;
template struct Utils::CodeVector<Geom::Vec3d>;
template struct Utils::CodeVector<Geom::Vec4d>;
//template struct Utils::CodeVector<Geom::Vec3f>;
//template struct Utils::CodeVector<Geom::Vec3d>;
//template struct Utils::CodeVector<Geom::Vec4d>;
template class Utils::Quantization<Geom::Vec3f>;
template class Utils::Quantization<Geom::Vec3d>;
template class Utils::Quantization<Geom::Vec4d>;
//template class Utils::Quantization<Geom::Vec3f>;
//template class Utils::Quantization<Geom::Vec3d>;
//template class Utils::Quantization<Geom::Vec4d>;
int test_quantization()
......
......@@ -130,9 +130,9 @@ void MyQT::cb_initGL()
m_sprite->setAttributePosition(m_positionVBO);
m_sprite->setColor(Geom::Vec4f(1.0f, 0.0f , 0.0f, 1.0f));
m_strings = new Utils::Strings3D(true, Geom::Vec3f(0.1f,0.0f,0.3f));
storeVerticesInfo();
m_strings->sendToVBO();
m_strings = new Utils::Strings3D(true, Geom::Vec3f(0.1f,0.0f,0.3f));
storeVerticesInfo();
m_strings->sendToVBO();
// copy de contenu de VBO a la creation
m_dataVBO = new Utils::VBO(*m_positionVBO);
......
......@@ -383,6 +383,14 @@ public:
template<typename MAP>
void drawColoredDarts(MAP& map);
/**
* Get back middle position of drawn darts
* @param map the map
* @param posExpl the output positions
*/
template<typename PFP>
void computeDartMiddlePositions(typename PFP::MAP& map, DartAttribute< typename PFP::VEC3, typename PFP::MAP>& posExpl);
};
......
......@@ -622,25 +622,43 @@ Dart TopoRender::raySelection(MAP& map, const Geom::Vec3f& rayA, const Geom::Vec
double dist2 = std::numeric_limits<double>::max();
for(Dart d = map.begin(); d!=map.end(); map.next(d))
{
// get back position of segment PQ
const Geom::Vec3f& P = m_bufferDartPosition[attIndex[d]];
const Geom::Vec3f& Q =m_bufferDartPosition[attIndex[d]+1];
float ld2 = Geom::squaredDistanceLine2Seg(rayA, rayAB, AB2, P, Q);
if (ld2<dm2)
if (!map.isBoundaryMarkedCurrent(d))
{
Geom::Vec3f V = (P+Q)/2.0f - rayA;
double d2 = double(V*V);
if (d2<dist2)
// get back position of segment PQ
const Geom::Vec3f& P = m_bufferDartPosition[attIndex[d]];
const Geom::Vec3f& Q =m_bufferDartPosition[attIndex[d]+1];
float ld2 = Geom::squaredDistanceLine2Seg(rayA, rayAB, AB2, P, Q);
if (ld2<dm2)
{
dist2 = d2;
dFinal = d;
Geom::Vec3f V = (P+Q)/2.0f - rayA;
double d2 = double(V*V);
if (d2<dist2)
{
dist2 = d2;
dFinal = d;
}
}
}
}
return dFinal;
}
template <typename PFP>
void TopoRender::computeDartMiddlePositions( typename PFP::MAP& map, DartAttribute< typename PFP::VEC3, typename PFP::MAP>& posExpl)
{
DartAttribute<unsigned int, typename PFP::MAP> attIndex = map.template getAttribute<unsigned int, DART, typename PFP::MAP>(m_nameIndex);
if (!attIndex.isValid())
attIndex = map.template addAttribute<unsigned int, DART, typename PFP::MAP>(m_nameIndex);
for (Dart d = map.begin(); d != map.end(); map.next(d))
{
const Geom::Vec3f& P = m_bufferDartPosition[attIndex[d]];
const Geom::Vec3f& Q = m_bufferDartPosition[attIndex[d]+1];
posExpl[d] = (P + Q)*0.5f;
}
}
} // namespace GL2
} // namespace Algo
......
......@@ -6,5 +6,5 @@ uniform vec4 color;
FRAG_OUT_DEF;
void main (void)
{
float lum = TEXTURE2D(FontTexture, tex_coord).s;;
float lum = TEXTURE2D(FontTexture, tex_coord).s;
// no } because it is added in the shader class code (with other things)
......@@ -353,7 +353,7 @@ bool Image<DIM,TYPE>::load(const std::string& filename)
QImage* ptr = new QImage(filename.c_str());
if (ptr == NULL)
if (ptr->isNull())
{
CGoGNout << "Impossible to load "<< filename << CGoGNendl;
return false;
......
......@@ -62,9 +62,12 @@ Strings3D::Strings3D(bool withBackground, const Geom::Vec3f& bgc, bool with_plan
glGenTextures(1, &(*m_idTexture));
glBindTexture(GL_TEXTURE_2D, *m_idTexture);
glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, WIDTHTEXTURE, HEIGHTTEXTURE, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, (GLvoid*)(buff));
glTexImage2D(GL_TEXTURE_2D, 0, GL_RED, WIDTHTEXTURE, HEIGHTTEXTURE, 0, GL_RED, GL_UNSIGNED_BYTE, (GLvoid*)(buff));
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
delete[] buff;
}
else
......@@ -88,8 +91,7 @@ Strings3D::Strings3D(bool withBackground, const Geom::Vec3f& bgc, bool with_plan
else
{
std::stringstream ss;
ss << "vec4 backColor = vec4(" <<bgc[0] << "," << bgc[1] << "," << bgc[2] << ",color[3]);\n";
// ss << "vec4 backColor = vec4(0.2,0.1,0.4);\n";
ss << " vec4 backColor = vec4(" <<bgc[0] << "," << bgc[1] << "," << bgc[2] << ",color[3]);\n";
glxfrag.append(ss.str());
glxfrag.append(fragmentShaderText3);
}
......@@ -178,6 +180,7 @@ unsigned int Strings3D::sendOneStringToVBO(const std::string& str, float **buffe
float u2 = u + float(REALWIDTHFONT) / float(WIDTHTEXTURE);
float v2 = v + float(WIDTHFONT - 1) / float(HEIGHTTEXTURE);
// 0
*buffer++ = x;
*buffer++ = 0;
*buffer++ = u;
......@@ -185,16 +188,31 @@ unsigned int Strings3D::sendOneStringToVBO(const std::string& str, float **buffe
float xf = x + float(REALWIDTHFONT) / 25.f;
// 1
*buffer++ = xf;
*buffer++ = 0;
*buffer++ = u2;
*buffer++ = v2;
// 2
*buffer++ = xf;
*buffer++ = float(WIDTHFONT) / 25.f;
*buffer++ = u2;
*buffer++ = v;
// 0
*buffer++ = x;
*buffer++ = 0;
*buffer++ = u;
*buffer++ = v2;
// 2
*buffer++ = xf;
*buffer++ = float(WIDTHFONT) / 25.f;
*buffer++ = u2;
*buffer++ = v;
// 3
*buffer++ = x;
*buffer++ = float(WIDTHFONT) / 25.f;
*buffer++ = u;
......@@ -205,7 +223,7 @@ unsigned int Strings3D::sendOneStringToVBO(const std::string& str, float **buffe
*buffervbo = buffer;
return 4 * nbc;
return 6 * nbc;
}
void Strings3D::sendToVBO()
......@@ -214,7 +232,7 @@ void Strings3D::sendToVBO()
// alloc buffer
m_vbo1->bind();
glBufferData(GL_ARRAY_BUFFER, m_nbChars * 16 * sizeof(float), 0, GL_STREAM_DRAW);
glBufferData(GL_ARRAY_BUFFER, m_nbChars * 24 * sizeof(float), 0, GL_STREAM_DRAW);
float* buffer = reinterpret_cast<float*>(glMapBuffer(GL_ARRAY_BUFFER, GL_READ_WRITE));
// fill buffer
......@@ -269,7 +287,7 @@ void Strings3D::postdraw()
void Strings3D::draw(unsigned int idSt, const Geom::Vec3f& pos)
{
glUniform3fv(*m_uniform_position, 1, pos.data());
glDrawArrays(GL_QUADS, m_strpos[idSt].first , m_strpos[idSt].second );
glDrawArrays(GL_TRIANGLES, m_strpos[idSt].first , m_strpos[idSt].second );
}
void Strings3D::drawAll(const Geom::Vec4f& color)
......@@ -290,7 +308,7 @@ void Strings3D::drawAll(const Geom::Vec4f& color)
for (unsigned int idSt=0; idSt<nb; ++idSt)
{
glUniform3fv(*m_uniform_position, 1, m_strTranslate[idSt].data());
glDrawArrays(GL_QUADS, m_strpos[idSt].first , m_strpos[idSt].second );
glDrawArrays(GL_TRIANGLES, m_strpos[idSt].first , m_strpos[idSt].second );
}
postdraw();
}
......@@ -316,23 +334,38 @@ void Strings3D::updateString(unsigned int idSt, const std::string& str)
float u2 = u + float(REALWIDTHFONT) / float(WIDTHTEXTURE);
float v2 = v + float(WIDTHFONT - 1) / float(HEIGHTTEXTURE);
// 0
*buffer++ = x;
*buffer++ = 0;
*buffer++ = u;
*buffer++ = v2;
float xf = x + float(REALWIDTHFONT) / 25.f;
// 1
*buffer++ = xf;
*buffer++ = 0;
*buffer++ = u2;
*buffer++ = v2;
// 2
*buffer++ = xf;
*buffer++ = float(WIDTHFONT) / 25.f;
*buffer++ = u2;
*buffer++ = v;
// 0
*buffer++ = x;
*buffer++ = 0;
*buffer++ = u;
*buffer++ = v2;
// 2
*buffer++ = xf;
*buffer++ = float(WIDTHFONT) / 25.f;
*buffer++ = u2;
*buffer++ = v;
// 3
*buffer++ = x;
*buffer++ = float(WIDTHFONT) / 25.f;
*buffer++ = u;
......
......@@ -86,7 +86,7 @@ void TextureSticker::fullScreenTexture(CGoGNGLuint texId)
// Draw quad
sm_textureMappingShader->enableVertexAttribs();
glDrawArrays(GL_QUADS, 0, 4);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
sm_textureMappingShader->disableVertexAttribs();
// Unbind texture mapping shader
......@@ -134,7 +134,7 @@ void TextureSticker::fullScreenTextureDepth(CGoGNGLuint texId, CGoGNGLuint dtexI
// Draw quad
sm_depthtextureMappingShader->enableVertexAttribs();
glDrawArrays(GL_QUADS, 0, 4);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
sm_depthtextureMappingShader->disableVertexAttribs();
// Unbind texture mapping shader
......@@ -175,7 +175,7 @@ void TextureSticker::fullScreenShader(Utils::GLSLShader* shader)
// Draw quad
shader->enableVertexAttribs();
glDrawArrays(GL_QUADS, 0, 4);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
shader->disableVertexAttribs();
// Unbind shader
......
English version bellow
Dépendences Linux
=================
installer les paquets suivants:
cmake cmake-curses-gui cmake-qt-gui libXi-dev libXmu-dev libglew-dev libtinyxml2-dev libboost-all-dev zlib1g-dev qt4-designer qt4-dev-tools uuid-dev libgsl0-dev libsuitesparse-dev
Pour compiler CGoGN
===================
* on compile tout d'abord les bibliothèques third-party :
cd CGoGN/ThirdParty/build
cmake ..
make (-j x si vous avez x cores)
make install
La même chose en debug:
cd ../buildDebug
cmake ..
make (-j x si vous avez x cores)
On peut fixer certaines option pour ne pas tout compiler:
* WITH_ASSIMP -> compile et utilise la librairie Assimp
* WITH_ZINRI -> compile et utilise la librairie Zinri
* WITH_PYTHONQT -> pour SCHNApps
* ensuite on compile CGoGN :
cd CGoGN/build
cmake ..
make (-j x si vous avez x cores)
Et en Debug avec:
cd ../buildDebug
cmake ..
make (-j x si vous avez x cores)
Certaines options sont disponibles :
* BUILD_SHARED_LIBS -Q experimental !
* ONELIB -> compilation en une seule lib (libcgogn.a) au lieu de 4
* WITH_ASSIMP -> utilise Assimp (auto set par third party compil)
* WITH_ZINRI -> utilise Zinri (auto set par third party compil)
* WITH_QT -> minimize les dependence si pas besoin de Qt (VRJuggler)
* WITH_GLEWMX -> pour utiliser GLEWMX a la place de GELW (pour VRJuggler)
Les librairies sont generees dans lib/Release et lib/Debug
Les binaires sont generes dans bin/Release et bin/Debug
* on peut ensuite compiler SCHNApps ainsi que les plugins fournis :
cd CGoGN/SCHNApps/build
cmake ..
make (-j x si vous avez x cores)
Et en Debug avec:
cd ../buildDebug
cmake ..
make (-j x si vous avez x cores)
Des exemples de données (fichiers trianbgz, off, etc..) sont accessible à l'adresse suivante:
https://iggservis.u-strasbg.fr/Data/data.zip
ENGLISH VERSION
===============
Linux dependencies
==================
install the following packages:
cmake cmake-curses-gui cmake-qt-gui libXi-dev libXmu-dev libglew-dev libxml2-dev libboost-all-dev zlib1g-dev qt4-designer qt4-dev-tools uuid-dev libgsl0-dev libsuitesparse-dev
To compile CGoGN
================
* first compile third-party libraries:
cd CGoGN/ThirdParty/build
cmake ..
make (-j x if you have x cores)
make install
In debug mode:
cd ../buildDebug
cmake ..
make
Some options are available to not compile everything:
* WITH_ASSIMP -> compile and use Assimp library
* WITH_ZINRI -> compile and use Zinri library
* WITH_PYTHONQT -> needed by SCHNApps
* then compile CGoGN (the libs are generated in CGoGN/lib and some examples in CGoGN/bin):
cd CGoGN/build
cmake ..
make (-j x if you have x cores)
in debug mode:
cd ../buildDebug
cmake ..
make
Some options are available:
* BUILD_SHARED_LIBS (F) experimental !
* ONELIB -> allow compilation in one lib (libcgogn.a) instead of four.
* WITH_ASSIMP -> use Assimp library (auto setted by third party compiling)
* WITH_ZINRI -> use Zinri library (auto setted by third party compiling)
* WITH_QT -> to minimize dependencies and compilation time
* WITH_GLEWMX -> to use GLEWMX (for VRJuggler users)
* we can then compile SCHNApps and the provided plugins :
cd CGoGN/SCHNApps/build
cmake ..
make (-j x if you have x cores)
in debug mode:
cd ../buildDebug
cmake ..
make
Libraries are generated in lib/Release and lib/Debug
Binaries are generated in bin/Release and bin/Debug
Examples of data (trianbgz, off, etc.. files) are available at the following address:
https://iggservis.u-strasbg.fr/Data/data.zip
......@@ -78,7 +78,10 @@ Dependencies
------------
* install (or compile) Qt (choose 32/64 bits)
* install python 2.7 (choose 32/64 bits) (Needed for SCHNApps)
* Other Windows dependencies are furnished at http://cgogn.unistra.fr/Dependencies/
* Other Windows dependencies are furnished at:
* http://cgogn.unistra.fr/Dependencies/dependencies.txt
* http://cgogn.unistra.fr/Dependencies/windows_dependencies32.zip
* http://cgogn.unistra.fr/Dependencies/windows_dependencies64.zip
**Supported compilers: Visual C++ 2013 (12.0) or greater**
......
......@@ -390,6 +390,18 @@ if(SUITESPARSE_USE_LAPACK_BLAS)
endif()
find_library(SSPARSE_CONFIG_LIB
NAMES libsuitesparseconfig suitesparseconfig
PATHS /opt/local/lib${SUITESPARSE_SEARCH_LIB_POSTFIX}
/usr/lib${SUITESPARSE_SEARCH_LIB_POSTFIX}
/usr/local/lib${SUITESPARSE_SEARCH_LIB_POSTFIX}
${SUITESPARSE_DIR}
PATH_SUFFIXES Release Debug)
if (SSPARSE_CONFIG_LIB)
list(APPEND SUITESPARSE_LIBRARIES ${SSPARSE_CONFIG_LIB})
endif()
if(SUITESPARSE_INCLUDE_DIRS)
list(REMOVE_DUPLICATES SUITESPARSE_INCLUDE_DIRS)
endif()
......
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