├── .gitignore ├── LICENSE.md ├── Makefile ├── README.md ├── assets └── images │ └── screenshots │ ├── led_3_0.PNG │ ├── led_3_1.PNG │ └── led_8_0.gif ├── docs ├── 1.foundation │ ├── 1.embedding_python │ │ ├── custom_python_module.md │ │ ├── embedding_further.md │ │ └── hello_python.md │ ├── 2.game_loop_and_sdl │ │ ├── game_loop_introduction.md │ │ └── initialize_sdl.md │ ├── 3.opengl_rendering │ │ ├── asset_management.md │ │ ├── rendering_sprites.md │ │ └── rendering_text.md │ ├── 4.implementing_audio │ │ └── using_sdl_mixer.md │ ├── 5.input_management │ │ ├── input_events.md │ │ └── input_management.md │ ├── 6.entity_component_system │ │ ├── building_an_ecs.md │ │ ├── ecs_orchestrator.md │ │ └── managers.md │ ├── 7.serializing_with_json │ │ ├── creating_scene_json_files.md │ │ └── parsing_json_properties_file.md │ ├── 8.animations │ │ └── animation_system.md │ └── 9.collisions │ │ └── collision_system.md ├── 2.engine_api │ └── about.md ├── 3.games │ └── about.md ├── index.md ├── source_code │ └── source_code.md └── theme │ └── main.html ├── include ├── glad │ ├── glad.c │ └── glad.h ├── glm │ ├── CMakeLists.txt │ ├── common.hpp │ ├── detail │ │ ├── _features.hpp │ │ ├── _fixes.hpp │ │ ├── _noise.hpp │ │ ├── _swizzle.hpp │ │ ├── _swizzle_func.hpp │ │ ├── _vectorize.hpp │ │ ├── compute_common.hpp │ │ ├── compute_vector_relational.hpp │ │ ├── func_common.inl │ │ ├── func_common_simd.inl │ │ ├── func_exponential.inl │ │ ├── func_exponential_simd.inl │ │ ├── func_geometric.inl │ │ ├── func_geometric_simd.inl │ │ ├── func_integer.inl │ │ ├── func_integer_simd.inl │ │ ├── func_matrix.inl │ │ ├── func_matrix_simd.inl │ │ ├── func_packing.inl │ │ ├── func_packing_simd.inl │ │ ├── func_trigonometric.inl │ │ ├── func_trigonometric_simd.inl │ │ ├── func_vector_relational.inl │ │ ├── func_vector_relational_simd.inl │ │ ├── glm.cpp │ │ ├── qualifier.hpp │ │ ├── setup.hpp │ │ ├── type_float.hpp │ │ ├── type_half.hpp │ │ ├── type_half.inl │ │ ├── type_mat2x2.hpp │ │ ├── type_mat2x2.inl │ │ ├── type_mat2x3.hpp │ │ ├── type_mat2x3.inl │ │ ├── type_mat2x4.hpp │ │ ├── type_mat2x4.inl │ │ ├── type_mat3x2.hpp │ │ ├── type_mat3x2.inl │ │ ├── type_mat3x3.hpp │ │ ├── type_mat3x3.inl │ │ ├── type_mat3x4.hpp │ │ ├── type_mat3x4.inl │ │ ├── type_mat4x2.hpp │ │ ├── type_mat4x2.inl │ │ ├── type_mat4x3.hpp │ │ ├── type_mat4x3.inl │ │ ├── type_mat4x4.hpp │ │ ├── type_mat4x4.inl │ │ ├── type_mat4x4_simd.inl │ │ ├── type_quat.hpp │ │ ├── type_quat.inl │ │ ├── type_quat_simd.inl │ │ ├── type_vec1.hpp │ │ ├── type_vec1.inl │ │ ├── type_vec2.hpp │ │ ├── type_vec2.inl │ │ ├── type_vec3.hpp │ │ ├── type_vec3.inl │ │ ├── type_vec4.hpp │ │ ├── type_vec4.inl │ │ └── type_vec4_simd.inl │ ├── exponential.hpp │ ├── ext.hpp │ ├── ext │ │ ├── matrix_clip_space.hpp │ │ ├── matrix_clip_space.inl │ │ ├── matrix_common.hpp │ │ ├── matrix_common.inl │ │ ├── matrix_double2x2.hpp │ │ ├── matrix_double2x2_precision.hpp │ │ ├── matrix_double2x3.hpp │ │ ├── matrix_double2x3_precision.hpp │ │ ├── matrix_double2x4.hpp │ │ ├── matrix_double2x4_precision.hpp │ │ ├── matrix_double3x2.hpp │ │ ├── matrix_double3x2_precision.hpp │ │ ├── matrix_double3x3.hpp │ │ ├── matrix_double3x3_precision.hpp │ │ ├── matrix_double3x4.hpp │ │ ├── matrix_double3x4_precision.hpp │ │ ├── matrix_double4x2.hpp │ │ ├── matrix_double4x2_precision.hpp │ │ ├── matrix_double4x3.hpp │ │ ├── matrix_double4x3_precision.hpp │ │ ├── matrix_double4x4.hpp │ │ ├── matrix_double4x4_precision.hpp │ │ ├── matrix_float2x2.hpp │ │ ├── matrix_float2x2_precision.hpp │ │ ├── matrix_float2x3.hpp │ │ ├── matrix_float2x3_precision.hpp │ │ ├── matrix_float2x4.hpp │ │ ├── matrix_float2x4_precision.hpp │ │ ├── matrix_float3x2.hpp │ │ ├── matrix_float3x2_precision.hpp │ │ ├── matrix_float3x3.hpp │ │ ├── matrix_float3x3_precision.hpp │ │ ├── matrix_float3x4.hpp │ │ ├── matrix_float3x4_precision.hpp │ │ ├── matrix_float4x2.hpp │ │ ├── matrix_float4x2_precision.hpp │ │ ├── matrix_float4x3.hpp │ │ ├── matrix_float4x3_precision.hpp │ │ ├── matrix_float4x4.hpp │ │ ├── matrix_float4x4_precision.hpp │ │ ├── matrix_projection.hpp │ │ ├── matrix_projection.inl │ │ ├── matrix_relational.hpp │ │ ├── matrix_relational.inl │ │ ├── matrix_transform.hpp │ │ ├── matrix_transform.inl │ │ ├── quaternion_common.hpp │ │ ├── quaternion_common.inl │ │ ├── quaternion_common_simd.inl │ │ ├── quaternion_double.hpp │ │ ├── quaternion_double_precision.hpp │ │ ├── quaternion_exponential.hpp │ │ ├── quaternion_exponential.inl │ │ ├── quaternion_float.hpp │ │ ├── quaternion_float_precision.hpp │ │ ├── quaternion_geometric.hpp │ │ ├── quaternion_geometric.inl │ │ ├── quaternion_relational.hpp │ │ ├── quaternion_relational.inl │ │ ├── quaternion_transform.hpp │ │ ├── quaternion_transform.inl │ │ ├── quaternion_trigonometric.hpp │ │ ├── quaternion_trigonometric.inl │ │ ├── scalar_common.hpp │ │ ├── scalar_common.inl │ │ ├── scalar_constants.hpp │ │ ├── scalar_constants.inl │ │ ├── scalar_int_sized.hpp │ │ ├── scalar_relational.hpp │ │ ├── scalar_relational.inl │ │ ├── scalar_uint_sized.hpp │ │ ├── scalar_ulp.hpp │ │ ├── scalar_ulp.inl │ │ ├── vector_bool1.hpp │ │ ├── vector_bool1_precision.hpp │ │ ├── vector_bool2.hpp │ │ ├── vector_bool2_precision.hpp │ │ ├── vector_bool3.hpp │ │ ├── vector_bool3_precision.hpp │ │ ├── vector_bool4.hpp │ │ ├── vector_bool4_precision.hpp │ │ ├── vector_common.hpp │ │ ├── vector_common.inl │ │ ├── vector_double1.hpp │ │ ├── vector_double1_precision.hpp │ │ ├── vector_double2.hpp │ │ ├── vector_double2_precision.hpp │ │ ├── vector_double3.hpp │ │ ├── vector_double3_precision.hpp │ │ ├── vector_double4.hpp │ │ ├── vector_double4_precision.hpp │ │ ├── vector_float1.hpp │ │ ├── vector_float1_precision.hpp │ │ ├── vector_float2.hpp │ │ ├── vector_float2_precision.hpp │ │ ├── vector_float3.hpp │ │ ├── vector_float3_precision.hpp │ │ ├── vector_float4.hpp │ │ ├── vector_float4_precision.hpp │ │ ├── vector_int1.hpp │ │ ├── vector_int1_precision.hpp │ │ ├── vector_int2.hpp │ │ ├── vector_int2_precision.hpp │ │ ├── vector_int3.hpp │ │ ├── vector_int3_precision.hpp │ │ ├── vector_int4.hpp │ │ ├── vector_int4_precision.hpp │ │ ├── vector_relational.hpp │ │ ├── vector_relational.inl │ │ ├── vector_uint1.hpp │ │ ├── vector_uint1_precision.hpp │ │ ├── vector_uint2.hpp │ │ ├── vector_uint2_precision.hpp │ │ ├── vector_uint3.hpp │ │ ├── vector_uint3_precision.hpp │ │ ├── vector_uint4.hpp │ │ ├── vector_uint4_precision.hpp │ │ ├── vector_ulp.hpp │ │ └── vector_ulp.inl │ ├── fwd.hpp │ ├── geometric.hpp │ ├── glm.hpp │ ├── gtc │ │ ├── bitfield.hpp │ │ ├── bitfield.inl │ │ ├── color_space.hpp │ │ ├── color_space.inl │ │ ├── constants.hpp │ │ ├── constants.inl │ │ ├── epsilon.hpp │ │ ├── epsilon.inl │ │ ├── integer.hpp │ │ ├── integer.inl │ │ ├── matrix_access.hpp │ │ ├── matrix_access.inl │ │ ├── matrix_integer.hpp │ │ ├── matrix_inverse.hpp │ │ ├── matrix_inverse.inl │ │ ├── matrix_transform.hpp │ │ ├── matrix_transform.inl │ │ ├── noise.hpp │ │ ├── noise.inl │ │ ├── packing.hpp │ │ ├── packing.inl │ │ ├── quaternion.hpp │ │ ├── quaternion.inl │ │ ├── quaternion_simd.inl │ │ ├── random.hpp │ │ ├── random.inl │ │ ├── reciprocal.hpp │ │ ├── reciprocal.inl │ │ ├── round.hpp │ │ ├── round.inl │ │ ├── type_aligned.hpp │ │ ├── type_precision.hpp │ │ ├── type_precision.inl │ │ ├── type_ptr.hpp │ │ ├── type_ptr.inl │ │ ├── ulp.hpp │ │ ├── ulp.inl │ │ └── vec1.hpp │ ├── gtx │ │ ├── associated_min_max.hpp │ │ ├── associated_min_max.inl │ │ ├── bit.hpp │ │ ├── bit.inl │ │ ├── closest_point.hpp │ │ ├── closest_point.inl │ │ ├── color_encoding.hpp │ │ ├── color_encoding.inl │ │ ├── color_space.hpp │ │ ├── color_space.inl │ │ ├── color_space_YCoCg.hpp │ │ ├── color_space_YCoCg.inl │ │ ├── common.hpp │ │ ├── common.inl │ │ ├── compatibility.hpp │ │ ├── compatibility.inl │ │ ├── component_wise.hpp │ │ ├── component_wise.inl │ │ ├── dual_quaternion.hpp │ │ ├── dual_quaternion.inl │ │ ├── easing.hpp │ │ ├── easing.inl │ │ ├── euler_angles.hpp │ │ ├── euler_angles.inl │ │ ├── extend.hpp │ │ ├── extend.inl │ │ ├── extended_min_max.hpp │ │ ├── extended_min_max.inl │ │ ├── exterior_product.hpp │ │ ├── exterior_product.inl │ │ ├── fast_exponential.hpp │ │ ├── fast_exponential.inl │ │ ├── fast_square_root.hpp │ │ ├── fast_square_root.inl │ │ ├── fast_trigonometry.hpp │ │ ├── fast_trigonometry.inl │ │ ├── float_notmalize.inl │ │ ├── functions.hpp │ │ ├── functions.inl │ │ ├── gradient_paint.hpp │ │ ├── gradient_paint.inl │ │ ├── handed_coordinate_space.hpp │ │ ├── handed_coordinate_space.inl │ │ ├── hash.hpp │ │ ├── hash.inl │ │ ├── integer.hpp │ │ ├── integer.inl │ │ ├── intersect.hpp │ │ ├── intersect.inl │ │ ├── io.hpp │ │ ├── io.inl │ │ ├── log_base.hpp │ │ ├── log_base.inl │ │ ├── matrix_cross_product.hpp │ │ ├── matrix_cross_product.inl │ │ ├── matrix_decompose.hpp │ │ ├── matrix_decompose.inl │ │ ├── matrix_factorisation.hpp │ │ ├── matrix_factorisation.inl │ │ ├── matrix_interpolation.hpp │ │ ├── matrix_interpolation.inl │ │ ├── matrix_major_storage.hpp │ │ ├── matrix_major_storage.inl │ │ ├── matrix_operation.hpp │ │ ├── matrix_operation.inl │ │ ├── matrix_query.hpp │ │ ├── matrix_query.inl │ │ ├── matrix_transform_2d.hpp │ │ ├── matrix_transform_2d.inl │ │ ├── mixed_product.hpp │ │ ├── mixed_product.inl │ │ ├── norm.hpp │ │ ├── norm.inl │ │ ├── normal.hpp │ │ ├── normal.inl │ │ ├── normalize_dot.hpp │ │ ├── normalize_dot.inl │ │ ├── number_precision.hpp │ │ ├── number_precision.inl │ │ ├── optimum_pow.hpp │ │ ├── optimum_pow.inl │ │ ├── orthonormalize.hpp │ │ ├── orthonormalize.inl │ │ ├── perpendicular.hpp │ │ ├── perpendicular.inl │ │ ├── polar_coordinates.hpp │ │ ├── polar_coordinates.inl │ │ ├── projection.hpp │ │ ├── projection.inl │ │ ├── quaternion.hpp │ │ ├── quaternion.inl │ │ ├── range.hpp │ │ ├── raw_data.hpp │ │ ├── raw_data.inl │ │ ├── rotate_normalized_axis.hpp │ │ ├── rotate_normalized_axis.inl │ │ ├── rotate_vector.hpp │ │ ├── rotate_vector.inl │ │ ├── scalar_multiplication.hpp │ │ ├── scalar_relational.hpp │ │ ├── scalar_relational.inl │ │ ├── spline.hpp │ │ ├── spline.inl │ │ ├── std_based_type.hpp │ │ ├── std_based_type.inl │ │ ├── string_cast.hpp │ │ ├── string_cast.inl │ │ ├── texture.hpp │ │ ├── texture.inl │ │ ├── transform.hpp │ │ ├── transform.inl │ │ ├── transform2.hpp │ │ ├── transform2.inl │ │ ├── type_aligned.hpp │ │ ├── type_aligned.inl │ │ ├── type_trait.hpp │ │ ├── type_trait.inl │ │ ├── vec_swizzle.hpp │ │ ├── vector_angle.hpp │ │ ├── vector_angle.inl │ │ ├── vector_query.hpp │ │ ├── vector_query.inl │ │ ├── wrap.hpp │ │ └── wrap.inl │ ├── integer.hpp │ ├── mat2x2.hpp │ ├── mat2x3.hpp │ ├── mat2x4.hpp │ ├── mat3x2.hpp │ ├── mat3x3.hpp │ ├── mat3x4.hpp │ ├── mat4x2.hpp │ ├── mat4x3.hpp │ ├── mat4x4.hpp │ ├── matrix.hpp │ ├── packing.hpp │ ├── simd │ │ ├── common.h │ │ ├── exponential.h │ │ ├── geometric.h │ │ ├── integer.h │ │ ├── matrix.h │ │ ├── packing.h │ │ ├── platform.h │ │ ├── trigonometric.h │ │ └── vector_relational.h │ ├── trigonometric.hpp │ ├── vec2.hpp │ ├── vec3.hpp │ ├── vec4.hpp │ └── vector_relational.hpp ├── json │ └── json.hpp ├── re │ ├── animation │ │ ├── animation.h │ │ └── animation_utils.h │ ├── audio │ │ ├── audio.h │ │ └── audio_helper.h │ ├── camera │ │ ├── camera2d.h │ │ ├── camera_manager.cpp │ │ └── camera_manager.h │ ├── collision │ │ ├── collision_context.cpp │ │ ├── collision_context.h │ │ └── collision_utils.h │ ├── data │ │ ├── asset_manager.cpp │ │ ├── asset_manager.h │ │ └── constants.h │ ├── ecs │ │ ├── component │ │ │ ├── component.h │ │ │ ├── component_array.h │ │ │ ├── component_manager.cpp │ │ │ ├── component_manager.h │ │ │ └── components │ │ │ │ ├── animated_sprite_component.h │ │ │ │ ├── collider_component.h │ │ │ │ ├── node_component.h │ │ │ │ ├── scene_component.h │ │ │ │ ├── sprite_component.h │ │ │ │ ├── text_label_component.h │ │ │ │ └── transform2d_component.h │ │ ├── ecs_orchestrator.cpp │ │ ├── ecs_orchestrator.h │ │ ├── entity │ │ │ ├── entity.h │ │ │ ├── entity_manager.cpp │ │ │ ├── entity_manager.h │ │ │ └── entity_tag_cache.h │ │ └── system │ │ │ ├── ec_system.h │ │ │ ├── ec_system_manager.h │ │ │ └── systems │ │ │ ├── animated_sprite_rendering_ec_system.h │ │ │ ├── collision_ec_system.h │ │ │ ├── sprite_rendering_ec_system.h │ │ │ └── text_rendering_ec_system.h │ ├── game_engine_context.cpp │ ├── game_engine_context.h │ ├── input │ │ ├── input_action.h │ │ ├── input_event_state.h │ │ ├── input_manager.cpp │ │ ├── input_manager.h │ │ ├── joystick_input.cpp │ │ ├── joystick_input.h │ │ ├── keyboard_input.h │ │ ├── mouse_input.cpp │ │ └── mouse_input.h │ ├── math │ │ ├── physics.h │ │ ├── rectangle.cpp │ │ ├── rectangle.h │ │ └── redmath.h │ ├── project_properties.cpp │ ├── project_properties.h │ ├── python │ │ ├── pyhelper.hpp │ │ ├── python_modules.cpp │ │ ├── python_modules.h │ │ └── python_object_manager.h │ ├── rendering │ │ ├── color.h │ │ ├── font.h │ │ ├── font_renderer.cpp │ │ ├── font_renderer.h │ │ ├── render_context.cpp │ │ ├── render_context.h │ │ ├── renderer_2d.cpp │ │ ├── renderer_2d.h │ │ ├── renderer_batcher.cpp │ │ ├── renderer_batcher.h │ │ ├── shader.cpp │ │ ├── shader.h │ │ ├── sprite_renderer.cpp │ │ ├── sprite_renderer.h │ │ ├── texture.cpp │ │ └── texture.h │ ├── scene │ │ ├── scene.h │ │ ├── scene_loader.cpp │ │ ├── scene_loader.h │ │ ├── scene_manager.cpp │ │ ├── scene_manager.h │ │ └── scene_node_utils.h │ └── utils │ │ ├── file_helper.h │ │ ├── fps_counter.cpp │ │ ├── fps_counter.h │ │ ├── helper.h │ │ ├── json_helper.h │ │ ├── logger.cpp │ │ ├── logger.h │ │ ├── singleton.h │ │ ├── timer.cpp │ │ └── timer.h └── stb_image │ ├── stb_image.cpp │ └── stb_image.h ├── mkdocs.yml └── src ├── 1.foundation ├── 1.embedding_python │ ├── 1.0.hello_python │ │ ├── Makefile │ │ └── src │ │ │ └── main.cpp │ ├── 1.1.calling_a_function │ │ ├── Makefile │ │ ├── assets │ │ │ └── scripts │ │ │ │ └── game.py │ │ └── src │ │ │ └── main.cpp │ ├── 1.2.using_pyhelper │ │ ├── Makefile │ │ ├── assets │ │ │ └── scripts │ │ │ │ └── game.py │ │ └── src │ │ │ ├── main.cpp │ │ │ └── scripting │ │ │ └── pyhelper.hpp │ ├── 1.3.create_python_instance │ │ ├── Makefile │ │ ├── assets │ │ │ └── scripts │ │ │ │ └── game.py │ │ └── src │ │ │ ├── main.cpp │ │ │ └── scripting │ │ │ ├── pyhelper.hpp │ │ │ └── python_object_manager.h │ └── 1.4.create_custom_module │ │ ├── Makefile │ │ ├── assets │ │ └── scripts │ │ │ └── game.py │ │ └── src │ │ └── main.cpp ├── 2.game_loop_and_sdl │ └── 2.0.game_loop_and_sdl │ │ ├── Makefile │ │ ├── assets │ │ └── scripts │ │ │ └── game.py │ │ └── src │ │ ├── fps_counter.cpp │ │ ├── fps_counter.h │ │ ├── game_engine.cpp │ │ ├── game_engine.h │ │ └── main.cpp ├── 3.opengl_rendering │ ├── 3.0.rendering_sprites │ │ ├── Makefile │ │ ├── assets │ │ │ ├── images │ │ │ │ └── melissa_walk_animation.png │ │ │ └── scripts │ │ │ │ └── game.py │ │ └── src │ │ │ ├── asset_manager.cpp │ │ │ ├── asset_manager.h │ │ │ ├── game_engine.cpp │ │ │ ├── game_engine.h │ │ │ ├── main.cpp │ │ │ ├── render_context.cpp │ │ │ ├── render_context.h │ │ │ ├── renderer_2d.cpp │ │ │ ├── renderer_2d.h │ │ │ ├── renderer_batcher.cpp │ │ │ ├── renderer_batcher.h │ │ │ ├── sprite_renderer.cpp │ │ │ └── sprite_renderer.h │ └── 3.1.rendering_text │ │ ├── Makefile │ │ ├── assets │ │ ├── fonts │ │ │ └── verdana.ttf │ │ ├── images │ │ │ └── melissa_walk_animation.png │ │ └── scripts │ │ │ └── game.py │ │ └── src │ │ ├── asset_manager.cpp │ │ ├── asset_manager.h │ │ ├── game_engine.cpp │ │ ├── game_engine.h │ │ ├── main.cpp │ │ ├── renderer_2d.cpp │ │ └── renderer_2d.h ├── 4.implementing_audio │ └── 4.0.sdl_mixer │ │ ├── Makefile │ │ ├── assets │ │ ├── audio │ │ │ ├── music │ │ │ │ └── test_music.wav │ │ │ └── sound │ │ │ │ └── test_sound_effect.wav │ │ ├── fonts │ │ │ └── verdana.ttf │ │ ├── images │ │ │ └── melissa_walk_animation.png │ │ └── scripts │ │ │ └── game.py │ │ └── src │ │ ├── asset_manager.cpp │ │ ├── asset_manager.h │ │ ├── audio_helper.h │ │ ├── game_engine.cpp │ │ ├── game_engine.h │ │ └── main.cpp ├── 5.input_management │ └── 5.0.input_management │ │ ├── Makefile │ │ ├── assets │ │ ├── audio │ │ │ ├── music │ │ │ │ └── test_music.wav │ │ │ └── sound │ │ │ │ └── test_sound_effect.wav │ │ ├── fonts │ │ │ └── verdana.ttf │ │ ├── images │ │ │ └── melissa_walk_animation.png │ │ ├── resources │ │ │ └── game_controller_db.txt │ │ └── scripts │ │ │ └── game.py │ │ └── src │ │ ├── asset_manager.cpp │ │ ├── asset_manager.h │ │ ├── audio_helper.h │ │ ├── game_engine.cpp │ │ ├── game_engine.h │ │ └── main.cpp ├── 6.entity_component_system │ └── 6.0.entity_component_system │ │ ├── Makefile │ │ ├── assets │ │ ├── audio │ │ │ ├── music │ │ │ │ └── test_music.wav │ │ │ └── sound │ │ │ │ └── test_sound_effect.wav │ │ ├── fonts │ │ │ └── verdana.ttf │ │ ├── images │ │ │ └── melissa_walk_animation.png │ │ ├── resources │ │ │ └── game_controller_db.txt │ │ └── scripts │ │ │ └── game.py │ │ └── src │ │ ├── audio_helper.h │ │ ├── ecs_orchestrator.cpp │ │ ├── ecs_orchestrator.h │ │ ├── game_engine.cpp │ │ ├── game_engine.h │ │ └── main.cpp ├── 7.serializing_with_json │ ├── 7.0.parsing_json_properties_file │ │ ├── Makefile │ │ ├── assets │ │ │ ├── audio │ │ │ │ ├── music │ │ │ │ │ └── test_music.wav │ │ │ │ └── sound │ │ │ │ │ └── test_sound_effect.wav │ │ │ ├── fonts │ │ │ │ └── verdana.ttf │ │ │ ├── images │ │ │ │ └── melissa_walk_animation.png │ │ │ ├── resources │ │ │ │ └── game_controller_db.txt │ │ │ └── scripts │ │ │ │ └── game.py │ │ ├── properties.json │ │ └── src │ │ │ ├── game_engine.cpp │ │ │ ├── game_engine.h │ │ │ └── main.cpp │ └── 7.1.creating_scene_json_files │ │ ├── Makefile │ │ ├── assets │ │ ├── audio │ │ │ ├── music │ │ │ │ └── test_music.wav │ │ │ └── sound │ │ │ │ └── test_sound_effect.wav │ │ ├── fonts │ │ │ └── verdana.ttf │ │ ├── images │ │ │ └── melissa_walk_animation.png │ │ ├── resources │ │ │ └── game_controller_db.txt │ │ └── scripts │ │ │ └── game.py │ │ ├── properties.json │ │ ├── scenes │ │ └── main.json │ │ └── src │ │ ├── game_engine.cpp │ │ ├── game_engine.h │ │ └── main.cpp ├── 8.animations │ └── 8.0.animation_system │ │ ├── Makefile │ │ ├── assets │ │ ├── audio │ │ │ ├── music │ │ │ │ └── test_music.wav │ │ │ └── sound │ │ │ │ └── test_sound_effect.wav │ │ ├── fonts │ │ │ └── verdana.ttf │ │ ├── images │ │ │ └── melissa_walk_animation.png │ │ ├── resources │ │ │ └── game_controller_db.txt │ │ └── scripts │ │ │ └── game.py │ │ ├── properties.json │ │ ├── scenes │ │ └── main.json │ │ └── src │ │ ├── game_engine.cpp │ │ ├── game_engine.h │ │ └── main.cpp └── 9.collisions │ └── 9.0.collision_system │ ├── Makefile │ ├── assets │ ├── audio │ │ ├── music │ │ │ └── test_music.wav │ │ └── sound │ │ │ └── test_sound_effect.wav │ ├── fonts │ │ └── verdana.ttf │ ├── images │ │ └── melissa_walk_animation.png │ ├── resources │ │ └── game_controller_db.txt │ └── scripts │ │ └── game.py │ ├── properties.json │ ├── scenes │ └── main.json │ └── src │ ├── game_engine.cpp │ ├── game_engine.h │ └── main.cpp ├── 2.engine_api └── README.md └── 3.games └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.exe 3 | *.dll 4 | 5 | red_engine 6 | 7 | .idea 8 | 9 | temp 10 | export_package 11 | site 12 | 13 | __pycache__ 14 | venv 15 | 16 | 0.0.workspace 17 | -------------------------------------------------------------------------------- /assets/images/screenshots/led_3_0.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chukobyte/learn-engine-dev/3f4437ed4abab9011d584bdc0ab4eff921393f00/assets/images/screenshots/led_3_0.PNG -------------------------------------------------------------------------------- /assets/images/screenshots/led_3_1.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chukobyte/learn-engine-dev/3f4437ed4abab9011d584bdc0ab4eff921393f00/assets/images/screenshots/led_3_1.PNG -------------------------------------------------------------------------------- /assets/images/screenshots/led_8_0.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chukobyte/learn-engine-dev/3f4437ed4abab9011d584bdc0ab4eff921393f00/assets/images/screenshots/led_8_0.gif -------------------------------------------------------------------------------- /docs/1.foundation/8.animations/animation_system.md: -------------------------------------------------------------------------------- 1 | # Animation System 2 | 3 | ## Coming Soon 4 | 5 | Source for this section can be found [here](https://github.com/Chukobyte/learn-engine-dev/tree/main/src/1.foundation/8.animations/8.0.animation_system). 6 | -------------------------------------------------------------------------------- /docs/1.foundation/9.collisions/collision_system.md: -------------------------------------------------------------------------------- 1 | # Collision System 2 | 3 | ## Coming Soon 4 | 5 | Source for this section can be found [here](https://github.com/Chukobyte/learn-engine-dev/tree/main/src/1.foundation/9.collisions/9.0.collision_system). 6 | -------------------------------------------------------------------------------- /docs/2.engine_api/about.md: -------------------------------------------------------------------------------- 1 | # Engine API 2 | 3 | Coming soon... 4 | -------------------------------------------------------------------------------- /docs/3.games/about.md: -------------------------------------------------------------------------------- 1 | # Games 2 | 3 | Coming soon... 4 | -------------------------------------------------------------------------------- /docs/source_code/source_code.md: -------------------------------------------------------------------------------- 1 | # Source Code 2 | 3 | The full source code of the tutorials are on github and can be found [here](https://github.com/Chukobyte/learn-engine-dev). 4 | -------------------------------------------------------------------------------- /docs/theme/main.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block analytics %} 4 | 5 | {% set analytics = config.google_analytics %} 6 | 7 | 28 | {% endblock %} 29 | -------------------------------------------------------------------------------- /include/glm/detail/_fixes.hpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | //! Workaround for compatibility with other libraries 4 | #ifdef max 5 | #undef max 6 | #endif 7 | 8 | //! Workaround for compatibility with other libraries 9 | #ifdef min 10 | #undef min 11 | #endif 12 | 13 | //! Workaround for Android 14 | #ifdef isnan 15 | #undef isnan 16 | #endif 17 | 18 | //! Workaround for Android 19 | #ifdef isinf 20 | #undef isinf 21 | #endif 22 | 23 | //! Workaround for Chrone Native Client 24 | #ifdef log2 25 | #undef log2 26 | #endif 27 | 28 | -------------------------------------------------------------------------------- /include/glm/detail/compute_common.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "setup.hpp" 4 | #include 5 | 6 | namespace glm{ 7 | namespace detail 8 | { 9 | template 10 | struct compute_abs 11 | {}; 12 | 13 | template 14 | struct compute_abs 15 | { 16 | GLM_FUNC_QUALIFIER GLM_CONSTEXPR static genFIType call(genFIType x) 17 | { 18 | GLM_STATIC_ASSERT( 19 | std::numeric_limits::is_iec559 || std::numeric_limits::is_signed, 20 | "'abs' only accept floating-point and integer scalar or vector inputs"); 21 | 22 | return x >= genFIType(0) ? x : -x; 23 | // TODO, perf comp with: *(((int *) &x) + 1) &= 0x7fffffff; 24 | } 25 | }; 26 | 27 | #if GLM_COMPILER & GLM_COMPILER_CUDA 28 | template<> 29 | struct compute_abs 30 | { 31 | GLM_FUNC_QUALIFIER GLM_CONSTEXPR static float call(float x) 32 | { 33 | return fabsf(x); 34 | } 35 | }; 36 | #endif 37 | 38 | template 39 | struct compute_abs 40 | { 41 | GLM_FUNC_QUALIFIER GLM_CONSTEXPR static genFIType call(genFIType x) 42 | { 43 | GLM_STATIC_ASSERT( 44 | (!std::numeric_limits::is_signed && std::numeric_limits::is_integer), 45 | "'abs' only accept floating-point and integer scalar or vector inputs"); 46 | return x; 47 | } 48 | }; 49 | }//namespace detail 50 | }//namespace glm 51 | -------------------------------------------------------------------------------- /include/glm/detail/compute_vector_relational.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | //#include "compute_common.hpp" 4 | #include "setup.hpp" 5 | #include 6 | 7 | namespace glm{ 8 | namespace detail 9 | { 10 | template 11 | struct compute_equal 12 | { 13 | GLM_FUNC_QUALIFIER GLM_CONSTEXPR static bool call(T a, T b) 14 | { 15 | return a == b; 16 | } 17 | }; 18 | /* 19 | template 20 | struct compute_equal 21 | { 22 | GLM_FUNC_QUALIFIER GLM_CONSTEXPR static bool call(T a, T b) 23 | { 24 | return detail::compute_abs::is_signed>::call(b - a) <= static_cast(0); 25 | //return std::memcmp(&a, &b, sizeof(T)) == 0; 26 | } 27 | }; 28 | */ 29 | }//namespace detail 30 | }//namespace glm 31 | -------------------------------------------------------------------------------- /include/glm/detail/func_exponential_simd.inl: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/detail/func_exponential_simd.inl 3 | 4 | #include "../simd/exponential.h" 5 | 6 | #if GLM_ARCH & GLM_ARCH_SSE2_BIT 7 | 8 | namespace glm{ 9 | namespace detail 10 | { 11 | template 12 | struct compute_sqrt<4, float, Q, true> 13 | { 14 | GLM_FUNC_QUALIFIER static vec<4, float, Q> call(vec<4, float, Q> const& v) 15 | { 16 | vec<4, float, Q> Result; 17 | Result.data = _mm_sqrt_ps(v.data); 18 | return Result; 19 | } 20 | }; 21 | 22 | # if GLM_CONFIG_ALIGNED_GENTYPES == GLM_ENABLE 23 | template<> 24 | struct compute_sqrt<4, float, aligned_lowp, true> 25 | { 26 | GLM_FUNC_QUALIFIER static vec<4, float, aligned_lowp> call(vec<4, float, aligned_lowp> const& v) 27 | { 28 | vec<4, float, aligned_lowp> Result; 29 | Result.data = glm_vec4_sqrt_lowp(v.data); 30 | return Result; 31 | } 32 | }; 33 | # endif 34 | }//namespace detail 35 | }//namespace glm 36 | 37 | #endif//GLM_ARCH & GLM_ARCH_SSE2_BIT 38 | -------------------------------------------------------------------------------- /include/glm/detail/func_packing_simd.inl: -------------------------------------------------------------------------------- 1 | namespace glm{ 2 | namespace detail 3 | { 4 | 5 | }//namespace detail 6 | }//namespace glm 7 | -------------------------------------------------------------------------------- /include/glm/detail/func_trigonometric_simd.inl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chukobyte/learn-engine-dev/3f4437ed4abab9011d584bdc0ab4eff921393f00/include/glm/detail/func_trigonometric_simd.inl -------------------------------------------------------------------------------- /include/glm/detail/func_vector_relational_simd.inl: -------------------------------------------------------------------------------- 1 | namespace glm{ 2 | namespace detail 3 | { 4 | 5 | }//namespace detail 6 | }//namespace glm 7 | -------------------------------------------------------------------------------- /include/glm/detail/type_half.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "setup.hpp" 4 | 5 | namespace glm{ 6 | namespace detail 7 | { 8 | typedef short hdata; 9 | 10 | GLM_FUNC_DECL float toFloat32(hdata value); 11 | GLM_FUNC_DECL hdata toFloat16(float const& value); 12 | 13 | }//namespace detail 14 | }//namespace glm 15 | 16 | #include "type_half.inl" 17 | -------------------------------------------------------------------------------- /include/glm/detail/type_mat4x4_simd.inl: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | 3 | namespace glm 4 | { 5 | 6 | }//namespace glm 7 | -------------------------------------------------------------------------------- /include/glm/ext/matrix_common.hpp: -------------------------------------------------------------------------------- 1 | /// @ref ext_matrix_common 2 | /// @file glm/ext/matrix_common.hpp 3 | /// 4 | /// @defgroup ext_matrix_common GLM_EXT_matrix_common 5 | /// @ingroup ext 6 | /// 7 | /// Defines functions for common matrix operations. 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// @see ext_matrix_common 12 | 13 | #pragma once 14 | 15 | #include "../detail/qualifier.hpp" 16 | #include "../detail/_fixes.hpp" 17 | 18 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 19 | # pragma message("GLM: GLM_EXT_matrix_transform extension included") 20 | #endif 21 | 22 | namespace glm 23 | { 24 | /// @addtogroup ext_matrix_common 25 | /// @{ 26 | 27 | template 28 | GLM_FUNC_DECL mat mix(mat const& x, mat const& y, mat const& a); 29 | 30 | template 31 | GLM_FUNC_DECL mat mix(mat const& x, mat const& y, U a); 32 | 33 | /// @} 34 | }//namespace glm 35 | 36 | #include "matrix_common.inl" 37 | -------------------------------------------------------------------------------- /include/glm/ext/matrix_common.inl: -------------------------------------------------------------------------------- 1 | #include "../matrix.hpp" 2 | 3 | namespace glm 4 | { 5 | template 6 | GLM_FUNC_QUALIFIER mat mix(mat const& x, mat const& y, U a) 7 | { 8 | return mat(x) * (static_cast(1) - a) + mat(y) * a; 9 | } 10 | 11 | template 12 | GLM_FUNC_QUALIFIER mat mix(mat const& x, mat const& y, mat const& a) 13 | { 14 | return matrixCompMult(mat(x), static_cast(1) - a) + matrixCompMult(mat(y), a); 15 | } 16 | }//namespace glm 17 | -------------------------------------------------------------------------------- /include/glm/ext/matrix_double2x2.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/matrix_double2x2.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_mat2x2.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_matrix 10 | /// @{ 11 | 12 | /// 2 columns of 2 components matrix of double-precision floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 15 | typedef mat<2, 2, double, defaultp> dmat2x2; 16 | 17 | /// 2 columns of 2 components matrix of double-precision floating-point numbers. 18 | /// 19 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 20 | typedef mat<2, 2, double, defaultp> dmat2; 21 | 22 | /// @} 23 | }//namespace glm 24 | -------------------------------------------------------------------------------- /include/glm/ext/matrix_double2x3.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/matrix_double2x3.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_mat2x3.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_matrix 10 | /// @{ 11 | 12 | /// 2 columns of 3 components matrix of double-precision floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 15 | typedef mat<2, 3, double, defaultp> dmat2x3; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /include/glm/ext/matrix_double2x4.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/matrix_double2x4.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_mat2x4.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_matrix 10 | /// @{ 11 | 12 | /// 2 columns of 4 components matrix of double-precision floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 15 | typedef mat<2, 4, double, defaultp> dmat2x4; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /include/glm/ext/matrix_double3x2.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/matrix_double3x2.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_mat3x2.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_matrix 10 | /// @{ 11 | 12 | /// 3 columns of 2 components matrix of double-precision floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 15 | typedef mat<3, 2, double, defaultp> dmat3x2; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /include/glm/ext/matrix_double3x3.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/matrix_double3x3.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_mat3x3.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_matrix 10 | /// @{ 11 | 12 | /// 3 columns of 3 components matrix of double-precision floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 15 | typedef mat<3, 3, double, defaultp> dmat3x3; 16 | 17 | /// 3 columns of 3 components matrix of double-precision floating-point numbers. 18 | /// 19 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 20 | typedef mat<3, 3, double, defaultp> dmat3; 21 | 22 | /// @} 23 | }//namespace glm 24 | -------------------------------------------------------------------------------- /include/glm/ext/matrix_double3x4.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/matrix_double3x4.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_mat3x4.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_matrix 10 | /// @{ 11 | 12 | /// 3 columns of 4 components matrix of double-precision floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 15 | typedef mat<3, 4, double, defaultp> dmat3x4; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /include/glm/ext/matrix_double4x2.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/matrix_double4x2.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_mat4x2.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_matrix 10 | /// @{ 11 | 12 | /// 4 columns of 2 components matrix of double-precision floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 15 | typedef mat<4, 2, double, defaultp> dmat4x2; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /include/glm/ext/matrix_double4x3.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/matrix_double4x3.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_mat4x3.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_matrix 10 | /// @{ 11 | 12 | /// 4 columns of 3 components matrix of double-precision floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 15 | typedef mat<4, 3, double, defaultp> dmat4x3; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /include/glm/ext/matrix_double4x4.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/matrix_double4x4.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_mat4x4.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_matrix 10 | /// @{ 11 | 12 | /// 4 columns of 4 components matrix of double-precision floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 15 | typedef mat<4, 4, double, defaultp> dmat4x4; 16 | 17 | /// 4 columns of 4 components matrix of double-precision floating-point numbers. 18 | /// 19 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 20 | typedef mat<4, 4, double, defaultp> dmat4; 21 | 22 | /// @} 23 | }//namespace glm 24 | -------------------------------------------------------------------------------- /include/glm/ext/matrix_float2x2.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/matrix_float2x2.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_mat2x2.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_matrix 10 | /// @{ 11 | 12 | /// 2 columns of 2 components matrix of single-precision floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 15 | typedef mat<2, 2, float, defaultp> mat2x2; 16 | 17 | /// 2 columns of 2 components matrix of single-precision floating-point numbers. 18 | /// 19 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 20 | typedef mat<2, 2, float, defaultp> mat2; 21 | 22 | /// @} 23 | }//namespace glm 24 | -------------------------------------------------------------------------------- /include/glm/ext/matrix_float2x3.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/matrix_float2x3.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_mat2x3.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_matrix 10 | /// @{ 11 | 12 | /// 2 columns of 3 components matrix of single-precision floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 15 | typedef mat<2, 3, float, defaultp> mat2x3; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /include/glm/ext/matrix_float2x4.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/matrix_float2x4.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_mat2x4.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_matrix 10 | /// @{ 11 | 12 | /// 2 columns of 4 components matrix of single-precision floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 15 | typedef mat<2, 4, float, defaultp> mat2x4; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /include/glm/ext/matrix_float3x2.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/matrix_float3x2.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_mat3x2.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core 10 | /// @{ 11 | 12 | /// 3 columns of 2 components matrix of single-precision floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 15 | typedef mat<3, 2, float, defaultp> mat3x2; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /include/glm/ext/matrix_float3x3.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/matrix_float3x3.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_mat3x3.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_matrix 10 | /// @{ 11 | 12 | /// 3 columns of 3 components matrix of single-precision floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 15 | typedef mat<3, 3, float, defaultp> mat3x3; 16 | 17 | /// 3 columns of 3 components matrix of single-precision floating-point numbers. 18 | /// 19 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 20 | typedef mat<3, 3, float, defaultp> mat3; 21 | 22 | /// @} 23 | }//namespace glm 24 | -------------------------------------------------------------------------------- /include/glm/ext/matrix_float3x4.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/matrix_float3x4.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_mat3x4.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_matrix 10 | /// @{ 11 | 12 | /// 3 columns of 4 components matrix of single-precision floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 15 | typedef mat<3, 4, float, defaultp> mat3x4; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /include/glm/ext/matrix_float4x2.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/matrix_float4x2.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_mat4x2.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_matrix 10 | /// @{ 11 | 12 | /// 4 columns of 2 components matrix of single-precision floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 15 | typedef mat<4, 2, float, defaultp> mat4x2; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /include/glm/ext/matrix_float4x3.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/matrix_float4x3.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_mat4x3.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_matrix 10 | /// @{ 11 | 12 | /// 4 columns of 3 components matrix of single-precision floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 15 | typedef mat<4, 3, float, defaultp> mat4x3; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /include/glm/ext/matrix_float4x4.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/matrix_float4x4.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_mat4x4.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @ingroup core_matrix 10 | /// @{ 11 | 12 | /// 4 columns of 4 components matrix of single-precision floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 15 | typedef mat<4, 4, float, defaultp> mat4x4; 16 | 17 | /// 4 columns of 4 components matrix of single-precision floating-point numbers. 18 | /// 19 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 20 | typedef mat<4, 4, float, defaultp> mat4; 21 | 22 | /// @} 23 | }//namespace glm 24 | -------------------------------------------------------------------------------- /include/glm/ext/quaternion_common_simd.inl: -------------------------------------------------------------------------------- 1 | #if GLM_ARCH & GLM_ARCH_SSE2_BIT 2 | 3 | namespace glm{ 4 | namespace detail 5 | { 6 | template 7 | struct compute_dot, float, true> 8 | { 9 | static GLM_FUNC_QUALIFIER float call(qua const& x, qua const& y) 10 | { 11 | return _mm_cvtss_f32(glm_vec1_dot(x.data, y.data)); 12 | } 13 | }; 14 | }//namespace detail 15 | }//namespace glm 16 | 17 | #endif//GLM_ARCH & GLM_ARCH_SSE2_BIT 18 | 19 | -------------------------------------------------------------------------------- /include/glm/ext/quaternion_double.hpp: -------------------------------------------------------------------------------- 1 | /// @ref ext_quaternion_double 2 | /// @file glm/ext/quaternion_double.hpp 3 | /// 4 | /// @defgroup ext_quaternion_double GLM_EXT_quaternion_double 5 | /// @ingroup ext 6 | /// 7 | /// Exposes double-precision floating point quaternion type. 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// @see ext_quaternion_float 12 | /// @see ext_quaternion_double_precision 13 | /// @see ext_quaternion_common 14 | /// @see ext_quaternion_exponential 15 | /// @see ext_quaternion_geometric 16 | /// @see ext_quaternion_relational 17 | /// @see ext_quaternion_transform 18 | /// @see ext_quaternion_trigonometric 19 | 20 | #pragma once 21 | 22 | // Dependency: 23 | #include "../detail/type_quat.hpp" 24 | 25 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 26 | # pragma message("GLM: GLM_EXT_quaternion_double extension included") 27 | #endif 28 | 29 | namespace glm 30 | { 31 | /// @addtogroup ext_quaternion_double 32 | /// @{ 33 | 34 | /// Quaternion of double-precision floating-point numbers. 35 | typedef qua dquat; 36 | 37 | /// @} 38 | } //namespace glm 39 | 40 | -------------------------------------------------------------------------------- /include/glm/ext/quaternion_double_precision.hpp: -------------------------------------------------------------------------------- 1 | /// @ref ext_quaternion_double_precision 2 | /// @file glm/ext/quaternion_double_precision.hpp 3 | /// 4 | /// @defgroup ext_quaternion_double_precision GLM_EXT_quaternion_double_precision 5 | /// @ingroup ext 6 | /// 7 | /// Exposes double-precision floating point quaternion type with various precision in term of ULPs. 8 | /// 9 | /// Include to use the features of this extension. 10 | 11 | #pragma once 12 | 13 | // Dependency: 14 | #include "../detail/type_quat.hpp" 15 | 16 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 17 | # pragma message("GLM: GLM_EXT_quaternion_double_precision extension included") 18 | #endif 19 | 20 | namespace glm 21 | { 22 | /// @addtogroup ext_quaternion_double_precision 23 | /// @{ 24 | 25 | /// Quaternion of double-precision floating-point numbers using high precision arithmetic in term of ULPs. 26 | /// 27 | /// @see ext_quaternion_double_precision 28 | typedef qua lowp_dquat; 29 | 30 | /// Quaternion of medium double-qualifier floating-point numbers using high precision arithmetic in term of ULPs. 31 | /// 32 | /// @see ext_quaternion_double_precision 33 | typedef qua mediump_dquat; 34 | 35 | /// Quaternion of high double-qualifier floating-point numbers using high precision arithmetic in term of ULPs. 36 | /// 37 | /// @see ext_quaternion_double_precision 38 | typedef qua highp_dquat; 39 | 40 | /// @} 41 | } //namespace glm 42 | 43 | -------------------------------------------------------------------------------- /include/glm/ext/quaternion_float.hpp: -------------------------------------------------------------------------------- 1 | /// @ref ext_quaternion_float 2 | /// @file glm/ext/quaternion_float.hpp 3 | /// 4 | /// @defgroup ext_quaternion_float GLM_EXT_quaternion_float 5 | /// @ingroup ext 6 | /// 7 | /// Exposes single-precision floating point quaternion type. 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// @see ext_quaternion_double 12 | /// @see ext_quaternion_float_precision 13 | /// @see ext_quaternion_common 14 | /// @see ext_quaternion_exponential 15 | /// @see ext_quaternion_geometric 16 | /// @see ext_quaternion_relational 17 | /// @see ext_quaternion_transform 18 | /// @see ext_quaternion_trigonometric 19 | 20 | #pragma once 21 | 22 | // Dependency: 23 | #include "../detail/type_quat.hpp" 24 | 25 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 26 | # pragma message("GLM: GLM_EXT_quaternion_float extension included") 27 | #endif 28 | 29 | namespace glm 30 | { 31 | /// @addtogroup ext_quaternion_float 32 | /// @{ 33 | 34 | /// Quaternion of single-precision floating-point numbers. 35 | typedef qua quat; 36 | 37 | /// @} 38 | } //namespace glm 39 | 40 | -------------------------------------------------------------------------------- /include/glm/ext/quaternion_float_precision.hpp: -------------------------------------------------------------------------------- 1 | /// @ref ext_quaternion_float_precision 2 | /// @file glm/ext/quaternion_float_precision.hpp 3 | /// 4 | /// @defgroup ext_quaternion_float_precision GLM_EXT_quaternion_float_precision 5 | /// @ingroup ext 6 | /// 7 | /// Exposes single-precision floating point quaternion type with various precision in term of ULPs. 8 | /// 9 | /// Include to use the features of this extension. 10 | 11 | #pragma once 12 | 13 | // Dependency: 14 | #include "../detail/type_quat.hpp" 15 | 16 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 17 | # pragma message("GLM: GLM_EXT_quaternion_float_precision extension included") 18 | #endif 19 | 20 | namespace glm 21 | { 22 | /// @addtogroup ext_quaternion_float_precision 23 | /// @{ 24 | 25 | /// Quaternion of single-precision floating-point numbers using high precision arithmetic in term of ULPs. 26 | typedef qua lowp_quat; 27 | 28 | /// Quaternion of single-precision floating-point numbers using high precision arithmetic in term of ULPs. 29 | typedef qua mediump_quat; 30 | 31 | /// Quaternion of single-precision floating-point numbers using high precision arithmetic in term of ULPs. 32 | typedef qua highp_quat; 33 | 34 | /// @} 35 | } //namespace glm 36 | 37 | -------------------------------------------------------------------------------- /include/glm/ext/quaternion_geometric.inl: -------------------------------------------------------------------------------- 1 | namespace glm 2 | { 3 | template 4 | GLM_FUNC_QUALIFIER T dot(qua const& x, qua const& y) 5 | { 6 | GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'dot' accepts only floating-point inputs"); 7 | return detail::compute_dot, T, detail::is_aligned::value>::call(x, y); 8 | } 9 | 10 | template 11 | GLM_FUNC_QUALIFIER T length(qua const& q) 12 | { 13 | return glm::sqrt(dot(q, q)); 14 | } 15 | 16 | template 17 | GLM_FUNC_QUALIFIER qua normalize(qua const& q) 18 | { 19 | T len = length(q); 20 | if(len <= static_cast(0)) // Problem 21 | return qua(static_cast(1), static_cast(0), static_cast(0), static_cast(0)); 22 | T oneOverLen = static_cast(1) / len; 23 | return qua(q.w * oneOverLen, q.x * oneOverLen, q.y * oneOverLen, q.z * oneOverLen); 24 | } 25 | 26 | template 27 | GLM_FUNC_QUALIFIER qua cross(qua const& q1, qua const& q2) 28 | { 29 | return qua( 30 | q1.w * q2.w - q1.x * q2.x - q1.y * q2.y - q1.z * q2.z, 31 | q1.w * q2.x + q1.x * q2.w + q1.y * q2.z - q1.z * q2.y, 32 | q1.w * q2.y + q1.y * q2.w + q1.z * q2.x - q1.x * q2.z, 33 | q1.w * q2.z + q1.z * q2.w + q1.x * q2.y - q1.y * q2.x); 34 | } 35 | }//namespace glm 36 | 37 | -------------------------------------------------------------------------------- /include/glm/ext/quaternion_relational.inl: -------------------------------------------------------------------------------- 1 | namespace glm 2 | { 3 | template 4 | GLM_FUNC_QUALIFIER vec<4, bool, Q> equal(qua const& x, qua const& y) 5 | { 6 | vec<4, bool, Q> Result; 7 | for(length_t i = 0; i < x.length(); ++i) 8 | Result[i] = x[i] == y[i]; 9 | return Result; 10 | } 11 | 12 | template 13 | GLM_FUNC_QUALIFIER vec<4, bool, Q> equal(qua const& x, qua const& y, T epsilon) 14 | { 15 | vec<4, T, Q> v(x.x - y.x, x.y - y.y, x.z - y.z, x.w - y.w); 16 | return lessThan(abs(v), vec<4, T, Q>(epsilon)); 17 | } 18 | 19 | template 20 | GLM_FUNC_QUALIFIER vec<4, bool, Q> notEqual(qua const& x, qua const& y) 21 | { 22 | vec<4, bool, Q> Result; 23 | for(length_t i = 0; i < x.length(); ++i) 24 | Result[i] = x[i] != y[i]; 25 | return Result; 26 | } 27 | 28 | template 29 | GLM_FUNC_QUALIFIER vec<4, bool, Q> notEqual(qua const& x, qua const& y, T epsilon) 30 | { 31 | vec<4, T, Q> v(x.x - y.x, x.y - y.y, x.z - y.z, x.w - y.w); 32 | return greaterThanEqual(abs(v), vec<4, T, Q>(epsilon)); 33 | } 34 | }//namespace glm 35 | 36 | -------------------------------------------------------------------------------- /include/glm/ext/quaternion_transform.hpp: -------------------------------------------------------------------------------- 1 | /// @ref ext_quaternion_transform 2 | /// @file glm/ext/quaternion_transform.hpp 3 | /// 4 | /// @defgroup ext_quaternion_transform GLM_EXT_quaternion_transform 5 | /// @ingroup ext 6 | /// 7 | /// Provides transformation functions for quaternion types 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// @see ext_quaternion_float 12 | /// @see ext_quaternion_double 13 | /// @see ext_quaternion_exponential 14 | /// @see ext_quaternion_geometric 15 | /// @see ext_quaternion_relational 16 | /// @see ext_quaternion_trigonometric 17 | 18 | #pragma once 19 | 20 | // Dependency: 21 | #include "../common.hpp" 22 | #include "../trigonometric.hpp" 23 | #include "../geometric.hpp" 24 | 25 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 26 | # pragma message("GLM: GLM_EXT_quaternion_transform extension included") 27 | #endif 28 | 29 | namespace glm 30 | { 31 | /// @addtogroup ext_quaternion_transform 32 | /// @{ 33 | 34 | /// Rotates a quaternion from a vector of 3 components axis and an angle. 35 | /// 36 | /// @param q Source orientation 37 | /// @param angle Angle expressed in radians. 38 | /// @param axis Axis of the rotation 39 | /// 40 | /// @tparam T Floating-point scalar types 41 | /// @tparam Q Value from qualifier enum 42 | template 43 | GLM_FUNC_DECL qua rotate(qua const& q, T const& angle, vec<3, T, Q> const& axis); 44 | /// @} 45 | } //namespace glm 46 | 47 | #include "quaternion_transform.inl" 48 | -------------------------------------------------------------------------------- /include/glm/ext/quaternion_transform.inl: -------------------------------------------------------------------------------- 1 | namespace glm 2 | { 3 | template 4 | GLM_FUNC_QUALIFIER qua rotate(qua const& q, T const& angle, vec<3, T, Q> const& v) 5 | { 6 | vec<3, T, Q> Tmp = v; 7 | 8 | // Axis of rotation must be normalised 9 | T len = glm::length(Tmp); 10 | if(abs(len - static_cast(1)) > static_cast(0.001)) 11 | { 12 | T oneOverLen = static_cast(1) / len; 13 | Tmp.x *= oneOverLen; 14 | Tmp.y *= oneOverLen; 15 | Tmp.z *= oneOverLen; 16 | } 17 | 18 | T const AngleRad(angle); 19 | T const Sin = sin(AngleRad * static_cast(0.5)); 20 | 21 | return q * qua(cos(AngleRad * static_cast(0.5)), Tmp.x * Sin, Tmp.y * Sin, Tmp.z * Sin); 22 | } 23 | }//namespace glm 24 | 25 | -------------------------------------------------------------------------------- /include/glm/ext/quaternion_trigonometric.inl: -------------------------------------------------------------------------------- 1 | namespace glm 2 | { 3 | template 4 | GLM_FUNC_QUALIFIER T angle(qua const& x) 5 | { 6 | return acos(x.w) * static_cast(2); 7 | } 8 | 9 | template 10 | GLM_FUNC_QUALIFIER vec<3, T, Q> axis(qua const& x) 11 | { 12 | T const tmp1 = static_cast(1) - x.w * x.w; 13 | if(tmp1 <= static_cast(0)) 14 | return vec<3, T, Q>(0, 0, 1); 15 | T const tmp2 = static_cast(1) / sqrt(tmp1); 16 | return vec<3, T, Q>(x.x * tmp2, x.y * tmp2, x.z * tmp2); 17 | } 18 | 19 | template 20 | GLM_FUNC_QUALIFIER qua angleAxis(T const& angle, vec<3, T, Q> const& v) 21 | { 22 | T const a(angle); 23 | T const s = glm::sin(a * static_cast(0.5)); 24 | 25 | return qua(glm::cos(a * static_cast(0.5)), v * s); 26 | } 27 | }//namespace glm 28 | -------------------------------------------------------------------------------- /include/glm/ext/scalar_constants.hpp: -------------------------------------------------------------------------------- 1 | /// @ref ext_scalar_constants 2 | /// @file glm/ext/scalar_constants.hpp 3 | /// 4 | /// @defgroup ext_scalar_constants GLM_EXT_scalar_constants 5 | /// @ingroup ext 6 | /// 7 | /// Provides a list of constants and precomputed useful values. 8 | /// 9 | /// Include to use the features of this extension. 10 | 11 | #pragma once 12 | 13 | // Dependencies 14 | #include "../detail/setup.hpp" 15 | 16 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 17 | # pragma message("GLM: GLM_EXT_scalar_constants extension included") 18 | #endif 19 | 20 | namespace glm 21 | { 22 | /// @addtogroup ext_scalar_constants 23 | /// @{ 24 | 25 | /// Return the epsilon constant for floating point types. 26 | template 27 | GLM_FUNC_DECL GLM_CONSTEXPR genType epsilon(); 28 | 29 | /// Return the pi constant for floating point types. 30 | template 31 | GLM_FUNC_DECL GLM_CONSTEXPR genType pi(); 32 | 33 | /// @} 34 | } //namespace glm 35 | 36 | #include "scalar_constants.inl" 37 | -------------------------------------------------------------------------------- /include/glm/ext/scalar_constants.inl: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | namespace glm 4 | { 5 | template 6 | GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType epsilon() 7 | { 8 | GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'epsilon' only accepts floating-point inputs"); 9 | return std::numeric_limits::epsilon(); 10 | } 11 | 12 | template 13 | GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType pi() 14 | { 15 | GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'epsilon' only accepts floating-point inputs"); 16 | return static_cast(3.14159265358979323846264338327950288); 17 | } 18 | } //namespace glm 19 | -------------------------------------------------------------------------------- /include/glm/ext/scalar_relational.inl: -------------------------------------------------------------------------------- 1 | #include "../common.hpp" 2 | #include "../ext/scalar_int_sized.hpp" 3 | #include "../ext/scalar_uint_sized.hpp" 4 | #include "../detail/type_float.hpp" 5 | 6 | namespace glm 7 | { 8 | template 9 | GLM_FUNC_QUALIFIER GLM_CONSTEXPR bool equal(genType const& x, genType const& y, genType const& epsilon) 10 | { 11 | return abs(x - y) <= epsilon; 12 | } 13 | 14 | template 15 | GLM_FUNC_QUALIFIER GLM_CONSTEXPR bool notEqual(genType const& x, genType const& y, genType const& epsilon) 16 | { 17 | return abs(x - y) > epsilon; 18 | } 19 | 20 | template 21 | GLM_FUNC_QUALIFIER GLM_CONSTEXPR bool equal(genType const& x, genType const& y, int MaxULPs) 22 | { 23 | detail::float_t const a(x); 24 | detail::float_t const b(y); 25 | 26 | // Different signs means they do not match. 27 | if(a.negative() != b.negative()) 28 | { 29 | // Check for equality to make sure +0==-0 30 | return a.mantissa() == b.mantissa() && a.exponent() == b.exponent(); 31 | } 32 | 33 | // Find the difference in ULPs. 34 | typename detail::float_t::int_type const DiffULPs = abs(a.i - b.i); 35 | return DiffULPs <= MaxULPs; 36 | } 37 | 38 | template 39 | GLM_FUNC_QUALIFIER GLM_CONSTEXPR bool notEqual(genType const& x, genType const& y, int ULPs) 40 | { 41 | return !equal(x, y, ULPs); 42 | } 43 | }//namespace glm 44 | -------------------------------------------------------------------------------- /include/glm/ext/vector_bool1.hpp: -------------------------------------------------------------------------------- 1 | /// @ref ext_vector_bool1 2 | /// @file glm/ext/vector_bool1.hpp 3 | /// 4 | /// @defgroup ext_vector_bool1 GLM_EXT_vector_bool1 5 | /// @ingroup ext 6 | /// 7 | /// Exposes bvec1 vector type. 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// @see ext_vector_bool1_precision extension. 12 | 13 | #pragma once 14 | 15 | #include "../detail/type_vec1.hpp" 16 | 17 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 18 | # pragma message("GLM: GLM_EXT_vector_bool1 extension included") 19 | #endif 20 | 21 | namespace glm 22 | { 23 | /// @addtogroup ext_vector_bool1 24 | /// @{ 25 | 26 | /// 1 components vector of boolean. 27 | typedef vec<1, bool, defaultp> bvec1; 28 | 29 | /// @} 30 | }//namespace glm 31 | -------------------------------------------------------------------------------- /include/glm/ext/vector_bool1_precision.hpp: -------------------------------------------------------------------------------- 1 | /// @ref ext_vector_bool1_precision 2 | /// @file glm/ext/vector_bool1_precision.hpp 3 | /// 4 | /// @defgroup ext_vector_bool1_precision GLM_EXT_vector_bool1_precision 5 | /// @ingroup ext 6 | /// 7 | /// Exposes highp_bvec1, mediump_bvec1 and lowp_bvec1 types. 8 | /// 9 | /// Include to use the features of this extension. 10 | 11 | #pragma once 12 | 13 | #include "../detail/type_vec1.hpp" 14 | 15 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 16 | # pragma message("GLM: GLM_EXT_vector_bool1_precision extension included") 17 | #endif 18 | 19 | namespace glm 20 | { 21 | /// @addtogroup ext_vector_bool1_precision 22 | /// @{ 23 | 24 | /// 1 component vector of bool values. 25 | typedef vec<1, bool, highp> highp_bvec1; 26 | 27 | /// 1 component vector of bool values. 28 | typedef vec<1, bool, mediump> mediump_bvec1; 29 | 30 | /// 1 component vector of bool values. 31 | typedef vec<1, bool, lowp> lowp_bvec1; 32 | 33 | /// @} 34 | }//namespace glm 35 | -------------------------------------------------------------------------------- /include/glm/ext/vector_bool2.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/vector_bool2.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_vec2.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_vector 10 | /// @{ 11 | 12 | /// 2 components vector of boolean. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 15 | typedef vec<2, bool, defaultp> bvec2; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /include/glm/ext/vector_bool2_precision.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/vector_bool2_precision.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_vec2.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_vector_precision 10 | /// @{ 11 | 12 | /// 2 components vector of high qualifier bool numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 15 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 16 | typedef vec<2, bool, highp> highp_bvec2; 17 | 18 | /// 2 components vector of medium qualifier bool numbers. 19 | /// 20 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 21 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 22 | typedef vec<2, bool, mediump> mediump_bvec2; 23 | 24 | /// 2 components vector of low qualifier bool numbers. 25 | /// 26 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 27 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 28 | typedef vec<2, bool, lowp> lowp_bvec2; 29 | 30 | /// @} 31 | }//namespace glm 32 | -------------------------------------------------------------------------------- /include/glm/ext/vector_bool3.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/vector_bool3.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_vec3.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_vector 10 | /// @{ 11 | 12 | /// 3 components vector of boolean. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 15 | typedef vec<3, bool, defaultp> bvec3; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /include/glm/ext/vector_bool3_precision.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/vector_bool3_precision.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_vec3.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_vector_precision 10 | /// @{ 11 | 12 | /// 3 components vector of high qualifier bool numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 15 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 16 | typedef vec<3, bool, highp> highp_bvec3; 17 | 18 | /// 3 components vector of medium qualifier bool numbers. 19 | /// 20 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 21 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 22 | typedef vec<3, bool, mediump> mediump_bvec3; 23 | 24 | /// 3 components vector of low qualifier bool numbers. 25 | /// 26 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 27 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 28 | typedef vec<3, bool, lowp> lowp_bvec3; 29 | 30 | /// @} 31 | }//namespace glm 32 | -------------------------------------------------------------------------------- /include/glm/ext/vector_bool4.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/vector_bool4.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_vec4.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_vector 10 | /// @{ 11 | 12 | /// 4 components vector of boolean. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 15 | typedef vec<4, bool, defaultp> bvec4; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /include/glm/ext/vector_bool4_precision.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/vector_bool4_precision.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_vec4.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_vector_precision 10 | /// @{ 11 | 12 | /// 4 components vector of high qualifier bool numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 15 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 16 | typedef vec<4, bool, highp> highp_bvec4; 17 | 18 | /// 4 components vector of medium qualifier bool numbers. 19 | /// 20 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 21 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 22 | typedef vec<4, bool, mediump> mediump_bvec4; 23 | 24 | /// 4 components vector of low qualifier bool numbers. 25 | /// 26 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 27 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 28 | typedef vec<4, bool, lowp> lowp_bvec4; 29 | 30 | /// @} 31 | }//namespace glm 32 | -------------------------------------------------------------------------------- /include/glm/ext/vector_double1.hpp: -------------------------------------------------------------------------------- 1 | /// @ref ext_vector_double1 2 | /// @file glm/ext/vector_double1.hpp 3 | /// 4 | /// @defgroup ext_vector_double1 GLM_EXT_vector_double1 5 | /// @ingroup ext 6 | /// 7 | /// Exposes double-precision floating point vector type with one component. 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// @see ext_vector_double1_precision extension. 12 | /// @see ext_vector_float1 extension. 13 | 14 | #pragma once 15 | 16 | #include "../detail/type_vec1.hpp" 17 | 18 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 19 | # pragma message("GLM: GLM_EXT_vector_dvec1 extension included") 20 | #endif 21 | 22 | namespace glm 23 | { 24 | /// @addtogroup ext_vector_double1 25 | /// @{ 26 | 27 | /// 1 components vector of double-precision floating-point numbers. 28 | typedef vec<1, double, defaultp> dvec1; 29 | 30 | /// @} 31 | }//namespace glm 32 | -------------------------------------------------------------------------------- /include/glm/ext/vector_double1_precision.hpp: -------------------------------------------------------------------------------- 1 | /// @ref ext_vector_double1_precision 2 | /// @file glm/ext/vector_double1_precision.hpp 3 | /// 4 | /// @defgroup ext_vector_double1_precision GLM_EXT_vector_double1_precision 5 | /// @ingroup ext 6 | /// 7 | /// Exposes highp_dvec1, mediump_dvec1 and lowp_dvec1 types. 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// @see ext_vector_double1 12 | 13 | #pragma once 14 | 15 | #include "../detail/type_vec1.hpp" 16 | 17 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 18 | # pragma message("GLM: GLM_EXT_vector_double1_precision extension included") 19 | #endif 20 | 21 | namespace glm 22 | { 23 | /// @addtogroup ext_vector_double1_precision 24 | /// @{ 25 | 26 | /// 1 component vector of double-precision floating-point numbers using high precision arithmetic in term of ULPs. 27 | typedef vec<1, double, highp> highp_dvec1; 28 | 29 | /// 1 component vector of double-precision floating-point numbers using medium precision arithmetic in term of ULPs. 30 | typedef vec<1, double, mediump> mediump_dvec1; 31 | 32 | /// 1 component vector of double-precision floating-point numbers using low precision arithmetic in term of ULPs. 33 | typedef vec<1, double, lowp> lowp_dvec1; 34 | 35 | /// @} 36 | }//namespace glm 37 | -------------------------------------------------------------------------------- /include/glm/ext/vector_double2.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/vector_double2.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_vec2.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_vector 10 | /// @{ 11 | 12 | /// 2 components vector of double-precision floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 15 | typedef vec<2, double, defaultp> dvec2; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /include/glm/ext/vector_double2_precision.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/vector_double2_precision.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_vec2.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_vector_precision 10 | /// @{ 11 | 12 | /// 2 components vector of high double-qualifier floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 15 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 16 | typedef vec<2, double, highp> highp_dvec2; 17 | 18 | /// 2 components vector of medium double-qualifier floating-point numbers. 19 | /// 20 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 21 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 22 | typedef vec<2, double, mediump> mediump_dvec2; 23 | 24 | /// 2 components vector of low double-qualifier floating-point numbers. 25 | /// 26 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 27 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 28 | typedef vec<2, double, lowp> lowp_dvec2; 29 | 30 | /// @} 31 | }//namespace glm 32 | -------------------------------------------------------------------------------- /include/glm/ext/vector_double3.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/vector_double3.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_vec3.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_vector 10 | /// @{ 11 | 12 | /// 3 components vector of double-precision floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 15 | typedef vec<3, double, defaultp> dvec3; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /include/glm/ext/vector_double4.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/vector_double4.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_vec4.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_vector 10 | /// @{ 11 | 12 | /// 4 components vector of double-precision floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 15 | typedef vec<4, double, defaultp> dvec4; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /include/glm/ext/vector_float1.hpp: -------------------------------------------------------------------------------- 1 | /// @ref ext_vector_float1 2 | /// @file glm/ext/vector_float1.hpp 3 | /// 4 | /// @defgroup ext_vector_float1 GLM_EXT_vector_float1 5 | /// @ingroup ext 6 | /// 7 | /// Exposes single-precision floating point vector type with one component. 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// @see ext_vector_float1_precision extension. 12 | /// @see ext_vector_double1 extension. 13 | 14 | #pragma once 15 | 16 | #include "../detail/type_vec1.hpp" 17 | 18 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 19 | # pragma message("GLM: GLM_EXT_vector_float1 extension included") 20 | #endif 21 | 22 | namespace glm 23 | { 24 | /// @addtogroup ext_vector_float1 25 | /// @{ 26 | 27 | /// 1 components vector of single-precision floating-point numbers. 28 | typedef vec<1, float, defaultp> vec1; 29 | 30 | /// @} 31 | }//namespace glm 32 | -------------------------------------------------------------------------------- /include/glm/ext/vector_float1_precision.hpp: -------------------------------------------------------------------------------- 1 | /// @ref ext_vector_float1_precision 2 | /// @file glm/ext/vector_float1_precision.hpp 3 | /// 4 | /// @defgroup ext_vector_float1_precision GLM_EXT_vector_float1_precision 5 | /// @ingroup ext 6 | /// 7 | /// Exposes highp_vec1, mediump_vec1 and lowp_vec1 types. 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// @see ext_vector_float1 extension. 12 | 13 | #pragma once 14 | 15 | #include "../detail/type_vec1.hpp" 16 | 17 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 18 | # pragma message("GLM: GLM_EXT_vector_float1_precision extension included") 19 | #endif 20 | 21 | namespace glm 22 | { 23 | /// @addtogroup ext_vector_float1_precision 24 | /// @{ 25 | 26 | /// 1 component vector of single-precision floating-point numbers using high precision arithmetic in term of ULPs. 27 | typedef vec<1, float, highp> highp_vec1; 28 | 29 | /// 1 component vector of single-precision floating-point numbers using medium precision arithmetic in term of ULPs. 30 | typedef vec<1, float, mediump> mediump_vec1; 31 | 32 | /// 1 component vector of single-precision floating-point numbers using low precision arithmetic in term of ULPs. 33 | typedef vec<1, float, lowp> lowp_vec1; 34 | 35 | /// @} 36 | }//namespace glm 37 | -------------------------------------------------------------------------------- /include/glm/ext/vector_float2.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/vector_float2.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_vec2.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_vector 10 | /// @{ 11 | 12 | /// 2 components vector of single-precision floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 15 | typedef vec<2, float, defaultp> vec2; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /include/glm/ext/vector_float2_precision.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/vector_float2_precision.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_vec2.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_vector_precision 10 | /// @{ 11 | 12 | /// 2 components vector of high single-qualifier floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 15 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 16 | typedef vec<2, float, highp> highp_vec2; 17 | 18 | /// 2 components vector of medium single-qualifier floating-point numbers. 19 | /// 20 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 21 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 22 | typedef vec<2, float, mediump> mediump_vec2; 23 | 24 | /// 2 components vector of low single-qualifier floating-point numbers. 25 | /// 26 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 27 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 28 | typedef vec<2, float, lowp> lowp_vec2; 29 | 30 | /// @} 31 | }//namespace glm 32 | -------------------------------------------------------------------------------- /include/glm/ext/vector_float3.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/vector_float3.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_vec3.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_vector 10 | /// @{ 11 | 12 | /// 3 components vector of single-precision floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 15 | typedef vec<3, float, defaultp> vec3; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /include/glm/ext/vector_float3_precision.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/vector_float3_precision.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_vec3.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_vector_precision 10 | /// @{ 11 | 12 | /// 3 components vector of high single-qualifier floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 15 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 16 | typedef vec<3, float, highp> highp_vec3; 17 | 18 | /// 3 components vector of medium single-qualifier floating-point numbers. 19 | /// 20 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 21 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 22 | typedef vec<3, float, mediump> mediump_vec3; 23 | 24 | /// 3 components vector of low single-qualifier floating-point numbers. 25 | /// 26 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 27 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 28 | typedef vec<3, float, lowp> lowp_vec3; 29 | 30 | /// @} 31 | }//namespace glm 32 | -------------------------------------------------------------------------------- /include/glm/ext/vector_float4.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/vector_float4.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_vec4.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_vector 10 | /// @{ 11 | 12 | /// 4 components vector of single-precision floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 15 | typedef vec<4, float, defaultp> vec4; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /include/glm/ext/vector_float4_precision.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/vector_float4_precision.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_vec4.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_vector_precision 10 | /// @{ 11 | 12 | /// 4 components vector of high single-qualifier floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 15 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 16 | typedef vec<4, float, highp> highp_vec4; 17 | 18 | /// 4 components vector of medium single-qualifier floating-point numbers. 19 | /// 20 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 21 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 22 | typedef vec<4, float, mediump> mediump_vec4; 23 | 24 | /// 4 components vector of low single-qualifier floating-point numbers. 25 | /// 26 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 27 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 28 | typedef vec<4, float, lowp> lowp_vec4; 29 | 30 | /// @} 31 | }//namespace glm 32 | -------------------------------------------------------------------------------- /include/glm/ext/vector_int1.hpp: -------------------------------------------------------------------------------- 1 | /// @ref ext_vector_int1 2 | /// @file glm/ext/vector_int1.hpp 3 | /// 4 | /// @defgroup ext_vector_int1 GLM_EXT_vector_int1 5 | /// @ingroup ext 6 | /// 7 | /// Exposes ivec1 vector type. 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// @see ext_vector_uint1 extension. 12 | /// @see ext_vector_int1_precision extension. 13 | 14 | #pragma once 15 | 16 | #include "../detail/type_vec1.hpp" 17 | 18 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 19 | # pragma message("GLM: GLM_EXT_vector_int1 extension included") 20 | #endif 21 | 22 | namespace glm 23 | { 24 | /// @addtogroup ext_vector_int1 25 | /// @{ 26 | 27 | /// 1 component vector of signed integer numbers. 28 | typedef vec<1, int, defaultp> ivec1; 29 | 30 | /// @} 31 | }//namespace glm 32 | 33 | -------------------------------------------------------------------------------- /include/glm/ext/vector_int1_precision.hpp: -------------------------------------------------------------------------------- 1 | /// @ref ext_vector_int1_precision 2 | /// @file glm/ext/vector_int1_precision.hpp 3 | /// 4 | /// @defgroup ext_vector_int1_precision GLM_EXT_vector_int1_precision 5 | /// @ingroup ext 6 | /// 7 | /// Exposes highp_ivec1, mediump_ivec1 and lowp_ivec1 types. 8 | /// 9 | /// Include to use the features of this extension. 10 | 11 | #pragma once 12 | 13 | #include "../detail/type_vec1.hpp" 14 | 15 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 16 | # pragma message("GLM: GLM_EXT_vector_int1_precision extension included") 17 | #endif 18 | 19 | namespace glm 20 | { 21 | /// @addtogroup ext_vector_int1_precision 22 | /// @{ 23 | 24 | /// 1 component vector of signed integer values. 25 | typedef vec<1, int, highp> highp_ivec1; 26 | 27 | /// 1 component vector of signed integer values. 28 | typedef vec<1, int, mediump> mediump_ivec1; 29 | 30 | /// 1 component vector of signed integer values. 31 | typedef vec<1, int, lowp> lowp_ivec1; 32 | 33 | /// @} 34 | }//namespace glm 35 | -------------------------------------------------------------------------------- /include/glm/ext/vector_int2.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/vector_int2.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_vec2.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_vector 10 | /// @{ 11 | 12 | /// 2 components vector of signed integer numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 15 | typedef vec<2, int, defaultp> ivec2; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /include/glm/ext/vector_int2_precision.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/vector_int2_precision.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_vec2.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_vector_precision 10 | /// @{ 11 | 12 | /// 2 components vector of high qualifier signed integer numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 15 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 16 | typedef vec<2, int, highp> highp_ivec2; 17 | 18 | /// 2 components vector of medium qualifier signed integer numbers. 19 | /// 20 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 21 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 22 | typedef vec<2, int, mediump> mediump_ivec2; 23 | 24 | /// 2 components vector of low qualifier signed integer numbers. 25 | /// 26 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 27 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 28 | typedef vec<2, int, lowp> lowp_ivec2; 29 | 30 | /// @} 31 | }//namespace glm 32 | -------------------------------------------------------------------------------- /include/glm/ext/vector_int3.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/vector_int3.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_vec3.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_vector 10 | /// @{ 11 | 12 | /// 3 components vector of signed integer numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 15 | typedef vec<3, int, defaultp> ivec3; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /include/glm/ext/vector_int3_precision.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/vector_int3_precision.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_vec3.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_vector_precision 10 | /// @{ 11 | 12 | /// 3 components vector of high qualifier signed integer numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 15 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 16 | typedef vec<3, int, highp> highp_ivec3; 17 | 18 | /// 3 components vector of medium qualifier signed integer numbers. 19 | /// 20 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 21 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 22 | typedef vec<3, int, mediump> mediump_ivec3; 23 | 24 | /// 3 components vector of low qualifier signed integer numbers. 25 | /// 26 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 27 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 28 | typedef vec<3, int, lowp> lowp_ivec3; 29 | 30 | /// @} 31 | }//namespace glm 32 | -------------------------------------------------------------------------------- /include/glm/ext/vector_int4.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/vector_int4.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_vec4.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_vector 10 | /// @{ 11 | 12 | /// 4 components vector of signed integer numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 15 | typedef vec<4, int, defaultp> ivec4; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /include/glm/ext/vector_int4_precision.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/vector_int4_precision.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_vec4.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_vector_precision 10 | /// @{ 11 | 12 | /// 4 components vector of high qualifier signed integer numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 15 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 16 | typedef vec<4, int, highp> highp_ivec4; 17 | 18 | /// 4 components vector of medium qualifier signed integer numbers. 19 | /// 20 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 21 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 22 | typedef vec<4, int, mediump> mediump_ivec4; 23 | 24 | /// 4 components vector of low qualifier signed integer numbers. 25 | /// 26 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 27 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 28 | typedef vec<4, int, lowp> lowp_ivec4; 29 | 30 | /// @} 31 | }//namespace glm 32 | -------------------------------------------------------------------------------- /include/glm/ext/vector_uint1.hpp: -------------------------------------------------------------------------------- 1 | /// @ref ext_vector_uint1 2 | /// @file glm/ext/vector_uint1.hpp 3 | /// 4 | /// @defgroup ext_vector_uint1 GLM_EXT_vector_uint1 5 | /// @ingroup ext 6 | /// 7 | /// Exposes uvec1 vector type. 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// @see ext_vector_int1 extension. 12 | /// @see ext_vector_uint1_precision extension. 13 | 14 | #pragma once 15 | 16 | #include "../detail/type_vec1.hpp" 17 | 18 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 19 | # pragma message("GLM: GLM_EXT_vector_uint1 extension included") 20 | #endif 21 | 22 | namespace glm 23 | { 24 | /// @addtogroup ext_vector_uint1 25 | /// @{ 26 | 27 | /// 1 component vector of unsigned integer numbers. 28 | typedef vec<1, unsigned int, defaultp> uvec1; 29 | 30 | /// @} 31 | }//namespace glm 32 | 33 | -------------------------------------------------------------------------------- /include/glm/ext/vector_uint1_precision.hpp: -------------------------------------------------------------------------------- 1 | /// @ref ext_vector_uint1_precision 2 | /// @file glm/ext/vector_uint1_precision.hpp 3 | /// 4 | /// @defgroup ext_vector_uint1_precision GLM_EXT_vector_uint1_precision 5 | /// @ingroup ext 6 | /// 7 | /// Exposes highp_uvec1, mediump_uvec1 and lowp_uvec1 types. 8 | /// 9 | /// Include to use the features of this extension. 10 | 11 | #pragma once 12 | 13 | #include "../detail/type_vec1.hpp" 14 | 15 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 16 | # pragma message("GLM: GLM_EXT_vector_uint1_precision extension included") 17 | #endif 18 | 19 | namespace glm 20 | { 21 | /// @addtogroup ext_vector_uint1_precision 22 | /// @{ 23 | 24 | /// 1 component vector of unsigned integer values. 25 | /// 26 | /// @see ext_vector_uint1_precision 27 | typedef vec<1, unsigned int, highp> highp_uvec1; 28 | 29 | /// 1 component vector of unsigned integer values. 30 | /// 31 | /// @see ext_vector_uint1_precision 32 | typedef vec<1, unsigned int, mediump> mediump_uvec1; 33 | 34 | /// 1 component vector of unsigned integer values. 35 | /// 36 | /// @see ext_vector_uint1_precision 37 | typedef vec<1, unsigned int, lowp> lowp_uvec1; 38 | 39 | /// @} 40 | }//namespace glm 41 | -------------------------------------------------------------------------------- /include/glm/ext/vector_uint2.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/vector_uint2.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_vec2.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_vector 10 | /// @{ 11 | 12 | /// 2 components vector of unsigned integer numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 15 | typedef vec<2, unsigned int, defaultp> uvec2; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /include/glm/ext/vector_uint2_precision.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/vector_uint2_precision.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_vec2.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_vector_precision 10 | /// @{ 11 | 12 | /// 2 components vector of high qualifier unsigned integer numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 15 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 16 | typedef vec<2, unsigned int, highp> highp_uvec2; 17 | 18 | /// 2 components vector of medium qualifier unsigned integer numbers. 19 | /// 20 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 21 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 22 | typedef vec<2, unsigned int, mediump> mediump_uvec2; 23 | 24 | /// 2 components vector of low qualifier unsigned integer numbers. 25 | /// 26 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 27 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 28 | typedef vec<2, unsigned int, lowp> lowp_uvec2; 29 | 30 | /// @} 31 | }//namespace glm 32 | -------------------------------------------------------------------------------- /include/glm/ext/vector_uint3.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/vector_uint3.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_vec3.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_vector 10 | /// @{ 11 | 12 | /// 3 components vector of unsigned integer numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 15 | typedef vec<3, unsigned int, defaultp> uvec3; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /include/glm/ext/vector_uint3_precision.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/vector_uint3_precision.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_vec3.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_vector_precision 10 | /// @{ 11 | 12 | /// 3 components vector of high qualifier unsigned integer numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 15 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 16 | typedef vec<3, unsigned int, highp> highp_uvec3; 17 | 18 | /// 3 components vector of medium qualifier unsigned integer numbers. 19 | /// 20 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 21 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 22 | typedef vec<3, unsigned int, mediump> mediump_uvec3; 23 | 24 | /// 3 components vector of low qualifier unsigned integer numbers. 25 | /// 26 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 27 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 28 | typedef vec<3, unsigned int, lowp> lowp_uvec3; 29 | 30 | /// @} 31 | }//namespace glm 32 | -------------------------------------------------------------------------------- /include/glm/ext/vector_uint4.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/vector_uint4.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_vec4.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_vector 10 | /// @{ 11 | 12 | /// 4 components vector of unsigned integer numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 15 | typedef vec<4, unsigned int, defaultp> uvec4; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /include/glm/ext/vector_uint4_precision.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/vector_uint4_precision.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_vec4.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_vector_precision 10 | /// @{ 11 | 12 | /// 4 components vector of high qualifier unsigned integer numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 15 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 16 | typedef vec<4, unsigned int, highp> highp_uvec4; 17 | 18 | /// 4 components vector of medium qualifier unsigned integer numbers. 19 | /// 20 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 21 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 22 | typedef vec<4, unsigned int, mediump> mediump_uvec4; 23 | 24 | /// 4 components vector of low qualifier unsigned integer numbers. 25 | /// 26 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 27 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 28 | typedef vec<4, unsigned int, lowp> lowp_uvec4; 29 | 30 | /// @} 31 | }//namespace glm 32 | -------------------------------------------------------------------------------- /include/glm/gtc/matrix_access.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtc_matrix_access 2 | 3 | namespace glm 4 | { 5 | template 6 | GLM_FUNC_QUALIFIER genType row 7 | ( 8 | genType const& m, 9 | length_t index, 10 | typename genType::row_type const& x 11 | ) 12 | { 13 | assert(index >= 0 && index < m[0].length()); 14 | 15 | genType Result = m; 16 | for(length_t i = 0; i < m.length(); ++i) 17 | Result[i][index] = x[i]; 18 | return Result; 19 | } 20 | 21 | template 22 | GLM_FUNC_QUALIFIER typename genType::row_type row 23 | ( 24 | genType const& m, 25 | length_t index 26 | ) 27 | { 28 | assert(index >= 0 && index < m[0].length()); 29 | 30 | typename genType::row_type Result(0); 31 | for(length_t i = 0; i < m.length(); ++i) 32 | Result[i] = m[i][index]; 33 | return Result; 34 | } 35 | 36 | template 37 | GLM_FUNC_QUALIFIER genType column 38 | ( 39 | genType const& m, 40 | length_t index, 41 | typename genType::col_type const& x 42 | ) 43 | { 44 | assert(index >= 0 && index < m.length()); 45 | 46 | genType Result = m; 47 | Result[index] = x; 48 | return Result; 49 | } 50 | 51 | template 52 | GLM_FUNC_QUALIFIER typename genType::col_type column 53 | ( 54 | genType const& m, 55 | length_t index 56 | ) 57 | { 58 | assert(index >= 0 && index < m.length()); 59 | 60 | return m[index]; 61 | } 62 | }//namespace glm 63 | -------------------------------------------------------------------------------- /include/glm/gtc/matrix_transform.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtc_matrix_transform 2 | /// @file glm/gtc/matrix_transform.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtx_transform 6 | /// @see gtx_transform2 7 | /// 8 | /// @defgroup gtc_matrix_transform GLM_GTC_matrix_transform 9 | /// @ingroup gtc 10 | /// 11 | /// Include to use the features of this extension. 12 | /// 13 | /// Defines functions that generate common transformation matrices. 14 | /// 15 | /// The matrices generated by this extension use standard OpenGL fixed-function 16 | /// conventions. For example, the lookAt function generates a transform from world 17 | /// space into the specific eye space that the projective matrix functions 18 | /// (perspective, ortho, etc) are designed to expect. The OpenGL compatibility 19 | /// specifications defines the particular layout of this eye space. 20 | 21 | #pragma once 22 | 23 | // Dependencies 24 | #include "../mat4x4.hpp" 25 | #include "../vec2.hpp" 26 | #include "../vec3.hpp" 27 | #include "../vec4.hpp" 28 | #include "../ext/matrix_projection.hpp" 29 | #include "../ext/matrix_clip_space.hpp" 30 | #include "../ext/matrix_transform.hpp" 31 | 32 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 33 | # pragma message("GLM: GLM_GTC_matrix_transform extension included") 34 | #endif 35 | 36 | #include "matrix_transform.inl" 37 | -------------------------------------------------------------------------------- /include/glm/gtc/matrix_transform.inl: -------------------------------------------------------------------------------- 1 | #include "../geometric.hpp" 2 | #include "../trigonometric.hpp" 3 | #include "../matrix.hpp" 4 | -------------------------------------------------------------------------------- /include/glm/gtc/quaternion_simd.inl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chukobyte/learn-engine-dev/3f4437ed4abab9011d584bdc0ab4eff921393f00/include/glm/gtc/quaternion_simd.inl -------------------------------------------------------------------------------- /include/glm/gtc/type_precision.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtc_precision 2 | 3 | namespace glm 4 | { 5 | 6 | } 7 | -------------------------------------------------------------------------------- /include/glm/gtc/ulp.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtc_ulp 2 | /// @file glm/gtc/ulp.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtc_ulp GLM_GTC_ulp 7 | /// @ingroup gtc 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// Allow the measurement of the accuracy of a function against a reference 12 | /// implementation. This extension works on floating-point data and provide results 13 | /// in ULP. 14 | 15 | #pragma once 16 | 17 | // Dependencies 18 | #include "../ext/scalar_ulp.hpp" 19 | #include "../ext/vector_ulp.hpp" 20 | 21 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 22 | # pragma message("GLM: GLM_GTC_ulp extension included") 23 | #endif 24 | 25 | -------------------------------------------------------------------------------- /include/glm/gtc/ulp.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtc_ulp 2 | /// 3 | 4 | -------------------------------------------------------------------------------- /include/glm/gtc/vec1.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtc_vec1 2 | /// @file glm/gtc/vec1.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtc_vec1 GLM_GTC_vec1 7 | /// @ingroup gtc 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// Add vec1, ivec1, uvec1 and bvec1 types. 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../ext/vector_bool1.hpp" 17 | #include "../ext/vector_bool1_precision.hpp" 18 | #include "../ext/vector_float1.hpp" 19 | #include "../ext/vector_float1_precision.hpp" 20 | #include "../ext/vector_double1.hpp" 21 | #include "../ext/vector_double1_precision.hpp" 22 | #include "../ext/vector_int1.hpp" 23 | #include "../ext/vector_int1_precision.hpp" 24 | #include "../ext/vector_uint1.hpp" 25 | #include "../ext/vector_uint1_precision.hpp" 26 | 27 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 28 | # pragma message("GLM: GLM_GTC_vec1 extension included") 29 | #endif 30 | 31 | -------------------------------------------------------------------------------- /include/glm/gtx/closest_point.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_closest_point 2 | /// @file glm/gtx/closest_point.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_closest_point GLM_GTX_closest_point 7 | /// @ingroup gtx 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// Find the point on a straight line which is the closet of a point. 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../glm.hpp" 17 | 18 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 19 | # ifndef GLM_ENABLE_EXPERIMENTAL 20 | # pragma message("GLM: GLM_GTX_closest_point is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") 21 | # elif 22 | # pragma message("GLM: GLM_GTX_closest_point extension included") 23 | # endif 24 | #endif 25 | 26 | namespace glm 27 | { 28 | /// @addtogroup gtx_closest_point 29 | /// @{ 30 | 31 | /// Find the point on a straight line which is the closet of a point. 32 | /// @see gtx_closest_point 33 | template 34 | GLM_FUNC_DECL vec<3, T, Q> closestPointOnLine( 35 | vec<3, T, Q> const& point, 36 | vec<3, T, Q> const& a, 37 | vec<3, T, Q> const& b); 38 | 39 | /// 2d lines work as well 40 | template 41 | GLM_FUNC_DECL vec<2, T, Q> closestPointOnLine( 42 | vec<2, T, Q> const& point, 43 | vec<2, T, Q> const& a, 44 | vec<2, T, Q> const& b); 45 | 46 | /// @} 47 | }// namespace glm 48 | 49 | #include "closest_point.inl" 50 | -------------------------------------------------------------------------------- /include/glm/gtx/closest_point.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_closest_point 2 | 3 | namespace glm 4 | { 5 | template 6 | GLM_FUNC_QUALIFIER vec<3, T, Q> closestPointOnLine 7 | ( 8 | vec<3, T, Q> const& point, 9 | vec<3, T, Q> const& a, 10 | vec<3, T, Q> const& b 11 | ) 12 | { 13 | T LineLength = distance(a, b); 14 | vec<3, T, Q> Vector = point - a; 15 | vec<3, T, Q> LineDirection = (b - a) / LineLength; 16 | 17 | // Project Vector to LineDirection to get the distance of point from a 18 | T Distance = dot(Vector, LineDirection); 19 | 20 | if(Distance <= T(0)) return a; 21 | if(Distance >= LineLength) return b; 22 | return a + LineDirection * Distance; 23 | } 24 | 25 | template 26 | GLM_FUNC_QUALIFIER vec<2, T, Q> closestPointOnLine 27 | ( 28 | vec<2, T, Q> const& point, 29 | vec<2, T, Q> const& a, 30 | vec<2, T, Q> const& b 31 | ) 32 | { 33 | T LineLength = distance(a, b); 34 | vec<2, T, Q> Vector = point - a; 35 | vec<2, T, Q> LineDirection = (b - a) / LineLength; 36 | 37 | // Project Vector to LineDirection to get the distance of point from a 38 | T Distance = dot(Vector, LineDirection); 39 | 40 | if(Distance <= T(0)) return a; 41 | if(Distance >= LineLength) return b; 42 | return a + LineDirection * Distance; 43 | } 44 | 45 | }//namespace glm 46 | -------------------------------------------------------------------------------- /include/glm/gtx/extend.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_extend 2 | /// @file glm/gtx/extend.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_extend GLM_GTX_extend 7 | /// @ingroup gtx 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// Extend a position from a source to a position at a defined length. 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../glm.hpp" 17 | 18 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 19 | # ifndef GLM_ENABLE_EXPERIMENTAL 20 | # pragma message("GLM: GLM_GTX_extend is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") 21 | # elif 22 | # pragma message("GLM: GLM_GTX_extend extension included") 23 | # endif 24 | #endif 25 | 26 | namespace glm 27 | { 28 | /// @addtogroup gtx_extend 29 | /// @{ 30 | 31 | /// Extends of Length the Origin position using the (Source - Origin) direction. 32 | /// @see gtx_extend 33 | template 34 | GLM_FUNC_DECL genType extend( 35 | genType const& Origin, 36 | genType const& Source, 37 | typename genType::value_type const Length); 38 | 39 | /// @} 40 | }//namespace glm 41 | 42 | #include "extend.inl" 43 | -------------------------------------------------------------------------------- /include/glm/gtx/extend.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_extend 2 | 3 | namespace glm 4 | { 5 | template 6 | GLM_FUNC_QUALIFIER genType extend 7 | ( 8 | genType const& Origin, 9 | genType const& Source, 10 | genType const& Distance 11 | ) 12 | { 13 | return Origin + (Source - Origin) * Distance; 14 | } 15 | 16 | template 17 | GLM_FUNC_QUALIFIER vec<2, T, Q> extend 18 | ( 19 | vec<2, T, Q> const& Origin, 20 | vec<2, T, Q> const& Source, 21 | T const& Distance 22 | ) 23 | { 24 | return Origin + (Source - Origin) * Distance; 25 | } 26 | 27 | template 28 | GLM_FUNC_QUALIFIER vec<3, T, Q> extend 29 | ( 30 | vec<3, T, Q> const& Origin, 31 | vec<3, T, Q> const& Source, 32 | T const& Distance 33 | ) 34 | { 35 | return Origin + (Source - Origin) * Distance; 36 | } 37 | 38 | template 39 | GLM_FUNC_QUALIFIER vec<4, T, Q> extend 40 | ( 41 | vec<4, T, Q> const& Origin, 42 | vec<4, T, Q> const& Source, 43 | T const& Distance 44 | ) 45 | { 46 | return Origin + (Source - Origin) * Distance; 47 | } 48 | }//namespace glm 49 | -------------------------------------------------------------------------------- /include/glm/gtx/exterior_product.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_exterior_product 2 | /// @file glm/gtx/exterior_product.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtx_exterior_product (dependence) 6 | /// 7 | /// @defgroup gtx_exterior_product GLM_GTX_exterior_product 8 | /// @ingroup gtx 9 | /// 10 | /// Include to use the features of this extension. 11 | /// 12 | /// @brief Allow to perform bit operations on integer values 13 | 14 | #pragma once 15 | 16 | // Dependencies 17 | #include "../detail/setup.hpp" 18 | #include "../detail/qualifier.hpp" 19 | 20 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 21 | # pragma message("GLM: GLM_GTX_exterior_product extension included") 22 | #endif 23 | 24 | namespace glm 25 | { 26 | /// @addtogroup gtx_exterior_product 27 | /// @{ 28 | 29 | /// Returns the cross product of x and y. 30 | /// 31 | /// @tparam T Floating-point scalar types 32 | /// @tparam Q Value from qualifier enum 33 | /// 34 | /// @see Exterior product 35 | template 36 | GLM_FUNC_DECL T cross(vec<2, T, Q> const& v, vec<2, T, Q> const& u); 37 | 38 | /// @} 39 | } //namespace glm 40 | 41 | #include "exterior_product.inl" 42 | -------------------------------------------------------------------------------- /include/glm/gtx/exterior_product.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_exterior_product 2 | 3 | #include 4 | 5 | namespace glm { 6 | namespace detail 7 | { 8 | template 9 | struct compute_cross_vec2 10 | { 11 | GLM_FUNC_QUALIFIER static T call(vec<2, T, Q> const& v, vec<2, T, Q> const& u) 12 | { 13 | GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'cross' accepts only floating-point inputs"); 14 | 15 | return v.x * u.y - u.x * v.y; 16 | } 17 | }; 18 | }//namespace detail 19 | 20 | template 21 | GLM_FUNC_QUALIFIER T cross(vec<2, T, Q> const& x, vec<2, T, Q> const& y) 22 | { 23 | return detail::compute_cross_vec2::value>::call(x, y); 24 | } 25 | }//namespace glm 26 | 27 | -------------------------------------------------------------------------------- /include/glm/gtx/float_notmalize.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_float_normalize 2 | 3 | #include 4 | 5 | namespace glm 6 | { 7 | template 8 | GLM_FUNC_QUALIFIER vec floatNormalize(vec const& v) 9 | { 10 | return vec(v) / static_cast(std::numeric_limits::max()); 11 | } 12 | 13 | }//namespace glm 14 | -------------------------------------------------------------------------------- /include/glm/gtx/functions.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_functions 2 | /// @file glm/gtx/functions.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtc_quaternion (dependence) 6 | /// 7 | /// @defgroup gtx_functions GLM_GTX_functions 8 | /// @ingroup gtx 9 | /// 10 | /// Include to use the features of this extension. 11 | /// 12 | /// List of useful common functions. 13 | 14 | #pragma once 15 | 16 | // Dependencies 17 | #include "../detail/setup.hpp" 18 | #include "../detail/qualifier.hpp" 19 | #include "../detail/type_vec2.hpp" 20 | 21 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 22 | # pragma message("GLM: GLM_GTX_functions extension included") 23 | #endif 24 | 25 | namespace glm 26 | { 27 | /// @addtogroup gtx_functions 28 | /// @{ 29 | 30 | /// 1D gauss function 31 | /// 32 | /// @see gtc_epsilon 33 | template 34 | GLM_FUNC_DECL T gauss( 35 | T x, 36 | T ExpectedValue, 37 | T StandardDeviation); 38 | 39 | /// 2D gauss function 40 | /// 41 | /// @see gtc_epsilon 42 | template 43 | GLM_FUNC_DECL T gauss( 44 | vec<2, T, Q> const& Coord, 45 | vec<2, T, Q> const& ExpectedValue, 46 | vec<2, T, Q> const& StandardDeviation); 47 | 48 | /// @} 49 | }//namespace glm 50 | 51 | #include "functions.inl" 52 | 53 | -------------------------------------------------------------------------------- /include/glm/gtx/functions.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_functions 2 | 3 | #include "../exponential.hpp" 4 | 5 | namespace glm 6 | { 7 | template 8 | GLM_FUNC_QUALIFIER T gauss 9 | ( 10 | T x, 11 | T ExpectedValue, 12 | T StandardDeviation 13 | ) 14 | { 15 | return exp(-((x - ExpectedValue) * (x - ExpectedValue)) / (static_cast(2) * StandardDeviation * StandardDeviation)) / (StandardDeviation * sqrt(static_cast(6.28318530717958647692528676655900576))); 16 | } 17 | 18 | template 19 | GLM_FUNC_QUALIFIER T gauss 20 | ( 21 | vec<2, T, Q> const& Coord, 22 | vec<2, T, Q> const& ExpectedValue, 23 | vec<2, T, Q> const& StandardDeviation 24 | ) 25 | { 26 | vec<2, T, Q> const Squared = ((Coord - ExpectedValue) * (Coord - ExpectedValue)) / (static_cast(2) * StandardDeviation * StandardDeviation); 27 | return exp(-(Squared.x + Squared.y)); 28 | } 29 | }//namespace glm 30 | 31 | -------------------------------------------------------------------------------- /include/glm/gtx/gradient_paint.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_gradient_paint 2 | 3 | namespace glm 4 | { 5 | template 6 | GLM_FUNC_QUALIFIER T radialGradient 7 | ( 8 | vec<2, T, Q> const& Center, 9 | T const& Radius, 10 | vec<2, T, Q> const& Focal, 11 | vec<2, T, Q> const& Position 12 | ) 13 | { 14 | vec<2, T, Q> F = Focal - Center; 15 | vec<2, T, Q> D = Position - Focal; 16 | T Radius2 = pow2(Radius); 17 | T Fx2 = pow2(F.x); 18 | T Fy2 = pow2(F.y); 19 | 20 | T Numerator = (D.x * F.x + D.y * F.y) + sqrt(Radius2 * (pow2(D.x) + pow2(D.y)) - pow2(D.x * F.y - D.y * F.x)); 21 | T Denominator = Radius2 - (Fx2 + Fy2); 22 | return Numerator / Denominator; 23 | } 24 | 25 | template 26 | GLM_FUNC_QUALIFIER T linearGradient 27 | ( 28 | vec<2, T, Q> const& Point0, 29 | vec<2, T, Q> const& Point1, 30 | vec<2, T, Q> const& Position 31 | ) 32 | { 33 | vec<2, T, Q> Dist = Point1 - Point0; 34 | return (Dist.x * (Position.x - Point0.x) + Dist.y * (Position.y - Point0.y)) / glm::dot(Dist, Dist); 35 | } 36 | }//namespace glm 37 | -------------------------------------------------------------------------------- /include/glm/gtx/handed_coordinate_space.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_handed_coordinate_space 2 | 3 | namespace glm 4 | { 5 | template 6 | GLM_FUNC_QUALIFIER bool rightHanded 7 | ( 8 | vec<3, T, Q> const& tangent, 9 | vec<3, T, Q> const& binormal, 10 | vec<3, T, Q> const& normal 11 | ) 12 | { 13 | return dot(cross(normal, tangent), binormal) > T(0); 14 | } 15 | 16 | template 17 | GLM_FUNC_QUALIFIER bool leftHanded 18 | ( 19 | vec<3, T, Q> const& tangent, 20 | vec<3, T, Q> const& binormal, 21 | vec<3, T, Q> const& normal 22 | ) 23 | { 24 | return dot(cross(normal, tangent), binormal) < T(0); 25 | } 26 | }//namespace glm 27 | -------------------------------------------------------------------------------- /include/glm/gtx/log_base.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_log_base 2 | /// @file glm/gtx/log_base.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_log_base GLM_GTX_log_base 7 | /// @ingroup gtx 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// Logarithm for any base. base can be a vector or a scalar. 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../glm.hpp" 17 | 18 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 19 | # ifndef GLM_ENABLE_EXPERIMENTAL 20 | # pragma message("GLM: GLM_GTX_log_base is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") 21 | # elif 22 | # pragma message("GLM: GLM_GTX_log_base extension included") 23 | # endif 24 | #endif 25 | 26 | namespace glm 27 | { 28 | /// @addtogroup gtx_log_base 29 | /// @{ 30 | 31 | /// Logarithm for any base. 32 | /// From GLM_GTX_log_base. 33 | template 34 | GLM_FUNC_DECL genType log( 35 | genType const& x, 36 | genType const& base); 37 | 38 | /// Logarithm for any base. 39 | /// From GLM_GTX_log_base. 40 | template 41 | GLM_FUNC_DECL vec sign( 42 | vec const& x, 43 | vec const& base); 44 | 45 | /// @} 46 | }//namespace glm 47 | 48 | #include "log_base.inl" 49 | -------------------------------------------------------------------------------- /include/glm/gtx/log_base.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_log_base 2 | 3 | namespace glm 4 | { 5 | template 6 | GLM_FUNC_QUALIFIER genType log(genType const& x, genType const& base) 7 | { 8 | return glm::log(x) / glm::log(base); 9 | } 10 | 11 | template 12 | GLM_FUNC_QUALIFIER vec log(vec const& x, vec const& base) 13 | { 14 | return glm::log(x) / glm::log(base); 15 | } 16 | }//namespace glm 17 | -------------------------------------------------------------------------------- /include/glm/gtx/matrix_cross_product.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_matrix_cross_product 2 | /// @file glm/gtx/matrix_cross_product.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtx_extented_min_max (dependence) 6 | /// 7 | /// @defgroup gtx_matrix_cross_product GLM_GTX_matrix_cross_product 8 | /// @ingroup gtx 9 | /// 10 | /// Include to use the features of this extension. 11 | /// 12 | /// Build cross product matrices 13 | 14 | #pragma once 15 | 16 | // Dependency: 17 | #include "../glm.hpp" 18 | 19 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 20 | # ifndef GLM_ENABLE_EXPERIMENTAL 21 | # pragma message("GLM: GLM_GTX_matrix_cross_product is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") 22 | # elif 23 | # pragma message("GLM: GLM_GTX_matrix_cross_product extension included") 24 | # endif 25 | #endif 26 | 27 | namespace glm 28 | { 29 | /// @addtogroup gtx_matrix_cross_product 30 | /// @{ 31 | 32 | //! Build a cross product matrix. 33 | //! From GLM_GTX_matrix_cross_product extension. 34 | template 35 | GLM_FUNC_DECL mat<3, 3, T, Q> matrixCross3( 36 | vec<3, T, Q> const& x); 37 | 38 | //! Build a cross product matrix. 39 | //! From GLM_GTX_matrix_cross_product extension. 40 | template 41 | GLM_FUNC_DECL mat<4, 4, T, Q> matrixCross4( 42 | vec<3, T, Q> const& x); 43 | 44 | /// @} 45 | }//namespace glm 46 | 47 | #include "matrix_cross_product.inl" 48 | -------------------------------------------------------------------------------- /include/glm/gtx/matrix_cross_product.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_matrix_cross_product 2 | 3 | namespace glm 4 | { 5 | template 6 | GLM_FUNC_QUALIFIER mat<3, 3, T, Q> matrixCross3 7 | ( 8 | vec<3, T, Q> const& x 9 | ) 10 | { 11 | mat<3, 3, T, Q> Result(T(0)); 12 | Result[0][1] = x.z; 13 | Result[1][0] = -x.z; 14 | Result[0][2] = -x.y; 15 | Result[2][0] = x.y; 16 | Result[1][2] = x.x; 17 | Result[2][1] = -x.x; 18 | return Result; 19 | } 20 | 21 | template 22 | GLM_FUNC_QUALIFIER mat<4, 4, T, Q> matrixCross4 23 | ( 24 | vec<3, T, Q> const& x 25 | ) 26 | { 27 | mat<4, 4, T, Q> Result(T(0)); 28 | Result[0][1] = x.z; 29 | Result[1][0] = -x.z; 30 | Result[0][2] = -x.y; 31 | Result[2][0] = x.y; 32 | Result[1][2] = x.x; 33 | Result[2][1] = -x.x; 34 | return Result; 35 | } 36 | 37 | }//namespace glm 38 | -------------------------------------------------------------------------------- /include/glm/gtx/matrix_factorisation.inl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chukobyte/learn-engine-dev/3f4437ed4abab9011d584bdc0ab4eff921393f00/include/glm/gtx/matrix_factorisation.inl -------------------------------------------------------------------------------- /include/glm/gtx/mixed_product.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_mixed_product 2 | /// @file glm/gtx/mixed_product.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_mixed_product GLM_GTX_mixed_producte 7 | /// @ingroup gtx 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// Mixed product of 3 vectors. 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../glm.hpp" 17 | 18 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 19 | # ifndef GLM_ENABLE_EXPERIMENTAL 20 | # pragma message("GLM: GLM_GTX_mixed_product is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") 21 | # elif 22 | # pragma message("GLM: GLM_GTX_mixed_product extension included") 23 | # endif 24 | #endif 25 | 26 | namespace glm 27 | { 28 | /// @addtogroup gtx_mixed_product 29 | /// @{ 30 | 31 | /// @brief Mixed product of 3 vectors (from GLM_GTX_mixed_product extension) 32 | template 33 | GLM_FUNC_DECL T mixedProduct( 34 | vec<3, T, Q> const& v1, 35 | vec<3, T, Q> const& v2, 36 | vec<3, T, Q> const& v3); 37 | 38 | /// @} 39 | }// namespace glm 40 | 41 | #include "mixed_product.inl" 42 | -------------------------------------------------------------------------------- /include/glm/gtx/mixed_product.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_mixed_product 2 | 3 | namespace glm 4 | { 5 | template 6 | GLM_FUNC_QUALIFIER T mixedProduct 7 | ( 8 | vec<3, T, Q> const& v1, 9 | vec<3, T, Q> const& v2, 10 | vec<3, T, Q> const& v3 11 | ) 12 | { 13 | return dot(cross(v1, v2), v3); 14 | } 15 | }//namespace glm 16 | -------------------------------------------------------------------------------- /include/glm/gtx/normal.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_normal 2 | /// @file glm/gtx/normal.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtx_extented_min_max (dependence) 6 | /// 7 | /// @defgroup gtx_normal GLM_GTX_normal 8 | /// @ingroup gtx 9 | /// 10 | /// Include to use the features of this extension. 11 | /// 12 | /// Compute the normal of a triangle. 13 | 14 | #pragma once 15 | 16 | // Dependency: 17 | #include "../glm.hpp" 18 | 19 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 20 | # ifndef GLM_ENABLE_EXPERIMENTAL 21 | # pragma message("GLM: GLM_GTX_normal is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") 22 | # elif 23 | # pragma message("GLM: GLM_GTX_normal extension included") 24 | # endif 25 | #endif 26 | 27 | namespace glm 28 | { 29 | /// @addtogroup gtx_normal 30 | /// @{ 31 | 32 | /// Computes triangle normal from triangle points. 33 | /// 34 | /// @see gtx_normal 35 | template 36 | GLM_FUNC_DECL vec<3, T, Q> triangleNormal(vec<3, T, Q> const& p1, vec<3, T, Q> const& p2, vec<3, T, Q> const& p3); 37 | 38 | /// @} 39 | }//namespace glm 40 | 41 | #include "normal.inl" 42 | -------------------------------------------------------------------------------- /include/glm/gtx/normal.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_normal 2 | 3 | namespace glm 4 | { 5 | template 6 | GLM_FUNC_QUALIFIER vec<3, T, Q> triangleNormal 7 | ( 8 | vec<3, T, Q> const& p1, 9 | vec<3, T, Q> const& p2, 10 | vec<3, T, Q> const& p3 11 | ) 12 | { 13 | return normalize(cross(p1 - p2, p1 - p3)); 14 | } 15 | }//namespace glm 16 | -------------------------------------------------------------------------------- /include/glm/gtx/normalize_dot.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_normalize_dot 2 | 3 | namespace glm 4 | { 5 | template 6 | GLM_FUNC_QUALIFIER T normalizeDot(vec const& x, vec const& y) 7 | { 8 | return glm::dot(x, y) * glm::inversesqrt(glm::dot(x, x) * glm::dot(y, y)); 9 | } 10 | 11 | template 12 | GLM_FUNC_QUALIFIER T fastNormalizeDot(vec const& x, vec const& y) 13 | { 14 | return glm::dot(x, y) * glm::fastInverseSqrt(glm::dot(x, x) * glm::dot(y, y)); 15 | } 16 | }//namespace glm 17 | -------------------------------------------------------------------------------- /include/glm/gtx/number_precision.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_number_precision 2 | 3 | namespace glm 4 | { 5 | 6 | } 7 | -------------------------------------------------------------------------------- /include/glm/gtx/optimum_pow.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_optimum_pow 2 | 3 | namespace glm 4 | { 5 | template 6 | GLM_FUNC_QUALIFIER genType pow2(genType const& x) 7 | { 8 | return x * x; 9 | } 10 | 11 | template 12 | GLM_FUNC_QUALIFIER genType pow3(genType const& x) 13 | { 14 | return x * x * x; 15 | } 16 | 17 | template 18 | GLM_FUNC_QUALIFIER genType pow4(genType const& x) 19 | { 20 | return (x * x) * (x * x); 21 | } 22 | }//namespace glm 23 | -------------------------------------------------------------------------------- /include/glm/gtx/orthonormalize.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_orthonormalize 2 | /// @file glm/gtx/orthonormalize.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtx_extented_min_max (dependence) 6 | /// 7 | /// @defgroup gtx_orthonormalize GLM_GTX_orthonormalize 8 | /// @ingroup gtx 9 | /// 10 | /// Include to use the features of this extension. 11 | /// 12 | /// Orthonormalize matrices. 13 | 14 | #pragma once 15 | 16 | // Dependency: 17 | #include "../vec3.hpp" 18 | #include "../mat3x3.hpp" 19 | #include "../geometric.hpp" 20 | 21 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 22 | # ifndef GLM_ENABLE_EXPERIMENTAL 23 | # pragma message("GLM: GLM_GTX_orthonormalize is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") 24 | # elif 25 | # pragma message("GLM: GLM_GTX_orthonormalize extension included") 26 | # endif 27 | #endif 28 | 29 | namespace glm 30 | { 31 | /// @addtogroup gtx_orthonormalize 32 | /// @{ 33 | 34 | /// Returns the orthonormalized matrix of m. 35 | /// 36 | /// @see gtx_orthonormalize 37 | template 38 | GLM_FUNC_DECL mat<3, 3, T, Q> orthonormalize(mat<3, 3, T, Q> const& m); 39 | 40 | /// Orthonormalizes x according y. 41 | /// 42 | /// @see gtx_orthonormalize 43 | template 44 | GLM_FUNC_DECL vec<3, T, Q> orthonormalize(vec<3, T, Q> const& x, vec<3, T, Q> const& y); 45 | 46 | /// @} 47 | }//namespace glm 48 | 49 | #include "orthonormalize.inl" 50 | -------------------------------------------------------------------------------- /include/glm/gtx/orthonormalize.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_orthonormalize 2 | 3 | namespace glm 4 | { 5 | template 6 | GLM_FUNC_QUALIFIER mat<3, 3, T, Q> orthonormalize(mat<3, 3, T, Q> const& m) 7 | { 8 | mat<3, 3, T, Q> r = m; 9 | 10 | r[0] = normalize(r[0]); 11 | 12 | T d0 = dot(r[0], r[1]); 13 | r[1] -= r[0] * d0; 14 | r[1] = normalize(r[1]); 15 | 16 | T d1 = dot(r[1], r[2]); 17 | d0 = dot(r[0], r[2]); 18 | r[2] -= r[0] * d0 + r[1] * d1; 19 | r[2] = normalize(r[2]); 20 | 21 | return r; 22 | } 23 | 24 | template 25 | GLM_FUNC_QUALIFIER vec<3, T, Q> orthonormalize(vec<3, T, Q> const& x, vec<3, T, Q> const& y) 26 | { 27 | return normalize(x - y * dot(y, x)); 28 | } 29 | }//namespace glm 30 | -------------------------------------------------------------------------------- /include/glm/gtx/perpendicular.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_perpendicular 2 | /// @file glm/gtx/perpendicular.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtx_projection (dependence) 6 | /// 7 | /// @defgroup gtx_perpendicular GLM_GTX_perpendicular 8 | /// @ingroup gtx 9 | /// 10 | /// Include to use the features of this extension. 11 | /// 12 | /// Perpendicular of a vector from other one 13 | 14 | #pragma once 15 | 16 | // Dependency: 17 | #include "../glm.hpp" 18 | #include "../gtx/projection.hpp" 19 | 20 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 21 | # ifndef GLM_ENABLE_EXPERIMENTAL 22 | # pragma message("GLM: GLM_GTX_perpendicular is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") 23 | # elif 24 | # pragma message("GLM: GLM_GTX_perpendicular extension included") 25 | # endif 26 | #endif 27 | 28 | namespace glm 29 | { 30 | /// @addtogroup gtx_perpendicular 31 | /// @{ 32 | 33 | //! Projects x a perpendicular axis of Normal. 34 | //! From GLM_GTX_perpendicular extension. 35 | template 36 | GLM_FUNC_DECL genType perp(genType const& x, genType const& Normal); 37 | 38 | /// @} 39 | }//namespace glm 40 | 41 | #include "perpendicular.inl" 42 | -------------------------------------------------------------------------------- /include/glm/gtx/perpendicular.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_perpendicular 2 | 3 | namespace glm 4 | { 5 | template 6 | GLM_FUNC_QUALIFIER genType perp(genType const& x, genType const& Normal) 7 | { 8 | return x - proj(x, Normal); 9 | } 10 | }//namespace glm 11 | -------------------------------------------------------------------------------- /include/glm/gtx/polar_coordinates.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_polar_coordinates 2 | 3 | namespace glm 4 | { 5 | template 6 | GLM_FUNC_QUALIFIER vec<3, T, Q> polar 7 | ( 8 | vec<3, T, Q> const& euclidean 9 | ) 10 | { 11 | T const Length(length(euclidean)); 12 | vec<3, T, Q> const tmp(euclidean / Length); 13 | T const xz_dist(sqrt(tmp.x * tmp.x + tmp.z * tmp.z)); 14 | 15 | return vec<3, T, Q>( 16 | asin(tmp.y), // latitude 17 | atan(tmp.x, tmp.z), // longitude 18 | xz_dist); // xz distance 19 | } 20 | 21 | template 22 | GLM_FUNC_QUALIFIER vec<3, T, Q> euclidean 23 | ( 24 | vec<2, T, Q> const& polar 25 | ) 26 | { 27 | T const latitude(polar.x); 28 | T const longitude(polar.y); 29 | 30 | return vec<3, T, Q>( 31 | cos(latitude) * sin(longitude), 32 | sin(latitude), 33 | cos(latitude) * cos(longitude)); 34 | } 35 | 36 | }//namespace glm 37 | -------------------------------------------------------------------------------- /include/glm/gtx/projection.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_projection 2 | /// @file glm/gtx/projection.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_projection GLM_GTX_projection 7 | /// @ingroup gtx 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// Projection of a vector to other one 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../geometric.hpp" 17 | 18 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 19 | # ifndef GLM_ENABLE_EXPERIMENTAL 20 | # pragma message("GLM: GLM_GTX_projection is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") 21 | # elif 22 | # pragma message("GLM: GLM_GTX_projection extension included") 23 | # endif 24 | #endif 25 | 26 | namespace glm 27 | { 28 | /// @addtogroup gtx_projection 29 | /// @{ 30 | 31 | /// Projects x on Normal. 32 | /// 33 | /// @param[in] x A vector to project 34 | /// @param[in] Normal A normal that doesn't need to be of unit length. 35 | /// 36 | /// @see gtx_projection 37 | template 38 | GLM_FUNC_DECL genType proj(genType const& x, genType const& Normal); 39 | 40 | /// @} 41 | }//namespace glm 42 | 43 | #include "projection.inl" 44 | -------------------------------------------------------------------------------- /include/glm/gtx/projection.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_projection 2 | 3 | namespace glm 4 | { 5 | template 6 | GLM_FUNC_QUALIFIER genType proj(genType const& x, genType const& Normal) 7 | { 8 | return glm::dot(x, Normal) / glm::dot(Normal, Normal) * Normal; 9 | } 10 | }//namespace glm 11 | -------------------------------------------------------------------------------- /include/glm/gtx/raw_data.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_raw_data 2 | /// @file glm/gtx/raw_data.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_raw_data GLM_GTX_raw_data 7 | /// @ingroup gtx 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// Projection of a vector to other one 12 | 13 | #pragma once 14 | 15 | // Dependencies 16 | #include "../ext/scalar_uint_sized.hpp" 17 | #include "../detail/setup.hpp" 18 | 19 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 20 | # ifndef GLM_ENABLE_EXPERIMENTAL 21 | # pragma message("GLM: GLM_GTX_raw_data is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") 22 | # elif 23 | # pragma message("GLM: GLM_GTX_raw_data extension included") 24 | # endif 25 | #endif 26 | 27 | namespace glm 28 | { 29 | /// @addtogroup gtx_raw_data 30 | /// @{ 31 | 32 | //! Type for byte numbers. 33 | //! From GLM_GTX_raw_data extension. 34 | typedef detail::uint8 byte; 35 | 36 | //! Type for word numbers. 37 | //! From GLM_GTX_raw_data extension. 38 | typedef detail::uint16 word; 39 | 40 | //! Type for dword numbers. 41 | //! From GLM_GTX_raw_data extension. 42 | typedef detail::uint32 dword; 43 | 44 | //! Type for qword numbers. 45 | //! From GLM_GTX_raw_data extension. 46 | typedef detail::uint64 qword; 47 | 48 | /// @} 49 | }// namespace glm 50 | 51 | #include "raw_data.inl" 52 | -------------------------------------------------------------------------------- /include/glm/gtx/raw_data.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_raw_data 2 | 3 | -------------------------------------------------------------------------------- /include/glm/gtx/scalar_relational.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_scalar_relational 2 | /// @file glm/gtx/scalar_relational.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_scalar_relational GLM_GTX_scalar_relational 7 | /// @ingroup gtx 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// Extend a position from a source to a position at a defined length. 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../glm.hpp" 17 | 18 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 19 | # ifndef GLM_ENABLE_EXPERIMENTAL 20 | # pragma message("GLM: GLM_GTX_extend is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") 21 | # elif 22 | # pragma message("GLM: GLM_GTX_extend extension included") 23 | # endif 24 | #endif 25 | 26 | namespace glm 27 | { 28 | /// @addtogroup gtx_scalar_relational 29 | /// @{ 30 | 31 | 32 | 33 | /// @} 34 | }//namespace glm 35 | 36 | #include "scalar_relational.inl" 37 | -------------------------------------------------------------------------------- /include/glm/gtx/scalar_relational.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_scalar_relational 2 | 3 | namespace glm 4 | { 5 | template 6 | GLM_FUNC_QUALIFIER bool lessThan 7 | ( 8 | T const& x, 9 | T const& y 10 | ) 11 | { 12 | return x < y; 13 | } 14 | 15 | template 16 | GLM_FUNC_QUALIFIER bool lessThanEqual 17 | ( 18 | T const& x, 19 | T const& y 20 | ) 21 | { 22 | return x <= y; 23 | } 24 | 25 | template 26 | GLM_FUNC_QUALIFIER bool greaterThan 27 | ( 28 | T const& x, 29 | T const& y 30 | ) 31 | { 32 | return x > y; 33 | } 34 | 35 | template 36 | GLM_FUNC_QUALIFIER bool greaterThanEqual 37 | ( 38 | T const& x, 39 | T const& y 40 | ) 41 | { 42 | return x >= y; 43 | } 44 | 45 | template 46 | GLM_FUNC_QUALIFIER bool equal 47 | ( 48 | T const& x, 49 | T const& y 50 | ) 51 | { 52 | return detail::compute_equal::is_iec559>::call(x, y); 53 | } 54 | 55 | template 56 | GLM_FUNC_QUALIFIER bool notEqual 57 | ( 58 | T const& x, 59 | T const& y 60 | ) 61 | { 62 | return !detail::compute_equal::is_iec559>::call(x, y); 63 | } 64 | 65 | GLM_FUNC_QUALIFIER bool any 66 | ( 67 | bool const& x 68 | ) 69 | { 70 | return x; 71 | } 72 | 73 | GLM_FUNC_QUALIFIER bool all 74 | ( 75 | bool const& x 76 | ) 77 | { 78 | return x; 79 | } 80 | 81 | GLM_FUNC_QUALIFIER bool not_ 82 | ( 83 | bool const& x 84 | ) 85 | { 86 | return !x; 87 | } 88 | }//namespace glm 89 | -------------------------------------------------------------------------------- /include/glm/gtx/std_based_type.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_std_based_type 2 | 3 | namespace glm 4 | { 5 | 6 | } 7 | -------------------------------------------------------------------------------- /include/glm/gtx/texture.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_texture 2 | /// @file glm/gtx/texture.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_texture GLM_GTX_texture 7 | /// @ingroup gtx 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// Wrapping mode of texture coordinates. 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../glm.hpp" 17 | #include "../gtc/integer.hpp" 18 | #include "../gtx/component_wise.hpp" 19 | 20 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 21 | # ifndef GLM_ENABLE_EXPERIMENTAL 22 | # pragma message("GLM: GLM_GTX_texture is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") 23 | # elif 24 | # pragma message("GLM: GLM_GTX_texture extension included") 25 | # endif 26 | #endif 27 | 28 | namespace glm 29 | { 30 | /// @addtogroup gtx_texture 31 | /// @{ 32 | 33 | /// Compute the number of mipmaps levels necessary to create a mipmap complete texture 34 | /// 35 | /// @param Extent Extent of the texture base level mipmap 36 | /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector 37 | /// @tparam T Floating-point or signed integer scalar types 38 | /// @tparam Q Value from qualifier enum 39 | template 40 | T levels(vec const& Extent); 41 | 42 | /// @} 43 | }// namespace glm 44 | 45 | #include "texture.inl" 46 | 47 | -------------------------------------------------------------------------------- /include/glm/gtx/texture.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_texture 2 | 3 | namespace glm 4 | { 5 | template 6 | inline T levels(vec const& Extent) 7 | { 8 | return glm::log2(compMax(Extent)) + static_cast(1); 9 | } 10 | 11 | template 12 | inline T levels(T Extent) 13 | { 14 | return vec<1, T, defaultp>(Extent).x; 15 | } 16 | }//namespace glm 17 | 18 | -------------------------------------------------------------------------------- /include/glm/gtx/transform.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_transform 2 | 3 | namespace glm 4 | { 5 | template 6 | GLM_FUNC_QUALIFIER mat<4, 4, T, Q> translate(vec<3, T, Q> const& v) 7 | { 8 | return translate(mat<4, 4, T, Q>(static_cast(1)), v); 9 | } 10 | 11 | template 12 | GLM_FUNC_QUALIFIER mat<4, 4, T, Q> rotate(T angle, vec<3, T, Q> const& v) 13 | { 14 | return rotate(mat<4, 4, T, Q>(static_cast(1)), angle, v); 15 | } 16 | 17 | template 18 | GLM_FUNC_QUALIFIER mat<4, 4, T, Q> scale(vec<3, T, Q> const& v) 19 | { 20 | return scale(mat<4, 4, T, Q>(static_cast(1)), v); 21 | } 22 | 23 | }//namespace glm 24 | -------------------------------------------------------------------------------- /include/glm/gtx/type_aligned.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtc_type_aligned 2 | 3 | namespace glm 4 | { 5 | 6 | } 7 | -------------------------------------------------------------------------------- /include/glm/mat2x2.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/mat2x2.hpp 3 | 4 | #pragma once 5 | #include "./ext/matrix_double2x2.hpp" 6 | #include "./ext/matrix_double2x2_precision.hpp" 7 | #include "./ext/matrix_float2x2.hpp" 8 | #include "./ext/matrix_float2x2_precision.hpp" 9 | 10 | -------------------------------------------------------------------------------- /include/glm/mat2x3.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/mat2x3.hpp 3 | 4 | #pragma once 5 | #include "./ext/matrix_double2x3.hpp" 6 | #include "./ext/matrix_double2x3_precision.hpp" 7 | #include "./ext/matrix_float2x3.hpp" 8 | #include "./ext/matrix_float2x3_precision.hpp" 9 | 10 | -------------------------------------------------------------------------------- /include/glm/mat2x4.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/mat2x4.hpp 3 | 4 | #pragma once 5 | #include "./ext/matrix_double2x4.hpp" 6 | #include "./ext/matrix_double2x4_precision.hpp" 7 | #include "./ext/matrix_float2x4.hpp" 8 | #include "./ext/matrix_float2x4_precision.hpp" 9 | 10 | -------------------------------------------------------------------------------- /include/glm/mat3x2.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/mat3x2.hpp 3 | 4 | #pragma once 5 | #include "./ext/matrix_double3x2.hpp" 6 | #include "./ext/matrix_double3x2_precision.hpp" 7 | #include "./ext/matrix_float3x2.hpp" 8 | #include "./ext/matrix_float3x2_precision.hpp" 9 | 10 | -------------------------------------------------------------------------------- /include/glm/mat3x3.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/mat3x3.hpp 3 | 4 | #pragma once 5 | #include "./ext/matrix_double3x3.hpp" 6 | #include "./ext/matrix_double3x3_precision.hpp" 7 | #include "./ext/matrix_float3x3.hpp" 8 | #include "./ext/matrix_float3x3_precision.hpp" 9 | -------------------------------------------------------------------------------- /include/glm/mat3x4.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/mat3x4.hpp 3 | 4 | #pragma once 5 | #include "./ext/matrix_double3x4.hpp" 6 | #include "./ext/matrix_double3x4_precision.hpp" 7 | #include "./ext/matrix_float3x4.hpp" 8 | #include "./ext/matrix_float3x4_precision.hpp" 9 | -------------------------------------------------------------------------------- /include/glm/mat4x2.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/mat4x2.hpp 3 | 4 | #pragma once 5 | #include "./ext/matrix_double4x2.hpp" 6 | #include "./ext/matrix_double4x2_precision.hpp" 7 | #include "./ext/matrix_float4x2.hpp" 8 | #include "./ext/matrix_float4x2_precision.hpp" 9 | 10 | -------------------------------------------------------------------------------- /include/glm/mat4x3.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/mat4x3.hpp 3 | 4 | #pragma once 5 | #include "./ext/matrix_double4x3.hpp" 6 | #include "./ext/matrix_double4x3_precision.hpp" 7 | #include "./ext/matrix_float4x3.hpp" 8 | #include "./ext/matrix_float4x3_precision.hpp" 9 | -------------------------------------------------------------------------------- /include/glm/mat4x4.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/mat4x4.hpp 3 | 4 | #pragma once 5 | #include "./ext/matrix_double4x4.hpp" 6 | #include "./ext/matrix_double4x4_precision.hpp" 7 | #include "./ext/matrix_float4x4.hpp" 8 | #include "./ext/matrix_float4x4_precision.hpp" 9 | 10 | -------------------------------------------------------------------------------- /include/glm/simd/exponential.h: -------------------------------------------------------------------------------- 1 | /// @ref simd 2 | /// @file glm/simd/experimental.h 3 | 4 | #pragma once 5 | 6 | #include "platform.h" 7 | 8 | #if GLM_ARCH & GLM_ARCH_SSE2_BIT 9 | 10 | GLM_FUNC_QUALIFIER glm_f32vec4 glm_vec1_sqrt_lowp(glm_f32vec4 x) 11 | { 12 | return _mm_mul_ss(_mm_rsqrt_ss(x), x); 13 | } 14 | 15 | GLM_FUNC_QUALIFIER glm_f32vec4 glm_vec4_sqrt_lowp(glm_f32vec4 x) 16 | { 17 | return _mm_mul_ps(_mm_rsqrt_ps(x), x); 18 | } 19 | 20 | #endif//GLM_ARCH & GLM_ARCH_SSE2_BIT 21 | -------------------------------------------------------------------------------- /include/glm/simd/packing.h: -------------------------------------------------------------------------------- 1 | /// @ref simd 2 | /// @file glm/simd/packing.h 3 | 4 | #pragma once 5 | 6 | #if GLM_ARCH & GLM_ARCH_SSE2_BIT 7 | 8 | #endif//GLM_ARCH & GLM_ARCH_SSE2_BIT 9 | -------------------------------------------------------------------------------- /include/glm/simd/trigonometric.h: -------------------------------------------------------------------------------- 1 | /// @ref simd 2 | /// @file glm/simd/trigonometric.h 3 | 4 | #pragma once 5 | 6 | #if GLM_ARCH & GLM_ARCH_SSE2_BIT 7 | 8 | #endif//GLM_ARCH & GLM_ARCH_SSE2_BIT 9 | 10 | -------------------------------------------------------------------------------- /include/glm/simd/vector_relational.h: -------------------------------------------------------------------------------- 1 | /// @ref simd 2 | /// @file glm/simd/vector_relational.h 3 | 4 | #pragma once 5 | 6 | #if GLM_ARCH & GLM_ARCH_SSE2_BIT 7 | 8 | #endif//GLM_ARCH & GLM_ARCH_SSE2_BIT 9 | -------------------------------------------------------------------------------- /include/glm/vec2.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/vec2.hpp 3 | 4 | #pragma once 5 | #include "./ext/vector_bool2.hpp" 6 | #include "./ext/vector_bool2_precision.hpp" 7 | #include "./ext/vector_float2.hpp" 8 | #include "./ext/vector_float2_precision.hpp" 9 | #include "./ext/vector_double2.hpp" 10 | #include "./ext/vector_double2_precision.hpp" 11 | #include "./ext/vector_int2.hpp" 12 | #include "./ext/vector_int2_precision.hpp" 13 | #include "./ext/vector_uint2.hpp" 14 | #include "./ext/vector_uint2_precision.hpp" 15 | -------------------------------------------------------------------------------- /include/glm/vec3.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/vec3.hpp 3 | 4 | #pragma once 5 | #include "./ext/vector_bool3.hpp" 6 | #include "./ext/vector_bool3_precision.hpp" 7 | #include "./ext/vector_float3.hpp" 8 | #include "./ext/vector_float3_precision.hpp" 9 | #include "./ext/vector_double3.hpp" 10 | #include "./ext/vector_double3_precision.hpp" 11 | #include "./ext/vector_int3.hpp" 12 | #include "./ext/vector_int3_precision.hpp" 13 | #include "./ext/vector_uint3.hpp" 14 | #include "./ext/vector_uint3_precision.hpp" 15 | -------------------------------------------------------------------------------- /include/glm/vec4.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/vec4.hpp 3 | 4 | #pragma once 5 | #include "./ext/vector_bool4.hpp" 6 | #include "./ext/vector_bool4_precision.hpp" 7 | #include "./ext/vector_float4.hpp" 8 | #include "./ext/vector_float4_precision.hpp" 9 | #include "./ext/vector_double4.hpp" 10 | #include "./ext/vector_double4_precision.hpp" 11 | #include "./ext/vector_int4.hpp" 12 | #include "./ext/vector_int4_precision.hpp" 13 | #include "./ext/vector_uint4.hpp" 14 | #include "./ext/vector_uint4_precision.hpp" 15 | 16 | -------------------------------------------------------------------------------- /include/re/animation/animation.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../rendering/texture.h" 6 | #include "../math/redmath.h" 7 | 8 | struct AnimationFrame { 9 | Texture *texture = nullptr; 10 | Rect2 drawSource; 11 | int frame; 12 | }; 13 | 14 | struct Animation { 15 | std::string name; 16 | int speed; 17 | std::unordered_map animationFrames; 18 | unsigned int frames; // Caches number of frames to system doesn't have to count elements of map 19 | }; 20 | -------------------------------------------------------------------------------- /include/re/camera/camera2d.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "re/math/redmath.h" 4 | 5 | struct Camera2D { 6 | Vector2 viewport = Vector2(0.0f, 0.0f); 7 | Vector2 zoom = Vector2(1.0f, 1.0f); 8 | Vector2 offset = Vector2(0.0f, 0.0f); 9 | Rect2 boundary = Rect2(-10000000.0f, -10000000.0f, 10000000.0f, 10000000.0f); 10 | }; 11 | -------------------------------------------------------------------------------- /include/re/camera/camera_manager.cpp: -------------------------------------------------------------------------------- 1 | #include "camera_manager.h" 2 | 3 | Camera2D CameraManager::GetCurrentCamera() { 4 | return camera2D; 5 | } 6 | 7 | void CameraManager::UpdateCurrentCamera2D(Camera2D updatedCamera) { 8 | camera2D = updatedCamera; 9 | } 10 | 11 | void CameraManager::ResetCamera2D() { 12 | camera2D = Camera2D{}; 13 | } 14 | -------------------------------------------------------------------------------- /include/re/camera/camera_manager.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../utils/singleton.h" 4 | 5 | #include "camera2d.h" 6 | 7 | class CameraManager : public Singleton { 8 | public: 9 | CameraManager(singleton) {} 10 | Camera2D GetCurrentCamera(); 11 | void UpdateCurrentCamera2D(Camera2D updatedCamera); 12 | void ResetCamera2D(); 13 | 14 | private: 15 | Camera2D camera2D; 16 | }; 17 | -------------------------------------------------------------------------------- /include/re/collision/collision_context.cpp: -------------------------------------------------------------------------------- 1 | #include "collision_context.h" 2 | 3 | #include "../ecs/component/components/collider_component.h" 4 | #include "../ecs/component/components/transform2d_component.h" 5 | #include "../scene/scene_node_utils.h" 6 | 7 | CollisionContext::CollisionContext(singleton) : componentManager(ComponentManager::GetInstance()) {} 8 | 9 | Rect2 CollisionContext::GetCollisionRectangle(Entity entity) { 10 | ColliderComponent colliderComponent = componentManager->GetComponent(entity); 11 | Transform2DComponent translatedTransform = SceneNodeUtils::TranslateEntityTransformIntoWorld(entity); 12 | return Rect2(translatedTransform.position.x + colliderComponent.collider.x, 13 | translatedTransform.position.y + colliderComponent.collider.y, 14 | translatedTransform.scale.x * colliderComponent.collider.w, 15 | translatedTransform.scale.y * colliderComponent.collider.h); 16 | } 17 | 18 | bool CollisionContext::IsTargetCollisionEntityInExceptionList(Entity sourceEntity, Entity targetEntity) { 19 | ColliderComponent sourceColliderComponent = componentManager->GetComponent(sourceEntity); 20 | return std::find(sourceColliderComponent.collisionExceptions.begin(), sourceColliderComponent.collisionExceptions.end(), targetEntity) != sourceColliderComponent.collisionExceptions.end(); 21 | } 22 | -------------------------------------------------------------------------------- /include/re/collision/collision_context.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../utils/singleton.h" 4 | 5 | #include 6 | 7 | #include "../math/redmath.h" 8 | #include "../ecs/component/component_manager.h" 9 | 10 | struct CollisionResult { 11 | Entity sourceEntity = NULL_ENTITY; 12 | std::vector collidedEntities; 13 | }; 14 | 15 | class CollisionContext : public Singleton { 16 | public: 17 | CollisionContext(singleton); 18 | Rect2 GetCollisionRectangle(Entity entity); 19 | bool IsTargetCollisionEntityInExceptionList(Entity sourceEntity, Entity targetEntity); 20 | 21 | private: 22 | ComponentManager* componentManager = nullptr; 23 | 24 | }; 25 | -------------------------------------------------------------------------------- /include/re/collision/collision_utils.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../ecs/ecs_orchestrator.h" 4 | #include "../ecs/system/systems/collision_ec_system.h" 5 | 6 | class CollisionUtils { 7 | public: 8 | static CollisionResult GetEntityCollisionResult(Entity entity) { 9 | static CollisionECSystem* collisionSystem = ECSOrchestrator::GetInstance()->GetSystem(); 10 | return collisionSystem->GetEntityCollisionResult(entity); 11 | } 12 | 13 | static CollisionResult GetEntityCollisionResultByTag(Entity entity, const std::string& tag) { 14 | static CollisionECSystem* collisionSystem = ECSOrchestrator::GetInstance()->GetSystem(); 15 | return collisionSystem->GetEntityCollisionResultByTag(entity, tag); 16 | } 17 | }; 18 | -------------------------------------------------------------------------------- /include/re/data/constants.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace Timing { 4 | namespace Update { 5 | const unsigned int MILLISECONDS_PER_TICK = 1000; 6 | } 7 | namespace Physics { 8 | const float DELTA_TIME = 0.01f; 9 | const Uint32 MAX_FRAME_TIME = 250; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /include/re/ecs/component/component.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | const std::uint32_t MAX_COMPONENT_TYPES = 32; 6 | 7 | using ComponentType = std::uint32_t; 8 | using ComponentSignature = std::bitset; 9 | -------------------------------------------------------------------------------- /include/re/ecs/component/component_manager.cpp: -------------------------------------------------------------------------------- 1 | #include "component_manager.h" 2 | 3 | void ComponentManager::EntityDestroyed(Entity entity) { 4 | for (auto const &pair : componentArrays) { 5 | auto const &component = pair.second; 6 | component->EntityDestroyed(entity); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /include/re/ecs/component/components/animated_sprite_component.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #include "re/animation/animation.h" 7 | 8 | struct AnimatedSpriteComponent { 9 | std::unordered_map animations; 10 | Animation currentAnimation; // Preselects first added animation 11 | bool isPlaying; 12 | bool flipX = false; 13 | bool flipY = false; 14 | Color modulate = Color(1.0f, 1.0f, 1.0f, 1.0f); 15 | unsigned int currentFrameIndex = 0; 16 | }; 17 | -------------------------------------------------------------------------------- /include/re/ecs/component/components/collider_component.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../../../math/redmath.h" 6 | #include "../../../rendering/color.h" 7 | 8 | const Color DEFAULT_COLLIDER_COMPONENT_COLOR = Color::NormalizedColor(95, 205, 228, 190); 9 | 10 | struct ColliderComponent { 11 | public: 12 | Rect2 collider = Rect2(); 13 | Color color = DEFAULT_COLLIDER_COMPONENT_COLOR; 14 | std::vector collisionExceptions; 15 | }; 16 | -------------------------------------------------------------------------------- /include/re/ecs/component/components/node_component.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | struct NodeComponent { 7 | std::string name; 8 | std::vector tags; 9 | }; 10 | -------------------------------------------------------------------------------- /include/re/ecs/component/components/scene_component.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | struct SceneComponent { 7 | std::string name; 8 | std::vector tags; 9 | bool ignoreCamera = false; 10 | }; 11 | -------------------------------------------------------------------------------- /include/re/ecs/component/components/sprite_component.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../component.h" 4 | #include "../../../rendering/texture.h" 5 | #include "../../../rendering/color.h" 6 | #include "re/math/redmath.h" 7 | 8 | struct SpriteComponent { 9 | Texture* texture = nullptr; 10 | Rect2 drawSource; 11 | bool flipX = false; 12 | bool flipY = false; 13 | Color modulate = Color(1.0f, 1.0f, 1.0f, 1.0f); 14 | Rect2 drawDestination; // Updated when drawing to position 15 | }; 16 | -------------------------------------------------------------------------------- /include/re/ecs/component/components/text_label_component.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../../rendering/font.h" 4 | #include "../../../rendering/color.h" 5 | 6 | struct TextLabelComponent { 7 | std::string text; 8 | Font *font = nullptr; 9 | Color color; 10 | }; 11 | -------------------------------------------------------------------------------- /include/re/ecs/component/components/transform2d_component.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "re/math/redmath.h" 4 | 5 | struct Transform2DComponent { 6 | Vector2 position = Vector2(0.0f, 0.0f); 7 | Vector2 scale = Vector2(1.0f, 1.0f); 8 | float rotation = 0.0f; 9 | int zIndex = 0; 10 | bool isZIndexRelativeToParent = true; 11 | bool ignoreCamera = false; 12 | }; 13 | -------------------------------------------------------------------------------- /include/re/ecs/entity/entity.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | using Entity = unsigned int; 4 | 5 | const Entity MAX_ENTITIES = 20000; 6 | const Entity NULL_ENTITY = 0; 7 | -------------------------------------------------------------------------------- /include/re/ecs/entity/entity_manager.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../utils/singleton.h" 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #include "entity.h" 12 | #include "../component/component.h" 13 | 14 | class EntityManager : public Singleton { 15 | public: 16 | EntityManager(singleton) {} 17 | Entity CreateEntity(); 18 | void DestroyEntity(Entity entity); 19 | void DeleteEntitiesQueuedForDeletion(); 20 | unsigned int GetAliveEntities(); 21 | void SetSignature(Entity entity, ComponentSignature signature); 22 | void SetEnabledSignature(Entity entity, ComponentSignature signature); 23 | void ResetEnabledSignature(Entity entity); 24 | ComponentSignature GetSignature(Entity entity); 25 | ComponentSignature GetEnabledSignature(Entity entity); 26 | 27 | private: 28 | unsigned int entityIdCounter = 1; // Starts at 1 as 0 is invalid 29 | unsigned int livingEntityCounter = 0; 30 | std::queue availableEntityIds; 31 | std::array signatures; 32 | std::array enabledSignatures; 33 | std::vector entitiesToDelete; 34 | 35 | Entity GetUniqueEntityId(); 36 | }; 37 | -------------------------------------------------------------------------------- /include/re/ecs/entity/entity_tag_cache.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #include "entity.h" 7 | 8 | class EntityTagCache { 9 | public: 10 | void AddEntityTags(Entity entity, const std::vector tags) { 11 | for (const std::string& tag : tags) { 12 | if (!HasTag(tag)) { 13 | entityTagCache.emplace(tag, std::set {}); 14 | } 15 | entityTagCache[tag].insert(entity); 16 | } 17 | } 18 | 19 | void RemoveEntityTags(Entity entity, const std::vector tags) { 20 | for (const std::string& tag : tags) { 21 | if (HasTag(tag)) { 22 | entityTagCache[tag].erase(entity); 23 | } 24 | } 25 | } 26 | 27 | bool HasTag(const std::string& tag) { 28 | return entityTagCache.count(tag) > 0; 29 | } 30 | 31 | std::set GetTaggedEntities(const std::string& tag) { 32 | if (HasTag(tag)) { 33 | return entityTagCache[tag]; 34 | } 35 | return {}; 36 | } 37 | private: 38 | std::unordered_map> entityTagCache = {}; 39 | }; 40 | -------------------------------------------------------------------------------- /include/re/ecs/system/systems/text_rendering_ec_system.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../ec_system.h" 4 | 5 | #include "../../../scene/scene_node_utils.h" 6 | #include "../../component/components/transform2d_component.h" 7 | #include "../../component/components/text_label_component.h" 8 | #include "../../../rendering/renderer_2d.h" 9 | 10 | class TextRenderingECSystem : public ECSystem { 11 | private: 12 | Renderer2D *renderer2D = nullptr; 13 | ComponentManager *componentManager = nullptr; 14 | 15 | public: 16 | TextRenderingECSystem() : renderer2D(Renderer2D::GetInstance()), componentManager(ComponentManager::GetInstance()) {} 17 | 18 | void Render() override { 19 | if (IsEnabled()) { 20 | for (Entity entity : entities) { 21 | Transform2DComponent translatedTransform = SceneNodeUtils::TranslateEntityTransformIntoWorld(entity); 22 | TextLabelComponent textLabelComponent = componentManager->GetComponent(entity); 23 | renderer2D->SubmitFontBatchItem( 24 | textLabelComponent.font, 25 | textLabelComponent.text, 26 | translatedTransform.position.x, 27 | translatedTransform.position.y, 28 | translatedTransform.zIndex, 29 | translatedTransform.scale.x, 30 | textLabelComponent.color 31 | ); 32 | } 33 | } 34 | } 35 | }; 36 | -------------------------------------------------------------------------------- /include/re/game_engine_context.cpp: -------------------------------------------------------------------------------- 1 | #include "game_engine_context.h" 2 | 3 | const char* GameEngineContext::GetEngineVersion() const { 4 | return engineVersion; 5 | } 6 | 7 | const char* GameEngineContext::GetEngineName() const { 8 | return engineName; 9 | } 10 | 11 | void GameEngineContext::SetRunning(bool value) { 12 | running = value; 13 | } 14 | 15 | bool GameEngineContext::IsRunning() const { 16 | return running; 17 | } 18 | -------------------------------------------------------------------------------- /include/re/game_engine_context.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "utils/singleton.h" 4 | 5 | class GameEngineContext : public Singleton { 6 | public: 7 | GameEngineContext(singleton) {} 8 | const char* GetEngineVersion() const; 9 | const char* GetEngineName() const; 10 | void SetRunning(bool value); 11 | bool IsRunning() const; 12 | 13 | 14 | private: 15 | const char *engineVersion = "0.1.0"; 16 | const char *engineName = "Red"; 17 | 18 | bool running = false; 19 | }; 20 | -------------------------------------------------------------------------------- /include/re/input/input_manager.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "input_action.h" 6 | #include "mouse_input.h" 7 | #include "joystick_input.h" 8 | #include "input_event_state.h" 9 | #include "re/project_properties.h" 10 | 11 | class InputManager { 12 | public: 13 | static InputManager* GetInstance(); 14 | void Initialize(); 15 | void ProcessInputs(SDL_Event &event); 16 | void ClearInputFlags(); 17 | void AddAction(const std::string &actionName, const std::string &actionValue); 18 | void RemoveAction(const std::string &actionName); 19 | bool IsActionPressed(const std::string &actionName); 20 | bool IsActionJustPressed(const std::string &actionName); 21 | bool IsActionJustReleased(const std::string &actionName); 22 | InputEvent GetCurrentInputEvent() const; 23 | void LoadInputActionConfigurations(InputActionsConfigurations inputActionsConfigurations); 24 | 25 | private: 26 | MouseInput *mouseInput = nullptr; 27 | JoystickInput *joystickInput = nullptr; 28 | InputEvent currentInputEvent; 29 | InputEventState inputEventState; 30 | std::unordered_map inputActions; 31 | 32 | InputManager(); 33 | }; 34 | -------------------------------------------------------------------------------- /include/re/math/physics.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "redmath.h" 4 | 5 | namespace RedMath { 6 | static constexpr float FLOAT_EPSILON = 0.001f; 7 | 8 | static bool IsFloatGreaterOrEqual(float a, float b) { 9 | return fabs(a - b) < FLOAT_EPSILON || a > b; 10 | } 11 | 12 | namespace Collision { 13 | static bool AABB(Rect2 source, Rect2 target) { 14 | return IsFloatGreaterOrEqual(source.x + source.w, target.x) && 15 | IsFloatGreaterOrEqual(target.x + target.w, source.x) && 16 | IsFloatGreaterOrEqual(source.y + source.h, target.y) && 17 | IsFloatGreaterOrEqual(target.y + target.h, source.y); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /include/re/math/rectangle.cpp: -------------------------------------------------------------------------------- 1 | #include "rectangle.h" 2 | 3 | std::ostream& operator<<(std::ostream& os, const Rectangle &r) { 4 | os << "(" << r.x << ", " << r.y << ", " << r.w << ", " << r.h << ")"; 5 | return os; 6 | } 7 | -------------------------------------------------------------------------------- /include/re/math/rectangle.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include 6 | 7 | class Rectangle { 8 | public: 9 | float x; 10 | float y; 11 | float w; 12 | float h; 13 | 14 | Rectangle(): x(0.0f), y(0.0f), w(0.0f), h(0.0f) {} 15 | Rectangle(float x, float y, float w, float h): x(x), y(y), w(w), h(h) {} 16 | Rectangle(float x, float y, glm::vec2 size): x(x), y(y), w(size.x), h(size.y) {} 17 | Rectangle(glm::vec2 position, glm::vec2 size): x(position.x), y(position.y), w(size.x), h(size.y) {} 18 | 19 | bool operator==(const Rectangle &otherRect2) const { 20 | return this->x == otherRect2.x && this->y == otherRect2.y && this->w == otherRect2.w && this->h == otherRect2.h; 21 | } 22 | 23 | bool operator!=(const Rectangle &otherRect2) const { 24 | return !(*this == otherRect2); 25 | } 26 | 27 | friend std::ostream& operator<<(std::ostream& os, const Rectangle &r); 28 | }; 29 | -------------------------------------------------------------------------------- /include/re/math/redmath.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "rectangle.h" 4 | 5 | using Vector2 = glm::vec2; 6 | using IVector2 = glm::ivec2; 7 | using Vector3 = glm::vec3; 8 | using Matrix4 = glm::mat4; 9 | using Rect2 = Rectangle; 10 | -------------------------------------------------------------------------------- /include/re/python/python_modules.cpp: -------------------------------------------------------------------------------- 1 | #include "python_modules.h" 2 | #include 3 | 4 | PyObject* EnginePythonModule::get_version(PyObject *self, PyObject *args) { 5 | return Py_BuildValue("s", "v0.0.1"); 6 | } 7 | 8 | PyObject* EnginePythonModule::print_log(PyObject *self, PyObject *args, PyObject *kwargs) { 9 | char *message; 10 | if (PyArg_ParseTupleAndKeywords(args, kwargs, "s", enginePrintLogKWList, &message)) { 11 | std::cout << "[INFO] " << message << std::endl; 12 | Py_RETURN_NONE; 13 | } 14 | return nullptr; 15 | } 16 | -------------------------------------------------------------------------------- /include/re/python/python_modules.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define PY_SSIZE_T_CLEAN 4 | 5 | #include 6 | #include 7 | 8 | class EnginePythonModule { 9 | public: 10 | static PyObject* get_version(PyObject* self, PyObject* args); 11 | static PyObject* print_log(PyObject* self, PyObject* args, PyObject* kwargs); 12 | }; 13 | 14 | static struct PyMethodDef engineModuleMethods[] = { 15 | { 16 | "get_version", EnginePythonModule::get_version, 17 | METH_VARARGS, "Gets version of the engine." 18 | }, 19 | { 20 | "print_log", (PyCFunction) EnginePythonModule::print_log, 21 | METH_VARARGS | METH_KEYWORDS, "Logs a message to the console." 22 | }, 23 | 24 | {nullptr, nullptr, 0,nullptr }, 25 | }; 26 | 27 | static struct PyModuleDef engineModuleDefinition = { 28 | PyModuleDef_HEAD_INIT, "engine", nullptr, -1, engineModuleMethods, 29 | nullptr, nullptr, nullptr, nullptr 30 | }; 31 | 32 | static char *enginePrintLogKWList[] = {"message", nullptr}; 33 | 34 | static PyObject* PyInit_engine(void) { 35 | return PyModule_Create(&engineModuleDefinition); 36 | } 37 | -------------------------------------------------------------------------------- /include/re/rendering/color.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | class Color { 6 | public: 7 | float r = 1.0f; 8 | float g = 1.0f; 9 | float b = 1.0f; 10 | float a = 1.0f; 11 | 12 | Color() {} 13 | Color(GLfloat red, GLfloat green, GLfloat blue) : r(red), g(green), b(blue), a(1.0f) {} 14 | Color(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) : r(red), g(green), b(blue), a(alpha) {} 15 | 16 | static Color NormalizedColor(int red, int green, int blue) { 17 | return Color(red / 255.0f, green / 255.0f, blue / 255.0f); 18 | } 19 | 20 | static Color NormalizedColor(int red, int green, int blue, int alpha) { 21 | return Color(red / 255.0f, green / 255.0f, blue / 255.0f, alpha / 255.0f); 22 | } 23 | 24 | Color operator*(float value) { 25 | return Color(this->r * value, this->g * value, this->b * value, this->a); 26 | } 27 | }; 28 | -------------------------------------------------------------------------------- /include/re/rendering/render_context.cpp: -------------------------------------------------------------------------------- 1 | #include "render_context.h" 2 | #include "../utils/logger.h" 3 | 4 | RenderContext* RenderContext::GetInstance() { 5 | static RenderContext *instance = new RenderContext(); 6 | return instance; 7 | } 8 | 9 | void RenderContext::InitializeFont() { 10 | if(FT_Init_FreeType(&freeTypeLibrary)) { 11 | Logger::GetInstance()->Error("Could not initialize FreeType Library!"); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /include/re/rendering/render_context.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include FT_FREETYPE_H 7 | 8 | class RenderContext { 9 | public: 10 | SDL_Window *window = nullptr; 11 | SDL_WindowFlags windowFlags = (SDL_WindowFlags)( 12 | SDL_WINDOW_OPENGL 13 | | SDL_WINDOW_RESIZABLE 14 | | SDL_WINDOW_ALLOW_HIGHDPI 15 | ); 16 | SDL_GLContext glContext; 17 | FT_Library freeTypeLibrary; 18 | unsigned int currentWindowWidth; 19 | unsigned int currentWindowHeight; 20 | 21 | static RenderContext* GetInstance(); 22 | void InitializeFont(); 23 | 24 | private: 25 | RenderContext() = default; 26 | }; 27 | -------------------------------------------------------------------------------- /include/re/rendering/renderer_2d.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "./renderer_batcher.h" 4 | #include "./sprite_renderer.h" 5 | #include "./font_renderer.h" 6 | 7 | class Renderer2D { 8 | public: 9 | ~Renderer2D(); 10 | static Renderer2D* GetInstance(); 11 | void Initialize(); 12 | void SubmitSpriteBatchItem(Texture *texture2D, Rect2 sourceRectangle, Rect2 destinationRectangle, int zIndex, float rotation = 0.0f, Color color = Color(1.0f, 1.0f, 1.0f), bool flipX = false, bool flipY = false); 13 | void SubmitFontBatchItem(Font *font, const std::string &text, float x, float y, int zIndex, float scale, Color color); 14 | void FlushBatches(); 15 | 16 | private: 17 | RendererBatcher rendererBatcher; 18 | SpriteRenderer *spriteRenderer = nullptr; 19 | FontRenderer *fontRenderer = nullptr; 20 | 21 | Renderer2D() = default; 22 | }; 23 | -------------------------------------------------------------------------------- /include/re/rendering/renderer_batcher.cpp: -------------------------------------------------------------------------------- 1 | #include "./renderer_batcher.h" 2 | 3 | void RendererBatcher::BatchDrawSprite(SpriteBatchItem spriteBatchItem, int zIndex) { 4 | if (drawBatches.find(zIndex) == drawBatches.end()) { 5 | drawBatches.emplace(zIndex, ZIndexDrawBatch{}); 6 | } 7 | drawBatches[zIndex].spriteDrawBatches.emplace_back(spriteBatchItem); 8 | } 9 | 10 | void RendererBatcher::BatchDrawFont(FontBatchItem fontBatchItem, int zIndex) { 11 | if (drawBatches.find(zIndex) == drawBatches.end()) { 12 | drawBatches.emplace(zIndex, ZIndexDrawBatch{}); 13 | } 14 | drawBatches[zIndex].fontDrawBatches.emplace_back(fontBatchItem); 15 | } 16 | 17 | void RendererBatcher::Flush(const RenderFlushFunction &renderFlushFunction) { 18 | for (const auto &pair : drawBatches) { 19 | const int zIndex = pair.first; 20 | const ZIndexDrawBatch &zIndexDrawBatch = pair.second; 21 | renderFlushFunction(zIndex, zIndexDrawBatch); 22 | } 23 | drawBatches.clear(); 24 | } 25 | -------------------------------------------------------------------------------- /include/re/rendering/renderer_batcher.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include "./texture.h" 9 | #include "./font.h" 10 | #include "./color.h" 11 | #include "./re/math/redmath.h" 12 | 13 | struct SpriteBatchItem { 14 | Texture *texture2D = nullptr; 15 | Rect2 sourceRectangle; 16 | Rect2 destinationRectangle; 17 | float rotation = 0.0f; 18 | Color color = Color(1.0f, 1.0f, 1.0f, 1.0f); 19 | bool flipX = false; 20 | bool flipY = false; 21 | }; 22 | 23 | struct FontBatchItem { 24 | Font *font = nullptr; 25 | std::string text; 26 | float x = 0.0f; 27 | float y = 0.0f; 28 | float scale = 1.0f; 29 | Color color = Color(1.0f, 1.0f, 1.0f, 1.0f); 30 | }; 31 | 32 | struct ZIndexDrawBatch { 33 | std::vector spriteDrawBatches; 34 | std::vector fontDrawBatches; 35 | }; 36 | 37 | using RenderFlushFunction = std::function; 38 | 39 | class RendererBatcher { 40 | public: 41 | void BatchDrawSprite(SpriteBatchItem spriteBatchItem, int zIndex); 42 | void BatchDrawFont(FontBatchItem fontBatchItem, int zIndex); 43 | void Flush(const RenderFlushFunction &renderFlushFunction); 44 | 45 | private: 46 | std::map drawBatches; 47 | }; 48 | -------------------------------------------------------------------------------- /include/re/scene/scene.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | #include "../ecs/entity/entity.h" 8 | #include "../utils/helper.h" 9 | 10 | struct SceneNode { 11 | Entity entity = NULL_ENTITY; 12 | Entity parent = NULL_ENTITY; 13 | std::vector children = {}; 14 | }; 15 | 16 | struct Scene { 17 | SceneNode rootNode = {}; 18 | std::unordered_map sceneNodes = {}; 19 | 20 | SceneNode GetSceneNode(Entity entity) { 21 | assert(sceneNodes.count(entity) > 0 && "Entity doesn't have a scene node!"); 22 | return sceneNodes[entity]; 23 | } 24 | }; 25 | -------------------------------------------------------------------------------- /include/re/scene/scene_manager.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../utils/singleton.h" 4 | 5 | #include 6 | #include 7 | 8 | #include "scene_loader.h" 9 | #include "../ecs/entity/entity.h" 10 | #include "../utils/logger.h" 11 | 12 | class SceneManager : public Singleton{ 13 | public: 14 | SceneManager(singleton); 15 | void ChangeToEmptyScene(); 16 | void ChangeToScene(const std::string& filePath); 17 | void AddRootNode(Entity rootEntity); 18 | void AddChildNode(Entity child, Entity parent); 19 | void DeleteNode(Entity entity); 20 | bool IsNodeInScene(Entity entity) const; 21 | 22 | Scene* GetCurrentScene(); 23 | private: 24 | Scene *currentScene = nullptr; 25 | Logger *logger = nullptr; 26 | }; 27 | -------------------------------------------------------------------------------- /include/re/utils/file_helper.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | class FileHelper { 7 | public: 8 | static bool DoesFileExist(const std::string &name) { 9 | struct stat buffer; 10 | return(stat(name.c_str(), &buffer) == 0); 11 | } 12 | 13 | static void ChangeDirectory(const std::string &newDirectory) { 14 | std::experimental::filesystem::current_path(newDirectory); 15 | } 16 | }; 17 | -------------------------------------------------------------------------------- /include/re/utils/fps_counter.cpp: -------------------------------------------------------------------------------- 1 | #include "fps_counter.h" 2 | 3 | FPSCounter::FPSCounter(singleton) : timer(new Timer((Uint32) 1000, true)) { 4 | timer->Start(); 5 | } 6 | 7 | FPSCounter::~FPSCounter() { 8 | delete timer; 9 | } 10 | 11 | void FPSCounter::Update() { 12 | if (timer->HasReachedTimeOut()) { 13 | timer->Stop(); 14 | 15 | fps = fpsCount; 16 | fpsCount = 0; 17 | 18 | timer->Start(); 19 | } 20 | fpsCount++; 21 | } 22 | 23 | unsigned int FPSCounter::GetFPS() const { 24 | return fps; 25 | } 26 | -------------------------------------------------------------------------------- /include/re/utils/fps_counter.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "singleton.h" 4 | 5 | #include "timer.h" 6 | 7 | class FPSCounter : public Singleton { 8 | public: 9 | ~FPSCounter(); 10 | FPSCounter(singleton); 11 | void Update(); 12 | unsigned int GetFPS() const; 13 | private: 14 | unsigned int fps; 15 | unsigned int fpsCount; 16 | 17 | Timer *timer = nullptr; 18 | }; 19 | -------------------------------------------------------------------------------- /include/re/utils/json_helper.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | class JsonHelper { 10 | public: 11 | template 12 | static T Get(const nlohmann::json& json, const std::string& key) { 13 | if (json.contains(key)) { 14 | return json.at(key); 15 | } 16 | std::cerr << "Key '" << key << "' doesn't exist!" << std::endl; 17 | assert(false && "Key doesn't exist in json!"); 18 | return T(); // Not reached, just added to have returns for all code paths 19 | } 20 | 21 | template 22 | static T GetDefault(const nlohmann::json& json, const std::string& key, T defaultValue) { 23 | if (json.contains(key)) { 24 | return json.at(key); 25 | } 26 | return defaultValue; 27 | } 28 | }; 29 | 30 | class JsonFileHelper { 31 | public: 32 | static nlohmann::json LoadJsonFile(const std::string& filePath) { 33 | std::ifstream i(filePath); 34 | nlohmann::json json; 35 | i >> json; 36 | return json; 37 | } 38 | 39 | }; 40 | -------------------------------------------------------------------------------- /include/re/utils/logger.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "singleton.h" 4 | 5 | #include 6 | 7 | enum class LogLevel : unsigned int { 8 | DEBUG = 0, 9 | WARN = 1, 10 | INFO = 2, 11 | ERROR = 3, 12 | }; 13 | 14 | class Logger : public Singleton { 15 | protected: 16 | Logger() = default; 17 | public: 18 | Logger(singleton) {}; 19 | void SetLogLevel(LogLevel level); 20 | bool SetLogLevelFromString(std::string logLevelString); 21 | LogLevel GetLogLevel() const; 22 | void Debug(const char *fmt, ...) const; 23 | void Warn(const char *fmt, ...) const; 24 | void Info(const char *fmt, ...) const; 25 | void Error(const char *fmt, ...) const; 26 | 27 | LogLevel logLevel = LogLevel::DEBUG; 28 | }; 29 | -------------------------------------------------------------------------------- /include/re/utils/singleton.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | template 4 | class Singleton { 5 | public: 6 | static T* GetInstance(); 7 | Singleton(const Singleton&) = delete; 8 | Singleton& operator= (const Singleton) = delete; 9 | protected: 10 | struct singleton {}; 11 | Singleton() = default; 12 | }; 13 | 14 | template 15 | T* Singleton::GetInstance() { 16 | static T* instance = new T(singleton{}); 17 | return instance; 18 | } 19 | -------------------------------------------------------------------------------- /include/re/utils/timer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | class Timer { 6 | public: 7 | Timer(Uint32 waitTimeInMilliseconds, bool doesLoop = false); 8 | Timer(float waitTimeInSeconds, bool doesLoop = false); 9 | Uint32 GetWaitTime() const; 10 | Uint32 GetTimeLeft() const; 11 | void SetWaitTime(Uint32 waitTimeInMilliseconds); 12 | void SetWaitTime(float waitTimeInSeconds); 13 | bool DoesLoop() const; 14 | void SetLoop(bool doesLoop); 15 | void Start(); 16 | void Stop(); 17 | void Pause(); 18 | void UnPause(); 19 | bool HasStopped() const; 20 | bool HasReachedTimeOut() const; 21 | Uint32 GetTicks() const; 22 | bool HasStarted() const; 23 | bool IsPaused() const; 24 | 25 | private: 26 | Uint32 waitTime; 27 | bool loops; 28 | Uint32 startTicks = 0; 29 | Uint32 pausedTicks = 0; 30 | bool isPaused = false; 31 | bool hasStarted = false; 32 | }; 33 | -------------------------------------------------------------------------------- /include/stb_image/stb_image.cpp: -------------------------------------------------------------------------------- 1 | #define STB_IMAGE_IMPLEMENTATION 2 | #include "stb_image.h" 3 | -------------------------------------------------------------------------------- /src/1.foundation/1.embedding_python/1.0.hello_python/src/main.cpp: -------------------------------------------------------------------------------- 1 | #define PY_SSIZE_T_CLEAN 2 | #include 3 | 4 | int main(int argv, char** args) { 5 | Py_SetProgramName(L"red_engine"); 6 | Py_Initialize(); 7 | 8 | PyRun_SimpleString("print('hello world (from python)')"); 9 | 10 | Py_Finalize(); 11 | 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /src/1.foundation/1.embedding_python/1.1.calling_a_function/assets/scripts/game.py: -------------------------------------------------------------------------------- 1 | def play() -> int: 2 | print("Game played!") 3 | return 0 4 | -------------------------------------------------------------------------------- /src/1.foundation/1.embedding_python/1.1.calling_a_function/src/main.cpp: -------------------------------------------------------------------------------- 1 | #define PY_SSIZE_T_CLEAN 2 | #include 3 | #include 4 | 5 | int main(int argv, char** args) { 6 | Py_SetProgramName(L"red_engine"); 7 | Py_Initialize(); 8 | PyRun_SimpleString("import sys"); 9 | PyRun_SimpleString("sys.path.append(\".\")"); 10 | 11 | // Load Module 12 | PyObject* pModuleName = PyUnicode_FromString("assets.scripts.game"); 13 | PyObject* pModule = PyImport_Import(pModuleName); 14 | Py_DECREF(pModuleName); 15 | assert(pModule != nullptr && "Not able to load python module!"); 16 | 17 | // Function 18 | PyObject* pFunc = PyObject_GetAttrString(pModule, "play"); 19 | assert(pFunc != nullptr && "Not able to find function named 'play'!"); 20 | PyObject* pValue = PyObject_CallObject(pFunc, nullptr); 21 | std::cout << "Python script exit code = " << PyLong_AsLong(pValue) << std::endl; 22 | 23 | Py_DECREF(pValue); 24 | Py_DECREF(pFunc); 25 | Py_DECREF(pModule); 26 | 27 | Py_Finalize(); 28 | 29 | return 0; 30 | } 31 | -------------------------------------------------------------------------------- /src/1.foundation/1.embedding_python/1.2.using_pyhelper/assets/scripts/game.py: -------------------------------------------------------------------------------- 1 | def play(message: str) -> int: 2 | print(f"{message} (from python)!") 3 | return 0 4 | -------------------------------------------------------------------------------- /src/1.foundation/1.embedding_python/1.2.using_pyhelper/src/main.cpp: -------------------------------------------------------------------------------- 1 | #include "./scripting/pyhelper.hpp" 2 | 3 | int main(int argv, char** args) { 4 | CPyInstance pyInstance; 5 | 6 | // Load Module 7 | CPyObject pModuleName = PyUnicode_FromString("assets.scripts.game"); 8 | CPyObject pModule = PyImport_Import(pModuleName); 9 | assert(pModule != nullptr && "Not able to load python module!"); 10 | 11 | // Function 12 | CPyObject pFunc = PyObject_GetAttrString(pModule, "play"); 13 | assert(pFunc != nullptr && "Not able to find function named 'play'!"); 14 | CPyObject pArgs = Py_BuildValue("(s)", "hello world!"); 15 | assert(pArgs != nullptr); 16 | CPyObject pValue = PyObject_CallObject(pFunc, pArgs); 17 | 18 | return 0; 19 | } 20 | -------------------------------------------------------------------------------- /src/1.foundation/1.embedding_python/1.2.using_pyhelper/src/scripting/pyhelper.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define PY_SSIZE_T_CLEAN 4 | #include 5 | #include 6 | 7 | class CPyInstance { 8 | public: 9 | CPyInstance() { 10 | Py_SetProgramName(L"red_engine"); 11 | Py_Initialize(); 12 | PyRun_SimpleString("import sys"); 13 | PyRun_SimpleString("sys.path.append(\".\")"); 14 | } 15 | 16 | ~CPyInstance() { 17 | Py_Finalize(); 18 | } 19 | }; 20 | 21 | class CPyObject { 22 | public: 23 | CPyObject(): pyObj(nullptr) {} 24 | 25 | CPyObject(PyObject* p) : pyObj(p) {} 26 | 27 | ~CPyObject() { 28 | Release(); 29 | } 30 | 31 | PyObject* GetObj() { 32 | return pyObj; 33 | } 34 | 35 | PyObject* SetObj(PyObject* p) { 36 | return (pyObj=p); 37 | } 38 | 39 | PyObject* AddRef() { 40 | if(pyObj) { 41 | Py_INCREF(pyObj); 42 | } 43 | return pyObj; 44 | } 45 | 46 | void Release() { 47 | if(pyObj) { 48 | Py_DECREF(pyObj); 49 | } 50 | pyObj = nullptr; 51 | } 52 | 53 | PyObject* operator->() { 54 | return pyObj; 55 | } 56 | 57 | bool Is() const { 58 | return pyObj ? true : false; 59 | } 60 | 61 | operator PyObject*() { 62 | return pyObj; 63 | } 64 | 65 | PyObject* operator=(PyObject* p) { 66 | pyObj = p; 67 | return pyObj; 68 | } 69 | private: 70 | PyObject* pyObj; 71 | }; 72 | -------------------------------------------------------------------------------- /src/1.foundation/1.embedding_python/1.3.create_python_instance/assets/scripts/game.py: -------------------------------------------------------------------------------- 1 | class Player: 2 | def talk(self, message: str) -> None: 3 | print(f"Player says '{message}'!") 4 | -------------------------------------------------------------------------------- /src/1.foundation/1.embedding_python/1.3.create_python_instance/src/main.cpp: -------------------------------------------------------------------------------- 1 | #include "./scripting/python_object_manager.h" 2 | 3 | int main(int argv, char** args) { 4 | CPyInstance pyInstance; 5 | PythonObjectManager pObjectManager; 6 | 7 | CPyObject pClassInstance = pObjectManager.CreateClassInstance("assets.scripts.game", "Player"); 8 | PyObject_CallMethod(pClassInstance, "talk", "(s)", "Hello!"); 9 | 10 | return 0; 11 | } 12 | -------------------------------------------------------------------------------- /src/1.foundation/1.embedding_python/1.3.create_python_instance/src/scripting/pyhelper.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define PY_SSIZE_T_CLEAN 4 | #include 5 | #include 6 | 7 | class CPyInstance { 8 | public: 9 | CPyInstance() { 10 | Py_SetProgramName(L"red_engine"); 11 | Py_Initialize(); 12 | PyRun_SimpleString("import sys"); 13 | PyRun_SimpleString("sys.path.append(\".\")"); 14 | } 15 | 16 | ~CPyInstance() { 17 | Py_Finalize(); 18 | } 19 | }; 20 | 21 | class CPyObject { 22 | public: 23 | CPyObject(): pyObj(nullptr) {} 24 | 25 | CPyObject(PyObject* p) : pyObj(p) {} 26 | 27 | ~CPyObject() { 28 | Release(); 29 | } 30 | 31 | PyObject* GetObj() { 32 | return pyObj; 33 | } 34 | 35 | PyObject* SetObj(PyObject* p) { 36 | return (pyObj=p); 37 | } 38 | 39 | PyObject* AddRef() { 40 | if(pyObj) { 41 | Py_INCREF(pyObj); 42 | } 43 | return pyObj; 44 | } 45 | 46 | void Release() { 47 | if(pyObj) { 48 | Py_DECREF(pyObj); 49 | } 50 | pyObj = nullptr; 51 | } 52 | 53 | PyObject* operator->() { 54 | return pyObj; 55 | } 56 | 57 | bool Is() const { 58 | return pyObj ? true : false; 59 | } 60 | 61 | operator PyObject*() { 62 | return pyObj; 63 | } 64 | 65 | PyObject* operator=(PyObject* p) { 66 | pyObj = p; 67 | return pyObj; 68 | } 69 | 70 | private: 71 | PyObject* pyObj; 72 | }; 73 | -------------------------------------------------------------------------------- /src/1.foundation/1.embedding_python/1.4.create_custom_module/assets/scripts/game.py: -------------------------------------------------------------------------------- 1 | import engine 2 | 3 | 4 | class Player: 5 | def talk(self, message: str) -> None: 6 | engine_version = engine.get_version() 7 | engine.print_log(message=f"Engine version = {engine_version}") 8 | -------------------------------------------------------------------------------- /src/1.foundation/1.embedding_python/1.4.create_custom_module/src/main.cpp: -------------------------------------------------------------------------------- 1 | #include "./re/python/python_object_manager.h" 2 | 3 | int main(int argv, char** args) { 4 | CPyInstance pyInstance; 5 | PythonObjectManager pObjectManager; 6 | 7 | CPyObject pClassInstance = pObjectManager.CreateClassInstance("assets.scripts.game", "Player"); 8 | PyObject_CallMethod(pClassInstance, "talk", "(s)", "Hello!"); 9 | 10 | return 0; 11 | } 12 | -------------------------------------------------------------------------------- /src/1.foundation/2.game_loop_and_sdl/2.0.game_loop_and_sdl/assets/scripts/game.py: -------------------------------------------------------------------------------- 1 | class Player: 2 | def talk(self, message: str) -> None: 3 | print(f"Player says '{message}'!") 4 | -------------------------------------------------------------------------------- /src/1.foundation/2.game_loop_and_sdl/2.0.game_loop_and_sdl/src/fps_counter.cpp: -------------------------------------------------------------------------------- 1 | #include "fps_counter.h" 2 | 3 | #include "./re/utils/logger.h" 4 | 5 | FPSCounter::FPSCounter() : timer(new Timer((Uint32) 1000, true)) { 6 | timer->Start(); 7 | } 8 | 9 | FPSCounter::~FPSCounter() { 10 | delete timer; 11 | } 12 | 13 | FPSCounter* FPSCounter::GetInstance() { 14 | static FPSCounter *instance = new FPSCounter(); 15 | return instance; 16 | } 17 | 18 | void FPSCounter::Update() { 19 | if (timer->HasReachedTimeOut()) { 20 | timer->Stop(); 21 | 22 | fps = fpsCount; 23 | fpsCount = 0; 24 | Logger::GetInstance()->Debug("fps = %d", fps); 25 | 26 | timer->Start(); 27 | } 28 | fpsCount++; 29 | } 30 | 31 | unsigned int FPSCounter::GetFPS() const { 32 | return fps; 33 | } 34 | -------------------------------------------------------------------------------- /src/1.foundation/2.game_loop_and_sdl/2.0.game_loop_and_sdl/src/fps_counter.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "./re/utils/timer.h" 4 | 5 | class FPSCounter { 6 | public: 7 | ~FPSCounter(); 8 | static FPSCounter* GetInstance(); 9 | void Update(); 10 | unsigned int GetFPS() const; 11 | 12 | private: 13 | unsigned int fps; 14 | unsigned int fpsCount; 15 | Timer *timer = nullptr; 16 | 17 | FPSCounter(); 18 | }; 19 | -------------------------------------------------------------------------------- /src/1.foundation/2.game_loop_and_sdl/2.0.game_loop_and_sdl/src/game_engine.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "./re/game_engine_context.h" 4 | #include "./re/utils/logger.h" 5 | #include "fps_counter.h" 6 | 7 | class GameEngine { 8 | public: 9 | GameEngine(); 10 | ~GameEngine(); 11 | void ProcessInput(); 12 | void Update(); 13 | void Render(); 14 | bool IsRunning() const; 15 | 16 | private: 17 | GameEngineContext *engineContext = nullptr; 18 | FPSCounter *fpsCounter = nullptr; 19 | Logger *logger = nullptr; 20 | 21 | bool Initialize(); 22 | bool InitializeSDL(); 23 | }; 24 | -------------------------------------------------------------------------------- /src/1.foundation/2.game_loop_and_sdl/2.0.game_loop_and_sdl/src/main.cpp: -------------------------------------------------------------------------------- 1 | #include "game_engine.h" 2 | 3 | int main(int argv, char** args) { 4 | GameEngine gameEngine; 5 | 6 | while (gameEngine.IsRunning()) { 7 | gameEngine.ProcessInput(); 8 | gameEngine.Update(); 9 | gameEngine.Render(); 10 | } 11 | 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /src/1.foundation/3.opengl_rendering/3.0.rendering_sprites/assets/images/melissa_walk_animation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chukobyte/learn-engine-dev/3f4437ed4abab9011d584bdc0ab4eff921393f00/src/1.foundation/3.opengl_rendering/3.0.rendering_sprites/assets/images/melissa_walk_animation.png -------------------------------------------------------------------------------- /src/1.foundation/3.opengl_rendering/3.0.rendering_sprites/assets/scripts/game.py: -------------------------------------------------------------------------------- 1 | class Player: 2 | def talk(self, message: str) -> None: 3 | print(f"Player says '{message}'!") 4 | -------------------------------------------------------------------------------- /src/1.foundation/3.opengl_rendering/3.0.rendering_sprites/src/asset_manager.cpp: -------------------------------------------------------------------------------- 1 | #include "asset_manager.h" 2 | #include 3 | 4 | AssetManager::AssetManager() : logger(Logger::GetInstance()) {} 5 | 6 | AssetManager* AssetManager::GetInstance() { 7 | static AssetManager *instance = new AssetManager(); 8 | return instance; 9 | } 10 | 11 | void AssetManager::LoadTexture(const std::string &id, const std::string &filePath) { 12 | Texture *texture = new Texture(filePath.c_str()); 13 | assert(texture->IsValid() && "Failed to load texture!"); 14 | if (HasTexture(id)) { 15 | logger->Warn("Already have texture, not loading..."); 16 | return; 17 | } 18 | textures.emplace(id, texture); 19 | } 20 | 21 | Texture *AssetManager::GetTexture(const std::string &id) { 22 | assert(HasTexture(id) && "Failed to get texture!"); 23 | return textures[id]; 24 | } 25 | 26 | bool AssetManager::HasTexture(const std::string &id) const { 27 | return textures.count(id) > 0; 28 | } 29 | -------------------------------------------------------------------------------- /src/1.foundation/3.opengl_rendering/3.0.rendering_sprites/src/asset_manager.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #include "./re/utils/logger.h" 7 | #include "./re/rendering/texture.h" 8 | 9 | 10 | class AssetManager { 11 | public: 12 | static AssetManager* GetInstance(); 13 | void LoadTexture(const std::string &id, const std::string &filePath); 14 | Texture* GetTexture(const std::string &id); 15 | bool HasTexture(const std::string &id) const; 16 | 17 | private: 18 | std::unordered_map textures; 19 | Logger *logger = nullptr; 20 | 21 | AssetManager(); 22 | }; 23 | -------------------------------------------------------------------------------- /src/1.foundation/3.opengl_rendering/3.0.rendering_sprites/src/game_engine.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "./re/game_engine_context.h" 4 | #include "./re/utils/fps_counter.h" 5 | #include "./re/project_properties.h" 6 | #include "./re/utils/logger.h" 7 | #include "render_context.h" 8 | #include "asset_manager.h" 9 | #include "renderer_2d.h" 10 | 11 | class GameEngine { 12 | public: 13 | GameEngine(); 14 | ~GameEngine(); 15 | void ProcessInput(); 16 | void Update(); 17 | void Render(); 18 | bool IsRunning() const; 19 | 20 | private: 21 | ProjectProperties *projectProperties = nullptr; 22 | GameEngineContext *engineContext = nullptr; 23 | RenderContext *renderContext = nullptr; 24 | AssetManager *assetManager = nullptr; 25 | FPSCounter *fpsCounter = nullptr; 26 | Renderer2D renderer2D; 27 | Logger *logger = nullptr; 28 | 29 | bool Initialize(); 30 | bool InitializeSDL(); 31 | bool InitializeRendering(); 32 | }; 33 | -------------------------------------------------------------------------------- /src/1.foundation/3.opengl_rendering/3.0.rendering_sprites/src/main.cpp: -------------------------------------------------------------------------------- 1 | #include "game_engine.h" 2 | 3 | int main(int argv, char** args) { 4 | GameEngine gameEngine; 5 | 6 | while (gameEngine.IsRunning()) { 7 | gameEngine.ProcessInput(); 8 | gameEngine.Update(); 9 | gameEngine.Render(); 10 | } 11 | 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /src/1.foundation/3.opengl_rendering/3.0.rendering_sprites/src/render_context.cpp: -------------------------------------------------------------------------------- 1 | #include "render_context.h" 2 | 3 | RenderContext* RenderContext::GetInstance() { 4 | static RenderContext *instance = new RenderContext(); 5 | return instance; 6 | } 7 | -------------------------------------------------------------------------------- /src/1.foundation/3.opengl_rendering/3.0.rendering_sprites/src/render_context.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | class RenderContext { 7 | public: 8 | SDL_Window *window = nullptr; 9 | SDL_WindowFlags windowFlags = (SDL_WindowFlags)( 10 | SDL_WINDOW_OPENGL 11 | | SDL_WINDOW_RESIZABLE 12 | | SDL_WINDOW_ALLOW_HIGHDPI 13 | ); 14 | SDL_GLContext glContext; 15 | unsigned int currentWindowWidth; 16 | unsigned int currentWindowHeight; 17 | 18 | static RenderContext* GetInstance(); 19 | 20 | private: 21 | RenderContext() = default; 22 | }; 23 | -------------------------------------------------------------------------------- /src/1.foundation/3.opengl_rendering/3.0.rendering_sprites/src/renderer_2d.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "renderer_batcher.h" 4 | #include "sprite_renderer.h" 5 | 6 | class Renderer2D { 7 | public: 8 | Renderer2D() = default; 9 | ~Renderer2D(); 10 | void Initialize(); 11 | void SubmitSpriteBatchItem(Texture *texture2D, Rect2 sourceRectangle, Rect2 destinationRectangle, int zIndex, float rotation = 0.0f, Color color = Color(1.0f, 1.0f, 1.0f), bool flipX = false, bool flipY = false); 12 | void FlushBatches(); 13 | 14 | private: 15 | RendererBatcher rendererBatcher; 16 | SpriteRenderer *spriteRenderer = nullptr; 17 | }; 18 | -------------------------------------------------------------------------------- /src/1.foundation/3.opengl_rendering/3.0.rendering_sprites/src/renderer_batcher.cpp: -------------------------------------------------------------------------------- 1 | #include "./renderer_batcher.h" 2 | 3 | void RendererBatcher::BatchDrawSprite(SpriteBatchItem spriteBatchItem, int zIndex) { 4 | if (drawBatches.find(zIndex) == drawBatches.end()) { 5 | drawBatches.emplace(zIndex, ZIndexDrawBatch{}); 6 | } 7 | drawBatches[zIndex].spriteDrawBatches.emplace_back(spriteBatchItem); 8 | } 9 | 10 | void RendererBatcher::Flush(const RenderFlushFunction &renderFlushFunction) { 11 | for (const auto &pair : drawBatches) { 12 | const int zIndex = pair.first; 13 | const ZIndexDrawBatch &zIndexDrawBatch = pair.second; 14 | renderFlushFunction(zIndex, zIndexDrawBatch); 15 | } 16 | drawBatches.clear(); 17 | } 18 | -------------------------------------------------------------------------------- /src/1.foundation/3.opengl_rendering/3.0.rendering_sprites/src/renderer_batcher.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include "./re/rendering/color.h" 9 | #include "./re/rendering/texture.h" 10 | #include "./re/math/redmath.h" 11 | 12 | struct SpriteBatchItem { 13 | Texture *texture2D = nullptr; 14 | Rect2 sourceRectangle; 15 | Rect2 destinationRectangle; 16 | float rotation = 0.0f; 17 | Color color = Color(1.0f, 1.0f, 1.0f, 1.0f); 18 | bool flipX = false; 19 | bool flipY = false; 20 | }; 21 | 22 | struct ZIndexDrawBatch { 23 | std::vector spriteDrawBatches; 24 | }; 25 | 26 | using RenderFlushFunction = std::function; 27 | 28 | class RendererBatcher { 29 | public: 30 | void BatchDrawSprite(SpriteBatchItem spriteBatchItem, int zIndex); 31 | void Flush(const RenderFlushFunction &renderFlushFunction); 32 | 33 | private: 34 | std::map drawBatches; 35 | }; 36 | -------------------------------------------------------------------------------- /src/1.foundation/3.opengl_rendering/3.1.rendering_text/assets/fonts/verdana.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chukobyte/learn-engine-dev/3f4437ed4abab9011d584bdc0ab4eff921393f00/src/1.foundation/3.opengl_rendering/3.1.rendering_text/assets/fonts/verdana.ttf -------------------------------------------------------------------------------- /src/1.foundation/3.opengl_rendering/3.1.rendering_text/assets/images/melissa_walk_animation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chukobyte/learn-engine-dev/3f4437ed4abab9011d584bdc0ab4eff921393f00/src/1.foundation/3.opengl_rendering/3.1.rendering_text/assets/images/melissa_walk_animation.png -------------------------------------------------------------------------------- /src/1.foundation/3.opengl_rendering/3.1.rendering_text/assets/scripts/game.py: -------------------------------------------------------------------------------- 1 | class Player: 2 | def talk(self, message: str) -> None: 3 | print(f"Player says '{message}'!") 4 | -------------------------------------------------------------------------------- /src/1.foundation/3.opengl_rendering/3.1.rendering_text/src/asset_manager.h: -------------------------------------------------------------------------------- 1 | #ifndef ASSET_MANAGER_H 2 | #define ASSET_MANAGER_H 3 | 4 | #include 5 | #include 6 | 7 | #include "./re/utils/logger.h" 8 | #include "./re/rendering/texture.h" 9 | #include "./re/rendering/font.h" 10 | #include "./re/rendering/render_context.h" 11 | 12 | 13 | class AssetManager { 14 | public: 15 | static AssetManager* GetInstance(); 16 | // Texture 17 | void LoadTexture(const std::string &id, const std::string &filePath); 18 | Texture* GetTexture(const std::string &id); 19 | bool HasTexture(const std::string &id) const; 20 | // Font 21 | void LoadFont(const std::string &fontId, const std::string &fontPath, int size); 22 | Font* GetFont(const std::string &fontId); 23 | bool HasFont(const std::string &fontId) const; 24 | 25 | private: 26 | std::unordered_map textures; 27 | std::unordered_map fonts; 28 | RenderContext *renderContext = nullptr; 29 | Logger *logger = nullptr; 30 | 31 | AssetManager(); 32 | }; 33 | 34 | 35 | #endif //ASSET_MANAGER_H 36 | -------------------------------------------------------------------------------- /src/1.foundation/3.opengl_rendering/3.1.rendering_text/src/game_engine.h: -------------------------------------------------------------------------------- 1 | #ifndef GAME_ENGINE_H 2 | #define GAME_ENGINE_H 3 | 4 | #include "./re/game_engine_context.h" 5 | #include "./re/project_properties.h" 6 | #include "./re/rendering/render_context.h" 7 | #include "./re/utils/fps_counter.h" 8 | #include "./re/utils/logger.h" 9 | #include "asset_manager.h" 10 | #include "renderer_2d.h" 11 | 12 | class GameEngine { 13 | public: 14 | GameEngine(); 15 | ~GameEngine(); 16 | void ProcessInput(); 17 | void Update(); 18 | void Render(); 19 | bool IsRunning() const; 20 | 21 | private: 22 | ProjectProperties *projectProperties = nullptr; 23 | GameEngineContext *engineContext = nullptr; 24 | RenderContext *renderContext = nullptr; 25 | AssetManager *assetManager = nullptr; 26 | FPSCounter *fpsCounter = nullptr; 27 | Renderer2D renderer2D; 28 | Logger *logger = nullptr; 29 | 30 | bool Initialize(); 31 | bool InitializeSDL(); 32 | bool InitializeRendering(); 33 | }; 34 | 35 | 36 | #endif //GAME_ENGINE_H 37 | -------------------------------------------------------------------------------- /src/1.foundation/3.opengl_rendering/3.1.rendering_text/src/main.cpp: -------------------------------------------------------------------------------- 1 | #include "game_engine.h" 2 | 3 | int main(int argv, char** args) { 4 | GameEngine gameEngine; 5 | 6 | while (gameEngine.IsRunning()) { 7 | gameEngine.ProcessInput(); 8 | gameEngine.Update(); 9 | gameEngine.Render(); 10 | } 11 | 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /src/1.foundation/3.opengl_rendering/3.1.rendering_text/src/renderer_2d.h: -------------------------------------------------------------------------------- 1 | #ifndef RENDERER_2D_H 2 | #define RENDERER_2D_H 3 | 4 | #include "./re/rendering/renderer_batcher.h" 5 | #include "./re/rendering/sprite_renderer.h" 6 | #include "./re/rendering/font_renderer.h" 7 | 8 | class Renderer2D { 9 | public: 10 | Renderer2D() = default; 11 | ~Renderer2D(); 12 | void Initialize(); 13 | void SubmitSpriteBatchItem(Texture *texture2D, Rect2 sourceRectangle, Rect2 destinationRectangle, int zIndex, float rotation = 0.0f, Color color = Color(1.0f, 1.0f, 1.0f), bool flipX = false, bool flipY = false); 14 | void SubmitFontBatchItem(Font *font, const std::string &text, float x, float y, int zIndex, float scale, Color color); 15 | void FlushBatches(); 16 | 17 | private: 18 | RendererBatcher rendererBatcher; 19 | SpriteRenderer *spriteRenderer = nullptr; 20 | FontRenderer *fontRenderer = nullptr; 21 | }; 22 | 23 | 24 | #endif //RENDERER_2D_H 25 | -------------------------------------------------------------------------------- /src/1.foundation/4.implementing_audio/4.0.sdl_mixer/assets/audio/music/test_music.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chukobyte/learn-engine-dev/3f4437ed4abab9011d584bdc0ab4eff921393f00/src/1.foundation/4.implementing_audio/4.0.sdl_mixer/assets/audio/music/test_music.wav -------------------------------------------------------------------------------- /src/1.foundation/4.implementing_audio/4.0.sdl_mixer/assets/audio/sound/test_sound_effect.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chukobyte/learn-engine-dev/3f4437ed4abab9011d584bdc0ab4eff921393f00/src/1.foundation/4.implementing_audio/4.0.sdl_mixer/assets/audio/sound/test_sound_effect.wav -------------------------------------------------------------------------------- /src/1.foundation/4.implementing_audio/4.0.sdl_mixer/assets/fonts/verdana.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chukobyte/learn-engine-dev/3f4437ed4abab9011d584bdc0ab4eff921393f00/src/1.foundation/4.implementing_audio/4.0.sdl_mixer/assets/fonts/verdana.ttf -------------------------------------------------------------------------------- /src/1.foundation/4.implementing_audio/4.0.sdl_mixer/assets/images/melissa_walk_animation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chukobyte/learn-engine-dev/3f4437ed4abab9011d584bdc0ab4eff921393f00/src/1.foundation/4.implementing_audio/4.0.sdl_mixer/assets/images/melissa_walk_animation.png -------------------------------------------------------------------------------- /src/1.foundation/4.implementing_audio/4.0.sdl_mixer/assets/scripts/game.py: -------------------------------------------------------------------------------- 1 | class Player: 2 | def talk(self, message: str) -> None: 3 | print(f"Player says '{message}'!") 4 | -------------------------------------------------------------------------------- /src/1.foundation/4.implementing_audio/4.0.sdl_mixer/src/game_engine.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "./re/game_engine_context.h" 4 | #include "./re/project_properties.h" 5 | #include "./re/rendering/renderer_2d.h" 6 | #include "./re/rendering/render_context.h" 7 | #include "./re/utils/fps_counter.h" 8 | #include "./re/utils/logger.h" 9 | #include "asset_manager.h" 10 | 11 | class GameEngine { 12 | public: 13 | GameEngine(); 14 | ~GameEngine(); 15 | void ProcessInput(); 16 | void Update(); 17 | void Render(); 18 | bool IsRunning() const; 19 | 20 | private: 21 | ProjectProperties *projectProperties = nullptr; 22 | GameEngineContext *engineContext = nullptr; 23 | RenderContext *renderContext = nullptr; 24 | AssetManager *assetManager = nullptr; 25 | FPSCounter *fpsCounter = nullptr; 26 | Renderer2D* renderer2D = nullptr; 27 | Logger *logger = nullptr; 28 | 29 | bool Initialize(); 30 | bool InitializeSDL(); 31 | bool InitializeAudio(); 32 | bool InitializeRendering(); 33 | }; 34 | -------------------------------------------------------------------------------- /src/1.foundation/4.implementing_audio/4.0.sdl_mixer/src/main.cpp: -------------------------------------------------------------------------------- 1 | #include "game_engine.h" 2 | 3 | int main(int argv, char** args) { 4 | GameEngine gameEngine; 5 | 6 | while (gameEngine.IsRunning()) { 7 | gameEngine.ProcessInput(); 8 | gameEngine.Update(); 9 | gameEngine.Render(); 10 | } 11 | 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /src/1.foundation/5.input_management/5.0.input_management/assets/audio/music/test_music.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chukobyte/learn-engine-dev/3f4437ed4abab9011d584bdc0ab4eff921393f00/src/1.foundation/5.input_management/5.0.input_management/assets/audio/music/test_music.wav -------------------------------------------------------------------------------- /src/1.foundation/5.input_management/5.0.input_management/assets/audio/sound/test_sound_effect.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chukobyte/learn-engine-dev/3f4437ed4abab9011d584bdc0ab4eff921393f00/src/1.foundation/5.input_management/5.0.input_management/assets/audio/sound/test_sound_effect.wav -------------------------------------------------------------------------------- /src/1.foundation/5.input_management/5.0.input_management/assets/fonts/verdana.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chukobyte/learn-engine-dev/3f4437ed4abab9011d584bdc0ab4eff921393f00/src/1.foundation/5.input_management/5.0.input_management/assets/fonts/verdana.ttf -------------------------------------------------------------------------------- /src/1.foundation/5.input_management/5.0.input_management/assets/images/melissa_walk_animation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chukobyte/learn-engine-dev/3f4437ed4abab9011d584bdc0ab4eff921393f00/src/1.foundation/5.input_management/5.0.input_management/assets/images/melissa_walk_animation.png -------------------------------------------------------------------------------- /src/1.foundation/5.input_management/5.0.input_management/assets/scripts/game.py: -------------------------------------------------------------------------------- 1 | class Player: 2 | def talk(self, message: str) -> None: 3 | print(f"Player says '{message}'!") 4 | -------------------------------------------------------------------------------- /src/1.foundation/5.input_management/5.0.input_management/src/game_engine.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "./re/game_engine_context.h" 4 | #include "./re/project_properties.h" 5 | #include "./re/rendering/renderer_2d.h" 6 | #include "./re/rendering/render_context.h" 7 | #include "./re/utils/fps_counter.h" 8 | #include "./re/utils/logger.h" 9 | #include "./re/input/input_manager.h" 10 | #include "asset_manager.h" 11 | 12 | class GameEngine { 13 | public: 14 | GameEngine(); 15 | ~GameEngine(); 16 | void ProcessInput(); 17 | void Update(); 18 | void Render(); 19 | bool IsRunning() const; 20 | 21 | private: 22 | ProjectProperties *projectProperties = nullptr; 23 | GameEngineContext *engineContext = nullptr; 24 | RenderContext *renderContext = nullptr; 25 | AssetManager *assetManager = nullptr; 26 | FPSCounter *fpsCounter = nullptr; 27 | Renderer2D* renderer2D = nullptr; 28 | Logger *logger = nullptr; 29 | InputManager *inputManager = nullptr; 30 | 31 | bool Initialize(); 32 | bool InitializeSDL(); 33 | bool InitializeAudio(); 34 | bool InitializeRendering(); 35 | bool InitializeInput(); 36 | }; 37 | -------------------------------------------------------------------------------- /src/1.foundation/5.input_management/5.0.input_management/src/main.cpp: -------------------------------------------------------------------------------- 1 | #include "game_engine.h" 2 | 3 | int main(int argv, char** args) { 4 | GameEngine gameEngine; 5 | 6 | while (gameEngine.IsRunning()) { 7 | gameEngine.ProcessInput(); 8 | gameEngine.Update(); 9 | gameEngine.Render(); 10 | } 11 | 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /src/1.foundation/6.entity_component_system/6.0.entity_component_system/assets/audio/music/test_music.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chukobyte/learn-engine-dev/3f4437ed4abab9011d584bdc0ab4eff921393f00/src/1.foundation/6.entity_component_system/6.0.entity_component_system/assets/audio/music/test_music.wav -------------------------------------------------------------------------------- /src/1.foundation/6.entity_component_system/6.0.entity_component_system/assets/audio/sound/test_sound_effect.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chukobyte/learn-engine-dev/3f4437ed4abab9011d584bdc0ab4eff921393f00/src/1.foundation/6.entity_component_system/6.0.entity_component_system/assets/audio/sound/test_sound_effect.wav -------------------------------------------------------------------------------- /src/1.foundation/6.entity_component_system/6.0.entity_component_system/assets/fonts/verdana.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chukobyte/learn-engine-dev/3f4437ed4abab9011d584bdc0ab4eff921393f00/src/1.foundation/6.entity_component_system/6.0.entity_component_system/assets/fonts/verdana.ttf -------------------------------------------------------------------------------- /src/1.foundation/6.entity_component_system/6.0.entity_component_system/assets/images/melissa_walk_animation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chukobyte/learn-engine-dev/3f4437ed4abab9011d584bdc0ab4eff921393f00/src/1.foundation/6.entity_component_system/6.0.entity_component_system/assets/images/melissa_walk_animation.png -------------------------------------------------------------------------------- /src/1.foundation/6.entity_component_system/6.0.entity_component_system/assets/scripts/game.py: -------------------------------------------------------------------------------- 1 | class Player: 2 | def talk(self, message: str) -> None: 3 | print(f"Player says '{message}'!") 4 | -------------------------------------------------------------------------------- /src/1.foundation/6.entity_component_system/6.0.entity_component_system/src/game_engine.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "./re/game_engine_context.h" 4 | #include "./re/project_properties.h" 5 | #include "./re/rendering/renderer_2d.h" 6 | #include "./re/rendering/render_context.h" 7 | #include "./re/utils/fps_counter.h" 8 | #include "./re/utils/logger.h" 9 | #include "./re/input/input_manager.h" 10 | #include "./re/data/asset_manager.h" 11 | 12 | #include "ecs_orchestrator.h" 13 | 14 | class GameEngine { 15 | public: 16 | GameEngine(); 17 | ~GameEngine(); 18 | void ProcessInput(); 19 | void Update(); 20 | void Render(); 21 | bool IsRunning() const; 22 | 23 | private: 24 | ProjectProperties *projectProperties = nullptr; 25 | GameEngineContext *engineContext = nullptr; 26 | RenderContext *renderContext = nullptr; 27 | AssetManager *assetManager = nullptr; 28 | FPSCounter *fpsCounter = nullptr; 29 | Renderer2D *renderer2D = nullptr; 30 | Logger *logger = nullptr; 31 | InputManager *inputManager = nullptr; 32 | ECSOrchestrator *ecsOrchestrator = nullptr; 33 | 34 | bool Initialize(); 35 | bool InitializeSDL(); 36 | bool InitializeAudio(); 37 | bool InitializeRendering(); 38 | bool InitializeInput(); 39 | bool InitializeECS(); 40 | }; 41 | -------------------------------------------------------------------------------- /src/1.foundation/6.entity_component_system/6.0.entity_component_system/src/main.cpp: -------------------------------------------------------------------------------- 1 | #include "game_engine.h" 2 | 3 | int main(int argv, char** args) { 4 | GameEngine gameEngine; 5 | 6 | while (gameEngine.IsRunning()) { 7 | gameEngine.ProcessInput(); 8 | gameEngine.Update(); 9 | gameEngine.Render(); 10 | } 11 | 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /src/1.foundation/7.serializing_with_json/7.0.parsing_json_properties_file/assets/audio/music/test_music.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chukobyte/learn-engine-dev/3f4437ed4abab9011d584bdc0ab4eff921393f00/src/1.foundation/7.serializing_with_json/7.0.parsing_json_properties_file/assets/audio/music/test_music.wav -------------------------------------------------------------------------------- /src/1.foundation/7.serializing_with_json/7.0.parsing_json_properties_file/assets/audio/sound/test_sound_effect.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chukobyte/learn-engine-dev/3f4437ed4abab9011d584bdc0ab4eff921393f00/src/1.foundation/7.serializing_with_json/7.0.parsing_json_properties_file/assets/audio/sound/test_sound_effect.wav -------------------------------------------------------------------------------- /src/1.foundation/7.serializing_with_json/7.0.parsing_json_properties_file/assets/fonts/verdana.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chukobyte/learn-engine-dev/3f4437ed4abab9011d584bdc0ab4eff921393f00/src/1.foundation/7.serializing_with_json/7.0.parsing_json_properties_file/assets/fonts/verdana.ttf -------------------------------------------------------------------------------- /src/1.foundation/7.serializing_with_json/7.0.parsing_json_properties_file/assets/images/melissa_walk_animation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chukobyte/learn-engine-dev/3f4437ed4abab9011d584bdc0ab4eff921393f00/src/1.foundation/7.serializing_with_json/7.0.parsing_json_properties_file/assets/images/melissa_walk_animation.png -------------------------------------------------------------------------------- /src/1.foundation/7.serializing_with_json/7.0.parsing_json_properties_file/assets/scripts/game.py: -------------------------------------------------------------------------------- 1 | class Player: 2 | def talk(self, message: str) -> None: 3 | print(f"Player says '{message}'!") 4 | -------------------------------------------------------------------------------- /src/1.foundation/7.serializing_with_json/7.0.parsing_json_properties_file/properties.json: -------------------------------------------------------------------------------- 1 | { 2 | "game_title": "2D Test", 3 | "initial_scene": "scenes/main.sscn", 4 | "base_resolution": { 5 | "width": 800, 6 | "height": 600 7 | }, 8 | "colliders_visible": true, 9 | "target_fps": 60, 10 | "background_color": { 11 | "red": 50, 12 | "green": 50, 13 | "blue": 50 14 | }, 15 | "assets": [ 16 | { 17 | "type": "texture", 18 | "file_path": "assets/images/melissa_walk_animation.png", 19 | "wrap_s": "clamp_to_border", 20 | "wrap_t": "clamp_to_border", 21 | "filter_min": "nearest", 22 | "filter_max": "nearest" 23 | }, 24 | { 25 | "type": "font", 26 | "uid": "verdana-32", 27 | "file_path": "assets/fonts/verdana.ttf", 28 | "size": 32 29 | }, 30 | { 31 | "type": "music", 32 | "file_path": "assets/audio/music/test_music.wav" 33 | }, 34 | { 35 | "type": "sound", 36 | "file_path": "assets/audio/sound/test_sound_effect.wav" 37 | } 38 | ], 39 | "input_actions": [ 40 | { 41 | "name": "quit", 42 | "values": [ 43 | "esc" 44 | ] 45 | }, 46 | { 47 | "name": "move_left", 48 | "values": [ 49 | "left" 50 | ] 51 | }, 52 | { 53 | "name": "move_right", 54 | "values": [ 55 | "right" 56 | ] 57 | } 58 | ] 59 | } 60 | -------------------------------------------------------------------------------- /src/1.foundation/7.serializing_with_json/7.0.parsing_json_properties_file/src/game_engine.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "./re/data/asset_manager.h" 4 | #include "./re/game_engine_context.h" 5 | #include "./re/project_properties.h" 6 | #include "./re/rendering/renderer_2d.h" 7 | #include "./re/rendering/render_context.h" 8 | #include "./re/utils/fps_counter.h" 9 | #include "./re/utils/logger.h" 10 | #include "./re/input/input_manager.h" 11 | #include "./re/ecs/ecs_orchestrator.h" 12 | 13 | class GameEngine { 14 | public: 15 | GameEngine(); 16 | ~GameEngine(); 17 | void ProcessInput(); 18 | void Update(); 19 | void Render(); 20 | bool IsRunning() const; 21 | 22 | private: 23 | ProjectProperties *projectProperties = nullptr; 24 | GameEngineContext *engineContext = nullptr; 25 | RenderContext *renderContext = nullptr; 26 | AssetManager *assetManager = nullptr; 27 | FPSCounter *fpsCounter = nullptr; 28 | Renderer2D *renderer2D = nullptr; 29 | Logger *logger = nullptr; 30 | InputManager *inputManager = nullptr; 31 | ECSOrchestrator *ecsOrchestrator = nullptr; 32 | 33 | bool Initialize(); 34 | bool InitializeSDL(); 35 | bool InitializeAudio(); 36 | bool InitializeRendering(); 37 | bool InitializeInput(); 38 | bool InitializeECS(); 39 | bool LoadProjectProperties(); 40 | }; 41 | -------------------------------------------------------------------------------- /src/1.foundation/7.serializing_with_json/7.0.parsing_json_properties_file/src/main.cpp: -------------------------------------------------------------------------------- 1 | #include "game_engine.h" 2 | 3 | int main(int argv, char** args) { 4 | GameEngine gameEngine; 5 | 6 | while (gameEngine.IsRunning()) { 7 | gameEngine.ProcessInput(); 8 | gameEngine.Update(); 9 | gameEngine.Render(); 10 | } 11 | 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /src/1.foundation/7.serializing_with_json/7.1.creating_scene_json_files/assets/audio/music/test_music.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chukobyte/learn-engine-dev/3f4437ed4abab9011d584bdc0ab4eff921393f00/src/1.foundation/7.serializing_with_json/7.1.creating_scene_json_files/assets/audio/music/test_music.wav -------------------------------------------------------------------------------- /src/1.foundation/7.serializing_with_json/7.1.creating_scene_json_files/assets/audio/sound/test_sound_effect.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chukobyte/learn-engine-dev/3f4437ed4abab9011d584bdc0ab4eff921393f00/src/1.foundation/7.serializing_with_json/7.1.creating_scene_json_files/assets/audio/sound/test_sound_effect.wav -------------------------------------------------------------------------------- /src/1.foundation/7.serializing_with_json/7.1.creating_scene_json_files/assets/fonts/verdana.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chukobyte/learn-engine-dev/3f4437ed4abab9011d584bdc0ab4eff921393f00/src/1.foundation/7.serializing_with_json/7.1.creating_scene_json_files/assets/fonts/verdana.ttf -------------------------------------------------------------------------------- /src/1.foundation/7.serializing_with_json/7.1.creating_scene_json_files/assets/images/melissa_walk_animation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chukobyte/learn-engine-dev/3f4437ed4abab9011d584bdc0ab4eff921393f00/src/1.foundation/7.serializing_with_json/7.1.creating_scene_json_files/assets/images/melissa_walk_animation.png -------------------------------------------------------------------------------- /src/1.foundation/7.serializing_with_json/7.1.creating_scene_json_files/assets/scripts/game.py: -------------------------------------------------------------------------------- 1 | class Player: 2 | def talk(self, message: str) -> None: 3 | print(f"Player says '{message}'!") 4 | -------------------------------------------------------------------------------- /src/1.foundation/7.serializing_with_json/7.1.creating_scene_json_files/src/game_engine.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "./re/game_engine_context.h" 4 | #include "./re/data/asset_manager.h" 5 | #include "./re/project_properties.h" 6 | #include "./re/rendering/renderer_2d.h" 7 | #include "./re/rendering/render_context.h" 8 | #include "./re/utils/fps_counter.h" 9 | #include "./re/utils/logger.h" 10 | #include "./re/input/input_manager.h" 11 | #include "./re/data/constants.h" 12 | #include "./re/ecs/ecs_orchestrator.h" 13 | 14 | class GameEngine { 15 | public: 16 | GameEngine(); 17 | ~GameEngine(); 18 | void ProcessInput(); 19 | void Update(); 20 | void Render(); 21 | bool IsRunning() const; 22 | 23 | private: 24 | ProjectProperties *projectProperties = nullptr; 25 | GameEngineContext *engineContext = nullptr; 26 | RenderContext *renderContext = nullptr; 27 | AssetManager *assetManager = nullptr; 28 | FPSCounter *fpsCounter = nullptr; 29 | Renderer2D *renderer2D = nullptr; 30 | Logger *logger = nullptr; 31 | InputManager *inputManager = nullptr; 32 | ECSOrchestrator *ecsOrchestrator = nullptr; 33 | 34 | bool Initialize(); 35 | bool InitializeSDL(); 36 | bool InitializeAudio(); 37 | bool InitializeRendering(); 38 | bool InitializeInput(); 39 | bool InitializeECS(); 40 | bool LoadProjectProperties(); 41 | void PhysicsUpdate(); // Fixed time step 42 | }; 43 | -------------------------------------------------------------------------------- /src/1.foundation/7.serializing_with_json/7.1.creating_scene_json_files/src/main.cpp: -------------------------------------------------------------------------------- 1 | #include "game_engine.h" 2 | 3 | int main(int argv, char** args) { 4 | GameEngine gameEngine; 5 | 6 | while (gameEngine.IsRunning()) { 7 | gameEngine.ProcessInput(); 8 | gameEngine.Update(); 9 | gameEngine.Render(); 10 | } 11 | 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /src/1.foundation/8.animations/8.0.animation_system/assets/audio/music/test_music.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chukobyte/learn-engine-dev/3f4437ed4abab9011d584bdc0ab4eff921393f00/src/1.foundation/8.animations/8.0.animation_system/assets/audio/music/test_music.wav -------------------------------------------------------------------------------- /src/1.foundation/8.animations/8.0.animation_system/assets/audio/sound/test_sound_effect.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chukobyte/learn-engine-dev/3f4437ed4abab9011d584bdc0ab4eff921393f00/src/1.foundation/8.animations/8.0.animation_system/assets/audio/sound/test_sound_effect.wav -------------------------------------------------------------------------------- /src/1.foundation/8.animations/8.0.animation_system/assets/fonts/verdana.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chukobyte/learn-engine-dev/3f4437ed4abab9011d584bdc0ab4eff921393f00/src/1.foundation/8.animations/8.0.animation_system/assets/fonts/verdana.ttf -------------------------------------------------------------------------------- /src/1.foundation/8.animations/8.0.animation_system/assets/images/melissa_walk_animation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chukobyte/learn-engine-dev/3f4437ed4abab9011d584bdc0ab4eff921393f00/src/1.foundation/8.animations/8.0.animation_system/assets/images/melissa_walk_animation.png -------------------------------------------------------------------------------- /src/1.foundation/8.animations/8.0.animation_system/assets/scripts/game.py: -------------------------------------------------------------------------------- 1 | class Player: 2 | def talk(self, message: str) -> None: 3 | print(f"Player says '{message}'!") 4 | -------------------------------------------------------------------------------- /src/1.foundation/8.animations/8.0.animation_system/properties.json: -------------------------------------------------------------------------------- 1 | { 2 | "game_title": "2D Test", 3 | "initial_scene": "scenes/main.json", 4 | "base_resolution": { 5 | "width": 800, 6 | "height": 600 7 | }, 8 | "colliders_visible": false, 9 | "target_fps": 60, 10 | "background_color": { 11 | "red": 50, 12 | "green": 50, 13 | "blue": 50 14 | }, 15 | "assets": [ 16 | { 17 | "type": "texture", 18 | "file_path": "assets/images/melissa_walk_animation.png", 19 | "wrap_s": "clamp_to_border", 20 | "wrap_t": "clamp_to_border", 21 | "filter_min": "nearest", 22 | "filter_max": "nearest" 23 | }, 24 | { 25 | "type": "font", 26 | "uid": "verdana-20", 27 | "file_path": "assets/fonts/verdana.ttf", 28 | "size": 20 29 | }, 30 | { 31 | "type": "music", 32 | "file_path": "assets/audio/music/test_music.wav" 33 | }, 34 | { 35 | "type": "sound", 36 | "file_path": "assets/audio/sound/test_sound_effect.wav" 37 | } 38 | ], 39 | "input_actions": [ 40 | { 41 | "name": "quit", 42 | "values": [ 43 | "esc", 44 | "joystick_button_back" 45 | ] 46 | }, 47 | { 48 | "name": "mouse_left_click", 49 | "values": [ 50 | "mb_left" 51 | ] 52 | }, 53 | { 54 | "name": "move_left", 55 | "values": [ 56 | "left" 57 | ] 58 | }, 59 | { 60 | "name": "move_right", 61 | "values": [ 62 | "right" 63 | ] 64 | } 65 | ] 66 | } 67 | -------------------------------------------------------------------------------- /src/1.foundation/8.animations/8.0.animation_system/src/game_engine.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "./re/game_engine_context.h" 4 | #include "./re/data/asset_manager.h" 5 | #include "./re/project_properties.h" 6 | #include "./re/rendering/renderer_2d.h" 7 | #include "./re/rendering/render_context.h" 8 | #include "./re/utils/fps_counter.h" 9 | #include "./re/utils/logger.h" 10 | #include "./re/input/input_manager.h" 11 | #include "./re/data/constants.h" 12 | #include "./re/ecs/ecs_orchestrator.h" 13 | 14 | class GameEngine { 15 | public: 16 | GameEngine(); 17 | ~GameEngine(); 18 | void ProcessInput(); 19 | void Update(); 20 | void Render(); 21 | bool IsRunning() const; 22 | 23 | private: 24 | ProjectProperties *projectProperties = nullptr; 25 | GameEngineContext *engineContext = nullptr; 26 | RenderContext *renderContext = nullptr; 27 | AssetManager *assetManager = nullptr; 28 | FPSCounter *fpsCounter = nullptr; 29 | Renderer2D *renderer2D = nullptr; 30 | Logger *logger = nullptr; 31 | InputManager *inputManager = nullptr; 32 | ECSOrchestrator *ecsOrchestrator = nullptr; 33 | 34 | bool Initialize(); 35 | bool InitializeSDL(); 36 | bool InitializeAudio(); 37 | bool InitializeRendering(); 38 | bool InitializeInput(); 39 | bool InitializeECS(); 40 | bool LoadProjectProperties(); 41 | void PhysicsUpdate(); // Fixed time step 42 | }; 43 | -------------------------------------------------------------------------------- /src/1.foundation/8.animations/8.0.animation_system/src/main.cpp: -------------------------------------------------------------------------------- 1 | #include "game_engine.h" 2 | 3 | int main(int argv, char** args) { 4 | GameEngine gameEngine; 5 | 6 | while (gameEngine.IsRunning()) { 7 | gameEngine.ProcessInput(); 8 | gameEngine.Update(); 9 | gameEngine.Render(); 10 | } 11 | 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /src/1.foundation/9.collisions/9.0.collision_system/assets/audio/music/test_music.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chukobyte/learn-engine-dev/3f4437ed4abab9011d584bdc0ab4eff921393f00/src/1.foundation/9.collisions/9.0.collision_system/assets/audio/music/test_music.wav -------------------------------------------------------------------------------- /src/1.foundation/9.collisions/9.0.collision_system/assets/audio/sound/test_sound_effect.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chukobyte/learn-engine-dev/3f4437ed4abab9011d584bdc0ab4eff921393f00/src/1.foundation/9.collisions/9.0.collision_system/assets/audio/sound/test_sound_effect.wav -------------------------------------------------------------------------------- /src/1.foundation/9.collisions/9.0.collision_system/assets/fonts/verdana.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chukobyte/learn-engine-dev/3f4437ed4abab9011d584bdc0ab4eff921393f00/src/1.foundation/9.collisions/9.0.collision_system/assets/fonts/verdana.ttf -------------------------------------------------------------------------------- /src/1.foundation/9.collisions/9.0.collision_system/assets/images/melissa_walk_animation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chukobyte/learn-engine-dev/3f4437ed4abab9011d584bdc0ab4eff921393f00/src/1.foundation/9.collisions/9.0.collision_system/assets/images/melissa_walk_animation.png -------------------------------------------------------------------------------- /src/1.foundation/9.collisions/9.0.collision_system/assets/scripts/game.py: -------------------------------------------------------------------------------- 1 | class Player: 2 | def talk(self, message: str) -> None: 3 | print(f"Player says '{message}'!") 4 | -------------------------------------------------------------------------------- /src/1.foundation/9.collisions/9.0.collision_system/properties.json: -------------------------------------------------------------------------------- 1 | { 2 | "game_title": "2D Test", 3 | "initial_scene": "scenes/main.json", 4 | "base_resolution": { 5 | "width": 800, 6 | "height": 600 7 | }, 8 | "colliders_visible": true, 9 | "target_fps": 60, 10 | "background_color": { 11 | "red": 50, 12 | "green": 50, 13 | "blue": 50 14 | }, 15 | "assets": [ 16 | { 17 | "type": "texture", 18 | "file_path": "assets/images/melissa_walk_animation.png", 19 | "wrap_s": "clamp_to_border", 20 | "wrap_t": "clamp_to_border", 21 | "filter_min": "nearest", 22 | "filter_max": "nearest" 23 | }, 24 | { 25 | "type": "font", 26 | "uid": "verdana-20", 27 | "file_path": "assets/fonts/verdana.ttf", 28 | "size": 20 29 | }, 30 | { 31 | "type": "music", 32 | "file_path": "assets/audio/music/test_music.wav" 33 | }, 34 | { 35 | "type": "sound", 36 | "file_path": "assets/audio/sound/test_sound_effect.wav" 37 | } 38 | ], 39 | "input_actions": [ 40 | { 41 | "name": "quit", 42 | "values": [ 43 | "esc", 44 | "joystick_button_back" 45 | ] 46 | }, 47 | { 48 | "name": "mouse_left_click", 49 | "values": [ 50 | "mb_left" 51 | ] 52 | }, 53 | { 54 | "name": "move_left", 55 | "values": [ 56 | "left" 57 | ] 58 | }, 59 | { 60 | "name": "move_right", 61 | "values": [ 62 | "right" 63 | ] 64 | } 65 | ] 66 | } 67 | -------------------------------------------------------------------------------- /src/1.foundation/9.collisions/9.0.collision_system/src/game_engine.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "./re/game_engine_context.h" 4 | #include "./re/data/asset_manager.h" 5 | #include "./re/project_properties.h" 6 | #include "./re/rendering/renderer_2d.h" 7 | #include "./re/rendering/render_context.h" 8 | #include "./re/utils/fps_counter.h" 9 | #include "./re/utils/logger.h" 10 | #include "./re/input/input_manager.h" 11 | #include "./re/data/constants.h" 12 | #include "./re/ecs/ecs_orchestrator.h" 13 | 14 | class GameEngine { 15 | public: 16 | GameEngine(); 17 | ~GameEngine(); 18 | void ProcessInput(); 19 | void Update(); 20 | void Render(); 21 | bool IsRunning() const; 22 | 23 | private: 24 | ProjectProperties *projectProperties = nullptr; 25 | GameEngineContext *engineContext = nullptr; 26 | RenderContext *renderContext = nullptr; 27 | AssetManager *assetManager = nullptr; 28 | FPSCounter *fpsCounter = nullptr; 29 | Renderer2D *renderer2D = nullptr; 30 | Logger *logger = nullptr; 31 | InputManager *inputManager = nullptr; 32 | ECSOrchestrator *ecsOrchestrator = nullptr; 33 | 34 | bool Initialize(); 35 | bool InitializeSDL(); 36 | bool InitializeAudio(); 37 | bool InitializeRendering(); 38 | bool InitializeInput(); 39 | bool InitializeECS(); 40 | bool LoadProjectProperties(); 41 | void PhysicsUpdate(); // Fixed time step 42 | }; 43 | -------------------------------------------------------------------------------- /src/1.foundation/9.collisions/9.0.collision_system/src/main.cpp: -------------------------------------------------------------------------------- 1 | #include "game_engine.h" 2 | 3 | int main(int argv, char** args) { 4 | GameEngine gameEngine; 5 | 6 | while (gameEngine.IsRunning()) { 7 | gameEngine.ProcessInput(); 8 | gameEngine.Update(); 9 | gameEngine.Render(); 10 | } 11 | 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /src/2.engine_api/README.md: -------------------------------------------------------------------------------- 1 | ## 2. Engine API 2 | 3 | Coming soon... 4 | -------------------------------------------------------------------------------- /src/3.games/README.md: -------------------------------------------------------------------------------- 1 | ## 3. Games 2 | 3 | Coming soon... 4 | --------------------------------------------------------------------------------