Author: richefeu
Date: 2008-10-30 09:50:59 +0100 (Thu, 30 Oct 2008)
New Revision: 1566

Added:
   
trunk/pkg/common/RenderingEngine/GLDrawInteractingGeometry/GLDrawBssSweptSphereLineSegment.cpp
   
trunk/pkg/common/RenderingEngine/GLDrawInteractingGeometry/GLDrawBssSweptSphereLineSegment.hpp
Modified:
   trunk/pkg/common/DataClass/InteractingGeometry/BssSweptSphereLineSegment.hpp
   
trunk/pkg/common/Engine/EngineUnit/ef2_BshTube_BssSweptSphereLineSegment_makeBssSweptSphereLineSegment.cpp
   trunk/pkg/common/RenderingEngine/GLDrawGeometricalModel/GLDrawTube.cpp
   trunk/pkg/common/RenderingEngine/GLDrawGeometricalModel/GLDrawTube.hpp
   trunk/pkg/common/SConscript
   trunk/pkg/dem/PreProcessor/MembraneTest.cpp
Log:
- add GLDraw plugin for BssSweptSphereLineSegment displaying


Modified: 
trunk/pkg/common/DataClass/InteractingGeometry/BssSweptSphereLineSegment.hpp
===================================================================
--- 
trunk/pkg/common/DataClass/InteractingGeometry/BssSweptSphereLineSegment.hpp    
    2008-10-29 19:29:18 UTC (rev 1565)
+++ 
trunk/pkg/common/DataClass/InteractingGeometry/BssSweptSphereLineSegment.hpp    
    2008-10-30 08:50:59 UTC (rev 1566)
@@ -1,6 +1,6 @@
 /*************************************************************************
 *  Copyright (C) 2008 by Vincent Richefeu                                *
-*  [EMAIL PROTECTED]                                               *
+*  [EMAIL PROTECTED]                                          *
 *                                                                        *
 *  This program is free software; it is licensed under the terms of the  *
 *  GNU General Public License v2 or later. See file LICENSE for details. *

Modified: 
trunk/pkg/common/Engine/EngineUnit/ef2_BshTube_BssSweptSphereLineSegment_makeBssSweptSphereLineSegment.cpp
===================================================================
--- 
trunk/pkg/common/Engine/EngineUnit/ef2_BshTube_BssSweptSphereLineSegment_makeBssSweptSphereLineSegment.cpp
  2008-10-29 19:29:18 UTC (rev 1565)
+++ 
trunk/pkg/common/Engine/EngineUnit/ef2_BshTube_BssSweptSphereLineSegment_makeBssSweptSphereLineSegment.cpp
  2008-10-30 08:50:59 UTC (rev 1566)
@@ -20,16 +20,17 @@
   //if(ig == 0)
   //  ig = boost::shared_ptr<InteractingGeometry>(new BshTube);
 
-  BssSweptSphereLineSegment* SSLS = 
YADE_CAST<BssSweptSphereLineSegment*>(ig.get());
+  BssSweptSphereLineSegment* SSLS = 
static_cast<BssSweptSphereLineSegment*>(ig.get());
   
   SSLS->radius = tube->radius;
-  SSLS->length = 2.0 * tube->half_height;
+  //SSLS->length = 2.0 * tube->half_height;
   
-  BcpConnection* bc = 
YADE_CAST<BcpConnection*>(body->physicalParameters.get());
+  BcpConnection* bc = 
static_cast<BcpConnection*>(body->physicalParameters.get());
 
   SSLS->position = 
(*(Omega::instance().getRootBody()->bodies))[bc->id1]->physicalParameters->se3.position;
   Vector3r len = 
(*(Omega::instance().getRootBody()->bodies))[bc->id2]->physicalParameters->se3.position
 - SSLS->position;
-  *(SSLS->orientation) = len.Normalize();
+  SSLS->length = len.Normalize();
+  SSLS->orientation = len;
   
 }
        

Modified: trunk/pkg/common/RenderingEngine/GLDrawGeometricalModel/GLDrawTube.cpp
===================================================================
--- trunk/pkg/common/RenderingEngine/GLDrawGeometricalModel/GLDrawTube.cpp      
2008-10-29 19:29:18 UTC (rev 1565)
+++ trunk/pkg/common/RenderingEngine/GLDrawGeometricalModel/GLDrawTube.cpp      
2008-10-30 08:50:59 UTC (rev 1566)
@@ -11,7 +11,10 @@
 #include<yade/lib-opengl/OpenGLWrapper.hpp>
 #include<yade/lib-base/yadeWm3.hpp>
 
-
+bool GLDrawTube::first           = true;
+int  GLDrawTube::glWiredTubeList = -1;
+int  GLDrawTube::glTubeList      = -1;
+    
 void GLDrawTube::go(const shared_ptr<GeometricalModel>& gm, const 
shared_ptr<PhysicalParameters>&,bool wire)
 {
        

Modified: trunk/pkg/common/RenderingEngine/GLDrawGeometricalModel/GLDrawTube.hpp
===================================================================
--- trunk/pkg/common/RenderingEngine/GLDrawGeometricalModel/GLDrawTube.hpp      
2008-10-29 19:29:18 UTC (rev 1565)
+++ trunk/pkg/common/RenderingEngine/GLDrawGeometricalModel/GLDrawTube.hpp      
2008-10-30 08:50:59 UTC (rev 1566)
@@ -11,12 +11,13 @@
 
 #include<yade/pkg-common/GLDrawFunctors.hpp>
 
+
 class GLDrawTube : public GLDrawGeometricalModelFunctor
 {
        private :
-               bool first;
-               int  glWiredTubeList;
-               int  glTubeList;
+               static bool first;
+               static int  glWiredTubeList;
+               static int  glTubeList;
                 
        public :
                virtual void go(const shared_ptr<GeometricalModel>&, const 
shared_ptr<PhysicalParameters>&,bool);

Added: 
trunk/pkg/common/RenderingEngine/GLDrawInteractingGeometry/GLDrawBssSweptSphereLineSegment.cpp
===================================================================
--- 
trunk/pkg/common/RenderingEngine/GLDrawInteractingGeometry/GLDrawBssSweptSphereLineSegment.cpp
      2008-10-29 19:29:18 UTC (rev 1565)
+++ 
trunk/pkg/common/RenderingEngine/GLDrawInteractingGeometry/GLDrawBssSweptSphereLineSegment.cpp
      2008-10-30 08:50:59 UTC (rev 1566)
@@ -0,0 +1,73 @@
+/*************************************************************************
+*  Copyright (C) 2008 by Vincent Richefeu                                *
+*  [EMAIL PROTECTED]                                          *
+*                                                                        *
+*  This program is free software; it is licensed under the terms of the  *
+*  GNU General Public License v2 or later. See file LICENSE for details. *
+*************************************************************************/
+
+#include "GLDrawBssSweptSphereLineSegment.hpp"
+#include<yade/pkg-common/BssSweptSphereLineSegment.hpp>
+#include<yade/lib-opengl/OpenGLWrapper.hpp>
+
+bool GLDrawBssSweptSphereLineSegment::first       = true;
+int  GLDrawBssSweptSphereLineSegment::glList      = -1;
+int  GLDrawBssSweptSphereLineSegment::glWiredList = -1;
+
+GLDrawBssSweptSphereLineSegment::GLDrawBssSweptSphereLineSegment(){ 
/*first=true;*/ };
+
+void GLDrawBssSweptSphereLineSegment::go(const 
shared_ptr<InteractingGeometry>& cm, const shared_ptr<PhysicalParameters>& 
,bool)
+{
+        
+  if (first)
+  {        
+        const Real my2PI  = 6.28318530717958647692;
+        const Real myPI_6 = 5.23598775598298873077e-1;
+                                
+        glList = glGenLists(1);
+        glNewList(glList,GL_COMPILE);
+        glDisable(GL_CULL_FACE);
+        glEnable(GL_LIGHTING);
+        glBegin(GL_TRIANGLE_STRIP);
+        for (Real a = 0.0 ; a < my2PI ; a += myPI_6)
+        {
+                glVertex3f(-1.0f, cos(a), sin(a));
+                glVertex3f( 1.0f, cos(a), sin(a));
+        }
+                glVertex3f(-1.0f, cos(0.0), sin(0.0));
+                glVertex3f( 1.0f, cos(0.0), sin(0.0));
+        glEnd(); 
+        glEndList();
+                
+        first = false;
+  }
+
+  BssSweptSphereLineSegment* ssls = static_cast<BssSweptSphereLineSegment*> 
(cm.get());
+  
+  Real radius = ssls->radius;
+  Real half_length = 0.5 * ssls->length;
+
+  glMaterialv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, 
Vector3f(cm->diffuseColor[0],cm->diffuseColor[1],cm->diffuseColor[2]));
+  glColor3v(cm->diffuseColor);
+  
+  static GLUquadric* quadric = gluNewQuadric();
+  
+  glPushMatrix();
+  glScalef(half_length,radius,radius);
+  glCallList(glList);
+  glPopMatrix();
+  
+  // It is not very elegant but it provides assistance
+  // TODO - write a gl-list that draw 2 halh spheres 
+  glTranslate(-half_length, 0.0, 0.0);
+  gluSphere(quadric, radius, 5, 5);
+  glTranslate(2.0*half_length, 0.0, 0.0);
+  gluSphere(quadric, radius, 5, 5);
+}
+
+
+
+
+
+YADE_PLUGIN();
+

Added: 
trunk/pkg/common/RenderingEngine/GLDrawInteractingGeometry/GLDrawBssSweptSphereLineSegment.hpp
===================================================================
--- 
trunk/pkg/common/RenderingEngine/GLDrawInteractingGeometry/GLDrawBssSweptSphereLineSegment.hpp
      2008-10-29 19:29:18 UTC (rev 1565)
+++ 
trunk/pkg/common/RenderingEngine/GLDrawInteractingGeometry/GLDrawBssSweptSphereLineSegment.hpp
      2008-10-30 08:50:59 UTC (rev 1566)
@@ -0,0 +1,36 @@
+/*************************************************************************
+*  Copyright (C) 2008 by Vincent Richefeu                                *
+*  [EMAIL PROTECTED]                                          *
+*                                                                        *
+*  This program is free software; it is licensed under the terms of the  *
+*  GNU General Public License v2 or later. See file LICENSE for details. *
+*************************************************************************/
+
+#ifndef GLDRAW_BSS_SWEPT_SPHERE_LINE_SEGMENT_HPP
+#define GLDRAW_BSS_SWEPT_SPHERE_LINE_SEGMENT_HPP
+
+#include<yade/pkg-common/GLDrawFunctors.hpp>
+
+class GLDrawBssSweptSphereLineSegment : public GLDrawInteractingGeometryFunctor
+{      
+       private :
+               static bool first;
+               static int  glWiredList;
+               static int  glList;
+       
+       public :
+                GLDrawBssSweptSphereLineSegment();
+               virtual void go(const shared_ptr<InteractingGeometry>&, const 
shared_ptr<PhysicalParameters>&,bool);
+/// Serialization
+       protected :
+               virtual void postProcessAttributes(bool 
deserializing){if(deserializing){first=true;};};
+
+        RENDERS(BssSweptSphereLineSegment);
+        REGISTER_CLASS_NAME(GLDrawBssSweptSphereLineSegment);
+       REGISTER_BASE_CLASS_NAME(GLDrawInteractingGeometryFunctor);
+};
+
+REGISTER_SERIALIZABLE(GLDrawBssSweptSphereLineSegment,false);
+
+#endif //  GLDRAW_BSS_SWEPT_SPHERE_LINE_SEGMENT_HPP
+

Modified: trunk/pkg/common/SConscript
===================================================================
--- trunk/pkg/common/SConscript 2008-10-29 19:29:18 UTC (rev 1565)
+++ trunk/pkg/common/SConscript 2008-10-30 08:50:59 UTC (rev 1566)
@@ -164,7 +164,7 @@
        
env.SharedLibrary('GLDrawMesh2D',['RenderingEngine/GLDrawGeometricalModel/GLDrawMesh2D.cpp'],
                LIBS=env['LIBS']+['yade-base','Mesh2D','yade-opengl']),
        
env.SharedLibrary('GLDrawSphere',['RenderingEngine/GLDrawGeometricalModel/GLDrawSphere.cpp'],
-               LIBS=env['LIBS']+['yade-base','Sphere','yade-opengl']),
+               LIBS=env['LIBS']+['yade-base','Sphere','yade-opengl']),         
      
        
env.SharedLibrary('GLDrawQuadrilateral',['RenderingEngine/GLDrawGeometricalModel/GLDrawQuadrilateral.cpp'],
                LIBS=env['LIBS']+['yade-base','Quadrilateral','yade-opengl']),
        
env.SharedLibrary('GLDrawFacet',['RenderingEngine/GLDrawGeometricalModel/GLDrawFacet.cpp']
@@ -173,6 +173,8 @@
                LIBS=env['LIBS']+['yade-base','InteractingBox','yade-opengl']),
        
env.SharedLibrary('GLDrawInteractingSphere',['RenderingEngine/GLDrawInteractingGeometry/GLDrawInteractingSphere.cpp'],
                
LIBS=env['LIBS']+['yade-base','InteractingSphere','yade-opengl'],),
+         
env.SharedLibrary('GLDrawBssSweptSphereLineSegment',['RenderingEngine/GLDrawInteractingGeometry/GLDrawBssSweptSphereLineSegment.cpp'],
+                
LIBS=env['LIBS']+['yade-base','BssSweptSphereLineSegment','yade-opengl']),      
         
        
env.SharedLibrary('GLDrawMetaInteractingGeometry',['RenderingEngine/GLDrawInteractingGeometry/GLDrawMetaInteractingGeometry.cpp'],
                LIBS=env['LIBS']+['yade-opengl']),
        
env.SharedLibrary('GLDrawInteractingFacet',['RenderingEngine/GLDrawInteractingGeometry/GLDrawInteractingFacet.cpp']

Modified: trunk/pkg/dem/PreProcessor/MembraneTest.cpp
===================================================================
--- trunk/pkg/dem/PreProcessor/MembraneTest.cpp 2008-10-29 19:29:18 UTC (rev 
1565)
+++ trunk/pkg/dem/PreProcessor/MembraneTest.cpp 2008-10-30 08:50:59 UTC (rev 
1566)
@@ -204,6 +204,8 @@
         tube->half_height           = 0.5 * link.Length();
         tube->diffuseColor          = 
Vector3r(Mathr::UnitRandom(),Mathr::UnitRandom(),Mathr::UnitRandom());
         
+        bss->diffuseColor           = 
Vector3r(Mathr::UnitRandom(),Mathr::UnitRandom(),Mathr::UnitRandom());
+        
         body->isDynamic             = false;
         body->geometricalModel      = tube;
         body->interactingGeometry   = bss;
@@ -259,10 +261,11 @@
         shared_ptr<InteractingSphere> isph(new InteractingSphere);      // Bss
                
         
-       if ((i==0 && j==0)||(i==0 && j==nbZ)||(i==nbX && j==nbZ)||(i==nbX && 
j==0))
-               body->isDynamic = false;
-       else
-               body->isDynamic = true;
+//     if ((i==0 && j==0)||(i==0 && j==nbZ)||(i==nbX && j==nbZ)||(i==nbX && 
j==0))
+//             body->isDynamic = false;
+//     else
+//             body->isDynamic = true;
+        body->isDynamic = false; // During interaction debuging
         
         node->radius                    = 0.5 * membraneThickness;
        node->diffuseColor              = Vector3r(0.7,0.7,0.7);
@@ -293,7 +296,7 @@
        physicalActionInitializer->physicalActionNames.push_back("Force");
        //physicalActionInitializer->physicalActionNames.push_back("Momentum");
        
-       shared_ptr<InteractionPhysicsMetaEngine> 
interactionPhysicsDispatcher(new InteractionPhysicsMetaEngine);
+       //shared_ptr<InteractionPhysicsMetaEngine> 
interactionPhysicsDispatcher(new InteractionPhysicsMetaEngine);
         //interactionPhysicsDispatcher->add("ElasticBodySimpleRelationship");
                
        shared_ptr<InteractionGeometryMetaEngine> 
interactionGeometryDispatcher(new InteractionGeometryMetaEngine);
@@ -306,7 +309,7 @@
        shared_ptr<BoundingVolumeMetaEngine> boundingVolumeDispatcher   = 
shared_ptr<BoundingVolumeMetaEngine>(new BoundingVolumeMetaEngine);
        boundingVolumeDispatcher->add("InteractingSphere2AABB"); // 
        //boundingVolumeDispatcher->add("InteractingBox2AABB");
-       
//boundingVolumeDispatcher->add("ef2_BssSweptSphereLineSegment_AABB_makeAABB"); 
// 
+       
//boundingVolumeDispatcher->add("ef2_BssSweptSphereLineSegment_AABB_makeAABB");
        boundingVolumeDispatcher->add("MetaInteractingGeometry2AABB"); 
        
        shared_ptr<GravityEngine> gravityCondition(new GravityEngine);
@@ -329,8 +332,8 @@
        shared_ptr<PhysicalParametersMetaEngine> positionIntegrator(new 
PhysicalParametersMetaEngine);
        positionIntegrator->add("LeapFrogPositionIntegrator");
 
-       shared_ptr<PhysicalParametersMetaEngine> orientationIntegrator(new 
PhysicalParametersMetaEngine);
-       orientationIntegrator->add("LeapFrogOrientationIntegrator");
+       //shared_ptr<PhysicalParametersMetaEngine> orientationIntegrator(new 
PhysicalParametersMetaEngine);
+       //orientationIntegrator->add("LeapFrogOrientationIntegrator");
        //////////////////
        
 /*
@@ -342,18 +345,18 @@
 */
 
        rootBody->engines.clear();
-       rootBody->engines.push_back(shared_ptr<Engine>(new 
PhysicalActionContainerReseter));
+       //rootBody->engines.push_back(shared_ptr<Engine>(new 
PhysicalActionContainerReseter));
        rootBody->engines.push_back(boundingVolumeDispatcher);  
        rootBody->engines.push_back(shared_ptr<Engine>(new 
PersistentSAPCollider));
-       rootBody->engines.push_back(interactionGeometryDispatcher);
-       rootBody->engines.push_back(interactionPhysicsDispatcher);
+       //rootBody->engines.push_back(interactionGeometryDispatcher);
+       //rootBody->engines.push_back(interactionPhysicsDispatcher);
        //rootBody->engines.push_back(shared_ptr<Engine>(new MyTetrahedronLaw));
        rootBody->engines.push_back(gravityCondition);
        //rootBody->engines.push_back(actionDampingDispatcher);
        rootBody->engines.push_back(applyActionDispatcher);
        rootBody->engines.push_back(positionIntegrator);
        //if(!rotationBlocked)
-               rootBody->engines.push_back(orientationIntegrator);
+       //      rootBody->engines.push_back(orientationIntegrator);
        
        rootBody->initializers.clear();
        rootBody->initializers.push_back(physicalActionInitializer);


_______________________________________________
Mailing list: https://launchpad.net/~yade-dev
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~yade-dev
More help   : https://help.launchpad.net/ListHelp

Reply via email to