chromium/third_party/angle/third_party/glmark2/src/src/libmatrix/vec.h

//
// Copyright (c) 2010-2011 Linaro Limited
//
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the MIT License which accompanies
// this distribution, and is available at
// http://www.opensource.org/licenses/mit-license.php
//
// Contributors:
//     Jesse Barker - original implementation.
//
#ifndef VEC_H_
#define VEC_H_

#include <iostream> // only needed for print() functions...
#include <math.h>

namespace LibMatrix
{
// A template class for creating, managing and operating on a 2-element vector
// of any type you like (intended for built-in types, but as long as it 
// supports the basic arithmetic and assignment operators, any type should
// work).
template<typename T>
class tvec2
{};

// A template class for creating, managing and operating on a 3-element vector
// of any type you like (intended for built-in types, but as long as it 
// supports the basic arithmetic and assignment operators, any type should
// work).
template<typename T>
class tvec3
{};

// A template class for creating, managing and operating on a 4-element vector
// of any type you like (intended for built-in types, but as long as it 
// supports the basic arithmetic and assignment operators, any type should
// work).
template<typename T>
class tvec4
{};

//
// Convenience typedefs.  These are here to present a homogeneous view of these
// objects with respect to shader source.
//
vec2;
vec3;
vec4;

dvec2;
dvec3;
dvec4;

ivec2;
ivec3;
ivec4;

uvec2;
uvec3;
uvec4;

bvec2;
bvec3;
bvec4;

} // namespace LibMatrix

// Global operators to allow for things like defining a new vector in terms of
// a product of a scalar and a vector
template<typename T>
const LibMatrix::tvec2<T> operator*(const T t, const LibMatrix::tvec2<T>& v)
{}

template<typename T>
const LibMatrix::tvec3<T> operator*(const T t, const LibMatrix::tvec3<T>& v)
{}

template<typename T>
const LibMatrix::tvec4<T> operator*(const T t, const LibMatrix::tvec4<T>& v)
{}

#endif // VEC_H_