/*
 * eos - A 3D Morphable Model fitting library written in modern C++11/14.
 *
 * File: include/eos/render/detail/Vertex.hpp
 *
 * Copyright 2017 Patrik Huber
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
#pragma once

#ifndef VERTEX_HPP_
#define VERTEX_HPP_

#include "glm/vec2.hpp"
#include "glm/vec3.hpp"
#include "glm/vec4.hpp"

/**
 * The detail namespace contains implementations of internal functions, not part of the API we expose and not
 * meant to be used by a user.
 */
namespace eos {
namespace render {
namespace detail {

/**
 * @brief A representation for a vertex during rendering, used internally.
 *
 * It's used to build the vertices that will be rendered, and new vertices that are generated by the renderer
 * (during clipping).
 * I should check at some point that no unnecessary copies of the vertex data is created in some places, but I
 * think it's pretty much fine.
 *
 * FragmentShader and SoftwareRenderer use this.
 *
 * This is the same as the one in the current render_detail.hpp, except that this is fully templated.
 *
 */
template <typename T, glm::precision P = glm::defaultp>
struct Vertex
{
    glm::tvec4<T, P> position;  // XYZW
    glm::tvec3<T, P> color;     // RGB order
    glm::tvec2<T, P> texcoords; // UV
};

} /* namespace detail */
} /* namespace render */
} /* namespace eos */

#endif /* VERTEX_HPP_ */
