From 831f04d4bc19a390415ac0bbac4331c7a65509bc Mon Sep 17 00:00:00 2001 From: Charles McGarvey Date: Mon, 24 May 2010 17:19:31 -0600 Subject: [PATCH] the massive refactoring effort --- COPYING | 2 +- Doxyfile | 1510 +++++++++++++++++ README | 6 +- configure.ac | 2 +- src/Animation.cc | 94 +- src/Animation.hh | 14 +- src/Character.cc | 181 +- src/Character.hh | 28 +- src/ErrorHandler.cc | 77 - src/ErrorHandler.hh | 22 - src/GameLayer.cc | 195 ++- src/GameLayer.hh | 48 +- src/GameState.hh | 14 +- src/Heroine.cc | 39 +- src/Heroine.hh | 6 +- src/Hud.cc | 79 +- src/Hud.hh | 52 +- src/Main.cc | 142 +- src/Main.hh | 24 +- src/Makefile.am | 132 +- src/Moof/Backend.cc | 94 - src/Moof/Camera.cc | 152 -- src/Moof/Camera.hh | 80 - src/Moof/Dispatch.cc | 149 -- src/Moof/Dispatch.hh | 103 -- src/Moof/Entity.hh | 74 - src/Moof/Error.hh | 93 - src/Moof/Frustum.cc | 95 -- src/Moof/Frustum.hh | 60 - src/Moof/Image.hh | 70 - src/Moof/Interpolator.hh | 158 -- src/Moof/Log.cc | 75 - src/Moof/Math.hh | 204 --- src/Moof/ModalDialog.hh | 192 --- src/Moof/Octree.hh | 353 ---- src/Moof/Plane.cc | 51 - src/Moof/Ray.hh | 79 - src/Moof/Resource.hh | 76 - src/Moof/RigidBody.hh | 316 ---- src/Moof/Script.hh | 1055 ------------ src/Moof/Socket.hh | 1132 ------------ src/Moof/Sound.cc | 601 ------- src/Moof/Sound.hh | 104 -- src/Moof/StringTools.hh | 27 - src/Moof/Texture.cc | 487 ------ src/Moof/Timer.cc | 232 --- src/Moof/Transition.hh | 151 -- src/Moof/Video.cc | 404 ----- src/Moof/Video.hh | 141 -- src/Moof/View.cc | 411 ----- src/Scene.cc | 345 ++-- src/Scene.hh | 32 +- src/TilemapFont.cc | 10 +- src/TilemapFont.hh | 8 +- src/TitleLayer.cc | 31 +- src/TitleLayer.hh | 20 +- src/Typesetter.hh | 10 +- src/{Moof => moof}/ConvertUTF.c | 0 src/{Moof => moof}/ConvertUTF.h | 0 src/{Moof/Aabb.cc => moof/aabb.cc} | 10 +- src/{Moof/Aabb.hh => moof/aabb.hh} | 109 +- src/moof/backend.cc | 92 + src/{Moof/Backend.hh => moof/backend.hh} | 37 +- src/moof/camera.cc | 152 ++ src/moof/camera.hh | 86 + src/{Moof => moof}/cml/cml.h | 0 src/{Moof => moof}/cml/constants.h | 0 src/{Moof => moof}/cml/core/cml_assert.h | 0 src/{Moof => moof}/cml/core/cml_meta.h | 0 src/{Moof => moof}/cml/core/common.h | 0 src/{Moof => moof}/cml/core/dynamic_1D.h | 0 src/{Moof => moof}/cml/core/dynamic_2D.h | 0 src/{Moof => moof}/cml/core/external_1D.h | 0 src/{Moof => moof}/cml/core/external_2D.h | 0 src/{Moof => moof}/cml/core/fixed_1D.h | 0 src/{Moof => moof}/cml/core/fixed_2D.h | 0 src/{Moof => moof}/cml/core/fwd.h | 0 src/{Moof => moof}/cml/core/meta/common.h | 0 src/{Moof => moof}/cml/core/meta/if.h | 0 src/{Moof => moof}/cml/core/meta/switch.h | 0 src/{Moof => moof}/cml/defaults.h | 0 src/{Moof => moof}/cml/dynamic.h | 0 src/{Moof => moof}/cml/et/array_promotions.h | 0 src/{Moof => moof}/cml/et/scalar_ops.h | 0 src/{Moof => moof}/cml/et/scalar_promotions.h | 0 src/{Moof => moof}/cml/et/size_checking.h | 0 src/{Moof => moof}/cml/et/tags.h | 0 src/{Moof => moof}/cml/et/traits.h | 0 src/{Moof => moof}/cml/external.h | 0 src/{Moof => moof}/cml/fixed.h | 0 src/{Moof => moof}/cml/mathlib/checking.h | 0 .../cml/mathlib/coord_conversion.h | 0 src/{Moof => moof}/cml/mathlib/epsilon.h | 0 src/{Moof => moof}/cml/mathlib/frustum.h | 0 src/{Moof => moof}/cml/mathlib/helper.h | 0 .../cml/mathlib/interpolation.h | 0 src/{Moof => moof}/cml/mathlib/mathlib.h | 0 src/{Moof => moof}/cml/mathlib/matrix_basis.h | 0 .../cml/mathlib/matrix_concat.h | 0 src/{Moof => moof}/cml/mathlib/matrix_misc.h | 0 src/{Moof => moof}/cml/mathlib/matrix_ortho.h | 0 .../cml/mathlib/matrix_projection.h | 0 .../cml/mathlib/matrix_rotation.h | 0 .../cml/mathlib/matrix_transform.h | 0 .../cml/mathlib/matrix_translation.h | 0 src/{Moof => moof}/cml/mathlib/misc.h | 0 src/{Moof => moof}/cml/mathlib/picking.h | 0 src/{Moof => moof}/cml/mathlib/projection.h | 0 .../cml/mathlib/quaternion_basis.h | 0 .../cml/mathlib/quaternion_rotation.h | 0 src/{Moof => moof}/cml/mathlib/typedef.h | 0 src/{Moof => moof}/cml/mathlib/vector_angle.h | 0 src/{Moof => moof}/cml/mathlib/vector_misc.h | 0 src/{Moof => moof}/cml/mathlib/vector_ortho.h | 0 .../cml/mathlib/vector_transform.h | 0 src/{Moof => moof}/cml/matrix.h | 0 src/{Moof => moof}/cml/matrix/class_ops.h | 0 src/{Moof => moof}/cml/matrix/determinant.h | 0 src/{Moof => moof}/cml/matrix/dynamic.h | 0 src/{Moof => moof}/cml/matrix/external.h | 0 src/{Moof => moof}/cml/matrix/fixed.h | 0 src/{Moof => moof}/cml/matrix/inverse.h | 0 src/{Moof => moof}/cml/matrix/lu.h | 0 src/{Moof => moof}/cml/matrix/matop_macros.h | 0 .../cml/matrix/matrix_comparison.h | 0 src/{Moof => moof}/cml/matrix/matrix_expr.h | 0 .../cml/matrix/matrix_functions.h | 0 src/{Moof => moof}/cml/matrix/matrix_mul.h | 0 src/{Moof => moof}/cml/matrix/matrix_ops.h | 0 src/{Moof => moof}/cml/matrix/matrix_print.h | 0 .../cml/matrix/matrix_promotions.h | 0 src/{Moof => moof}/cml/matrix/matrix_rowcol.h | 0 src/{Moof => moof}/cml/matrix/matrix_traits.h | 0 .../cml/matrix/matrix_transpose.h | 0 .../cml/matrix/matrix_unroller.h | 0 src/{Moof => moof}/cml/matvec/matvec_mul.h | 0 .../cml/matvec/matvec_promotions.h | 0 src/{Moof => moof}/cml/quaternion.h | 0 src/{Moof => moof}/cml/quaternion/conjugate.h | 0 src/{Moof => moof}/cml/quaternion/inverse.h | 0 .../cml/quaternion/quaternion.h | 0 .../cml/quaternion/quaternion_comparison.h | 0 .../cml/quaternion/quaternion_dot.h | 0 .../cml/quaternion/quaternion_expr.h | 0 .../cml/quaternion/quaternion_functions.h | 0 .../cml/quaternion/quaternion_mul.h | 0 .../cml/quaternion/quaternion_ops.h | 0 .../cml/quaternion/quaternion_print.h | 0 .../cml/quaternion/quaternion_promotions.h | 0 .../cml/quaternion/quaternion_traits.h | 0 .../cml/quaternion/quatop_macros.h | 0 src/{Moof => moof}/cml/util.h | 0 src/{Moof => moof}/cml/vector.h | 0 src/{Moof => moof}/cml/vector/class_ops.h | 0 src/{Moof => moof}/cml/vector/dynamic.h | 0 src/{Moof => moof}/cml/vector/external.h | 0 src/{Moof => moof}/cml/vector/fixed.h | 0 src/{Moof => moof}/cml/vector/vecop_macros.h | 0 .../cml/vector/vector_comparison.h | 0 src/{Moof => moof}/cml/vector/vector_expr.h | 0 .../cml/vector/vector_functions.h | 0 src/{Moof => moof}/cml/vector/vector_ops.h | 0 src/{Moof => moof}/cml/vector/vector_print.h | 0 .../cml/vector/vector_products.h | 0 .../cml/vector/vector_promotions.h | 0 src/{Moof => moof}/cml/vector/vector_traits.h | 0 .../cml/vector/vector_unroller.h | 0 src/{Moof/Contact.hh => moof/contact.hh} | 23 +- src/{Moof/Cullable.hh => moof/cullable.hh} | 17 +- src/moof/dispatcher.cc | 150 ++ src/moof/dispatcher.hh | 108 ++ src/{Moof/Drawable.hh => moof/drawable.hh} | 18 +- src/moof/entity.hh | 106 ++ src/{Moof/Event.hh => moof/event.hh} | 26 +- src/{Moof => moof}/fastevents.c | 0 src/{Moof => moof}/fastevents.h | 0 src/moof/frustum.cc | 94 + src/moof/frustum.hh | 74 + src/{Moof/HashTools.cc => moof/hash.cc} | 10 +- src/{Moof/HashTools.hh => moof/hash.hh} | 30 +- src/{Moof/Image.cc => moof/image.cc} | 135 +- src/moof/image.hh | 76 + src/moof/interpolator.hh | 204 +++ src/{Moof/Line.hh => moof/line.hh} | 142 +- src/moof/log.cc | 74 + src/{Moof/Log.hh => moof/log.hh} | 88 +- src/{Moof/Manager.hh => moof/manager.hh} | 58 +- src/moof/math.hh | 157 ++ src/moof/modal_dialog.hh | 202 +++ src/{Moof/Network.hh => moof/network.hh} | 16 +- src/{Moof/OpenGL.hh => moof/opengl.hh} | 22 +- src/{Moof/Packet.cc => moof/packet.cc} | 207 +-- src/{Moof/Packet.hh => moof/packet.hh} | 150 +- src/moof/plane.cc | 51 + src/{Moof/Plane.hh => moof/plane.hh} | 70 +- src/moof/ray.hh | 84 + src/{Moof/Resource.cc => moof/resource.cc} | 52 +- src/moof/resource.hh | 89 + src/moof/rigid_body.hh | 322 ++++ src/moof/script.hh | 1063 ++++++++++++ src/{Moof/Service.cc => moof/service.cc} | 32 +- src/{Moof/Service.hh => moof/service.hh} | 70 +- src/{Moof/Settings.cc => moof/settings.cc} | 56 +- src/{Moof/Settings.hh => moof/settings.hh} | 60 +- src/{Moof/Shape.hh => moof/shape.hh} | 69 +- src/moof/socket.hh | 1164 +++++++++++++ src/moof/sound.cc | 599 +++++++ src/moof/sound.hh | 104 ++ src/{Moof/Sphere.cc => moof/sphere.cc} | 16 +- src/{Moof/Sphere.hh => moof/sphere.hh} | 97 +- src/{Moof => moof}/stlplus/containers.hpp | 0 .../stlplus/containers_fixes.hpp | 0 src/{Moof => moof}/stlplus/digraph.hpp | 0 src/{Moof => moof}/stlplus/digraph.tpp | 0 src/{Moof => moof}/stlplus/exceptions.hpp | 0 src/{Moof => moof}/stlplus/foursome.hpp | 0 src/{Moof => moof}/stlplus/foursome.tpp | 0 src/{Moof => moof}/stlplus/hash.hpp | 0 src/{Moof => moof}/stlplus/hash.tpp | 0 src/{Moof => moof}/stlplus/matrix.hpp | 0 src/{Moof => moof}/stlplus/matrix.tpp | 0 src/{Moof => moof}/stlplus/ntree.hpp | 0 src/{Moof => moof}/stlplus/ntree.tpp | 0 src/{Moof => moof}/stlplus/safe_iterator.hpp | 0 src/{Moof => moof}/stlplus/safe_iterator.tpp | 0 src/{Moof => moof}/stlplus/smart_ptr.hpp | 0 src/{Moof => moof}/stlplus/smart_ptr.tpp | 0 src/{Moof => moof}/stlplus/triple.hpp | 0 src/{Moof => moof}/stlplus/triple.tpp | 0 src/{Moof/StringTools.cc => moof/string.cc} | 62 +- src/moof/string.hh | 49 + src/moof/texture.cc | 409 +++++ src/{Moof/Texture.hh => moof/texture.hh} | 73 +- src/{Moof/Thread.hh => moof/thread.hh} | 232 +-- src/moof/timer.cc | 232 +++ src/{Moof/Timer.hh => moof/timer.hh} | 76 +- src/moof/video.cc | 394 +++++ src/moof/video.hh | 163 ++ src/moof/view.cc | 410 +++++ src/{Moof/View.hh => moof/view.hh} | 62 +- 240 files changed, 10085 insertions(+), 9090 deletions(-) create mode 100644 Doxyfile delete mode 100644 src/ErrorHandler.cc delete mode 100644 src/ErrorHandler.hh delete mode 100644 src/Moof/Backend.cc delete mode 100644 src/Moof/Camera.cc delete mode 100644 src/Moof/Camera.hh delete mode 100644 src/Moof/Dispatch.cc delete mode 100644 src/Moof/Dispatch.hh delete mode 100644 src/Moof/Entity.hh delete mode 100644 src/Moof/Error.hh delete mode 100644 src/Moof/Frustum.cc delete mode 100644 src/Moof/Frustum.hh delete mode 100644 src/Moof/Image.hh delete mode 100644 src/Moof/Interpolator.hh delete mode 100644 src/Moof/Log.cc delete mode 100644 src/Moof/Math.hh delete mode 100644 src/Moof/ModalDialog.hh delete mode 100644 src/Moof/Octree.hh delete mode 100644 src/Moof/Plane.cc delete mode 100644 src/Moof/Ray.hh delete mode 100644 src/Moof/Resource.hh delete mode 100644 src/Moof/RigidBody.hh delete mode 100644 src/Moof/Script.hh delete mode 100644 src/Moof/Socket.hh delete mode 100644 src/Moof/Sound.cc delete mode 100644 src/Moof/Sound.hh delete mode 100644 src/Moof/StringTools.hh delete mode 100644 src/Moof/Texture.cc delete mode 100644 src/Moof/Timer.cc delete mode 100644 src/Moof/Transition.hh delete mode 100644 src/Moof/Video.cc delete mode 100644 src/Moof/Video.hh delete mode 100644 src/Moof/View.cc rename src/{Moof => moof}/ConvertUTF.c (100%) rename src/{Moof => moof}/ConvertUTF.h (100%) rename src/{Moof/Aabb.cc => moof/aabb.cc} (75%) rename src/{Moof/Aabb.hh => moof/aabb.hh} (64%) create mode 100644 src/moof/backend.cc rename src/{Moof/Backend.hh => moof/backend.hh} (56%) create mode 100644 src/moof/camera.cc create mode 100644 src/moof/camera.hh rename src/{Moof => moof}/cml/cml.h (100%) rename src/{Moof => moof}/cml/constants.h (100%) rename src/{Moof => moof}/cml/core/cml_assert.h (100%) rename src/{Moof => moof}/cml/core/cml_meta.h (100%) rename src/{Moof => moof}/cml/core/common.h (100%) rename src/{Moof => moof}/cml/core/dynamic_1D.h (100%) rename src/{Moof => moof}/cml/core/dynamic_2D.h (100%) rename src/{Moof => moof}/cml/core/external_1D.h (100%) rename src/{Moof => moof}/cml/core/external_2D.h (100%) rename src/{Moof => moof}/cml/core/fixed_1D.h (100%) rename src/{Moof => moof}/cml/core/fixed_2D.h (100%) rename src/{Moof => moof}/cml/core/fwd.h (100%) rename src/{Moof => moof}/cml/core/meta/common.h (100%) rename src/{Moof => moof}/cml/core/meta/if.h (100%) rename src/{Moof => moof}/cml/core/meta/switch.h (100%) rename src/{Moof => moof}/cml/defaults.h (100%) rename src/{Moof => moof}/cml/dynamic.h (100%) rename src/{Moof => moof}/cml/et/array_promotions.h (100%) rename src/{Moof => moof}/cml/et/scalar_ops.h (100%) rename src/{Moof => moof}/cml/et/scalar_promotions.h (100%) rename src/{Moof => moof}/cml/et/size_checking.h (100%) rename src/{Moof => moof}/cml/et/tags.h (100%) rename src/{Moof => moof}/cml/et/traits.h (100%) rename src/{Moof => moof}/cml/external.h (100%) rename src/{Moof => moof}/cml/fixed.h (100%) rename src/{Moof => moof}/cml/mathlib/checking.h (100%) rename src/{Moof => moof}/cml/mathlib/coord_conversion.h (100%) rename src/{Moof => moof}/cml/mathlib/epsilon.h (100%) rename src/{Moof => moof}/cml/mathlib/frustum.h (100%) rename src/{Moof => moof}/cml/mathlib/helper.h (100%) rename src/{Moof => moof}/cml/mathlib/interpolation.h (100%) rename src/{Moof => moof}/cml/mathlib/mathlib.h (100%) rename src/{Moof => moof}/cml/mathlib/matrix_basis.h (100%) rename src/{Moof => moof}/cml/mathlib/matrix_concat.h (100%) rename src/{Moof => moof}/cml/mathlib/matrix_misc.h (100%) rename src/{Moof => moof}/cml/mathlib/matrix_ortho.h (100%) rename src/{Moof => moof}/cml/mathlib/matrix_projection.h (100%) rename src/{Moof => moof}/cml/mathlib/matrix_rotation.h (100%) rename src/{Moof => moof}/cml/mathlib/matrix_transform.h (100%) rename src/{Moof => moof}/cml/mathlib/matrix_translation.h (100%) rename src/{Moof => moof}/cml/mathlib/misc.h (100%) rename src/{Moof => moof}/cml/mathlib/picking.h (100%) rename src/{Moof => moof}/cml/mathlib/projection.h (100%) rename src/{Moof => moof}/cml/mathlib/quaternion_basis.h (100%) rename src/{Moof => moof}/cml/mathlib/quaternion_rotation.h (100%) rename src/{Moof => moof}/cml/mathlib/typedef.h (100%) rename src/{Moof => moof}/cml/mathlib/vector_angle.h (100%) rename src/{Moof => moof}/cml/mathlib/vector_misc.h (100%) rename src/{Moof => moof}/cml/mathlib/vector_ortho.h (100%) rename src/{Moof => moof}/cml/mathlib/vector_transform.h (100%) rename src/{Moof => moof}/cml/matrix.h (100%) rename src/{Moof => moof}/cml/matrix/class_ops.h (100%) rename src/{Moof => moof}/cml/matrix/determinant.h (100%) rename src/{Moof => moof}/cml/matrix/dynamic.h (100%) rename src/{Moof => moof}/cml/matrix/external.h (100%) rename src/{Moof => moof}/cml/matrix/fixed.h (100%) rename src/{Moof => moof}/cml/matrix/inverse.h (100%) rename src/{Moof => moof}/cml/matrix/lu.h (100%) rename src/{Moof => moof}/cml/matrix/matop_macros.h (100%) rename src/{Moof => moof}/cml/matrix/matrix_comparison.h (100%) rename src/{Moof => moof}/cml/matrix/matrix_expr.h (100%) rename src/{Moof => moof}/cml/matrix/matrix_functions.h (100%) rename src/{Moof => moof}/cml/matrix/matrix_mul.h (100%) rename src/{Moof => moof}/cml/matrix/matrix_ops.h (100%) rename src/{Moof => moof}/cml/matrix/matrix_print.h (100%) rename src/{Moof => moof}/cml/matrix/matrix_promotions.h (100%) rename src/{Moof => moof}/cml/matrix/matrix_rowcol.h (100%) rename src/{Moof => moof}/cml/matrix/matrix_traits.h (100%) rename src/{Moof => moof}/cml/matrix/matrix_transpose.h (100%) rename src/{Moof => moof}/cml/matrix/matrix_unroller.h (100%) rename src/{Moof => moof}/cml/matvec/matvec_mul.h (100%) rename src/{Moof => moof}/cml/matvec/matvec_promotions.h (100%) rename src/{Moof => moof}/cml/quaternion.h (100%) rename src/{Moof => moof}/cml/quaternion/conjugate.h (100%) rename src/{Moof => moof}/cml/quaternion/inverse.h (100%) rename src/{Moof => moof}/cml/quaternion/quaternion.h (100%) rename src/{Moof => moof}/cml/quaternion/quaternion_comparison.h (100%) rename src/{Moof => moof}/cml/quaternion/quaternion_dot.h (100%) rename src/{Moof => moof}/cml/quaternion/quaternion_expr.h (100%) rename src/{Moof => moof}/cml/quaternion/quaternion_functions.h (100%) rename src/{Moof => moof}/cml/quaternion/quaternion_mul.h (100%) rename src/{Moof => moof}/cml/quaternion/quaternion_ops.h (100%) rename src/{Moof => moof}/cml/quaternion/quaternion_print.h (100%) rename src/{Moof => moof}/cml/quaternion/quaternion_promotions.h (100%) rename src/{Moof => moof}/cml/quaternion/quaternion_traits.h (100%) rename src/{Moof => moof}/cml/quaternion/quatop_macros.h (100%) rename src/{Moof => moof}/cml/util.h (100%) rename src/{Moof => moof}/cml/vector.h (100%) rename src/{Moof => moof}/cml/vector/class_ops.h (100%) rename src/{Moof => moof}/cml/vector/dynamic.h (100%) rename src/{Moof => moof}/cml/vector/external.h (100%) rename src/{Moof => moof}/cml/vector/fixed.h (100%) rename src/{Moof => moof}/cml/vector/vecop_macros.h (100%) rename src/{Moof => moof}/cml/vector/vector_comparison.h (100%) rename src/{Moof => moof}/cml/vector/vector_expr.h (100%) rename src/{Moof => moof}/cml/vector/vector_functions.h (100%) rename src/{Moof => moof}/cml/vector/vector_ops.h (100%) rename src/{Moof => moof}/cml/vector/vector_print.h (100%) rename src/{Moof => moof}/cml/vector/vector_products.h (100%) rename src/{Moof => moof}/cml/vector/vector_promotions.h (100%) rename src/{Moof => moof}/cml/vector/vector_traits.h (100%) rename src/{Moof => moof}/cml/vector/vector_unroller.h (100%) rename src/{Moof/Contact.hh => moof/contact.hh} (56%) rename src/{Moof/Cullable.hh => moof/cullable.hh} (70%) create mode 100644 src/moof/dispatcher.cc create mode 100644 src/moof/dispatcher.hh rename src/{Moof/Drawable.hh => moof/drawable.hh} (67%) create mode 100644 src/moof/entity.hh rename src/{Moof/Event.hh => moof/event.hh} (50%) rename src/{Moof => moof}/fastevents.c (100%) rename src/{Moof => moof}/fastevents.h (100%) create mode 100644 src/moof/frustum.cc create mode 100644 src/moof/frustum.hh rename src/{Moof/HashTools.cc => moof/hash.cc} (91%) rename src/{Moof/HashTools.hh => moof/hash.hh} (53%) rename src/{Moof/Image.cc => moof/image.cc} (62%) create mode 100644 src/moof/image.hh create mode 100644 src/moof/interpolator.hh rename src/{Moof/Line.hh => moof/line.hh} (55%) create mode 100644 src/moof/log.cc rename src/{Moof/Log.hh => moof/log.hh} (66%) rename src/{Moof/Manager.hh => moof/manager.hh} (50%) create mode 100644 src/moof/math.hh create mode 100644 src/moof/modal_dialog.hh rename src/{Moof/Network.hh => moof/network.hh} (64%) rename src/{Moof/OpenGL.hh => moof/opengl.hh} (86%) rename src/{Moof/Packet.cc => moof/packet.cc} (60%) rename src/{Moof/Packet.hh => moof/packet.hh} (59%) create mode 100644 src/moof/plane.cc rename src/{Moof/Plane.hh => moof/plane.hh} (56%) create mode 100644 src/moof/ray.hh rename src/{Moof/Resource.cc => moof/resource.cc} (69%) create mode 100644 src/moof/resource.hh create mode 100644 src/moof/rigid_body.hh create mode 100644 src/moof/script.hh rename src/{Moof/Service.cc => moof/service.cc} (60%) rename src/{Moof/Service.hh => moof/service.hh} (68%) rename src/{Moof/Settings.cc => moof/settings.cc} (55%) rename src/{Moof/Settings.hh => moof/settings.hh} (53%) rename src/{Moof/Shape.hh => moof/shape.hh} (50%) create mode 100644 src/moof/socket.hh create mode 100644 src/moof/sound.cc create mode 100644 src/moof/sound.hh rename src/{Moof/Sphere.cc => moof/sphere.cc} (71%) rename src/{Moof/Sphere.hh => moof/sphere.hh} (52%) rename src/{Moof => moof}/stlplus/containers.hpp (100%) rename src/{Moof => moof}/stlplus/containers_fixes.hpp (100%) rename src/{Moof => moof}/stlplus/digraph.hpp (100%) rename src/{Moof => moof}/stlplus/digraph.tpp (100%) rename src/{Moof => moof}/stlplus/exceptions.hpp (100%) rename src/{Moof => moof}/stlplus/foursome.hpp (100%) rename src/{Moof => moof}/stlplus/foursome.tpp (100%) rename src/{Moof => moof}/stlplus/hash.hpp (100%) rename src/{Moof => moof}/stlplus/hash.tpp (100%) rename src/{Moof => moof}/stlplus/matrix.hpp (100%) rename src/{Moof => moof}/stlplus/matrix.tpp (100%) rename src/{Moof => moof}/stlplus/ntree.hpp (100%) rename src/{Moof => moof}/stlplus/ntree.tpp (100%) rename src/{Moof => moof}/stlplus/safe_iterator.hpp (100%) rename src/{Moof => moof}/stlplus/safe_iterator.tpp (100%) rename src/{Moof => moof}/stlplus/smart_ptr.hpp (100%) rename src/{Moof => moof}/stlplus/smart_ptr.tpp (100%) rename src/{Moof => moof}/stlplus/triple.hpp (100%) rename src/{Moof => moof}/stlplus/triple.tpp (100%) rename src/{Moof/StringTools.cc => moof/string.cc} (64%) create mode 100644 src/moof/string.hh create mode 100644 src/moof/texture.cc rename src/{Moof/Texture.hh => moof/texture.hh} (51%) rename src/{Moof/Thread.hh => moof/thread.hh} (72%) create mode 100644 src/moof/timer.cc rename src/{Moof/Timer.hh => moof/timer.hh} (55%) create mode 100644 src/moof/video.cc create mode 100644 src/moof/video.hh create mode 100644 src/moof/view.cc rename src/{Moof/View.hh => moof/view.hh} (59%) diff --git a/COPYING b/COPYING index 2279408..afe3fe7 100644 --- a/COPYING +++ b/COPYING @@ -5,7 +5,7 @@ according to the following terms and conditions: The Simplified BSD License -Copyright (c) 2009, Charles McGarvey +Copyright (c) 2009-2010, Charles McGarvey All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/Doxyfile b/Doxyfile new file mode 100644 index 0000000..2ab3c1b --- /dev/null +++ b/Doxyfile @@ -0,0 +1,1510 @@ +# Doxyfile 1.5.8 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project +# +# All text after a hash (#) is considered a comment and will be ignored +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" ") + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file +# that follow. The default is UTF-8 which is also the encoding used for all +# text before the first occurrence of this tag. Doxygen uses libiconv (or the +# iconv built into libc) for the transcoding. See +# http://www.gnu.org/software/libiconv for the list of possible encodings. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded +# by quotes) that should identify the project. + +PROJECT_NAME = Yoink + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. + +PROJECT_NUMBER = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location +# where doxygen was started. If left blank the current directory will be used. + +OUTPUT_DIRECTORY = doc + +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create +# 4096 sub-directories (in 2 levels) under the output directory of each output +# format and will distribute the generated files over these directories. +# Enabling this option can be useful when feeding doxygen a huge amount of +# source files, where putting all generated files in the same directory would +# otherwise cause performance problems for the file system. + +CREATE_SUBDIRS = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, +# Croatian, Czech, Danish, Dutch, Farsi, Finnish, French, German, Greek, +# Hungarian, Italian, Japanese, Japanese-en (Japanese with English messages), +# Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, Polish, +# Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak, Slovene, +# Spanish, Swedish, and Ukrainian. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator +# that is used to form the text in various listings. Each string +# in this list, if found as the leading text of the brief description, will be +# stripped from the text and the result after processing the whole list, is +# used as the annotated text. Otherwise, the brief description is used as-is. +# If left blank, the following values are used ("$name" is automatically +# replaced with the name of the entity): "The $name class" "The $name widget" +# "The $name file" "is" "provides" "specifies" "contains" +# "represents" "a" "an" "the" + +ABBREVIATE_BRIEF = + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. + +FULL_PATH_NAMES = YES + +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user-defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the +# path to strip. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of +# the path mentioned in the documentation of a class, which tells +# the reader which header file to include in order to use a class. +# If left blank only the name of the header file containing the class +# definition is used. Otherwise one should specify the include paths that +# are normally passed to the compiler using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful is your file systems +# doesn't support long names like on DOS, Mac, or CD-ROM. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like regular Qt-style comments +# (thus requiring an explicit @brief command for a brief description.) + +JAVADOC_AUTOBRIEF = NO + +# If the QT_AUTOBRIEF tag is set to YES then Doxygen will +# interpret the first line (until the first dot) of a Qt-style +# comment as the brief description. If set to NO, the comments +# will behave just like regular Qt-style comments (thus requiring +# an explicit \brief command for a brief description.) + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen +# treat a multi-line C++ special comment block (i.e. a block of //! or /// +# comments) as a brief description. This used to be the default behaviour. +# The new default is to treat a multi-line C++ comment block as a detailed +# description. Set this tag to YES if you prefer the old behaviour instead. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# re-implements. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce +# a new page for each member. If set to NO, the documentation of a member will +# be part of the file/class/namespace that contains it. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. + +TAB_SIZE = 8 + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user-defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + +ALIASES = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C +# sources only. Doxygen will then generate output that is more tailored for C. +# For instance, some of the names that are used will be different. The list +# of all members will be omitted, etc. + +OPTIMIZE_OUTPUT_FOR_C = NO + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java +# sources only. Doxygen will then generate output that is more tailored for +# Java. For instance, namespaces will be presented as packages, qualified +# scopes will look different, etc. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources only. Doxygen will then generate output that is more tailored for +# Fortran. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for +# VHDL. + +OPTIMIZE_OUTPUT_VHDL = NO + +# Doxygen selects the parser to use depending on the extension of the files it parses. +# With this tag you can assign which parser to use for a given extension. +# Doxygen has a built-in mapping, but you can override or extend it using this tag. +# The format is ext=language, where ext is a file extension, and language is one of +# the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP, +# Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat +# .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran), +# use: inc=Fortran f=C + +EXTENSION_MAPPING = + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should +# set this tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. +# func(std::string) {}). This also make the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. +# Doxygen will parse them like normal C++ but will assume all classes use public +# instead of private inheritance when no explicit protection keyword is present. + +SIP_SUPPORT = NO + +# For Microsoft's IDL there are propget and propput attributes to indicate getter +# and setter methods for a property. Setting this option to YES (the default) +# will make doxygen to replace the get and set methods by a property in the +# documentation. This will only work if the methods are indeed getting or +# setting a simple type. If this is not the case, or you want to show the +# methods anyway, you should set this option to NO. + +IDL_PROPERTY_SUPPORT = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. + +DISTRIBUTE_GROUP_DOC = NO + +# Set the SUBGROUPING tag to YES (the default) to allow class member groups of +# the same type (for instance a group of public functions) to be put as a +# subgroup of that type (e.g. under the Public Functions section). Set it to +# NO to prevent subgrouping. Alternatively, this can be done per class using +# the \nosubgrouping command. + +SUBGROUPING = YES + +# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum +# is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically +# be useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. + +TYPEDEF_HIDES_STRUCT = NO + +# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to +# determine which symbols to keep in memory and which to flush to disk. +# When the cache is full, less often used symbols will be written to disk. +# For small to medium size projects (<1000 input files) the default value is +# probably good enough. For larger projects a too small cache size can cause +# doxygen to be busy swapping symbols to and from disk most of the time +# causing a significant performance penality. +# If the system has enough physical memory increasing the cache will improve the +# performance by keeping more symbols in memory. Note that the value works on +# a logarithmic scale so increasing the size by one will rougly double the +# memory usage. The cache size is given by this formula: +# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, +# corresponding to a cache size of 2^16 = 65536 symbols + +SYMBOL_CACHE_SIZE = 0 + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + +EXTRACT_ALL = NO + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = NO + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) +# defined locally in source files will be included in the documentation. +# If set to NO only classes defined in header files are included. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. When set to YES local +# methods, which are defined in the implementation section but not in +# the interface are included in the documentation. +# If set to NO (the default) only methods in the interface are included. + +EXTRACT_LOCAL_METHODS = NO + +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base +# name of the file that contains the anonymous namespace. By default +# anonymous namespace are hidden. + +EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these classes will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all +# friend (class|struct|union) declarations. +# If set to NO (the default) these declarations will be included in the +# documentation. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any +# documentation blocks found inside the body of a function. +# If set to NO (the default) these blocks will be appended to the +# function's detailed documentation block. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. + +CASE_SENSE_NAMES = YES + +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the +# documentation. If set to YES the scope will be hidden. + +HIDE_SCOPE_NAMES = NO + +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put a list of the files that are included by a file in the documentation +# of that file. + +SHOW_INCLUDE_FILES = YES + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the +# brief documentation of file, namespace and class members alphabetically +# by member name. If set to NO (the default) the members will appear in +# declaration order. + +SORT_BRIEF_DOCS = NO + +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the +# hierarchy of group names into alphabetical order. If set to NO (the default) +# the group names will appear in their defined order. + +SORT_GROUP_NAMES = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be +# sorted by fully-qualified names, including namespaces. If set to +# NO (the default), the class list will be sorted only by class name, +# not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the +# alphabetical list. + +SORT_BY_SCOPE_NAME = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug +# commands in the documentation. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or +# disable (NO) the deprecated list. This list is created by putting +# \deprecated commands in the documentation. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if sectionname ... \endif. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or define consists of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and defines in the +# documentation can be controlled using \showinitializer or \hideinitializer +# command in the documentation regardless of this setting. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the +# list will mention the files that were used to generate the documentation. + +SHOW_USED_FILES = YES + +# If the sources in your project are distributed over multiple directories +# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy +# in the documentation. The default is NO. + +SHOW_DIRECTORIES = NO + +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. +# This will remove the Files entry from the Quick Index and from the +# Folder Tree View (if specified). The default is YES. + +SHOW_FILES = YES + +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the +# Namespaces page. +# This will remove the Namespaces entry from the Quick Index +# and from the Folder Tree View (if specified). The default is YES. + +SHOW_NAMESPACES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command , where is the value of +# the FILE_VERSION_FILTER tag, and is the name of an input file +# provided by doxygen. Whatever the program writes to standard output +# is used as the file version. See the manual for examples. + +FILE_VERSION_FILTER = + +# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by +# doxygen. The layout file controls the global structure of the generated output files +# in an output format independent way. The create the layout file that represents +# doxygen's defaults, run doxygen with the -l option. You can optionally specify a +# file name after the option, if omitted DoxygenLayout.xml will be used as the name +# of the layout file. + +LAYOUT_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + +WARNINGS = YES + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + +WARN_IF_UNDOCUMENTED = YES + +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some +# parameters in a documented function, or documenting parameters that +# don't exist or using markup commands wrongly. + +WARN_IF_DOC_ERROR = YES + +# This WARN_NO_PARAMDOC option can be abled to get warnings for +# functions that are documented, but have no documentation for their parameters +# or return value. If set to NO (the default) doxygen will only warn about +# wrong or incomplete parameter documentation, but not about the absence of +# documentation. + +WARN_NO_PARAMDOC = NO + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. Optionally the format may contain +# $version, which will be replaced by the version of the file (if it could +# be obtained via FILE_VERSION_FILTER) + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written +# to stderr. + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. + +INPUT = src + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is +# also the default input encoding. Doxygen uses libiconv (or the iconv built +# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for +# the list of possible encodings. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank the following patterns are tested: +# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx +# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90 + +FILE_PATTERNS = *.cc *.hh + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + +RECURSIVE = YES + +# The EXCLUDE tag can be used to specify files and/or directories that should +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used select whether or not files or +# directories that are symbolic links (a Unix filesystem feature) are excluded +# from the input. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. Note that the wildcards are matched +# against the file with absolute path, so to exclude all test directories +# for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# AClass::ANamespace, ANamespace::*Test + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +EXAMPLE_PATTERNS = + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude +# commands irrespective of the value of the RECURSIVE tag. +# Possible values are YES and NO. If left blank NO is used. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command , where +# is the value of the INPUT_FILTER tag, and is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. +# If FILTER_PATTERNS is specified, this tag will be +# ignored. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. +# Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. +# The filters are a list of the form: +# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further +# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER +# is applied to all files. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source +# files to browse (i.e. when SOURCE_BROWSER is set to YES). + +FILTER_SOURCE_FILES = NO + +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. +# Note: To get rid of all source code in the generated output, make sure also +# VERBATIM_HEADERS is set to NO. + +SOURCE_BROWSER = NO + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C and C++ comments will always remain visible. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES +# then for each documented function all documented +# functions referencing it will be listed. + +REFERENCED_BY_RELATION = NO + +# If the REFERENCES_RELATION tag is set to YES +# then for each documented function all documented entities +# called/used by that function will be listed. + +REFERENCES_RELATION = NO + +# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) +# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from +# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will +# link to the source code. +# Otherwise they will link to the documentation. + +REFERENCES_LINK_SOURCE = YES + +# If the USE_HTAGS tag is set to YES then the references to source code +# will point to the HTML generated by the htags(1) tool instead of doxygen +# built-in source browser. The htags tool is part of GNU's global source +# tagging system (see http://www.gnu.org/software/global/global.html). You +# will need version 4.8.6 or higher. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. + +VERBATIM_HEADERS = YES + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. + +ALPHABETICAL_INDEX = NO + +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for +# each generated HTML page (for example: .htm,.php,.asp). If it is left blank +# doxygen will generate files with .html extension. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If the tag is left blank doxygen +# will generate a default style sheet. Note that doxygen will try to copy +# the style sheet file to the HTML output directory, so don't put your own +# stylesheet in the HTML output directory as well, or it will be erased! + +HTML_STYLESHEET = + +# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, +# files or namespaces will be aligned in HTML using tables. If set to +# NO a bullet list will be used. + +HTML_ALIGN_MEMBERS = YES + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. For this to work a browser that supports +# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox +# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). + +HTML_DYNAMIC_SECTIONS = NO + +# If the GENERATE_DOCSET tag is set to YES, additional index files +# will be generated that can be used as input for Apple's Xcode 3 +# integrated development environment, introduced with OSX 10.5 (Leopard). +# To create a documentation set, doxygen will generate a Makefile in the +# HTML output directory. Running make will produce the docset in that +# directory and running "make install" will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find +# it at startup. +# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information. + +GENERATE_DOCSET = NO + +# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the +# feed. A documentation feed provides an umbrella under which multiple +# documentation sets from a single provider (such as a company or product suite) +# can be grouped. + +DOCSET_FEEDNAME = "Doxygen generated docs" + +# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that +# should uniquely identify the documentation set bundle. This should be a +# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen +# will append .docset to the name. + +DOCSET_BUNDLE_ID = org.doxygen.Project + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) +# of the generated HTML documentation. + +GENERATE_HTMLHELP = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can +# be used to specify the file name of the resulting .chm file. You +# can add a path in front of the file if the result should not be +# written to the html output directory. + +CHM_FILE = + +# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can +# be used to specify the location (absolute path including file name) of +# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run +# the HTML help compiler on the generated index.hhp. + +HHC_LOCATION = + +# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag +# controls if a separate .chi index file is generated (YES) or that +# it should be included in the master .chm file (NO). + +GENERATE_CHI = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING +# is used to encode HtmlHelp index (hhk), content (hhc) and project file +# content. + +CHM_INDEX_ENCODING = + +# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag +# controls whether a binary table of contents is generated (YES) or a +# normal table of contents (NO) in the .chm file. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members +# to the contents of the HTML help documentation and to the tree view. + +TOC_EXPAND = NO + +# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER +# are set, an additional index file will be generated that can be used as input for +# Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated +# HTML documentation. + +GENERATE_QHP = NO + +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can +# be used to specify the file name of the resulting .qch file. +# The path specified is relative to the HTML output folder. + +QCH_FILE = + +# The QHP_NAMESPACE tag specifies the namespace to use when generating +# Qt Help Project output. For more information please see +# http://doc.trolltech.com/qthelpproject.html#namespace + +QHP_NAMESPACE = + +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating +# Qt Help Project output. For more information please see +# http://doc.trolltech.com/qthelpproject.html#virtual-folders + +QHP_VIRTUAL_FOLDER = doc + +# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add. +# For more information please see +# http://doc.trolltech.com/qthelpproject.html#custom-filters + +QHP_CUST_FILTER_NAME = + +# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see +# Qt Help Project / Custom Filters. + +QHP_CUST_FILTER_ATTRS = + +# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's +# filter section matches. +# Qt Help Project / Filter Attributes. + +QHP_SECT_FILTER_ATTRS = + +# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can +# be used to specify the location of Qt's qhelpgenerator. +# If non-empty doxygen will try to run qhelpgenerator on the generated +# .qhp file. + +QHG_LOCATION = + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index at +# top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. + +DISABLE_INDEX = NO + +# This tag can be used to set the number of enum values (range [1..20]) +# that doxygen will group on one line in the generated HTML documentation. + +ENUM_VALUES_PER_LINE = 4 + +# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index +# structure should be generated to display hierarchical information. +# If the tag value is set to FRAME, a side panel will be generated +# containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, +# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are +# probably better off using the HTML help feature. Other possible values +# for this tag are: HIERARCHIES, which will generate the Groups, Directories, +# and Class Hierarchy pages using a tree view instead of an ordered list; +# ALL, which combines the behavior of FRAME and HIERARCHIES; and NONE, which +# disables this behavior completely. For backwards compatibility with previous +# releases of Doxygen, the values YES and NO are equivalent to FRAME and NONE +# respectively. + +GENERATE_TREEVIEW = NONE + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree +# is shown. + +TREEVIEW_WIDTH = 250 + +# Use this tag to change the font size of Latex formulas included +# as images in the HTML documentation. The default is 10. Note that +# when you change the font size after a successful doxygen run you need +# to manually remove any form_*.png images from the HTML output directory +# to force them to be regenerated. + +FORMULA_FONTSIZE = 10 + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. + +GENERATE_LATEX = NO + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. + +LATEX_OUTPUT = latex + +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be +# invoked. If left blank `latex' will be used as the default command name. + +LATEX_CMD_NAME = latex + +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to +# generate index for LaTeX. If left blank `makeindex' will be used as the +# default command name. + +MAKEINDEX_CMD_NAME = makeindex + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, a4wide, letter, legal and +# executive. If left blank a4wide will be used. + +PAPER_TYPE = a4wide + +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. + +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! + +LATEX_HEADER = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. + +PDF_HYPERLINKS = YES + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. + +USE_PDFLATEX = YES + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + +LATEX_BATCHMODE = NO + +# If LATEX_HIDE_INDICES is set to YES then doxygen will not +# include the index chapters (such as File Index, Compound Index, etc.) +# in the output. + +LATEX_HIDE_INDICES = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimized for Word 97 and may not look very pretty with +# other RTF readers or editors. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. + +RTF_OUTPUT = rtf + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using WORD or other +# programs which support those fields. +# Note: wordpad (write) and others do not support links. + +RTF_HYPERLINKS = NO + +# Load stylesheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assignments. You only have to provide +# replacements, missing definitions are set to their default value. + +RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an rtf document. +# Syntax is similar to doxygen's config file. + +RTF_EXTENSIONS_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages + +GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. + +MAN_OUTPUT = man + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + +MAN_EXTENSION = .3 + +# If the MAN_LINKS tag is set to YES and Doxygen generates man output, +# then it will generate one additional man file for each entity +# documented in the real man page(s). These additional files +# only source the real man page, but without them the man command +# would be unable to find the correct page. The default is NO. + +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES Doxygen will +# generate an XML file that captures the structure of +# the code including all documentation. + +GENERATE_XML = NO + +# The XML_OUTPUT tag is used to specify where the XML pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `xml' will be used as the default path. + +XML_OUTPUT = xml + +# The XML_SCHEMA tag can be used to specify an XML schema, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_SCHEMA = + +# The XML_DTD tag can be used to specify an XML DTD, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_DTD = + +# If the XML_PROGRAMLISTING tag is set to YES Doxygen will +# dump the program listings (including syntax highlighting +# and cross-referencing information) to the XML output. Note that +# enabling this will significantly increase the size of the XML output. + +XML_PROGRAMLISTING = YES + +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- + +# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will +# generate an AutoGen Definitions (see autogen.sf.net) file +# that captures the structure of the code including all +# documentation. Note that this feature is still experimental +# and incomplete at the moment. + +GENERATE_AUTOGEN_DEF = NO + +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- + +# If the GENERATE_PERLMOD tag is set to YES Doxygen will +# generate a Perl module file that captures the structure of +# the code including all documentation. Note that this +# feature is still experimental and incomplete at the +# moment. + +GENERATE_PERLMOD = NO + +# If the PERLMOD_LATEX tag is set to YES Doxygen will generate +# the necessary Makefile rules, Perl scripts and LaTeX code to be able +# to generate PDF and DVI output from the Perl module output. + +PERLMOD_LATEX = NO + +# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be +# nicely formatted so it can be parsed by a human reader. +# This is useful +# if you want to understand what is going on. +# On the other hand, if this +# tag is set to NO the size of the Perl module output will be much smaller +# and Perl will parse it just the same. + +PERLMOD_PRETTY = YES + +# The names of the make variables in the generated doxyrules.make file +# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. +# This is useful so different doxyrules.make files included by the same +# Makefile don't overwrite each other's variables. + +PERLMOD_MAKEVAR_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. + +ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled +# way by setting EXPAND_ONLY_PREDEF to YES. + +MACRO_EXPANSION = NO + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the +# PREDEFINED and EXPAND_AS_DEFINED tags. + +EXPAND_ONLY_PREDEF = NO + +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# in the INCLUDE_PATH (see below) will be search if a #include is found. + +SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. + +INCLUDE_PATH = + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will +# be used. + +INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. To prevent a macro definition from being +# undefined via #undef or recursively expanded use the := operator +# instead of the = operator. + +PREDEFINED = + +# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition. + +EXPAND_AS_DEFINED = + +# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then +# doxygen's preprocessor will remove all function-like macros that are alone +# on a line, have an all uppercase name, and do not end with a semicolon. Such +# function macros are typically used for boiler-plate code, and will confuse +# the parser if not removed. + +SKIP_FUNCTION_MACROS = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES option can be used to specify one or more tagfiles. +# Optionally an initial location of the external documentation +# can be added for each tagfile. The format of a tag file without +# this location is as follows: +# +# TAGFILES = file1 file2 ... +# Adding location for the tag files is done as follows: +# +# TAGFILES = file1=loc1 "file2 = loc2" ... +# where "loc1" and "loc2" can be relative or absolute paths or +# URLs. If a location is present for each tag, the installdox tool +# does not have to be run to correct the links. +# Note that each tag file must have a unique name +# (where the name does NOT include the path) +# If a tag file is not located in the directory in which doxygen +# is run, you must also specify the path to the tagfile here. + +TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. + +GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. + +ALLEXTERNALS = NO + +# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed +# in the modules index. If set to NO, only the current project's groups will +# be listed. + +EXTERNAL_GROUPS = YES + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of `which perl'). + +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base +# or super classes. Setting the tag to NO turns the diagrams off. Note that +# this option is superseded by the HAVE_DOT option below. This is only a +# fallback. It is recommended to install and use dot, since it yields more +# powerful graphs. + +CLASS_DIAGRAMS = YES + +# You can define message sequence charts within doxygen comments using the \msc +# command. Doxygen will then run the mscgen tool (see +# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the +# documentation. The MSCGEN_PATH tag allows you to specify the directory where +# the mscgen tool resides. If left empty the tool is assumed to be found in the +# default search path. + +MSCGEN_PATH = + +# If set to YES, the inheritance and collaboration graphs will hide +# inheritance and usage relations if the target is undocumented +# or is not a class. + +HIDE_UNDOC_RELATIONS = YES + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) + +HAVE_DOT = YES + +# By default doxygen will write a font called FreeSans.ttf to the output +# directory and reference it in all dot files that doxygen generates. This +# font does not include all possible unicode characters however, so when you need +# these (or just want a differently looking font) you can specify the font name +# using DOT_FONTNAME. You need need to make sure dot is able to find the font, +# which can be done by putting it in a standard location or by setting the +# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory +# containing the font. + +DOT_FONTNAME = FreeSans + +# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. +# The default size is 10pt. + +DOT_FONTSIZE = 10 + +# By default doxygen will tell dot to use the output directory to look for the +# FreeSans.ttf font (which doxygen will put there itself). If you specify a +# different font using DOT_FONTNAME you can set the path where dot +# can find it using this tag. + +DOT_FONTPATH = + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the +# the CLASS_DIAGRAMS tag to NO. + +CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and +# class references variables) of the class with other documented classes. + +COLLABORATION_GRAPH = YES + +# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for groups, showing the direct groups dependencies + +GROUP_GRAPHS = YES + +# If the UML_LOOK tag is set to YES doxygen will generate inheritance and +# collaboration diagrams in a style similar to the OMG's Unified Modeling +# Language. + +UML_LOOK = NO + +# If set to YES, the inheritance and collaboration graphs will show the +# relations between templates and their instances. + +TEMPLATE_RELATIONS = NO + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT +# tags are set to YES then doxygen will generate a graph for each documented +# file showing the direct and indirect include dependencies of the file with +# other documented files. + +INCLUDE_GRAPH = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and +# HAVE_DOT tags are set to YES then doxygen will generate a graph for each +# documented header file showing the documented files that directly or +# indirectly include this file. + +INCLUDED_BY_GRAPH = YES + +# If the CALL_GRAPH and HAVE_DOT options are set to YES then +# doxygen will generate a call dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable call graphs +# for selected functions only using the \callgraph command. + +CALL_GRAPH = NO + +# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then +# doxygen will generate a caller dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable caller +# graphs for selected functions only using the \callergraph command. + +CALLER_GRAPH = NO + +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will graphical hierarchy of all classes instead of a textual one. + +GRAPHICAL_HIERARCHY = YES + +# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES +# then doxygen will show the dependencies a directory has on other directories +# in a graphical way. The dependency relations are determined by the #include +# relations between the files in the directories. + +DIRECTORY_GRAPH = YES + +# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images +# generated by dot. Possible values are png, jpg, or gif +# If left blank png will be used. + +DOT_IMAGE_FORMAT = png + +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found in the path. + +DOT_PATH = + +# The DOTFILE_DIRS tag can be used to specify one or more directories that +# contain dot files that are included in the documentation (see the +# \dotfile command). + +DOTFILE_DIRS = + +# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of +# nodes that will be shown in the graph. If the number of nodes in a graph +# becomes larger than this value, doxygen will truncate the graph, which is +# visualized by representing a node as a red box. Note that doxygen if the +# number of direct children of the root node in a graph is already larger than +# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note +# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. + +DOT_GRAPH_MAX_NODES = 50 + +# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the +# graphs generated by dot. A depth value of 3 means that only nodes reachable +# from the root by following a path via at most 3 edges will be shown. Nodes +# that lay further from the root node will be omitted. Note that setting this +# option to 1 or 2 may greatly reduce the computation time needed for large +# code bases. Also note that the size of a graph can be further restricted by +# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. + +MAX_DOT_GRAPH_DEPTH = 0 + +# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent +# background. This is disabled by default, because dot on Windows does not +# seem to support this out of the box. Warning: Depending on the platform used, +# enabling this option may lead to badly anti-aliased labels on the edges of +# a graph (i.e. they become hard to read). + +DOT_TRANSPARENT = NO + +# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output +# files in one run (i.e. multiple -o and -T options on the command line). This +# makes dot run faster, but since only newer versions of dot (>1.8.10) +# support this, this feature is disabled by default. + +DOT_MULTI_TARGETS = NO + +# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will +# generate a legend page explaining the meaning of the various boxes and +# arrows in the dot generated graphs. + +GENERATE_LEGEND = YES + +# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will +# remove the intermediate dot files that are used to generate +# the various graphs. + +DOT_CLEANUP = YES + +#--------------------------------------------------------------------------- +# Options related to the search engine +#--------------------------------------------------------------------------- + +# The SEARCHENGINE tag specifies whether or not a search engine should be +# used. If set to NO the values of all tags below this one will be ignored. + +SEARCHENGINE = NO diff --git a/README b/README index 6c69f0a..9a83126 100644 --- a/README +++ b/README @@ -53,7 +53,7 @@ a) Notes regarding the code The code is a complete rewrite, containing none of the original code. I've made some effort to put the more generic or reusable code into a separate -library called Moof. I've also made an effort to incorporate 3rd-party +library called libmoof. I've also made an effort to incorporate 3rd-party code that happened to fit well into what I needed. So, generally, the source code is separated into these three categories: @@ -63,8 +63,8 @@ This is the code directly in src/. These classes reside in no namespace. 2. Reusable code. -Currently, the code is in src/Moof/, and it is compiled as a convenience -library. These classes and helper functions reside in the Mf namespace. +Currently, the code is in src/moof/, and it is compiled as a convenience +library. These classes and helper functions reside in the moof namespace. Since I wrote this code alongside the Yoink-specific stuff, there is somewhat of a blurry line between the two categories, unfortunately. diff --git a/configure.ac b/configure.ac index 6820114..d45b756 100644 --- a/configure.ac +++ b/configure.ac @@ -345,7 +345,7 @@ AC_MSG_NOTICE([Checks for library functions.]) AC_FUNC_ERROR_AT_LINE AC_FUNC_STRTOD -AC_CHECK_FUNCS([fcntl ioctl nanosleep strchr strcspn strrchr strstr]) +AC_CHECK_FUNCS([fcntl nanosleep strchr strcspn strrchr strstr]) if test x$clock_gettime = xyes then diff --git a/src/Animation.cc b/src/Animation.cc index bd31f9b..ba34bc5 100644 --- a/src/Animation.cc +++ b/src/Animation.cc @@ -10,26 +10,26 @@ **************************************************************************/ #include +#include #include -#include -#include -#include -#include +#include +#include +#include #include "Animation.hh" /** * The collection of nested animation classes. The animation - * implementation consists of an Impl class which is allocated and + * implementation consists of an impl class which is allocated and * initialized with the interface object. This class contains the specific * fields which are required to run a single instance of an animation. The * sequence data is loaded in a different class which can be shared amongst * multiple animation implementation instances. */ -class Animation::Impl +class Animation::impl { public: @@ -39,7 +39,7 @@ public: * animation which wants to use these loaded sequences. */ - class Data : public Mf::Manager + class Data : public moof::manager { public: @@ -55,7 +55,7 @@ public: public: unsigned mIndex; ///< Frame index. - Mf::Scalar mDuration; ///< Frame duration. + moof::scalar mDuration; ///< Frame duration. /** * Construction is initialization. The frame data is loaded @@ -63,7 +63,7 @@ public: * animation file. */ - Frame(const Mf::Script::Slot& table) : + Frame(const moof::script::slot& table) : mIndex(0), mDuration(1.0) { @@ -83,7 +83,7 @@ public: public: std::vector mFrames; ///< List of frames. - Mf::Scalar mDelay; ///< Scale frame durations. + moof::scalar mDelay; ///< Scale frame durations. bool mLoop; ///< Does the sequence repeat? std::string mNext; ///< Next sequence name. @@ -94,7 +94,7 @@ public: * the frame's constructor which loads each individual frame. */ - Sequence(const Mf::Script::Slot& table) : + Sequence(const moof::script::slot& table) : mDelay(0.0), mLoop(true) { @@ -104,21 +104,21 @@ public: // TODO - sequence class/type not yet implemented - Mf::Script::Slot frameTable = table.pushField("frames"); - if (frameTable.isTable()) + moof::script::slot frameTable = table.push_field("frames"); + if (frameTable.is_table()) { int max = frameTable.length(); for (int index = 1; index <= max; ++index) { - Mf::Script::Slot top = frameTable.pushField(index); + moof::script::slot top = frameTable.push_field(index); - if (top.isTable()) + if (top.is_table()) { mFrames.push_back(Frame(top)); } else { - Mf::logWarning << "invalid frame at index " + moof::log_warning << "invalid frame at index " << index << std::endl; } } @@ -136,30 +136,30 @@ public: void init(const std::string& name) { - Mf::Script script; + moof::script script; std::string path(name); - if (!Animation::getPath(path)) + if (!Animation::find_path(path)) { - Mf::Error(Mf::Error::RESOURCE_NOT_FOUND).raise(); + throw std::runtime_error("cannot find resource " + name); } - script.importBaseLibrary(); - importLogFunctions(script); + script.import_base_library(); + moof::log::import(script); importAnimationBindings(script); - if (script.doFile(path) != Mf::Script::SUCCESS) + if (script.do_file(path) != moof::script::success) { std::string str; script[-1].get(str); - Mf::logWarning(str); + moof::log_warning(str); } } - int defineSequence(Mf::Script& script) + int defineSequence(moof::script& script) { - Mf::Script::Slot name = script[1].requireString(); - Mf::Script::Slot table = script[2].requireTable(); + moof::script::slot name = script[1].require_string(); + moof::script::slot table = script[2].require_table(); std::string nameStr; name.get(nameStr); @@ -170,19 +170,19 @@ public: } - void importAnimationBindings(Mf::Script& script) + void importAnimationBindings(moof::script& script) { - script.importFunction("DefineSequence", + script.import_function("DefineSequence", boost::bind(&Data::defineSequence, this, _1)); - script.globals().setField("ATTACK", 1); - script.globals().setField("CHARGE", 2); - script.globals().setField("FLY", 3); - script.globals().setField("HIT", 4); - script.globals().setField("JUMP", 5); - script.globals().setField("RUN", 6); - script.globals().setField("STAND", 7); + script.globals().set_field("ATTACK", 1); + script.globals().set_field("CHARGE", 2); + script.globals().set_field("FLY", 3); + script.globals().set_field("HIT", 4); + script.globals().set_field("JUMP", 5); + script.globals().set_field("RUN", 6); + script.globals().set_field("STAND", 7); } @@ -194,8 +194,8 @@ public: * Construction is intialization. */ - Impl(const std::string& name) : - mData(Data::getInstance(name)), + impl(const std::string& name) : + mData(Data::instance(name)), mCurrentSequence(0), mFrameCounter(0), mFrameIndex(0), @@ -236,7 +236,7 @@ public: * the animation essentially starts over again. */ - void update(Mf::Scalar t, Mf::Scalar dt) + void update(moof::scalar t, moof::scalar dt) { if (!mCurrentSequence) return; @@ -273,26 +273,26 @@ public: Data::Sequence* mCurrentSequence; ///< Active sequence. unsigned mFrameCounter; ///< Current frame. unsigned mFrameIndex; ///< Index of current frame. - Mf::Scalar mTimeAccum; ///< Time accumulation. - Mf::Scalar mFrameDuration; ///< Scaled frame duration. + moof::scalar mTimeAccum; ///< Time accumulation. + moof::scalar mFrameDuration; ///< Scaled frame duration. }; Animation::Animation(const std::string& name) : // pass through - mImpl(new Animation::Impl(name)) {} + impl_(new Animation::impl(name)) {} void Animation::startSequence(const std::string& name) { // pass through - mImpl->startSequence(name); + impl_->startSequence(name); } -void Animation::update(Mf::Scalar t, Mf::Scalar dt) +void Animation::update(moof::scalar t, moof::scalar dt) { // pass through - mImpl->update(t, dt); + impl_->update(t, dt); } @@ -303,7 +303,7 @@ void Animation::update(Mf::Scalar t, Mf::Scalar dt) unsigned Animation::getFrame() const { - return mImpl->mFrameIndex; + return impl_->mFrameIndex; } @@ -312,8 +312,8 @@ unsigned Animation::getFrame() const * the "animations" subdirectory of any of the search directories. */ -bool Animation::getPath(std::string& name) +bool Animation::find_path(std::string& name) { - return Mf::Resource::getPath(name, "animations/", "lua"); + return moof::resource::find_path(name, "animations/", "lua"); } diff --git a/src/Animation.hh b/src/Animation.hh index d8651dd..ba38601 100644 --- a/src/Animation.hh +++ b/src/Animation.hh @@ -21,8 +21,8 @@ #include -#include -#include +#include +#include class Animation; @@ -36,10 +36,10 @@ typedef boost::shared_ptr AnimationP; * about anything to whatever drawing context is used to render the frame. */ -class Animation : public Mf::Resource +class Animation : public moof::resource { - class Impl; - boost::shared_ptr mImpl; + class impl; + boost::shared_ptr impl_; public: @@ -53,10 +53,10 @@ public: void startSequence(const std::string& name); - void update(Mf::Scalar t, Mf::Scalar dt); + void update(moof::scalar t, moof::scalar dt); unsigned getFrame() const; - static bool getPath(std::string& name); + static bool find_path(std::string& name); }; diff --git a/src/Character.cc b/src/Character.cc index 82d5e54..a857cbe 100644 --- a/src/Character.cc +++ b/src/Character.cc @@ -11,25 +11,26 @@ #include +#include + #include "Character.hh" -#include "Log.hh" class SpringForce { public: - explicit SpringForce(Mf::Vector2 x) : + explicit SpringForce(moof::vector2 x) : location(x) {} - const Mf::Vector2& operator () (const Mf::LinearState<2>& state) + const moof::vector2& operator () (const moof::linear_state<2>& state) { - Mf::Vector2 x = state.position - location; - Mf::Scalar mag = x.length(); - Mf::Scalar d = 0.0; + moof::vector2 x = state.position - location; + moof::scalar mag = x.length(); + moof::scalar d = 0.0; // spring: - //mState.force += -15.0 * x - 1.5 * mState.velocity; + //state_.force += -15.0 * x - 1.5 * state_.velocity; force = SCALAR(-10.0) * (mag - d) * (x / mag);// - SCALAR(2.0) * state.velocity; return force; @@ -37,18 +38,18 @@ public: private: - Mf::Vector2 force; - Mf::Vector2 location; + moof::vector2 force; + moof::vector2 location; }; class ResistanceForce { public: - explicit ResistanceForce(Mf::Scalar scale = 1.0) : + explicit ResistanceForce(moof::scalar scale = 1.0) : k(scale) {} - const Mf::Vector2& operator () (const Mf::LinearState<2>& state) + const moof::vector2& operator () (const moof::linear_state<2>& state) { force = -k * state.velocity; return force; @@ -56,8 +57,8 @@ public: private: - Mf::Vector2 force; - Mf::Scalar k; + moof::vector2 force; + moof::scalar k; }; @@ -65,58 +66,58 @@ Character::Character(const std::string& name) : tilemap(name), animation(name) { - mState.init(); + state_.init(); - mState.mass = 1.0; - mState.inverseMass = 1.0 / mState.mass; + state_.mass = 1.0; + state_.inverse_mass = 1.0 / state_.mass; // forces - mState.force = Mf::Vector2(0.0, 0.0); - //mState.forces.push_back(SpringForce(Mf::Vector2(5.0, 4.0))); - mState.forces.push_back(ResistanceForce(2.0)); - //mState.forces.push_back(Mf::LinearState<2>::GravityForce(-9.8)); + state_.force = moof::vector2(0.0, 0.0); + //state_.forces.push_back(SpringForce(moof::vector2(5.0, 4.0))); + state_.forces.push_back(ResistanceForce(2.0)); + //state_.forces.push_back(moof::linear_state<2>::gravity_force(-9.8)); // starting position - mState.position = Mf::Vector2(5.0, 5.0); - mState.momentum = Mf::Vector2(0.0, 0.0); - mState.recalculate(); + state_.position = moof::vector2(5.0, 5.0); + state_.momentum = moof::vector2(0.0, 0.0); + state_.recalculate(); - mPrevState = mState; + prev_state_ = state_; } -void Character::update(Mf::Scalar t, Mf::Scalar dt) +void Character::update(moof::scalar t, moof::scalar dt) { - Mf::RigidBody2::update(t, dt); // update physics + moof::rigid_body2::update(t, dt); // update physics animation.update(t, dt); - Mf::Vector3 center(mState.position[0], mState.position[1], 0.0); - Mf::Vector3 a(mState.position[0] - 0.5, mState.position[1] - 0.5, 0.0); - Mf::Vector3 b(mState.position[0] + 0.5, mState.position[1] + 0.5, 0.0); + moof::vector3 center(state_.position[0], state_.position[1], 0.0); + moof::vector3 a(state_.position[0] - 0.5, state_.position[1] - 0.5, 0.0); + moof::vector3 b(state_.position[0] + 0.5, state_.position[1] + 0.5, 0.0); - mAabb.init(a, b); - mSphere.init(center, a); + aabb_.init(a, b); + sphere_.init(center, a); } -void Character::draw(Mf::Scalar alpha) const +void Character::draw(moof::scalar alpha) const { - Mf::State2 state = getState(alpha); - Mf::Vector2 position = state.position; + moof::state2 state = moof::rigid_body2::state(alpha); + moof::vector2 position = state.position; //glColor3f(1.0f, 1.0f, 1.0f); tilemap.bind(); - Mf::Texture::TileIndex frame = animation.getFrame(); - Mf::Texture::Orientation orientation = Mf::Texture::NORMAL; + int frame = animation.getFrame(); + moof::texture::orientation orientation = moof::texture::normal; - if (mState.velocity[0] < 0.0) orientation = Mf::Texture::REVERSE; + if (state_.velocity[0] < 0.0) orientation = moof::texture::reverse; - Mf::Scalar coords[8]; - tilemap.getTileCoords(frame, coords, orientation); + moof::scalar coords[8]; + tilemap.tile_coordinates(frame, coords, orientation); - Mf::Scalar s = 0.5; + moof::scalar s = 0.5; glBegin(GL_TRIANGLE_FAN); glTexCoord(coords[0], coords[1]); @@ -131,106 +132,106 @@ void Character::draw(Mf::Scalar alpha) const } -/*int Character::getOctant(const Mf::Aabb<3>& aabb) const +/*int Character::getOctant(const moof::Aabb<3>& aabb) const { int octantNum = -1; - Mf::Plane::Halfspace halfspace; + moof::plane::halfspace halfspace; - Mf::Plane xy = aabb.getPlaneXY(); - halfspace = xy.intersects(mSphere); - if (halfspace == Mf::Plane::INTERSECT) + moof::plane xy = aabb.xy_plane(); + halfspace = xy.intersects(sphere_); + if (halfspace == moof::plane::intersecting) { - halfspace = xy.intersects(mAabb); + halfspace = xy.intersects(aabb_); } - if (halfspace == Mf::Plane::POSITIVE) + if (halfspace == moof::plane::positive) { - Mf::Plane xz = aabb.getPlaneXZ(); - halfspace = xz.intersects(mSphere); - if (halfspace == Mf::Plane::INTERSECT) + moof::plane xz = aabb.xz_plane(); + halfspace = xz.intersects(sphere_); + if (halfspace == moof::plane::intersecting) { - halfspace = xz.intersects(mAabb); + halfspace = xz.intersects(aabb_); } - if (halfspace == Mf::Plane::POSITIVE) + if (halfspace == moof::plane::positive) { - Mf::Plane yz = aabb.getPlaneYZ(); - halfspace = yz.intersects(mSphere); - if (halfspace == Mf::Plane::INTERSECT) + moof::plane yz = aabb.yz_plane(); + halfspace = yz.intersects(sphere_); + if (halfspace == moof::plane::intersecting) { - halfspace = yz.intersects(mAabb); + halfspace = yz.intersects(aabb_); } - if (halfspace == Mf::Plane::POSITIVE) + if (halfspace == moof::plane::positive) { octantNum = 2; } - else if (halfspace == Mf::Plane::NEGATIVE) + else if (halfspace == moof::plane::negative) { octantNum = 3; } } - else if (halfspace == Mf::Plane::NEGATIVE) + else if (halfspace == moof::plane::negative) { - Mf::Plane yz = aabb.getPlaneYZ(); - halfspace = yz.intersects(mSphere); - if (halfspace == Mf::Plane::INTERSECT) + moof::plane yz = aabb.yz_plane(); + halfspace = yz.intersects(sphere_); + if (halfspace == moof::plane::intersecting) { - halfspace = yz.intersects(mAabb); + halfspace = yz.intersects(aabb_); } - if (halfspace == Mf::Plane::POSITIVE) + if (halfspace == moof::plane::positive) { octantNum = 1; } - else if (halfspace == Mf::Plane::NEGATIVE) + else if (halfspace == moof::plane::negative) { octantNum = 0; } } } - else if (halfspace == Mf::Plane::NEGATIVE) + else if (halfspace == moof::plane::negative) { - Mf::Plane xz = aabb.getPlaneXZ(); - halfspace = xz.intersects(mSphere); - if (halfspace == Mf::Plane::INTERSECT) + moof::plane xz = aabb.xz_plane(); + halfspace = xz.intersects(sphere_); + if (halfspace == moof::plane::intersecting) { - halfspace = xz.intersects(mAabb); + halfspace = xz.intersects(aabb_); } - if (halfspace == Mf::Plane::POSITIVE) + if (halfspace == moof::plane::positive) { - Mf::Plane yz = aabb.getPlaneYZ(); - halfspace = yz.intersects(mSphere); - if (halfspace == Mf::Plane::INTERSECT) + moof::plane yz = aabb.yz_plane(); + halfspace = yz.intersects(sphere_); + if (halfspace == moof::plane::intersecting) { - halfspace = yz.intersects(mAabb); + halfspace = yz.intersects(aabb_); } - if (halfspace == Mf::Plane::POSITIVE) + if (halfspace == moof::plane::positive) { octantNum = 6; } - else if (halfspace == Mf::Plane::NEGATIVE) + else if (halfspace == moof::plane::negative) { octantNum = 7; } } - else if (halfspace == Mf::Plane::NEGATIVE) + else if (halfspace == moof::plane::negative) { - Mf::Plane yz = aabb.getPlaneYZ(); - halfspace = yz.intersects(mSphere); - if (halfspace == Mf::Plane::INTERSECT) + moof::plane yz = aabb.yz_plane(); + halfspace = yz.intersects(sphere_); + if (halfspace == moof::plane::intersecting) { - halfspace = yz.intersects(mAabb); + halfspace = yz.intersects(aabb_); } - if (halfspace == Mf::Plane::POSITIVE) + if (halfspace == moof::plane::positive) { octantNum = 5; } - else if (halfspace == Mf::Plane::NEGATIVE) + else if (halfspace == moof::plane::negative) { octantNum = 4; } @@ -242,18 +243,18 @@ void Character::draw(Mf::Scalar alpha) const */ -void Character::addImpulse(Mf::Vector2 impulse) +void Character::addImpulse(moof::vector2 impulse) { - mState.momentum += impulse; + state_.momentum += impulse; } -void Character::addForce(Mf::Vector2 force) +void Character::addForce(moof::vector2 force) { - mState.force += force; + state_.force += force; } -void Character::setPosition(Mf::Vector2 position) +void Character::setPosition(moof::vector2 position) { - mState.position = position; + state_.position = position; } diff --git a/src/Character.hh b/src/Character.hh index 4140d17..651cc88 100644 --- a/src/Character.hh +++ b/src/Character.hh @@ -16,12 +16,12 @@ #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include "Animation.hh" @@ -35,23 +35,23 @@ typedef boost::shared_ptr CharacterP; * includes the heroine herself and the bad guys. */ -class Character : public Mf::RigidBody2 +class Character : public moof::rigid_body2 { public: Character(const std::string& name); virtual ~Character() {} - virtual void update(Mf::Scalar t, Mf::Scalar dt); - virtual void draw(Mf::Scalar alpha) const; + virtual void update(moof::scalar t, moof::scalar dt); + virtual void draw(moof::scalar alpha) const; - void addImpulse(Mf::Vector2 impulse); - void addForce(Mf::Vector2 force); - void setPosition(Mf::Vector2 position); + void addImpulse(moof::vector2 impulse); + void addForce(moof::vector2 force); + void setPosition(moof::vector2 position); - //virtual int getOctant(const Mf::Aabb<3>& aabb) const; + //virtual int getOctant(const moof::Aabb<3>& aabb) const; - Mf::Texture tilemap; + moof::texture tilemap; Animation animation; }; diff --git a/src/ErrorHandler.cc b/src/ErrorHandler.cc deleted file mode 100644 index d027956..0000000 --- a/src/ErrorHandler.cc +++ /dev/null @@ -1,77 +0,0 @@ - -/*] Copyright (c) 2009-2010, Charles McGarvey [************************** -**] All rights reserved. -* -* vi:ts=4 sw=4 tw=75 -* -* Distributable under the terms and conditions of the 2-clause BSD license; -* see the file COPYING for a complete text of the license. -* -**************************************************************************/ - -#include - -#include "ErrorHandler.hh" - - -std::string getErrorString(const Mf::Error& error) -{ - std::string str; - - switch(error.code()) - { - case Mf::Error::ALC_INIT: - str += "An error occurred during OpenAL initialization: "; - str += error.what(); - return str; - - case Mf::Error::FASTEVENTS_INIT: - case Mf::Error::SDL_INIT: - str += "An error occurred during SDL initialization: "; - str += error.what(); - return str; - - case Mf::Error::FILE_NOT_FOUND: - str += "A required file ("; - str += error.what(); - str += ") could not be found."; - return str; - - case Mf::Error::OPENAL_INIT: - str += "The audio library returned an error: "; - str += error.what(); - return str; - - case Mf::Error::RESOURCE_NOT_FOUND: - str += "A required resource ("; - str += error.what(); - str += ") could not be found."; - return str; - - case Mf::Error::SCRIPT_ERROR: - str += "An error occurred in a script: "; - str == error.what(); - return str; - - case Mf::Error::SDL_VIDEOMODE: - str += "An error occurred while trying to set up the graphics."; - return str; - - case Mf::Error::UNKNOWN_AUDIO_FORMAT: - str += "An error occurred while trying to load an audio file, "; - str += error.what(); - str += "."; - return str; - - case Mf::Error::UNKNOWN_IMAGE_FORMAT: - str += "An error occurred while trying to load an image file, "; - str += error.what(); - str += "."; - return str; - } - - std::ostringstream stream; - stream << "An unknown error (code " << error.code() << ") occurred."; - return stream.str(); -} - diff --git a/src/ErrorHandler.hh b/src/ErrorHandler.hh deleted file mode 100644 index d1201e8..0000000 --- a/src/ErrorHandler.hh +++ /dev/null @@ -1,22 +0,0 @@ - -/*] Copyright (c) 2009-2010, Charles McGarvey [************************** -**] All rights reserved. -* -* vi:ts=4 sw=4 tw=75 -* -* Distributable under the terms and conditions of the 2-clause BSD license; -* see the file COPYING for a complete text of the license. -* -**************************************************************************/ - -#ifndef _ERRORHANDLER_HH_ -#define _ERRORHANDLER_HH_ - -#include - - -std::string getErrorString(const Mf::Error& error); - - -#endif // _ERRORHANDLER_HH_ - diff --git a/src/GameLayer.cc b/src/GameLayer.cc index d68522e..0498182 100644 --- a/src/GameLayer.cc +++ b/src/GameLayer.cc @@ -9,12 +9,13 @@ * **************************************************************************/ -#include -#include -#include -#include -#include -#include +#include + +#include +#include +#include +#include +#include #include "GameLayer.hh" @@ -25,58 +26,55 @@ void GameLayer::loadSceneLoader() { - mState.script.importStandardLibraries(); - importLogFunctions(mState.script); + state_.script.import_standard_libraries(); + moof::log::import(state_.script); std::string path("loader"); - if (!Scene::getPath(path)) + if (!Scene::find_path(path)) { - throw Mf::Error(Mf::Error::RESOURCE_NOT_FOUND, "loader"); + throw std::runtime_error("cannot find scene loader script"); } - Mf::Script::Result status = mState.script.doFile(path); - if (status != Mf::Script::SUCCESS) + moof::script::status status = state_.script.do_file(path); + if (status != moof::script::success) { std::string str; - mState.script[-1].get(str); - - throw Mf::Error(Mf::Error::SCRIPT_ERROR, str); + state_.script[-1].get(str); + throw std::runtime_error("script error: " + str); } - mState.script.globals().pushField("scenes"); - mState.script.top().get(mState.sceneList); - if (mState.sceneList.size() == 0) + state_.script.globals().push_field("scenes"); + state_.script.top().get(state_.sceneList); + if (state_.sceneList.size() == 0) { - throw Mf::Error(Mf::Error::SCRIPT_ERROR, - "no variable `scenes' within loader"); + throw std::runtime_error("no variable `scenes' in script loader."); } } -void GameLayer::advanceScene(Mf::Settings& settings) +void GameLayer::advanceScene(moof::settings& settings) { - if (mState.sceneList.size() != 0) + if (state_.sceneList.size() != 0) { - mState.scene = Scene::alloc(mState.sceneList[0]); - mState.sceneList.erase(mState.sceneList.begin()); + state_.scene = Scene::alloc(state_.sceneList[0]); + state_.sceneList.erase(state_.sceneList.begin()); - Mf::Script::Result status = mState.scene->load(settings, - mState.script); - if (status != Mf::Script::SUCCESS) + moof::script::status status = state_.scene->load(settings, + state_.script); + if (status != moof::script::success) { std::string str; - mState.script[-1].get(str); - - throw Mf::Error(Mf::Error::SCRIPT_ERROR, str); + state_.script[-1].get(str); + throw std::runtime_error("script error: " + str); } - Mf::Script::Slot table = mState.script.globals().pushField("Event"); - if (table.isTable()) + moof::script::slot table = state_.script.globals().push_field("Event"); + if (table.is_table()) { - mState.script.push("Think"); - table.pushField("Think"); - mState.script.registry().setField(); + state_.script.push("Think"); + table.push_field("Think"); + state_.script.registry().set_field(); } - mState.script.pop(); + state_.script.pop(); } } @@ -85,23 +83,22 @@ GameLayer::GameLayer() : mMusic("NightFusionIntro"), mPunchSound("Thump") { - mMusic.setLooping(true); + mMusic.loop(true); mMusic.enqueue("NightFusionLoop"); - //mMusic.setPosition(Mf::Vector3(10.0, 5.0, 0.0)); + //mMusic.setPosition(moof::vector3(10.0, 5.0, 0.0)); mThinkTimer.init(boost::bind(&GameLayer::thinkTimer, this), - 0.1, Mf::Timer::REPEAT); + 0.1, moof::timer::repeat); - mState.heroine = Heroine::alloc(); - mState.heroine->animation.startSequence("FlyDiagonallyUp"); + state_.heroine = Heroine::alloc(); + state_.heroine->animation.startSequence("FlyDiagonallyUp"); - mState.interp.init(0.0, 1.0); - mState.interp.reset(4.0, Mf::Interp::OSCILLATE); + state_.interp.init(0.0, 1.0, 4.0, moof::lerp_scalar::oscillate); } -void GameLayer::didAddToView() +void GameLayer::did_add_to_view() { bool isMute = false; settings().get("nomusic", isMute); @@ -110,8 +107,8 @@ void GameLayer::didAddToView() loadSceneLoader(); advanceScene(settings()); // load the first scene - mHud = Hud::alloc(mState); - addChild(mHud); + mHud = Hud::alloc(state_); + add_child(mHud); mRay.direction.set(1.0, 0.0); @@ -122,103 +119,103 @@ void GameLayer::didAddToView() mCircle.radius = 2; mRayTimer.init(boost::bind(&GameLayer::rayTimer, this), - 1.0, Mf::Timer::REPEAT); + 1.0, moof::timer::repeat); - setProjection(); + projection(); } -void GameLayer::update(Mf::Scalar t, Mf::Scalar dt) +void GameLayer::update(moof::scalar t, moof::scalar dt) { - if (!mState.scene) return; - mState.camera.update(t, dt); - mState.heroine->update(t, dt); + if (!state_.scene) return; + state_.camera.update(t, dt); + state_.heroine->update(t, dt); - mState.scene->checkForCollision(*mState.heroine); + state_.scene->checkForCollision(*state_.heroine); - Mf::Vector3 cam= -Mf::promote(mState.heroine->getState().position, 8); - mState.camera.setPosition(cam); + moof::vector3 cam= -moof::promote(state_.heroine->state().position, 8); + state_.camera.position(cam); - mRay.point = mState.heroine->getState().position; + mRay.point = state_.heroine->state().position; - Mf::View::update(t, dt); + moof::view::update(t, dt); } void GameLayer::thinkTimer() { - mState.script.registry().pushField("Think"); - if (mState.script[-1].isFunction()) mState.script.call(); - else mState.script.pop(); + state_.script.registry().push_field("Think"); + if (state_.script[-1].is_function()) state_.script.call(); + else state_.script.pop(); } void GameLayer::rayTimer() { - Mf::Ray2::Contact meh; - std::list hits; - Mf::Vector2 point; + moof::ray2::contact meh; + std::list hits; + moof::vector2 point; - bool bam = mLine.intersectRay(mRay, meh); + bool bam = mLine.intersect_ray(mRay, meh); if (bam) { //meh.normal.normalize(); //hits.push_back(meh); mRay.solve(point, meh.distance); - Mf::logInfo << "line: d = " << meh.distance << std::endl; - Mf::logInfo << " P = " << point << std::endl; - Mf::logInfo << " n = " << meh.normal << std::endl; + moof::log_info << "line: d = " << meh.distance << std::endl; + moof::log_info << " P = " << point << std::endl; + moof::log_info << " n = " << meh.normal << std::endl; } - bam = mCircle.intersectRay(mRay, meh); + bam = mCircle.intersect_ray(mRay, meh); if (bam) { meh.normal.normalize(); hits.push_back(meh); } - if (mState.scene->castRay(mRay, hits)) + if (state_.scene->castRay(mRay, hits)) { hits.front().normal.normalize(); mRay.solve(point, hits.front().distance); - Mf::logInfo << "scene: d = " << hits.front().distance << std::endl; - Mf::logInfo << " P = " << point << std::endl; - Mf::logInfo << " n = " << hits.front().normal << std::endl; + moof::log_info << "scene: d = " << hits.front().distance << std::endl; + moof::log_info << " P = " << point << std::endl; + moof::log_info << " n = " << hits.front().normal << std::endl; } } -void GameLayer::draw(Mf::Scalar alpha) const +void GameLayer::draw(moof::scalar alpha) const { - if (!mState.scene) return; - mState.camera.uploadToGL(alpha); + if (!state_.scene) return; + state_.camera.upload_to_gl(alpha); // DRAW THE SCENE - Mf::Texture::resetBind(); + moof::texture::reset_binding(); glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_TEXTURE_COORD_ARRAY); - mState.scene->drawIfVisible(alpha, mState.camera.getFrustum()); - mState.heroine->draw(alpha); + state_.scene->draw_if_visible(alpha, state_.camera.frustum()); + state_.heroine->draw(alpha); mRay.draw(); mLine.draw(); mCircle.draw(); - Mf::View::draw(alpha); + moof::view::draw(alpha); } -bool GameLayer::handleEvent(const Mf::Event& event) +bool GameLayer::handle_event(const moof::event& event) { - if (Mf::View::handleEvent(event)) return true; + if (moof::view::handle_event(event)) return true; switch (event.type) { case SDL_KEYDOWN: if (event.key.keysym.sym == SDLK_SPACE) { - mState.heroine->animation.startSequence("Flattened"); - Mf::logInfo("thump!"); + state_.heroine->animation.startSequence("Flattened"); + moof::log_info("thump!"); mPunchSound.play(); return true; } @@ -229,14 +226,14 @@ bool GameLayer::handleEvent(const Mf::Event& event) } else if (event.key.keysym.sym == SDLK_PAGEUP) { - mRay.direction = cml::rotate_vector_2D(mRay.direction, - cml::rad(10.0)); + mRay.direction = moof::rotate_vector_2D(mRay.direction, + moof::rad(10.0)); return true; } else if (event.key.keysym.sym == SDLK_PAGEDOWN) { - mRay.direction = cml::rotate_vector_2D(mRay.direction, - cml::rad(-10.0)); + mRay.direction = moof::rotate_vector_2D(mRay.direction, + moof::rad(-10.0)); return true; } else if (event.key.keysym.sym == SDLK_r) @@ -245,28 +242,28 @@ bool GameLayer::handleEvent(const Mf::Event& event) advanceScene(settings()); return true; } - return mState.heroine->handleEvent(event); + return state_.heroine->handle_event(event); case SDL_KEYUP: if (event.key.keysym.sym == SDLK_ESCAPE) { - parent().removeChild(this); + parent().remove_child(this); return true; } else if (event.key.keysym.sym == SDLK_h) { - addChild(mHud); + add_child(mHud); return true; } - return mState.heroine->handleEvent(event); + return state_.heroine->handle_event(event); case SDL_MOUSEMOTION: case SDL_MOUSEBUTTONDOWN: - mState.camera.handleEvent(event); + state_.camera.handle_event(event); return true; case SDL_VIDEORESIZE: - setProjection(event.resize.w, event.resize.h); + projection(event.resize.w, event.resize.h); break; } @@ -274,15 +271,15 @@ bool GameLayer::handleEvent(const Mf::Event& event) } -void GameLayer::setProjection() +void GameLayer::projection() { - setProjection(video().getWidth(), video().getHeight()); + projection(video().width(), video().height()); } -void GameLayer::setProjection(Mf::Scalar width, Mf::Scalar height) +void GameLayer::projection(moof::scalar width, moof::scalar height) { - mState.camera.setProjection(cml::rad(45.0), - width / height, - SCALAR(1.0), SCALAR(200.0)); + state_.camera.projection(moof::rad(45.0), + width / height, + SCALAR(1.0), SCALAR(200.0)); } diff --git a/src/GameLayer.hh b/src/GameLayer.hh index 145cf76..c194e9f 100644 --- a/src/GameLayer.hh +++ b/src/GameLayer.hh @@ -23,15 +23,15 @@ #include -#include -#include +#include +#include -#include // TODO -#include -#include -#include -#include -#include +#include // TODO +#include +#include +#include +#include +#include #include "GameState.hh" #include "Hud.hh" @@ -40,7 +40,7 @@ class GameLayer; typedef boost::shared_ptr GameLayerP; -class GameLayer : public Mf::View +class GameLayer : public moof::view { public: @@ -50,35 +50,35 @@ public: } GameLayer(); - void didAddToView(); + void did_add_to_view(); - void update(Mf::Scalar t, Mf::Scalar dt); - void draw(Mf::Scalar alpha) const; - bool handleEvent(const Mf::Event& event); + void update(moof::scalar t, moof::scalar dt); + void draw(moof::scalar alpha) const; + bool handle_event(const moof::event& event); private: void loadSceneLoader(); - void advanceScene(Mf::Settings& settings); + void advanceScene(moof::settings& settings); void thinkTimer(); - void setProjection(); - void setProjection(Mf::Scalar width, Mf::Scalar height); + void projection(); + void projection(moof::scalar width, moof::scalar height); - GameState mState; - Mf::Timer mThinkTimer; + GameState state_; + moof::timer mThinkTimer; HudP mHud; - Mf::SoundStream mMusic; - Mf::Sound mPunchSound; + moof::sound_stream mMusic; + moof::sound mPunchSound; - Mf::Ray2 mRay; - Mf::Line2 mLine; - Mf::Circle mCircle; + moof::ray2 mRay; + moof::line2 mLine; + moof::circle mCircle; - Mf::Timer mRayTimer; + moof::timer mRayTimer; void rayTimer(); }; diff --git a/src/GameState.hh b/src/GameState.hh index 9583ff2..66b7a7d 100644 --- a/src/GameState.hh +++ b/src/GameState.hh @@ -13,7 +13,7 @@ #define _GAMESTATE_HH_ /** - * @file GameState.hh + * \file GameState.hh * The data. */ @@ -22,9 +22,9 @@ #include -#include -#include -#include +#include +#include +#include #include "Character.hh" #include "Heroine.hh" @@ -33,15 +33,15 @@ struct GameState { - Mf::Script script; + moof::script script; std::vector sceneList; HeroineP heroine; SceneP scene; - Mf::Lerp interp; + moof::lerp_scalar interp; - Mf::Camera camera; + moof::camera camera; }; diff --git a/src/Heroine.cc b/src/Heroine.cc index c1c9f07..a206918 100644 --- a/src/Heroine.cc +++ b/src/Heroine.cc @@ -9,79 +9,78 @@ * **************************************************************************/ -#include +#include +#include #include "Heroine.hh" -#include "Log.hh" - Heroine::Heroine() : Character("Heroine") {} -void Heroine::update(Mf::Scalar t, Mf::Scalar dt) +void Heroine::update(moof::scalar t, moof::scalar dt) { Character::update(t, dt); - Mf::Vector3 at(0.0, 0.0, 0.0); - const Mf::Vector3 up(0.0, 1.0, 0.0); + moof::vector3 at(0.0, 0.0, 0.0); + const moof::vector3 up(0.0, 1.0, 0.0); - if (mState.velocity[0] < 0.0) at[0] = -1.0; + if (state_.velocity[0] < 0.0) at[0] = -1.0; else at[0] = 1.0; - Mf::Sound::setListenerPosition(Mf::promote(mState.position)); - Mf::Sound::setListenerVelocity(Mf::promote(mState.velocity)); - Mf::Sound::setListenerOrientation(at, up); + moof::sound::listener_position(moof::promote(state_.position)); + moof::sound::listener_velocity(moof::promote(state_.velocity)); + moof::sound::listener_orientation(at, up); } -bool Heroine::handleEvent(const Mf::Event& event) +bool Heroine::handle_event(const moof::event& event) { - Mf::Scalar force = 40.0; + moof::scalar force = 40.0; switch (event.type) { case SDL_KEYDOWN: if (event.key.keysym.sym == SDLK_a) { - mState.force += Mf::Vector2(-force, 0.0); + state_.force += moof::vector2(-force, 0.0); return true; } else if (event.key.keysym.sym == SDLK_d) { - mState.force += Mf::Vector2(force, 0.0); + state_.force += moof::vector2(force, 0.0); return true; } else if (event.key.keysym.sym == SDLK_s) { - mState.force += Mf::Vector2(0.0, -force); + state_.force += moof::vector2(0.0, -force); return true; } else if (event.key.keysym.sym == SDLK_w) { - mState.force += Mf::Vector2(0.0, force); + state_.force += moof::vector2(0.0, force); return true; } case SDL_KEYUP: if (event.key.keysym.sym == SDLK_a) { - mState.force += Mf::Vector2(force, 0.0); + state_.force += moof::vector2(force, 0.0); return true; } else if (event.key.keysym.sym == SDLK_d) { - mState.force += Mf::Vector2(-force, 0.0); + state_.force += moof::vector2(-force, 0.0); return true; } else if (event.key.keysym.sym == SDLK_s) { - mState.force += Mf::Vector2(0.0, force); + state_.force += moof::vector2(0.0, force); return true; } else if (event.key.keysym.sym == SDLK_w) { - mState.force += Mf::Vector2(0.0, -force); + state_.force += moof::vector2(0.0, -force); return true; } } diff --git a/src/Heroine.hh b/src/Heroine.hh index 8ed8f66..6eb5a54 100644 --- a/src/Heroine.hh +++ b/src/Heroine.hh @@ -14,7 +14,7 @@ #include -#include +#include #include "Character.hh" @@ -38,8 +38,8 @@ public: return HeroineP(new Heroine); } - void update(Mf::Scalar t, Mf::Scalar dt); - bool handleEvent(const Mf::Event& event); + void update(moof::scalar t, moof::scalar dt); + bool handle_event(const moof::event& event); }; diff --git a/src/Hud.cc b/src/Hud.cc index 28b7c34..d5ed412 100644 --- a/src/Hud.cc +++ b/src/Hud.cc @@ -9,50 +9,49 @@ * **************************************************************************/ -#include -#include -#include -#include +#include +#include +#include +#include #include "Hud.hh" -ProgressBar::ProgressBar(const Mf::Texture& tilemap, - Mf::Texture::TileIndex index) : +ProgressBar::ProgressBar(const moof::texture& tilemap, int index) : mProgress(0.0), mTilemap(tilemap) { - tilemap.getTileCoords(index, mTexCoords); + tilemap.tile_coordinates(index, mTexCoords); - Mf::Scalar half = (mTexCoords[2] - mTexCoords[0]) / 2.0 + mTexCoords[0]; + moof::scalar half = (mTexCoords[2] - mTexCoords[0]) / 2.0 + mTexCoords[0]; mMidCoords[0] = half - 0.01; mMidCoords[1] = half + 0.01; } -void ProgressBar::resize(const Mf::Rectangle& rect) +void ProgressBar::resize(const moof::rectangle& rect) { - Mf::logInfo << "rect: " << rect.min << ", " << rect.max << std::endl; - Mf::Scalar height = rect.max[1] - rect.min[1]; - Mf::Scalar halfHeight = height / 2.0; + moof::log_info << "rect: " << rect.min << ", " << rect.max << std::endl; + moof::scalar height = rect.max[1] - rect.min[1]; + moof::scalar halfHeight = height / 2.0; mWidth = rect.max[0] - rect.min[0] - height; ASSERT(mWidth > 0); mVertices[0] = rect.min; - mVertices[1] = Mf::Vector2(rect.min[0] + halfHeight, rect.min[1]); + mVertices[1] = moof::vector2(rect.min[0] + halfHeight, rect.min[1]); mVertices[2] = mVertices[1]; - mVertices[3] = Mf::Vector2(rect.min[0] + height, rect.min[1]); - mVertices[4] = Mf::Vector2(rect.min[0] + height, rect.max[1]); - mVertices[5] = Mf::Vector2(rect.min[0] + halfHeight, rect.max[1]); + mVertices[3] = moof::vector2(rect.min[0] + height, rect.min[1]); + mVertices[4] = moof::vector2(rect.min[0] + height, rect.max[1]); + mVertices[5] = moof::vector2(rect.min[0] + halfHeight, rect.max[1]); mVertices[6] = mVertices[5]; - mVertices[7] = Mf::Vector2(rect.min[0], rect.max[1]); + mVertices[7] = moof::vector2(rect.min[0], rect.max[1]); setProgress(mProgress); } -void ProgressBar::setProgress(Mf::Scalar progress) +void ProgressBar::setProgress(moof::scalar progress) { - Mf::Scalar halfHeight = (mVertices[7][1] - mVertices[0][1]) / 2.0; + moof::scalar halfHeight = (mVertices[7][1] - mVertices[0][1]) / 2.0; mVertices[2][0] = mVertices[1][0] + progress * mWidth; mVertices[3][0] = mVertices[1][0] + progress * mWidth + halfHeight; @@ -62,9 +61,9 @@ void ProgressBar::setProgress(Mf::Scalar progress) mProgress = progress; } -void ProgressBar::draw(Mf::Scalar alpha) const +void ProgressBar::draw(moof::scalar alpha) const { - if (Mf::isEqual(mProgress, 0.0)) + if (moof::is_equal(mProgress, 0.0)) { // don't draw anything if the progress is 0% return; @@ -105,41 +104,41 @@ void ProgressBar::draw(Mf::Scalar alpha) const Hud::Hud(GameState& state) : - mState(state), - mBar1(Mf::Texture("StatusBars"), 0), - mBar2(Mf::Texture("StatusBars"), 2), + state_(state), + mBar1(moof::texture("StatusBars"), 0), + mBar2(moof::texture("StatusBars"), 2), mFont("Font") { - Mf::Video* video = Mf::Video::current(); + moof::video* video = moof::video::current(); ASSERT(video && "a current video context should be set"); - resize(video->getWidth(), video->getHeight()); + resize(video->width(), video->height()); } void Hud::resize(int width, int height) { - cml::matrix_orthographic_RH(mProjection, - SCALAR(0.0), - Mf::Scalar(width), SCALAR(0.0), Mf::Scalar(height), - SCALAR(1.0), SCALAR(-1.0), cml::z_clip_neg_one); + moof::matrix_orthographic_RH(mProjection, SCALAR(0.0), + moof::scalar(width), SCALAR(0.0), + moof::scalar(height), + SCALAR(1.0), SCALAR(-1.0), moof::z_clip_neg_one); // position the two progress bars at the top-left of the screen - mBar1.resize(Mf::Rectangle(20, height - 51, 0.7 * width, height - 3)); - mBar2.resize(Mf::Rectangle(20, height - 28, 0.7 * width, height - 70)); + mBar1.resize(moof::rectangle(20, height - 51, 0.7 * width, height - 3)); + mBar2.resize(moof::rectangle(20, height - 28, 0.7 * width, height - 70)); setBar1Progress(0.05); setBar2Progress(0.0); } -void Hud::update(Mf::Scalar t, Mf::Scalar dt) +void Hud::update(moof::scalar t, moof::scalar dt) { - mState.interp.update(t, dt); - setBar1Progress(mState.interp.getState(dt)); - setBar2Progress(1.0 - mState.interp.getState(dt)); + state_.interp.update(t, dt); + setBar1Progress(state_.interp.state(dt)); + setBar2Progress(1.0 - state_.interp.state(dt)); } -void Hud::draw(Mf::Scalar alpha) const +void Hud::draw(moof::scalar alpha) const { glMatrixMode(GL_PROJECTION); glPushMatrix(); @@ -165,7 +164,7 @@ void Hud::draw(Mf::Scalar alpha) const glPopMatrix(); } -bool Hud::handleEvent(const Mf::Event& event) +bool Hud::handle_event(const moof::event& event) { switch (event.type) { @@ -173,9 +172,9 @@ bool Hud::handleEvent(const Mf::Event& event) if (event.key.keysym.sym == SDLK_h) { // don't want the hud anymore - parent().removeChild(this); + parent().remove_child(this); - Mf::logWarning("okay bye bye hud"); + moof::log_warning("okay bye bye hud"); return true; } break; diff --git a/src/Hud.hh b/src/Hud.hh index 0bc0a46..7cf2504 100644 --- a/src/Hud.hh +++ b/src/Hud.hh @@ -17,48 +17,48 @@ * Heads-up Display */ -#include -#include -//#include -#include -#include +#include +#include +//#include +#include +#include #include "GameState.hh" -class Rectangle; +class rectangle; // TODO this stuff is still just hacked up -class ProgressBar : public Mf::Drawable +class ProgressBar : public moof::drawable { public: - ProgressBar(const Mf::Texture& tilemap, Mf::Texture::TileIndex index); + ProgressBar(const moof::texture& tilemap, int index); - void resize(const Mf::Rectangle& rect); + void resize(const moof::rectangle& rect); - void setProgress(Mf::Scalar progress); + void setProgress(moof::scalar progress); - void draw(Mf::Scalar alpha = 0.0) const; + void draw(moof::scalar alpha = 0.0) const; private: - Mf::Scalar mProgress; + moof::scalar mProgress; - Mf::Vector2 mVertices[8]; - Mf::Scalar mWidth; + moof::vector2 mVertices[8]; + moof::scalar mWidth; - Mf::Texture mTilemap; - Mf::Scalar mTexCoords[8]; - Mf::Scalar mMidCoords[2]; + moof::texture mTilemap; + moof::scalar mTexCoords[8]; + moof::scalar mMidCoords[2]; }; class Hud; typedef boost::shared_ptr HudP; -class Hud : public Mf::View +class Hud : public moof::view { public: @@ -69,13 +69,13 @@ public: Hud(GameState& state); - void setBar1Progress(Mf::Scalar progress) + void setBar1Progress(moof::scalar progress) { // pass through mBar1.setProgress(progress); } - void setBar2Progress(Mf::Scalar progress) + void setBar2Progress(moof::scalar progress) { // pass through mBar2.setProgress(progress); @@ -85,21 +85,21 @@ public: void resize(int width, int height); - void update(Mf::Scalar t, Mf::Scalar dt); - void draw(Mf::Scalar alpha = 0.0) const; - bool handleEvent(const Mf::Event& event); + void update(moof::scalar t, moof::scalar dt); + void draw(moof::scalar alpha = 0.0) const; + bool handle_event(const moof::event& event); private: - GameState& mState; + GameState& state_; ProgressBar mBar1; ProgressBar mBar2; unsigned mNumber; - Mf::Texture mFont; + moof::texture mFont; - Mf::Matrix4 mProjection; + moof::matrix4 mProjection; }; diff --git a/src/Main.cc b/src/Main.cc index 051b22c..bb6b35b 100644 --- a/src/Main.cc +++ b/src/Main.cc @@ -10,19 +10,19 @@ **************************************************************************/ #include // atexit, getenv +#include #include #include #include #include // access -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include -#include "ErrorHandler.hh" #include "GameLayer.hh" #include "Main.hh" #include "TitleLayer.hh" @@ -33,30 +33,30 @@ #include "version.h" -Main::Main(Mf::Settings& settings, Mf::Video& video) : - Mf::View(settings, video) +Main::Main(moof::settings& settings, moof::video& video) : + moof::view(settings, video) { - Mf::Dispatch& dispatch = Mf::Dispatch::global(); - mNewContextDispatch = dispatch.addTarget("video.newcontext", + moof::dispatcher& dispatcher = moof::dispatcher::global(); + mNewContextDispatch = dispatcher.add_target("video.newcontext", boost::bind(&Main::setupGL)); setupGL(); } -void Main::update(Mf::Scalar t, Mf::Scalar dt) +void Main::update(moof::scalar t, moof::scalar dt) { if (children().size() == 0) { - //Mf::logWarning("main view has no children"); + //moof::log_warning("main view has no children"); //stop(); //return; - addChild(TitleLayer::alloc()); + add_child(TitleLayer::alloc()); } - Mf::View::update(t, dt); + moof::view::update(t, dt); } -void Main::draw(Mf::Scalar alpha) const +void Main::draw(moof::scalar alpha) const { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); @@ -66,24 +66,24 @@ void Main::draw(Mf::Scalar alpha) const glMatrixMode(GL_MODELVIEW); glLoadIdentity(); - Mf::View::draw(alpha); + moof::view::draw(alpha); } -bool Main::handleEvent(const Mf::Event& event) +bool Main::handle_event(const moof::event& event) { - if (Mf::View::handleEvent(event)) return true; + if (moof::view::handle_event(event)) return true; switch (event.type) { case SDL_KEYUP: if (event.key.keysym.sym == SDLK_f) { - video().toggleFull(); + video().toggle_fullscreen(); } else if (event.key.keysym.sym == SDLK_l) { - video().toggleCursorGrab(); - video().toggleCursorVisible(); + video().toggle_cursor_captured(); + video().toggle_cursor_visible(); } break; @@ -128,7 +128,7 @@ std::string Main::getConfigPath() // 4. YOINKRC (environment) std::string path("yoinkrc"); - Mf::Resource::getPath(path); + moof::resource::find_path(path); #if !defined(_WIN32) path += ":/etc/yoinkrc"; @@ -164,8 +164,8 @@ void Main::setupGL() //glMatrixMode(GL_PROJECTION); //glLoadIdentity(); - //Mf::Scalar ratio = Mf::core.getVideo()->getWidth() / - //Mf::core.getVideo()->getHeight(); + //moof::scalar ratio = moof::core.getVideo()->width() / + //moof::core.getVideo()->height(); //gluPerspective(60.0, ratio, 1.0, 250.0); //glMatrixMode(GL_MODELVIEW); @@ -276,25 +276,26 @@ void goodbye() } -#include +#include int main(int argc, char* argv[]) { - Mf::ResolverTask task("4950", "compy", SOCK_DGRAM); + moof::resolver_task task("4950", "lappy"); task.run(); int i = task.wait(); - Mf::logWarning << "task ended with code: " << i << std::endl; + moof::log_warning("task ended with code:", i); - std::vector::const_iterator it; + std::vector::const_iterator it; for (it = task.addresses().begin(); it != task.addresses().end(); ++it) { - Mf::SocketAddress addr = *it; + moof::socket::address addr = *it; - Mf::logInfo << "address: " << addr.name() << ":" << addr.port() - << " (" << addr.type() << ")" << std::endl; + moof::log_info("address:", addr, "(", addr.type(), ")"); } + //ASSERT(5 == 8 && "uh oh that's not right"); + std::vector hi; for (int a = 0; a < 4000; a++) @@ -302,38 +303,47 @@ int main(int argc, char* argv[]) hi.push_back(a); } - Mf::logInfo << "array size: " << hi.size() << std::endl; - Mf::Packet packet; + moof::log_info("array size:", hi.size()); + moof::packet packet; packet << hi; - Mf::SocketAddress addr("4950", "155.98.111.159", SOCK_DGRAM); - //Mf::SocketAddress addr = Mf::SocketAddress::broadcast("4950"); - //Mf::SocketAddress addr("4950", "155.98.109.255", SOCK_DGRAM); - //Mf::logInfo << "local addr: " << addr.name() << std::endl; - //for (it = task.addresses().begin(); it != task.addresses().end(); ++it) //{ - int bcast = 0; - - //Mf::SocketAddress addr = *it; - Mf::Socket sock(addr); + //moof::socket sock(*it); + moof::socket sock(moof::socket::address::broadcast("4950")); + //moof::socket sock("4950", "lappy", SOCK_DGRAM); + sock.set(SO_BROADCAST, 1); sock.connect(); - sock.get(SO_BROADCAST, bcast); - Mf::logInfo << "bcast: " << bcast << std::endl; - - sock.set(SO_BROADCAST, 1); + //if (sock.isConnected()) + //{ + moof::packet pack; + pack << "hello world"; + sock.write(pack); + //sock.write(pack, sock.address()); + moof::log_info("sent", pack.size(), "bytes"); - sock.get(SO_BROADCAST, bcast); - Mf::logInfo << "bcast: " << bcast << std::endl; + const char* data = pack.bytes(); + for (unsigned i = 0; i < pack.size(); ++i) + { + moof::log_warning("meh:", data[i]); + } - Mf::logInfo << "sending packet of size: " << packet.size() << std::endl; - //sock.write(packet); - sock.write(&bcast, sizeof(bcast)); + char data2[56]; + pack.read(data2, 13); + for (int i = 0; i < 13; ++i) + { + moof::log_warning("meh:", data2[i]); + } + //} + //else + //{ + //moof::log_error("NOT CONNECTED"); + //} //} - return 0; + //return 0; if (argc > 1) @@ -354,31 +364,33 @@ int main(int argc, char* argv[]) hello(); atexit(goodbye); - Mf::Resource::addSearchPaths(Main::getSearchPath()); + moof::resource::add_search_paths(Main::getSearchPath()); - Mf::Settings settings(argc, argv, Main::getConfigPath()); + moof::settings settings(argc, argv, Main::getConfigPath()); - Mf::Log::Level logLevel = Mf::Log::INFO; + enum moof::log::level logLevel = moof::log::info; settings.get("loglevel", logLevel); - Mf::Log::setLevel(logLevel); + moof::log::level(logLevel); try { - Mf::Video::Attributes attributes(settings); - attributes.caption = PACKAGE_STRING; - attributes.icon = Mf::Resource::getPath(PACKAGE".png"); + std::string iconPath(PACKAGE".png"); + moof::resource::find_path(iconPath); + moof::image icon(iconPath); + icon.set_as_icon(); - Mf::Video video(attributes); + class moof::video::attributes attributes(settings); + moof::video video(PACKAGE_STRING, attributes); Main mainView(settings, video); mainView.run(); return 0; } - catch (const Mf::Error& error) + catch (const std::exception& e) { - Mf::ModalDialog dialog(Mf::ModalDialog::CRITICAL, - PACKAGE_STRING, "Unhandled Exception", - getErrorString(error)); + moof::modal_dialog dialog(moof::modal_dialog::error, + PACKAGE_STRING, "Unhandled Exception", + e.what()); dialog.run(); return 1; diff --git a/src/Main.hh b/src/Main.hh index b6a6684..aa4a0d9 100644 --- a/src/Main.hh +++ b/src/Main.hh @@ -22,30 +22,30 @@ #include -#include -#include -#include +#include +#include +#include -namespace Mf +namespace moof { - class Settings; - class View; + class settings; + class view; } class Main; typedef boost::shared_ptr
MainP; -class Main : public Mf::View +class Main : public moof::view { public: - Main(Mf::Settings& settings, Mf::Video& video); + Main(moof::settings& settings, moof::video& video); - void update(Mf::Scalar t, Mf::Scalar dt); - void draw(Mf::Scalar alpha) const; - bool handleEvent(const Mf::Event& event); + void update(moof::scalar t, moof::scalar dt); + void draw(moof::scalar alpha) const; + bool handle_event(const moof::event& event); static std::string getSearchPath(); static std::string getConfigPath(); @@ -60,7 +60,7 @@ private: */ static void setupGL(); - Mf::Dispatch::Handle mNewContextDispatch; + moof::dispatcher::handle mNewContextDispatch; }; diff --git a/src/Makefile.am b/src/Makefile.am index c9b5dd9..61be610 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -11,75 +11,73 @@ noinst_LIBRARIES = libmoof.a -libmoof_a_CPPFLAGS = -I$(top_srcdir)/src/Moof +libmoof_a_CPPFLAGS = -I$(top_srcdir)/src/moof libmoof_a_SOURCES = \ - Moof/Aabb.cc \ - Moof/Aabb.hh \ - Moof/Backend.cc \ - Moof/Backend.hh \ - Moof/Camera.cc \ - Moof/Camera.hh \ - Moof/Contact.hh \ - Moof/ConvertUTF.c \ - Moof/ConvertUTF.h \ - Moof/Cullable.hh \ - Moof/Dispatch.cc \ - Moof/Dispatch.hh \ - Moof/Drawable.hh \ - Moof/Entity.hh \ - Moof/Error.hh \ - Moof/Event.hh \ - Moof/Frustum.cc \ - Moof/Frustum.hh \ - Moof/HashTools.cc \ - Moof/HashTools.hh \ - Moof/Image.cc \ - Moof/Image.hh \ - Moof/Interpolator.hh \ - Moof/Line.hh \ - Moof/Log.cc \ - Moof/Log.hh \ - Moof/Manager.hh \ - Moof/Math.hh \ - Moof/ModalDialog.hh \ - Moof/Network.hh \ - Moof/Octree.hh \ - Moof/OpenGL.hh \ - Moof/Packet.cc \ - Moof/Packet.hh \ - Moof/Plane.cc \ - Moof/Plane.hh \ - Moof/Ray.hh \ - Moof/Resource.cc \ - Moof/Resource.hh \ - Moof/RigidBody.hh \ - Moof/Script.hh \ - Moof/Service.cc \ - Moof/Service.hh \ - Moof/Settings.cc \ - Moof/Settings.hh \ - Moof/Shape.hh \ - Moof/Socket.hh \ - Moof/Sound.cc \ - Moof/Sound.hh \ - Moof/Sphere.hh \ - Moof/StringTools.cc \ - Moof/StringTools.hh \ - Moof/Texture.cc \ - Moof/Texture.hh \ - Moof/Thread.hh \ - Moof/Timer.cc \ - Moof/Timer.hh \ - Moof/Video.cc \ - Moof/Video.hh \ - Moof/View.cc \ - Moof/View.hh \ - Moof/fastevents.c \ - Moof/fastevents.h \ + moof/aabb.cc \ + moof/aabb.hh \ + moof/backend.cc \ + moof/backend.hh \ + moof/camera.cc \ + moof/camera.hh \ + moof/contact.hh \ + moof/ConvertUTF.c \ + moof/ConvertUTF.h \ + moof/cullable.hh \ + moof/dispatcher.cc \ + moof/dispatcher.hh \ + moof/drawable.hh \ + moof/entity.hh \ + moof/event.hh \ + moof/frustum.cc \ + moof/frustum.hh \ + moof/hash.cc \ + moof/hash.hh \ + moof/image.cc \ + moof/image.hh \ + moof/interpolator.hh \ + moof/line.hh \ + moof/log.cc \ + moof/log.hh \ + moof/manager.hh \ + moof/math.hh \ + moof/modal_dialog.hh \ + moof/network.hh \ + moof/opengl.hh \ + moof/packet.cc \ + moof/packet.hh \ + moof/plane.cc \ + moof/plane.hh \ + moof/ray.hh \ + moof/resource.cc \ + moof/resource.hh \ + moof/rigid_body.hh \ + moof/script.hh \ + moof/service.cc \ + moof/service.hh \ + moof/settings.cc \ + moof/settings.hh \ + moof/shape.hh \ + moof/socket.hh \ + moof/sound.cc \ + moof/sound.hh \ + moof/sphere.hh \ + moof/string.cc \ + moof/string.hh \ + moof/texture.cc \ + moof/texture.hh \ + moof/thread.hh \ + moof/timer.cc \ + moof/timer.hh \ + moof/video.cc \ + moof/video.hh \ + moof/view.cc \ + moof/view.hh \ + moof/fastevents.c \ + moof/fastevents.h \ $(ENDLIST) -EXTRA_DIST = Moof/cml Moof/stlplus +EXTRA_DIST = moof/cml moof/stlplus # @@ -88,7 +86,7 @@ EXTRA_DIST = Moof/cml Moof/stlplus bin_PROGRAMS = yoink -yoink_CPPFLAGS = -I$(top_srcdir)/src/Moof +yoink_CPPFLAGS = -I$(top_srcdir)/src/moof yoink_LDADD = libmoof.a yoink_SOURCES = \ @@ -96,8 +94,6 @@ yoink_SOURCES = \ Animation.hh \ Character.cc \ Character.hh \ - ErrorHandler.cc \ - ErrorHandler.hh \ GameLayer.cc \ GameLayer.hh \ GameState.hh \ diff --git a/src/Moof/Backend.cc b/src/Moof/Backend.cc deleted file mode 100644 index 95f4dc3..0000000 --- a/src/Moof/Backend.cc +++ /dev/null @@ -1,94 +0,0 @@ - -/*] Copyright (c) 2009-2010, Charles McGarvey [************************** -**] All rights reserved. -* -* vi:ts=4 sw=4 tw=75 -* -* Distributable under the terms and conditions of the 2-clause BSD license; -* see the file COPYING for a complete text of the license. -* -**************************************************************************/ - -#include -#include "fastevents.h" - -#include "Backend.hh" -#include "Error.hh" -#include "Log.hh" - - -namespace Mf { - - -struct Impl -{ - static Error error; - static int retainCount; -}; - -Error Impl::error(Error::UNINITIALIZED); -int Impl::retainCount = 0; - - -Backend::Backend() -{ - if (Impl::retainCount++ == 0) - { -#if defined(_WIN32) - if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) != 0) -#else - if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTTHREAD) != 0) -#endif - { - const char* error = SDL_GetError(); - Impl::error.init(Error::SDL_INIT, error); - return; // fatal - } - else - { - char name[128]; - SDL_VideoDriverName(name, sizeof(name)); - logInfo << "initialized SDL; using video driver `" - << name << "'" << std::endl; - } - - if (FE_Init() != 0) - { - const char* error = FE_GetError(); - Impl::error.init(Error::FASTEVENTS_INIT, error); - return; // fatal - } - - Impl::error.init(Error::NONE); - } -} - -Backend::Backend(const Backend& backend) -{ - ++Impl::retainCount; -} - -Backend::~Backend() -{ - if (--Impl::retainCount == 0) - { - FE_Quit(); - SDL_Quit(); - - Impl::error.reset(); - } -} - -bool Backend::isInitialized() -{ - return Impl::error.code() == Error::NONE; -} - -const Error& Backend::getError() -{ - return Impl::error; -} - - -} // namespace Mf - diff --git a/src/Moof/Camera.cc b/src/Moof/Camera.cc deleted file mode 100644 index d7f1fe2..0000000 --- a/src/Moof/Camera.cc +++ /dev/null @@ -1,152 +0,0 @@ - -/*] Copyright (c) 2009-2010, Charles McGarvey [************************** -**] All rights reserved. -* -* vi:ts=4 sw=4 tw=75 -* -* Distributable under the terms and conditions of the 2-clause BSD license; -* see the file COPYING for a complete text of the license. -* -**************************************************************************/ - -#include "Camera.hh" -#include "OpenGL.hh" - - -namespace Mf { - - -void Camera::setPosition(const Vector3& position) -{ - mState.position = position; -} - -void Camera::setRotation(const Quaternion& rotation) -{ - mState.orientation = rotation; -} - -void Camera::lookAt(const Vector3& point) -{ - // FIXME this doesn't work as expected - cml::quaternion_rotation_aim_at(mState.orientation, - mState.position, point, - Vector3(0.0, 1.0, 0.0)); -} - - -void Camera::setProjection(const Matrix4& projection) -{ - mProjection = projection; -} - -void Camera::setProjection(Scalar fovy, Scalar aspect, Scalar abutting, - Scalar distant) -{ - cml::matrix_perspective_yfov_RH(mProjection, fovy, aspect, abutting, - distant, cml::z_clip_neg_one); -} - - -void Camera::uploadToGL(Scalar alpha) const -{ - calculate(alpha); - - glMatrixMode(GL_PROJECTION); - glMultMatrix(mProjection.data()); - - glMatrixMode(GL_MODELVIEW); - glMultMatrix(mModelview.data()); -} - -void Camera::calculate(Scalar alpha) const -{ - State3 state = getState(alpha); - - cml::matrix_rotation_quaternion(mModelview, state.orientation); - - Matrix4 translate; - cml::matrix_translation(translate, state.position); - - mModelview *= translate; - - mFrustum.init(mModelview, mProjection); -} - - -void Camera::update(Scalar t, Scalar dt) -{ - RigidBody3::update(t, dt); -} - -void Camera::draw(Scalar alpha) const -{ - mSphere.draw(alpha); -} - - -void Camera::handleEvent(const Event& event) -{ - const Scalar ds = 50.0; - - switch (event.type) - { - case SDL_KEYDOWN: - if (event.key.keysym.sym == SDLK_RIGHT) - { - mState.position[0] -= ds; - } - else if (event.key.keysym.sym == SDLK_LEFT) - { - mState.position[0] += ds; - } - else if (event.key.keysym.sym == SDLK_UP) - { - mState.position[1] -= ds; - } - else if (event.key.keysym.sym == SDLK_DOWN) - { - mState.position[1] += ds; - } - else if (event.key.keysym.sym == SDLK_PAGEUP) - { - mState.position[2] += ds; - } - else if (event.key.keysym.sym == SDLK_PAGEDOWN) - { - mState.position[2] -= ds; - } - break; - - case SDL_MOUSEMOTION: - { - Scalar xrel = cml::rad(Scalar(event.motion.xrel) / 6.0); - Scalar yrel = cml::rad(Scalar(event.motion.yrel) / 6.0); - - Quaternion rotation = mState.orientation; - - cml::quaternion_rotate_about_world_x(rotation, yrel); - //mRotation.normalize(); - cml::quaternion_rotate_about_world_y(rotation, xrel); - - rotation.normalize(); - mState.orientation = rotation; - } - break; - - case SDL_MOUSEBUTTONDOWN: - if (event.button.button == SDL_BUTTON_WHEELUP) - { - mState.position[2] -= ds; - } - else if (event.button.button == SDL_BUTTON_WHEELDOWN) - { - mState.position[2] -= ds; - } - break; - } -} - - -} // namespace Mf - diff --git a/src/Moof/Camera.hh b/src/Moof/Camera.hh deleted file mode 100644 index bbb493d..0000000 --- a/src/Moof/Camera.hh +++ /dev/null @@ -1,80 +0,0 @@ - -/*] Copyright (c) 2009-2010, Charles McGarvey [************************** -**] All rights reserved. -* -* vi:ts=4 sw=4 tw=75 -* -* Distributable under the terms and conditions of the 2-clause BSD license; -* see the file COPYING for a complete text of the license. -* -**************************************************************************/ - -#ifndef _MOOF_CAMERA_HH_ -#define _MOOF_CAMERA_HH_ - -#include -#include -#include -#include - - -namespace Mf { - - -class Camera : public RigidBody3 -{ -public: - - Camera() - { - mState.init(); - mPrevState.init(); - - cml::quaternion_rotation_world_y(mState.orientation, SCALAR(0.0)); - } - - void setPosition(const Vector3& position); - void setRotation(const Quaternion& rotation); - - void lookAt(const Vector3& point); - - void setProjection(const Matrix4& projection); - void setProjection(Scalar fovy, Scalar aspect, Scalar near, Scalar far); - - const Matrix4& getModelview() const - { - return mModelview; - } - - const Matrix4& getProjection() const - { - return mProjection; - } - - const Frustum& getFrustum() const - { - return mFrustum; - } - - - void uploadToGL(Scalar alpha = 0) const; - - void update(Scalar t, Scalar dt); - void draw(Scalar alpha = 0) const; - void handleEvent(const Event& event); - -private: - - void calculate(Scalar alpha) const; - - mutable Matrix4 mModelview; - Matrix4 mProjection; - - mutable Frustum mFrustum; -}; - - -} // namespace Mf - -#endif // _MOOF_CAMERA_HH_ - diff --git a/src/Moof/Dispatch.cc b/src/Moof/Dispatch.cc deleted file mode 100644 index af0faea..0000000 --- a/src/Moof/Dispatch.cc +++ /dev/null @@ -1,149 +0,0 @@ - -/*] Copyright (c) 2009-2010, Charles McGarvey [************************** -**] All rights reserved. -* -* vi:ts=4 sw=4 tw=75 -* -* Distributable under the terms and conditions of the 2-clause BSD license; -* see the file COPYING for a complete text of the license. -* -**************************************************************************/ - -#include - -#include "Dispatch.hh" - - -namespace Mf { - - -class Dispatch::Impl -{ -public: - - Impl(Dispatch* dispatch) : - mDispatch(dispatch), - mId(0) {} - - Dispatch::Handle getNewHandle() - { - ++mId; - Dispatch::Handle handle(mDispatch->mImpl, mId); - return handle; - } - - typedef std::pair Callback; - typedef std::multimap CallbackLookup; - typedef CallbackLookup::iterator CallbackIt; - - typedef std::multimap HandleLookup; - typedef HandleLookup::iterator HandleIt; - - - inline Handle addTarget(const std::string& event, - const Function& callback, Handle handle) - { - mCallbacks.insert(std::make_pair(event, - std::make_pair(handle.getId(), callback))); - mHandles.insert(std::make_pair(handle.getId(), event)); - - return handle; - } - - inline void removeTarget(unsigned id) - { - std::pair matching(mHandles.equal_range(id)); - - for (HandleIt it = matching.first; it != matching.second; ++it) - { - CallbackIt first = mCallbacks.find((*it).second); - CallbackIt last = mCallbacks.end(); - - for (CallbackIt jt = first; jt != last; ++jt) - { - if ((*jt).second.first == id) - { - mCallbacks.erase(jt); - break; - } - } - } - - mHandles.erase(id); - } - - void dispatch(const std::string& event) - { - std::pair - callbacks(mCallbacks.equal_range(event)); - - for (CallbackIt it = callbacks.first; it != callbacks.second; ++it) - { - Function callback = (*it).second.second; - callback(); - } - } - - - Dispatch* mDispatch; - - unsigned mId; - - CallbackLookup mCallbacks; - HandleLookup mHandles; -}; - - -void Dispatch::Handle::clear() -{ - boost::shared_ptr dispatch; - if (mId && (dispatch = mDispatch.lock())) - { - dispatch->removeTarget(mId); - mId = 0; - } -} - - -Dispatch::Dispatch() : - mImpl(new Dispatch::Impl(this)) {} - - -Dispatch::Handle Dispatch::addTarget(const std::string& event, - const Function& callback) -{ - return addTarget(event, callback, mImpl->getNewHandle()); -} - -Dispatch::Handle Dispatch::addTarget(const std::string& event, - const Function& callback, - Handle handle) -{ - // pass through - return mImpl->addTarget(event, callback, handle); -} - - -void Dispatch::removeTarget(unsigned id) -{ - // pass through - return mImpl->removeTarget(id); -} - - -void Dispatch::dispatch(const std::string& event) -{ - // pass through - mImpl->dispatch(event); -} - - -Dispatch& Dispatch::global() -{ - static Dispatch dispatch; - return dispatch; -} - - -} // namespace Mf - diff --git a/src/Moof/Dispatch.hh b/src/Moof/Dispatch.hh deleted file mode 100644 index e357f02..0000000 --- a/src/Moof/Dispatch.hh +++ /dev/null @@ -1,103 +0,0 @@ - -/*] Copyright (c) 2009-2010, Charles McGarvey [************************** -**] All rights reserved. -* -* vi:ts=4 sw=4 tw=75 -* -* Distributable under the terms and conditions of the 2-clause BSD license; -* see the file COPYING for a complete text of the license. -* -**************************************************************************/ - -#ifndef _MOOF_DISPATCH_HH_ -#define _MOOF_DISPATCH_HH_ - -#include - -#include -#include -#include -#include - - -namespace Mf { - - -/** - * Dispatcher of messages to interested parties. - */ - -class Dispatch -{ - class Impl; - boost::shared_ptr mImpl; - - void removeTarget(unsigned id); - - -public: - - class Handle - { - public: - - Handle() : - mId(0) {} - - Handle(boost::weak_ptr dispatch, unsigned id) : - mDispatch(dispatch), - mId(id) {} - - Handle(const Handle& handle) : - mDispatch(handle.mDispatch), - mId(handle.mId) - { - handle.mId = 0; - } - - ~Handle() - { - clear(); - } - - Handle& operator = (const Handle& handle) - { - clear(); - mDispatch = handle.mDispatch; - mId = handle.mId; - handle.mId = 0; - return *this; - } - - unsigned getId() const - { - return mId; - } - - void clear(); - - private: - - boost::weak_ptr mDispatch; - mutable unsigned mId; - }; - - typedef boost::function Function; - - - Dispatch(); - - Handle addTarget(const std::string& event, const Function& callback); - Handle addTarget(const std::string& event, const Function& callback, - Handle handle); - - void dispatch(const std::string& event); - - static Dispatch& global(); -}; - - -} // namespace Mf - -#endif // _MOOF_DISPATCH_HH_ - diff --git a/src/Moof/Entity.hh b/src/Moof/Entity.hh deleted file mode 100644 index 4e71466..0000000 --- a/src/Moof/Entity.hh +++ /dev/null @@ -1,74 +0,0 @@ - -/*] Copyright (c) 2009-2010, Charles McGarvey [************************** -**] All rights reserved. -* -* vi:ts=4 sw=4 tw=75 -* -* Distributable under the terms and conditions of the 2-clause BSD license; -* see the file COPYING for a complete text of the license. -* -**************************************************************************/ - -#ifndef _MOOF_ENTITY_HH_ -#define _MOOF_ENTITY_HH_ - -#include - -#include -#include -#include -#include - - -namespace Mf { - - -class Frustum; - - -/** - * Interface for game objects that can be drawn to the screen and have a - * specified volume (take up space). - */ - -class Entity; -typedef boost::shared_ptr EntityP; - - -class Entity : public Cullable, public Drawable -{ -protected: - - Aabb<3> mAabb; - Sphere<3> mSphere; - -public: - - virtual ~Entity() {} - - virtual void drawIfVisible(Scalar alpha, const Frustum& frustum) const - { - if (isVisible(frustum)) draw(alpha); - } - - virtual bool isVisible(const Frustum& frustum) const - { - return mSphere.isVisible(frustum) && mAabb.isVisible(frustum); - } - - const Aabb<3>& getAabb() const - { - return mAabb; - } - - const Sphere<3>& getSphere() const - { - return mSphere; - } -}; - - -} // namespace Mf - -#endif // _MOOF_ENTITY_HH_ - diff --git a/src/Moof/Error.hh b/src/Moof/Error.hh deleted file mode 100644 index 494dd60..0000000 --- a/src/Moof/Error.hh +++ /dev/null @@ -1,93 +0,0 @@ - -/*] Copyright (c) 2009-2010, Charles McGarvey [************************** -**] All rights reserved. -* -* vi:ts=4 sw=4 tw=75 -* -* Distributable under the terms and conditions of the 2-clause BSD license; -* see the file COPYING for a complete text of the license. -* -**************************************************************************/ - -#ifndef _MOOF_ERROR_HH_ -#define _MOOF_ERROR_HH_ - -#include // strncpy -#include -#include - - -namespace Mf { - - -class Error : public std::exception -{ -public: - - enum Code - { - UNINITIALIZED = -1, // - - NONE = 0, // - - ALC_INIT, // description - FASTEVENTS_INIT, // description - FILE_NOT_FOUND, // path of missing file - OPENAL_INIT, // description - RESOURCE_NOT_FOUND, // name of missing resource - SCRIPT_ERROR, // description - SDL_INIT, // description - SDL_VIDEOMODE, // - - UNKNOWN_AUDIO_FORMAT, // name of resource - UNKNOWN_IMAGE_FORMAT, // name of resource - }; - - explicit Error(unsigned code = NONE, const std::string& what = "") - { - init(code, what); - } - virtual ~Error() throw() {} - - void init(unsigned code = NONE, const std::string& what = "") - { - strncpy(mWhat, what.c_str(), sizeof(mWhat)-1); - mWhat[sizeof(mWhat)-1] = '\0'; - mCode = code; - } - - virtual void raise() const - { - throw *this; - } - - unsigned code() const throw() - { - return mCode; - } - - const char* what() const throw() - { - return mWhat; - } - - operator bool () const - { - // resolves to true if error code is not NONE - return mCode != NONE; - } - - void reset() throw() - { - mCode = NONE; - mWhat[0] = '\0'; - } - -private: - - unsigned mCode; - char mWhat[1024]; -}; - - -} // namespace Mf - -#endif // _MOOF_ERROR_HH_ - diff --git a/src/Moof/Frustum.cc b/src/Moof/Frustum.cc deleted file mode 100644 index e56fb7b..0000000 --- a/src/Moof/Frustum.cc +++ /dev/null @@ -1,95 +0,0 @@ - -/*] Copyright (c) 2009-2010, Charles McGarvey [************************** -**] All rights reserved. -* -* vi:ts=4 sw=4 tw=75 -* -* Distributable under the terms and conditions of the 2-clause BSD license; -* see the file COPYING for a complete text of the license. -* -**************************************************************************/ - -#include -#include -#include - - -namespace Mf { - - -void Frustum::init(const Matrix4& modelview, const Matrix4& projection) -{ - Scalar planes[6][4]; - - cml::extract_frustum_planes(modelview, projection, planes, - cml::z_clip_neg_one); - - mPlanes[0] = Plane(planes[0][0], planes[0][1], - planes[0][2], planes[0][3]); - mPlanes[1] = Plane(planes[1][0], planes[1][1], - planes[1][2], planes[1][3]); - mPlanes[2] = Plane(planes[2][0], planes[2][1], - planes[2][2], planes[2][3]); - mPlanes[3] = Plane(planes[3][0], planes[3][1], - planes[3][2], planes[3][3]); - mPlanes[4] = Plane(planes[4][0], planes[4][1], - planes[4][2], planes[4][3]); - mPlanes[5] = Plane(planes[5][0], planes[5][1], - planes[5][2], planes[5][3]); -} - -void Frustum::init(const Matrix4& modelview, Scalar fovy, Scalar aspect, - Scalar abutting, Scalar distant) -{ - Matrix4 projection; - - cml::matrix_perspective_yfov_RH(projection, fovy, aspect, abutting, - distant, cml::z_clip_neg_one); - - init(modelview, projection); -} - -Frustum::Collision Frustum::contains(const Aabb<3>& aabb) const -{ - Vector3 corners[8]; - int nTotalInside = 0; - - aabb.getCorners(corners); - - for (int i = 0; i < 6; ++i) - { - int nInside = 8; - - for (int j = 0; j < 8; ++j) - { - if (mPlanes[i].intersects(corners[j]) == Plane::NEGATIVE) - { - --nInside; - } - } - - if (nInside == 0) return OUTSIDE; - else if (nInside == 8) ++nTotalInside; - } - - if (nTotalInside == 6) return INSIDE; - else return INTERSECT; -} - - -Frustum::Collision Frustum::contains(const Sphere<3>& sphere) const -{ - for (int i = 0; i < 6; ++i) - { - Plane::Halfspace halfspace = mPlanes[i].intersects(sphere); - - if (halfspace == Plane::NEGATIVE) return OUTSIDE; - else if (halfspace == Plane::INTERSECT) return INTERSECT; - } - - return INSIDE; -} - - -} // namespace Mf - diff --git a/src/Moof/Frustum.hh b/src/Moof/Frustum.hh deleted file mode 100644 index 5710004..0000000 --- a/src/Moof/Frustum.hh +++ /dev/null @@ -1,60 +0,0 @@ - -/*] Copyright (c) 2009-2010, Charles McGarvey [************************** -**] All rights reserved. -* -* vi:ts=4 sw=4 tw=75 -* -* Distributable under the terms and conditions of the 2-clause BSD license; -* see the file COPYING for a complete text of the license. -* -**************************************************************************/ - -#ifndef _MOOF_FRUSTUM_HH_ -#define _MOOF_FRUSTUM_HH_ - -#include -#include - - -namespace Mf { - - -template class Aabb; -template class Sphere; - -class Frustum -{ - Plane mPlanes[6]; // left, right, bottom, top, near, far - -public: - typedef enum - { - OUTSIDE = 0, - INSIDE = 1, - INTERSECT = 2 - } Collision; - - Frustum() {} - Frustum(const Matrix4& modelview, const Matrix4& projection) - { - init(modelview, projection); - } - Frustum(const Matrix4& modelview, Scalar fovy, Scalar aspect, - Scalar abutting, Scalar distant) - { - init(modelview, fovy, aspect, abutting, distant); - } - - void init(const Matrix4& modelview, const Matrix4& projection); - void init(const Matrix4& modelview, Scalar fovy, Scalar aspect, - Scalar abutting, Scalar distant); - - Collision contains(const Aabb<3>& aabb) const; - Collision contains(const Sphere<3>& sphere) const; -}; - - -} // namespace Mf - -#endif // _MOOF_FRUSTUM_HH_ - diff --git a/src/Moof/Image.hh b/src/Moof/Image.hh deleted file mode 100644 index 6c36cdd..0000000 --- a/src/Moof/Image.hh +++ /dev/null @@ -1,70 +0,0 @@ - -/*] Copyright (c) 2009-2010, Charles McGarvey [************************** -**] All rights reserved. -* -* vi:ts=4 sw=4 tw=75 -* -* Distributable under the terms and conditions of the 2-clause BSD license; -* see the file COPYING for a complete text of the license. -* -**************************************************************************/ - -#ifndef _MOOF_IMAGE_HH_ -#define _MOOF_IMAGE_HH_ - -#include - -#include -#include - - -namespace Mf { - - -class Image; -typedef boost::shared_ptr ImageP; - -class Image : public Resource -{ -public: - - static ImageP alloc(const std::string& name) - { - return ImageP(new Image(name)); - } - - explicit Image(const std::string& name); - - bool isValid() const; - - int getWidth() const; - int getHeight() const; - - unsigned getDepth() const; - unsigned getPitch() const; - GLuint getMode() const; - - std::string getComment() const; - - const char* getPixels() const; - char* getPixels(); - - void flip(); - - void setAsIcon() const; - - static bool getPath(std::string& name); - -private: - - static FILE* openFile(std::string& name); - - class Impl; - boost::shared_ptr mImpl; -}; - - -} // namespace Mf - -#endif // _MOOF_IMAGE_HH_ - diff --git a/src/Moof/Interpolator.hh b/src/Moof/Interpolator.hh deleted file mode 100644 index db91e10..0000000 --- a/src/Moof/Interpolator.hh +++ /dev/null @@ -1,158 +0,0 @@ - -/*] Copyright (c) 2009-2010, Charles McGarvey [************************** -**] All rights reserved. -* -* vi:ts=4 sw=4 tw=75 -* -* Distributable under the terms and conditions of the 2-clause BSD license; -* see the file COPYING for a complete text of the license. -* -**************************************************************************/ - -#ifndef _MOOF_INTERPOLATOR_HH_ -#define _MOOF_INTERPOLATOR_HH_ - -#include -#include - - -namespace Mf { - - -namespace Interp { - - typedef enum - { - STOP = 0, - REPEAT = 1, - OSCILLATE = 2 - } Mode; - -} // namespace Interp - - -template -class Interpolator : public T -{ -public: - - Interpolator(Scalar t = 1.0, Interp::Mode mode = Interp::STOP) - { - reset(t, mode); - } - - void reset(Scalar t = 1.0, Interp::Mode mode = Interp::STOP) - { - mAlpha = 0.0; - mScale = 1.0 / t; - mMode = mode; - mIsDone = false; - } - - void update(Scalar t, Scalar dt) - { - if (!mIsDone) - { - mPrevState = T::getValue(); - mAlpha += dt * mScale; - clamp(); - if (mPrevState == T::calculate(mAlpha)) mIsDone = true; - } - } - - typename T::Type getState(Scalar alpha) const - { - return cml::lerp(mPrevState, T::getValue(), alpha); - } - - bool isDone() const - { - return mIsDone; - } - -private: - - void clamp() - { - if (mAlpha > 1.0) - { - switch (mMode) - { - case Interp::STOP: - mAlpha = SCALAR(1.0); - break; - case Interp::REPEAT: - mAlpha -= SCALAR(1.0); - break; - case Interp::OSCILLATE: - mAlpha = SCALAR(2.0) - mAlpha; - mScale = -mScale; - break; - } - } - else if (mAlpha < 0.0) - { - switch (mMode) - { - case Interp::STOP: - mAlpha = SCALAR(0.0); - break; - case Interp::REPEAT: - mAlpha += SCALAR(1.0); - break; - case Interp::OSCILLATE: - mAlpha = -mAlpha; - mScale = -mScale; - break; - } - } - } - - Scalar mAlpha; - Scalar mScale; - Interp::Mode mMode; - bool mIsDone; - - typename T::Type mPrevState; -}; - - -template -class Linear -{ -public: - - typedef T Type; - - void init(const Type& a, const Type& b) - { - mStart = a; - mFinish = b; - } - - const Type& calculate(Scalar alpha) - { - mState = cml::lerp(mStart, mFinish, alpha); - return mState; - } - - const Type& getValue() const - { - return mState; - } - -private: - - Type mState; - Type mStart; - Type mFinish; -}; - - -typedef Interpolator< Linear > Lerp; - - -} // namespace Mf - -#endif // _MOOF_INTERPOLATOR_HH_ - diff --git a/src/Moof/Log.cc b/src/Moof/Log.cc deleted file mode 100644 index da7985d..0000000 --- a/src/Moof/Log.cc +++ /dev/null @@ -1,75 +0,0 @@ - -/*] Copyright (c) 2009-2010, Charles McGarvey [************************** -**] All rights reserved. -* -* vi:ts=4 sw=4 tw=75 -* -* Distributable under the terms and conditions of the 2-clause BSD license; -* see the file COPYING for a complete text of the license. -* -**************************************************************************/ - -#include - -#include "Log.hh" -#include "Script.hh" - - -namespace Mf { - - -Log::Level Log::gLevel = Log::INFO; - - -void Log::setLevel(Level level) -{ - gLevel = level; -} - -Log::Level Log::level() -{ - return gLevel; -} - - -std::ostream& log(std::clog); - -static std::ofstream nullLog_; -std::ostream& nullLog(nullLog_); - -Log logError( Log::ERRORR, " error: "); -Log logWarning(Log::WARNING, "warning: "); -Log logInfo( Log::INFO, " info: "); - - -static int logScript_(Script& script, Log::Level level) -{ - static Log* logs[] = {0, &logError, &logWarning, &logInfo}; - - Script::Slot param = script[1]; - - while (!param.isNone()) - { - (*logs[level])(param); - ++param.index; - } - - return 0; -} - - -void importLogFunctions(Script& script) -{ - script.importFunction("LogError", - boost::bind(logScript_, _1, Log::ERRORR)); - script.importFunction("LogWarning", - boost::bind(logScript_, _1, Log::WARNING)); - script.importFunction("LogInfo", - boost::bind(logScript_, _1, Log::INFO)); - script.importFunction("print", - boost::bind(logScript_, _1, Log::INFO)); -} - - -} // namespace Mf - diff --git a/src/Moof/Math.hh b/src/Moof/Math.hh deleted file mode 100644 index d557c7f..0000000 --- a/src/Moof/Math.hh +++ /dev/null @@ -1,204 +0,0 @@ - -/*] Copyright (c) 2009-2010, Charles McGarvey [************************** -**] All rights reserved. -* -* vi:ts=4 sw=4 tw=75 -* -* Distributable under the terms and conditions of the 2-clause BSD license; -* see the file COPYING for a complete text of the license. -* -**************************************************************************/ - -#ifndef _MOOF_MATH_HH_ -#define _MOOF_MATH_HH_ - -/** - * @file Math.hh - * General math-related types and functions. - */ - -#include -#include - -#include - -#if HAVE_CONFIG_H -#include "config.h" -#endif - - -#if USE_DOUBLE_PRECISION - -typedef GLdouble GLscalar; -#define GL_SCALAR GL_DOUBLE -#define SCALAR(D) (D) - -#else - -typedef GLfloat GLscalar; -#define GL_SCALAR GL_FLOAT -#define SCALAR(F) (F##f) - -#endif - - -namespace Mf { - - -typedef GLscalar Scalar; - -typedef cml::vector< Scalar, cml::fixed<2> > Vector2; -typedef cml::vector< Scalar, cml::fixed<3> > Vector3; -typedef cml::vector< Scalar, cml::fixed<4> > Vector4; - -typedef cml::matrix< Scalar, cml::fixed<2,2>, - cml::col_basis, cml::col_major > Matrix2; -typedef cml::matrix< Scalar, cml::fixed<3,3>, - cml::col_basis, cml::col_major > Matrix3; -typedef cml::matrix< Scalar, cml::fixed<4,4>, - cml::col_basis, cml::col_major > Matrix4; - -typedef cml::quaternion< Scalar, cml::fixed<>, cml::vector_first, - cml::positive_cross > Quaternion; - -typedef cml::constants Constants; - - -inline Vector3 demote(const Vector4& vec) -{ - return Vector3(vec[0], vec[1], vec[2]); -} - -inline Vector2 demote(const Vector3& vec) -{ - return Vector2(vec[0], vec[1]); -} - -inline Vector4 promote(const Vector3& vec, Scalar extra = 0.0) -{ - return Vector4(vec[0], vec[1], vec[2], extra); -} - -inline Vector3 promote(const Vector2& vec, Scalar extra = 0.0) -{ - return Vector3(vec[0], vec[1], extra); -} - - -template -inline R convert(const P& p) -{ - return R(p); -} - -template <> -inline Vector3 convert(const Vector4& vec) -{ - return Vector3(vec[0], vec[1], vec[2]); -} - -template <> -inline Vector2 convert(const Vector3& vec) -{ - return Vector2(vec[0], vec[1]); -} - -template <> -inline Vector4 convert(const Vector3& vec) -{ - return Vector4(vec[0], vec[1], vec[2], SCALAR(0.0)); -} - -template <> -inline Vector3 convert(const Vector2& vec) -{ - return Vector3(vec[0], vec[1], SCALAR(0.0)); -} - -template -struct cast -{ - cast(const P& p) : param(p) {} - template - operator R() { return convert(param); } -private: - const P& param; -}; - - - -const Scalar EPSILON = SCALAR(0.000001); - -/** - * Check the equality of scalars with a certain degree of error allowed. - */ - -inline bool isEqual(Scalar a, Scalar b, Scalar epsilon = EPSILON) -{ - return std::abs(a - b) < epsilon; -} - - - -// Here are some generic implementations of a few simple integrators. To -// use, you need one type representing the state and another containing the -// derivatives of the primary state variables. The state class must -// implement these methods: -// -// void getDerivative(Derivative_Type& derivative, Scalar absoluteTime); -// void step(const Derivative_Type& derivative, Scalar deltaTime); -// -// Additionally, the derivative class must overload a few operators: -// -// Derivative_Type operator+(const Derivative_Type& other) const -// Derivative_Type operator*(const Derivative_Type& other) const - -template -inline D evaluate(const S& state, Scalar t) -{ - D derivative; - state.getDerivative(derivative, t); - return derivative; -} - -template -inline D evaluate(S state, Scalar t, Scalar dt, const D& derivative) -{ - state.step(derivative, dt); - return evaluate(state, t + dt); -} - - -template -inline void euler(S& state, Scalar t, Scalar dt) -{ - D a = evaluate(state, t); - - state.step(a, dt); -} - -template -inline void rk2(S& state, Scalar t, Scalar dt) -{ - D a = evaluate(state, t); - D b = evaluate(state, t, dt * SCALAR(0.5), a); - - state.step(b, dt); -} - -template -inline void rk4(S& state, Scalar t, Scalar dt) -{ - D a = evaluate(state, t); - D b = evaluate(state, t, dt * SCALAR(0.5), a); - D c = evaluate(state, t, dt * SCALAR(0.5), b); - D d = evaluate(state, t, dt, c); - - state.step((a + (b + c) * SCALAR(2.0) + d) * SCALAR(1.0/6.0), dt); -} - - -} // namespace Mf - -#endif // _MOOF_MATH_HH_ - diff --git a/src/Moof/ModalDialog.hh b/src/Moof/ModalDialog.hh deleted file mode 100644 index 4ca199e..0000000 --- a/src/Moof/ModalDialog.hh +++ /dev/null @@ -1,192 +0,0 @@ - -/*] Copyright (c) 2009-2010, Charles McGarvey [************************** -**] All rights reserved. -* -* vi:ts=4 sw=4 tw=75 -* -* Distributable under the terms and conditions of the 2-clause BSD license; -* see the file COPYING for a complete text of the license. -* -**************************************************************************/ - -#ifndef _MOOF_MODALDIALOG_HH_ -#define _MOOF_MODALDIALOG_HH_ - -#include - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#if defined(_WIN32) -#include -#elif defined(__APPLE__) && defined(__MACH__) -#include -#elif USE_GTK -#include -#elif USE_QT4 -#include -#include -#include -#endif - -#include -#include - - -namespace Mf { - - -/** - * Small wrapper over various user interface modal dialog windows. - */ - -struct ModalDialog -{ - enum Type - { - INFO = 1, - WARNING = 2, - CRITICAL = 3 - }; - - - std::string title; - Type type; - std::string text1; - std::string text2; - - - - ModalDialog(Type pType = INFO, - const std::string& pTitle = "", - const std::string& pText1 = "", - const std::string& pText2 = "") : - title(pTitle), - type(pType), - text1(pText1), - text2(pText2) {} - - - void run() const - { - switch (type) - { - case WARNING: - logWarning(text1); - logWarning(text2); - break; - case CRITICAL: - logError(text1); - logError(text2); - break; - default: - logInfo(text1); - logInfo(text2); - break; - } - -#if defined(_WIN32) - - int iconType; - switch (type) - { - case WARNING: - iconType = MB_ICONWARNING; - break; - case CRITICAL: - iconType = MB_ICONERROR; - break; - default: - iconType = MB_ICONINFORMATION; - break; - } - - MessageBox(0, (text1 + "\n" + text2).c_str(), title.c_str(), - MB_OK | iconType); - -#elif USE_GTK - - int argc = 0; - char** argv; - gtk_init(&argc, &argv); - - GtkMessageType iconType; - switch (type) - { - case WARNING: - iconType = GTK_MESSAGE_WARNING; - break; - case CRITICAL: - iconType = GTK_MESSAGE_ERROR; - break; - default: - iconType = GTK_MESSAGE_INFO; - break; - } - - GtkWidget* dialog = gtk_message_dialog_new(NULL, - GTK_DIALOG_DESTROY_WITH_PARENT, iconType, - GTK_BUTTONS_CLOSE, "%s", text1.c_str()); - gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog), - "%s", text2.c_str()); - gtk_window_set_title(GTK_WINDOW(dialog), title.c_str()); - - std::string iconPath(PACKAGE".png"); - if (Resource::getPath(iconPath)) - { - GdkPixbuf* iconPixbuf = gdk_pixbuf_new_from_file(iconPath.c_str(), - NULL); - gtk_window_set_icon(GTK_WINDOW(dialog), iconPixbuf); - } - - gtk_dialog_run(GTK_DIALOG(dialog)); - gtk_widget_destroy(dialog); - // FIXME - this doesn't seem to actually remove the window from the - // screen when it closes - -#elif USE_QT4 - - int argc = 0; - char** argv; - QApplication qtApp(argc, argv); - - QMessageBox::Icon iconType; - switch (type) - { - case WARNING: - iconType = QMessageBox::Warning; - break; - case CRITICAL: - iconType = QMessageBox::Critical; - break; - default: - iconType = QMessageBox::Information; - break; - } - - QMessageBox dialog; - dialog.setWindowTitle(title.c_str()); - dialog.setIcon(iconType); - dialog.setText(text1.c_str()); - dialog.setInformativeText(text2.c_str()); - dialog.setStandardButtons(QMessageBox::Close); - - std::string iconPath(PACKAGE".png"); - if (Resource::getPath(iconPath)) - { - QIcon icon(iconPath.c_str()); - dialog.setWindowIcon(icon); - } - - dialog.exec(); - -#endif - } -}; - - -} // namespace Mf - -#endif // _MOOF_MODALDIALOG_HH_ - diff --git a/src/Moof/Octree.hh b/src/Moof/Octree.hh deleted file mode 100644 index 1559959..0000000 --- a/src/Moof/Octree.hh +++ /dev/null @@ -1,353 +0,0 @@ - -/*] Copyright (c) 2009-2010, Charles McGarvey [************************** -**] All rights reserved. -* -* vi:ts=4 sw=4 tw=75 -* -* Distributable under the terms and conditions of the 2-clause BSD license; -* see the file COPYING for a complete text of the license. -* -**************************************************************************/ - -#ifndef _MOOF_OCTREE_HH_ -#define _MOOF_OCTREE_HH_ - -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include - - -namespace Mf { - - -struct OctreeInsertable -{ - virtual ~OctreeInsertable() {} - - virtual int getOctant(const Aabb<3>& aabb) const = 0; -}; - - -template -class Octree : public Entity -{ - typedef boost::shared_ptr InsertableP; - - struct Node : public Entity - { - std::list objects; - - Node(const Aabb<3>& aabb) - { - mAabb = aabb; - mSphere.point = mAabb.getCenter(); - mSphere.radius = (mAabb.min - mSphere.point).length(); - } - - void draw(Scalar alpha) const - { - mAabb.draw(alpha); - } - - void printSize() - { - logInfo << "size of node " << objects.size() << std::endl; - } - - void getAll(std::list& insertables) const - { - insertables.insert(insertables.end(), objects.begin(), - objects.end()); - } - - void getIfVisible(std::list& insertables, - const Frustum& frustum) const - { - typename std::list::const_iterator it; - - for (it = objects.begin(); it != objects.end(); ++it) - { - if ((*it)->isVisible(frustum)) insertables.push_back(*it); - } - } - }; - - -public: - - typedef boost::shared_ptr Ptr; - typedef typename stlplus::ntree::iterator NodeP; - -private: - - - NodeP insert(InsertableP entity, NodeP node) - { - ASSERT(node.valid() && "invalid node passed"); - ASSERT(entity && "null entity passed"); - - Aabb<3> entityAabb = entity->getAabb(); - Aabb<3> nodeAabb = node->getAabb(); - - if (!(entityAabb.max[0] < nodeAabb.max[0] && - entityAabb.min[0] > nodeAabb.min[0] && - entityAabb.max[1] < nodeAabb.max[1] && - entityAabb.min[1] > nodeAabb.min[1] && - entityAabb.max[2] < nodeAabb.max[2] && - entityAabb.min[2] > nodeAabb.min[2])) - { - node->objects.push_back(entity); - return node; - } - else - { - return insert_recurse(entity, node); - } - } - - NodeP insert_recurse(InsertableP entity, NodeP node) - { - ASSERT(node.valid() && "invalid node passed"); - ASSERT(entity && "null entity passed"); - - int octantNum = entity->getOctant(node->getAabb()); - if (octantNum == -1) - { - node->objects.push_back(entity); - return node; - } - else - { - if ((int)mTree.children(node) <= octantNum) - { - addChild(node, octantNum); - } - - NodeP child = mTree.child(node, octantNum); - ASSERT(child.valid() && "expected valid child node"); - - return insert_recurse(entity, child); - } - } - - void addChild(NodeP node, int index) - { - ASSERT(node.valid() && "invalid node passed"); - - Aabb<3> octant; - - for (int i = mTree.children(node); i <= index; ++i) - { - node->getAabb().getOctant(octant, i); - mTree.append(node, octant); - } - } - - - void getNearbyObjects(std::list& insertables, - const OctreeInsertable& entity, NodeP node) const - { - ASSERT(node.valid() && "invalid node passed"); - - node->printSize(); - - int octantNum = entity.getOctant(node->getAabb()); - if (octantNum != -1) - { - node->getAll(insertables); - - if (octantNum < (int)mTree.children(node)) - { - NodeP child = mTree.child(node, octantNum); - ASSERT(child.valid() && "expected valid child node"); - - getNearbyObjects(insertables, entity, child); - } - } - else - { - logInfo("getting all the rest..."); - getAll(insertables, node); - } - } - - - void getAll(std::list& insertables, NodeP node) const - { - ASSERT(node.valid() && "invalid node passed"); - - node->getAll(insertables); - - for (unsigned i = 0; i < mTree.children(node); ++i) - { - NodeP child = mTree.child(node, i); - ASSERT(child.valid() && "expected valid child node"); - - getAll(insertables, child); - } - } - - void getIfVisible(std::list& insertables, - const Frustum& frustum, NodeP node) const - { - ASSERT(node.valid() && "invalid node passed"); - - // try to cull by sphere - Frustum::Collision collision = frustum.contains(node->getSphere()); - if (collision == Frustum::OUTSIDE) return; - - // try to cull by aabb - collision = frustum.contains(node->getAabb()); - if (collision == Frustum::OUTSIDE) return; - - - if (collision == Frustum::INSIDE) - { - node->getAll(insertables); - } - else // collision == Frustum::INTERSECT - { - node->getIfVisible(insertables, frustum); - } - - if (mTree.children(node) > 0) - { - if (collision == Frustum::INSIDE) - { - for (unsigned i = 0; i < mTree.children(node); ++i) - { - NodeP child = mTree.child(node, i); - ASSERT(child.valid() && "expected valid child node"); - - getAll(insertables, child); - } - } - else // collision == Frustum::INTERSECT - { - for (unsigned i = 0; i < mTree.children(node); ++i) - { - NodeP child = mTree.child(node, i); - ASSERT(child.valid() && "expected valid child node"); - - getIfVisible(insertables, frustum, child); - } - } - } - } - - - mutable stlplus::ntree mTree; - - -public: - - void print(NodeP node) - { - logInfo("-----"); - logInfo << "depth to node: " << mTree.depth(node) << std::endl; - logInfo << "size of node: " << mTree.size(node) << std::endl; - } - - static Ptr alloc(const Node& rootNode) - { - return Ptr(new Octree(rootNode)); - } - - explicit Octree(const Node& rootNode) - { - mTree.insert(rootNode); - } - - - NodeP insert(InsertableP entity) - { - return insert(entity, mTree.root()); - } - - void remove(InsertableP entity, NodeP node) - { - ASSERT(entity && "null entity passed"); - ASSERT(node.valid() && "invalid node passed"); - - typename std::list::iterator it; - it = std::find(node->objects.begin(), node->objects.end(), entity); - - if (it != node->objects.end()) - { - node->objects.erase(it); - } - } - - - NodeP reinsert(InsertableP entity, NodeP node) - { - remove(entity, node); - return insert(entity); - } - - - void draw(Scalar alpha) const - { - std::list objects; - getAll(objects); - - typename std::list::const_iterator it; - for (it = objects.begin(); it != objects.end(); ++it) - { - (*it)->draw(alpha); - } - } - - void drawIfVisible(Scalar alpha, const Frustum& frustum) const - { - std::list objects; - getIfVisible(objects, frustum); - //getNearbyObjects(objects, *savedObj); - - typename std::list::const_iterator it; - for (it = objects.begin(); it != objects.end(); ++it) - { - (*it)->draw(alpha); - } - } - - - void getAll(std::list& insertables) const - { - getAll(insertables, mTree.root()); - } - - void getIfVisible(std::list& insertables, - const Frustum& frustum) const - { - getIfVisible(insertables, frustum, mTree.root()); - } - - mutable const OctreeInsertable* savedObj; - - - void getNearbyObjects(std::list& insertables, - const OctreeInsertable& entity) const - { - logInfo("--- GETTING NEARBY"); - getNearbyObjects(insertables, entity, mTree.root()); - logInfo("---"); - savedObj = &entity; - } -}; - - -} // namespace Mf - -#endif // _MOOF_OCTREE_HH_ - diff --git a/src/Moof/Plane.cc b/src/Moof/Plane.cc deleted file mode 100644 index 5c4d9fd..0000000 --- a/src/Moof/Plane.cc +++ /dev/null @@ -1,51 +0,0 @@ - -/*] Copyright (c) 2009-2010, Charles McGarvey [************************** -**] All rights reserved. -* -* vi:ts=4 sw=4 tw=75 -* -* Distributable under the terms and conditions of the 2-clause BSD license; -* see the file COPYING for a complete text of the license. -* -**************************************************************************/ - -#include "Aabb.hh" -#include "Plane.hh" -#include "Sphere.hh" - - -namespace Mf { - - -Plane::Halfspace Plane::intersects(const Aabb<3>& aabb) const -{ - Vector3 corners[8]; - int nPositive = 8; - - aabb.getCorners(corners); - - for (int i = 0; i < 8; ++i) - { - if (intersects(corners[i]) == NEGATIVE) - { - --nPositive; - } - } - - if (nPositive == 0) return NEGATIVE; - else if (nPositive == 8) return POSITIVE; - else return INTERSECT; -} - -Plane::Halfspace Plane::intersects(const Sphere<3>& sphere) const -{ - Scalar distance = getDistanceToPoint(sphere.point); - - if (distance < -sphere.radius) return NEGATIVE; - else if (distance < sphere.radius) return INTERSECT; - else return POSITIVE; -} - - -} // namespace Mf - diff --git a/src/Moof/Ray.hh b/src/Moof/Ray.hh deleted file mode 100644 index 6d4705a..0000000 --- a/src/Moof/Ray.hh +++ /dev/null @@ -1,79 +0,0 @@ - -/*] Copyright (c) 2009-2010, Charles McGarvey [************************** -**] All rights reserved. -* -* vi:ts=4 sw=4 tw=75 -* -* Distributable under the terms and conditions of the 2-clause BSD license; -* see the file COPYING for a complete text of the license. -* -**************************************************************************/ - -#ifndef _MOOF_RAY_HH_ -#define _MOOF_RAY_HH_ - -#include -#include -#include -#include - - -namespace Mf { - - -/** - * A line that goes to infinity. - */ - -template -struct Ray : public Drawable -{ - typedef cml::vector< Scalar, cml::fixed > Vector; - - // solution = point + t*direction - Vector point; - Vector direction; - - struct Contact - { - Scalar distance; // distance from the origin to the nearest point - Vector normal; // surface normal at contact point - - bool operator < (const Contact& rhs) - { - return distance < rhs.distance; - } - }; - - void solve(Vector& p, Scalar t) const - { - p = point + t*direction; - } - - void draw(Scalar alpha = 0.0) const - { - Vector end = point + 1000.0 * direction; - // FIXME this is kinda cheesy - - Mf::Texture::resetBind(); - glBegin(GL_LINES); - glVertex(point); - glVertex(end); - glEnd(); - } - - void normalize() - { - direction.normalize(); - } -}; - - -typedef Ray<2> Ray2; -typedef Ray<3> Ray3; - - -} // namespace Mf - -#endif // _MOOF_RAY_HH_ - diff --git a/src/Moof/Resource.hh b/src/Moof/Resource.hh deleted file mode 100644 index db6fe13..0000000 --- a/src/Moof/Resource.hh +++ /dev/null @@ -1,76 +0,0 @@ - -/*] Copyright (c) 2009-2010, Charles McGarvey [************************** -**] All rights reserved. -* -* vi:ts=4 sw=4 tw=75 -* -* Distributable under the terms and conditions of the 2-clause BSD license; -* see the file COPYING for a complete text of the license. -* -**************************************************************************/ - -#ifndef _MOOF_RESOURCE_HH_ -#define _MOOF_RESOURCE_HH_ - -/** - * @file Resource.hh - * Interface for textures, sounds, and other types of resources. - */ - -#include -#include -#include - - -namespace Mf { - - -/** - * Generic resource class. - */ - -class Resource -{ -public: - - virtual ~Resource() {} - - - /** - * Add a directory to search when looking for resource files. - * @param directory Path to a directory. - */ - - static void addSearchPaths(const std::string& paths); - static void addSearchPaths(const std::vector& pathList); - - /** - * Get the path to a resource of a given name. - * @param name Name of a resource. The name will be appended to each - * search directory in order. - * @return The first path found which resolves to a file. - */ - - static std::string getPath(const std::string& path, - const std::string& prefix = "", - const std::string& extension = ""); - - static bool getPath(std::string& path, - const std::string& prefix = "", - const std::string& extension = ""); - - static FILE* openFile(std::string& path, - std::string prefix = "", - const std::string& extension = "", - const std::string& mode = "rb"); - -private: - - static std::vector gSearchPaths; -}; - - -} // namespace Mf - -#endif // _MOOF_RESOURCE_HH_ - diff --git a/src/Moof/RigidBody.hh b/src/Moof/RigidBody.hh deleted file mode 100644 index ad6e33f..0000000 --- a/src/Moof/RigidBody.hh +++ /dev/null @@ -1,316 +0,0 @@ - -/*] Copyright (c) 2009-2010, Charles McGarvey [************************** -**] All rights reserved. -* -* vi:ts=4 sw=4 tw=75 -* -* Distributable under the terms and conditions of the 2-clause BSD license; -* see the file COPYING for a complete text of the license. -* -**************************************************************************/ - -#ifndef _MOOF_RIGIDBODY_HH_ -#define _MOOF_RIGIDBODY_HH_ - -#include - -#include -#include - -#include -#include - - -namespace Mf { - - -template -struct LinearState -{ - typedef cml::vector< Scalar, cml::fixed > Vector; - typedef boost::function - ForceFunction; - - // primary - - Vector position; - Vector momentum; - - // secondary - - Vector velocity; - - // user - - Vector force; - std::vector forces; - - // constant - - Scalar mass; - Scalar inverseMass; - - - void recalculateLinear() - { - velocity = momentum * inverseMass; - } - - - struct GravityForce - { - explicit GravityForce(Scalar a = -9.8) - { - force.zero(); - acceleration = a; - } - - const Vector& operator () (const LinearState& state) - { - force[1] = state.mass * acceleration; - return force; - } - - private: - - Vector force; - Scalar acceleration; - }; - - - void init() - { - position.zero(); - momentum.zero(); - - velocity.zero(); - - force.zero(); - forces.clear(); - - mass = SCALAR(1.0); - inverseMass = 1.0 / mass; - } - - - struct Derivative - { - Vector velocity; - Vector force; - - Derivative operator*(Scalar dt) const - { - Derivative derivative; - derivative.velocity = dt * velocity; - derivative.force = dt * force; - return derivative; - } - - Derivative operator+(const Derivative& other) const - { - Derivative derivative; - derivative.velocity = velocity + other.velocity; - derivative.force = force + other.force; - return derivative; - } - }; - - - Vector getForce() const - { - Vector f(force); - - for (size_t i = 0; i < forces.size(); ++i) - { - f += forces[i](*this); - } - - return f; - } - - void getDerivative(Derivative& derivative, Scalar t) const - { - derivative.velocity = velocity; - derivative.force = getForce(); - } - - void step(const Derivative& derivative, Scalar dt) - { - position += dt * derivative.velocity; - momentum += dt * derivative.force; - recalculateLinear(); - } -}; - - -struct RotationalState2 -{ - // primary - - Scalar orientation; - Scalar angularMomentum; - - // secondary - - Scalar angularVelocity; - - // constant - - Scalar inertia; - Scalar inverseInertia; - - - void recalculateRotational() - { - angularVelocity = angularMomentum * inertia; - } - - - struct Derivative - { - Scalar angularVelocity; - Scalar torque; - }; - - void step(const Derivative& derivative, Scalar dt) - { - orientation += dt * derivative.angularVelocity; - angularMomentum += dt * derivative.torque; - recalculateRotational(); - } -}; - -struct RotationalState3 -{ - // primary - - Quaternion orientation; - Vector3 angularMomentum; - - // secondary - - Quaternion spin; - Vector3 angularVelocity; - - // constant - - Scalar inertia; - Scalar inverseInertia; - - - void recalculateRotational() - { - angularVelocity = angularMomentum * inertia; - } -}; - - -struct State2 : public LinearState<2>, public RotationalState2 -{ - void recalculate() - { - recalculateLinear(); - recalculateRotational(); - } - - void update(Scalar t, Scalar dt) - { - rk4,LinearState<2>::Derivative>(*this, t, dt); - } -}; - -struct State3 : public LinearState<3>, public RotationalState3 -{ - void recalculate() - { - recalculateLinear(); - recalculateRotational(); - } - - void update(Scalar t, Scalar dt) - { - rk4,LinearState<3>::Derivative>(*this, t, dt); - } -}; - - -template -inline T interpolate(const T& a, const T& b, Scalar alpha) -{ - return cml::lerp(a, b, alpha); -} - -template <> -inline State2 interpolate(const State2& a, const State2& b, - Scalar alpha) -{ - State2 state(b); - state.position = interpolate(a.position, b.position, alpha); - state.momentum = interpolate(a.momentum, b.momentum, alpha); - state.orientation = interpolate(a.orientation, b.orientation, alpha); - state.angularMomentum = interpolate(a.angularMomentum, - b.angularMomentum, alpha); - return state; -} - -template <> -inline State3 interpolate(const State3& a, const State3& b, - Scalar alpha) -{ - State3 state(b); - state.position = interpolate(a.position, b.position, alpha); - state.momentum = interpolate(a.momentum, b.momentum, alpha); - state.orientation = cml::slerp(a.orientation, b.orientation, alpha); - state.angularMomentum = interpolate(a.angularMomentum, - b.angularMomentum, alpha); - return state; -} - - - -/** - * Interface for anything that can move. - */ - -template -class RigidBody : public Entity -{ -protected: - - T mState; - T mPrevState; - -public: - - virtual ~RigidBody() {} - - virtual void update(Scalar t, Scalar dt) - { - mPrevState = mState; - mState.update(t, dt); - } - - const T& getState() const - { - return mState; - } - - T getState(Scalar alpha) const - { - return interpolate(mPrevState, mState, alpha); - } - - const T& getLastState() const - { - return mPrevState; - } -}; - -typedef RigidBody RigidBody2; -typedef RigidBody RigidBody3; - - -} // namespace Mf - -#endif // _MOOF_RIGIDBODY_HH_ - diff --git a/src/Moof/Script.hh b/src/Moof/Script.hh deleted file mode 100644 index 974dce7..0000000 --- a/src/Moof/Script.hh +++ /dev/null @@ -1,1055 +0,0 @@ - -/*] Copyright (c) 2009-2010, Charles McGarvey [************************** -**] All rights reserved. -* -* vi:ts=4 sw=4 tw=75 -* -* Distributable under the terms and conditions of the 2-clause BSD license; -* see the file COPYING for a complete text of the license. -* -**************************************************************************/ - -#ifndef _MOOF_SCRIPT_HH_ -#define _MOOF_SCRIPT_HH_ - -/** - * @file Script.hh - * A thin wrapper over Lua. This is not meant as a complicated binding - * package between C++ and Lua. It is not meant to obscure the division - * between C++ and Lua but rather to clarify it and make it more - * manageable. It does not hide the concept of the Lua stack, but rather - * provides that mechanism with a certain level of abstraction while also - * providing a cleaner, more consistent API. - */ - -#include -#include -#include -#include -#include - -#include -#include -#include -#include - - -namespace Mf { - - -class Script; -typedef boost::shared_ptr