CollisionModel.cpp

Go to the documentation of this file.
00001 /******************************************************************************
00002 *       SOFA, Simulation Open-Framework Architecture, version 1.0 beta 3      *
00003 *                (c) 2006-2008 MGH, INRIA, USTL, UJF, CNRS                    *
00004 *                                                                             *
00005 * This library is free software; you can redistribute it and/or modify it     *
00006 * under the terms of the GNU Lesser General Public License as published by    *
00007 * the Free Software Foundation; either version 2.1 of the License, or (at     *
00008 * your option) any later version.                                             *
00009 *                                                                             *
00010 * This library is distributed in the hope that it will be useful, but WITHOUT *
00011 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or       *
00012 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
00013 * for more details.                                                           *
00014 *                                                                             *
00015 * You should have received a copy of the GNU Lesser General Public License    *
00016 * along with this library; if not, write to the Free Software Foundation,     *
00017 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.          *
00018 *******************************************************************************
00019 *                              SOFA :: Framework                              *
00020 *                                                                             *
00021 * Authors: M. Adam, J. Allard, B. Andre, P-J. Bensoussan, S. Cotin, C. Duriez,*
00022 * H. Delingette, F. Falipou, F. Faure, S. Fonteneau, L. Heigeas, C. Mendoza,  *
00023 * M. Nesme, P. Neumann, J-P. de la Plata Alcade, F. Poyer and F. Roy          *
00024 *                                                                             *
00025 * Contact information: contact@sofa-framework.org                             *
00026 ******************************************************************************/
00027 #include "CollisionModel.h"
00028 
00029 namespace sofa
00030 {
00031 
00032 namespace core
00033 {
00034 
00035 std::vector<int> BaseCollisionElementIterator::emptyVector; 
00036 
00037 
00039 const float* CollisionModel::getColor4f() 
00040 {
00041     
00042     static float defaultColorSimulatedMovingActive[4] = {1, 0.5f, 0, 1};
00043 
00044     static float defaultColorSimulatedMoving[4] = {0.5f, 0.25f, 0, 1};
00045 
00046     static float defaultColorSimulatedActive[4] = {1, 0, 0, 1};
00047 
00048     static float defaultColorSimulated[4] = {0.5f, 0, 0, 1};
00049 
00050     static float defaultColorMovingActive[4] = {0, 1, 0.5f, 1};
00051 
00052     static float defaultColorMoving[4] = {0, 0.5f, 0.25f, 1};
00053 
00054     static float defaultColorActive[4] = {0.5f, 0.5f, 0.5f, 1};
00055 
00056     static float defaultColor[4] = {0.25f, 0.25f, 0.25f, 1};
00057 
00058     if (color.isSet())
00059     return color.getValue().ptr();
00060     else if (isSimulated())
00061     if (isMoving())
00062         if (isActive()) {setColor4f(defaultColorSimulatedMovingActive);return defaultColorSimulatedMovingActive;}
00063         else            {setColor4f(defaultColorSimulatedMoving);return defaultColorSimulatedMoving;}
00064     else
00065         if (isActive()) {setColor4f(defaultColorSimulatedActive);return defaultColorSimulatedActive;}
00066         else            {setColor4f(defaultColorSimulated);return defaultColorSimulated;}
00067     else
00068     if (isMoving())
00069         if (isActive()) {setColor4f(defaultColorMovingActive);return defaultColorMovingActive;}
00070         else            {setColor4f(defaultColorMoving);return defaultColorMoving;}
00071     else
00072         if (isActive()) {setColor4f(defaultColorActive);return defaultColorActive;}
00073         else            {setColor4f(defaultColor);return defaultColor;}
00074 }
00075 
00076 } // namespace core
00077 
00078 } // namespace sofa
00079 

Generated on Sun Nov 23 02:28:39 2008 for Sofa by  doxygen 1.5.7.1