소스 검색

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

it's a bit less confusing.
legacy
Sam Hocevar sam 12 년 전
부모
커밋
9262efbac3
3개의 변경된 파일19개의 추가작업 그리고 19개의 파일을 삭제
  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 파일 보기

@@ -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 파일 보기

@@ -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 파일 보기

@@ -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;
}


불러오는 중...
취소
저장