@@ -97,7 +97,7 @@ void Log::Helper(MessageType type, char const *fmt, va_list ap) | |||||
# if defined _WIN32 | # if defined _WIN32 | ||||
String buf = String(prefix[type]) + ": " + String::VPrintf(fmt, ap); | String buf = String(prefix[type]) + ": " + String::VPrintf(fmt, ap); | ||||
Array<WCHAR> widechar; | |||||
array<WCHAR> widechar; | |||||
widechar.Resize(buf.Count() + 1); | widechar.Resize(buf.Count() + 1); | ||||
MultiByteToWideChar(CP_UTF8, 0, buf.C(), buf.Count() + 1, widechar.Data(), widechar.Count()); | MultiByteToWideChar(CP_UTF8, 0, buf.C(), buf.Count() + 1, widechar.Data(), widechar.Count()); | ||||
OutputDebugStringW(widechar.Data()); | OutputDebugStringW(widechar.Data()); | ||||
@@ -24,9 +24,9 @@ namespace lol | |||||
struct CommandStack | struct CommandStack | ||||
{ | { | ||||
private: | 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_f_cur; | ||||
int m_i_cur; | int m_i_cur; | ||||
@@ -50,7 +50,7 @@ public: | |||||
} | } | ||||
private: | private: | ||||
Array<Entity *> m_entities; | |||||
array<Entity *> m_entities; | |||||
int nentities; | int nentities; | ||||
}; | }; | ||||
@@ -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) | void CsgBsp::AddTriangleToTree(int const &tri_idx, vec3 const &tri_p0, vec3 const &tri_p1, vec3 const &tri_p2) | ||||
{ | { | ||||
//<Leaf_Id, v0, v1, v2> | //<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> | //<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 | //Tree is empty, so this leaf is the first | ||||
if (m_tree.Count() == 0) | 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, | 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. | //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; } | //<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. | //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> | //<{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. | //This list stores the current triangles to process. | ||||
//<Leaf_Id_List, v0, v1, v2, Should_Point_Test> | //<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 ! | //Tree is empty, ABORT ! | ||||
if (m_tree.Count() == 0) | 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. | //Let's push the triangle in here. | ||||
tri_to_process.Reserve(20); | 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); | tri_to_process.Last().m1.Push(0); | ||||
while (tri_to_process.Count()) | 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]); | t[(isec_base + 2) % 3], new_v_idx[v_idx1], new_v_idx[v_idx0]); | ||||
else | 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); | 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 | 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.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); | tri_to_process.Last().m1.Push(0); | ||||
} | } | ||||
#else | #else | ||||
@@ -417,14 +417,14 @@ int CsgBsp::TestTriangleToTree(vec3 const &tri_p0, vec3 const &tri_p1, vec3 cons | |||||
continue; | continue; | ||||
#endif | #endif | ||||
#if 0 //Send the newly created triangle back to the beginning | #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); | tri_to_process.Last().m1.Push(0); | ||||
#else //Inherit parent tree | #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) | 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]); | tri_list.Push(new_side[k / 3], new_t[k], new_t[k + 1], new_t[k + 2]); | ||||
else | 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; | 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) | if (m_tree[leaf_idx].m_leaves[new_side[k / 3]] == LEAF_CURRENT) | ||||
tri_to_process.Last().m1.Pop(); | 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; | res_total = res_total; | ||||
tri_list[i].m1 = LEAF_BACK; | tri_list[i].m1 = LEAF_BACK; | ||||
#if 0 | #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_to_process.Last().m1.Push(0); | ||||
tri_list.Remove(i--); | tri_list.Remove(i--); | ||||
break; | break; | ||||
@@ -44,7 +44,7 @@ public: | |||||
private: | private: | ||||
vec3 m_origin; | vec3 m_origin; | ||||
vec3 m_normal; | vec3 m_normal; | ||||
Array< int, vec3, vec3, vec3 > m_tri_list; | |||||
array< int, vec3, vec3, vec3 > m_tri_list; | |||||
ivec3 m_leaves; | ivec3 m_leaves; | ||||
}; | }; | ||||
@@ -60,16 +60,16 @@ public: | |||||
int TestTriangleToTree(vec3 const &tri_p0, vec3 const &tri_p1, vec3 const &tri_p2, | 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. | //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; } | //<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. | //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> | //<{IN|OUT}side_status, v0, v1, v2> | ||||
Array< int, int, int, int > &tri_list); | |||||
array< int, int, int, int > &tri_list); | |||||
private: | private: | ||||
int AddLeaf(int leaf_type, vec3 origin, vec3 normal, int above_idx); | int AddLeaf(int leaf_type, vec3 origin, vec3 normal, int above_idx); | ||||
int TestPoint(int leaf_idx, vec3 point); | int TestPoint(int leaf_idx, vec3 point); | ||||
Array<CsgBspLeaf> m_tree; | |||||
array<CsgBspLeaf> m_tree; | |||||
}; | }; | ||||
} /* namespace lol */ | } /* namespace lol */ | ||||
@@ -306,13 +306,13 @@ void EasyMesh::MeshCsg(CSGUsage csg_operation) | |||||
} | } | ||||
//A vertex dictionnary for vertices on the same spot. | //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. | //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>> | //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> | //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++) | for (int k = 0; k < 10; k++) | ||||
triangle_vertex.Push(vec3(.0f), 0); | 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 start_point = (mesh_id == 0)?(cursor_start):(m_cursors.Last().m2); | ||||
int end_point = (mesh_id == 0)?(m_cursors.Last().m2):(indices_count); | int end_point = (mesh_id == 0)?(m_cursors.Last().m2):(indices_count); | ||||
CsgBsp &mesh_bsp = (mesh_id == 0)?(mesh_bsp_1):(mesh_bsp_0); | 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); | vec3 n0(.0f); vec3 n1(.0f); | ||||
vec4 c0(.0f); vec4 c1(.0f); | vec4 c0(.0f); vec4 c1(.0f); | ||||
@@ -699,7 +699,7 @@ void EasyMesh::ComputeNormals(int start, int vcount) | |||||
BD()->IsEnabled(MeshBuildOperation::PostBuildComputeNormals)) | BD()->IsEnabled(MeshBuildOperation::PostBuildComputeNormals)) | ||||
return; | return; | ||||
Array< Array<vec3> > normals; | |||||
array< array<vec3> > normals; | |||||
normals.Resize(m_vert.Count()); | normals.Resize(m_vert.Count()); | ||||
for (int i = 0; i < vcount; i += 3) | for (int i = 0; i < vcount; i += 3) | ||||
{ | { | ||||
@@ -734,7 +734,7 @@ void EasyMesh::ComputeNormals(int start, int vcount) | |||||
//----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | ||||
void EasyMesh::VerticesCleanup() | void EasyMesh::VerticesCleanup() | ||||
{ | { | ||||
Array<int> vert_ids; | |||||
array<int> vert_ids; | |||||
vert_ids.Resize(m_vert.Count(), 0); | vert_ids.Resize(m_vert.Count(), 0); | ||||
//1: Remove triangles with two vertices on each other | //1: Remove triangles with two vertices on each other | ||||
@@ -758,7 +758,7 @@ void EasyMesh::VerticesCleanup() | |||||
} | } | ||||
//2: Remove all unused vertices | //2: Remove all unused vertices | ||||
Array<VertexData> old_vert = m_vert; | |||||
array<VertexData> old_vert = m_vert; | |||||
int shift = 0; | int shift = 0; | ||||
m_vert.Empty(); | m_vert.Empty(); | ||||
for (int i = 0; i < vert_ids.Count(); ++i) | for (int i = 0; i < vert_ids.Count(); ++i) | ||||
@@ -812,8 +812,8 @@ void EasyMesh::VerticesSeparate() | |||||
return; | 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); | vert_ids.Resize(m_vert.Count(), 0); | ||||
//1: Mark all used vertices | //1: Mark all used vertices | ||||
@@ -855,7 +855,7 @@ void EasyMesh::ComputeTexCoord(float uv_scale, int uv_offset) | |||||
UNUSED(uv_scale, uv_offset); | UNUSED(uv_scale, uv_offset); | ||||
#if 0 | #if 0 | ||||
VertexDictionnary vert_dict; | VertexDictionnary vert_dict; | ||||
Array<int> tri_list; | |||||
array<int> tri_list; | |||||
tri_list.Reserve(m_indices.Count() - m_cursors.Last().m2); | tri_list.Reserve(m_indices.Count() - m_cursors.Last().m2); | ||||
for (int i = m_cursors.Last().m2; i < m_indices.Count(); i++) | 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 | //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; | int tri_count = (m_indices.Count() - m_cursors.Last().m2) / 3; | ||||
tri_check << tri_list[0]; | 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); | uv[2] = texu_dir * dot(v01, v02) + texv_dir * dot(v_dir, v02); | ||||
//Set UV on ALL matching vertices! | //Set UV on ALL matching vertices! | ||||
Array<int> matching_vert; | |||||
array<int> matching_vert; | |||||
for (int i = 0; i < 3; i++) | for (int i = 0; i < 3; i++) | ||||
{ | { | ||||
#if 1 | #if 1 | ||||
@@ -1118,7 +1118,7 @@ void EasyMesh::RadialJitter(float r) | |||||
return; | return; | ||||
} | } | ||||
Array<int> Welded; | |||||
array<int> Welded; | |||||
Welded.Push(-1); | Welded.Push(-1); | ||||
for (int i = m_cursors.Last().m1 + 1; i < m_vert.Count(); i++) | 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(); | int ibase = m_indices.Count(); | ||||
Array<vec3> vertices; | |||||
array<vec3> vertices; | |||||
float uv_h = 0; | float uv_h = 0; | ||||
float uv_r = 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; | 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; | int smbuf = 0; | ||||
for (int i = m_cursors.Last().m1; i < m_vert.Count(); i++) | for (int i = m_cursors.Last().m1; i < m_vert.Count(); i++) | ||||
@@ -64,7 +64,7 @@ public: | |||||
bool SetRender(bool should_render); | bool SetRender(bool should_render); | ||||
private: | private: | ||||
void UpdateVertexDict(Array< int, int > &vertex_dict); | |||||
void UpdateVertexDict(array< int, int > &vertex_dict); | |||||
//------------------------------------------------------------------------- | //------------------------------------------------------------------------- | ||||
//Mesh CSG operations | //Mesh CSG operations | ||||
@@ -378,11 +378,11 @@ public: | |||||
vec3 const &GetVertexLocation(int i) { return m_vert[i].m_coord; } | vec3 const &GetVertexLocation(int i) { return m_vert[i].m_coord; } | ||||
//private: | //private: | ||||
Array<uint16_t> m_indices; | |||||
Array<VertexData> m_vert; | |||||
array<uint16_t> m_indices; | |||||
array<VertexData> m_vert; | |||||
//<vert count, indices count> | //<vert count, indices count> | ||||
Array<int, int> m_cursors; | |||||
array<int, int> m_cursors; | |||||
MeshRender m_state; | MeshRender m_state; | ||||
@@ -37,7 +37,7 @@ int VertexDictionnary::FindVertexMaster(const int search_idx) | |||||
//----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | ||||
//retrieve a list of matching vertices, doesn't include 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); | 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. | //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); | FindConnectedTriangles(search_idx, tri_list, tri0, connected_tri, ignored_tri); | ||||
for (int i = 0; i < connected_tri.Count(); i++) | 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); | 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); | 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); | 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; | int needed_validation = 0; | ||||
Array<int> vert_list[3]; | |||||
array<int> vert_list[3]; | |||||
for (int i = 0; i < 3; i++) | for (int i = 0; i < 3; i++) | ||||
{ | { | ||||
//Small optim since above func will use this one | //Small optim since above func will use this one | ||||
@@ -167,7 +167,7 @@ public: | |||||
inline CommandStack &CmdStack() { return m_stack; } | inline CommandStack &CmdStack() { return m_stack; } | ||||
inline int &Cmdi() { return m_i_cmd; } | inline int &Cmdi() { return m_i_cmd; } | ||||
inline int &CmdExecNb() { return m_exec_nb; } | 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 &ColorA() { return m_color_a; } | ||||
inline vec4 &ColorB() { return m_color_b; } | inline vec4 &ColorB() { return m_color_b; } | ||||
inline vec2 &TexCoordOffset() { return m_texcoord_offset; } | inline vec2 &TexCoordOffset() { return m_texcoord_offset; } | ||||
@@ -359,15 +359,15 @@ public: | |||||
CommandStack m_stack; | CommandStack m_stack; | ||||
int m_i_cmd; | int m_i_cmd; | ||||
int m_exec_nb; | int m_exec_nb; | ||||
Array<int, int> m_loop_stack; | |||||
array<int, int> m_loop_stack; | |||||
vec4 m_color_a; | vec4 m_color_a; | ||||
vec4 m_color_b; | vec4 m_color_b; | ||||
vec2 m_texcoord_offset; | vec2 m_texcoord_offset; | ||||
vec2 m_texcoord_offset2; | vec2 m_texcoord_offset2; | ||||
vec2 m_texcoord_scale; | vec2 m_texcoord_scale; | ||||
vec2 m_texcoord_scale2; | 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_type[MeshType::MAX]; | ||||
uint32_t m_texcoord_build_type2[MeshType::MAX]; | uint32_t m_texcoord_build_type2[MeshType::MAX]; | ||||
uint32_t m_build_flags; | uint32_t m_build_flags; | ||||
@@ -391,20 +391,20 @@ class VertexDictionnary | |||||
{ | { | ||||
public: | public: | ||||
int FindVertexMaster(const int search_idx); | 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 AddVertex(int vert_id, vec3 vert_coord); | ||||
void RemoveVertex(int vert_id); | 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(); } | void Clear() { vertex_list.Empty(); } | ||||
private: | private: | ||||
//<VertexId, VertexLocation, VertexMasterId> | //<VertexId, VertexLocation, VertexMasterId> | ||||
Array<int, vec3, int> vertex_list; | |||||
array<int, vec3, int> vertex_list; | |||||
//List of the master_ vertices | //List of the master_ vertices | ||||
Array<int> master_list; | |||||
array<int> master_list; | |||||
}; | }; | ||||
} /* namespace lol */ | } /* namespace lol */ | ||||
@@ -152,8 +152,8 @@ void DefaultShaderData::SetupShaderDatas(mat4 const &model) | |||||
mat4 modelview = view * model; | mat4 modelview = view * model; | ||||
mat3 normalmat = transpose(inverse(mat3(modelview))); | mat3 normalmat = transpose(inverse(mat3(modelview))); | ||||
/* FIXME: this should be hidden in the shader */ | /* 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. | //This is not very nice, but necessary for emscripten WebGL generation. | ||||
float f = 0.f; | float f = 0.f; | ||||
@@ -224,7 +224,7 @@ void GpuEasyMeshData::AddGpuData(GpuShaderData* gpudata, EasyMesh* src_mesh) | |||||
if (!m_ibo) | if (!m_ibo) | ||||
{ | { | ||||
Array<uint16_t> indexlist; | |||||
array<uint16_t> indexlist; | |||||
for (int i = 0; i < src_mesh->m_indices.Count(); i += 3) | for (int i = 0; i < src_mesh->m_indices.Count(); i += 3) | ||||
{ | { | ||||
indexlist << src_mesh->m_indices[i + 0]; | indexlist << src_mesh->m_indices[i + 0]; | ||||
@@ -292,7 +292,7 @@ void GpuEasyMeshData::SetupVertexData(uint16_t vflags, EasyMesh* src_mesh) | |||||
VertexUsage::Color, | VertexUsage::Color, | ||||
VertexUsage::TexCoord)); | 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++) | for (int i = 0; i < src_mesh->m_vert.Count(); i++) | ||||
vertexlist.Push(src_mesh->m_vert[i].m_coord, | vertexlist.Push(src_mesh->m_vert[i].m_coord, | ||||
src_mesh->m_vert[i].m_normal, | src_mesh->m_vert[i].m_normal, | ||||
@@ -309,7 +309,7 @@ void GpuEasyMeshData::SetupVertexData(uint16_t vflags, EasyMesh* src_mesh) | |||||
VertexUsage::Color, | VertexUsage::Color, | ||||
VertexUsage::TexCoord)); | 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++) | for (int i = 0; i < src_mesh->m_vert.Count(); i++) | ||||
vertexlist.Push(src_mesh->m_vert[i].m_coord, | vertexlist.Push(src_mesh->m_vert[i].m_coord, | ||||
src_mesh->m_vert[i].m_normal, | 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)); | 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++) | 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); | 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; | COPY_VBO; | ||||
@@ -334,7 +334,7 @@ void GpuEasyMeshData::SetupVertexData(uint16_t vflags, EasyMesh* src_mesh) | |||||
VertexUsage::Normal, | VertexUsage::Normal, | ||||
VertexUsage::Color)); | VertexUsage::Color)); | ||||
Array<vec3,vec3,u8vec4> vertexlist; | |||||
array<vec3,vec3,u8vec4> vertexlist; | |||||
for (int i = 0; i < src_mesh->m_vert.Count(); i++) | for (int i = 0; i < src_mesh->m_vert.Count(); i++) | ||||
vertexlist.Push(src_mesh->m_vert[i].m_coord, | vertexlist.Push(src_mesh->m_vert[i].m_coord, | ||||
src_mesh->m_vert[i].m_normal, | 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)); | 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++) | 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); | vertexlist.Push(src_mesh->m_vert[i].m_coord, src_mesh->m_vert[i].m_texcoord); | ||||
COPY_VBO; | 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)); | 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++) | 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); | vertexlist.Push(src_mesh->m_vert[i].m_coord, src_mesh->m_vert[i].m_texcoord.xy); | ||||
COPY_VBO; | 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)); | 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++) | 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)); | vertexlist.Push(src_mesh->m_vert[i].m_coord, (u8vec4)(src_mesh->m_vert[i].m_color * 255.f)); | ||||
COPY_VBO; | COPY_VBO; | ||||
@@ -80,8 +80,8 @@ protected: | |||||
uint16_t m_vert_decl_flags; | uint16_t m_vert_decl_flags; | ||||
Shader* m_shader; | Shader* m_shader; | ||||
int m_render_mode; | 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 | class DefaultShaderData : public GpuShaderData | ||||
@@ -96,7 +96,7 @@ public: | |||||
void SetupDefaultData(bool with_UV); | void SetupDefaultData(bool with_UV); | ||||
virtual void SetupShaderDatas(mat4 const &model); | virtual void SetupShaderDatas(mat4 const &model); | ||||
//-- | //-- | ||||
Array<String> m_uniform_names; | |||||
array<String> m_uniform_names; | |||||
}; | }; | ||||
class GpuEasyMeshData | class GpuEasyMeshData | ||||
@@ -115,9 +115,9 @@ public: | |||||
private: | private: | ||||
void SetupVertexData(uint16_t vdecl_flags, EasyMesh* src_mesh); | 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. | //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; | VertexBuffer*> m_vdatas; | ||||
int m_vertexcount; | int m_vertexcount; | ||||
//We only need only one ibo for the whole mesh | //We only need only one ibo for the whole mesh | ||||
@@ -46,7 +46,7 @@ private: | |||||
BlockIsForeverFalse, | BlockIsForeverFalse, | ||||
BlockIsTrue, | BlockIsTrue, | ||||
}; | }; | ||||
Array<int> m_pp_stack; | |||||
array<int> m_pp_stack; | |||||
char const *m_input; | char const *m_input; | ||||
}; | }; | ||||
@@ -129,7 +129,7 @@ Shader *Shader::Create(String const &name, String const &code) | |||||
String src = String("\n") + code; | String src = String("\n") + code; | ||||
/* Parse the crap */ | /* Parse the crap */ | ||||
Array<char const *, char const *> sections; | |||||
array<char const *, char const *> sections; | |||||
char *key = nullptr; | char *key = nullptr; | ||||
for (char *parser = src.C(); *parser; ) | for (char *parser = src.C(); *parser; ) | ||||
{ | { | ||||
@@ -699,7 +699,7 @@ void Shader::SetUniform(ShaderUniform const &uni, TextureUniform tex, int index) | |||||
* Uniform setters for arrays | * 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 | #if defined USE_D3D9 || defined _XBOX | ||||
/* FIXME: this will not work properly because we don't know how tell DX9 | /* 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 | #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 | #if defined USE_D3D9 || defined _XBOX | ||||
/* FIXME: this will not work properly because we don't know how tell DX9 | /* 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 | #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 | #if defined USE_D3D9 || defined _XBOX | ||||
/* FIXME: this will not work properly because we don't know how tell DX9 | /* 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 | #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 defined USE_D3D9 || defined _XBOX | ||||
if (uni.flags & 1) | if (uni.flags & 1) | ||||
@@ -45,9 +45,9 @@ public: | |||||
virtual uint8_t *GetData() const; | virtual uint8_t *GetData() const; | ||||
private: | private: | ||||
jobject bmp; | |||||
jintArray array; | |||||
jint *pixels; | |||||
jobject m_bmp; | |||||
jintArray m_array; | |||||
jint *m_pixels; | |||||
}; | }; | ||||
DECLARE_IMAGE_CODEC(AndroidImageCodec, 100) | DECLARE_IMAGE_CODEC(AndroidImageCodec, 100) | ||||
@@ -76,35 +76,35 @@ bool AndroidImageCodec::Load(Image *image, char const *path) | |||||
mid = env->GetMethodID(cls, "openImage", | mid = env->GetMethodID(cls, "openImage", | ||||
"(Ljava/lang/String;)Landroid/graphics/Bitmap;"); | "(Ljava/lang/String;)Landroid/graphics/Bitmap;"); | ||||
jstring name = env->NewStringUTF(path); | 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); | env->DeleteLocalRef(name); | ||||
if (!bmp) | |||||
if (!m_bmp) | |||||
{ | { | ||||
#if !LOL_BUILD_RELEASE | #if !LOL_BUILD_RELEASE | ||||
Log::Error("could not load %s\n", path); | Log::Error("could not load %s\n", path); | ||||
#endif | #endif | ||||
return false; | return false; | ||||
} | } | ||||
env->NewGlobalRef(bmp); | |||||
env->NewGlobalRef(m_bmp); | |||||
/* Get image dimensions */ | /* Get image dimensions */ | ||||
mid = env->GetMethodID(cls, "getWidth", "(Landroid/graphics/Bitmap;)I"); | 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"); | 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 */ | /* 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"); | 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++) | 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); | u = (u & 0xff00ff00) | ((u & 0xff0000) >> 16) | ((u & 0xff) << 16); | ||||
pixels[n] = u; | |||||
m_pixels[n] = u; | |||||
} | } | ||||
m_format = PixelFormat::RGBA_8; | m_format = PixelFormat::RGBA_8; | ||||
@@ -132,20 +132,20 @@ bool AndroidImageCodec::Close() | |||||
jclass cls = env->GetObjectClass(g_activity->clazz); | jclass cls = env->GetObjectClass(g_activity->clazz); | ||||
jmethodID mid; | jmethodID mid; | ||||
env->ReleaseIntArrayElements(array, pixels, 0); | |||||
env->DeleteGlobalRef(array); | |||||
env->ReleaseIntArrayElements(m_array, m_pixels, 0); | |||||
env->DeleteGlobalRef(m_array); | |||||
/* Free image */ | /* Free image */ | ||||
mid = env->GetMethodID(cls, "closeImage", "(Landroid/graphics/Bitmap;)V"); | 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; | return true; | ||||
} | } | ||||
uint8_t *AndroidImageCodec::GetData() const | uint8_t *AndroidImageCodec::GetData() const | ||||
{ | { | ||||
return (uint8_t *)pixels; | |||||
return (uint8_t *)m_pixels; | |||||
} | } | ||||
} /* namespace lol */ | } /* namespace lol */ | ||||
@@ -58,7 +58,7 @@ bool GdiPlusImageCodec::Load(Image *image, char const *path) | |||||
return false; | return false; | ||||
} | } | ||||
Array<String> pathlist = System::GetPathList(path); | |||||
array<String> pathlist = System::GetPathList(path); | |||||
Gdiplus::Bitmap *bitmap = nullptr; | Gdiplus::Bitmap *bitmap = nullptr; | ||||
for (auto fullpath : pathlist) | for (auto fullpath : pathlist) | ||||
{ | { | ||||
@@ -42,7 +42,7 @@ bool Imlib2ImageCodec::Load(Image *image, char const *path) | |||||
{ | { | ||||
Imlib_Image priv = nullptr; | Imlib_Image priv = nullptr; | ||||
Array<String> pathlist = System::GetPathList(path); | |||||
array<String> pathlist = System::GetPathList(path); | |||||
for (int i = 0; i < pathlist.Count(); i++) | for (int i = 0; i < pathlist.Count(); i++) | ||||
{ | { | ||||
priv = imlib_load_image(pathlist[i].C()); | priv = imlib_load_image(pathlist[i].C()); | ||||
@@ -38,7 +38,7 @@ public: | |||||
private: | private: | ||||
static String ReadScreen(char const *name); | 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) | DECLARE_IMAGE_CODEC(OricImageCodec, 100) | ||||
@@ -116,7 +116,7 @@ bool OricImageCodec::Save(Image *image, char const *path) | |||||
|| toupper(path[len - 1]) != 'P') | || toupper(path[len - 1]) != 'P') | ||||
return false; | return false; | ||||
Array<uint8_t> result; | |||||
array<uint8_t> result; | |||||
result << 0x16 << 0x16 << 0x16 << 0x16 << 0x24; | result << 0x16 << 0x16 << 0x16 << 0x16 << 0x24; | ||||
result << 0 << 0xff << 0x80 << 0 << 0xbf << 0x3f << 0xa0 << 0; | result << 0 << 0xff << 0x80 << 0 << 0xbf << 0x3f << 0xa0 << 0; | ||||
@@ -465,7 +465,7 @@ static uint8_t bestmove(ivec3 const *in, u8vec2 bgfg, | |||||
return bestcommand; | return bestcommand; | ||||
} | } | ||||
void OricImageCodec::WriteScreen(Image &image, Array<uint8_t> &result) | |||||
void OricImageCodec::WriteScreen(Image &image, array<uint8_t> &result) | |||||
{ | { | ||||
ivec2 size = image.GetSize(); | ivec2 size = image.GetSize(); | ||||
vec4 *pixels = image.Lock<PixelFormat::RGBA_F32>(); | vec4 *pixels = image.Lock<PixelFormat::RGBA_F32>(); | ||||
@@ -98,7 +98,7 @@ bool Ps3ImageCodec::Load(Image *image, char const *path) | |||||
CellPngDecSubHandle hsub; | CellPngDecSubHandle hsub; | ||||
CellPngDecOpnInfo open_info; | CellPngDecOpnInfo open_info; | ||||
Array<String> pathlist = System::GetPathList(path); | |||||
array<String> pathlist = System::GetPathList(path); | |||||
for (int i = 0; i < pathlist.Count(); ++i) | for (int i = 0; i < pathlist.Count(); ++i) | ||||
{ | { | ||||
String name = String(SYS_APP_HOME) + '/' + pathlist[i]; | String name = String(SYS_APP_HOME) + '/' + pathlist[i]; | ||||
@@ -52,7 +52,7 @@ bool SdlImageCodec::Load(Image *image, char const *path) | |||||
{ | { | ||||
SDL_Surface *surface = nullptr; | SDL_Surface *surface = nullptr; | ||||
Array<String> pathlist = System::GetPathList(path); | |||||
array<String> pathlist = System::GetPathList(path); | |||||
for (int i = 0; i < pathlist.Count(); i++) | for (int i = 0; i < pathlist.Count(); i++) | ||||
{ | { | ||||
surface = IMG_Load(pathlist[i].C()); | surface = IMG_Load(pathlist[i].C()); | ||||
@@ -31,7 +31,7 @@ public: | |||||
virtual bool Load(Image *image, char const *path); | virtual bool Load(Image *image, char const *path); | ||||
virtual bool Save(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; | bool result = m_tiles.Count() > 0; | ||||
tiles += m_tiles; | tiles += m_tiles; | ||||
@@ -41,7 +41,7 @@ public: | |||||
private: | private: | ||||
//<Pos, Size> | //<Pos, Size> | ||||
Array<ivec2, ivec2> m_tiles; | |||||
array<ivec2, ivec2> m_tiles; | |||||
}; | }; | ||||
DECLARE_IMAGE_CODEC(ZedImageCodec, 0) | DECLARE_IMAGE_CODEC(ZedImageCodec, 0) | ||||
@@ -60,14 +60,14 @@ bool ZedImageCodec::Load(Image *image, char const *path) | |||||
{ | { | ||||
CompactSecondary(int32_t size) { m_size = size; } | CompactSecondary(int32_t size) { m_size = size; } | ||||
int32_t m_size; | int32_t m_size; | ||||
Array<int32_t> m_tiles; | |||||
array<int32_t> m_tiles; | |||||
}; | }; | ||||
struct CompactMain | struct CompactMain | ||||
{ | { | ||||
CompactMain(int32_t size) { m_size = size; m_count = 0; } | CompactMain(int32_t size) { m_size = size; m_count = 0; } | ||||
int32_t m_size; | int32_t m_size; | ||||
int32_t m_count; | int32_t m_count; | ||||
Array<CompactSecondary> m_secondary; | |||||
array<CompactSecondary> m_secondary; | |||||
}; | }; | ||||
struct Compacter2d | struct Compacter2d | ||||
{ | { | ||||
@@ -89,7 +89,7 @@ bool ZedImageCodec::Load(Image *image, char const *path) | |||||
m_primary.Last().m_secondary << CompactSecondary(start + interval * j); | 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++) | 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; | File file; | ||||
@@ -125,7 +125,7 @@ bool ZedImageCodec::Load(Image *image, char const *path) | |||||
//Put file in memory | //Put file in memory | ||||
long file_size = file.GetSize(); | long file_size = file.GetSize(); | ||||
Array<uint8_t> file_buffer; | |||||
array<uint8_t> file_buffer; | |||||
file_buffer.Resize(file_size); | file_buffer.Resize(file_size); | ||||
file.Read((uint8_t*)&file_buffer[0], file_size); | file.Read((uint8_t*)&file_buffer[0], file_size); | ||||
file.Close(); | file.Close(); | ||||
@@ -136,7 +136,7 @@ bool ZedImageCodec::Load(Image *image, char const *path) | |||||
file_count = *((uint16_t*)(&file_buffer[file_pos])); | file_count = *((uint16_t*)(&file_buffer[file_pos])); | ||||
file_pos += sizeof(uint16_t); | file_pos += sizeof(uint16_t); | ||||
Array<long int> file_offset; | |||||
array<long int> file_offset; | |||||
file_offset.Resize(file_count); | file_offset.Resize(file_count); | ||||
//Get all the file offsets | //Get all the file offsets | ||||
for (int i = 0; i < file_count; i++) | 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); | compacter.StepSetup(8, 8, 10); | ||||
uint32_t total_size = 0; | uint32_t total_size = 0; | ||||
Array<uint8_t> file_convert; | |||||
array<uint8_t> file_convert; | |||||
file_convert.Reserve(file_size); | file_convert.Reserve(file_size); | ||||
Array<ivec2> available_sizes; | |||||
array<ivec2> available_sizes; | |||||
for (int i = 0; i < file_count; i++) | for (int i = 0; i < file_count; i++) | ||||
{ | { | ||||
file_pos = file_offset[i]; | file_pos = file_offset[i]; | ||||
@@ -176,10 +176,10 @@ bool ZedImageCodec::Load(Image *image, char const *path) | |||||
/* Seems useless in the end | /* Seems useless in the end | ||||
//Retrieve Header & footer | //Retrieve Header & footer | ||||
Array<uint8_t> header_data; | |||||
array<uint8_t> header_data; | |||||
header_data.Resize(header_length); | header_data.Resize(header_length); | ||||
memcpy(&header_data[0], &file_buffer[file_offset[i]], 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); | 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) | if (footer_length > 0) | ||||
{ | { | ||||
@@ -47,7 +47,7 @@ bool ZedPaletteImageCodec::Load(Image *image, char const *path) | |||||
//Put file in memory | //Put file in memory | ||||
long file_size = file.GetSize(); | long file_size = file.GetSize(); | ||||
Array<uint8_t> file_buffer; | |||||
array<uint8_t> file_buffer; | |||||
file_buffer.Resize(file_size); | file_buffer.Resize(file_size); | ||||
file.Read((uint8_t*)&file_buffer[0], file_size); | file.Read((uint8_t*)&file_buffer[0], file_size); | ||||
file.Close(); | file.Close(); | ||||
@@ -21,8 +21,8 @@ | |||||
namespace lol | 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); | static Image NonSepConv(Image &src, array2d<float> const &kernel); | ||||
Image Image::Convolution(array2d<float> const &kernel) | Image Image::Convolution(array2d<float> const &kernel) | ||||
@@ -67,7 +67,7 @@ Image Image::Convolution(array2d<float> const &kernel) | |||||
if (separable) | if (separable) | ||||
{ | { | ||||
/* Matrix rank is 1! Separate the filter. */ | /* 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])); | float norm = 1.0f / lol::sqrt(lol::abs(kernel[bestx][besty])); | ||||
for (int dx = 0; dx < ksize.x; dx++) | 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> | 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; | typedef typename PixelType<FORMAT>::type pixel_t; | ||||
@@ -254,8 +254,8 @@ static Image SepConv(Image &src, Array<float> const &hvec, | |||||
return dst; | 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_x = src.GetWrapX() == WrapMode::Repeat; | ||||
bool const wrap_y = src.GetWrapY() == WrapMode::Repeat; | bool const wrap_y = src.GetWrapY() == WrapMode::Repeat; | ||||
@@ -30,7 +30,7 @@ namespace lol | |||||
* The bug was reported to Microsoft and fixed by them, but the fix | * The bug was reported to Microsoft and fixed by them, but the fix | ||||
* is not yet available. | * is not yet available. | ||||
* https://connect.microsoft.com/VisualStudio/feedback/details/730878/ */ | * https://connect.microsoft.com/VisualStudio/feedback/details/730878/ */ | ||||
static bool RegisterAllCodecs(Array<ImageCodec *> &codeclist) | |||||
static bool RegisterAllCodecs(array<ImageCodec *> &codeclist) | |||||
{ | { | ||||
#if defined __ANDROID__ | #if defined __ANDROID__ | ||||
REGISTER_IMAGE_CODEC(AndroidImageCodec) | REGISTER_IMAGE_CODEC(AndroidImageCodec) | ||||
@@ -73,7 +73,7 @@ public: | |||||
} | } | ||||
private: | private: | ||||
Array<ImageCodec *> m_codecs; | |||||
array<ImageCodec *> m_codecs; | |||||
map<String, Image *> m_images; | map<String, Image *> m_images; | ||||
} | } | ||||
g_image_loader; | 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()); | 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 */ | /* TODO: re-implement this */ | ||||
//return m_data->m_codecdata->RetrieveTiles(tiles); | //return m_data->m_codecdata->RetrieveTiles(tiles); | ||||
@@ -188,7 +188,7 @@ array2d<float> Image::NormalizeKernel(array2d<float> const &kernel) | |||||
{ | { | ||||
ivec2 size = kernel.GetSize(); | ivec2 size = kernel.GetSize(); | ||||
Array<Dot> tmp; | |||||
array<Dot> tmp; | |||||
tmp.Resize(size.x * size.y); | tmp.Resize(size.x * size.y); | ||||
for (int y = 0; y < size.y; y++) | for (int y = 0; y < size.y; y++) | ||||
@@ -147,7 +147,7 @@ static Image ResizeBresenham(Image &image, ivec2 size) | |||||
vec4 const *srcp = image.Lock<PixelFormat::RGBA_F32>(); | vec4 const *srcp = image.Lock<PixelFormat::RGBA_F32>(); | ||||
vec4 *dstp = dst.Lock<PixelFormat::RGBA_F32>(); | vec4 *dstp = dst.Lock<PixelFormat::RGBA_F32>(); | ||||
Array<vec4> aline, line; | |||||
array<vec4> aline, line; | |||||
aline.Resize(size.x); | aline.Resize(size.x); | ||||
line.Resize(size.x); | line.Resize(size.x); | ||||
memset(line.Data(), 0, line.Bytes()); | memset(line.Data(), 0, line.Bytes()); | ||||
@@ -218,7 +218,7 @@ float AxisBinding::RetrieveCurrentValue() | |||||
/////////////////////////////////////////////////////////////////////////////// | /////////////////////////////////////////////////////////////////////////////// | ||||
// Controller | // Controller | ||||
Array<Controller*> Controller::controllers; | |||||
array<Controller*> Controller::controllers; | |||||
Controller::Controller(char const* name, int nb_keys, int nb_axis) | Controller::Controller(char const* name, int nb_keys, int nb_axis) | ||||
{ | { | ||||
@@ -290,9 +290,9 @@ void Controller::Deactivate() | |||||
m_activate_nextframe = false; | 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) | for (int i = 0; i < controllers.Count(); ++i) | ||||
{ | { | ||||
@@ -60,7 +60,7 @@ protected: | |||||
} | } | ||||
/** m1 is the InputDevice, m2 is the key index on the InputDevice */ | /** 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 */ | /** Value at the previous frame */ | ||||
bool m_current; | bool m_current; | ||||
/** Value at the current frame */ | /** Value at the current frame */ | ||||
@@ -112,9 +112,9 @@ protected: | |||||
float RetrieveCurrentValue(); | 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 */ | /** 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. */ | /** 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_current; | ||||
float m_previous; | float m_previous; | ||||
@@ -135,7 +135,7 @@ public: | |||||
/** Deactivate the controller on next frame */ | /** Deactivate the controller on next frame */ | ||||
void Deactivate(); | void Deactivate(); | ||||
/** Deactivate every active controller on next frame and return an array of deactivated (previously active) controllers */ | /** 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]; } | KeyBinding& GetKey(int index) { return m_keys[index]; } | ||||
AxisBinding& GetAxis(int index) { return m_axis[index]; } | AxisBinding& GetAxis(int index) { return m_axis[index]; } | ||||
@@ -143,11 +143,11 @@ public: | |||||
static Controller* Get(char const* name); | static Controller* Get(char const* name); | ||||
protected: | protected: | ||||
Array<KeyBinding> m_keys; | |||||
Array<AxisBinding> m_axis; | |||||
array<KeyBinding> m_keys; | |||||
array<AxisBinding> m_axis; | |||||
private: | private: | ||||
static Array<Controller*> controllers; | |||||
static array<Controller*> controllers; | |||||
String m_name; | String m_name; | ||||
bool m_activate_nextframe; | bool m_activate_nextframe; | ||||
bool m_deactivate_nextframe; | bool m_deactivate_nextframe; | ||||
@@ -19,12 +19,12 @@ | |||||
namespace lol | namespace lol | ||||
{ | { | ||||
Array<InputDevice*> InputDevice::devices; | |||||
array<InputDevice*> InputDevice::devices; | |||||
bool InputDevice::m_capturemouse; | 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) | for (int i = 0; i < devices.Count(); ++i) | ||||
{ | { | ||||
result.Push(devices[i]->m_name); | result.Push(devices[i]->m_name); | ||||
@@ -48,14 +48,14 @@ public: | |||||
float GetAxisSensitivity(int index) const { return m_axis[index].m2; } | float GetAxisSensitivity(int index) const { return m_axis[index].m2; } | ||||
/** Gets a list of the name of all available keys in this device */ | /** 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 */ | /** 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 */ | /** 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 */ | /** 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 */ | /** Gets an input device by its name */ | ||||
static InputDevice* Get(const char* name) { return GetDevice(name); } | static InputDevice* Get(const char* name) { return GetDevice(name); } | ||||
/** Sets whether the mouse cursor should be captured. */ | /** Sets whether the mouse cursor should be captured. */ | ||||
@@ -66,16 +66,16 @@ protected: | |||||
String m_name; | 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) */ | /** key states (pressed/released) */ | ||||
Array<bool> m_keys; | |||||
array<bool> m_keys; | |||||
/** axis states (value and sensitivity) */ | /** axis states (value and sensitivity) */ | ||||
Array<float, float> m_axis; | |||||
array<float, float> m_axis; | |||||
/** cursor position */ | /** cursor position */ | ||||
Array<vec2, ivec2> m_cursors; | |||||
array<vec2, ivec2> m_cursors; | |||||
static bool m_capturemouse; | static bool m_capturemouse; | ||||
@@ -97,10 +97,10 @@ protected: | |||||
} | } | ||||
private: | private: | ||||
static Array<InputDevice*> devices; | |||||
static array<InputDevice*> devices; | |||||
template <typename T> | 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) | for (int i = 0; i < array.Count(); ++i) | ||||
{ | { | ||||
@@ -29,9 +29,9 @@ namespace Debug { | |||||
//-- | //-- | ||||
template<typename TREE, typename TE, typename TBB> | 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); | boxes.Push(tree->GetAABB(), Color::white); | ||||
leaves.Push(0, boxes.Last().m1); | leaves.Push(0, boxes.Last().m1); | ||||
@@ -70,9 +70,9 @@ void DrawInner(TREE *tree, Array<TBB, vec4> &boxes, | |||||
template <typename TE> | template <typename TE> | ||||
void Draw(Quadtree<TE>* tree, vec4 color) | 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); | 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> | template <typename TE> | ||||
void Draw(Octree<TE>* tree, vec4 color) | 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); | DrawInner<Octree<TE>, TE, box3>(tree, boxes, elements, leaves, 8, color); | ||||
@@ -143,7 +143,7 @@ class AABBTree | |||||
//Children pos in the list | //Children pos in the list | ||||
int m_children[child_nb]; | int m_children[child_nb]; | ||||
//Element list | //Element list | ||||
Array<int> m_elements; | |||||
array<int> m_elements; | |||||
NodeLeaf(int parent) | NodeLeaf(int parent) | ||||
{ | { | ||||
@@ -156,7 +156,7 @@ class AABBTree | |||||
struct TreeElement | struct TreeElement | ||||
{ | { | ||||
TE* m_element; | TE* m_element; | ||||
Array<int> m_leaves; | |||||
array<int> m_leaves; | |||||
inline bool operator==(const TE*& element) { return m_element == element; } | inline bool operator==(const TE*& element) { return m_element == element; } | ||||
}; | }; | ||||
@@ -235,7 +235,7 @@ private: | |||||
TreeElement new_element; | TreeElement new_element; | ||||
new_element.m_element = element; | new_element.m_element = element; | ||||
new_element.m_leaves = Array<int>(); | |||||
new_element.m_leaves = array<int>(); | |||||
m_elements << new_element; | m_elements << new_element; | ||||
return m_elements.Count() - 1; | 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; | bool result = false; | ||||
if (TestAABBVsAABB(leaf_bb, test_bb)) | if (TestAABBVsAABB(leaf_bb, test_bb)) | ||||
@@ -299,7 +299,7 @@ private: | |||||
depth < m_max_depth) | depth < m_max_depth) | ||||
{ | { | ||||
//Extract elements | //Extract elements | ||||
Array<int> elements = m_tree[leaf].m_elements; | |||||
array<int> elements = m_tree[leaf].m_elements; | |||||
elements.PushUnique(AddElement(element)); | elements.PushUnique(AddElement(element)); | ||||
m_tree[leaf].m_elements.Empty(); | m_tree[leaf].m_elements.Empty(); | ||||
//Add children | //Add children | ||||
@@ -327,7 +327,7 @@ private: | |||||
public: | public: | ||||
void RegisterElement(TE* element) { RegisterElement(element, 0, GetAABB(), 0); } | void RegisterElement(TE* element) { RegisterElement(element, 0, GetAABB(), 0); } | ||||
void UnregisterElement(TE* element) { RemoveElement(element); } | 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() | void Clear() | ||||
{ | { | ||||
m_tree.Empty(); | m_tree.Empty(); | ||||
@@ -353,20 +353,20 @@ public: | |||||
void SetMaxDepth(int max_depth) { m_max_depth = max_depth; } | void SetMaxDepth(int max_depth) { m_max_depth = max_depth; } | ||||
void SetMaxElement(int max_element) { m_max_element = max_element; } | void SetMaxElement(int max_element) { m_max_element = max_element; } | ||||
Array<NodeLeaf> const & GetTree() const | |||||
array<NodeLeaf> const & GetTree() const | |||||
{ | { | ||||
return m_tree; | return m_tree; | ||||
} | } | ||||
Array<TreeElement> const & GetElements() const | |||||
array<TreeElement> const & GetElements() const | |||||
{ | { | ||||
return m_elements; | return m_elements; | ||||
} | } | ||||
protected: | 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 | TV m_size; //Main tree size | ||||
int m_max_depth; //Maximum depth possible | int m_max_depth; //Maximum depth possible | ||||
int m_max_element; //Maximum element per leaf | int m_max_element; //Maximum element per leaf | ||||
@@ -278,7 +278,7 @@ public: | |||||
private: | private: | ||||
//Portals associated with this room. | //Portals associated with this room. | ||||
Array<PortalDoor<TE>*> m_doors; | |||||
array<PortalDoor<TE>*> m_doors; | |||||
TE* m_element; | TE* m_element; | ||||
}; | }; | ||||
@@ -298,9 +298,9 @@ public: | |||||
} | } | ||||
//Visible room getter | //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); | GetVisibleRooms(see_through, start_room, visible_rooms, ignore_doors); | ||||
#if LOL_BUILD_DEBUG | #if LOL_BUILD_DEBUG | ||||
for (auto room : visible_rooms) | for (auto room : visible_rooms) | ||||
@@ -322,7 +322,7 @@ public: | |||||
#endif //LOL_BUILD_DEBUG | #endif //LOL_BUILD_DEBUG | ||||
} | } | ||||
private: | 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) | for (auto door : start_room->m_doors) | ||||
{ | { | ||||
@@ -381,8 +381,8 @@ public: | |||||
private: | private: | ||||
//Portals associated with this room. | //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 */ | } /* namespace lol */ | ||||
@@ -18,7 +18,7 @@ namespace lol | |||||
{ | { | ||||
template<typename T, typename ARRAY> | template<typename T, typename ARRAY> | ||||
void ArrayBase<T, ARRAY>::Sort(int sort) | |||||
void array_base<T, ARRAY>::Sort(int sort) | |||||
{ | { | ||||
int s = 0; | int s = 0; | ||||
// Classic bubble | // Classic bubble | ||||
@@ -44,7 +44,7 @@ void ArrayBase<T, ARRAY>::Sort(int sort) | |||||
} | } | ||||
template<typename T, typename ARRAY> | 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] = | int m[3] = | ||||
{ | { | ||||
@@ -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__ | #if !defined __LOL_BASE_ARRAY_H__ | ||||
@@ -41,16 +41,16 @@ namespace lol | |||||
* m_count are allocated. The rest is uninitialised memory. | * 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: | 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_data(0), | ||||
m_count(0), | m_count(0), | ||||
m_reserved(0) | m_reserved(0) | ||||
@@ -60,24 +60,24 @@ public: | |||||
Push(elem); | Push(elem); | ||||
} | } | ||||
inline ~ArrayBase() | |||||
inline ~array_base() | |||||
{ | { | ||||
for (int i = 0; i < m_count; i++) | for (int i = 0; i < m_count; i++) | ||||
m_data[i].~Element(); | |||||
m_data[i].~element_t(); | |||||
delete[] reinterpret_cast<uint8_t *>(m_data); | 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 | /* Reserve the exact number of values instead of what the other | ||||
* array had reserved. Just a method for not wasting too much. */ | * array had reserved. Just a method for not wasting too much. */ | ||||
Reserve(that.m_count); | Reserve(that.m_count); | ||||
for (int i = 0; i < that.m_count; i++) | 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; | m_count = that.m_count; | ||||
} | } | ||||
ArrayBase& operator=(ArrayBase const& that) | |||||
array_base& operator=(array_base const& that) | |||||
{ | { | ||||
if ((uintptr_t)this != (uintptr_t)&that) | if ((uintptr_t)this != (uintptr_t)&that) | ||||
{ | { | ||||
@@ -91,9 +91,9 @@ public: | |||||
* remaining elements. */ | * remaining elements. */ | ||||
Reserve(that.m_count); | Reserve(that.m_count); | ||||
for (int i = 0; i < m_count && i < that.m_count; i++) | 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++) | 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 | else | ||||
{ | { | ||||
@@ -102,23 +102,23 @@ public: | |||||
* that we do not have, and finally destroy the remaining | * that we do not have, and finally destroy the remaining | ||||
* elements. */ | * elements. */ | ||||
for (int i = 0; i < m_count && i < that.m_count; i++) | 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++) | 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++) | for (int i = that.m_count; i < m_count; i++) | ||||
m_data[i].~Element(); | |||||
m_data[i].~element_t(); | |||||
} | } | ||||
m_count = that.m_count; | m_count = that.m_count; | ||||
} | } | ||||
return *this; | return *this; | ||||
} | } | ||||
ArrayBase& operator+=(ArrayBase const &that) | |||||
array_base& operator+=(array_base const &that) | |||||
{ | { | ||||
int todo = that.m_count; | int todo = that.m_count; | ||||
Reserve(m_count + that.m_count); | Reserve(m_count + that.m_count); | ||||
for (int i = 0; i < todo; i++) | 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; | m_count += todo; | ||||
return *this; | return *this; | ||||
} | } | ||||
@@ -132,7 +132,7 @@ public: | |||||
return ret; | 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 | /* Allow array[0] even if size is zero so that people can | ||||
* always use &array[0] to get a pointer to the data. */ | * always use &array[0] to get a pointer to the data. */ | ||||
@@ -141,14 +141,14 @@ public: | |||||
return m_data[n]; | return m_data[n]; | ||||
} | } | ||||
inline Element const& operator[](int n) const | |||||
inline element_t const& operator[](int n) const | |||||
{ | { | ||||
ASSERT(n >= 0); | ASSERT(n >= 0); | ||||
ASSERT(n < m_count || (!n && !m_count)); | ASSERT(n < m_count || (!n && !m_count)); | ||||
return m_data[n]; | 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 | /* Allow array[0] even if size is zero so that people can | ||||
* always use &array[0] to get a pointer to the data. */ | * always use &array[0] to get a pointer to the data. */ | ||||
@@ -157,14 +157,14 @@ public: | |||||
return m_data[n]; | 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 >= 0); | ||||
ASSERT(n < m_count || (!n && !m_count)); | ASSERT(n < m_count || (!n && !m_count)); | ||||
return m_data[n]; | 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 | /* Allow array[0] even if size is zero so that people can | ||||
* always use &array[0] to get a pointer to the data. */ | * always use &array[0] to get a pointer to the data. */ | ||||
@@ -173,52 +173,52 @@ public: | |||||
return m_data[n]; | 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 >= 0); | ||||
ASSERT(n < m_count || (!n && !m_count)); | ASSERT(n < m_count || (!n && !m_count)); | ||||
return m_data[n]; | return m_data[n]; | ||||
} | } | ||||
inline Element& Last() | |||||
inline element_t& Last() | |||||
{ | { | ||||
ASSERT(m_count > 0); | ASSERT(m_count > 0); | ||||
return m_data[m_count - 1]; | return m_data[m_count - 1]; | ||||
} | } | ||||
inline Element *Data() | |||||
inline element_t *Data() | |||||
{ | { | ||||
return m_data; | return m_data; | ||||
} | } | ||||
inline Element const *Data() const | |||||
inline element_t const *Data() const | |||||
{ | { | ||||
return m_data; | return m_data; | ||||
} | } | ||||
inline Element const& Last() const | |||||
inline element_t const& Last() const | |||||
{ | { | ||||
ASSERT(m_count > 0); | ASSERT(m_count > 0); | ||||
return m_data[m_count - 1]; | return m_data[m_count - 1]; | ||||
} | } | ||||
inline ArrayBase& operator<<(T const &x) | |||||
inline array_base& operator<<(T const &x) | |||||
{ | { | ||||
if (m_count >= m_reserved) | if (m_count >= m_reserved) | ||||
{ | { | ||||
T tmp = x; | T tmp = x; | ||||
Grow(); | Grow(); | ||||
new (&m_data[m_count]) Element(tmp); | |||||
new (&m_data[m_count]) element_t(tmp); | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
new (&m_data[m_count]) Element(x); | |||||
new (&m_data[m_count]) element_t(x); | |||||
} | } | ||||
++m_count; | ++m_count; | ||||
return *this; | return *this; | ||||
} | } | ||||
inline ArrayBase& operator>>(T const &x) | |||||
inline array_base& operator>>(T const &x) | |||||
{ | { | ||||
RemoveItem(x); | RemoveItem(x); | ||||
return *this; | return *this; | ||||
@@ -248,10 +248,10 @@ public: | |||||
for (int i = m_count; i > pos; --i) | 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; | ++m_count; | ||||
} | } | ||||
@@ -312,7 +312,7 @@ public: | |||||
inline T Pop() | inline T Pop() | ||||
{ | { | ||||
ASSERT(m_count > 0); | ASSERT(m_count > 0); | ||||
Element tmp = Last(); | |||||
element_t tmp = Last(); | |||||
Remove(m_count - 1, 1); | Remove(m_count - 1, 1); | ||||
return tmp; | return tmp; | ||||
} | } | ||||
@@ -339,7 +339,7 @@ public: | |||||
for (int i = pos; i + todelete < m_count; i++) | for (int i = pos; i + todelete < m_count; i++) | ||||
m_data[i] = m_data[i + todelete]; | m_data[i] = m_data[i + todelete]; | ||||
for (int i = m_count - todelete; i < m_count; i++) | for (int i = m_count - todelete; i < m_count; i++) | ||||
m_data[i].~Element(); | |||||
m_data[i].~element_t(); | |||||
m_count -= todelete; | m_count -= todelete; | ||||
} | } | ||||
@@ -355,23 +355,23 @@ public: | |||||
{ | { | ||||
if (pos + i < m_count - 1 - i) | if (pos + i < m_count - 1 - i) | ||||
m_data[pos + i] = m_data[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; | m_count -= todelete; | ||||
} | } | ||||
void Resize(int count, Element e = Element()) | |||||
void Resize(int count, element_t e = element_t()) | |||||
{ | { | ||||
ASSERT(count >= 0); | ASSERT(count >= 0); | ||||
Reserve(count); | Reserve(count); | ||||
/* Too many elements? Remove them. */ | /* Too many elements? Remove them. */ | ||||
for (int i = count; i < m_count; ++i) | for (int i = count; i < m_count; ++i) | ||||
m_data[i].~Element(); | |||||
m_data[i].~element_t(); | |||||
/* Not enough elements? Add some. */ | /* Not enough elements? Add some. */ | ||||
for (int i = m_count; i < count; ++i) | for (int i = m_count; i < count; ++i) | ||||
new(&m_data[i]) Element(e); | |||||
new(&m_data[i]) element_t(e); | |||||
m_count = count; | m_count = count; | ||||
} | } | ||||
@@ -390,13 +390,13 @@ public: | |||||
* information we could have. But until C++ gives us the proper | * information we could have. But until C++ gives us the proper | ||||
* tools to deal with it, we assume new uint8_t[] returns properly | * tools to deal with it, we assume new uint8_t[] returns properly | ||||
* aligned data. */ | * 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++) | 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); | delete[] reinterpret_cast<uint8_t *>(m_data); | ||||
m_data = tmp; | m_data = tmp; | ||||
@@ -410,7 +410,7 @@ public: | |||||
class ConstIterator | class ConstIterator | ||||
{ | { | ||||
public: | public: | ||||
ConstIterator(ArrayBase const *array, int pos) | |||||
ConstIterator(array_base const *array, int pos) | |||||
: m_pos(pos), | : m_pos(pos), | ||||
m_array(array) | m_array(array) | ||||
{ } | { } | ||||
@@ -420,7 +420,7 @@ public: | |||||
return m_pos != that.m_pos; | return m_pos != that.m_pos; | ||||
} | } | ||||
Element const & operator *() const | |||||
element_t const & operator *() const | |||||
{ | { | ||||
return (*m_array)[m_pos]; | return (*m_array)[m_pos]; | ||||
} | } | ||||
@@ -433,13 +433,13 @@ public: | |||||
private: | private: | ||||
int m_pos; | int m_pos; | ||||
ArrayBase const *m_array; | |||||
array_base const *m_array; | |||||
}; | }; | ||||
class Iterator | class Iterator | ||||
{ | { | ||||
public: | public: | ||||
Iterator(ArrayBase *array, int pos) | |||||
Iterator(array_base *array, int pos) | |||||
: m_pos(pos), | : m_pos(pos), | ||||
m_array(array) | m_array(array) | ||||
{ } | { } | ||||
@@ -449,7 +449,7 @@ public: | |||||
return m_pos != that.m_pos; | return m_pos != that.m_pos; | ||||
} | } | ||||
Element operator *() | |||||
element_t operator *() | |||||
{ | { | ||||
return (*m_array)[m_pos]; | return (*m_array)[m_pos]; | ||||
} | } | ||||
@@ -462,7 +462,7 @@ public: | |||||
private: | private: | ||||
int m_pos; | int m_pos; | ||||
ArrayBase *m_array; | |||||
array_base *m_array; | |||||
}; | }; | ||||
ConstIterator begin() const { return ConstIterator(this, 0); } | ConstIterator begin() const { return ConstIterator(this, 0); } | ||||
@@ -472,7 +472,7 @@ public: | |||||
public: | public: | ||||
inline int Count() const { return m_count; } | 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: | protected: | ||||
void Grow() | void Grow() | ||||
@@ -480,18 +480,18 @@ protected: | |||||
Reserve(m_count * 13 / 8 + 8); | Reserve(m_count * 13 / 8 + 8); | ||||
} | } | ||||
Element *m_data; | |||||
element_t *m_data; | |||||
int m_count, m_reserved; | int m_count, m_reserved; | ||||
}; | }; | ||||
/* | /* | ||||
* Element types | |||||
* element_t types | |||||
*/ | */ | ||||
template<typename T1, typename T2, typename T3 = void, typename T4 = void, | template<typename T1, typename T2, typename T3 = void, typename T4 = void, | ||||
typename T5 = void, typename T6 = void, typename T7 = void, | typename T5 = void, typename T6 = void, typename T7 = void, | ||||
typename T8 = void> | typename T8 = void> | ||||
class ArrayElement | |||||
class array_element | |||||
{ | { | ||||
public: | public: | ||||
T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; | 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, | template<typename T1, typename T2, typename T3, typename T4, typename T5, | ||||
typename T6, typename T7> | 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: | public: | ||||
T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; | 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, | template<typename T1, typename T2, typename T3, typename T4, typename T5, | ||||
typename T6> | typename T6> | ||||
class ArrayElement<T1, T2, T3, T4, T5, T6, void, void> | |||||
class array_element<T1, T2, T3, T4, T5, T6, void, void> | |||||
{ | { | ||||
public: | public: | ||||
T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; | T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; | ||||
}; | }; | ||||
template<typename T1, typename T2, typename T3, typename T4, typename T5> | 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: | public: | ||||
T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; | T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; | ||||
}; | }; | ||||
template<typename T1, typename T2, typename T3, typename T4> | 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: | public: | ||||
T1 m1; T2 m2; T3 m3; T4 m4; | T1 m1; T2 m2; T3 m3; T4 m4; | ||||
}; | }; | ||||
template<typename T1, typename T2, typename T3> | 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: | public: | ||||
T1 m1; T2 m2; T3 m3; | T1 m1; T2 m2; T3 m3; | ||||
}; | }; | ||||
template<typename T1, typename T2> | 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: | public: | ||||
T1 m1; T2 m2; | T1 m1; T2 m2; | ||||
}; | }; | ||||
/* | /* | ||||
* Array specialisations implementing specific setters | |||||
* array specialisations implementing specific setters | |||||
*/ | */ | ||||
template<typename T1, typename T2 = void, typename T3 = void, | template<typename T1, typename T2 = void, typename T3 = void, | ||||
typename T4 = void, typename T5 = void, typename T6 = void, | typename T4 = void, typename T5 = void, typename T6 = void, | ||||
typename T7 = void, typename T8 = 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 | #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 | #else | ||||
public: | 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 | #endif | ||||
public: | public: | ||||
@@ -602,24 +602,24 @@ public: | |||||
template<typename T1, typename T2, typename T3, typename T4, typename T5, | template<typename T1, typename T2, typename T3, typename T4, typename T5, | ||||
typename T6, typename T7> | 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 | #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 | #else | ||||
public: | 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 | #endif | ||||
public: | public: | ||||
@@ -655,24 +655,24 @@ public: | |||||
template<typename T1, typename T2, typename T3, typename T4, typename T5, | template<typename T1, typename T2, typename T3, typename T4, typename T5, | ||||
typename T6> | 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 | #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 | #else | ||||
public: | 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 | #endif | ||||
public: | public: | ||||
@@ -705,24 +705,24 @@ public: | |||||
}; | }; | ||||
template<typename T1, typename T2, typename T3, typename T4, typename T5> | 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 | #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 | #else | ||||
public: | 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 | #endif | ||||
public: | public: | ||||
@@ -753,24 +753,24 @@ public: | |||||
}; | }; | ||||
template<typename T1, typename T2, typename T3, typename T4> | 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 | #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 | #else | ||||
public: | 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 | #endif | ||||
public: | public: | ||||
@@ -797,24 +797,24 @@ public: | |||||
}; | }; | ||||
template<typename T1, typename T2, typename T3> | 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 | #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 | #else | ||||
public: | 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 | #endif | ||||
public: | public: | ||||
@@ -839,24 +839,24 @@ public: | |||||
}; | }; | ||||
template<typename T1, typename T2> | 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 | #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 | #else | ||||
public: | 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 | #endif | ||||
public: | public: | ||||
@@ -879,27 +879,33 @@ public: | |||||
}; | }; | ||||
template<typename T> | 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 | #if INHERIT_CONSTRUCTORS | ||||
using ArrayBase<T, | |||||
Array<T>>::ArrayBase; | |||||
using array_base<T, | |||||
array<T>>::array_base; | |||||
#else | #else | ||||
public: | 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 | #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 */ | } /* namespace lol */ | ||||
#endif // __LOL_BASE_ARRAY_H__ | #endif // __LOL_BASE_ARRAY_H__ | ||||
@@ -80,9 +80,9 @@ public: | |||||
return false; | return false; | ||||
} | } | ||||
Array<K> Keys() const | |||||
array<K> Keys() const | |||||
{ | { | ||||
Array<K> ret; | |||||
array<K> ret; | |||||
for (auto it : m_array) | for (auto it : m_array) | ||||
ret.Push(it.m2); | ret.Push(it.m2); | ||||
return ret; | return ret; | ||||
@@ -111,7 +111,7 @@ private: | |||||
return FindIndex(key, hashed); | return FindIndex(key, hashed); | ||||
} | } | ||||
Array<uint32_t, K, V> m_array; | |||||
array<uint32_t, K, V> m_array; | |||||
}; | }; | ||||
} /* namespace lol */ | } /* namespace lol */ | ||||
@@ -26,10 +26,10 @@ | |||||
namespace lol | namespace lol | ||||
{ | { | ||||
class String : protected Array<char> | |||||
class String : protected array<char> | |||||
{ | { | ||||
private: | private: | ||||
typedef Array<char> Super; | |||||
typedef array<char> Super; | |||||
public: | public: | ||||
inline String() | inline String() | ||||
@@ -113,10 +113,10 @@ public: | |||||
void SetUniform(ShaderUniform const &uni, mat4 const &m); | void SetUniform(ShaderUniform const &uni, mat4 const &m); | ||||
void SetUniform(ShaderUniform const &uni, TextureUniform tex, int index); | 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 Bind() const; | ||||
void Unbind() const; | void Unbind() const; | ||||
@@ -91,7 +91,7 @@ public: | |||||
template<typename T> | template<typename T> | ||||
void Unlock2D(array2d<T> const &); | void Unlock2D(array2d<T> const &); | ||||
bool RetrieveTiles(Array<ivec2, ivec2>& tiles) const; | |||||
bool RetrieveTiles(array<ivec2, ivec2>& tiles) const; | |||||
/* Image processing kernels */ | /* Image processing kernels */ | ||||
static array2d<float> BayerKernel(ivec2 size); | static array2d<float> BayerKernel(ivec2 size); | ||||
@@ -33,11 +33,11 @@ namespace lol | |||||
template<typename T1, typename T2 = void, typename T3 = void, | template<typename T1, typename T2 = void, typename T3 = void, | ||||
typename T4 = void, typename T5 = void, typename T6 = void, | typename T4 = void, typename T5 = void, typename T6 = void, | ||||
typename T7 = void, typename T8 = 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: | 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() | inline array2d() | ||||
: m_size(0, 0) | : m_size(0, 0) | ||||
@@ -45,14 +45,14 @@ public: | |||||
} | } | ||||
inline array2d(std::initializer_list< | 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, | : m_size(list.size() ? (int)(*list.begin()).size() : 0, | ||||
(int)list.size()) | (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 l : list) | ||||
for (auto elem : l) | for (auto elem : l) | ||||
Super::Push(elem); | |||||
super::Push(elem); | |||||
} | } | ||||
inline array2d(int w, int h) | inline array2d(int w, int h) | ||||
@@ -66,7 +66,7 @@ public: | |||||
} | } | ||||
/* Access elements directly using an ivec2 index */ | /* 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.x >= 0); | ||||
ASSERT(pos.y >= 0); | ASSERT(pos.y >= 0); | ||||
@@ -80,7 +80,7 @@ public: | |||||
return this->m_data[n]; | return this->m_data[n]; | ||||
} | } | ||||
inline Element &operator [](ivec2 pos) | |||||
inline element_t &operator [](ivec2 pos) | |||||
{ | { | ||||
ASSERT(pos.x >= 0); | ASSERT(pos.x >= 0); | ||||
ASSERT(pos.y >= 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 >= 0); | ||||
ASSERT(j < m_array.m_size.y); | 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 >= 0); | ||||
ASSERT(j < m_array.m_size.y); | ASSERT(j < m_array.m_size.y); | ||||
@@ -153,7 +153,7 @@ public: | |||||
/* Resize the array. | /* Resize the array. | ||||
* FIXME: data gets scrambled; should we care? */ | * 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); | this->Resize(size.x * size.y, e); | ||||
m_size = size; | m_size = size; | ||||
@@ -165,10 +165,10 @@ public: | |||||
} | } | ||||
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: | private: | ||||
ivec2 m_size; | ivec2 m_size; | ||||
@@ -33,11 +33,11 @@ namespace lol | |||||
template<typename T1, typename T2 = void, typename T3 = void, | template<typename T1, typename T2 = void, typename T3 = void, | ||||
typename T4 = void, typename T5 = void, typename T6 = void, | typename T4 = void, typename T5 = void, typename T6 = void, | ||||
typename T7 = void, typename T8 = 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: | 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() | inline array3d() | ||||
: m_size(0, 0, 0) | : m_size(0, 0, 0) | ||||
@@ -46,17 +46,17 @@ public: | |||||
inline array3d(std::initializer_list< | inline array3d(std::initializer_list< | ||||
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() ? | : m_size(list.size() && (*list.begin()).size() ? | ||||
(int)(*(*list.begin()).begin()).size() : 0, | (int)(*(*list.begin()).begin()).size() : 0, | ||||
list.size() ? (int)(*list.begin()).size() : 0, | list.size() ? (int)(*list.begin()).size() : 0, | ||||
(int)list.size()) | (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 ll : list) | ||||
for (auto l : ll) | for (auto l : ll) | ||||
for (auto elem : l) | for (auto elem : l) | ||||
Super::Push(elem); | |||||
super::Push(elem); | |||||
} | } | ||||
inline array3d(int w, int h, int d) | inline array3d(int w, int h, int d) | ||||
@@ -70,7 +70,7 @@ public: | |||||
} | } | ||||
/* Access elements directly using an ivec3 index */ | /* 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.x >= 0); | ||||
ASSERT(pos.y >= 0); | ASSERT(pos.y >= 0); | ||||
@@ -86,7 +86,7 @@ public: | |||||
return this->m_data[n]; | return this->m_data[n]; | ||||
} | } | ||||
inline Element &operator [](ivec3 pos) | |||||
inline element_t &operator [](ivec3 pos) | |||||
{ | { | ||||
ASSERT(pos.x >= 0); | ASSERT(pos.x >= 0); | ||||
ASSERT(pos.y >= 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 >= 0); | ||||
ASSERT(k < m_array.m_size.z); | 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 >= 0); | ||||
ASSERT(k < m_array.m_size.z); | ASSERT(k < m_array.m_size.z); | ||||
@@ -203,7 +203,7 @@ public: | |||||
/* Resize the array. | /* Resize the array. | ||||
* FIXME: data gets scrambled; should we care? */ | * 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); | this->Resize(size.x * size.y * size.z, e); | ||||
m_size = size; | m_size = size; | ||||
@@ -215,10 +215,10 @@ public: | |||||
} | } | ||||
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: | private: | ||||
ivec3 m_size; | ivec3 m_size; | ||||
@@ -72,11 +72,11 @@ public: | |||||
void Close(); | void Close(); | ||||
private: | private: | ||||
bool GetContent(Array<String>* files, Array<Directory>* directories); | |||||
bool GetContent(array<String>* files, array<Directory>* directories); | |||||
public: | 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(); | String GetName(); | ||||
static String GetCurrent(); | static String GetCurrent(); | ||||
@@ -52,7 +52,7 @@ extern void Init(int argc, char *argv[], | |||||
String const &sourcesubdir = LOL_CONFIG_SOURCESUBDIR); | String const &sourcesubdir = LOL_CONFIG_SOURCESUBDIR); | ||||
extern void AddDataDir(String const &dir); | extern void AddDataDir(String const &dir); | ||||
extern Array<String> GetPathList(String const &file); | |||||
extern array<String> GetPathList(String const &file); | |||||
} /* namespace System */ | } /* namespace System */ | ||||
@@ -103,7 +103,7 @@ protected: | |||||
bool AddWork(ThreadJob* job); | bool AddWork(ThreadJob* job); | ||||
//Fetch Results | //Fetch Results | ||||
bool FetchResult(Array<ThreadJob*>& results); | |||||
bool FetchResult(array<ThreadJob*>& results); | |||||
//Base thread work function | //Base thread work function | ||||
static void *BaseThreadWork(void* data); | static void *BaseThreadWork(void* data); | ||||
virtual void TickGame(float seconds); | virtual void TickGame(float seconds); | ||||
@@ -112,11 +112,11 @@ protected: | |||||
/* Worker threads */ | /* Worker threads */ | ||||
int m_thread_count; | int m_thread_count; | ||||
Array<Thread*> m_threads; | |||||
array<Thread*> m_threads; | |||||
Queue<ThreadStatus> m_spawnqueue, m_donequeue; | Queue<ThreadStatus> m_spawnqueue, m_donequeue; | ||||
Queue<ThreadJob*> m_jobqueue; | Queue<ThreadJob*> m_jobqueue; | ||||
Queue<ThreadJob*> m_resultqueue; | 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 | //Generic class for thread manager, executes work and store results, for you to use | ||||
@@ -130,7 +130,7 @@ public: | |||||
//Work stuff | //Work stuff | ||||
bool AddJob(ThreadJob* job) { return AddWork(job); } | bool AddJob(ThreadJob* job) { return AddWork(job); } | ||||
bool GetWorkResult(Array<ThreadJob*>& results) | |||||
bool GetWorkResult(array<ThreadJob*>& results) | |||||
{ | { | ||||
results += m_job_result; | results += m_job_result; | ||||
m_job_result.Empty(); | m_job_result.Empty(); | ||||
@@ -140,7 +140,7 @@ public: | |||||
protected: | protected: | ||||
virtual void TreatResult(ThreadJob* result) { m_job_result << result; } | virtual void TreatResult(ThreadJob* result) { m_job_result << result; } | ||||
Array<ThreadJob*> m_job_result; | |||||
array<ThreadJob*> m_job_result; | |||||
}; | }; | ||||
#endif | #endif | ||||
@@ -37,7 +37,7 @@ public: | |||||
void Render(); | void Render(); | ||||
public: | public: | ||||
Array<class SubMesh *> m_submeshes; | |||||
array<class SubMesh *> m_submeshes; | |||||
}; | }; | ||||
/* | /* | ||||
@@ -68,10 +68,10 @@ protected: | |||||
MeshPrimitive m_mesh_prim; | MeshPrimitive m_mesh_prim; | ||||
Shader *m_shader; | Shader *m_shader; | ||||
VertexDeclaration* m_vdecl; | VertexDeclaration* m_vdecl; | ||||
Array<VertexBuffer *> m_vbos; | |||||
array<VertexBuffer *> m_vbos; | |||||
IndexBuffer *m_ibo; | IndexBuffer *m_ibo; | ||||
Array<String, Texture*> m_textures; | |||||
array<String, Texture*> m_textures; | |||||
}; | }; | ||||
} /* namespace lol */ | } /* namespace lol */ | ||||
@@ -79,7 +79,7 @@ bool MessageService::Send(MessageBucket id, const char* message) | |||||
{ | { | ||||
ASSERT(0 <= id && (int)id < g_messageservice->m_bucket.Count()); | ASSERT(0 <= id && (int)id < g_messageservice->m_bucket.Count()); | ||||
MessageService& g = *g_messageservice; | MessageService& g = *g_messageservice; | ||||
Array<MessageList>& bucket = g.m_bucket[id]; | |||||
array<MessageList>& bucket = g.m_bucket[id]; | |||||
bucket << MessageList(time(nullptr), String(message)); | bucket << MessageList(time(nullptr), String(message)); | ||||
return true; | 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()); | ASSERT(0 <= id && (int)id < g_messageservice->m_bucket.Count()); | ||||
MessageService& g = *g_messageservice; | MessageService& g = *g_messageservice; | ||||
Array<MessageList>& bucket = g.m_bucket[id]; | |||||
array<MessageList>& bucket = g.m_bucket[id]; | |||||
if (bucket.Count()) | 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()); | ASSERT(0 <= id && (int)id < g_messageservice->m_bucket.Count()); | ||||
MessageService& g = *g_messageservice; | MessageService& g = *g_messageservice; | ||||
Array<MessageList>& bucket = g.m_bucket[id]; | |||||
array<MessageList>& bucket = g.m_bucket[id]; | |||||
message = String(""); | message = String(""); | ||||
if (bucket.Count()) | if (bucket.Count()) | ||||
@@ -80,7 +80,7 @@ public: | |||||
static bool FetchAll(MessageBucket id, String& message, time_t &first_timestamp); | static bool FetchAll(MessageBucket id, String& message, time_t &first_timestamp); | ||||
private: | private: | ||||
Array<Array<MessageList> > m_bucket; | |||||
array<array<MessageList> > m_bucket; | |||||
}; | }; | ||||
extern MessageService *g_messageservice; | extern MessageService *g_messageservice; | ||||
@@ -35,7 +35,7 @@ class D3d9InputData | |||||
private: | private: | ||||
#if defined USE_XINPUT | #if defined USE_XINPUT | ||||
Array<int, InputDeviceInternal*> m_joysticks; | |||||
array<int, InputDeviceInternal*> m_joysticks; | |||||
#endif // USE_XINPUT | #endif // USE_XINPUT | ||||
}; | }; | ||||
@@ -34,7 +34,7 @@ private: | |||||
InitViewportSize(); | InitViewportSize(); | ||||
} | } | ||||
Array<class pp::InputEvent> m_input_events; | |||||
array<class pp::InputEvent> m_input_events; | |||||
class InputDeviceInternal* m_mouse; | class InputDeviceInternal* m_mouse; | ||||
class InputDeviceInternal* m_keyboard; | class InputDeviceInternal* m_keyboard; | ||||
@@ -39,7 +39,7 @@ class Ps3InputData | |||||
friend class Ps3Input; | friend class Ps3Input; | ||||
#if defined __CELLOS_LV2__ | #if defined __CELLOS_LV2__ | ||||
Array<int, Stick *> m_joysticks; | |||||
array<int, Stick *> m_joysticks; | |||||
vec2 mousepos; | vec2 mousepos; | ||||
ivec3 mousebuttons; | ivec3 mousebuttons; | ||||
@@ -59,7 +59,7 @@ private: | |||||
m_mousecapture(false) | m_mousecapture(false) | ||||
{ } | { } | ||||
Array<SDL_Joystick*, InputDeviceInternal*> m_joysticks; | |||||
array<SDL_Joystick*, InputDeviceInternal*> m_joysticks; | |||||
InputDeviceInternal* m_mouse; | InputDeviceInternal* m_mouse; | ||||
InputDeviceInternal* m_keyboard; | InputDeviceInternal* m_keyboard; | ||||
@@ -33,7 +33,7 @@ class XboxInputData | |||||
private: | private: | ||||
#if defined _XBOX | #if defined _XBOX | ||||
Array<int, Stick *> m_joysticks; | |||||
array<int, Stick *> m_joysticks; | |||||
#endif | #endif | ||||
}; | }; | ||||
@@ -86,7 +86,7 @@ Sample::Sample(char const *path) | |||||
data->m_name = String("<sample> ") + path; | data->m_name = String("<sample> ") + path; | ||||
#if __CELLOS_LV2__ | #if __CELLOS_LV2__ | ||||
Array<String> pathlist = System::GetPathList(path); | |||||
array<String> pathlist = System::GetPathList(path); | |||||
File f; | File f; | ||||
for (int i = 0; i < pathlist.Count(); ++i) | 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); | Log::Error("could not load sample %s\n", path); | ||||
} | } | ||||
#elif defined USE_SDL_MIXER | #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) | for (int i = 0; i < pathlist.Count(); ++i) | ||||
{ | { | ||||
data->m_chunk = Mix_LoadWAV(pathlist[i].C()); | data->m_chunk = Mix_LoadWAV(pathlist[i].C()); | ||||
@@ -59,30 +59,30 @@ class SceneData | |||||
private: | private: | ||||
/* New scenegraph */ | /* New scenegraph */ | ||||
Array<Primitive> m_primitives; | |||||
array<Primitive> m_primitives; | |||||
/* Old API <P0, P1, COLOR, TIME, MASK> */ | /* Old API <P0, P1, COLOR, TIME, MASK> */ | ||||
float m_new_line_time; | float m_new_line_time; | ||||
int m_new_line_mask; | int m_new_line_mask; | ||||
float m_new_line_segment_size; | float m_new_line_segment_size; | ||||
vec4 m_new_line_color; | 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; | int m_debug_mask; | ||||
Shader *m_line_shader; | Shader *m_line_shader; | ||||
VertexDeclaration *m_line_vdecl; | VertexDeclaration *m_line_vdecl; | ||||
int m_tile_cam; | 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_tile_shader; | ||||
Shader *m_palette_shader; | Shader *m_palette_shader; | ||||
VertexDeclaration *m_tile_vdecl; | VertexDeclaration *m_tile_vdecl; | ||||
Array<VertexBuffer *> m_tile_bufs; | |||||
array<VertexBuffer *> m_tile_bufs; | |||||
Camera *m_default_cam; | 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); | data->m_lights.Push(l); | ||||
} | } | ||||
Array<Light *> const &Scene::GetLights() const | |||||
array<Light *> const &Scene::GetLights() const | |||||
{ | { | ||||
return data->m_lights; | return data->m_lights; | ||||
} | } | ||||
@@ -277,8 +277,8 @@ void Scene::RenderPrimitives() | |||||
u_normalmat = shader->GetUniformLocation("u_normalmat"); | u_normalmat = shader->GetUniformLocation("u_normalmat"); | ||||
/* Per-scene environment */ | /* 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: the 4th component of the position can be used for other things */ | ||||
/* FIXME: GetUniform("blabla") is costly */ | /* FIXME: GetUniform("blabla") is costly */ | ||||
@@ -325,7 +325,7 @@ void Scene::RenderTiles() // XXX: rename to Blit() | |||||
for (int p = 0; p < 2; p++) | for (int p = 0; p < 2; p++) | ||||
{ | { | ||||
Shader *shader = (p == 0) ? data->m_tile_shader : data->m_palette_shader; | 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) | if (tiles.Count() == 0) | ||||
continue; | continue; | ||||
@@ -434,7 +434,7 @@ void Scene::RenderLines(float seconds) // XXX: rename to Blit() | |||||
if (!data->m_line_shader) | if (!data->m_line_shader) | ||||
data->m_line_shader = Shader::Create(LOLFX_RESOURCE_NAME(line)); | 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); | buff.Resize(linecount); | ||||
int real_linecount = 0; | int real_linecount = 0; | ||||
mat4 const inv_view_proj = inverse(g_scene->GetCamera()->GetProjection() * g_scene->GetCamera()->GetView()); | mat4 const inv_view_proj = inverse(g_scene->GetCamera()->GetProjection() * g_scene->GetCamera()->GetView()); | ||||
@@ -67,7 +67,7 @@ public: | |||||
void AddLine(vec2 a, vec2 b, vec4 color, float az=-1.f, float bz=-1.f); | void AddLine(vec2 a, vec2 b, vec4 color, float az=-1.f, float bz=-1.f); | ||||
void AddLight(Light *light); | void AddLight(Light *light); | ||||
Array<Light *> const &GetLights() const; | |||||
array<Light *> const &GetLights() const; | |||||
private: | private: | ||||
SceneData *data; | SceneData *data; | ||||
@@ -144,7 +144,7 @@ class FileData | |||||
String ReadString() | String ReadString() | ||||
{ | { | ||||
Array<uint8_t> buf; | |||||
array<uint8_t> buf; | |||||
buf.Resize(BUFSIZ); | buf.Resize(BUFSIZ); | ||||
String ret; | String ret; | ||||
while (IsValid()) | while (IsValid()) | ||||
@@ -415,7 +415,7 @@ class DirectoryData | |||||
#endif | #endif | ||||
} | } | ||||
bool GetContentList(Array<String>* files, Array<String>* directories) | |||||
bool GetContentList(array<String>* files, array<String>* directories) | |||||
{ | { | ||||
if (!IsValid()) | if (!IsValid()) | ||||
return false; | 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); | bool found_some = m_data->GetContentList(&sfiles, &sdirectories); | ||||
if (directories) | 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); | return GetContent(&files, &directories); | ||||
} | } | ||||
//-- | //-- | ||||
bool Directory::GetContent(Array<Directory>& directories) | |||||
bool Directory::GetContent(array<Directory>& directories) | |||||
{ | { | ||||
return GetContent(nullptr, &directories); | return GetContent(nullptr, &directories); | ||||
} | } | ||||
//-- | //-- | ||||
bool Directory::GetContent(Array<String>& files) | |||||
bool Directory::GetContent(array<String>& files) | |||||
{ | { | ||||
return GetContent(&files, nullptr); | return GetContent(&files, nullptr); | ||||
} | } | ||||
@@ -37,7 +37,7 @@ namespace System | |||||
# define SEPARATOR '/' | # define SEPARATOR '/' | ||||
#endif | #endif | ||||
static Array<String> data_dir; | |||||
static array<String> data_dir; | |||||
void Init(int argc, char *argv[], | void Init(int argc, char *argv[], | ||||
String const &projectdir, | String const &projectdir, | ||||
@@ -157,9 +157,9 @@ void AddDataDir(String const &dir) | |||||
data_dir << 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) | for (int i = 0; i < data_dir.Count(); ++i) | ||||
ret << data_dir[i] + file; | ret << data_dir[i] + file; | ||||
@@ -70,7 +70,7 @@ bool BaseThreadManager::AddWork(ThreadJob* job) | |||||
return false; | return false; | ||||
} | } | ||||
bool BaseThreadManager::FetchResult(Array<ThreadJob*>& results) | |||||
bool BaseThreadManager::FetchResult(array<ThreadJob*>& results) | |||||
{ | { | ||||
ThreadJob* result; | ThreadJob* result; | ||||
while (m_resultqueue.TryPop(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())) | while (m_job_dispatch.Count() > 0 && AddWork(m_job_dispatch.Last())) | ||||
m_job_dispatch.Pop(); | m_job_dispatch.Pop(); | ||||
Array<ThreadJob*> result; | |||||
array<ThreadJob*> result; | |||||
//Fetch and treat results | //Fetch and treat results | ||||
if (FetchResult(result)) | if (FetchResult(result)) | ||||
{ | { | ||||
@@ -57,8 +57,8 @@ public: | |||||
private: | private: | ||||
/* Entity management */ | /* 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; | int nentities; | ||||
/* Fixed framerate management */ | /* Fixed framerate management */ | ||||
@@ -45,7 +45,7 @@ private: | |||||
String m_name; | String m_name; | ||||
/* Pixels, then texture coordinates */ | /* Pixels, then texture coordinates */ | ||||
Array<ibox2, box2> m_tiles; | |||||
array<ibox2, box2> m_tiles; | |||||
ivec2 m_tile_size, m_image_size, m_texture_size; | ivec2 m_tile_size, m_image_size, m_texture_size; | ||||
Image *m_image; | Image *m_image; | ||||
@@ -61,7 +61,7 @@ TileSet::TileSet(char const *path) | |||||
{ | { | ||||
Init(path); | Init(path); | ||||
Array<ivec2, ivec2> tiles; | |||||
array<ivec2, ivec2> tiles; | |||||
if (m_data->m_image->RetrieveTiles(tiles)) | if (m_data->m_image->RetrieveTiles(tiles)) | ||||
for (int i = 0; i < tiles.Count(); i++) | for (int i = 0; i < tiles.Count(); i++) | ||||
AddTile(ibox2(tiles[0].m1, tiles[0].m1 + tiles[0].m2)); | 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); | Init(path, image); | ||||
Array<ivec2, ivec2> tiles; | |||||
array<ivec2, ivec2> tiles; | |||||
if (m_data->m_image->RetrieveTiles(tiles)) | if (m_data->m_image->RetrieveTiles(tiles)) | ||||
for (int i = 0; i < tiles.Count(); i++) | for (int i = 0; i < tiles.Count(); i++) | ||||
AddTile(ibox2(tiles[0].m1, tiles[0].m1 + tiles[0].m2)); | 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))); | size * ivec2(i + 1, j + 1))); | ||||
} | } | ||||
Array<ivec2, ivec2> tiles; | |||||
array<ivec2, ivec2> tiles; | |||||
if (m_data->m_image->RetrieveTiles(tiles)) | if (m_data->m_image->RetrieveTiles(tiles)) | ||||
for (int i = 0; i < tiles.Count(); i++) | for (int i = 0; i < tiles.Count(); i++) | ||||
AddTile(ibox2(tiles[i].m1, tiles[i].m1 + tiles[i].m2)); | 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))); | size * ivec2(i + 1, j + 1))); | ||||
} | } | ||||
Array<ivec2, ivec2> tiles; | |||||
array<ivec2, ivec2> tiles; | |||||
if (m_data->m_image->RetrieveTiles(tiles)) | if (m_data->m_image->RetrieveTiles(tiles)) | ||||
for (int i = 0; i < tiles.Count(); i++) | for (int i = 0; i < tiles.Count(); i++) | ||||
AddTile(ibox2(tiles[i].m1, tiles[i].m1 + tiles[i].m2)); | AddTile(ibox2(tiles[i].m1, tiles[i].m1 + tiles[i].m2)); | ||||
@@ -33,7 +33,7 @@ template< class T > inline void Swap( T& A, T& B ) | |||||
//TODO: random struct | //TODO: random struct | ||||
//Gets a random Element from the given array<T>, considering you have implemented what follows : | //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. | //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_total = 0.f; | ||||
float r_alpha = rand(1.f); | float r_alpha = rand(1.f); | ||||
@@ -47,7 +47,7 @@ class WorldData | |||||
char const *filename = lua_tostring(L, 1); | char const *filename = lua_tostring(L, 1); | ||||
int status = LUA_ERRFILE; | int status = LUA_ERRFILE; | ||||
Array<String> pathlist = System::GetPathList(filename); | |||||
array<String> pathlist = System::GetPathList(filename); | |||||
File f; | File f; | ||||
for (int i = 0; i < pathlist.Count(); ++i) | for (int i = 0; i < pathlist.Count(); ++i) | ||||
{ | { | ||||