indent classes, align by spaces
This commit is contained in:
294
include/ipatch.h
294
include/ipatch.h
@@ -33,187 +33,187 @@ class Node;
|
||||
template<typename Element>
|
||||
class ArrayReference
|
||||
{
|
||||
std::size_t m_size;
|
||||
Element* m_data;
|
||||
std::size_t m_size;
|
||||
Element* m_data;
|
||||
public:
|
||||
typedef Element value_type;
|
||||
typedef value_type* iterator;
|
||||
typedef const value_type* const_iterator;
|
||||
typedef Element value_type;
|
||||
typedef value_type* iterator;
|
||||
typedef const value_type* const_iterator;
|
||||
|
||||
ArrayReference()
|
||||
: m_size( 0 ), m_data( 0 ){
|
||||
}
|
||||
ArrayReference( std::size_t size, Element* data )
|
||||
: m_size( size ), m_data( data ){
|
||||
}
|
||||
ArrayReference()
|
||||
: m_size( 0 ), m_data( 0 ){
|
||||
}
|
||||
ArrayReference( std::size_t size, Element* data )
|
||||
: m_size( size ), m_data( data ){
|
||||
}
|
||||
|
||||
iterator begin(){
|
||||
return m_data;
|
||||
}
|
||||
const_iterator begin() const {
|
||||
return m_data;
|
||||
}
|
||||
iterator end(){
|
||||
return m_data + m_size;
|
||||
}
|
||||
const_iterator end() const {
|
||||
return m_data + m_size;
|
||||
}
|
||||
iterator begin(){
|
||||
return m_data;
|
||||
}
|
||||
const_iterator begin() const {
|
||||
return m_data;
|
||||
}
|
||||
iterator end(){
|
||||
return m_data + m_size;
|
||||
}
|
||||
const_iterator end() const {
|
||||
return m_data + m_size;
|
||||
}
|
||||
|
||||
value_type& operator[]( std::size_t index ){
|
||||
value_type& operator[]( std::size_t index ){
|
||||
#if defined( _DEBUG )
|
||||
ASSERT_MESSAGE( index < size(), "array index out of bounds" );
|
||||
ASSERT_MESSAGE( index < size(), "array index out of bounds" );
|
||||
#endif
|
||||
return m_data[index];
|
||||
}
|
||||
const value_type& operator[]( std::size_t index ) const {
|
||||
return m_data[index];
|
||||
}
|
||||
const value_type& operator[]( std::size_t index ) const {
|
||||
#if defined( _DEBUG )
|
||||
ASSERT_MESSAGE( index < size(), "array index out of bounds" );
|
||||
ASSERT_MESSAGE( index < size(), "array index out of bounds" );
|
||||
#endif
|
||||
return m_data[index];
|
||||
}
|
||||
value_type* data(){
|
||||
return m_data;
|
||||
}
|
||||
const value_type* data() const {
|
||||
return m_data;
|
||||
}
|
||||
std::size_t size() const {
|
||||
return m_size;
|
||||
}
|
||||
bool empty() const {
|
||||
return m_size == 0;
|
||||
}
|
||||
return m_data[index];
|
||||
}
|
||||
value_type* data(){
|
||||
return m_data;
|
||||
}
|
||||
const value_type* data() const {
|
||||
return m_data;
|
||||
}
|
||||
std::size_t size() const {
|
||||
return m_size;
|
||||
}
|
||||
bool empty() const {
|
||||
return m_size == 0;
|
||||
}
|
||||
};
|
||||
|
||||
#if 0
|
||||
template<typename Element>
|
||||
class MatrixIterator
|
||||
{
|
||||
Element* m_position;
|
||||
Element* m_position;
|
||||
|
||||
void increment(){
|
||||
++m_position;
|
||||
}
|
||||
void increment(){
|
||||
++m_position;
|
||||
}
|
||||
|
||||
public:
|
||||
typedef std::bidirectional_iterator_tag iterator_category;
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
typedef difference_type distance_type;
|
||||
typedef KeyValue<Key, Value> value_type;
|
||||
typedef value_type* pointer;
|
||||
typedef value_type& reference;
|
||||
typedef std::bidirectional_iterator_tag iterator_category;
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
typedef difference_type distance_type;
|
||||
typedef KeyValue<Key, Value> value_type;
|
||||
typedef value_type* pointer;
|
||||
typedef value_type& reference;
|
||||
|
||||
MatrixIterator( Element* position ) : m_position( position ){
|
||||
}
|
||||
MatrixIterator( Element* position ) : m_position( position ){
|
||||
}
|
||||
|
||||
Element* position(){
|
||||
return m_position;
|
||||
}
|
||||
Element* position(){
|
||||
return m_position;
|
||||
}
|
||||
|
||||
bool operator==( const MatrixIterator& other ) const {
|
||||
return m_position == other.m_position;
|
||||
}
|
||||
bool operator!=( const MatrixIterator& other ) const {
|
||||
return !operator==( other );
|
||||
}
|
||||
MatrixIterator& operator++(){
|
||||
increment();
|
||||
return *this;
|
||||
}
|
||||
MatrixIterator operator++( int ){
|
||||
MatrixIterator tmp = *this;
|
||||
increment();
|
||||
return tmp;
|
||||
}
|
||||
value_type& operator*() const {
|
||||
return m_position->m_value;
|
||||
}
|
||||
value_type* operator->() const {
|
||||
return &( operator*() );
|
||||
}
|
||||
bool operator==( const MatrixIterator& other ) const {
|
||||
return m_position == other.m_position;
|
||||
}
|
||||
bool operator!=( const MatrixIterator& other ) const {
|
||||
return !operator==( other );
|
||||
}
|
||||
MatrixIterator& operator++(){
|
||||
increment();
|
||||
return *this;
|
||||
}
|
||||
MatrixIterator operator++( int ){
|
||||
MatrixIterator tmp = *this;
|
||||
increment();
|
||||
return tmp;
|
||||
}
|
||||
value_type& operator*() const {
|
||||
return m_position->m_value;
|
||||
}
|
||||
value_type* operator->() const {
|
||||
return &( operator*() );
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
template<typename Element>
|
||||
class Matrix
|
||||
{
|
||||
std::size_t m_x, m_y;
|
||||
Element* m_data;
|
||||
std::size_t m_x, m_y;
|
||||
Element* m_data;
|
||||
public:
|
||||
typedef Element value_type;
|
||||
typedef value_type* iterator;
|
||||
typedef const value_type* const_iterator;
|
||||
typedef Element value_type;
|
||||
typedef value_type* iterator;
|
||||
typedef const value_type* const_iterator;
|
||||
|
||||
Matrix()
|
||||
: m_x( 0 ), m_y( 0 ), m_data( 0 ){
|
||||
}
|
||||
Matrix( std::size_t x, std::size_t y, Element* data )
|
||||
: m_x( x ), m_y( y ), m_data( data ){
|
||||
}
|
||||
Matrix()
|
||||
: m_x( 0 ), m_y( 0 ), m_data( 0 ){
|
||||
}
|
||||
Matrix( std::size_t x, std::size_t y, Element* data )
|
||||
: m_x( x ), m_y( y ), m_data( data ){
|
||||
}
|
||||
|
||||
iterator begin(){
|
||||
return m_data;
|
||||
}
|
||||
const_iterator begin() const {
|
||||
return m_data;
|
||||
}
|
||||
iterator end(){
|
||||
return m_data + size();
|
||||
}
|
||||
const_iterator end() const {
|
||||
return m_data + size();
|
||||
}
|
||||
iterator begin(){
|
||||
return m_data;
|
||||
}
|
||||
const_iterator begin() const {
|
||||
return m_data;
|
||||
}
|
||||
iterator end(){
|
||||
return m_data + size();
|
||||
}
|
||||
const_iterator end() const {
|
||||
return m_data + size();
|
||||
}
|
||||
|
||||
value_type& operator[]( std::size_t index ){
|
||||
value_type& operator[]( std::size_t index ){
|
||||
#if defined( _DEBUG )
|
||||
ASSERT_MESSAGE( index < size(), "array index out of bounds" );
|
||||
ASSERT_MESSAGE( index < size(), "array index out of bounds" );
|
||||
#endif
|
||||
return m_data[index];
|
||||
}
|
||||
const value_type& operator[]( std::size_t index ) const {
|
||||
return m_data[index];
|
||||
}
|
||||
const value_type& operator[]( std::size_t index ) const {
|
||||
#if defined( _DEBUG )
|
||||
ASSERT_MESSAGE( index < size(), "array index out of bounds" );
|
||||
ASSERT_MESSAGE( index < size(), "array index out of bounds" );
|
||||
#endif
|
||||
return m_data[index];
|
||||
}
|
||||
value_type& operator()( std::size_t x, std::size_t y ){
|
||||
return m_data[index];
|
||||
}
|
||||
value_type& operator()( std::size_t x, std::size_t y ){
|
||||
#if defined( _DEBUG )
|
||||
ASSERT_MESSAGE( x < m_x && y < m_y, "array index out of bounds" );
|
||||
ASSERT_MESSAGE( x < m_x && y < m_y, "array index out of bounds" );
|
||||
#endif
|
||||
return m_data[x * m_y + y];
|
||||
}
|
||||
const value_type& operator()( std::size_t x, std::size_t y ) const {
|
||||
return m_data[x * m_y + y];
|
||||
}
|
||||
const value_type& operator()( std::size_t x, std::size_t y ) const {
|
||||
#if defined( _DEBUG )
|
||||
ASSERT_MESSAGE( x < m_x && y < m_y, "array index out of bounds" );
|
||||
ASSERT_MESSAGE( x < m_x && y < m_y, "array index out of bounds" );
|
||||
#endif
|
||||
return m_data[x * m_y + y];
|
||||
}
|
||||
value_type* data(){
|
||||
return m_data;
|
||||
}
|
||||
const value_type* data() const {
|
||||
return m_data;
|
||||
}
|
||||
std::size_t x() const {
|
||||
return m_x;
|
||||
}
|
||||
std::size_t y() const {
|
||||
return m_y;
|
||||
}
|
||||
std::size_t size() const {
|
||||
return m_x * m_y;
|
||||
}
|
||||
bool empty() const {
|
||||
return m_x == 0;
|
||||
}
|
||||
return m_data[x * m_y + y];
|
||||
}
|
||||
value_type* data(){
|
||||
return m_data;
|
||||
}
|
||||
const value_type* data() const {
|
||||
return m_data;
|
||||
}
|
||||
std::size_t x() const {
|
||||
return m_x;
|
||||
}
|
||||
std::size_t y() const {
|
||||
return m_y;
|
||||
}
|
||||
std::size_t size() const {
|
||||
return m_x * m_y;
|
||||
}
|
||||
bool empty() const {
|
||||
return m_x == 0;
|
||||
}
|
||||
};
|
||||
|
||||
class PatchControl
|
||||
{
|
||||
public:
|
||||
Vector3 m_vertex;
|
||||
Vector2 m_texcoord;
|
||||
Vector3 m_vertex;
|
||||
Vector2 m_texcoord;
|
||||
};
|
||||
|
||||
typedef Matrix<PatchControl> PatchControlMatrix;
|
||||
@@ -222,15 +222,15 @@ typedef Matrix<PatchControl> PatchControlMatrix;
|
||||
class PatchCreator
|
||||
{
|
||||
public:
|
||||
INTEGER_CONSTANT( Version, 1 );
|
||||
STRING_CONSTANT( Name, "patch" );
|
||||
virtual scene::Node& createPatch() = 0;
|
||||
virtual void Patch_undoSave( scene::Node& patch ) const = 0;
|
||||
virtual void Patch_resize( scene::Node& patch, std::size_t width, std::size_t height ) const = 0;
|
||||
virtual PatchControlMatrix Patch_getControlPoints( scene::Node& patch ) const = 0;
|
||||
virtual void Patch_controlPointsChanged( scene::Node& patch ) const = 0;
|
||||
virtual const char* Patch_getShader( scene::Node& patch ) const = 0;
|
||||
virtual void Patch_setShader( scene::Node& patch, const char* shader ) const = 0;
|
||||
INTEGER_CONSTANT( Version, 1 );
|
||||
STRING_CONSTANT( Name, "patch" );
|
||||
virtual scene::Node& createPatch() = 0;
|
||||
virtual void Patch_undoSave( scene::Node& patch ) const = 0;
|
||||
virtual void Patch_resize( scene::Node& patch, std::size_t width, std::size_t height ) const = 0;
|
||||
virtual PatchControlMatrix Patch_getControlPoints( scene::Node& patch ) const = 0;
|
||||
virtual void Patch_controlPointsChanged( scene::Node& patch ) const = 0;
|
||||
virtual const char* Patch_getShader( scene::Node& patch ) const = 0;
|
||||
virtual void Patch_setShader( scene::Node& patch, const char* shader ) const = 0;
|
||||
};
|
||||
|
||||
#include "modulesystem.h"
|
||||
|
||||
Reference in New Issue
Block a user