<commit_before>/*
 * Copyright (C) 2015 <NAME>
 * All rights reserved
 */
#include "mesh_chunk.h"
namespace game { namespace gfx
{
  Mesh_Chunk copy_mesh_chunk_share_mesh(Mesh_Chunk const& orig) noexcept
  {
    Mesh_Chunk ret;

    ret.start = orig.start;
    ret.count = orig.count;

    ret.type = orig.type;
    ret.mesh.set_pointer(orig.mesh.get());

    ret.base_vertex = orig.base_vertex;

    return ret;
  }
  Mesh_Chunk copy_mesh_chunk_move_mesh(Mesh_Chunk& orig) noexcept
  {
    Mesh_Chunk ret;

    ret.start = orig.start;
    ret.count = orig.count;

    ret.type = orig.type;

    ret.mesh = std::move(orig.mesh);
    orig.mesh.set_pointer(ret.mesh.get());

    ret.base_vertex = orig.base_vertex;

    return ret;
  }
  void render_chunk(Mesh_Chunk const& m) noexcept
  {
    if(!m.mesh) return;

    m.mesh->set_primitive_type(m.type);

    if(m.base_vertex)
    {
      if(m.base_vertex.value() == 0)
      {
        m.mesh->draw_elements(m.start, m.count);
      }
      else
      {
        m.mesh->draw_elements_base_vertex(m.start, m.count,
                                          m.base_vertex.value());
      }
    }
    else
    {
      m.mesh->draw_arrays(m.start, m.count);
    }
  }<commit_msg>Cleaner implementation of mesh_chunk sharing vs. moving functions.<commit_after>/*
 * Copyright (C) 2015 <NAME>
 * All rights reserved
 */
#include "mesh_chunk.h"
namespace game { namespace gfx
{
  Mesh_Chunk copy_mesh_chunk_share_mesh(Mesh_Chunk const& orig) noexcept
  {
    Mesh_Chunk ret;

    ret.start = orig.start;
    ret.count = orig.count;

    ret.type = orig.type;

    ret.mesh = ref_mo(orig.mesh);

    ret.base_vertex = orig.base_vertex;

    return ret;
  }
  Mesh_Chunk copy_mesh_chunk_move_mesh(Mesh_Chunk& orig) noexcept
  {
    Mesh_Chunk ret;

    ret.start = orig.start;
    ret.count = orig.count;

    ret.type = orig.type;

    ret.mesh = std::move(orig.mesh);

    ret.base_vertex = orig.base_vertex;

    return ret;
  }
  void render_chunk(Mesh_Chunk const& m) noexcept
  {
    if(!m.mesh) return;

    m.mesh->set_primitive_type(m.type);

    if(m.base_vertex)
    {
      if(m.base_vertex.value() == 0)
      {
        m.mesh->draw_elements(m.start, m.count);
      }
      else
      {
        m.mesh->draw_elements_base_vertex(m.start, m.count,
                                          m.base_vertex.value());
      }
    }
    else
    {
      m.mesh->draw_arrays(m.start, m.count);
    }
  }
{'fraction_non_alphanumeric': 0.12571428571428572, 'fraction_numerical': 0.004081632653061225, 'mean_word_length': 2.2767379679144386, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3673877', 'n_tokens_mistral': 903, 'n_tokens_neox': 858, 'n_words': 149}