Ver código fonte

base: use lol::array in most places.

undefined
Sam Hocevar 10 anos atrás
pai
commit
398ee1b4d5
24 arquivos alterados com 85 adições e 85 exclusões
  1. +1
    -1
      demos/tutorial/01_triangle.cpp
  2. +2
    -2
      demos/tutorial/02_cube.cpp
  3. +1
    -1
      demos/tutorial/03_noise.cpp
  4. +2
    -2
      demos/tutorial/04_texture.cpp
  5. +1
    -1
      demos/tutorial/05_easymesh.cpp
  6. +1
    -1
      demos/tutorial/06_sprite.cpp
  7. +2
    -2
      demos/tutorial/07_input.cpp
  8. +1
    -1
      demos/tutorial/08_fbo.cpp
  9. +1
    -1
      demos/tutorial/11_fractal.cpp
  10. +4
    -4
      demos/tutorial/12_voronoi.cpp
  11. +1
    -1
      test/btphystest.cpp
  12. +6
    -6
      test/btphystest.h
  13. +6
    -6
      test/meshviewer.cpp
  14. +6
    -6
      test/nacl_phystest.h
  15. +3
    -3
      test/physicobject.h
  16. +2
    -2
      test/physics/easyphysics.h
  17. +12
    -12
      test/physics/lolphysics.h
  18. +2
    -2
      test/scenesetup.h
  19. +19
    -19
      test/unit/array.cpp
  20. +1
    -1
      test/unit/quat.cpp
  21. +1
    -1
      tools/lolremez/matrix.h
  22. +6
    -6
      tools/lolremez/solver.cpp
  23. +3
    -3
      tools/lolremez/solver.h
  24. +1
    -1
      tools/vimlol/vimlol.vim

+ 1
- 1
demos/tutorial/01_triangle.cpp Ver arquivo

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

private:
Array<vec2> m_vertices;
array<vec2> m_vertices;
Shader *m_shader;
ShaderAttrib m_coord;
VertexDeclaration *m_vdecl;


+ 2
- 2
demos/tutorial/02_cube.cpp Ver arquivo

@@ -118,8 +118,8 @@ public:
private:
float m_angle;
mat4 m_matrix;
Array<vec3,vec3> m_mesh;
Array<uint16_t> m_lines_indices, m_faces_indices;
array<vec3,vec3> m_mesh;
array<uint16_t> m_lines_indices, m_faces_indices;

Shader *m_shader;
ShaderAttrib m_coord, m_color;


+ 1
- 1
demos/tutorial/03_noise.cpp Ver arquivo

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

private:
Array<vec2> m_vertices;
array<vec2> m_vertices;
Shader *m_shader;
ShaderAttrib m_coord;
ShaderUniform m_time_uni;


+ 2
- 2
demos/tutorial/04_texture.cpp Ver arquivo

@@ -96,14 +96,14 @@ public:
}

private:
Array<vec2> m_vertices;
array<vec2> m_vertices;
Texture *m_texture;
Shader *m_shader;
ShaderAttrib m_coord;
ShaderUniform m_texture_uni;
VertexDeclaration *m_vdecl;
VertexBuffer *m_vbo;
Array<uint8_t> m_heightmap;
array<uint8_t> m_heightmap;
int m_frames;
bool m_ready;
};


+ 1
- 1
demos/tutorial/05_easymesh.cpp Ver arquivo

@@ -144,7 +144,7 @@ public:

private:
Shader* m_custom_shader;
Array<EasyMesh, mat4, float> m_gears;
array<EasyMesh, mat4, float> m_gears;
float m_angle;
mat4 m_mat;
Camera *m_camera;


+ 1
- 1
demos/tutorial/06_sprite.cpp Ver arquivo

@@ -88,7 +88,7 @@ private:

static int const SPRITE_COUNT = 192;
static int const FRAME_COUNT = 16;
Array<vec3, float> m_sprites;
array<vec3, float> m_sprites;

bool m_ready;
};


+ 2
- 2
demos/tutorial/07_input.cpp Ver arquivo

@@ -218,8 +218,8 @@ private:
float m_pitch_angle;
float m_yaw_angle;
mat4 m_matrix;
Array<vec3,vec3> m_mesh;
Array<uint16_t> m_lines_indices, m_faces_indices;
array<vec3,vec3> m_mesh;
array<uint16_t> m_lines_indices, m_faces_indices;

Shader *m_shader;
ShaderAttrib m_coord, m_color;


+ 1
- 1
demos/tutorial/08_fbo.cpp Ver arquivo

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

private:
Array<vec2> m_vertices;
array<vec2> m_vertices;
Shader *m_shader;
ShaderAttrib m_coord;
ShaderUniform m_uni_flag, m_uni_point, m_uni_color, m_uni_texture;


+ 1
- 1
demos/tutorial/11_fractal.cpp Ver arquivo

@@ -532,7 +532,7 @@ private:
ivec2 m_size, m_window_size, m_oldmouse;
double m_window2world;
dvec2 m_texel2world;
Array<u8vec4> m_pixels, m_palette;
array<u8vec4> m_pixels, m_palette;

Shader *m_shader;
ShaderAttrib m_vertexattrib, m_texattrib;


+ 4
- 4
demos/tutorial/12_voronoi.cpp Ver arquivo

@@ -113,7 +113,7 @@ public:

for (int i = 0; i < MaxFboType; ++i)
{
m_fbos.Push(new Framebuffer(Video::GetSize()), 0, Array<ShaderUniform>(), Array<ShaderAttrib>() );
m_fbos.Push(new Framebuffer(Video::GetSize()), 0, array<ShaderUniform>(), array<ShaderAttrib>() );

if (i == SrcVoronoiFbo)
{
@@ -394,8 +394,8 @@ public:

private:
Controller* m_controller;
Array<vec3, vec2> voronoi_points;
Array<vec2> m_vertices;
array<vec3, vec2> voronoi_points;
array<vec2> m_vertices;
Shader *m_screen_shader;
ShaderAttrib m_screen_coord;
ShaderUniform m_screen_texture;
@@ -403,7 +403,7 @@ private:
VertexDeclaration *m_vdecl;
VertexBuffer *m_vbo;

Array<Framebuffer *, Shader *, Array<ShaderUniform>, Array<ShaderAttrib> > m_fbos;
array<Framebuffer *, Shader *, array<ShaderUniform>, array<ShaderAttrib> > m_fbos;
Framebuffer *temp_buffer;

int mode;


+ 1
- 1
test/btphystest.cpp Ver arquivo

@@ -272,7 +272,7 @@ void BtPhysTest::InitApp()

#if USE_ROPE
{
Array<PhysicsObject*> RopeElements;
array<PhysicsObject*> RopeElements;
for (int i = 0; i < 14; i++)
{
PhysicsObject* new_physobj = new PhysicsObject(m_simulation, 1000.f,


+ 6
- 6
test/btphystest.h Ver arquivo

@@ -68,12 +68,12 @@ private:
bool m_ready;

lol::phys::Simulation* m_simulation;
Array<EasyConstraint*> m_constraint_list;
Array<PhysicsObject*, float> m_physobj_list;
Array<PhysicsObject*> m_ground_list;
Array<PhysicsObject*> m_platform_list;
Array<PhysicsObject*> m_character_list;
Array<PhysicsObject*> m_stairs_list;
array<EasyConstraint*> m_constraint_list;
array<PhysicsObject*, float> m_physobj_list;
array<PhysicsObject*> m_ground_list;
array<PhysicsObject*> m_platform_list;
array<PhysicsObject*> m_character_list;
array<PhysicsObject*> m_stairs_list;

float m_loop_value;
float m_target_timer;


+ 6
- 6
test/meshviewer.cpp Ver arquivo

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

Array<vec3> m_targets;
array<vec3> m_targets;
};

class MeshViewer : public WorldEntity
@@ -581,7 +581,7 @@ public:
if (new_ssetup->Compile(mesh.C()) && new_ssetup->m_lights.Count())
{
//Store current light datas, in World
Array<LightData> light_datas;
array<LightData> light_datas;
for (int i = 0; i < m_ssetup->m_lights.Count(); ++i)
light_datas << LightData(m_ssetup->m_lights[i]->GetPosition(), m_ssetup->m_lights[i]->GetColor());

@@ -890,7 +890,7 @@ public:

private:
SceneSetup* m_ssetup;
Array<LightData> m_light_datas;
array<LightData> m_light_datas;
Controller* m_controller;
short m_input_usage;
mat4 m_mat;
@@ -927,12 +927,12 @@ private:
int m_mesh_render;
int m_mesh_id;
float m_mesh_id1;
Array<EasyMesh*, EasyMesh*> m_meshes;
Array<EasyMesh*> m_gizmos;
array<EasyMesh*, EasyMesh*> m_meshes;
array<EasyMesh*> m_gizmos;

//File data
String m_file_name;
Array<String> m_cmdlist;
array<String> m_cmdlist;
float m_stream_update_time;
float m_stream_update_timer;



+ 6
- 6
test/nacl_phystest.h Ver arquivo

@@ -43,12 +43,12 @@ private:
bool m_ready;

//lol::phys::Simulation* m_simulation;
//Array<EasyConstraint*> m_constraint_list;
//Array<PhysicsObject*, float> m_physobj_list;
//Array<PhysicsObject*> m_ground_list;
//Array<PhysicsObject*> m_platform_list;
//Array<PhysicsObject*> m_character_list;
//Array<PhysicsObject*> m_stairs_list;
//array<EasyConstraint*> m_constraint_list;
//array<PhysicsObject*, float> m_physobj_list;
//array<PhysicsObject*> m_ground_list;
//array<PhysicsObject*> m_platform_list;
//array<PhysicsObject*> m_character_list;
//array<PhysicsObject*> m_stairs_list;

float m_loop_value;
float m_target_timer;


+ 3
- 3
test/physicobject.h Ver arquivo

@@ -130,9 +130,9 @@ public:
m_is_character(false),
m_is_phys(false)
{
Array<char const *> MeshRand;
Array<int> MeshLimit;
Array<int> MeshType;
array<char const *> MeshRand;
array<int> MeshLimit;
array<int> MeshType;

MeshLimit << 0;



+ 2
- 2
test/physics/easyphysics.h Ver arquivo

@@ -142,13 +142,13 @@ protected:
Simulation* m_owner_simulation;

//Base/Attachment logic
Array<EasyPhysic*> m_based_physic_list; //List of objects based on this : this object moves, its based object MoveStep with it.
array<EasyPhysic*> m_based_physic_list; //List of objects based on this : this object moves, its based object MoveStep with it.
EasyPhysic* m_base_physic; //Base for this object : The base moves, the object moves with it.
bool m_base_lock_location; //when this is TRUE, location moves with rotation change.
bool m_base_lock_rotation; //when this is TRUE, rotation moves with rotation change.

//Touch logic
Array<EasyPhysic*> m_touching_physic; //Maintained by ghost objects
array<EasyPhysic*> m_touching_physic; //Maintained by ghost objects
};

} /* namespace phys */


+ 12
- 12
test/physics/lolphysics.h Ver arquivo

@@ -48,10 +48,10 @@ struct RayCastResult
m_hit_fraction_list.Empty();
}

Array<EasyPhysic*> m_collider_list;
Array<vec3> m_hit_normal_list;
Array<vec3> m_hit_point_list;
Array<float> m_hit_fraction_list;
array<EasyPhysic*> m_collider_list;
array<vec3> m_hit_normal_list;
array<vec3> m_hit_point_list;
array<float> m_hit_fraction_list;

short int m_collision_filter_group;
short int m_collision_filter_mask;
@@ -334,7 +334,7 @@ private:
//Adds the given EasyPhysic to the correct list.
void ObjectRegistration(bool AddObject, EasyPhysic* NewEP, eEasyPhysicType CurType)
{
Array<EasyPhysic*>* SearchList = NULL;
array<EasyPhysic*>* SearchList = NULL;
switch(CurType)
{
case EEPT_Dynamic:
@@ -388,7 +388,7 @@ private:
}
void ObjectRegistration(bool AddObject, EasyConstraint* NewEC)
{
Array<EasyConstraint*>* SearchList = NULL;
array<EasyConstraint*>* SearchList = NULL;
SearchList = &m_constraint_list;

if (AddObject)
@@ -411,12 +411,12 @@ private:
}

//Easy Physics body List
Array<EasyPhysic*> m_dynamic_list;
Array<EasyPhysic*> m_static_list;
Array<EasyPhysic*> m_ghost_list;
Array<EasyPhysic*> m_collision_object_list;
Array<EasyPhysic*> m_character_controller_list;
Array<EasyConstraint*> m_constraint_list;
array<EasyPhysic*> m_dynamic_list;
array<EasyPhysic*> m_static_list;
array<EasyPhysic*> m_ghost_list;
array<EasyPhysic*> m_collision_object_list;
array<EasyPhysic*> m_character_controller_list;
array<EasyConstraint*> m_constraint_list;

//Easy Physics data storage
float m_timestep;


+ 2
- 2
test/scenesetup.h Ver arquivo

@@ -40,8 +40,8 @@ public:

//--
vec4 m_clear_color;
Array<Light *> m_lights;
Array<String, String> m_custom_cmd;
array<Light *> m_lights;
array<String, String> m_custom_cmd;
bool m_show_gizmo;
bool m_show_lights;
};


+ 19
- 19
test/unit/array.cpp Ver arquivo

@@ -38,7 +38,7 @@ LOLUNIT_FIXTURE(ArrayTest)

LOLUNIT_TEST(ArrayPush)
{
Array<int> a;
array<int> a;
a.Push(0);
a.Push(1);
a.Push(2);
@@ -52,19 +52,19 @@ LOLUNIT_FIXTURE(ArrayTest)

LOLUNIT_TEST(ArrayInitializer)
{
Array<int> a({ 2, 4, 6 });
array<int> a({ 2, 4, 6 });

LOLUNIT_ASSERT_EQUAL(a[0], 2);
LOLUNIT_ASSERT_EQUAL(a[1], 4);
LOLUNIT_ASSERT_EQUAL(a[2], 6);

Array<int> b = { 2, 4, 6 };
array<int> b = { 2, 4, 6 };

LOLUNIT_ASSERT_EQUAL(b[0], 2);
LOLUNIT_ASSERT_EQUAL(b[1], 4);
LOLUNIT_ASSERT_EQUAL(b[2], 6);

Array<int, float> c = { { 2, 3.0f },
array<int, float> c = { { 2, 3.0f },
{ 4, 5.0f },
{ 6, 7.0f } };

@@ -78,7 +78,7 @@ LOLUNIT_FIXTURE(ArrayTest)

LOLUNIT_TEST(ArrayPushWithShift)
{
Array<int> a;
array<int> a;
a << 0 << 1 << 2 << 3;

LOLUNIT_ASSERT_EQUAL(a[0], 0);
@@ -89,10 +89,10 @@ LOLUNIT_FIXTURE(ArrayTest)

LOLUNIT_TEST(ArrayCopy)
{
Array<int> a;
array<int> a;
a << 0 << 1 << 2 << 3;

Array<int> b = a;
array<int> b = a;

LOLUNIT_ASSERT_EQUAL(b[0], 0);
LOLUNIT_ASSERT_EQUAL(b[1], 1);
@@ -102,7 +102,7 @@ LOLUNIT_FIXTURE(ArrayTest)

LOLUNIT_TEST(ArrayRemove)
{
Array<int> a;
array<int> a;
a << 0 << 1 << 2 << 3;
a.Remove(1);

@@ -111,7 +111,7 @@ LOLUNIT_FIXTURE(ArrayTest)
LOLUNIT_ASSERT_EQUAL(a[1], 2);
LOLUNIT_ASSERT_EQUAL(a[2], 3);

Array<int> b;
array<int> b;
b << 0 << 1 << 2 << 3;
b.Remove(-2);

@@ -123,7 +123,7 @@ LOLUNIT_FIXTURE(ArrayTest)

LOLUNIT_TEST(ArrayRemoveSwap)
{
Array<int> a;
array<int> a;
a << 0 << 1 << 2 << 3;
a.RemoveSwap(1);

@@ -132,7 +132,7 @@ LOLUNIT_FIXTURE(ArrayTest)
LOLUNIT_ASSERT_EQUAL(a[1], 3);
LOLUNIT_ASSERT_EQUAL(a[2], 2);

Array<int> b;
array<int> b;
b << 0 << 1 << 2 << 3;
b.Remove(1, 2);

@@ -143,7 +143,7 @@ LOLUNIT_FIXTURE(ArrayTest)

LOLUNIT_TEST(EightElements)
{
Array<int, long, float, double, unsigned, char, bool, void *> a;
array<int, long, float, double, unsigned, char, bool, void *> a;
a.Push(1, 2, 3.f, 4.0, 5, 'a', true, 0);

LOLUNIT_ASSERT_EQUAL(a[0].m1, 1);
@@ -158,7 +158,7 @@ LOLUNIT_FIXTURE(ArrayTest)

LOLUNIT_TEST(ArraySwap)
{
Array<int, int> a;
array<int, int> a;
a.Push(10, 20);
a.Push(30, 40);
a.Swap(0, 1);
@@ -171,7 +171,7 @@ LOLUNIT_FIXTURE(ArrayTest)

LOLUNIT_TEST(ArrayInsert)
{
Array<int> a;
array<int> a;
a << 1 << 2;

a.Insert(5, 0);
@@ -195,11 +195,11 @@ LOLUNIT_FIXTURE(ArrayTest)

LOLUNIT_TEST(ArrayConcat)
{
Array<int> a, b;
array<int> a, b;
a << 0 << 1;
b << 2 << 3;

Array<int> c = a + b;
array<int> c = a + b;
LOLUNIT_ASSERT_EQUAL(c[0], 0);
LOLUNIT_ASSERT_EQUAL(c[1], 1);
LOLUNIT_ASSERT_EQUAL(c[2], 2);
@@ -208,7 +208,7 @@ LOLUNIT_FIXTURE(ArrayTest)

LOLUNIT_TEST(ArrayAppend)
{
Array<int> a, b;
array<int> a, b;
a << 0 << 1;
b << 2 << 3;

@@ -232,7 +232,7 @@ LOLUNIT_FIXTURE(ArrayTest)
TrackedObj::m_ctor = 0;
TrackedObj::m_dtor = 0;
{
Array<TrackedObj> a;
array<TrackedObj> a;

a.Push(TrackedObj());
}
@@ -241,7 +241,7 @@ LOLUNIT_FIXTURE(ArrayTest)
TrackedObj::m_ctor = 0;
TrackedObj::m_dtor = 0;
{
Array<TrackedObj> a;
array<TrackedObj> a;

a.Resize(2);
a.Resize(4);


+ 1
- 1
test/unit/quat.cpp Ver arquivo

@@ -536,7 +536,7 @@ LOLUNIT_FIXTURE(QuaternionTest)
}

private:
Array<vec3, vec3> m_vectorpairs;
array<vec3, vec3> m_vectorpairs;
};

} /* namespace lol */


+ 1
- 1
tools/lolremez/matrix.h Ver arquivo

@@ -106,6 +106,6 @@ template<typename T> struct Matrix
int m_cols, m_rows;

private:
Array<T> m_data;
array<T> m_data;
};


+ 6
- 6
tools/lolremez/solver.cpp Ver arquivo

@@ -96,7 +96,7 @@ void RemezSolver::Init()
m_control.Resize(m_order + 2);

/* Pick up x_i where error will be 0 and compute f(x_i) */
Array<real> fxn;
array<real> fxn;
for (int i = 0; i < m_order + 1; i++)
{
m_zeroes[i] = (real)(2 * i - m_order) / (real)(m_order + 1);
@@ -109,7 +109,7 @@ void RemezSolver::Init()
for (int i = 0; i < m_order + 1; i++)
{
/* Compute the powers of x_i */
Array<real> powers;
array<real> powers;
powers.Push(real(1.0));
for (int n = 1; n < m_order + 1; n++)
powers.Push(powers.Last() * m_zeroes[i]);
@@ -239,7 +239,7 @@ real RemezSolver::FindExtrema()
void RemezSolver::Step()
{
/* Pick up x_i where error will be 0 and compute f(x_i) */
Array<real> fxn;
array<real> fxn;
for (int i = 0; i < m_order + 2; i++)
fxn.Push(EvalFunc(m_control[i]));

@@ -249,7 +249,7 @@ void RemezSolver::Step()
for (int i = 0; i < m_order + 2; i++)
{
/* Compute the powers of x_i */
Array<real> powers;
array<real> powers;
powers.Push(real(1.0));
for (int n = 1; n < m_order + 1; n++)
powers.Push(powers.Last() * m_control[i]);
@@ -307,7 +307,7 @@ void RemezSolver::PrintPoly()

/* Transform Chebyshev polynomial weights into powers of X^i
* in the [-1..1] range. */
Array<real> bn;
array<real> bn;

for (int i = 0; i < m_order + 1; i++)
{
@@ -319,7 +319,7 @@ void RemezSolver::PrintPoly()

/* Transform a polynomial in the [-1..1] range into a polynomial
* in the [a..b] range. */
Array<real> k1p, k2p, an;
array<real> k1p, k2p, an;

for (int i = 0; i < m_order + 1; i++)
{


+ 3
- 3
tools/lolremez/solver.h Ver arquivo

@@ -44,9 +44,9 @@ private:
private:
int m_order;

lol::Array<lol::real> m_coeff;
lol::Array<lol::real> m_zeroes;
lol::Array<lol::real> m_control;
lol::array<lol::real> m_coeff;
lol::array<lol::real> m_zeroes;
lol::array<lol::real> m_control;

RealFunc *m_func, *m_weight;
lol::real m_k1, m_k2, m_invk1, m_invk2, m_epsilon;


+ 1
- 1
tools/vimlol/vimlol.vim Ver arquivo

@@ -18,7 +18,7 @@ au Syntax cpp
" Some custom container types
au Syntax cpp
\ syn keyword cType
\ hash map array2d array3d
\ array array2d array3d hash map

" GLSL types and the Lol Engine extensions
au Syntax cpp


Carregando…
Cancelar
Salvar