Browse Source

core: no longer deactivate std::ostream features on Android.

legacy
Sam Hocevar sam 12 years ago
parent
commit
59ba6e6c87
3 changed files with 9 additions and 26 deletions
  1. +5
    -5
      src/gpu/vertexbuffer.cpp
  2. +2
    -19
      src/lol/math/vector.h
  3. +2
    -2
      src/math/vector.cpp

+ 5
- 5
src/gpu/vertexbuffer.cpp View File

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


+ 2
- 19
src/lol/math/vector.h View File

@@ -18,9 +18,8 @@

#include <stdint.h>
#include <cmath>
#if !defined __ANDROID__
# include <iostream>
#endif
#include <ostream>
#include <algorithm>

#include "lol/math/half.h"
#include "lol/math/real.h"
@@ -235,10 +234,8 @@ template <typename T> struct Vec2 : BVec2<T>

DECLARE_MEMBER_OPS(Vec2, x)

#if !defined __ANDROID__
template<typename U>
friend std::ostream &operator<<(std::ostream &stream, Vec2<U> const &v);
#endif
};

/*
@@ -269,10 +266,8 @@ template <typename T> struct Cmplx
}

inline T norm() const { return length(*this); }
#if !defined __ANDROID__
template<typename U>
friend std::ostream &operator<<(std::ostream &stream, Cmplx<U> const &v);
#endif

T x, y;
};
@@ -493,10 +488,8 @@ template <typename T> struct Vec3 : BVec3<T>

DECLARE_MEMBER_OPS(Vec3, x)

#if !defined __ANDROID__
template<typename U>
friend std::ostream &operator<<(std::ostream &stream, Vec3<U> const &v);
#endif
};

/*
@@ -902,10 +895,8 @@ template <typename T> struct Vec4 : BVec4<T>

DECLARE_MEMBER_OPS(Vec4, x)

#if !defined __ANDROID__
template<typename U>
friend std::ostream &operator<<(std::ostream &stream, Vec4<U> const &v);
#endif
};

/*
@@ -983,10 +974,8 @@ template <typename T> struct Quat
return Vec3<T>(q.x, q.y, q.z);
}

#if !defined __ANDROID__
template<typename U>
friend std::ostream &operator<<(std::ostream &stream, Quat<U> const &v);
#endif

/* XXX: storage order is wxyz, unlike vectors! */
T w, x, y, z;
@@ -1592,10 +1581,8 @@ template <typename T> struct Mat2

void printf() const;

#if !defined __ANDROID__
template<class U>
friend std::ostream &operator<<(std::ostream &stream, Mat2<U> const &m);
#endif

inline Mat2<T> operator +(Mat2<T> const m) const
{
@@ -1717,10 +1704,8 @@ template <typename T> struct Mat3

void printf() const;

#if !defined __ANDROID__
template<class U>
friend std::ostream &operator<<(std::ostream &stream, Mat3<U> const &m);
#endif

inline Mat3<T> operator +(Mat3<T> const m) const
{
@@ -1884,10 +1869,8 @@ template <typename T> struct Mat4

void printf() const;

#if !defined __ANDROID__
template<class U>
friend std::ostream &operator<<(std::ostream &stream, Mat4<U> const &m);
#endif

inline Mat4<T> operator +(Mat4<T> const &m) const
{


+ 2
- 2
src/math/vector.cpp View File

@@ -29,6 +29,8 @@
#include <cstdlib> /* free() */
#include <cstring> /* strdup() */

#include <ostream> /* 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)
{


Loading…
Cancel
Save