<commit_before>#ifndef OGLTETRAHEDRALMODEL_INL_
#define OGLTETRAHEDRALMODEL_INL_

#include "OglTetrahedralModel.h"

#include <sofa/helper/gl/GLshader.h>

namespace sofa
{
namespace component
{
namespace visualmodel
{

using namespace sofa::defaulttype;

template<class DataTypes>
OglTetrahedralModel<DataTypes>::OglTetrahedralModel()
    :depthTest(initData(&depthTest, (bool) true, "depthTest", "Set Depth Test")),
     blending(initData(&blending, (bool) true, "blending", "Set Blending"))
{
}

template<class DataTypes>
OglTetrahedralModel<DataTypes>::~OglTetrahedralModel()
{
}

template<class DataTypes>
void OglTetrahedralModel<DataTypes>::init()
{
    sofa::core::objectmodel::BaseContext* context = this->getContext();
    context->get(topo);
    context->get(nodes);


    if (!nodes)
    {
        std::cerr << "No mecha." << std::endl;
        return;
    }

    if (!topo)
    {
        std::cerr << "No topo." << std::endl;
        return;
    }
}

template<class DataTypes>
void OglTetrahedralModel<DataTypes>::drawTransparent()
{
//	glDisable(GL_CULL_FACE);
//	glBegin(GL_LINES_ADJACENCY_EXT);
//		glVertex3f(5.0,0.0,0.0);
//		glVertex3f(0.0,0.0,0.0);
//		glVertex3f(0.0,-5.0,0.0);
//		glVertex3f(2.5,-2.5,-3.0);
//	glEnd();

    if(blending.getValue())
        glEnable(GL_BLEND);
    if(depthTest.getValue())
        glDepthMask(GL_FALSE);

    glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
    core::componentmodel::topology::BaseMeshTopology::SeqTetras::const_iterator it;

#ifdef GL_LINES_ADJACENCY_EXT
    const core::componentmodel::topology::BaseMeshTopology::SeqTetras& vec = topo->getTetras();
    VecCoord& x = *nodes->getX();
    Coord v;

    glBegin(GL_LINES_ADJACENCY_EXT);
    for(it = vec.begin() ; it != vec.end() ; it++)
    {

        for (unsigned int i=0 ; i< 4 ; i++)
        {
            v = x[(*it)[i]];
            glVertex3f((GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2]);
        }
    }<commit_msg>r2658/sofa-dev : BUGFIX : remove permanent drawing of ogltetrahedramodel (even if all visual models are hidden)<commit_after>#ifndef OGLTETRAHEDRALMODEL_INL_
#define OGLTETRAHEDRALMODEL_INL_

#include "OglTetrahedralModel.h"

#include <sofa/helper/gl/GLshader.h>

namespace sofa
{
namespace component
{
namespace visualmodel
{

using namespace sofa::defaulttype;

template<class DataTypes>
OglTetrahedralModel<DataTypes>::OglTetrahedralModel()
    :depthTest(initData(&depthTest, (bool) true, "depthTest", "Set Depth Test")),
     blending(initData(&blending, (bool) true, "blending", "Set Blending"))
{
}

template<class DataTypes>
OglTetrahedralModel<DataTypes>::~OglTetrahedralModel()
{
}

template<class DataTypes>
void OglTetrahedralModel<DataTypes>::init()
{
    sofa::core::objectmodel::BaseContext* context = this->getContext();
    context->get(topo);
    context->get(nodes);


    if (!nodes)
    {
        std::cerr << "No mecha." << std::endl;
        return;
    }

    if (!topo)
    {
        std::cerr << "No topo." << std::endl;
        return;
    }
}

template<class DataTypes>
void OglTetrahedralModel<DataTypes>::drawTransparent()
{
    if (!getContext()->getShowVisualModels()) return;

    if(blending.getValue())
        glEnable(GL_BLEND);
    if(depthTest.getValue())
        glDepthMask(GL_FALSE);

    glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
    core::componentmodel::topology::BaseMeshTopology::SeqTetras::const_iterator it;

#ifdef GL_LINES_ADJACENCY_EXT
    const core::componentmodel::topology::BaseMeshTopology::SeqTetras& vec = topo->getTetras();
    VecCoord& x = *nodes->getX();
    Coord v;

    glBegin(GL_LINES_ADJACENCY_EXT);
    for(it = vec.begin() ; it != vec.end() ; it++)
    {

        for (unsigned int i=0 ; i< 4 ; i++)
        {
            v = x[(*it)[i]];
            glVertex3f((GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2]);
        }
    }
{'fraction_non_alphanumeric': 0.1563721657544957, 'fraction_numerical': 0.011467292155329685, 'mean_word_length': 3.990897269180754, 'pattern_counts': {'":': 0, '<': 39, '<?xml version=': 0, '>': 32, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3832018', 'n_tokens_mistral': 1450, 'n_tokens_neox': 1423, 'n_words': 223}