Commit 63f28931 authored by Thomas Jund's avatar Thomas Jund
Browse files

new limace for tests

parent 35d362bc
......@@ -9,11 +9,11 @@ ELSE (WIN32)
ENDIF (WIN32)
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
../include
${CGoGN_ROOT_DIR}/include
${COMMON_INCLUDES}
${CMAKE_CURRENT_BINARY_DIR}
)
file(
......
......@@ -10,10 +10,10 @@ ENDIF (WIN32)
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
../include
${CGoGN_ROOT_DIR}/include
${COMMON_INCLUDES}
${CMAKE_CURRENT_SOURCE_DIR}
)
file(
......
# Blender MTL File: 'Limace.002.blend'
# Material Count: 1
newmtl _rect2987.png
Ns 0
Ka 0.000000 0.000000 0.000000
Kd 0.8 0.8 0.8
Ks 0.8 0.8 0.8
d 1
illum 2
map_Kd C:\Users\larue\Downloads\Limace.002.blend\limace.png
This diff is collapsed.
......@@ -246,37 +246,37 @@ void Agent::updateObstacleNeighbors()
for(std::vector<Obstacle*>::const_iterator it = neighborObst.begin() ; it != neighborObst.end() ; ++it)
{
if ((*it)->mo==NULL)
{
float distSq = distSqPointLineSegment((*it)->p1, (*it)->p2, part_.getPosition()) ;
if ((obstacleNeighbors_.size() < maxNeighbors_ || distSq < maxDistObst)
&&distSq < rangeSq_)
{
if (Geom::testOrientation2D(part_.getPosition(), (*it)->p1, (*it)->p2) == Geom::RIGHT)
{
float distSq = distSqPointLineSegment((*it)->p1, (*it)->p2, part_.getPosition()) ;
if ((obstacleNeighbors_.size() < maxNeighbors_ || distSq < maxDistObst)
&&distSq < rangeSq_)
{
if (Geom::testOrientation2D(part_.getPosition(), (*it)->p1, (*it)->p2) == Geom::RIGHT)
{
if (distSq > maxDistObst) maxDistObst = distSq ;
obstacleNeighbors_.push_back(std::make_pair(distSq, *it)) ;
}
if (distSq > maxDistObst) maxDistObst = distSq ;
obstacleNeighbors_.push_back(std::make_pair(distSq, *it)) ;
}
}
else
{
float distSq = distSqPointLineSegment((*it)->p1, (*it)->p2, part_.getPosition()) ;
if ((movingObstacleNeighbors_.size() < maxNeighbors_ || distSq < maxDistMovingObst)
&&distSq < rangeSq_)
{
if (Geom::testOrientation2D(part_.getPosition(), (*it)->p1, (*it)->p2) == Geom::RIGHT)
{
if (distSq > maxDistMovingObst) maxDistMovingObst = distSq ;
movingObstacleNeighbors_.push_back(std::make_pair(distSq, *it)) ;
}
}
else
{
float distSq = distSqPointLineSegment((*it)->p1, (*it)->p2, part_.getPosition()) ;
if ((movingObstacleNeighbors_.size() < maxNeighbors_ || distSq < maxDistMovingObst)
&&distSq < rangeSq_)
{
if (Geom::testOrientation2D(part_.getPosition(), (*it)->p1, (*it)->p2) == Geom::RIGHT)
{
}
if (distSq > maxDistMovingObst) maxDistMovingObst = distSq ;
movingObstacleNeighbors_.push_back(std::make_pair(distSq, *it)) ;
}
}
}
}
}
// if (obstacleNeighbors_.size() > maxNeighbors_)
......@@ -601,7 +601,7 @@ void Agent::computeNewVelocity()
int obst_power = 2 ; // the power to which elevate the agent-obstacle distance
Obstacle* obst ;
//#define ARASH
#define ARASH
#ifdef ARASH
nb_mos = 0;
for(std::vector<std::pair<float, Obstacle*> >::iterator it = movingObstacleNeighbors_.begin() ;
......
......@@ -23,8 +23,15 @@ constrainedV(map)
// scale(2.5f);
// scale(0.5f);
// Geom::Matrix44f m;
// m.identity();
// VEC3 axis(1.0f,0.0f,0.0f);
// Geom::rotate(axis, float(M_PI/2.0f),m);
// transform(m);
VEC3 v = Algo::Surface::Geometry::faceCentroid<PFP>(motherMap, d, motherPosition) ;
translate(v);
// translate(VEC3(0,0,5));
// TraversorV<PFP::MAP> tv(map);
// std::vector<Dart> obstDarts;
......@@ -146,8 +153,11 @@ void MovingMesh::draw()
{
m_positionVBO->updateData(position) ;
m_render->initPrimitives<PFP>(map, allDarts, Algo::Render::GL2::TRIANGLES) ;
m_render->initPrimitives<PFP>(map, allDarts, Algo::Render::GL2::LINES) ;
m_simpleColorShader->setColor(Geom::Vec4f(1.0,0.627,0.0,0.));
m_render->draw(m_simpleColorShader, Algo::Render::GL2::TRIANGLES);
m_simpleColorShader->setColor(Geom::Vec4f(0.0,0.0,0.0,0.));
m_render->draw(m_simpleColorShader, Algo::Render::GL2::LINES);
}
std::vector<VEC3> MovingMesh::computeProjectedPointSet(float maxHeight)
......
......@@ -73,7 +73,6 @@ VEC3 rotate(VEC3 pos1, VEC3 center, float angle) // renvoie le déplacement nece
}
MovingObstacle::MovingObstacle(Simulator* sim, int ind, std::vector<VEC3> pos, std::vector<VEC3> goals, bool rigid, bool spin, Dart dInside, ArticulatedObstacle * art, int indParent) :
nbVertices(pos.size()),
center(0),
......@@ -137,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, 10.0f) ;
Algo::Surface::Modelisation::extrudeFace<PFP>(map, position, groundFace, 15.0f) ;
map.fillHole(groundFace);
groundFace = map.phi2(groundFace);
......@@ -506,7 +505,7 @@ void MovingObstacle::update()
//stretch spring : /!\ max rigidity relative to the timestep used (unstable otherwise)
float norm = v1.norm();
float rigidity = 50.0f;
float rigidity = 70.0f;
float stretch = rigidity*(edgeLength[dd]-v1.norm());
VEC3 f = stretch*(v1/norm);
......@@ -534,7 +533,7 @@ void MovingObstacle::update()
float restAngle = vertexAngle[dd];
if(restAngle!=0.0f)
{
float angularRig = 50.0f;
float angularRig = 70.0f;
float curAngle = Algo::Surface::Geometry::angle<PFP>(map, map.phi_1(dd),map.phi1(dd),position);
float angularStretch = angularRig*(restAngle-curAngle);
......
......@@ -665,7 +665,7 @@ void Simulator::addMovingObstacle(Dart d, unsigned int obstType)
{
std::vector<VEC3> vPos;
VEC3 start;
float maxHeight=5.0f;
float maxHeight=2.0f;
MovingMesh* mm = NULL;
......@@ -685,7 +685,7 @@ void Simulator::addMovingObstacle(Dart d, unsigned int obstType)
break;
case 1 :
{
mm = new MovingMesh(envMap_, d, "meshRessources/Limace.ply");
mm = new MovingMesh(envMap_, d, "meshRessources/Limace_2.obj");
movingMeshes_.push_back(mm);
vPos = mm->computeProjectedPointSet(maxHeight);
}
......
......@@ -26,6 +26,7 @@
#include "env_generator.h"
#include <string>
#include "glm/gtc/type_ptr.hpp"
#include "Algo/Export/export.h"
SocialAgents::SocialAgents(unsigned int config, unsigned int minSize, unsigned int nbAgent, unsigned int nbObst, unsigned int iterations) :
m_renderStyle(0),
......@@ -287,11 +288,6 @@ void SocialAgents::initRendering()
m_Ground_Shader->setAttributePosition(m_Ground_VBO);
registerShader(m_Ground_Shader);
for(unsigned int i = 0 ; i < simulator.movingMeshes_.size() ; ++i)
registerShader(simulator.movingMeshes_[i]->m_simpleColorShader);
if( !m_DeferedShader.loadShaders("./shaders/Defered.vert", "./shaders/Defered.frag") )
std::cout << __FUNCTION__ << ": pas glop!" << std::endl;
......@@ -299,6 +295,9 @@ void SocialAgents::initRendering()
std::cout << __FUNCTION__ << ": pas glop!" << std::endl;
#endif
for(unsigned int i = 0 ; i < simulator.movingMeshes_.size() ; ++i)
registerShader(simulator.movingMeshes_[i]->m_simpleColorShader);
}
void SocialAgents::updateObstacleVBO()
......@@ -467,8 +466,7 @@ void SocialAgents::cb_redraw()
glClearColor( 0.8f, 0.8f, 1.0f, 1.0f );
glClear( GL_COLOR_BUFFER_BIT );
// glCullFace(GL_BACK);
glEnable(GL_CULL_FACE);
// glEnable(GL_CULL_FACE);
glEnable(GL_MULTISAMPLE);
glEnable(GL_LINE_SMOOTH);
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
......@@ -1477,6 +1475,12 @@ void SocialAgents::cb_keyPress(int keycode)
simulator.envMap_.buildingMark, filename) ;
std::string filename2("myAgents.pos") ;
simulator.exportAgents(filename2) ;
std::cout << "exporting meshes" << std::endl ;
std::string filename3("roadMap.ply") ;
std::string filename4("buildingMap.ply") ;
Algo::Surface::Export::exportPLY<PFP>(simulator.envMap_.map, simulator.envMap_.position,filename3.c_str(), false);
if(simulator.config==5)
Algo::Surface::Export::exportPLY<PFP>(simulator.envMap_.mapScenary, simulator.envMap_.positionScenary,filename4.c_str(), false);
break ;
}
case 'p' :
......
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