From 59ba6e6c87553f284294094d212f6659bc884c5c Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Sat, 19 May 2012 00:42:33 +0000 Subject: [PATCH] core: no longer deactivate std::ostream features on Android. --- src/gpu/vertexbuffer.cpp | 10 +++++----- src/lol/math/vector.h | 21 ++------------------- src/math/vector.cpp | 4 ++-- 3 files changed, 9 insertions(+), 26 deletions(-) diff --git a/src/gpu/vertexbuffer.cpp b/src/gpu/vertexbuffer.cpp index 6d4cc67b..eed2672b 100644 --- a/src/gpu/vertexbuffer.cpp +++ b/src/gpu/vertexbuffer.cpp @@ -46,7 +46,7 @@ class VertexBufferData IDirect3DVertexBuffer9 *m_vbo; #elif defined _XBOX D3DVertexBuffer *m_vbo; -#elif !defined __ANDROID__ +#else GLuint m_vbo; uint8_t *m_memory; size_t m_size; @@ -473,7 +473,7 @@ VertexBuffer::VertexBuffer(size_t size) if (FAILED(g_d3ddevice->CreateVertexBuffer(size, D3DUSAGE_WRITEONLY, NULL, D3DPOOL_MANAGED, &m_data->m_vbo, NULL))) Abort(); -#elif !defined __CELLOS_LV2__ && !defined __ANDROID__ +#elif !defined __CELLOS_LV2__ glGenBuffers(1, &m_data->m_vbo); m_data->m_memory = new uint8_t[size]; m_data->m_size = size; @@ -485,7 +485,7 @@ VertexBuffer::~VertexBuffer() #if defined USE_D3D9 || defined _XBOX if (FAILED(m_data->m_vbo->Release())) Abort(); -#elif !defined __CELLOS_LV2__ && !defined __ANDROID__ +#elif !defined __CELLOS_LV2__ glDeleteBuffers(1, &m_data->m_vbo); delete[] m_data->m_memory; #endif @@ -499,7 +499,7 @@ void *VertexBuffer::Lock(size_t offset, size_t size) if (FAILED(m_data->m_vbo->Lock(offset, size, (void **)&ret, 0))) Abort(); return ret; -#elif !defined __CELLOS_LV2__ && !defined __ANDROID__ +#elif !defined __CELLOS_LV2__ return m_data->m_memory + offset; #endif } @@ -509,7 +509,7 @@ void VertexBuffer::Unlock() #if defined USE_D3D9 || defined _XBOX if (FAILED(m_data->m_vbo->Unlock())) Abort(); -#elif !defined __CELLOS_LV2__ && !defined __ANDROID__ +#elif !defined __CELLOS_LV2__ glBindBuffer(GL_ARRAY_BUFFER, m_data->m_vbo); glBufferData(GL_ARRAY_BUFFER, m_data->m_size, m_data->m_memory, GL_STATIC_DRAW); diff --git a/src/lol/math/vector.h b/src/lol/math/vector.h index 5dfb4ce9..55658e90 100644 --- a/src/lol/math/vector.h +++ b/src/lol/math/vector.h @@ -18,9 +18,8 @@ #include #include -#if !defined __ANDROID__ -# include -#endif +#include +#include #include "lol/math/half.h" #include "lol/math/real.h" @@ -235,10 +234,8 @@ template struct Vec2 : BVec2 DECLARE_MEMBER_OPS(Vec2, x) -#if !defined __ANDROID__ template friend std::ostream &operator<<(std::ostream &stream, Vec2 const &v); -#endif }; /* @@ -269,10 +266,8 @@ template struct Cmplx } inline T norm() const { return length(*this); } -#if !defined __ANDROID__ template friend std::ostream &operator<<(std::ostream &stream, Cmplx const &v); -#endif T x, y; }; @@ -493,10 +488,8 @@ template struct Vec3 : BVec3 DECLARE_MEMBER_OPS(Vec3, x) -#if !defined __ANDROID__ template friend std::ostream &operator<<(std::ostream &stream, Vec3 const &v); -#endif }; /* @@ -902,10 +895,8 @@ template struct Vec4 : BVec4 DECLARE_MEMBER_OPS(Vec4, x) -#if !defined __ANDROID__ template friend std::ostream &operator<<(std::ostream &stream, Vec4 const &v); -#endif }; /* @@ -983,10 +974,8 @@ template struct Quat return Vec3(q.x, q.y, q.z); } -#if !defined __ANDROID__ template friend std::ostream &operator<<(std::ostream &stream, Quat const &v); -#endif /* XXX: storage order is wxyz, unlike vectors! */ T w, x, y, z; @@ -1592,10 +1581,8 @@ template struct Mat2 void printf() const; -#if !defined __ANDROID__ template friend std::ostream &operator<<(std::ostream &stream, Mat2 const &m); -#endif inline Mat2 operator +(Mat2 const m) const { @@ -1717,10 +1704,8 @@ template struct Mat3 void printf() const; -#if !defined __ANDROID__ template friend std::ostream &operator<<(std::ostream &stream, Mat3 const &m); -#endif inline Mat3 operator +(Mat3 const m) const { @@ -1884,10 +1869,8 @@ template struct Mat4 void printf() const; -#if !defined __ANDROID__ template friend std::ostream &operator<<(std::ostream &stream, Mat4 const &m); -#endif inline Mat4 operator +(Mat4 const &m) const { diff --git a/src/math/vector.cpp b/src/math/vector.cpp index 24b3b51a..2a6a644d 100644 --- a/src/math/vector.cpp +++ b/src/math/vector.cpp @@ -29,6 +29,8 @@ #include /* free() */ #include /* strdup() */ +#include /* std::ostream */ + #include "core.h" using namespace std; @@ -237,7 +239,6 @@ template<> void mat4::printf() const p[0][3], p[1][3], p[2][3], p[3][3]); } -#if !defined __ANDROID__ template<> std::ostream &operator<<(std::ostream &stream, ivec2 const &v) { return stream << "(" << v.x << ", " << v.y << ")"; @@ -304,7 +305,6 @@ template<> std::ostream &operator<<(std::ostream &stream, mat4 const &m) << ", " << m[2][3] << ", " << m[3][3] << "))"; return stream; } -#endif template<> mat3 mat3::scale(float x, float y, float z) {