Bladeren bron

core: use operator<< instead of operator+= to append stuff to arrays,

it's a bit less confusing.
legacy
Sam Hocevar sam 12 jaren geleden
bovenliggende
commit
9262efbac3
3 gewijzigde bestanden met toevoegingen van 19 en 19 verwijderingen
  1. +4
    -4
      src/array.h
  2. +3
    -3
      test/tutorial/01_triangle.cpp
  3. +12
    -12
      test/tutorial/02_cube.cpp

+ 4
- 4
src/array.h Bestand weergeven

@@ -40,7 +40,7 @@ public:
return m_data[n];
}

inline Array<T1, T2, T3> const& operator+=(Element const &x)
inline Array<T1, T2, T3> const& operator<<(Element const &x)
{
if (m_count >= m_reserved)
{
@@ -127,7 +127,7 @@ public:
return m_data[n];
}

inline Array<T1, T2> const& operator+=(Element const &x)
inline Array<T1, T2> const& operator<<(Element const &x)
{
if (m_count >= m_reserved)
{
@@ -210,7 +210,7 @@ public:
return m_data[n];
}

inline Array<T1> const& operator+=(T1 const &x)
inline Array<T1> const& operator<<(T1 const &x)
{
if (m_count >= m_reserved)
{
@@ -227,7 +227,7 @@ public:

inline void Append(T1 const &x)
{
*this += x;
*this << x;
}

void Remove(int pos)


+ 3
- 3
test/tutorial/01_triangle.cpp Bestand weergeven

@@ -36,9 +36,9 @@ class Triangle : public WorldEntity
public:
Triangle()
{
m_vertices += vec2( 0.0, 0.8);
m_vertices += vec2(-0.8, -0.8);
m_vertices += vec2( 0.8, -0.8);
m_vertices << vec2( 0.0, 0.8);
m_vertices << vec2(-0.8, -0.8);
m_vertices << vec2( 0.8, -0.8);
m_ready = false;
}



+ 12
- 12
test/tutorial/02_cube.cpp Bestand weergeven

@@ -45,18 +45,18 @@ public:
m_mesh.Append(vec3( 1.0, 1.0, -1.0), vec3(0.0, 0.5, 1.0));
m_mesh.Append(vec3(-1.0, 1.0, -1.0), vec3(0.0, 0.0, 1.0));

m_indices += i16vec3(0, 1, 2);
m_indices += i16vec3(2, 3, 0);
m_indices += i16vec3(1, 5, 6);
m_indices += i16vec3(6, 2, 1);
m_indices += i16vec3(7, 6, 5);
m_indices += i16vec3(5, 4, 7);
m_indices += i16vec3(4, 0, 3);
m_indices += i16vec3(3, 7, 4);
m_indices += i16vec3(4, 5, 1);
m_indices += i16vec3(1, 0, 4);
m_indices += i16vec3(3, 2, 6);
m_indices += i16vec3(6, 7, 3);
m_indices << i16vec3(0, 1, 2);
m_indices << i16vec3(2, 3, 0);
m_indices << i16vec3(1, 5, 6);
m_indices << i16vec3(6, 2, 1);
m_indices << i16vec3(7, 6, 5);
m_indices << i16vec3(5, 4, 7);
m_indices << i16vec3(4, 0, 3);
m_indices << i16vec3(3, 7, 4);
m_indices << i16vec3(4, 5, 1);
m_indices << i16vec3(1, 0, 4);
m_indices << i16vec3(3, 2, 6);
m_indices << i16vec3(6, 7, 3);

m_ready = false;
}


Laden…
Annuleren
Opslaan