mirror of
https://github.com/g-truc/glm.git
synced 2024-11-22 08:54:35 +00:00
Promoted extension
This commit is contained in:
parent
833ef6bcc6
commit
d56da3b541
@ -0,0 +1,62 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// OpenGL Mathematics Copyright (c) 2005 - 2010 G-Truc Creation (www.g-truc.net)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Created : 2005-12-27
|
||||
// Updated : 2010-11-12
|
||||
// Licence : This source is under MIT License
|
||||
// File : glm/gtc/matrix_access.hpp
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Dependency:
|
||||
// - GLM core
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef glm_gtc_matrix_access
|
||||
#define glm_gtc_matrix_access
|
||||
|
||||
// Dependency:
|
||||
#include "../glm.hpp"
|
||||
|
||||
namespace glm{
|
||||
namespace gtc{
|
||||
//! GLM_GTC_matrix_access extension: Set a column or a row of a matrix
|
||||
namespace matrix_access
|
||||
{
|
||||
//! Get a specific row of a matrix.
|
||||
//! From GLM_GTC_matrix_access extension.
|
||||
template <typename genType>
|
||||
typename genType::row_type row(
|
||||
genType const & m,
|
||||
int index);
|
||||
|
||||
//! Set a specific row to a matrix.
|
||||
//! From GLM_GTC_matrix_access extension.
|
||||
template <typename genType>
|
||||
genType row(
|
||||
genType const & m,
|
||||
int index,
|
||||
typename genType::row_type const & x);
|
||||
|
||||
//! Get a specific column of a matrix.
|
||||
//! From GLM_GTC_matrix_access extension.
|
||||
template <typename genType>
|
||||
typename genType::col_type column(
|
||||
genType const & m,
|
||||
int index);
|
||||
|
||||
//! Set a specific column to a matrix.
|
||||
//! From GLM_GTC_matrix_access extension.
|
||||
template <typename genType>
|
||||
genType column(
|
||||
genType const & m,
|
||||
int index,
|
||||
typename genType::col_type const & x);
|
||||
|
||||
}//namespace matrix_access
|
||||
}//namespace gtc
|
||||
}//namespace glm
|
||||
|
||||
#include "matrix_access.inl"
|
||||
|
||||
namespace glm{using namespace gtc::matrix_access;}
|
||||
|
||||
#endif//glm_gtc_matrix_access
|
@ -0,0 +1,59 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// OpenGL Mathematics Copyright (c) 2005 - 2010 G-Truc Creation (www.g-truc.net)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Created : 2005-12-27
|
||||
// Updated : 2010-11-12
|
||||
// Licence : This source is under MIT License
|
||||
// File : glm/gtc/matrix_access.inl
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace glm{
|
||||
namespace gtc{
|
||||
namespace matrix_access
|
||||
{
|
||||
template <typename genType>
|
||||
inline genType row(
|
||||
genType const & m,
|
||||
int index,
|
||||
typename genType::row_type const & x)
|
||||
{
|
||||
genType Result = m;
|
||||
for(typename genType::size_type i = 0; i < genType::row_size(); ++i)
|
||||
Result[i][index] = x[i];
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename genType>
|
||||
inline typename genType::row_type row(
|
||||
genType & const m,
|
||||
int index)
|
||||
{
|
||||
typename genType::row_type Result;
|
||||
for(typename genType::size_type i = 0; i < genType::row_size(); ++i)
|
||||
Result[i] = m[i][index];
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename genType>
|
||||
inline genType column(
|
||||
genType const & m,
|
||||
int index,
|
||||
typename genType::col_type const & x)
|
||||
{
|
||||
genType Result = m;
|
||||
Result[index] = x;
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename genType>
|
||||
inline typename genType::col_type column(
|
||||
genType const & m,
|
||||
int index)
|
||||
{
|
||||
return m[index];
|
||||
}
|
||||
|
||||
}//namespace matrix_access
|
||||
}//namespace gtc
|
||||
}//namespace glm
|
||||
|
Loading…
Reference in New Issue
Block a user