chromium/third_party/angle/third_party/glmark2/src/src/mesh.cpp

/*
 * Copyright © 2008 Ben Smith
 * Copyright © 2010-2011 Linaro Limited
 *
 * This file is part of the glmark2 OpenGL (ES) 2.0 benchmark.
 *
 * glmark2 is free software: you can redistribute it and/or modify it under the
 * terms of the GNU General Public License as published by the Free Software
 * Foundation, either version 3 of the License, or (at your option) any later
 * version.
 *
 * glmark2 is distributed in the hope that it will be useful, but WITHOUT ANY
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 * details.
 *
 * You should have received a copy of the GNU General Public License along with
 * glmark2.  If not, see <http://www.gnu.org/licenses/>.
 *
 * Authors:
 *  Ben Smith (original glmark benchmark)
 *  Alexandros Frantzis (glmark2)
 */
#include "mesh.h"
#include "log.h"
#include "gl-headers.h"


Mesh::Mesh() :{}

Mesh::~Mesh()
{}

/*
 * Sets the vertex format for this mesh.
 *
 * The format consists of a vector of integers, each
 * specifying the size in floats of each vertex attribute.
 *
 * e.g. {4, 3, 2} => 3 attributes vec4, vec3, vec2
 */
void
Mesh::set_vertex_format(const std::vector<int> &format)
{}

/*
 * Sets the attribute locations.
 *
 * These are the locations used in glEnableVertexAttribArray()
 * and other related functions.
 */
void
Mesh::set_attrib_locations(const std::vector<int> &locations)
{}


/**
 * Checks that an attribute is of the correct dimensionality.
 *
 * @param pos the position/index of the attribute to check
 * @param dim the size of the attribute (in #floats)
 *
 * @return whether the check succeeded
 */
bool
Mesh::check_attrib(unsigned int pos, int dim)
{}


/**
 * Ensures that we have a vertex to process.
 *
 * @return the vertex to process
 */
std::vector<float> &
Mesh::ensure_vertex()
{}

/*
 * Sets the value of an attribute in the current vertex.
 *
 * The pos parameter refers to the position of the attribute
 * as specified indirectly when setting the format using
 * set_vertex_format(). e.g. 0 = first attribute, 1 = second
 * etc
 */
void
Mesh::set_attrib(unsigned int pos, const LibMatrix::vec2 &v, std::vector<float> *vertex)
{}

void
Mesh::set_attrib(unsigned int pos, const LibMatrix::vec3 &v, std::vector<float> *vertex)
{}

void
Mesh::set_attrib(unsigned int pos, const LibMatrix::vec4 &v, std::vector<float> *vertex)
{}

/*
 * Adds a new vertex to the list and makes it current.
 */
void
Mesh::next_vertex()
{}

/**
 * Gets the mesh vertices.
 *
 * You should use the ::set_attrib() method to manipulate
 * the vertex data.
 *
 * You shouldn't resize the vector (change the number of vertices)
 * manually. Use ::next_vertex() instead.
 */
std::vector<std::vector<float> >&
Mesh::vertices()
{}

/**
 * Sets the VBO update method.
 *
 * The default value is VBOUpdateMethodMap.
 */
void
Mesh::vbo_update_method(Mesh::VBOUpdateMethod method)
{}

/**
 * Sets the VBO usage hint.
 *
 * The usage hint takes effect in the next call to ::build_vbo().
 *
 * The default value is VBOUsageStatic.
 */
void
Mesh::vbo_usage(Mesh::VBOUsage usage)
{}

/**
 * Sets the vertex attribute interleaving mode.
 *
 * If true the vertex attributes are going to be interleaved in a single
 * buffer. Otherwise they will be separated into different buffers (one
 * per attribute).
 *
 * Interleaving mode takes effect in the next call to ::build_array() or
 * ::build_vbo().
 *
 * @param interleave whether to interleave
 */
void
Mesh::interleave(bool interleave)
{}

/**
 * Resets a Mesh object to its initial, empty state.
 */
void
Mesh::reset()
{}

/**
 * Builds a vertex array containing the mesh vertex data.
 *
 * The way the vertex array is constructed is affected by the current
 * interleave value, which can set using ::interleave().
 */
void
Mesh::build_array()
{}

/**
 * Builds a vertex buffer object containing the mesh vertex data.
 *
 * The way the VBO is constructed is affected by the current interleave
 * value (::interleave()) and the vbo usage hint (::vbo_usage()).
 */
void
Mesh::build_vbo()
{}

/**
 * Updates ranges of a single vertex array.
 *
 * @param ranges the ranges of vertices to update
 * @param n the index of the vertex array to update
 * @param nfloats how many floats to update for each vertex
 * @param offset the offset (in floats) in the vertex data to start reading from
 */
void
Mesh::update_single_array(const std::vector<std::pair<size_t, size_t> >& ranges,
                          size_t n, size_t nfloats, size_t offset)
{}

/**
 * Updates ranges of the vertex arrays.
 *
 * @param ranges the ranges of vertices to update
 */
void
Mesh::update_array(const std::vector<std::pair<size_t, size_t> >& ranges)
{}


/**
 * Updates ranges of a single VBO.
 *
 * This method use either glMapBuffer or glBufferSubData to perform
 * the update. The used method can be set with ::vbo_update_method().
 *
 * @param ranges the ranges of vertices to update
 * @param n the index of the vbo to update
 * @param nfloats how many floats to update for each vertex
 */
void
Mesh::update_single_vbo(const std::vector<std::pair<size_t, size_t> >& ranges,
                        size_t n, size_t nfloats)
{}

/**
 * Updates ranges of the VBOs.
 *
 * @param ranges the ranges of vertices to update
 */
void
Mesh::update_vbo(const std::vector<std::pair<size_t, size_t> >& ranges)
{}


/**
 * Deletes all resources associated with built vertex arrays.
 */
void
Mesh::delete_array()
{}

/**
 * Deletes all resources associated with built VBOs.
 */
void
Mesh::delete_vbo()
{}


/**
 * Renders a mesh using vertex arrays.
 *
 * The vertex arrays must have been previously initialized using
 * ::build_array().
 */
void
Mesh::render_array()
{}

/**
 * Renders a mesh using vertex buffer objects.
 *
 * The vertex buffer objects must have been previously initialized using
 * ::build_vbo().
 */
void
Mesh::render_vbo()
{}

/**
 * Creates a grid mesh.
 *
 * @param n_x the number of grid cells on the X axis
 * @param n_y the number of grid cells on the Y axis
 * @param width the width X of the grid (normalized)
 * @param height the height Y of the grid (normalized)
 * @param spacing the spacing between cells (normalized)
 * @param conf_func a function to call to configure the grid (or NULL)
 */
void
Mesh::make_grid(int n_x, int n_y, double width, double height,
                double spacing, grid_configuration_func conf_func)
{}