Bladeren bron

base: going on a lowercase rampage; today’s victim: Array.

undefined
Sam Hocevar 10 jaren geleden
bovenliggende
commit
3862ad59dc
60 gewijzigde bestanden met toevoegingen van 453 en 447 verwijderingen
  1. +1
    -1
      src/base/log.cpp
  2. +3
    -3
      src/commandstack.h
  3. +1
    -1
      src/dict.cpp
  4. +12
    -12
      src/easymesh/csgbsp.cpp
  5. +4
    -4
      src/easymesh/csgbsp.h
  6. +21
    -21
      src/easymesh/easymesh.cpp
  7. +4
    -4
      src/easymesh/easymesh.h
  8. +7
    -7
      src/easymesh/easymeshbuild.cpp
  9. +12
    -12
      src/easymesh/easymeshbuild.h
  10. +10
    -10
      src/easymesh/easymeshrender.cpp
  11. +5
    -5
      src/easymesh/easymeshrender.h
  12. +1
    -1
      src/gpu/lolfx-compiler.h
  13. +5
    -5
      src/gpu/shader.cpp
  14. +19
    -19
      src/image/codec/android-image.cpp
  15. +1
    -1
      src/image/codec/gdiplus-image.cpp
  16. +1
    -1
      src/image/codec/imlib2-image.cpp
  17. +3
    -3
      src/image/codec/oric-image.cpp
  18. +1
    -1
      src/image/codec/ps3-image.cpp
  19. +1
    -1
      src/image/codec/sdl-image.cpp
  20. +12
    -12
      src/image/codec/zed-image.cpp
  21. +1
    -1
      src/image/codec/zed-palette-image.cpp
  22. +7
    -7
      src/image/filter/convolution.cpp
  23. +3
    -3
      src/image/image.cpp
  24. +1
    -1
      src/image/kernel.cpp
  25. +1
    -1
      src/image/resample.cpp
  26. +3
    -3
      src/input/controller.cpp
  27. +7
    -7
      src/input/controller.h
  28. +3
    -3
      src/input/input.cpp
  29. +12
    -12
      src/input/input.h
  30. +20
    -20
      src/lol/algorithm/aabb_tree.h
  31. +6
    -6
      src/lol/algorithm/portal.h
  32. +2
    -2
      src/lol/algorithm/sort.h
  33. +165
    -159
      src/lol/base/array.h
  34. +3
    -3
      src/lol/base/map.h
  35. +2
    -2
      src/lol/base/string.h
  36. +4
    -4
      src/lol/gpu/shader.h
  37. +1
    -1
      src/lol/image/image.h
  38. +15
    -15
      src/lol/math/array2d.h
  39. +15
    -15
      src/lol/math/array3d.h
  40. +4
    -4
      src/lol/sys/file.h
  41. +1
    -1
      src/lol/sys/init.h
  42. +5
    -5
      src/lol/sys/thread.h
  43. +3
    -3
      src/mesh/mesh.h
  44. +3
    -3
      src/messageservice.cpp
  45. +1
    -1
      src/messageservice.h
  46. +1
    -1
      src/platform/d3d9/d3d9input.cpp
  47. +1
    -1
      src/platform/nacl/nacl-instance.h
  48. +1
    -1
      src/platform/ps3/ps3input.cpp
  49. +1
    -1
      src/platform/sdl/sdlinput.cpp
  50. +1
    -1
      src/platform/xbox/xboxinput.cpp
  51. +2
    -2
      src/sample.cpp
  52. +12
    -12
      src/scene.cpp
  53. +1
    -1
      src/scene.h
  54. +7
    -7
      src/sys/file.cpp
  55. +3
    -3
      src/sys/init.cpp
  56. +2
    -2
      src/sys/thread.cpp
  57. +2
    -2
      src/ticker.cpp
  58. +5
    -5
      src/tileset.cpp
  59. +1
    -1
      src/utils.h
  60. +1
    -1
      src/world.cpp

+ 1
- 1
src/base/log.cpp Bestand weergeven

@@ -97,7 +97,7 @@ void Log::Helper(MessageType type, char const *fmt, va_list ap)
# if defined _WIN32
String buf = String(prefix[type]) + ": " + String::VPrintf(fmt, ap);

Array<WCHAR> widechar;
array<WCHAR> widechar;
widechar.Resize(buf.Count() + 1);
MultiByteToWideChar(CP_UTF8, 0, buf.C(), buf.Count() + 1, widechar.Data(), widechar.Count());
OutputDebugStringW(widechar.Data());


+ 3
- 3
src/commandstack.h Bestand weergeven

@@ -24,9 +24,9 @@ namespace lol
struct CommandStack
{
private:
Array<int, int, int> m_commands;
Array<float> m_floats;
Array<int> m_ints;
array<int, int, int> m_commands;
array<float> m_floats;
array<int> m_ints;
int m_f_cur;
int m_i_cur;



+ 1
- 1
src/dict.cpp Bestand weergeven

@@ -50,7 +50,7 @@ public:
}

private:
Array<Entity *> m_entities;
array<Entity *> m_entities;
int nentities;
};



+ 12
- 12
src/easymesh/csgbsp.cpp Bestand weergeven

@@ -68,9 +68,9 @@ int CsgBsp::TestPoint(int leaf_idx, vec3 point)
void CsgBsp::AddTriangleToTree(int const &tri_idx, vec3 const &tri_p0, vec3 const &tri_p1, vec3 const &tri_p2)
{
//<Leaf_Id, v0, v1, v2>
Array< int, vec3, vec3, vec3 > tri_to_process;
array< int, vec3, vec3, vec3 > tri_to_process;
//<FW/BW, Leaf_Id, v0, v1, v2, twin_leaf>
Array< int, int, vec3, vec3, vec3, int > Leaf_to_add;
array< int, int, vec3, vec3, vec3, int > Leaf_to_add;

//Tree is empty, so this leaf is the first
if (m_tree.Count() == 0)
@@ -228,14 +228,14 @@ void CsgBsp::AddTriangleToTree(int const &tri_idx, vec3 const &tri_p0, vec3 cons
int CsgBsp::TestTriangleToTree(vec3 const &tri_p0, vec3 const &tri_p1, vec3 const &tri_p2,
//In order to easily build the actual vertices list afterward, this list stores each Vertices location and its source vertices & Alpha.
//<Point_Loc, Src_V0, Src_V1, Alpha> as { Point_Loc = Src_V0 + (Src_V1 - Src_V0) * Alpha; }
Array< vec3, int, int, float > &vert_list,
array< vec3, int, int, float > &vert_list,
//This is the final triangle list : If Side_Status is LEAF_CURRENT, a new test will be done point by point.
//<{IN|OUT}side_status, v0, v1, v2>
Array< int, int, int, int > &tri_list)
array< int, int, int, int > &tri_list)
{
//This list stores the current triangles to process.
//<Leaf_Id_List, v0, v1, v2, Should_Point_Test>
Array< Array< int >, int, int, int, int > tri_to_process;
array< array< int >, int, int, int, int > tri_to_process;

//Tree is empty, ABORT !
if (m_tree.Count() == 0)
@@ -248,7 +248,7 @@ int CsgBsp::TestTriangleToTree(vec3 const &tri_p0, vec3 const &tri_p1, vec3 cons

//Let's push the triangle in here.
tri_to_process.Reserve(20);
tri_to_process.Push( Array< int >(), 0, 1, 2, 0);
tri_to_process.Push( array< int >(), 0, 1, 2, 0);
tri_to_process.Last().m1.Push(0);

while (tri_to_process.Count())
@@ -371,7 +371,7 @@ int CsgBsp::TestTriangleToTree(vec3 const &tri_p0, vec3 const &tri_p1, vec3 cons
t[(isec_base + 2) % 3], new_v_idx[v_idx1], new_v_idx[v_idx0]);
else
{
tri_to_process.Push(Array< int >(), t[(isec_base + 2) % 3], new_v_idx[v_idx1], new_v_idx[v_idx0], 0);
tri_to_process.Push(array< int >(), t[(isec_base + 2) % 3], new_v_idx[v_idx1], new_v_idx[v_idx0], 0);
tri_to_process.Last().m1.Push(0);
}

@@ -384,9 +384,9 @@ int CsgBsp::TestTriangleToTree(vec3 const &tri_p0, vec3 const &tri_p1, vec3 cons
}
else
{
tri_to_process.Push(Array< int >(), t[isec_base], t[((isec_base + 1) % 3)], new_v_idx[v_idx0], 0);
tri_to_process.Push(array< int >(), t[isec_base], t[((isec_base + 1) % 3)], new_v_idx[v_idx0], 0);
tri_to_process.Last().m1.Push(0);
tri_to_process.Push(Array< int >(), t[isec_base], new_v_idx[v_idx0], new_v_idx[v_idx1], 0);
tri_to_process.Push(array< int >(), t[isec_base], new_v_idx[v_idx0], new_v_idx[v_idx1], 0);
tri_to_process.Last().m1.Push(0);
}
#else
@@ -417,14 +417,14 @@ int CsgBsp::TestTriangleToTree(vec3 const &tri_p0, vec3 const &tri_p1, vec3 cons
continue;
#endif
#if 0 //Send the newly created triangle back to the beginning
tri_to_process.Push(Array< int >(), new_t[k], new_t[k + 1], new_t[k + 2], 0);
tri_to_process.Push(array< int >(), new_t[k], new_t[k + 1], new_t[k + 2], 0);
tri_to_process.Last().m1.Push(0);
#else //Inherit parent tree
if (m_tree[leaf_idx].m_leaves[new_side[k / 3]] == LEAF_CURRENT && tri_to_process[tri_to_remove].m1.Count() == 1)
tri_list.Push(new_side[k / 3], new_t[k], new_t[k + 1], new_t[k + 2]);
else
{
tri_to_process.Push(Array< int >(), new_t[k], new_t[k + 1], new_t[k + 2], 0);
tri_to_process.Push(array< int >(), new_t[k], new_t[k + 1], new_t[k + 2], 0);
tri_to_process.Last().m1 = tri_to_process[tri_to_remove].m1;
if (m_tree[leaf_idx].m_leaves[new_side[k / 3]] == LEAF_CURRENT)
tri_to_process.Last().m1.Pop();
@@ -522,7 +522,7 @@ int CsgBsp::TestTriangleToTree(vec3 const &tri_p0, vec3 const &tri_p1, vec3 cons
res_total = res_total;
tri_list[i].m1 = LEAF_BACK;
#if 0
tri_to_process.Push( Array< int >(), tri_list[i].m2, tri_list[i].m3, tri_list[i].m4, 0);
tri_to_process.Push( array< int >(), tri_list[i].m2, tri_list[i].m3, tri_list[i].m4, 0);
tri_to_process.Last().m1.Push(0);
tri_list.Remove(i--);
break;


+ 4
- 4
src/easymesh/csgbsp.h Bestand weergeven

@@ -44,7 +44,7 @@ public:
private:
vec3 m_origin;
vec3 m_normal;
Array< int, vec3, vec3, vec3 > m_tri_list;
array< int, vec3, vec3, vec3 > m_tri_list;
ivec3 m_leaves;
};

@@ -60,16 +60,16 @@ public:
int TestTriangleToTree(vec3 const &tri_p0, vec3 const &tri_p1, vec3 const &tri_p2,
//In order to easily build the actual vertices list afterward, this list stores each Vertices location and its source vertices & Alpha.
//<Point_Loc, Src_V0, Src_V1, Alpha> as { Point_Loc = Src_V0 + (Src_V1 - Src_V0) * Alpha; }
Array< vec3, int, int, float > &vert_list,
array< vec3, int, int, float > &vert_list,
//This is the final triangle list : If Side_Status is LEAF_CURRENT, a new test will be done point by point.
//<{IN|OUT}side_status, v0, v1, v2>
Array< int, int, int, int > &tri_list);
array< int, int, int, int > &tri_list);

private:
int AddLeaf(int leaf_type, vec3 origin, vec3 normal, int above_idx);
int TestPoint(int leaf_idx, vec3 point);

Array<CsgBspLeaf> m_tree;
array<CsgBspLeaf> m_tree;
};

} /* namespace lol */


+ 21
- 21
src/easymesh/easymesh.cpp Bestand weergeven

@@ -306,13 +306,13 @@ void EasyMesh::MeshCsg(CSGUsage csg_operation)
}

//A vertex dictionnary for vertices on the same spot.
Array< int, int > vertex_dict;
array< int, int > vertex_dict;
//This list keeps track of the triangle that will need deletion at the end.
Array< int > triangle_to_kill;
array< int > triangle_to_kill;
//Listing for each triangle of the vectors intersecting it. <tri_Id, <Point0, Point1, tri_isec_Normal>>
Array< int, Array< vec3, vec3, vec3 > > triangle_isec;
array< int, array< vec3, vec3, vec3 > > triangle_isec;
//keep a track of the intersection point on the triangle. <pos, side_id>
Array< vec3, int > triangle_vertex;
array< vec3, int > triangle_vertex;
for (int k = 0; k < 10; k++)
triangle_vertex.Push(vec3(.0f), 0);

@@ -343,8 +343,8 @@ void EasyMesh::MeshCsg(CSGUsage csg_operation)
int start_point = (mesh_id == 0)?(cursor_start):(m_cursors.Last().m2);
int end_point = (mesh_id == 0)?(m_cursors.Last().m2):(indices_count);
CsgBsp &mesh_bsp = (mesh_id == 0)?(mesh_bsp_1):(mesh_bsp_0);
Array< vec3, int, int, float > vert_list;
Array< int, int, int, int > tri_list;
array< vec3, int, int, float > vert_list;
array< int, int, int, int > tri_list;
vec3 n0(.0f); vec3 n1(.0f);
vec4 c0(.0f); vec4 c1(.0f);

@@ -699,7 +699,7 @@ void EasyMesh::ComputeNormals(int start, int vcount)
BD()->IsEnabled(MeshBuildOperation::PostBuildComputeNormals))
return;

Array< Array<vec3> > normals;
array< array<vec3> > normals;
normals.Resize(m_vert.Count());
for (int i = 0; i < vcount; i += 3)
{
@@ -734,7 +734,7 @@ void EasyMesh::ComputeNormals(int start, int vcount)
//-----------------------------------------------------------------------------
void EasyMesh::VerticesCleanup()
{
Array<int> vert_ids;
array<int> vert_ids;
vert_ids.Resize(m_vert.Count(), 0);

//1: Remove triangles with two vertices on each other
@@ -758,7 +758,7 @@ void EasyMesh::VerticesCleanup()
}

//2: Remove all unused vertices
Array<VertexData> old_vert = m_vert;
array<VertexData> old_vert = m_vert;
int shift = 0;
m_vert.Empty();
for (int i = 0; i < vert_ids.Count(); ++i)
@@ -812,8 +812,8 @@ void EasyMesh::VerticesSeparate()
return;
}

Array< Array<int> > new_ids;
Array<int> vert_ids;
array< array<int> > new_ids;
array<int> vert_ids;
vert_ids.Resize(m_vert.Count(), 0);

//1: Mark all used vertices
@@ -855,7 +855,7 @@ void EasyMesh::ComputeTexCoord(float uv_scale, int uv_offset)
UNUSED(uv_scale, uv_offset);
#if 0
VertexDictionnary vert_dict;
Array<int> tri_list;
array<int> tri_list;

tri_list.Reserve(m_indices.Count() - m_cursors.Last().m2);
for (int i = m_cursors.Last().m2; i < m_indices.Count(); i++)
@@ -865,8 +865,8 @@ void EasyMesh::ComputeTexCoord(float uv_scale, int uv_offset)
}

//full triangle count
Array<int> tri_done;
Array<int> tri_check;
array<int> tri_done;
array<int> tri_check;
int tri_count = (m_indices.Count() - m_cursors.Last().m2) / 3;

tri_check << tri_list[0];
@@ -962,7 +962,7 @@ void EasyMesh::ComputeTexCoord(float uv_scale, int uv_offset)
uv[2] = texu_dir * dot(v01, v02) + texv_dir * dot(v_dir, v02);

//Set UV on ALL matching vertices!
Array<int> matching_vert;
array<int> matching_vert;
for (int i = 0; i < 3; i++)
{
#if 1
@@ -1118,7 +1118,7 @@ void EasyMesh::RadialJitter(float r)
return;
}

Array<int> Welded;
array<int> Welded;
Welded.Push(-1);
for (int i = m_cursors.Last().m1 + 1; i < m_vert.Count(); i++)
{
@@ -1432,7 +1432,7 @@ void EasyMesh::AppendCapsule(int ndivisions, float h, float d)

int ibase = m_indices.Count();

Array<vec3> vertices;
array<vec3> vertices;
float uv_h = 0;
float uv_r = 0;

@@ -2434,10 +2434,10 @@ void EasyMesh::SmoothMesh(int main_pass, int split_per_main_pass, int smooth_per
}

VertexDictionnary vert_dict;
Array<vec3> smooth_buf[2];
Array<int> master_list;
Array<int> matching_ids;
Array<int> connected_vert;
array<vec3> smooth_buf[2];
array<int> master_list;
array<int> matching_ids;
array<int> connected_vert;
int smbuf = 0;

for (int i = m_cursors.Last().m1; i < m_vert.Count(); i++)


+ 4
- 4
src/easymesh/easymesh.h Bestand weergeven

@@ -64,7 +64,7 @@ public:
bool SetRender(bool should_render);

private:
void UpdateVertexDict(Array< int, int > &vertex_dict);
void UpdateVertexDict(array< int, int > &vertex_dict);

//-------------------------------------------------------------------------
//Mesh CSG operations
@@ -378,11 +378,11 @@ public:
vec3 const &GetVertexLocation(int i) { return m_vert[i].m_coord; }

//private:
Array<uint16_t> m_indices;
Array<VertexData> m_vert;
array<uint16_t> m_indices;
array<VertexData> m_vert;

//<vert count, indices count>
Array<int, int> m_cursors;
array<int, int> m_cursors;

MeshRender m_state;



+ 7
- 7
src/easymesh/easymeshbuild.cpp Bestand weergeven

@@ -37,7 +37,7 @@ int VertexDictionnary::FindVertexMaster(const int search_idx)

//-----------------------------------------------------------------------------
//retrieve a list of matching vertices, doesn't include search_idx.
bool VertexDictionnary::FindMatchingVertices(const int search_idx, Array<int> &matching_ids)
bool VertexDictionnary::FindMatchingVertices(const int search_idx, array<int> &matching_ids)
{
int cur_mast = FindVertexMaster(search_idx);

@@ -58,9 +58,9 @@ bool VertexDictionnary::FindMatchingVertices(const int search_idx, Array<int> &m

//-----------------------------------------------------------------------------
//Will return connected vertices (through triangles), if returned vertex has matching ones, it only returns the master.
bool VertexDictionnary::FindConnectedVertices(const int search_idx, const Array<uint16_t> &tri_list, const int tri0, Array<int> &connected_vert, Array<int> const *ignored_tri)
bool VertexDictionnary::FindConnectedVertices(const int search_idx, const array<uint16_t> &tri_list, const int tri0, array<int> &connected_vert, array<int> const *ignored_tri)
{
Array<int> connected_tri;
array<int> connected_tri;
FindConnectedTriangles(search_idx, tri_list, tri0, connected_tri, ignored_tri);

for (int i = 0; i < connected_tri.Count(); i++)
@@ -88,20 +88,20 @@ bool VertexDictionnary::FindConnectedVertices(const int search_idx, const Array<
return (connected_vert.Count() > 0);
}
//-----------------------------------------------------------------------------
bool VertexDictionnary::FindConnectedTriangles(const int search_idx, const Array<uint16_t> &tri_list, const int tri0, Array<int> &connected_tri, Array<int> const *ignored_tri)
bool VertexDictionnary::FindConnectedTriangles(const int search_idx, const array<uint16_t> &tri_list, const int tri0, array<int> &connected_tri, array<int> const *ignored_tri)
{
return FindConnectedTriangles(ivec3(search_idx, search_idx, search_idx), tri_list, tri0, connected_tri, ignored_tri);
}
//-----------------------------------------------------------------------------
bool VertexDictionnary::FindConnectedTriangles(const ivec2 &search_idx, const Array<uint16_t> &tri_list, const int tri0, Array<int> &connected_tri, Array<int> const *ignored_tri)
bool VertexDictionnary::FindConnectedTriangles(const ivec2 &search_idx, const array<uint16_t> &tri_list, const int tri0, array<int> &connected_tri, array<int> const *ignored_tri)
{
return FindConnectedTriangles(ivec3(search_idx, search_idx.x), tri_list, tri0, connected_tri, ignored_tri);
}
//-----------------------------------------------------------------------------
bool VertexDictionnary::FindConnectedTriangles(const ivec3 &search_idx, const Array<uint16_t> &tri_list, const int tri0, Array<int> &connected_tri, Array<int> const *ignored_tri)
bool VertexDictionnary::FindConnectedTriangles(const ivec3 &search_idx, const array<uint16_t> &tri_list, const int tri0, array<int> &connected_tri, array<int> const *ignored_tri)
{
int needed_validation = 0;
Array<int> vert_list[3];
array<int> vert_list[3];
for (int i = 0; i < 3; i++)
{
//Small optim since above func will use this one


+ 12
- 12
src/easymesh/easymeshbuild.h Bestand weergeven

@@ -167,7 +167,7 @@ public:
inline CommandStack &CmdStack() { return m_stack; }
inline int &Cmdi() { return m_i_cmd; }
inline int &CmdExecNb() { return m_exec_nb; }
inline Array<int, int> &LoopStack(){ return m_loop_stack; }
inline array<int, int> &LoopStack(){ return m_loop_stack; }
inline vec4 &ColorA() { return m_color_a; }
inline vec4 &ColorB() { return m_color_b; }
inline vec2 &TexCoordOffset() { return m_texcoord_offset; }
@@ -359,15 +359,15 @@ public:
CommandStack m_stack;
int m_i_cmd;
int m_exec_nb;
Array<int, int> m_loop_stack;
array<int, int> m_loop_stack;
vec4 m_color_a;
vec4 m_color_b;
vec2 m_texcoord_offset;
vec2 m_texcoord_offset2;
vec2 m_texcoord_scale;
vec2 m_texcoord_scale2;
Array<vec2, vec2> m_texcoord_custom_build[MeshType::MAX];
Array<vec2, vec2> m_texcoord_custom_build2[MeshType::MAX];
array<vec2, vec2> m_texcoord_custom_build[MeshType::MAX];
array<vec2, vec2> m_texcoord_custom_build2[MeshType::MAX];
uint32_t m_texcoord_build_type[MeshType::MAX];
uint32_t m_texcoord_build_type2[MeshType::MAX];
uint32_t m_build_flags;
@@ -391,20 +391,20 @@ class VertexDictionnary
{
public:
int FindVertexMaster(const int search_idx);
bool FindMatchingVertices(const int search_idx, Array<int> &matching_ids);
bool FindConnectedVertices(const int search_idx, const Array<uint16_t> &tri_list, const int tri0, Array<int> &connected_vert, Array<int> const *ignored_tri = nullptr);
bool FindConnectedTriangles(const int search_idx, const Array<uint16_t> &tri_list, const int tri0, Array<int> &connected_tri, Array<int> const *ignored_tri = nullptr);
bool FindConnectedTriangles(const ivec2 &search_idx, const Array<uint16_t> &tri_list, const int tri0, Array<int> &connected_tri, Array<int> const *ignored_tri = nullptr);
bool FindConnectedTriangles(const ivec3 &search_idx, const Array<uint16_t> &tri_list, const int tri0, Array<int> &connected_tri, Array<int> const *ignored_tri = nullptr);
bool FindMatchingVertices(const int search_idx, array<int> &matching_ids);
bool FindConnectedVertices(const int search_idx, const array<uint16_t> &tri_list, const int tri0, array<int> &connected_vert, array<int> const *ignored_tri = nullptr);
bool FindConnectedTriangles(const int search_idx, const array<uint16_t> &tri_list, const int tri0, array<int> &connected_tri, array<int> const *ignored_tri = nullptr);
bool FindConnectedTriangles(const ivec2 &search_idx, const array<uint16_t> &tri_list, const int tri0, array<int> &connected_tri, array<int> const *ignored_tri = nullptr);
bool FindConnectedTriangles(const ivec3 &search_idx, const array<uint16_t> &tri_list, const int tri0, array<int> &connected_tri, array<int> const *ignored_tri = nullptr);
void AddVertex(int vert_id, vec3 vert_coord);
void RemoveVertex(int vert_id);
bool GetMasterList(Array<int> &ret_master_list) { ret_master_list = master_list; return ret_master_list.Count() > 0; }
bool GetMasterList(array<int> &ret_master_list) { ret_master_list = master_list; return ret_master_list.Count() > 0; }
void Clear() { vertex_list.Empty(); }
private:
//<VertexId, VertexLocation, VertexMasterId>
Array<int, vec3, int> vertex_list;
array<int, vec3, int> vertex_list;
//List of the master_ vertices
Array<int> master_list;
array<int> master_list;
};

} /* namespace lol */


+ 10
- 10
src/easymesh/easymeshrender.cpp Bestand weergeven

@@ -152,8 +152,8 @@ void DefaultShaderData::SetupShaderDatas(mat4 const &model)
mat4 modelview = view * model;
mat3 normalmat = transpose(inverse(mat3(modelview)));
/* FIXME: this should be hidden in the shader */
Array<Light *> const &lights = g_scene->GetLights();
Array<vec4> light_data;
array<Light *> const &lights = g_scene->GetLights();
array<vec4> light_data;
//This is not very nice, but necessary for emscripten WebGL generation.
float f = 0.f;

@@ -224,7 +224,7 @@ void GpuEasyMeshData::AddGpuData(GpuShaderData* gpudata, EasyMesh* src_mesh)

if (!m_ibo)
{
Array<uint16_t> indexlist;
array<uint16_t> indexlist;
for (int i = 0; i < src_mesh->m_indices.Count(); i += 3)
{
indexlist << src_mesh->m_indices[i + 0];
@@ -292,7 +292,7 @@ void GpuEasyMeshData::SetupVertexData(uint16_t vflags, EasyMesh* src_mesh)
VertexUsage::Color,
VertexUsage::TexCoord));

Array<vec3, vec3, u8vec4, vec4> vertexlist;
array<vec3, vec3, u8vec4, vec4> vertexlist;
for (int i = 0; i < src_mesh->m_vert.Count(); i++)
vertexlist.Push(src_mesh->m_vert[i].m_coord,
src_mesh->m_vert[i].m_normal,
@@ -309,7 +309,7 @@ void GpuEasyMeshData::SetupVertexData(uint16_t vflags, EasyMesh* src_mesh)
VertexUsage::Color,
VertexUsage::TexCoord));

Array<vec3, vec3, u8vec4, vec2> vertexlist;
array<vec3, vec3, u8vec4, vec2> vertexlist;
for (int i = 0; i < src_mesh->m_vert.Count(); i++)
vertexlist.Push(src_mesh->m_vert[i].m_coord,
src_mesh->m_vert[i].m_normal,
@@ -321,7 +321,7 @@ void GpuEasyMeshData::SetupVertexData(uint16_t vflags, EasyMesh* src_mesh)
{
new_vdecl = new VertexDeclaration(VertexStream<vec3,vec4,vec4>(VertexUsage::Position, VertexUsage::Color, VertexUsage::TexCoord));

Array<vec3, vec4, vec4> vertexlist;
array<vec3, vec4, vec4> vertexlist;
for (int i = 0; i < src_mesh->m_vert.Count(); i++)
vertexlist.Push(src_mesh->m_vert[i].m_coord, src_mesh->m_vert[i].m_color, src_mesh->m_vert[i].m_texcoord);
COPY_VBO;
@@ -334,7 +334,7 @@ void GpuEasyMeshData::SetupVertexData(uint16_t vflags, EasyMesh* src_mesh)
VertexUsage::Normal,
VertexUsage::Color));

Array<vec3,vec3,u8vec4> vertexlist;
array<vec3,vec3,u8vec4> vertexlist;
for (int i = 0; i < src_mesh->m_vert.Count(); i++)
vertexlist.Push(src_mesh->m_vert[i].m_coord,
src_mesh->m_vert[i].m_normal,
@@ -345,7 +345,7 @@ void GpuEasyMeshData::SetupVertexData(uint16_t vflags, EasyMesh* src_mesh)
{
new_vdecl = new VertexDeclaration(VertexStream<vec3,vec4>(VertexUsage::Position, VertexUsage::TexCoord));

Array<vec3, vec4> vertexlist;
array<vec3, vec4> vertexlist;
for (int i = 0; i < src_mesh->m_vert.Count(); i++)
vertexlist.Push(src_mesh->m_vert[i].m_coord, src_mesh->m_vert[i].m_texcoord);
COPY_VBO;
@@ -354,7 +354,7 @@ void GpuEasyMeshData::SetupVertexData(uint16_t vflags, EasyMesh* src_mesh)
{
new_vdecl = new VertexDeclaration(VertexStream<vec3,vec2>(VertexUsage::Position, VertexUsage::TexCoord));

Array<vec3, vec2> vertexlist;
array<vec3, vec2> vertexlist;
for (int i = 0; i < src_mesh->m_vert.Count(); i++)
vertexlist.Push(src_mesh->m_vert[i].m_coord, src_mesh->m_vert[i].m_texcoord.xy);
COPY_VBO;
@@ -363,7 +363,7 @@ void GpuEasyMeshData::SetupVertexData(uint16_t vflags, EasyMesh* src_mesh)
{
new_vdecl = new VertexDeclaration(VertexStream<vec3,u8vec4>(VertexUsage::Position, VertexUsage::Color));

Array<vec3, u8vec4> vertexlist;
array<vec3, u8vec4> vertexlist;
for (int i = 0; i < src_mesh->m_vert.Count(); i++)
vertexlist.Push(src_mesh->m_vert[i].m_coord, (u8vec4)(src_mesh->m_vert[i].m_color * 255.f));
COPY_VBO;


+ 5
- 5
src/easymesh/easymeshrender.h Bestand weergeven

@@ -80,8 +80,8 @@ protected:
uint16_t m_vert_decl_flags;
Shader* m_shader;
int m_render_mode;
Array<lol::String, ShaderUniform> m_shader_uniform;
Array<ShaderAttrib> m_shader_attrib;
array<lol::String, ShaderUniform> m_shader_uniform;
array<ShaderAttrib> m_shader_attrib;
};

class DefaultShaderData : public GpuShaderData
@@ -96,7 +96,7 @@ public:
void SetupDefaultData(bool with_UV);
virtual void SetupShaderDatas(mat4 const &model);
//--
Array<String> m_uniform_names;
array<String> m_uniform_names;
};

class GpuEasyMeshData
@@ -115,9 +115,9 @@ public:
private:
void SetupVertexData(uint16_t vdecl_flags, EasyMesh* src_mesh);

Array<GpuShaderData*> m_gpudatas;
array<GpuShaderData*> m_gpudatas;
//uint16_t are the vdecl/vbo flags to avoid copy same vdecl several times.
Array<uint16_t, VertexDeclaration*,
array<uint16_t, VertexDeclaration*,
VertexBuffer*> m_vdatas;
int m_vertexcount;
//We only need only one ibo for the whole mesh


+ 1
- 1
src/gpu/lolfx-compiler.h Bestand weergeven

@@ -46,7 +46,7 @@ private:
BlockIsForeverFalse,
BlockIsTrue,
};
Array<int> m_pp_stack;
array<int> m_pp_stack;

char const *m_input;
};


+ 5
- 5
src/gpu/shader.cpp Bestand weergeven

@@ -129,7 +129,7 @@ Shader *Shader::Create(String const &name, String const &code)
String src = String("\n") + code;

/* Parse the crap */
Array<char const *, char const *> sections;
array<char const *, char const *> sections;
char *key = nullptr;
for (char *parser = src.C(); *parser; )
{
@@ -699,7 +699,7 @@ void Shader::SetUniform(ShaderUniform const &uni, TextureUniform tex, int index)
* Uniform setters for arrays
*/

void Shader::SetUniform(ShaderUniform const &uni, Array<float> const &v)
void Shader::SetUniform(ShaderUniform const &uni, array<float> const &v)
{
#if defined USE_D3D9 || defined _XBOX
/* FIXME: this will not work properly because we don't know how tell DX9
@@ -722,7 +722,7 @@ void Shader::SetUniform(ShaderUniform const &uni, Array<float> const &v)
#endif
}

void Shader::SetUniform(ShaderUniform const &uni, Array<vec2> const &v)
void Shader::SetUniform(ShaderUniform const &uni, array<vec2> const &v)
{
#if defined USE_D3D9 || defined _XBOX
/* FIXME: this will not work properly because we don't know how tell DX9
@@ -745,7 +745,7 @@ void Shader::SetUniform(ShaderUniform const &uni, Array<vec2> const &v)
#endif
}

void Shader::SetUniform(ShaderUniform const &uni, Array<vec3> const &v)
void Shader::SetUniform(ShaderUniform const &uni, array<vec3> const &v)
{
#if defined USE_D3D9 || defined _XBOX
/* FIXME: this will not work properly because we don't know how tell DX9
@@ -768,7 +768,7 @@ void Shader::SetUniform(ShaderUniform const &uni, Array<vec3> const &v)
#endif
}

void Shader::SetUniform(ShaderUniform const &uni, Array<vec4> const &v)
void Shader::SetUniform(ShaderUniform const &uni, array<vec4> const &v)
{
#if defined USE_D3D9 || defined _XBOX
if (uni.flags & 1)


+ 19
- 19
src/image/codec/android-image.cpp Bestand weergeven

@@ -45,9 +45,9 @@ public:
virtual uint8_t *GetData() const;

private:
jobject bmp;
jintArray array;
jint *pixels;
jobject m_bmp;
jintArray m_array;
jint *m_pixels;
};

DECLARE_IMAGE_CODEC(AndroidImageCodec, 100)
@@ -76,35 +76,35 @@ bool AndroidImageCodec::Load(Image *image, char const *path)
mid = env->GetMethodID(cls, "openImage",
"(Ljava/lang/String;)Landroid/graphics/Bitmap;");
jstring name = env->NewStringUTF(path);
bmp = env->CallObjectMethod(g_activity->clazz, mid, name);
m_bmp = env->CallObjectMethod(g_activity->clazz, mid, name);
env->DeleteLocalRef(name);
if (!bmp)
if (!m_bmp)
{
#if !LOL_BUILD_RELEASE
Log::Error("could not load %s\n", path);
#endif
return false;
}
env->NewGlobalRef(bmp);
env->NewGlobalRef(m_bmp);

/* Get image dimensions */
mid = env->GetMethodID(cls, "getWidth", "(Landroid/graphics/Bitmap;)I");
m_size.x = env->CallIntMethod(g_activity->clazz, mid, bmp);
m_size.x = env->CallIntMethod(g_activity->clazz, mid, m_bmp);
mid = env->GetMethodID(cls, "getHeight", "(Landroid/graphics/Bitmap;)I");
m_size.y = env->CallIntMethod(g_activity->clazz, mid, bmp);
m_size.y = env->CallIntMethod(g_activity->clazz, mid, m_bmp);

/* Get pixels */
array = env->NewIntArray(m_size.x * m_size.y);
env->NewGlobalRef(array);
m_array = env->NewIntArray(m_size.x * m_size.y);
env->NewGlobalRef(m_array);
mid = env->GetMethodID(cls, "getPixels", "(Landroid/graphics/Bitmap;[I)V");
env->CallVoidMethod(g_activity->clazz, mid, bmp, array);
env->CallVoidMethod(g_activity->clazz, mid, m_bmp, m_array);

pixels = env->GetIntArrayElements(array, 0);
m_pixels = env->GetIntArrayElements(m_array, 0);
for (int n = 0; n < m_size.x * m_size.y; n++)
{
uint32_t u = pixels[n];
uint32_t u = m_pixels[n];
u = (u & 0xff00ff00) | ((u & 0xff0000) >> 16) | ((u & 0xff) << 16);
pixels[n] = u;
m_pixels[n] = u;
}
m_format = PixelFormat::RGBA_8;

@@ -132,20 +132,20 @@ bool AndroidImageCodec::Close()
jclass cls = env->GetObjectClass(g_activity->clazz);
jmethodID mid;

env->ReleaseIntArrayElements(array, pixels, 0);
env->DeleteGlobalRef(array);
env->ReleaseIntArrayElements(m_array, m_pixels, 0);
env->DeleteGlobalRef(m_array);

/* Free image */
mid = env->GetMethodID(cls, "closeImage", "(Landroid/graphics/Bitmap;)V");
env->CallVoidMethod(g_activity->clazz, mid, bmp);
env->DeleteGlobalRef(bmp);
env->CallVoidMethod(g_activity->clazz, mid, m_bmp);
env->DeleteGlobalRef(m_bmp);

return true;
}

uint8_t *AndroidImageCodec::GetData() const
{
return (uint8_t *)pixels;
return (uint8_t *)m_pixels;
}

} /* namespace lol */


+ 1
- 1
src/image/codec/gdiplus-image.cpp Bestand weergeven

@@ -58,7 +58,7 @@ bool GdiPlusImageCodec::Load(Image *image, char const *path)
return false;
}

Array<String> pathlist = System::GetPathList(path);
array<String> pathlist = System::GetPathList(path);
Gdiplus::Bitmap *bitmap = nullptr;
for (auto fullpath : pathlist)
{


+ 1
- 1
src/image/codec/imlib2-image.cpp Bestand weergeven

@@ -42,7 +42,7 @@ bool Imlib2ImageCodec::Load(Image *image, char const *path)
{
Imlib_Image priv = nullptr;

Array<String> pathlist = System::GetPathList(path);
array<String> pathlist = System::GetPathList(path);
for (int i = 0; i < pathlist.Count(); i++)
{
priv = imlib_load_image(pathlist[i].C());


+ 3
- 3
src/image/codec/oric-image.cpp Bestand weergeven

@@ -38,7 +38,7 @@ public:

private:
static String ReadScreen(char const *name);
static void WriteScreen(Image &image, Array<uint8_t> &result);
static void WriteScreen(Image &image, array<uint8_t> &result);
};

DECLARE_IMAGE_CODEC(OricImageCodec, 100)
@@ -116,7 +116,7 @@ bool OricImageCodec::Save(Image *image, char const *path)
|| toupper(path[len - 1]) != 'P')
return false;

Array<uint8_t> result;
array<uint8_t> result;

result << 0x16 << 0x16 << 0x16 << 0x16 << 0x24;
result << 0 << 0xff << 0x80 << 0 << 0xbf << 0x3f << 0xa0 << 0;
@@ -465,7 +465,7 @@ static uint8_t bestmove(ivec3 const *in, u8vec2 bgfg,
return bestcommand;
}

void OricImageCodec::WriteScreen(Image &image, Array<uint8_t> &result)
void OricImageCodec::WriteScreen(Image &image, array<uint8_t> &result)
{
ivec2 size = image.GetSize();
vec4 *pixels = image.Lock<PixelFormat::RGBA_F32>();


+ 1
- 1
src/image/codec/ps3-image.cpp Bestand weergeven

@@ -98,7 +98,7 @@ bool Ps3ImageCodec::Load(Image *image, char const *path)
CellPngDecSubHandle hsub;
CellPngDecOpnInfo open_info;

Array<String> pathlist = System::GetPathList(path);
array<String> pathlist = System::GetPathList(path);
for (int i = 0; i < pathlist.Count(); ++i)
{
String name = String(SYS_APP_HOME) + '/' + pathlist[i];


+ 1
- 1
src/image/codec/sdl-image.cpp Bestand weergeven

@@ -52,7 +52,7 @@ bool SdlImageCodec::Load(Image *image, char const *path)
{
SDL_Surface *surface = nullptr;

Array<String> pathlist = System::GetPathList(path);
array<String> pathlist = System::GetPathList(path);
for (int i = 0; i < pathlist.Count(); i++)
{
surface = IMG_Load(pathlist[i].C());


+ 12
- 12
src/image/codec/zed-image.cpp Bestand weergeven

@@ -31,7 +31,7 @@ public:
virtual bool Load(Image *image, char const *path);
virtual bool Save(Image *image, char const *path);

virtual bool RetrieveTiles(Array<ivec2, ivec2>& tiles)
virtual bool RetrieveTiles(array<ivec2, ivec2>& tiles)
{
bool result = m_tiles.Count() > 0;
tiles += m_tiles;
@@ -41,7 +41,7 @@ public:

private:
//<Pos, Size>
Array<ivec2, ivec2> m_tiles;
array<ivec2, ivec2> m_tiles;
};

DECLARE_IMAGE_CODEC(ZedImageCodec, 0)
@@ -60,14 +60,14 @@ bool ZedImageCodec::Load(Image *image, char const *path)
{
CompactSecondary(int32_t size) { m_size = size; }
int32_t m_size;
Array<int32_t> m_tiles;
array<int32_t> m_tiles;
};
struct CompactMain
{
CompactMain(int32_t size) { m_size = size; m_count = 0; }
int32_t m_size;
int32_t m_count;
Array<CompactSecondary> m_secondary;
array<CompactSecondary> m_secondary;
};
struct Compacter2d
{
@@ -89,7 +89,7 @@ bool ZedImageCodec::Load(Image *image, char const *path)
m_primary.Last().m_secondary << CompactSecondary(start + interval * j);
}
}
void CustomSetup(Array<int32_t> custom_list)
void CustomSetup(array<int32_t> custom_list)
{
for (int i = 0; i < custom_list.Count(); i++)
{
@@ -117,7 +117,7 @@ bool ZedImageCodec::Load(Image *image, char const *path)
}
}
}
Array<CompactMain> m_primary;
array<CompactMain> m_primary;
};

File file;
@@ -125,7 +125,7 @@ bool ZedImageCodec::Load(Image *image, char const *path)

//Put file in memory
long file_size = file.GetSize();
Array<uint8_t> file_buffer;
array<uint8_t> file_buffer;
file_buffer.Resize(file_size);
file.Read((uint8_t*)&file_buffer[0], file_size);
file.Close();
@@ -136,7 +136,7 @@ bool ZedImageCodec::Load(Image *image, char const *path)
file_count = *((uint16_t*)(&file_buffer[file_pos]));
file_pos += sizeof(uint16_t);

Array<long int> file_offset;
array<long int> file_offset;
file_offset.Resize(file_count);
//Get all the file offsets
for (int i = 0; i < file_count; i++)
@@ -152,9 +152,9 @@ bool ZedImageCodec::Load(Image *image, char const *path)
compacter.StepSetup(8, 8, 10);

uint32_t total_size = 0;
Array<uint8_t> file_convert;
array<uint8_t> file_convert;
file_convert.Reserve(file_size);
Array<ivec2> available_sizes;
array<ivec2> available_sizes;
for (int i = 0; i < file_count; i++)
{
file_pos = file_offset[i];
@@ -176,10 +176,10 @@ bool ZedImageCodec::Load(Image *image, char const *path)

/* Seems useless in the end
//Retrieve Header & footer
Array<uint8_t> header_data;
array<uint8_t> header_data;
header_data.Resize(header_length);
memcpy(&header_data[0], &file_buffer[file_offset[i]], header_length);
Array<uint8_t> footer_data;
array<uint8_t> footer_data;
uint32_t footer_length = lol::min((uint32_t)file_buffer.Count(), data_pos + data_length + header_length) - (data_pos + data_length);
if (footer_length > 0)
{


+ 1
- 1
src/image/codec/zed-palette-image.cpp Bestand weergeven

@@ -47,7 +47,7 @@ bool ZedPaletteImageCodec::Load(Image *image, char const *path)

//Put file in memory
long file_size = file.GetSize();
Array<uint8_t> file_buffer;
array<uint8_t> file_buffer;
file_buffer.Resize(file_size);
file.Read((uint8_t*)&file_buffer[0], file_size);
file.Close();


+ 7
- 7
src/image/filter/convolution.cpp Bestand weergeven

@@ -21,8 +21,8 @@
namespace lol
{

static Image SepConv(Image &src, Array<float> const &hvec,
Array<float> const &vvec);
static Image SepConv(Image &src, array<float> const &hvec,
array<float> const &vvec);
static Image NonSepConv(Image &src, array2d<float> const &kernel);

Image Image::Convolution(array2d<float> const &kernel)
@@ -67,7 +67,7 @@ Image Image::Convolution(array2d<float> const &kernel)
if (separable)
{
/* Matrix rank is 1! Separate the filter. */
Array<float> hvec, vvec;
array<float> hvec, vvec;

float norm = 1.0f / lol::sqrt(lol::abs(kernel[bestx][besty]));
for (int dx = 0; dx < ksize.x; dx++)
@@ -192,8 +192,8 @@ static Image NonSepConv(Image &src, array2d<float> const &kernel)
}

template<PixelFormat FORMAT, int WRAP_X, int WRAP_Y>
static Image SepConv(Image &src, Array<float> const &hvec,
Array<float> const &vvec)
static Image SepConv(Image &src, array<float> const &hvec,
array<float> const &vvec)
{
typedef typename PixelType<FORMAT>::type pixel_t;

@@ -254,8 +254,8 @@ static Image SepConv(Image &src, Array<float> const &hvec,
return dst;
}

static Image SepConv(Image &src, Array<float> const &hvec,
Array<float> const &vvec)
static Image SepConv(Image &src, array<float> const &hvec,
array<float> const &vvec)
{
bool const wrap_x = src.GetWrapX() == WrapMode::Repeat;
bool const wrap_y = src.GetWrapY() == WrapMode::Repeat;


+ 3
- 3
src/image/image.cpp Bestand weergeven

@@ -30,7 +30,7 @@ namespace lol
* The bug was reported to Microsoft and fixed by them, but the fix
* is not yet available.
* https://connect.microsoft.com/VisualStudio/feedback/details/730878/ */
static bool RegisterAllCodecs(Array<ImageCodec *> &codeclist)
static bool RegisterAllCodecs(array<ImageCodec *> &codeclist)
{
#if defined __ANDROID__
REGISTER_IMAGE_CODEC(AndroidImageCodec)
@@ -73,7 +73,7 @@ public:
}

private:
Array<ImageCodec *> m_codecs;
array<ImageCodec *> m_codecs;
map<String, Image *> m_images;
}
g_image_loader;
@@ -238,7 +238,7 @@ void Image::Unlock(void const *pixels)
ASSERT(pixels == m_data->m_pixels[(int)m_data->m_format]->Data());
}

bool Image::RetrieveTiles(Array<ivec2, ivec2>& tiles) const
bool Image::RetrieveTiles(array<ivec2, ivec2>& tiles) const
{
/* TODO: re-implement this */
//return m_data->m_codecdata->RetrieveTiles(tiles);


+ 1
- 1
src/image/kernel.cpp Bestand weergeven

@@ -188,7 +188,7 @@ array2d<float> Image::NormalizeKernel(array2d<float> const &kernel)
{
ivec2 size = kernel.GetSize();

Array<Dot> tmp;
array<Dot> tmp;
tmp.Resize(size.x * size.y);

for (int y = 0; y < size.y; y++)


+ 1
- 1
src/image/resample.cpp Bestand weergeven

@@ -147,7 +147,7 @@ static Image ResizeBresenham(Image &image, ivec2 size)
vec4 const *srcp = image.Lock<PixelFormat::RGBA_F32>();
vec4 *dstp = dst.Lock<PixelFormat::RGBA_F32>();

Array<vec4> aline, line;
array<vec4> aline, line;
aline.Resize(size.x);
line.Resize(size.x);
memset(line.Data(), 0, line.Bytes());


+ 3
- 3
src/input/controller.cpp Bestand weergeven

@@ -218,7 +218,7 @@ float AxisBinding::RetrieveCurrentValue()
///////////////////////////////////////////////////////////////////////////////
// Controller

Array<Controller*> Controller::controllers;
array<Controller*> Controller::controllers;

Controller::Controller(char const* name, int nb_keys, int nb_axis)
{
@@ -290,9 +290,9 @@ void Controller::Deactivate()
m_activate_nextframe = false;
}

Array<Controller*> Controller::DeactivateAll()
array<Controller*> Controller::DeactivateAll()
{
Array<Controller*> result;
array<Controller*> result;

for (int i = 0; i < controllers.Count(); ++i)
{


+ 7
- 7
src/input/controller.h Bestand weergeven

@@ -60,7 +60,7 @@ protected:
}

/** m1 is the InputDevice, m2 is the key index on the InputDevice */
Array<const InputDevice*, int> m_keybindings;
array<const InputDevice*, int> m_keybindings;
/** Value at the previous frame */
bool m_current;
/** Value at the current frame */
@@ -112,9 +112,9 @@ protected:
float RetrieveCurrentValue();

/** m1 is the InputDevice, m2 is the axis index on the InputDevice, m3 and m4 are an optional key indices to bind one or two keys over the axis */
Array<const InputDevice*, int> m_axisbindings;
array<const InputDevice*, int> m_axisbindings;
/** m1 is the InputDevice, m2 is the key index on the InputDevice for the negative value, m3 is the key index on the InputDevice for the positive value. Only one key is required to bind key over axis. */
Array<const InputDevice*, int, int> m_keybindings;
array<const InputDevice*, int, int> m_keybindings;
float m_current;
float m_previous;

@@ -135,7 +135,7 @@ public:
/** Deactivate the controller on next frame */
void Deactivate();
/** Deactivate every active controller on next frame and return an array of deactivated (previously active) controllers */
static Array<Controller*> DeactivateAll();
static array<Controller*> DeactivateAll();

KeyBinding& GetKey(int index) { return m_keys[index]; }
AxisBinding& GetAxis(int index) { return m_axis[index]; }
@@ -143,11 +143,11 @@ public:
static Controller* Get(char const* name);

protected:
Array<KeyBinding> m_keys;
Array<AxisBinding> m_axis;
array<KeyBinding> m_keys;
array<AxisBinding> m_axis;

private:
static Array<Controller*> controllers;
static array<Controller*> controllers;
String m_name;
bool m_activate_nextframe;
bool m_deactivate_nextframe;


+ 3
- 3
src/input/input.cpp Bestand weergeven

@@ -19,12 +19,12 @@
namespace lol
{

Array<InputDevice*> InputDevice::devices;
array<InputDevice*> InputDevice::devices;
bool InputDevice::m_capturemouse;

Array<String> InputDevice::GetAvailableDevices()
array<String> InputDevice::GetAvailableDevices()
{
Array<String> result;
array<String> result;
for (int i = 0; i < devices.Count(); ++i)
{
result.Push(devices[i]->m_name);


+ 12
- 12
src/input/input.h Bestand weergeven

@@ -48,14 +48,14 @@ public:
float GetAxisSensitivity(int index) const { return m_axis[index].m2; }

/** Gets a list of the name of all available keys in this device */
const Array<String>& GetAllKeys() const { return m_keynames; }
const array<String>& GetAllKeys() const { return m_keynames; }
/** Gets a list of the name of all available axis in this device */
const Array<String>& GetAllAxis() const { return m_axisnames; }
const array<String>& GetAllAxis() const { return m_axisnames; }
/** Gets a list of the name of all available cursors in this device */
const Array<String>& GetAllCursors() const { return m_cursornames; }
const array<String>& GetAllCursors() const { return m_cursornames; }

/** Gets a list of the name of all available input devices */
static Array<String> GetAvailableDevices();
static array<String> GetAvailableDevices();
/** Gets an input device by its name */
static InputDevice* Get(const char* name) { return GetDevice(name); }
/** Sets whether the mouse cursor should be captured. */
@@ -66,16 +66,16 @@ protected:

String m_name;

Array<String> m_keynames;
Array<String> m_axisnames;
Array<String> m_cursornames;
array<String> m_keynames;
array<String> m_axisnames;
array<String> m_cursornames;

/** key states (pressed/released) */
Array<bool> m_keys;
array<bool> m_keys;
/** axis states (value and sensitivity) */
Array<float, float> m_axis;
array<float, float> m_axis;
/** cursor position */
Array<vec2, ivec2> m_cursors;
array<vec2, ivec2> m_cursors;

static bool m_capturemouse;

@@ -97,10 +97,10 @@ protected:
}

private:
static Array<InputDevice*> devices;
static array<InputDevice*> devices;

template <typename T>
int GetItemIndex(const char* name, const Array<String, T>& array) const
int GetItemIndex(const char* name, const array<String, T>& array) const
{
for (int i = 0; i < array.Count(); ++i)
{


+ 20
- 20
src/lol/algorithm/aabb_tree.h Bestand weergeven

@@ -29,9 +29,9 @@ namespace Debug {
//--

template<typename TREE, typename TE, typename TBB>
void DrawInner(TREE *tree, Array<TBB, vec4> &boxes,
Array<TE *, int, vec4> &elements,
Array<int, TBB> &leaves, int children, vec4 color)
void DrawInner(TREE *tree, array<TBB, vec4> &boxes,
array<TE *, int, vec4> &elements,
array<int, TBB> &leaves, int children, vec4 color)
{
boxes.Push(tree->GetAABB(), Color::white);
leaves.Push(0, boxes.Last().m1);
@@ -70,9 +70,9 @@ void DrawInner(TREE *tree, Array<TBB, vec4> &boxes,
template <typename TE>
void Draw(Quadtree<TE>* tree, vec4 color)
{
Array<box2, vec4> boxes;
Array<TE*, int, vec4> elements;
Array<int, box2> leaves;
array<box2, vec4> boxes;
array<TE*, int, vec4> elements;
array<int, box2> leaves;

DrawInner<Quadtree<TE>, TE, box2>(tree, boxes, elements, leaves, 4, color);

@@ -101,9 +101,9 @@ void Draw(Quadtree<TE>* tree, vec4 color)
template <typename TE>
void Draw(Octree<TE>* tree, vec4 color)
{
Array<box3, vec4> boxes;
Array<TE*, int, vec4> elements;
Array<int, box3> leaves;
array<box3, vec4> boxes;
array<TE*, int, vec4> elements;
array<int, box3> leaves;

DrawInner<Octree<TE>, TE, box3>(tree, boxes, elements, leaves, 8, color);

@@ -143,7 +143,7 @@ class AABBTree
//Children pos in the list
int m_children[child_nb];
//Element list
Array<int> m_elements;
array<int> m_elements;

NodeLeaf(int parent)
{
@@ -156,7 +156,7 @@ class AABBTree
struct TreeElement
{
TE* m_element;
Array<int> m_leaves;
array<int> m_leaves;

inline bool operator==(const TE*& element) { return m_element == element; }
};
@@ -235,7 +235,7 @@ private:

TreeElement new_element;
new_element.m_element = element;
new_element.m_leaves = Array<int>();
new_element.m_leaves = array<int>();
m_elements << new_element;
return m_elements.Count() - 1;
}
@@ -254,7 +254,7 @@ private:
}

//--
bool TestLeaf(int leaf, const TB& leaf_bb, const TB& test_bb, Array<TE*>& elements)
bool TestLeaf(int leaf, const TB& leaf_bb, const TB& test_bb, array<TE*>& elements)
{
bool result = false;
if (TestAABBVsAABB(leaf_bb, test_bb))
@@ -299,7 +299,7 @@ private:
depth < m_max_depth)
{
//Extract elements
Array<int> elements = m_tree[leaf].m_elements;
array<int> elements = m_tree[leaf].m_elements;
elements.PushUnique(AddElement(element));
m_tree[leaf].m_elements.Empty();
//Add children
@@ -327,7 +327,7 @@ private:
public:
void RegisterElement(TE* element) { RegisterElement(element, 0, GetAABB(), 0); }
void UnregisterElement(TE* element) { RemoveElement(element); }
bool FindElements(const TB& bbox, Array<TE*>& elements) { return TestLeaf(0, GetAABB(), bbox, elements); }
bool FindElements(const TB& bbox, array<TE*>& elements) { return TestLeaf(0, GetAABB(), bbox, elements); }
void Clear()
{
m_tree.Empty();
@@ -353,20 +353,20 @@ public:
void SetMaxDepth(int max_depth) { m_max_depth = max_depth; }
void SetMaxElement(int max_element) { m_max_element = max_element; }

Array<NodeLeaf> const & GetTree() const
array<NodeLeaf> const & GetTree() const
{
return m_tree;
}

Array<TreeElement> const & GetElements() const
array<TreeElement> const & GetElements() const
{
return m_elements;
}

protected:
Array<NodeLeaf> m_tree; //actual tree
Array<TreeElement> m_elements; //elements to leaves
Array<int> m_free_leaves; //leaves removed from tree
array<NodeLeaf> m_tree; //actual tree
array<TreeElement> m_elements; //elements to leaves
array<int> m_free_leaves; //leaves removed from tree
TV m_size; //Main tree size
int m_max_depth; //Maximum depth possible
int m_max_element; //Maximum element per leaf


+ 6
- 6
src/lol/algorithm/portal.h Bestand weergeven

@@ -278,7 +278,7 @@ public:

private:
//Portals associated with this room.
Array<PortalDoor<TE>*> m_doors;
array<PortalDoor<TE>*> m_doors;
TE* m_element;
};

@@ -298,9 +298,9 @@ public:
}

//Visible room getter
void GetVisibleRooms(PortalDoor<TE>* see_through, PortalRoom<TE>* start_room, Array<PortalRoom<TE>*>& visible_rooms)
void GetVisibleRooms(PortalDoor<TE>* see_through, PortalRoom<TE>* start_room, array<PortalRoom<TE>*>& visible_rooms)
{
Array<PortalDoor<TE>*> ignore_doors;
array<PortalDoor<TE>*> ignore_doors;
GetVisibleRooms(see_through, start_room, visible_rooms, ignore_doors);
#if LOL_BUILD_DEBUG
for (auto room : visible_rooms)
@@ -322,7 +322,7 @@ public:
#endif //LOL_BUILD_DEBUG
}
private:
void GetVisibleRooms(PortalDoor<TE>* see_through, PortalRoom<TE>* start_room, Array<PortalRoom<TE>*>& visible_rooms, Array<PortalDoor<TE>*>& ignore_doors)
void GetVisibleRooms(PortalDoor<TE>* see_through, PortalRoom<TE>* start_room, array<PortalRoom<TE>*>& visible_rooms, array<PortalDoor<TE>*>& ignore_doors)
{
for (auto door : start_room->m_doors)
{
@@ -381,8 +381,8 @@ public:

private:
//Portals associated with this room.
Array<PortalRoom<TE>*> m_rooms;
Array<PortalDoor<TE>*> m_doors;
array<PortalRoom<TE>*> m_rooms;
array<PortalDoor<TE>*> m_doors;
};

} /* namespace lol */


+ 2
- 2
src/lol/algorithm/sort.h Bestand weergeven

@@ -18,7 +18,7 @@ namespace lol
{

template<typename T, typename ARRAY>
void ArrayBase<T, ARRAY>::Sort(int sort)
void array_base<T, ARRAY>::Sort(int sort)
{
int s = 0;
// Classic bubble
@@ -44,7 +44,7 @@ void ArrayBase<T, ARRAY>::Sort(int sort)
}

template<typename T, typename ARRAY>
void ArrayBase<T, ARRAY>::SortQuickSwap(int start, int stop)
void array_base<T, ARRAY>::SortQuickSwap(int start, int stop)
{
int m[3] =
{


+ 165
- 159
src/lol/base/array.h Bestand weergeven

@@ -10,10 +10,10 @@
//

//
// The Array class
// The array class
// ---------------
// A very simple Array class not unlike the std::vector, with some nice
// additional features, eg. Array<int,float> for automatic arrays of tuples.
// A very simple array class not unlike the std::vector, with some nice
// additional features, eg. array<int,float> for automatic arrays of tuples.
//

#if !defined __LOL_BASE_ARRAY_H__
@@ -41,16 +41,16 @@ namespace lol
* m_count are allocated. The rest is uninitialised memory.
*/

template<typename T, typename ARRAY> class ArrayBase
template<typename T, typename ARRAY> class array_base
{
public:
typedef T Element;
typedef T element_t;

inline ArrayBase() : m_data(0), m_count(0), m_reserved(0)
inline array_base() : m_data(0), m_count(0), m_reserved(0)
{
}

inline ArrayBase(std::initializer_list<Element> const &list)
inline array_base(std::initializer_list<element_t> const &list)
: m_data(0),
m_count(0),
m_reserved(0)
@@ -60,24 +60,24 @@ public:
Push(elem);
}

inline ~ArrayBase()
inline ~array_base()
{
for (int i = 0; i < m_count; i++)
m_data[i].~Element();
m_data[i].~element_t();
delete[] reinterpret_cast<uint8_t *>(m_data);
}

ArrayBase(ArrayBase const& that) : m_data(0), m_count(0), m_reserved(0)
array_base(array_base const& that) : m_data(0), m_count(0), m_reserved(0)
{
/* Reserve the exact number of values instead of what the other
* array had reserved. Just a method for not wasting too much. */
Reserve(that.m_count);
for (int i = 0; i < that.m_count; i++)
new(&m_data[i]) Element(that[i]);
new(&m_data[i]) element_t(that[i]);
m_count = that.m_count;
}

ArrayBase& operator=(ArrayBase const& that)
array_base& operator=(array_base const& that)
{
if ((uintptr_t)this != (uintptr_t)&that)
{
@@ -91,9 +91,9 @@ public:
* remaining elements. */
Reserve(that.m_count);
for (int i = 0; i < m_count && i < that.m_count; i++)
m_data[i] = Element(that[i]);
m_data[i] = element_t(that[i]);
for (int i = m_count; i < that.m_count; i++)
new(&m_data[i]) Element(that[i]);
new(&m_data[i]) element_t(that[i]);
}
else
{
@@ -102,23 +102,23 @@ public:
* that we do not have, and finally destroy the remaining
* elements. */
for (int i = 0; i < m_count && i < that.m_count; i++)
m_data[i] = Element(that[i]);
m_data[i] = element_t(that[i]);
for (int i = m_count; i < that.m_count; i++)
new(&m_data[i]) Element(that[i]);
new(&m_data[i]) element_t(that[i]);
for (int i = that.m_count; i < m_count; i++)
m_data[i].~Element();
m_data[i].~element_t();
}
m_count = that.m_count;
}
return *this;
}

ArrayBase& operator+=(ArrayBase const &that)
array_base& operator+=(array_base const &that)
{
int todo = that.m_count;
Reserve(m_count + that.m_count);
for (int i = 0; i < todo; i++)
new(&m_data[m_count + i]) Element(that[i]);
new(&m_data[m_count + i]) element_t(that[i]);
m_count += todo;
return *this;
}
@@ -132,7 +132,7 @@ public:
return ret;
}

inline Element& operator[](int n)
inline element_t& operator[](int n)
{
/* Allow array[0] even if size is zero so that people can
* always use &array[0] to get a pointer to the data. */
@@ -141,14 +141,14 @@ public:
return m_data[n];
}

inline Element const& operator[](int n) const
inline element_t const& operator[](int n) const
{
ASSERT(n >= 0);
ASSERT(n < m_count || (!n && !m_count));
return m_data[n];
}

inline Element& operator[](uint32_t n)
inline element_t& operator[](uint32_t n)
{
/* Allow array[0] even if size is zero so that people can
* always use &array[0] to get a pointer to the data. */
@@ -157,14 +157,14 @@ public:
return m_data[n];
}

inline Element const& operator[](uint32_t n) const
inline element_t const& operator[](uint32_t n) const
{
ASSERT(n >= 0);
ASSERT(n < m_count || (!n && !m_count));
return m_data[n];
}

inline Element& operator[](uint64_t n)
inline element_t& operator[](uint64_t n)
{
/* Allow array[0] even if size is zero so that people can
* always use &array[0] to get a pointer to the data. */
@@ -173,52 +173,52 @@ public:
return m_data[n];
}

inline Element const& operator[](uint64_t n) const
inline element_t const& operator[](uint64_t n) const
{
ASSERT(n >= 0);
ASSERT(n < m_count || (!n && !m_count));
return m_data[n];
}

inline Element& Last()
inline element_t& Last()
{
ASSERT(m_count > 0);
return m_data[m_count - 1];
}

inline Element *Data()
inline element_t *Data()
{
return m_data;
}

inline Element const *Data() const
inline element_t const *Data() const
{
return m_data;
}

inline Element const& Last() const
inline element_t const& Last() const
{
ASSERT(m_count > 0);
return m_data[m_count - 1];
}

inline ArrayBase& operator<<(T const &x)
inline array_base& operator<<(T const &x)
{
if (m_count >= m_reserved)
{
T tmp = x;
Grow();
new (&m_data[m_count]) Element(tmp);
new (&m_data[m_count]) element_t(tmp);
}
else
{
new (&m_data[m_count]) Element(x);
new (&m_data[m_count]) element_t(x);
}
++m_count;
return *this;
}

inline ArrayBase& operator>>(T const &x)
inline array_base& operator>>(T const &x)
{
RemoveItem(x);
return *this;
@@ -248,10 +248,10 @@ public:

for (int i = m_count; i > pos; --i)
{
new (&m_data[i]) Element(m_data[i - 1]);
m_data[i - 1].~Element();
new (&m_data[i]) element_t(m_data[i - 1]);
m_data[i - 1].~element_t();
}
new (&m_data[pos]) Element(x);
new (&m_data[pos]) element_t(x);
++m_count;
}

@@ -312,7 +312,7 @@ public:
inline T Pop()
{
ASSERT(m_count > 0);
Element tmp = Last();
element_t tmp = Last();
Remove(m_count - 1, 1);
return tmp;
}
@@ -339,7 +339,7 @@ public:
for (int i = pos; i + todelete < m_count; i++)
m_data[i] = m_data[i + todelete];
for (int i = m_count - todelete; i < m_count; i++)
m_data[i].~Element();
m_data[i].~element_t();
m_count -= todelete;
}

@@ -355,23 +355,23 @@ public:
{
if (pos + i < m_count - 1 - i)
m_data[pos + i] = m_data[m_count - 1 - i];
m_data[m_count - 1 - i].~Element();
m_data[m_count - 1 - i].~element_t();
}
m_count -= todelete;
}

void Resize(int count, Element e = Element())
void Resize(int count, element_t e = element_t())
{
ASSERT(count >= 0);
Reserve(count);

/* Too many elements? Remove them. */
for (int i = count; i < m_count; ++i)
m_data[i].~Element();
m_data[i].~element_t();

/* Not enough elements? Add some. */
for (int i = m_count; i < count; ++i)
new(&m_data[i]) Element(e);
new(&m_data[i]) element_t(e);

m_count = count;
}
@@ -390,13 +390,13 @@ public:
* information we could have. But until C++ gives us the proper
* tools to deal with it, we assume new uint8_t[] returns properly
* aligned data. */
Element *tmp = reinterpret_cast<Element *>(reinterpret_cast<uintptr_t>
(new uint8_t[sizeof(Element) * toreserve]));
ASSERT(tmp, "out of memory in Array class");
element_t *tmp = reinterpret_cast<element_t *>(reinterpret_cast<uintptr_t>
(new uint8_t[sizeof(element_t) * toreserve]));
ASSERT(tmp, "out of memory in array class");
for (int i = 0; i < m_count; i++)
{
new(&tmp[i]) Element(m_data[i]);
m_data[i].~Element();
new(&tmp[i]) element_t(m_data[i]);
m_data[i].~element_t();
}
delete[] reinterpret_cast<uint8_t *>(m_data);
m_data = tmp;
@@ -410,7 +410,7 @@ public:
class ConstIterator
{
public:
ConstIterator(ArrayBase const *array, int pos)
ConstIterator(array_base const *array, int pos)
: m_pos(pos),
m_array(array)
{ }
@@ -420,7 +420,7 @@ public:
return m_pos != that.m_pos;
}

Element const & operator *() const
element_t const & operator *() const
{
return (*m_array)[m_pos];
}
@@ -433,13 +433,13 @@ public:

private:
int m_pos;
ArrayBase const *m_array;
array_base const *m_array;
};

class Iterator
{
public:
Iterator(ArrayBase *array, int pos)
Iterator(array_base *array, int pos)
: m_pos(pos),
m_array(array)
{ }
@@ -449,7 +449,7 @@ public:
return m_pos != that.m_pos;
}

Element operator *()
element_t operator *()
{
return (*m_array)[m_pos];
}
@@ -462,7 +462,7 @@ public:

private:
int m_pos;
ArrayBase *m_array;
array_base *m_array;
};

ConstIterator begin() const { return ConstIterator(this, 0); }
@@ -472,7 +472,7 @@ public:

public:
inline int Count() const { return m_count; }
inline int Bytes() const { return m_count * sizeof(Element); }
inline int Bytes() const { return m_count * sizeof(element_t); }

protected:
void Grow()
@@ -480,18 +480,18 @@ protected:
Reserve(m_count * 13 / 8 + 8);
}

Element *m_data;
element_t *m_data;
int m_count, m_reserved;
};

/*
* Element types
* element_t types
*/

template<typename T1, typename T2, typename T3 = void, typename T4 = void,
typename T5 = void, typename T6 = void, typename T7 = void,
typename T8 = void>
class ArrayElement
class array_element
{
public:
T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8;
@@ -499,7 +499,7 @@ public:

template<typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7>
class ArrayElement<T1, T2, T3, T4, T5, T6, T7, void>
class array_element<T1, T2, T3, T4, T5, T6, T7, void>
{
public:
T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7;
@@ -507,64 +507,64 @@ public:

template<typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6>
class ArrayElement<T1, T2, T3, T4, T5, T6, void, void>
class array_element<T1, T2, T3, T4, T5, T6, void, void>
{
public:
T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6;
};

template<typename T1, typename T2, typename T3, typename T4, typename T5>
class ArrayElement<T1, T2, T3, T4, T5, void, void, void>
class array_element<T1, T2, T3, T4, T5, void, void, void>
{
public:
T1 m1; T2 m2; T3 m3; T4 m4; T5 m5;
};

template<typename T1, typename T2, typename T3, typename T4>
class ArrayElement<T1, T2, T3, T4, void, void, void, void>
class array_element<T1, T2, T3, T4, void, void, void, void>
{
public:
T1 m1; T2 m2; T3 m3; T4 m4;
};

template<typename T1, typename T2, typename T3>
class ArrayElement<T1, T2, T3, void, void, void, void, void>
class array_element<T1, T2, T3, void, void, void, void, void>
{
public:
T1 m1; T2 m2; T3 m3;
};

template<typename T1, typename T2>
class ArrayElement<T1, T2, void, void, void, void, void, void>
class array_element<T1, T2, void, void, void, void, void, void>
{
public:
T1 m1; T2 m2;
};

/*
* Array specialisations implementing specific setters
* array specialisations implementing specific setters
*/

template<typename T1, typename T2 = void, typename T3 = void,
typename T4 = void, typename T5 = void, typename T6 = void,
typename T7 = void, typename T8 = void>
class Array : public ArrayBase<ArrayElement<T1, T2, T3, T4, T5, T6, T7, T8>,
Array<T1, T2, T3, T4, T5, T6, T7, T8>>
class array : public array_base<array_element<T1, T2, T3, T4, T5, T6, T7, T8>,
array<T1, T2, T3, T4, T5, T6, T7, T8>>
{
#if INHERIT_CONSTRUCTORS
using ArrayBase<ArrayElement<T1, T2, T3, T4, T5, T6, T7, T8>,
Array<T1, T2, T3, T4, T5, T6, T7, T8>>::ArrayBase;
using array_base<array_element<T1, T2, T3, T4, T5, T6, T7, T8>,
array<T1, T2, T3, T4, T5, T6, T7, T8>>::array_base;
#else
public:
typedef ArrayElement<T1, T2, T3, T4, T5, T6, T7, T8> Element;
typedef array_element<T1, T2, T3, T4, T5, T6, T7, T8> element_t;

inline Array()
: ArrayBase<Element,
Array<T1, T2, T3, T4, T5, T6, T7, T8>>::ArrayBase() {}
inline array()
: array_base<element_t,
array<T1, T2, T3, T4, T5, T6, T7, T8>>::array_base() {}

inline Array(std::initializer_list<Element> const &list)
: ArrayBase<Element,
Array<T1, T2, T3, T4, T5, T6, T7, T8>>::ArrayBase(list) {}
inline array(std::initializer_list<element_t> const &list)
: array_base<element_t,
array<T1, T2, T3, T4, T5, T6, T7, T8>>::array_base(list) {}
#endif

public:
@@ -602,24 +602,24 @@ public:

template<typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7>
class Array<T1, T2, T3, T4, T5, T6, T7, void>
: public ArrayBase<ArrayElement<T1, T2, T3, T4, T5, T6, T7, void>,
Array<T1, T2, T3, T4, T5, T6, T7>>
class array<T1, T2, T3, T4, T5, T6, T7, void>
: public array_base<array_element<T1, T2, T3, T4, T5, T6, T7, void>,
array<T1, T2, T3, T4, T5, T6, T7>>
{
#if INHERIT_CONSTRUCTORS
using ArrayBase<ArrayElement<T1, T2, T3, T4, T5, T6, T7, void>,
Array<T1, T2, T3, T4, T5, T6, T7>>::ArrayBase;
using array_base<array_element<T1, T2, T3, T4, T5, T6, T7, void>,
array<T1, T2, T3, T4, T5, T6, T7>>::array_base;
#else
public:
typedef ArrayElement<T1, T2, T3, T4, T5, T6, T7, void> Element;
typedef array_element<T1, T2, T3, T4, T5, T6, T7, void> element_t;

inline Array()
: ArrayBase<Element,
Array<T1, T2, T3, T4, T5, T6, T7>>::ArrayBase() {}
inline array()
: array_base<element_t,
array<T1, T2, T3, T4, T5, T6, T7>>::array_base() {}

inline Array(std::initializer_list<Element> const &list)
: ArrayBase<Element,
Array<T1, T2, T3, T4, T5, T6, T7>>::ArrayBase(list) {}
inline array(std::initializer_list<element_t> const &list)
: array_base<element_t,
array<T1, T2, T3, T4, T5, T6, T7>>::array_base(list) {}
#endif

public:
@@ -655,24 +655,24 @@ public:

template<typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6>
class Array<T1, T2, T3, T4, T5, T6, void, void>
: public ArrayBase<ArrayElement<T1, T2, T3, T4, T5, T6, void, void>,
Array<T1, T2, T3, T4, T5, T6>>
class array<T1, T2, T3, T4, T5, T6, void, void>
: public array_base<array_element<T1, T2, T3, T4, T5, T6, void, void>,
array<T1, T2, T3, T4, T5, T6>>
{
#if INHERIT_CONSTRUCTORS
using ArrayBase<ArrayElement<T1, T2, T3, T4, T5, T6, void, void>,
Array<T1, T2, T3, T4, T5, T6>>::ArrayBase;
using array_base<array_element<T1, T2, T3, T4, T5, T6, void, void>,
array<T1, T2, T3, T4, T5, T6>>::array_base;
#else
public:
typedef ArrayElement<T1, T2, T3, T4, T5, T6, void, void> Element;
typedef array_element<T1, T2, T3, T4, T5, T6, void, void> element_t;

inline Array()
: ArrayBase<Element,
Array<T1, T2, T3, T4, T5, T6>>::ArrayBase() {}
inline array()
: array_base<element_t,
array<T1, T2, T3, T4, T5, T6>>::array_base() {}

inline Array(std::initializer_list<Element> const &list)
: ArrayBase<Element,
Array<T1, T2, T3, T4, T5, T6>>::ArrayBase(list) {}
inline array(std::initializer_list<element_t> const &list)
: array_base<element_t,
array<T1, T2, T3, T4, T5, T6>>::array_base(list) {}
#endif

public:
@@ -705,24 +705,24 @@ public:
};

template<typename T1, typename T2, typename T3, typename T4, typename T5>
class Array<T1, T2, T3, T4, T5, void, void, void>
: public ArrayBase<ArrayElement<T1, T2, T3, T4, T5, void, void, void>,
Array<T1, T2, T3, T4, T5>>
class array<T1, T2, T3, T4, T5, void, void, void>
: public array_base<array_element<T1, T2, T3, T4, T5, void, void, void>,
array<T1, T2, T3, T4, T5>>
{
#if INHERIT_CONSTRUCTORS
using ArrayBase<ArrayElement<T1, T2, T3, T4, T5, void, void, void>,
Array<T1, T2, T3, T4, T5>>::ArrayBase;
using array_base<array_element<T1, T2, T3, T4, T5, void, void, void>,
array<T1, T2, T3, T4, T5>>::array_base;
#else
public:
typedef ArrayElement<T1, T2, T3, T4, T5, void, void, void> Element;
typedef array_element<T1, T2, T3, T4, T5, void, void, void> element_t;

inline Array()
: ArrayBase<Element,
Array<T1, T2, T3, T4, T5>>::ArrayBase() {}
inline array()
: array_base<element_t,
array<T1, T2, T3, T4, T5>>::array_base() {}

inline Array(std::initializer_list<Element> const &list)
: ArrayBase<Element,
Array<T1, T2, T3, T4, T5>>::ArrayBase(list) {}
inline array(std::initializer_list<element_t> const &list)
: array_base<element_t,
array<T1, T2, T3, T4, T5>>::array_base(list) {}
#endif

public:
@@ -753,24 +753,24 @@ public:
};

template<typename T1, typename T2, typename T3, typename T4>
class Array<T1, T2, T3, T4, void, void, void, void>
: public ArrayBase<ArrayElement<T1, T2, T3, T4, void, void, void, void>,
Array<T1, T2, T3, T4>>
class array<T1, T2, T3, T4, void, void, void, void>
: public array_base<array_element<T1, T2, T3, T4, void, void, void, void>,
array<T1, T2, T3, T4>>
{
#if INHERIT_CONSTRUCTORS
using ArrayBase<ArrayElement<T1, T2, T3, T4, void, void, void, void>,
Array<T1, T2, T3, T4>>::ArrayBase;
using array_base<array_element<T1, T2, T3, T4, void, void, void, void>,
array<T1, T2, T3, T4>>::array_base;
#else
public:
typedef ArrayElement<T1, T2, T3, T4, void, void, void, void> Element;
typedef array_element<T1, T2, T3, T4, void, void, void, void> element_t;

inline Array()
: ArrayBase<Element,
Array<T1, T2, T3, T4>>::ArrayBase() {}
inline array()
: array_base<element_t,
array<T1, T2, T3, T4>>::array_base() {}

inline Array(std::initializer_list<Element> const &list)
: ArrayBase<Element,
Array<T1, T2, T3, T4>>::ArrayBase(list) {}
inline array(std::initializer_list<element_t> const &list)
: array_base<element_t,
array<T1, T2, T3, T4>>::array_base(list) {}
#endif

public:
@@ -797,24 +797,24 @@ public:
};

template<typename T1, typename T2, typename T3>
class Array<T1, T2, T3, void, void, void, void, void>
: public ArrayBase<ArrayElement<T1, T2, T3, void, void, void, void, void>,
Array<T1, T2, T3>>
class array<T1, T2, T3, void, void, void, void, void>
: public array_base<array_element<T1, T2, T3, void, void, void, void, void>,
array<T1, T2, T3>>
{
#if INHERIT_CONSTRUCTORS
using ArrayBase<ArrayElement<T1, T2, T3, void, void, void, void, void>,
Array<T1, T2, T3>>::ArrayBase;
using array_base<array_element<T1, T2, T3, void, void, void, void, void>,
array<T1, T2, T3>>::array_base;
#else
public:
typedef ArrayElement<T1, T2, T3, void, void, void, void, void> Element;
typedef array_element<T1, T2, T3, void, void, void, void, void> element_t;

inline Array()
: ArrayBase<Element,
Array<T1, T2, T3>>::ArrayBase() {}
inline array()
: array_base<element_t,
array<T1, T2, T3>>::array_base() {}

inline Array(std::initializer_list<Element> const &list)
: ArrayBase<Element,
Array<T1, T2, T3>>::ArrayBase(list) {}
inline array(std::initializer_list<element_t> const &list)
: array_base<element_t,
array<T1, T2, T3>>::array_base(list) {}
#endif

public:
@@ -839,24 +839,24 @@ public:
};

template<typename T1, typename T2>
class Array<T1, T2, void, void, void, void, void, void>
: public ArrayBase<ArrayElement<T1, T2, void, void, void, void, void, void>,
Array<T1, T2>>
class array<T1, T2, void, void, void, void, void, void>
: public array_base<array_element<T1, T2, void, void, void, void, void, void>,
array<T1, T2>>
{
#if INHERIT_CONSTRUCTORS
using ArrayBase<ArrayElement<T1, T2, void, void, void, void, void, void>,
Array<T1, T2>>::ArrayBase;
using array_base<array_element<T1, T2, void, void, void, void, void, void>,
array<T1, T2>>::array_base;
#else
public:
typedef ArrayElement<T1, T2, void, void, void, void, void, void> Element;
typedef array_element<T1, T2, void, void, void, void, void, void> element_t;

inline Array()
: ArrayBase<Element,
Array<T1, T2>>::ArrayBase() {}
inline array()
: array_base<element_t,
array<T1, T2>>::array_base() {}

inline Array(std::initializer_list<Element> const &list)
: ArrayBase<Element,
Array<T1, T2>>::ArrayBase(list) {}
inline array(std::initializer_list<element_t> const &list)
: array_base<element_t,
array<T1, T2>>::array_base(list) {}
#endif

public:
@@ -879,27 +879,33 @@ public:
};

template<typename T>
class Array<T, void, void, void, void, void, void, void>
: public ArrayBase<T,
Array<T>>
class array<T, void, void, void, void, void, void, void>
: public array_base<T,
array<T>>
{
#if INHERIT_CONSTRUCTORS
using ArrayBase<T,
Array<T>>::ArrayBase;
using array_base<T,
array<T>>::array_base;
#else
public:
typedef T Element;
typedef T element_t;

inline Array()
: ArrayBase<T,
Array<T>>::ArrayBase() {}
inline array()
: array_base<T,
array<T>>::array_base() {}

inline Array(std::initializer_list<Element> const &list)
: ArrayBase<T,
Array<T>>::ArrayBase(list) {}
inline array(std::initializer_list<element_t> const &list)
: array_base<T,
array<T>>::array_base(list) {}
#endif
};

/* Transitional alias for the camelcase version of lol::array */
template<typename T1, typename T2 = void, typename T3 = void,
typename T4 = void, typename T5 = void, typename T6 = void,
typename T7 = void, typename T8 = void>
using Array = array<T1, T2, T3, T4, T5, T6, T7, T8>;

} /* namespace lol */

#endif // __LOL_BASE_ARRAY_H__


+ 3
- 3
src/lol/base/map.h Bestand weergeven

@@ -80,9 +80,9 @@ public:
return false;
}

Array<K> Keys() const
array<K> Keys() const
{
Array<K> ret;
array<K> ret;
for (auto it : m_array)
ret.Push(it.m2);
return ret;
@@ -111,7 +111,7 @@ private:
return FindIndex(key, hashed);
}

Array<uint32_t, K, V> m_array;
array<uint32_t, K, V> m_array;
};

} /* namespace lol */


+ 2
- 2
src/lol/base/string.h Bestand weergeven

@@ -26,10 +26,10 @@
namespace lol
{

class String : protected Array<char>
class String : protected array<char>
{
private:
typedef Array<char> Super;
typedef array<char> Super;

public:
inline String()


+ 4
- 4
src/lol/gpu/shader.h Bestand weergeven

@@ -113,10 +113,10 @@ public:
void SetUniform(ShaderUniform const &uni, mat4 const &m);
void SetUniform(ShaderUniform const &uni, TextureUniform tex, int index);

void SetUniform(ShaderUniform const &uni, Array<float> const &v);
void SetUniform(ShaderUniform const &uni, Array<vec2> const &v);
void SetUniform(ShaderUniform const &uni, Array<vec3> const &v);
void SetUniform(ShaderUniform const &uni, Array<vec4> const &v);
void SetUniform(ShaderUniform const &uni, array<float> const &v);
void SetUniform(ShaderUniform const &uni, array<vec2> const &v);
void SetUniform(ShaderUniform const &uni, array<vec3> const &v);
void SetUniform(ShaderUniform const &uni, array<vec4> const &v);

void Bind() const;
void Unbind() const;


+ 1
- 1
src/lol/image/image.h Bestand weergeven

@@ -91,7 +91,7 @@ public:
template<typename T>
void Unlock2D(array2d<T> const &);

bool RetrieveTiles(Array<ivec2, ivec2>& tiles) const;
bool RetrieveTiles(array<ivec2, ivec2>& tiles) const;

/* Image processing kernels */
static array2d<float> BayerKernel(ivec2 size);


+ 15
- 15
src/lol/math/array2d.h Bestand weergeven

@@ -33,11 +33,11 @@ namespace lol
template<typename T1, typename T2 = void, typename T3 = void,
typename T4 = void, typename T5 = void, typename T6 = void,
typename T7 = void, typename T8 = void>
class array2d : protected Array<T1, T2, T3, T4, T5, T6, T7, T8>
class array2d : protected array<T1, T2, T3, T4, T5, T6, T7, T8>
{
public:
typedef Array<T1, T2, T3, T4, T5, T6, T7, T8> Super;
typedef typename Super::Element Element;
typedef array<T1, T2, T3, T4, T5, T6, T7, T8> super;
typedef typename super::element_t element_t;

inline array2d()
: m_size(0, 0)
@@ -45,14 +45,14 @@ public:
}

inline array2d(std::initializer_list<
std::initializer_list<Element>> const &list)
std::initializer_list<element_t>> const &list)
: m_size(list.size() ? (int)(*list.begin()).size() : 0,
(int)list.size())
{
Super::Reserve(m_size.x * m_size.y);
super::Reserve(m_size.x * m_size.y);
for (auto l : list)
for (auto elem : l)
Super::Push(elem);
super::Push(elem);
}

inline array2d(int w, int h)
@@ -66,7 +66,7 @@ public:
}

/* Access elements directly using an ivec2 index */
inline Element const &operator [](ivec2 pos) const
inline element_t const &operator [](ivec2 pos) const
{
ASSERT(pos.x >= 0);
ASSERT(pos.y >= 0);
@@ -80,7 +80,7 @@ public:
return this->m_data[n];
}

inline Element &operator [](ivec2 pos)
inline element_t &operator [](ivec2 pos)
{
ASSERT(pos.x >= 0);
ASSERT(pos.y >= 0);
@@ -103,7 +103,7 @@ public:
{
}

inline Element &operator [](int j)
inline element_t &operator [](int j)
{
ASSERT(j >= 0);
ASSERT(j < m_array.m_size.y);
@@ -124,7 +124,7 @@ public:
{
}

inline Element const &operator [](int j) const
inline element_t const &operator [](int j) const
{
ASSERT(j >= 0);
ASSERT(j < m_array.m_size.y);
@@ -153,7 +153,7 @@ public:

/* Resize the array.
* FIXME: data gets scrambled; should we care? */
inline void SetSize(ivec2 size, Element e = Element())
inline void SetSize(ivec2 size, element_t e = element_t())
{
this->Resize(size.x * size.y, e);
m_size = size;
@@ -165,10 +165,10 @@ public:
}

public:
inline Element *Data() { return Super::Data(); }
inline Element const *Data() const { return Super::Data(); }
inline int Count() const { return Super::Count(); }
inline int Bytes() const { return Super::Bytes(); }
inline element_t *Data() { return super::Data(); }
inline element_t const *Data() const { return super::Data(); }
inline int Count() const { return super::Count(); }
inline int Bytes() const { return super::Bytes(); }

private:
ivec2 m_size;


+ 15
- 15
src/lol/math/array3d.h Bestand weergeven

@@ -33,11 +33,11 @@ namespace lol
template<typename T1, typename T2 = void, typename T3 = void,
typename T4 = void, typename T5 = void, typename T6 = void,
typename T7 = void, typename T8 = void>
class array3d : protected Array<T1, T2, T3, T4, T5, T6, T7, T8>
class array3d : protected array<T1, T2, T3, T4, T5, T6, T7, T8>
{
public:
typedef Array<T1, T2, T3, T4, T5, T6, T7, T8> Super;
typedef typename Super::Element Element;
typedef array<T1, T2, T3, T4, T5, T6, T7, T8> super;
typedef typename super::element_t element_t;

inline array3d()
: m_size(0, 0, 0)
@@ -46,17 +46,17 @@ public:

inline array3d(std::initializer_list<
std::initializer_list<
std::initializer_list<Element>>> const &list)
std::initializer_list<element_t>>> const &list)
: m_size(list.size() && (*list.begin()).size() ?
(int)(*(*list.begin()).begin()).size() : 0,
list.size() ? (int)(*list.begin()).size() : 0,
(int)list.size())
{
Super::Reserve(m_size.x * m_size.y * m_size.z);
super::Reserve(m_size.x * m_size.y * m_size.z);
for (auto ll : list)
for (auto l : ll)
for (auto elem : l)
Super::Push(elem);
super::Push(elem);
}

inline array3d(int w, int h, int d)
@@ -70,7 +70,7 @@ public:
}

/* Access elements directly using an ivec3 index */
inline Element const &operator [](ivec3 pos) const
inline element_t const &operator [](ivec3 pos) const
{
ASSERT(pos.x >= 0);
ASSERT(pos.y >= 0);
@@ -86,7 +86,7 @@ public:
return this->m_data[n];
}

inline Element &operator [](ivec3 pos)
inline element_t &operator [](ivec3 pos)
{
ASSERT(pos.x >= 0);
ASSERT(pos.y >= 0);
@@ -120,7 +120,7 @@ public:
{
}

inline Element &operator [](int k)
inline element_t &operator [](int k)
{
ASSERT(k >= 0);
ASSERT(k < m_array.m_size.z);
@@ -162,7 +162,7 @@ public:
{
}

inline Element const &operator [](int k) const
inline element_t const &operator [](int k) const
{
ASSERT(k >= 0);
ASSERT(k < m_array.m_size.z);
@@ -203,7 +203,7 @@ public:

/* Resize the array.
* FIXME: data gets scrambled; should we care? */
inline void SetSize(ivec3 size, Element e = Element())
inline void SetSize(ivec3 size, element_t e = element_t())
{
this->Resize(size.x * size.y * size.z, e);
m_size = size;
@@ -215,10 +215,10 @@ public:
}

public:
inline Element *Data() { return Super::Data(); }
inline Element const *Data() const { return Super::Data(); }
inline int Count() const { return Super::Count(); }
inline int Bytes() const { return Super::Bytes(); }
inline element_t *Data() { return super::Data(); }
inline element_t const *Data() const { return super::Data(); }
inline int Count() const { return super::Count(); }
inline int Bytes() const { return super::Bytes(); }

private:
ivec3 m_size;


+ 4
- 4
src/lol/sys/file.h Bestand weergeven

@@ -72,11 +72,11 @@ public:
void Close();

private:
bool GetContent(Array<String>* files, Array<Directory>* directories);
bool GetContent(array<String>* files, array<Directory>* directories);
public:
bool GetContent(Array<String>& files, Array<Directory>& directories);
bool GetContent(Array<Directory>& directories);
bool GetContent(Array<String>& files);
bool GetContent(array<String>& files, array<Directory>& directories);
bool GetContent(array<Directory>& directories);
bool GetContent(array<String>& files);
String GetName();

static String GetCurrent();


+ 1
- 1
src/lol/sys/init.h Bestand weergeven

@@ -52,7 +52,7 @@ extern void Init(int argc, char *argv[],
String const &sourcesubdir = LOL_CONFIG_SOURCESUBDIR);

extern void AddDataDir(String const &dir);
extern Array<String> GetPathList(String const &file);
extern array<String> GetPathList(String const &file);

} /* namespace System */



+ 5
- 5
src/lol/sys/thread.h Bestand weergeven

@@ -103,7 +103,7 @@ protected:
bool AddWork(ThreadJob* job);

//Fetch Results
bool FetchResult(Array<ThreadJob*>& results);
bool FetchResult(array<ThreadJob*>& results);
//Base thread work function
static void *BaseThreadWork(void* data);
virtual void TickGame(float seconds);
@@ -112,11 +112,11 @@ protected:

/* Worker threads */
int m_thread_count;
Array<Thread*> m_threads;
array<Thread*> m_threads;
Queue<ThreadStatus> m_spawnqueue, m_donequeue;
Queue<ThreadJob*> m_jobqueue;
Queue<ThreadJob*> m_resultqueue;
Array<ThreadJob*> m_job_dispatch;
array<ThreadJob*> m_job_dispatch;
};

//Generic class for thread manager, executes work and store results, for you to use
@@ -130,7 +130,7 @@ public:

//Work stuff
bool AddJob(ThreadJob* job) { return AddWork(job); }
bool GetWorkResult(Array<ThreadJob*>& results)
bool GetWorkResult(array<ThreadJob*>& results)
{
results += m_job_result;
m_job_result.Empty();
@@ -140,7 +140,7 @@ public:
protected:
virtual void TreatResult(ThreadJob* result) { m_job_result << result; }

Array<ThreadJob*> m_job_result;
array<ThreadJob*> m_job_result;
};
#endif



+ 3
- 3
src/mesh/mesh.h Bestand weergeven

@@ -37,7 +37,7 @@ public:
void Render();

public:
Array<class SubMesh *> m_submeshes;
array<class SubMesh *> m_submeshes;
};

/*
@@ -68,10 +68,10 @@ protected:
MeshPrimitive m_mesh_prim;
Shader *m_shader;
VertexDeclaration* m_vdecl;
Array<VertexBuffer *> m_vbos;
array<VertexBuffer *> m_vbos;
IndexBuffer *m_ibo;

Array<String, Texture*> m_textures;
array<String, Texture*> m_textures;
};

} /* namespace lol */


+ 3
- 3
src/messageservice.cpp Bestand weergeven

@@ -79,7 +79,7 @@ bool MessageService::Send(MessageBucket id, const char* message)
{
ASSERT(0 <= id && (int)id < g_messageservice->m_bucket.Count());
MessageService& g = *g_messageservice;
Array<MessageList>& bucket = g.m_bucket[id];
array<MessageList>& bucket = g.m_bucket[id];
bucket << MessageList(time(nullptr), String(message));
return true;
}
@@ -104,7 +104,7 @@ bool MessageService::FetchFirst(MessageBucket id, String& message, time_t& times
{
ASSERT(0 <= id && (int)id < g_messageservice->m_bucket.Count());
MessageService& g = *g_messageservice;
Array<MessageList>& bucket = g.m_bucket[id];
array<MessageList>& bucket = g.m_bucket[id];

if (bucket.Count())
{
@@ -135,7 +135,7 @@ bool MessageService::FetchAll(MessageBucket id, String& message, time_t& first_t
{
ASSERT(0 <= id && (int)id < g_messageservice->m_bucket.Count());
MessageService& g = *g_messageservice;
Array<MessageList>& bucket = g.m_bucket[id];
array<MessageList>& bucket = g.m_bucket[id];
message = String("");

if (bucket.Count())


+ 1
- 1
src/messageservice.h Bestand weergeven

@@ -80,7 +80,7 @@ public:
static bool FetchAll(MessageBucket id, String& message, time_t &first_timestamp);

private:
Array<Array<MessageList> > m_bucket;
array<array<MessageList> > m_bucket;
};

extern MessageService *g_messageservice;


+ 1
- 1
src/platform/d3d9/d3d9input.cpp Bestand weergeven

@@ -35,7 +35,7 @@ class D3d9InputData

private:
#if defined USE_XINPUT
Array<int, InputDeviceInternal*> m_joysticks;
array<int, InputDeviceInternal*> m_joysticks;
#endif // USE_XINPUT
};



+ 1
- 1
src/platform/nacl/nacl-instance.h Bestand weergeven

@@ -34,7 +34,7 @@ private:
InitViewportSize();
}

Array<class pp::InputEvent> m_input_events;
array<class pp::InputEvent> m_input_events;
class InputDeviceInternal* m_mouse;
class InputDeviceInternal* m_keyboard;



+ 1
- 1
src/platform/ps3/ps3input.cpp Bestand weergeven

@@ -39,7 +39,7 @@ class Ps3InputData
friend class Ps3Input;

#if defined __CELLOS_LV2__
Array<int, Stick *> m_joysticks;
array<int, Stick *> m_joysticks;

vec2 mousepos;
ivec3 mousebuttons;


+ 1
- 1
src/platform/sdl/sdlinput.cpp Bestand weergeven

@@ -59,7 +59,7 @@ private:
m_mousecapture(false)
{ }

Array<SDL_Joystick*, InputDeviceInternal*> m_joysticks;
array<SDL_Joystick*, InputDeviceInternal*> m_joysticks;
InputDeviceInternal* m_mouse;
InputDeviceInternal* m_keyboard;



+ 1
- 1
src/platform/xbox/xboxinput.cpp Bestand weergeven

@@ -33,7 +33,7 @@ class XboxInputData

private:
#if defined _XBOX
Array<int, Stick *> m_joysticks;
array<int, Stick *> m_joysticks;
#endif
};



+ 2
- 2
src/sample.cpp Bestand weergeven

@@ -86,7 +86,7 @@ Sample::Sample(char const *path)
data->m_name = String("<sample> ") + path;

#if __CELLOS_LV2__
Array<String> pathlist = System::GetPathList(path);
array<String> pathlist = System::GetPathList(path);
File f;
for (int i = 0; i < pathlist.Count(); ++i)
{
@@ -103,7 +103,7 @@ Sample::Sample(char const *path)
Log::Error("could not load sample %s\n", path);
}
#elif defined USE_SDL_MIXER
Array<String> pathlist = System::GetPathList(path);
array<String> pathlist = System::GetPathList(path);
for (int i = 0; i < pathlist.Count(); ++i)
{
data->m_chunk = Mix_LoadWAV(pathlist[i].C());


+ 12
- 12
src/scene.cpp Bestand weergeven

@@ -59,30 +59,30 @@ class SceneData

private:
/* New scenegraph */
Array<Primitive> m_primitives;
array<Primitive> m_primitives;

/* Old API <P0, P1, COLOR, TIME, MASK> */
float m_new_line_time;
int m_new_line_mask;
float m_new_line_segment_size;
vec4 m_new_line_color;
Array<vec3, vec3, vec4, float, int, bool, bool> m_lines;
array<vec3, vec3, vec4, float, int, bool, bool> m_lines;
int m_debug_mask;
Shader *m_line_shader;
VertexDeclaration *m_line_vdecl;

int m_tile_cam;
Array<Tile> m_tiles;
Array<Tile> m_palettes;
Array<Light *> m_lights;
array<Tile> m_tiles;
array<Tile> m_palettes;
array<Light *> m_lights;

Shader *m_tile_shader;
Shader *m_palette_shader;
VertexDeclaration *m_tile_vdecl;
Array<VertexBuffer *> m_tile_bufs;
array<VertexBuffer *> m_tile_bufs;

Camera *m_default_cam;
Array<Camera *> m_camera_stack;
array<Camera *> m_camera_stack;
};

/*
@@ -236,7 +236,7 @@ void Scene::AddLight(Light *l)
data->m_lights.Push(l);
}

Array<Light *> const &Scene::GetLights() const
array<Light *> const &Scene::GetLights() const
{
return data->m_lights;
}
@@ -277,8 +277,8 @@ void Scene::RenderPrimitives()
u_normalmat = shader->GetUniformLocation("u_normalmat");

/* Per-scene environment */
Array<Light *> const &lights = GetLights();
Array<vec4> light_data;
array<Light *> const &lights = GetLights();
array<vec4> light_data;

/* FIXME: the 4th component of the position can be used for other things */
/* FIXME: GetUniform("blabla") is costly */
@@ -325,7 +325,7 @@ void Scene::RenderTiles() // XXX: rename to Blit()
for (int p = 0; p < 2; p++)
{
Shader *shader = (p == 0) ? data->m_tile_shader : data->m_palette_shader;
Array<Tile>& tiles = (p == 0) ? data->m_tiles : data->m_palettes;
array<Tile>& tiles = (p == 0) ? data->m_tiles : data->m_palettes;

if (tiles.Count() == 0)
continue;
@@ -434,7 +434,7 @@ void Scene::RenderLines(float seconds) // XXX: rename to Blit()
if (!data->m_line_shader)
data->m_line_shader = Shader::Create(LOLFX_RESOURCE_NAME(line));

Array<vec4, vec4, vec4, vec4> buff;
array<vec4, vec4, vec4, vec4> buff;
buff.Resize(linecount);
int real_linecount = 0;
mat4 const inv_view_proj = inverse(g_scene->GetCamera()->GetProjection() * g_scene->GetCamera()->GetView());


+ 1
- 1
src/scene.h Bestand weergeven

@@ -67,7 +67,7 @@ public:
void AddLine(vec2 a, vec2 b, vec4 color, float az=-1.f, float bz=-1.f);

void AddLight(Light *light);
Array<Light *> const &GetLights() const;
array<Light *> const &GetLights() const;

private:
SceneData *data;


+ 7
- 7
src/sys/file.cpp Bestand weergeven

@@ -144,7 +144,7 @@ class FileData

String ReadString()
{
Array<uint8_t> buf;
array<uint8_t> buf;
buf.Resize(BUFSIZ);
String ret;
while (IsValid())
@@ -415,7 +415,7 @@ class DirectoryData
#endif
}

bool GetContentList(Array<String>* files, Array<String>* directories)
bool GetContentList(array<String>* files, array<String>* directories)
{
if (!IsValid())
return false;
@@ -546,9 +546,9 @@ void Directory::Close()
}

//--
bool Directory::GetContent(Array<String>* files, Array<Directory>* directories)
bool Directory::GetContent(array<String>* files, array<Directory>* directories)
{
Array<String> sfiles, sdirectories;
array<String> sfiles, sdirectories;
bool found_some = m_data->GetContentList(&sfiles, &sdirectories);

if (directories)
@@ -563,19 +563,19 @@ bool Directory::GetContent(Array<String>* files, Array<Directory>* directories)
}

//--
bool Directory::GetContent(Array<String>& files, Array<Directory>& directories)
bool Directory::GetContent(array<String>& files, array<Directory>& directories)
{
return GetContent(&files, &directories);
}

//--
bool Directory::GetContent(Array<Directory>& directories)
bool Directory::GetContent(array<Directory>& directories)
{
return GetContent(nullptr, &directories);
}

//--
bool Directory::GetContent(Array<String>& files)
bool Directory::GetContent(array<String>& files)
{
return GetContent(&files, nullptr);
}


+ 3
- 3
src/sys/init.cpp Bestand weergeven

@@ -37,7 +37,7 @@ namespace System
# define SEPARATOR '/'
#endif

static Array<String> data_dir;
static array<String> data_dir;

void Init(int argc, char *argv[],
String const &projectdir,
@@ -157,9 +157,9 @@ void AddDataDir(String const &dir)
data_dir << dir;
}

Array<String> GetPathList(String const &file)
array<String> GetPathList(String const &file)
{
Array<String> ret;
array<String> ret;

for (int i = 0; i < data_dir.Count(); ++i)
ret << data_dir[i] + file;


+ 2
- 2
src/sys/thread.cpp Bestand weergeven

@@ -70,7 +70,7 @@ bool BaseThreadManager::AddWork(ThreadJob* job)
return false;
}

bool BaseThreadManager::FetchResult(Array<ThreadJob*>& results)
bool BaseThreadManager::FetchResult(array<ThreadJob*>& results)
{
ThreadJob* result;
while (m_resultqueue.TryPop(result))
@@ -112,7 +112,7 @@ void BaseThreadManager::TickGame(float seconds)
while (m_job_dispatch.Count() > 0 && AddWork(m_job_dispatch.Last()))
m_job_dispatch.Pop();

Array<ThreadJob*> result;
array<ThreadJob*> result;
//Fetch and treat results
if (FetchResult(result))
{


+ 2
- 2
src/ticker.cpp Bestand weergeven

@@ -57,8 +57,8 @@ public:

private:
/* Entity management */
Array<Entity *> m_todolist, m_autolist;
Array<Entity *> m_list[Entity::ALLGROUP_END];
array<Entity *> m_todolist, m_autolist;
array<Entity *> m_list[Entity::ALLGROUP_END];
int nentities;

/* Fixed framerate management */


+ 5
- 5
src/tileset.cpp Bestand weergeven

@@ -45,7 +45,7 @@ private:
String m_name;

/* Pixels, then texture coordinates */
Array<ibox2, box2> m_tiles;
array<ibox2, box2> m_tiles;
ivec2 m_tile_size, m_image_size, m_texture_size;

Image *m_image;
@@ -61,7 +61,7 @@ TileSet::TileSet(char const *path)
{
Init(path);

Array<ivec2, ivec2> tiles;
array<ivec2, ivec2> tiles;
if (m_data->m_image->RetrieveTiles(tiles))
for (int i = 0; i < tiles.Count(); i++)
AddTile(ibox2(tiles[0].m1, tiles[0].m1 + tiles[0].m2));
@@ -72,7 +72,7 @@ TileSet::TileSet(char const *path, Image* image)
{
Init(path, image);

Array<ivec2, ivec2> tiles;
array<ivec2, ivec2> tiles;
if (m_data->m_image->RetrieveTiles(tiles))
for (int i = 0; i < tiles.Count(); i++)
AddTile(ibox2(tiles[0].m1, tiles[0].m1 + tiles[0].m2));
@@ -102,7 +102,7 @@ TileSet::TileSet(char const *path, ivec2 size, ivec2 count)
size * ivec2(i + 1, j + 1)));
}

Array<ivec2, ivec2> tiles;
array<ivec2, ivec2> tiles;
if (m_data->m_image->RetrieveTiles(tiles))
for (int i = 0; i < tiles.Count(); i++)
AddTile(ibox2(tiles[i].m1, tiles[i].m1 + tiles[i].m2));
@@ -132,7 +132,7 @@ TileSet::TileSet(char const *path, Image* image, ivec2 size, ivec2 count)
size * ivec2(i + 1, j + 1)));
}

Array<ivec2, ivec2> tiles;
array<ivec2, ivec2> tiles;
if (m_data->m_image->RetrieveTiles(tiles))
for (int i = 0; i < tiles.Count(); i++)
AddTile(ibox2(tiles[i].m1, tiles[i].m1 + tiles[i].m2));


+ 1
- 1
src/utils.h Bestand weergeven

@@ -33,7 +33,7 @@ template< class T > inline void Swap( T& A, T& B )
//TODO: random struct
//Gets a random Element from the given array<T>, considering you have implemented what follows :
//NEEDS : float T::m_weight; //if m_weight is 0, it automatically assumes that this step is ignored.
template< class T > inline int GetRandom(Array<T> src)
template< class T > inline int GetRandom(array<T> src)
{
float r_total = 0.f;
float r_alpha = rand(1.f);


+ 1
- 1
src/world.cpp Bestand weergeven

@@ -47,7 +47,7 @@ class WorldData
char const *filename = lua_tostring(L, 1);
int status = LUA_ERRFILE;

Array<String> pathlist = System::GetPathList(filename);
array<String> pathlist = System::GetPathList(filename);
File f;
for (int i = 0; i < pathlist.Count(); ++i)
{


Laden…
Annuleren
Opslaan