Commit 53d599e2 authored by Thomas's avatar Thomas

Merge branch 'master' of cgogn.u-strasbg.fr:CGoGN

parents a3dd8899 33cc8427
......@@ -32,17 +32,19 @@
SimpleGMap3::SimpleGMap3()
{
position = myMap.addAttribute<PFP::VEC3>(VERTEX, "position");
normal = myMap.addAttribute<PFP::VEC3>(VERTEX, "position");
normal = myMap.addAttribute<PFP::VEC3>(VERTEX, "normal");
volume = myMap.addAttribute<PFP::VEC3>(VOLUME, "volume");
Algo::Modelisation::Primitive3D<PFP> primCat(myMap,position);
Dart d = primCat.hexaGrid_topo(2,1,1);
primCat.embedHexaGrid(1,1,1);
Dart d = primCat.hexaGrid_topo(3,1,1);
primCat.embedHexaGrid(2,1,1);
myMap.check();
DartMarker markOrient(myMap);
std::vector<Dart> orient;
FunctorStore fs(orient);
d = 49;
myMap.foreach_dart_of_oriented_volume(d,fs);
for(std::vector<Dart>::iterator it = orient.begin() ; it != orient.end() ; ++it)
......
......@@ -55,6 +55,7 @@ public:
PFP::TVEC3 position ;
PFP::TVEC3 normal ;
PFP::TVEC3 volume ;
SimpleGMap3() ;
......
......@@ -113,7 +113,6 @@ void catmullClarkVol(typename PFP::MAP& map, EMBV& attributs, const FunctorSelec
//memorize each vertices per volumes
if(selected(d) && !mv.isMarked(d))
{
std::cout << " d " << d << std::endl;
l_vertices.push_back(d);
mv.markOrbitInParent<typename PFP::MAP>(VERTEX,d);
}
......@@ -145,12 +144,6 @@ void catmullClarkVol(typename PFP::MAP& map, EMBV& attributs, const FunctorSelec
}
}
unsigned int nb_=0;
for(unsigned int nb= attributs.begin() ; nb != attributs.end() ; attributs.next(nb))
nb_++;
std::cout << "first " << nb_ << std::endl;
// second pass: quandrangule faces
std::map<Dart,Dart> toSew;
for (Dart d = map.begin(); d != map.end(); map.next(d))
......@@ -230,12 +223,6 @@ void catmullClarkVol(typename PFP::MAP& map, EMBV& attributs, const FunctorSelec
}
}
nb_=0;
for(unsigned int nb= attributs.begin() ; nb != attributs.end() ; attributs.next(nb))
nb_++;
std::cout << "then " << nb_ << std::endl;
map.check();
//sew all faces leading to the central vertex
......
......@@ -144,7 +144,7 @@ protected:
void popColors();
/**
* pick dart with color set bey setDartsIdColor
* pick dart with color set by setDartsIdColor
* @param x position of mouse (x)
* @param y position of mouse (pass H-y, classic pb of origin)
* @return the dart or NIL
......@@ -270,7 +270,7 @@ class Topo3RenderMapD: public Topo3Render
{
public:
/**
* update all drawing buffers
* update all drawing buffers to render a dual map
* @param map the map
* @param good selector
* @param positions attribute of position vertices
......@@ -287,7 +287,7 @@ class Topo3RenderGMap: public Topo3Render
{
public:
/**
* update all drawing buffers
* update all drawing buffers to render a gmap
* @param map the map
* @param good selector
* @param positions attribute of position vertices
......
......@@ -305,7 +305,6 @@ Dart Topo3Render::picking(typename PFP::MAP& map, const FunctorSelect& good, int
Dart d = pickColor(x,y);
popColors();
return d;
}
template<typename PFP>
......@@ -320,7 +319,6 @@ void Topo3RenderGMap::updateData(typename PFP::MAP& map, const FunctorSelect& go
AutoAttributeHandler<Geom::Vec3f> vert(map, DART);
if (m_attIndex.map() != &map)
// if(!m_attIndex.isValid())
{
m_attIndex = map.template addAttribute<unsigned int>(DART, "dart_index");
}
......@@ -388,13 +386,15 @@ void Topo3RenderGMap::updateData(typename PFP::MAP& map, const FunctorSelect& go
}
}
m_nbDarts *= 2;
m_nbDarts *= 2; // x2 : only one orientation is used for the previous computation, multiply by 2 to get the number of darts
//colors
m_vbo4->bind();
glBufferData(GL_ARRAY_BUFFER, 2*m_nbDarts*sizeof(VEC3), 0, GL_STREAM_DRAW);
GLvoid* ColorDartsBuffer = glMapBuffer(GL_ARRAY_BUFFER, GL_READ_WRITE);
VEC3* colorDartBuf = reinterpret_cast<VEC3*>(ColorDartsBuffer);
//darts
m_vbo0->bind();
glBufferData(GL_ARRAY_BUFFER, 2*m_nbDarts*sizeof(VEC3), 0, GL_STREAM_DRAW);
GLvoid* PositionDartsBuffer = glMapBuffer(GL_ARRAY_BUFFER, GL_READ_WRITE);
......@@ -418,8 +418,11 @@ void Topo3RenderGMap::updateData(typename PFP::MAP& map, const FunctorSelect& go
{
const VEC3& P = positions[dd];
vecPos.push_back(P);
// m_attIndex[dd] = posDBI;
m_attIndex[dd] = posDBI;
posDBI+=2;
m_attIndex[map.beta0(dd)] = posDBI; //for gmap : also affect a number to the other orientation for picking
posDBI+=2;
center += P;
dd = map.phi1(dd);
} while (dd != d);
......
......@@ -189,7 +189,7 @@ public:
/**
* pick dart with color set bey setDartsIdColor
* pick dart with color set by setDartsIdColor
* Do not forget to apply same transformation to scene before picking than before drawing !
* @param map the map in which we pick (same as drawn !)
* @param good the selector (same as used during drawing)
......@@ -205,7 +205,7 @@ class TopoRenderMapD : public TopoRender
{
public:
/**
* update all drawing buffers
* update all drawing buffers to render a dual map
* @param map the map
* @param positions attribute of position vertices
* @param ke exploding coef for edge
......@@ -220,7 +220,7 @@ class TopoRenderGMap : public TopoRender
{
public:
/**
* update all drawing buffers
* update all drawing buffers to render a gmap
* @param map the map
* @param positions attribute of position vertices
* @param ke exploding coef for edge
......
......@@ -182,7 +182,7 @@ void TopoRenderMapD::updateData(typename PFP::MAP& map, const typename PFP::TVEC
template<typename PFP>
void TopoRenderGMap::updateData(typename PFP::MAP& map, const typename PFP::TVEC3& positions, float ke, float kf, const FunctorSelect& good)
{
/*
/*
typedef typename PFP::VEC3 VEC3;
typedef typename PFP::REAL REAL;
......
......@@ -24,7 +24,7 @@
#ifndef __PICKABLES_H_
#define __PICKABLE_H_
#define __PICKABLES_H_
#include "Utils/vbo.h"
#include "glm/glm.hpp"
......@@ -270,7 +270,7 @@ class Grid: public LineDrawable
public:
/**
* constructor
* @param sub number of subdivision of grig
* @param sub number of subdivision of grid
*/
Grid(unsigned int sub=5);
......
......@@ -227,7 +227,7 @@ Dart TopoRender::pickColor(unsigned int x, unsigned int y)
// draw in back buffer (not shown on screen)
drawDarts();
// restore dart with
// restore dart width
m_topo_dart_width = dw;
// read the pixel under the mouse in back buffer
......
......@@ -477,6 +477,30 @@ bool EmbeddedGMap3::check()
}
}
if (isOrbitEmbedded(VERTEX))
{
delete dvMark;
delete vMark;
}
if (isOrbitEmbedded(EDGE))
{
delete deMark;
delete eMark;
}
if (isOrbitEmbedded(FACE))
{
delete dfMark;
delete fMark;
}
if (isOrbitEmbedded(VOLUME))
{
delete dvolMark;
delete volMark;
}
CGoGNout << "Check: embedding ok" << CGoGNendl ;
return true ;
}
......
......@@ -134,7 +134,6 @@ glm::mat4& Pickable::transfo()
return m_transfo;
}
void Pickable::rotate(float angle, const Geom::Vec3f& Axis)
{
m_transfo = glm::rotate(m_transfo, angle, glm::vec3(Axis[0],Axis[1],Axis[2]));
......@@ -472,7 +471,7 @@ unsigned int Sphere::pick(const Geom::Vec3f& P, const Geom::Vec3f& V, Geom::Vec3
I=P;
I.normalize(); // grossiere approximation TODO amelioerer approxim ?
I.normalize(); // grossiere approximation TODO ameliorer approxim ?
return 1;
}
......
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