Commit d2dc2619 authored by Thomas Jund's avatar Thomas Jund

extension limace pour la cage

parent f7fcf8dc
......@@ -19,7 +19,7 @@
using namespace std;
#define EXPORTING2
//#define EXPORTING2
class MovingMesh
{
......
......@@ -53,7 +53,7 @@
#include "shaderCustom.h"
//#define EXPORTING
#define EXPORTING
using namespace CGoGN ;
......
......@@ -180,8 +180,8 @@ void MovingMesh::animate()
void MovingMesh::draw()
{
#ifdef EXPORTING2
Algo::Surface::Geometry::computeNormalVertices<PFP2>(map, m_obj.m_positions, normal) ;
m_nbIndices = m_obj.createSimpleVBO_PTN(m_positionVBO,m_texcoordVBO,m_normalVBO);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
m_shaderTex->activeTexture();
......
......@@ -136,7 +136,7 @@ MovingObstacle::MovingObstacle(Simulator* sim, int ind, std::vector<VEC3> pos, s
{
//extrude face to build a cage
// compute edgeLength for mass-spring
Algo::Surface::Modelisation::extrudeFace<PFP>(map, position, groundFace, 15.0f) ;
Algo::Surface::Modelisation::extrudeFace<PFP>(map, position, groundFace, 25.0f) ;
map.fillHole(groundFace);
groundFace = map.phi2(groundFace);
......@@ -743,7 +743,7 @@ void MovingObstacle::computePrefVelocity() //calcul du vecteur optimal pour atte
float goalDist2 = goalVector.norm2() ;
if (goalDist2 < 500.0f)
if (goalDist2 < 750.0f)
{
curGoal_ = (curGoal_ + 1) % goals_.size() ;
goalVector = goals_[curGoal_] - center ;
......
......@@ -688,6 +688,16 @@ void Simulator::addMovingObstacle(Dart d, unsigned int obstType)
mm = new MovingMesh(envMap_, d, "./meshRessources/Limace_2.obj");
movingMeshes_.push_back(mm);
vPos = mm->computeProjectedPointSet(maxHeight);
//scale projected pointset
VEC3 bary(0);
for(std::vector<VEC3>::iterator it = vPos.begin() ; it != vPos.end() ; ++it)
bary += *it;
bary /= vPos.size();
float scale = 1.2f;
for(std::vector<VEC3>::iterator it = vPos.begin() ; it != vPos.end() ; ++it)
*it = *it*scale - bary*(scale-1.0f);
}
break;
default:
......
......@@ -298,11 +298,11 @@ void SocialAgents::initRendering()
for(unsigned int i = 0 ; i < simulator.movingMeshes_.size() ; ++i)
{
#ifdef EXPORTING2
simulator.movingMeshes_[i]->initGL();
#ifdef EXPORTING2
registerShader(simulator.movingMeshes_[i]->m_shaderTex);
#else
// registerShader(simulator.movingMeshes_[i]->m_simpleColorShader);
registerShader(simulator.movingMeshes_[i]->m_simpleColorShader);
#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