From dd22bd15f6ed3e5eb5c77ab427029be50fe20148 Mon Sep 17 00:00:00 2001 From: Dimitri John Ledkov Date: Tue, 24 Jun 2014 20:05:13 +0100 Subject: libavg (1.8.1-1) unstable; urgency=medium * New upstream release (Closes: #739664) * Mark libdc1394-22-dev as linux-any build-dependency. * Add libvdpau-dev build-dependency. * Add libavresample-dev build-dependency. # imported from the archive --- BuildMacDeps.sh | 139 + COPYING | 504 + CreateVersionFile.py | 212 + Makefile.am | 11 + NEWS | 452 + bootstrap | 33 + compile | 99 + configure.ac | 232 + debian/avg_audioplayer.1 | 11 + debian/avg_checktouch.1 | 11 + debian/avg_checkvsync.1 | 11 + debian/avg_chromakey.1 | 39 + debian/avg_showcamera.1 | 54 + debian/avg_showfile.1 | 11 + debian/avg_showfont.1 | 19 + debian/avg_showsvg.1 | 17 + debian/avg_videoinfo.1 | 29 + debian/avg_videoplayer.1 | 11 + debian/changelog | 500 + debian/compat | 1 + debian/control | 39 + debian/copyright | 45 + debian/install | 2 + debian/libavg.pth | 1 + debian/links | 1 + debian/patches/foreign.patch | 19 + debian/patches/series | 1 + debian/python-libavg.examples | 5 + debian/rules | 18 + debian/source/format | 1 + debian/watch | 2 + depcomp | 472 + fixcopyright.py | 32 + install-sh | 294 + m4/ac_cxx_namespaces.m4 | 27 + m4/ac_path_generic.m4 | 140 + m4/avg_version.m4 | 3 + m4/ax_boost_thread.m4 | 72 + m4/ax_check_define.m4 | 90 + m4/ax_check_gl.m4 | 335 + m4/ax_python_devel.m4 | 312 + m4/pkg.m4 | 114 + mac/MakeDist.sh | 89 + mac/PackDeps.sh | 12 + mac/UnpackDeps.sh | 48 + mac/avg_env.sh | 33 + mac/dc1394_mavericks.patch | 77 + mac/fontconfig-disablecache.patch | 12 + mac/fontconfig.pc.in.patch | 4 + mac/freetype_linespacing.patch | 13 + mac/gcc-fat.sh | 113 + mac/glib.patch | 4 + mac/installscripts/background.tif | Bin 0 -> 73280 bytes mac/installscripts/postflight | 17 + mac/libavg.10.6.pmdoc/01dist-contents.xml | 1 + mac/libavg.10.6.pmdoc/01dist.xml | 1 + mac/libavg.10.6.pmdoc/02bindist-contents.xml | 1 + mac/libavg.10.6.pmdoc/02bindist.xml | 1 + mac/libavg.10.6.pmdoc/index.xml | 1 + mac/librsvg_configure.patch | 17 + mac/librsvg_makefile.patch | 11 + mac/libsdl_mavericks.patch | 11 + mac/libtool.m4.patch | 20 + mac/pkg-config-mavericks.patch | 6 + mac/readme.txt | 3 + mac/stpncpy.patch | 13 + mac/welcome.txt | 3 + makedocs.sh | 6 + man/Makefile.am | 3 + man/avg_audioplayer.1 | 11 + man/avg_chromakey.1 | 39 + man/avg_showcamera.1 | 54 + man/avg_showfile.1 | 11 + man/avg_showfont.1 | 19 + man/avg_videoinfo.1 | 29 + man/avg_videoplayer.1 | 11 + man/avgrc.5 | 33 + missing | 336 + mkinstalldirs | 111 + sphinxdoc/ButtonStates.png | Bin 0 -> 14193 bytes sphinxdoc/Recognizer.graffle | 1780 +++ sphinxdoc/Recognizer.png | Bin 0 -> 35806 bytes sphinxdoc/ToggleButtonStates.png | Bin 0 -> 43048 bytes sphinxdoc/animation.rst | 252 + sphinxdoc/app.rst | 217 + sphinxdoc/areanodes.rst | 831 ++ sphinxdoc/basenodes.rst | 382 + sphinxdoc/conf.py | 223 + sphinxdoc/events.rst | 428 + sphinxdoc/fx.rst | 140 + sphinxdoc/gesture.rst | 347 + sphinxdoc/index.rst | 31 + sphinxdoc/misc.rst | 685 ++ sphinxdoc/player.rst | 629 + sphinxdoc/vectornodes.rst | 224 + sphinxdoc/widget.rst | 591 + src/Makefile.am | 16 + src/addcopyright.py | 22 + src/anim/Anim.cpp | 123 + src/anim/Anim.h | 90 + src/anim/AttrAnim.cpp | 103 + src/anim/AttrAnim.h | 92 + src/anim/ContinuousAnim.cpp | 91 + src/anim/ContinuousAnim.h | 59 + src/anim/EaseInOutAnim.cpp | 71 + src/anim/EaseInOutAnim.h | 55 + src/anim/LinearAnim.cpp | 73 + src/anim/LinearAnim.h | 60 + src/anim/Makefile.am | 9 + src/anim/ParallelAnim.cpp | 113 + src/anim/ParallelAnim.h | 64 + src/anim/SimpleAnim.cpp | 182 + src/anim/SimpleAnim.h | 79 + src/anim/StateAnim.cpp | 123 + src/anim/StateAnim.h | 69 + src/anim/WaitAnim.cpp | 69 + src/anim/WaitAnim.h | 57 + src/api.h | 50 + src/audio/AudioBuffer.cpp | 105 + src/audio/AudioBuffer.h | 61 + src/audio/AudioEngine.cpp | 295 + src/audio/AudioEngine.h | 94 + src/audio/AudioMsg.cpp | 165 + src/audio/AudioMsg.h | 85 + src/audio/AudioParams.cpp | 40 + src/audio/AudioParams.h | 39 + src/audio/AudioSource.cpp | 156 + src/audio/AudioSource.h | 66 + src/audio/Dynamics.h | 343 + src/audio/IProcessor.h | 37 + src/audio/Makefile.am | 17 + src/audio/testlimiter.cpp | 112 + src/avgconfig_win.h | 28 + src/avgconfigwrapper.h | 37 + src/avgrc | 42 + src/base/Backtrace.cpp | 120 + src/base/Backtrace.h | 36 + src/base/BezierCurve.cpp | 56 + src/base/BezierCurve.h | 56 + src/base/CmdQueue.h | 56 + src/base/Command.h | 56 + src/base/ConfigMgr.cpp | 361 + src/base/ConfigMgr.h | 93 + src/base/CubicSpline.cpp | 104 + src/base/CubicSpline.h | 56 + src/base/DAG.cpp | 130 + src/base/DAG.h | 64 + src/base/DirEntry.cpp | 65 + src/base/DirEntry.h | 67 + src/base/Directory.cpp | 135 + src/base/Directory.h | 64 + src/base/DlfcnWrapper.cpp | 61 + src/base/DlfcnWrapper.h | 41 + src/base/Exception.cpp | 99 + src/base/Exception.h | 88 + src/base/FileHelper.cpp | 164 + src/base/FileHelper.h | 53 + src/base/GLMHelper.cpp | 183 + src/base/GLMHelper.h | 70 + src/base/GeomHelper.cpp | 178 + src/base/GeomHelper.h | 51 + src/base/IFrameEndListener.h | 37 + src/base/ILogSink.h | 53 + src/base/IPlaybackEndListener.h | 38 + src/base/IPreRenderListener.h | 35 + src/base/Logger.cpp | 280 + src/base/Logger.h | 154 + src/base/Makefile.am | 35 + src/base/MathHelper.cpp | 78 + src/base/MathHelper.h | 93 + src/base/OSHelper.cpp | 308 + src/base/OSHelper.h | 52 + src/base/ObjectCounter.cpp | 187 + src/base/ObjectCounter.h | 61 + src/base/ProfilingZone.cpp | 91 + src/base/ProfilingZone.h | 69 + src/base/ProfilingZoneID.cpp | 57 + src/base/ProfilingZoneID.h | 50 + src/base/Queue.h | 160 + src/base/Rect.h | 213 + src/base/ScopeTimer.cpp | 35 + src/base/ScopeTimer.h | 60 + src/base/Signal.h | 119 + src/base/StandardLogSink.cpp | 54 + src/base/StandardLogSink.h | 39 + src/base/StringHelper.cpp | 145 + src/base/StringHelper.h | 133 + src/base/Test.cpp | 114 + src/base/Test.h | 81 + src/base/TestSuite.cpp | 72 + src/base/TestSuite.h | 49 + src/base/ThreadHelper.cpp | 94 + src/base/ThreadHelper.h | 37 + src/base/ThreadProfiler.cpp | 184 + src/base/ThreadProfiler.h | 88 + src/base/TimeSource.cpp | 128 + src/base/TimeSource.h | 60 + src/base/Triangle.cpp | 105 + src/base/Triangle.h | 52 + src/base/UTF8String.cpp | 62 + src/base/UTF8String.h | 46 + src/base/WideLine.cpp | 53 + src/base/WideLine.h | 48 + src/base/WorkerThread.cpp | 41 + src/base/WorkerThread.h | 169 + src/base/XMLHelper.cpp | 225 + src/base/XMLHelper.h | 78 + src/base/testbase.cpp | 1024 ++ src/base/triangulate/AdvancingFront.cpp | 104 + src/base/triangulate/AdvancingFront.h | 118 + src/base/triangulate/Makefile.am | 8 + src/base/triangulate/Shapes.cpp | 353 + src/base/triangulate/Shapes.h | 296 + src/base/triangulate/Sweep.cpp | 796 ++ src/base/triangulate/Sweep.h | 201 + src/base/triangulate/SweepContext.cpp | 196 + src/base/triangulate/SweepContext.h | 181 + src/base/triangulate/Triangulate.cpp | 90 + src/base/triangulate/Triangulate.h | 33 + src/base/triangulate/Utils.h | 124 + src/glm/CMakeLists.txt | 43 + src/glm/core/_detail.hpp | 356 + src/glm/core/_fixes.hpp | 18 + src/glm/core/_swizzle.hpp | 1085 ++ src/glm/core/dummy.cpp | 20 + src/glm/core/func_common.hpp | 337 + src/glm/core/func_common.inl | 1577 +++ src/glm/core/func_exponential.hpp | 86 + src/glm/core/func_exponential.inl | 358 + src/glm/core/func_geometric.hpp | 108 + src/glm/core/func_geometric.inl | 290 + src/glm/core/func_integer.hpp | 158 + src/glm/core/func_integer.inl | 597 + src/glm/core/func_matrix.hpp | 111 + src/glm/core/func_matrix.inl | 571 + src/glm/core/func_noise.hpp | 62 + src/glm/core/func_noise.inl | 21 + src/glm/core/func_packing.hpp | 132 + src/glm/core/func_packing.inl | 94 + src/glm/core/func_trigonometric.hpp | 156 + src/glm/core/func_trigonometric.inl | 745 ++ src/glm/core/func_vector_relational.hpp | 215 + src/glm/core/func_vector_relational.inl | 20 + src/glm/core/hint.hpp | 21 + src/glm/core/intrinsic_common.hpp | 70 + src/glm/core/intrinsic_common.inl | 283 + src/glm/core/intrinsic_exponential.hpp | 60 + src/glm/core/intrinsic_exponential.inl | 0 src/glm/core/intrinsic_geometric.hpp | 57 + src/glm/core/intrinsic_geometric.inl | 123 + src/glm/core/intrinsic_matrix.hpp | 50 + src/glm/core/intrinsic_matrix.inl | 1051 ++ src/glm/core/intrinsic_trigonometric.hpp | 29 + src/glm/core/intrinsic_trigonometric.inl | 0 src/glm/core/intrinsic_vector_relational.hpp | 29 + src/glm/core/intrinsic_vector_relational.inl | 347 + src/glm/core/setup.hpp | 480 + src/glm/core/type.hpp | 322 + src/glm/core/type_float.hpp | 74 + src/glm/core/type_gentype.hpp | 150 + src/glm/core/type_gentype.inl | 347 + src/glm/core/type_half.hpp | 78 + src/glm/core/type_half.inl | 357 + src/glm/core/type_int.hpp | 109 + src/glm/core/type_mat.hpp | 56 + src/glm/core/type_mat.inl | 0 src/glm/core/type_mat2x2.hpp | 281 + src/glm/core/type_mat2x2.inl | 648 ++ src/glm/core/type_mat2x3.hpp | 227 + src/glm/core/type_mat2x3.inl | 583 + src/glm/core/type_mat2x4.hpp | 225 + src/glm/core/type_mat2x4.inl | 611 + src/glm/core/type_mat3x2.hpp | 231 + src/glm/core/type_mat3x2.inl | 623 + src/glm/core/type_mat3x3.hpp | 283 + src/glm/core/type_mat3x3.inl | 750 ++ src/glm/core/type_mat3x4.hpp | 232 + src/glm/core/type_mat3x4.inl | 653 ++ src/glm/core/type_mat4x2.hpp | 242 + src/glm/core/type_mat4x2.inl | 670 ++ src/glm/core/type_mat4x3.hpp | 240 + src/glm/core/type_mat4x3.inl | 675 ++ src/glm/core/type_mat4x4.hpp | 286 + src/glm/core/type_mat4x4.inl | 840 ++ src/glm/core/type_size.hpp | 24 + src/glm/core/type_vec.hpp | 22 + src/glm/core/type_vec.inl | 0 src/glm/core/type_vec1.hpp | 172 + src/glm/core/type_vec1.inl | 884 ++ src/glm/core/type_vec2.hpp | 263 + src/glm/core/type_vec2.inl | 1010 ++ src/glm/core/type_vec3.hpp | 269 + src/glm/core/type_vec3.inl | 1097 ++ src/glm/core/type_vec4.hpp | 282 + src/glm/core/type_vec4.inl | 1226 ++ src/glm/ext.hpp | 97 + src/glm/glm.hpp | 93 + src/glm/gtc/half_float.hpp | 401 + src/glm/gtc/half_float.inl | 975 ++ src/glm/gtc/matrix_access.hpp | 70 + src/glm/gtc/matrix_access.inl | 59 + src/glm/gtc/matrix_integer.hpp | 204 + src/glm/gtc/matrix_inverse.hpp | 51 + src/glm/gtc/matrix_inverse.inl | 139 + src/glm/gtc/matrix_transform.hpp | 158 + src/glm/gtc/matrix_transform.inl | 397 + src/glm/gtc/quaternion.hpp | 245 + src/glm/gtc/quaternion.inl | 584 + src/glm/gtc/swizzle.hpp | 354 + src/glm/gtc/swizzle.inl | 177 + src/glm/gtc/type_precision.hpp | 220 + src/glm/gtc/type_precision.inl | 13 + src/glm/gtc/type_ptr.hpp | 449 + src/glm/gtc/type_ptr.inl | 0 src/glm/gtx/associated_min_max.hpp | 82 + src/glm/gtx/associated_min_max.inl | 916 ++ src/glm/gtx/bit.hpp | 107 + src/glm/gtx/bit.inl | 743 ++ src/glm/gtx/closest_point.hpp | 47 + src/glm/gtx/closest_point.inl | 41 + src/glm/gtx/color_cast.hpp | 107 + src/glm/gtx/color_cast.inl | 739 ++ src/glm/gtx/color_space.hpp | 77 + src/glm/gtx/color_space.inl | 154 + src/glm/gtx/color_space_YCoCg.hpp | 65 + src/glm/gtx/color_space_YCoCg.inl | 69 + src/glm/gtx/compatibility.hpp | 170 + src/glm/gtx/compatibility.inl | 141 + src/glm/gtx/component_wise.hpp | 63 + src/glm/gtx/component_wise.inl | 52 + src/glm/gtx/epsilon.hpp | 59 + src/glm/gtx/epsilon.inl | 234 + src/glm/gtx/euler_angles.hpp | 141 + src/glm/gtx/euler_angles.inl | 249 + src/glm/gtx/extend.hpp | 47 + src/glm/gtx/extend.inl | 60 + src/glm/gtx/extented_min_max.hpp | 175 + src/glm/gtx/extented_min_max.inl | 182 + src/glm/gtx/fast_exponential.hpp | 81 + src/glm/gtx/fast_exponential.inl | 294 + src/glm/gtx/fast_square_root.hpp | 68 + src/glm/gtx/fast_square_root.inl | 237 + src/glm/gtx/fast_trigonometry.hpp | 81 + src/glm/gtx/fast_trigonometry.inl | 272 + src/glm/gtx/gradient_paint.hpp | 55 + src/glm/gtx/gradient_paint.inl | 44 + src/glm/gtx/handed_coordinate_space.hpp | 55 + src/glm/gtx/handed_coordinate_space.inl | 34 + src/glm/gtx/inertia.hpp | 95 + src/glm/gtx/inertia.inl | 103 + src/glm/gtx/int_10_10_10_2.hpp | 47 + src/glm/gtx/int_10_10_10_2.inl | 21 + src/glm/gtx/integer.hpp | 56 + src/glm/gtx/integer.inl | 91 + src/glm/gtx/intersect.hpp | 73 + src/glm/gtx/intersect.inl | 201 + src/glm/gtx/log_base.hpp | 47 + src/glm/gtx/log_base.inl | 92 + src/glm/gtx/matrix_cross_product.hpp | 51 + src/glm/gtx/matrix_cross_product.inl | 44 + src/glm/gtx/matrix_interpolation.hpp | 66 + src/glm/gtx/matrix_interpolation.inl | 117 + src/glm/gtx/matrix_major_storage.hpp | 123 + src/glm/gtx/matrix_major_storage.inl | 176 + src/glm/gtx/matrix_operation.hpp | 93 + src/glm/gtx/matrix_operation.inl | 129 + src/glm/gtx/matrix_query.hpp | 95 + src/glm/gtx/matrix_query.inl | 144 + src/glm/gtx/mixed_product.hpp | 46 + src/glm/gtx/mixed_product.inl | 36 + src/glm/gtx/multiple.hpp | 53 + src/glm/gtx/multiple.inl | 191 + src/glm/gtx/noise.hpp | 63 + src/glm/gtx/noise.inl | 792 ++ src/glm/gtx/norm.hpp | 143 + src/glm/gtx/norm.inl | 130 + src/glm/gtx/normal.hpp | 47 + src/glm/gtx/normal.inl | 27 + src/glm/gtx/normalize_dot.hpp | 59 + src/glm/gtx/normalize_dot.inl | 120 + src/glm/gtx/number_precision.hpp | 69 + src/glm/gtx/number_precision.inl | 13 + src/glm/gtx/ocl_type.hpp | 110 + src/glm/gtx/ocl_type.inl | 0 src/glm/gtx/optimum_pow.hpp | 70 + src/glm/gtx/optimum_pow.inl | 63 + src/glm/gtx/orthonormalize.hpp | 52 + src/glm/gtx/orthonormalize.inl | 49 + src/glm/gtx/perpendicular.hpp | 62 + src/glm/gtx/perpendicular.inl | 40 + src/glm/gtx/polar_coordinates.hpp | 49 + src/glm/gtx/polar_coordinates.inl | 42 + src/glm/gtx/projection.hpp | 60 + src/glm/gtx/projection.inl | 40 + src/glm/gtx/quaternion.hpp | 217 + src/glm/gtx/quaternion.inl | 303 + src/glm/gtx/random.hpp | 89 + src/glm/gtx/random.inl | 536 + src/glm/gtx/raw_data.hpp | 58 + src/glm/gtx/raw_data.inl | 11 + src/glm/gtx/reciprocal.hpp | 99 + src/glm/gtx/reciprocal.inl | 593 + src/glm/gtx/rotate_vector.hpp | 114 + src/glm/gtx/rotate_vector.inl | 149 + src/glm/gtx/simd_mat4.hpp | 183 + src/glm/gtx/simd_mat4.inl | 309 + src/glm/gtx/simd_vec4.hpp | 474 + src/glm/gtx/simd_vec4.inl | 730 ++ src/glm/gtx/simplex.hpp | 70 + src/glm/gtx/simplex.inl | 0 src/glm/gtx/spline.hpp | 73 + src/glm/gtx/spline.inl | 74 + src/glm/gtx/std_based_type.hpp | 72 + src/glm/gtx/std_based_type.inl | 13 + src/glm/gtx/string_cast.hpp | 57 + src/glm/gtx/string_cast.inl | 597 + src/glm/gtx/transform.hpp | 103 + src/glm/gtx/transform.inl | 94 + src/glm/gtx/transform2.hpp | 118 + src/glm/gtx/transform2.inl | 159 + src/glm/gtx/ulp.hpp | 70 + src/glm/gtx/ulp.inl | 396 + src/glm/gtx/unsigned_int.hpp | 59 + src/glm/gtx/unsigned_int.inl | 45 + src/glm/gtx/vec1.hpp | 121 + src/glm/gtx/vec1.inl | 0 src/glm/gtx/vector_access.hpp | 66 + src/glm/gtx/vector_access.inl | 58 + src/glm/gtx/vector_angle.hpp | 72 + src/glm/gtx/vector_angle.inl | 58 + src/glm/gtx/vector_query.hpp | 95 + src/glm/gtx/vector_query.inl | 174 + src/glm/gtx/verbose_operator.hpp | 64 + src/glm/gtx/verbose_operator.inl | 129 + src/glm/gtx/wrap.hpp | 54 + src/glm/gtx/wrap.inl | 173 + src/glm/virtrev/xstream.hpp | 148 + src/graphics/AppleDisplay.cpp | 75 + src/graphics/AppleDisplay.h | 46 + src/graphics/BCMDisplay.cpp | 142 + src/graphics/BCMDisplay.h | 45 + src/graphics/Bitmap.cpp | 1814 +++ src/graphics/Bitmap.h | 186 + src/graphics/BitmapLoader.cpp | 156 + src/graphics/BitmapLoader.h | 55 + src/graphics/BmpTextureMover.cpp | 111 + src/graphics/BmpTextureMover.h | 54 + src/graphics/CGLContext.cpp | 114 + src/graphics/CGLContext.h | 56 + src/graphics/ContribDefs.h | 75 + src/graphics/Display.cpp | 136 + src/graphics/Display.h | 71 + src/graphics/EGLContext.cpp | 202 + src/graphics/EGLContext.h | 61 + src/graphics/FBO.cpp | 410 + src/graphics/FBO.h | 97 + src/graphics/Filter.cpp | 55 + src/graphics/Filter.h | 56 + src/graphics/Filter3x3.cpp | 68 + src/graphics/Filter3x3.h | 82 + src/graphics/FilterBandpass.cpp | 77 + src/graphics/FilterBandpass.h | 52 + src/graphics/FilterBlur.cpp | 69 + src/graphics/FilterBlur.h | 45 + src/graphics/FilterConvol.h | 141 + src/graphics/FilterDilation.cpp | 71 + src/graphics/FilterDilation.h | 45 + src/graphics/FilterErosion.cpp | 71 + src/graphics/FilterErosion.h | 45 + src/graphics/FilterFastBandpass.cpp | 92 + src/graphics/FilterFastBandpass.h | 46 + src/graphics/FilterFastDownscale.cpp | 98 + src/graphics/FilterFastDownscale.h | 47 + src/graphics/FilterFloodfill.h | 165 + src/graphics/FilterGauss.cpp | 203 + src/graphics/FilterGauss.h | 52 + src/graphics/FilterGetAlpha.cpp | 66 + src/graphics/FilterGetAlpha.h | 45 + src/graphics/FilterHighpass.cpp | 94 + src/graphics/FilterHighpass.h | 46 + src/graphics/FilterIntensity.cpp | 56 + src/graphics/FilterIntensity.h | 45 + src/graphics/FilterMask.cpp | 84 + src/graphics/FilterMask.h | 45 + src/graphics/FilterNormalize.cpp | 55 + src/graphics/FilterNormalize.h | 44 + src/graphics/FilterResizeBilinear.cpp | 77 + src/graphics/FilterResizeBilinear.h | 39 + src/graphics/FilterResizeGaussian.cpp | 78 + src/graphics/FilterResizeGaussian.h | 41 + src/graphics/FilterThreshold.cpp | 61 + src/graphics/FilterThreshold.h | 44 + src/graphics/FilterUnmultiplyAlpha.cpp | 96 + src/graphics/FilterUnmultiplyAlpha.h | 43 + src/graphics/Filtercolorize.cpp | 145 + src/graphics/Filtercolorize.h | 48 + src/graphics/Filterfill.h | 68 + src/graphics/Filterfillrect.h | 75 + src/graphics/Filterflip.cpp | 54 + src/graphics/Filterflip.h | 43 + src/graphics/FilterflipX.cpp | 78 + src/graphics/FilterflipX.h | 43 + src/graphics/Filterfliprgb.cpp | 92 + src/graphics/Filterfliprgb.h | 45 + src/graphics/Filterfliprgba.cpp | 56 + src/graphics/Filterfliprgba.h | 44 + src/graphics/Filterflipuv.cpp | 53 + src/graphics/Filterflipuv.h | 44 + src/graphics/Filtergrayscale.cpp | 80 + src/graphics/Filtergrayscale.h | 45 + src/graphics/GL/gl.h | 2262 ++++ src/graphics/GL/glext.h | 11489 +++++++++++++++++++ src/graphics/GL/glu.h | 341 + src/graphics/GL/glx.h | 552 + src/graphics/GL/wglext.h | 943 ++ src/graphics/GLBufferCache.cpp | 73 + src/graphics/GLBufferCache.h | 55 + src/graphics/GLConfig.cpp | 83 + src/graphics/GLConfig.h | 52 + src/graphics/GLContext.cpp | 656 ++ src/graphics/GLContext.h | 156 + src/graphics/GLContextAttribs.cpp | 67 + src/graphics/GLContextAttribs.h | 44 + src/graphics/GLShaderParam.cpp | 87 + src/graphics/GLShaderParam.h | 128 + src/graphics/GLTexture.cpp | 370 + src/graphics/GLTexture.h | 98 + src/graphics/GLXContext.cpp | 265 + src/graphics/GLXContext.h | 65 + src/graphics/GPUBandpassFilter.cpp | 78 + src/graphics/GPUBandpassFilter.h | 56 + src/graphics/GPUBlurFilter.cpp | 122 + src/graphics/GPUBlurFilter.h | 68 + src/graphics/GPUBrightnessFilter.cpp | 64 + src/graphics/GPUBrightnessFilter.h | 50 + src/graphics/GPUChromaKeyFilter.cpp | 137 + src/graphics/GPUChromaKeyFilter.h | 74 + src/graphics/GPUFilter.cpp | 287 + src/graphics/GPUFilter.h | 89 + src/graphics/GPUHueSatFilter.cpp | 77 + src/graphics/GPUHueSatFilter.h | 59 + src/graphics/GPUInvertFilter.cpp | 56 + src/graphics/GPUInvertFilter.h | 49 + src/graphics/GPUNullFilter.cpp | 61 + src/graphics/GPUNullFilter.h | 48 + src/graphics/GPURGB2YUVFilter.cpp | 68 + src/graphics/GPURGB2YUVFilter.h | 48 + src/graphics/GPUShadowFilter.cpp | 136 + src/graphics/GPUShadowFilter.h | 76 + src/graphics/GraphicsTest.cpp | 142 + src/graphics/GraphicsTest.h | 52 + src/graphics/HistoryPreProcessor.cpp | 157 + src/graphics/HistoryPreProcessor.h | 89 + src/graphics/ImagingProjection.cpp | 91 + src/graphics/ImagingProjection.h | 66 + src/graphics/Makefile.am | 95 + src/graphics/OGLHelper.cpp | 440 + src/graphics/OGLHelper.h | 253 + src/graphics/OGLShader.cpp | 206 + src/graphics/OGLShader.h | 101 + src/graphics/PBO.cpp | 245 + src/graphics/PBO.h | 74 + src/graphics/Pixel16.h | 180 + src/graphics/Pixel24.h | 190 + src/graphics/Pixel32.cpp | 134 + src/graphics/Pixel32.h | 208 + src/graphics/Pixel8.h | 150 + src/graphics/PixelFormat.cpp | 288 + src/graphics/PixelFormat.h | 66 + src/graphics/Pixeldefs.h | 29 + src/graphics/ShaderRegistry.cpp | 193 + src/graphics/ShaderRegistry.h | 73 + src/graphics/StandardShader.cpp | 216 + src/graphics/StandardShader.h | 106 + src/graphics/SubVertexArray.cpp | 103 + src/graphics/SubVertexArray.h | 75 + src/graphics/TextureMover.cpp | 79 + src/graphics/TextureMover.h | 71 + src/graphics/TwoPassScale.h | 355 + src/graphics/VertexArray.cpp | 159 + src/graphics/VertexArray.h | 69 + src/graphics/VertexData.cpp | 253 + src/graphics/VertexData.h | 100 + src/graphics/WGLContext.cpp | 184 + src/graphics/WGLContext.h | 56 + src/graphics/WinDisplay.cpp | 61 + src/graphics/WinDisplay.h | 45 + src/graphics/X11Display.cpp | 124 + src/graphics/X11Display.h | 59 + src/graphics/baseline/BandpassResult.png | Bin 0 -> 2864 bytes src/graphics/baseline/BlurResult.png | Bin 0 -> 2809 bytes src/graphics/baseline/ChromaKeyMedianResult.png | Bin 0 -> 607 bytes src/graphics/baseline/ChromaKeyResult0.png | Bin 0 -> 410 bytes src/graphics/baseline/ChromaKeyResult1.png | Bin 0 -> 503 bytes src/graphics/baseline/ChromaKeyResult2.png | Bin 0 -> 497 bytes src/graphics/baseline/ChromaKeySpillResult1.png | Bin 0 -> 370 bytes src/graphics/baseline/ChromaKeySpillResult2.png | Bin 0 -> 335 bytes src/graphics/baseline/ChromaKeySpillResult3.png | Bin 0 -> 353 bytes src/graphics/baseline/DilationResult.png | Bin 0 -> 88 bytes src/graphics/baseline/ErosionResult.png | Bin 0 -> 82 bytes src/graphics/baseline/FastBandpassResult.png | Bin 0 -> 2859 bytes src/graphics/baseline/FastDownscaleResult.png | Bin 0 -> 69 bytes src/graphics/baseline/FloodfillResult.png | Bin 0 -> 121 bytes src/graphics/baseline/Gauss15Result.png | Bin 0 -> 89 bytes src/graphics/baseline/Gauss1Result.png | Bin 0 -> 81 bytes src/graphics/baseline/Gauss3Result.png | Bin 0 -> 96 bytes src/graphics/baseline/Gauss5Result.png | Bin 0 -> 95 bytes src/graphics/baseline/GetAlphaResult.png | Bin 0 -> 1235 bytes src/graphics/baseline/HighpassResult.png | Bin 0 -> 100 bytes src/graphics/baseline/HslColorizeResult0.png | Bin 0 -> 3232 bytes src/graphics/baseline/HslColorizeResult1.png | Bin 0 -> 3286 bytes src/graphics/baseline/HslColorizeResult2.png | Bin 0 -> 3223 bytes src/graphics/baseline/HslHueResult0.png | Bin 0 -> 3131 bytes src/graphics/baseline/HslHueResult1.png | Bin 0 -> 3201 bytes src/graphics/baseline/HslHueResult2.png | Bin 0 -> 3218 bytes src/graphics/baseline/LineResultB8G8R8.png | Bin 0 -> 2848 bytes src/graphics/baseline/LineResultB8G8R8A8.png | Bin 0 -> 2863 bytes src/graphics/baseline/LineResultI8.png | Bin 0 -> 2855 bytes src/graphics/baseline/MaskResultB8G8R8.png | Bin 0 -> 89 bytes src/graphics/baseline/MaskResultB8G8R8X8.png | Bin 0 -> 89 bytes src/graphics/baseline/MaskResultI8.png | Bin 0 -> 73 bytes .../baseline/ResizeBilinearResultB8G8R8.png | Bin 0 -> 876 bytes .../baseline/ResizeBilinearResultB8G8R8A8.png | Bin 0 -> 1288 bytes .../baseline/ResizeBilinearResultB8G8R8X8.png | Bin 0 -> 812 bytes src/graphics/baseline/ThresholdResult.png | Bin 0 -> 73 bytes src/graphics/baseline/YUV2RGBResult1.png | Bin 0 -> 203 bytes src/graphics/baseline/bandpass_i8-64x64.png | Bin 0 -> 1160 bytes src/graphics/baseline/bandpass_spike.png | Bin 0 -> 293 bytes src/graphics/baseline/blur05_flat.png | Bin 0 -> 1312 bytes src/graphics/baseline/blur05_spike.png | Bin 0 -> 118 bytes src/graphics/baseline/blur1_spike.png | Bin 0 -> 177 bytes src/graphics/baseline/blur3_spike.png | Bin 0 -> 197 bytes src/graphics/baseline/blur_rgb24-64x64.png | Bin 0 -> 3659 bytes src/graphics/baseline/blur_rgb24alpha-64x64.png | Bin 0 -> 5501 bytes src/graphics/baseline/copyPixels_B8G8R8X8_I8.png | Bin 0 -> 85 bytes src/graphics/baseline/copyPixels_R8G8B8X8_I8.png | Bin 0 -> 85 bytes src/graphics/baseline/invert_rgb24-64x64.png | Bin 0 -> 2393 bytes src/graphics/benchmarkgraphics.cpp | 255 + src/graphics/shaders/Makefile.am | 3 + src/graphics/shaders/bandpass.frag | 42 + src/graphics/shaders/brightness.frag | 35 + src/graphics/shaders/chromakey.frag | 134 + src/graphics/shaders/chromakey_erosion.frag | 47 + src/graphics/shaders/helper.frag | 109 + src/graphics/shaders/horizblur.frag | 43 + src/graphics/shaders/horizshadow.frag | 44 + src/graphics/shaders/huesat.frag | 72 + src/graphics/shaders/invert.frag | 41 + src/graphics/shaders/minimal.frag | 37 + src/graphics/shaders/null.frag | 33 + src/graphics/shaders/rgb2yuv.frag | 38 + src/graphics/shaders/standard.frag | 101 + src/graphics/shaders/standard.vert | 36 + src/graphics/shaders/vertblur.frag | 42 + src/graphics/shaders/vertshadow.frag | 54 + src/graphics/testgpu.cpp | 530 + src/graphics/testgraphics.cpp | 1057 ++ src/imaging/Blob.cpp | 616 + src/imaging/Blob.h | 120 + src/imaging/CMUCamera.cpp | 466 + src/imaging/CMUCamera.h | 82 + src/imaging/CMUCameraUtils.cpp | 369 + src/imaging/CMUCameraUtils.h | 46 + src/imaging/Camera.cpp | 301 + src/imaging/Camera.h | 120 + src/imaging/CameraInfo.cpp | 159 + src/imaging/CameraInfo.h | 100 + src/imaging/CoordTransformer.cpp | 37 + src/imaging/CoordTransformer.h | 45 + src/imaging/DSCamera.cpp | 733 ++ src/imaging/DSCamera.h | 105 + src/imaging/DSHelper.cpp | 311 + src/imaging/DSHelper.h | 63 + src/imaging/DSSampleGrabber.cpp | 220 + src/imaging/DSSampleGrabber.h | 91 + src/imaging/DeDistort.cpp | 306 + src/imaging/DeDistort.h | 88 + src/imaging/FWCamera.cpp | 671 ++ src/imaging/FWCamera.h | 94 + src/imaging/FWCameraUtils.cpp | 366 + src/imaging/FWCameraUtils.h | 48 + src/imaging/FakeCamera.cpp | 149 + src/imaging/FakeCamera.h | 69 + src/imaging/FilterClearBorder.cpp | 67 + src/imaging/FilterClearBorder.h | 51 + src/imaging/FilterDistortion.cpp | 83 + src/imaging/FilterDistortion.h | 56 + src/imaging/FilterWipeBorder.cpp | 70 + src/imaging/FilterWipeBorder.h | 50 + src/imaging/IDSSampleCallback.h | 37 + src/imaging/Makefile.am | 41 + src/imaging/Run.cpp | 36 + src/imaging/Run.h | 56 + src/imaging/TrackerConfig.cpp | 268 + src/imaging/TrackerConfig.h | 75 + src/imaging/TrackerThread.cpp | 548 + src/imaging/TrackerThread.h | 135 + src/imaging/V4LCamera.cpp | 713 ++ src/imaging/V4LCamera.h | 100 + src/imaging/avgtrackerrc.minimal | 49 + src/imaging/baseline/FilterClearBorderResult1.png | Bin 0 -> 220 bytes src/imaging/baseline/FilterClearBorderResult3.png | Bin 0 -> 171 bytes src/imaging/baseline/FilterWipeBorderResult1.png | Bin 0 -> 230 bytes src/imaging/baseline/FilterWipeBorderResult3.png | Bin 0 -> 187 bytes src/imaging/checktracking.cpp | 0 src/imaging/qedit.h | 9914 ++++++++++++++++ src/imaging/test_comp.png | Bin 0 -> 851 bytes src/imaging/testimaging.cpp | 239 + src/imaging/trackerconfigdtd.cpp | 175 + src/imaging/trackerconfigdtd.h | 27 + src/lmfit/Makefile.am | 7 + src/lmfit/lm_eval.c | 81 + src/lmfit/lm_eval.h | 11 + src/lmfit/lmmin.c | 1320 +++ src/lmfit/lmmin.h | 52 + src/oscpack/CHANGES | 68 + src/oscpack/IpEndpointName.cpp | 81 + src/oscpack/IpEndpointName.h | 74 + src/oscpack/LICENSE | 28 + src/oscpack/Makefile.am | 12 + src/oscpack/MessageMappingOscPacketListener.h | 73 + src/oscpack/NetworkingUtils.cpp | 98 + src/oscpack/NetworkingUtils.h | 49 + src/oscpack/OscException.h | 54 + src/oscpack/OscHostEndianness.h | 70 + src/oscpack/OscOutboundPacketStream.cpp | 639 ++ src/oscpack/OscOutboundPacketStream.h | 142 + src/oscpack/OscPacketListener.h | 72 + src/oscpack/OscPrintReceivedElements.cpp | 240 + src/oscpack/OscPrintReceivedElements.h | 49 + src/oscpack/OscReceivedElements.cpp | 722 ++ src/oscpack/OscReceivedElements.h | 486 + src/oscpack/OscTypes.cpp | 40 + src/oscpack/OscTypes.h | 178 + src/oscpack/PacketListener.h | 44 + src/oscpack/README | 80 + src/oscpack/TODO | 55 + src/oscpack/TimerListener.h | 40 + src/oscpack/UdpSocket.cpp | 1039 ++ src/oscpack/UdpSocket.h | 158 + src/player/AVGNode.cpp | 53 + src/player/AVGNode.h | 45 + src/player/AppleTrackpadInputDevice.cpp | 116 + src/player/AppleTrackpadInputDevice.h | 85 + src/player/AreaNode.cpp | 350 + src/player/AreaNode.h | 132 + src/player/Arg.cpp | 47 + src/player/Arg.h | 119 + src/player/ArgBase.cpp | 66 + src/player/ArgBase.h | 65 + src/player/ArgList.cpp | 278 + src/player/ArgList.h | 84 + src/player/BitmapManager.cpp | 147 + src/player/BitmapManager.h | 66 + src/player/BitmapManagerMsg.cpp | 121 + src/player/BitmapManagerMsg.h | 76 + src/player/BitmapManagerThread.cpp | 78 + src/player/BitmapManagerThread.h | 55 + src/player/BlurFXNode.cpp | 79 + src/player/BlurFXNode.h | 58 + src/player/BoostPython.h | 35 + src/player/CameraNode.cpp | 414 + src/player/CameraNode.h | 135 + src/player/Canvas.cpp | 325 + src/player/Canvas.h | 124 + src/player/CanvasNode.cpp | 67 + src/player/CanvasNode.h | 48 + src/player/ChromaKeyFXNode.cpp | 154 + src/player/ChromaKeyFXNode.h | 77 + src/player/CircleNode.cpp | 291 + src/player/CircleNode.h | 77 + src/player/Contact.cpp | 239 + src/player/Contact.h | 96 + src/player/CursorEvent.cpp | 136 + src/player/CursorEvent.h | 87 + src/player/CursorState.cpp | 58 + src/player/CursorState.h | 56 + src/player/CurveNode.cpp | 183 + src/player/CurveNode.h | 80 + src/player/DisplayEngine.cpp | 187 + src/player/DisplayEngine.h | 93 + src/player/DisplayParams.cpp | 64 + src/player/DisplayParams.h | 52 + src/player/DivNode.cpp | 392 + src/player/DivNode.h | 94 + src/player/Event.cpp | 139 + src/player/Event.h | 99 + src/player/EventDispatcher.cpp | 184 + src/player/EventDispatcher.h | 68 + src/player/ExportedObject.cpp | 105 + src/player/ExportedObject.h | 73 + src/player/FXNode.cpp | 117 + src/player/FXNode.h | 71 + src/player/FilledVectorNode.cpp | 215 + src/player/FilledVectorNode.h | 88 + src/player/FontStyle.cpp | 315 + src/player/FontStyle.h | 114 + src/player/HueSatFXNode.cpp | 153 + src/player/HueSatFXNode.h | 72 + src/player/IBitmapLoadedListener.h | 44 + src/player/IInputDevice.h | 82 + src/player/Image.cpp | 399 + src/player/Image.h | 97 + src/player/ImageNode.cpp | 241 + src/player/ImageNode.h | 76 + src/player/InvertFXNode.cpp | 67 + src/player/InvertFXNode.h | 57 + src/player/KeyEvent.cpp | 80 + src/player/KeyEvent.h | 335 + src/player/LibMTDevInputDevice.cpp | 190 + src/player/LibMTDevInputDevice.h | 73 + src/player/LineNode.cpp | 106 + src/player/LineNode.h | 64 + src/player/MainCanvas.cpp | 87 + src/player/MainCanvas.h | 51 + src/player/Makefile.am | 121 + src/player/MaterialInfo.cpp | 53 + src/player/MaterialInfo.h | 47 + src/player/MeshNode.cpp | 164 + src/player/MeshNode.h | 71 + src/player/MessageID.cpp | 62 + src/player/MessageID.h | 48 + src/player/MouseEvent.cpp | 89 + src/player/MouseEvent.h | 66 + src/player/MultitouchInputDevice.cpp | 136 + src/player/MultitouchInputDevice.h | 79 + src/player/Node.cpp | 624 + src/player/Node.h | 195 + src/player/NullFXNode.cpp | 61 + src/player/NullFXNode.h | 53 + src/player/OGLSurface.cpp | 262 + src/player/OGLSurface.h | 93 + src/player/OffscreenCanvas.cpp | 271 + src/player/OffscreenCanvas.h | 91 + src/player/OffscreenCanvasNode.cpp | 83 + src/player/OffscreenCanvasNode.h | 57 + src/player/Player.cpp | 1835 +++ src/player/Player.h | 299 + src/player/PluginManager.cpp | 187 + src/player/PluginManager.h | 76 + src/player/PolyLineNode.cpp | 118 + src/player/PolyLineNode.h | 65 + src/player/PolygonNode.cpp | 219 + src/player/PolygonNode.h | 74 + src/player/Publisher.cpp | 248 + src/player/Publisher.h | 113 + src/player/PublisherDefinition.cpp | 90 + src/player/PublisherDefinition.h | 62 + src/player/PublisherDefinitionRegistry.cpp | 90 + src/player/PublisherDefinitionRegistry.h | 63 + src/player/PythonLogSink.cpp | 90 + src/player/PythonLogSink.h | 46 + src/player/RasterNode.cpp | 599 + src/player/RasterNode.h | 159 + src/player/RectNode.cpp | 178 + src/player/RectNode.h | 69 + src/player/SDLDisplayEngine.cpp | 865 ++ src/player/SDLDisplayEngine.h | 109 + src/player/SDLMain.h | 14 + src/player/SDLMain.m | 32 + src/player/SVG.cpp | 180 + src/player/SVG.h | 78 + src/player/SVGElement.cpp | 116 + src/player/SVGElement.h | 62 + src/player/ShadowFXNode.cpp | 122 + src/player/ShadowFXNode.h | 72 + src/player/Shape.cpp | 129 + src/player/Shape.h | 70 + src/player/SoundNode.cpp | 354 + src/player/SoundNode.h | 100 + src/player/SubscriberInfo.cpp | 85 + src/player/SubscriberInfo.h | 58 + src/player/TUIOInputDevice.cpp | 216 + src/player/TUIOInputDevice.h | 80 + src/player/TestHelper.cpp | 152 + src/player/TestHelper.h | 76 + src/player/TextEngine.cpp | 313 + src/player/TextEngine.h | 76 + src/player/Timeout.cpp | 93 + src/player/Timeout.h | 54 + src/player/TouchEvent.cpp | 202 + src/player/TouchEvent.h | 87 + src/player/TouchStatus.cpp | 109 + src/player/TouchStatus.h | 59 + src/player/TrackerCalibrator.cpp | 236 + src/player/TrackerCalibrator.h | 75 + src/player/TrackerInputDevice.cpp | 493 + src/player/TrackerInputDevice.h | 122 + src/player/TrackerTouchStatus.cpp | 120 + src/player/TrackerTouchStatus.h | 70 + src/player/TypeDefinition.cpp | 130 + src/player/TypeDefinition.h | 75 + src/player/TypeRegistry.cpp | 159 + src/player/TypeRegistry.h | 65 + src/player/VectorNode.cpp | 524 + src/player/VectorNode.h | 120 + src/player/VersionInfo.cpp | 72 + src/player/VersionInfo.h | 47 + src/player/VideoNode.cpp | 812 ++ src/player/VideoNode.h | 157 + src/player/VideoWriter.cpp | 260 + src/player/VideoWriter.h | 99 + src/player/VideoWriterThread.cpp | 347 + src/player/VideoWriterThread.h | 83 + src/player/Win7TouchInputDevice.cpp | 186 + src/player/Win7TouchInputDevice.h | 69 + src/player/WordsNode.cpp | 816 ++ src/player/WordsNode.h | 158 + src/player/WrapPython.cpp | 72 + src/player/WrapPython.h | 70 + src/player/XInputMTInputDevice.cpp | 379 + src/player/XInputMTInputDevice.h | 77 + src/player/testcalibrator.cpp | 120 + src/player/testplayer.cpp | 101 + src/python/Makefile.am | 6 + src/python/__init__.py | 29 + src/python/app/Makefile.am | 3 + src/python/app/__init__.py | 29 + src/python/app/app.py | 385 + src/python/app/debugpanel.py | 697 ++ src/python/app/flashmessage.py | 98 + src/python/app/keyboardmanager.py | 204 + src/python/app/settings.py | 277 + src/python/app/touchvisualization.py | 188 + src/python/apphelpers.py | 235 + src/python/appstarter.py | 396 + src/python/avgapp.py | 142 + src/python/camcalibrator.py | 469 + src/python/coordcalibrator.py | 133 + src/python/data/CamImgBorder.png | Bin 0 -> 3031 bytes src/python/data/Feedback.png | Bin 0 -> 196 bytes src/python/data/Makefile.am | 4 + src/python/data/SimpleSkin.xml | 83 + src/python/data/TouchFeedback.png | Bin 0 -> 4494 bytes src/python/data/black.png | Bin 0 -> 142 bytes src/python/data/border.png | Bin 0 -> 8074 bytes src/python/data/button_bg_down.png | Bin 0 -> 4089 bytes src/python/data/button_bg_up.png | Bin 0 -> 3995 bytes src/python/data/checkbox_checked_disabled.png | Bin 0 -> 2908 bytes src/python/data/checkbox_checked_down.png | Bin 0 -> 2902 bytes src/python/data/checkbox_checked_up.png | Bin 0 -> 2902 bytes src/python/data/checkbox_unchecked_disabled.png | Bin 0 -> 2856 bytes src/python/data/checkbox_unchecked_down.png | Bin 0 -> 2849 bytes src/python/data/checkbox_unchecked_up.png | Bin 0 -> 2849 bytes src/python/data/crosshair.png | Bin 0 -> 189 bytes src/python/data/mpeg1-48x48-sound.avi | Bin 0 -> 28534 bytes src/python/data/mpeg1-48x48.mov | Bin 0 -> 9863 bytes src/python/data/pause_button_down.png | Bin 0 -> 2826 bytes src/python/data/pause_button_up.png | Bin 0 -> 2825 bytes src/python/data/play_button_down.png | Bin 0 -> 2927 bytes src/python/data/play_button_up.png | Bin 0 -> 2928 bytes src/python/data/rgb24alpha-64x64.png | Bin 0 -> 3392 bytes src/python/data/scrollarea_border.png | Bin 0 -> 3262 bytes src/python/data/scrollbar_horiz_thumb_down.png | Bin 0 -> 2990 bytes src/python/data/scrollbar_horiz_thumb_up.png | Bin 0 -> 2977 bytes src/python/data/scrollbar_horiz_track.png | Bin 0 -> 2874 bytes src/python/data/scrollbar_horiz_track_disabled.png | Bin 0 -> 2873 bytes src/python/data/scrollbar_vert_thumb_down.png | Bin 0 -> 3008 bytes src/python/data/scrollbar_vert_thumb_up.png | Bin 0 -> 2998 bytes src/python/data/scrollbar_vert_track.png | Bin 0 -> 2903 bytes src/python/data/scrollbar_vert_track_disabled.png | Bin 0 -> 2902 bytes src/python/data/skin.xsd | 137 + src/python/data/slider_horiz_track.png | Bin 0 -> 2858 bytes src/python/data/slider_horiz_track_disabled.png | Bin 0 -> 2859 bytes src/python/data/slider_thumb_down.png | Bin 0 -> 3200 bytes src/python/data/slider_thumb_up.png | Bin 0 -> 3225 bytes src/python/data/slider_vert_track.png | Bin 0 -> 2867 bytes src/python/data/slider_vert_track_disabled.png | Bin 0 -> 2866 bytes src/python/enumcompat.py | 37 + src/python/filter.py | 95 + src/python/geom.py | 202 + src/python/gesture.py | 1000 ++ src/python/graph.py | 229 + src/python/mathutil.py | 168 + src/python/methodref.py | 69 + src/python/mtemu.py | 166 + src/python/parsecamargs.py | 49 + src/python/persist.py | 157 + src/python/statemachine.py | 149 + src/python/textarea.py | 833 ++ src/python/utils.py | 63 + src/python/widget/Makefile.am | 3 + src/python/widget/__init__.py | 7 + src/python/widget/base.py | 267 + src/python/widget/button.py | 443 + src/python/widget/keyboard.py | 302 + src/python/widget/mediacontrol.py | 161 + src/python/widget/scrollarea.py | 240 + src/python/widget/skin.py | 161 + src/python/widget/slider.py | 371 + src/samples/Makefile.am | 5 + src/samples/abort_gestures.py | 114 + src/samples/anim1.py | 17 + src/samples/anim2.py | 19 + src/samples/app_complete.py | 58 + src/samples/app_minimal.py | 17 + src/samples/asyncload.py | 89 + src/samples/attributes.py | 11 + src/samples/canvas.py | 14 + src/samples/drag.py | 36 + src/samples/event1.py | 20 + src/samples/event2.py | 21 + src/samples/firebirds/LICENSE | 6 + src/samples/firebirds/Makefile.am | 3 + src/samples/firebirds/firebirds.py | 469 + src/samples/firebirds/media/Fire_Birds.mp3 | Bin 0 -> 1824809 bytes src/samples/firebirds/media/Makefile.am | 5 + src/samples/firebirds/media/bullet.gif | Bin 0 -> 188 bytes src/samples/firebirds/media/bullet.mov | Bin 0 -> 37232 bytes src/samples/firebirds/media/bulletSound.mp3 | Bin 0 -> 20062 bytes src/samples/firebirds/media/enemy.gif | Bin 0 -> 1123 bytes src/samples/firebirds/media/enemy.mov | Bin 0 -> 603181 bytes src/samples/firebirds/media/enemyDeath.mp3 | Bin 0 -> 63529 bytes src/samples/firebirds/media/explosion.mov | Bin 0 -> 2218276 bytes src/samples/firebirds/media/flySound.mp3 | Bin 0 -> 193097 bytes src/samples/firebirds/media/ground.jpg | Bin 0 -> 262162 bytes src/samples/firebirds/media/gui_frame.png | Bin 0 -> 124453 bytes src/samples/firebirds/media/gui_heatbar_bg.png | Bin 0 -> 12626 bytes src/samples/firebirds/media/gui_heatbar_fg.png | Bin 0 -> 13937 bytes src/samples/firebirds/media/gui_lives_bg.png | Bin 0 -> 3679 bytes src/samples/firebirds/media/gui_lives_fg.png | Bin 0 -> 4655 bytes src/samples/firebirds/media/gui_numbers.png | Bin 0 -> 12640 bytes src/samples/firebirds/media/spitfire.gif | Bin 0 -> 1109 bytes src/samples/firebirds/media/spitfire.mov | Bin 0 -> 612657 bytes src/samples/firebirds/plugin/CollisionDetector.cpp | 122 + src/samples/firebirds/plugin/CollisionDetector.h | 28 + src/samples/firebirds/plugin/Makefile.am | 16 + src/samples/flashmessages.py | 58 + src/samples/fontstyle.py | 23 + src/samples/gestures.py | 287 + src/samples/globalcoords.py | 9 + src/samples/invertfx.py | 35 + src/samples/localcoords.py | 10 + src/samples/localcoordsrot.py | 11 + src/samples/logsample.py | 55 + src/samples/mesh.py | 13 + src/samples/minimal.py | 9 + src/samples/mpeg1-48x48-sound.avi | Bin 0 -> 28534 bytes src/samples/plugin.py | 15 + src/samples/rgb24-64x64.png | Bin 0 -> 2092 bytes src/samples/rotcustompivot.py | 11 + src/samples/rotdefaultpivot.py | 11 + src/samples/showvideo.py | 14 + src/samples/slideshow.py | 159 + src/samples/subclass.py | 40 + src/samples/timer.py | 16 + src/samples/timer2.py | 17 + src/samples/timer3.py | 19 + src/samples/twovideos.py | 55 + src/samples/video.py | 11 + src/samples/videochooser.py | 87 + src/samples/widget.py | 77 + src/samples/wordspos.py | 15 + src/test/AVGAppTest.py | 187 + src/test/AVTest.py | 674 ++ src/test/AnimTest.py | 512 + src/test/AppTest.py | 299 + src/test/DynamicsTest.py | 380 + src/test/EventTest.py | 1086 ++ src/test/FXTest.py | 483 + src/test/GestureTest.py | 1048 ++ src/test/ImageTest.py | 583 + src/test/InputDeviceTest.py | 218 + src/test/LoggerTest.py | 96 + src/test/Makefile.am | 9 + src/test/OffscreenTest.py | 472 + src/test/PlayerTest.py | 853 ++ src/test/PluginTest.py | 65 + src/test/PythonTest.py | 239 + src/test/Test.py | 150 + src/test/VectorTest.py | 734 ++ src/test/WidgetTest.py | 900 ++ src/test/WordsTest.py | 701 ++ src/test/baseline/test2VideosAtOnce1.png | Bin 0 -> 4250 bytes src/test/baseline/testAVGFile.png | Bin 0 -> 5767 bytes src/test/baseline/testAnim1.png | Bin 0 -> 6524 bytes src/test/baseline/testAnim2.png | Bin 0 -> 5795 bytes src/test/baseline/testAnim3.png | Bin 0 -> 6622 bytes src/test/baseline/testArc1.png | Bin 0 -> 264 bytes src/test/baseline/testArc2.png | Bin 0 -> 492 bytes src/test/baseline/testBitmap1.png | Bin 0 -> 1257 bytes src/test/baseline/testBitmap2.png | Bin 0 -> 2816 bytes src/test/baseline/testBitmap3.png | Bin 0 -> 2918 bytes src/test/baseline/testBitmap4.png | Bin 0 -> 3666 bytes src/test/baseline/testBlend1.png | Bin 0 -> 24802 bytes src/test/baseline/testBlend2.png | Bin 0 -> 23161 bytes src/test/baseline/testBlurFX1.png | Bin 0 -> 2994 bytes src/test/baseline/testBlurFX2.png | Bin 0 -> 6838 bytes src/test/baseline/testBlurFX3.png | Bin 0 -> 2418 bytes src/test/baseline/testButtonDisabled.png | Bin 0 -> 1561 bytes src/test/baseline/testButtonDown.png | Bin 0 -> 1492 bytes src/test/baseline/testButtonOver.png | Bin 0 -> 1399 bytes src/test/baseline/testButtonUp.png | Bin 0 -> 1212 bytes src/test/baseline/testCanvasAlpha.png | Bin 0 -> 3790 bytes src/test/baseline/testCanvasBlendModes.png | Bin 0 -> 8527 bytes src/test/baseline/testCanvasCrop.png | Bin 0 -> 1745 bytes src/test/baseline/testCanvasDependencies1.png | Bin 0 -> 1022 bytes src/test/baseline/testCanvasDependencies2.png | Bin 0 -> 2726 bytes src/test/baseline/testCanvasMipmap.png | Bin 0 -> 893 bytes src/test/baseline/testCanvasMultisample.png | Bin 0 -> 3472 bytes src/test/baseline/testCanvasNullFX1.png | Bin 0 -> 2214 bytes src/test/baseline/testCanvasNullFX2.png | Bin 0 -> 1995 bytes src/test/baseline/testCanvasNullFX3.png | Bin 0 -> 1042 bytes src/test/baseline/testCanvasResize.png | Bin 0 -> 1022 bytes src/test/baseline/testCheckboxClickedDown.png | Bin 0 -> 1732 bytes src/test/baseline/testCheckboxClickedOut.png | Bin 0 -> 1497 bytes src/test/baseline/testCheckboxClickedOver.png | Bin 0 -> 1642 bytes src/test/baseline/testCheckboxDown.png | Bin 0 -> 1492 bytes src/test/baseline/testCheckboxOver.png | Bin 0 -> 1399 bytes src/test/baseline/testCheckboxUp.png | Bin 0 -> 1212 bytes src/test/baseline/testChromaKeyFX1.png | Bin 0 -> 2428 bytes src/test/baseline/testChromaKeyFX2.png | Bin 0 -> 2230 bytes src/test/baseline/testChromaKeyFX3.png | Bin 0 -> 2309 bytes src/test/baseline/testChromaKeyFX4.png | Bin 0 -> 2186 bytes src/test/baseline/testCircle1.png | Bin 0 -> 295 bytes src/test/baseline/testCircle2.png | Bin 0 -> 414 bytes src/test/baseline/testCircle3.png | Bin 0 -> 3350 bytes src/test/baseline/testCircle4.png | Bin 0 -> 1620 bytes src/test/baseline/testCircle5.png | Bin 0 -> 1821 bytes src/test/baseline/testColorFX1.png | Bin 0 -> 2170 bytes src/test/baseline/testColorFX2.png | Bin 0 -> 1166 bytes src/test/baseline/testColorFX3.png | Bin 0 -> 1511 bytes src/test/baseline/testColorFX4.png | Bin 0 -> 2103 bytes src/test/baseline/testColorFX5.png | Bin 0 -> 2105 bytes src/test/baseline/testColorFX6.png | Bin 0 -> 2082 bytes src/test/baseline/testColorFX7.png | Bin 0 -> 3067 bytes src/test/baseline/testComplexDiv1.png | Bin 0 -> 2404 bytes src/test/baseline/testContAnim1.png | Bin 0 -> 6562 bytes src/test/baseline/testContAnim2.png | Bin 0 -> 4908 bytes src/test/baseline/testContAnim3.png | Bin 0 -> 4155 bytes src/test/baseline/testContAnim4.png | Bin 0 -> 4553 bytes src/test/baseline/testContinuousAnim1.png | Bin 0 -> 4723 bytes src/test/baseline/testContinuousAnim2.png | Bin 0 -> 2548 bytes src/test/baseline/testContrast1.png | Bin 0 -> 1640 bytes src/test/baseline/testContrast2.png | Bin 0 -> 1385 bytes src/test/baseline/testContrast3.png | Bin 0 -> 9533 bytes src/test/baseline/testCropImage1.png | Bin 0 -> 1494 bytes src/test/baseline/testCropImage10.png | Bin 0 -> 5718 bytes src/test/baseline/testCropImage2.png | Bin 0 -> 1110 bytes src/test/baseline/testCropImage3.png | Bin 0 -> 3572 bytes src/test/baseline/testCropImage4.png | Bin 0 -> 3404 bytes src/test/baseline/testCropImage5.png | Bin 0 -> 3389 bytes src/test/baseline/testCropImage6.png | Bin 0 -> 7900 bytes src/test/baseline/testCropImage7.png | Bin 0 -> 6616 bytes src/test/baseline/testCropImage8.png | Bin 0 -> 5925 bytes src/test/baseline/testCropImage9.png | Bin 0 -> 5823 bytes src/test/baseline/testCropMovie1.png | Bin 0 -> 6265 bytes src/test/baseline/testCropMovie10.png | Bin 0 -> 5754 bytes src/test/baseline/testCropMovie2.png | Bin 0 -> 4527 bytes src/test/baseline/testCropMovie3.png | Bin 0 -> 4102 bytes src/test/baseline/testCropMovie4.png | Bin 0 -> 3482 bytes src/test/baseline/testCropMovie5.png | Bin 0 -> 3350 bytes src/test/baseline/testCropMovie6.png | Bin 0 -> 6430 bytes src/test/baseline/testCropMovie7.png | Bin 0 -> 3948 bytes src/test/baseline/testCropMovie8.png | Bin 0 -> 6345 bytes src/test/baseline/testCropMovie9.png | Bin 0 -> 5786 bytes src/test/baseline/testCurve1.png | Bin 0 -> 382 bytes src/test/baseline/testCurve2.png | Bin 0 -> 552 bytes src/test/baseline/testCurve3.png | Bin 0 -> 653 bytes src/test/baseline/testCurve4.png | Bin 0 -> 829 bytes src/test/baseline/testDivDynamics1.png | Bin 0 -> 2396 bytes src/test/baseline/testDivDynamics2.png | Bin 0 -> 2620 bytes src/test/baseline/testDivDynamics3.png | Bin 0 -> 2698 bytes src/test/baseline/testDivDynamics4.png | Bin 0 -> 136 bytes src/test/baseline/testDivDynamics5.png | Bin 0 -> 2396 bytes src/test/baseline/testDraggable1.png | Bin 0 -> 5805 bytes src/test/baseline/testDraggable2.png | Bin 0 -> 5765 bytes src/test/baseline/testDynamicMediaDir1.png | Bin 0 -> 3302 bytes src/test/baseline/testDynamicMediaDir2.png | Bin 0 -> 5141 bytes src/test/baseline/testDynamicWords1.png | Bin 0 -> 390 bytes src/test/baseline/testDynamicWords2.png | Bin 0 -> 1356 bytes src/test/baseline/testDynamicWords3.png | Bin 0 -> 136 bytes src/test/baseline/testDynamicWords4.png | Bin 0 -> 874 bytes src/test/baseline/testEaseInOutAnim1.png | Bin 0 -> 4985 bytes src/test/baseline/testEaseInOutAnim2.png | Bin 0 -> 5106 bytes src/test/baseline/testEaseInOutAnim3.png | Bin 0 -> 5045 bytes src/test/baseline/testEaseInOutAnimC1.png | Bin 0 -> 2513 bytes src/test/baseline/testEaseInOutAnimC2.png | Bin 0 -> 2513 bytes src/test/baseline/testEaseInOutAnimC3.png | Bin 0 -> 2481 bytes src/test/baseline/testEaseInOutAnimC4.png | Bin 0 -> 2182 bytes src/test/baseline/testEaseInOutAnimC5.png | Bin 0 -> 2481 bytes src/test/baseline/testEaseInOutAnimC6.png | Bin 0 -> 2566 bytes src/test/baseline/testEvents.png | Bin 0 -> 7493 bytes src/test/baseline/testFXUpdateFX.png | Bin 0 -> 3452 bytes src/test/baseline/testFXUpdateMaskPos.png | Bin 0 -> 2791 bytes src/test/baseline/testFXUpdateMaskTex1.png | Bin 0 -> 1484 bytes src/test/baseline/testFXUpdateMaskTex2.png | Bin 0 -> 2861 bytes src/test/baseline/testFXUpdateTex.png | Bin 0 -> 2210 bytes src/test/baseline/testFXUpdateVideo.png | Bin 0 -> 10424 bytes src/test/baseline/testFadeIn1.png | Bin 0 -> 2161 bytes src/test/baseline/testFadeIn2.png | Bin 0 -> 2304 bytes src/test/baseline/testFadeIn3.png | Bin 0 -> 2473 bytes src/test/baseline/testFadeOut1.png | Bin 0 -> 2161 bytes src/test/baseline/testFadeOut2.png | Bin 0 -> 1886 bytes src/test/baseline/testFadeOut3.png | Bin 0 -> 136 bytes src/test/baseline/testFocusContext1.png | Bin 0 -> 3011 bytes src/test/baseline/testFocusContext2.png | Bin 0 -> 3629 bytes src/test/baseline/testFocusContext3.png | Bin 0 -> 4164 bytes src/test/baseline/testFocusContext4.png | Bin 0 -> 2241 bytes src/test/baseline/testFocusContext5.png | Bin 0 -> 1379 bytes src/test/baseline/testFontDir.png | Bin 0 -> 1595 bytes src/test/baseline/testFontStyle1.png | Bin 0 -> 1971 bytes src/test/baseline/testFontStyle2.png | Bin 0 -> 2566 bytes src/test/baseline/testGamma1.png | Bin 0 -> 2009 bytes src/test/baseline/testGamma2.png | Bin 0 -> 2196 bytes src/test/baseline/testHVStretchNode1.png | Bin 0 -> 339 bytes src/test/baseline/testHVStretchNode2.png | Bin 0 -> 409 bytes src/test/baseline/testHinting1.png | Bin 0 -> 2865 bytes src/test/baseline/testHueSatFX1.png | Bin 0 -> 3456 bytes src/test/baseline/testHueSatFX2.png | Bin 0 -> 3824 bytes src/test/baseline/testHueSatFX3.png | Bin 0 -> 2641 bytes src/test/baseline/testHueSatFX4.png | Bin 0 -> 3764 bytes src/test/baseline/testHugeImage0.png | Bin 0 -> 3578 bytes src/test/baseline/testHugeImage1.png | Bin 0 -> 3136 bytes src/test/baseline/testI18NWords1.png | Bin 0 -> 2792 bytes src/test/baseline/testI18NWords2.png | Bin 0 -> 3693 bytes src/test/baseline/testI18NWords3.png | Bin 0 -> 3534 bytes src/test/baseline/testImageNullFX1.png | Bin 0 -> 4153 bytes src/test/baseline/testImageNullFX2.png | Bin 0 -> 4700 bytes src/test/baseline/testImageNullFX3.png | Bin 0 -> 4174 bytes src/test/baseline/testImgDynamics1.png | Bin 0 -> 2396 bytes src/test/baseline/testImgDynamics2.png | Bin 0 -> 2620 bytes src/test/baseline/testImgDynamics3.png | Bin 0 -> 2698 bytes src/test/baseline/testImgDynamics4.png | Bin 0 -> 2858 bytes src/test/baseline/testImgDynamics5.png | Bin 0 -> 2396 bytes src/test/baseline/testImgHRef1.png | Bin 0 -> 2332 bytes src/test/baseline/testImgHRef2.png | Bin 0 -> 2545 bytes src/test/baseline/testImgHRef3.png | Bin 0 -> 3564 bytes src/test/baseline/testImgMask1.png | Bin 0 -> 698 bytes src/test/baseline/testImgMask2.png | Bin 0 -> 2333 bytes src/test/baseline/testImgMask3.png | Bin 0 -> 2476 bytes src/test/baseline/testImgMaskCanvas.png | Bin 0 -> 2081 bytes src/test/baseline/testImgMaskPos.png | Bin 0 -> 867 bytes src/test/baseline/testImgMaskSize1.png | Bin 0 -> 519 bytes src/test/baseline/testImgMaskSize2.png | Bin 0 -> 849 bytes src/test/baseline/testImgMaskSize3.png | Bin 0 -> 916 bytes src/test/baseline/testImgPos1.png | Bin 0 -> 1182 bytes src/test/baseline/testImgPos2.png | Bin 0 -> 1374 bytes src/test/baseline/testImgSize1.png | Bin 0 -> 1055 bytes src/test/baseline/testImgSize2.png | Bin 0 -> 1217 bytes src/test/baseline/testImgWarp1.png | Bin 0 -> 1138 bytes src/test/baseline/testImgWarp2.png | Bin 0 -> 2522 bytes src/test/baseline/testInactiveVector1.png | Bin 0 -> 247 bytes src/test/baseline/testInactiveVector2.png | Bin 0 -> 136 bytes src/test/baseline/testIntAnim1.png | Bin 0 -> 2476 bytes src/test/baseline/testIntAnim2.png | Bin 0 -> 2182 bytes src/test/baseline/testIntensity1.png | Bin 0 -> 1620 bytes src/test/baseline/testIntensity2.png | Bin 0 -> 1700 bytes src/test/baseline/testIntensity3.png | Bin 0 -> 8629 bytes src/test/baseline/testIntensity4.png | Bin 0 -> 3618 bytes src/test/baseline/testInvertFX1.png | Bin 0 -> 619 bytes src/test/baseline/testInvertFX2.png | Bin 0 -> 3674 bytes src/test/baseline/testJustify.png | Bin 0 -> 2413 bytes src/test/baseline/testLetterSpacing1.png | Bin 0 -> 1809 bytes src/test/baseline/testLetterSpacing2.png | Bin 0 -> 1711 bytes src/test/baseline/testLinearAnim1.png | Bin 0 -> 4985 bytes src/test/baseline/testLinearAnim2.png | Bin 0 -> 5106 bytes src/test/baseline/testLinearAnim3.png | Bin 0 -> 5106 bytes src/test/baseline/testLinearAnimC1.png | Bin 0 -> 2513 bytes src/test/baseline/testLinearAnimC2.png | Bin 0 -> 2469 bytes src/test/baseline/testLinearAnimC3.png | Bin 0 -> 2508 bytes src/test/baseline/testLinearAnimC4.png | Bin 0 -> 2182 bytes src/test/baseline/testLinearAnimC5.png | Bin 0 -> 2508 bytes src/test/baseline/testLinearAnimC6.png | Bin 0 -> 2500 bytes src/test/baseline/testLinearAnimZeroDuration1.png | Bin 0 -> 5106 bytes src/test/baseline/testLinearAnimZeroDuration2.png | Bin 0 -> 5784 bytes src/test/baseline/testLinearAnimZeroDuration3.png | Bin 0 -> 5784 bytes src/test/baseline/testLinearAnimZeroDurationC1.png | Bin 0 -> 2182 bytes src/test/baseline/testLinearAnimZeroDurationC2.png | Bin 0 -> 5784 bytes src/test/baseline/testLinearAnimZeroDurationC3.png | Bin 0 -> 5784 bytes src/test/baseline/testMediaControl1.png | Bin 0 -> 1041 bytes src/test/baseline/testMediaControl2.png | Bin 0 -> 1032 bytes src/test/baseline/testMediaControl3.png | Bin 0 -> 1202 bytes src/test/baseline/testMediaControl4.png | Bin 0 -> 1108 bytes src/test/baseline/testMediaControl5.png | Bin 0 -> 930 bytes src/test/baseline/testMediaDir1.png | Bin 0 -> 6900 bytes src/test/baseline/testMediaDir2.png | Bin 0 -> 4961 bytes src/test/baseline/testMesh1.png | Bin 0 -> 2390 bytes src/test/baseline/testMesh2.png | Bin 0 -> 2103 bytes src/test/baseline/testMesh3.png | Bin 0 -> 719 bytes src/test/baseline/testMesh4.png | Bin 0 -> 1810 bytes src/test/baseline/testMesh5.png | Bin 0 -> 2309 bytes src/test/baseline/testMesh6.png | Bin 0 -> 136 bytes src/test/baseline/testMesh7.png | Bin 0 -> 1481 bytes src/test/baseline/testMesh8.png | Bin 0 -> 1870 bytes src/test/baseline/testMipmap.png | Bin 0 -> 371 bytes src/test/baseline/testMove1.png | Bin 0 -> 6514 bytes src/test/baseline/testNodeInCanvasNullFX1.png | Bin 0 -> 2461 bytes src/test/baseline/testOffscreen1.png | Bin 0 -> 2510 bytes src/test/baseline/testOffscreen2.png | Bin 0 -> 136 bytes src/test/baseline/testOffscreen3.png | Bin 0 -> 2464 bytes src/test/baseline/testOffscreen4.png | Bin 0 -> 2510 bytes src/test/baseline/testOffscreen5.png | Bin 0 -> 136 bytes src/test/baseline/testOffscreenAutoRender1.png | Bin 0 -> 2510 bytes src/test/baseline/testOffscreenAutoRender2.png | Bin 0 -> 2517 bytes .../testOffscreenMultisampleScreenshot.png | Bin 0 -> 3713 bytes src/test/baseline/testOffscreenScreenshot.png | Bin 0 -> 2792 bytes src/test/baseline/testOpacity.png | Bin 0 -> 2457 bytes src/test/baseline/testOutlines.png | Bin 0 -> 3282 bytes src/test/baseline/testPanoDynamics1.png | Bin 0 -> 38510 bytes src/test/baseline/testPanoDynamics2.png | Bin 0 -> 2858 bytes src/test/baseline/testPanoDynamics3.png | Bin 0 -> 38564 bytes src/test/baseline/testPanoImage.png | Bin 0 -> 37544 bytes src/test/baseline/testPanoImagewNOP.png | Bin 0 -> 37544 bytes src/test/baseline/testParaWords.png | Bin 0 -> 4290 bytes src/test/baseline/testParallelAnimC1.png | Bin 0 -> 3283 bytes src/test/baseline/testParallelAnimC2.png | Bin 0 -> 2586 bytes src/test/baseline/testParallelAnimC3.png | Bin 0 -> 2519 bytes src/test/baseline/testParallelAnims1.png | Bin 0 -> 5791 bytes src/test/baseline/testParallelAnims2.png | Bin 0 -> 6139 bytes src/test/baseline/testPieSlice1.png | Bin 0 -> 325 bytes src/test/baseline/testPieSlice2.png | Bin 0 -> 800 bytes src/test/baseline/testPieSlice3.png | Bin 0 -> 142 bytes src/test/baseline/testPlayBeforeConnect.png | Bin 0 -> 3986 bytes src/test/baseline/testPointAnim1.png | Bin 0 -> 2510 bytes src/test/baseline/testPointAnim2.png | Bin 0 -> 2506 bytes src/test/baseline/testPointAnim3.png | Bin 0 -> 2506 bytes src/test/baseline/testPolyLine1.png | Bin 0 -> 432 bytes src/test/baseline/testPolyLine2.png | Bin 0 -> 592 bytes src/test/baseline/testPolyLine3.png | Bin 0 -> 558 bytes src/test/baseline/testPolyLine4.png | Bin 0 -> 616 bytes src/test/baseline/testPolyLine5.png | Bin 0 -> 558 bytes src/test/baseline/testPolyLine6.png | Bin 0 -> 184 bytes src/test/baseline/testPolygon1.png | Bin 0 -> 565 bytes src/test/baseline/testPolygon2.png | Bin 0 -> 554 bytes src/test/baseline/testPolygon3.png | Bin 0 -> 716 bytes src/test/baseline/testPolygon4.png | Bin 0 -> 716 bytes src/test/baseline/testPolygon5.png | Bin 0 -> 767 bytes src/test/baseline/testPolygon6.png | Bin 0 -> 741 bytes src/test/baseline/testPolygon7.png | Bin 0 -> 567 bytes src/test/baseline/testPolygon8.png | Bin 0 -> 547 bytes src/test/baseline/testPolygon9.png | Bin 0 -> 579 bytes src/test/baseline/testPolygonHole1.png | Bin 0 -> 637 bytes src/test/baseline/testPolygonHole2.png | Bin 0 -> 727 bytes src/test/baseline/testPositioning.png | Bin 0 -> 3435 bytes src/test/baseline/testProgressBar1.png | Bin 0 -> 318 bytes src/test/baseline/testProgressBar2.png | Bin 0 -> 321 bytes src/test/baseline/testProgressBar3.png | Bin 0 -> 303 bytes src/test/baseline/testRawText1.png | Bin 0 -> 2771 bytes src/test/baseline/testRawText2.png | Bin 0 -> 4481 bytes src/test/baseline/testRawText3.png | Bin 0 -> 4222 bytes src/test/baseline/testRawText4.png | Bin 0 -> 1946 bytes src/test/baseline/testRect1.png | Bin 0 -> 212 bytes src/test/baseline/testRect2.png | Bin 0 -> 196 bytes src/test/baseline/testRect3.png | Bin 0 -> 235 bytes src/test/baseline/testRect4.png | Bin 0 -> 321 bytes src/test/baseline/testRenderPipeline.png | Bin 0 -> 3381 bytes src/test/baseline/testRotate1.png | Bin 0 -> 4931 bytes src/test/baseline/testRotate1a.png | Bin 0 -> 2369 bytes src/test/baseline/testRotate1b.png | Bin 0 -> 2363 bytes src/test/baseline/testRotate2.png | Bin 0 -> 980 bytes src/test/baseline/testRotatePivot1.png | Bin 0 -> 4188 bytes src/test/baseline/testRotatePivot2.png | Bin 0 -> 6048 bytes src/test/baseline/testRotatePivot3.png | Bin 0 -> 4942 bytes src/test/baseline/testRoundedRect1.png | Bin 0 -> 312 bytes src/test/baseline/testRoundedRect2.png | Bin 0 -> 311 bytes src/test/baseline/testRoundedRect3.png | Bin 0 -> 212 bytes src/test/baseline/testRoundedRect4.png | Bin 0 -> 221 bytes src/test/baseline/testRoundedRect5.png | Bin 0 -> 256 bytes src/test/baseline/testRoundedRect6.png | Bin 0 -> 237 bytes src/test/baseline/testScrollArea1.png | Bin 0 -> 741 bytes src/test/baseline/testScrollArea2.png | Bin 0 -> 857 bytes src/test/baseline/testScrollArea3.png | Bin 0 -> 745 bytes src/test/baseline/testScrollBarHoriz1.png | Bin 0 -> 313 bytes src/test/baseline/testScrollBarHoriz10.png | Bin 0 -> 319 bytes src/test/baseline/testScrollBarHoriz11.png | Bin 0 -> 322 bytes src/test/baseline/testScrollBarHoriz12.png | Bin 0 -> 314 bytes src/test/baseline/testScrollBarHoriz2.png | Bin 0 -> 318 bytes src/test/baseline/testScrollBarHoriz3.png | Bin 0 -> 315 bytes src/test/baseline/testScrollBarHoriz4.png | Bin 0 -> 301 bytes src/test/baseline/testScrollBarHoriz5.png | Bin 0 -> 327 bytes src/test/baseline/testScrollBarHoriz6.png | Bin 0 -> 297 bytes src/test/baseline/testScrollBarHoriz7.png | Bin 0 -> 331 bytes src/test/baseline/testScrollBarHoriz8.png | Bin 0 -> 326 bytes src/test/baseline/testScrollBarHoriz9.png | Bin 0 -> 331 bytes src/test/baseline/testScrollBarVert1.png | Bin 0 -> 521 bytes src/test/baseline/testScrollBarVert2.png | Bin 0 -> 523 bytes src/test/baseline/testScrollBarVert3.png | Bin 0 -> 537 bytes src/test/baseline/testScrollBarVert4.png | Bin 0 -> 520 bytes src/test/baseline/testScrollBarVert5.png | Bin 0 -> 555 bytes src/test/baseline/testScrollBarVert6.png | Bin 0 -> 500 bytes src/test/baseline/testScrollBarVert7.png | Bin 0 -> 517 bytes src/test/baseline/testScrollBarVert8.png | Bin 0 -> 539 bytes src/test/baseline/testScrollBarVert9.png | Bin 0 -> 525 bytes src/test/baseline/testScrollPane1.png | Bin 0 -> 429 bytes src/test/baseline/testScrollPane2.png | Bin 0 -> 1682 bytes src/test/baseline/testScrollPane3.png | Bin 0 -> 998 bytes src/test/baseline/testSeekAfterEOF.png | Bin 0 -> 4114 bytes src/test/baseline/testShadowFX1.png | Bin 0 -> 2173 bytes src/test/baseline/testShadowFX2.png | Bin 0 -> 2759 bytes src/test/baseline/testShadowFX3.png | Bin 0 -> 1157 bytes src/test/baseline/testShadowFX4.png | Bin 0 -> 1154 bytes src/test/baseline/testShadowFX5.png | Bin 0 -> 2703 bytes src/test/baseline/testShadowFX6.png | Bin 0 -> 805 bytes src/test/baseline/testSimpleWords.png | Bin 0 -> 1955 bytes src/test/baseline/testSliderHoriz1.png | Bin 0 -> 412 bytes src/test/baseline/testSliderHoriz2.png | Bin 0 -> 424 bytes src/test/baseline/testSliderHoriz3.png | Bin 0 -> 431 bytes src/test/baseline/testSliderHoriz4.png | Bin 0 -> 390 bytes src/test/baseline/testSliderHoriz5.png | Bin 0 -> 381 bytes src/test/baseline/testSliderVert1.png | Bin 0 -> 578 bytes src/test/baseline/testSliderVert2.png | Bin 0 -> 581 bytes src/test/baseline/testSliderVert3.png | Bin 0 -> 578 bytes src/test/baseline/testSliderVert4.png | Bin 0 -> 504 bytes src/test/baseline/testSliderVert5.png | Bin 0 -> 502 bytes src/test/baseline/testSpanWords.png | Bin 0 -> 2503 bytes src/test/baseline/testSplineAnim1.png | Bin 0 -> 4985 bytes src/test/baseline/testSplineAnim2.png | Bin 0 -> 5106 bytes src/test/baseline/testSplineAnim3.png | Bin 0 -> 6171 bytes src/test/baseline/testStateAnim1.png | Bin 0 -> 5765 bytes src/test/baseline/testStateAnim2.png | Bin 0 -> 5320 bytes src/test/baseline/testStateAnim3.png | Bin 0 -> 5320 bytes src/test/baseline/testStateAnim4.png | Bin 0 -> 5765 bytes src/test/baseline/testStateAnim5.png | Bin 0 -> 5320 bytes src/test/baseline/testStateAnimC1.png | Bin 0 -> 2473 bytes src/test/baseline/testStateAnimC2.png | Bin 0 -> 2506 bytes src/test/baseline/testStateAnimC3.png | Bin 0 -> 2472 bytes src/test/baseline/testStateAnimC4.png | Bin 0 -> 2506 bytes src/test/baseline/testStateAnimC5.png | Bin 0 -> 2506 bytes src/test/baseline/testStretchNodeHoriz1.png | Bin 0 -> 1098 bytes src/test/baseline/testStretchNodeHoriz2.png | Bin 0 -> 1118 bytes src/test/baseline/testStretchNodeVert1.png | Bin 0 -> 1091 bytes src/test/baseline/testStretchNodeVert2.png | Bin 0 -> 1224 bytes src/test/baseline/testSvgBmp.png | Bin 0 -> 157 bytes src/test/baseline/testSvgNode.png | Bin 0 -> 222 bytes src/test/baseline/testSvgPosBmp.png | Bin 0 -> 155 bytes src/test/baseline/testSvgScaleBmp1.png | Bin 0 -> 347 bytes src/test/baseline/testSvgScaleBmp2.png | Bin 0 -> 207 bytes src/test/baseline/testSvgScaledNode1.png | Bin 0 -> 359 bytes src/test/baseline/testSvgScaledNode2.png | Bin 0 -> 511 bytes src/test/baseline/testTexCompression1.png | Bin 0 -> 2367 bytes src/test/baseline/testTexCompression2.png | Bin 0 -> 810 bytes src/test/baseline/testTextArea1.png | Bin 0 -> 2792 bytes src/test/baseline/testTextArea2.png | Bin 0 -> 460 bytes src/test/baseline/testTextArea3.png | Bin 0 -> 511 bytes src/test/baseline/testTextArea4.png | Bin 0 -> 1056 bytes src/test/baseline/testTextArea5.png | Bin 0 -> 1100 bytes src/test/baseline/testTextButtonDisabled.png | Bin 0 -> 1099 bytes src/test/baseline/testTextButtonDown.png | Bin 0 -> 975 bytes src/test/baseline/testTextButtonDownNewText.png | Bin 0 -> 1438 bytes src/test/baseline/testTextButtonUp.png | Bin 0 -> 1099 bytes src/test/baseline/testTextButtonUpNewText.png | Bin 0 -> 1559 bytes src/test/baseline/testTexturedCurve1.png | Bin 0 -> 3811 bytes src/test/baseline/testTexturedCurve2.png | Bin 0 -> 4002 bytes src/test/baseline/testTexturedPolyLine1.png | Bin 0 -> 2755 bytes src/test/baseline/testTexturedPolyLine2.png | Bin 0 -> 2545 bytes src/test/baseline/testTexturedPolyLine3.png | Bin 0 -> 3059 bytes src/test/baseline/testTexturedPolyLine4.png | Bin 0 -> 2329 bytes src/test/baseline/testTexturedPolygon1.png | Bin 0 -> 5278 bytes src/test/baseline/testTexturedPolygon2.png | Bin 0 -> 4889 bytes src/test/baseline/testTexturedPolygon3.png | Bin 0 -> 4985 bytes src/test/baseline/testTexturedPolygon4.png | Bin 0 -> 5447 bytes src/test/baseline/testTexturedPolygon5.png | Bin 0 -> 2624 bytes src/test/baseline/testTexturedPolygon6.png | Bin 0 -> 2629 bytes src/test/baseline/testTexturedRect1.png | Bin 0 -> 2487 bytes src/test/baseline/testTexturedRect2.png | Bin 0 -> 2515 bytes src/test/baseline/testTexturedRect3.png | Bin 0 -> 3933 bytes src/test/baseline/testTexturedRect4.png | Bin 0 -> 1950 bytes src/test/baseline/testTexturedRect5.png | Bin 0 -> 2008 bytes src/test/baseline/testTexturedRect6.png | Bin 0 -> 1491 bytes src/test/baseline/testTexturedRect7.png | Bin 0 -> 251 bytes src/test/baseline/testTexturedRect8.png | Bin 0 -> 283 bytes src/test/baseline/testTimeSliderHoriz1.png | Bin 0 -> 416 bytes src/test/baseline/testTimeSliderHoriz2.png | Bin 0 -> 501 bytes src/test/baseline/testTimeSliderHoriz3.png | Bin 0 -> 499 bytes src/test/baseline/testTimeSliderHoriz4.png | Bin 0 -> 461 bytes src/test/baseline/testTimeSliderHoriz5.png | Bin 0 -> 461 bytes src/test/baseline/testTimeSliderVert1.png | Bin 0 -> 570 bytes src/test/baseline/testTimeSliderVert2.png | Bin 0 -> 674 bytes src/test/baseline/testTimeSliderVert3.png | Bin 0 -> 665 bytes src/test/baseline/testTimeSliderVert4.png | Bin 0 -> 591 bytes src/test/baseline/testTimeSliderVert5.png | Bin 0 -> 591 bytes src/test/baseline/testUIButtonDisabled.png | Bin 0 -> 1722 bytes src/test/baseline/testUIButtonDown.png | Bin 0 -> 1657 bytes src/test/baseline/testUIButtonUp.png | Bin 0 -> 1364 bytes src/test/baseline/testUICheckBoxChecked_Down.png | Bin 0 -> 1506 bytes src/test/baseline/testUICheckBoxChecked_Up.png | Bin 0 -> 1499 bytes .../baseline/testUICheckBoxUnchecked_Disabled.png | Bin 0 -> 1440 bytes src/test/baseline/testUICheckBoxUnchecked_Down.png | Bin 0 -> 1430 bytes src/test/baseline/testUICheckBoxUnchecked_Up.png | Bin 0 -> 1471 bytes src/test/baseline/testUIKeyboard.png | Bin 0 -> 859 bytes src/test/baseline/testUIKeyboard1S.png | Bin 0 -> 911 bytes src/test/baseline/testUIKeyboardA.png | Bin 0 -> 878 bytes src/test/baseline/testUIKeyboardA1S.png | Bin 0 -> 885 bytes src/test/baseline/testUIKeyboardAS.png | Bin 0 -> 883 bytes src/test/baseline/testUIKeyboardDown11.png | Bin 0 -> 1979 bytes src/test/baseline/testUIKeyboardDownA212S2.png | Bin 0 -> 2191 bytes src/test/baseline/testUIKeyboardDownA2S1.png | Bin 0 -> 1205 bytes src/test/baseline/testUIKeyboardFB.png | Bin 0 -> 859 bytes src/test/baseline/testUIKeyboardFB1.png | Bin 0 -> 1616 bytes src/test/baseline/testUIKeyboardFBA1S.png | Bin 0 -> 1587 bytes src/test/baseline/testUIKeyboardFBAS.png | Bin 0 -> 2065 bytes src/test/baseline/testUIKeyboardFBS.png | Bin 0 -> 854 bytes src/test/baseline/testUIKeyboardNoFB1S.png | Bin 0 -> 910 bytes src/test/baseline/testUIKeyboardS.png | Bin 0 -> 855 bytes src/test/baseline/testUIToggleChecked_Disabled.png | Bin 0 -> 1276 bytes src/test/baseline/testUIToggleChecked_Down.png | Bin 0 -> 1458 bytes src/test/baseline/testUIToggleChecked_Up.png | Bin 0 -> 1450 bytes .../baseline/testUIToggleUnchecked_Disabled.png | Bin 0 -> 959 bytes src/test/baseline/testUIToggleUnchecked_Down.png | Bin 0 -> 1113 bytes src/test/baseline/testUIToggleUnchecked_Up.png | Bin 0 -> 1115 bytes src/test/baseline/testVideo-h264-48x48.h2641.png | Bin 0 -> 9756 bytes src/test/baseline/testVideo-mjpeg-48x48.avi1.png | Bin 0 -> 13061 bytes .../baseline/testVideo-mpeg1-48x48-sound.avi1.png | Bin 0 -> 10948 bytes src/test/baseline/testVideo-mpeg1-48x48.mov1.png | Bin 0 -> 10904 bytes src/test/baseline/testVideo-rgba-48x48.mov1.png | Bin 0 -> 6434 bytes .../baseline/testVideo-vp6a-yuva-48x48.flv1.png | Bin 0 -> 10033 bytes src/test/baseline/testVideoActive1.png | Bin 0 -> 136 bytes src/test/baseline/testVideoActive2.png | Bin 0 -> 10508 bytes src/test/baseline/testVideoDynamics1.png | Bin 0 -> 4236 bytes src/test/baseline/testVideoDynamics2.png | Bin 0 -> 5735 bytes src/test/baseline/testVideoDynamics3.png | Bin 0 -> 5598 bytes src/test/baseline/testVideoDynamics4.png | Bin 0 -> 136 bytes src/test/baseline/testVideoDynamics5.png | Bin 0 -> 4236 bytes src/test/baseline/testVideoFPS.png | Bin 0 -> 3215 bytes src/test/baseline/testVideoHRef1.png | Bin 0 -> 3531 bytes src/test/baseline/testVideoLoop.png | Bin 0 -> 10904 bytes src/test/baseline/testVideoMaskRGBA1.png | Bin 0 -> 804 bytes src/test/baseline/testVideoMaskRGBA2.png | Bin 0 -> 2147 bytes src/test/baseline/testVideoMaskRGBA3.png | Bin 0 -> 2619 bytes src/test/baseline/testVideoMaskRGBA4.png | Bin 0 -> 2194 bytes src/test/baseline/testVideoMaskYUV1.png | Bin 0 -> 1499 bytes src/test/baseline/testVideoMaskYUV2.png | Bin 0 -> 4117 bytes src/test/baseline/testVideoMaskYUV3.png | Bin 0 -> 3861 bytes src/test/baseline/testVideoMaskYUV4.png | Bin 0 -> 3115 bytes src/test/baseline/testVideoMaskYUVJ1.png | Bin 0 -> 1804 bytes src/test/baseline/testVideoMaskYUVJ2.png | Bin 0 -> 417 bytes src/test/baseline/testVideoMaskYUVJ3.png | Bin 0 -> 1524 bytes src/test/baseline/testVideoMaskYUVJ4.png | Bin 0 -> 1092 bytes src/test/baseline/testVideoNullFX.png | Bin 0 -> 4769 bytes src/test/baseline/testVideoOpacityRGBA1.png | Bin 0 -> 2215 bytes src/test/baseline/testVideoOpacityRGBA2.png | Bin 0 -> 2245 bytes src/test/baseline/testVideoOpacityYUV1.png | Bin 0 -> 3986 bytes src/test/baseline/testVideoOpacityYUV2.png | Bin 0 -> 3976 bytes src/test/baseline/testVideoSeek0.png | Bin 0 -> 11091 bytes src/test/baseline/testVideoSeek1.png | Bin 0 -> 11683 bytes src/test/baseline/testVideoSeek2.png | Bin 0 -> 11139 bytes src/test/baseline/testVideoSeek3.png | Bin 0 -> 851 bytes src/test/baseline/testVideoState1.png | Bin 0 -> 10904 bytes src/test/baseline/testVideoState2.png | Bin 0 -> 10424 bytes src/test/baseline/testVideoState3.png | Bin 0 -> 10561 bytes src/test/baseline/testVideoState4.png | Bin 0 -> 136 bytes src/test/baseline/testVideoState5.png | Bin 0 -> 10904 bytes src/test/baseline/testVideoWriter1.png | Bin 0 -> 4659 bytes src/test/baseline/testVideoWriterCanvas1.png | Bin 0 -> 3935 bytes src/test/baseline/testWarp1.png | Bin 0 -> 8512 bytes src/test/baseline/testWarp2.png | Bin 0 -> 8401 bytes src/test/baseline/testWarp3.png | Bin 0 -> 8451 bytes src/test/baseline/testWordsBR.png | Bin 0 -> 1170 bytes src/test/baseline/testWordsDynamics1.png | Bin 0 -> 513 bytes src/test/baseline/testWordsDynamics2.png | Bin 0 -> 552 bytes src/test/baseline/testWordsDynamics3.png | Bin 0 -> 552 bytes src/test/baseline/testWordsDynamics4.png | Bin 0 -> 136 bytes src/test/baseline/testWordsDynamics5.png | Bin 0 -> 513 bytes src/test/baseline/testWordsGamma1.png | Bin 0 -> 3194 bytes src/test/baseline/testWordsGamma2.png | Bin 0 -> 3174 bytes src/test/baseline/testWordsIntensity.png | Bin 0 -> 2239 bytes src/test/baseline/testWordsMask1.png | Bin 0 -> 4057 bytes src/test/baseline/testWordsMask2.png | Bin 0 -> 3471 bytes src/test/baseline/testWordsMask3.png | Bin 0 -> 3420 bytes src/test/baseline/testWordsMask4.png | Bin 0 -> 4055 bytes src/test/baseline/testWordsMask5.png | Bin 0 -> 4129 bytes src/test/baseline/testWordsMask6.png | Bin 0 -> 3854 bytes src/test/baseline/testWordsMask7.png | Bin 0 -> 3853 bytes src/test/baseline/testWordsNullFX.png | Bin 0 -> 949 bytes src/test/baseline/testWordsOutlines.png | Bin 0 -> 1024 bytes src/test/baseline/testWordsShadowFX1.png | Bin 0 -> 2034 bytes src/test/baseline/testWordsShadowFX2.png | Bin 0 -> 2228 bytes src/test/baseline/testWrapMode1.png | Bin 0 -> 2901 bytes src/test/baseline/testWrapMode2.png | Bin 0 -> 3698 bytes src/test/baseline/testWrapMode3.png | Bin 0 -> 2901 bytes src/test/baseline/testWrapMode4.png | Bin 0 -> 3927 bytes src/test/baseline/testXPosPointAnim1.png | Bin 0 -> 5123 bytes src/test/baseline/testXPosPointAnim2.png | Bin 0 -> 5106 bytes src/test/baseline/testXPosPointAnim3.png | Bin 0 -> 5106 bytes src/test/baseline/testYPosPointAnim1.png | Bin 0 -> 5123 bytes src/test/baseline/testYPosPointAnim2.png | Bin 0 -> 5127 bytes src/test/baseline/testYPosPointAnim3.png | Bin 0 -> 5127 bytes src/test/baseline/testbasics.png | Bin 0 -> 2510 bytes src/test/baseline/testline1.png | Bin 0 -> 348 bytes src/test/baseline/testline2.png | Bin 0 -> 351 bytes src/test/baseline/testline3.png | Bin 0 -> 364 bytes src/test/baseline/testline4.png | Bin 0 -> 385 bytes src/test/baseline/testlineopacity1.png | Bin 0 -> 154 bytes src/test/baseline/testlineopacity2.png | Bin 0 -> 156 bytes src/test/baseline/testlotsoflines.png | Bin 0 -> 369 bytes src/test/baseline/testplugin1.png | Bin 0 -> 371 bytes src/test/baseline/testplugin2.png | Bin 0 -> 375 bytes src/test/baseline/testtexturedline1.png | Bin 0 -> 1854 bytes src/test/baseline/testtexturedline2.png | Bin 0 -> 136 bytes src/test/baseline/testtexturedline3.png | Bin 0 -> 1371 bytes src/test/baseline/testtexturedline4.png | Bin 0 -> 1837 bytes src/test/baseline/testtexturedline5.png | Bin 0 -> 213 bytes src/test/camcfgs.py | 133 + src/test/checkcamera.py | 225 + src/test/extrafonts/testaddfontdir.ttf | Bin 0 -> 1736 bytes src/test/fonts/Vera.ttf | Bin 0 -> 65932 bytes src/test/fonts/VeraBI.ttf | Bin 0 -> 63208 bytes src/test/fonts/VeraBd.ttf | Bin 0 -> 58716 bytes src/test/fonts/VeraIt.ttf | Bin 0 -> 63684 bytes src/test/illustratorRect.svg | 7 + src/test/image.avg | 8 + src/test/media/1x1_white.png | Bin 0 -> 2791 bytes src/test/media/22.050Hz_16bit_mono.wav | Bin 0 -> 4454 bytes src/test/media/44.1kHz_16bit_6Chan.ogg | Bin 0 -> 159170 bytes src/test/media/44.1kHz_16bit_mono.wav | Bin 0 -> 8864 bytes src/test/media/44.1kHz_16bit_stereo.aif | Bin 0 -> 352854 bytes src/test/media/44.1kHz_16bit_stereo.wav | Bin 0 -> 352844 bytes src/test/media/44.1kHz_24bit_mono.wav | Bin 0 -> 8864 bytes src/test/media/44.1kHz_24bit_stereo.aif | Bin 0 -> 529254 bytes src/test/media/44.1kHz_24bit_stereo.wav | Bin 0 -> 352844 bytes src/test/media/44.1kHz_mono.ogg | Bin 0 -> 4177 bytes src/test/media/44.1kHz_stereo.mp3 | Bin 0 -> 47647 bytes src/test/media/44.1kHz_stereo.ogg | Bin 0 -> 10211 bytes src/test/media/48kHz_16bit_mono.wav | Bin 0 -> 9644 bytes src/test/media/48kHz_16bit_stereo.aif | Bin 0 -> 384054 bytes src/test/media/48kHz_16bit_stereo.wav | Bin 0 -> 384044 bytes src/test/media/48kHz_24bit_mono.wav | Bin 0 -> 9644 bytes src/test/media/48kHz_24bit_stereo.aif | Bin 0 -> 576054 bytes src/test/media/48kHz_24bit_stereo.wav | Bin 0 -> 384044 bytes src/test/media/48kHz_stereo.mp3 | Bin 0 -> 47808 bytes src/test/media/48kHz_stereo.ogg | Bin 0 -> 104701 bytes src/test/media/CustomSkin.xml | 83 + src/test/media/SimpleSkin.xml | 83 + src/test/media/button_bg_down.png | Bin 0 -> 3212 bytes src/test/media/button_bg_up.png | Bin 0 -> 3085 bytes src/test/media/button_check.png | Bin 0 -> 3040 bytes src/test/media/button_disabled.png | Bin 0 -> 4308 bytes src/test/media/button_down.png | Bin 0 -> 4221 bytes src/test/media/button_over.png | Bin 0 -> 4131 bytes src/test/media/button_up.png | Bin 0 -> 3923 bytes src/test/media/checkbox_checked_disabled.png | Bin 0 -> 2908 bytes src/test/media/checkbox_checked_down.png | Bin 0 -> 2902 bytes src/test/media/checkbox_checked_up.png | Bin 0 -> 2902 bytes src/test/media/checkbox_unchecked_disabled.png | Bin 0 -> 2856 bytes src/test/media/checkbox_unchecked_down.png | Bin 0 -> 2849 bytes src/test/media/checkbox_unchecked_up.png | Bin 0 -> 2849 bytes src/test/media/checker.png | Bin 0 -> 3526 bytes src/test/media/chromakey-median.png | Bin 0 -> 3331 bytes src/test/media/chromakey.png | Bin 0 -> 2995 bytes src/test/media/colorramp.png | Bin 0 -> 4471 bytes src/test/media/crop_bkgd.png | Bin 0 -> 369 bytes src/test/media/dilation.png | Bin 0 -> 80 bytes src/test/media/erosion.png | Bin 0 -> 960 bytes src/test/media/filterwipeborder.png | Bin 0 -> 1166 bytes src/test/media/flat.png | Bin 0 -> 2861 bytes src/test/media/floodfill.png | Bin 0 -> 119 bytes src/test/media/freidrehen.jpg | Bin 0 -> 3856 bytes src/test/media/greyscale.png | Bin 0 -> 2245 bytes src/test/media/h264-48x48.h264 | Bin 0 -> 131081 bytes src/test/media/hsl.png | Bin 0 -> 3131 bytes src/test/media/i8-64x64.png | Bin 0 -> 2256 bytes .../media/incompleteSkinMedia/IncompleteSkin.xml | 11 + .../scrollbar_horiz_thumb_down.png | Bin 0 -> 2990 bytes .../scrollbar_horiz_thumb_up.png | Bin 0 -> 2948 bytes .../incompleteSkinMedia/scrollbar_horiz_track.png | Bin 0 -> 2843 bytes .../scrollbar_horiz_track_disabled.png | Bin 0 -> 2873 bytes src/test/media/keyboard_bg.png | Bin 0 -> 781 bytes src/test/media/keyboard_down.png | Bin 0 -> 775 bytes src/test/media/keyboard_feedback.png | Bin 0 -> 2711 bytes src/test/media/mask.png | Bin 0 -> 1270 bytes src/test/media/mask1.png | Bin 0 -> 227 bytes src/test/media/mask2.png | Bin 0 -> 1598 bytes src/test/media/mjpeg-48x48.avi | Bin 0 -> 329852 bytes src/test/media/mpeg1-48x48-sound.avi | Bin 0 -> 28534 bytes src/test/media/mpeg1-48x48.mov | Bin 0 -> 9863 bytes src/test/media/oe.png | Bin 0 -> 3178 bytes src/test/media/pause_button_down.png | Bin 0 -> 2826 bytes src/test/media/pause_button_up.png | Bin 0 -> 2825 bytes src/test/media/play_button_down.png | Bin 0 -> 2927 bytes src/test/media/play_button_up.png | Bin 0 -> 2928 bytes src/test/media/rect.svg | 8 + src/test/media/rectborder.png | Bin 0 -> 2810 bytes src/test/media/rgb24-32x32.png | Bin 0 -> 3584 bytes src/test/media/rgb24-64x64.png | Bin 0 -> 2092 bytes src/test/media/rgb24-65x65.png | Bin 0 -> 2210 bytes src/test/media/rgb24alpha-32x32.png | Bin 0 -> 4088 bytes src/test/media/rgb24alpha-64x64.png | Bin 0 -> 3392 bytes src/test/media/rgba-48x48.mov | Bin 0 -> 127378 bytes src/test/media/scrollarea_border.png | Bin 0 -> 3262 bytes src/test/media/scrollbar_horiz_thumb_disabled.png | Bin 0 -> 2924 bytes src/test/media/scrollbar_horiz_thumb_down.png | Bin 0 -> 2990 bytes src/test/media/scrollbar_horiz_thumb_up.png | Bin 0 -> 2948 bytes src/test/media/scrollbar_horiz_track.png | Bin 0 -> 2843 bytes src/test/media/scrollbar_horiz_track_disabled.png | Bin 0 -> 2873 bytes src/test/media/scrollbar_vert_thumb_disabled.png | Bin 0 -> 2911 bytes src/test/media/scrollbar_vert_thumb_down.png | Bin 0 -> 3008 bytes src/test/media/scrollbar_vert_thumb_up.png | Bin 0 -> 2998 bytes src/test/media/scrollbar_vert_track.png | Bin 0 -> 2903 bytes src/test/media/scrollbar_vert_track_disabled.png | Bin 0 -> 2902 bytes src/test/media/shadow.png | Bin 0 -> 3168 bytes src/test/media/slider_horiz_track.png | Bin 0 -> 2858 bytes src/test/media/slider_horiz_track_disabled.png | Bin 0 -> 2859 bytes src/test/media/slider_thumb_down.png | Bin 0 -> 3200 bytes src/test/media/slider_thumb_up.png | Bin 0 -> 3225 bytes src/test/media/slider_vert_track.png | Bin 0 -> 2867 bytes src/test/media/slider_vert_track_disabled.png | Bin 0 -> 2866 bytes src/test/media/spike.png | Bin 0 -> 2820 bytes src/test/media/toggle_checked_Disabled.png | Bin 0 -> 3886 bytes src/test/media/toggle_checked_Down.png | Bin 0 -> 3873 bytes src/test/media/toggle_checked_Up.png | Bin 0 -> 3867 bytes src/test/media/toggle_unchecked_Disabled.png | Bin 0 -> 3555 bytes src/test/media/toggle_unchecked_Down.png | Bin 0 -> 3506 bytes src/test/media/toggle_unchecked_Up.png | Bin 0 -> 3517 bytes src/test/media/vp6a-yuva-48x48.flv | Bin 0 -> 13669 bytes src/test/media/widebmp.jpg | Bin 0 -> 33903 bytes src/test/plugin/ColorNode.cpp | 153 + src/test/plugin/Makefile.am | 19 + src/test/plugin/test.sh | 5 + src/test/testapp.py | 191 + src/test/testcase.py | 369 + src/test/testmediadir/mjpeg-48x48.avi | Bin 0 -> 10240 bytes src/test/testmediadir/rgb24-64x64a.png | Bin 0 -> 3392 bytes src/utils/Makefile.am | 5 + src/utils/avg_audioplayer.py | 49 + src/utils/avg_checkpolygonspeed.py | 145 + src/utils/avg_checkspeed.py | 141 + src/utils/avg_checktouch.py | 57 + src/utils/avg_checkvsync.py | 44 + src/utils/avg_chromakey.py | 189 + src/utils/avg_jitterfilter.py | 111 + src/utils/avg_showcamera.py | 201 + src/utils/avg_showfile.py | 38 + src/utils/avg_showfont.py | 68 + src/utils/avg_showsvg.py | 63 + src/utils/avg_videoinfo.py | 275 + src/utils/avg_videoplayer.py | 143 + src/video/AsyncVideoDecoder.cpp | 505 + src/video/AsyncVideoDecoder.h | 117 + src/video/AudioDecoderThread.cpp | 366 + src/video/AudioDecoderThread.h | 88 + src/video/FFMpegDemuxer.cpp | 153 + src/video/FFMpegDemuxer.h | 58 + src/video/FFMpegFrameDecoder.cpp | 258 + src/video/FFMpegFrameDecoder.h | 72 + src/video/Makefile.am | 50 + src/video/SyncVideoDecoder.cpp | 261 + src/video/SyncVideoDecoder.h | 77 + src/video/VDPAUDecoder.cpp | 251 + src/video/VDPAUDecoder.h | 67 + src/video/VDPAUHelper.cpp | 182 + src/video/VDPAUHelper.h | 76 + src/video/VideoDecoder.cpp | 485 + src/video/VideoDecoder.h | 138 + src/video/VideoDecoderThread.cpp | 222 + src/video/VideoDecoderThread.h | 83 + src/video/VideoDemuxerThread.cpp | 157 + src/video/VideoDemuxerThread.h | 63 + src/video/VideoInfo.cpp | 94 + src/video/VideoInfo.h | 71 + src/video/VideoMsg.cpp | 94 + src/video/VideoMsg.h | 72 + src/video/WrapFFMpeg.h | 93 + src/video/baseline/mjpeg-48x48.avi_1.png | Bin 0 -> 7047 bytes src/video/baseline/mjpeg-48x48.avi_100.png | Bin 0 -> 6784 bytes src/video/baseline/mjpeg-48x48.avi_2.png | Bin 0 -> 7029 bytes src/video/baseline/mjpeg-48x48.avi_201.png | Bin 0 -> 6978 bytes src/video/baseline/mjpeg-48x48.avi_53.png | Bin 0 -> 6817 bytes src/video/baseline/mjpeg-48x48.avi_end.png | Bin 0 -> 6967 bytes src/video/baseline/mjpeg-48x48.avi_loop.png | Bin 0 -> 7041 bytes src/video/baseline/mpeg1-48x48-sound.avi_end.png | Bin 0 -> 3282 bytes src/video/baseline/mpeg1-48x48-sound.avi_loop.png | Bin 0 -> 3428 bytes src/video/baseline/mpeg1-48x48.mov_1.png | Bin 0 -> 3451 bytes src/video/baseline/mpeg1-48x48.mov_2.png | Bin 0 -> 3301 bytes src/video/baseline/mpeg1-48x48.mov_end.png | Bin 0 -> 3284 bytes src/video/baseline/mpeg1-48x48.mov_loop.png | Bin 0 -> 3451 bytes src/video/testvideo.cpp | 543 + src/wrapper/Makefile.am | 45 + src/wrapper/WrapHelper.cpp | 428 + src/wrapper/WrapHelper.h | 397 + src/wrapper/anim_wrap.cpp | 131 + src/wrapper/avg_wrap.cpp | 355 + src/wrapper/bitmap_wrap.cpp | 207 + src/wrapper/event_wrap.cpp | 251 + src/wrapper/fx_wrap.cpp | 100 + src/wrapper/node_wrap.cpp | 333 + src/wrapper/raster_wrap.cpp | 279 + src/wrapper/raw_constructor.hpp | 61 + updateMessages.sh | 34 + valgrind.cmdline | 1 + valgrind.suppressions | 808 ++ win/anim/anim.vcxproj | 93 + win/audio/audio.vcxproj | 91 + win/base/base.vcxproj | 177 + win/genwinimportlibs.py | 35 + win/graphics/graphics.vcxproj | 211 + win/imaging/imaging.vcxproj | 126 + win/libavg.props | 44 + win/libavg.sln | 191 + win/lmfit/lmfit.vcxproj | 78 + win/oscpack/oscpack.vcxproj | 100 + win/player/player.vcxproj | 238 + win/testbase/testbase.vcxproj | 76 + win/testgpu/testgpu.vcxproj | 79 + win/testgraphics/testgraphics.vcxproj | 78 + win/testimaging/testimaging.vcxproj | 79 + win/testlimiter/testlimiter.vcxproj | 77 + win/testplayer/testplayer.vcxproj | 77 + win/testplugin/batch_template.txt | 18 + win/testplugin/setup.py | 188 + win/testplugin/testplugin.vcxproj | 91 + win/testvideo/testvideo.vcxproj | 77 + win/video/video.vcxproj | 97 + win/wrapper/wrapper.vcxproj | 96 + 1804 files changed, 193959 insertions(+) create mode 100755 BuildMacDeps.sh create mode 100644 COPYING create mode 100755 CreateVersionFile.py create mode 100644 Makefile.am create mode 100644 NEWS create mode 100755 bootstrap create mode 100755 compile create mode 100644 configure.ac create mode 100644 debian/avg_audioplayer.1 create mode 100644 debian/avg_checktouch.1 create mode 100644 debian/avg_checkvsync.1 create mode 100644 debian/avg_chromakey.1 create mode 100644 debian/avg_showcamera.1 create mode 100644 debian/avg_showfile.1 create mode 100644 debian/avg_showfont.1 create mode 100644 debian/avg_showsvg.1 create mode 100644 debian/avg_videoinfo.1 create mode 100644 debian/avg_videoplayer.1 create mode 100644 debian/changelog create mode 100644 debian/compat create mode 100644 debian/control create mode 100644 debian/copyright create mode 100644 debian/install create mode 100644 debian/libavg.pth create mode 100644 debian/links create mode 100644 debian/patches/foreign.patch create mode 100644 debian/patches/series create mode 100644 debian/python-libavg.examples create mode 100755 debian/rules create mode 100644 debian/source/format create mode 100644 debian/watch create mode 100755 depcomp create mode 100755 fixcopyright.py create mode 100755 install-sh create mode 100644 m4/ac_cxx_namespaces.m4 create mode 100644 m4/ac_path_generic.m4 create mode 100644 m4/avg_version.m4 create mode 100644 m4/ax_boost_thread.m4 create mode 100644 m4/ax_check_define.m4 create mode 100644 m4/ax_check_gl.m4 create mode 100644 m4/ax_python_devel.m4 create mode 100644 m4/pkg.m4 create mode 100755 mac/MakeDist.sh create mode 100755 mac/PackDeps.sh create mode 100755 mac/UnpackDeps.sh create mode 100755 mac/avg_env.sh create mode 100644 mac/dc1394_mavericks.patch create mode 100644 mac/fontconfig-disablecache.patch create mode 100644 mac/fontconfig.pc.in.patch create mode 100644 mac/freetype_linespacing.patch create mode 100755 mac/gcc-fat.sh create mode 100644 mac/glib.patch create mode 100644 mac/installscripts/background.tif create mode 100644 mac/installscripts/postflight create mode 100644 mac/libavg.10.6.pmdoc/01dist-contents.xml create mode 100644 mac/libavg.10.6.pmdoc/01dist.xml create mode 100644 mac/libavg.10.6.pmdoc/02bindist-contents.xml create mode 100644 mac/libavg.10.6.pmdoc/02bindist.xml create mode 100644 mac/libavg.10.6.pmdoc/index.xml create mode 100644 mac/librsvg_configure.patch create mode 100644 mac/librsvg_makefile.patch create mode 100644 mac/libsdl_mavericks.patch create mode 100644 mac/libtool.m4.patch create mode 100644 mac/pkg-config-mavericks.patch create mode 100644 mac/readme.txt create mode 100644 mac/stpncpy.patch create mode 100644 mac/welcome.txt create mode 100755 makedocs.sh create mode 100644 man/Makefile.am create mode 100644 man/avg_audioplayer.1 create mode 100644 man/avg_chromakey.1 create mode 100644 man/avg_showcamera.1 create mode 100644 man/avg_showfile.1 create mode 100644 man/avg_showfont.1 create mode 100644 man/avg_videoinfo.1 create mode 100644 man/avg_videoplayer.1 create mode 100755 man/avgrc.5 create mode 100755 missing create mode 100755 mkinstalldirs create mode 100644 sphinxdoc/ButtonStates.png create mode 100644 sphinxdoc/Recognizer.graffle create mode 100644 sphinxdoc/Recognizer.png create mode 100644 sphinxdoc/ToggleButtonStates.png create mode 100644 sphinxdoc/animation.rst create mode 100644 sphinxdoc/app.rst create mode 100644 sphinxdoc/areanodes.rst create mode 100644 sphinxdoc/basenodes.rst create mode 100644 sphinxdoc/conf.py create mode 100644 sphinxdoc/events.rst create mode 100644 sphinxdoc/fx.rst create mode 100644 sphinxdoc/gesture.rst create mode 100644 sphinxdoc/index.rst create mode 100644 sphinxdoc/misc.rst create mode 100644 sphinxdoc/player.rst create mode 100644 sphinxdoc/vectornodes.rst create mode 100644 sphinxdoc/widget.rst create mode 100644 src/Makefile.am create mode 100755 src/addcopyright.py create mode 100644 src/anim/Anim.cpp create mode 100644 src/anim/Anim.h create mode 100644 src/anim/AttrAnim.cpp create mode 100644 src/anim/AttrAnim.h create mode 100644 src/anim/ContinuousAnim.cpp create mode 100644 src/anim/ContinuousAnim.h create mode 100644 src/anim/EaseInOutAnim.cpp create mode 100644 src/anim/EaseInOutAnim.h create mode 100644 src/anim/LinearAnim.cpp create mode 100644 src/anim/LinearAnim.h create mode 100644 src/anim/Makefile.am create mode 100644 src/anim/ParallelAnim.cpp create mode 100644 src/anim/ParallelAnim.h create mode 100644 src/anim/SimpleAnim.cpp create mode 100644 src/anim/SimpleAnim.h create mode 100644 src/anim/StateAnim.cpp create mode 100644 src/anim/StateAnim.h create mode 100644 src/anim/WaitAnim.cpp create mode 100644 src/anim/WaitAnim.h create mode 100644 src/api.h create mode 100644 src/audio/AudioBuffer.cpp create mode 100644 src/audio/AudioBuffer.h create mode 100644 src/audio/AudioEngine.cpp create mode 100644 src/audio/AudioEngine.h create mode 100644 src/audio/AudioMsg.cpp create mode 100644 src/audio/AudioMsg.h create mode 100644 src/audio/AudioParams.cpp create mode 100644 src/audio/AudioParams.h create mode 100644 src/audio/AudioSource.cpp create mode 100644 src/audio/AudioSource.h create mode 100644 src/audio/Dynamics.h create mode 100644 src/audio/IProcessor.h create mode 100644 src/audio/Makefile.am create mode 100644 src/audio/testlimiter.cpp create mode 100644 src/avgconfig_win.h create mode 100644 src/avgconfigwrapper.h create mode 100644 src/avgrc create mode 100644 src/base/Backtrace.cpp create mode 100644 src/base/Backtrace.h create mode 100644 src/base/BezierCurve.cpp create mode 100644 src/base/BezierCurve.h create mode 100644 src/base/CmdQueue.h create mode 100644 src/base/Command.h create mode 100644 src/base/ConfigMgr.cpp create mode 100644 src/base/ConfigMgr.h create mode 100644 src/base/CubicSpline.cpp create mode 100644 src/base/CubicSpline.h create mode 100644 src/base/DAG.cpp create mode 100644 src/base/DAG.h create mode 100644 src/base/DirEntry.cpp create mode 100644 src/base/DirEntry.h create mode 100644 src/base/Directory.cpp create mode 100644 src/base/Directory.h create mode 100644 src/base/DlfcnWrapper.cpp create mode 100644 src/base/DlfcnWrapper.h create mode 100644 src/base/Exception.cpp create mode 100644 src/base/Exception.h create mode 100644 src/base/FileHelper.cpp create mode 100644 src/base/FileHelper.h create mode 100644 src/base/GLMHelper.cpp create mode 100644 src/base/GLMHelper.h create mode 100644 src/base/GeomHelper.cpp create mode 100644 src/base/GeomHelper.h create mode 100644 src/base/IFrameEndListener.h create mode 100644 src/base/ILogSink.h create mode 100644 src/base/IPlaybackEndListener.h create mode 100644 src/base/IPreRenderListener.h create mode 100644 src/base/Logger.cpp create mode 100644 src/base/Logger.h create mode 100644 src/base/Makefile.am create mode 100644 src/base/MathHelper.cpp create mode 100644 src/base/MathHelper.h create mode 100644 src/base/OSHelper.cpp create mode 100644 src/base/OSHelper.h create mode 100644 src/base/ObjectCounter.cpp create mode 100644 src/base/ObjectCounter.h create mode 100644 src/base/ProfilingZone.cpp create mode 100644 src/base/ProfilingZone.h create mode 100644 src/base/ProfilingZoneID.cpp create mode 100644 src/base/ProfilingZoneID.h create mode 100644 src/base/Queue.h create mode 100644 src/base/Rect.h create mode 100644 src/base/ScopeTimer.cpp create mode 100644 src/base/ScopeTimer.h create mode 100644 src/base/Signal.h create mode 100644 src/base/StandardLogSink.cpp create mode 100644 src/base/StandardLogSink.h create mode 100644 src/base/StringHelper.cpp create mode 100644 src/base/StringHelper.h create mode 100644 src/base/Test.cpp create mode 100644 src/base/Test.h create mode 100644 src/base/TestSuite.cpp create mode 100644 src/base/TestSuite.h create mode 100644 src/base/ThreadHelper.cpp create mode 100644 src/base/ThreadHelper.h create mode 100644 src/base/ThreadProfiler.cpp create mode 100644 src/base/ThreadProfiler.h create mode 100644 src/base/TimeSource.cpp create mode 100644 src/base/TimeSource.h create mode 100644 src/base/Triangle.cpp create mode 100644 src/base/Triangle.h create mode 100644 src/base/UTF8String.cpp create mode 100644 src/base/UTF8String.h create mode 100644 src/base/WideLine.cpp create mode 100644 src/base/WideLine.h create mode 100644 src/base/WorkerThread.cpp create mode 100644 src/base/WorkerThread.h create mode 100644 src/base/XMLHelper.cpp create mode 100644 src/base/XMLHelper.h create mode 100644 src/base/testbase.cpp create mode 100644 src/base/triangulate/AdvancingFront.cpp create mode 100644 src/base/triangulate/AdvancingFront.h create mode 100644 src/base/triangulate/Makefile.am create mode 100644 src/base/triangulate/Shapes.cpp create mode 100644 src/base/triangulate/Shapes.h create mode 100644 src/base/triangulate/Sweep.cpp create mode 100644 src/base/triangulate/Sweep.h create mode 100644 src/base/triangulate/SweepContext.cpp create mode 100644 src/base/triangulate/SweepContext.h create mode 100644 src/base/triangulate/Triangulate.cpp create mode 100644 src/base/triangulate/Triangulate.h create mode 100644 src/base/triangulate/Utils.h create mode 100644 src/glm/CMakeLists.txt create mode 100644 src/glm/core/_detail.hpp create mode 100644 src/glm/core/_fixes.hpp create mode 100644 src/glm/core/_swizzle.hpp create mode 100644 src/glm/core/dummy.cpp create mode 100644 src/glm/core/func_common.hpp create mode 100644 src/glm/core/func_common.inl create mode 100644 src/glm/core/func_exponential.hpp create mode 100644 src/glm/core/func_exponential.inl create mode 100644 src/glm/core/func_geometric.hpp create mode 100644 src/glm/core/func_geometric.inl create mode 100644 src/glm/core/func_integer.hpp create mode 100644 src/glm/core/func_integer.inl create mode 100644 src/glm/core/func_matrix.hpp create mode 100644 src/glm/core/func_matrix.inl create mode 100644 src/glm/core/func_noise.hpp create mode 100644 src/glm/core/func_noise.inl create mode 100644 src/glm/core/func_packing.hpp create mode 100644 src/glm/core/func_packing.inl create mode 100644 src/glm/core/func_trigonometric.hpp create mode 100644 src/glm/core/func_trigonometric.inl create mode 100644 src/glm/core/func_vector_relational.hpp create mode 100644 src/glm/core/func_vector_relational.inl create mode 100644 src/glm/core/hint.hpp create mode 100644 src/glm/core/intrinsic_common.hpp create mode 100644 src/glm/core/intrinsic_common.inl create mode 100644 src/glm/core/intrinsic_exponential.hpp create mode 100644 src/glm/core/intrinsic_exponential.inl create mode 100644 src/glm/core/intrinsic_geometric.hpp create mode 100644 src/glm/core/intrinsic_geometric.inl create mode 100644 src/glm/core/intrinsic_matrix.hpp create mode 100644 src/glm/core/intrinsic_matrix.inl create mode 100644 src/glm/core/intrinsic_trigonometric.hpp create mode 100644 src/glm/core/intrinsic_trigonometric.inl create mode 100644 src/glm/core/intrinsic_vector_relational.hpp create mode 100644 src/glm/core/intrinsic_vector_relational.inl create mode 100644 src/glm/core/setup.hpp create mode 100644 src/glm/core/type.hpp create mode 100644 src/glm/core/type_float.hpp create mode 100644 src/glm/core/type_gentype.hpp create mode 100644 src/glm/core/type_gentype.inl create mode 100644 src/glm/core/type_half.hpp create mode 100644 src/glm/core/type_half.inl create mode 100644 src/glm/core/type_int.hpp create mode 100644 src/glm/core/type_mat.hpp create mode 100644 src/glm/core/type_mat.inl create mode 100644 src/glm/core/type_mat2x2.hpp create mode 100644 src/glm/core/type_mat2x2.inl create mode 100644 src/glm/core/type_mat2x3.hpp create mode 100644 src/glm/core/type_mat2x3.inl create mode 100644 src/glm/core/type_mat2x4.hpp create mode 100644 src/glm/core/type_mat2x4.inl create mode 100644 src/glm/core/type_mat3x2.hpp create mode 100644 src/glm/core/type_mat3x2.inl create mode 100644 src/glm/core/type_mat3x3.hpp create mode 100644 src/glm/core/type_mat3x3.inl create mode 100644 src/glm/core/type_mat3x4.hpp create mode 100644 src/glm/core/type_mat3x4.inl create mode 100644 src/glm/core/type_mat4x2.hpp create mode 100644 src/glm/core/type_mat4x2.inl create mode 100644 src/glm/core/type_mat4x3.hpp create mode 100644 src/glm/core/type_mat4x3.inl create mode 100644 src/glm/core/type_mat4x4.hpp create mode 100644 src/glm/core/type_mat4x4.inl create mode 100644 src/glm/core/type_size.hpp create mode 100644 src/glm/core/type_vec.hpp create mode 100644 src/glm/core/type_vec.inl create mode 100644 src/glm/core/type_vec1.hpp create mode 100644 src/glm/core/type_vec1.inl create mode 100644 src/glm/core/type_vec2.hpp create mode 100644 src/glm/core/type_vec2.inl create mode 100644 src/glm/core/type_vec3.hpp create mode 100644 src/glm/core/type_vec3.inl create mode 100644 src/glm/core/type_vec4.hpp create mode 100644 src/glm/core/type_vec4.inl create mode 100644 src/glm/ext.hpp create mode 100644 src/glm/glm.hpp create mode 100644 src/glm/gtc/half_float.hpp create mode 100644 src/glm/gtc/half_float.inl create mode 100644 src/glm/gtc/matrix_access.hpp create mode 100644 src/glm/gtc/matrix_access.inl create mode 100644 src/glm/gtc/matrix_integer.hpp create mode 100644 src/glm/gtc/matrix_inverse.hpp create mode 100644 src/glm/gtc/matrix_inverse.inl create mode 100644 src/glm/gtc/matrix_transform.hpp create mode 100644 src/glm/gtc/matrix_transform.inl create mode 100644 src/glm/gtc/quaternion.hpp create mode 100644 src/glm/gtc/quaternion.inl create mode 100644 src/glm/gtc/swizzle.hpp create mode 100644 src/glm/gtc/swizzle.inl create mode 100644 src/glm/gtc/type_precision.hpp create mode 100644 src/glm/gtc/type_precision.inl create mode 100644 src/glm/gtc/type_ptr.hpp create mode 100644 src/glm/gtc/type_ptr.inl create mode 100644 src/glm/gtx/associated_min_max.hpp create mode 100644 src/glm/gtx/associated_min_max.inl create mode 100644 src/glm/gtx/bit.hpp create mode 100644 src/glm/gtx/bit.inl create mode 100644 src/glm/gtx/closest_point.hpp create mode 100644 src/glm/gtx/closest_point.inl create mode 100644 src/glm/gtx/color_cast.hpp create mode 100644 src/glm/gtx/color_cast.inl create mode 100644 src/glm/gtx/color_space.hpp create mode 100644 src/glm/gtx/color_space.inl create mode 100644 src/glm/gtx/color_space_YCoCg.hpp create mode 100644 src/glm/gtx/color_space_YCoCg.inl create mode 100644 src/glm/gtx/compatibility.hpp create mode 100644 src/glm/gtx/compatibility.inl create mode 100644 src/glm/gtx/component_wise.hpp create mode 100644 src/glm/gtx/component_wise.inl create mode 100644 src/glm/gtx/epsilon.hpp create mode 100644 src/glm/gtx/epsilon.inl create mode 100644 src/glm/gtx/euler_angles.hpp create mode 100644 src/glm/gtx/euler_angles.inl create mode 100644 src/glm/gtx/extend.hpp create mode 100644 src/glm/gtx/extend.inl create mode 100644 src/glm/gtx/extented_min_max.hpp create mode 100644 src/glm/gtx/extented_min_max.inl create mode 100644 src/glm/gtx/fast_exponential.hpp create mode 100644 src/glm/gtx/fast_exponential.inl create mode 100644 src/glm/gtx/fast_square_root.hpp create mode 100644 src/glm/gtx/fast_square_root.inl create mode 100644 src/glm/gtx/fast_trigonometry.hpp create mode 100644 src/glm/gtx/fast_trigonometry.inl create mode 100644 src/glm/gtx/gradient_paint.hpp create mode 100644 src/glm/gtx/gradient_paint.inl create mode 100644 src/glm/gtx/handed_coordinate_space.hpp create mode 100644 src/glm/gtx/handed_coordinate_space.inl create mode 100644 src/glm/gtx/inertia.hpp create mode 100644 src/glm/gtx/inertia.inl create mode 100644 src/glm/gtx/int_10_10_10_2.hpp create mode 100644 src/glm/gtx/int_10_10_10_2.inl create mode 100644 src/glm/gtx/integer.hpp create mode 100644 src/glm/gtx/integer.inl create mode 100644 src/glm/gtx/intersect.hpp create mode 100644 src/glm/gtx/intersect.inl create mode 100644 src/glm/gtx/log_base.hpp create mode 100644 src/glm/gtx/log_base.inl create mode 100644 src/glm/gtx/matrix_cross_product.hpp create mode 100644 src/glm/gtx/matrix_cross_product.inl create mode 100644 src/glm/gtx/matrix_interpolation.hpp create mode 100644 src/glm/gtx/matrix_interpolation.inl create mode 100644 src/glm/gtx/matrix_major_storage.hpp create mode 100644 src/glm/gtx/matrix_major_storage.inl create mode 100644 src/glm/gtx/matrix_operation.hpp create mode 100644 src/glm/gtx/matrix_operation.inl create mode 100644 src/glm/gtx/matrix_query.hpp create mode 100644 src/glm/gtx/matrix_query.inl create mode 100644 src/glm/gtx/mixed_product.hpp create mode 100644 src/glm/gtx/mixed_product.inl create mode 100644 src/glm/gtx/multiple.hpp create mode 100644 src/glm/gtx/multiple.inl create mode 100644 src/glm/gtx/noise.hpp create mode 100644 src/glm/gtx/noise.inl create mode 100644 src/glm/gtx/norm.hpp create mode 100644 src/glm/gtx/norm.inl create mode 100644 src/glm/gtx/normal.hpp create mode 100644 src/glm/gtx/normal.inl create mode 100644 src/glm/gtx/normalize_dot.hpp create mode 100644 src/glm/gtx/normalize_dot.inl create mode 100644 src/glm/gtx/number_precision.hpp create mode 100644 src/glm/gtx/number_precision.inl create mode 100644 src/glm/gtx/ocl_type.hpp create mode 100644 src/glm/gtx/ocl_type.inl create mode 100644 src/glm/gtx/optimum_pow.hpp create mode 100644 src/glm/gtx/optimum_pow.inl create mode 100644 src/glm/gtx/orthonormalize.hpp create mode 100644 src/glm/gtx/orthonormalize.inl create mode 100644 src/glm/gtx/perpendicular.hpp create mode 100644 src/glm/gtx/perpendicular.inl create mode 100644 src/glm/gtx/polar_coordinates.hpp create mode 100644 src/glm/gtx/polar_coordinates.inl create mode 100644 src/glm/gtx/projection.hpp create mode 100644 src/glm/gtx/projection.inl create mode 100644 src/glm/gtx/quaternion.hpp create mode 100644 src/glm/gtx/quaternion.inl create mode 100644 src/glm/gtx/random.hpp create mode 100644 src/glm/gtx/random.inl create mode 100644 src/glm/gtx/raw_data.hpp create mode 100644 src/glm/gtx/raw_data.inl create mode 100644 src/glm/gtx/reciprocal.hpp create mode 100644 src/glm/gtx/reciprocal.inl create mode 100644 src/glm/gtx/rotate_vector.hpp create mode 100644 src/glm/gtx/rotate_vector.inl create mode 100644 src/glm/gtx/simd_mat4.hpp create mode 100644 src/glm/gtx/simd_mat4.inl create mode 100644 src/glm/gtx/simd_vec4.hpp create mode 100644 src/glm/gtx/simd_vec4.inl create mode 100644 src/glm/gtx/simplex.hpp create mode 100644 src/glm/gtx/simplex.inl create mode 100644 src/glm/gtx/spline.hpp create mode 100644 src/glm/gtx/spline.inl create mode 100644 src/glm/gtx/std_based_type.hpp create mode 100644 src/glm/gtx/std_based_type.inl create mode 100644 src/glm/gtx/string_cast.hpp create mode 100644 src/glm/gtx/string_cast.inl create mode 100644 src/glm/gtx/transform.hpp create mode 100644 src/glm/gtx/transform.inl create mode 100644 src/glm/gtx/transform2.hpp create mode 100644 src/glm/gtx/transform2.inl create mode 100644 src/glm/gtx/ulp.hpp create mode 100644 src/glm/gtx/ulp.inl create mode 100644 src/glm/gtx/unsigned_int.hpp create mode 100644 src/glm/gtx/unsigned_int.inl create mode 100644 src/glm/gtx/vec1.hpp create mode 100644 src/glm/gtx/vec1.inl create mode 100644 src/glm/gtx/vector_access.hpp create mode 100644 src/glm/gtx/vector_access.inl create mode 100644 src/glm/gtx/vector_angle.hpp create mode 100644 src/glm/gtx/vector_angle.inl create mode 100644 src/glm/gtx/vector_query.hpp create mode 100644 src/glm/gtx/vector_query.inl create mode 100644 src/glm/gtx/verbose_operator.hpp create mode 100644 src/glm/gtx/verbose_operator.inl create mode 100644 src/glm/gtx/wrap.hpp create mode 100644 src/glm/gtx/wrap.inl create mode 100644 src/glm/virtrev/xstream.hpp create mode 100644 src/graphics/AppleDisplay.cpp create mode 100644 src/graphics/AppleDisplay.h create mode 100644 src/graphics/BCMDisplay.cpp create mode 100644 src/graphics/BCMDisplay.h create mode 100644 src/graphics/Bitmap.cpp create mode 100644 src/graphics/Bitmap.h create mode 100644 src/graphics/BitmapLoader.cpp create mode 100644 src/graphics/BitmapLoader.h create mode 100644 src/graphics/BmpTextureMover.cpp create mode 100644 src/graphics/BmpTextureMover.h create mode 100644 src/graphics/CGLContext.cpp create mode 100644 src/graphics/CGLContext.h create mode 100644 src/graphics/ContribDefs.h create mode 100644 src/graphics/Display.cpp create mode 100644 src/graphics/Display.h create mode 100644 src/graphics/EGLContext.cpp create mode 100644 src/graphics/EGLContext.h create mode 100644 src/graphics/FBO.cpp create mode 100644 src/graphics/FBO.h create mode 100644 src/graphics/Filter.cpp create mode 100644 src/graphics/Filter.h create mode 100644 src/graphics/Filter3x3.cpp create mode 100644 src/graphics/Filter3x3.h create mode 100644 src/graphics/FilterBandpass.cpp create mode 100644 src/graphics/FilterBandpass.h create mode 100644 src/graphics/FilterBlur.cpp create mode 100644 src/graphics/FilterBlur.h create mode 100644 src/graphics/FilterConvol.h create mode 100644 src/graphics/FilterDilation.cpp create mode 100644 src/graphics/FilterDilation.h create mode 100644 src/graphics/FilterErosion.cpp create mode 100644 src/graphics/FilterErosion.h create mode 100644 src/graphics/FilterFastBandpass.cpp create mode 100644 src/graphics/FilterFastBandpass.h create mode 100644 src/graphics/FilterFastDownscale.cpp create mode 100644 src/graphics/FilterFastDownscale.h create mode 100644 src/graphics/FilterFloodfill.h create mode 100644 src/graphics/FilterGauss.cpp create mode 100644 src/graphics/FilterGauss.h create mode 100644 src/graphics/FilterGetAlpha.cpp create mode 100644 src/graphics/FilterGetAlpha.h create mode 100644 src/graphics/FilterHighpass.cpp create mode 100644 src/graphics/FilterHighpass.h create mode 100644 src/graphics/FilterIntensity.cpp create mode 100644 src/graphics/FilterIntensity.h create mode 100644 src/graphics/FilterMask.cpp create mode 100644 src/graphics/FilterMask.h create mode 100644 src/graphics/FilterNormalize.cpp create mode 100644 src/graphics/FilterNormalize.h create mode 100644 src/graphics/FilterResizeBilinear.cpp create mode 100644 src/graphics/FilterResizeBilinear.h create mode 100644 src/graphics/FilterResizeGaussian.cpp create mode 100644 src/graphics/FilterResizeGaussian.h create mode 100644 src/graphics/FilterThreshold.cpp create mode 100644 src/graphics/FilterThreshold.h create mode 100644 src/graphics/FilterUnmultiplyAlpha.cpp create mode 100644 src/graphics/FilterUnmultiplyAlpha.h create mode 100644 src/graphics/Filtercolorize.cpp create mode 100644 src/graphics/Filtercolorize.h create mode 100644 src/graphics/Filterfill.h create mode 100644 src/graphics/Filterfillrect.h create mode 100644 src/graphics/Filterflip.cpp create mode 100644 src/graphics/Filterflip.h create mode 100644 src/graphics/FilterflipX.cpp create mode 100644 src/graphics/FilterflipX.h create mode 100644 src/graphics/Filterfliprgb.cpp create mode 100644 src/graphics/Filterfliprgb.h create mode 100644 src/graphics/Filterfliprgba.cpp create mode 100644 src/graphics/Filterfliprgba.h create mode 100644 src/graphics/Filterflipuv.cpp create mode 100644 src/graphics/Filterflipuv.h create mode 100644 src/graphics/Filtergrayscale.cpp create mode 100644 src/graphics/Filtergrayscale.h create mode 100644 src/graphics/GL/gl.h create mode 100644 src/graphics/GL/glext.h create mode 100644 src/graphics/GL/glu.h create mode 100644 src/graphics/GL/glx.h create mode 100644 src/graphics/GL/wglext.h create mode 100644 src/graphics/GLBufferCache.cpp create mode 100644 src/graphics/GLBufferCache.h create mode 100644 src/graphics/GLConfig.cpp create mode 100644 src/graphics/GLConfig.h create mode 100644 src/graphics/GLContext.cpp create mode 100644 src/graphics/GLContext.h create mode 100644 src/graphics/GLContextAttribs.cpp create mode 100644 src/graphics/GLContextAttribs.h create mode 100644 src/graphics/GLShaderParam.cpp create mode 100644 src/graphics/GLShaderParam.h create mode 100644 src/graphics/GLTexture.cpp create mode 100644 src/graphics/GLTexture.h create mode 100644 src/graphics/GLXContext.cpp create mode 100644 src/graphics/GLXContext.h create mode 100644 src/graphics/GPUBandpassFilter.cpp create mode 100644 src/graphics/GPUBandpassFilter.h create mode 100644 src/graphics/GPUBlurFilter.cpp create mode 100644 src/graphics/GPUBlurFilter.h create mode 100644 src/graphics/GPUBrightnessFilter.cpp create mode 100644 src/graphics/GPUBrightnessFilter.h create mode 100644 src/graphics/GPUChromaKeyFilter.cpp create mode 100644 src/graphics/GPUChromaKeyFilter.h create mode 100644 src/graphics/GPUFilter.cpp create mode 100644 src/graphics/GPUFilter.h create mode 100644 src/graphics/GPUHueSatFilter.cpp create mode 100644 src/graphics/GPUHueSatFilter.h create mode 100644 src/graphics/GPUInvertFilter.cpp create mode 100644 src/graphics/GPUInvertFilter.h create mode 100644 src/graphics/GPUNullFilter.cpp create mode 100644 src/graphics/GPUNullFilter.h create mode 100644 src/graphics/GPURGB2YUVFilter.cpp create mode 100644 src/graphics/GPURGB2YUVFilter.h create mode 100644 src/graphics/GPUShadowFilter.cpp create mode 100644 src/graphics/GPUShadowFilter.h create mode 100644 src/graphics/GraphicsTest.cpp create mode 100644 src/graphics/GraphicsTest.h create mode 100644 src/graphics/HistoryPreProcessor.cpp create mode 100644 src/graphics/HistoryPreProcessor.h create mode 100644 src/graphics/ImagingProjection.cpp create mode 100644 src/graphics/ImagingProjection.h create mode 100644 src/graphics/Makefile.am create mode 100644 src/graphics/OGLHelper.cpp create mode 100644 src/graphics/OGLHelper.h create mode 100644 src/graphics/OGLShader.cpp create mode 100644 src/graphics/OGLShader.h create mode 100644 src/graphics/PBO.cpp create mode 100644 src/graphics/PBO.h create mode 100644 src/graphics/Pixel16.h create mode 100644 src/graphics/Pixel24.h create mode 100644 src/graphics/Pixel32.cpp create mode 100644 src/graphics/Pixel32.h create mode 100644 src/graphics/Pixel8.h create mode 100644 src/graphics/PixelFormat.cpp create mode 100644 src/graphics/PixelFormat.h create mode 100644 src/graphics/Pixeldefs.h create mode 100644 src/graphics/ShaderRegistry.cpp create mode 100644 src/graphics/ShaderRegistry.h create mode 100644 src/graphics/StandardShader.cpp create mode 100644 src/graphics/StandardShader.h create mode 100644 src/graphics/SubVertexArray.cpp create mode 100644 src/graphics/SubVertexArray.h create mode 100644 src/graphics/TextureMover.cpp create mode 100644 src/graphics/TextureMover.h create mode 100644 src/graphics/TwoPassScale.h create mode 100644 src/graphics/VertexArray.cpp create mode 100644 src/graphics/VertexArray.h create mode 100644 src/graphics/VertexData.cpp create mode 100644 src/graphics/VertexData.h create mode 100644 src/graphics/WGLContext.cpp create mode 100644 src/graphics/WGLContext.h create mode 100644 src/graphics/WinDisplay.cpp create mode 100644 src/graphics/WinDisplay.h create mode 100644 src/graphics/X11Display.cpp create mode 100644 src/graphics/X11Display.h create mode 100644 src/graphics/baseline/BandpassResult.png create mode 100644 src/graphics/baseline/BlurResult.png create mode 100644 src/graphics/baseline/ChromaKeyMedianResult.png create mode 100644 src/graphics/baseline/ChromaKeyResult0.png create mode 100644 src/graphics/baseline/ChromaKeyResult1.png create mode 100644 src/graphics/baseline/ChromaKeyResult2.png create mode 100644 src/graphics/baseline/ChromaKeySpillResult1.png create mode 100644 src/graphics/baseline/ChromaKeySpillResult2.png create mode 100644 src/graphics/baseline/ChromaKeySpillResult3.png create mode 100644 src/graphics/baseline/DilationResult.png create mode 100644 src/graphics/baseline/ErosionResult.png create mode 100644 src/graphics/baseline/FastBandpassResult.png create mode 100644 src/graphics/baseline/FastDownscaleResult.png create mode 100644 src/graphics/baseline/FloodfillResult.png create mode 100644 src/graphics/baseline/Gauss15Result.png create mode 100644 src/graphics/baseline/Gauss1Result.png create mode 100644 src/graphics/baseline/Gauss3Result.png create mode 100644 src/graphics/baseline/Gauss5Result.png create mode 100644 src/graphics/baseline/GetAlphaResult.png create mode 100644 src/graphics/baseline/HighpassResult.png create mode 100644 src/graphics/baseline/HslColorizeResult0.png create mode 100644 src/graphics/baseline/HslColorizeResult1.png create mode 100644 src/graphics/baseline/HslColorizeResult2.png create mode 100644 src/graphics/baseline/HslHueResult0.png create mode 100644 src/graphics/baseline/HslHueResult1.png create mode 100644 src/graphics/baseline/HslHueResult2.png create mode 100644 src/graphics/baseline/LineResultB8G8R8.png create mode 100644 src/graphics/baseline/LineResultB8G8R8A8.png create mode 100644 src/graphics/baseline/LineResultI8.png create mode 100644 src/graphics/baseline/MaskResultB8G8R8.png create mode 100644 src/graphics/baseline/MaskResultB8G8R8X8.png create mode 100644 src/graphics/baseline/MaskResultI8.png create mode 100644 src/graphics/baseline/ResizeBilinearResultB8G8R8.png create mode 100644 src/graphics/baseline/ResizeBilinearResultB8G8R8A8.png create mode 100644 src/graphics/baseline/ResizeBilinearResultB8G8R8X8.png create mode 100644 src/graphics/baseline/ThresholdResult.png create mode 100644 src/graphics/baseline/YUV2RGBResult1.png create mode 100644 src/graphics/baseline/bandpass_i8-64x64.png create mode 100644 src/graphics/baseline/bandpass_spike.png create mode 100644 src/graphics/baseline/blur05_flat.png create mode 100644 src/graphics/baseline/blur05_spike.png create mode 100644 src/graphics/baseline/blur1_spike.png create mode 100644 src/graphics/baseline/blur3_spike.png create mode 100644 src/graphics/baseline/blur_rgb24-64x64.png create mode 100644 src/graphics/baseline/blur_rgb24alpha-64x64.png create mode 100644 src/graphics/baseline/copyPixels_B8G8R8X8_I8.png create mode 100644 src/graphics/baseline/copyPixels_R8G8B8X8_I8.png create mode 100644 src/graphics/baseline/invert_rgb24-64x64.png create mode 100644 src/graphics/benchmarkgraphics.cpp create mode 100644 src/graphics/shaders/Makefile.am create mode 100644 src/graphics/shaders/bandpass.frag create mode 100644 src/graphics/shaders/brightness.frag create mode 100644 src/graphics/shaders/chromakey.frag create mode 100644 src/graphics/shaders/chromakey_erosion.frag create mode 100644 src/graphics/shaders/helper.frag create mode 100644 src/graphics/shaders/horizblur.frag create mode 100644 src/graphics/shaders/horizshadow.frag create mode 100644 src/graphics/shaders/huesat.frag create mode 100644 src/graphics/shaders/invert.frag create mode 100644 src/graphics/shaders/minimal.frag create mode 100644 src/graphics/shaders/null.frag create mode 100644 src/graphics/shaders/rgb2yuv.frag create mode 100644 src/graphics/shaders/standard.frag create mode 100644 src/graphics/shaders/standard.vert create mode 100644 src/graphics/shaders/vertblur.frag create mode 100644 src/graphics/shaders/vertshadow.frag create mode 100644 src/graphics/testgpu.cpp create mode 100644 src/graphics/testgraphics.cpp create mode 100644 src/imaging/Blob.cpp create mode 100644 src/imaging/Blob.h create mode 100644 src/imaging/CMUCamera.cpp create mode 100644 src/imaging/CMUCamera.h create mode 100644 src/imaging/CMUCameraUtils.cpp create mode 100644 src/imaging/CMUCameraUtils.h create mode 100644 src/imaging/Camera.cpp create mode 100644 src/imaging/Camera.h create mode 100644 src/imaging/CameraInfo.cpp create mode 100644 src/imaging/CameraInfo.h create mode 100644 src/imaging/CoordTransformer.cpp create mode 100644 src/imaging/CoordTransformer.h create mode 100644 src/imaging/DSCamera.cpp create mode 100644 src/imaging/DSCamera.h create mode 100644 src/imaging/DSHelper.cpp create mode 100644 src/imaging/DSHelper.h create mode 100644 src/imaging/DSSampleGrabber.cpp create mode 100644 src/imaging/DSSampleGrabber.h create mode 100644 src/imaging/DeDistort.cpp create mode 100644 src/imaging/DeDistort.h create mode 100644 src/imaging/FWCamera.cpp create mode 100644 src/imaging/FWCamera.h create mode 100644 src/imaging/FWCameraUtils.cpp create mode 100644 src/imaging/FWCameraUtils.h create mode 100644 src/imaging/FakeCamera.cpp create mode 100644 src/imaging/FakeCamera.h create mode 100644 src/imaging/FilterClearBorder.cpp create mode 100644 src/imaging/FilterClearBorder.h create mode 100644 src/imaging/FilterDistortion.cpp create mode 100644 src/imaging/FilterDistortion.h create mode 100644 src/imaging/FilterWipeBorder.cpp create mode 100644 src/imaging/FilterWipeBorder.h create mode 100644 src/imaging/IDSSampleCallback.h create mode 100644 src/imaging/Makefile.am create mode 100644 src/imaging/Run.cpp create mode 100644 src/imaging/Run.h create mode 100644 src/imaging/TrackerConfig.cpp create mode 100644 src/imaging/TrackerConfig.h create mode 100644 src/imaging/TrackerThread.cpp create mode 100644 src/imaging/TrackerThread.h create mode 100644 src/imaging/V4LCamera.cpp create mode 100644 src/imaging/V4LCamera.h create mode 100644 src/imaging/avgtrackerrc.minimal create mode 100644 src/imaging/baseline/FilterClearBorderResult1.png create mode 100644 src/imaging/baseline/FilterClearBorderResult3.png create mode 100644 src/imaging/baseline/FilterWipeBorderResult1.png create mode 100644 src/imaging/baseline/FilterWipeBorderResult3.png create mode 100644 src/imaging/checktracking.cpp create mode 100644 src/imaging/qedit.h create mode 100644 src/imaging/test_comp.png create mode 100644 src/imaging/testimaging.cpp create mode 100644 src/imaging/trackerconfigdtd.cpp create mode 100644 src/imaging/trackerconfigdtd.h create mode 100644 src/lmfit/Makefile.am create mode 100644 src/lmfit/lm_eval.c create mode 100644 src/lmfit/lm_eval.h create mode 100644 src/lmfit/lmmin.c create mode 100644 src/lmfit/lmmin.h create mode 100644 src/oscpack/CHANGES create mode 100644 src/oscpack/IpEndpointName.cpp create mode 100644 src/oscpack/IpEndpointName.h create mode 100644 src/oscpack/LICENSE create mode 100644 src/oscpack/Makefile.am create mode 100644 src/oscpack/MessageMappingOscPacketListener.h create mode 100644 src/oscpack/NetworkingUtils.cpp create mode 100644 src/oscpack/NetworkingUtils.h create mode 100644 src/oscpack/OscException.h create mode 100644 src/oscpack/OscHostEndianness.h create mode 100644 src/oscpack/OscOutboundPacketStream.cpp create mode 100644 src/oscpack/OscOutboundPacketStream.h create mode 100644 src/oscpack/OscPacketListener.h create mode 100644 src/oscpack/OscPrintReceivedElements.cpp create mode 100644 src/oscpack/OscPrintReceivedElements.h create mode 100644 src/oscpack/OscReceivedElements.cpp create mode 100644 src/oscpack/OscReceivedElements.h create mode 100644 src/oscpack/OscTypes.cpp create mode 100644 src/oscpack/OscTypes.h create mode 100644 src/oscpack/PacketListener.h create mode 100644 src/oscpack/README create mode 100644 src/oscpack/TODO create mode 100644 src/oscpack/TimerListener.h create mode 100644 src/oscpack/UdpSocket.cpp create mode 100644 src/oscpack/UdpSocket.h create mode 100644 src/player/AVGNode.cpp create mode 100644 src/player/AVGNode.h create mode 100644 src/player/AppleTrackpadInputDevice.cpp create mode 100644 src/player/AppleTrackpadInputDevice.h create mode 100644 src/player/AreaNode.cpp create mode 100644 src/player/AreaNode.h create mode 100644 src/player/Arg.cpp create mode 100644 src/player/Arg.h create mode 100644 src/player/ArgBase.cpp create mode 100644 src/player/ArgBase.h create mode 100644 src/player/ArgList.cpp create mode 100644 src/player/ArgList.h create mode 100644 src/player/BitmapManager.cpp create mode 100644 src/player/BitmapManager.h create mode 100644 src/player/BitmapManagerMsg.cpp create mode 100644 src/player/BitmapManagerMsg.h create mode 100644 src/player/BitmapManagerThread.cpp create mode 100644 src/player/BitmapManagerThread.h create mode 100644 src/player/BlurFXNode.cpp create mode 100644 src/player/BlurFXNode.h create mode 100644 src/player/BoostPython.h create mode 100644 src/player/CameraNode.cpp create mode 100644 src/player/CameraNode.h create mode 100644 src/player/Canvas.cpp create mode 100644 src/player/Canvas.h create mode 100644 src/player/CanvasNode.cpp create mode 100644 src/player/CanvasNode.h create mode 100644 src/player/ChromaKeyFXNode.cpp create mode 100644 src/player/ChromaKeyFXNode.h create mode 100644 src/player/CircleNode.cpp create mode 100644 src/player/CircleNode.h create mode 100644 src/player/Contact.cpp create mode 100644 src/player/Contact.h create mode 100644 src/player/CursorEvent.cpp create mode 100644 src/player/CursorEvent.h create mode 100644 src/player/CursorState.cpp create mode 100644 src/player/CursorState.h create mode 100644 src/player/CurveNode.cpp create mode 100644 src/player/CurveNode.h create mode 100644 src/player/DisplayEngine.cpp create mode 100644 src/player/DisplayEngine.h create mode 100644 src/player/DisplayParams.cpp create mode 100644 src/player/DisplayParams.h create mode 100644 src/player/DivNode.cpp create mode 100644 src/player/DivNode.h create mode 100644 src/player/Event.cpp create mode 100644 src/player/Event.h create mode 100644 src/player/EventDispatcher.cpp create mode 100644 src/player/EventDispatcher.h create mode 100644 src/player/ExportedObject.cpp create mode 100644 src/player/ExportedObject.h create mode 100644 src/player/FXNode.cpp create mode 100644 src/player/FXNode.h create mode 100644 src/player/FilledVectorNode.cpp create mode 100644 src/player/FilledVectorNode.h create mode 100644 src/player/FontStyle.cpp create mode 100644 src/player/FontStyle.h create mode 100644 src/player/HueSatFXNode.cpp create mode 100644 src/player/HueSatFXNode.h create mode 100644 src/player/IBitmapLoadedListener.h create mode 100644 src/player/IInputDevice.h create mode 100644 src/player/Image.cpp create mode 100644 src/player/Image.h create mode 100644 src/player/ImageNode.cpp create mode 100644 src/player/ImageNode.h create mode 100644 src/player/InvertFXNode.cpp create mode 100644 src/player/InvertFXNode.h create mode 100644 src/player/KeyEvent.cpp create mode 100644 src/player/KeyEvent.h create mode 100644 src/player/LibMTDevInputDevice.cpp create mode 100644 src/player/LibMTDevInputDevice.h create mode 100644 src/player/LineNode.cpp create mode 100644 src/player/LineNode.h create mode 100644 src/player/MainCanvas.cpp create mode 100644 src/player/MainCanvas.h create mode 100644 src/player/Makefile.am create mode 100644 src/player/MaterialInfo.cpp create mode 100644 src/player/MaterialInfo.h create mode 100644 src/player/MeshNode.cpp create mode 100644 src/player/MeshNode.h create mode 100644 src/player/MessageID.cpp create mode 100644 src/player/MessageID.h create mode 100644 src/player/MouseEvent.cpp create mode 100644 src/player/MouseEvent.h create mode 100644 src/player/MultitouchInputDevice.cpp create mode 100644 src/player/MultitouchInputDevice.h create mode 100644 src/player/Node.cpp create mode 100644 src/player/Node.h create mode 100644 src/player/NullFXNode.cpp create mode 100644 src/player/NullFXNode.h create mode 100644 src/player/OGLSurface.cpp create mode 100644 src/player/OGLSurface.h create mode 100644 src/player/OffscreenCanvas.cpp create mode 100644 src/player/OffscreenCanvas.h create mode 100644 src/player/OffscreenCanvasNode.cpp create mode 100644 src/player/OffscreenCanvasNode.h create mode 100644 src/player/Player.cpp create mode 100644 src/player/Player.h create mode 100644 src/player/PluginManager.cpp create mode 100644 src/player/PluginManager.h create mode 100644 src/player/PolyLineNode.cpp create mode 100644 src/player/PolyLineNode.h create mode 100644 src/player/PolygonNode.cpp create mode 100644 src/player/PolygonNode.h create mode 100644 src/player/Publisher.cpp create mode 100644 src/player/Publisher.h create mode 100644 src/player/PublisherDefinition.cpp create mode 100644 src/player/PublisherDefinition.h create mode 100644 src/player/PublisherDefinitionRegistry.cpp create mode 100644 src/player/PublisherDefinitionRegistry.h create mode 100644 src/player/PythonLogSink.cpp create mode 100644 src/player/PythonLogSink.h create mode 100644 src/player/RasterNode.cpp create mode 100644 src/player/RasterNode.h create mode 100644 src/player/RectNode.cpp create mode 100644 src/player/RectNode.h create mode 100644 src/player/SDLDisplayEngine.cpp create mode 100644 src/player/SDLDisplayEngine.h create mode 100644 src/player/SDLMain.h create mode 100644 src/player/SDLMain.m create mode 100644 src/player/SVG.cpp create mode 100644 src/player/SVG.h create mode 100644 src/player/SVGElement.cpp create mode 100644 src/player/SVGElement.h create mode 100644 src/player/ShadowFXNode.cpp create mode 100644 src/player/ShadowFXNode.h create mode 100644 src/player/Shape.cpp create mode 100644 src/player/Shape.h create mode 100644 src/player/SoundNode.cpp create mode 100644 src/player/SoundNode.h create mode 100644 src/player/SubscriberInfo.cpp create mode 100644 src/player/SubscriberInfo.h create mode 100644 src/player/TUIOInputDevice.cpp create mode 100644 src/player/TUIOInputDevice.h create mode 100644 src/player/TestHelper.cpp create mode 100644 src/player/TestHelper.h create mode 100644 src/player/TextEngine.cpp create mode 100644 src/player/TextEngine.h create mode 100644 src/player/Timeout.cpp create mode 100644 src/player/Timeout.h create mode 100644 src/player/TouchEvent.cpp create mode 100644 src/player/TouchEvent.h create mode 100644 src/player/TouchStatus.cpp create mode 100644 src/player/TouchStatus.h create mode 100644 src/player/TrackerCalibrator.cpp create mode 100644 src/player/TrackerCalibrator.h create mode 100644 src/player/TrackerInputDevice.cpp create mode 100644 src/player/TrackerInputDevice.h create mode 100644 src/player/TrackerTouchStatus.cpp create mode 100644 src/player/TrackerTouchStatus.h create mode 100644 src/player/TypeDefinition.cpp create mode 100644 src/player/TypeDefinition.h create mode 100644 src/player/TypeRegistry.cpp create mode 100644 src/player/TypeRegistry.h create mode 100644 src/player/VectorNode.cpp create mode 100644 src/player/VectorNode.h create mode 100644 src/player/VersionInfo.cpp create mode 100644 src/player/VersionInfo.h create mode 100644 src/player/VideoNode.cpp create mode 100644 src/player/VideoNode.h create mode 100644 src/player/VideoWriter.cpp create mode 100644 src/player/VideoWriter.h create mode 100644 src/player/VideoWriterThread.cpp create mode 100644 src/player/VideoWriterThread.h create mode 100644 src/player/Win7TouchInputDevice.cpp create mode 100644 src/player/Win7TouchInputDevice.h create mode 100644 src/player/WordsNode.cpp create mode 100644 src/player/WordsNode.h create mode 100644 src/player/WrapPython.cpp create mode 100644 src/player/WrapPython.h create mode 100644 src/player/XInputMTInputDevice.cpp create mode 100644 src/player/XInputMTInputDevice.h create mode 100644 src/player/testcalibrator.cpp create mode 100644 src/player/testplayer.cpp create mode 100644 src/python/Makefile.am create mode 100644 src/python/__init__.py create mode 100644 src/python/app/Makefile.am create mode 100644 src/python/app/__init__.py create mode 100644 src/python/app/app.py create mode 100644 src/python/app/debugpanel.py create mode 100644 src/python/app/flashmessage.py create mode 100644 src/python/app/keyboardmanager.py create mode 100644 src/python/app/settings.py create mode 100644 src/python/app/touchvisualization.py create mode 100644 src/python/apphelpers.py create mode 100644 src/python/appstarter.py create mode 100644 src/python/avgapp.py create mode 100644 src/python/camcalibrator.py create mode 100644 src/python/coordcalibrator.py create mode 100644 src/python/data/CamImgBorder.png create mode 100644 src/python/data/Feedback.png create mode 100644 src/python/data/Makefile.am create mode 100644 src/python/data/SimpleSkin.xml create mode 100644 src/python/data/TouchFeedback.png create mode 100644 src/python/data/black.png create mode 100644 src/python/data/border.png create mode 100644 src/python/data/button_bg_down.png create mode 100644 src/python/data/button_bg_up.png create mode 100644 src/python/data/checkbox_checked_disabled.png create mode 100644 src/python/data/checkbox_checked_down.png create mode 100644 src/python/data/checkbox_checked_up.png create mode 100644 src/python/data/checkbox_unchecked_disabled.png create mode 100644 src/python/data/checkbox_unchecked_down.png create mode 100644 src/python/data/checkbox_unchecked_up.png create mode 100644 src/python/data/crosshair.png create mode 100644 src/python/data/mpeg1-48x48-sound.avi create mode 100644 src/python/data/mpeg1-48x48.mov create mode 100644 src/python/data/pause_button_down.png create mode 100644 src/python/data/pause_button_up.png create mode 100644 src/python/data/play_button_down.png create mode 100644 src/python/data/play_button_up.png create mode 100644 src/python/data/rgb24alpha-64x64.png create mode 100644 src/python/data/scrollarea_border.png create mode 100644 src/python/data/scrollbar_horiz_thumb_down.png create mode 100644 src/python/data/scrollbar_horiz_thumb_up.png create mode 100644 src/python/data/scrollbar_horiz_track.png create mode 100644 src/python/data/scrollbar_horiz_track_disabled.png create mode 100644 src/python/data/scrollbar_vert_thumb_down.png create mode 100644 src/python/data/scrollbar_vert_thumb_up.png create mode 100644 src/python/data/scrollbar_vert_track.png create mode 100644 src/python/data/scrollbar_vert_track_disabled.png create mode 100644 src/python/data/skin.xsd create mode 100644 src/python/data/slider_horiz_track.png create mode 100644 src/python/data/slider_horiz_track_disabled.png create mode 100644 src/python/data/slider_thumb_down.png create mode 100644 src/python/data/slider_thumb_up.png create mode 100644 src/python/data/slider_vert_track.png create mode 100644 src/python/data/slider_vert_track_disabled.png create mode 100644 src/python/enumcompat.py create mode 100644 src/python/filter.py create mode 100644 src/python/geom.py create mode 100644 src/python/gesture.py create mode 100644 src/python/graph.py create mode 100644 src/python/mathutil.py create mode 100644 src/python/methodref.py create mode 100644 src/python/mtemu.py create mode 100644 src/python/parsecamargs.py create mode 100644 src/python/persist.py create mode 100644 src/python/statemachine.py create mode 100644 src/python/textarea.py create mode 100644 src/python/utils.py create mode 100644 src/python/widget/Makefile.am create mode 100644 src/python/widget/__init__.py create mode 100644 src/python/widget/base.py create mode 100644 src/python/widget/button.py create mode 100644 src/python/widget/keyboard.py create mode 100644 src/python/widget/mediacontrol.py create mode 100644 src/python/widget/scrollarea.py create mode 100644 src/python/widget/skin.py create mode 100644 src/python/widget/slider.py create mode 100644 src/samples/Makefile.am create mode 100755 src/samples/abort_gestures.py create mode 100755 src/samples/anim1.py create mode 100755 src/samples/anim2.py create mode 100755 src/samples/app_complete.py create mode 100755 src/samples/app_minimal.py create mode 100755 src/samples/asyncload.py create mode 100755 src/samples/attributes.py create mode 100755 src/samples/canvas.py create mode 100755 src/samples/drag.py create mode 100755 src/samples/event1.py create mode 100755 src/samples/event2.py create mode 100644 src/samples/firebirds/LICENSE create mode 100644 src/samples/firebirds/Makefile.am create mode 100755 src/samples/firebirds/firebirds.py create mode 100644 src/samples/firebirds/media/Fire_Birds.mp3 create mode 100644 src/samples/firebirds/media/Makefile.am create mode 100644 src/samples/firebirds/media/bullet.gif create mode 100644 src/samples/firebirds/media/bullet.mov create mode 100644 src/samples/firebirds/media/bulletSound.mp3 create mode 100644 src/samples/firebirds/media/enemy.gif create mode 100644 src/samples/firebirds/media/enemy.mov create mode 100644 src/samples/firebirds/media/enemyDeath.mp3 create mode 100644 src/samples/firebirds/media/explosion.mov create mode 100644 src/samples/firebirds/media/flySound.mp3 create mode 100644 src/samples/firebirds/media/ground.jpg create mode 100644 src/samples/firebirds/media/gui_frame.png create mode 100644 src/samples/firebirds/media/gui_heatbar_bg.png create mode 100644 src/samples/firebirds/media/gui_heatbar_fg.png create mode 100644 src/samples/firebirds/media/gui_lives_bg.png create mode 100644 src/samples/firebirds/media/gui_lives_fg.png create mode 100644 src/samples/firebirds/media/gui_numbers.png create mode 100644 src/samples/firebirds/media/spitfire.gif create mode 100644 src/samples/firebirds/media/spitfire.mov create mode 100644 src/samples/firebirds/plugin/CollisionDetector.cpp create mode 100644 src/samples/firebirds/plugin/CollisionDetector.h create mode 100644 src/samples/firebirds/plugin/Makefile.am create mode 100644 src/samples/flashmessages.py create mode 100755 src/samples/fontstyle.py create mode 100755 src/samples/gestures.py create mode 100755 src/samples/globalcoords.py create mode 100755 src/samples/invertfx.py create mode 100755 src/samples/localcoords.py create mode 100755 src/samples/localcoordsrot.py create mode 100755 src/samples/logsample.py create mode 100755 src/samples/mesh.py create mode 100755 src/samples/minimal.py create mode 100644 src/samples/mpeg1-48x48-sound.avi create mode 100755 src/samples/plugin.py create mode 100644 src/samples/rgb24-64x64.png create mode 100755 src/samples/rotcustompivot.py create mode 100755 src/samples/rotdefaultpivot.py create mode 100755 src/samples/showvideo.py create mode 100755 src/samples/slideshow.py create mode 100755 src/samples/subclass.py create mode 100755 src/samples/timer.py create mode 100755 src/samples/timer2.py create mode 100755 src/samples/timer3.py create mode 100755 src/samples/twovideos.py create mode 100755 src/samples/video.py create mode 100755 src/samples/videochooser.py create mode 100755 src/samples/widget.py create mode 100755 src/samples/wordspos.py create mode 100644 src/test/AVGAppTest.py create mode 100644 src/test/AVTest.py create mode 100644 src/test/AnimTest.py create mode 100644 src/test/AppTest.py create mode 100644 src/test/DynamicsTest.py create mode 100644 src/test/EventTest.py create mode 100644 src/test/FXTest.py create mode 100644 src/test/GestureTest.py create mode 100644 src/test/ImageTest.py create mode 100644 src/test/InputDeviceTest.py create mode 100644 src/test/LoggerTest.py create mode 100644 src/test/Makefile.am create mode 100644 src/test/OffscreenTest.py create mode 100644 src/test/PlayerTest.py create mode 100644 src/test/PluginTest.py create mode 100644 src/test/PythonTest.py create mode 100755 src/test/Test.py create mode 100644 src/test/VectorTest.py create mode 100644 src/test/WidgetTest.py create mode 100644 src/test/WordsTest.py create mode 100644 src/test/baseline/test2VideosAtOnce1.png create mode 100644 src/test/baseline/testAVGFile.png create mode 100644 src/test/baseline/testAnim1.png create mode 100644 src/test/baseline/testAnim2.png create mode 100644 src/test/baseline/testAnim3.png create mode 100644 src/test/baseline/testArc1.png create mode 100644 src/test/baseline/testArc2.png create mode 100644 src/test/baseline/testBitmap1.png create mode 100644 src/test/baseline/testBitmap2.png create mode 100644 src/test/baseline/testBitmap3.png create mode 100644 src/test/baseline/testBitmap4.png create mode 100644 src/test/baseline/testBlend1.png create mode 100644 src/test/baseline/testBlend2.png create mode 100644 src/test/baseline/testBlurFX1.png create mode 100644 src/test/baseline/testBlurFX2.png create mode 100644 src/test/baseline/testBlurFX3.png create mode 100644 src/test/baseline/testButtonDisabled.png create mode 100644 src/test/baseline/testButtonDown.png create mode 100644 src/test/baseline/testButtonOver.png create mode 100644 src/test/baseline/testButtonUp.png create mode 100644 src/test/baseline/testCanvasAlpha.png create mode 100644 src/test/baseline/testCanvasBlendModes.png create mode 100644 src/test/baseline/testCanvasCrop.png create mode 100644 src/test/baseline/testCanvasDependencies1.png create mode 100644 src/test/baseline/testCanvasDependencies2.png create mode 100644 src/test/baseline/testCanvasMipmap.png create mode 100644 src/test/baseline/testCanvasMultisample.png create mode 100644 src/test/baseline/testCanvasNullFX1.png create mode 100644 src/test/baseline/testCanvasNullFX2.png create mode 100644 src/test/baseline/testCanvasNullFX3.png create mode 100644 src/test/baseline/testCanvasResize.png create mode 100644 src/test/baseline/testCheckboxClickedDown.png create mode 100644 src/test/baseline/testCheckboxClickedOut.png create mode 100644 src/test/baseline/testCheckboxClickedOver.png create mode 100644 src/test/baseline/testCheckboxDown.png create mode 100644 src/test/baseline/testCheckboxOver.png create mode 100644 src/test/baseline/testCheckboxUp.png create mode 100644 src/test/baseline/testChromaKeyFX1.png create mode 100644 src/test/baseline/testChromaKeyFX2.png create mode 100644 src/test/baseline/testChromaKeyFX3.png create mode 100644 src/test/baseline/testChromaKeyFX4.png create mode 100644 src/test/baseline/testCircle1.png create mode 100644 src/test/baseline/testCircle2.png create mode 100644 src/test/baseline/testCircle3.png create mode 100644 src/test/baseline/testCircle4.png create mode 100644 src/test/baseline/testCircle5.png create mode 100644 src/test/baseline/testColorFX1.png create mode 100644 src/test/baseline/testColorFX2.png create mode 100644 src/test/baseline/testColorFX3.png create mode 100644 src/test/baseline/testColorFX4.png create mode 100644 src/test/baseline/testColorFX5.png create mode 100644 src/test/baseline/testColorFX6.png create mode 100644 src/test/baseline/testColorFX7.png create mode 100644 src/test/baseline/testComplexDiv1.png create mode 100644 src/test/baseline/testContAnim1.png create mode 100644 src/test/baseline/testContAnim2.png create mode 100644 src/test/baseline/testContAnim3.png create mode 100644 src/test/baseline/testContAnim4.png create mode 100644 src/test/baseline/testContinuousAnim1.png create mode 100644 src/test/baseline/testContinuousAnim2.png create mode 100644 src/test/baseline/testContrast1.png create mode 100644 src/test/baseline/testContrast2.png create mode 100644 src/test/baseline/testContrast3.png create mode 100644 src/test/baseline/testCropImage1.png create mode 100644 src/test/baseline/testCropImage10.png create mode 100644 src/test/baseline/testCropImage2.png create mode 100644 src/test/baseline/testCropImage3.png create mode 100644 src/test/baseline/testCropImage4.png create mode 100644 src/test/baseline/testCropImage5.png create mode 100644 src/test/baseline/testCropImage6.png create mode 100644 src/test/baseline/testCropImage7.png create mode 100644 src/test/baseline/testCropImage8.png create mode 100644 src/test/baseline/testCropImage9.png create mode 100644 src/test/baseline/testCropMovie1.png create mode 100644 src/test/baseline/testCropMovie10.png create mode 100644 src/test/baseline/testCropMovie2.png create mode 100644 src/test/baseline/testCropMovie3.png create mode 100644 src/test/baseline/testCropMovie4.png create mode 100644 src/test/baseline/testCropMovie5.png create mode 100644 src/test/baseline/testCropMovie6.png create mode 100644 src/test/baseline/testCropMovie7.png create mode 100644 src/test/baseline/testCropMovie8.png create mode 100644 src/test/baseline/testCropMovie9.png create mode 100644 src/test/baseline/testCurve1.png create mode 100644 src/test/baseline/testCurve2.png create mode 100644 src/test/baseline/testCurve3.png create mode 100644 src/test/baseline/testCurve4.png create mode 100644 src/test/baseline/testDivDynamics1.png create mode 100644 src/test/baseline/testDivDynamics2.png create mode 100644 src/test/baseline/testDivDynamics3.png create mode 100644 src/test/baseline/testDivDynamics4.png create mode 100644 src/test/baseline/testDivDynamics5.png create mode 100644 src/test/baseline/testDraggable1.png create mode 100644 src/test/baseline/testDraggable2.png create mode 100644 src/test/baseline/testDynamicMediaDir1.png create mode 100644 src/test/baseline/testDynamicMediaDir2.png create mode 100644 src/test/baseline/testDynamicWords1.png create mode 100644 src/test/baseline/testDynamicWords2.png create mode 100644 src/test/baseline/testDynamicWords3.png create mode 100644 src/test/baseline/testDynamicWords4.png create mode 100644 src/test/baseline/testEaseInOutAnim1.png create mode 100644 src/test/baseline/testEaseInOutAnim2.png create mode 100644 src/test/baseline/testEaseInOutAnim3.png create mode 100644 src/test/baseline/testEaseInOutAnimC1.png create mode 100644 src/test/baseline/testEaseInOutAnimC2.png create mode 100644 src/test/baseline/testEaseInOutAnimC3.png create mode 100644 src/test/baseline/testEaseInOutAnimC4.png create mode 100644 src/test/baseline/testEaseInOutAnimC5.png create mode 100644 src/test/baseline/testEaseInOutAnimC6.png create mode 100644 src/test/baseline/testEvents.png create mode 100644 src/test/baseline/testFXUpdateFX.png create mode 100644 src/test/baseline/testFXUpdateMaskPos.png create mode 100644 src/test/baseline/testFXUpdateMaskTex1.png create mode 100644 src/test/baseline/testFXUpdateMaskTex2.png create mode 100644 src/test/baseline/testFXUpdateTex.png create mode 100644 src/test/baseline/testFXUpdateVideo.png create mode 100644 src/test/baseline/testFadeIn1.png create mode 100644 src/test/baseline/testFadeIn2.png create mode 100644 src/test/baseline/testFadeIn3.png create mode 100644 src/test/baseline/testFadeOut1.png create mode 100644 src/test/baseline/testFadeOut2.png create mode 100644 src/test/baseline/testFadeOut3.png create mode 100644 src/test/baseline/testFocusContext1.png create mode 100644 src/test/baseline/testFocusContext2.png create mode 100644 src/test/baseline/testFocusContext3.png create mode 100644 src/test/baseline/testFocusContext4.png create mode 100644 src/test/baseline/testFocusContext5.png create mode 100644 src/test/baseline/testFontDir.png create mode 100644 src/test/baseline/testFontStyle1.png create mode 100644 src/test/baseline/testFontStyle2.png create mode 100644 src/test/baseline/testGamma1.png create mode 100644 src/test/baseline/testGamma2.png create mode 100644 src/test/baseline/testHVStretchNode1.png create mode 100644 src/test/baseline/testHVStretchNode2.png create mode 100644 src/test/baseline/testHinting1.png create mode 100644 src/test/baseline/testHueSatFX1.png create mode 100644 src/test/baseline/testHueSatFX2.png create mode 100644 src/test/baseline/testHueSatFX3.png create mode 100644 src/test/baseline/testHueSatFX4.png create mode 100644 src/test/baseline/testHugeImage0.png create mode 100644 src/test/baseline/testHugeImage1.png create mode 100644 src/test/baseline/testI18NWords1.png create mode 100644 src/test/baseline/testI18NWords2.png create mode 100644 src/test/baseline/testI18NWords3.png create mode 100644 src/test/baseline/testImageNullFX1.png create mode 100644 src/test/baseline/testImageNullFX2.png create mode 100644 src/test/baseline/testImageNullFX3.png create mode 100644 src/test/baseline/testImgDynamics1.png create mode 100644 src/test/baseline/testImgDynamics2.png create mode 100644 src/test/baseline/testImgDynamics3.png create mode 100644 src/test/baseline/testImgDynamics4.png create mode 100644 src/test/baseline/testImgDynamics5.png create mode 100644 src/test/baseline/testImgHRef1.png create mode 100644 src/test/baseline/testImgHRef2.png create mode 100644 src/test/baseline/testImgHRef3.png create mode 100644 src/test/baseline/testImgMask1.png create mode 100644 src/test/baseline/testImgMask2.png create mode 100644 src/test/baseline/testImgMask3.png create mode 100644 src/test/baseline/testImgMaskCanvas.png create mode 100644 src/test/baseline/testImgMaskPos.png create mode 100644 src/test/baseline/testImgMaskSize1.png create mode 100644 src/test/baseline/testImgMaskSize2.png create mode 100644 src/test/baseline/testImgMaskSize3.png create mode 100644 src/test/baseline/testImgPos1.png create mode 100644 src/test/baseline/testImgPos2.png create mode 100644 src/test/baseline/testImgSize1.png create mode 100644 src/test/baseline/testImgSize2.png create mode 100644 src/test/baseline/testImgWarp1.png create mode 100644 src/test/baseline/testImgWarp2.png create mode 100644 src/test/baseline/testInactiveVector1.png create mode 100644 src/test/baseline/testInactiveVector2.png create mode 100644 src/test/baseline/testIntAnim1.png create mode 100644 src/test/baseline/testIntAnim2.png create mode 100644 src/test/baseline/testIntensity1.png create mode 100644 src/test/baseline/testIntensity2.png create mode 100644 src/test/baseline/testIntensity3.png create mode 100644 src/test/baseline/testIntensity4.png create mode 100644 src/test/baseline/testInvertFX1.png create mode 100644 src/test/baseline/testInvertFX2.png create mode 100644 src/test/baseline/testJustify.png create mode 100644 src/test/baseline/testLetterSpacing1.png create mode 100644 src/test/baseline/testLetterSpacing2.png create mode 100644 src/test/baseline/testLinearAnim1.png create mode 100644 src/test/baseline/testLinearAnim2.png create mode 100644 src/test/baseline/testLinearAnim3.png create mode 100644 src/test/baseline/testLinearAnimC1.png create mode 100644 src/test/baseline/testLinearAnimC2.png create mode 100644 src/test/baseline/testLinearAnimC3.png create mode 100644 src/test/baseline/testLinearAnimC4.png create mode 100644 src/test/baseline/testLinearAnimC5.png create mode 100644 src/test/baseline/testLinearAnimC6.png create mode 100644 src/test/baseline/testLinearAnimZeroDuration1.png create mode 100644 src/test/baseline/testLinearAnimZeroDuration2.png create mode 100644 src/test/baseline/testLinearAnimZeroDuration3.png create mode 100644 src/test/baseline/testLinearAnimZeroDurationC1.png create mode 100644 src/test/baseline/testLinearAnimZeroDurationC2.png create mode 100644 src/test/baseline/testLinearAnimZeroDurationC3.png create mode 100644 src/test/baseline/testMediaControl1.png create mode 100644 src/test/baseline/testMediaControl2.png create mode 100644 src/test/baseline/testMediaControl3.png create mode 100644 src/test/baseline/testMediaControl4.png create mode 100644 src/test/baseline/testMediaControl5.png create mode 100644 src/test/baseline/testMediaDir1.png create mode 100644 src/test/baseline/testMediaDir2.png create mode 100644 src/test/baseline/testMesh1.png create mode 100644 src/test/baseline/testMesh2.png create mode 100644 src/test/baseline/testMesh3.png create mode 100644 src/test/baseline/testMesh4.png create mode 100644 src/test/baseline/testMesh5.png create mode 100644 src/test/baseline/testMesh6.png create mode 100644 src/test/baseline/testMesh7.png create mode 100644 src/test/baseline/testMesh8.png create mode 100644 src/test/baseline/testMipmap.png create mode 100644 src/test/baseline/testMove1.png create mode 100644 src/test/baseline/testNodeInCanvasNullFX1.png create mode 100644 src/test/baseline/testOffscreen1.png create mode 100644 src/test/baseline/testOffscreen2.png create mode 100644 src/test/baseline/testOffscreen3.png create mode 100644 src/test/baseline/testOffscreen4.png create mode 100644 src/test/baseline/testOffscreen5.png create mode 100644 src/test/baseline/testOffscreenAutoRender1.png create mode 100644 src/test/baseline/testOffscreenAutoRender2.png create mode 100644 src/test/baseline/testOffscreenMultisampleScreenshot.png create mode 100644 src/test/baseline/testOffscreenScreenshot.png create mode 100644 src/test/baseline/testOpacity.png create mode 100644 src/test/baseline/testOutlines.png create mode 100644 src/test/baseline/testPanoDynamics1.png create mode 100644 src/test/baseline/testPanoDynamics2.png create mode 100644 src/test/baseline/testPanoDynamics3.png create mode 100644 src/test/baseline/testPanoImage.png create mode 100644 src/test/baseline/testPanoImagewNOP.png create mode 100644 src/test/baseline/testParaWords.png create mode 100644 src/test/baseline/testParallelAnimC1.png create mode 100644 src/test/baseline/testParallelAnimC2.png create mode 100644 src/test/baseline/testParallelAnimC3.png create mode 100644 src/test/baseline/testParallelAnims1.png create mode 100644 src/test/baseline/testParallelAnims2.png create mode 100644 src/test/baseline/testPieSlice1.png create mode 100644 src/test/baseline/testPieSlice2.png create mode 100644 src/test/baseline/testPieSlice3.png create mode 100644 src/test/baseline/testPlayBeforeConnect.png create mode 100644 src/test/baseline/testPointAnim1.png create mode 100644 src/test/baseline/testPointAnim2.png create mode 100644 src/test/baseline/testPointAnim3.png create mode 100644 src/test/baseline/testPolyLine1.png create mode 100644 src/test/baseline/testPolyLine2.png create mode 100644 src/test/baseline/testPolyLine3.png create mode 100644 src/test/baseline/testPolyLine4.png create mode 100644 src/test/baseline/testPolyLine5.png create mode 100644 src/test/baseline/testPolyLine6.png create mode 100644 src/test/baseline/testPolygon1.png create mode 100644 src/test/baseline/testPolygon2.png create mode 100644 src/test/baseline/testPolygon3.png create mode 100644 src/test/baseline/testPolygon4.png create mode 100644 src/test/baseline/testPolygon5.png create mode 100644 src/test/baseline/testPolygon6.png create mode 100644 src/test/baseline/testPolygon7.png create mode 100644 src/test/baseline/testPolygon8.png create mode 100644 src/test/baseline/testPolygon9.png create mode 100644 src/test/baseline/testPolygonHole1.png create mode 100644 src/test/baseline/testPolygonHole2.png create mode 100644 src/test/baseline/testPositioning.png create mode 100644 src/test/baseline/testProgressBar1.png create mode 100644 src/test/baseline/testProgressBar2.png create mode 100644 src/test/baseline/testProgressBar3.png create mode 100644 src/test/baseline/testRawText1.png create mode 100644 src/test/baseline/testRawText2.png create mode 100644 src/test/baseline/testRawText3.png create mode 100644 src/test/baseline/testRawText4.png create mode 100644 src/test/baseline/testRect1.png create mode 100644 src/test/baseline/testRect2.png create mode 100644 src/test/baseline/testRect3.png create mode 100644 src/test/baseline/testRect4.png create mode 100644 src/test/baseline/testRenderPipeline.png create mode 100644 src/test/baseline/testRotate1.png create mode 100644 src/test/baseline/testRotate1a.png create mode 100644 src/test/baseline/testRotate1b.png create mode 100644 src/test/baseline/testRotate2.png create mode 100644 src/test/baseline/testRotatePivot1.png create mode 100644 src/test/baseline/testRotatePivot2.png create mode 100644 src/test/baseline/testRotatePivot3.png create mode 100644 src/test/baseline/testRoundedRect1.png create mode 100644 src/test/baseline/testRoundedRect2.png create mode 100644 src/test/baseline/testRoundedRect3.png create mode 100644 src/test/baseline/testRoundedRect4.png create mode 100644 src/test/baseline/testRoundedRect5.png create mode 100644 src/test/baseline/testRoundedRect6.png create mode 100644 src/test/baseline/testScrollArea1.png create mode 100644 src/test/baseline/testScrollArea2.png create mode 100644 src/test/baseline/testScrollArea3.png create mode 100644 src/test/baseline/testScrollBarHoriz1.png create mode 100644 src/test/baseline/testScrollBarHoriz10.png create mode 100644 src/test/baseline/testScrollBarHoriz11.png create mode 100644 src/test/baseline/testScrollBarHoriz12.png create mode 100644 src/test/baseline/testScrollBarHoriz2.png create mode 100644 src/test/baseline/testScrollBarHoriz3.png create mode 100644 src/test/baseline/testScrollBarHoriz4.png create mode 100644 src/test/baseline/testScrollBarHoriz5.png create mode 100644 src/test/baseline/testScrollBarHoriz6.png create mode 100644 src/test/baseline/testScrollBarHoriz7.png create mode 100644 src/test/baseline/testScrollBarHoriz8.png create mode 100644 src/test/baseline/testScrollBarHoriz9.png create mode 100644 src/test/baseline/testScrollBarVert1.png create mode 100644 src/test/baseline/testScrollBarVert2.png create mode 100644 src/test/baseline/testScrollBarVert3.png create mode 100644 src/test/baseline/testScrollBarVert4.png create mode 100644 src/test/baseline/testScrollBarVert5.png create mode 100644 src/test/baseline/testScrollBarVert6.png create mode 100644 src/test/baseline/testScrollBarVert7.png create mode 100644 src/test/baseline/testScrollBarVert8.png create mode 100644 src/test/baseline/testScrollBarVert9.png create mode 100644 src/test/baseline/testScrollPane1.png create mode 100644 src/test/baseline/testScrollPane2.png create mode 100644 src/test/baseline/testScrollPane3.png create mode 100644 src/test/baseline/testSeekAfterEOF.png create mode 100644 src/test/baseline/testShadowFX1.png create mode 100644 src/test/baseline/testShadowFX2.png create mode 100644 src/test/baseline/testShadowFX3.png create mode 100644 src/test/baseline/testShadowFX4.png create mode 100644 src/test/baseline/testShadowFX5.png create mode 100644 src/test/baseline/testShadowFX6.png create mode 100644 src/test/baseline/testSimpleWords.png create mode 100644 src/test/baseline/testSliderHoriz1.png create mode 100644 src/test/baseline/testSliderHoriz2.png create mode 100644 src/test/baseline/testSliderHoriz3.png create mode 100644 src/test/baseline/testSliderHoriz4.png create mode 100644 src/test/baseline/testSliderHoriz5.png create mode 100644 src/test/baseline/testSliderVert1.png create mode 100644 src/test/baseline/testSliderVert2.png create mode 100644 src/test/baseline/testSliderVert3.png create mode 100644 src/test/baseline/testSliderVert4.png create mode 100644 src/test/baseline/testSliderVert5.png create mode 100644 src/test/baseline/testSpanWords.png create mode 100644 src/test/baseline/testSplineAnim1.png create mode 100644 src/test/baseline/testSplineAnim2.png create mode 100644 src/test/baseline/testSplineAnim3.png create mode 100644 src/test/baseline/testStateAnim1.png create mode 100644 src/test/baseline/testStateAnim2.png create mode 100644 src/test/baseline/testStateAnim3.png create mode 100644 src/test/baseline/testStateAnim4.png create mode 100644 src/test/baseline/testStateAnim5.png create mode 100644 src/test/baseline/testStateAnimC1.png create mode 100644 src/test/baseline/testStateAnimC2.png create mode 100644 src/test/baseline/testStateAnimC3.png create mode 100644 src/test/baseline/testStateAnimC4.png create mode 100644 src/test/baseline/testStateAnimC5.png create mode 100644 src/test/baseline/testStretchNodeHoriz1.png create mode 100644 src/test/baseline/testStretchNodeHoriz2.png create mode 100644 src/test/baseline/testStretchNodeVert1.png create mode 100644 src/test/baseline/testStretchNodeVert2.png create mode 100644 src/test/baseline/testSvgBmp.png create mode 100644 src/test/baseline/testSvgNode.png create mode 100644 src/test/baseline/testSvgPosBmp.png create mode 100644 src/test/baseline/testSvgScaleBmp1.png create mode 100644 src/test/baseline/testSvgScaleBmp2.png create mode 100644 src/test/baseline/testSvgScaledNode1.png create mode 100644 src/test/baseline/testSvgScaledNode2.png create mode 100644 src/test/baseline/testTexCompression1.png create mode 100644 src/test/baseline/testTexCompression2.png create mode 100644 src/test/baseline/testTextArea1.png create mode 100644 src/test/baseline/testTextArea2.png create mode 100644 src/test/baseline/testTextArea3.png create mode 100644 src/test/baseline/testTextArea4.png create mode 100644 src/test/baseline/testTextArea5.png create mode 100644 src/test/baseline/testTextButtonDisabled.png create mode 100644 src/test/baseline/testTextButtonDown.png create mode 100644 src/test/baseline/testTextButtonDownNewText.png create mode 100644 src/test/baseline/testTextButtonUp.png create mode 100644 src/test/baseline/testTextButtonUpNewText.png create mode 100644 src/test/baseline/testTexturedCurve1.png create mode 100644 src/test/baseline/testTexturedCurve2.png create mode 100644 src/test/baseline/testTexturedPolyLine1.png create mode 100644 src/test/baseline/testTexturedPolyLine2.png create mode 100644 src/test/baseline/testTexturedPolyLine3.png create mode 100644 src/test/baseline/testTexturedPolyLine4.png create mode 100644 src/test/baseline/testTexturedPolygon1.png create mode 100644 src/test/baseline/testTexturedPolygon2.png create mode 100644 src/test/baseline/testTexturedPolygon3.png create mode 100644 src/test/baseline/testTexturedPolygon4.png create mode 100644 src/test/baseline/testTexturedPolygon5.png create mode 100644 src/test/baseline/testTexturedPolygon6.png create mode 100644 src/test/baseline/testTexturedRect1.png create mode 100644 src/test/baseline/testTexturedRect2.png create mode 100644 src/test/baseline/testTexturedRect3.png create mode 100644 src/test/baseline/testTexturedRect4.png create mode 100644 src/test/baseline/testTexturedRect5.png create mode 100644 src/test/baseline/testTexturedRect6.png create mode 100644 src/test/baseline/testTexturedRect7.png create mode 100644 src/test/baseline/testTexturedRect8.png create mode 100644 src/test/baseline/testTimeSliderHoriz1.png create mode 100644 src/test/baseline/testTimeSliderHoriz2.png create mode 100644 src/test/baseline/testTimeSliderHoriz3.png create mode 100644 src/test/baseline/testTimeSliderHoriz4.png create mode 100644 src/test/baseline/testTimeSliderHoriz5.png create mode 100644 src/test/baseline/testTimeSliderVert1.png create mode 100644 src/test/baseline/testTimeSliderVert2.png create mode 100644 src/test/baseline/testTimeSliderVert3.png create mode 100644 src/test/baseline/testTimeSliderVert4.png create mode 100644 src/test/baseline/testTimeSliderVert5.png create mode 100644 src/test/baseline/testUIButtonDisabled.png create mode 100644 src/test/baseline/testUIButtonDown.png create mode 100644 src/test/baseline/testUIButtonUp.png create mode 100644 src/test/baseline/testUICheckBoxChecked_Down.png create mode 100644 src/test/baseline/testUICheckBoxChecked_Up.png create mode 100644 src/test/baseline/testUICheckBoxUnchecked_Disabled.png create mode 100644 src/test/baseline/testUICheckBoxUnchecked_Down.png create mode 100644 src/test/baseline/testUICheckBoxUnchecked_Up.png create mode 100644 src/test/baseline/testUIKeyboard.png create mode 100644 src/test/baseline/testUIKeyboard1S.png create mode 100644 src/test/baseline/testUIKeyboardA.png create mode 100644 src/test/baseline/testUIKeyboardA1S.png create mode 100644 src/test/baseline/testUIKeyboardAS.png create mode 100644 src/test/baseline/testUIKeyboardDown11.png create mode 100644 src/test/baseline/testUIKeyboardDownA212S2.png create mode 100644 src/test/baseline/testUIKeyboardDownA2S1.png create mode 100644 src/test/baseline/testUIKeyboardFB.png create mode 100644 src/test/baseline/testUIKeyboardFB1.png create mode 100644 src/test/baseline/testUIKeyboardFBA1S.png create mode 100644 src/test/baseline/testUIKeyboardFBAS.png create mode 100644 src/test/baseline/testUIKeyboardFBS.png create mode 100644 src/test/baseline/testUIKeyboardNoFB1S.png create mode 100644 src/test/baseline/testUIKeyboardS.png create mode 100644 src/test/baseline/testUIToggleChecked_Disabled.png create mode 100644 src/test/baseline/testUIToggleChecked_Down.png create mode 100644 src/test/baseline/testUIToggleChecked_Up.png create mode 100644 src/test/baseline/testUIToggleUnchecked_Disabled.png create mode 100644 src/test/baseline/testUIToggleUnchecked_Down.png create mode 100644 src/test/baseline/testUIToggleUnchecked_Up.png create mode 100644 src/test/baseline/testVideo-h264-48x48.h2641.png create mode 100644 src/test/baseline/testVideo-mjpeg-48x48.avi1.png create mode 100644 src/test/baseline/testVideo-mpeg1-48x48-sound.avi1.png create mode 100644 src/test/baseline/testVideo-mpeg1-48x48.mov1.png create mode 100644 src/test/baseline/testVideo-rgba-48x48.mov1.png create mode 100644 src/test/baseline/testVideo-vp6a-yuva-48x48.flv1.png create mode 100644 src/test/baseline/testVideoActive1.png create mode 100644 src/test/baseline/testVideoActive2.png create mode 100644 src/test/baseline/testVideoDynamics1.png create mode 100644 src/test/baseline/testVideoDynamics2.png create mode 100644 src/test/baseline/testVideoDynamics3.png create mode 100644 src/test/baseline/testVideoDynamics4.png create mode 100644 src/test/baseline/testVideoDynamics5.png create mode 100644 src/test/baseline/testVideoFPS.png create mode 100644 src/test/baseline/testVideoHRef1.png create mode 100644 src/test/baseline/testVideoLoop.png create mode 100644 src/test/baseline/testVideoMaskRGBA1.png create mode 100644 src/test/baseline/testVideoMaskRGBA2.png create mode 100644 src/test/baseline/testVideoMaskRGBA3.png create mode 100644 src/test/baseline/testVideoMaskRGBA4.png create mode 100644 src/test/baseline/testVideoMaskYUV1.png create mode 100644 src/test/baseline/testVideoMaskYUV2.png create mode 100644 src/test/baseline/testVideoMaskYUV3.png create mode 100644 src/test/baseline/testVideoMaskYUV4.png create mode 100644 src/test/baseline/testVideoMaskYUVJ1.png create mode 100644 src/test/baseline/testVideoMaskYUVJ2.png create mode 100644 src/test/baseline/testVideoMaskYUVJ3.png create mode 100644 src/test/baseline/testVideoMaskYUVJ4.png create mode 100644 src/test/baseline/testVideoNullFX.png create mode 100644 src/test/baseline/testVideoOpacityRGBA1.png create mode 100644 src/test/baseline/testVideoOpacityRGBA2.png create mode 100644 src/test/baseline/testVideoOpacityYUV1.png create mode 100644 src/test/baseline/testVideoOpacityYUV2.png create mode 100644 src/test/baseline/testVideoSeek0.png create mode 100644 src/test/baseline/testVideoSeek1.png create mode 100644 src/test/baseline/testVideoSeek2.png create mode 100644 src/test/baseline/testVideoSeek3.png create mode 100644 src/test/baseline/testVideoState1.png create mode 100644 src/test/baseline/testVideoState2.png create mode 100644 src/test/baseline/testVideoState3.png create mode 100644 src/test/baseline/testVideoState4.png create mode 100644 src/test/baseline/testVideoState5.png create mode 100644 src/test/baseline/testVideoWriter1.png create mode 100644 src/test/baseline/testVideoWriterCanvas1.png create mode 100644 src/test/baseline/testWarp1.png create mode 100644 src/test/baseline/testWarp2.png create mode 100644 src/test/baseline/testWarp3.png create mode 100644 src/test/baseline/testWordsBR.png create mode 100644 src/test/baseline/testWordsDynamics1.png create mode 100644 src/test/baseline/testWordsDynamics2.png create mode 100644 src/test/baseline/testWordsDynamics3.png create mode 100644 src/test/baseline/testWordsDynamics4.png create mode 100644 src/test/baseline/testWordsDynamics5.png create mode 100644 src/test/baseline/testWordsGamma1.png create mode 100644 src/test/baseline/testWordsGamma2.png create mode 100644 src/test/baseline/testWordsIntensity.png create mode 100644 src/test/baseline/testWordsMask1.png create mode 100644 src/test/baseline/testWordsMask2.png create mode 100644 src/test/baseline/testWordsMask3.png create mode 100644 src/test/baseline/testWordsMask4.png create mode 100644 src/test/baseline/testWordsMask5.png create mode 100644 src/test/baseline/testWordsMask6.png create mode 100644 src/test/baseline/testWordsMask7.png create mode 100644 src/test/baseline/testWordsNullFX.png create mode 100644 src/test/baseline/testWordsOutlines.png create mode 100644 src/test/baseline/testWordsShadowFX1.png create mode 100644 src/test/baseline/testWordsShadowFX2.png create mode 100644 src/test/baseline/testWrapMode1.png create mode 100644 src/test/baseline/testWrapMode2.png create mode 100644 src/test/baseline/testWrapMode3.png create mode 100644 src/test/baseline/testWrapMode4.png create mode 100644 src/test/baseline/testXPosPointAnim1.png create mode 100644 src/test/baseline/testXPosPointAnim2.png create mode 100644 src/test/baseline/testXPosPointAnim3.png create mode 100644 src/test/baseline/testYPosPointAnim1.png create mode 100644 src/test/baseline/testYPosPointAnim2.png create mode 100644 src/test/baseline/testYPosPointAnim3.png create mode 100644 src/test/baseline/testbasics.png create mode 100644 src/test/baseline/testline1.png create mode 100644 src/test/baseline/testline2.png create mode 100644 src/test/baseline/testline3.png create mode 100644 src/test/baseline/testline4.png create mode 100644 src/test/baseline/testlineopacity1.png create mode 100644 src/test/baseline/testlineopacity2.png create mode 100644 src/test/baseline/testlotsoflines.png create mode 100644 src/test/baseline/testplugin1.png create mode 100644 src/test/baseline/testplugin2.png create mode 100644 src/test/baseline/testtexturedline1.png create mode 100644 src/test/baseline/testtexturedline2.png create mode 100644 src/test/baseline/testtexturedline3.png create mode 100644 src/test/baseline/testtexturedline4.png create mode 100644 src/test/baseline/testtexturedline5.png create mode 100644 src/test/camcfgs.py create mode 100755 src/test/checkcamera.py create mode 100644 src/test/extrafonts/testaddfontdir.ttf create mode 100644 src/test/fonts/Vera.ttf create mode 100644 src/test/fonts/VeraBI.ttf create mode 100644 src/test/fonts/VeraBd.ttf create mode 100644 src/test/fonts/VeraIt.ttf create mode 100644 src/test/illustratorRect.svg create mode 100644 src/test/image.avg create mode 100644 src/test/media/1x1_white.png create mode 100755 src/test/media/22.050Hz_16bit_mono.wav create mode 100644 src/test/media/44.1kHz_16bit_6Chan.ogg create mode 100755 src/test/media/44.1kHz_16bit_mono.wav create mode 100755 src/test/media/44.1kHz_16bit_stereo.aif create mode 100755 src/test/media/44.1kHz_16bit_stereo.wav create mode 100755 src/test/media/44.1kHz_24bit_mono.wav create mode 100755 src/test/media/44.1kHz_24bit_stereo.aif create mode 100755 src/test/media/44.1kHz_24bit_stereo.wav create mode 100755 src/test/media/44.1kHz_mono.ogg create mode 100644 src/test/media/44.1kHz_stereo.mp3 create mode 100644 src/test/media/44.1kHz_stereo.ogg create mode 100755 src/test/media/48kHz_16bit_mono.wav create mode 100755 src/test/media/48kHz_16bit_stereo.aif create mode 100755 src/test/media/48kHz_16bit_stereo.wav create mode 100755 src/test/media/48kHz_24bit_mono.wav create mode 100755 src/test/media/48kHz_24bit_stereo.aif create mode 100755 src/test/media/48kHz_24bit_stereo.wav create mode 100644 src/test/media/48kHz_stereo.mp3 create mode 100644 src/test/media/48kHz_stereo.ogg create mode 100644 src/test/media/CustomSkin.xml create mode 100644 src/test/media/SimpleSkin.xml create mode 100644 src/test/media/button_bg_down.png create mode 100644 src/test/media/button_bg_up.png create mode 100644 src/test/media/button_check.png create mode 100644 src/test/media/button_disabled.png create mode 100644 src/test/media/button_down.png create mode 100644 src/test/media/button_over.png create mode 100644 src/test/media/button_up.png create mode 100644 src/test/media/checkbox_checked_disabled.png create mode 100644 src/test/media/checkbox_checked_down.png create mode 100644 src/test/media/checkbox_checked_up.png create mode 100644 src/test/media/checkbox_unchecked_disabled.png create mode 100644 src/test/media/checkbox_unchecked_down.png create mode 100644 src/test/media/checkbox_unchecked_up.png create mode 100644 src/test/media/checker.png create mode 100644 src/test/media/chromakey-median.png create mode 100644 src/test/media/chromakey.png create mode 100644 src/test/media/colorramp.png create mode 100644 src/test/media/crop_bkgd.png create mode 100644 src/test/media/dilation.png create mode 100644 src/test/media/erosion.png create mode 100644 src/test/media/filterwipeborder.png create mode 100644 src/test/media/flat.png create mode 100644 src/test/media/floodfill.png create mode 100644 src/test/media/freidrehen.jpg create mode 100644 src/test/media/greyscale.png create mode 100644 src/test/media/h264-48x48.h264 create mode 100644 src/test/media/hsl.png create mode 100644 src/test/media/i8-64x64.png create mode 100644 src/test/media/incompleteSkinMedia/IncompleteSkin.xml create mode 100644 src/test/media/incompleteSkinMedia/scrollbar_horiz_thumb_down.png create mode 100644 src/test/media/incompleteSkinMedia/scrollbar_horiz_thumb_up.png create mode 100644 src/test/media/incompleteSkinMedia/scrollbar_horiz_track.png create mode 100644 src/test/media/incompleteSkinMedia/scrollbar_horiz_track_disabled.png create mode 100644 src/test/media/keyboard_bg.png create mode 100644 src/test/media/keyboard_down.png create mode 100644 src/test/media/keyboard_feedback.png create mode 100644 src/test/media/mask.png create mode 100644 src/test/media/mask1.png create mode 100644 src/test/media/mask2.png create mode 100644 src/test/media/mjpeg-48x48.avi create mode 100644 src/test/media/mpeg1-48x48-sound.avi create mode 100644 src/test/media/mpeg1-48x48.mov create mode 100644 src/test/media/oe.png create mode 100644 src/test/media/pause_button_down.png create mode 100644 src/test/media/pause_button_up.png create mode 100644 src/test/media/play_button_down.png create mode 100644 src/test/media/play_button_up.png create mode 100644 src/test/media/rect.svg create mode 100644 src/test/media/rectborder.png create mode 100644 src/test/media/rgb24-32x32.png create mode 100644 src/test/media/rgb24-64x64.png create mode 100644 src/test/media/rgb24-65x65.png create mode 100644 src/test/media/rgb24alpha-32x32.png create mode 100644 src/test/media/rgb24alpha-64x64.png create mode 100644 src/test/media/rgba-48x48.mov create mode 100644 src/test/media/scrollarea_border.png create mode 100644 src/test/media/scrollbar_horiz_thumb_disabled.png create mode 100644 src/test/media/scrollbar_horiz_thumb_down.png create mode 100644 src/test/media/scrollbar_horiz_thumb_up.png create mode 100644 src/test/media/scrollbar_horiz_track.png create mode 100644 src/test/media/scrollbar_horiz_track_disabled.png create mode 100644 src/test/media/scrollbar_vert_thumb_disabled.png create mode 100644 src/test/media/scrollbar_vert_thumb_down.png create mode 100644 src/test/media/scrollbar_vert_thumb_up.png create mode 100644 src/test/media/scrollbar_vert_track.png create mode 100644 src/test/media/scrollbar_vert_track_disabled.png create mode 100644 src/test/media/shadow.png create mode 100644 src/test/media/slider_horiz_track.png create mode 100644 src/test/media/slider_horiz_track_disabled.png create mode 100644 src/test/media/slider_thumb_down.png create mode 100644 src/test/media/slider_thumb_up.png create mode 100644 src/test/media/slider_vert_track.png create mode 100644 src/test/media/slider_vert_track_disabled.png create mode 100644 src/test/media/spike.png create mode 100644 src/test/media/toggle_checked_Disabled.png create mode 100644 src/test/media/toggle_checked_Down.png create mode 100644 src/test/media/toggle_checked_Up.png create mode 100644 src/test/media/toggle_unchecked_Disabled.png create mode 100644 src/test/media/toggle_unchecked_Down.png create mode 100644 src/test/media/toggle_unchecked_Up.png create mode 100644 src/test/media/vp6a-yuva-48x48.flv create mode 100644 src/test/media/widebmp.jpg create mode 100644 src/test/plugin/ColorNode.cpp create mode 100644 src/test/plugin/Makefile.am create mode 100755 src/test/plugin/test.sh create mode 100644 src/test/testapp.py create mode 100644 src/test/testcase.py create mode 100644 src/test/testmediadir/mjpeg-48x48.avi create mode 100644 src/test/testmediadir/rgb24-64x64a.png create mode 100644 src/utils/Makefile.am create mode 100755 src/utils/avg_audioplayer.py create mode 100755 src/utils/avg_checkpolygonspeed.py create mode 100755 src/utils/avg_checkspeed.py create mode 100755 src/utils/avg_checktouch.py create mode 100755 src/utils/avg_checkvsync.py create mode 100755 src/utils/avg_chromakey.py create mode 100755 src/utils/avg_jitterfilter.py create mode 100755 src/utils/avg_showcamera.py create mode 100755 src/utils/avg_showfile.py create mode 100755 src/utils/avg_showfont.py create mode 100755 src/utils/avg_showsvg.py create mode 100755 src/utils/avg_videoinfo.py create mode 100755 src/utils/avg_videoplayer.py create mode 100644 src/video/AsyncVideoDecoder.cpp create mode 100644 src/video/AsyncVideoDecoder.h create mode 100644 src/video/AudioDecoderThread.cpp create mode 100644 src/video/AudioDecoderThread.h create mode 100644 src/video/FFMpegDemuxer.cpp create mode 100644 src/video/FFMpegDemuxer.h create mode 100644 src/video/FFMpegFrameDecoder.cpp create mode 100644 src/video/FFMpegFrameDecoder.h create mode 100644 src/video/Makefile.am create mode 100644 src/video/SyncVideoDecoder.cpp create mode 100644 src/video/SyncVideoDecoder.h create mode 100644 src/video/VDPAUDecoder.cpp create mode 100644 src/video/VDPAUDecoder.h create mode 100644 src/video/VDPAUHelper.cpp create mode 100644 src/video/VDPAUHelper.h create mode 100644 src/video/VideoDecoder.cpp create mode 100644 src/video/VideoDecoder.h create mode 100644 src/video/VideoDecoderThread.cpp create mode 100644 src/video/VideoDecoderThread.h create mode 100644 src/video/VideoDemuxerThread.cpp create mode 100644 src/video/VideoDemuxerThread.h create mode 100644 src/video/VideoInfo.cpp create mode 100644 src/video/VideoInfo.h create mode 100644 src/video/VideoMsg.cpp create mode 100644 src/video/VideoMsg.h create mode 100644 src/video/WrapFFMpeg.h create mode 100644 src/video/baseline/mjpeg-48x48.avi_1.png create mode 100644 src/video/baseline/mjpeg-48x48.avi_100.png create mode 100644 src/video/baseline/mjpeg-48x48.avi_2.png create mode 100644 src/video/baseline/mjpeg-48x48.avi_201.png create mode 100644 src/video/baseline/mjpeg-48x48.avi_53.png create mode 100644 src/video/baseline/mjpeg-48x48.avi_end.png create mode 100644 src/video/baseline/mjpeg-48x48.avi_loop.png create mode 100644 src/video/baseline/mpeg1-48x48-sound.avi_end.png create mode 100644 src/video/baseline/mpeg1-48x48-sound.avi_loop.png create mode 100644 src/video/baseline/mpeg1-48x48.mov_1.png create mode 100644 src/video/baseline/mpeg1-48x48.mov_2.png create mode 100644 src/video/baseline/mpeg1-48x48.mov_end.png create mode 100644 src/video/baseline/mpeg1-48x48.mov_loop.png create mode 100644 src/video/testvideo.cpp create mode 100644 src/wrapper/Makefile.am create mode 100644 src/wrapper/WrapHelper.cpp create mode 100644 src/wrapper/WrapHelper.h create mode 100644 src/wrapper/anim_wrap.cpp create mode 100644 src/wrapper/avg_wrap.cpp create mode 100644 src/wrapper/bitmap_wrap.cpp create mode 100644 src/wrapper/event_wrap.cpp create mode 100644 src/wrapper/fx_wrap.cpp create mode 100644 src/wrapper/node_wrap.cpp create mode 100644 src/wrapper/raster_wrap.cpp create mode 100644 src/wrapper/raw_constructor.hpp create mode 100755 updateMessages.sh create mode 100644 valgrind.cmdline create mode 100644 valgrind.suppressions create mode 100644 win/anim/anim.vcxproj create mode 100644 win/audio/audio.vcxproj create mode 100755 win/base/base.vcxproj create mode 100755 win/genwinimportlibs.py create mode 100755 win/graphics/graphics.vcxproj create mode 100644 win/imaging/imaging.vcxproj create mode 100755 win/libavg.props create mode 100755 win/libavg.sln create mode 100644 win/lmfit/lmfit.vcxproj create mode 100644 win/oscpack/oscpack.vcxproj create mode 100644 win/player/player.vcxproj create mode 100755 win/testbase/testbase.vcxproj create mode 100755 win/testgpu/testgpu.vcxproj create mode 100755 win/testgraphics/testgraphics.vcxproj create mode 100644 win/testimaging/testimaging.vcxproj create mode 100644 win/testlimiter/testlimiter.vcxproj create mode 100644 win/testplayer/testplayer.vcxproj create mode 100644 win/testplugin/batch_template.txt create mode 100644 win/testplugin/setup.py create mode 100644 win/testplugin/testplugin.vcxproj create mode 100644 win/testvideo/testvideo.vcxproj create mode 100644 win/video/video.vcxproj create mode 100644 win/wrapper/wrapper.vcxproj diff --git a/BuildMacDeps.sh b/BuildMacDeps.sh new file mode 100755 index 0000000..50dfae1 --- /dev/null +++ b/BuildMacDeps.sh @@ -0,0 +1,139 @@ +#!/bin/bash + +set -e +set -x + +clean() +{ + rm -rf ${AVG_PATH}/bin/ + rm -rf ${AVG_PATH}/lib/ + sudo rm -rf ${AVG_PATH}/include/ + + mkdir ${AVG_PATH}/bin + mkdir ${AVG_PATH}/lib + mkdir ${AVG_PATH}/include +} + +buildLib() +{ + LIBNAME=$1 + CONFIG_ARGS=$2 + + echo -------------------------------------------------------------------- + cd ${LIBNAME} + ./configure --prefix=${AVG_PATH} ${CONFIG_ARGS} + make clean + make -j5 + make install + cd .. +} + +buildglib() +{ + echo -------------------------------------------------------------------- + cd glib-2.29.2 + LDFLAGS="-framework ApplicationServices $LDFLAGS -lresolv" ./configure --prefix=${AVG_PATH} --disable-shared --enable-static + make clean + make -j5 + make install + cd .. +} + +buildfontconfig() +{ + echo -------------------------------------------------------------------- + cd fontconfig-2.7.0 + automake + LDFLAGS="-framework ApplicationServices ${LDFLAGS}" ./configure --prefix=${AVG_PATH} --disable-shared --with-add-fonts=/Library/Fonts,/System/Library/Fonts,~/Library/Fonts --with-confdir=/etc/fonts --with-cache-dir=~/.fontconfig --with-cache-dir=~/.fontconfig + make clean + make -j5 + sudo make install + sudo chown -R `whoami` ~/.fontconfig + cd .. +} + +buildgdkpixbuf() +{ + echo -------------------------------------------------------------------- + cd gdk-pixbuf-2.23.3 + LDFLAGS="-framework ApplicationServices $LDFLAGS -lresolv" ./configure --prefix=${AVG_PATH} --disable-shared --with-included-loaders + make clean + make -j5 + make install + cd .. +} + +buildlibrsvg() +{ + echo -------------------------------------------------------------------- + cd librsvg-2.34.0 + autoreconf --force --install + LDFLAGS=`xml2-config --libs` CPPFLAGS=`xml2-config --cflags` ./configure --prefix=${AVG_PATH} --disable-shared --disable-gtk-theme --disable-tools + make clean + make -j5 + make install + cd .. +} + +buildboost() +{ + echo -------------------------------------------------------------------- + cd boost_1_54_0 + ./bootstrap.sh --prefix=${AVG_PATH} --with-libraries=python,thread,date_time,system + ./bjam clean + ./bjam install + cd .. + rm -f ../lib/libboost_thread.dylib + rm -f ../lib/libboost_python.dylib + rm -f ../lib/libboost_date_time.dylib + rm -f ../lib/libboost_system.dylib +} +if [[ x"${AVG_PATH}" == "x" ]] +then + echo ${AVG_PATH} + echo Please set AVG_PATH and call 'source mac/avg_env.sh' before calling this script. + exit -1 +fi + +if [[ x"${AVG_MAC_ENV_SET}" == "x" ]] +then + echo Please call 'source mac/avg_env.sh' before calling this script. + exit -1 +fi + +clean + +cd ../deps + +buildLib libtool-2.2.6 +buildLib autoconf-2.63 +buildLib automake-1.11 +buildLib nasm-2.10.09 +buildLib libjpeg-turbo-1.3.0 "--host x86_64-apple-darwin --disable-shared NASM=${AVG_PATH}/bin/nasm" +buildLib tiff-3.8.2 --disable-shared +buildLib libpng-1.2.41 --disable-shared +buildLib pkg-config-0.20 +buildLib yasm-1.2.0 +buildLib libav-9.9 "--arch=x86_64 --disable-debug --enable-pthreads --enable-runtime-cpudetect" + +buildLib SDL-1.2.15 "--disable-shared --disable-cdrom --disable-threads --disable-file --disable-video-x11 --without-x" +buildLib gettext-0.18.1.1 "--disable-shared --with-included-gettext --disable-csharp --disable-libasprintf" +buildglib + +buildLib freetype-2.5.0.1 "--disable-shared --with-old-mac-fonts" +buildLib expat-2.0.0 --disable-shared + +buildfontconfig + +buildLib pixman-0.22.0 --disable-shared +buildLib cairo-1.10.2 "--disable-shared --enable-xlib=no --enable-xlib-xrender=no --enable-quartz=no --enable-quartz-font=no --enable-quartz-image=no --enable-ps=no --enable-pdf=no --enable-svg=no" +buildLib pango-1.24.4 "--disable-shared --without-x --with-included-modules=yes" + +buildgdkpixbuf +buildlibrsvg + +buildboost + +buildLib libdc1394-2.2.1 "--disable-shared --disable-doxygen-doc --without-x" + +cd ../libavg diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..223ede7 --- /dev/null +++ b/COPYING @@ -0,0 +1,504 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + + diff --git a/CreateVersionFile.py b/CreateVersionFile.py new file mode 100755 index 0000000..59063ad --- /dev/null +++ b/CreateVersionFile.py @@ -0,0 +1,212 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# libavg - Media Playback Engine. +# Copyright (C) 2003-2014 Ulrich von Zadow +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# Current versions can be found at www.libavg.de +# + +# The script generates a header file that contains versioning data for +# the current build. + +import os +import sys +import subprocess +import errno +import re +import socket +import getpass +import platform +import datetime +import pickle + +CHECK_FIELDS = ('releaseVersion', 'revision', 'branchurl') +OUTPUT_TEMPLATE = '''// version.h +// This file is automatically generated by CreateVersionFile.py + +#define AVG_VERSION_RELEASE "%(releaseVersion)s" +#define AVG_VERSION_FULL "%(fullVersion)s" +#define AVG_VERSION_BRANCH_URL "%(branchurl)s" +#define AVG_VERSION_BUILDER "%(builder)s" +#define AVG_VERSION_BUILDTIME "%(buildtime)s" +#define AVG_VERSION_REVISION %(revision)s +#define AVG_VERSION_MAJOR "%(major)s" +#define AVG_VERSION_MINOR "%(minor)s" +#define AVG_VERSION_MICRO "%(micro)s" +''' +TOPDIR = os.path.dirname(os.path.abspath(__file__)) +INPUT_FILE = os.path.join(TOPDIR, 'm4', 'avg_version.m4') +CACHE_FILE = os.path.join(TOPDIR, 'versioninfo.cache') +OUTPUT_FILENAME = 'version.h' + +def err(text): + print >>sys.stderr, text + +def getSvnRevision(): + revision = 0 + + try: + process = subprocess.Popen(['svnversion'], + cwd=TOPDIR, + stdout=subprocess.PIPE) + + output, discard = process.communicate() + except OSError, e: + print e, dir(e) + if e.errno == errno.ENOENT: + err('Cannot query current revision number via svninfo: ' + '"svnversion" executable cannot be found.') + else: + match = re.search(r'^(\d+)(?::(\d+))?', output) + if match: + if match.group(2): + revision = match.group(2) + else: + revision = match.group(1) + + return int(revision) + +def getSvnBranch(): + url = '' + branch = 'exported' + + try: + env = os.environ.copy() + env['LC_ALL'] = 'C' + process = subprocess.Popen(['svn', 'info', '.'], + cwd=TOPDIR, + stdout=subprocess.PIPE, + env=env) + + output, discard = process.communicate() + except OSError, e: + if e.errno == errno.ENOENT: + err('Cannot query current branch via svn: ' + '"svn" executable cannot be found.') + branch = 'unknown' + else: + match = re.search(r'^URL: (.+)$', output, re.M) + if match: + url = match.group(1) + + if 'svn/trunk' in url: + branch = 'trunk' + elif 'svn/branches/' in url: + match = re.search(r'svn\/branches\/(.+)/?', url) + if match: + branch = match.group(1) + + return (url, branch) + +def getBuilder(): + user = getpass.getuser() + hostname = socket.gethostname() + + return '%s@%s %s' % (user, hostname, platform.platform()) + +def extractComponentFromM4(text, component): + match = re.search(r'%s\s*\].*\[\s*([A-Za-z0-9\.]+)\s*\]' % component, text, re.M) + if match: + return match.group(1) + else: + err('Cannot identify %s version component in %s' % (component, INPUT_FILE)) + sys.exit(1) + +def getVersionComponents(): + f = open(INPUT_FILE) + contents = f.read() + f.close() + + major = extractComponentFromM4(contents, 'VERSION_MAJOR') + minor = extractComponentFromM4(contents, 'VERSION_MINOR') + micro = extractComponentFromM4(contents, 'VERSION_MICRO') + + return (major, minor, micro) + +def assembleVersionInfo(major, minor, micro): + releaseVersion = '%s.%s.%s' % (major, minor, micro) + revision = getSvnRevision() + branchurl, branch = getSvnBranch() + builder = getBuilder() + buildtime = datetime.datetime.now().isoformat() + + if revision and branch: + fullVersion = '%s-%s/r%s' % (releaseVersion, branch, revision) + elif revision: + fullVersion = '%s-r%s' % (releaseVersion, revision) + else: + fullVersion = releaseVersion + + return locals() + +def dumpVersionInfo(versionInfo): + for k, v in versionInfo.iteritems(): + print ' %s: %s' % (k, v) + +def hasChanged(versionInfo): + try: + cachef = open(CACHE_FILE) + except IOError: + return True + + try: + cachedVersionInfo = pickle.load(cachef) + except Exception, e: + err('Corrupted %s file, forcing rewrite (%s)' % (CACHE_FILE, str(e))) + cachef.close() + return True + + cachef.close() + + for field in CHECK_FIELDS: + if versionInfo.get(field) != cachedVersionInfo.get(field): + return True + + return False + +def writeVersionHeader(versionInfo, originalFile): + outf = open(originalFile, 'w') + outf.write(OUTPUT_TEMPLATE % versionInfo) + outf.close() + + try: + cachef = open(CACHE_FILE, 'w') + except IOError: + pass + else: + pickle.dump(versionInfo, cachef) + cachef.close() + +def main(topBuildDir=TOPDIR): + versionInfo = assembleVersionInfo(*getVersionComponents()) + outputFile = os.path.join(topBuildDir, OUTPUT_FILENAME) + + # Avoid to write again if the content hasn't significantly changed + if not os.path.exists(outputFile) or hasChanged(versionInfo): + dumpVersionInfo(versionInfo) + writeVersionHeader(versionInfo, outputFile) + + +if __name__ == '__main__': + if len(sys.argv) == 2: + main(sys.argv[1]) + elif len(sys.argv) == 1: + main() + else: + err('%s [top build dir]' % sys.argv[0]) + sys.exit(1) + diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..0f31201 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,11 @@ +SUBDIRS = src man + +ACLOCAL_AMFLAGS = -I m4 + +EXTRA_DIST = bootstrap COPYING NEWS \ + CreateVersionFile.py BuildMacDeps.sh makedocs.sh \ + valgrind.cmdline valgrind.suppressions \ + $(wildcard mac/*) $(wildcard mac/installscripts/*) + +install-data-hook: + $(mkinstalldirs) $(DESTDIR)/$(datadir)/avg/ diff --git a/NEWS b/NEWS new file mode 100644 index 0000000..9a3660f --- /dev/null +++ b/NEWS @@ -0,0 +1,452 @@ +libavg 1.8.1 - June 21, 2014 + + Bugfixes: + * Fixed anim keepAttr bug (#496) + * Fixed XInput multitouch support (r9651, #489) + * Documentation fixes (r9648, r9637, r9636, #487) + * Cleaner test output (r9629, r9630, #410) + * Fixed undefined reference in VDPAUHelper (r9635, #486) + * libav 0.10.0 support + +libavg 1.8.0 - Feb 15, 2014 + + svn revision 9557 + + Bugfixes + +libavg 1.8.0.pre2 - Feb 8, 2014 + + svn revision 9545 + + Bugfixes + +libavg 1.8.0.pre1 - Jan 11, 2014 + + svn revision 9495 + + Major New Features: + * Skinnable widget library including all standard button types, sliders, scroll and + progress bars, on-screen keyboard and media controls. + * Major speed improvements: libavg can now handle thousands of visible nodes, switched + to entirely shader-based rendering. + * New cool Firebirds sample (Scotty). + * Powerful unified event handling framework based on publish/subscribe pattern. + * Support for GLES and Raspberry Pi. + * Complete rewrite of the video decoder subsystem: Audio consistently works, VDPAU + support. + * Shiny new logging subsystem (Richy) + * Powerful new app class (OXullo) + + Less Major New Features: + * New StateMachine class + * WordsNode.alphagamma + * GPUInvertFilter (Richy) + * Faster handling of filled vector nodes (Benjamin Granzow) + * Easier creation of derived node classes in python + * €1 jitter filter support for gestures + * Global libavg.player variable + * CPU Thread affinity used for cleaner playback when many threads are involved + * Debug OpenGL context support + * Player.callFromThread() + * FontStyle class + * SwipeRecognizer gesture recognizer + * Bitmaps: added blt(), getResized(), (Incomplete) support for bitmaps > 2 GB, thread + pool support for BitmapLoader. + + LOTS of minor new features, support for current OSes and graphics drivers, bugfixes, + etc. + +libavg 1.7.1 - Jan 26, 2012 + + svn revision 7008, branch release1.7.x + + Bugfixes: + + - Mac avg_env.sh handling of PKG_CONFIG_PATH fixed (r6886). + - Fixed handling of files > 2 gb in VideoWriter (r6905, Bug #279). + - Fixed VideoWriter crash with some ffmpeg versions (r6922). + - Fixed crash when stopping and seeking one video simultaneously (r6961). + - Fixed slow tests on Linux machines with ATI display drivers (r6970). + - Fixed TUIO support under Linux x86-64 (r6982). + +libavg 1.7.0 - Oct 29, 2011 + + svn revision 6888, branch release1.7.x + + Bugfixes + +libavg 1.7.0.pre1 - Oct 29, 2011 + + svn revision 6871 + + Major New Features: + * Expanded effects support: New HueSatFXNode and InvertFXNode by Richard Klemm, major + speed improvements. + * Polished multitouch gesture support. + * New Contact class that delivers per-touch data, per-touch callbacks that make + event handling a lot easier. + * SVG support. + * New BitmapManager that allows loading of bitmaps in a background thread (OXullo + Intersecans). + + Other Changes: + * Lots of performance optimizations. + * Linux ATI graphics are supported now. + * Major speed improvements to VideoWriter. Saving full HD videos is not a problem + anymore and costs little performance for the main rendering thread. + * Callbacks don't hold references to python objects anymore - this should make + freeing nodes a lot easier. + * New StateMachine class. + * Added Player.getPixelsPerMM(), getPhysicalScreenDimensions(), assumePixelsPerMM() + * Added touch feedback class. + +libavg 1.6.0 - May 29, 2011 + + svn revision 6022, branch release1.6.x + + Bugfix release + +libavg 1.6.0.pre2 - May 27, 2011 + + svn revision 6018, branch release1.6.x + + Bugfix release + +libavg 1.6.0.pre1 - May 20, 2011 + + svn revision 5974 + + Major New Features: + * New Sphinx-based reference. + * Unified multitouch interface: internal tracker can now be activated using + enableMultitouch(), Windows 7 touch is supported, linux multitouch using + XInput 2.1 and LibMTDev. Drivers are autodetected if possible. + * (Finally!) Added clean windows build files for VS 2010 to the open source + distribution. + + Other Changes: + * (Finally!) Found an invisible workaround for the Linux/Mesa graphics segfault + that's been plaguing us for years (Chase Douglas). + * Support for input devices defined in python (Henrik Thoms). + * Added VideoWriter class (initial version by Henrik Thoms). + * Added initial manipulation classes for multitouch gesture support. + * Added connect/disconnectEventHandler functions to replace setEventHandler() + * Added Player.getFrameDuration(). + * Added geom.Arc and geom.PieSlice node classes. + * Added Player.isUsingShaders(). + * Added Player.getScreenResolution(). + * 16 bit texture support is more robust. + * Frame times are now monotonic, so libavg installations survive time zone changes. + * libavg can be built with binutils-gold under linux. + * Intelligent fallback for multisampling. + * FXNodes can now change the size of the node - necessary e.g. for blur and shadow. + * Added Player.getTimeSinceLastFrame(). + * Added avg_checkvsync.py utility. + +libavg 1.5.3 - February 20, 2011 (Linux only) + + svn revision 5599 + + Major new feature: + * Linux XInput 2.1 Multitouch support. + +libavg 1.5.1 - November 14, 2010 (Mac only) + + svn revision 5275 + + Fixed bug that caused fullscreen apps to crash on the mac (Bug # 162). + +libavg 1.5.0 - November 6, 2010 + + svn revision 5270 + + Major New Features: + * Nodes can be constructed directly from python, making createNode unnecessary. + * Added support for rendering avg scenes to offscreen canvases. + * Added GPU-based effects framework and Blur, Shadow, Chromakey effects. + * Added multitouch driver model and support for Apple Magic Trackpads and TUIO + devices. + * Support for flash videos with an alpha channel. Decoding is GPU-accellerated. + + Other Changes: + * Added color controls (gamma, brightness, contrast) to all RasterNodes. + * Node constructors have a parent parameter which makes a following addChild + redundant. + * Added Player.setEventHook(). + * Added onscreen keyboard for touchscreens. + * WordsNode.getNumLines(), .getCharIndexFromPos(), .getTextAsDisplayed(). + * DivNode.getEffectiveMediaDir(). + * Clearer profiling that works for multiple threads. + * Added AVG_BREAK_ON_IMPORT and AVG_BREAK_ON_ASSERT env variables. + * Added AVG_DUMP_TEST_FRAMES env variable. + * Added Player.setWindowFrame(). + * Added VideoNode.queuelength. + * Video stability & timing improvements. + * DivNode crop default is now false. + * Node class names are unified: All names end with 'Node': WordsNode, DivNode, etc. + * Added ImageNode.compression for 16 bpp texture support. + * Added avg_audioplayer.py. + + * Various compiler compatibility fixes: Compiles with gcc 4.5 and VC++ 2010 now. + * Lots of bugfixes - see the bug tracker. + +libavg 1.5.0.pre3 - November 4, 2010 + + svn revision 5267 + +libavg 1.5.0.pre2 - November 3, 2010 + + svn revision 5263 + +libavg 1.5.0.pre1 - October 31, 2010 + + svn revision 5244 + +libavg 1.0.0 - January 8, 2010 + + svn revision 4489 + + New Features: + + * hinting is now optional in words node. + * Multitouch emulation module added to AVGMTApp. + * masks now work with words nodes. + * Added video.volume property and video.hasAudio() method. + * Added AVG_LOG_CATEGORIES environment variable. Log configuration is now + done using the environment and not by calling a method. + * Added maskpos and masksize attribute so masks can be moved and rescaled. + * Added Player.getKeyModifierState() + * Added sse2 version of yuv->rgb color conversion. + * Added avg_videoinfo.sh. + * Added mesh node. + * Added avg_showcamera --resetbus to reset the firewire bus after crashes. + + Other Improvements: + * New anim framework is now stable. + * Snow Leopard compatibility. + * avg_showcamera has much better command line handling. + * The test suite is faster and a lot more comprehensive. + * hrefs and mediadirs are now unicode-aware, so filenames like "ö.png" + should work. + * node.unlink(True) now deletes all event handlers in the node, making + it a lot easier to avoid memory leaks. + * Lots of bug fixes: + - Windows gamma is now reset correctly on program end. + - Linux vsync now much more stable. + - Setting node.pos.x now throws an error instead of being ignored. + Same for all other Point2D attributes. + - video.getNumFrames() now returns the exact number of frames. + - Behaviour of nodes before Player.play() and when they are not in the + avg tree is now much more stable. + - Fixed words node sensitive area for centered and right-aligned nodes. + +libavg 1.0.0.pre3 - January 6, 2010 + + svn revision 4475 + +libavg 1.0.0.pre2 - December 23, 2009 + + svn revision 4398 + +libavg 1.0.0.pre1 - December 21, 2009 + + svn revision 4387 + +libavg 0.9.0 - August 23, 2009 + + svn revision 4100 + + Major new features: + + * Support for vector node types: Line, PolyLine, Curve, Circle, Polygon, + Rectangle. Vector nodes can be textured, with the closed vectors taking two + textures: one for the outline, one for the fill. Vector drawing is GPU-based. + * Plugin support. Plugins written in C++ can define complete new node types. + * Powerful (but still experimental) new animation framework. + * Unified & much more stable camera drivers. Consistent support for all + resolutions & framerates we could test. Support for more than one camera on all + platforms. fw800 is supported. + * Uniform support for aggregate types in node interfaces (node.pos, node.pivot, + ...) + + Other improvements: + * gcc 4.4 and ffmpeg 0.5.0 compatibility. + * Added letterspacing support to words node. + * Threaded videos are now the default. + * Improved video seek and loop performance. + * New Node::getElementByPos() method that returns the node at that point on the + screen. + * Added avg.svnrevision and avg.svndate properties so the avg version can be + queried. + * New avg_showfont.py utility to help font selection. + * New avg_showcamera.py utility to help camera setup. + * New avg.getMemoryUsage function that returns the resident set size. + * New Words.addFontDir(). + * Added support for mipmapping node textures, including videos. + * rasternode.maskhref to support static alpha masks for any videos, word nodes, + etc. + + Syntax and semantic changes: + * In the course of adding aggregate types for node attributes, several attributes + have changed: + - words.size is now called words.fontsize. + - pivotx and pivoty have been replaced by pivot. + * right-aligned and centered words nodes are positioned differently. + * avgtrackerrc syntax has changed significantly; see src/avgtrackerrc.minimal. + * Support for firewire cameras using libdc1394 ver. 1 has been phased out. Please + install ver. 2.x. + * The old python-based anim framework is marked deprecated. You need to explicitly + use the namespace anim to access it. + +libavg 0.9.0.pre3 - August 20, 2009 + + svn rev. 4086 + +libavg 0.9.0.pre2 - August 11, 2009 + + svn revision 4066 + +libavg 0.9.0.pre1 - August 9, 2009 + + svn revision 4046 + +libavg 0.8.0 - September 22, 2008 + + svn revision 3196 + +libavg 0.8.0.pre3 - September 16, 2008 + + svn revision 3171 + + * Fixed testgpu bug on older graphics cards. + * Fixed gcc 4.3 compile. + * Error instead of crash if vertex buffers are not supported. + +libavg 0.8.0.pre2 - September 13, 2008 + + svn revision 3161 + + Major new Features: + + * Major tracking improvements: Parts now run as shaders on the GPU, + lots of optimizations, speed and ellipse axes of blobs are now available + in python, blob contours can be calculated, etc. + * Major rendering performance improvements. + * Much improved words node - variant attribute to select font variant to use, + _much_ faster rendering, full unicode support, getGlyphPos() and + getGlyphSize() methods, avg_showfont.py utility (parts by oxullol02l.org). + * Support for stereo sound mixing (Mostly Nick Hebner - hebern@gmail.com). + * Support for audio playback for videos (Mostly Nick Hebner - hebern@gmail.com). + + Other improvements: + * General Mac OS X 10.5 stability. + * Added mediadir attribute for div nodes to specify where media used in child + nodes should be loaded from. + * Switched from ImageMagick to GraphicsMagick. + * Nodes can now be constructed in python using a dict for the attributes (Nick + Hebner - hebern@gmail.com). + * Mouse Wheel support. + * Added Player::setWindowPos() + * Added Node::unlink() to remove a node from the tree. + * The anim module now allows only one animation per node attribute. + * avg_videoplayer.py utility. + * Support for application-specific fonts. + * Added Player::getGPUMemoryUsage() (oxullo@02l.net). + * Experimental button, checkbox and textarea gui classes. + * Added Player::loadString() to load avg tree from a string. + * Added DivNode::reorderChild(), ::insertChildBefore() and ::removeChild(pNode). + * Experimental TUIO protocol support in remote.py. + * Support for bayer pattern decoding (oxullo@02l.net). + * Added Node::getAbsPos(). + * Added Node::getMediaSize(). + * Unicode handling for keyboard events. + * New Point2D class exposed to python. + * Added anim.abortAnim(node, attrName). + + +libavg 0.8.0.pre1 - September 9, 2008 + + svn revision 3118 + + +libavg 0.7.1.pre1 - November 25, 2007 + + svn revision 2439 + + Major new features: + + * Rotating div nodes is now possible curtesy of Nick Hebner (hebnern@gmail.com) + * Works with Mac OS X 10.5 (Leopard) + + Other improvements: + + * Improved font rendering on Mac (pango-1.18.2, freetype-2.3.5) + * If AVG_CONSOLE_TEST is defined during make check, all tests that involve + opening windows are skipped. + * Fixed a memory corruption bug involving timeouts. + * Added draggable class. + * Added continuousAnimation class by Martin Heistermann + * Added DivNode::reorderChild() + * Fixes for new MacBook Pros with NVidia 8600 cards. + + +libavg 0.7.0 - August 31, 2007 + + svn Revision 2309 + + Major new features: + + * Support for camera tracking and multitouch surfaces. (Lots of code by + igor@c-base.org.) + * Multi-threaded video decoding and video playback at speeds other than the + player redraw speed. + * API cleanups (not really a major feature, but a heads up that things will + break :-)). + * Much improved documentation. + + Other improvements: + + * Improved dynamic node API (DivNode::insertChild()). + * Video4Linux support curtesy of Xullo (x@02l.net). + * Update to new ffmpeg version. + * Callback support on video end of file. + * Support for python threads. + * Improved warp interface. + * Event callbacks now pass the event as a parameter. + * Added Player::setOnFrameHandler(). + * Added Node::getRelPos(). + * Any pythoon callable can be used as event handler now using + Node::setEventHandler(). + * Added Anim.abort() and .isDone(). + * Lots of new automatic low-level tests. + * libavg now uses correct python package semantics. Use + 'from libavg import avg' to import it now. It shouldn't be necessary to + use PYTHONPATH anymore (igor@c-base.org). + * Much faster Image::setBitmap(). + +libavg 0.6.0 - October 7, 2006 + + svn Revision 1664 + + Major new features: + + * Added support for dynamically adding and removing nodes to/from the tree. + * libavg now runs under windows, curtesy of Thomas Schüppel. + + Other improvements: + + * Compatible with Mesa 6.5.1 OpenGL. + * Much improved Gentoo ebuild. + * Added event capture capability (setEventCapture/releaseEventCapture) to nodes. + * Major speed improvement for motion jpeg videos. + * Some panorama image improvements. + * Text rendering speed improvements, minor text rendering quality improvements. + * Fixed mac fontconfig configuration directory issue. + * Fixed camera bug that caused an endless loop after 16 open/close cycles. + * Better error checking for broken videos and missing video files. + * More minor bugfixes. + +libavg 0.5.9 - August 11, 2006 + + * Test suite now completely automatic and a lot faster. + diff --git a/bootstrap b/bootstrap new file mode 100755 index 0000000..b5b3370 --- /dev/null +++ b/bootstrap @@ -0,0 +1,33 @@ +#!/bin/bash +set -x +set -e + +if [[ `uname` = Darwin ]] +then + if [[ x"$(which port)" = x"/opt/local/bin/port" ]] + then + echo "Macports detected" + glibtoolize --copy --force + aclocal -I m4 + else + if [[ "$AVG_MAC_ENV_SET" -ne "1" ]] + then + echo Please source mac/avg_env.sh before calling bootstrap. + exit 5 + fi + # This uses locally-installed libtoolize and automake since the + # apple-supplied one is buggy as of OS X 10.4.7 + libtoolize --copy --force + aclocal -I m4 + # Patch that fixes 'absolute addressing not allowed in slidable + # image' linker error. + patch < mac/libtool.m4.patch m4/libtool.m4 + fi +else + libtoolize --copy --force + aclocal -I m4 +fi +autoheader +automake --foreign --add-missing --copy +autoconf + diff --git a/compile b/compile new file mode 100755 index 0000000..9bb997a --- /dev/null +++ b/compile @@ -0,0 +1,99 @@ +#! /bin/sh + +# Wrapper for compilers which do not understand `-c -o'. + +# Copyright 1999, 2000 Free Software Foundation, Inc. +# Written by Tom Tromey . +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Usage: +# compile PROGRAM [ARGS]... +# `-o FOO.o' is removed from the args passed to the actual compile. + +prog=$1 +shift + +ofile= +cfile= +args= +while test $# -gt 0; do + case "$1" in + -o) + # configure might choose to run compile as `compile cc -o foo foo.c'. + # So we do something ugly here. + ofile=$2 + shift + case "$ofile" in + *.o | *.obj) + ;; + *) + args="$args -o $ofile" + ofile= + ;; + esac + ;; + *.c) + cfile=$1 + args="$args $1" + ;; + *) + args="$args $1" + ;; + esac + shift +done + +if test -z "$ofile" || test -z "$cfile"; then + # If no `-o' option was seen then we might have been invoked from a + # pattern rule where we don't need one. That is ok -- this is a + # normal compilation that the losing compiler can handle. If no + # `.c' file was seen then we are probably linking. That is also + # ok. + exec "$prog" $args +fi + +# Name of file we expect compiler to create. +cofile=`echo $cfile | sed -e 's|^.*/||' -e 's/\.c$/.o/'` + +# Create the lock directory. +# Note: use `[/.-]' here to ensure that we don't use the same name +# that we are using for the .o file. Also, base the name on the expected +# object file name, since that is what matters with a parallel build. +lockdir=`echo $cofile | sed -e 's|[/.-]|_|g'`.d +while true; do + if mkdir $lockdir > /dev/null 2>&1; then + break + fi + sleep 1 +done +# FIXME: race condition here if user kills between mkdir and trap. +trap "rmdir $lockdir; exit 1" 1 2 15 + +# Run the compile. +"$prog" $args +status=$? + +if test -f "$cofile"; then + mv "$cofile" "$ofile" +fi + +rmdir $lockdir +exit $status diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..ce08096 --- /dev/null +++ b/configure.ac @@ -0,0 +1,232 @@ +AC_PREREQ(2.53) + +dnl Use this file to bump version on release +m4_include([m4/avg_version.m4]) + +AC_INIT(libavg, [VERSION_MAJOR.VERSION_MINOR.VERSION_MICRO], uzadow@libavg.de) + +dnl Hack to detect virtualenv +if [[ x"$VIRTUAL_ENV" != "x" ]] && [[ $prefix = NONE ]]; then + prefix=$VIRTUAL_ENV + AC_MSG_RESULT([Virtualenv detected, setting prefix to $prefix]) +fi + +AC_CANONICAL_TARGET + +AC_DISABLE_STATIC +AC_PROG_LIBTOOL + +AC_CONFIG_MACRO_DIR([m4]) +AC_CONFIG_SRCDIR([src/avgconfig.h.in]) +AM_INIT_AUTOMAKE([check-news dist-zip foreign]) +m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) +# Checks for programs. +AC_PROG_CXX +AC_PROG_CC +AC_PROG_CPP +CXXFLAGS="-O3 -ffast-math -Wall -pipe -Wno-invalid-offsetof -Woverloaded-virtual -Wswitch -Wuninitialized -Wempty-body $CXXFLAGS" +CFLAGS="-O3 -ffast-math -Wall -pipe $CFLAGS" +if [[ $host_cpu == i386 ]] || [[ $host_cpu == i686 ]] || [[ $host_cpu == x86_64 ]]; then + CXXFLAGS="-msse2 $CXXFLAGS" + CFLAGS="-msse2 $CFLAGS" +fi +OBJC="gcc" +OBJCFLAGS="" +OBJCLDFLAGS="-lobjc" +AC_SUBST(OBJC) +AC_SUBST(OBJCFLAGS) +AC_SUBST(OBJCLDFLAGS) +_AM_DEPENDENCIES([OBJC]) +LDFLAGS="$LDFLAGS -rdynamic" + +if [[ $target_vendor = apple ]] && [[ x"`which port`" = x"/opt/local/bin/port" ]]; then + AC_MSG_RESULT([Macports detected. Adding include and lib search paths]) + CFLAGS="$CFLAGS -I/opt/local/include" + CXXFLAGS="$CXXFLAGS -I/opt/local/include" + LDFLAGS="$LDFLAGS -L/opt/local/lib" +fi + +AC_SEARCH_LIBS([clock_gettime],[rt]) +AC_CHECK_LIB([dl], [dlopen]) + +AC_PATH_GENERIC(xml2,,,AC_MSG_ERROR([libxml2 not found. Aborting.])) +PKG_CHECK_MODULES([PANGOFT2], [pangoft2]) +AC_PATH_GENERIC(freetype,,,AC_MSG_ERROR([libfreetype not found. Aborting.])) + +PKG_CHECK_MODULES([GDK_PIXBUF], [gdk-pixbuf-2.0]) +PKG_CHECK_MODULES([LIBRSVG], [librsvg-2.0]) +PKG_CHECK_MODULES([FONTCONFIG], [fontconfig]) + +PKG_CHECK_MODULES([FFMPEG], [libswscale libavformat libavcodec libavutil], [LIBFFMPEG="$FFMPEG_LIBS"], [:]) +AC_SUBST(LIBFFMPEG) +AC_CHECK_HEADERS([libavformat/avformat.h]) +if test -z "$FFMPEG_LIBS"; then + AC_MSG_ERROR([Could not find ffmpeg development libraries.]) +fi + +PKG_CHECK_MODULES([AVRESAMPLE], [libavresample], [LIBAVRESAMPLE="$AVRESAMPLE_LIBS"], [:]) +AC_SUBST(LIBAVRESAMPLE) +AC_CHECK_HEADERS([libavresample/avresample.h]) + +AM_PATH_PYTHON +AX_PYTHON_DEVEL + +AC_ARG_VAR(BOOST_PYTHON_LIBS, [linker flags for BOOST, defaults to -lboost_python]) +if test -z "$BOOST_PYTHON_LIBS" +then + AC_CHECK_LIB(boost_python, main, libboost_python_installed=yes, , $PYTHON_LDFLAGS) + if test -z "$libboost_python_installed" + then + AC_MSG_ERROR([boost.python not found. Aborting.]) + fi + BOOST_PYTHON_LIBS="-lboost_python" +fi + +AX_BOOST_THREAD +if test -z "$BOOST_THREAD_LIBS"; then + AC_MSG_ERROR([boost.thread not found. Aborting.]) +fi + +AC_ARG_ENABLE(dc1394, + AC_HELP_STRING([--enable-dc1394], + [compile support for firewire cameras]), + enable_1394=$enableval, enable_1394=maybe) +if test "$enable_1394" = maybe; then + PKG_CHECK_MODULES([DC1394_2], [libdc1394-2],,AC_MSG_NOTICE([libdc1394 ver 2 not found])) +fi +AM_CONDITIONAL(ENABLE_1394_2, test x"$DC1394_2_LIBS" != x ) +if test x"$DC1394_2_LIBS" != "x"; then + AC_DEFINE(AVG_ENABLE_1394_2, 1, [Enable firewire camera support v.2]) +fi + +PKG_CHECK_MODULES([MTDEV], [mtdev], + [AC_DEFINE(AVG_ENABLE_MTDEV, 1, [Enable Linux kernel multitouch])], + AC_MSG_NOTICE(mtdev not found)) +AM_CONDITIONAL(ENABLE_MTDEV, test x"$MTDEV_LIBS" != x) + +if test $target_vendor = apple; then + AM_CONDITIONAL(HAVE_XI2_1, false) + AM_CONDITIONAL(HAVE_XI2_2, false) +else + PKG_CHECK_MODULES(XI2_1, [xi >= 1.4.1.99.1] [inputproto >= 2.0.99.1] [inputproto < 2.1.99.5], + HAVE_XI2_1="yes"; AC_DEFINE(HAVE_XI2_1, 1, [XI2_1 available]), + HAVE_XI2_1="no"); + PKG_CHECK_MODULES(XI2_2, [xi >= 1.5.99.2] [inputproto >= 2.1.99.5], + HAVE_XI2_2="yes"; AC_DEFINE(HAVE_XI2_2, 1, [XI2_2 available]), + HAVE_XI2_2="no"); + AM_CONDITIONAL(HAVE_XI2_1, [ test "$HAVE_XI2_1" = "yes" ]) + AM_CONDITIONAL(HAVE_XI2_2, [ test "$HAVE_XI2_2" = "yes" ]) +fi + +AC_ARG_ENABLE(v4l2, + AC_HELP_STRING([--enable-v4l2], + [compile support for video4linux v2 video devices]), + enable_v4l2=$enableval, enable_v4l2=maybe) +if test "$enable_v4l2" = maybe; then + AC_CHECK_TYPE([struct v4l2_buffer], + [enable_v4l2=yes], + [enable_v4l2=no], + [#include + #include ]) +fi +AM_CONDITIONAL(ENABLE_V4L2, test x$enable_v4l2 = xyes) +if test "$enable_v4l2" = yes; then + AC_DEFINE(AVG_ENABLE_V4L2, 1, [Enable Video4Linux2 camera support]) +fi + +AC_CHECK_HEADER([linux/ppdev.h], enable_ParPort=yes, enable_ParPort=no) +AM_CONDITIONAL(ENABLE_PARPORT, test x$enable_ParPort = xyes) +if test "$enable_ParPort" = yes; then + AC_DEFINE(AVG_ENABLE_PARPORT, 1, [Enable parallel port support]) +fi + +AC_ARG_ENABLE(egl, + AC_HELP_STRING([--enable-egl], [include EGL support [default=no]]), + , + enable_egl=no) + +AC_ARG_ENABLE(rpi, + AC_HELP_STRING([--enable-rpi], [configure for RaspberryPi [default=no]]), + , + enable_rpi=no) + +if test "$enable_rpi" = yes; then + CPPFLAGS="$CPPFLAGS -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads" + LDFLAGS="$LDFLAGS -L/opt/vc/lib" + AC_DEFINE(AVG_ENABLE_RPI, 1, [Build on RaspberryPi]) + AM_CONDITIONAL(ENABLE_RPI, true) + if test "$enable_egl" = no; then + enable_egl=yes + AC_MSG_NOTICE([--enable-rpi requires --enable-egl, added --enable-egl]) + fi + # suppress several hundreds "swp{b} use is deprecated for this architecture" assembler warnings + CFLAGS="$CFLAGS -Wa,--no-warn" + CXXFLAGS="$CXXFLAGS -Wa,--no-warn" +else + AM_CONDITIONAL(ENABLE_RPI, false) +fi + +if test "$enable_egl" = yes; then + AC_CHECK_HEADERS(["EGL/egl.h"], [egl_present=yes;]) + AC_CHECK_HEADERS(["GLES2/gl2.h"], [gles2_present=yes;]) + if [[ x"$egl_present" == x ]] || [[ x"$gles2_present" == x ]]; then + AC_MSG_ERROR([EGL not found. Aborting]) + fi + AC_DEFINE(AVG_ENABLE_EGL, 1, [Enable EGL support]) +else + AX_CHECK_GL + AX_CHECK_GLU + if test x"$GL_LIBS" = x; then + AC_MSG_ERROR([OpenGL not found. Aborting]) + fi + AC_DEFINE(AVG_ENABLE_OPENGL, 1, [Enable OpenGL support]) +fi +AM_CONDITIONAL(ENABLE_EGL, test x"$egl_present" != x) +AM_CONDITIONAL(ENABLE_OPENGL, test x"$GL_LIBS" != x) + +AM_PATH_SDL(1.2.10,:,AC_MSG_ERROR([libSDL not found. Aborting.])) + +AC_CHECK_LIB([vdpau],[main],let vdpau_lib=1,let vdpau_lib=0) +AC_CHECK_HEADERS([libavcodec/vdpau.h],let vdpau_h1=1,let vdpau_h1=0) +AC_CHECK_HEADERS([vdpau/vdpau.h],let vdpau_h2=1,let vdpau_h2=0) +if [[ $vdpau_lib -eq 1 ]] && [[ $vdpau_h1 -eq 1 ]] && [[ $vdpau_h2 -eq 1 ]]; then + AC_DEFINE(AVG_ENABLE_VDPAU, 1, [Enable VDPAU support]) + LIBVIDEO_LDADD="-lvdpau" + AM_CONDITIONAL(USE_VDPAU_SRC, true) +else + LIBVIDEO_LDADD="" + AM_CONDITIONAL(USE_VDPAU_SRC, false) +fi +AC_SUBST([LIBVIDEO_LDADD]) + +AM_CONDITIONAL(APPLE, test $target_vendor = apple) + +PREFIX=$prefix +AC_SUBST(PREFIX) +AC_CONFIG_HEADERS(src/avgconfig.h) +AC_OUTPUT(Makefile + src/Makefile + src/test/Makefile + src/test/plugin/Makefile + src/base/Makefile + src/base/triangulate/Makefile + src/lmfit/Makefile + src/wrapper/Makefile + src/player/Makefile + src/graphics/Makefile + src/graphics/shaders/Makefile + src/python/Makefile + src/imaging/Makefile + src/video/Makefile + src/audio/Makefile + src/utils/Makefile + src/anim/Makefile + src/python/data/Makefile + src/samples/Makefile + src/samples/firebirds/Makefile + src/samples/firebirds/plugin/Makefile + src/samples/firebirds/media/Makefile + src/python/widget/Makefile + src/python/app/Makefile + src/oscpack/Makefile + man/Makefile) diff --git a/debian/avg_audioplayer.1 b/debian/avg_audioplayer.1 new file mode 100644 index 0000000..5084385 --- /dev/null +++ b/debian/avg_audioplayer.1 @@ -0,0 +1,11 @@ +.TH AVG_AUDIPLAYER "1" "November 2011" "libavg 1.7.0" "User Commands" +.SH NAME +avg_audioplayer \- audio player +.SH SYNOPSIS +.B avg_audioplayer +\fIfile\fR +.SH DESCRIPTION +Play an audio file. +.PP +.SH AUTHOR +Ulrich von Zadow diff --git a/debian/avg_checktouch.1 b/debian/avg_checktouch.1 new file mode 100644 index 0000000..604dd7f --- /dev/null +++ b/debian/avg_checktouch.1 @@ -0,0 +1,11 @@ +.TH AVG_CHECKTOUCH "1" "November 2011" "libavg 1.7.0" "User Commands" +.SH NAME +avg_checktouch \- test application for multitouch devices +.SH SYNOPSIS +.B avg_checktouch +\fIfile\fR +.SH DESCRIPTION +Minimal application to test multitouch event and visualize them on screen +.PP +.SH AUTHOR +Ulrich von Zadow diff --git a/debian/avg_checkvsync.1 b/debian/avg_checkvsync.1 new file mode 100644 index 0000000..a020a99 --- /dev/null +++ b/debian/avg_checkvsync.1 @@ -0,0 +1,11 @@ +.TH AVG_CHECKVSYNC "1" "November 2011" "libavg 1.7.0" "User Commands" +.SH NAME +avg_checkvsync \- vsync test application +.SH SYNOPSIS +.B avg_checkvsync +\fIfile\fR +.SH DESCRIPTION +Minimal application to test vertical syncing +.PP +.SH AUTHOR +Ulrich von Zadow diff --git a/debian/avg_chromakey.1 b/debian/avg_chromakey.1 new file mode 100644 index 0000000..8261d85 --- /dev/null +++ b/debian/avg_chromakey.1 @@ -0,0 +1,39 @@ +.TH AVG_CHROMAKEY "1" "November 2011" "libavg 1.7.0" "User Commands" +.SH NAME +avg_chromakey \- test application for libavg chromakey filter +.SH SYNOPSIS +.B avg_chromakey +\fI\-t DRIVER [OPTION]...\fR +.SH DESCRIPTION +Stream a live image from a camera and apply a chromakey filter. +.PP +.SH OPTIONS +.TP +\fB\-h\fR, \fB\-\-help\fR +Show a brief description of the options. +.TP +\fB\-t\fR, \fB\-\-driver\fR DRIVER +One of the camera subsystems supported by libavg (supported: firewire, video4linux, directshow). +.TP +\fB\-d\fR, \fB\-\-device\fR DEVICE +Camera device identifier (depending on the driver, a GUID or device path is expected). +.TP +\fB\-u\fR, \fB\-\-unit\fR UNIT +Unit number. Used for cameras or other capture devices which deliver several images (e.g. stereo cameras or TV capture cards). +.TP +\fB\-w\fR, \fB\-\-width\fR WIDTH +Camera image width. +.TP +\fB\-e\fR, \fB\-\-height\fR HEIGHT +Camera image height. +.TP +\fB\-p\fR, \fB\-\-pixelformat\fR PIXELFORMAT +Camera pixel format (one of: I8, I16, YUV411, YUV422, YUYV422, RGB, BGR, BAYER8). +.TP +\fB\-f\fR, \fB\-\-framerate\fR FRAMERATE +Frames per second. +.TP +\fB\-8\fR, \fB\-\-fw800\fR +Set firewire bus speed to s800 (if supported). +.SH AUTHOR +Ulrich von Zadow diff --git a/debian/avg_showcamera.1 b/debian/avg_showcamera.1 new file mode 100644 index 0000000..350214b --- /dev/null +++ b/debian/avg_showcamera.1 @@ -0,0 +1,54 @@ +.TH AVG_SHOWCAMERA "1" "November 2011" "libavg 1.7.0" "User Commands" +.SH NAME +avg_showcamera \- camera discovery and display tool +.SH SYNOPSIS +.B avg_showcamera +\fI\-l\fR +.HP +.B avg_showcamera +\fI\-r\fR +.HP +.B avg_showcamera +\fI\-t DRIVER [OPTION]...\fR +.SH DESCRIPTION +Query and list attached cameras, reset firewire bus, show video stream. +.PP +.SH OPTIONS +.TP +\fB\-h\fR, \fB\-\-help\fR +Show a brief description of the options. +.TP +\fB\-l\fR, \fB\-\-dump\fR +Dump a list of available cameras to the console. +.TP +\fB\-r\fR, \fB\-\-resetbus\fR +Reset the firewire bus and free allocated bandwidth. +.TP +\fB\-t\fR, \fB\-\-driver\fR DRIVER +One of the camera subsystems supported by libavg (supported: firewire, video4linux, directshow). +.TP +\fB\-d\fR, \fB\-\-device\fR DEVICE +Camera device identifier (depending on the driver, a GUID or device path is expected). +.TP +\fB\-u\fR, \fB\-\-unit\fR UNIT +Unit number. Used for cameras or other capture devices which deliver several images (e.g. stereo cameras or TV capture cards). +.TP +\fB\-w\fR, \fB\-\-width\fR WIDTH +Camera image width. +.TP +\fB\-e\fR, \fB\-\-height\fR HEIGHT +Camera image height. +.TP +\fB\-p\fR, \fB\-\-pixelformat\fR PIXELFORMAT +Camera pixel format (one of: I8, I16, YUV411, YUV422, YUYV422, RGB, BGR, BAYER8). +.TP +\fB\-f\fR, \fB\-\-framerate\fR FRAMERATE +Frames per second. +.TP +\fB\-8\fR, \fB\-\-fw800\fR +Set firewire bus speed to s800 (if supported). +.TP +\fB\-s\fR, \fB\-\-noinfo\fR +Don't show any info overlayed on the screen. +.SH AUTHOR +Ulrich von Zadow diff --git a/debian/avg_showfile.1 b/debian/avg_showfile.1 new file mode 100644 index 0000000..cfc1561 --- /dev/null +++ b/debian/avg_showfile.1 @@ -0,0 +1,11 @@ +.TH AVG_SHOWFILE "1" "November 2011" "libavg 1.7.0" "User Commands" +.SH NAME +avg_showfile \- display an avg file +.SH SYNOPSIS +.B avg_showfile +\fIfile\fR +.SH DESCRIPTION +Open and render an avg file. +.PP +.SH AUTHOR +Ulrich von Zadow diff --git a/debian/avg_showfont.1 b/debian/avg_showfont.1 new file mode 100644 index 0000000..acbddf6 --- /dev/null +++ b/debian/avg_showfont.1 @@ -0,0 +1,19 @@ +.TH AVG_SHOWFONT "1" "November 2011" "libavg 1.7.0" "User Commands" +.SH NAME +avg_showfont \- font enumeration and preview tool +.SH SYNOPSIS +.B avg_showfont +[\fIfontname\fR] [\fItext\fR] +.SH DESCRIPTION +List available font faces and generate preview of their variants. +.PP +If invoked without arguments, avg_showfont generates a list of font family names and prints them on the console. +Fontconfig is used for font discovery. Fonts are searched for in the system font path and in $PWD/fonts. +.PP +If \fBfontname\fR is specified, the chosen font is displayed in a window, with one line for +each available variant. +.PP +If supplied, the optional \fBtext\fR argument is used instead of the variant name in the +sample text. +.SH AUTHOR +Ulrich von Zadow diff --git a/debian/avg_showsvg.1 b/debian/avg_showsvg.1 new file mode 100644 index 0000000..7dc67ba --- /dev/null +++ b/debian/avg_showsvg.1 @@ -0,0 +1,17 @@ +.TH AVG_SHOWSVG "1" "November 2011" "libavg 1.7.0" "User Commands" +.SH NAME +avg_showsvg \- basic svg rasterizer +.SH SYNOPSIS +.B avg_showsvg [-s FACTOR] [--save-image] +.SH DESCRIPTION +Opens an svg file and renders a specific element (chosen by ID) on screen or saves it to a png file. +.PP +.SH OPTIONS +.TP +\fB\-s\fR, \fB\-\-size\fR +Specify a factor for the size of the element. +.TP +\fB\-\-save-image\fR +Write the rendered output to a png file as .png +.SH AUTHOR +Ulrich von Zadow diff --git a/debian/avg_videoinfo.1 b/debian/avg_videoinfo.1 new file mode 100644 index 0000000..23c313f --- /dev/null +++ b/debian/avg_videoinfo.1 @@ -0,0 +1,29 @@ +.TH AVG_VIDEOINFO "1" "November 2011" "libavg 1.7.0" "User Commands" +.SH NAME +avg_videoinfo \- video inspection tool +.SH SYNOPSIS +.B avg_videoinfo +\fIfile(s)\fR \fI[OPTION]\fR +.SH DESCRIPTION +Dump video file format information to the console +.PP +Inspects the given file(s) and dumps information about duration, bitrate, video/audio codec, +video frame size and pixel format, video fps, audio sample rate and number of channels for +each file given. +.PP +The default output format is text. +.PP +XML and CSV formats can be chosen with the appropriate options. +.PP +.SH OPTIONS +.TP +\fB\-h\fR, \fB\-\-help\fR +Show a brief description of the options. +.TP +\fB\-x\fR, \fB\-\-xml\fR +XML output format. +.TP +\fB\-c\fR, \fB\-\-csv\fR +CSV output format. +.SH AUTHOR +Ulrich von Zadow diff --git a/debian/avg_videoplayer.1 b/debian/avg_videoplayer.1 new file mode 100644 index 0000000..d2f8cbd --- /dev/null +++ b/debian/avg_videoplayer.1 @@ -0,0 +1,11 @@ +.TH AVG_VIDEOPLAYER "1" "November 2011" "libavg 1.7.0" "User Commands" +.SH NAME +avg_videoplayer \- video player +.SH SYNOPSIS +.B avg_videoplayer +\fIfile\fR +.SH DESCRIPTION +Play a video file using libavg. +.PP +.SH AUTHOR +Ulrich von Zadow diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..caa9dde --- /dev/null +++ b/debian/changelog @@ -0,0 +1,500 @@ +libavg (1.8.1-1) unstable; urgency=medium + + * New upstream release (Closes: #739664) + * Mark libdc1394-22-dev as linux-any build-dependency. + * Add libvdpau-dev build-dependency. + * Add libavresample-dev build-dependency. + + -- Dimitri John Ledkov Tue, 24 Jun 2014 20:05:13 +0100 + +libavg (1.8.0-1) unstable; urgency=medium + + * New upstream release. Closes: #721047 + * Drop all patches, none are needed with this new upstream release. + * Port to dh. + * Specify foreign in configure.ac. + + -- Dimitri John Ledkov Thu, 20 Feb 2014 16:06:16 +0000 + +libavg (1.7.1-4) unstable; urgency=low + + * Drop automake1.10 dependency in favor of automake. Closes: #724398. + + -- Dmitrijs Ledkovs Tue, 24 Sep 2013 09:14:03 +0100 + +libavg (1.7.1-3ubuntu1) saucy; urgency=low + + * Link against boost-system for boost1.50+ + + -- Dmitrijs Ledkovs Tue, 27 Aug 2013 16:49:57 +0100 + +libavg (1.7.1-3) unstable; urgency=low + + * Fix building against multiarched python. + + -- Dmitrijs Ledkovs Wed, 20 Feb 2013 12:28:46 +0000 + +libavg (1.7.1-2) unstable; urgency=low + + * Change architecture to any + * Make some x86 specific debug code conditional (replacing it with a + deliberate segfault) (patch accepted upstream) (Closes: #683105) + + -- Peter Michael Green Fri, 27 Jul 2012 23:46:04 +0000 + +libavg (1.7.1-1) unstable; urgency=low + + * New maintainer + * debian/patches/series: Add patch to fix FTBFS with gcc 4.7 (LP: #1008300) + * debian/control: Correct the packaging URL + * debian/control: Bump the standards version to 3.9.3 + * debian/copyright: Change the URL of the copyright format specification + * closing debian bugs, fixed in the previous ubuntu uploads: + - builds with gold (Closes: #555079) + - uses dh_python2 (Closes: #616859) + - no *.la files shipped (Closes: #621534) + - don't use -msse2 on non-ix86 architectures (Closes: #580678) + + -- Dmitrijs Ledkovs Wed, 13 Jun 2012 21:36:19 +0100 + +libavg (1.7.1-0ubuntu1) precise; urgency=low + + * New upstream release (LP: #923302) + + -- OXullo Intersecans Sun, 29 Jan 2012 19:26:37 +0100 + +libavg (1.7.0-0ubuntu1) precise; urgency=low + + * New upstream release (LP: #899183) + * Remove patches 0002-libav-0.7.patch, 0003-fglrx-segfault-on-startup.patch + now merged to upstream + * Remove unnecessary .la files + * Update debian/watch file + * Fix debian/copyright dep-5 compliancy + * Update standards to version 3.9.2 + * Add man pages for avg_checktouch, avg_checkvsync, avg_showsvg + * Minor debian/rules enhancement + * Add librsvg2-dev, libgdk-pixbuf2.0-dev to Build-Depends + * Proper transition to dh_python2 + + -- OXullo Intersecans Tue, 06 Dec 2011 22:44:56 +0100 + +libavg (1.5.4-0ubuntu4) oneiric; urgency=low + + * Work around segfault when using fglrx (LP: #815922) + + -- Stefano Rivera Sun, 09 Oct 2011 23:30:53 +0200 + +libavg (1.5.4-0ubuntu3) oneiric; urgency=low + + * Port to libav 0.7 API (LP: #831190). + + -- Colin Watson Mon, 29 Aug 2011 23:32:13 +0100 + +libavg (1.5.4-0ubuntu2) natty; urgency=low + + * Build arch restricted to the supported i386 and amd64 (LP: #735548) + * STDC macros define moved from CXXFLAGS to CPPFLAGS in order to autoconf + to set correctly the default (LP: #752924) + + -- OXullo Intersecans Wed, 06 Apr 2011 23:46:15 +0200 + +libavg (1.5.4-0ubuntu1) natty; urgency=low + + [ OXullo Intersecans ] + * Upstream update + * Removed 0002-load-libstdc++-first.patch which is now merged to upstream + * Add manpages + + [ Chase Douglas ] + * Update debian/copyright for DEP5 standards + * Remove README.debian as its contents are no longer relevant + * Update debian/watch to version 3 + * Add list-missing check for installed but not packaged files + + -- OXullo Intersecans Fri, 11 Mar 2011 20:24:54 +0100 + +libavg (1.5.3-0ubuntu2) UNRELEASED; urgency=low + + [ OXullo Intersecans ] + * New package descriptions + + [ Chase Douglas ] + * Fix segfault on start up in Ubuntu due to Mesa glx tls issue + - Added 0002-load-libstdc++-first.patch + + -- Chase Douglas Wed, 23 Feb 2011 15:04:56 -0500 + +libavg (1.5.3-0ubuntu1) UNRELEASED; urgency=low + + * Upstream update + * Reverted rules back to watch + + -- OXullo Intersecans Sun, 20 Feb 2011 14:27:42 +0100 + +libavg (1.5.2+svn5577-0ubuntu1) UNRELEASED; urgency=low + + * Upstream update + + -- OXullo Intersecans Sun, 13 Feb 2011 23:18:32 +0100 + +libavg (1.5.2+svn5512-0ubuntu2) UNRELEASED; urgency=low + + * Switched python-central to dh_python2 + + -- OXullo Intersecans Sat, 12 Feb 2011 00:27:30 +0100 + +libavg (1.5.2+svn5512-0ubuntu1) UNRELEASED; urgency=low + + * Upstream update + + -- OXullo Intersecans Mon, 07 Feb 2011 18:17:48 +0100 + +libavg (1.5.2+svn5510-0ubuntu1) UNRELEASED; urgency=low + + * Upstream update + * Added libxi6 as package dependency + + -- OXullo Intersecans Sun, 06 Feb 2011 21:48:27 +0100 + +libavg (1.5.2+svn5509-0ubuntu2) UNRELEASED; urgency=low + + * Added libxi-dev as build dependency + + -- OXullo Intersecans Sun, 06 Feb 2011 20:32:47 +0100 + +libavg (1.5.2+svn5509-0ubuntu1) UNRELEASED; urgency=low + + * Upstream update + + -- OXullo Intersecans Sun, 06 Feb 2011 20:24:05 +0100 + +libavg (1.5.2+svn5503-0ubuntu1) UNRELEASED; urgency=low + + * Upstream update + + -- OXullo Intersecans Sun, 06 Feb 2011 17:50:24 +0100 + +libavg (1.5.2+svn5481-0ubuntu1) UNRELEASED; urgency=low + + * Upstream update + * Temporarily enabled svn upstream provider + + -- OXullo Intersecans Sat, 05 Feb 2011 02:07:31 +0100 + +libavg (1.5.2+svn5420-0ubuntu2) UNRELEASED; urgency=low + + * Upstream update + + -- OXullo Intersecans Wed, 26 Jan 2011 02:06:08 +0100 + +libavg (1.5.2-0ubuntu1) UNRELEASED; urgency=low + + * New upstream version + * Remove current examples in favour of upstream's src/samples. + * Remove patches merged upstream. + * Remove .py extension from new /usr/bin/ scripts. + + -- OXullo Intersecans Sun, 16 Jan 2011 23:11:32 +0100 + +libavg (1.0.1-1ubuntu4) natty; urgency=low + + * Fix build failure with ld --no-add-needed. + + -- Matthias Klose Sat, 04 Dec 2010 11:55:19 +0100 + +libavg (1.0.1-1ubuntu3) natty; urgency=low + + * Rebuild to add support for python 2.7. + + -- Matthias Klose Fri, 03 Dec 2010 00:02:50 +0000 + +libavg (1.0.1-1ubuntu2) maverick; urgency=low + + * Fix FTBFS, don't use -msse2 on non-ix86 architectures. + + -- Matthias Klose Sun, 19 Sep 2010 14:16:51 +0200 + +libavg (1.0.1-1ubuntu1) maverick; urgency=low + + * debian/rules: added CXXFLAGS to fix a FTBFS with undefined UINT64_C error + with latest ffmpeg + + -- Fabrice Coutadeur Sat, 04 Sep 2010 19:47:32 +0000 + +libavg (1.0.1-1) unstable; urgency=low + + * new upstream release (Closes: #565512) + * Remove patches that have been merged upstream. + * Add a patch that avoids building tests by default. + * Remove .py extension from two more scripts in /usr/bin . + * Add 2 example files to /usr/share/doc/python-libavg/examples/ . + * Describe a workaround for bug #579937 in README.Debian. + * Install debian/libavg.pth into /usr/share/pyshared/ . + (Closes: #575551) + * Add get-orig-source target to debian/rules. + + -- Torsten Werner Sun, 02 May 2010 23:50:04 +0200 + +libavg (0.8.0-7) unstable; urgency=low + + * Support all python versions; not just 2.5. + * Convert patches to dep3 format. + * Do no longer link with $py_localmodlibs. (Closes: #567144) + * Add Build-Depends: automake1.10 and run ./bootstrap before ./configure. + * Change Standards-Version: 3.8.4 (no changes). + * Switch to source format 3.0. + + -- Torsten Werner Sat, 20 Mar 2010 22:22:05 +0100 + +libavg (0.8.0-6) unstable; urgency=low + + * Update library name for newer libboost-python-dev. (Closes: #545601) + + -- Torsten Werner Wed, 09 Sep 2009 17:24:36 +0200 + +libavg (0.8.0-5) unstable; urgency=low + + * Configure library boost_thread-mt. + * Add suffix '-mt' to boost_python. + * Add Depends: ${misc:Depends}. + * Bump up Standards-Version: 3.8.1 (no changes). + + -- Torsten Werner Mon, 11 May 2009 20:54:25 +0200 + +libavg (0.8.0-4) unstable; urgency=low + + * Add patch avg_namespace.diff; thanks to Luca Falavigna. (Closes: #520730) + + -- Torsten Werner Wed, 01 Apr 2009 22:33:58 +0200 + +libavg (0.8.0-3) unstable; urgency=low + + * Add patch ffmpeg-includes.diff; thanks to Reinhard Tartler. (Closes: + #516951) + + -- Torsten Werner Tue, 24 Feb 2009 22:26:54 +0100 + +libavg (0.8.0-2) unstable; urgency=low + + * Add patch gcc-4.4.diff provided by Martin Michlmayr. + (Closes: #505593) + + -- Torsten Werner Fri, 14 Nov 2008 00:32:16 +0100 + +libavg (0.8.0-1) unstable; urgency=low + + * new upstream release + - Uses GraphicsMagick++ instead of ImageMagick++. (Closes: #485895) + - Does no longer support python 2.4. + * Remove patch libavg_gcc-4.3.diff because it is not needed any more. + * Remove .py extension from scripts installed into /usr/bin. + + -- Torsten Werner Tue, 07 Oct 2008 22:49:40 +0200 + +libavg (0.7.0-9) unstable; urgency=low + + * Add missing Build-Depends: libswscale-dev. (Closes: #487644) + * Bump up Standards-Version: 3.8.0 (no changes needed). + + -- Torsten Werner Fri, 15 Aug 2008 17:15:47 +0200 + +libavg (0.7.0-8) unstable; urgency=medium + + * Change Build-Depends: libdc1394-22-dev. + + -- Torsten Werner Sun, 20 Jul 2008 23:14:49 +0200 + +libavg (0.7.0-7) unstable; urgency=high + + * Remove Build-Depends: liblzo-dev; thanks to Andreas Henriksson. + (Closes: #485914) + + -- Torsten Werner Tue, 24 Jun 2008 23:37:17 +0200 + +libavg (0.7.0-6) unstable; urgency=low + + * Support both python 2.4 and 2.5. + * Build-Depend on a recent libboost-python-dev. + * Clean up Build-Depends on libmagick++. + + -- Torsten Werner Sun, 23 Mar 2008 09:22:14 +0100 + +libavg (0.7.0-5) unstable; urgency=low + + * Add a patch from Cyril Brulebois to support g++ 4.3. (Closes: #455436) + * Make debian/copyright more verbose. + * Replace python by Python in description of the package. + + -- Torsten Werner Fri, 07 Mar 2008 20:57:39 +0100 + +libavg (0.7.0-4) unstable; urgency=low + + * Update Homepage and Vcs fields. + * Set Standards-Version: 3.7.3. + * Remove redundant Build-Depends: python-all-dev. + * Install libavg.pth into the correct directory. + * Remove empty directory /usr/share/avg. + + -- Torsten Werner Mon, 07 Jan 2008 21:14:49 +0100 + +libavg (0.7.0-3) unstable; urgency=low + + * Ignore errors from 'make check' because they are probably errors of the + buildd environment. (Closes: #447246) + + -- Torsten Werner Sun, 09 Dec 2007 21:22:36 +0100 + +libavg (0.7.0-2) unstable; urgency=low + + * Remove the last patch because it is not needed anymore. + * Enable 'make check' during the build process. + + -- Torsten Werner Tue, 02 Oct 2007 20:07:26 +0200 + +libavg (0.7.0-1) unstable; urgency=low + + * New upstream version + * Fix debian/watch to reflect the changes of the website. + * Remove patches that have been applied upstream. + * Refresh one remaining patch. + * Add missing Build-Depends: libboost-thread-dev. + * Do not run the autotools any more and remove the Build-Depends. + * Switch back to python 2.4 because boost has been built with that version. + * Do no longer specify BOOST_LIBS as an argument to configure because it is + not needed any more. + + -- Torsten Werner Tue, 18 Sep 2007 19:10:28 +0200 + +libavg (0.6.0-6) unstable; urgency=low + + * Add a patch for newer ffmpeg provided by Ulrich von Zadow. + (Closes: #427202) + * Add patch from Martin Michlmayr for gcc-4.3. (Closes: #417357) + + -- Torsten Werner Sat, 30 Jun 2007 09:20:54 +0200 + +libavg (0.6.0-5) unstable; urgency=low + + * Fix linking the boost_python library. + + -- Torsten Werner Sun, 20 May 2007 13:55:49 +0200 + +libavg (0.6.0-4) unstable; urgency=low + + * Switch to new boost packages and python 2.5. + * Switch to debhelper 5. + + -- Torsten Werner Sun, 20 May 2007 09:01:22 +0200 + +libavg (0.6.0-3) unstable; urgency=low + + * Add file /usr/lib/python2.4/site-packages/libavg.pth. + + -- Torsten Werner Thu, 18 Jan 2007 07:22:37 +0100 + +libavg (0.6.0-2) unstable; urgency=low + + * Switch from dh_python to python-central. + * Add XS-X-Vcs-Svn header and Homepage to debian/control. + + -- Torsten Werner Fri, 8 Dec 2006 14:25:40 +0100 + +libavg (0.6.0-1) experimental; urgency=low + + * New upstream release. + * Uploading to experimental. + * Removing all patches because they are not needed anymore. + * Do not run automake anymore. + + -- Torsten Werner Sun, 5 Nov 2006 14:43:11 +0100 + +libavg (0.5.9-4) unstable; urgency=low + + * move patches/ directory into debian/ directory where cdbs expects it + * add patch 64bit.diff from upstream that fixes compilation errors on 64bit + platforms, closes: #386619 + * add debian/pycompat (policy version 1) + + -- Torsten Werner Sat, 9 Sep 2006 21:35:54 +0200 + +libavg (0.5.9-3) unstable; urgency=low + + * remove reference to www.debian-multimedia.org from package description + + -- Torsten Werner Mon, 28 Aug 2006 07:06:46 +0200 + +libavg (0.5.9-2) unstable; urgency=low + + * uses libtool now; fixes non PIC code (patch sent to upstream author) + * add checks to debian/rules (still commented out) + * add patch for 'make check' + * removed any non-free Build-Depends and move the package from contrib to + main + * set Architecture back to any because it should be possible to autobuild + the package now + * removed stuff specific to the python 2.4 transition that has happened + finally + * add a cosmetic patch pkg-config.diff which is intended to be sent to the + upstream author + + -- Torsten Werner Sun, 27 Aug 2006 23:25:58 +0200 + +libavg (0.5.9-1) unstable; urgency=low + + * fixed debian/watch + * new upstream release + * set Architecture to i386 because the package does not get autobuilded + * add patch for gcc 4.1.1 from Alexander Baldeck + * lintian fixes + + -- Torsten Werner Sat, 12 Aug 2006 11:03:24 +0200 + +libavg (0.5.7-1) experimental; urgency=low + + * new upstream version + * set Standards-Version to 3.7.2, no changes needed + * use dh_python + * exclude avg.so from dh_makeshlibs + * documented the packages from debian-multimedia.org which are needed to + build libavg, closes: #376424 + * minor lintian fixes + * updated description in debian/control + * upload to experimental because of the python2.4 transition + * add patch gcc.diff for newer gccs + + -- Torsten Werner Tue, 11 Jul 2006 21:20:09 +0200 + +libavg (0.5.4-1) unstable; urgency=low + + * New upstream release + * final switch to pkg-config + * changed Build-Depends: libavcodeccvs51-dev | libavcodeccvs-dev | libavcodec2-dev + * added a lot of Build-Depends + * removed old autoconf changes + + -- Torsten Werner Sun, 23 Apr 2006 19:22:04 +0200 + +libavg (0.5.3-1) unstable; urgency=low + + * new upstream + * switched from Magick++-config to pkg-config, closes: #347407 + + -- Torsten Werner Sat, 14 Jan 2006 12:37:39 +0100 + +libavg (0.2.0-2) unstable; urgency=low + + * changed Build-Depends: libmagick++9-dev | libmagick++6-dev, + closes: #341817 + * added hint to Christian Marillat's archive to README.Debian, + closes: #332522 + * changed Build-Depends: libavcodeccvs-dev | libavcodec2-dev + * some small lintian cleanups + + -- Torsten Werner Sun, 4 Dec 2005 17:42:35 +0100 + +libavg (0.2.0-1) unstable; urgency=low + + * Initial Release, closes: #329429 + + -- Torsten Werner Wed, 21 Sep 2005 21:13:19 +0200 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..ec63514 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +9 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..0f9d094 --- /dev/null +++ b/debian/control @@ -0,0 +1,39 @@ +Source: libavg +Section: python +Priority: optional +Maintainer: Dimitri John Ledkov +Build-Depends: debhelper (>= 9), + dh-autoreconf, + libavcodec-dev, + libavformat-dev, + libavresample-dev, + libboost-python-dev (>= 1.34.1-8), + libboost-thread-dev, + libboost-system-dev, + libdc1394-22-dev [linux-any], + libvdpau-dev, + libgdk-pixbuf2.0-dev, + libgraphicsmagick++1-dev, + libmtdev-dev, + libpango1.0-dev, + librsvg2-dev, + libsdl1.2-dev, + libswscale-dev, + libtool, + libxi-dev (>= 2:1.4.1-1ubuntu1), + libxml2-dev, + libxxf86vm-dev, + python-all-dev (>= 2.6.6-3~) +X-Python-Version: >= 2.6 +Homepage: http://www.libavg.de +Standards-Version: 3.9.3 + +Package: python-libavg +Architecture: any +Depends: ${misc:Depends}, ${python:Depends}, ${shlibs:Depends} +Provides: ${python:Provides} +Description: High-level development platform for media-centric applications + libavg is a high-level development platform for media-centric applications. + It uses an xml-based layout language for screen design and Python as scripting + language. libavg allows developers and media artists/designers to quickly + develop media applications. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..06e3f87 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,45 @@ +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: libavg +Upstream-Contact: Ulrich von Zadow , + OXullo Intersecans +Source: http://www.libavg.de/download.php + +Files: debian/* +Copyright: 2005 Torsten Werner , + 2011-2012 OXullo Intersecans , + 2012 Dmitrijs Ledkovs +License: GPL-2+ + On Debian systems, the full text of the GNU General Public License version 2 can + be found in the file `/usr/share/common-licenses/GPL-2'. + +Files: src/oscpack/* +Copyright: 2004-2005 Ross Bencina +License: MIT/X11 (BSD like) + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files + (the "Software"), to deal in the Software without restriction, + including without limitation the rights to use, copy, modify, merge, + publish, distribute, sublicense, and/or sell copies of the Software, + and to permit persons to whom the Software is furnished to do so, + subject to the following conditions: + . + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + . + Any person wishing to distribute modifications to the Software is + requested to send the modifications to the original developer so that + they can be incorporated into the canonical version. + . + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR + ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Files: * +Copyright: 2003-2011 Ulrich von Zadow +License: LGPL-2.1+ + On Debian systems, the full text of the GNU Lesser General Public License + version 2.1 can be found in the file `/usr/share/common-licenses/LGPL-2.1'. diff --git a/debian/install b/debian/install new file mode 100644 index 0000000..55c5393 --- /dev/null +++ b/debian/install @@ -0,0 +1,2 @@ +debian/libavg.pth /usr/share/pyshared/ +src/avgrc /etc/ diff --git a/debian/libavg.pth b/debian/libavg.pth new file mode 100644 index 0000000..dc7191a --- /dev/null +++ b/debian/libavg.pth @@ -0,0 +1 @@ +libavg diff --git a/debian/links b/debian/links new file mode 100644 index 0000000..c713e54 --- /dev/null +++ b/debian/links @@ -0,0 +1 @@ +usr/lib/python2.7/dist-packages/libavg/avg.so usr/lib/python2.7/dist-packages/libavg/avg.so.0 diff --git a/debian/patches/foreign.patch b/debian/patches/foreign.patch new file mode 100644 index 0000000..2f9a488 --- /dev/null +++ b/debian/patches/foreign.patch @@ -0,0 +1,19 @@ +Description: specify in configure that this is a foreign package +Author: Dimitri John Ledkov + +--- a/configure.ac ++++ b/configure.ac +@@ -1,4 +1,3 @@ +- + AC_PREREQ(2.53) + + dnl Use this file to bump version on release +@@ -19,7 +18,7 @@ + + AC_CONFIG_MACRO_DIR([m4]) + AC_CONFIG_SRCDIR([src/avgconfig.h.in]) +-AM_INIT_AUTOMAKE([check-news dist-zip]) ++AM_INIT_AUTOMAKE([check-news dist-zip foreign]) + m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) + # Checks for programs. + AC_PROG_CXX diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 0000000..d3b650a --- /dev/null +++ b/debian/patches/series @@ -0,0 +1 @@ +foreign.patch diff --git a/debian/python-libavg.examples b/debian/python-libavg.examples new file mode 100644 index 0000000..7982f8e --- /dev/null +++ b/debian/python-libavg.examples @@ -0,0 +1,5 @@ +src/samples/*.py +src/samples/*.avg +src/samples/*.png +src/samples/*.avi + diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..4d78926 --- /dev/null +++ b/debian/rules @@ -0,0 +1,18 @@ +#!/usr/bin/make -f + +%: + dh $@ --with autoreconf,python2 --parallel + +override_dh_installman: + dh_installman debian/*.1 + +override_dh_auto_test: + -dh_auto_test + +override_dh_shlibdeps: + dh_shlibdeps -l/usr/lib/python2.7/dist-packages/libavg/ + +override_dh_install: + dh_install + prename -f 's/\.py$$//' ./debian/python-libavg/usr/bin/avg_*.py + find debian/python-libavg/ -name '*.la' -delete diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/debian/watch b/debian/watch new file mode 100644 index 0000000..8f365be --- /dev/null +++ b/debian/watch @@ -0,0 +1,2 @@ +version=3 +http://www.libavg.de/raw-attachment/wiki/DownLoad/ libavg-(\d+.\d+.\d+).tar.gz diff --git a/depcomp b/depcomp new file mode 100755 index 0000000..aea3d00 --- /dev/null +++ b/depcomp @@ -0,0 +1,472 @@ +#! /bin/sh + +# depcomp - compile a program generating dependencies as side-effects +# Copyright 1999, 2000 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Originally written by Alexandre Oliva . + +if test -z "$depmode" || test -z "$source" || test -z "$object"; then + echo "depcomp: Variables source, object and depmode must be set" 1>&2 + exit 1 +fi +# `libtool' can also be set to `yes' or `no'. + +if test -z "$depfile"; then + base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'` + dir=`echo "$object" | sed 's,/.*$,/,'` + if test "$dir" = "$object"; then + dir= + fi + # FIXME: should be _deps on DOS. + depfile="$dir.deps/$base" +fi + +tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} + +rm -f "$tmpdepfile" + +# Some modes work just like other modes, but use different flags. We +# parameterize here, but still list the modes in the big case below, +# to make depend.m4 easier to write. Note that we *cannot* use a case +# here, because this file can only contain one case statement. +if test "$depmode" = hp; then + # HP compiler uses -M and no extra arg. + gccflag=-M + depmode=gcc +fi + +if test "$depmode" = dashXmstdout; then + # This is just like dashmstdout with a different argument. + dashmflag=-xM + depmode=dashmstdout +fi + +case "$depmode" in +gcc3) +## gcc 3 implements dependency tracking that does exactly what +## we want. Yay! Note: for some reason libtool 1.4 doesn't like +## it if -MD -MP comes after the -MF stuff. Hmm. + "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + mv "$tmpdepfile" "$depfile" + ;; + +gcc) +## There are various ways to get dependency output from gcc. Here's +## why we pick this rather obscure method: +## - Don't want to use -MD because we'd like the dependencies to end +## up in a subdir. Having to rename by hand is ugly. +## (We might end up doing this anyway to support other compilers.) +## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like +## -MM, not -M (despite what the docs say). +## - Using -M directly means running the compiler twice (even worse +## than renaming). + if test -z "$gccflag"; then + gccflag=-MD, + fi + "$@" -Wp,"$gccflag$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz +## The second -e expression handles DOS-style file names with drive letters. + sed -e 's/^[^:]*: / /' \ + -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" +## This next piece of magic avoids the `deleted header file' problem. +## The problem is that when a header file which appears in a .P file +## is deleted, the dependency causes make to die (because there is +## typically no way to rebuild the header). We avoid this by adding +## dummy dependencies for each header file. Too bad gcc doesn't do +## this for us directly. + tr ' ' ' +' < "$tmpdepfile" | +## Some versions of gcc put a space before the `:'. On the theory +## that the space means something, we add a space to the output as +## well. +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +sgi) + if test "$libtool" = yes; then + "$@" "-Wp,-MDupdate,$tmpdepfile" + else + "$@" -MDupdate "$tmpdepfile" + fi + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + + if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files + echo "$object : \\" > "$depfile" + + # Clip off the initial element (the dependent). Don't try to be + # clever and replace this with sed code, as IRIX sed won't handle + # lines with more than a fixed number of characters (4096 in + # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; + # the IRIX cc adds comments like `#:fec' to the end of the + # dependency line. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ + tr ' +' ' ' >> $depfile + echo >> $depfile + + # The second pass generates a dummy entry for each header file. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ + >> $depfile + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +aix) + # The C for AIX Compiler uses -M and outputs the dependencies + # in a .u file. This file always lives in the current directory. + # Also, the AIX compiler puts `$object:' at the start of each line; + # $object doesn't have directory information. + stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'` + tmpdepfile="$stripped.u" + outname="$stripped.o" + if test "$libtool" = yes; then + "$@" -Wc,-M + else + "$@" -M + fi + + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + + if test -f "$tmpdepfile"; then + # Each line is of the form `foo.o: dependent.h'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" + sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +icc) + # Intel's C compiler understands `-MD -MF file'. However on + # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c + # ICC 7.0 will fill foo.d with something like + # foo.o: sub/foo.c + # foo.o: sub/foo.h + # which is wrong. We want: + # sub/foo.o: sub/foo.c + # sub/foo.o: sub/foo.h + # sub/foo.c: + # sub/foo.h: + # ICC 7.1 will output + # foo.o: sub/foo.c sub/foo.h + # and will wrap long lines using \ : + # foo.o: sub/foo.c ... \ + # sub/foo.h ... \ + # ... + + "$@" -MD -MF "$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + # Each line is of the form `foo.o: dependent.h', + # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" + # Some versions of the HPUX 10.20 sed can't process this invocation + # correctly. Breaking it into two sed invocations is a workaround. + sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | + sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +tru64) + # The Tru64 compiler uses -MD to generate dependencies as a side + # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. + # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put + # dependencies in `foo.d' instead, so we check for that too. + # Subdirectories are respected. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + + if test "$libtool" = yes; then + tmpdepfile1="$dir.libs/$base.lo.d" + tmpdepfile2="$dir.libs/$base.d" + "$@" -Wc,-MD + else + tmpdepfile1="$dir$base.o.d" + tmpdepfile2="$dir$base.d" + "$@" -MD + fi + + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" + exit $stat + fi + + if test -f "$tmpdepfile1"; then + tmpdepfile="$tmpdepfile1" + else + tmpdepfile="$tmpdepfile2" + fi + if test -f "$tmpdepfile"; then + sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" + # That's a space and a tab in the []. + sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" + else + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +#nosideeffect) + # This comment above is used by automake to tell side-effect + # dependency tracking mechanisms from slower ones. + +dashmstdout) + # Important note: in order to support this mode, a compiler *must* + # always write the proprocessed file to stdout, regardless of -o. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + test -z "$dashmflag" && dashmflag=-M + # Require at least two characters before searching for `:' + # in the target name. This is to cope with DOS-style filenames: + # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. + "$@" $dashmflag | + sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + tr ' ' ' +' < "$tmpdepfile" | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +dashXmstdout) + # This case only exists to satisfy depend.m4. It is never actually + # run, as this mode is specially recognized in the preamble. + exit 1 + ;; + +makedepend) + "$@" || exit $? + # Remove any Libtool call + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + # X makedepend + shift + cleared=no + for arg in "$@"; do + case $cleared in + no) + set ""; shift + cleared=yes ;; + esac + case "$arg" in + -D*|-I*) + set fnord "$@" "$arg"; shift ;; + # Strip any option that makedepend may not understand. Remove + # the object too, otherwise makedepend will parse it as a source file. + -*|$object) + ;; + *) + set fnord "$@" "$arg"; shift ;; + esac + done + obj_suffix="`echo $object | sed 's/^.*\././'`" + touch "$tmpdepfile" + ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + sed '1,2d' "$tmpdepfile" | tr ' ' ' +' | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" "$tmpdepfile".bak + ;; + +cpp) + # Important note: in order to support this mode, a compiler *must* + # always write the proprocessed file to stdout. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + "$@" -E | + sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | + sed '$ s: \\$::' > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + cat < "$tmpdepfile" >> "$depfile" + sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvisualcpp) + # Important note: in order to support this mode, a compiler *must* + # always write the proprocessed file to stdout, regardless of -o, + # because we must use -o when running libtool. + "$@" || exit $? + IFS=" " + for arg + do + case "$arg" in + "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") + set fnord "$@" + shift + shift + ;; + *) + set fnord "$@" "$arg" + shift + shift + ;; + esac + done + "$@" -E | + sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" + echo " " >> "$depfile" + . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +none) + exec "$@" + ;; + +*) + echo "Unknown depmode $depmode" 1>&2 + exit 1 + ;; +esac + +exit 0 diff --git a/fixcopyright.py b/fixcopyright.py new file mode 100755 index 0000000..2c0ba1d --- /dev/null +++ b/fixcopyright.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python + +import os +import re + +def handleFile(path): + lines = file(path).readlines() + lineNumber = 0 + found = False + for i, line in enumerate(lines): + match = re.match(r'((//)|(#))\s*Copyright \(C\) 2003-(.*) Ulrich von Zadow\s*', line) +# m = re.match(r'#include\s*["<]([\-_a-zA-Z0-9\.\\/]+)[">]\s*', l) + if match: + if path[-2:] == 'py': + lines[i] = "# Copyright (C) 2003-2014 Ulrich von Zadow\n" + else: + lines[i] = "// Copyright (C) 2003-2014 Ulrich von Zadow\n" + found = True + if found: + outFile = open(path, "w") + for line in lines: + outFile.write(line) + else: + print path + + +for ext in ("h", "c", "cpp", "py"): + cmd = 'find . -name "*.'+ext+'"' + files = os.popen(cmd).readlines() + for f in files: + handleFile(f.strip()) + diff --git a/install-sh b/install-sh new file mode 100755 index 0000000..6ce63b9 --- /dev/null +++ b/install-sh @@ -0,0 +1,294 @@ +#!/bin/sh +# +# install - install a program, script, or datafile +# +# This originates from X11R5 (mit/util/scripts/install.sh), which was +# later released in X11R6 (xc/config/util/install.sh) with the +# following copyright and license. +# +# Copyright (C) 1994 X Consortium +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- +# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name of the X Consortium shall not +# be used in advertising or otherwise to promote the sale, use or other deal- +# ings in this Software without prior written authorization from the X Consor- +# tium. +# +# +# FSF changes to this file are in the public domain. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +transformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd=$cpprog + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd=$stripprog + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "$0: no input file specified" >&2 + exit 1 +else + : +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d "$dst" ]; then + instcmd=: + chmodcmd="" + else + instcmd=$mkdirprog + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f "$src" ] || [ -d "$src" ] + then + : + else + echo "$0: $src does not exist" >&2 + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "$0: no destination specified" >&2 + exit 1 + else + : + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d "$dst" ] + then + dst=$dst/`basename "$src"` + else + : + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' + ' +IFS="${IFS-$defaultIFS}" + +oIFS=$IFS +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS=$oIFS + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp=$pathcomp$1 + shift + + if [ ! -d "$pathcomp" ] ; + then + $mkdirprog "$pathcomp" + else + : + fi + + pathcomp=$pathcomp/ +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd "$dst" && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dst"; else : ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dst"; else : ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dst"; else : ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dst"; else : ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename "$dst"` + else + dstfile=`basename "$dst" $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename "$dst"` + else + : + fi + +# Make a couple of temp file names in the proper directory. + + dsttmp=$dstdir/_inst.$$_ + rmtmp=$dstdir/_rm.$$_ + +# Trap to clean up temp files at exit. + + trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0 + trap '(exit $?); exit' 1 2 13 15 + +# Move or copy the file name to the temp name + + $doit $instcmd "$src" "$dsttmp" && + +# and set any options; do chmod last to preserve setuid bits + +# If any of these fail, we abort the whole thing. If we want to +# ignore errors from any of these, just make sure not to ignore +# errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; else :;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else :;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dsttmp"; else :;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else :;fi && + +# Now remove or move aside any old file at destination location. We try this +# two ways since rm can't unlink itself on some systems and the destination +# file might be busy for other reasons. In this case, the final cleanup +# might fail but the new file should still install successfully. + +{ + if [ -f "$dstdir/$dstfile" ] + then + $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null || + $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null || + { + echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 + (exit 1); exit + } + else + : + fi +} && + +# Now rename the file to the real destination. + + $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" + +fi && + +# The final little trick to "correctly" pass the exit status to the exit trap. + +{ + (exit 0); exit +} diff --git a/m4/ac_cxx_namespaces.m4 b/m4/ac_cxx_namespaces.m4 new file mode 100644 index 0000000..7001b91 --- /dev/null +++ b/m4/ac_cxx_namespaces.m4 @@ -0,0 +1,27 @@ +dnl @synopsis AC_CXX_NAMESPACES +dnl +dnl If the compiler can prevent names clashes using namespaces, define +dnl HAVE_NAMESPACES. +dnl +dnl @category Cxx +dnl @author Todd Veldhuizen +dnl @author Luc Maisonobe +dnl @version 2004-02-04 +dnl @license AllPermissive + +AC_DEFUN([AC_CXX_NAMESPACES], +[AC_CACHE_CHECK(whether the compiler implements namespaces, +ac_cv_cxx_namespaces, +[AC_LANG_SAVE + AC_LANG_CPLUSPLUS + AC_TRY_COMPILE([namespace Outer { namespace Inner { int i = 0; }}], + [using namespace Outer::Inner; return i;], + ac_cv_cxx_namespaces=yes, ac_cv_cxx_namespaces=no) + AC_LANG_RESTORE +]) +if test "$ac_cv_cxx_namespaces" = yes; then + AC_DEFINE(HAVE_NAMESPACES,,[define if the compiler implements namespaces]) +fi +]) + + diff --git a/m4/ac_path_generic.m4 b/m4/ac_path_generic.m4 new file mode 100644 index 0000000..97d3279 --- /dev/null +++ b/m4/ac_path_generic.m4 @@ -0,0 +1,140 @@ +dnl @synopsis AC_PATH_GENERIC(LIBRARY [, MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) +dnl +dnl Runs a LIBRARY-config script and defines LIBRARY_CFLAGS and +dnl LIBRARY_LIBS +dnl +dnl The script must support `--cflags' and `--libs' args. If +dnl MINIMUM-VERSION is specified, the script must also support the +dnl `--version' arg. If the `--with-library-[exec-]prefix' arguments to +dnl ./configure are given, it must also support `--prefix' and +dnl `--exec-prefix'. (In other words, it must be like gtk-config.) +dnl +dnl For example: +dnl +dnl AC_PATH_GENERIC(Foo, 1.0.0) +dnl +dnl would run `foo-config --version' and check that it is at least +dnl 1.0.0 +dnl +dnl If so, the following would then be defined: +dnl +dnl FOO_CFLAGS to `foo-config --cflags` +dnl FOO_LIBS to `foo-config --libs` +dnl +dnl At present there is no support for additional "MODULES" (see +dnl AM_PATH_GTK) (shamelessly stolen from gtk.m4 and then hacked around +dnl a fair amount) +dnl +dnl @category Misc +dnl @author Angus Lees +dnl @version 2001-03-16 +dnl @license GPLWithACException + +AC_DEFUN([AC_PATH_GENERIC], +[dnl +dnl we're going to need uppercase, lowercase and user-friendly versions of the +dnl string `LIBRARY' +pushdef([UP], translit([$1], [a-z], [A-Z]))dnl +pushdef([DOWN], translit([$1], [A-Z], [a-z]))dnl + +dnl +dnl Get the cflags and libraries from the LIBRARY-config script +dnl +AC_ARG_WITH(DOWN-prefix,[ --with-]DOWN[-prefix=PFX Prefix where $1 is installed (optional)], + DOWN[]_config_prefix="$withval", DOWN[]_config_prefix="") +AC_ARG_WITH(DOWN-exec-prefix,[ --with-]DOWN[-exec-prefix=PFX Exec prefix where $1 is installed (optional)], + DOWN[]_config_exec_prefix="$withval", DOWN[]_config_exec_prefix="") + + if test x$DOWN[]_config_exec_prefix != x ; then + DOWN[]_config_args="$DOWN[]_config_args --exec-prefix=$DOWN[]_config_exec_prefix" + if test x${UP[]_CONFIG+set} != xset ; then + UP[]_CONFIG=$DOWN[]_config_exec_prefix/bin/DOWN-config + fi + fi + if test x$DOWN[]_config_prefix != x ; then + DOWN[]_config_args="$DOWN[]_config_args --prefix=$DOWN[]_config_prefix" + if test x${UP[]_CONFIG+set} != xset ; then + UP[]_CONFIG=$DOWN[]_config_prefix/bin/DOWN-config + fi + fi + + AC_PATH_PROG(UP[]_CONFIG, DOWN-config, no) + ifelse([$2], , + AC_MSG_CHECKING(for $1), + AC_MSG_CHECKING(for $1 - version >= $2) + ) + no_[]DOWN="" + if test "$UP[]_CONFIG" = "no" ; then + no_[]DOWN=yes + else + UP[]_CFLAGS="`$UP[]_CONFIG $DOWN[]_config_args --cflags`" + UP[]_LIBS="`$UP[]_CONFIG $DOWN[]_config_args --libs`" + ifelse([$2], , ,[ + DOWN[]_config_major_version=`$UP[]_CONFIG $DOWN[]_config_args \ + --version | sed 's/[[^0-9]]*\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + DOWN[]_config_minor_version=`$UP[]_CONFIG $DOWN[]_config_args \ + --version | sed 's/[[^0-9]]*\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + DOWN[]_config_micro_version=`$UP[]_CONFIG $DOWN[]_config_args \ + --version | sed 's/[[^0-9]]*\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + DOWN[]_wanted_major_version="regexp($2, [\<\([0-9]*\)], [\1])" + DOWN[]_wanted_minor_version="regexp($2, [\<\([0-9]*\)\.\([0-9]*\)], [\2])" + DOWN[]_wanted_micro_version="regexp($2, [\<\([0-9]*\).\([0-9]*\).\([0-9]*\)], [\3])" + + # Compare wanted version to what config script returned. + # If I knew what library was being run, i'd probably also compile + # a test program at this point (which also extracted and tested + # the version in some library-specific way) + if test "$DOWN[]_config_major_version" -lt \ + "$DOWN[]_wanted_major_version" \ + -o \( "$DOWN[]_config_major_version" -eq \ + "$DOWN[]_wanted_major_version" \ + -a "$DOWN[]_config_minor_version" -lt \ + "$DOWN[]_wanted_minor_version" \) \ + -o \( "$DOWN[]_config_major_version" -eq \ + "$DOWN[]_wanted_major_version" \ + -a "$DOWN[]_config_minor_version" -eq \ + "$DOWN[]_wanted_minor_version" \ + -a "$DOWN[]_config_micro_version" -lt \ + "$DOWN[]_wanted_micro_version" \) ; then + # older version found + no_[]DOWN=yes + echo -n "*** An old version of $1 " + echo -n "($DOWN[]_config_major_version" + echo -n ".$DOWN[]_config_minor_version" + echo ".$DOWN[]_config_micro_version) was found." + echo -n "*** You need a version of $1 newer than " + echo -n "$DOWN[]_wanted_major_version" + echo -n ".$DOWN[]_wanted_minor_version" + echo ".$DOWN[]_wanted_micro_version." + echo "***" + echo "*** If you have already installed a sufficiently new version, this error" + echo "*** probably means that the wrong copy of the DOWN-config shell script is" + echo "*** being found. The easiest way to fix this is to remove the old version" + echo "*** of $1, but you can also set the UP[]_CONFIG environment to point to the" + echo "*** correct copy of DOWN-config. (In this case, you will have to" + echo "*** modify your LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf" + echo "*** so that the correct libraries are found at run-time)" + fi + ]) + fi + if test "x$no_[]DOWN" = x ; then + AC_MSG_RESULT(yes) + ifelse([$3], , :, [$3]) + else + AC_MSG_RESULT(no) + if test "$UP[]_CONFIG" = "no" ; then + echo "*** The DOWN-config script installed by $1 could not be found" + echo "*** If $1 was installed in PREFIX, make sure PREFIX/bin is in" + echo "*** your path, or set the UP[]_CONFIG environment variable to the" + echo "*** full path to DOWN-config." + fi + UP[]_CFLAGS="" + UP[]_LIBS="" + ifelse([$4], , :, [$4]) + fi + AC_SUBST(UP[]_CFLAGS) + AC_SUBST(UP[]_LIBS) + + popdef([UP]) + popdef([DOWN]) +]) diff --git a/m4/avg_version.m4 b/m4/avg_version.m4 new file mode 100644 index 0000000..7ab45b0 --- /dev/null +++ b/m4/avg_version.m4 @@ -0,0 +1,3 @@ +m4_define([VERSION_MAJOR], [1]) +m4_define([VERSION_MINOR], [8]) +m4_define([VERSION_MICRO], [1]) diff --git a/m4/ax_boost_thread.m4 b/m4/ax_boost_thread.m4 new file mode 100644 index 0000000..9590ee6 --- /dev/null +++ b/m4/ax_boost_thread.m4 @@ -0,0 +1,72 @@ +dnl @synopsis AX_BOOST_THREAD +dnl +dnl This macro checks to see if the Boost.Thread library is installed. +dnl It also attempts to guess the currect library name using several +dnl attempts. It tries to build the library name using a user supplied +dnl name or suffix and then just the raw library. +dnl +dnl If the library is found, HAVE_BOOST_THREAD is defined and +dnl BOOST_THREAD_LIBS is set to the name of the library. +dnl +dnl This macro calls AC_SUBST(BOOST_THREAD_LIBS). +dnl +dnl @category InstalledPackages +dnl @author Michael Tindal +dnl @version 2004-09-20 +dnl @license GPLWithACException + +AC_DEFUN([AX_BOOST_THREAD], +[AC_REQUIRE([AC_CXX_NAMESPACES])dnl + +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +CXXFLAGS_SAVE=$CXXFLAGS +LIBS_SAVE=$LIBS +dnl FIXME: need to include a generic way to check for the flag +dnl to turn on threading support. +CXXFLAGS="-pthread $CXXFLAGS" + +AC_CACHE_CHECK(whether the Boost::Thread library is available, +ax_cv_boost_thread, +[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], + [[boost::thread_group thrds; return 0;]])], + ax_cv_boost_thread=yes, ax_cv_boost_thread=no) +]) + +if test "$ax_cv_boost_thread" = yes; then + AC_DEFINE(HAVE_BOOST_THREAD,,[define if the Boost::Thread library is available]) + dnl Now determine the appropriate file names + AC_ARG_WITH([boost-thread],AS_HELP_STRING([--with-boost-thread], + [specify the boost thread library suffix to use]), + [if test "x$with_boost_thread" != "xno"; then + ax_boost_thread_lib=boost_thread$with_boost_thread + fi]) + for ax_lib in $ax_boost_thread_lib boost_thread boost_thread-mt; do + AC_CHECK_LIB($ax_lib, main, [BOOST_THREAD_LIBS=-l$ax_lib; break]) + done + + # OXullo 2012-07-18: since boost 1.50, boost::thread depends on boost::system + AC_CACHE_CHECK(whether Boost::Thread needs Boost::System library, + ax_cv_boost_thread_system, + [LIBS="$LIBS $BOOST_THREAD_LIBS" + AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], + [[boost::thread_group thrds; return 0;]])], + [ax_cv_boost_thread_system=no], + [LIBS="$LIBS $BOOST_THREAD_LIBS -lboost_system$with_boost_thread" + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[#include ]], + [[boost::thread_group thrds; return 0;]]) + ], + [BOOST_THREAD_LIBS="$BOOST_THREAD_LIBS -lboost_system$with_boost_thread" + ax_cv_boost_thread_system=yes], + [AC_ERROR([Cannot use Boost::Thread])] + )]) + ]) + + CXXFLAGS=$CXXFLAGS_SAVE + LIBS=$LIBS_SAVE + AC_LANG_RESTORE + + AC_SUBST(BOOST_THREAD_LIBS) +fi +])dnl diff --git a/m4/ax_check_define.m4 b/m4/ax_check_define.m4 new file mode 100644 index 0000000..cb0b5b5 --- /dev/null +++ b/m4/ax_check_define.m4 @@ -0,0 +1,90 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_check_define.html +# =========================================================================== +# +# SYNOPSIS +# +# AC_CHECK_DEFINE([symbol], [ACTION-IF-FOUND], [ACTION-IF-NOT]) +# AX_CHECK_DEFINE([includes],[symbol], [ACTION-IF-FOUND], [ACTION-IF-NOT]) +# +# DESCRIPTION +# +# Complements AC_CHECK_FUNC but it does not check for a function but for a +# define to exist. Consider a usage like: +# +# AC_CHECK_DEFINE(__STRICT_ANSI__, CFLAGS="$CFLAGS -D_XOPEN_SOURCE=500") +# +# LICENSE +# +# Copyright (c) 2008 Guido U. Draheim +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 7 + +AC_DEFUN([AC_CHECK_DEFINED],[ +AS_VAR_PUSHDEF([ac_var],[ac_cv_defined_$1])dnl +AC_CACHE_CHECK([for $1 defined], ac_var, +AC_TRY_COMPILE(,[ + #ifdef $1 + int ok; + #else + choke me + #endif +],AS_VAR_SET(ac_var, yes),AS_VAR_SET(ac_var, no))) +AS_IF([test AS_VAR_GET(ac_var) != "no"], [$2], [$3])dnl +AS_VAR_POPDEF([ac_var])dnl +]) + +AC_DEFUN([AX_CHECK_DEFINED],[ +AS_VAR_PUSHDEF([ac_var],[ac_cv_defined_$2])dnl +AC_CACHE_CHECK([for $2 defined], ac_var, +AC_TRY_COMPILE([#include "$1"],[ + #ifdef $2 + int ok; + #else + choke me + #endif +],AS_VAR_SET(ac_var, yes),AS_VAR_SET(ac_var, no))) +AS_IF([test AS_VAR_GET(ac_var) != "no"], [$3], [$4])dnl +AS_VAR_POPDEF([ac_var])dnl +]) + +AC_DEFUN([AX_CHECK_FUNC], +[AS_VAR_PUSHDEF([ac_var], [ac_cv_func_$2])dnl +AC_CACHE_CHECK([for $2], ac_var, +dnl AC_LANG_FUNC_LINK_TRY +[AC_LINK_IFELSE([AC_LANG_PROGRAM([$1 + #undef $2 + char $2 ();],[ + char (*f) () = $2; + return f != $2; ])], + [AS_VAR_SET(ac_var, yes)], + [AS_VAR_SET(ac_var, no)])]) +AS_IF([test AS_VAR_GET(ac_var) = yes], [$3], [$4])dnl +AS_VAR_POPDEF([ac_var])dnl +])# AC_CHECK_FUNC diff --git a/m4/ax_check_gl.m4 b/m4/ax_check_gl.m4 new file mode 100644 index 0000000..124760c --- /dev/null +++ b/m4/ax_check_gl.m4 @@ -0,0 +1,335 @@ +# Copied from +# http://ac-archive.sourceforge.net/ +# + +AC_DEFUN([ACX_PTHREAD], [ +AC_REQUIRE([AC_CANONICAL_HOST]) +AC_LANG_SAVE +AC_LANG_C +acx_pthread_ok=no + +# We used to check for pthread.h first, but this fails if pthread.h +# requires special compiler flags (e.g. on True64 or Sequent). +# It gets checked for in the link test anyway. + +# First of all, check if the user has set any of the PTHREAD_LIBS, +# etcetera environment variables, and if threads linking works using +# them: +if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + save_LIBS="$LIBS" + LIBS="$PTHREAD_LIBS $LIBS" + AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS]) + AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes) + AC_MSG_RESULT($acx_pthread_ok) + if test x"$acx_pthread_ok" = xno; then + PTHREAD_LIBS="" + PTHREAD_CFLAGS="" + fi + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" +fi + +# We must check for the threads library under a number of different +# names; the ordering is very important because some systems +# (e.g. DEC) have both -lpthread and -lpthreads, where one of the +# libraries is broken (non-POSIX). + +# Create a list of thread flags to try. Items starting with a "-" are +# C compiler flags, and other items are library names, except for "none" +# which indicates that we try without any flags at all, and "pthread-config" +# which is a program returning the flags for the Pth emulation library. + +acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" + +# The ordering *is* (sometimes) important. Some notes on the +# individual items follow: + +# pthreads: AIX (must check this before -lpthread) +# none: in case threads are in libc; should be tried before -Kthread and +# other compiler flags to prevent continual compiler warnings +# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) +# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) +# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) +# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads) +# -pthreads: Solaris/gcc +# -mthreads: Mingw32/gcc, Lynx/gcc +# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it +# doesn't hurt to check since this sometimes defines pthreads too; +# also defines -D_REENTRANT) +# pthread: Linux, etcetera +# --thread-safe: KAI C++ +# pthread-config: use pthread-config program (for GNU Pth library) + +case "${host_cpu}-${host_os}" in + *solaris*) + + # On Solaris (at least, for some versions), libc contains stubbed + # (non-functional) versions of the pthreads routines, so link-based + # tests will erroneously succeed. (We need to link with -pthread or + # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather + # a function called by this macro, so we could check for that, but + # who knows whether they'll stub that too in a future libc.) So, + # we'll just look for -pthreads and -lpthread first: + + acx_pthread_flags="-pthread -pthreads pthread -mt $acx_pthread_flags" + ;; +esac + +if test x"$acx_pthread_ok" = xno; then +for flag in $acx_pthread_flags; do + + case $flag in + none) + AC_MSG_CHECKING([whether pthreads work without any flags]) + ;; + + -*) + AC_MSG_CHECKING([whether pthreads work with $flag]) + PTHREAD_CFLAGS="$flag" + ;; + + pthread-config) + AC_CHECK_PROG(acx_pthread_config, pthread-config, yes, no) + if test x"$acx_pthread_config" = xno; then continue; fi + PTHREAD_CFLAGS="`pthread-config --cflags`" + PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" + ;; + + *) + AC_MSG_CHECKING([for the pthreads library -l$flag]) + PTHREAD_LIBS="-l$flag" + ;; + esac + + save_LIBS="$LIBS" + save_CFLAGS="$CFLAGS" + LIBS="$PTHREAD_LIBS $LIBS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + + # Check for various functions. We must include pthread.h, + # since some functions may be macros. (On the Sequent, we + # need a special flag -Kthread to make this header compile.) + # We check for pthread_join because it is in -lpthread on IRIX + # while pthread_create is in libc. We check for pthread_attr_init + # due to DEC craziness with -lpthreads. We check for + # pthread_cleanup_push because it is one of the few pthread + # functions on Solaris that doesn't have a non-functional libc stub. + # We try pthread_create on general principles. + AC_TRY_LINK([#include ], + [pthread_t th; pthread_join(th, 0); + pthread_attr_init(0); pthread_cleanup_push(0, 0); + pthread_create(0,0,0,0); pthread_cleanup_pop(0); ], + [acx_pthread_ok=yes]) + + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" + + AC_MSG_RESULT($acx_pthread_ok) + if test "x$acx_pthread_ok" = xyes; then + break; + fi + + PTHREAD_LIBS="" + PTHREAD_CFLAGS="" +done +fi + +# Various other checks: +if test "x$acx_pthread_ok" = xyes; then + save_LIBS="$LIBS" + LIBS="$PTHREAD_LIBS $LIBS" + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + + # Detect AIX lossage: threads are created detached by default + # and the JOINABLE attribute has a nonstandard name (UNDETACHED). + AC_MSG_CHECKING([for joinable pthread attribute]) + AC_TRY_LINK([#include ], + [int attr=PTHREAD_CREATE_JOINABLE;], + ok=PTHREAD_CREATE_JOINABLE, ok=unknown) + if test x"$ok" = xunknown; then + AC_TRY_LINK([#include ], + [int attr=PTHREAD_CREATE_UNDETACHED;], + ok=PTHREAD_CREATE_UNDETACHED, ok=unknown) + fi + if test x"$ok" != xPTHREAD_CREATE_JOINABLE; then + AC_DEFINE(PTHREAD_CREATE_JOINABLE, $ok, + [Define to the necessary symbol if this constant + uses a non-standard name on your system.]) + fi + AC_MSG_RESULT(${ok}) + if test x"$ok" = xunknown; then + AC_MSG_WARN([we do not know how to create joinable pthreads]) + fi + + AC_MSG_CHECKING([if more special flags are required for pthreads]) + flag=no + case "${host_cpu}-${host_os}" in + *-aix* | *-freebsd*) flag="-D_THREAD_SAFE";; + *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";; + esac + AC_MSG_RESULT(${flag}) + if test "x$flag" != xno; then + PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS" + fi + + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" + + # More AIX lossage: must compile with cc_r + AC_CHECK_PROG(PTHREAD_CC, cc_r, cc_r, ${CC}) +else + PTHREAD_CC="$CC" +fi + +AC_SUBST(PTHREAD_LIBS) +AC_SUBST(PTHREAD_CFLAGS) +AC_SUBST(PTHREAD_CC) + +# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: +if test x"$acx_pthread_ok" = xyes; then + ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1]) + : +else + acx_pthread_ok=no + $2 +fi +AC_LANG_RESTORE +])dnl ACX_PTHREAD + + + +AC_DEFUN([AX_CHECK_GL], +[AC_REQUIRE([AC_PATH_X])dnl +AC_REQUIRE([ACX_PTHREAD])dnl + +# +# There isn't a reliable way to know we should use the Apple OpenGL framework +# without a configure option. A Mac OS X user may have installed an +# alternative GL implementation (e.g., Mesa), which may or may not depend on X. +# libavg change: We just assume that libavg should always run using the mac +# OpenGL framework on OS X. +# +if test $target_vendor = apple; then + AC_DEFINE([HAVE_APPLE_OPENGL_FRAMEWORK], [1], + [Use the Apple OpenGL framework.]) + AC_MSG_NOTICE([Using Apple OpenGL framework]) + GL_CFLAGS="" + GL_LIBS="-framework OpenGL -framework AGL" +else + GL_CFLAGS="${PTHREAD_CFLAGS}" + GL_LIBS="${PTHREAD_LIBS} -lm" + + # + # Use x_includes and x_libraries if they have been set (presumably by + # AC_PATH_X). + # + if test "X$no_x" != "Xyes"; then + if test -n "$x_includes"; then + GL_CFLAGS="-I${x_includes} ${GL_CFLAGS}" + fi + if test -n "$x_libraries"; then + GL_LIBS="-L${x_libraries} -lX11 ${GL_LIBS}" + fi + fi + + AC_LANG_PUSH(C) + + AC_CHECK_HEADERS([windows.h]) + + AC_CACHE_CHECK([for OpenGL library], [ax_cv_check_gl_libgl], + [ax_cv_check_gl_libgl="no" + ax_save_CPPFLAGS="${CPPFLAGS}" + CPPFLAGS="${GL_CFLAGS} ${CPPFLAGS}" + ax_save_LIBS="${LIBS}" + LIBS="" + ax_check_libs="-lopengl32 -lGL" + for ax_lib in ${ax_check_libs}; do + if test "X$CC" = "Xcl"; then + ax_try_lib=`echo $ax_lib | sed -e 's/^-l//' -e 's/$/.lib/'` + else + ax_try_lib="${ax_lib}" + fi + LIBS="${ax_try_lib} ${GL_LIBS} ${ax_save_LIBS}" + AC_TRY_LINK([ +# if HAVE_WINDOWS_H && defined(_WIN32) +# include +# endif +# include +], + [glBegin(0)], + [ax_cv_check_gl_libgl="${ax_try_lib}"; break]) + done + LIBS=${ax_save_LIBS} + CPPFLAGS=${ax_save_CPPFLAGS}]) + + if test "X${ax_cv_check_gl_libgl}" = "Xno"; then + no_gl="yes" + GL_CFLAGS="" + GL_LIBS="" + else + GL_LIBS="${ax_cv_check_gl_libgl} ${GL_LIBS}" + fi + AC_LANG_POP(C) +fi + +AC_SUBST([GL_CFLAGS]) +AC_SUBST([GL_LIBS]) +])dnl + + +AC_DEFUN([AX_CHECK_GLU], +[AC_REQUIRE([AX_CHECK_GL])dnl +GLU_CFLAGS="${GL_CFLAGS}" +if test $target_vendor != apple; then + AC_CACHE_CHECK([for OpenGL Utility library], [ax_cv_check_glu_libglu], + [ax_cv_check_glu_libglu="no" + ax_save_CPPFLAGS="${CPPFLAGS}" + CPPFLAGS="${GL_CFLAGS} ${CPPFLAGS}" + ax_save_LIBS="${LIBS}" + LIBS="" + ax_check_libs="-lglu32 -lGLU" + for ax_lib in ${ax_check_libs}; do + if test "X$CC" = "Xcl"; then + ax_try_lib=`echo $ax_lib | sed -e 's/^-l//' -e 's/$/.lib/'` + else + ax_try_lib="${ax_lib}" + fi + LIBS="${ax_try_lib} ${GL_LIBS} ${ax_save_LIBS}" + # + # libGLU typically links with libstdc++ on POSIX platforms. However, + # setting the language to C++ means that test program source is named + # "conftest.cc"; and Microsoft cl doesn't know what to do with such a + # file. + # + if test "X$CXX" != "Xcl"; then + AC_LANG_PUSH([C++]) + fi + AC_TRY_LINK([ +# if HAVE_WINDOWS_H && defined(_WIN32) +# include +# endif +# include +], + [gluBeginCurve(0)], + [ax_cv_check_glu_libglu="${ax_try_lib}"; break]) + if test "X$CXX" != "Xcl"; then + AC_LANG_POP([C++]) + fi + done + LIBS=${ax_save_LIBS} + CPPFLAGS=${ax_save_CPPFLAGS}]) + if test "X${ax_cv_check_glu_libglu}" = "Xno"; then + no_gl="yes" + GLU_CFLAGS="" + GLU_LIBS="" + else + GLU_LIBS="${ax_cv_check_glu_libglu} ${GL_LIBS}" + fi +fi +AC_SUBST([GLU_CFLAGS]) +AC_SUBST([GLU_LIBS]) +]) + diff --git a/m4/ax_python_devel.m4 b/m4/ax_python_devel.m4 new file mode 100644 index 0000000..0151482 --- /dev/null +++ b/m4/ax_python_devel.m4 @@ -0,0 +1,312 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_python_devel.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_PYTHON_DEVEL([version]) +# +# DESCRIPTION +# +# Note: Defines as a precious variable "PYTHON_VERSION". Don't override it +# in your configure.ac. +# +# This macro checks for Python and tries to get the include path to +# 'Python.h'. It provides the $(PYTHON_CPPFLAGS) and $(PYTHON_LDFLAGS) +# output variables. It also exports $(PYTHON_EXTRA_LIBS) and +# $(PYTHON_EXTRA_LDFLAGS) for embedding Python in your code. +# +# You can search for some particular version of Python by passing a +# parameter to this macro, for example ">= '2.3.1'", or "== '2.4'". Please +# note that you *have* to pass also an operator along with the version to +# match, and pay special attention to the single quotes surrounding the +# version number. Don't use "PYTHON_VERSION" for this: that environment +# variable is declared as precious and thus reserved for the end-user. +# +# This macro should work for all versions of Python >= 2.1.0. As an end +# user, you can disable the check for the python version by setting the +# PYTHON_NOVERSIONCHECK environment variable to something else than the +# empty string. +# +# If you need to use this macro for an older Python version, please +# contact the authors. We're always open for feedback. +# +# LICENSE +# +# Copyright (c) 2009 Sebastian Huber +# Copyright (c) 2009 Alan W. Irwin +# Copyright (c) 2009 Rafael Laboissiere +# Copyright (c) 2009 Andrew Collier +# Copyright (c) 2009 Matteo Settenvini +# Copyright (c) 2009 Horst Knorr +# Copyright (c) 2013 Daniel Mullner +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 16 + +AU_ALIAS([AC_PYTHON_DEVEL], [AX_PYTHON_DEVEL]) +AC_DEFUN([AX_PYTHON_DEVEL],[ + # + # Allow the use of a (user set) custom python version + # + AC_ARG_VAR([PYTHON_VERSION],[The installed Python + version to use, for example '2.3'. This string + will be appended to the Python interpreter + canonical name.]) + + AC_PATH_PROG([PYTHON],[python[$PYTHON_VERSION]]) + if test -z "$PYTHON"; then + AC_MSG_ERROR([Cannot find python$PYTHON_VERSION in your system path]) + PYTHON_VERSION="" + fi + + # + # Check for a version of Python >= 2.1.0 + # + AC_MSG_CHECKING([for a version of Python >= '2.1.0']) + ac_supports_python_ver=`$PYTHON -c "import sys; \ + ver = sys.version.split ()[[0]]; \ + print (ver >= '2.1.0')"` + if test "$ac_supports_python_ver" != "True"; then + if test -z "$PYTHON_NOVERSIONCHECK"; then + AC_MSG_RESULT([no]) + AC_MSG_FAILURE([ +This version of the AC@&t@_PYTHON_DEVEL macro +doesn't work properly with versions of Python before +2.1.0. You may need to re-run configure, setting the +variables PYTHON_CPPFLAGS, PYTHON_LDFLAGS, PYTHON_SITE_PKG, +PYTHON_EXTRA_LIBS and PYTHON_EXTRA_LDFLAGS by hand. +Moreover, to disable this check, set PYTHON_NOVERSIONCHECK +to something else than an empty string. +]) + else + AC_MSG_RESULT([skip at user request]) + fi + else + AC_MSG_RESULT([yes]) + fi + + # + # if the macro parameter ``version'' is set, honour it + # + if test -n "$1"; then + AC_MSG_CHECKING([for a version of Python $1]) + ac_supports_python_ver=`$PYTHON -c "import sys; \ + ver = sys.version.split ()[[0]]; \ + print (ver $1)"` + if test "$ac_supports_python_ver" = "True"; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + AC_MSG_ERROR([this package requires Python $1. +If you have it installed, but it isn't the default Python +interpreter in your system path, please pass the PYTHON_VERSION +variable to configure. See ``configure --help'' for reference. +]) + PYTHON_VERSION="" + fi + fi + + # + # Check if you have distutils, else fail + # + AC_MSG_CHECKING([for the distutils Python package]) + ac_distutils_result=`$PYTHON -c "import distutils" 2>&1` + if test -z "$ac_distutils_result"; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + AC_MSG_ERROR([cannot import Python module "distutils". +Please check your Python installation. The error was: +$ac_distutils_result]) + PYTHON_VERSION="" + fi + + # + # Check for Python include path + # + AC_MSG_CHECKING([for Python include path]) + if test -z "$PYTHON_CPPFLAGS"; then + python_path=`$PYTHON -c "import distutils.sysconfig; \ + print (distutils.sysconfig.get_python_inc ());"` + plat_python_path=`$PYTHON -c "import distutils.sysconfig; \ + print (distutils.sysconfig.get_python_inc (plat_specific=1));"` + if test -n "${python_path}"; then + if test "${plat_python_path}" != "${python_path}"; then + python_path="-I$python_path -I$plat_python_path" + else + python_path="-I$python_path" + fi + fi + PYTHON_CPPFLAGS=$python_path + fi + AC_MSG_RESULT([$PYTHON_CPPFLAGS]) + AC_SUBST([PYTHON_CPPFLAGS]) + + # + # Check for Python library path + # + AC_MSG_CHECKING([for Python library path]) + if test -z "$PYTHON_LDFLAGS"; then + # (makes two attempts to ensure we've got a version number + # from the interpreter) + ac_python_version=`cat<]], + [[Py_Initialize();]]) + ],[pythonexists=yes],[pythonexists=no]) + AC_LANG_POP([C]) + # turn back to default flags + CPPFLAGS="$ac_save_CPPFLAGS" + LIBS="$ac_save_LIBS" + + AC_MSG_RESULT([$pythonexists]) + + if test ! "x$pythonexists" = "xyes"; then + AC_MSG_FAILURE([ + Could not link test program to Python. Maybe the main Python library has been + installed in some non-standard library path. If so, pass it to configure, + via the LDFLAGS environment variable. + Example: ./configure LDFLAGS="-L/usr/non-standard-path/python/lib" + ============================================================================ + ERROR! + You probably have to install the development version of the Python package + for your distribution. The exact name of this package varies among them. + ============================================================================ + ]) + PYTHON_VERSION="" + fi + + # + # all done! + # +]) diff --git a/m4/pkg.m4 b/m4/pkg.m4 new file mode 100644 index 0000000..5122636 --- /dev/null +++ b/m4/pkg.m4 @@ -0,0 +1,114 @@ +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +# +# Copyright © 2004 Scott James Remnant . +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# PKG_PROG_PKG_CONFIG([MIN-VERSION]) +# ---------------------------------- +AC_DEFUN([PKG_PROG_PKG_CONFIG], +[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) +m4_pattern_allow([^PKG_CONFIG(_PATH)?$]) +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=m4_ifval([$1], [$1], [0.9.0]) + AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + PKG_CONFIG="" + fi + +fi[]dnl +])# PKG_PROG_PKG_CONFIG + +# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) +# --------------------------------------------- +m4_define([_PKG_CONFIG], +[if test "x$ac_cv_env_[]$1[]_set" = "xset"; then + pkg_cv_[]$1=$ac_cv_env_[]$1[]_value +elif test -n "$PKG_CONFIG"; then + if AC_RUN_LOG([$PKG_CONFIG --exists "$3" >/dev/null 2>&1]); then + pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` + else + pkg_failed=yes + fi +else + pkg_failed=untried +fi[]dnl +])# _PKG_CONFIG + +# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +# [ACTION-IF-NOT-FOUND]) +# +# +# Note that if there is a possibility the first call to +# PKG_CHECK_MODULES might not happen, you should be sure to include an +# explicit call to PKG_PROG_PKG_CONFIG in your configure.in +# +# +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_MODULES], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl +AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl + +pkg_failed=no +AC_CACHE_CHECK([for $1][_CFLAGS], [pkg_cv_][$1][_CFLAGS], + [_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])]) +AC_CACHE_CHECK([for $1][_LIBS], [pkg_cv_][$1][_LIBS], + [_PKG_CONFIG([$1][_LIBS], [libs], [$2])]) + +if test $pkg_failed = yes; then + $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` + # Put the nasty error message in config.log where it belongs + echo "$$1[]_PKG_ERRORS" 1>&AS_MESSAGE_LOG_FD + + ifelse([$4], , [AC_MSG_ERROR(dnl +[Package requirements ($2) were not met. +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively you may set the $1_CFLAGS and $1_LIBS environment variables +to avoid the need to call pkg-config. See the pkg-config man page for +more details.])], + [$4]) +elif test $pkg_failed = untried; then + ifelse([$4], , [AC_MSG_FAILURE(dnl +[The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively you may set the $1_CFLAGS and $1_LIBS environment variables +to avoid the need to call pkg-config. See the pkg-config man page for +more details. + +To get pkg-config, see .])], + [$4]) +else + $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS + $1[]_LIBS=$pkg_cv_[]$1[]_LIBS + ifelse([$3], , :, [$3]) +fi[]dnl +])# PKG_CHECK_MODULES diff --git a/mac/MakeDist.sh b/mac/MakeDist.sh new file mode 100755 index 0000000..a3c6faa --- /dev/null +++ b/mac/MakeDist.sh @@ -0,0 +1,89 @@ +#!/bin/bash + +set -e +set -x + +cd .. + +VERSION_MAJOR=$(grep VERSION_MAJOR m4/avg_version.m4 | + sed 's/^.*\[ *\([A-Za-z0-9\.]*\) *\].*$/\1/') +VERSION_MINOR=$(grep VERSION_MINOR m4/avg_version.m4 | + sed 's/^.*\[ *\([A-Za-z0-9\.]*\) *\].*$/\1/') +VERSION_MICRO=$(grep VERSION_MICRO m4/avg_version.m4 | + sed 's/^.*\[ *\([A-Za-z0-9\.]*\) *\].*$/\1/') + +export VERSION=$VERSION_MAJOR.$VERSION_MINOR.$VERSION_MICRO + +fixLib() +{ + INSTALL_PATH=$3 + install_name_tool -change ${AVG_PATH}/lib/$2.dylib $INSTALL_PATH/avg/$2.dylib avg/$1 + install_name_tool -id $INSTALL_PATH/avg/$2.dylib avg/$2.dylib +} + +distLib() +{ + INSTALL_PATH=$2 + cp -v ../../lib/$1.dylib ./avg + install_name_tool -change $AVG_PATH//lib/$1.dylib $INSTALL_PATH/avg/$1.dylib avg.0.so + fixLib ../avg.0.so $1 $INSTALL_PATH +} + +makeOneDist() +{ + INSTALL_PATH=$1 + PYTHON_VER=$2 + + # Copy distribution files into staging area. + cd $LIBAVGDIR/../dist + rm -rf * + mkdir libavg + cd libavg + mkdir avg + mkdir avg/test + cp -Rv ${BUILDDIR}/site-packages/libavg/ . + strip -S avg.0.so + cp ../../libavg/src/avgrc avg + mkdir etc + cp -R /etc/fonts etc/ + cd $LIBAVGDIR/src/test + cp -Rv *.py *.avg *.svg ${AVG_PATH}/dist/libavg/avg/test + mkdir ${AVG_PATH}/dist/libavg/avg/test/baseline + cp -v baseline/* ${AVG_PATH}/dist/libavg/avg/test/baseline + mkdir ${AVG_PATH}/dist/libavg/avg/test/media + cp -Rv media/* ${AVG_PATH}/dist/libavg/avg/test/media + mkdir ${AVG_PATH}/dist/libavg/avg/test/testmediadir + cp -v testmediadir/* ${AVG_PATH}/dist/libavg/avg/test/testmediadir + mkdir ${AVG_PATH}/dist/libavg/avg/test/fonts + cp -v fonts/* ${AVG_PATH}/dist/libavg/avg/test/fonts + mkdir ${AVG_PATH}/dist/libavg/avg/test/plugin + cp -v plugin/.libs/colorplugin.so ${AVG_PATH}/dist/libavg/avg/test/plugin + cp -v plugin/.libs/colorplugin.0.so ${AVG_PATH}/dist/libavg/avg/test/plugin + mkdir ${AVG_PATH}/dist/libavg/avg/test/extrafonts + cp -v extrafonts/testaddfontdir.ttf ${AVG_PATH}/dist/libavg/avg/test/extrafonts + + + cd $LIBAVGDIR/../bindist + rm -rf * + cp /usr/local/bin/avg_* . +} + +if [[ x"${PKG_CONFIG_PATH}" == "x" ]] +then + echo Please call 'source mac/avg_env.sh' before calling this script. + exit -1 +fi + +LIBAVGDIR=`pwd` +DARWINVER=`uname -r` +DARWINMAJORVER=${DARWINVER%%.*} + +PYTHONVERSION=2.7 +OSXVERSION=10.6 +BUILDDIR=/usr/local/lib/python2.7/ + +makeOneDist /Library/Python/${PYTHONVERSION}/site-packages/libavg ${PYTHONVERSION} +cd $LIBAVGDIR +/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker --doc mac/libavg.10.6.pmdoc -v -o libavg.pkg +hdiutil create libavg-mac-${VERSION}.dmg -srcfolder libavg.pkg -ov +hdiutil internet-enable -yes libavg-mac-${VERSION}.dmg diff --git a/mac/PackDeps.sh b/mac/PackDeps.sh new file mode 100755 index 0000000..7535978 --- /dev/null +++ b/mac/PackDeps.sh @@ -0,0 +1,12 @@ +#!/bin/bash +if [[ x"${AVG_PATH}" == "x" ]] +then + echo Please set AVG_PATH before calling this script. + exit -1 +fi + +DEST_PATH=`pwd` +cd $AVG_PATH/deps +tar cjf $DEST_PATH/macdependencies.tar.bz2 tarballs + +echo "Done" diff --git a/mac/UnpackDeps.sh b/mac/UnpackDeps.sh new file mode 100755 index 0000000..cb9fe78 --- /dev/null +++ b/mac/UnpackDeps.sh @@ -0,0 +1,48 @@ +#!/bin/bash +if [[ x"${AVG_PATH}" == "x" ]] +then + echo Please set AVG_PATH before calling this script. + exit -1 +fi + +cd $AVG_PATH/deps + +for file in $(ls tarballs/*.gz) $(ls tarballs/*.bz2); do + echo " Unpacking $file." + tar xf $file +done + +echo " Applying patches." +cd gettext-0.18.1.1 +patch -p0 < ../../libavg/mac/stpncpy.patch +cd .. +cd fontconfig-2.7.0 +patch -R Makefile.am <../../libavg/mac/fontconfig-disablecache.patch +patch fontconfig.pc.in < ../../libavg/mac/fontconfig.pc.in.patch +cd .. +cd librsvg-2.34.0 +patch Makefile.am < ../../libavg/mac/librsvg_makefile.patch +patch configure.in < ../../libavg/mac/librsvg_configure.patch +cd .. +cd glib-2.29.2/glib +patch -R gconvert.c < ../../../libavg/mac/glib.patch +cd ../.. +cd freetype-2.5.0.1/ +patch -p1 -R < ../../libavg/mac/freetype_linespacing.patch +cd .. + +DARWINVER=`uname -r` +DARWINMAJORVER=${DARWINVER%%.*} +if [[ "${DARWINMAJORVER}" == "13" ]] +then + cd SDL-1.2.15 + patch -p1 < ../../libavg/mac/libsdl_mavericks.patch + cd .. +fi +cd pkg-config-0.20/glib-1.2.8/ +patch -p0 -R glib.h ../../../libavg/mac/pkg-config-mavericks.patch +cd ../.. +cd libdc1394-2.2.1 +patch -p1 < ../../libavg/mac/dc1394_mavericks.patch +cd .. +echo "Done" diff --git a/mac/avg_env.sh b/mac/avg_env.sh new file mode 100755 index 0000000..089a0e9 --- /dev/null +++ b/mac/avg_env.sh @@ -0,0 +1,33 @@ +if [[ x"${AVG_PATH}" == x"" ]] +then + echo Please set AVG_PATH +else + # Set the debug info flag to use depending on whether clang is used as compiler. + # Is there an easier way to do this? + if [[ "${CXX}" == "" ]] + then + CXX=gcc + fi + IS_CLANG="`${CXX} --version 2> /dev/null | grep clang`" + if [[ "${IS_CLANG}" == "" ]] + then + DEBUGINFOFLAG="-gstabs" + else + DEBUGINFOFLAG="-g" + fi + export PATH=${AVG_PATH}/bin:${PATH} + export CPPFLAGS="-I${AVG_PATH}/include "$CPPFLAGS + export CXXFLAGS="-O3 ${DEBUGINFOFLAG} -Wall -pipe "$CXXFLAGS + export CFLAGS="-O3 ${DEBUGINFOFLAG} -Wall -pipe "$CFLAGS + export LDFLAGS="-L${AVG_PATH}/lib "$LDFLAGS + export PKG_CONFIG_PATH=${PKG_CONFIG_PATH}:${AVG_PATH}/lib/pkgconfig + DARWINVER=`uname -r` + DARWINMAJORVER=${DARWINVER%%.*} + if [[ "${DARWINMAJORVER}" == "10" ]] + then + export PYTHONPATH=/usr/local/lib/python2.6/site-packages/:$PYTHONPATH + else + export PYTHONPATH=${AVG_PATH}/lib/python/2.5/site-packages/:$PYTHONPATH + fi + export AVG_MAC_ENV_SET=1 +fi diff --git a/mac/dc1394_mavericks.patch b/mac/dc1394_mavericks.patch new file mode 100644 index 0000000..fc65746 --- /dev/null +++ b/mac/dc1394_mavericks.patch @@ -0,0 +1,77 @@ +--- libdc1394-2.2.1/configure 2013-01-28 03:47:43.000000000 +0100 ++++ libdc1394-2.2.1-changed/configure 2013-10-29 22:05:59.000000000 +0100 +@@ -13609,51 +13609,8 @@ + + ;; + *-*-darwin*) +- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for IOMasterPort in -lIOKit" >&5 +-$as_echo_n "checking for IOMasterPort in -lIOKit... " >&6; } +-if test "${ac_cv_lib_IOKit_IOMasterPort+set}" = set; then : +- $as_echo_n "(cached) " >&6 +-else +- ac_check_lib_save_LIBS=$LIBS +-LIBS="-lIOKit $LIBS" +-cat confdefs.h - <<_ACEOF >conftest.$ac_ext +-/* end confdefs.h. */ +- +-/* Override any GCC internal prototype to avoid an error. +- Use char because int might match the return type of a GCC +- builtin and then its argument prototype would still apply. */ +-#ifdef __cplusplus +-extern "C" +-#endif +-char IOMasterPort (); +-int +-main () +-{ +-return IOMasterPort (); +- ; +- return 0; +-} +-_ACEOF +-if ac_fn_c_try_link "$LINENO"; then : +- ac_cv_lib_IOKit_IOMasterPort=yes +-else +- ac_cv_lib_IOKit_IOMasterPort=no +-fi +-rm -f core conftest.err conftest.$ac_objext \ +- conftest$ac_exeext conftest.$ac_ext +-LIBS=$ac_check_lib_save_LIBS +-fi +-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_IOKit_IOMasterPort" >&5 +-$as_echo "$ac_cv_lib_IOKit_IOMasterPort" >&6; } +-if test "x$ac_cv_lib_IOKit_IOMasterPort" = x""yes; then : +- +-$as_echo "#define HAVE_MACOSX /**/" >>confdefs.h +- have_macosx=true +-else +- as_fn_error "IOKitLib not found." "$LINENO" 5 +-fi + +- platform_LDFLAGS="-framework CoreServices -framework CoreFoundation -framework Carbon" ++ platform_LDFLAGS="-framework CoreServices -framework CoreFoundation -framework Carbon -framework IOKit" + + ;; + *-*-cygwin* | *-*-mingw*) +--- libdc1394-2.2.1/dc1394/macosx/Makefile.in 2013-01-28 03:47:45.000000000 +0100 ++++ libdc1394-2.2.1-changed/dc1394/macosx/Makefile.in 2013-10-29 22:03:29.000000000 +0100 +@@ -264,7 +264,7 @@ + @HAVE_MACOSX_TRUE@ capture.h + + AM_CFLAGS = -I.. +-libdc1394_macosx_la_LDFLAGS = -framework CoreFoundation -framework Carbon ++libdc1394_macosx_la_LDFLAGS = -framework CoreFoundation -framework Carbon -framework IOKit + libdc1394_macosx_la_LIBADD = -lIOKit + libdc1394_macosx_la_SOURCES = \ + control.c \ +--- libdc1394-2.2.1/examples/Makefile.in 2013-01-28 03:47:45.000000000 +0100 ++++ libdc1394-2.2.1-changed/examples/Makefile.in 2013-10-29 22:03:59.000000000 +0100 +@@ -350,7 +350,7 @@ + B = dc1394_reset_bus $(am__append_2) + @HAVE_LINUX_TRUE@@HAVE_OPENGL_TRUE@GL_LIBS = -lGL + @HAVE_OPENGL_TRUE@@HAVE_WINDOWS_TRUE@GL_LIBS = -lopengl32 +-@HAVE_MACOSX_TRUE@AM_LDFLAGS = -framework CoreFoundation -framework Carbon ++@HAVE_MACOSX_TRUE@AM_LDFLAGS = -framework CoreFoundation -framework Carbon -framework IOKit + LDADD = ../dc1394/libdc1394.la + helloworld_SOURCES = helloworld.c + ladybug_SOURCES = ladybug.c diff --git a/mac/fontconfig-disablecache.patch b/mac/fontconfig-disablecache.patch new file mode 100644 index 0000000..a00d847 --- /dev/null +++ b/mac/fontconfig-disablecache.patch @@ -0,0 +1,12 @@ +57c57 +< #if CROSS_COMPILING +--- +> if CROSS_COMPILING +59,61c59,61 +< #else +< # RUN_FC_CACHE_TEST=test -z "$(DESTDIR)" +< #endif +--- +> else +> RUN_FC_CACHE_TEST=test -z "$(DESTDIR)" +> endif diff --git a/mac/fontconfig.pc.in.patch b/mac/fontconfig.pc.in.patch new file mode 100644 index 0000000..64d2a76 --- /dev/null +++ b/mac/fontconfig.pc.in.patch @@ -0,0 +1,4 @@ +9c9 +< Libs: -L${libdir} -lfontconfig +--- +> Libs: -L${libdir} -lfontconfig -lexpat diff --git a/mac/freetype_linespacing.patch b/mac/freetype_linespacing.patch new file mode 100644 index 0000000..426e18f --- /dev/null +++ b/mac/freetype_linespacing.patch @@ -0,0 +1,13 @@ +--- a/src/truetype/ttdriver.c ++++ b/src/truetype/ttdriver.c +@@ -246,7 +246,10 @@ + FT_Request_Metrics( size->face, req ); + + if ( FT_IS_SCALABLE( size->face ) ) ++ { + error = tt_size_reset( ttsize ); ++ ttsize->root.metrics = ttsize->metrics; ++ } + + return error; + } diff --git a/mac/gcc-fat.sh b/mac/gcc-fat.sh new file mode 100755 index 0000000..7d653eb --- /dev/null +++ b/mac/gcc-fat.sh @@ -0,0 +1,113 @@ +#!/bin/sh +# +# Build Universal binaries on Mac OS X, thanks Ryan! +# +# Usage: ./configure CC="sh gcc-fat.sh" && make && rm -rf ppc x86 + + +# PowerPC compiler flags (10.2 runtime compatibility) +PPC_SDK=MacOSX10.3.9.sdk + +GCC_COMPILE_PPC="gcc-3.3 -arch ppc \ +-DMAC_OS_X_VERSION_MIN_REQUIRED=1030 \ +-nostdinc \ +-F/Developer/SDKs/${PPC_SDK}/System/Library/Frameworks \ +-I/Developer/SDKs/${PPC_SDK}/usr/include/gcc/darwin/3.3 \ +-isystem /Developer/SDKs/${PPC_SDK}/usr/include" + +GCC_LINK_PPC="\ +-L/Developer/SDKs/${PPC_SDK}/usr/lib/gcc/darwin/3.3 \ +-F/Developer/SDKs/${PPC_SDK}/System/Library/Frameworks \ +-Wl,-syslibroot,/Developer/SDKs/${PPC_SDK}" + +# Intel compiler flags (10.4 runtime compatibility) +GCC_COMPILE_X86="gcc-4.0 -arch i386 -mmacosx-version-min=10.4 \ +-DMAC_OS_X_VERSION_MIN_REQUIRED=1040 \ +-nostdinc \ +-F/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks \ +-I/Developer/SDKs/MacOSX10.4u.sdk/usr/lib/gcc/i686-apple-darwin8/4.0.1/include \ +-isystem /Developer/SDKs/MacOSX10.4u.sdk/usr/include" + +GCC_LINK_X86="\ +-L/Developer/SDKs/MacOSX10.4u.sdk/usr/lib/gcc/i686-apple-darwin8/4.0.0 \ +-Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk" + +# Output both PowerPC and Intel object files +args="$*" +compile=yes +link=yes +while test x$1 != x; do + case $1 in + --version) exec gcc $1;; + -v) exec gcc $1;; + -V) exec gcc $1;; + -print-prog-name=*) exec gcc $1;; + -print-search-dirs) exec gcc $1;; + -E) GCC_COMPILE_PPC="$GCC_COMPILE_PPC -E" + GCC_COMPILE_X86="$GCC_COMPILE_X86 -E" + compile=no; link=no;; + -c) link=no;; + -o) output=$2;; + *.c|*.cc|*.cpp|*.S) source=$1;; + esac + shift +done +if test x$link = xyes; then + GCC_COMPILE_PPC="$GCC_COMPILE_PPC $GCC_LINK_PPC" + GCC_COMPILE_X86="$GCC_COMPILE_X86 $GCC_LINK_X86" +fi +if test x"$output" = x; then + if test x$link = xyes; then + output=a.out + elif test x$compile = xyes; then + output=`echo $source | sed -e 's|.*/||' -e 's|\(.*\)\.[^\.]*|\1|'`.o + fi +fi + +if test x"$output" != x; then + dir=ppc/`dirname $output` + if test -d $dir; then + : + else + mkdir -p $dir + fi +fi +set -- $args +while test x$1 != x; do + if test -f "ppc/$1" && test "$1" != "$output"; then + ppc_args="$ppc_args ppc/$1" + else + ppc_args="$ppc_args $1" + fi + shift +done +$GCC_COMPILE_PPC $ppc_args || exit $? +if test x"$output" != x; then + cp $output ppc/$output +fi + +if test x"$output" != x; then + dir=x86/`dirname $output` + if test -d $dir; then + : + else + mkdir -p $dir + fi +fi +set -- $args +while test x$1 != x; do + if test -f "x86/$1" && test "$1" != "$output"; then + x86_args="$x86_args x86/$1" + else + x86_args="$x86_args $1" + fi + shift +done +$GCC_COMPILE_X86 $x86_args || exit $? +if test x"$output" != x; then + cp $output x86/$output +fi + +if test x"$output" != x; then + lipo -create -o $output ppc/$output x86/$output +fi diff --git a/mac/glib.patch b/mac/glib.patch new file mode 100644 index 0000000..fbd20e3 --- /dev/null +++ b/mac/glib.patch @@ -0,0 +1,4 @@ +54c54 +< #if !(defined(__APPLE__) && defined(__LP64__)) && !defined(USE_LIBICONV_GNU) && defined (_LIBICONV_H) +--- +> #if !defined(USE_LIBICONV_GNU) && defined (_LIBICONV_H) diff --git a/mac/installscripts/background.tif b/mac/installscripts/background.tif new file mode 100644 index 0000000..0f81147 Binary files /dev/null and b/mac/installscripts/background.tif differ diff --git a/mac/installscripts/postflight b/mac/installscripts/postflight new file mode 100644 index 0000000..bb19ffe --- /dev/null +++ b/mac/installscripts/postflight @@ -0,0 +1,17 @@ +#!/usr/bin/env python2.7 + +import sys +#sys.stdout = open("/Users/uzadow/Desktop/postflight.log", "w") +print "Starting postinstall..." +from libavg import avg + +print "Building font cache. This can take a while." +Player=avg.Player.get() +Player.loadString(""" + + + +""") +print "Done." +sys.exit(0) diff --git a/mac/libavg.10.6.pmdoc/01dist-contents.xml b/mac/libavg.10.6.pmdoc/01dist-contents.xml new file mode 100644 index 0000000..36c6b84 --- /dev/null +++ b/mac/libavg.10.6.pmdoc/01dist-contents.xml @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/mac/libavg.10.6.pmdoc/01dist.xml b/mac/libavg.10.6.pmdoc/01dist.xml new file mode 100644 index 0000000..855a500 --- /dev/null +++ b/mac/libavg.10.6.pmdoc/01dist.xml @@ -0,0 +1 @@ +org.c-base.libavg.dist.pkg1.8.1/Users/uzadow/devel/libavg/dist/Library/Python/2.7/site-packages/scripts.scriptsDirectoryPath.isAbsoluteTypescripts.scriptsDirectoryPath.isRelativeTypescripts.postflight.pathinstallToscripts.postinstall.pathscripts.postinstall.isRelativeTypeversionparentscripts.scriptsDirectoryPath.pathidentifierinstallFrom.pathinstallTo.path/Users/uzadow/libavg/libavg/mac/installscripts/postflight/Users/uzadow/devel/libavg/libavg/mac/installscripts01dist-contents.xml/CVS$/\.svn$/\.cvsignore$/\.cvspass$/\.DS_Store$ \ No newline at end of file diff --git a/mac/libavg.10.6.pmdoc/02bindist-contents.xml b/mac/libavg.10.6.pmdoc/02bindist-contents.xml new file mode 100644 index 0000000..5373587 --- /dev/null +++ b/mac/libavg.10.6.pmdoc/02bindist-contents.xml @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/mac/libavg.10.6.pmdoc/02bindist.xml b/mac/libavg.10.6.pmdoc/02bindist.xml new file mode 100644 index 0000000..a88ca8a --- /dev/null +++ b/mac/libavg.10.6.pmdoc/02bindist.xml @@ -0,0 +1 @@ +org.c-base.libavg.bindist.pkg1.8.1/Users/uzadow/devel/libavg/bindist/usr/bininstallTo.pathinstallFrom.pathparentinstallToversion02bindist-contents.xml/CVS$/\.svn$/\.cvsignore$/\.cvspass$/\.DS_Store$ \ No newline at end of file diff --git a/mac/libavg.10.6.pmdoc/index.xml b/mac/libavg.10.6.pmdoc/index.xml new file mode 100644 index 0000000..562535b --- /dev/null +++ b/mac/libavg.10.6.pmdoc/index.xml @@ -0,0 +1 @@ +libavg/Users/coder/Desktop/libavg.pkgorg.c-baseinstallscripts/background.tifwelcome.txtreadme.txt01dist.xml02bindist.xmlproperties.customizeOptiondescription \ No newline at end of file diff --git a/mac/librsvg_configure.patch b/mac/librsvg_configure.patch new file mode 100644 index 0000000..fcb81d6 --- /dev/null +++ b/mac/librsvg_configure.patch @@ -0,0 +1,17 @@ +101d100 +< libxml-2.0 >= $LIBXML_REQUIRED \ +305,315d303 +< ################################################## +< # Checks for gtk-doc and docbook-tools +< ################################################## +< +< GTK_DOC_CHECK([1.13],[--flavour no-tmpl]) +< +< AC_SUBST([GLIB_PREFIX],[$($PKG_CONFIG --variable=prefix glib-2.0)]) +< AC_SUBST([GDK_PIXBUF_PREFIX],[$($PKG_CONFIG --variable=prefix gdk-pixbuf-2.0)]) +< AC_SUBST([GTK_PREFIX],[$($PKG_CONFIG --variable=prefix gdk-pixbuf-2.0)]) +< AC_SUBST([CAIRO_PREFIX],[$($PKG_CONFIG --variable=prefix cairo)]) +< +365,366d352 +< doc/Makefile +< doc/version.xml diff --git a/mac/librsvg_makefile.patch b/mac/librsvg_makefile.patch new file mode 100644 index 0000000..c5c5e33 --- /dev/null +++ b/mac/librsvg_makefile.patch @@ -0,0 +1,11 @@ +1c1 +< SUBDIRS = . gdk-pixbuf-loader data tests tools doc +--- +> SUBDIRS = . gdk-pixbuf-loader data tests tools +200,201c200 +< librsvg.def \ +< gtk-doc.make +--- +> librsvg.def +245d243 +< DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc diff --git a/mac/libsdl_mavericks.patch b/mac/libsdl_mavericks.patch new file mode 100644 index 0000000..bf07703 --- /dev/null +++ b/mac/libsdl_mavericks.patch @@ -0,0 +1,11 @@ +--- a/src/video/quartz/SDL_QuartzVideo.h Sat Aug 10 10:54:03 2013 -0700 ++++ b/src/video/quartz/SDL_QuartzVideo.h Thu Sep 05 06:38:57 2013 -0700 +@@ -91,7 +91,6 @@ + CGDirectDisplayID display; /* 0 == main display (only support single display) */ + const void *mode; /* current mode of the display */ + const void *save_mode; /* original mode of the display */ +- CGDirectPaletteRef palette; /* palette of an 8-bit display */ + NSOpenGLContext *gl_context; /* OpenGL rendering context */ + NSGraphicsContext *nsgfx_context; /* Cocoa graphics context */ + Uint32 width, height, bpp; /* frequently used data about the display */ + diff --git a/mac/libtool.m4.patch b/mac/libtool.m4.patch new file mode 100644 index 0000000..d3215b0 --- /dev/null +++ b/mac/libtool.m4.patch @@ -0,0 +1,20 @@ +945c945 +< _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; +--- +> _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress ${wl}-read_only_relocs ${wl}suppress' ;; +947c947 +< _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; +--- +> _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress ${wl}-read_only_relocs ${wl}suppress' ;; +954c954 +< _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; +--- +> _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup ${wl}-read_only_relocs ${wl}suppress' ;; +956c956 +< _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; +--- +> _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress ${wl}-read_only_relocs ${wl}suppress' ;; +958c958 +< _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; +--- +> _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup ${wl}-read_only_relocs ${wl}suppress' ;; diff --git a/mac/pkg-config-mavericks.patch b/mac/pkg-config-mavericks.patch new file mode 100644 index 0000000..a19f1be --- /dev/null +++ b/mac/pkg-config-mavericks.patch @@ -0,0 +1,6 @@ +205,207d204 +< #if defined (__clang__) +< # define G_INLINE_FUNC inline +< #else +222d218 +< #endif diff --git a/mac/readme.txt b/mac/readme.txt new file mode 100644 index 0000000..e58f8f4 --- /dev/null +++ b/mac/readme.txt @@ -0,0 +1,3 @@ + +This will install the libavg library on your computer. Installation can take a while - be patient. + diff --git a/mac/stpncpy.patch b/mac/stpncpy.patch new file mode 100644 index 0000000..e18af95 --- /dev/null +++ b/mac/stpncpy.patch @@ -0,0 +1,13 @@ +diff -Naurp gettext-0.18.1.1.orig/gettext-tools/configure gettext-0.18.1.1/gettext-tools/configure +--- gettext-tools/configure 2010-06-06 13:12:20.000000000 -0700 ++++ gettext-tools/configure 2010-08-13 23:24:09.000000000 -0700 +@@ -40606,7 +40606,9 @@ else + #include + #include /* for strcpy */ + /* The stpncpy prototype is missing in on AIX 4. */ ++#ifndef stpncpy + extern char *stpncpy (char *dest, const char *src, size_t n); ++#endif + int main () { + const char *src = "Hello"; + char dest[10]; diff --git a/mac/welcome.txt b/mac/welcome.txt new file mode 100644 index 0000000..6e5198b --- /dev/null +++ b/mac/welcome.txt @@ -0,0 +1,3 @@ +After the installer runs, please make sure that everything works by running the tests. To do this, open a terminal, cd to /Library/Python/2.7/site-packages/libavg/avg/test and call ./Test.py. You should see some test graphics flicker on the screen. The last message in the terminal should read 'OK'. + +We welcome your feedback. See http://www.libavg.de/ for details. diff --git a/makedocs.sh b/makedocs.sh new file mode 100755 index 0000000..11ad531 --- /dev/null +++ b/makedocs.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +cd sphinxdoc +#sphinx-build -b linkcheck . _build/ +sphinx-build -b coverage . _build/ +sphinx-build -b html . _build/reference diff --git a/man/Makefile.am b/man/Makefile.am new file mode 100644 index 0000000..e8e2106 --- /dev/null +++ b/man/Makefile.am @@ -0,0 +1,3 @@ +man_MANS = avgrc.5 avg_audioplayer.1 avg_showcamera.1 avg_showfont.1 avg_videoplayer.1 \ + avg_chromakey.1 avg_showfile.1 avg_videoinfo.1 +EXTRA_DIST = $(man_MANS) diff --git a/man/avg_audioplayer.1 b/man/avg_audioplayer.1 new file mode 100644 index 0000000..04b5d7b --- /dev/null +++ b/man/avg_audioplayer.1 @@ -0,0 +1,11 @@ +.TH AVG_AUDIPLAYER "1" "March 2011" "libavg 1.5.4" "User Commands" +.SH NAME +avg_audioplayer \- audio player +.SH SYNOPSIS +.B avg_audioplayer +\fIfile\fR +.SH DESCRIPTION +Play an audio file. +.PP +.SH AUTHOR +Ulrich von Zadow diff --git a/man/avg_chromakey.1 b/man/avg_chromakey.1 new file mode 100644 index 0000000..12774b1 --- /dev/null +++ b/man/avg_chromakey.1 @@ -0,0 +1,39 @@ +.TH AVG_CHROMAKEY "1" "March 2011" "libavg 1.5.4" "User Commands" +.SH NAME +avg_chromakey \- test application for libavg chromakey filter +.SH SYNOPSIS +.B avg_chromakey +\fI\-t DRIVER [OPTION]...\fR +.SH DESCRIPTION +Stream a live image from a camera and apply a chromakey filter. +.PP +.SH OPTIONS +.TP +\fB\-h\fR, \fB\-\-help\fR +Show a brief description of the options. +.TP +\fB\-t\fR, \fB\-\-driver\fR DRIVER +One of the camera subsystems supported by libavg (supported: firewire, video4linux, directshow). +.TP +\fB\-d\fR, \fB\-\-device\fR DEVICE +Camera device identifier (depending on the driver, a GUID or device path is expected). +.TP +\fB\-u\fR, \fB\-\-unit\fR UNIT +Unit number. Used for cameras or other capture devices which deliver several images (e.g. stereo cameras or TV capture cards). +.TP +\fB\-w\fR, \fB\-\-width\fR WIDTH +Camera image width. +.TP +\fB\-e\fR, \fB\-\-height\fR HEIGHT +Camera image height. +.TP +\fB\-p\fR, \fB\-\-pixelformat\fR PIXELFORMAT +Camera pixel format (one of: I8, I16, YUV411, YUV422, YUYV422, RGB, BGR, BAYER8). +.TP +\fB\-f\fR, \fB\-\-framerate\fR FRAMERATE +Frames per second. +.TP +\fB\-8\fR, \fB\-\-fw800\fR +Set firewire bus speed to s800 (if supported). +.SH AUTHOR +Ulrich von Zadow diff --git a/man/avg_showcamera.1 b/man/avg_showcamera.1 new file mode 100644 index 0000000..88de2d4 --- /dev/null +++ b/man/avg_showcamera.1 @@ -0,0 +1,54 @@ +.TH AVG_SHOWCAMERA "1" "March 2011" "libavg 1.5.4" "User Commands" +.SH NAME +avg_showcamera \- camera discovery and display tool +.SH SYNOPSIS +.B avg_showcamera +\fI\-l\fR +.HP +.B avg_showcamera +\fI\-r\fR +.HP +.B avg_showcamera +\fI\-t DRIVER [OPTION]...\fR +.SH DESCRIPTION +Query and list attached cameras, reset firewire bus, show video stream. +.PP +.SH OPTIONS +.TP +\fB\-h\fR, \fB\-\-help\fR +Show a brief description of the options. +.TP +\fB\-l\fR, \fB\-\-dump\fR +Dump a list of available cameras to the console. +.TP +\fB\-r\fR, \fB\-\-resetbus\fR +Reset the firewire bus and free allocated bandwidth. +.TP +\fB\-t\fR, \fB\-\-driver\fR DRIVER +One of the camera subsystems supported by libavg (supported: firewire, video4linux, directshow). +.TP +\fB\-d\fR, \fB\-\-device\fR DEVICE +Camera device identifier (depending on the driver, a GUID or device path is expected). +.TP +\fB\-u\fR, \fB\-\-unit\fR UNIT +Unit number. Used for cameras or other capture devices which deliver several images (e.g. stereo cameras or TV capture cards). +.TP +\fB\-w\fR, \fB\-\-width\fR WIDTH +Camera image width. +.TP +\fB\-e\fR, \fB\-\-height\fR HEIGHT +Camera image height. +.TP +\fB\-p\fR, \fB\-\-pixelformat\fR PIXELFORMAT +Camera pixel format (one of: I8, I16, YUV411, YUV422, YUYV422, RGB, BGR, BAYER8). +.TP +\fB\-f\fR, \fB\-\-framerate\fR FRAMERATE +Frames per second. +.TP +\fB\-8\fR, \fB\-\-fw800\fR +Set firewire bus speed to s800 (if supported). +.TP +\fB\-s\fR, \fB\-\-noinfo\fR +Don't show any info overlayed on the screen. +.SH AUTHOR +Ulrich von Zadow diff --git a/man/avg_showfile.1 b/man/avg_showfile.1 new file mode 100644 index 0000000..1f5329b --- /dev/null +++ b/man/avg_showfile.1 @@ -0,0 +1,11 @@ +.TH AVG_SHOWFILE "1" "March 2011" "libavg 1.5.4" "User Commands" +.SH NAME +avg_showfile \- display an avg file +.SH SYNOPSIS +.B avg_showfile +\fIfile\fR +.SH DESCRIPTION +Open and render an avg file. +.PP +.SH AUTHOR +Ulrich von Zadow diff --git a/man/avg_showfont.1 b/man/avg_showfont.1 new file mode 100644 index 0000000..f9b26d8 --- /dev/null +++ b/man/avg_showfont.1 @@ -0,0 +1,19 @@ +.TH AVG_SHOWFONT "1" "March 2011" "libavg 1.5.4" "User Commands" +.SH NAME +avg_showfont \- font enumeration and preview tool +.SH SYNOPSIS +.B avg_showfont +[\fIfontname\fR] [\fItext\fR] +.SH DESCRIPTION +List available font faces and generate preview of their variants. +.PP +If invoked without arguments, avg_showfont generates a list of font family names and prints them on the console. +Fontconfig is used for font discovery. Fonts are searched for in the system font path and in $PWD/fonts. +.PP +If \fBfontname\fR is specified, the chosen font is displayed in a window, with one line for +each available variant. +.PP +If supplied, the optional \fBtext\fR argument is used instead of the variant name in the +sample text. +.SH AUTHOR +Ulrich von Zadow diff --git a/man/avg_videoinfo.1 b/man/avg_videoinfo.1 new file mode 100644 index 0000000..80c2e40 --- /dev/null +++ b/man/avg_videoinfo.1 @@ -0,0 +1,29 @@ +.TH AVG_VIDEOINFO "1" "March 2011" "libavg 1.5.4" "User Commands" +.SH NAME +avg_videoinfo \- video inspection tool +.SH SYNOPSIS +.B avg_videoinfo +\fIfile(s)\fR \fI[OPTION]\fR +.SH DESCRIPTION +Dump video file format information to the console +.PP +Inspects the given file(s) and dumps information about duration, bitrate, video/audio codec, +video frame size and pixel format, video fps, audio sample rate and number of channels for +each file given. +.PP +The default output format is text. +.PP +XML and CSV formats can be chosen with the appropriate options. +.PP +.SH OPTIONS +.TP +\fB\-h\fR, \fB\-\-help\fR +Show a brief description of the options. +.TP +\fB\-x\fR, \fB\-\-xml\fR +XML output format. +.TP +\fB\-c\fR, \fB\-\-csv\fR +CSV output format. +.SH AUTHOR +Ulrich von Zadow diff --git a/man/avg_videoplayer.1 b/man/avg_videoplayer.1 new file mode 100644 index 0000000..42b1129 --- /dev/null +++ b/man/avg_videoplayer.1 @@ -0,0 +1,11 @@ +.TH AVG_VIDEOPLAYER "1" "March 2011" "libavg 1.5.4" "User Commands" +.SH NAME +avg_videoplayer \- video player +.SH SYNOPSIS +.B avg_videoplayer +\fIfile\fR +.SH DESCRIPTION +Play a video file using libavg. +.PP +.SH AUTHOR +Ulrich von Zadow diff --git a/man/avgrc.5 b/man/avgrc.5 new file mode 100755 index 0000000..6582b7d --- /dev/null +++ b/man/avgrc.5 @@ -0,0 +1,33 @@ +.ad 1 +.nh +.hlm 0 +.TH avgrc 5 "13 January 2005" "avg" +.SH NAME +avgrc \- avg configuration file +.SH DESCRIPTION +.I avgrc +contains configuration information for the +.B avg +player, including display data and font directory information. +.B avg +looks +for a system-wide file in +.I /etc/ +and a user-specific file in +.I $HOME. +The file is xml-based. There is an example avgrc.default in the +avg source directory. The available options are described in the +.B avg +(1) man page. + +.SH FILES +.PD 0 +/etc/avgrc - System-wide configuration file. +.P +$HOME/avgrc - User-specific configuration file. +.PD +.SH SEE ALSO +.B avg +(1) +.SH AUTHORS +Ulrich von Zadow (coder@c-base.org) diff --git a/missing b/missing new file mode 100755 index 0000000..6a37006 --- /dev/null +++ b/missing @@ -0,0 +1,336 @@ +#! /bin/sh +# Common stub for a few missing GNU programs while installing. +# Copyright (C) 1996, 1997, 1999, 2000, 2002 Free Software Foundation, Inc. +# Originally by Fran,cois Pinard , 1996. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +if test $# -eq 0; then + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 +fi + +run=: + +# In the cases where this matters, `missing' is being run in the +# srcdir already. +if test -f configure.ac; then + configure_ac=configure.ac +else + configure_ac=configure.in +fi + +case "$1" in +--run) + # Try to run requested program, and just exit if it succeeds. + run= + shift + "$@" && exit 0 + ;; +esac + +# If it does not exist, or fails to run (possibly an outdated version), +# try to emulate it. +case "$1" in + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an +error status if there is no known handling for PROGRAM. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + --run try to run the given command, and emulate it if it fails + +Supported PROGRAM values: + aclocal touch file \`aclocal.m4' + autoconf touch file \`configure' + autoheader touch file \`config.h.in' + automake touch all \`Makefile.in' files + bison create \`y.tab.[ch]', if possible, from existing .[ch] + flex create \`lex.yy.c', if possible, from existing .c + help2man touch the output file + lex create \`lex.yy.c', if possible, from existing .c + makeinfo touch the output file + tar try tar, gnutar, gtar, then tar without non-portable flags + yacc create \`y.tab.[ch]', if possible, from existing .[ch]" + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing 0.4 - GNU automake" + ;; + + -*) + echo 1>&2 "$0: Unknown \`$1' option" + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 + ;; + + aclocal*) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acinclude.m4' or \`${configure_ac}'. You might want + to install the \`Automake' and \`Perl' packages. Grab them from + any GNU archive site." + touch aclocal.m4 + ;; + + autoconf) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`${configure_ac}'. You might want to install the + \`Autoconf' and \`GNU m4' packages. Grab them from any GNU + archive site." + touch configure + ;; + + autoheader) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acconfig.h' or \`${configure_ac}'. You might want + to install the \`Autoconf' and \`GNU m4' packages. Grab them + from any GNU archive site." + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` + test -z "$files" && files="config.h" + touch_files= + for f in $files; do + case "$f" in + *:*) touch_files="$touch_files "`echo "$f" | + sed -e 's/^[^:]*://' -e 's/:.*//'`;; + *) touch_files="$touch_files $f.in";; + esac + done + touch $touch_files + ;; + + automake*) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. + You might want to install the \`Automake' and \`Perl' packages. + Grab them from any GNU archive site." + find . -type f -name Makefile.am -print | + sed 's/\.am$/.in/' | + while read f; do touch "$f"; done + ;; + + autom4te) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is needed, and you do not seem to have it handy on your + system. You might have modified some files without having the + proper tools for further handling them. + You can get \`$1Help2man' as part of \`Autoconf' from any GNU + archive site." + + file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` + test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` + if test -f "$file"; then + touch $file + else + test -z "$file" || exec >$file + echo "#! /bin/sh" + echo "# Created by GNU Automake missing as a replacement of" + echo "# $ $@" + echo "exit 0" + chmod +x $file + exit 1 + fi + ;; + + bison|yacc) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.y' file. You may need the \`Bison' package + in order for those modifications to take effect. You can get + \`Bison' from any GNU archive site." + rm -f y.tab.c y.tab.h + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.y) + SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.c + fi + SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.h + fi + ;; + esac + fi + if [ ! -f y.tab.h ]; then + echo >y.tab.h + fi + if [ ! -f y.tab.c ]; then + echo 'main() { return 0; }' >y.tab.c + fi + ;; + + lex|flex) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.l' file. You may need the \`Flex' package + in order for those modifications to take effect. You can get + \`Flex' from any GNU archive site." + rm -f lex.yy.c + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.l) + SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" lex.yy.c + fi + ;; + esac + fi + if [ ! -f lex.yy.c ]; then + echo 'main() { return 0; }' >lex.yy.c + fi + ;; + + help2man) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a dependency of a manual page. You may need the + \`Help2man' package in order for those modifications to take + effect. You can get \`Help2man' from any GNU archive site." + + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` + fi + if [ -f "$file" ]; then + touch $file + else + test -z "$file" || exec >$file + echo ".ab help2man is required to generate this page" + exit 1 + fi + ;; + + makeinfo) + if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then + # We have makeinfo, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.texi' or \`.texinfo' file, or any other file + indirectly affecting the aspect of the manual. The spurious + call might also be the consequence of using a buggy \`make' (AIX, + DU, IRIX). You might want to install the \`Texinfo' package or + the \`GNU make' package. Grab either from any GNU archive site." + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` + fi + touch $file + ;; + + tar) + shift + if test -n "$run"; then + echo 1>&2 "ERROR: \`tar' requires --run" + exit 1 + fi + + # We have already tried tar in the generic part. + # Look for gnutar/gtar before invocation to avoid ugly error + # messages. + if (gnutar --version > /dev/null 2>&1); then + gnutar "$@" && exit 0 + fi + if (gtar --version > /dev/null 2>&1); then + gtar "$@" && exit 0 + fi + firstarg="$1" + if shift; then + case "$firstarg" in + *o*) + firstarg=`echo "$firstarg" | sed s/o//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + case "$firstarg" in + *h*) + firstarg=`echo "$firstarg" | sed s/h//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + fi + + echo 1>&2 "\ +WARNING: I can't seem to be able to run \`tar' with the given arguments. + You may want to install GNU tar or Free paxutils, or check the + command line arguments." + exit 1 + ;; + + *) + echo 1>&2 "\ +WARNING: \`$1' is needed, and you do not seem to have it handy on your + system. You might have modified some files without having the + proper tools for further handling them. Check the \`README' file, + it often tells you about the needed prerequirements for installing + this package. You may also peek at any GNU archive site, in case + some other package would contain this missing \`$1' program." + exit 1 + ;; +esac + +exit 0 diff --git a/mkinstalldirs b/mkinstalldirs new file mode 100755 index 0000000..d2d5f21 --- /dev/null +++ b/mkinstalldirs @@ -0,0 +1,111 @@ +#! /bin/sh +# mkinstalldirs --- make directory hierarchy +# Author: Noah Friedman +# Created: 1993-05-16 +# Public domain + +errstatus=0 +dirmode="" + +usage="\ +Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..." + +# process command line arguments +while test $# -gt 0 ; do + case $1 in + -h | --help | --h*) # -h for help + echo "$usage" 1>&2 + exit 0 + ;; + -m) # -m PERM arg + shift + test $# -eq 0 && { echo "$usage" 1>&2; exit 1; } + dirmode=$1 + shift + ;; + --) # stop option processing + shift + break + ;; + -*) # unknown option + echo "$usage" 1>&2 + exit 1 + ;; + *) # first non-opt arg + break + ;; + esac +done + +for file +do + if test -d "$file"; then + shift + else + break + fi +done + +case $# in + 0) exit 0 ;; +esac + +case $dirmode in + '') + if mkdir -p -- . 2>/dev/null; then + echo "mkdir -p -- $*" + exec mkdir -p -- "$@" + fi + ;; + *) + if mkdir -m "$dirmode" -p -- . 2>/dev/null; then + echo "mkdir -m $dirmode -p -- $*" + exec mkdir -m "$dirmode" -p -- "$@" + fi + ;; +esac + +for file +do + set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` + shift + + pathcomp= + for d + do + pathcomp="$pathcomp$d" + case $pathcomp in + -*) pathcomp=./$pathcomp ;; + esac + + if test ! -d "$pathcomp"; then + echo "mkdir $pathcomp" + + mkdir "$pathcomp" || lasterr=$? + + if test ! -d "$pathcomp"; then + errstatus=$lasterr + else + if test ! -z "$dirmode"; then + echo "chmod $dirmode $pathcomp" + lasterr="" + chmod "$dirmode" "$pathcomp" || lasterr=$? + + if test ! -z "$lasterr"; then + errstatus=$lasterr + fi + fi + fi + fi + + pathcomp="$pathcomp/" + done +done + +exit $errstatus + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# End: +# mkinstalldirs ends here diff --git a/sphinxdoc/ButtonStates.png b/sphinxdoc/ButtonStates.png new file mode 100644 index 0000000..38d7764 Binary files /dev/null and b/sphinxdoc/ButtonStates.png differ diff --git a/sphinxdoc/Recognizer.graffle b/sphinxdoc/Recognizer.graffle new file mode 100644 index 0000000..cb2fe97 --- /dev/null +++ b/sphinxdoc/Recognizer.graffle @@ -0,0 +1,1780 @@ + + + + + ActiveLayerIndex + 0 + ApplicationVersion + + com.omnigroup.OmniGraffle + 138.28.0.154505 + + AutoAdjust + + BackgroundGraphic + + Bounds + {{0, 0}, {559, 783}} + Class + SolidGraphic + ID + 2 + Style + + shadow + + Draws + NO + + stroke + + Draws + NO + + + + CanvasOrigin + {0, 0} + ColumnAlign + 1 + ColumnSpacing + 36 + CreationDate + 2011-09-09 17:11:41 +0200 + Creator + Ulrich von Zadow + DisplayScale + 1.000 cm = 1.000 cm + GraphDocumentVersion + 6 + GraphicsList + + + Bounds + {{256, 142.5}, {57, 21}} + Class + ShapedGraphic + FitText + YES + Flow + Resize + FontInfo + + Font + HelveticaNeue + Size + 9 + + ID + 28 + Shape + Rectangle + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + stroke + + CornerRadius + 7 + Draws + NO + + + Text + + Align + 0 + Text + {\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf360 +{\fonttbl\f0\fnil\fcharset0 HelveticaNeue;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural + +\f0\fs18 \cf0 onDetected} + + Wrap + NO + + + Class + LineGraphic + FontInfo + + Font + HelveticaNeue + Size + 8 + + Head + + ID + 13 + + ID + 27 + Points + + {369.222, 223.693} + {317, 183} + {318, 122.5} + {369.337, 82.3082} + + Style + + stroke + + CornerRadius + 5 + HeadArrow + 0 + HeadScale + 3 + HopLines + + HopType + 1 + LineType + 1 + TailArrow + FilledArrow + TailScale + 3 + Width + 0.25 + + + Tail + + ID + 21 + + + + Bounds + {{480, 142.5}, {37, 21}} + Class + ShapedGraphic + FitText + YES + Flow + Resize + FontInfo + + Font + HelveticaNeue + Size + 9 + + ID + 25 + Shape + Rectangle + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + stroke + + CornerRadius + 7 + Draws + NO + + + Text + + Align + 0 + Text + {\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf360 +{\fonttbl\f0\fnil\fcharset0 HelveticaNeue;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural + +\f0\fs18 \cf0 onEnd} + + Wrap + NO + + + Class + LineGraphic + FontInfo + + Font + HelveticaNeue + Size + 8 + + Head + + ID + 13 + + ID + 24 + Points + + {417.773, 223.685} + {474, 178} + {473, 125} + {418.603, 82.3087} + + Style + + stroke + + CornerRadius + 5 + HeadArrow + FilledArrow + HeadScale + 3 + HopLines + + HopType + 1 + LineType + 1 + TailArrow + 0 + Width + 0.25 + + + Tail + + ID + 21 + + + + Bounds + {{340, 183.5}, {57, 21}} + Class + ShapedGraphic + FitText + YES + Flow + Resize + FontInfo + + Font + HelveticaNeue + Size + 9 + + ID + 23 + Shape + Rectangle + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + stroke + + CornerRadius + 7 + Draws + NO + + + Text + + Align + 0 + Text + {\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf360 +{\fonttbl\f0\fnil\fcharset0 HelveticaNeue;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural + +\f0\fs18 \cf0 onDetected} + + Wrap + NO + + + Class + LineGraphic + FontInfo + + Font + HelveticaNeue + Size + 8 + + Head + + ID + 21 + + ID + 22 + Points + + {394, 172.5} + {394, 223.5} + + Style + + stroke + + CornerRadius + 5 + HeadArrow + FilledArrow + HeadScale + 3 + HopLines + + HopType + 1 + LineType + 1 + TailArrow + 0 + Width + 0.25 + + + Tail + + ID + 14 + + + + Bounds + {{351.5, 224}, {85, 38}} + Class + ShapedGraphic + ID + 21 + Shape + Rectangle + Style + + fill + + Draws + NO + + + Text + + Text + {\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf360 +{\fonttbl\f0\fnil\fcharset0 HelveticaNeue;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc\pardirnatural + +\f0\fs18 \cf0 RUNNING} + + + + Bounds + {{323, 277.914}, {142, 25}} + Class + ShapedGraphic + FitText + YES + Flow + Resize + FontInfo + + Font + HelveticaNeue + Size + 12 + + ID + 20 + Shape + Rectangle + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + stroke + + CornerRadius + 7 + Draws + NO + + + Text + + Text + {\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf360 +{\fonttbl\f0\fnil\fcharset0 HelveticaNeue;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc\pardirnatural + +\f0\fs24 \cf0 Continuous Recognizers} + + Wrap + NO + + + Bounds + {{409, 97.086}, {35, 21}} + Class + ShapedGraphic + FitText + YES + Flow + Resize + FontInfo + + Font + HelveticaNeue + Size + 9 + + ID + 19 + Shape + Rectangle + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + stroke + + CornerRadius + 7 + Draws + NO + + + Text + + Align + 0 + Text + {\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf360 +{\fonttbl\f0\fnil\fcharset0 HelveticaNeue;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural + +\f0\fs18 \cf0 onFail} + + Wrap + NO + + + Class + LineGraphic + FontInfo + + Font + HelveticaNeue + Size + 8 + + Head + + ID + 13 + + ID + 17 + Points + + {400.639, 133.527} + {409, 109} + {400.351, 82.4754} + + Style + + stroke + + CornerRadius + 5 + HeadArrow + FilledArrow + HeadScale + 3 + HopLines + + HopType + 1 + LineType + 1 + TailArrow + 0 + Width + 0.25 + + + Tail + + ID + 14 + + + + Bounds + {{342, 97.086}, {55, 21}} + Class + ShapedGraphic + FitText + YES + Flow + Resize + FontInfo + + Font + HelveticaNeue + Size + 9 + + ID + 16 + Shape + Rectangle + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + stroke + + CornerRadius + 7 + Draws + NO + + + Text + + Align + 0 + Text + {\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf360 +{\fonttbl\f0\fnil\fcharset0 HelveticaNeue;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural + +\f0\fs18 \cf0 onPossible} + + Wrap + NO + + + Class + LineGraphic + FontInfo + + Font + HelveticaNeue + Size + 8 + + Head + + ID + 14 + + ID + 15 + Points + + {394, 82.5} + {394, 133.5} + + Style + + stroke + + CornerRadius + 5 + HeadArrow + FilledArrow + HeadScale + 3 + HopLines + + HopType + 1 + LineType + 1 + TailArrow + 0 + Width + 0.25 + + + Tail + + ID + 13 + + + + Bounds + {{351.5, 134}, {85, 38}} + Class + ShapedGraphic + ID + 14 + Shape + Rectangle + Style + + fill + + Draws + NO + + + Text + + Text + {\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf360 +{\fonttbl\f0\fnil\fcharset0 HelveticaNeue;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc\pardirnatural + +\f0\fs18 \cf0 POSSIBLE} + + + + Bounds + {{351.5, 44}, {85, 38}} + Class + ShapedGraphic + ID + 13 + Shape + Rectangle + Style + + fill + + Draws + NO + + + Text + + Text + {\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf360 +{\fonttbl\f0\fnil\fcharset0 HelveticaNeue;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc\pardirnatural + +\f0\fs18 \cf0 IDLE} + + + + Bounds + {{61.5, 277.914}, {124, 25}} + Class + ShapedGraphic + FitText + YES + Flow + Resize + FontInfo + + Font + HelveticaNeue + Size + 12 + + ID + 12 + Shape + Rectangle + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + stroke + + CornerRadius + 7 + Draws + NO + + + Text + + Text + {\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf360 +{\fonttbl\f0\fnil\fcharset0 HelveticaNeue;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc\pardirnatural + +\f0\fs24 \cf0 Discrete Recognizers} + + Wrap + NO + + + Bounds + {{151.5, 149}, {35, 21}} + Class + ShapedGraphic + FitText + YES + Flow + Resize + FontInfo + + Font + HelveticaNeue + Size + 9 + + ID + 11 + Shape + Rectangle + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + stroke + + CornerRadius + 7 + Draws + NO + + + Text + + Align + 0 + Text + {\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf360 +{\fonttbl\f0\fnil\fcharset0 HelveticaNeue;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural + +\f0\fs18 \cf0 onFail} + + Wrap + NO + + + Bounds + {{151.5, 135}, {57, 21}} + Class + ShapedGraphic + FitText + YES + Flow + Resize + FontInfo + + Font + HelveticaNeue + Size + 9 + + ID + 10 + Shape + Rectangle + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + stroke + + CornerRadius + 7 + Draws + NO + + + Text + + Align + 0 + Text + {\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf360 +{\fonttbl\f0\fnil\fcharset0 HelveticaNeue;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural + +\f0\fs18 \cf0 onDetected} + + Wrap + NO + + + Class + LineGraphic + FontInfo + + Font + HelveticaNeue + Size + 8 + + Head + + ID + 4 + + ID + 8 + Points + + {136.972, 178.574} + {151.5, 155} + {135.958, 127.436} + + Style + + stroke + + CornerRadius + 5 + HeadArrow + FilledArrow + HeadScale + 3 + HopLines + + HopType + 1 + LineType + 1 + TailArrow + 0 + Width + 0.25 + + + Tail + + ID + 5 + + + + Bounds + {{38.5, 142.5}, {55, 21}} + Class + ShapedGraphic + FitText + YES + Flow + Resize + FontInfo + + Font + HelveticaNeue + Size + 9 + + ID + 7 + Shape + Rectangle + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + stroke + + CornerRadius + 7 + Draws + NO + + + Text + + Align + 0 + Text + {\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf360 +{\fonttbl\f0\fnil\fcharset0 HelveticaNeue;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural + +\f0\fs18 \cf0 onPossible} + + Wrap + NO + + + Class + LineGraphic + FontInfo + + Font + HelveticaNeue + Size + 8 + + Head + + ID + 5 + + ID + 6 + Points + + {111.842, 127.414} + {94.5, 153} + {111.842, 178.586} + + Style + + stroke + + CornerRadius + 5 + HeadArrow + FilledArrow + HeadScale + 3 + HopLines + + HopType + 1 + LineType + 1 + TailArrow + 0 + Width + 0.25 + + + Tail + + ID + 4 + + + + Bounds + {{82.5, 179}, {85, 38}} + Class + ShapedGraphic + ID + 5 + Shape + Rectangle + Style + + fill + + Draws + NO + + + Text + + Text + {\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf360 +{\fonttbl\f0\fnil\fcharset0 HelveticaNeue;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc\pardirnatural + +\f0\fs18 \cf0 POSSIBLE} + + + + Bounds + {{82.5, 89}, {85, 38}} + Class + ShapedGraphic + ID + 4 + Shape + Rectangle + Style + + fill + + Draws + NO + + + Text + + Text + {\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf360 +{\fonttbl\f0\fnil\fcharset0 HelveticaNeue;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc\pardirnatural + +\f0\fs18 \cf0 IDLE} + + + + GridInfo + + GuidesLocked + NO + GuidesVisible + YES + HPages + 1 + ImageCounter + 1 + KeepToScale + + Layers + + + Lock + NO + Name + Layer 1 + Print + YES + View + YES + + + LayoutInfo + + Animate + NO + circoMinDist + 18 + circoSeparation + 0.0 + layoutEngine + dot + neatoSeparation + 0.0 + twopiSeparation + 0.0 + + LinksVisible + NO + MagnetsVisible + NO + MasterSheets + + ModificationDate + 2011-09-09 17:25:00 +0200 + Modifier + Ulrich von Zadow + NotesVisible + NO + Orientation + 2 + OriginVisible + NO + PageBreaks + YES + PrintInfo + + NSBottomMargin + + float + 41 + + NSLeftMargin + + float + 18 + + NSPaperSize + + coded + BAtzdHJlYW10eXBlZIHoA4QBQISEhAdOU1ZhbHVlAISECE5TT2JqZWN0AIWEASqEhAx7X05TU2l6ZT1mZn2WgVMCgUoDhg== + + NSRightMargin + + float + 18 + + NSTopMargin + + float + 18 + + + PrintOnePage + + QuickLookPreview + + JVBERi0xLjMKJcTl8uXrp/Og0MTGCjUgMCBvYmoKPDwgL0xlbmd0aCA2IDAgUiAvRmls + dGVyIC9GbGF0ZURlY29kZSA+PgpzdHJlYW0KeAGtl8luG0cQhu/zFH1MDmp19d5XS3Yg + I3BsS0bODkPFNCQxFuUEyNPnq+ai4eokCASBnGFtXVX/X9VfzDvzxTj+Umqm1GAep+Zn + 82DOLxZiJgsj/W8xMWfOJqP/I8Fbc/52+jiZ/v709ePd8DjDlLjSzWVniiCdI2buzfnV + vZjLefe2K5LSWsSvRIaRSIjqNNd8wsxSJrW1zNrOOJqVjMvDMpyw9CXmNSf8bM7fT+8+ + Ps3+mF7M7+aPs/vp0+NsYjhST8TFdT+UM9cXesb+cKYfZEztVU+MtZmaTKiawmtOiqbX + FDpD+kZa4jlPSXqeFzemLY01c9ZsqrG1ZoJNww05eyXW4ezm1nx3dfnjy+/NzWfz8maZ + w60Q1FQPQcpODDtuU00a7pZbLzZrOHg1O17f/nR9ffVi7NlZgv9zfJpNDkTE1ijFiC82 + Smjmnvxn67K+C8m2KNW0iBuJ0cbi/eopBTNZf222hFRoALFFfDWSs4o2LaVNDe9SgvWu + qc4qy71RtYd7pjWOILGY7JJ11dVB42g2pFZN5kepIZg73iVbffPIVRta8Lz7ZPa0OcUt + hl/z/3kYpbOfWxO/0ZBSbBMMjvwJIKiSy9iflGizy3XY8jfSPtU8OZsc3F7veG3AA30z + f3g7Xyxmv9xNn7tn3fIHDxOybUUyWa42lRg0eVHPQD2lOIpCMZO2DO0uGZfeh/6GyiSa + un8PhCmxWh+K9GqTF4oKlHNALjRLx/FLCFYa1ThWSqKJCJicoq3JBU1tKBbUyZCxn2oT + TS0RpgzyMpE53zTdlPKA9qaUh1t4rUHnWYnYefaHOZqWRhr7kyCki7jG/oaR9qlSSnXU + kq7er6Zi8WA1L6dP08nT9Nfnao6qKLmZ7FV3F+NytD1efZzdHTbWDcWG5pJ7IQ3xHWRn + fJ6lbGs1cZeoLmeLyeN/Mujhvxj3LXJi8346mf/2MPtr+rh4ti0Q0aleDjRDMpjsrDys + WHmUr9CiKX4fTGMi3qXETsTDKSJeuqVbtqfBjt8NiIfnAfB/MbGeq4+De6NfxWebEy16 + kC5VIicHPdLsoWUl+ExxQ4KfQoOG18+9ybfEj6NJO7D7Dh7fkMjK8iaWleXN86eROIGc + wk3IFEgnaJ8y+/Ns1eu7lfs3VKhGo1O2oveVpZKHw/VdsNFDc8xwMuR50ayLjCkBx64U + faHTBkaLjJUG3THLiCiI8CZZWKuYxmdJBfjwU2no12prQegYE/ZgUmhDbjohXe7BEKBO + xNyCDd4r60UHUbZMSRm0zVdlx0+8RRJt3m60b4fVUNtjQq3dRqMybLElY39V6bsQ7LO/ + gQO4IkqOI3cj5VMFjTToiYKuyWu/oEfJS1tvRV2r/hhTVyb9pCjuGryYPzzNHr7Ovy4O + Es7wzwjH+9PIT9Ht96zWpx3cwd5/ePPm6s0Pz7R3YgXriCva/0v0efkW8lPeRn5i3Roj + f/ncq6rGN+LfRr5nJRkjfxPLCvmb5yXyl+LEfapRQmbkG4b+fgJXE3O3pPOH/Yl5bGZ0 + 0IPjUoASW43NlS0SLLAVJGE/9CA6JlCbI6ilgwSQxf6m8ACeQb32vAt5kMz0SRGKgIp9 + ABq6/jQsxsLCBGwRxlDO9IsIl5zG8h5113LMrAZ5IMz88tG6VvNQ2YWci6p3kMhZlKyv + cEkB7ey4PXSKAK2wCxNpacQOZKEu3LBA4QNKWu69h7RPF3mjwflYcb3u2XHtDzrwjqeR + P1NZ/TnSiiPW0a61t0sPOW1fmiLBwhEHVl85WvqXD31PGvqd6VjV+6Rij816K/BE1YEI + fiLYYXv13Dta5VYbKEQurg1CKJJiMEF3Ya7MExO0M3QB1esKe6fnDdWgI3TX9ZUNMXD5 + kb6mIw7hcf1hMiQWatZMRon1nqWZyVBcZP/WIRcCbUV+sM6OfaTsHRPsHAP3clqHEUTs + MJxz3EQSX4RbJWUgKBsygSRtTM8EUapea+utfq19ejJsNBQh3HZ0J9/488CHO6DaXvsb + PGsNVdcYRv5G2qcQT0Nvyj5sX1uPln0f8e/+BimPk/sKZW5kc3RyZWFtCmVuZG9iago2 + IDAgb2JqCjE1MzUKZW5kb2JqCjMgMCBvYmoKPDwgL1R5cGUgL1BhZ2UgL1BhcmVudCA0 + IDAgUiAvUmVzb3VyY2VzIDcgMCBSIC9Db250ZW50cyA1IDAgUiAvTWVkaWFCb3ggWzAg + MCA1NTkgNzgzXQo+PgplbmRvYmoKNyAwIG9iago8PCAvUHJvY1NldCBbIC9QREYgL1Rl + eHQgL0ltYWdlQiAvSW1hZ2VDIC9JbWFnZUkgXSAvQ29sb3JTcGFjZSA8PCAvQ3MxIDgg + MCBSCi9DczIgMTUgMCBSID4+IC9Gb250IDw8IC9GMS4wIDE2IDAgUiA+PiAvWE9iamVj + dCA8PCAvSW0zIDEzIDAgUiAvSW0xIDkgMCBSCi9JbTIgMTEgMCBSID4+ID4+CmVuZG9i + agoxMyAwIG9iago8PCAvTGVuZ3RoIDE0IDAgUiAvVHlwZSAvWE9iamVjdCAvU3VidHlw + ZSAvSW1hZ2UgL1dpZHRoIDIxNCAvSGVpZ2h0IDEyMCAvSW50ZXJwb2xhdGUKdHJ1ZSAv + Q29sb3JTcGFjZSAxNyAwIFIgL0ludGVudCAvUGVyY2VwdHVhbCAvU01hc2sgMTggMCBS + IC9CaXRzUGVyQ29tcG9uZW50CjggL0ZpbHRlciAvRmxhdGVEZWNvZGUgPj4Kc3RyZWFt + CngB7dAxAQAAAMKg9U9tDQ+IQGHAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAED + BgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDA + gAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwY + MGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAED + BgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDA + gAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwY + MGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDgd2As + /wABCmVuZHN0cmVhbQplbmRvYmoKMTQgMCBvYmoKMzU5CmVuZG9iago5IDAgb2JqCjw8 + IC9MZW5ndGggMTAgMCBSIC9UeXBlIC9YT2JqZWN0IC9TdWJ0eXBlIC9JbWFnZSAvV2lk + dGggMjE0IC9IZWlnaHQgMTIwIC9JbnRlcnBvbGF0ZQp0cnVlIC9Db2xvclNwYWNlIDE3 + IDAgUiAvSW50ZW50IC9QZXJjZXB0dWFsIC9TTWFzayAyMCAwIFIgL0JpdHNQZXJDb21w + b25lbnQKOCAvRmlsdGVyIC9GbGF0ZURlY29kZSA+PgpzdHJlYW0KeAHt0DEBAAAAwqD1 + T20ND4hAYcCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgw + YMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMG + DBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCA + AQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgw + YMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMG + DBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCA + AQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYOB3YCz/AAEKZW5kc3RyZWFt + CmVuZG9iagoxMCAwIG9iagozNTkKZW5kb2JqCjExIDAgb2JqCjw8IC9MZW5ndGggMTIg + MCBSIC9UeXBlIC9YT2JqZWN0IC9TdWJ0eXBlIC9JbWFnZSAvV2lkdGggMjE0IC9IZWln + aHQgMTIwIC9JbnRlcnBvbGF0ZQp0cnVlIC9Db2xvclNwYWNlIDE3IDAgUiAvSW50ZW50 + IC9QZXJjZXB0dWFsIC9TTWFzayAyMiAwIFIgL0JpdHNQZXJDb21wb25lbnQKOCAvRmls + dGVyIC9GbGF0ZURlY29kZSA+PgpzdHJlYW0KeAHt0DEBAAAAwqD1T20ND4hAYcCAAQMG + DBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCA + AQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgw + YMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMG + DBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCA + AQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgw + YMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMG + DBgwYMCAAQMGDBgwYMCAAQMGDBgwYOB3YCz/AAEKZW5kc3RyZWFtCmVuZG9iagoxMiAw + IG9iagozNTkKZW5kb2JqCjE4IDAgb2JqCjw8IC9MZW5ndGggMTkgMCBSIC9UeXBlIC9Y + T2JqZWN0IC9TdWJ0eXBlIC9JbWFnZSAvV2lkdGggMjE0IC9IZWlnaHQgMTIwIC9Db2xv + clNwYWNlCi9EZXZpY2VHcmF5IC9JbnRlcnBvbGF0ZSB0cnVlIC9CaXRzUGVyQ29tcG9u + ZW50IDggL0ZpbHRlciAvRmxhdGVEZWNvZGUgPj4Kc3RyZWFtCngB7VyJdho7DE3fS9Ns + EAgECM2+NH3t///fu/dK9ngWIO4JwZ2Dcmb3MLqWLMuSnYODPe1rYF8D+xrY10C7Br4U + T22e190hnH/+CiKn65DEZxWif0WHBZJx5vX+DmCOCa8RzNeCifyBTULbhMs0j4gMz1Gx + ZPwRmeGKutY6MUFBTHgFcL6Bjgsl8gYWwSgEtl5ckpRhCnhOCiWrbCATLsFqCclu0O5J + UEcUEeCcnp6eGeGsEKoYAoNgk7hcXJ2wKCkDRUgO6FzkP1XEIeHo9JTAAqxuGy9RoUlB + UBLR+flgMBiScCyIAkvn56zlU4iL0qISdgjLQVH7Ts+ISG9fkHRWzK5iaTAAMsI6WgVL + +hckRUQXFyPQmDQa6ZeK2EWWyBTYHCTSausgUNH6SVKDIRAJz6VIp8XsEp6ALIXVgQqm + Ar0U1W8wBKTLy8lkMjWaTOyXStgnTIEr6JHBgslA02q1LIkKjQptCqD07lUgB1fIIXB1 + BX4mE8Bi27Km1URFq079M1DTq6vZPKFZ/KWdnzT5mgZYXcICqkPqHyR1MZ4YpoWI4EpD + lXI2GV9AWuy2DlsqKAX8dnziqFI5zWaUdTF0NZul8royVCfotdBpNVTQUZmpmCavCVJJ + 1gLVmzaPGVWQ5n0FqmAAx5cRFapFbbIYqw5GaJgTec2ml+NgBluyorGgWVezmroCAhNA + TWA/i+iAxQT6HOCCNQv6NJUKwsM4om2vO01mLGrNKhFUQT7TRVNcsWHJXDRQwbGgsYBb + ARM4X9DwSfvY0aEDL4bg9kBcpoVgcjEXqsGZm4tVqEbjqVAl2ge9LYZQ7RCXa6FQmblY + g8pNoKPyJiUPspAxI0Z98LwDLDQtyKpmBLtklaCi+tFOwGzCbpYzzgeL5qfSZszeg+oE + r0BtoYF0J6awmaPRkG4Wh9KFEHg8Hw4xpEDbUr9FWV2w4tVhtWV1nKK6oucIZwSg0BLL + CaDBohEWlBAeOKs/ojqmc9FEhe7KUcEGUlTw84OkGMkphMQlpYWxkoQFG2iyUoe1AhWH + IeiFISq2qdBrM1BaBgUPiGNACQuMymWCQqEbbqCix05Zsb+asquiR2FtCgqLWEchpG6V + bYuGkK6TfAu2K3ntNVRfNA5xVPADWVajZ7YpgEJUtxAyRs9Y/dQqcHqJ2o+oak57AxXc + v9Vla9Xx6Rc5nOaU/XQgtQ/mcJpTtvYRv3D17Hr0wfdyOM0p22BTgBJTsrH9Md/ELRJe + xnl1p/GB+mUOpzll06+Qm48m/Gb6icZ5Dqc5ZavPOKZGotXSm9yrh7P9ps7OX7IaWocr + h9OcshGVyQlcf5TbQeibcqI5nOaUDagEKs1LMv8Hij6jXXLvnrFu1LzkqgjfUu1syInm + cJpT1lERVJXDUxZP45WE6zh+YaKJmygdqoUS9hIwElrIiYbqqx1zOM0pax8RKOgeM0Mh + hWcDZuO6Nni2TJolnMJ5M91nKbZjJUUtHdVpNHI4zSkrVAkoDA0834XgBvxhMq+MnmXA + WnkvJmiUpEkSY3hTmKvkocx9TUpem3Xfbq0XlI8KX6WklMKr0l3IeDmvDHNZtqgZTGQm + Yxw2f2ivARqSh4xArMqyHRzkcJpT1mSFRqXAvNx8so/UEDJBSAoZo8wKKVOkXRrPZoyR + m+3siZI29KchaoaLViYPt4qKliKCspAPmDSKCDAAxx+jkQtE4riJLPSf3lF6wsMkHP1E + WB39cU7955SlrIjKEkODYYwgiFHy7nHVxfXyGrRcLr9/tw2nOK+I16Tra2KeCRjzURUs + a0zJPofTnLKGSqJirHeksDwQiMi/QwGAG9Lt7e3dnW04vb27v4vEa9LNDV9bMK4wuXRY + alptM5jDaU7ZVFQCNSckMg8i/zdAo4v7h3vQw8PDo5POnp4eH7lxh2eie722vGZowWGp + aX0+KkQEMCJF/HoBqVAGFYd3dgG+Sc/PLy+2PYNeXl9A2uGuEeEB2M1yqaglA2GWuWkm + pKj7SSwCQ/x149ucsiYr/TbCh+Pp/JqCAiYKJNS/AAEN8Ly8/qjRG6+0w/FVBHgA5rAk + LKJakb/eNqrTM7aquST18ACZiKRcPItw3n46vfHsv/9s48mbo3sFLoN1zXSADIZyHC0V + zKn/nLKSlYwFsl2jy6s5RAWNexSkV/JnSgdQJhawn9KvX7gKm8GFzF6en6iE35eLGVAx + x7FLVGhWaFQA9SR9eyV/ktMrFA+ygHiAASAEhoffv39hpy2A/QldFCw0rev5dKyG1W0u + cuo/p2yQFaYxQFZCZaKiEVCtB+V7q1ABBEmggMiQ/abESD8h1FcIC03r+3IeG1Y7fb1l + a9HUQDYr2oYoK5qEhqykdQERIEZQxaCSfWUKBTYQve3tnVsLmGy1rxfatne0K1gO2A62 + v9iwqIHDYNo/11ooOW791WwRYNFKgLyLkj7+gE7K8plZoPWr20C2POpfYgR3iorzg8y3 + kGvBjhf9FToedKk4ktxwSBvDTiAkRVlIGhVhQod1fysbuDtrYS67Oxd0maiF8o7gYfCo + Lpliq3wLYoQAYfyx1ybo3KnzFqhd9lfw2TWZEP0wWhYzmcJFPxAeHf1B9wDlBxJhIIBs + +IF4wprAe3Bx4eFGBeyYmHSwTY9JIxHzmaCDSE0w6wd3UOMMO5i7XvPZwTe99fvKaVcF + 4G7itSNva067uqtP9QOJygZYGoto2KgkLcaGGh0uFj4caY6vMLa6aY2vICMOsZSLtgl/ + GGB9lag+0wYehGCMzVKzmR0cynMmjkbEmFhjY8fGWBigMUIMFEbHPDK9bpMGdjZqTGEh + 8cc5EB67wLxWhS+QLI9DfTthqCKGAWLwIhZSxIORiwRUWwG32q6EStOPFWVCqEwzxW1e + dZxb7QGk9MAgDeI1Mc6UPCMiBmNsfG9D4ZYCbhdVAothTuRePQhIzroDgWQagcBAHhTU + PT7xSKIiZwrgMv8Dn7NBOR5rTln/DJtWCEkzkB4XYQBfg2rh2nPEMztIr1j8FoZiR/FA + QBMsaCFTIkdY1gRkxNZFFmdPA+x+zgU24fTEZuAky1k6RLVlDaTEIi4CCyu2LM2BZQ4g + 7RyvQK/d8Q1fUgU16NS/7fbCUQuphlRE5t4IbTN5QicpGHI8dqtKYflH6oectpJTtvEV + E5hB8/QiEP4poX5UT12GQh/O4TSnbB0Vrr6QxMsH7fBzrY+EGzmc5pQNv18/Clobm92u + 9hF3uBVv+Inu13+6dpXDaU7Z2kdaF4FbHFvPVt3IeSeH05yyq3jz+87ihlJdj99VDTmc + Nsr+8eysuj4lMth8mmrgmtIWkH7f7KyDNHrdm5l0BxZdYeKwV7MeuaCihzNUD78GVD5J + txeziTH102XVr5nfXP/HdgVUHkPA+O7vn6WfoopxBM4WOAvDhd0fUe+aSMy41jtXVDBq + 2b/VL0TVq5VK3mfbElRFtPqwqkzdcN9WAGINalirgLkuYc1gIq4kxLXbUwVTPYTK4Chm + 3od1H63Vmr1dWWsLG5OGpdaFSUmMFZdDyapaMhgXa3avF5a56N2Kdctx9Ou/CyB6yLR8 + +KcJPflPEEBFYSkXYKsh+/FfOySs3v2HFQpLuV75uMxYxIwN5/qWQnn/DYcq6E2L/5Ck + J/+5iHH5RFpIvPTiv0wpw2FLJJJklGWaGvmonV4mHFm6K6zBWBFWlbDYtrhKgpkojBEd + wO5Hi4GDiiEwCDaTdFdX5BT3lAMgLOCyJNuKLFtX5u1z71kiDPkuMLtmVQmBImTKtmW4 + mD4M2NYm03by0DJ4hom5IbC+QlRBWsyKeooNCbNCKaTwJKgVecmI08TlyUOHZj9Q2p55 + P8/hrRWUQXNcUkW8RbkVR+TLk5IblC+Ky5KHQPUXEESwpj0lkOIp3yibIqv7k30N7Gtg + XwP7Gkhq4H+jmZ8lCmVuZHN0cmVhbQplbmRvYmoKMTkgMCBvYmoKMjkzMwplbmRvYmoK + MjAgMCBvYmoKPDwgL0xlbmd0aCAyMSAwIFIgL1R5cGUgL1hPYmplY3QgL1N1YnR5cGUg + L0ltYWdlIC9XaWR0aCAyMTQgL0hlaWdodCAxMjAgL0NvbG9yU3BhY2UKL0RldmljZUdy + YXkgL0ludGVycG9sYXRlIHRydWUgL0JpdHNQZXJDb21wb25lbnQgOCAvRmlsdGVyIC9G + bGF0ZURlY29kZSA+PgpzdHJlYW0KeAHtnOt24joMhZlz2k5LoZQ7lBaYy/s/49l7S06c + ACFeZ9bEZKEfXA3oi2TZlmwGg7vcr8D9CtyvwP0KnF6Bb9nLqc5NrxDnn5sQatpEUrxX + Ev0rechQTDO/7i3AnAkfI8xjxkL9oCbRrnGZ55HIeJ6yFdOPZMZV+NrJAzMUzISPAOc7 + 5DlToW5QEYrCYM3mkqWMKfC8ZCp2sUEmLmGdGMleYNyToZ5oIuAMh8NXEzzKREqFoCDU + JJeb6ywWLWVQRHKgkcS/Kou7SKPhkGAB63yMl6nQpWAomWg0Go/HbxTcZyRBpdGIV3kI + c9FadMIzxnIoet/wlUT69ISiR9nclCqNxyAj1tMlLPlfsBSJJpN3yJTy/q5vyuKmUIlK + Qc1xZK1THwQVo58sNX4DkXhmEj3M5ibSCWQx1hkqhAqMUnS/8RuQZrP5fL4wmc/tm3K4 + jZSCVvAjw0LIQNc66VkyFToV+hSg9NllEIfL5C5otYQ+8zmw2Lesa9WpGNXpfwa1WC5X + 60hWxTd1/qCu1yJgnTMWqB7of7DUZDo3po2EcLlRxZrNpxNYi8PWw4kLygG/P784VWyn + 1Yq2zkaWq1Vsr6VRvWDUwqBVc0GnslCxiD4mpJyiBS5v3D1WdEGG9wtUIQBOZwUVLov6 + ZDZRHYowMEf2Wi1m0xAGT2zFYMGwrm61cAcEE6DmiJ9ZDMBSAmMOuBDNgj8t5IKYYTwx + tlcnTRYsKt0qMlRGc6ZJ3VxFx1K4qFFhYsFggWkFQuB6w8An7+NAhwE8G8G0B+YyL4SS + m7Woxq8eLi5RvU8Xooq8D36bjeCyw1zuhaKycNFA5SHQqbxLaQaZyZoRqz7MvAMWuhZs + VQmC52wVUdH9GCcQNhE381nnQ0WbpzJmrNpQveAjcFt4IKcTC8TM9/c3TrO4lM5EoOPo + 7Q1LCvQtjVu01YQXXgPWqa2eY6olZ46YjAAKPTGfBBoiGrHghJiB8/IXVM+cXNSpMFw5 + FWIgTYV5frAUMzmZiLSktbBWkrEQA81WGrAuUHEZglEYpmKfCqM2E6V5SJgBcQ0oY0FR + TZngUBiGa1ScsdNWHK8WHKo4o7A+BYdFriMT0bDKvsVAyKmT5hbsV5q1V6i+aR3iVJgH + sq1Wz+xTgEJWNxMxRV95+elV0HSGq19QVSbtNSpM/y63rVyOv/4kRdOUtn8dpPKDKZqm + tK38yJUn7rZXWqW8naJpStt2OoinjDDne2W7r6q0StE0pW3lR84/AUMJdPkRUc9/weVX + UzRNaXv5F/0dZ/J6pQ1zVvO00iBqFEyLS5K5UjRNaXuNyuxU1iujSUllIHe0RK4UTVPa + NlMVTICxcqWXBa0yGCE+sq5LgyW5YYqmKW0bqQTlpT3W9qpCQBerfobyZ+N3Vt5M0TSl + beVH6k+8XvRo5Uov7WnJqSVaDOnVT5orIWakaJrStg4SP6epWFoBFKZfWDMU4ikCAaKW + piWbqp8sqCX4YIqmKW1jivrjAKVy5UiFvaioxyqaCyAJRj8UVv2LLj5P0TSl7cUfHAwc + Soay/EIlP2p1NCtajrEatTKhSjStfTBF05S2V6hYBNPkXwugMj2PchjrTS5YEPgyx6qf + GVOhV6FTWWVvwuwWV+AuyJkyFeKifDATckh4nStmXL5yKdc/pW3TLzKvzSLY+E0L1c12 + ++GyRXUGgISDWKrHsVTMaGusFE1T2jZSaUktKCSAth+fn18un7vdDoBbE+AhhRWtzFsH + 9xRNU9o2UVm9kjXYxXqz3X3t9/uDyZ50QHPTbYAVKk9JLpiiaUrbZiqECiQVmKuHpfbH + WA5G9gn52FaTru0H4hRNU9pepxpPpovV5mP3dTj+oPyE/CDfYS8wGO1jC2Mhi4CEA+tp + OVNZuWj4ivzPwkxFoF8SJ4M7wiv3XztgeY3mFqgYAUUFU+2Pgem3kclgx8PxgB72AWMh + kzdCcM/fVkY1W6yNygz163cF63iksTZwwRulcv+rUdFW8ECz1S144FPwQIVA9CtZK5jK + YsYBVKFf5R8tMGHiJBDloigGhngBPAVCDl9ywDUHrBuIgYGqOl5ZaOctLGUxEKZSt7I9 + BTcwCnMvVDy3OGgctuCnAUsjFgN7EQK1peBW5oHr9XanaaCmTZw62RiMqYVB2UYJq9Bk + PQ88mbNz2od5LUBw47PALaZLKiWxkqSay8mmlqb5S1STQqmnqc7xh2ZM9fWV9q9gCeIz + daxGbLUFJqywDAp7gZm5uMxRfSdF05S21V+pPOMKP1oLc1cEriZ3HbngidaNVsikpXy7 + Yu5U2ryrJT7LgbbTFXTcHapFvi3zscAvVsIppkJq5G974CCkY7TIf0WOCRuqip3WzFjw + CTdZgUkbHsxSCQ7YDVVInVk+sNzoH++Gx54oJpiQOCNUWuKsEyoaK6Q5cS4jHDMpsp1h + O5SynGBCyiItydkRlbAsfas8uxLR8S6okJnWeZymcyuVOFQ86aJfoWcRC+ZC0LCaSJxa + D495dgrvtzgSVtCEB91QRVwEg5zsFrKXS6bWUZ1kXVHBXGYvFHwoDhHd8VWvNybW5Dqk + ornEJV+E+meEb0GSobqzlboA9C3RDKF+yxahu7S+78wDSw2pd4OUDds/yoCKrtgg7VnK + lv+D6k/tzqr73MnzBuQLb6XszhrEc8be7KQbWB6FJZpe7XpUdsh2E/dph+rDowqfYY90 + T3YTY+sn13qBysuBYT9xmMF1fg8d03Z+W+nTT1SQqh+79FXQLc+JGJbW4vFSotvHiGfa + SGxHD9qcPdCZnpLKrYX1+G2ffundSSUfs+0IqrJ2SHYxzYUkFw9W5CLMWykhB/WkZuOp + Mg3DfTsBaOUM2//Rn9OayiUXoT2chORmFnlhDifwTQfzPkts8/bayVo72Bh1LPuody/f + gNT9XXSqlgoW3er8eWGFi96dWGfeny6oklpP/l0AWQ5uggtYPfknCFBZkcZnTX351w4Z + Cz4orN78wwqNpdqTsHrybzh0Qe9aDBk9+eci5noja2kvOgpNmv5lcwhfigSVWv3LlKoZ + /ftHMDOWlZ6wkEedCevD+MhAt8tF//VSISgINYvS3sVtAEqMEwsDlx9dUQ0twxvLn7T5 + pz0vZcgLe/SviCzRMGlcngg7qahl84KVw1gIo8ZXiivIbovLKmpRJS27h2mlPeeiyST8 + dG5imvHyQ6BwWTJpeMRyhH0i91tq2gBy5i1+Im85o/T9pfsVuF+B+xW4X4HBf/zBCjcK + ZW5kc3RyZWFtCmVuZG9iagoyMSAwIG9iagoyNDI2CmVuZG9iagoyMiAwIG9iago8PCAv + TGVuZ3RoIDIzIDAgUiAvVHlwZSAvWE9iamVjdCAvU3VidHlwZSAvSW1hZ2UgL1dpZHRo + IDIxNCAvSGVpZ2h0IDEyMCAvQ29sb3JTcGFjZQovRGV2aWNlR3JheSAvSW50ZXJwb2xh + dGUgdHJ1ZSAvQml0c1BlckNvbXBvbmVudCA4IC9GaWx0ZXIgL0ZsYXRlRGVjb2RlID4+ + CnN0cmVhbQp4Ae2cCVcbyQ6FyRtCEsBsNmYJS1jCmsz8/3/37r2SqqsXG+rk2K7xoHPi + jW5bX0ulUknV2dj4kI8r8HEFPq7AxxXoX4FP1Utf53mfEOd//wqhpvNI0t8aor8kmxWK + aebX/R1gzoTTCPO5YqF+UJNob3GZ55HIeLaqFdOPZMaVfK33wgwFM+EU4HyBfK1UqBtU + hKIw2HxzyVLGFDzfKhW72CATl7B6RrIPGPdkqC2aCDjb29s7JnhViTQKQUGoSS431yAW + LWVQRHKgXYl/VRVPmUbb2wQLrOEYL1NhSMFQMtHu7mg02qPguSIJlXZ3eZW3YS5ai044 + YCyHovdt75BIZ+9T9Kqah0al0QhkxNqahSX/C0uRaH//AHJIOTjQN1XxkFSiUlBzlFmr + 74OgYvSTpUZ7IBLPkUQvq3nIdAJZjjVAhVCBWYruN9oD0tHReDyemIzH9k01PGZKQSv4 + kWEhZGBo9UaWTIVBhTEFKJ17HOJwlTyFVsfQZzwGFseWDa0uFaM6/c+gJsfH05NMpumb + Vv6iq9cksIaMBapN+h8stX84NqZTCeFqo8o1Gx/uw1qctjZ7LigH/PL1m1PldppOaetq + 5Hg6ze11bFTfMGth0uq4oFNZqJhkpwmppmiBy5sPjyldkOF9BlUEwMOjRIXLojFZTVSH + IgzMmb2mk6PDCIM9WzFYMKxrWE3cAcEEqDHiZxUTsJTAnAMuRLPwp4lcEBnGFmN7O2my + YNEaVpmhKsqZ9rvmSgNL4aJDhcSCwQJpBULgySkDn7yPEx0m8GoEaQ/MZV4IJU9PRDXa + 8XAxi+rgcCKqzPvgt9UILjvM5V4oKgsXc6g8BDqVDyllkJWsGbHqQ+YdWBhasFUrCA7Z + KqOi+zFOIGwibtazzoeKlqcyZkzfQ/UNp8Bt4YFMJyaImQcHe0yzuJSuRKDj7t4elhQY + W5q3aKt9XnhNWH1bfc2pjpk5IhkBFEZiPQU0RDRiwQmRgfPyJ6qvTC66VJiunAoxkKZC + nh+WYiWnEpGWtBbWSjIWYqDZShPWDCouQzALw1QcUzFrs1Bah0QGxDWgjAVFlTLBoTAN + d6iYsdNWnK8mnKqYUdiYgsOi1lGJaFrl2GIgZOqk3ILjSll7i+qT1iFOhTyQx2r1zDEF + KFR1KxFTdIeXn14FTY9w9RNVK2nvUCH9m31s63Is/U2JpiXHLh2k9YMlmpYc2/oRvvlD + 3+x939wPSjQtObb1oyT64zjSuyytn2i/KdG05NjmVzIi6/6VPs64HqRsfqX9qkTTkmPj + V5xpsC3Jue3taTtmwOxiBOdMrhJNS451KvM8tCWlfS+lYltvpnhPDX9v0APR2jYz26Il + mpYca1SC8q5ktPDenwCr9aTDA7DB+8x+L2026IYlmpYcKypC5R28bP2VVi3ZZ6m9l68+ + +XcenOiMEHzONYRVomnJsaQSFHyPfSFkJBBrlllPyVWPj/TcKhGwa4QP8AcdanT4JuOj + W85sH5ZoWnJsGwoLg51odlHZYclqVOwfITNV90gHqwvlFwLGA5m6omy0DRirRNOSY0kF + r6el1MDjkjs6Q9Q2pF1ETP0UtFrYm2CfhUfgaLWhaDo22dA9BBjDiLDoGC0p0bTkWPwI + B5XK8kryceVRHnFdoS1fUvIiduo6oB5npTwrNgqPcGZNOCbArH2o1k1v3irRtOTYBMUO + imoIBKDaVNjUx1MqQ2K9emLl/tPTM8i5y9nZaVOgc8txoeDLH+uKLpmKbSEWRQ9UxGK1 + hzpT+0BI6oPiO+TC5FJyhccLfHh+jpPUdJFlVSdmoQ6FsKEmB69othLEAmve6qLkWNlK + X00o1G6AZATUXYbgi+8Xpv/lFQiurq6uTX5Ibm7wdH3NP11cEI1WSyUgx1KTo2usEk1L + jtWosg4eFqToNJyenRsCdKcNBAGMALiB3FLuJPd39/c/f97f393d3pLu+ppm09UA3BSl + rWzF3u3dLM5WjBWsB8j/JrTTxSVNYRQ/4pkkxoHHe5JQHiiPj0+PDw8J7cc1bSZDEys6 + UoMuWHL9S46lrcwBR3uoyZ8S6lIoNApdy0xDohaLcB6fnp+eJQR7eJDNbsQFsvPzdjG2 + 1z1cqK2cig4I94PLEeXmFj4Fr3IT0TjUm/II61CI8/L88vL66/UFL5/MZHd3dES678X5 + GYyF6gIKEeyzLZVKkxULvYd0QJmK9pG/2RMGT3K2JxLJPGR6eX19/UUR1/MjXVFYjB6X + 34HlvZtVUHGyYgQ8YaRAZGiNIg0j2ajFk4h+//77t7hgMNoLWLd03R/EgrFQ4dtFcF++ + rYzqqKEKW93RZAwOcrzcSLSSmen33/8QC2+FhdHFeOhUp3DBVVFtMbHwcSVjYWTZuJIL + OhajHc1B/3uBNFiylUHBB0GlOANbwQPNVkv3QI+Bu4yBFtkvGdgVAxU1FP98YDFKhMkI + 9ov2kqVeImL8JBVMda1woXG1gmjB+SoGFmZhZEScemOi4hgzLAVBxgOLgRYxRAbvI9Iz + ooVMxShIqu8I7ZywVhEDbXcQu8i2jwYTMbMLT4ugXhiM8xWjhgQADPCCMSs9EYn+d3dL + JsRATFhpr8HSZ+FYhzBlYiKIpMnALF/yOTmCfEotjA6mw1RsQJFgiCnmKw+B2mqwvDxQ + yUXk7CjhK8FFyh7JOdGYQ9GpbLD1kifQIBWEkSAMf0p0fRK2DRTWuVleHqj0FtmFL0Wy + jrotQkhHy3nSzpzXfFOURoqQp5FEG1kWyHPO2Dhj34KzlRZYXVMtLmMiFUeWY9kOCC6z + YunIRQVXW1QUeBItrmREGRKc9oafM2G3tQiagQGFPcKsXGx0pCRjLTl2I68wIXHnvmMU + LrjMt8V9wiNdWgdzGUwR6bmtPEgDyZfEbHDSUr6NcYlULSzWzbClmuWiZv8xay9Rt+Be + qFj/R9HCePloVQFcCCvPqGmboPqmWqAHiqopcvqW/rRbnKYjIKwXYhUmK9K06jT6KKpN + 3PSMagyKTGapAQdcJJVhaVM175FBCa+5W0EFT9Y0vTKYSoFRUWvz6tPYMq8CEwpnhBou + nC2UKrBUaEejwNF4c0l2d4kVdEco85GSgoqtw7ae8Jco4xqT1W4/9UYVxvTCqjEMS5+8 + JxJNEb+1iWajEI98kJ0d/ntLcCDOwJlfYKjZBekFU2Vcf6GNsBntqi0ILBfGE2L7AaqL + OX+II4Rk3odBNWCqhVM1BsP0hdghtoD7DCFgLgY741EH8qyGaQhqGVQG5s4YbDScRDoW + PeA0XBx+Eb6Tft6XxY6r1u9BBwi1SULbzZHNxO6XgDgQPx/f1vqB5s0SqfSjIuuwJciS + F/yiBqPzatlU8fNO9/4nI86Oj28aev7XUGU89nKIJj77A6o/2J1V4mqzj+2Bpg+8ZPKu + 3Vkb+Yy9NjvpNqwfYF22Ndr1qC4HS3zYdbdGO1Q3P8e+W9+kuxa7ibH103cTr9fO7+he + gwrNsbXZpe89eVElLK5PsZaoRRDStZE46nVWlfdSb2+PNNZ/dk/P+t39snZ3KqU2h+6/ + 8uoPxhZK+bqxorUiX+EbbGNntZg72e1uOe9M2g717i59TcPrdgcg7kGNexXW6G7Ntb2z + 1oKg3dvd1FZZXOXwqkbSgDId07DS7Ved1abvDFm7O9bZ5WB2YTuudBtaspjvj7Ndcqt9 + tMDnmvGOUrXwuOVkqIWigaVm7xr9TxCos9FYa/e/dshY8EElg7GP1noZ0dmo4znT6e3/ + YYXGQuXVsdRoi+6F9jOn3sZqX3gDia2Ud/xvOHRBbREWVupFCWGFCdLATzcqqZMy938u + Yg8ls5Y1EL0voyZNNQ8CTb0hQrGHAuU7k5XV2nQ/AZ0QIWN9/kcwM5aw2D20/pO3nWpZ + M6ZOGBTydtfcbhftpSI5sbDpgGDGlveZqnlt2nm7S+436H9GpbFlXNZcs7Pre2QXDC0v + trvUSEFt18bR0KO1NJrWYd5Uq+u19cXY8GJdex6TnJDmYueQfaWiltqSD6Z+3vCaaygz + Hg4hF4RdMqPjN9QkpplpObst2XFGNiD8lMqfqGlH+Tfe8oy65Q2Ajz9/XIGPK/BxBf6j + V+D/By+qOwplbmRzdHJlYW0KZW5kb2JqCjIzIDAgb2JqCjMwNTkKZW5kb2JqCjI0IDAg + b2JqCjw8IC9MZW5ndGggMjUgMCBSIC9OIDMgL0FsdGVybmF0ZSAvRGV2aWNlUkdCIC9G + aWx0ZXIgL0ZsYXRlRGVjb2RlID4+CnN0cmVhbQp4AdWWZ1BUyRqG+5zJiTADQ5Aw5Izk + KDkOQZAomBhmyDAOQ0ZURMQVWAMiIqAs6BIVXAMga0BEMbAIKKCiLsgioKyLAVFB2TNQ + sFbdu//un9tV3efpt7/+us/pPlUvAOQ2Fo8XC4sAEMdN5Pu42DPWBwUzcEMAD7CACoSA + OoudwLPz9vYA/1o+DgBIMPhAR5DrX8P++4AoJyyBDQDkjQyHchLYcQhfQHiezeMnAgCf + RbgnJZGHMCoTYTE+skGECwUcscQ1Ag5d4suLMX4+DkhMDwB4MovFjwCA9BTRGcnsCCQP + aR5hPS4nigsAWRtha3Yki4OwYO/acXFbBVyMsHrod3kivmMWK3QlJ4sVscJL74LMRBZ2 + jErgxbLSFjv/yyYuNgn5XouFirRkbuxawdmIIXWCw3J0X2Ze7OKZLephXH/fZZ0butZr + mcP5zj7LzEu0/469/Zb19EiHtcscluC0kiea5SY4s8X8/CQf/2VOSPZ1Wub0SL/AZeaE + Oa7o4VHOzGU9KpG5slbMVveVPQBfkAa4gA08AQskgEQQBviJYamJyDzgsJWXxo+KiExk + 2CE3LkybweSydbUZBnr6+oLh/5si+NeWNvuevvgPQfS7/2hpG5CridwtaM8/WhByrxsy + AJBo/EdTNgWAJgvApc/sJH7yUj604IEBRCCMnJAUkANKQB3oAANgAiyBLXACbsAL+IEg + sBn5wpEgDvBBCsgAu0AOyAMHwRFQAsrBSVADzoBzoBlcBtfBLXAP9IB+MASGwRh4DabB + RzAHQRAOokA0SAqSh1QgLcgAMoOsISfIA/KBgqAQKALiQklQBrQbyoMKoBKoAqqFfoEu + QdehO1Av9BgagSahd9AXGAWTYTFYFlaFV8NmsB3sDvvBm+AIOB5Oh7Ph/XAxXAmfhpvg + 6/A9uB8ehl/DMyiAIqHoKAWUDsoM5YDyQgWjwlF81A5ULqoIVYlqQLWiOlEPUMOoKdRn + NBZNQzPQOmhLtCvaH81Gx6N3oPPRJegadBO6A/0APYKeRn/DUDAyGC2MBYaJWY+JwKRg + cjBFmCrMRcxNTD9mDPMRi8XSsWpYU6wrNggbjd2GzccexzZi27C92FHsDA6Hk8Jp4axw + XjgWLhGXgzuGO427huvDjeE+4Ul4ebwB3hkfjOfis/BF+Dr8VXwffhw/RxAhqBAsCF4E + DiGNcIBwitBKuE8YI8wRRYlqRCuiHzGauItYTGwg3iQ+Jb4nkUiKJHPSOlIUKZNUTDpL + uk0aIX0mU8maZAfyRnISeT+5mtxGfkx+T6FQVCm2lGBKImU/pZZyg/Kc8kmIJqQrxBTi + CO0UKhVqEuoTeiNMEFYRthPeLJwuXCR8Xvi+8JQIQURVxEGEJbJDpFTkksigyIwoTVRf + 1Es0TjRftE70jugEFUdVpTpROdRs6knqDeooDUVTojnQ2LTdtFO0m7QxMayYmhhTLFos + T+yMWLfYtDhV3Eg8QDxVvFT8ivgwHUVXpTPpsfQD9HP0AfoXCVkJO4kwiX0SDRJ9ErOS + qyRtJcMkcyUbJfslv0gxpJykYqQOSTVLPZNGS2tKr5NOkT4hfVN6apXYKstV7FW5q86t + eiIDy2jK+Mhskzkp0yUzIysn6yLLkz0me0N2So4uZysXLVcod1VuUp4mby0fJV8of03+ + FUOcYceIZRQzOhjTCjIKrgpJChUK3QpzimqK/opZio2Kz5SISmZK4UqFSu1K08ryyp7K + Gcr1yk9UCCpmKpEqR1U6VWZV1VQDVfeqNqtOqEmqMdXS1erVnqpT1G3U49Ur1R9qYDXM + NGI0jmv0aMKaxpqRmqWa97VgLROtKK3jWr3aGG1zba52pfagDlnHTidZp15nRJeu66Gb + pdus+2a18urg1YdWd67+pmesF6t3Sm9In6rvpp+l36r/zkDTgG1QavDQkGLobLjTsMXw + rZGWUZjRCaNHxjRjT+O9xu3GX01MTfgmDSaTpsqmIaZlpoNmYmbeZvlmt80x5vbmO80v + m3+2MLFItDhn8ZeljmWMZZ3lxBq1NWFrTq0ZtVK0YllVWA1bM6xDrH+yHrZRsGHZVNq8 + sFWy5dhW2Y7badhF2522e2OvZ8+3v2g/62DhsN2hzRHl6OKY69jtRHXydypxeu6s6Bzh + XO887WLsss2lzRXj6u56yHWQKctkM2uZ026mbtvdOtzJ7r7uJe4vPDQ9+B6tnrCnm+dh + z6drVdZy1zZ7AS+m12GvZ95q3vHev67DrvNeV7rupY++T4ZPpy/Nd4tvne9HP3u/A35D + /ur+Sf7tAcIBGwNqA2YDHQMLAofXr16/ff29IOmgqKCWYFxwQHBV8MwGpw1HNoxtNN6Y + s3Fgk9qm1E13Nktvjt18ZYvwFtaW8yGYkMCQupB5lherkjUTygwtC51mO7CPsl9zbDmF + nMkwq7CCsPFwq/CC8IkIq4jDEZORNpFFkVNRDlElUW+jXaPLo2djvGKqYxZiA2Mb4/Bx + IXGXuFRuDLdjq9zW1K29PC1eDm843iL+SPw0351flQAlbEpoSRRDTE1XknrSnqSRZOvk + 0uRPKQEp51NFU7mpXWmaafvSxtOd03/eht7G3taeoZCxK2Nku932ih3QjtAd7TuVdmbv + HMt0yazZRdwVs+u3LL2sgqwPuwN3t2bLZmdmj+5x2VOfI5TDzxnca7m3/Af0D1E/dO8z + 3Hds37dcTu7dPL28orz5fHb+3R/1fyz+cWF/+P7uAyYHThzEHuQeHDhkc6imQLQgvWD0 + sOfhpkJGYW7hhyNbjtwpMioqP0o8mnR0uNijuOWY8rGDx+ZLIkv6S+1LG8tkyvaVzR7n + HO87YXuioVy2PK/8y09RPz2qcKloqlStLDqJPZl88uWpgFOdP5v9XFslXZVX9bWaWz1c + 41PTUWtaW1snU3egHq5Pqp88vfF0zxnHMy0NOg0VjfTGvLPgbNLZV7+E/DJwzv1c+3mz + 8w0XVC6UXaRdzG2CmtKappsjm4dbglp6L7ldam+1bL34q+6v1ZcVLpdeEb9y4CrxavbV + hWvp12baeG1T1yOuj7ZvaR+6sf7Gw451Hd033W/evuV860anXee121a3L9+xuHPprtnd + 5nsm95q6jLsu/mb828Vuk+6m+6b3W3rMe1p71/Re7bPpu/7A8cGth8yH9/rX9vcO+A88 + Gtw4OPyI82jicezjt0+Sn8wNZT7FPM19JvKs6LnM88rfNX5vHDYZvjLiONL1wvfF0Ch7 + 9PUfCX/Mj2W/pLwsGpcfr50wmLg86TzZ82rDq7HXvNdzUzl/iv5Z9kb9zYW/bP/qml4/ + PfaW/3bhXf57qffVH4w+tM94zzz/GPdxbjb3k9Snms9mnzu/BH4Zn0uZx80Xf9X42vrN + /dvThbiFBR6Lz1r0AiikhcPDAXhXDQAlCPEKiC8mCi154cUIaMm/Iyzw8Yte/j95yS8v + xpsAUGULQEAmQGwEAGVIVUH6VOQpsIR+tgA2NFypiCIoCeGGBosAkfmINfm0sPAe8Sy4 + VgC+8hcW5o4vLHw9hXj2xwC0xS95cEG0hw4A6IfuTAOjW/6fMxfnf9f8DZxg52UKZW5k + c3RyZWFtCmVuZG9iagoyNSAwIG9iagoyNjcwCmVuZG9iagoxNyAwIG9iagpbIC9JQ0NC + YXNlZCAyNCAwIFIgXQplbmRvYmoKMjYgMCBvYmoKPDwgL0xlbmd0aCAyNyAwIFIgL04g + MyAvQWx0ZXJuYXRlIC9EZXZpY2VSR0IgL0ZpbHRlciAvRmxhdGVEZWNvZGUgPj4Kc3Ry + ZWFtCngBhVTPaxNBFP42bqnQIghaaw6yeJAiSVmraEXUNv0RYmsM2x+2RZBkM0nWbjbr + 7ia1pYjk4tEq3kXtoQf/gB568GQvSoVaRSjeqyhioRct8c1uTLal6sDOfvPeN+99b3bf + AA1y0jT1gATkDcdSohFpbHxCavyIAI6iCUE0JVXb7E4kBkGDc/l759h6D4FbVsN7+3ey + d62a0raaB4T9QOBHmtkqsO8XcQpZEgKIPN+hKcd0CN/j2PLsjzlOeXjBtQ8rPcRZInxA + NS3Of024U80l00CDSDiU9XFSPpzXi5TXHQdpbmbGyBC9T5Cmu8zuq2KhnE72DpC9nfR+ + TrPePsIhwgsZrT9GuI2e9YzVP+Jh4aTmxIY9HBg19PhgFbcaqfg1whRfEE0nolRx2S4N + 8Ziu/VbySoJwkDjKZGGAc1pIT9dMbvi6hwV9JtcTr+J3VlHheY8TZ97U3e9F2gKvMA4d + DBoMmg1IUBBFBGGYsFBAhjwaMTSycj8jqwYbk3sydSRqu3RiRLFBezbcPbdRpN08/igi + cZRDtQiS/EH+Kq/JT+V5+ctcsNhW95Stm5q68uA7xeWZuRoe19PI43NNXnyV1HaTV0eW + rHl6vJrsGj/sV5cx5oI1j8RzsPvxLV+VzJcpjBTF41Xz6kuEdVoxN9+fbH87PeIuzy61 + 1nOtiYs3VpuXZ/1qSPvuqryT5lX5T1718fxnzcRj4ikxJnaK5yGJl8Uu8ZLYS6sL4mBt + xwidlYYp0m2R+iTVYGCavPUvXT9beL1Gfwz1UZQZzNJUifd/wipkNJ25Dm/6j9vH/Bfk + 94rnnygCL2zgyJm6bVNx7xChZaVuc64CF7/RffC2bmujfjj8BFg8qxatUjWfILwBHHaH + eh7oKZjTlpbNOVKHLJ+TuunKYlLMUNtDUlLXJddlSxazmVVi6XbYmdMdbhyhOUL3xKdK + ZZP6r/ERsP2wUvn5rFLZfk4a1oGX+m/AvP1FCmVuZHN0cmVhbQplbmRvYmoKMjcgMCBv + YmoKNzM3CmVuZG9iago4IDAgb2JqClsgL0lDQ0Jhc2VkIDI2IDAgUiBdCmVuZG9iagoy + OCAwIG9iago8PCAvTGVuZ3RoIDI5IDAgUiAvTiAxIC9BbHRlcm5hdGUgL0RldmljZUdy + YXkgL0ZpbHRlciAvRmxhdGVEZWNvZGUgPj4Kc3RyZWFtCngBhVJPSBRRHP7NNhKEiEGF + eIh3CgmVKaysoNp2dVmVbVuV0qIYZ9+6o7Mz05vZNcWTBF2iPHUPomN07NChm5eiwKxL + 1yCpIAg8dej7zezqKIRveTvf+/39ft97RG2dpu87KUFUc0OVK6Wnbk5Ni4MfKUUd1E5Y + phX46WJxjLHruZK/u9fWZ9LYst7HtXb79j21lWVgIeottrcQ+iGRZgAfmZ8oZYCzwB2W + r9g+ATxYDqwa8COiAw+auTDT0Zx0pbItkVPmoigqr2I7Sa77+bnGvou1iYP+XI9m1o69 + s+qq0UzUtPdEobwPrkQZz19U9mw1FKcN45xIQxop8q7V3ytMxxGRKxBKBlI1ZLmfak6d + deB1GLtdupPj+PYQpT7JYKiJtemymR2FfQB2KsvsEPAF6PGyYg/ngXth/1tRw5PAJ2E/ + ZId51q0f9heuU+B7hD014M4UrsXx2oofXi0BQ/dUI2iMc03E09c5c6SI7zHUGZj3Rjmm + CzF3lqoTN4A7YR9ZqmYKsV37ruol7nsCd9PjO9GbOQtcoBxJcrEV2RTQPAlYFH2LsEkO + PD7OHlXgd6iYwBy5idzNKPce1REbZ6NSgVZ6jVfGT+O58cX4ZWwYz4B+rHbXe3z/6eMV + dde2Pjz5jXrcOa69nRtVYVZxZQvd/8cyhI/ZJzmmwdOhWVhr2HbkD5rMTLAMKMR/BT6X + +pITVdzV7u24RRLMUD4sbCW6S1RuKdTqPYNKrBwr2AB2cJLELFocuFNrujl4d9giem35 + TVey64b++vZ6+9ryHm3KqCkoE82zRGaUsVuj5N142/1mkRGfODq+572KWsn+SUUQP4U5 + WiryFFX0VlDWxG9nDn4btn5cP6Xn9UH9PAk9rZ/Rr+ijEb4MdEnPwnNRH6NJ8LBpIeIS + oIqDM9ROVGONA+Ip8fK0W2SR/Q9AGf1mCmVuZHN0cmVhbQplbmRvYmoKMjkgMCBvYmoK + NzA0CmVuZG9iagoxNSAwIG9iagpbIC9JQ0NCYXNlZCAyOCAwIFIgXQplbmRvYmoKNCAw + IG9iago8PCAvVHlwZSAvUGFnZXMgL01lZGlhQm94IFswIDAgNjEyIDc5Ml0gL0NvdW50 + IDEgL0tpZHMgWyAzIDAgUiBdID4+CmVuZG9iagozMCAwIG9iago8PCAvVHlwZSAvQ2F0 + YWxvZyAvT3V0bGluZXMgMiAwIFIgL1BhZ2VzIDQgMCBSIC9WZXJzaW9uIC8xLjQgPj4K + ZW5kb2JqCjIgMCBvYmoKPDwgL0xhc3QgMzEgMCBSIC9GaXJzdCAzMiAwIFIgPj4KZW5k + b2JqCjMyIDAgb2JqCjw8IC9QYXJlbnQgMzMgMCBSIC9Db3VudCAwIC9EZXN0IFsgMyAw + IFIgL1hZWiAwIDc4MyAwIF0gL1RpdGxlIChDYW52YXMgMSkKPj4KZW5kb2JqCjMzIDAg + b2JqCjw8ID4+CmVuZG9iagozMSAwIG9iago8PCAvUGFyZW50IDMzIDAgUiAvQ291bnQg + MCAvRGVzdCBbIDMgMCBSIC9YWVogMCA3ODMgMCBdIC9UaXRsZSAoQ2FudmFzIDEpCj4+ + CmVuZG9iagozNCAwIG9iago8PCAvTGVuZ3RoIDM1IDAgUiAvTGVuZ3RoMSA3NjA4IC9G + aWx0ZXIgL0ZsYXRlRGVjb2RlID4+CnN0cmVhbQp4AeVZfWxb13W/91EkJVKmSJEURZHi + 1yP5xA+Romh+iRRF2ZIsWbYsyaYtypFlW5ItZ3Zt1K4RF24itGhsa0sX7I+safaRbVnX + bPWgDpsra2hgNEO2ZMBgFFi2ZEZRIFsXbMEQYMuyrjO933nv0V81ig7If6Nw3r3v6957 + zvmd3zn36cLnv7DCWtka07DK0plj55j8a/o6mr9ZunjBp5zzo2iFE+dOnlHPl3H6ZydP + XzqhnGu/xZjj6urKMVyXf/+DY3YVF5RTvh1tcPXMhWeU8yY32sunzy6p97WrOK+cOfaM + Oj+7g3Pf546dWVGe734Rbc+5s+cvqOd9aI+e+/yK+jyfw3mzcq9xNDHG0fey55ie+ZmA + P/rZsHKsHffoT35Gv/Dcm4ttpU+4RfMhPXJj51Fq2Pff/ftS/bV70aayZhOnLeoI8jua + zXsx5m66jPvzTWV5JPkd9eDdZIYYXorRfGjjk5usZXruO5x/rbbJ7311c4R138SImsUj + vZuMx32+0VMjG/woToQ4LkT96GnivrENTWhsdk6s+dZ96xPL674x3+qx5Y2mkNzixsp6 + LenbYPvnTuF4YM6/Uam57ndXarUBjNNE4+AVPL5ewwhPqyOglS8l7+IhbXzSt6EJT8/N + zG2sjbg2KiM1l9/vG924NT23cWvE5a/V8JTu/kqx4i+d6lTXrMeadVHcb1ZG2Y8xMERt + fZ3GxJkQ9m/cWl93rUMT+Yro3+RMvQBN6RlNaHSTV6bn6FZF9LvogugX/VhHbQRjt8Qn + 98+NYiV+WonhZ0zKRh4yqfH+QvFsK5ZnlE267TMyqekXMWnbL2RS8/2VPmJSC9ZsJpO2 + P9mk4s8x6H0LV55g4TXFwmtPsLD1IQsDyPw/WD/vQLxcZ1PCD1hMuIV2CVKGfMpiXMNm + hbh8b6/wXywsXEWfnr3KQnh+t+BkQWGG7VTboNyWWZD9kI2S4N0KxgryvWwQc3l5kbXQ + Nf4jhlnV+GRgJx27hXMfO/wzcYbL/+efAK5rYlqMqse7Cmu0oGdgRszF2DYG6mBtkCf9 + zMzC2pmV4prZIbRSkB+kkznlfhdzMTfrlvt08Kg9N67+iE/xG/xDwSa8Jrwh/FDj0bzR + FG66od2tXdOVde/qx/U/bp5qYS3RlpGWXzHEDfOGunHa+KrxL8A9/TDJ90FiGqzbCFLR + JhHayb5UyG/xhyx+C9+qr/G1+jP8xWb+cXNdZSsNm4IH14R3oJ+fxTnfghGNTAN24uYt + LFkv953mYS17Hyf/AhEWhl0gJ718N4K2AJmA1CCnIJcg1yAvQ16H3IS8Ddm2sMUiaJ2W + 9sImiyTlMSMYM9IYM4IxI/JfAccJSA1yCnIJcg3yMuR1yE3I25BtC4iBO1swtJG1y+Ny + 8yYL3MZVtIk7bIsF4DdSKACFjFCP+kb0GRPlPkO/A32G1/tS1ky63yPYbTqRW/z9ZSGz + PSxlypyahEbU3L97/Q1vLtq5a6b+Aa9lZnLusR3pXEo0927POF57z5OPde0a4r/+gb4z + Hi4UePpuVizslnY8ZRJs+wvZ3XaDQcvvPv+p0ZUQSyNYCWexex8Lfyj8AwuxM1sAheID + jxmm1uG0AxKGZCFjkIOQE5CLkOchL0G+CbkBeQuybQHG/Vt0/gkiLMAKTmZWXbmFERXN + dea+FE9DrYAJGnuEdH82J5pwmoDaZZx2CCOLzdunlvOzz1XjkdnL+6/9lmlR48lMJCtP + Fd3u4uHK5Bn+74VDA57iiWtTU1eXCy9die/JeftmzgzmV2f69hC4BRlj3wDGTFjFlzaZ + K0koa5OXQ95yQTrubDL9nc8GZdCWqdqSb9tUn7dB25xF8a6pSdSgK7tXvP7qjvmC0xXN + ZPvMdz+pfflAz5/8/rQQDe1aqexYKAetWuGLd7P9i788/+1vkT5c1qcMfYwsvYVIQNAB + Ui3Qouk25m6S56M1IIPjBq2hGYxC/WaswWrxZxp/U/zj+ll+vv4C/5rwzt3s9KfTH0w/ + mEPEHC0M1iIqotf1mEO4jejmuMhwuTG+DnFPffKo1ZJWZ5ha5OP1TX6Rhua7aGgFZzeB + szj7nU3Wi2Go8KFXBYzNILrbuI42hDYEEjHfkTFoBgbNwKAZGDQDg2Zg0AwMmoFBMzBo + BgbNwKAZGDQDg+YGBs3AoBkYVGZwYVRXElYysqg8LUWiD1xJS/ChT9xL/SZoEnJAE3u6 + wyQ8gKRHcDyKWGHZWar/5T8KnuLBfOlw2ecuLgz37MqH9YuG3MzJgepz1Vhi7tnpocu1 + Gn9mOlUdCib3ncwXzlS3W8PFyFBtwDX09AtTY19eLqbIt7Mwx3dgdw1zbOGg2EZjlm0O + A4FRyb6zi2RTPIafggcJJ1rm3cJBeUdL75DzFDwoGsm+t0zx9+rPy/4Wvkjv70WQ4Bw2 + mXx4TvJ7s2wM8nszxADrGZLqWojhGUSvzkH8tQUeR92qMBnWmeZpi2gR+d55gX9hdV6o + X5XXPXj3TbTfE3bS+gUWBvf8AJiwMon99SbrwaARSA9mtGFGG02koEDJaGG8lYWMQQ5C + TkAuQp6HvAT5JuQG5C2IykQMKMBUQEEEo3oQ7QYl2g3gf0OD/w0gCANY3YCcYgD/G8D/ + BvC/AfxvAP8bwP8G8L8B/G8A/xswPLDUhtcIM23Aj6jiR6RIkEmM2FxBkCRzHAV9Aogy + CV91l44MDx8puRvtYuzgWrW6djDWaPlK9tSBdPrAqWyjnbiyOji4emUCbbm8eoWUkvng + OPzXDAte22R2OISrwU/8ZoeYobFW0VgLjbUNjbVYuhYaa6GxFhprobEWGmuhsRYaa6Gx + FhprobEWGmuhMeVmpDDiAQOmasFkpH0LtKd6iPpM4YH+DiQyiRMQOrJIYeL1rZnJyZn6 + Py++f/rs2dP8AtftrFRGOD8Iggjyc8vLZxv6vAh9fNih/KbCEkiP8sAiZhZuKwzRjbzb + hevdct6VFO0kaCc1tJOgnQTtJGgnQTsJ2knQToJ2ErSToJ0E7SRoJ0E7ifxJ7LbJTNDs + 4QwdUBmOsngX+oEHGEe+dng0RAtI0WqyFjUiUjXUNwlTix+K0a7WJq0g6A1Pt7U1C4LG + 6JC8w8XzJ2JvfbSz5OotUVTwlF1MdnVlk2Fje3J7tqurT3LrhPbjw4eW69/9yUhWSnUb + sCRYO4R4WUK8FNgLlKu9smU8WFgEhR+ZX8Y4+UixiQ02sTVsYoNNbPKTBbQTkBrkFOQS + 5BrkZcjrkJuQtyHk8X7gh0YtUkWDylmexokpdSwn9x/L5boG5jPiA9Dr1KzO/3VeiOw6 + kkstTMSl4dnq7LDk2z7s69lTEOeTM79USi1Np9Xrrt4Bz+5F/pNiNd/lTO/LpoYjTmt7 + dyIk9Xe32qLDvcOLgx5HeqaQGUu4bJauiF9MultHFTvthp1AOKiJ4UwqoMk2BiyaI2io + zxu8SjjWqSWBrAlYCyVYIJyhTgcKE+Hq4uLhoycWX1m/8mtc4H9Vzx9dWjpK7a9+5RqG + C977RDAIFtbHdrA3t1hJNVEJs+kJMJhNr1RTJWSyEjJZCRxWAoeVwGElcFgJHFYCh5XA + YSVwWAkcVgKHleAAuZoqgcNKcOMWFAqykox6C6DaDt90wTdxxEUc59RPoZ9Cn5h7hHyW + g8tpETksqFXNd624mYNo8DD1aSBycvI2cl9GUV+lKn26zNXSRdCbNI1qjUyDk/sJskkw + tBlt+kB+VIxNlYJCVTOetUX8dnffkOgfSnlcybKYXRAlv3ShPVyKWkMuS3dioLBd2KF1 + e7ihN+81tEd29BUiuvaAu9O5Ta/XtYv5uJQT20LRaIh3HGqPiI7m9m67L2Rr0RvJzwLb + Cdv3ws+dqCquo+qGMztxg9TthDrEF9Q2oW2CTRLom6AqXevAtQ5cM6HvVKLFiWhxNqLF + ia4TpnMi2JyIFieixYlocSJanIgWJ6LFiWhxIlqciBanHC00soiRRcqVBD6PSscUpFbW + Iy/NqnBkJu3RKJUgJQWdXrTwB/ZEDewRdlYFUySRtBZrxW5PsVbKztsFXjQHi/F4WWq3 + hEuxyKBkJQoZdXjbm6MTx3O545NxKcaN9cHweD7gz+4KB8dyAV+WAoMTVvl/A6siu7SF + bZ8SF24FnW6g0w10uoFON9DpBjrdQKcb6HQDnW6g0w10uoFON9DpbqDTDXS6YTZgzYGC + i4zvgLY67Ouor4NJGIxuRmu786S6nz8osjr4b89pw8W98cGnBj3ewcPFpfOmQ827hnoG + ghZzqJzIVvhiYmfcHptcGRg4NhZePVra4cuMBKWJfCCrYILi0QRMWIGJP1dyiB2q0VIo + H1KFSbu0AHz/2dUWHRhVqZGAKvQ7MUMnZqB+FP0ooBDDhtAuxy5djVMWpYTdhuRDi6Ma + ohtplvrdQEjusRpCS/XUo1umtP1Zc7AUexgM/EUZMwnbw5ipP4aF94V36v/p8FqbYzJi + dsfDsTE5nsh2GuDDABwc3kIGUDKMDUujjwoNG9qwfg6tqGpvRdtKdXWbSnykRxe8Tw93 + oc8xDPWpdAjSC4QBfxnQR/YUTbLzc/6sUhjZKSSy/A/qfyd0hDN+X0ZyHDhgHM1Gyz3t + nH9FsOcOj2Zqw0HBWz5cnrvAt3syPQ6HlP3jdL87ORhIrs4VesaPF4vL4z1zMjcneR36 + 9IA+v7fFEmqRkpCX1cgEyv4gDz3ycEcTXsvLXqJ9if22vAdJAEAJ2CSB2EggNhKIjQRi + I4HYSCA2EoiNBGIjgdhIIDYSjdhIIDYSMnP7MXdCHtcPXPgQEGSQMjG0CyOThVxYlp6l + 5b4e/Qjonq5HgIaQRbSLCRjrwYY53aBfSZStJt3fPSuFJ69Pc8dsaudT+c7ugYMD/bUO + wRIeiNoTkotXhZ7ByeDlC/8WzQdMltBApCcvmi0gFv7e7lgsve9YIrO4K9rbF4iNp7tb + bD5HdCBofvbrYmFMDI1s9/oyOwLB8QJqMwHfzBijPTZ9/4H9HmRYxa7EvaSpjvCulR9Q + gMSJBTNiNxWJ36hWheOrqwt3fypoiacejPnz9kKjVXlPoe6FKnjxI/jawUYf3cuYVJ4j + ptdA7FgRBV4HIRoeUeu+VlyyqtselaEtyrcIO1YoZ0O9mKlUreGClMpXLdGR9PmMIGjv + /pQHxWK8M99X/11+IDra7z6CrZxSF3RhPf/f9jbPOuNFv78YdzbaeV/lyGB5oeLzVRbK + g0cqPi4kJ/q7uvonksmJVFdXaiJZOD4RiUwcLxSWJqLRiSU4hrNBHPYKVny7kcifylaD + /LcN/tum7EVpD6JsVFvUnEoey4SRTDODVVt8PD0675V99OP+vVn3vFAawr+KOPMiD74L + 3wywP6Jin8amjwEK29HHgBT6PjlaU8rXwhRqg1SjNkgh26cQninUBinUBinUBinUBinU + BinUBinUBinUBinUBinUBim5NjAi5okxo2jtECP6JYr/rMqWWUwcUkvGEG42Mif1vWDN + nBznyi4SGw6lpn7ks0RTgxIuVIVgaSom7RuSupODPk+pz2vzSVZ7JNCB0ixQ2B0PjObE + /sm5yf7OUNzWlZI6f69vZ6S9LVxOhvr9Nr1+m7W7w+Zs07XY/M7kUKjNIual/rzXYg/4 + O71mncEhwWz4BMW7hVcRc8gWj0c+fc8hf+nREpc6oDP5jtjARmxA35LaVEqmrPHgCwwM + hQe1eNB+W2YJu2hPW7CfKPKMXCxY0pkb1bk5U3fSPyzZnCbtSUH7yiuT9e8G450tkxpD + exsfnoRnsagKfP0RaKWTzVABvE2m1FZM9/h6lYqQihiB8fsZQMnkD3EE7bWJlemLmp82 + CVQDK9sF5UNm2s4/epglCgdcgGD9jkIS/Ej92yAJV28fffDBIkBD/B2srwV54OFvNg9/ + hIHv7fhyxzN+u7+D/2n9Bi/VP8eDw8OTfG1A1lP5LyK79xv0Pf4JPy+uaYCuMKqNHkA3 + iuooCWD2I99kgMA8GwHrjrFdbJztZnvYPjaDL1JV5LlDbI4t4G2O/y/gCw9+OmR0Nje6 + Z3Z6Jja+cvriyoVTS8emVvAfW/a/k8SuQwplbmRzdHJlYW0KZW5kb2JqCjM1IDAgb2Jq + CjQ1MzUKZW5kb2JqCjM2IDAgb2JqCjw8IC9UeXBlIC9Gb250RGVzY3JpcHRvciAvQXNj + ZW50IDk1MiAvQ2FwSGVpZ2h0IDYyOSAvRGVzY2VudCAtMjEzIC9GbGFncyAzMgovRm9u + dEJCb3ggWy0zNDggLTIxNCAxMDg2IDk1Ml0gL0ZvbnROYW1lIC9YRUxSUFErSGVsdmV0 + aWNhTmV1ZSAvSXRhbGljQW5nbGUKMCAvU3RlbVYgMCAvTGVhZGluZyAyOCAvTWF4V2lk + dGggMTE0OCAvWEhlaWdodCA1MjYgL0ZvbnRGaWxlMiAzNCAwIFIgPj4KZW5kb2JqCjM3 + IDAgb2JqClsgMjc4IDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAg + MCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDY4NQo3MjIgNzA0IDYxMSA1NzQgNzU5 + IDAgMjU5IDAgMCA1NTYgMCA3MjIgNzYwIDY0OCAwIDY4NSA2NDggMCA3MjIgMCAwIDAg + MCAwCjAgMCAwIDAgMCAwIDUzNyA1OTMgNTM3IDU5MyA1MzcgMCA1NzQgMCAyMjIgMCAw + IDIyMiAwIDU1NiA1NzQgMCAwIDMzMyA1MDAKMzE1IDU1NiAwIDAgMCAwIDQ4MCBdCmVu + ZG9iagoxNiAwIG9iago8PCAvVHlwZSAvRm9udCAvU3VidHlwZSAvVHJ1ZVR5cGUgL0Jh + c2VGb250IC9YRUxSUFErSGVsdmV0aWNhTmV1ZSAvRm9udERlc2NyaXB0b3IKMzYgMCBS + IC9XaWR0aHMgMzcgMCBSIC9GaXJzdENoYXIgMzIgL0xhc3RDaGFyIDEyMiAvRW5jb2Rp + bmcgL01hY1JvbWFuRW5jb2RpbmcKPj4KZW5kb2JqCjM4IDAgb2JqCihNYWMgT1MgWCAx + MC42LjggUXVhcnR6IFBERkNvbnRleHQpCmVuZG9iagozOSAwIG9iagooRDoyMDExMDkw + OTE1NDczOVowMCcwMCcpCmVuZG9iagoxIDAgb2JqCjw8IC9Qcm9kdWNlciAzOCAwIFIg + L0NyZWF0aW9uRGF0ZSAzOSAwIFIgL01vZERhdGUgMzkgMCBSID4+CmVuZG9iagp4cmVm + CjAgNDAKMDAwMDAwMDAwMCA2NTUzNSBmIAowMDAwMDIzMjI4IDAwMDAwIG4gCjAwMDAw + MTc1NTEgMDAwMDAgbiAKMDAwMDAwMTY1MSAwMDAwMCBuIAowMDAwMDE3Mzg4IDAwMDAw + IG4gCjAwMDAwMDAwMjIgMDAwMDAgbiAKMDAwMDAwMTYzMSAwMDAwMCBuIAowMDAwMDAx + NzU1IDAwMDAwIG4gCjAwMDAwMTY0ODcgMDAwMDAgbiAKMDAwMDAwMjU0MCAwMDAwMCBu + IAowMDAwMDAzMTE5IDAwMDAwIG4gCjAwMDAwMDMxMzkgMDAwMDAgbiAKMDAwMDAwMzcx + OSAwMDAwMCBuIAowMDAwMDAxOTQwIDAwMDAwIG4gCjAwMDAwMDI1MjAgMDAwMDAgbiAK + MDAwMDAxNzM1MSAwMDAwMCBuIAowMDAwMDIyOTU1IDAwMDAwIG4gCjAwMDAwMTU1OTAg + MDAwMDAgbiAKMDAwMDAwMzczOSAwMDAwMCBuIAowMDAwMDA2ODY0IDAwMDAwIG4gCjAw + MDAwMDY4ODUgMDAwMDAgbiAKMDAwMDAwOTUwMyAwMDAwMCBuIAowMDAwMDA5NTI0IDAw + MDAwIG4gCjAwMDAwMTI3NzUgMDAwMDAgbiAKMDAwMDAxMjc5NiAwMDAwMCBuIAowMDAw + MDE1NTY5IDAwMDAwIG4gCjAwMDAwMTU2MjcgMDAwMDAgbiAKMDAwMDAxNjQ2NyAwMDAw + MCBuIAowMDAwMDE2NTIzIDAwMDAwIG4gCjAwMDAwMTczMzEgMDAwMDAgbiAKMDAwMDAx + NzQ3MSAwMDAwMCBuIAowMDAwMDE3NzE0IDAwMDAwIG4gCjAwMDAwMTc1OTkgMDAwMDAg + biAKMDAwMDAxNzY5MiAwMDAwMCBuIAowMDAwMDE3ODA3IDAwMDAwIG4gCjAwMDAwMjI0 + MzIgMDAwMDAgbiAKMDAwMDAyMjQ1MyAwMDAwMCBuIAowMDAwMDIyNjkzIDAwMDAwIG4g + CjAwMDAwMjMxMzQgMDAwMDAgbiAKMDAwMDAyMzE4NiAwMDAwMCBuIAp0cmFpbGVyCjw8 + IC9TaXplIDQwIC9Sb290IDMwIDAgUiAvSW5mbyAxIDAgUiAvSUQgWyA8ODBlNzY3MTk3 + ZTU5OGIxYTliMTQxNDdjZjU1YWMxNjE+Cjw4MGU3NjcxOTdlNTk4YjFhOWIxNDE0N2Nm + NTVhYzE2MT4gXSA+PgpzdGFydHhyZWYKMjMzMDMKJSVFT0YKMSAwIG9iago8PC9BdXRo + b3IgKFVscmljaCB2b24gWmFkb3cpL0NyZWF0aW9uRGF0ZSAoRDoyMDExMDkwOTE1MTEw + MFopL0NyZWF0b3IgKE9tbmlHcmFmZmxlIDUuMy4yKS9Nb2REYXRlIChEOjIwMTEwOTA5 + MTUyNTAwWikvUHJvZHVjZXIgMzggMCBSIC9UaXRsZSAoUmVjb2duaXplci5ncmFmZmxl + KT4+CmVuZG9iagp4cmVmCjEgMQowMDAwMDI0MjYxIDAwMDAwIG4gCnRyYWlsZXIKPDwv + SUQgWzw4MGU3NjcxOTdlNTk4YjFhOWIxNDE0N2NmNTVhYzE2MT4gPDgwZTc2NzE5N2U1 + OThiMWE5YjE0MTQ3Y2Y1NWFjMTYxPl0gL0luZm8gMSAwIFIgL1ByZXYgMjMzMDMgL1Jv + b3QgMzAgMCBSIC9TaXplIDQwPj4Kc3RhcnR4cmVmCjI0NDQwCiUlRU9GCg== + + QuickLookThumbnail + + TU0AKgAACFaAP+BP8AQWDQeEQmFQuGQ2HQ+IRGJROKRWLQ1vxkAQMAAGPReKRx+SMACG + TAACymQSuCwOCSyYTGZTOaTWISN+ABrTsABefR2PzaExx5UUAAykAAM0uhRGXU2oVGpV + OZPqrABr1kACSuAAB1+gAGERyOR6xQezQx+2sAOS3AAFXEABy6VSF0+7Xm9XuqPm/ABs + 4EACjCSiVQtqYkAO3GAAG48ABTJAAPZW1WxwZkAAfOAAO5++Qa8aHSaXTRO/PkANrWYP + CykC2OBABubUAOfcV6wCDeAAN7/Lv0AZlwAADcfPaDSaPT83nc7U4DBYQUYbYwt79kAd + GD5wDgAE+Hg8PNd7kh3S8zn+v2XmrPoAMn5XO62mvgOEP79RvZ2iPgFADxnNAYAA/Azf + OA5aOPbBkGqgnAAHRCQAOye4AP0fwAARDaIHxDwAF1EIACdEiEFjE4ABtFQAAxFsEA26 + z0wWiq1uEZ0bgACMdLCqiOHrH4AAfIQAN4EEHPbDDtr+jkNgQih7SgAB4SnFkXQAASEP + eAEarguS0wU/qKwq8jiqWDIASvHrZnfNgAS0E04SO5p9zoAEIPNNKLygezNs7LjjgMhk + ky1NNAL29SHI5Dx8AAcVHAAEdIt0/CFymeAAKKeQAAnTgAR+eoAAtUVBP23Bz09IE4BN + Hk5KijjovvGKDnHWjzoQelcAAAldw1Dk9vA8VF2ABKEVMyLJy5NMk0NPKhUQhtFQ/Whx + 0hSVYoOjj5GStq3p8C7jOQG9xVJDNjVwegAVVVlWpojkxvNWJq3lRtHskCgAHTfMeTof + cugVTdOhTgV/Qo7VtT6760nZhYABnhylKZJLothXVeXbGaIWjRlp2qEdJtkgh55FTCjT + SBeTgAB2VXWgsk3NXN1S/diWXc7Tw2JmSo1+uN/2FJqY5rC14LAmFnoZjUyPoDmKgI8c + uIPWNroVJOFnZgsLBPrOWZmi7o13pupLtX+KIPsiZ6RPEAovoyH2FeRq6ZrcIPtoiDSS + bu8AAEu95AAF+Vtb2uZo2dhZuva3HIABocWAAh8dXsnZymsub/n+14wicuQhuaP7/JLz + Lu2ZedGAAidNHiOUK5Gw8EisIIPr6ISSZvabjyXQoJLWKWaobZzGF3gKOpKJ3ezveYzz + CZwhLnQIliS/8NbDZy52KHrKoPBa9XnWIXLSsmvAsD+OpqOQkdHhAZF6Kb+tPqoltiWZ + 9DiYQhJJjfuAFf7/LQIf7HjVVhgACfAN1oAFhHmduQo6JgRst6b4eZJLySHFpgo51OrH + DzGfPQRN+p+1DETHjCEf7eBugAgAvaAyH0tLnWOvdcQN03FXg+4Mgh0XLOCGnDlHixlD + JJf6BBKSVDzAxiJAE1BfzWDaNcdV2IxInAAZEPNOxJE2DvRir8EUWUiG9iyCJLZmDNKG + g0RRJJjB2r4X1AAx4DTFmNCNG+L4/R/jrjowRJKwkkpccMpwCcKVGQ3JWRxLUSWSKaS4 + RwHUiVZGhjMwiKDI2KN/kinVNLKgHOQa2Qs6MhDqNxkbCEeIAIWK/UM9ppsY0zRxaTGI + 5REnNkkUy3Ejiv4xvwJW54/bzSKymiCpdqJYFfqiAtJmApCVhLMbUQ6BZgmsgnXAoFLi + XEkpJIWWlijsUIDhm1I6McHCSOwYs++CRNUtEZG+ACZpEH2EffdMUpqWpfqUIcloY89U + gpDgSQ1JL4yHDun8AAFlAQAAVoIRRMbP58tHnGRObQ4SEOSdGLx0rpyHpahmS02ZHHAv + Rnc5ktidzOkPjuh9ZMySIs7LlSI/aaXDT8ISoMq8gCQ0LIchAb1N2UsrNI39v8XaOkgo + OhyhJTaUL/L08U79LnkJhoMdqcytnj00IVQkjkADozpp+RZLiWqOENiiQg8yhqLHIjwf + tnhUKRqMaHPKQNUm+rCUcOJjrH6GyPikkktMuEMwoh+ACvrLjcqfXSnGodWTx2CjWjxE + 4sacyXR0BEAFTyD2JliBqywAHgAuYITSrdMahPYJlLat60laqRY8mlt7+UoyjtWrlJIE + rYQOBLXOwCp4WMxtBYZGhbHdEqnaTGopMTuEGUNYWttTHrOEtItS0yaEAparKhmQ9yHY + uGZ/bWUTMLCW5t05d3JVyOTISwnpKNZyJvPNU7FsxdrRPSIIsKEljbnJYLJcit183UGz + sERyTtxrukXs6fC9RhyHJchYkIB5EEtLLORUoqd7SFJaQGOaVWDmzmzSTZYDVm7/l7TG + KLEAAAz4jIYOXEwAEbjOAAE3FhDFhOqUCezCDvSCTSP3f5ops32q8xxh0i7s3a4IlVb8 + mFJUsSgrnbACSMrkY+ycXZLVqSTAhR5j0iqSXzPoaVkwl+T8vF9L/AydDWlDSxyRYlMb + ZSVWCRaBiR02ZtwZlaXzGeX87NdiQa2TrFLUm1G5M825uSDsnAWhc/YNdEFbK6lw4mgJ + umhzrnfSREpN56NfmtIFX69H8y6QV2NjwAaElVo2VkG9IX30nqkiMy4G5TkdNM/eqCDK + xTS39jmotH501lqrXj3SrjP2AjHK1wEo0BBZPfBKYNO692Y84/Z0UubDu9fhn+FlXa72 + btnbRFtI7b29t+hWTSE5iIO4ZCGoktSxlSxxn9iUuM/sEmlLV1z9kHjHtKw2YlY6iI5h + NUKoykPpS1qLJHAQADK4RZh4LzDOpjLTMc5E1iVYZsu+StzixoKoVAlrJCBgPgAhyNOg + dBY+aGQzVYv9BAK6cjbGfgzlUOOvIMD3mmHNVYpj9KrMpRiOZI1csZNNPho9Dr8/4g+S + gAYmHKQjUDsc/AABh1EAEdB1gACL1cqG3ddEEHV10npP9wY+yQeamRzSAgAOAQAAAwAA + AAEATgAAAQEAAwAAAAEAKwAAAQIAAwAAAAQAAAkEAQMAAwAAAAEABQAAAQYAAwAAAAEA + AgAAAREABAAAAAEAAAAIARIAAwAAAAEAAQAAARUAAwAAAAEABAAAARYAAwAAAAEAKwAA + ARcABAAAAAEAAAhOARwAAwAAAAEAAQAAAT0AAwAAAAEAAgAAAVIAAwAAAAEAAQAAAVMA + AwAAAAQAAAkMAAAAAAAIAAgACAAIAAEAAQABAAE= + + ReadOnly + NO + RowAlign + 1 + RowSpacing + 36 + SheetTitle + Canvas 1 + SmartAlignmentGuidesActive + YES + SmartDistanceGuidesActive + YES + UniqueID + 1 + UseEntirePage + + VPages + 1 + WindowInfo + + CurrentSheet + 0 + ExpandedCanvases + + + name + Canvas 1 + + + Frame + {{476, 121}, {693, 937}} + ListView + + OutlineWidth + 142 + RightSidebar + + ShowRuler + + Sidebar + + SidebarWidth + 120 + VisibleRegion + {{0, 0}, {558, 783}} + Zoom + 1 + ZoomValues + + + Canvas 1 + 1 + 1 + + + + saveQuickLookFiles + YES + + diff --git a/sphinxdoc/Recognizer.png b/sphinxdoc/Recognizer.png new file mode 100644 index 0000000..e3a7d96 Binary files /dev/null and b/sphinxdoc/Recognizer.png differ diff --git a/sphinxdoc/ToggleButtonStates.png b/sphinxdoc/ToggleButtonStates.png new file mode 100644 index 0000000..2bd1002 Binary files /dev/null and b/sphinxdoc/ToggleButtonStates.png differ diff --git a/sphinxdoc/animation.rst b/sphinxdoc/animation.rst new file mode 100644 index 0000000..84538b1 --- /dev/null +++ b/sphinxdoc/animation.rst @@ -0,0 +1,252 @@ +Animation +========= + +.. automodule:: libavg.avg + :no-members: + + .. inheritance-diagram:: AnimState ContinuousAnim EaseInOutAnim LinearAnim ParallelAnim StateAnim WaitAnim + :parts: 1 + + .. autoclass:: Anim + + Base class for all animations. + + .. py:method:: setStartCallback(pyfunc) + + Sets a python callable to be invoked when the animation starts. + Corresponds to the constructor parameter startCallback. + + .. py:method:: setStopCallback(pyfunc) + + Sets a python callable to invoke when the animation has + finished running. Corresponds to the constructor parameter stopCallback. + + .. py:method:: abort + + Stops the animation. + + .. py:method:: start(keepAttr) + + Starts the animation. + + :param keepAttr: + + If this parameter is set to :py:const:`True`, the animation doesn't + set the attribute value when starting. Instead, it calculates a virtual + start time from the current attribute value and proceeds from there. + + .. py:method:: isRunning + + Returns :py:const:`True` if the animation is currently executing. + + .. autoclass:: AnimState(name, anim, nextName="") + + One state of a :py:class:`StateAnim`. + + :param name: + + The name of the state. Used in :py:meth:`StateAnim.setState` and + :py:meth:`StateAnim.getState()`. + + :param anim: The child animation to run when this state is active. + + :param nextName: The name of the state to enter when this state is done. + + .. autoclass:: AttrAnim + + .. autoclass:: ContinuousAnim(node, attrName, startValue, speed, [useInt=False, startCallback=None, stopCallback=None]) + + Class that animates an attribute of a libavg node continuously and + linearly. The animation will not stop until the :py:meth:`abort()` method is + called. + + A possible use case is the continuous rotation of an object. + + :param node: The libavg node object to animate. + + :param attrName: + + The name of the attribute to change. + + :param startValue: Initial value of the attribute. + + :param speed: Attribute change per second. + + :param useInt: + + If :py:const:`True`, the attribute is always set to an integer value. + + :param startCallback: Python callable to invoke when the animation starts. + + :param stopCallback: + + Python callable to invoke when the animation has + finished running, either because abort was called or because + another animation for the same attribute was started. + + .. autoclass:: EaseInOutAnim(node, attrName, duration, startValue, endValue, easeInDuration, easeOutDuration, [useInt=False, startCallback=None, stopCallback=None]) + + Class that animates an attribute of a libavg node. The animation proceeds + in three phases: ease-in, linear and ease-out. Start and end speed are + zero. Ease-in and ease-out phases have the shape of one quadrant of the + sine curve. + + :param node: The libavg node object to animate. + + :param attrName: + + The name of the attribute to change. + + :param duration: The length of the animation in milliseconds. + + :param startValue: Initial value of the attribute. + + :param endValue: Value of the attribute after duration has elapsed. + + :param easeInDuration: The duration of the ease-in phase in milliseconds. + + :param easeOutDuration: + + The duration of the ease-out phase in milliseconds. + + :param useInt: + + If :py:const:`True`, the attribute is always set to an integer value. + + :param startCallback: Python callable to invoke when the animation starts. + + :param stopCallback: + + Python callable to invoke when the animation has + finished running, either because it has run the allotted time, because + abort was called or because another animation for the same + attribute was started. + + .. autoclass:: LinearAnim(node, attrName, duration, startValue, endValue, [useInt=False, startCallback=None, stopCallback=None]) + + Class that animates an attribute of a libavg node by interpolating + linearly between start and end values. + + :param node: The libavg node object to animate. + + :param attrName: + + The name of the attribute to change. + + :param duration: The length of the animation in milliseconds. + + :param startValue: Initial value of the attribute. + + :param endValue: Value of the attribute after duration has elapsed. + + :param useInt: + + If :py:const:`True`, the attribute is always set to an integer value. + + :param startCallback: Python callable to invoke when the animation starts. + + :param stopCallback: + + Python callable to invoke when the animation has + finished running, either because it has run the allotted time, because + abort was called or because another animation for the same + attribute was started. + + .. autoclass:: ParallelAnim(anims, [startCallback, stopCallback, maxAge]) + + Animation that executes several child animations at the same time. The + duration of the ParallelAnim is the maximum of the child's durations or + maxAge, whatever is shorter. + + :param anims: A list of child animations. + + :param startCallback: Python callable to invoke when the animation starts. + + :param stopCallback: + + Python callable to invoke when the animation has + finished running, either because it has run the allotted time or because + abort was called. + + :param maxAge: The maximum duration of the animation in milliseconds. + + .. py:method:: start(keepAttr) + + Starts the animation by calling :py:meth:`start` for each of the child + animations. + + :param keepAttr: + + This parameter is passed to the child animations. + + .. autoclass:: SimpleAnim + + Base class for animations that change libavg node attributes by + interpolating over a set amount of time. If :py:meth:`Anim.abort()` isn't needed, + there is no need to hold on to the animation object after calling + :py:meth:`Anim.start` - it will exist exactly as long as the animation lasts and + then disappear. + + The animation framework makes sure that only one animation per attribute + of a node runs at any given time. If a second one is started, the first + one is aborted. + + .. autoclass:: StateAnim(states) + + Animation that executes one of several child animations depending on its + current state. The state can be None, in which case no animation is + executed. None is the initial state. Note that changing the state of an + animation during a start or stop callback of a child animation is not + possible. An attempt to do so is silently ignored. + + :param states: A list of AnimState objects. + + .. py:method:: getState + + .. py:method:: setDebug(debug) + + Setting this to :py:const:`True` causes all state changes to be printed on + the console. + + .. py:method:: setState + + .. autoclass:: WaitAnim([duration=-1, startCallback, stopCallback]) + + + Animation that simply does nothing for a specified duration. Useful + in the context of StateAnims. + + :param duration: The length of the animation in milliseconds. + + :param startCallback: Python callable to invoke when the animation starts. + + :param stopCallback: + + Python callable to invoke when the animation has + finished running, either because it has run the allotted time or because + abort was called. + + .. py:method:: start + + .. autofunction:: fadeIn(node, duration, [max=1.0, stopCallback]) + + Fades the opacity of a node. + + :param node: The node to fade. + :param duration: Length of the fade in milliseconds. + :param max: The opacity of the node at the end of the fade. + :param stopCallback: Function to call when the fade is over. + + .. autofunction:: fadeOut(node, duration, [stopCallback]) + + Fades the opacity of a node to zero. + + :param node: The node to fade. + :param duration: Length of the fade in milliseconds. + :param stopCallback: Function to call when the fade is over. + + .. autofunction:: getNumRunningAnims() -> int + + Returns the total number of running attribute-based animations (this + includes LinearAnim, EaseInOutAnim and ContinuousAnim). Useful for + debugging memory leaks. diff --git a/sphinxdoc/app.rst b/sphinxdoc/app.rst new file mode 100644 index 0000000..2fe03d1 --- /dev/null +++ b/sphinxdoc/app.rst @@ -0,0 +1,217 @@ +app module +========== + +.. automodule:: libavg.app + + .. note:: + + The app package is experimental. Functionality and interface are still in flux and + subject to change. + + .. autoclass:: App + + This class handles global application affairs. Among these are setting up a root + node along with window size (and possibly screen resolution) and screen + rotation, and creating an environment for the user's :py:class:`MainDiv`. + Global user interface items such as a debug panel and keyboard manager are also + set up. Additionally, :py:class:`App` handles configuration settings and command + line argument support. + + :py:class:`App` usually does not need to be subclassed. Instead, subclass + :py:class:`MainDiv` and pass an instance of the derived class to :py:meth:`run()`. + + .. py:attribute:: debugPanel + + An instance of debugpanel.DebugPanel. + + .. py:attribute:: mainDiv + + The instance passed as first argument of the :py:meth:`run()` method. + + .. py:attribute:: overlayPanel + + DivNode that stands always on top of the MainDiv. + + .. py:attribute:: settings + + An instance of settings.Settings. + + .. py:method:: dumpTextObjectCount() + + Dumps on the console the current number of initialized objects. Normally + bound to the keypress :kbd:`CTRL-b`. + + .. py:method:: onBeforeLaunch() + + Called just before starting the main loop (:samp:`Player.play()`). Useful only + for subclassing. The display hasn't been initialized at this point. + + .. py:method:: run(mainDiv, **kargs) + + Starts the application using the provided :py:attr:`mainDiv` (an instance of + :py:class:`MainDiv`). + + The optional additional kargs are used to set default settings - see + :py:class:`settings.Settings`. + + .. py:method:: takeScreenshot(targetFolder='.') + + Takes a screenshot of what is currently visible on the screen. Normally + bound to the keypress :kbd:`CTRL-p`. Screenshots are saved to the disk under + the name 'App-nnn.png', where nnn is a sequence number. + + + .. autoclass:: MainDiv + + This abstract class must be subclassed to write a libavg application. It is the + main application entry point and should be the parent node for all + application-created nodes. All the public methods are empty and don't do anything + if not overridden. + + .. py:attribute:: VERSION + + A version string. This is shown using the :option:`-v` or :option:`--version` + command-line option. + + .. py:method:: onArgvParsed(options, args, parser) + + This method is called after command-line arguments have been parsed and should + be used to retrieve any application-specific options. The arguments + :py:attr:`options` and :py:attr:`args` are the result of calling + :samp:`options, args = parser.parse_args()`, where parser is an instance of + :py:class:`optparse.OptionParser` configured by calling + :py:meth:`onArgvParserCreated`. + + .. py:method:: onArgvParserCreated(parser) + + Called with an empty :py:class:`optparse.OptionParser` instance. Allows the + application to add additional command line options. :py:class:`App` adds it's + own parameters as well. If this is overridden, :py:meth:`onArgvParsed()` + should probably be overridden as well. + + .. py:method:: onExit() + + Called after the main loop exits. + Release resources and run cleanups here. + + .. note:: + + onExit() doesn't get called if an exception is raised on the main thread. + + .. py:method:: onFrame() + + Called every frame. + + .. py:method:: onInit() + + Called by a libavg timer as soon as the main loop starts. At this point in + time, the window has been created and all render functions are available. + Build the application node tree here. + + .. py:method:: onStartup() + + Called before libavg has been setup, just after the :samp:`App().run()` call. + The window has not been created at this time. + + +keyboardmanager Module +---------------------- + +.. automodule:: libavg.app.keyboardmanager + :no-members: + + This module makes it possible to attach event handlers to individual keypresses. + Keys that are bound through the keyboard manager are also be shown in the debug panel + via the keyboard bindings widget along with their help string. + :py:class:`libavg.app.App` defines a range of keyboard bindings by default. + The keyboardmanager is usually set up by :py:class:`libavg.app.App`. + :py:class:`libavg.app.App` also reserves all keys modified by :kbd:`CTRL`. + + For all the binding methods, keystring can be a python string or a unicode object. + Plain strings are matched to :py:attr:`libavg.avg.KeyEvent.keystring`, while unicode + objects are matched to :py:attr:`libavg.avg.KeyEvent.unicode`. The modifiers are + described under :py:attr:`libavg.avg.KeyEvent.modifiers`, with the additional modifiers + :py:const:`KEYMOD_SHIFT`, :py:const:`KEYMOD_CTRL` and :py:const:`KEYMOD_ALT` available + to simplify checking for left and right modifier keys at one time. + + .. py:function:: bindKeyDown(keystring, handler, help, modifiers=avg.KEYMOD_NONE) + + Sets up a key handler so that :py:attr:`handler` is called whenever + :py:attr:`keystring` is pressed. + + .. py:function:: bindKeyUp(keystring, handler, help, modifiers=avg.KEYMOD_NONE) + + Sets up a key handler so that :py:attr:`handler` is called whenever + :py:attr:`keystring` is released. + + .. py:function:: disable() + + Companion to :py:meth:`enable()`, disables all handlers. + + .. py:function:: enable() + + Companion to :py:meth:`disable()`, enables all handlers. + + .. py:function:: getCurrentBindings() + + Returns the currently assigned bindings as a list of named tuples. + + .. py:function:: init() + + Called by :py:class:`App`. Should not be called by user programs. + + .. py:function:: pop() + + Companion to :py:meth:`push()`, restores the non-modified key bindings + previously pushed onto the stack via :py:meth:`push()`. + + .. py:function:: push() + + Pushes all the non-modified key bindings onto a stack and clears them all. + Useful when the application flow branches to a state where a different key + bindings set is needed. The bindings can be then restored with :py:meth:`pop()`. + + .. py:function:: unbindAll() + + Removes all the defined key bindings at once. + + .. py:function:: unbindKeyDown(keystring, modifiers=avg.KEYMOD_NONE) + + Removes a previously defined key binding for a KEY_DOWN event. + + .. py:function:: unbindKeyDown(keystring, modifiers=avg.KEYMOD_NONE) + + Removes a previously defined key binding for a KEY_UP event. + + +flashmessage Module +------------------- + +.. automodule:: libavg.app.flashmessage + :no-members: + + .. autoclass:: FlashMessage(text, timeout=DEFAULT_TIMEOUT, parent=None, isError=False, acknowledge=False) + + A :py:class:`FlashMessage` is an easy way to show debug notification and similar + text in the libavg window. The message can have an optional timeout or stay + visible until clicked on by the user. It inserts itself into node tree at the top. + Multiple :py:class:`FlashMessage` instances are shown in the order they get + created. + + :param timeout: The time in milliseconds the message should persist on screen + before it gets removed. Only valid if :py:attr:`acknowledge` is + :py:const:`False`. + + :param parent: When specified, the parent node the message should be appending + itself to. + + :param isError: A boolean flag to mark the message as error. Error-flagged + messages are shown in a different color and are routed to the + logger as well. + + :param acknowledge: A flag to indicate whether the message should remove itself + automatically (after timeout has elapsed) or needs to be acknowledged + by the user (by clicking / touching on it). + + + diff --git a/sphinxdoc/areanodes.rst b/sphinxdoc/areanodes.rst new file mode 100644 index 0000000..9bd54a3 --- /dev/null +++ b/sphinxdoc/areanodes.rst @@ -0,0 +1,831 @@ +Area Nodes +========== + +.. automodule:: libavg.avg + :no-members: + + .. inheritance-diagram:: AVGNode AreaNode CameraNode CanvasNode DivNode ImageNode Node RasterNode SoundNode VideoNode WordsNode + :parts: 1 + + .. autoclass:: AreaNode([x, y, pos, width, height, size, angle, pivot]) + + Base class for elements in the avg tree that define an area on the screen. + Responsible for coordinate transformations and event handling. See + http://www.libavg.de/wiki/ProgrammersGuide/CoordinateSystems + for an explanation of coordinate systems and reference points. + + .. py:method:: getMediaSize() -> avg.Point2D + + Returns the size in pixels of the media in the node. Image nodes + return the bitmap size, Camera nodes + the size of a camera frame and Words nodes the amount of space + the text takes. Video nodes return the video size if decoding has + started or (0,0) if not. Decoding starts after :py:func:`play` or + :py:func:`pause` + is called and the node can be rendered. + + .. py:attribute:: x + + This is the horizontal position of the node's reference point + relative to its parent node. + + .. py:attribute:: y + + This is the vertical position of the node's reference point + relative to its parent node. + + .. py:attribute:: pos + + This is the position of the node's reference point + relative to its parent node. + + .. py:attribute:: width + + .. py:attribute:: height + + .. py:attribute:: angle + + The angle that the node is rotated to in radians. 0 is + unchanged, 3.14 is upside-down. + + .. py:attribute:: size + + The size that the node takes on the canvas. Node types usually have sensible + defaults for the size. For media nodes, this is generally the size of the + media (so :samp:`size == getMediaSize()`). For DivNodes, the default size is + infinite. + + .. py:attribute:: pivot + + The position of the point that the node is rotated around. + Default is the center of the node. + + + .. autoclass:: AVGNode() + + Root node of an onscreen avg tree. Defines the properties of the display + and handles key press events. The AVGNode's width and height define the + coordinate system for the display and are the default for the window + size used (i.e. by default, the coordinate system is pixel-based). + + + .. autoclass:: CameraControl + + Camera controls are camera configuration parameters like brightness and white + balance. A CameraControl object contains information about the supported maximum + and minimum values as well as defaults for a specific control. + + .. py:attribute:: controlName + + String which tells which control is meant. Read-only. + + .. py:attribute:: default + + .. py:attribute:: max + + .. py:attribute:: min + + .. autoclass:: CameraImageFormat + + CameraImageFormat objects contain information about a supported + image format of a camera. + + .. py:attribute:: framerates + + List of supported frame rates in images per second for that image format as + floats. Read-only. + + .. py:attribute:: pixelFormat + + String which tells about the pixel format (see :py:class:`Bitmap`). Read-only. + + .. py:attribute:: size + + A point which represents the resolution in width and height. Read-only. + + .. autoclass:: CameraInfo + + CameraInfo objects contain data about camera capabilities. The data can be used + to create create objects of class :py:class:`CameraNode`. The unique value to + identify the camera is stored in :py:attr:`device`, whereas :py:attr:`driver` + tells which driver is used to call the camera itself. Information about supported + camera :py:attr:`controls` or :py:attr:`imageFormats` are stored + in two separate lists. + + .. py:attribute:: controls + + List of :py:class:`CameraControl` objects with all possible controls for + that camera. Read-only. + + .. py:attribute:: device + + String which contains the unique id of the camera. Read-only. + + .. py:attribute:: driver + + String which contains the name of the driver. Read-only. + + .. py:attribute:: imageFormats + + List of :py:class:`CameraImageFormat` objects with all possible image + formats for that camera. Read-only. + + .. autoclass:: CameraNode([driver='firewire', device="", unit=-1, fw800=False, framerate=15, capturewidth=640, captureheight=480, pixelformat="RGB", brightness, exposure, sharpness, saturation, camgamma, shutter, gain, strobeduration]) + + A node that displays the image of a camera. The attributes correspond to the + camera properties in .avgtrackerrc and are explained under + http://www.libavg.de/wiki/ProgrammersGuide/Tracker. An easy way to find the + appropriate parameters for your camera is to use :command:`avg_showcamera.py`. + + CameraNodes open the camera device on construction and set the chosen camera + parameters immediately. + + .. py:attribute:: brightness + + .. py:attribute:: camgamma + + .. py:attribute:: device + + Read-only. + + .. py:attribute:: driver + + Read-only. + + .. py:attribute:: framenum + + The number of frames the camera has read since playback started. Read-only. + + .. py:attribute:: framerate + + Read-only. + + .. py:attribute:: gain + + .. py:attribute:: saturation + + .. py:attribute:: sharpness + + .. py:attribute:: shutter + + .. py:attribute:: strobeduration + + .. py:method:: doOneShotWhitebalance() + + .. py:method:: getBitmap() -> Bitmap + + Returns a copy of the last camera frame. + + .. py:method:: getWhitebalanceU() -> int + + .. py:method:: getWhitebalanceV() -> int + + .. py:method:: isAvailable() -> bool + + Returns :py:const:`True` if there is a working device that can deliver images + attached to the CameraNode. + + .. py:method:: play() + + Starts reading images from the camera device and displays them. Note that the + camera device is opened on construction of the CameraNode. + + .. py:method:: setWhitebalance(u, v) + + .. py:method:: stop() + + Stops camera playback. + + .. py:classmethod:: getCamerasInfos() + + Returns a list of :py:class:`CameraInfo` objects, one for for each connected + camera. + + .. py:classmethod:: resetFirewireBus() + + Frees all allocated bandwidth and devices on the firewire bus. Helpful + if a program using a firewire device has crashed leaving resources + allocated. Note that all firewire devices (including for instance + external hard drives) are affected. + + .. autoclass:: CanvasNode + + Root node of a scene graph. + + .. autoclass:: DivNode([crop=False, elementoutlinecolor, mediadir]) + + A div node is a node that groups other nodes logically and visually. + Its position is used as point of origin for the coordinates + of its child nodes. Its extents can be used to clip the children if crop is set + to :py:const:`True`. Its opacity is used as base opacity for the child nodes' + opacities. The children of a div node are drawn in the order they are found + in the avg file, so the first one is below all others in z-order. + + .. py:attribute:: crop + + Boolean that turns clipping on or off. + + .. py:attribute:: elementoutlinecolor + + Allows debugging of div node nesting by rendering the outlines of + this div and all its div children in the specified color (given in html hex + format). Turn off by setting the color to the empty string. + + .. py:attribute:: mediadir + + .. deprecated:: 1.7 + Seldom used, error-prone and slow. + + The directory that the media files for the children of this node are + in. Relative mediadirs are taken to mean subdirectories of the parent node's + mediadir. + + .. py:method:: getNumChildren() -> int + + Returns the number of immediate children that this div contains. + + .. py:method:: getChild(i) -> Node + + Returns the child at index :py:attr:`i`. + + .. py:method:: appendChild(node) + + Adds a new child to the container behind the last existing child. + + .. py:method:: insertChildBefore(newNode, oldChild) + + Adds a new child to the container before the existing node + :py:attr:`oldChild`. In z-order, the new child ist behind the old one. + + .. py:method:: insertChildAfter(newNode, oldChild) + + Adds a new child to the container after the existing node + :py:attr:`oldChild`. In z-order, the new child ist in front of the old one. + + .. py:method:: insertChild(node, i) + + Adds a new child to the container at index :py:attr:`i`. + + .. py:method:: removeChild(node) + + Removes the child given by :py:attr:`node` from the div. Note that as long as + other references to the node exist, the node is not deleted. + + .. py:method:: removeChild(i) + + Removes the child at index :py:attr:`i` from the div. Note that as long a` + other references to the node exist, the node is not deleted. + + .. py:method:: reorderChild(oldIndex, newIndex) + + Moves the child at :py:attr:`oldIndex` so it is at :py:attr:`newIndex`. This + function can be used to change the order in which the children are drawn. + + .. py:method:: reorderChild(node, newPos) + + Moves the child :py:attr:`node` so it is at index :py:attr:`newPos`. This + function can be used to change the order in which the children are drawn. + + .. py:method:: indexOf(node) + + Returns the index of the node given. Throws an exception if :py:attr:`node` + isn't a child of the :py:class:`DivNode`. + + .. py:method:: getEffectiveMediaDir() -> string + + Returns the node's effective mediadir by traversing the node + hierarchy up to the root node. + + .. autoclass:: ImageNode([href, compression]) + + A static raster image on the screen. The content of an ImageNode can be loaded + from a file. It can also come from a :py:class:`Bitmap` object or from an + :py:class:`OffscreenCanvas`. Alpha channels of the image files are used as + transparency information. + + .. py:attribute:: compression + + The texture compression used for this image. Currently, :py:const:`none` + and :py:const:`B5G6R5` are supported. :py:const:`B5G6R5` causes the bitmap + to be compressed to 16 bit per pixel on load and is only valid if the source + is a filename. Read-only. + + .. py:attribute:: href + + In the standard case, this is the source filename of the image. To use a + bitmap as source, call setBitmap(). To use an offscreen canvas as source, + use the :samp:`canvas:` protocol: :samp:`href="canvas:{id}"`. + + .. py:method:: getBitmap() -> Bitmap + + Returns a copy of the bitmap that the node contains. + + .. py:method:: setBitmap(bitmap) + + Sets a bitmap to use as content for the ImageNode. Sets href to an empty + string. + + .. autoclass:: RasterNode([maxtilewidth, maxtileheight, blendmode, mipmap, maskhref, maskpos, masksize, gamma, contrast, intensity]) + + Base class for all nodes that have a direct 2D raster representation. + This includes Image, Word, Camera, and Video nodes. The base class implements + color controls (:py:attr:`contrast`, :py:attr:`intensity`, :py:attr:`gamma`), + alpha masks (:py:attr:`maskhref`, :py:attr:`maskpos`, :py:attr:`masksize`), + several blend modes that define how compositing is done and mipmapping support. + + Any Raster Node can have a GPU-based effect added to it by using + :py:meth:`setEffect`. + + In addition, RasterNodes can be warped. By default, a RasterNode is rectangular. + However, it can be subdivided into a grid of reference points using + :py:attr:`maxtilewidth` and :py:attr:`maxtileheight`. The position of each of + these points can be changed with :py:meth:`getOrigVertexCoords`, + :py:meth:`getWarpedVertexCoords` and :py:meth:`setWarpedVertexCoords`, + yielding arbitrary shapes. + + .. py:attribute:: blendmode + + .. deprecated:: 1.7 + + The min and max blend modes will be removed. + + The method of compositing the node with the nodes under + it. Valid values are :py:const:`blend`, :py:const:`add`, :py:const:`min` + and :py:const:`max`. For :py:const:`min` and :py:const:`max` + blend modes, opacity is ignored. + + .. py:attribute:: contrast + + A control for the color contrast of the node. contrast is a triple + that contains separate float values for red, green, and blue. A contrast + value of 1.0 in all channels leaves the image unchanged. + + .. py:attribute:: gamma + + Allows node-specific gamma correction. gamma is a triple that + contains separate float values for red, green, and blue. A gamma value of + 1.0 in all channels leaves the image unchanged. Higher gamma values + increase, lower values decrease the brightness. In all cases, black and + white pixels are not affected by gamma. See also + http://en.wikipedia.org/wiki/Gamma_correction. + + .. py:attribute:: intensity + + A control for the brightness of the node. intensity is a triple + that contains separate float values for red, green, and blue. An intensity + value of 1.0 in all channels leaves the image unchanged. This value + corresponds to the photoshop brightness value. + + .. py:attribute:: maskhref + + The source filename for a mask image to be used as alpha channel. + Where this file is white, the node is shown. Where it is black, the + node is transparent. If the node is an image with an alpha channel, + the alpha channel is replaced by the mask. + + .. py:attribute:: maskpos + + An offset for the mask image. For images and videos, the offset is + given in image or video pixels, respectively. For words nodes, the + offset is given in screen pixels. If portions of the node extend + outside the mask, the border pixels of the mask are taken. Note that the + maskpos is an offset from the top left of the node, even for + :py:class:`WordsNode` objects that have :py:attr:`alignment` + :py:const:`Center` or :py:const:`Right`. + + + .. py:attribute:: masksize + + The size of the mask image. For images and videos, the size is + given in image or video pixels, respectively. For words nodes, the + size is given in screen pixels. If portions of the node extend + outside the mask, the border pixels of the mask are taken. + + .. py:attribute:: maxtileheight + + The maximum height of the tiles used for warping. The effective tile size is + also dependent on hardware and driver limits. Read-only. + + .. py:attribute:: maxtilewidth + + The maximum width of the tiles used for warping. The effective tile size is + also dependent on hardware and driver limits. Read-only. + + .. py:attribute:: mipmap + + Determines whether mipmaps (http://en.wikipedia.org/wiki/Mipmap) are + generated for this node. Setting this to :py:const:`True` improves the quality + of minified nodes. Depending on the graphics card in use, turning on mipmaps + may cause an extreme performance hit for every image change or have no + performance cost at all. Read-only. + + .. py:method:: getOrigVertexCoords() -> list + + Returns the unwarped coordinate of all vertices as a list of lists. + + .. py:method:: getWarpedVertexCoords() -> list + + Returnes the current coordinate of all vertices as a list of lists. + + .. py:method:: setEffect(FXNode) + + Attaches an :py:class:`FXNode` to the node that modifies how it looks. + + .. py:method:: setWarpedVertexCoords(grid) + + Changes the current coordinates of all vertices. :py:attr:`grid` is a list of + lists of coordinate tuples. :py:meth:`setWarpedVertexCoords` can only be called if + the node is in a renderable state. This means that :py:meth:`Player.play()` must have + been called and the node must be inserted in a Canvas. There must also be something to + render (for instance, :py:meth:`play()` must be called before + :py:meth:`setWarpedVertexCoords` in the case of a :py:class:`CameraNode`). The grid + submitted is lost if the node loses renderable status. + + .. autoclass:: SoundNode([href, loop=False, volume=1.0]) + + A sound played from a file. + + **Messages:** + + To get this message, call :py:meth:`Publisher.subscribe`. + + .. py:method:: Node.END_OF_FILE() + + Emitted when the end of the audio stream has been reached. + + .. py:attribute:: duration + + The duration of the sound file in milliseconds. Some file formats don't store + valid durations; in this case, 0 is returned. Read-only. + + .. py:attribute:: href + + The source filename of the sound. + + .. py:attribute:: loop + + Whether to start the sound again when it has ended. Read-only. + + .. py:attribute:: volume + + Audio playback volume for this sound. 0 is silence, 1 passes media + file volume through unchanged. Values higher than 1 can be used to + amplify sound if the sound file doesn't use the complete dynamic + range. + + .. py:method:: getAudioCodec() -> string + + Returns the codec used as a string such as :samp:`"mp2"`. + + .. py:method:: getAudioSampleRate() -> int + + Returns the sample rate in samples per second (for example, 44100). + + .. py:method:: getCurTime() -> time + + Returns milliseconds of playback time since audio start. + + .. py:method:: getNumAudioChannels() -> int + + Returns the number of channels. 2 for stereo, etc. + + .. py:method:: pause() + + Stops audio playback but doesn't close the object. The playback + cursor stays at the same position. + + .. py:method:: play() + + Starts audio playback. + + .. py:method:: seekToTime(time) + + Moves the playback cursor to the time given in milliseconds. + + .. py:method:: setEOFCallback(pyfunc) + + .. deprecated:: 1.8 + Use the message interface instead. + + Sets a python callable to be invoked when the audio reaches end of file. + + .. py:method:: stop() + + Stops audio playback. Closes the object and 'rewinds' the playback cursor. + + .. autoclass:: VideoNode([href, loop=False, threaded=True, fps, queuelength=8, volume=1.0, accelerated=True, enablesound=True]) + + Video nodes display a video file. Video formats and codecs supported + are all formats that ffmpeg/libavcodec supports. Usage is described thoroughly + in the libavg wiki: https://www.libavg.de/wiki/ProgrammersGuide/VideoNode. + + **Messages:** + + To get this message, call :py:meth:`Publisher.subscribe`. + + .. py:method:: Node.END_OF_FILE() + + Emitted when the end of the video stream has been reached. + + .. py:attribute:: accelerated + + On construction, set to :py:const:`True` if hardware acceleration should be + used to decode this video. Later queries of the attribute return + :py:const:`True` if acceleration is actually being used. Read-only. + + .. py:attribute:: enablesound + + On construction, set to :py:const:`True` if any audio present in the video + file should be played back as well. A value of :py:const:`False` ignores + audio and just plays a silent video. + + .. py:attribute:: fps + + The nominal frames per second the object should display at. Read-only. + + .. py:attribute:: href + + The source filename of the video. + + .. py:attribute:: loop + + Whether to start the video again when it has ended. Read-only. + + .. py:attribute:: queuelength + + The length of the decoder queue in video frames. This is the number of + frames that can be decoded before the first one is displayed. A higher + number increases memory consumption but also resilience against + data source latency (i.e. hiccups during disk reads). Can only be set at node + construction. Can't be set if :samp:`threaded=False`, since there is no queue + in that case. + + .. py:attribute:: threaded + + Whether to use separate threads to decode the video. The default is + :py:const:`True`. Setting this attribute to :py:const:`False` makes seeking + much quicker. On the other hand, it also disables audio and prevents libavg + from distributing the CPU load over several cores of a multi-core computer. + + .. py:attribute:: volume + + Audio playback volume for this video. 0 is silence, 1 passes media + file volume through unchanged. Values higher than 1 can be used to + amplify sound if the sound file doesn't use the complete dynamic + range. If there is no audio track, volume is ignored. + + .. py:method:: getAudioCodec() -> string + + Returns the audio codec used as a string such as :samp:`mp2`. + + .. py:method:: getAudioSampleRate() -> int + + Returns the sample rate in samples per second (for example, 44100). + + .. py:method:: getBitrate() -> int + + Returns the number of bits in the file per second. + + .. py:method:: getContainerFormat() -> string + + Returns the video file format. This is a string such as :samp:`avi` or + :samp:`mpeg`. + + .. py:method:: getCurFrame() -> int + + Returns the index of the video frame currently playing. + + .. py:method:: getCurTime() + + Returns milliseconds of playback time since video start. + + .. py:method:: getDuration() -> int + + Returns the duration of the video in milliseconds. Some file formats don't + store valid durations; in this case, 0 is returned. Read-only. + + .. py:method:: getNumFrames() -> int + + Returns the number of frames in the video. + + .. py:method:: getNumAudioChannels() -> int + + Returns the number of audio channels. 2 for stereo, etc. + + .. py:method:: getNumFramesQueued() -> int + + Returns the number of frames already decoded and waiting for playback. + + .. py:method:: getStreamPixelFormat() -> string + + Returns the pixel format of the video file as a string. Possible + pixel formats are described in + http://ffmpeg.mplayerhq.hu/doxygen/trunk/pixfmt_8h.html#60883d4958a60b91661e97027a85072a + + .. py:method:: getVideoCodec() -> string + + Returns the video codec used as a string such as :samp:`mpeg4`. + + .. py:method:: hasAlpha() -> bool + + Returns :py:const:`True` if the video contains an alpha (transparency) + channel. Throws an exception if the video has not been opened yet. + + .. py:method:: hasAudio() -> bool + + Returns :py:const:`True` if the video contains an audio stream. Throws an + exception if the video has not been opened yet. + + .. py:method:: pause() + + Stops video playback but doesn't close the object. The playback + cursor stays at the same position and the decoder queues remain full. + + .. py:method:: play() + + Starts video playback. + + .. py:method:: seekToFrame(num) + + Moves the playback cursor to the frame given. + + .. py:method:: seekToTime(millisecs) + + Moves the playback cursor to the time given. + + .. py:method:: setEOFCallback(pyfunc) + + .. deprecated:: 1.8 + Use the message interface instead. + + Sets a python callable to be invoked when the video reaches end of file. + + .. py:method:: stop() + + Stops video playback. Closes the file, 'rewinds' the playback + cursor and clears the decoder queues. + + .. py:classmethod:: getVideoAccelConfig() -> enum + + Returns either :py:const:`NO_ACCELERATION` if the current configuration does + not support hardware-accelerated video decoding or :py:const:`VDPAU` if VDPAU + can be used to decode videos. + + .. autoclass:: WordsNode([fontstyle=None, font="sans", variant="", text="", color="FFFFFF", fontsize=15, indent=0, linespacing=-1, alignment="left", wrapmode="word", justify=False, rawtextmode=False, letterspacing=0, aagamma=1, hint=True]) + + A words node displays formatted text. All + properties are set in pixels. International and multi-byte character + sets are fully supported. Words nodes use UTF-8 to encode international + characters (use python unicode strings for this). + + The pos attribute of a words node is the + logical top left of the first character for left-aligned text. For + centered and right-aligned text, it is the top center and right of the + first line, respectively. For latin text, the logical top usually + corresponds to the height of the ascender. There may be cases where + portions of the text are rendered to the left of or above the logical position, + for instance when italics are used. + + Words nodes are rendered using pango internally. + + .. py:attribute:: alignment + + The paragraph alignment. Possible values are :py:const:`left`, + :py:const:`center` and :py:const:`right`. + + .. py:attribute:: aagamma + + Defines a gamma-correction value for the alpha (transparency) of the text + rendered. Using this attibute, it is possible to fine-tune the text + antialiasing and make sure rendering is smooth. + + .. py:attribute:: color + + The color of the text in standard html color notation: FF0000 is red, + 00FF00 green, etc. + + .. py:attribute:: font + + The family name of the truetype font to use. Font files can either be + installed in the system, be in a :file:`fonts/` subdirectory of the current + directory, or be in a directory specified using :py:meth:`addFontDir`. To + figure out which fonts and variants are available, use the + :command:`avg_showfonts.py` utility. + + .. py:attribute:: fontsize + + The font size in pixels. Fractional sizes are supported. + + .. py:attribute:: fontstyle + + A :py:class:`FontStyle` object that encapsulates all font attributes of the node. As a + constructor parameter, this attribute sets the default attributes and other + constructor arguments can override these. If set during :py:class:`WordsNode` use, + all relevant attributes are set to the new values. + + .. py:attribute:: hint + + Whether or not hinting (http://en.wikipedia.org/wiki/Font_hinting) + should be used when rendering the text. Unfortunately, this setting + does not override the fontconfig settings in + :file:`/etc/fonts/conf.d/*-hinting.conf` or other fontconfig configuration + files. + + .. py:attribute:: indent + + The indentation of the first line of the text. + + .. py:attribute:: justify + + Whether each complete line should be stretched to fill + the entire width of the layout. Default is false. + + .. py:attribute:: letterspacing + + The amount of space between the idividual glyphs of the text in + pixels, with 0 being standard spacing and negative values indicating + packed text (less letter spacing than normal). Only active when text + attribute markup is not being used. + + .. py:attribute:: linespacing + + The number of pixels between different lines of a paragraph. Setting this to + :samp:`-1` results in default line spacing. + + .. py:attribute:: rawtextmode + + Sets whether the text should be parsed to apply markup (:py:const:`False`, + default) or interpreted as raw string (:py:const:`True`). + + .. py:attribute:: text + + The string to display. If the node is created using xml, this is either the + text attribute of the words node or the content of the words + node itself. In the second case, the string can be formatted + using the pango text attribute markup language described at + http://developer.gnome.org/pango/unstable/PangoMarkupFormat.html. + Markup can also be used if the text is set using the python attribute. + + Markup parsing can be turned on or off with :py:attr:`rawtextmode` attribute. + + .. py:attribute:: variant + + The variant (:samp:`bold`, :samp:`italic`, etc.) of the font to use. + + .. py:attribute:: wrapmode + + Controls at which points text can wrap to the next line. Possible values are + :py:const:`word` (split lines at the nearest whitespace, default), + :py:const:`char` (split at any position, ignoring word breaks) and + :py:const:`wordchar` (split at word boundaries but fall back + to char mode if there is no free space for a full word). + + .. py:method:: getCharIndexFromPos(pos) -> int + + Returns the index of the character at the coordinates :py:attr:`pos`, or + :py:const:`None` if there is no character at that position. :py:attr:`pos` + is relative to the node position. + Formatting markup such as or is treated as zero chars, +
is treated as one char. To get the text matched to this + use :py:meth:`getTextAsDisplayed`. + + .. py:method:: getGlyphPos(i) -> Point2D + + Returns the position of the glyph at character index :py:attr:`i` in the + layout. The position is in pixels relative to the words + node. Formatting markup such as or is treated as zero chars, +
is treated as one char. + + .. py:method:: getGlyphSize(i) -> Point2D + + Returns the size in pixels of the glyph at character index :py:attr:`i` in + the layout. Formatting markup such + as or is treated as zero chars,
is treated as one char. + + .. py:method:: getLineExtents(line) -> Point2D + + Returns the width and height of the specified line in pixels. + + .. py:method:: getNumLines() -> int + + Returns the number of lines in the layout. + + .. py:method:: getTextAsDisplayed + + Returns the text without text attribute markup language.
+ is replaced by \\n. + + .. py:classmethod:: addFontDir + + Adds a directory to be searched for fonts. + May only be called before :py:meth:`Player.play`. + + .. py:classmethod:: getFontFamilies() -> list + + Returns a list of strings containing all font names available. + + .. py:classmethod:: getFontVariants(fontname) -> list + + Returns a list of available variants (:samp:`Regular`, :samp:`Bold`, etc.) + of a font. + diff --git a/sphinxdoc/basenodes.rst b/sphinxdoc/basenodes.rst new file mode 100644 index 0000000..6b08120 --- /dev/null +++ b/sphinxdoc/basenodes.rst @@ -0,0 +1,382 @@ +Base Node Classes +================= + +This section describes the base classes for all node classes that libavg provides. + +.. automodule:: libavg.avg + :no-members: + + .. inheritance-diagram:: Node + :parts: 1 + + To be rendered, a :py:class:`Node` must be part of a scene graph. Scene graphs are + trees of :py:class:`Node` objects associated with a :py:class:`Canvas`. A + :py:class:`CanvasNode` is at the root of each scene graph. Scene graphs are pure tree + structures, so each :py:class:`Node` only has one parent node. Nodes that are not + linked to a canvas are not rendered. Any media that these nodes need are loaded from + disk, however. + + libavg :py:class:`Node` classes make heavy use of inheritance. Concepts like + :py:attr:`id`, :py:attr:`position` and :py:attr:`opacity` are defined in base classes + and can be used in any of the subclasses. + + .. note:: + + To reduce redundancy in the reference, + inherited methods and attributes are not mentioned in the derived class + documentation - follow the link to the base class to access them. This also + applies to constructor parameters: When constructing an object of a derived class, + constructor parameters of the base classes are also accepted. + + There are several ways of constructing a + node. The reference documentation follows the python constructor syntax. The + parameters remain the same in all syntactic variations, however. The options for + construction are as follows: + + **Use the standard python constructor**: + Nodes can be created using a standard python constructor. As an example:: + + node = ImageNode(id="background", href="sunset.png", pos=(0,0), + parent=rootNode) + + Parameters to a node constructor are always named parameters. Nodes never have + positional constructor parameters. + + **Use** :py:meth:`Player.createNode`: + There are two ways to create a node using createNode:: + + node = player.createNode("image", + {"id":"background", "href":"sunset.png", "pos":(0,0), + "parent":rootNode}) + + and:: + + node = player.createNode( + """""") + + Using the second option, complete trees of nodes can be constructed in one + statement. + + **Load it from an avg file**: + Complete scene graphs for onscreen display can be loaded from disk using + :py:meth:`Player.loadFile`:: + + root = player.loadFile("scene.avg") + + **Create a complete scene graph using inline xml**: + :py:meth:`Player.loadString` allows using an avg-formatted xml string to + create a scene graph of nodes:: + + root = player.loadString(""" + + + + """) + + The methods :py:meth:`Player.loadFile` and :py:meth:`Player.loadString` create + onscreen scene graphs. :py:meth:`Player.loadCanvasFile` and + :py:meth:`Player.loadCanvasString` are the equivalent methods for offscreen + canvases. + + .. autoclass:: Node([id: string="", parent: DivNode=None, active=True, sensitive=True, opacity=1.0, style=None]) + + Base class for everything that can be put into an avg tree. This is an abstract + class. + + **Messages:** + + All cursor and hover messages are emitted only if the cursor is above the + :py:class:`Node` and + :py:attr:`active` as well as :py:attr:`sensitive` are True. The message + parameters are of type :py:class:`CursorEvent`. The CURSOR messages are + emitted for mouse and touch events. The HOVER events are emitted for touch + devices which can sense hands approaching the surface before the actual touch. + + To get these messages, call :py:meth:`Publisher.subscribe`. + + .. py:method:: CURSOR_DOWN(cursorevent) + + Emitted whenever a mouse button is pressed or a new touch is registered. + + .. py:method:: CURSOR_MOTION(cursorevent) + + Emitted whenever a mouse or a touch moves. + + .. py:method:: CURSOR_UP(cursorevent) + + Emitted whenever a mouse button is released or a touch leaves the surface. + + .. py:method:: CURSOR_OVER(cursorevent) + + Emitted whenever a mouse or a touch enters the :py:class:`Node`'s area. + + .. py:method:: CURSOR_OUT(cursorevent) + + Emitted whenever a mouse or a touch leaves the :py:class:`Node`'s area. + + .. py:method:: HOVER_DOWN(cursorevent) + + Emitted whenever a new hover cursor is registered. + + .. py:method:: HOVER_MOTION(cursorevent) + + Emitted whenever a hover cursor moves. + + .. py:method:: HOVER_UP(cursorevent) + + Emitted whenever a hover cursor disappears. + + .. py:method:: HOVER_OVER(cursorevent) + + Emitted whenever a hover cursor enters the :py:class:`Node`'s area. + + .. py:method:: HOVER_OUT(cursorevent) + + Emitted whenever a hover cursor leaves the :py:class:`Node`'s area. + + .. py:method:: SIZE_CHANGED(newSize) + + Emitted whenever the size of the node changes. This includes any python + calls that change the size. In addition, image loading (for + :py:class:`ImageNode`), opening of video files (for + :py:class:`VideoNode`) and changes in the text displayed (in the case of + :py:class:`WordsNode`) can trigger :py:meth:`SIZE_CHANGED` messages. Note + that changing the size of a node inside a :py:meth:`SIZE_CHANGED` handler + will lead to an additional recursive invocation of + :py:meth:`SIZE_CHANGED`. + + :py:class:`RectNode` and all classes derived from :py:class:`AreaNode` + support this message. + + + .. py:attribute:: id + + A unique identifier that can be used to reference the node, for instance using + :py:meth:`Player.getElementByID`. Read-only. + + .. py:attribute:: parent + + A :py:class:`DivNode` that the node will become a child of. When used as a + constructor parameter, this is equivalent to calling + :py:meth:`DivNode.appendChild` directly after construction. Read-only. + + .. py:attribute:: active + + If this attribute is true, the node behaves as usual. If not, it + is neither drawn nor does it react to events. + + .. py:attribute:: opacity + + A measure of the node's transparency. 0.0 is completely + transparent, 1.0 is completely opaque. Opacity is relative to + the parent node's opacity. + + .. py:attribute:: sensitive + + A node only reacts to events if sensitive is true. + + .. py:method:: connectEventHandler(type, source, pyobj, pyfunc) + + .. deprecated:: 1.8 + Use the message interface instead. + + Sets a callback function that is invoked whenever an event of the + specified type from the specified source occurs. Unlike + :py:meth:`setEventHandler`, this method allows several handlers for one + type/source-combination. To remove a handler installed using + :py:meth:`connectEventHandler`, call :py:meth:`disconnectEventHandler`. + + :param type: + + One of the event types :py:const:`KEYUP`, :py:const:`KEYDOWN`, + :py:const:`CURSORMOTION`, :py:const:`CURSORUP`, :py:const:`CURSORDOWN`, + :py:const:`CURSOROVER` or :py:const:`CURSOROUT`. + + :param source: + + :py:const:`MOUSE` for mouse events, :py:const:`TOUCH` for multitouch touch + events, :py:const:`TRACK` for multitouch track events or other tracking, + :py:const:`NONE` for keyboard events. Sources can be or'ed together to + set a handler for several sources at once. + + :param pyobj: + + The python object that hosts the callback. This parameter is only needed + so that :py:meth:`disconnectEventHandler` can be called to remove all + handlers hosted by one object in one call. + + :param pyfunc: + + The python callable to invoke. This callable must take the event to + process as a parameter. In contrast to callbacks set up using + :py:meth:`setEventHandler`, it should not return anything. If + :py:meth:`connectEventHandler` is used, all events bubble up the tree. + pyfunc may not be :py:const:`None`. + + .. py:method:: disconnectEventHandler(pyobj, [pyfunc]) + + .. deprecated:: 1.8 + Use the message interface instead. + + Removes one or more event handlers from the node's table of event handlers. + If several event handlers conform to the parameters given, all are removed. + It is an error if no matching event handler exists. + + :param pyobj: + + The python object that hosts the event handler. + + :param pyfunc: + + The python callable that should not be called anymore. If pyfunc is + absent, all callbacks hosted by :py:attr:`pyobj` are removed. + + .. py:method:: getAbsPos(relpos) -> Point2D + + Transforms a position in coordinates relative to the node to a + position in window coordinates. + + .. py:method:: getElementByPos(pos) -> Node + + Returns the topmost child node that is at the position given. :py:attr:`pos` + is in coordinates relative to the called node. The algorithm used + is the same as the cursor hit test algorithm used for events. + + .. py:method:: getParent() -> Node + + .. deprecated:: 1.8 + Use :attr:`parent` instead. + + Returns the container (:py:class:`AVGNode` or :py:class:`DivNode`) the node + is in. For the root node (or if the node is not connected), returns + :py:const:`None`. + + .. py:method:: getRelPos(abspos) -> Point2D + + Transforms a position in window coordinates to a position + in coordinates relative to the node. + + .. py:method:: registerInstance(self, parent) + + Needs to be called when deriving from a Node class in python in the derived + classes :py:meth:`__init__` method. + + .. py:method:: releaseEventCapture([cursorid]) + + Restores normal cursor event handling after a call to + :py:meth:`setEventCapture()`. :py:attr:`cursorid` is the id of the + cursor to release. If :py:attr:`cursorid` is not given, the mouse cursor is + used. + + .. py:method:: setEventCapture([cursorid]) + + Sets up event capturing so that cursor events are sent to this node + regardless of the cursor position. cursorid is optional; if left out, + the mouse cursor is captured. If not, events from a specific tracker + cursor are captured. The event propagates to the capturing node's + parent normally. This function is useful for the + implementation of user interface elements such as scroll bars. Only one + node can capture a cursor at any one time. Normal operation can + be restored by calling :py:meth:`releaseEventCapture()`. + + .. py:method:: setEventHandler(type, source, pyfunc) + + .. deprecated:: 1.7 + Use the message interface instead. + + Sets a callback function that is invoked whenever an event of the + specified type from the specified source occurs. This method removes all + other event handlers from this type/source-combination. + + :param type: + + One of the event types :py:const:`KEYUP`, :py:const:`KEYDOWN`, + :py:const:`CURSORMOTION`, :py:const:`CURSORUP`, :py:const:`CURSORDOWN`, + :py:const:`CURSOROVER` or :py:const:`CURSOROUT`. + + :param source: + + :py:const:`MOUSE` for mouse events, :py:const:`TOUCH` for multitouch + touch events, :py:const:`TRACK` for multitouch track events or other + tracking, :py:const:`NONE` for keyboard events. Sources can be or'ed + together to set a handler for several sources at once. + + :param pyfunc: + + The python callable to invoke. This callable must take the event to + process as a parameter. If pyfunc returns :py:const:`None` or + :py:const:`False`, the event bubbles up the node tree. If it is + :py:const:`True`, bubbling is suppressed. + + If pyfunc is :py:const:`None`, the previous handler is removed. + + .. py:method:: unlink([kill=False]) + + Removes a node from its parent container and optionally deletes all resources + the node holds. In the default case, :py:meth:`unlink` is equivalent to + :samp:`node.getParent().removeChild(node.getParent().indexOf(node))`, + except that if the node has no parent, unlink does nothing. Also in the + default case, textures are moved back to the CPU and event handlers are + preserved. + + If :samp:`kill=True`, textures are not moved back. Event handlers for events + routed to this node are reset, all textures are deleted and the href is reset + to empty in this case, saving some time and making sure there are no + references to the node left on the libavg side. :py:attr:`kill` should always + be set to :py:const:`True` if the node will not be used after the unlink. + + + .. autoclass:: Publisher() + + libavg supports event handling and callbacks through a publish/subscribe + interface. :py:class:`Publisher` is the base class for all classes that + send messages. Derived classes can send messages of arbitrary types. The base + class takes care of managing a list of subscribers for each message type and + sending the message to each subscriber. + + Many libavg classes, including :py:class:`Node`, :py:class:`Player`, + :py:class:`Contact` and the :py:class:`Recognizer` classes derive from publisher. + In addition, it is possible to derive from :py:class:`Publisher` in client code + by calling the methods in the protected interface. + + .. py:method:: subscribe(messageID, callable) -> int + + Registers a subscriber for the given :py:attr:`messageID`. The + :py:attr:`callable` for all subscribers is invoked whenever the publisher + sends out the message with this ID. + + :py:meth:`subscribe` returns a :py:attr:`subscriberID` that can be used to + unsubscribe if this becomes necessary. The subscription is also terminated if + either the publisher or the subscriber is deleted. The :py:class:`Publisher` + class works with weak references to subscribers when possible, so this should + happen automatically in most cases. The exception is when :py:attr:`callable` + is an anonymous function (a lambda expression). In this case, the + :py:class:`Publisher` needs to hold a reference to the callable to keep it + from being deleted immediately and :py:meth:`unsubscribe` needs to be called + manually. + + .. py:method:: unsubscribe(messageID, subscriberID) + unsubscribe(messageID, callable) + + Removes a subscriber from the list of subscribers for :py:attr:`messageID`. + The subscriber is either determined by the :py:attr:`subscriberID` returned + from :py:meth:`subscribe` or by the :py:attr:`callable` attached to the + subscription. + + **Protected Interface:** + + To be called from derived classes. + + .. py:method:: publish(messageID) + + Registers a :py:attr:`messageID` so that interested parties can subscribe + to this message. + + .. py:method:: notifySubscribers(messageID, argsList) + + Invokes all callables registered for this :py:attr:`messageID` using the + list of args passed. Subscribers are called synchronously; the order of + invokation is undefined. + diff --git a/sphinxdoc/conf.py b/sphinxdoc/conf.py new file mode 100644 index 0000000..a27b2da --- /dev/null +++ b/sphinxdoc/conf.py @@ -0,0 +1,223 @@ +# -*- coding: utf-8 -*- +# +# libavg documentation build configuration file, created by +# sphinx-quickstart on Sun Nov 14 22:21:44 2010. +# +# This file is execfile()d with the current directory set to its containing dir. +# +# Note that not all possible configuration values are present in this +# autogenerated file. +# +# All configuration values have a default; values that are commented out +# serve to show the default. + +import sys + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +#sys.path.insert(0, os.path.abspath('.')) + +# -- General configuration ----------------------------------------------------- + +# If your documentation needs a minimal Sphinx version, state it here. +#needs_sphinx = '1.0' + +# Add any Sphinx extension module names here, as strings. They can be extensions +# coming with Sphinx (named 'sphinx.ext.*') or your custom ones. +extensions = ['sphinx.ext.autodoc', 'sphinx.ext.pngmath', 'sphinx.ext.coverage', + 'sphinx.ext.graphviz', 'sphinx.ext.inheritance_diagram'] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# The suffix of source filenames. +source_suffix = '.rst' + +# The encoding of source files. +#source_encoding = 'utf-8-sig' + +# The master toctree document. +master_doc = 'index' + +# General information about the project. +project = u'libavg' +copyright = u'2010, Ulrich von Zadow' + +# The version info for the project you're documenting, acts as replacement for +# |version| and |release|, also used in various other places throughout the +# built documents. +# +# The short X.Y version. +version = '1.7' +# The full version, including alpha/beta/rc tags. +release = '1.7.svn' + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +#language = None + +# There are two options for replacing |today|: either, you set today to some +# non-false value, then it is used: +#today = '' +# Else, today_fmt is used as the format for a strftime call. +#today_fmt = '%B %d, %Y' + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +exclude_patterns = ['_build'] + +# The reST default role (used for this markup: `text`) to use for all documents. +#default_role = None + +# If true, '()' will be appended to :func: etc. cross-reference text. +#add_function_parentheses = True + +# If true, the current module name will be prepended to all description +# unit titles (such as .. function::). +#add_module_names = True + +# If true, sectionauthor and moduleauthor directives will be shown in the +# output. They are ignored by default. +#show_authors = False + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'sphinx' + +# A list of ignored prefixes for module index sorting. +#modindex_common_prefix = [] + +# -- Autodoc options ----------------------------------------------------------- + +autodoc_member_order = 'groupwise' +autodoc_default_flags = ['members', 'show-inheritance'] + +# -- Options for HTML output --------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +html_theme = 'sphinxdoc' + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +#html_theme_options = {} + +# Add any paths that contain custom themes here, relative to this directory. +#html_theme_path = [] + +# The name for this set of Sphinx documents. If None, it defaults to +# " v documentation". +#html_title = None + +# A shorter title for the navigation bar. Default is the same as html_title. +#html_short_title = None + +# The name of an image file (relative to this directory) to place at the top +# of the sidebar. +#html_logo = None + +# The name of an image file (within the static path) to use as favicon of the +# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 +# pixels large. +#html_favicon = None + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] + +# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, +# using the given strftime format. +#html_last_updated_fmt = '%b %d, %Y' + +# If true, SmartyPants will be used to convert quotes and dashes to +# typographically correct entities. +#html_use_smartypants = True + +# Custom sidebar templates, maps document names to template names. +#html_sidebars = {} + +# Additional templates that should be rendered to pages, maps page names to +# template names. +#html_additional_pages = {} + +# If false, no module index is generated. +#html_domain_indices = True + +# If false, no index is generated. +#html_use_index = True + +# If true, the index is split into individual pages for each letter. +#html_split_index = False + +# If true, links to the reST sources are added to the pages. +#html_show_sourcelink = True + +# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. +#html_show_sphinx = True + +# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. +#html_show_copyright = True + +# If true, an OpenSearch description file will be output, and all pages will +# contain a tag referring to it. The value of this option must be the +# base URL from which the finished HTML is served. +#html_use_opensearch = '' + +# This is the file name suffix for HTML files (e.g. ".xhtml"). +#html_file_suffix = None + +# Output file base name for HTML help builder. +htmlhelp_basename = 'libavgdoc' + + +# -- Options for LaTeX output -------------------------------------------------- + +# The paper size ('letter' or 'a4'). +#latex_paper_size = 'letter' + +# The font size ('10pt', '11pt' or '12pt'). +#latex_font_size = '10pt' + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, author, documentclass [howto/manual]). +latex_documents = [ + ('index', 'libavg.tex', u'libavg Documentation', + u'Ulrich von Zadow', 'manual'), +] + +# The name of an image file (relative to this directory) to place at the top of +# the title page. +#latex_logo = None + +# For "manual" documents, if this is true, then toplevel headings are parts, +# not chapters. +#latex_use_parts = False + +# If true, show page references after internal links. +#latex_show_pagerefs = False + +# If true, show URL addresses after external links. +#latex_show_urls = False + +# Additional stuff for the LaTeX preamble. +#latex_preamble = '' + +# Documents to append as an appendix to all manuals. +#latex_appendices = [] + +# If false, no module index is generated. +#latex_domain_indices = True + + +# -- Options for manual page output -------------------------------------------- + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [ + ('index', 'libavg', u'libavg Documentation', + [u'Ulrich von Zadow'], 1) +] + +inheritance_graph_attrs = dict(rankdir="TB") diff --git a/sphinxdoc/events.rst b/sphinxdoc/events.rst new file mode 100644 index 0000000..0db8d97 --- /dev/null +++ b/sphinxdoc/events.rst @@ -0,0 +1,428 @@ +Input Handling +============== + +.. automodule:: libavg.avg + :no-members: + + .. inheritance-diagram:: Event CursorEvent MouseEvent TouchEvent KeyEvent + :parts: 1 + + .. inheritance-diagram:: Contact + :parts: 1 + + .. inheritance-diagram:: InputDevice + :parts: 1 + + .. autoclass:: Contact + + A Contact encapsulates the information of one touch on an input device from + the down event to an up event. It exposes some aggregate information about the + touch - distance and direction travelled etc. - and supports event handlers that + are only called for this single contact. + + For compatibility reasons, a mouse device also produces contacts. A mouse contact + exists from the press of a button to its release. If multiple buttons are + pressed without a complete release (e.g. LEFTDOWN-RIGHTDOWN-LEFTUP-RIGHTUP), the + mouse contact exists for the complete sequence. + + **Messages:** + + All message parameters are of type :py:class:`CursorEvent`. + To get these messages, call :py:meth:`Publisher.subscribe`. All subscribers + are unsubscribed automatically after the up event. + + .. py:method:: CURSOR_MOTION(cursorevent) + + Emitted whenever the contact moves. + + .. py:method:: CURSOR_UP(cursorevent) + + Emitted when the mouse button is released or the touch leaves the surface. + + .. py:attribute:: age + + Time that has passed since the down event in milliseconds. Read-only. + + .. py:attribute:: distancefromstart + + Distance of the current position from the initial position in pixels. + Read-only. + + .. py:attribute:: distancetravelled + + The total distance travelled since the initial down event. Read-only. + + .. py:attribute:: events + + An array containing all events that this contact has generated in the past. + Read-only. + + .. py:attribute:: id + + A numerical id for this contact. This corresponds to the + :py:attr:`CursorEvent.cursorid` field. Contacts for touch events have unique + ids, while contacts for mouse events always have the :py:attr:`id` + :py:const:`-1`. ids are not reused. Read-only. + + .. py:attribute:: motionangle + + Angle of the current position from the initial position in radians. Like all + angles in libavg, :py:attr:`motionangle` is 0 on the positive x axis and + increases clockwise. Read-only. + + .. py:attribute:: motionvec + + The difference of the current position and the initial position as a + :py:class:`Point2D`. Read-only. + + .. py:method:: connectListener(motionCallback, upCallback) -> id + + .. deprecated:: 1.8 + Use the message interface instead. + + Registers event handlers that get called when CURSORMOTION and CURSORUP + events for this :py:class:`Contact` occur. Event handlers can be unregistered + using :py:meth:`disconnectListener`. They are automatically unregistered + after the up event. The :py:attr:`id` returned is unique for this contact. + + .. py:method:: disconnectListener(id) + + .. deprecated:: 1.8 + Use the message interface instead. + + Unregisters an event handler. The parameter is the :py:attr:`id` returned in + :py:meth:`connectListener`. It is an error to call + :py:meth:`disconnectListener` with an invalid id. + + .. autoclass:: CursorEvent + + Base class for all events which contain a position in the global coordinate + system. + + .. py:attribute:: contact + + The :py:class:`Contact` that the event belongs to, if there is one. + Read-only. + + .. py:attribute:: cursorid + + A numerical identifier for the current cursor. + + .. py:attribute:: node + + The :py:class:`Node` that the event occured in. If this is :py:const:`None`, + the event happened outside of the application window and the cursor was + captured by the application. + Read-only. + + .. py:attribute:: pos + + Position in the global coordinate system. Read-only. + + .. py:attribute:: source + + The type of the device that emitted the event. See :py:attr:`Event.source`. + Read-only. + + .. py:attribute:: x + + x position in the global coordinate system. Read-only. + + .. py:attribute:: y + + y position in the global coordinate system. Read-only. + + + .. autoclass:: Event(type, source, [when]) + + Base class for user input events. + + :param type type: + + The type of the event. See :py:attr:`Event.type`. + + :param source source: + + The source of the event. See :py:attr:`Event.source`. + + :param Integer when: + + The time the event occured + + .. py:attribute:: inputdevice + + The address of the device that emitted the event. + Read-only + + .. py:attribute:: inputdevicename + + The name of the device that emitted the event. + Read-only. + + .. py:attribute:: source + + One of :py:const:`MOUSE`, :py:const:`TOUCH`, :py:const:`TRACK`, + :py:const:`CUSTOM` or :py:const:`NONE`. Read-only + + .. py:attribute:: type + + One of :py:const:`KEYUP`, :py:const:`KEYDOWN`, :py:const:`CURSORMOTION`, + :py:const:`CURSORUP`, :py:const:`CURSORDOWN`, :py:const:`CURSOROVER` + or :py:const:`CURSOROUT`. Read-only. + + .. py:attribute:: when + + The time when the event occured in milliseconds since program start. + Read-only. + + .. autoclass:: InputDevice(name, [eventReceiverNode]) + + Base class for input devices which feed events to the system. Derived classes can + be either user-defined or one of the predefined libavg input devices. User-defined + InputDevice objects are registered with the system by calling + :py:meth:`Player.addInputDevice`. After this, the emitted + events are processed like any other events. + + .. py:attribute:: eventreceivernode + + The :py:class:`DivNode` that the input device will deliver events to. By + default, this is the libavg root node. Useful for restricting events to a + part of the total canvas or for sending events directly to an offscreen + canvas. Event bubbling starts at this node and proceeds down the tree from + there. Read-only. + + .. py:attribute:: name + + The name of the device. Read-only. + + .. py:method:: pollEvents() -> list + + Abstract method which returns a list of pending events. Override this method + in your derived input device class. After registering + the input device, this method gets called on every frame. + + .. py:method:: start() + + Initializes the input device if needed. By default this is an empty method. + + .. autoclass:: KeyEvent + + Generated when a key is pressed or released. + + .. py:attribute:: keycode + + The keycode of the key according to US keyboard layout. Read-only. + + .. py:attribute:: keystring + + A character or word describing the key pressed. Read-only. + + .. py:attribute:: modifiers + + Any modifier keys pressed, or'ed together. Possible Modifiers are + :py:const:`KEYMOD_NONE`, :py:const:`KEYMOD_LSHIFT`, :py:const:`KEYMOD_RSHIFT`, + :py:const:`KEYMOD_LCTRL`, :py:const:`KEYMOD_RCTRL`, :py:const:`KEYMOD_LALT`, + :py:const:`KEYMOD_RALT`, :py:const:`KEYMOD_LMETA`, :py:const:`KEYMOD_RMETA`, + :py:const:`KEYMOD_NUM`, :py:const:`KEYMOD_CAPS`, :py:const:`KEYMOD_MODE`. + Read-only. + + .. py:attribute:: scancode + + The untranslated (hardware-dependent) scancode of the key pressed. + Read-only. + + .. py:attribute:: unicode + + Unicode index of the character. Takes into account the current keyboard + layout and any modifiers pressed. This attribute is only filled in the + :py:const:`KEYDOWN` event. Read-only. + + .. autoclass:: MouseEvent(type, leftButtonState, middleButtonState, rightButtonState, pos, button, [speed, when]) + + Generated when a mouse-related event occurs. + + .. py:attribute:: button + + The button that caused the event. Read-only. + + .. py:attribute:: cursorid + + Always :samp:`-1` for mouse events, but can be used to handle mouse and + tracking events in one handler. Read-only. + + .. py:attribute:: leftbuttonstate + + :py:const:`True` if the left mouse button is currently pressed. Read-only. + + .. py:attribute:: middlebuttonstate + + :py:const:`True` if the middle mouse button is currently pressed. Read-only. + + .. py:attribute:: rightbuttonstate + + :py:const:`True` if the right mouse button is currently pressed. Read-only. + + .. py:attribute:: source + + Always :py:const:`MOUSE`. Read-only + + .. py:attribute:: speed + + Current speed of the mouse in pixels per millisecond as a + :py:class:`Point2D`. Read-only. + + .. autoclass:: TouchEvent(id, type, pos, source, [speed]) + + Generated when a touch or other tracking event occurs. Touch events happen + only when a multi-touch sensitive surface or other camera tracker is + active. + + .. py:attribute:: area + + Size of the blob found in pixels. Read-only. + + .. py:attribute:: center + + Position as :py:class:`Point2D`, with sub-pixel accuracy. Used for + calibration. Read-only. + + .. py:attribute:: cursorid + + An identifier for the current touch. A single touch will generate a down, + zero or more motion and a single up event in its lifetime, all with the same + :py:attr:`cursorid`. + + .. py:attribute:: eccentricity + + .. py:attribute:: handorientation + + The angle of the hand relative to the finger. :py:attr:`handorientation` is + only defined for events with :py:attr:`source`=:py:const:`TOUCH`. If the + tracker has detected a hovering hand attached to the finger, this is the + actual hand-finger angle. If no hand was detected, the angle is approximated + using the position of the touch on the surface. :py:attr:`handorientation` + ranges from :py:const:`-pi` to :py:const:`pi`, with 0 being the positive x + axis. Angles increase in a clockwise fashion. + + For :py:const:`CURSORUP` events, the angle is always approximated. + + .. py:attribute:: majoraxis + + Major axis of an ellipse that is similar to the blob. Read-only. + + .. py:attribute:: minoraxis + + Minor axis of an ellipse that is similar to the blob. Read-only. + + .. py:attribute:: orientation + + Angle of the blob in radians. For hovering hands, this is roughly the + direction of the hand, modulo 180 degrees. Read-only. + + .. py:attribute:: source + + :py:attr:`source` can be either :py:const:`TRACK` or :py:const:`TOUCH`. + In most cases, actual touches will generate :py:const:`TOUCH` events. When + used with a DI device, the internal tracker also generates :py:const:`TRACK` + events for hands above the surface. When used with an FTIR device, the + internal tracker generates :py:const:`TRACK` events for the actual touches. + Read-only. + + .. py:attribute:: speed + + Current speed of the touch in pixels per millisecond as a + :py:class:`Point2D`. Read-only. + + .. py:method:: getContour() -> list + + Returns the contour of the blob as a list of points if supported by the + tracker being used. + + .. py:method:: getRelatedEvents() -> events + + Only for DI devices and the internal tracker: Returns a python tuple + containing the events 'related' to this one. For :py:const:`TOUCH` events + (fingers), the tuple contains one element: the corresponding + :py:const:`TRACK` event (hand). For :py:const:`TRACK` events, + the tuple contains all :py:const:`TOUCH` events that belong to the same hand. + + .. autoclass:: Tracker + + A class that uses a camera to track moving objects and delivers the movements + as avg events. Create a tracker by using :py:meth:`Player.enableMultitouch()` with + :samp:`AVG_MULTITOUCH_DRIVER=TRACKER`. The properties of this class are explained + under https://www.libavg.de/wiki/ProgrammersGuide/Tracker. + + .. py:method:: abortCalibration() + + Aborts coordinate calibration session and restores the previous + coordinate transformer. + + .. py:method:: endCalibration() + + Ends coordinate calibration session and activates the coordinate + transformer generated. + + .. py:method:: getDisplayROIPos() + + .. py:method:: getDisplayROISize() + + .. py:method:: getImage(imageid) -> Bitmap + + Returns one of the intermediate images necessary for tracking. + These images are only available if setDebugImages was called before + with appropriate parameters. Possible :py:attr:`imageid` values are + :py:const:`IMG_CAMERA`, :py:const:`IMG_DISTORTED`, :py:const:`IMG_NOHISTORY`, + :py:const:`IMG_HISTOGRAM`, :py:const:`IMG_FINGERS` or + :py:const:`IMG_HIGHPASS`. + + .. py:method:: getParam(element) -> value + + Returns a tracker configuration parameter. + + .. py:method:: resetHistory() + + Throws away the current history image and generates a new one from + the next second of images. + + .. py:method:: saveConfig() + + Saves the current tracker configuration to the default config file. + + .. py:method:: setDebugImages(img, finger) + + Controls whether debug images of intermediate tracking results + and detected finger positions are generated and exported to + python. Generating the debug images takes a moderate amount of + time, so it is turned off by default. + + :param img: Whether to generate intermediate result images. + :param finger: Whether to generate the :py:const:`IMG_FINGERS` result image. + + .. py:method:: setParam(element, value) + + Sets one of the tracker configuration parameters. + + .. py:method:: startCalibration(displayextents) -> TrackerCalibrator + + Starts coordinate calibration session. The returned + :py:class:`TrackerCalibrator` exists until :py:meth:`endCalibration` + or :py:meth:`abortCalibration` is called. + + :param displayextents: The width and height of the display area. + + .. autoclass:: TrackerCalibrator + + Generates a mapping of display points to camera points using a set of reference + points. Python code should display reference points that the user must + touch to establish a mapping. Created by :py:meth:`Tracker.startCalibration`. + + .. py:method:: getDisplayPoint() -> Point2D + + .. py:method:: nextPoint() -> bool + + Advances to the next point. Returns :py:const:`False` and ends calibration if + all points have been set. + + .. py:method:: setCamPoint(pos) + diff --git a/sphinxdoc/fx.rst b/sphinxdoc/fx.rst new file mode 100644 index 0000000..f74efca --- /dev/null +++ b/sphinxdoc/fx.rst @@ -0,0 +1,140 @@ +Effect Nodes +============ + +.. automodule:: libavg.avg + :no-members: + + .. inheritance-diagram:: BlurFXNode ChromaKeyFXNode HueSatFXNode InvertFXNode NullFXNode ShadowFXNode + :parts: 1 + + .. autoclass:: BlurFXNode(radius=1.0) + + Blurs the node it is applied to. Corresponds to the Gaussian Blur effect in + Photoshop. + + Not supported under minimal shaders. Programs can call + :py:meth:`Player.areFullShadersSupported` to ensure support. + + .. py:attribute:: radius + + The width of the blur. This corresponds to the radius parameter of + photoshop. + + .. autoclass:: ChromaKeyFXNode + + Chroma keying is the process of removing a uniformly colored background from an + image. The background is then replaced with a different image or video. + Actors are filmed in front of a blue- or green-colored background and chroma + keying is used to insert a different background. + + The :py:class:`ChromaKeyFXNode` implements a high-quality realtime chroma key + (greenscreen or bluescreen) effect. It replaces all pixels that are similar to a + configured key color with transparency and can account for noise in the + background area as well as remove color spill from the background to the + foreground. All of the parameters can be manipulated for test purposes using the + :program:`avg_chromakey.py` script. The effect is carried out in the HSL + colorspace (http://en.wikipedia.org/wiki/HSL_and_HSV). + + Not supported under minimal shaders. Programs can call + :py:meth:`Player.areFullShadersSupported` to ensure support. + + .. py:attribute:: color + + The color to key out. Pixels of this and similar colors are made transparent. + + .. py:attribute:: erosion + + Removes single non-keyed-out pixels in larger transparent areas. Values > 1 + remove larger areas. Useful for removing camera noise. + + .. py:attribute:: htolerance + + Hue tolerance for the key color. + + .. py:attribute:: ltolerance + + Lightness tolerance for the key color. + + .. py:attribute:: softness + + :py:attr:`softness` > 0 causes pixels with a color close to the keyed-out + colors to become partially transparent. Greater values increase this effect. + + .. py:attribute:: spillthreshold + + Often, people in greenscreen studios aquire a greenish tint. Spill removal + works against this by desaturating pixels that are close to the key color. + Larger values cause more desaturation. + + .. py:attribute:: stolerance + + Saturation tolerance for the key color. + + .. autoclass:: FXNode + + Base class for GPU-based effects. These effects can be added to any + :py:class:`RasterNode` by calling :py:meth:`RasterNode.setEffect`. + + .. autoclass:: HueSatFXNode(hue=0.0, saturation=0.0, lightness=0.0, colorize=False) + + Color correction filter that works by converting pixels to the hsl color space + (http://en.wikipedia.org/wiki/HSL_and_HSV), changing the values there and + converting back to rgb. Can be used to change hue, + saturation and lightness of a node. Corresponds to the Photoshop Hue/Saturation + dialog. + + .. py:attribute:: colorize + + If :py:attr:`colorize` is :py:const:`True`, all colors will be tinted + according to the current :py:attr:`hue` value. Otherwise, :py:attr:`hue` is + treated as a difference value. + + .. py:attribute:: hue + + Used to get/set the color angle in degrees. Effective values are 0..360 or + -180..180, depending on the :py:attr:`colorize` value. + + .. py:attribute:: lightness + + Set :py:attr:`lightness` offset. Adds a per pixel offset in brightness. Values + range from -100 to 100, with -100 being very dark and 100 very bright. + + .. py:attribute:: saturation + + Set :py:attr:`saturation` of Node. In :py:attr:`colorize` mode, this is the + overall image saturation in the range 0..100, with 0 being greyscale and 100 + very oversaturated. If :py:attr:`colorize` is false, the attribute is an + offset from -100 to 100. + + .. autoclass:: InvertFXNode + + Color Invert Effect. Inverts the brightness of nodes that it is attached to. + + .. autoclass:: NullFXNode + + Do-nothing effect. Exists primarily as aid in debugging libavg. + + .. autoclass:: ShadowFXNode(offset=(0,0), radius=1.0, opacity=1.0, color="FFFFFF") + + Adds a shadow behind the node. + + Not supported under minimal shaders. Programs can call + :py:meth:`Player.areFullShadersSupported` to ensure support. + + .. py:attribute:: offset + + An adjustment to the shadow's position behind the node in pixels. + + .. py:attribute:: radius + + The blur radius of the shadow. + + .. py:attribute:: opacity + + The opacity of the shadow. + + .. py:attribute:: color + + The shadow color. + + diff --git a/sphinxdoc/gesture.rst b/sphinxdoc/gesture.rst new file mode 100644 index 0000000..ddac29b --- /dev/null +++ b/sphinxdoc/gesture.rst @@ -0,0 +1,347 @@ +Gesture Support +=============== + +The namespace libavg.gesture exposes a group of configurable gesture recognizers. + +.. automodule:: libavg.gesture + :no-members: + + .. inheritance-diagram:: DragRecognizer SwipeRecognizer TapRecognizer TransformRecognizer DoubletapRecognizer HoldRecognizer + :parts: 1 + + .. inheritance-diagram:: Transform + :parts: 1 + + + .. autoclass:: DoubletapRecognizer(node, [maxTime=MAX_DOUBLETAP_TIME, maxDist=MAX_TAP_DIST, initialEvent=None, possibleHandler=None, failHandler=None, detectedHandler=None]) + + A :py:class:`DoubletapRecognizer` detects doubletaps: Two short touches in quick + succession without a large change of the cursor position. + + :param maxTime: The maximum time that each phase of the tap may take. + + :param maxDist: The maximum distance the contact may move in millimeters. + + + .. autoclass:: DragRecognizer(eventNode, [coordSysNode=None, initialEvent=None, direction=ANY_DIRECTION, directionTolerance=DIRECTION_TOLERANCE, friction=-1, minDragDist=None, possibleHandler=None, failHandler=None, detectedHandler=None, moveHandler=None, upHandler=None, endHandler=None]) + + A :py:class:`DragRecognizer` attaches itself to a node's cursor events and + delivers higher-level callbacks that can be used to implement dragging or + drag-like functionality. + + :py:class:`DragRecognizer` supports inertia after the node is released. + + :param avg.Node coordSysNode: + + Used to determine the coordinate system for the offsets returned by the + callbacks. If :py:attr:`coordSysNode` is not given, :py:attr:`eventNode` is + used as default. The :py:class:`DragRecognizer` never modifies any nodes + itself. :py:attr:`coordSysNode` can be used to separate the node that + is the 'handle' for the events from the node that is being moved - for + instance, to allow moving a window by dragging the title bar. + + :param direction: + + Can be used to constrain the recognizer to :py:const:`VERTICAL` or + :py:const:`HORIZONTAL` drags only. If one of these constants is passed as + :py:attr:`direction`, the recognizer invokes :py:meth:`onPossible` + when the down event arrives, then determines whether the drag is a + predominantly horizontal or vertical drag and invokes either + :py:meth:`onDetected` or :py:meth:`onFail` depending on the result. + + :param float directionTolerance: + + A tolerance angle in radians for the detection of horizontal and vertical + drags. + + :param avg.Node eventNode: + + The node to attach to. The :py:class:`DragRecognizer` registers an event + handler to react to any contacts for this node. + + :param float friction: + + If set, this parameter enables inertia processing. It describes how + quickly the drag comes to a stop after the cursor is released. + + :param float minDragDist: + + Minimum distance in mm that the cursor must move for the recognizer to switch + from :py:const:`POSSIBLE` to :py:const:`DETECTED`. Default is either 0 (for + :py:const:`ANY_DIRECTION` recognizers) or :py:const:`MIN_DRAG_DIST` (for + constrained recognizers). + + :param moveHandler: + + A shortcut for + :samp:`Recognizer.subscribe(Recognizer.MOTION, moveHandler)`. + + :param upHandler: + + A shortcut for + :samp:`Recognizer.subscribe(Recognizer.UP, upHandler)`. + + **Messages:** + + To get these messages, call :py:meth:`Publisher.subscribe`. + + .. py:method:: Recognizer.MOTION(offset) + + Emitted when the drag should cause a position change. This usually happens + in response to a :py:const:`CURSORMOTION` event, but may also happen + because of inertia. + + :param avg.Point2D offset: + + The current offset from the start of the drag in coordinates relative + to the :py:attr:`coordSysNode`'s parent. + + .. py:method:: Recognizer.UP(offset) + + Emitted when the cursor is released. If inertia is enabled, there may be + move events after the up event. + + :param avg.Point2D offset: + + The current offset from the start of the drag in coordinates relative + to the :py:class:`coordSysNode`'s parent. + + .. py:method:: abort() + + Aborts the present recognized gesture and sliding caused by inertia + + + .. autoclass:: HoldRecognizer(node, [delay=HOLD_DELAY, maxDist=MAX_TAP_DIST, initialEvent=None, possibleHandler=None, failHandler=None, detectedHandler=None, stopHandler=None]) + + A :py:class:`HoldRecognizer` detects if a touch is held for a certain amount of + time. Holds are continuous events: the :py:meth:`stopHandler` is called when the + contact up event arrives. + + :param delay: The amount of time that has to pass before the hold is recognized. + + :param maxDist: The maximum distance the contact may move in millimeters. + + + .. autoclass:: Recognizer(node, isContinuous, maxContacts, initialEvent[, possibleHandler=None, failHandler=None, detectedHandler=None, endHandler=None]) + + Base class for gesture recognizers that attach to a node's cursor events and + emit higher-level events. Gesture recognizers have a standard set of states and + callbacks, but derived classes may add their own callbacks and do not need to + invoke all base class callbacks. The possible states vary depending on the value + of :py:attr:`isContinuous`: + + .. image:: Recognizer.png + + A usage example for the recognizers can be found under + :samp:`src/samples/gestures.py`. Many of the recognizers have default timeouts + and distance limits which can be changed by modifying :file:`avgrc`. The sample + file under :file:`src/avgrc` contains explanations. + + :param Node node: Node to attach to. + + :param bool isContinuous: + + :py:const:`True` if the gesture stays active after it has been detected. + + + :param maxContacts: + + The maximum number of contacts that the recognizer should handle. + :py:const:`None` if there is no maximum. + + :param initialEvent: + + A cursordown event to pass to the recognizer immediately. + + :param possibleHandler: + + A shortcut for + :samp:`Recognizer.subscribe(Recognizer.POSSIBLE, possibleHandler)`. + + :param failHandler: + + A shortcut for :samp:`Recognizer.subscribe(Recognizer.FAIL, failHandler)`. + + :param detectedHandler: + + A shortcut for + :samp:`Recognizer.subscribe(Recognizer.DETECTED, detectedHandler)`. + + :param endHandler: + + A shortcut for :samp:`Recognizer.subscribe(Recognizer.END, endHandler)`. + + **Messages:** + + Gesture recognizers emit messages whenever they change state - see the state + diagrams above. The messages have a parameter of type :py:class:`CursorEvent`. + + To get these messages, call :py:meth:`Publisher.subscribe`. + + .. py:method:: POSSIBLE() + + Emit when gesture recognition begins - usually after a cursordown event. + Some continuous gestures (such as unconstrained drags) never emit + :py:meth:`POSSIBLE` but emit :py:meth:`DETECTED` immediately. + + .. py:method:: FAILED() + + Emitted when gesture recognition is rejected. For instance, in the case + of a :py:class:`DoubleTapRecognizer`, a :py:meth:`FAILED` message is + emitted if the touch stays on the surface for too long. + + .. py:method:: DETECTED() + + Emitted when the gesture is recognized. For discrete gestures, this + signifies the end of gesture processing. + + .. py:method:: END() + + Emitted when a continuous gesture ends. This is often a result of an + up event, but e.g. in the case of inertia, :py:meth:`END` is emitted + when movement stops. + + .. py:attribute:: contacts + + List of all contacts detected by the :py:class:`Recognizer`. + + .. py:method:: abort() + + Aborts the present recognized gesture. + + .. py:method:: enable(isEnabled) + + Enables or disables the :py:class:`Recognizer`. + + .. py:method:: getState() -> String + + Returns the state ("IDLE", "POSSIBLE" or "RUNNING") of the recognizer. + + + .. autoclass:: SwipeRecognizer(node, direction, [numContacts=1, directionTolerance=SWIPE_DIRECTION_TOLERANCE, minDist=MIN_SWIPE_DIST, maxContactDist=MAX_SWIPE_CONTACT_DIST, initialEvent=None, possibleHandler=None, failHandler=None, detectedHandler=None]) + + A :py:class:`SwipeRecognizer` detects movement of one or more contacts in a + specified direction and with a minimal distance. Whether the gesture is recognized + is determined when an up event occurs. + + :param direction: + + One of :py:const:`SwipeRecognizer.UP`, :py:const:`DOWN`, :py:const:`LEFT` or + :py:const:`RIGHT`. + + :param numContacts: The minimum number of contacts for the swipe. + + :param directionTolerance: + + Maximum deviation from the ideal direction that the touch(es) may have in + radians. + + :param minDist: + + Minimum distance between start position and end position of each contact in + millimeters. + + :param maxInterContactDist: + + Maximum distance between the start positions of the different contacts. + + + .. autoclass:: TapRecognizer(node, [maxTime=MAX_TAP_TIME, maxDist=MAX_TAP_DIST, initialEvent=None, possibleHandler=None, failHandler=None, detectedHandler=None]) + + A :py:class:`TapRecognizer` detects short touches without a large change of the + cursor position. + + :param maxTime: The maximum time that the tap may take in milliseconds. + + :param maxDist: The maximum distance the contact may move in millimeters. + + + .. autoclass:: Transform(trans, [rot=0, scale=1, pivot=(0,0)]) + + Encapsulates a coordinate transformation and can be used to change the position, + rotation and scale of a node. + + .. py:attribute:: pivot + + The point around which rot and scale are applied. + + .. py:attribute:: rot + + Rotation in radians. + + .. py:attribute:: scale + + Multiplies the size of the node. + + .. py:attribute:: trans + + The translation. + + .. py:method:: moveNode(node) + + Changes a :py:attr:`node`'s pos, angle and size by applying the transform. + + + .. autoclass:: TransformRecognizer(eventNode, [coordSysNode=None, initialEvent=None, friction=-1, detectedHandler=None, moveHandler=None, upHandler=None, endHandler=None]) + + A :py:class:`TransformRecognizer` is used to support drag/zoom/rotate + functionality. From any number of touches on a node, it calculates an aggregate + transform that can be used to change the position, size and angle of a node. + The class supports intertia after the node is released. + + :param avg.Node eventNode: + + The node to attach to. The :py:class:`TransformRecognizer` registers an event + handler to react to any contacts for this node. + + :param avg.Node coordSysNode: + + Used to determine the coordinate system for the transforms returned by the + callbacks. If :py:attr:`coordSysNode` is not given, :py:attr:`eventNode` is + used as default. The :py:class:`TransformRecognizer` never modifies any nodes + itself. :py:attr:`coordSysNode` can be used to separate the node that + is the 'handle' for the events from the node that is being moved - for + instance, to allow moving and rotating a window by dragging the title bar. + + :param float friction: + + If set, this parameter enables inertia processing. It describes how + quickly the transform comes to a stop after the cursor is released. + + :param moveHandler: + + A shortcut for + :samp:`Recognizer.subscribe(Recognizer.MOTION, moveHandler)`. + + :param upHandler: + + A shortcut for + :samp:`Recognizer.subscribe(Recognizer.UP, upHandler)`. + + **Messages:** + + To get these messages, call :py:meth:`Publisher.subscribe`. + + .. py:method:: Recognizer.MOTION(transform) + + Emitted whenever the transform changes. This usually happens + in response to one or more :py:const:`CURSORMOTION` events, but may also + happen because of inertia. + + :param Transform transform: + + The change in transformation since the last call of move or up. + + .. py:method:: Recognizer.UP(transform) + + Called when the last touch is released. If inertia is enabled, there may + be move events after the up event. + + :param Transform transform: + + The change in transformation since the last call of move. + + .. py:method:: abort() + + Aborts the present recognized gesture and sliding caused by inertia. + diff --git a/sphinxdoc/index.rst b/sphinxdoc/index.rst new file mode 100644 index 0000000..1611175 --- /dev/null +++ b/sphinxdoc/index.rst @@ -0,0 +1,31 @@ +libavg Reference +================ + +Welcome to the libavg reference documentation. This documentation describes the syntax +and semantics of the library. As a reference, it aims to be exact and complete. It is not +intended to be an informal introduction to libavg - for this, have a look at +http://www.libavg.de/wiki/ProgrammersGuide. + +.. toctree:: + :maxdepth: 1 + + player + app + basenodes + areanodes + vectornodes + events + animation + fx + gesture + widget + misc + +Indexes and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` + +Generated |today|. diff --git a/sphinxdoc/misc.rst b/sphinxdoc/misc.rst new file mode 100644 index 0000000..ed84ccc --- /dev/null +++ b/sphinxdoc/misc.rst @@ -0,0 +1,685 @@ +Misc. Classes +============= + +.. automodule:: libavg.avg + :no-members: + + .. autoclass:: Bitmap + + Class representing a rectangular set of pixels in CPU memory. Bitmaps can be + obtained from any :py:class:`RasterNode` or loaded from disk. For nodes of type + :py:class:`ImageNode`, the current bitmap can be set as well. In general, huge + Bitmaps (e.g. width>65536) are supported as long as they fit into memory. + + The layout of the pixels in the bitmap is described by its pixel format. + The names for pixel format constants are confusing. They try to follow logic, + but it's a bit elusive: In many cases, each component is described by a single + letter indicating the component's role in the pixel and a number indicating the + number of bits used for this component. + Components are named in the order they appear in memory. In the cases where + the name doesn't follow this logic, reasons for the name are usually historical or + by convention. + You can receive a complete list of all supported pixel formats by calling + :py:func:`avg.getSupportedPixelFormats()`. + The pixel formats are: + + * :py:const:`B5G6R5`: 16 bits per pixel blue, green, red components. + * :py:const:`B8G8R8`: 24 bits per pixel blue, green, red components. + * :py:const:`B8G8R8A8`: 32 bits per pixel: blue, green, red and an + alpha (opacity) component. + * :py:const:`B8G8R8X8`: 32 bits per pixel, with the last byte unused. + * :py:const:`A8B8G8R8` + * :py:const:`X8B8G8R8` + * :py:const:`R5G6B5` + * :py:const:`R8G8B8` + * :py:const:`R8G8B8A8` + * :py:const:`R8G8B8X8` + * :py:const:`A8R8G8B8` + * :py:const:`X8R8G8B8` + * :py:const:`I8`: 8 bits of greyscale intensity. + * :py:const:`I16`: 16 bits of greyscale intensity. + * :py:const:`A8`: 8 bits of transparency information. + * :py:const:`YCbCr411`: Interleaved YCbCr: Y Y Cb Y Y Cr. + Effectively 12 bits per pixel. Output format of some cameras. + * :py:const:`YCbCr422`: Interleaved YCbCr: Cb Y Cr Y. + Effectively 16 bits per pixel. Output format of some cameras. + * :py:const:`YUYV422`: Like YCbCr422, but grey values come first, so the + order is Y Cb Y Cr. + * :py:const:`YCbCr420p`: Not a valid pixel format for a single bitmap, but + still a description of planar bitmap coding. Signifies separate + bitmaps for Y, Cb and Cr components, with Cb and Cr half as big in both x + and y dimensions. This is mpeg YCbCr, where the color components have + values from 16...235. Used by many video formats, including mpeg. + * :py:const:`YCbCrJ420p`: Same as YCbCr420p, but this is the jpeg version + with component values in the range 0...255. Used in video as well, for + instance in motion jpeg encoding. + * :py:const:`YCbCrA420p`: YCbCr420p with an additional alpha (transparency) + bitmap at full resolution. Used in flash video with transparency. + * :py:const:`BAYER8`: Bayer pattern. This is raw camera sensor data with + an unspecified pixel order. The other :py:const:`BAYER_XXX` constants + specify differing camera sensor arrangements. + * :py:const:`BAYER8_RGGB` + * :py:const:`BAYER8_GBRG` + * :py:const:`BAYER8_GRBG` + * :py:const:`BAYER8_BGGR` + * :py:const:`R32G32B32A32F`: 32 bits per channel float RGBA. + * :py:const:`I32F`: 32 bits per channel greyscale intensity. + + .. py:method:: __init__(size, pixelFormat, name) + + Creates an uninitialized bitmap of the given size and pixel format. + :py:attr:`name` is a name to be used in debug output. + + .. py:method:: __init__(bitmap) + + Creates a copy of an already existing bitmap. + + .. py:method:: __init__(bitmap, tlPos, brPos) + + Returns a rectangle inside an existing bitmap as a new bitmap. Note that the + pixels are not copied and write operations will therefore effect the + original bitmap as well. + + .. py:method:: __init__(fileName) + + Loads an image file from disk and returns it as bitmap object. + + .. py:method:: blt(srcBmp, pos) + + Copies the pixels of srcBmp into the current bitmap at pos. + + .. py:method:: getAvg() -> float + + Returns the average of all bitmap pixels. + + .. py:method:: getChannelAvg(channel) -> float + + Returns the average of one of the bitmap color channels (red, green or blue). + Used for automatic tests. + + .. py:method:: getFormat() + + Returns the bitmap's pixel format. + + .. py:method:: getName() -> string + + .. py:method:: getPixel(pos) -> (r,g,b,a) + + Returns one image pixel as a color tuple. This should only be used + for single pixels, as it is very slow. + + .. py:method:: getPixels() -> string + + Returns the raw pixel data in the bitmap as a python string. This + method can be used to interface to the python imaging library PIL + (http://www.pythonware.com/products/pil/). + + .. py:method:: getResized(newSize) -> Bitmap + + Returns a new bitmap that is a resized version of the original. + + .. py:method:: getSize() -> Point2D + + Returns the size of the image in pixels. + + .. py:method:: getStdDev() -> float + + Returns the standard deviation of all bitmap pixels. + + .. py:method:: save(filename) + + Writes the image to a file. File format is determined using the + extension. Supported file types are those supported by gdk-pixbuf. This + includes at least png, jpeg, gif, tiff and xpixmaps. + + .. py:method:: setPixels(pixels) + + Changes the raw pixel data in the bitmap. Doesn't change dimensions + or pixel format. Can be used to interface to the python imaging + library PIL (http://www.pythonware.com/products/pil/). + + :param string pixels: Image data. + + .. py:method:: subtract(otherbitmap) -> bmp + + Subtracts two bitmaps and returns the result. Used mainly to compare + test images with the intended results (along with :py:meth:`getAvg` and + :py:meth:`getStdDev`). + + .. autoclass:: BitmapManager + + (EXPERIMENTAL) Singleton class that allow an asynchronous load of bitmaps. + The instance is accessed by :py:meth:`get`. + + .. py:method:: loadBitmap(fileName, callback, pixelformat=NO_PIXELFORMAT) + + Asynchronously loads a file into a Bitmap. The provided callback is invoked + with a Bitmap instance as argument in case of a successful load or with a + RuntimeError exception instance in case of failure. The optional parameter + :py:attr:`pixelformat` can be used to convert the bitmap to a specific format + asynchronously as well. + + .. py:classmethod:: get() -> BitmapManager + + This method gives access to the BitmapManager instance. + + .. py:method:: setNumThreads(numThreads) + + Sets the number of threads used to load bitmaps. The default is a single + thread. This should generally be less than the number of logical cores + available. + + .. autoclass:: CubicSpline(controlpoints) + + Class that generates a smooth curve between control points using cubic + spline-based interpolation. For an introduction on spline interpolation, + see http://en.wikipedia.org/wiki/Spline_interpolation. + + :param controlpoints: + + A list of 2D coordinates. The x coordinates must be in increasing order. + + .. py:method:: interpolate(x) -> y + + Takes an x coordinate and delivers a corresponding y coordinate. + + + .. autoclass:: FontStyle(font="sans", variant="", color="FFFFFF", fontsize=15, indent=0, linespacing=-1, alignment="left", wrapmode="word", justify=False, letterspacing=0, aagamma=1, hint=True) + + A :py:class:`FontStyle` object encapsulates all configurable font attributes in a + :py:class:`WordsNode`. It provides a way to set all relevant attributes + (:py:attr:`font`, :py:attr:`fontsize`, etc.) in one line of code. The attributes + correspond to the :py:class:`WordsNode` attributes; refer to the + :py:class:`WordsNode` reference for descriptions. + + + .. autoclass:: Logger + + An python interface to libavg's logger. + It can be accessed as follows: + + .. code-block:: python + + import libavg + libavg.logger + + + + **Logging** + + .. py:method:: log(message, category, severity) + + Logs a message if category is active or severity is at least + :py:const:`ERROR`. + + :param category: + + One of the categories listed or a custom category. Defaults to + :py:const:`Logger.Category.APP`. + + :param severity: + One of the severities listed. Defaults to :py:const:`Logger.Severity.INFO`. + + :param message: The log message string. + + .. py:method:: critical(msg, category) + + Shortcut to :py:meth:`log` with **severity=** :py:const:`Logger.Severity.CRIT`. + + .. py:method:: error(msg, category) + + Shortcut to :py:meth:`log` with **severity=** :py:const:`Logger.Severity.ERR`. + + .. py:method:: warning(msg, category) + + Shortcut to :py:meth:`log` with **severity=** :py:const:`Logger.Severity.WARN`. + + .. py:method:: info(msg, category) + + Shortcut to :py:meth:`log` with **severity=** :py:const:`Logger.Severity.INFO`. + + .. py:method:: debug(msg, category) + + Shortcut to :py:meth:`log` with **severity=** :py:const:`Logger.Severity.DBG`. + + **Configuration** + + .. py:method:: addSink(logger) + + Add a python logger object to libavg's logging handlers. + The python logger gets the key `category` as an "extra" kwarg, useful for + formatting the output. + + .. py:method:: removeSink(logger) + + Remove a previously added logger. It will not receive any messages dispatched + by the logger annymore. It's safe to call the function even if the logger is + not present. + + .. py:method:: removeStdLogSink() + + Remove libavg console printing sink. + + Setting :envvar:`AVG_LOG_OMIT_STDERR` as EnvironmentVar has the same effect. + + .. py:method:: configureCategory(category, severity) + + Assign a severity to a given category. + category is either a custom string or a :py:const:`Logger.Category` + severity has to be one of :py:const:`Logger.Severity`, or it will default to + :py:const:`Logger.Severity.None` + + .. py:method:: getCategories() + + Returns a dict with **category** as key and **severity** as value + + + The Logger can also be configured using :envvar:`AVG_LOG_CATEGORIES` with + the format: + + .. code-block:: bash + + CATEGORY[:SEVERITY] [CATEGORY[:SEVERITY]]... + + Thus it is possible to set a severity level for every category. + If no severity is given, the default severity is used. + (refer to: :py:meth:`setDefaultSeverity`) + If the category does not exist, it will be created. + + .. code-block:: bash + + export AVG_LOG_CATEGORIES="CONFIG:INFO APP:DBG PROFILE:DBG MEMORY" + + Default categories are :py:const:`NONE`, :py:const:`APP` and + :py:const:`DEPREC`. They are set to the defaultSeverity. + + + + **Categories:** + + :py:const:`APP` + Reserved for application-level messages issued by python code. + :py:const:`CONFIG` + Outputs configuration data. + :py:const:`DEPREC` + Deprecation + Messages that warn of functionality that will be removed from libavg + in the future. + :py:const:`EVENTS` + Outputs basic event data. + :py:const:`MEMORY` + Outputs open/close information whenever a media file is accessed. + :py:const:`NONE` + Outputs everything that has not been categorized. + :py:const:`PROFILE` + Outputs performance statistics on player termination. + :py:const:`PROFILE_V` + Outputs performance statistics for video decoding. + :py:const:`PLUGIN` + Messages generated by loading plugins. + :py:const:`PLAYER` + General libavg playback messages. + :py:const:`SHADER` + Shader compiler messages. + + **Severities** + + :py:const:`CRIT` Critical + + :py:const:`ERR` Error + + :py:const:`WARN` Warning + + :py:const:`INFO` Info + + :py:const:`DBG` Debug + + :py:const:`NONE` None + + + .. autoclass:: Point2D([x,y=(0,0)]) + + A point in 2D space. Supports most arithmetic operations on vectors. The + operators :py:attr:`+`, :py:attr:`-`, :py:attr:`==` and :py:attr:`\!=` are + defined for two :py:class:`Point2D` parameters. Unary :py:attr:`-` (negation) + is defined as well. :py:class:`Point2D` objects can also be multiplied and + divided by a scalar. + + :py:class:`Point2D` implicitly converts from and to 2-element float tuples and + lists, so in most cases you can use one of these types whenever a point is needed. + + .. py:attribute:: x + + .. py:attribute:: y + + .. py:method:: getAngle() -> float + + Returns the direction of the vector as an angle between pi and -pi, with + 0 being the positive x axis. Angles run clockwise. + + .. py:method:: getNorm() -> float + + Returns the euclidian norm of the point, that is sqrt(x*x+y*y). + + .. py:method:: getNormalized() -> Point2D + + Returns a normalized version of the point with the same angle but a + norm of one. Throws an exception if called on Point2D(0,0). + + .. py:method:: getRotated(angle) -> Point2D + + Return the position of point rotated around the origin. + + .. py:method:: getRotated(angle, pivot) -> Point2D + + Return the position of point rotated around :py:attr:`pivot`. + + .. py:classmethod:: fromPolar(angle, radius) -> Point2D + + Converts polar to cartesian coordinates. :py:attr:`angle` is in radians with 0 + being the positive x axis. Angle is clockwise (assuming that y points + downward). + + + .. autoclass:: SVG(filename, [unescapeIllustratorIDs=False]) + + :py:class:`SVG` objects load and parse an svg file and render images from it. + svg (*Scalable Vector Graphics*, see http://en.wikipedia.org/wiki/Svg) files are + xml-based and contain two-dimensional vector graphics. They can be created with + editors such as Adobe Illustrator and Inkscape. :py:class:`SVG` objects can render + elements in the file to bitmaps and create image nodes from elements in the file. + Since the files contain vector graphics, the elements can be scaled to any size + when rendering without loss of resolution. + + :param filename: The name of the file to load. + + :param unescapeIllustratorIDs: + + If this is :py:const:`True`, the file is assumed to be generated by Adobe + Illustrator. Illustrator mangles element names to create IDs in the svg file. + Setting this parameter to :py:const:`True` allows these element names to be + passed as IDs. + + .. py:method:: renderElement(elementID, [size | scale=1]) -> Bitmap + + Renders an element to a :py:class:`Bitmap`. Either :py:attr:`scale` or + :py:attr:`size` may be given. :py:attr:`size` is the size of the bitmap. + :py:attr:`scale` is a factor to scale the native bitmap size with. + + .. py:method:: createImageNode(elementID, nodeAttrs, [size | scale=1]) -> Node + + Convenience method that calls :py:meth:`renderElement` to render a bitmap + and then creates an image node that displays that bitmap. :py:attr:`nodeAttrs` + is a dictionary containing constructor parameters for the node. + + .. py:method:: getElementPos(elementID) -> Point2D + + Returns the position of an element. + + .. py:method:: getElementSize(elementID) -> Point2D + + Returns the original size of an element. + + + .. autoclass:: TestHelper + + Miscellaneous routines used by tests. Not intended for normal application usage. + + + .. autoclass:: VersionInfo + + Exposes version data, including the specs of the builder. + + .. py:attribute:: full + + Full string containing a compact form of branch and revision number (if the + build doesn't come from an exported tree) + + .. py:attribute:: release + + String representation in the form `major.minor.micro` + + .. py:attribute:: major + + Integer component of the release version (major) + + .. py:attribute:: minor + + Integer component of the release version (minor) + + .. py:attribute:: micro + + Integer component of the release version (micro) + + .. py:attribute:: revision + + Revision number, if applicable, or 0 + + .. py:attribute:: branchurl + + Full URL path that represents the branch root, if applicable, or empty string + + .. py:attribute:: builder + + String representation in the form of `user@hostname machinespecs` + + .. py:attribute:: buildtime + + ISO timestamp representation of the build + + + .. autoclass:: VideoWriter(canvas, filename, [framerate=30, qmin=3, qmax=5, synctoplayback=True]) + + Class that writes the contents of a canvas to disk as a video file. The videos + are written as motion jpeg-encoded mov files. Writing commences immediately upon + object construction and continues until :py:meth:`stop` is called. + :py:meth:`pause` and :py:meth:`play` can be used to pause and resume writing. + + The VideoWriter is built for high performance: Opening, writing and closing the + video file is asynchronous to normal playback. Writing full HD videos of + offscreen canvasses to disk should cost virtually no time on the main thread of + execution for an Intel Core-class processor with a graphics card that supports + shaders. + + :param canvas: + + A libavg canvas used as source of the video. + + .. py:attribute:: filename + + The name of the file to write to. Read-only. + + .. py:attribute:: framerate + + The speed of the encoded video in frames per second. This is used for two + purposes. First, it determines the nominal playback speed of the video that is + encoded in the file. Second, if :py:attr:`synctoplayback` is + :py:const:`False`, the :py:class:`VideoWriter` will also use the + :py:attr:`framerate` value as the actual number of frames per second to + write. Read-only. + + .. py:attribute:: qmin + + .. py:attribute:: qmax + + :py:attr:`qmin` and :py:attr:`qmax` specify the minimum and maximum encoding + quality to use. :samp:`qmin = qmax = 1` give maximum quality at maximum file + size. :samp:`qmin=3` and :samp:`qmax=5` (the default) give a good quality and + a smaller file. Read-only. + + .. py:attribute:: synctoplayback + + If :py:attr:`synctoplayback` is :py:const:`True` (the default), each frame + played back in the canvas will be written to disk. This makes a lot of sense + in combination with :py:meth:`Canvas.registerCameraNode()`. If not, + :py:attr:`framerate` is used to determine which frames to write to disk. For + instance, if :py:attr:`synctoplayback` is :py:const:`False`, + :py:attr:`framerate` is 25 and the player is running at 60 fps, one movie + frame will be written for each 2.5 frames of playback. The actual, not the + nominal playback speed is used in this case. Read-only. + + .. py:method:: pause() + + Temporarily stops recording. + + .. py:method:: play() + + Resumes recording after a call to :py:meth:`pause`. :py:meth:`play` doesn't + need to be called after construction of the :py:class:`VideoWriter` - writing + commences immediately. + + .. py:method:: stop() + + Ends the recording and writes the rest of the file to disk. Note that this is + asynchronous to normal playback. If you need to immediately re-open the + video file (e.g. for playback in a video node), destroy the python object + first. This waits for sync. + + .. autofunction:: getMemoryUsage() -> int + + Returns the amount of memory used by the application in bytes. More + precisely, this function returns the resident set size of the process + in bytes. This does not include shared libraries or memory paged out to + disk. + + .. autofunction:: pointInPolygon(point, poly) -> bool + + Checks if a point is inside a polygon. + + :param Point2D point: Point to check. + :param poly: List of points which constitute a polygon to check against. + :returns: :py:const:`True` if point is inside, :py:const:`False` otherwise. + + .. autofunction:: validateXml(xmlString, schemaString, xmlName, schemaName) + + Validates an xml string using a schema. Throws an exception if the xml doesn't + conform to the schema. + + +.. automodule:: libavg.statemachine + :no-members: + + .. autoclass:: StateMachine(name, startState) + + A generic state machine, useful for user interface and other states. Consists of + a set of states (represented by strings) and possible transitions between the + states. The :py:class:`StateMachine` can be configured to invoke callbacks at + specific transitions and when entering or leaving a state. All callbacks are + optional. State changes can be logged for debugging purposes. + + State machines are initialized by calling :py:meth:`addState` for each + possible state after constructing it. + + :param String name: + + A name for the state machine to be used in debugging output. + + :param String startState: + + .. py:attribute:: state + + The current state the :py:class:`StateMachine` is in. States are strings. + + .. py:method:: addState(state, transitions, [enterFunc=None, leaveFunc=None]) + + Adds a state to the :py:class:`StateMachine`. Must be called before the first + changeState. + + :param String state: The name of the state to add. + :param transitions: + + This parameter can be either a list of destination states or a dict of + destinationState: callable pairs. The callables are invoked whenever the + corresponding state change happens. If :py:meth:`transitions` is a list, + no state change callbacks are registered. + + :param enterFunc: A callable to invoke whenever the state is entered. + :param leaveFunc: A callable to invoke whenever the state is left. + + .. py:method:: changeState(newState) + + Changes the state. This includes calling the leave callback for the current + state, actually changing the state, calling the transition callback and + calling the enter callback for the new state. + + Raises a :py:class:`RuntimeError` if :py:attr:`newState` is not a valid state + or if there is no transition defined from the current state to + :py:attr:`newState`. + + .. py:method:: dump() + + Prints all states and transitions to the console. + + .. py:method:: makeDiagram(imageFName, [showMethods=False]) + + Dumps a graph of the state machine to an image file using dot. graphviz must + be installed and in the path for this to work. Very useful for debugging. If + :py:attr:`showMethods` is true, names of enter, leave and transition + methods are included in the diagram. + + .. py:method:: traceChanges(trace) + + If :py:attr:`trace` is set to :py:const:`True`, all state changes are dumped + to the console. + + +.. automodule:: libavg.persist + :no-members: + + .. autoclass:: Persist(storeFile, initialData[, validator=lambda v: True, autoCommit=False]) + + A general purpose persistent object. + Its state is defined in the :py:attr:`data` attribute and pickled + from/to a store file. + + + :param string storeFile: + + Full path of the store file that is used to store and retrieve a + serialized version of the data. + + :param initialData: + + A pickle-able object that is assigned to the :py:attr:`data` attribute + when no file store exists or when the store file is corrupted. + + :param callable validator: + + An optional callable that receives the object state as soon it's + de-pickled from the store file. If the validator call doesn't return True, + the object state is restored to the provided `initialData`. + + :param bool autoCommit: + + If True, the :py:attr:`commit` method is registered as an `atexit` function. + + .. py:attribute:: data + + State of the persistent object. + + .. py:attribute:: storeFile + + Returns the full path of the store file. + + .. py:method:: commit() + + Dumps the contents of the :py:attr:`data` attribute to the store file. + + + .. autoclass:: UserPersistentData(appName, fileName, initialData[, validator=lambda v: True, autoCommit=False]) + + A :py:class:`Persist` subclass that sets up an OS-independent path for + the store file. + Under posix-compliant OSes is `$HOME/.avg//.pkl` + Under Windows is `%APPDATA%\Avg\/.pkl` + + :param string appName: + + Name of the application. This string is used to compose the full path to + the file store and it creates a namespace (directory) for multiple files + for the same application. + + :param string fileName: + + Name of the file store file. `.pkl` will be added as extension. + diff --git a/sphinxdoc/player.rst b/sphinxdoc/player.rst new file mode 100644 index 0000000..ba9115e --- /dev/null +++ b/sphinxdoc/player.rst @@ -0,0 +1,629 @@ +Player & Canvas +=============== + +.. automodule:: libavg.avg + :no-members: + + .. inheritance-diagram:: OffscreenCanvas + :parts: 1 + + .. inheritance-diagram:: Player + :parts: 1 + + This section describes the classes that provide a framework for rendering. The + :py:class:`Player` class is an interface to the avg renderer. The + :py:class:`Canvas` class and its descendant :py:class:`OffscreenCanvas` provide + areas to draw on. + + .. autoclass:: Canvas + + A Canvas is a tree of nodes. It is the place where a scenegraph is displayed. In + a libavg session, there is one main canvas that corresponds to the screen (which + is of class :py:class:`Canvas`) and zero or more canvases that are rendered + offscreen (which are of class :py:class:`OffscreenCanvas`). + + .. py:method:: getElementByID(id) -> Node + + Returns the element in the canvas's tree that has the :py:attr:`id` + given. + + .. py:method:: screenshot() -> Bitmap + + Returns the image the canvas has last rendered as :py:class:`Bitmap`. For + the main canvas, this is a real screenshot. For offscreen canvases, this + is the image rendered offscreen. + + .. py:method:: getRootNode() -> CanvasNode + + Returns the root of the scenegraph. For the main canvas, this is an + :py:class:`AVGNode`. For an offscreen canvas, this is a + :py:class:`CanvasNode`. + + .. autoclass:: OffscreenCanvas + + An OffscreenCanvas is a Canvas that is rendered to a texture. It can be + referenced in the href attribute of an image node. See + https://www.libavg.de/wiki/ProgrammersGuide/OffscreenRendering for an in-depth + explanation of using offscreen rendering. Offscreen canvases are created by + calling :py:meth:`Player.createCanvas`, :py:meth:`Player.loadCanvasFile` or + :py:meth:`Player.loadCanvasString`. + + .. py:attribute:: autorender + + Turns autorendering on or off. Default is :py:const:`True`. + + .. py:attribute:: handleevents + + :py:const:`True` if events that arrive at an image node that is displaying + this canvas are routed to the offscreen canvas. Read-only. + + .. py:attribute:: mipmap + + :py:const:`True` if mipmaps are generated and used for the canvas. This is + used instead of RasterNode.mipmap for images that render the canvas. + Read-only. + + .. py:attribute:: multisamplesamples + + Number of samples per pixel to use for multisampling. Setting this to + 1 disables multisampling. Read-only. + + .. py:method:: getID() -> string + + Returns the id of the canvas. This is the same as + calling :samp:`canvas.getRootNode().getID()`. + + .. py:method:: getNumDependentCanvases + + Returns the number of canvases that reference this canvas. Used mainly + for unit tests. + + .. py:method:: registerCameraNode + + .. py:method:: render() + + Forces an immediate redraw of the offscreen canvas. This makes sure that + following calls to screenshot() get a current version of the canvas and + is usually used in combination with :samp:`autorender=False`. + + .. py:method:: unregisterCameraNode + + .. py:classmethod:: isMultisampleSupported() -> bool + + :py:const:`True` if the machine's OpenGL implementation supports offscreen + multisampling. + + .. autoclass:: Player + + The class used to load and play avg files and the main interface to the avg + renderer. Player is a singleton. There is only one instance, accessed by + :py:attr:`avg.player`. + + **Messages:** + + To get these messages, call :py:meth:`Publisher.subscribe`. + + .. py:method:: KEY_DOWN(keyEvent) + + Called whenever a key is pressed. + + .. py:method:: KEY_UP(keyEvent) + + Called whenever a key is released. + + .. py:method:: ON_FRAME() + + Called each frame. + + .. py:attribute:: pluginPath + + A list of directories where the player searches for plugins when + :py:meth:`loadPlugin()` is called. The separator between path entries is a + semicolon (';') under Windows and a colon (':') under Mac and Linux. + + .. py:attribute:: volume + + Total audio playback volume. 0 is silence, 1 passes media file + volume through unchanged. Values higher than 1 can be used to + amplify playback. A limiter prevents distortion when the volume + is set too high. + + .. py:method:: addInputDevice(inputDevice) + + Registers an :py:class:`InputDevice` with the system. + + .. py:method:: areFullShadersSupported() -> bool + + Returns :py:const:`True` if the current OpenGL configuration has full shader + support. Platforms without full shader support (this includes OpenGL ES) disable + several :py:class:`FXNode` types. Calling this when playback is not running is + an error. + + .. py:method:: assumePixelsPerMM(ppmm) + + Tells the system to assume a resolution for the physical screen, overriding + operating system information. The parameter is the number of pixels per + millimeter as a :samp:`float`. This function affects the values returned by + :py:meth:`getPhysicalScreenDimensions` and :py:meth:`getPixelsPerMM`. It is + useful for situations in which the OS cannot know the resolution (e.g. + projectors) and when the automatic functions return wrong values (which + happens, unfortunately, because of operating system deficiencies). + + .. py:method:: callFromThread(pyfunc) + + Executes :py:attr:`pyfunc` in the main thread of execution, in the next event + handling phase. This method is the only libavg method that is thread-safe and + can be called from secondary threads of execution. :py:attr:`pyfunc` can be + any python callable, including any libavg methods. + + .. py:method:: clearInterval(id) -> bool + + Stops a timeout, an interval or an onFrameHandler from being called. + Returns :py:const:`True` if there was an interval with the given + :py:attr:`id`, :py:const:`False` if not. + + :param int id: + + An id returned by :py:meth:`setInterval`, :py:meth:`setTimeout` + or :py:meth:`setOnFrameHandler`. + + .. py:method:: createCanvas(*params) -> OffscreenCanvas + + Creates an empty offscreen canvas. Parameters are given under + :py:class:`OffscreenCanvas`. + + .. py:method:: createMainCanvas(*params) -> Canvas + + Creates an empty canvas with a render window and an AVGNode as root node. + Parameters are given under :py:class:`AVGNode`. + + .. py:method:: createNode(xml) -> Node + + Creates a new Node. This node can be used as parameter to + :py:meth:`DivNode.appendChild()` and :py:meth:`DivNode.insertChild()`. + This method will create any type of node, including :samp:`
` nodes + with children. + + :param xml: + + xml string conforming to the avg dtd that specifies the node to create. + + .. py:method:: createNode(type, args) -> Node + + Creates a new Node. This node can be used as parameter to + :py:meth:`DivNode.appendChild()` and :py:meth:`DivNode.insertChild()`. + This method will only create one node at a time. + + :param string type: + + Type string of the node to create (For example, :samp:`image` and + :samp:`words` are valid type strings). + + :param dict args: a dictionary specifying attributes of the node. + + .. py:method:: deleteCanvas(id) + + Removes the canvas given by id from the player's internal list of + canvases. It is an error to delete a canvas that is still referenced by + an image node. + + .. py:method:: enableGLErrorChecks(enable) + + Enables or disables checking for errors after each OpenGL call. By default, + this is :py:const:`False`, since it hurts performance in some setups. It is + enabled by the tests. You do not need this method unless you are looking for + errors inside libavg. + + .. py:method:: enableMouse(enable) + + Enables or disable mouse event handling. + + .. py:method:: enableMultitouch() + + Enables multitouch event handling. Several drivers are available that + generate multitouch events. To choose a driver, set the environment + variable :envvar:`AVG_MULTITOUCH_DRIVER` to the appropriate value: + + :samp:`TUIO`: + Listens for TUIO events from a tracker that conforms to the TUIO + protocol (http://www.tuio.org), a de-facto standard for multitouch + events. By default, it listens to events on the default TUIO UDP port + 3333, but this can be configured using the environment variable + :envvar:`AVG_TUIO_PORT`. + + :samp:`APPLETRACKPAD`: + Uses the trackpad built into Mac Book Pros to generate events. + + :samp:`LINUXMTDEV`: + Uses the linux mtdev library to interface to multitouch devices. + The environment variable :envvar:`AVG_LINUX_MULTITOUCH_DEVICE` is used + to determine which device file to open. Default is + :samp:`/dev/input/event3`. + + :samp:`TRACKER`: + Enables the internal camera-based tracker. Configuring this tracker is + described under https://www.libavg.de/wiki/ProgrammersGuide/Tracker. + + :samp:`WIN7TOUCH`: + Enables handling of Windows 7 touch events. This works with all devices + which have Windows 7 drivers. + + :samp:`XINPUT`: + Uses X11-based multitouch detection. This needs X11 with XInput >= 2.1 + support. For backwards compatibility reasons, XINPUT21 is supported as + value as well. + + If :envvar:`AVG_MULTITOUCH_DRIVER` is not set, the driver defaults to + a plattform-specific one. Under Linux, the default is :samp:`XINPUT` if + XInput multitouch is supported on the system, otherwise :samp:`LINUXMTDEV`. + Under Windows, the default is :samp:`WIN7TOUCH`. + + :py:meth:`enableMultitouch` throws an exception if the chosen driver is not + available or no multitouch device could be found. (Exception: Since there is + no way to determine if a TUIO device is available, :py:meth:`enableMultitouch` + always appears to succeed in this case.) + + .. py:method:: getCanvas(id) -> OffscreenCanvas + + Returns the offscreen canvas with the :py:attr:`id` given. + + .. py:method:: getCurrentEvent() -> Event + + Must be called inside an event handler and returns the event that's being + processed. Throws an exception if called outside an event handler. + + .. py:method:: getEffectiveFramerate() -> float + + Returns the framerate that the player is actually achieving. The + value returned is not averaged and reflects only the current frame. + + .. py:method:: getElementByID(id) -> Node + + Returns an element in the main avg tree. + + :param id: id attribute of the node to return. + + .. py:method:: getEventHook() -> pyfunc + + Returns the last event hook set using :py:meth:`setEventHook`. + + .. py:method:: getFrameDuration() -> float + + Returns the number of milliseconds that have elapsed since the last + frame (i.e. the last display update). + + .. py:method:: getFramerate() -> float + + Returns the current target framerate in frames per second. To get the + actual framerate that the player is currently achieving, call + :py:meth:`getEffectiveFramerate`. + + .. py:method:: getFrameTime() -> int + + Returns the number of milliseconds that have elapsed since playback + has started. Honors FakeFPS. The time returned stays constant for an + entire frame; it is the time of the last display update. + + .. py:method:: getKeyModifierState() -> KeyModifier + + Returns the current modifier keys pressed, or'ed together. For a list of + possible values, see :py:attr:`KeyEvent.modifiers`. + + .. py:method:: getMainCanvas() -> Canvas + + Returns the main canvas. This is the canvas loaded using :py:meth:`loadFile` + or :py:meth:`loadString` and displayed on screen. + + .. py:method:: getMouseState() -> MouseEvent + + Returns the last mouse event generated. + + .. py:method:: getPhysicalScreenDimensions() -> Point2D + + Returns the size of the primary screen in millimeters. + + .. py:method:: getPixelsPerMM() -> float + + Returns the number of dots per millimeter of the primary display. Assumes + square pixels. + + .. py:method:: getRootNode() -> Node + + Returns the outermost element in the main avg tree. + + .. py:method:: getScreenResolution() -> Point2D + + Returns the size in pixels of the current screen. + + .. py:method:: getTestHelper + + .. py:method:: getTracker() -> Tracker + + Returns a tracker previously created using :py:meth:`enableMultitouch` with + the internal tracker configured. + + .. py:method:: getVideoMemInstalled() -> int + + Returns the amount of dedicated video memory installed in the system in + bytes (which might be zero in case of shared-memory graphics cards). + Only available when using NVidia drivers. + + .. py:method:: getVideoMemUsed() -> int + + Returns the amount of dedicated video memory used in bytes. This + is the total amount used by all programs. Only available when using NVidia + drivers. + + .. py:method:: getVideoRefreshRate() -> float + + Returns the current hardware video refresh rate in number of + refreshes per second. + + .. py:method:: isCursorShown() + + Returns :py:const:`True` if the mouse cursor is visible. + + .. py:method:: isFullscreen() + + Returns :py:const:`True` if the player is running in fullscreen mode. + + .. py:method:: isMultitouchAvailable() -> bool + + Returns :py:const:`True` if a multitouch device has been configured and is + active, :py:const:`False` if not. Must be called after :py:meth:`play()`. + + .. py:method:: isPlaying() -> bool + + Returns :py:const:`True` if :py:meth:`play()` is currently executing, + :py:const:`False` if not. + + .. py:method:: keepWindowOpen() + + Tells the player to keep the playback window open after :py:meth:`play()` + has returned. This makes it possible to reuse the window with another scene + and :py:meth:`play()` call. It is used by the tests to keep flickering to a + minimum and increase speed. + + .. py:method:: loadCanvasFile(filename) -> OffscreenCanvas + + Loads the canvas file specified in filename and adds it to the + registered offscreen canvases. + + .. py:method:: loadCanvasString(avgString) -> OffscreenCanvas + + Parses avgString, loads the nodes it contains and adds the hierarchy + to the registered offscreen canvases. + + :param string avgString: An xml string containing an avg node hierarchy. + + .. py:method:: loadFile(filename) -> Canvas + + Loads the avg file specified in filename. Returns the canvas loaded. + The canvas is the main canvas displayed onscreen. + + .. py:method:: loadPlugin(name) + + Load a Plugin. + + :param string name: filename of the plugin without directory and + file extension. + + .. py:method:: loadString(avgString) -> Canvas + + Parses avgString and loads the nodes it contains. Returns the canvas + loaded. The canvas is the main canvas displayed onscreen. + + :param string avgString: An xml string containing an avg node hierarchy. + + .. py:method:: play() + + Opens a playback window or screen and starts playback. play returns + when playback has ended. + + .. py:method:: screenshot() -> Bitmap + + Returns the contents of the current screen as a bitmap. + + .. py:method:: setCursor(bitmap, hotspot) + + Sets the mouse cursor to the bitmap given. The bitmap must have a size + divisible by 8 and an RGBA pixel format. The cursor generated is + binary black and white with a binary transparency channel. hotspot is + the relative position of the actual pointing coordinate in the + bitmap. + + .. py:method:: setEventHook(pyfunc) + + Set a callable which will receive all events before the standard event + handlers receive them. If this callable returns :py:const:`True`, + the event is not propagated to the standard event handlers. + + Generally, :py:meth:`setEventHook` should be used as a last resort. In most + cases, standard event handlers are a lot cleaner. Also, setting several event + hooks is not supported by libavg. To get around this limitation, you can + use :py:meth:`getEventHook` to chain event hook functions. + + Note that :py:attr:`event.node` is not set in the callback, since the + system hasn't determined the node to send the event to at that + point. + + .. py:method:: setFakeFPS(fps) + + Sets a fixed number of virtual frames per second that are used as + clock source for video playback, animations and other time-based + actions. If a value of :samp:`-1` is given as parameter, the real clock is + used. :py:meth:`setFakeFPS` can be used to get reproducible results for + recordings or automated tests. Setting FakeFPS has the side-effect of + disabling audio. + + .. py:method:: setFramerate(framerate) + + Sets the desired framerate for playback. Turns off syncronization + to the vertical blanking interval. + + .. py:method:: setGamma(red, green, blue) + + Sets display gamma. This is a control for overall brightness and + contrast that leaves black and white unchanged but adjusts greyscale + values. :samp:`1.0` is identity, higher values give a brighter image, lower + values a darker one. + + .. py:method:: setInterval(time, pyfunc) -> int + + Sets a python callable object that should be executed regularly. + :py:meth:`setInterval` returns an id that can be used to + call :py:meth:`clearInterval()` to stop the function from being called. The + callback is called at most once per frame. + + :param int time: Number of milliseconds between two calls. + + :param pyfunc: Python callable to execute. + + .. py:method:: setMousePos(pos) + + Sets the position of the mouse cursor. Generates a mouse motion event. + + .. py:method:: setMultiSampleSamples(multiSampleSamples) + + Sets the number of samples per pixel to compute. + This costs performance and smoothes the edges of polygons. A value of + :samp:`1` turns multisampling (also knowna as FSAA - Full-Screen + Antialiasing) off. Good values are dependent on the graphics driver and + the performance of the graphics card. + + .. py:method:: setOGLOptions(usePOW2Textures, usePixelBuffers, multiSampleSamples, shaderUsage=AUTO, useDebugContext=False) + + Determines which OpenGL extensions to check for and use if possible. + This method is mainly used for debugging purposes while developing libavg, + but can also be used to work around buggy drivers. The values set here + override those in the :file:`avgrc` file. Note that with the exception of + multiSampleSamples, fallbacks are always used - if a feature is + specified that the system doesn't support, a less demanding one will + be used. + + Must be called before :py:meth:`play`. + + :param bool usePOW2Textures: + + If :py:const:`True`, restricts textures to power-of-two dimensions. + + :param bool usePixelBuffers: + + If :py:const:`False`, disables the use of OpenGL pixel buffer objects. + + :param int multiSampleSamples: + + The number of samples per pixel to compute. + This costs performance and smoothes the edges of polygons. A value of + :samp:`1` turns multisampling (also known as FSAA - Full-Screen + Antialiasing) off. Good values are dependent on the graphics driver and + the performance of the graphics card. + + :param shaderUsage: + + Either :py:const:`FULL`, :py:const:`MINIMAL` or :py:const:`AUTO`. + :py:const:`MINIMAL` restricts shader usage to a subset that doesn't use + much GPU power. + + :param useDebugContext: + + Uses an OpenGL Debug Context for rendering if the graphics driver supports + it. This causes more verbose error messages and warnings in the case of + OpenGL errors. + + + .. py:method:: setOnFrameHandler(pyfunc) -> int + + Sets a python callable object that should be executed once per frame. + This is the same as :samp:`setInterval(0, pyfunc)`. Returns an id that can + be used to call :py:meth:`clearInterval()` to stop the function from being + called. + + :param pyfunc: Python callable to execute. + + .. py:method:: setResolution(fullscreen, width, height, bpp) + + Sets display engine parameters. Must be called before :py:meth:`loadFile` or + :py:meth:`loadString`. + + :param bool fullscreen: + + :py:const:`True` if the avg file should be rendered fullscreen. + + :param int width, height: + + The window size (if fullscreen is :py:const:`False`) + or screen resolution (if fullscreen is :py:const:`True`). + + :param int bpp: + + Number of bits per pixel to use. Valid values are :samp:`15`, :samp:`16`, + :samp:`24` and :samp:`32`. + + .. py:method:: setTimeout(time, pyfunc) -> int + + Sets a python callable object that should be executed after a set + amount of time. :py:meth:`setTimeout` returns an id that can be used to + call :py:meth:`clearInterval()` to stop the function from being called. + + :param int time: Number of milliseconds before the call. + + :param pyfunc: Python callable to execute. + + .. py:method:: setVBlankFramerate(rate) + + Sets the desired number of monitor refreshes before the next + frame is displayed. The resulting framerate is determined by the + monitor refresh rate divided by the rate parameter. + + :param int rate: + + Number of vertical blanking intervals to wait. On Mac OS X, only :samp:`1` + is supported as rate. + + .. py:method:: setWindowFrame(hasWindowFrame) + + :py:attr:`hasWindowFrame` should be set to :py:const:`True` if a + non-fullscreen player should have a window frame. If set to + :py:const:`False`, the player runs with no title bar or window frame. Must + be called before :py:meth:`play` is called. + + .. py:method:: setWindowPos(x, y) + + Sets the location of the player window. Must be called before loadFile + or loadString. + + .. py:method:: setWindowTitle(title) + + Sets the string displayed in the title bar of the libavg window. Default is + 'libavg'. + + .. py:method:: showCursor(show) + + Shows or hides the mouse cursor. + + :param bool show: :py:const:`True` if the mouse cursor should be visible. + + .. py:method:: stop() + + Stops playback and resets the video mode if necessary. + + .. py:method:: stopOnEscape(stop) + + Toggles player stop upon escape keystroke. If stop is :py:const:`True` + (the default), if player will halt playback when :kbd:`Esc` is pressed. + + .. py:method:: useGLES(gles) + + Chooses whether to use OpenGL ES or desktop OpenGL for rendering. + Must be called before :py:meth:`play`. + + :param bool gles: :py:const:`True` if OpenGL ES should be used. + + .. py:classmethod:: get() -> Player + + .. deprecated:: 1.8 + Use :attr:`avg.player` instead. + + This method gives access to the player instance. If no player has been + created yet, a player is created. diff --git a/sphinxdoc/vectornodes.rst b/sphinxdoc/vectornodes.rst new file mode 100644 index 0000000..b45e750 --- /dev/null +++ b/sphinxdoc/vectornodes.rst @@ -0,0 +1,224 @@ +Vector Nodes +============ + +.. automodule:: libavg.avg + :no-members: + + .. inheritance-diagram:: CircleNode CurveNode FilledVectorNode LineNode MeshNode Node PolygonNode PolyLineNode RectNode VectorNode libavg.geom.Arc libavg.geom.PieSlice libavg.geom.RoundedRect + :parts: 1 + + .. autoclass:: CircleNode([r=1, texcoord1=0, texcoord2=1]) + + A circle. The reference point for a circle is its center. + + .. py:attribute:: r + + The radius of the circle in pixels. + + .. py:attribute:: texcoord1 + + .. py:attribute:: texcoord2 + + .. autoclass:: CurveNode([pos1, pos2, pos3, pos4, texcoord1, texcoord2]) + + A cubic bezier curve (``_). + :py:attr:`pos1` and :py:attr:`pos4` are the two endpoints of the curve. + :py:attr:`pos2` and :py:attr:`pos3` are control points. + + .. py:method:: getPtOnCurve(t) -> pos + + Returns a point on the curve. Which point is determined by the value of t. + If :samp:`t=0`, returns :py:attr:`pos1`. :samp:`t=1` returns :py:attr:`pos4`, + and values in between return the points in between. + + .. py:attribute:: length + + Returns an approximation of the length of the curve (ro). + + .. py:attribute:: pos1 + + .. py:attribute:: pos2 + + .. py:attribute:: pos3 + + .. py:attribute:: pos4 + + .. py:attribute:: texcoord1 + + .. py:attribute:: texcoord2 + + .. autoclass:: FilledVectorNode([filltexhref, fillopacity=0, fillcolor="FFFFFF", filltexcoord1=Point2D(0,0), filltexcoord2=Point2D(1,1)]) + + Base class for vector nodes which have a filled area and a border. The area can + be filled either with a solid color (:py:attr:`fillcolor`) or with a texture + loaded from a file (:py:attr:`filltexhref`) or taken from a bitmap object + (:py:meth:`setFillBitmap`). + + .. py:attribute:: fillcolor + + .. py:attribute:: fillopacity + + .. py:attribute:: filltexcoord1 + + .. py:attribute:: filltexcoord2 + + .. py:attribute:: filltexhref + + An image file to use as a texture for the area of the node. + + .. py:method:: setFillBitmap(bitmap) + + Sets a bitmap to use as a fill texture. Sets :attr:`filltexhref` to an empty + string. + + .. autoclass:: LineNode([pos1, pos2, texcoord1, texcoord2]) + + A line. :py:attr:`pos1` and :py:attr:`pos2` are the two endpoints of the line. + + .. py:attribute:: pos1 + + .. py:attribute:: pos2 + + .. py:attribute:: texcoord1 + + .. py:attribute:: texcoord2 + + .. autoclass:: MeshNode([vertexcoords, texcoords, triangles]) + + This is a generalized mesh of textured triangles. See + https://www.libavg.de/wiki/ProgrammersGuide/MeshNode for an example. + + .. py:attribute:: texcoords + + .. py:attribute:: triangles + + .. py:attribute:: vertexcoords + + .. autoclass:: PolygonNode([linejoin="bevel", pos, texcoords]) + + A closed figure bounded by a number of line segments, optionally filled. Filled + polygons may not be self-intersecting. + + .. py:attribute:: linejoin + + The method by which line segments are joined together. Valid values are + :py:const:`bevel` and :py:const:`miter`. + + .. py:attribute:: pos + + A sequence (:py:class:`list` or :py:class:`tuple`) of pixel positions. + + .. py:attribute:: texcoords + + A sequence of float texture coordinates corresponding to the border positions. + + .. autoclass:: PolyLineNode([linejoin="bevel", pos, texcoords]) + + A figure similar to a :py:class:`PolygonNode`, but not closed and never filled. + + .. py:attribute:: linejoin + + The method by which line segments are joined together. Valid values are + :py:const:`bevel` and :py:const:`miter`. + + .. py:attribute:: pos + + A sequence (:py:class:`list` or :py:class:`tuple`) of pixel positions. + + .. py:attribute:: texcoords + + A sequence of float texture coordinates corresponding to the border positions. + + .. autoclass:: RectNode([pos, size, angle]) + + A rectangle that can be filled. + + .. py:attribute:: angle + + The angle that the rectangle is rotated to in radians. 0 is + unchanged, 3.14 is upside-down. The rectangle is rotated around its + center. + + .. py:attribute:: pos + + The position of the top left corner of the rectangle. + + .. py:attribute:: size + + .. py:attribute:: texcoords + + .. autoclass:: VectorNode([color="FFFFFF", strokewidth=1, texhref, blendmode="blend"]) + + Base class for all nodes that draw geometrical primitives. All vector nodes + support configurable stroke width. Strokes can be filled either with a solid + color (:py:attr:`color`) or with a texture loaded from a file + (:py:attr:`texhref`) or taken from a bitmap object (:py:meth:`setBitmap`). + + .. py:attribute:: blendmode + + The method of compositing the node with the nodes under + it. Valid values are :py:const:`blend`, :py:const:`add`, :py:const:`min` + and :py:const:`max`. For :py:const:`min` and :py:const:`max` + blend modes, opacity is ignored. + + .. py:attribute:: color + + The color of the strokes in standard html color notation: + :samp:`"FF0000"` is red, :samp:`"00FF00"` green, etc. + + .. py:attribute:: strokewidth + + The width of the strokes in the vector. For lines, this is the line + width. For rectangles, it is the width of the outline, etc. + + .. py:attribute:: texhref + + An image file to use as a texture for the node. + + .. py:method:: setBitmap(bitmap) + + Sets a bitmap to use as a texture. Sets :attr:`texhref` to an empty + string. + +.. automodule:: libavg.geom + :no-members: + + .. autoclass:: Arc(radius, startangle, endangle[, pos=(0,0)]) + + An unfilled arc (incomplete circle) from :py:attr:`startangle` to + :py:attr:`endangle`. :py:attr:`pos` is the center of the circle. + + .. py:attribute:: endangle + + .. py:attribute:: pos + + .. py:attribute:: radius + + .. py:attribute:: startangle + + + .. autoclass:: PieSlice(radius, startangle, endangle[, pos=(0,0)]) + + An arc (incomplete circle) from :py:attr:`startangle` to + :py:attr:`endangle` connected to the center of the circle. :py:attr:`pos` is the + center of the circle. A :py:class:`PieSlice` can be filled. + + .. py:attribute:: endangle + + .. py:attribute:: pos + + .. py:attribute:: radius + + .. py:attribute:: startangle + + + .. autoclass:: RoundedRect(size, radius, pos) + + A rectangle with rounded corners. :py:attr:`radius` is the corner radius. + + .. py:attribute:: pos + + .. py:attribute:: radius + + .. py:attribute:: size + diff --git a/sphinxdoc/widget.rst b/sphinxdoc/widget.rst new file mode 100644 index 0000000..e37448f --- /dev/null +++ b/sphinxdoc/widget.rst @@ -0,0 +1,591 @@ +Widget Classes +============== + +The libavg.widget module contains high-level user interface elements such as buttons and +list boxes. Widgets are fully skinnable (using the :py:class:`Skin` class and an xml +configuration file) and multitouch-enabled. Sample code for all widgets can be found in the +:samp:`widget.py` sample. + +.. note:: + + The widget module is experimental. Functionality and interface are still in flux and + subject to change. + +.. automodule:: libavg.widget + :no-members: + + .. inheritance-diagram:: SwitchNode Button TextButton BmpButton ToggleButton CheckBox BmpToggleButton Keyboard Slider ScrollBar ProgressBar ScrollArea ScrollPane TimeSlider MediaControl + :parts: 1 + + .. inheritance-diagram:: HStretchNode VStretchNode HVStretchNode Skin + :parts: 1 + + .. autoclass:: BmpButton(upSrc, downSrc, [disabledSrc=None]) + + A :py:class:`Button` that is created from image files. Internally, it creates two or + three :py:class:`ImageNode` s and uses them as constructor parameters for + :py:class:`Button`. + + + .. autoclass:: BmpToggleButton(uncheckedUpSrc, uncheckedDownSrc, checkedUpSrc, checkedDownSrc, [uncheckedDisabledSrc=None, checkedDisabledSrc=None]) + + A :py:class:`ToggleButton` that is created from image files. Internally, it creates + image nodes for the src parameters and uses them as constructor parameters for + :py:class:`ToggleButton`. + + + .. autoclass:: Button(upNode, downNode, [disabledNode=None, activeAreaNode=None, fatFingerEnlarge=False, enabled=True]) + + A button that shows different user-supplied nodes depending on its + state. Possible button states are up, down and disabled. The nodes are attached + as children to the Button on construction. For a simple button, image nodes can + be passed. Uses the :py:class:`TapRecognizer` to detect clicks. + + .. image:: ButtonStates.png + + :param avg.Node upNode: The node displayed when the button is not pressed. + + :param avg.Node downNode: The node displayed when the button is pressed. + + :param avg.Node disabledNode: The node displayed when the button is disabled. + + :param avg.Node activeAreaNode: + + A node that is used only to determine if a click is over the button. Usually, + this node is invisible. :py:attr:`activeAreaNode` is useful for small touch + buttons, where the active area should be larger than the visible button to + account for touch inaccuracies. + + :param bool fatFingerEnlarge: + + If this parameter is set to :py:const:`True`, the button generates its own + internal :py:attr:`activeAreaNode` that is at least 20x20mm large. + :py:attr:`fatFingerEnlarge` is incompatible with a custom + :py:attr:`activeAreaNode`. + + **Messages:** + + To get these messages, call :py:meth:`Publisher.subscribe`. + + .. py:method:: Button.PRESSED() + + Called when a tap on the button is initiated. + + .. py:method:: Button.RELEASED() + + Called when a tap on the button ends. Emitted for both successful and + aborted taps. + + .. py:method:: Button.CLICKED() + + Called when the button is clicked. + + .. py:attribute:: enabled + + :py:const:`True` if the button accepts input. If the button is disabled, + it shows the :py:attr:`disabledNode`. + + + .. autoclass:: CheckBox([text="", skinObj=skin.Skin.default]) + + This is a classic checkbox with text to the right. + + .. autoclass:: HStretchNode(endsExtent, [src=None, minExtent=-1]) + + A node that stretches its graphics to fill the size given horizontally. It is used + as base component for scrollbars and buttons. The base + bitmap is split into three parts: left, center and right. The left and right parts + are :py:attr:`endsExtent` wide and generated from the corresponding parts of the + source bitmap. The center part is generated from a one pixel wide slice of the + source bitmap and stretched to fill the space left between the left and right + parts. + + :param int endsExtent: + + Width of the left and right bitmaps in pixels. + + :param src: + + Either the name of a bitmap file or a :py:class:`Bitmap` object. Used to + generate the graphics used. + + :param int minExtent: + + Minimum horizontal size. The default of -1 uses :py:const:`2*endsExtent+1` as + minimum. + + + .. autoclass:: HVStretchNode(endsExtent, [src=None, minExtent=-(1,-1)]) + + A node that stretches its graphics to fill the size given horizontally and + vertically. It is used as base component for scrollareas. Similar to + :py:class:`HStretchNode`, the base bitmap is split and partial bitmaps are + extracted. Four corner bitmaps of size :py:attr:`endsExtent` stay the same size, + four one-pixel-slice bitmaps fill the sides, and a single one-pixel bitmap is used + to fill the center area. + + :param IntPoint endsExtent: + + Size of the corner bitmaps in pixels. + + :param src: + + Either the name of a bitmap file or a :py:class:`Bitmap` object. Used to + generate the graphics used. + + :param IntPoint minExtent: + + Minimum size. The default of :py:const:`(-1,-1]` uses :py:const:`2*endsExtent+1` as + minimum. + + + .. autoclass:: Keyboard(bgSrc, downSrc, keyDefs, shiftKeyCode, [altGrKeyCode=None, stickyShift=False, feedbackSrc=None]) + + Implements an onscreen keyboard that turns mouse clicks or touches into key + presses. The keyboard is completely configurable. Keyboard graphics are determined + by the two image files in :py:attr:`bgSrc` and :py:attr:`downSrc`. Keys can be + defined as rectangles anywhere on these images. Works for both single-touch and + multitouch devices. Generates events when keys are pressed or released. + An additional enlarged image of the key being pressed can be rendered above a + pending touch as well by using :py:attr:`feedbackSrc`. + + Needs offscreen rendering support on the machine to generate individual key images + from the image files supplied. + + :param string bgSrc: + + Filename of an image that contains the keyboard with unpressed keys. + + :param string downSrc: + + Filename of an image that contains the keyboard with pressed keys. + + :param list keyDefs: + + List of key definitions. Keys can be either character keys: + + [(, , ), , , + , ] + + or command keys: + + [, , , , ] + + For character keys, the shift and altgr keycodes are optional. To define + entire rows of evenly-spaced keys, use :py:meth:`makeRowKeyDefs`. + + :param shiftKeyCode: + + One of the command keycodes. When a key with this code is pressed, + pressing other keys causes them to return the shifted keycode. + + :param altGrKeyCode: + + One of the command keycodes. When a key with this code is pressed, + pressing other keys causes them to return the altgr keycode. + + :param bool stickyShift: + + For single-touch devices, the shift key must stay in the pressed state + until the next normal key is pressed to have any effect. This is the + behaviour if :py:attr:`stickyShift` is :py:const:`True`. If it is + :py:const:`False` (the default), a + multitouch device is assumed and shift works like on a physical keyboard. + + :param string feedbackSrc: + + Filename of an image that contains an enlarged version of bgSrc for use as + feedback during key pressed. If this parameter not set the feedback funktion + is turned off. + + **Messages:** + + :py:class:`Keyboard` emits messages on every key press and release: + To get these messages, call :py:meth:`Publisher.subscribe`. + + .. py:method:: DOWN(keycode) + + Emitted whenever a key (command or char) is pressed. + + .. py:method:: UP(keycode) + + Emitted whenever a key (command or char) is released. + + .. py:method:: CHAR(char) + + Emitted whenever a character is generated. This is generally when a char key + is released and takes into account shift/altgr status. + + .. py:method:: reset() + + Resets any sticky keys (shift, altgr) to their default state. + + .. py:classmethod:: makeRowKeyDefs(startPos, keySize, spacing, feedbackStr, keyStr, shiftKeyStr, [altGrKeyStr]) + + Creates key definitions for a row of uniform keys. Useful for creating the + keyDefs parameter of the Keyboard constructor. All the keys get no repeat + functionality. + + :param avg.Point2D startPos: Top left position of the row. + + :param avg.Point2D keySize: Size of each key. + + :param int spacing: Number of empty pixels between two keys. + + :param string keyStr: + + Unicode string containing the unshifted keycodes (i.e. + :samp:`u"qwertzuiopżś"`) + + :param string shiftKeyStr: + + Unicode string containing the shifted keycodes + (i.e. :samp:`u"QWERTZUIOPńć"`) + + :param string altGrKeyStr: + + Unicode string containing the keycodes when altgr is pressed. + + + .. autoclass:: MediaControl([duration=1000, time=0, skinObj=skin.Skin.default]) + + A composite control that incorporates a :py:class:`Slider`, a play/pause + button and text widgets that display the time. By itself, the + :py:class:`MediaControl` is independent of a media node. The controlling + application is responsible for keeping track of media node and + :py:class:`MediaControl` state and syncing the two. + + **Messages:** + + .. py:method:: PLAY_CLICKED() + + Emitted when the play/pause toggle is switched to play. + + .. py:method:: PAUSE_CLICKED() + + Emitted when the play/pause toggle is switched to pause. + + .. py:method:: SEEK_PRESSED() + + Emitted when the user starts dragging the seek thumb. + + .. py:method:: SEEK_MOTION(curTime) + + Emitted when the user moves the seek thumb. + + .. py:method:: SEEK_RELEASED() + + Emitted when the user releases the seek thumb. + + .. py:attribute:: duration + + Duration of the medium in milliseconds. + + .. py:attribute:: time + + Current media time in milliseconds. + + .. py:method:: play() + + Switches to play mode by toggling the button. + + .. py:method:: pause() + + Switches to pause mode by toggling the button. + + + .. autoclass:: Orientation() + + .. py:data:: HORIZONTAL + + .. py:data:: VERTICAL + + + .. autoclass:: ProgressBar(orientation, [skinObj=skin.Skin.default, height=0, width=0, range=(0.,1.), value=0.0]) + + A horizontal bar-shaped UI element that indicates the progression of an operation. + + .. py:attribute:: range + + Tuple giving minimum and maximum value. + + .. py:attribute:: value + + Current progression. The application is responsible for updating the value. In + general, :py:attr:`value` will start at :py:attr:`range[0]` and end with + :py:attr:`range[1]`. + + + .. autoclass:: ScrollArea(contentNode, size[, skinObj=skin.Skin.default, enabled=True, scrollBars=(Orientation.HORIZONTAL, Orientation.VERTICAL)]) + + A rectangular area that allows a user to choose a view into arbitrary content. The + content can be larger than the :py:class:`ScrollArea`, in which case scroll bars can + be used to allow the user to choose which part to view. Dragging the content to + determine the viewport is also supported. A :py:class:`ScrollArea` uses + :py:class:`ScrollPane` and :py:class:`ScrollBar` objects internally. + + **Messages:** + + To get these messages, call :py:meth:`Publisher.subscribe`. + + .. py:method:: PRESSED() + + Emitted when a content drag is initiated. + + .. py:method:: RELEASED() + + Emitted when a content drag is finished. + + .. py:method:: CONTENT_POS_CHANGED(pos) + + Emitted when the viewport changes for any reason. + + .. py:attribute:: contentsize + + The size of the :py:attr:`contentNode`. + + .. py:attribute:: contentpos + + The position of the content within the area. + + + .. autoclass:: ScrollBar([orientation=Orientation.HORIZONTAL, skinObj=skin.Skin.default, enabled=True, height=0, width=0, range=(0.,1.), thumbPos=0.0, thumbExtent=0.1]) + + A vertical or horizontal scroll bar. + + **Messages:** + + To get these messages, call :py:meth:`Publisher.subscribe`. + + .. py:method:: PRESSED() + + Emitted when a drag is initiated. + + .. py:method:: RELEASED() + + Emitted when a drag is finished. + + .. py:method:: THUMB_POS_CHANGED(pos) + + Emitted when the thumb is dragged. + + .. py:attribute:: range + + Minimum and maximum values for the thumb. + + .. py:attribute:: thumbPos + + .. py:attribute:: thumbExtent + + + .. autoclass:: ScrollPane(contentNode) + + A rectangular view into arbitrary content. No user interaction is implemented. + + .. py:attribute:: contentpos + + .. py:attribute:: contentsize + + + .. autoclass:: Skin(skinXmlFName[, mediaDir=""]) + + A :py:class:`Skin` determines the appearance of any user interface elements that + use it. Skin configuration is determined by an xml file. This xml file determines + the bitmaps to use and the sizes of various components. It also determines the + fonts used by the elements. Skinnable user interface elements include + :py:class:`TextButton`, :py:class:`Slider`, :py:class:`ScrollBar`, + :py:class:`ProgressBar`, :py:class:`ScrollArea`, :py:class:`CheckBox` and + :py:class:`MediaControl`. In addition, the fonts defined can be accessed by the + application. + + The default skin xml file is located at :samp:`src/python/data/SimpleSkin.xml`. It + provides a good basis from which to create your own skin. + + :param string skinXmlFName: + + The name of the xml configuration file. + + :param string mediaDir: + + The location of the image files to use. + + .. py:attribute:: fonts: + + A dictionary of :py:class:`FontStyle` objects created from the xml + configuration file. + + + .. autoclass:: Slider([orientation=Orientation.HORIZONTAL, skinObj=skin.Skin.default]) + + Sliders are horizontal or vertical bar with a draggable thumb that can be used + to set a value. In contrast to a scroll bar, the slider's thumb has no range. + + **Messages:** + + To get these messages, call :py:meth:`Publisher.subscribe`. + + .. py:method:: PRESSED() + + Emitted when a drag is initiated. + + .. py:method:: RELEASED() + + Emitted when a drag is finished. + + .. py:method:: THUMB_POS_CHANGED(pos) + + Emitted when the thumb is dragged. + + .. py:attribute:: range + + Minimum and maximum values for the thumb. + + .. py:attribute:: thumbPos + + + .. autoclass:: SwitchNode([nodeMap=None, visibleid=None]) + + A :py:class:`DivNode` that keeps a map of child nodes and shows only one of + the map members at any time. + + :param map nodeMap: + + A map :py:const:`id->node` that contains the nodes to switch between. + + .. py:method:: setNodeMap(nodeMap) + + Can be used to set the :py:attr:`nodeMap` after construction if no node map + was set before. + + .. py:attribute:: visibleid + + The id of the visible child node. + + + .. autoclass:: TextButton(text, [skinObj=skin.Skin.default]) + + A :py:class:`Button` that is created using the given :py:class:`Skin` and a text. + + .. py:attribute:: text + + The string displayed on the button. + + + .. autoclass:: TimeSlider() + + Works like a :py:class:`ProgressBar` with an additional slider thumb. + + .. autoclass:: ToggleButton(uncheckedUpNode, uncheckedDownNode, checkedUpNode, checkedDownNode, [uncheckedDisabledNode=None, checkedDisabledNode=None, activeAreaNode=None, fatFingerEnlarge=False, enabled=True, checked=False]) + + A button that can be used to toggle between checked and unchecked states. + Classical GUI checkboxes are an example of this kind of button. + + A :py:class:`ToggleButton` has a total of six visual states. In addition to the + distinction between checked and unchecked, a button can be enabled or disabled. + Buttons also change their appearance as soon as they are touched, leading to two + further states. For each visual state, a node is passed as constructor parameter. + The constructor attaches the nodes to the :py:class:`ToggleButton`. + + Uses the :py:class:`TapRecognizer` to detect clicks. + + .. image:: ToggleButtonStates.png + + :param avg.Node uncheckedUpNode: + + The node displayed when the button is unchecked and not touched. + + :param avg.Node uncheckedDownNode: + + The node displayed when the button is unchecked and touched. + + :param avg.Node checkedUpNode: + + The node displayed when the button is checked and not touched. + + :param avg.Node checkedDownNode: + + The node displayed when the button is checked and not touched. + + :param avg.Node uncheckedDisabledNode: + + The node displayed when the button is unchecked and disabled. + + :param avg.Node checkedDisabledNode: + + The node displayed when the button is checked and disabled. + + :param avg.Node activeAreaNode: + + A node that is used only to determine if a click is over the button. Usually, + this node is invisible. :py:attr:`activeAreaNode` is useful for small touch + buttons, where the active area should be larger than the visible button to + account for touch inaccuracies. + + :param bool fatFingerEnlarge: + + If this parameter is set to :py:const:`True`, the button generates its own + internal :py:attr:`activeAreaNode` that is at least 20x20mm large. + :py:attr:`fatFingerEnlarge` is incompatible with a custom + :py:attr:`activeAreaNode`. + + :param bool checked: + + If this parameter is set to :py:const:`True`, the button starts in the checked + state. + + :param bool enabled: + + If this parameter is set to :py:const:`True`, the button starts in the + disabled state. + + **Messages:** + + To get these messages, call :py:meth:`Publisher.subscribe`. + + .. py:method:: Button.PRESSED() + + Called when a tap on the button is initiated. + + .. py:method:: Button.RELEASED() + + Called when a tap on the button ends. Emitted for both successful and + aborted taps. + + .. py:method:: Button.TOGGLED() + + Called when the button changes from unchecked to checked or vice-versa. + + + .. py:attribute:: checked + + The state of the toggle. + + .. py:attribute:: enabled + + Determines whether the button accepts input. + + + .. autoclass:: VStretchNode(endsExtent, [src=None, minExtent=-1]) + + A node that stretches its graphics to fill the size given vertically. It is used + as base component for scrollbars. The base + bitmap is split into three parts: top, center and bottom. The top and bottom parts + are :py:attr:`endsExtent` wide and generated from the corresponding parts of the + source bitmap. The center part is generated from a one pixel high slice of the + source bitmap and stretched to fill the space left between the top and bottom + parts. + + :param int endsExtent: + + Width of the top and bottom bitmaps in pixels. + + :param src: + + Either the name of a bitmap file or a :py:class:`Bitmap` object. Used to + generate the graphics used. + + :param int minExtent: + + Minimum vertical size. The default of :py:const:`-1` uses + :py:const:`2*endsExtent+1` as minimum. + diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 0000000..bfb11d4 --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1,16 @@ +SUBDIRS = base graphics imaging lmfit oscpack audio video player \ + anim wrapper python test utils samples + +EXTRA_DIST = avgrc avgconfigwrapper.h api.h avgconfig_win.h version.h \ + $(wildcard glm/*.hpp) $(wildcard glm/core/*.hpp) $(wildcard glm/core/*.inl) \ + $(wildcard glm/gtc/*.hpp) $(wildcard glm/gtc/*.inl) \ + $(wildcard glm/gtx/*.hpp) $(wildcard glm/gtx/*.inl) \ + $(wildcard glm/virtrev/*.hpp) + +BUILT_SOURCES = version.h +DISTCLEANFILES = version.h + +version.h: FORCE + $(top_srcdir)/CreateVersionFile.py $(top_builddir)/src + +FORCE: diff --git a/src/addcopyright.py b/src/addcopyright.py new file mode 100755 index 0000000..c8204ca --- /dev/null +++ b/src/addcopyright.py @@ -0,0 +1,22 @@ +#!/usr/bin/python + +import sys, os, fnmatch + +CopyrightNoticeLines = file("Copyright").read().splitlines() + +for dir in ["base", "conradrelais", "graphics", "parport", "player", "python"]: + files = os.listdir(dir) + for f in files: + if fnmatch.fnmatch(f, "*.cpp") or fnmatch.fnmatch(f, "*.h"): + fname = dir+"/"+f + print "Processing " + fname + fobj = file(fname, "r+") + str = fobj.read() + lines = str.splitlines() + while lines[0].find('//') == 0: + lines = lines[1:] + lines = CopyrightNoticeLines+lines + fobj.seek(0) + fobj.truncate() + for line in lines: + fobj.write(line+"\n") diff --git a/src/anim/Anim.cpp b/src/anim/Anim.cpp new file mode 100644 index 0000000..69b245d --- /dev/null +++ b/src/anim/Anim.cpp @@ -0,0 +1,123 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de + +#include "Anim.h" + +#include "../base/Exception.h" +#include "../base/ObjectCounter.h" + +#include "../player/Player.h" + +using namespace boost::python; +using namespace std; + +namespace avg { + +Anim::Anim(const object& startCallback, const object& stopCallback) + : m_StartCallback(startCallback), + m_StopCallback(stopCallback), + m_bRunning(false), + m_bIsRoot(true) +{ + ObjectCounter::get()->incRef(&typeid(*this)); + Player::get()->registerPlaybackEndListener(this); +} + +Anim::~Anim() +{ + ObjectCounter::get()->decRef(&typeid(*this)); + if (Player::exists()) { + Player::get()->unregisterPlaybackEndListener(this); + } +} + +void Anim::setStartCallback(const object& startCallback) +{ + m_StartCallback = startCallback; +} + +void Anim::setStopCallback(const object& stopCallback) +{ + m_StopCallback = stopCallback; +} + +void Anim::start(bool) +{ + if (m_bRunning) { + throw(Exception(AVG_ERR_UNSUPPORTED, + "Anim.start(): animation already running.")); + } + if (!(Player::get()->isPlaying())) { + throw(Exception(AVG_ERR_UNSUPPORTED, + "Animation playback can only be started when the player is running.")); + } + m_bRunning = true; + if (m_bIsRoot) { + Player::get()->registerPreRenderListener(this); + } + if (m_StartCallback != object()) { + call(m_StartCallback.ptr()); + } +} + +bool Anim::isRunning() const +{ + return m_bRunning; +} + +void Anim::setHasParent() +{ + assert(!m_bRunning); + m_bIsRoot = false; +} + +void Anim::onPreRender() +{ + step(); +} + +void Anim::onPlaybackEnd() +{ + AnimPtr tempThis = shared_from_this(); + m_StartCallback = object(); + m_StopCallback = object(); + if (m_bRunning) { + abort(); + } +} + +void Anim::setStopped() +{ + if (m_bIsRoot) { + Player::get()->unregisterPreRenderListener(this); + } + m_bRunning = false; + if (m_StopCallback != object()) { + try { + m_StopCallback(); + } catch (error_already_set &) { + cerr << "Python exception in Anim stop callback." << endl; + PyErr_Print(); + exit(5); + } + } +} + +} diff --git a/src/anim/Anim.h b/src/anim/Anim.h new file mode 100644 index 0000000..3080141 --- /dev/null +++ b/src/anim/Anim.h @@ -0,0 +1,90 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#ifndef _Anim_H_ +#define _Anim_H_ + +#include "../api.h" +// Python docs say python.h should be included before any standard headers (!) +#include "../player/WrapPython.h" + +#include "../base/IPreRenderListener.h" +#include "../base/IPlaybackEndListener.h" + +#include +#include +#include +#include + +#include + +namespace avg { + +class Anim; +class GroupAnim; + +typedef boost::shared_ptr AnimPtr; +typedef boost::weak_ptr AnimWeakPtr; + +class AVG_API Anim: public boost::enable_shared_from_this, IPreRenderListener, + IPlaybackEndListener +{ +public: + Anim(const boost::python::object& startCallback, + const boost::python::object& stopCallback); + virtual ~Anim(); + + void setStartCallback(const boost::python::object& startCallback); + void setStopCallback(const boost::python::object& stopCallback); + virtual void start(bool bKeepAttr=false); + virtual void abort() = 0; + bool isRunning() const; + void setHasParent(); + + virtual void onPreRender(); + virtual void onPlaybackEnd(); + virtual bool step() = 0; + +protected: + void setStopped(); + +private: + Anim(); + Anim(const Anim&); + boost::python::object m_StartCallback; + boost::python::object m_StopCallback; + bool m_bRunning; + bool m_bIsRoot; +}; + +template +bool isPythonType(const boost::python::object& obj) +{ + boost::python::extract ext(obj); + return ext.check(); +} + +} + +#endif + + + diff --git a/src/anim/AttrAnim.cpp b/src/anim/AttrAnim.cpp new file mode 100644 index 0000000..2791ed2 --- /dev/null +++ b/src/anim/AttrAnim.cpp @@ -0,0 +1,103 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de + +#include "AttrAnim.h" + +#include "../base/Exception.h" +#include "../player/Player.h" +#include "../player/Node.h" + +using namespace boost; +using namespace boost::python; +using namespace std; + +namespace avg { + +AttrAnim::AttrAnimationMap AttrAnim::s_ActiveAnimations; + +bool ObjAttrID::operator < (const ObjAttrID& other) const +{ + if (m_ObjHash < other.m_ObjHash) { + return true; + } else if (m_ObjHash > other.m_ObjHash) { + return false; + } else if (m_sAttrName < other.m_sAttrName) { + return true; + } else { + return false; + } +} + +int AttrAnim::getNumRunningAnims() +{ + return s_ActiveAnimations.size(); +} + +AttrAnim::AttrAnim(const object& node, const string& sAttrName, + const object& startCallback, const object& stopCallback) + : Anim(startCallback, stopCallback), + m_Node(node), + m_sAttrName(sAttrName) +{ + object obj = getValue(); +} + +AttrAnim::~AttrAnim() +{ +} + +void AttrAnim::start(bool bKeepAttr) +{ + stopActiveAttrAnim(); + Anim::start(); + addToMap(); +} + +object AttrAnim::getValue() const +{ + return m_Node.attr(m_sAttrName.c_str()); +} + +void AttrAnim::setValue(const object& val) +{ + m_Node.attr(m_sAttrName.c_str()) = val; +} + +void AttrAnim::addToMap() +{ + s_ActiveAnimations[ObjAttrID(m_Node, m_sAttrName)] = + dynamic_pointer_cast(shared_from_this()); +} + +void AttrAnim::removeFromMap() +{ + s_ActiveAnimations.erase(ObjAttrID(m_Node, m_sAttrName)); +} + +void AttrAnim::stopActiveAttrAnim() +{ + ObjAttrID id(m_Node, m_sAttrName); + AttrAnimationMap::iterator it = s_ActiveAnimations.find(id); + if (it != s_ActiveAnimations.end()) { + it->second->abort(); + } +} + +} diff --git a/src/anim/AttrAnim.h b/src/anim/AttrAnim.h new file mode 100644 index 0000000..a546c95 --- /dev/null +++ b/src/anim/AttrAnim.h @@ -0,0 +1,92 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#ifndef _AttrAnim_H_ +#define _AttrAnim_H_ + +#include "Anim.h" + +#include "../api.h" +// Python docs say python.h should be included before any standard headers (!) +#include "../player/WrapPython.h" + +#include +#include +#include + +#include +#include + +namespace avg { + +struct ObjAttrID { + ObjAttrID(const boost::python::object& obj, const std::string& sAttrName) + : m_ObjHash(boost::python::extract(obj.attr("__hash__")())), + m_sAttrName(sAttrName) + { + } + long m_ObjHash; + std::string m_sAttrName; + bool operator < (const ObjAttrID& other) const; +}; + +class AttrAnim; + +typedef boost::shared_ptr AttrAnimPtr; +typedef boost::weak_ptr AttrAnimWeakPtr; + +class AVG_API AttrAnim: public Anim +{ +public: + static int getNumRunningAnims(); + + AttrAnim(const boost::python::object& node, const std::string& sAttrName, + const boost::python::object& startCallback, + const boost::python::object& stopCallback); + virtual ~AttrAnim(); + + virtual void start(bool bKeepAttr=false); + +protected: + boost::python::object getValue() const; + void setValue(const boost::python::object& val); + + void addToMap(); + void removeFromMap(); + void stopActiveAttrAnim(); + +private: + AttrAnim(); + AttrAnim(const AttrAnim&); + + boost::python::object m_Node; + std::string m_sAttrName; + + typedef std::map AttrAnimationMap; + static AttrAnimationMap s_ActiveAnimations; +}; + +} + +#endif + + + diff --git a/src/anim/ContinuousAnim.cpp b/src/anim/ContinuousAnim.cpp new file mode 100644 index 0000000..e6b8b02 --- /dev/null +++ b/src/anim/ContinuousAnim.cpp @@ -0,0 +1,91 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#include "ContinuousAnim.h" + +#include "../base/Exception.h" +#include "../base/MathHelper.h" +#include "../player/Player.h" + +using namespace boost::python; +using namespace std; + +namespace avg { + +ContinuousAnim::ContinuousAnim(const object& node, const string& sAttrName, + const object& startValue, const object& speed, bool bUseInt, + const object& startCallback, const object& stopCallback) + : AttrAnim(node, sAttrName, startCallback, stopCallback), + m_StartValue(startValue), + m_Speed(speed), + m_bUseInt(bUseInt) +{ +} + +ContinuousAnim::~ContinuousAnim() +{ +} + +void ContinuousAnim::start(bool bKeepAttr) +{ + AttrAnim::start(); + if (!bKeepAttr) { + setValue(m_StartValue); + } + m_EffStartValue = getValue(); + m_StartTime = Player::get()->getFrameTime(); +} + +void ContinuousAnim::abort() +{ + if (isRunning()) { + AnimPtr tempThis = shared_from_this(); + removeFromMap(); + setStopped(); + } +} + +bool ContinuousAnim::step() +{ + object curValue; + float time = (Player::get()->getFrameTime()-m_StartTime)/1000.0f; + if (isPythonType(m_EffStartValue)) { + curValue = object(time*extract(m_Speed)+m_EffStartValue); + if (m_bUseInt) { + float d = extract(curValue); + curValue = object(round(d)); + } + } else if (isPythonType(m_EffStartValue)) { + glm::vec2 pt = extract(m_Speed)(); + curValue = object(time*pt+m_EffStartValue); + if (m_bUseInt) { + glm::vec2 pt = extract(curValue)(); + curValue = object(glm::vec2(round(pt.x), round(pt.y))); + } + } else { + throw (Exception(AVG_ERR_TYPE, + "Animated attributes must be either numbers or Point2D.")); + } + setValue(curValue); + return false; +} + +} diff --git a/src/anim/ContinuousAnim.h b/src/anim/ContinuousAnim.h new file mode 100644 index 0000000..c0bcb67 --- /dev/null +++ b/src/anim/ContinuousAnim.h @@ -0,0 +1,59 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#ifndef _ContinuousAnim_H_ +#define _ContinuousAnim_H_ + +#include "../api.h" + +#include "SimpleAnim.h" + +namespace avg { + +class AVG_API ContinuousAnim: public AttrAnim { +public: + ContinuousAnim(const boost::python::object& node, const std::string& sAttrName, + const boost::python::object& startValue, + const boost::python::object& speed, + bool bUseInt=false, + const boost::python::object& startCallback=boost::python::object(), + const boost::python::object& stopCallback=boost::python::object()); + virtual ~ContinuousAnim(); + + virtual void start(bool bKeepAttr=false); + virtual void abort(); + virtual bool step(); + +private: + boost::python::object m_StartValue; + boost::python::object m_Speed; + bool m_bUseInt; + + boost::python::object m_EffStartValue; + long long m_StartTime; +}; + +} + +#endif + + + diff --git a/src/anim/EaseInOutAnim.cpp b/src/anim/EaseInOutAnim.cpp new file mode 100644 index 0000000..c8a3cf7 --- /dev/null +++ b/src/anim/EaseInOutAnim.cpp @@ -0,0 +1,71 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#include "EaseInOutAnim.h" + +#include "../player/Player.h" +#include "../base/MathHelper.h" + +#include + +using namespace boost::python; +using namespace std; + +namespace avg { + +EaseInOutAnim::EaseInOutAnim(const object& node, const string& sAttrName, + long long duration, const object& startValue, const object& endValue, + long long easeInDuration, long long easeOutDuration, bool bUseInt, + const object& startCallback, const object& stopCallback) + : SimpleAnim(node, sAttrName, duration, startValue, endValue, bUseInt, startCallback, + stopCallback), + m_EaseInDuration(float(easeInDuration)/duration), + m_EaseOutDuration(float(easeOutDuration)/duration) +{ +} + +EaseInOutAnim::~EaseInOutAnim() +{ +} + +float EaseInOutAnim::interpolate(float t) +{ + float accelDist = m_EaseInDuration*2/PI; + float decelDist = m_EaseOutDuration*2/PI; + float dist; + if (t 1-m_EaseOutDuration) { + // Deceleration stage + float nt = (t-(1-m_EaseOutDuration))/m_EaseOutDuration; + float s = sin(nt*PI/2); + dist = accelDist+(1-m_EaseInDuration-m_EaseOutDuration)+s*decelDist; + } else { + // Linear stage + dist = accelDist+t-m_EaseInDuration; + } + return dist/(accelDist+(1-m_EaseInDuration-m_EaseOutDuration)+decelDist); +} + +} diff --git a/src/anim/EaseInOutAnim.h b/src/anim/EaseInOutAnim.h new file mode 100644 index 0000000..d4326da --- /dev/null +++ b/src/anim/EaseInOutAnim.h @@ -0,0 +1,55 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#ifndef _EaseInOutAnim_H_ +#define _EaseInOutAnim_H_ + +#include "../api.h" + +#include "SimpleAnim.h" + +namespace avg { + +class AVG_API EaseInOutAnim: public SimpleAnim { +public: + EaseInOutAnim(const boost::python::object& node, const std::string& sAttrName, + long long duration, + const boost::python::object& pStartValue, + const boost::python::object& pEndValue, + long long easeInDuration, long long easeOutDuration, bool bUseInt=false, + const boost::python::object& startCallback=boost::python::object(), + const boost::python::object& stopCallback=boost::python::object()); + virtual ~EaseInOutAnim(); + +protected: + virtual float interpolate(float t); + +private: + float m_EaseInDuration; + float m_EaseOutDuration; +}; + +} + +#endif + + + diff --git a/src/anim/LinearAnim.cpp b/src/anim/LinearAnim.cpp new file mode 100644 index 0000000..7e34cfd --- /dev/null +++ b/src/anim/LinearAnim.cpp @@ -0,0 +1,73 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#include "LinearAnim.h" + +#include "../player/Player.h" + +using namespace boost::python; +using namespace std; + +namespace avg { + +LinearAnim::LinearAnim(const object& node, const string& sAttrName, long long duration, + const object& startValue, const object& endValue, bool bUseInt, + const object& startCallback, const object& stopCallback) + : SimpleAnim(node, sAttrName, duration, startValue, endValue, bUseInt, startCallback, + stopCallback) +{ +} + +LinearAnim::~LinearAnim() +{ +} + +float LinearAnim::interpolate(float t) +{ + return t; +} + +float LinearAnim::getStartPart(float start, float end, float cur) +{ + return (cur-start)/(end-start); +} + +AnimPtr fadeIn(const boost::python::object& node, long long duration, float max, + const boost::python::object& stopCallback) +{ + object startVal = node.attr("opacity"); + AnimPtr pAnim(new LinearAnim(node, "opacity", duration, startVal, + object(max), false, object(), stopCallback)); + pAnim->start(false); + return pAnim; +} + +AnimPtr fadeOut(const boost::python::object& node, long long duration, + const boost::python::object& stopCallback) +{ + object startVal = node.attr("opacity"); + AnimPtr pAnim(new LinearAnim(node, "opacity", duration, startVal, + object(0), false, object(), stopCallback)); + pAnim->start(true); + return pAnim; +} + +} diff --git a/src/anim/LinearAnim.h b/src/anim/LinearAnim.h new file mode 100644 index 0000000..1b58613 --- /dev/null +++ b/src/anim/LinearAnim.h @@ -0,0 +1,60 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#ifndef _LinearAnim_H_ +#define _LinearAnim_H_ + +#include "../api.h" + +#include "SimpleAnim.h" + +namespace avg { + +class AVG_API LinearAnim: public SimpleAnim { +public: + LinearAnim(const boost::python::object& node, const std::string& sAttrName, + long long duration, + const boost::python::object& pStartValue, + const boost::python::object& pEndValue, + bool bUseInt=false, + const boost::python::object& startCallback=boost::python::object(), + const boost::python::object& stopCallback=boost::python::object()); + virtual ~LinearAnim(); + +protected: + virtual float interpolate(float t); + +private: + float getStartPart(float start, float end, float cur); +}; + +AnimPtr fadeIn(const boost::python::object& node, long long duration, float max=1.0f, + const boost::python::object& stopCallback=boost::python::object()); + +AnimPtr fadeOut(const boost::python::object& node, long long duration, + const boost::python::object& stopCallback=boost::python::object()); + +} + +#endif + + + diff --git a/src/anim/Makefile.am b/src/anim/Makefile.am new file mode 100644 index 0000000..6c37d2a --- /dev/null +++ b/src/anim/Makefile.am @@ -0,0 +1,9 @@ +AM_CPPFLAGS = -I.. @XML2_CFLAGS@ @PYTHON_CPPFLAGS@ + +ALL_H = Anim.h SimpleAnim.h LinearAnim.h AttrAnim.h ContinuousAnim.h EaseInOutAnim.h \ + WaitAnim.h ParallelAnim.h StateAnim.h +ALL_CPP = Anim.cpp SimpleAnim.cpp LinearAnim.cpp AttrAnim.cpp ContinuousAnim.cpp \ + EaseInOutAnim.cpp WaitAnim.cpp ParallelAnim.cpp StateAnim.cpp + +noinst_LTLIBRARIES = libanim.la +libanim_la_SOURCES = $(ALL_CPP) $(ALL_H) diff --git a/src/anim/ParallelAnim.cpp b/src/anim/ParallelAnim.cpp new file mode 100644 index 0000000..0cfe799 --- /dev/null +++ b/src/anim/ParallelAnim.cpp @@ -0,0 +1,113 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#include "ParallelAnim.h" + +#include "../player/Player.h" + +using namespace boost; +using namespace boost::python; +using namespace std; + +namespace avg { + +ParallelAnim::ParallelAnim(const vector& anims, + const object& startCallback, const object& stopCallback, long long maxAge) + : Anim(startCallback, stopCallback), + m_Anims(anims), + m_MaxAge(maxAge) +{ + vector::iterator it; + for (it=m_Anims.begin(); it != m_Anims.end(); ++it) { + (*it)->setHasParent(); + } +} + +ParallelAnim::~ParallelAnim() +{ + if (Player::exists()) { + abort(); + } +} + +void ParallelAnim::start(bool bKeepAttr) +{ + Anim::start(); + m_StartTime = Player::get()->getFrameTime(); + + vector::iterator it; + for (it=m_Anims.begin(); it != m_Anims.end(); ++it) { + (*it)->start(bKeepAttr); + if ((*it)->isRunning()) { + m_RunningAnims.push_back(*it); + } + m_This = dynamic_pointer_cast(shared_from_this()); + } +} + +void ParallelAnim::abort() +{ + if (isRunning()) { + vector::iterator it; + for (it=m_RunningAnims.begin(); it != m_RunningAnims.end(); ++it) { + (*it)->abort(); + } + m_RunningAnims.clear(); + setStopped(); + ParallelAnimPtr tempThis = m_This; + m_This = ParallelAnimPtr(); + tempThis = ParallelAnimPtr(); + } +} + +bool ParallelAnim::step() +{ + assert(isRunning()); + vector::iterator it; + for (it=m_RunningAnims.begin(); it != m_RunningAnims.end(); ) { + AnimPtr pAnim = (*it); + bool bDone; + if (pAnim->isRunning()) { + bDone = pAnim->step(); + } else { + bDone = true; + } + if (bDone) { + it = m_RunningAnims.erase(it); + } else { + ++it; + } + } + if (m_RunningAnims.empty()) { + setStopped(); + ParallelAnimPtr tempThis = m_This; + m_This = ParallelAnimPtr(); + tempThis = ParallelAnimPtr(); + return true; + } + if (m_MaxAge != -1 && Player::get()->getFrameTime()-m_StartTime >= m_MaxAge) { + abort(); + return true; + } + return false; +} + +} diff --git a/src/anim/ParallelAnim.h b/src/anim/ParallelAnim.h new file mode 100644 index 0000000..44d8e27 --- /dev/null +++ b/src/anim/ParallelAnim.h @@ -0,0 +1,64 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#ifndef _ParallelAnim_H_ +#define _ParallelAnim_H_ + +#include "../api.h" + +#include "Anim.h" + +#include + +namespace avg { + +class ParallelAnim; +typedef boost::shared_ptr ParallelAnimPtr; + +class AVG_API ParallelAnim: public Anim { +public: + virtual ~ParallelAnim(); + ParallelAnim(const std::vector& anims, + const boost::python::object& startCallback=boost::python::object(), + const boost::python::object& stopCallback=boost::python::object(), + long long maxAge=-1); + + virtual void start(bool bKeepAttr=false); + virtual void abort(); + + virtual bool step(); + +private: + std::vector m_Anims; + std::vector m_RunningAnims; + long long m_MaxAge; + + long long m_StartTime; + ParallelAnimPtr m_This; // Makes sure there is always a reference to the animation + // while it's running. +}; + +} + +#endif + + + diff --git a/src/anim/SimpleAnim.cpp b/src/anim/SimpleAnim.cpp new file mode 100644 index 0000000..76ea4ee --- /dev/null +++ b/src/anim/SimpleAnim.cpp @@ -0,0 +1,182 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de + +#include "SimpleAnim.h" + +#include "../base/Exception.h" +#include "../base/MathHelper.h" +#include "../player/Player.h" + +using namespace boost; +using namespace boost::python; +using namespace std; + +namespace avg { + +SimpleAnim::SimpleAnim(const object& node, const string& sAttrName, long long duration, + const object& startValue, const object& endValue, bool bUseInt, + const object& startCallback, const object& stopCallback) + : AttrAnim(node, sAttrName, startCallback, stopCallback), + m_Duration(duration), + m_StartValue(startValue), + m_EndValue(endValue), + m_bUseInt(bUseInt) +{ +} + +SimpleAnim::~SimpleAnim() +{ + if (Player::exists() && isRunning()) { + setStopped(); + } +} + +void SimpleAnim::start(bool bKeepAttr) +{ + AttrAnim::start(); + if (bKeepAttr) { + m_StartTime = calcStartTime(); + } else { + m_StartTime = Player::get()->getFrameTime(); + } + if (m_Duration == 0) { + setValue(m_EndValue); + remove(); + } else { + step(); + } +} + +void SimpleAnim::abort() +{ + if (isRunning()) { + remove(); + } +} + +template +object typedLERP(const object& startValue, const object& endValue, float part) +{ + T start = extract(startValue); + T end = extract(endValue); + T cur = start+(end-start)*part; + return object(cur); +} + +bool SimpleAnim::step() +{ + assert(isRunning()); + float t = ((float(Player::get()->getFrameTime())-m_StartTime) + /m_Duration); + if (t >= 1.0) { + setValue(m_EndValue); + remove(); + return true; + } else { + object curValue; + float part = interpolate(t); + if (isPythonType(m_StartValue)) { + curValue = typedLERP(m_StartValue, m_EndValue, part); + if (m_bUseInt) { + float d = extract(curValue); + curValue = object(round(d)); + } + } else if (isPythonType(m_StartValue)) { + curValue = typedLERP(m_StartValue, m_EndValue, part); + if (m_bUseInt) { + glm::vec2 pt = extract(curValue); + curValue = object(glm::vec2(round(pt.x), round(pt.y))); + } + } else { + throw (Exception(AVG_ERR_TYPE, + "Animated attributes must be either numbers or Point2D.")); + } + setValue(curValue); + return false; + } +} + +long long SimpleAnim::getStartTime() const +{ + return m_StartTime; +} + +long long SimpleAnim::getDuration() const +{ + return m_Duration; +} + +long long SimpleAnim::calcStartTime() +{ + float part; + if (isPythonType(m_StartValue)) { + if (m_EndValue == m_StartValue) { + part = 0; + } else { + part = getStartPart(extract(m_StartValue), + extract(m_EndValue), extract(getValue())); + } + } else if (isPythonType(m_StartValue)) { + float start = glm::vec2(extract(m_StartValue)()).x; + float end = glm::vec2(extract(m_EndValue)()).x; + float cur = glm::vec2(extract(getValue())()).x; + if (start == end) { + start = glm::vec2(extract(m_StartValue)()).y; + end = glm::vec2(extract(m_EndValue)()).y; + cur = glm::vec2(extract(getValue())()).y; + } + if (start == end) { + part = 0; + } else { + part = getStartPart(start, end, cur); + } + } else { + throw (Exception(AVG_ERR_TYPE, + "Animated attributes must be either numbers or Point2D.")); + } + return Player::get()->getFrameTime()-(long long)(part*getDuration()); +} + +float SimpleAnim::getStartPart(float start, float end, float cur) +{ + float tstart = 0; + float tend = 1; + bool bDir = (start < end); + for (int i=0; i<10; ++i) { + float tmiddle = (tstart+tend)/2; + float part = interpolate(tmiddle); + float middle = start+(end-start)*part; + if ((bDir && middle < cur) || (!bDir && middle >= cur)) { + tstart = tmiddle; + } else { + tend = tmiddle; + } + } + return (tend+tstart)/2; +} + +void SimpleAnim::remove() +{ + AnimPtr tempThis = shared_from_this(); + removeFromMap(); + setStopped(); +} + +} diff --git a/src/anim/SimpleAnim.h b/src/anim/SimpleAnim.h new file mode 100644 index 0000000..502505b --- /dev/null +++ b/src/anim/SimpleAnim.h @@ -0,0 +1,79 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#ifndef _SimpleAnim_H_ +#define _SimpleAnim_H_ + +#include "../api.h" +// Python docs say python.h should be included before any standard headers (!) +#include "../player/WrapPython.h" + +#include "AttrAnim.h" + +#include + +#include +#include + +namespace avg { + +class SimpleAnim; +typedef boost::shared_ptr SimpleAnimPtr; + +class AVG_API SimpleAnim: public AttrAnim +{ +public: + SimpleAnim(const boost::python::object& node, const std::string& sAttrName, + long long duration, + const boost::python::object& pStartValue, + const boost::python::object& pEndValue, + bool bUseInt, + const boost::python::object& startCallback, + const boost::python::object& stopCallback); + virtual ~SimpleAnim()=0; + + virtual void start(bool bKeepAttr=false); + virtual void abort(); + virtual bool step(); + +protected: + virtual float interpolate(float t)=0; + void remove(); + +private: + long long getStartTime() const; + long long getDuration() const; + long long calcStartTime(); + virtual float getStartPart(float start, float end, float cur); + + long long m_Duration; + boost::python::object m_StartValue; + boost::python::object m_EndValue; + bool m_bUseInt; + long long m_StartTime; +}; + +} + +#endif + + + diff --git a/src/anim/StateAnim.cpp b/src/anim/StateAnim.cpp new file mode 100644 index 0000000..4858c23 --- /dev/null +++ b/src/anim/StateAnim.cpp @@ -0,0 +1,123 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#include "StateAnim.h" + +#include "../base/Exception.h" +#include "../player/Player.h" + +using namespace boost::python; +using namespace std; + +namespace avg { + +AnimState::AnimState(const string& sName, AnimPtr pAnim, const string& sNextName) + : m_sName(sName), + m_pAnim(pAnim), + m_sNextName(sNextName) +{ +} + +AnimState::AnimState() +{ +} + +StateAnim::StateAnim(const vector& states) + : Anim(object(), object()), + m_bDebug(false) +{ + vector::const_iterator it; + for (it=states.begin(); it != states.end(); ++it) { + m_States[(*it).m_sName] = *it; + it->m_pAnim->setHasParent(); + } +} + +StateAnim::~StateAnim() +{ + setState(""); +} + +void StateAnim::abort() +{ + setState(""); +} + +void StateAnim::setState(const std::string& sName, bool bKeepAttr) +{ + if (m_sCurStateName == sName) { + return; + } + if (!m_sCurStateName.empty()) { + m_States[m_sCurStateName].m_pAnim->abort(); + } + switchToNewState(sName, bKeepAttr); +} + +const std::string& StateAnim::getState() const +{ + return m_sCurStateName; +} + +void StateAnim::setDebug(bool bDebug) +{ + m_bDebug = bDebug; +} + +bool StateAnim::step() +{ + // Make sure the object isn't deleted until the end of the method. + AnimPtr tempThis = shared_from_this(); + + if (!m_sCurStateName.empty()) { + const AnimState& curState = m_States[m_sCurStateName]; + bool bDone = curState.m_pAnim->step(); + if (bDone) { + switchToNewState(curState.m_sNextName, false); + } + } + return false; +} + +void StateAnim::switchToNewState(const string& sName, bool bKeepAttr) +{ + if (m_bDebug) { + cerr << this << " State change: '" << m_sCurStateName << "' --> '" << sName + << "'" << endl; + } + string sOldStateName = m_sCurStateName; + m_sCurStateName = sName; + if (!sName.empty()) { + map::iterator it = m_States.find(sName); + if (it == m_States.end()) { + throw Exception(AVG_ERR_INVALID_ARGS, "StateAnim: State "+sName+" unknown."); + } else { + it->second.m_pAnim->start(bKeepAttr); + } + if (sOldStateName == "") { + Anim::start(false); + } + } else { + Anim::setStopped(); + } +} + +} diff --git a/src/anim/StateAnim.h b/src/anim/StateAnim.h new file mode 100644 index 0000000..135668a --- /dev/null +++ b/src/anim/StateAnim.h @@ -0,0 +1,69 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#ifndef _StateAnim_H_ +#define _StateAnim_H_ + +#include "../api.h" + +#include "Anim.h" + +#include +#include + +namespace avg { + +struct AVG_API AnimState { + AnimState(const std::string& sName, AnimPtr pAnim, const std::string& sNextName = ""); + AnimState(); + + std::string m_sName; + AnimPtr m_pAnim; + std::string m_sNextName; +}; + +class AVG_API StateAnim: public Anim { +public: + StateAnim(const std::vector& states); + virtual ~StateAnim(); + + virtual void abort(); + + virtual void setState(const std::string& sName, bool bKeepAttr=false); + const std::string& getState() const; + void setDebug(bool bDebug); + + virtual bool step(); + +private: + void switchToNewState(const std::string& sName, bool bKeepAttr); + + std::map m_States; + bool m_bDebug; + std::string m_sCurStateName; +}; + +} + +#endif + + + diff --git a/src/anim/WaitAnim.cpp b/src/anim/WaitAnim.cpp new file mode 100644 index 0000000..7509504 --- /dev/null +++ b/src/anim/WaitAnim.cpp @@ -0,0 +1,69 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#include "WaitAnim.h" + +#include "../player/Player.h" + +using namespace boost; +using namespace boost::python; +using namespace std; + +namespace avg { + +WaitAnim::WaitAnim(long long duration, const object& startCallback, + const object& stopCallback) + : Anim(startCallback, stopCallback), + m_Duration(duration) +{ +} + +WaitAnim::~WaitAnim() +{ +} + +void WaitAnim::start(bool bKeepAttr) +{ + m_pThis = dynamic_pointer_cast(shared_from_this()); + Anim::start(); + m_StartTime = Player::get()->getFrameTime(); +} + +void WaitAnim::abort() +{ + setStopped(); + m_pThis = WaitAnimPtr(); +} + +bool WaitAnim::step() +{ + assert(isRunning()); + if (m_Duration != -1 && Player::get()->getFrameTime()-m_StartTime > m_Duration) { + setStopped(); + m_pThis = WaitAnimPtr(); + return true; + } else { + return false; + } + +} + +} diff --git a/src/anim/WaitAnim.h b/src/anim/WaitAnim.h new file mode 100644 index 0000000..e90daf2 --- /dev/null +++ b/src/anim/WaitAnim.h @@ -0,0 +1,57 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#ifndef _WaitAnim_H_ +#define _WaitAnim_H_ + +#include "../api.h" + +#include "SimpleAnim.h" + +namespace avg { + +class WaitAnim; +typedef boost::shared_ptr WaitAnimPtr; + +class AVG_API WaitAnim: public Anim { +public: + WaitAnim(long long duration = -1, + const boost::python::object& startCallback=boost::python::object(), + const boost::python::object& stopCallback=boost::python::object()); + virtual ~WaitAnim(); + + virtual void start(bool bKeepAttr=false); + virtual void abort(); + + virtual bool step(); + +private: + long long m_Duration; + long long m_StartTime; + WaitAnimPtr m_pThis; // Make sure we're not deleted while running. +}; + +} + +#endif + + + diff --git a/src/api.h b/src/api.h new file mode 100644 index 0000000..cd6001b --- /dev/null +++ b/src/api.h @@ -0,0 +1,50 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// +// Original author of this file is Jan Boelsche (regular.gonzales@googlemail.com). +// + +#ifndef _API_H_ +#define _API_H_ + +#ifdef _WIN32 // in declspec land +#pragma warning(disable: 4251) +#define AVG_PLUGIN_API extern "C" __declspec(dllexport) +#ifdef AVG_PLUGIN +#define AVG_API __declspec(dllimport) +#define AVG_TEMPLATE_API +#else +#define AVG_API __declspec(dllexport) +#define AVG_TEMPLATE_API __declspec(dllexport) +#endif +#else // not _WIN32, plain and simple +#define AVG_API +#define AVG_TEMPLATE_API +#define AVG_PLUGIN_API extern "C" +#endif + +#ifdef __APPLE__ +// Workaround for snow leopard incompatibility between c++ headers and python headers: +// always needs to be included before Python.h. +#include +#endif + +#endif + diff --git a/src/audio/AudioBuffer.cpp b/src/audio/AudioBuffer.cpp new file mode 100644 index 0000000..64032c3 --- /dev/null +++ b/src/audio/AudioBuffer.cpp @@ -0,0 +1,105 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// +// Original author of this file is Nick Hebner (hebnern@gmail.com). +// + +#include "AudioBuffer.h" + +#include +#include + +#define VOLUME_FADE_SAMPLES 100 + +namespace avg { + +AudioBuffer::AudioBuffer(int numFrames, AudioParams ap) + : m_NumFrames(numFrames), + m_AP(ap) +{ + m_pData = new short[numFrames*sizeof(short)*ap.m_Channels]; +} + +AudioBuffer::~AudioBuffer() +{ + delete[] m_pData; +} + +short* AudioBuffer::getData() +{ + return m_pData; +} + +int AudioBuffer::getNumFrames() +{ + return m_NumFrames; +} + +int AudioBuffer::getNumBytes() +{ + return m_NumFrames*m_AP.m_Channels*sizeof(short); +} + +int AudioBuffer::getFrameSize() +{ + return m_AP.m_Channels*sizeof(short); +} + +int AudioBuffer::getNumChannels() +{ + return m_AP.m_Channels; +} + +int AudioBuffer::getRate() +{ + return m_AP.m_SampleRate; +} + +void AudioBuffer::clear() +{ + memset(m_pData, 0, m_NumFrames*sizeof(short)*m_AP.m_Channels); +} + +void AudioBuffer::volumize(float lastVol, float curVol) +{ + float volDiff = lastVol - curVol; + + if (curVol == 1.0f && volDiff == 0.0f) { + return; + } + + for (int i = 0; i < m_NumFrames*m_AP.m_Channels; i++) { + float fadeVol = 0; + if (volDiff != 0 && i < VOLUME_FADE_SAMPLES) { + fadeVol = volDiff * (VOLUME_FADE_SAMPLES - i) / VOLUME_FADE_SAMPLES; + } + + int s = int(m_pData[i] * (curVol + fadeVol)); + + if (s < -32768) + s = -32768; + if (s > 32767) + s = 32767; + + m_pData[i] = s; + } +} + +} diff --git a/src/audio/AudioBuffer.h b/src/audio/AudioBuffer.h new file mode 100644 index 0000000..1dbf068 --- /dev/null +++ b/src/audio/AudioBuffer.h @@ -0,0 +1,61 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// +// Original author of this file is Nick Hebner (hebnern@gmail.com). +// + +#ifndef _AudioBuffer_H_ +#define _AudioBuffer_H_ + +#include "../api.h" +#include "AudioParams.h" + +#include + +namespace avg +{ + +class AVG_API AudioBuffer +{ + public: + AudioBuffer(int numFrames, AudioParams ap); + virtual ~AudioBuffer(); + + short* getData(); + int getNumFrames(); + int getNumBytes(); + int getFrameSize(); + int getNumChannels(); + int getRate(); + void clear(); + + void volumize(float lastVol, float curVol); + + private: + int m_NumFrames; + short* m_pData; + AudioParams m_AP; +}; + +typedef boost::shared_ptr AudioBufferPtr; + +} + +#endif diff --git a/src/audio/AudioEngine.cpp b/src/audio/AudioEngine.cpp new file mode 100644 index 0000000..aad1b9f --- /dev/null +++ b/src/audio/AudioEngine.cpp @@ -0,0 +1,295 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// +// Original author of this file is Nick Hebner (hebnern@gmail.com). +// + +#include "AudioEngine.h" + +#include "Dynamics.h" + +#include "../base/Exception.h" +#include "../base/Logger.h" + +#include + +using namespace std; +using namespace boost; + +namespace avg { + +AudioEngine* AudioEngine::s_pInstance = 0; + +AudioEngine* AudioEngine::get() +{ + return s_pInstance; +} + +AudioEngine::AudioEngine() + : m_pTempBuffer(), + m_pMixBuffer(0), + m_pLimiter(0), + m_bEnabled(true), + m_Volume(1) +{ + AVG_ASSERT(s_pInstance == 0); + if (SDL_InitSubSystem(SDL_INIT_AUDIO) == -1) { + AVG_LOG_ERROR("Can't init SDL audio subsystem."); + exit(-1); + } + s_pInstance = this; +} + +AudioEngine::~AudioEngine() +{ + if (m_pMixBuffer) { + delete[] m_pMixBuffer; + } + SDL_QuitSubSystem(SDL_INIT_AUDIO); + m_AudioSources.clear(); +} + +int AudioEngine::getChannels() +{ + return m_AP.m_Channels; +} + +int AudioEngine::getSampleRate() +{ + return m_AP.m_SampleRate; +} + +const AudioParams * AudioEngine::getParams() +{ + if (isEnabled()) { + return &m_AP; + } else { + return 0; + } +} + +void AudioEngine::init(const AudioParams& ap, float volume) +{ + m_Volume = volume; + m_AP = ap; + Dynamics* pLimiter = new Dynamics(float(m_AP.m_SampleRate)); + pLimiter->setThreshold(0.f); // in dB + pLimiter->setAttackTime(0.f); // in seconds + pLimiter->setReleaseTime(0.05f); // in seconds + pLimiter->setRmsTime(0.f); // in seconds + pLimiter->setRatio(std::numeric_limits::infinity()); + pLimiter->setMakeupGain(0.f); // in dB + m_pLimiter = pLimiter; + + SDL_AudioSpec desired; + desired.freq = m_AP.m_SampleRate; + desired.format = AUDIO_S16SYS; + desired.channels = m_AP.m_Channels; + desired.silence = 0; + desired.samples = m_AP.m_OutputBufferSamples; + desired.callback = audioCallback; + desired.userdata = this; + + int err = SDL_OpenAudio(&desired, 0); + if (err < 0) { + static bool bWarned = false; + if (!bWarned) { + AVG_TRACE(Logger::category::CONFIG, Logger::severity::WARNING, + "Can't open audio: " << SDL_GetError()); + bWarned = true; + } + } +} + +void AudioEngine::teardown() +{ + { + lock_guard lock(m_Mutex); + SDL_PauseAudio(1); + } + // Optimized away - takes too long. +// SDL_CloseAudio(); + + m_AudioSources.clear(); + if (m_pLimiter) { + delete m_pLimiter; + m_pLimiter = 0; + } +} + +void AudioEngine::setAudioEnabled(bool bEnabled) +{ + SDL_LockAudio(); + lock_guard lock(m_Mutex); + AVG_ASSERT(m_AudioSources.empty()); + m_bEnabled = bEnabled; + if (m_bEnabled) { + play(); + } else { + pause(); + } + SDL_UnlockAudio(); +} + +void AudioEngine::play() +{ + SDL_PauseAudio(0); +} + +void AudioEngine::pause() +{ + SDL_PauseAudio(1); +} + +int AudioEngine::addSource(AudioMsgQueue& dataQ, AudioMsgQueue& statusQ) +{ + SDL_LockAudio(); + lock_guard lock(m_Mutex); + static int nextID = -1; + nextID++; + AudioSourcePtr pSrc(new AudioSource(dataQ, statusQ, m_AP.m_SampleRate)); + m_AudioSources[nextID] = pSrc; + SDL_UnlockAudio(); + return nextID; +} + +void AudioEngine::removeSource(int id) +{ + SDL_LockAudio(); + lock_guard lock(m_Mutex); + int numErased = m_AudioSources.erase(id); + AVG_ASSERT(numErased == 1); + SDL_UnlockAudio(); +} + +void AudioEngine::pauseSource(int id) +{ + lock_guard lock(m_Mutex); + AudioSourceMap::iterator itSource = m_AudioSources.find(id); + AVG_ASSERT(itSource != m_AudioSources.end()); + AudioSourcePtr pSource = itSource->second; + pSource->pause(); +} + +void AudioEngine::playSource(int id) +{ + lock_guard lock(m_Mutex); + AudioSourceMap::iterator itSource = m_AudioSources.find(id); + AVG_ASSERT(itSource != m_AudioSources.end()); + AudioSourcePtr pSource = itSource->second; + pSource->play(); +} + +void AudioEngine::notifySeek(int id) +{ + lock_guard lock(m_Mutex); + AudioSourceMap::iterator itSource = m_AudioSources.find(id); + AVG_ASSERT(itSource != m_AudioSources.end()); + AudioSourcePtr pSource = itSource->second; + pSource->notifySeek(); +} + +void AudioEngine::setSourceVolume(int id, float volume) +{ + lock_guard lock(m_Mutex); + AudioSourceMap::iterator itSource = m_AudioSources.find(id); + AVG_ASSERT(itSource != m_AudioSources.end()); + AudioSourcePtr pSource = itSource->second; + pSource->setVolume(volume); +} + +void AudioEngine::setVolume(float volume) +{ + SDL_LockAudio(); + lock_guard lock(m_Mutex); + m_Volume = volume; + SDL_UnlockAudio(); +} + +float AudioEngine::getVolume() const +{ + return m_Volume; +} + +bool AudioEngine::isEnabled() const +{ + return m_bEnabled; +} + +void AudioEngine::mixAudio(Uint8 *pDestBuffer, int destBufferLen) +{ + int numFrames = destBufferLen/(2*getChannels()); // 16 bit samples. + + if (m_AudioSources.size() == 0) { + return; + } + if (!m_pTempBuffer || m_pTempBuffer->getNumFrames() < numFrames) { + if (m_pTempBuffer) { + delete[] m_pMixBuffer; + } + m_pTempBuffer = AudioBufferPtr(new AudioBuffer(numFrames, m_AP)); + m_pMixBuffer = new float[getChannels()*numFrames]; + } + + for (int i = 0; i < getChannels()*numFrames; ++i) { + m_pMixBuffer[i]=0; + } + { + lock_guard lock(m_Mutex); + AudioSourceMap::iterator it; + for (it = m_AudioSources.begin(); it != m_AudioSources.end(); it++) { + m_pTempBuffer->clear(); + it->second->fillAudioBuffer(m_pTempBuffer); + addBuffers(m_pMixBuffer, m_pTempBuffer); + } + } + calcVolume(m_pMixBuffer, numFrames*getChannels(), getVolume()); + for (int i = 0; i < numFrames; ++i) { + m_pLimiter->process(m_pMixBuffer+i*getChannels()); + for (int j = 0; j < getChannels(); ++j) { + ((short*)pDestBuffer)[i*2+j]=short(m_pMixBuffer[i*2+j]*32768); + } + } +} + +void AudioEngine::audioCallback(void *userData, Uint8 *audioBuffer, int audioBufferLen) +{ + AudioEngine *pThis = (AudioEngine*)userData; + pThis->mixAudio(audioBuffer, audioBufferLen); +} + +void AudioEngine::addBuffers(float *pDest, AudioBufferPtr pSrc) +{ + int numFrames = pSrc->getNumFrames(); + short * pData = pSrc->getData(); + for(int i = 0; i < numFrames*getChannels(); ++i) { + pDest[i] += pData[i]/32768.0f; + } +} + +void AudioEngine::calcVolume(float *pBuffer, int numSamples, float volume) +{ + // TODO: We need a VolumeFader class that keeps state. + for(int i = 0; i < numSamples; ++i) { + pBuffer[i] *= volume; + } +} + +} diff --git a/src/audio/AudioEngine.h b/src/audio/AudioEngine.h new file mode 100644 index 0000000..bb93196 --- /dev/null +++ b/src/audio/AudioEngine.h @@ -0,0 +1,94 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// +// Original author of this file is Nick Hebner (hebnern@gmail.com). +// + +#ifndef _AudioEngine_H_ +#define _AudioEngine_H_ + +#include "../api.h" +#include "AudioSource.h" +#include "AudioParams.h" +#include "AudioBuffer.h" +#include "IProcessor.h" + +#include + +#include + +#include + +namespace avg { + +typedef std::map AudioSourceMap; + +class AVG_API AudioEngine +{ + public: + static AudioEngine* get(); + AudioEngine(); + virtual ~AudioEngine(); + + int getChannels(); + int getSampleRate(); + const AudioParams * getParams(); + + void setAudioEnabled(bool bEnabled); + + void init(const AudioParams& ap, float volume); + void teardown(); + + void play(); + void pause(); + + int addSource(AudioMsgQueue& dataQ, AudioMsgQueue& statusQ); + void removeSource(int id); + void pauseSource(int id); + void playSource(int id); + void notifySeek(int id); + void setSourceVolume(int id, float volume); + + void setVolume(float volume); + float getVolume() const; + bool isEnabled() const; + + private: + void mixAudio(Uint8 *pDestBuffer, int destBufferLen); + static void audioCallback(void *userData, Uint8 *audioBuffer, int audioBufferLen); + void addBuffers(float *pDest, AudioBufferPtr pSrc); + void calcVolume(float *pBuffer, int numSamples, float volume); + + AudioParams m_AP; + AudioBufferPtr m_pTempBuffer; + float * m_pMixBuffer; + IProcessor* m_pLimiter; + boost::mutex m_Mutex; + + bool m_bEnabled; + AudioSourceMap m_AudioSources; + float m_Volume; + + static AudioEngine* s_pInstance; +}; + +} + +#endif diff --git a/src/audio/AudioMsg.cpp b/src/audio/AudioMsg.cpp new file mode 100644 index 0000000..2e1d6df --- /dev/null +++ b/src/audio/AudioMsg.cpp @@ -0,0 +1,165 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#include "AudioMsg.h" + +#include "../base/ObjectCounter.h" +#include "../base/Exception.h" + +#include + +using namespace std; + +namespace avg { + +AudioMsg::AudioMsg() + : m_MsgType(NONE) +{ + ObjectCounter::get()->incRef(&typeid(*this)); +} + +AudioMsg::~AudioMsg() +{ + ObjectCounter::get()->decRef(&typeid(*this)); +} + +void AudioMsg::setAudio(AudioBufferPtr pAudioBuffer, float audioTime) +{ + AVG_ASSERT(pAudioBuffer); + setType(AUDIO); + m_pAudioBuffer = pAudioBuffer; + m_AudioTime = audioTime; +} + +void AudioMsg::setAudioTime(float audioTime) +{ + setType(AUDIO_TIME); + m_AudioTime = audioTime; +} + +void AudioMsg::setEOF() +{ + setType(END_OF_FILE); +} + +void AudioMsg::setError(const Exception& ex) +{ + setType(ERROR); + m_pEx = new Exception(ex); +} + +void AudioMsg::setSeekDone(int seqNum, float seekTime) +{ + setType(SEEK_DONE); + AVG_ASSERT(seqNum != -1); + m_SeekSeqNum = seqNum; + m_SeekTime = seekTime; +} + +void AudioMsg::setClosed() +{ + setType(CLOSED); +} + +AudioMsg::MsgType AudioMsg::getType() +{ + return m_MsgType; +} + +AudioBufferPtr AudioMsg::getAudioBuffer() const +{ + AVG_ASSERT(m_MsgType == AUDIO); + return m_pAudioBuffer; +} + +float AudioMsg::getAudioTime() const +{ + AVG_ASSERT(m_MsgType == AUDIO_TIME || m_MsgType == AUDIO); + return m_AudioTime; +} + +const Exception& AudioMsg::getException() const +{ + AVG_ASSERT(m_MsgType == ERROR); + return *m_pEx; +} + +int AudioMsg::getSeekSeqNum() +{ + AVG_ASSERT(m_MsgType == SEEK_DONE); + return m_SeekSeqNum; +} + +float AudioMsg::getSeekTime() +{ + AVG_ASSERT(m_MsgType == SEEK_DONE); + return m_SeekTime; +} + +void AudioMsg::dump() +{ + switch (m_MsgType) { + case NONE: + cerr << "NONE" << endl; + break; + case AUDIO: + cerr << "AUDIO" << endl; + break; + case AUDIO_TIME: + cerr << "AUDIO_TIME" << endl; + break; + case END_OF_FILE: + cerr << "END_OF_FILE" << endl; + break; + case ERROR: + cerr << "ERROR" << endl; + break; + case FRAME: + cerr << "FRAME" << endl; + break; + case VDPAU_FRAME: + cerr << "VDPAU_FRAME" << endl; + break; + case SEEK_DONE: + cerr << "SEEK_DONE" << endl; + break; + case PACKET: + cerr << "PACKET" << endl; + break; + case CLOSED: + cerr << "CLOSED" << endl; + break; + default: + AVG_ASSERT(false); + break; + } +} + +void AudioMsg::setType(MsgType msgType) +{ + AVG_ASSERT(m_MsgType == NONE); + m_MsgType = msgType; +} + + + +} + diff --git a/src/audio/AudioMsg.h b/src/audio/AudioMsg.h new file mode 100644 index 0000000..89895e3 --- /dev/null +++ b/src/audio/AudioMsg.h @@ -0,0 +1,85 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#ifndef _AudioMsg_H_ +#define _AudioMsg_H_ + +#include "../api.h" +#include "../base/Queue.h" + +#include "AudioBuffer.h" + +#include + +namespace avg { + +class AVG_API AudioMsg { +public: + enum MsgType {NONE, AUDIO, AUDIO_TIME, END_OF_FILE, ERROR, FRAME, VDPAU_FRAME, + SEEK_DONE, PACKET, CLOSED}; + AudioMsg(); + void setAudio(AudioBufferPtr pAudioBuffer, float audioTime); + void setAudioTime(float audioTime); + void setEOF(); + void setError(const Exception& ex); + void setSeekDone(int seqNum, float seekTime); + void setClosed(); + + virtual ~AudioMsg(); + + MsgType getType(); + + AudioBufferPtr getAudioBuffer() const; + float getAudioTime() const; + + const Exception& getException() const; + + int getSeekSeqNum(); + float getSeekTime(); + + virtual void dump(); + +protected: + void setType(MsgType msgType); + +private: + MsgType m_MsgType; + + // AUDIO + AudioBufferPtr m_pAudioBuffer; + float m_AudioTime; + + // ERROR + Exception* m_pEx; + + // SEEK_DONE + int m_SeekSeqNum; + float m_SeekTime; + +}; + +typedef boost::shared_ptr AudioMsgPtr; +typedef Queue AudioMsgQueue; +typedef boost::shared_ptr AudioMsgQueuePtr; + +} +#endif + diff --git a/src/audio/AudioParams.cpp b/src/audio/AudioParams.cpp new file mode 100644 index 0000000..eee3768 --- /dev/null +++ b/src/audio/AudioParams.cpp @@ -0,0 +1,40 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// +// Original author of this file is Nick Hebner (hebnern@gmail.com). +// + +#include "AudioParams.h" + +#include "../base/ObjectCounter.h" + +namespace avg { + AudioParams::AudioParams() + { + } + + AudioParams::AudioParams(int sampleRate, int channels, int outputBufferSamples) + : m_SampleRate(sampleRate), + m_Channels(channels), + m_OutputBufferSamples(outputBufferSamples) + { + } +} + diff --git a/src/audio/AudioParams.h b/src/audio/AudioParams.h new file mode 100644 index 0000000..5e04b1d --- /dev/null +++ b/src/audio/AudioParams.h @@ -0,0 +1,39 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// +// Original author of this file is Nick Hebner (hebnern@gmail.com). +// + +#ifndef _AudioParams_H_ +#define _AudioParams_H_ + +namespace avg { + +struct AudioParams { + AudioParams(); + AudioParams(int sampleRate, int channels, int outputBufferSamples); + int m_SampleRate; + int m_Channels; + int m_OutputBufferSamples; +}; + +} + +#endif diff --git a/src/audio/AudioSource.cpp b/src/audio/AudioSource.cpp new file mode 100644 index 0000000..7f6ae4a --- /dev/null +++ b/src/audio/AudioSource.cpp @@ -0,0 +1,156 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#include "AudioSource.h" +#include "AudioEngine.h" + +#include +#include + +using namespace std; + +namespace avg { + +AudioSource::AudioSource(AudioMsgQueue& msgQ, AudioMsgQueue& statusQ, int sampleRate) + : m_MsgQ(msgQ), + m_StatusQ(statusQ), + m_SampleRate(sampleRate), + m_bPaused(false), + m_bSeeking(false), + m_Volume(1.0), + m_LastVolume(1.0) +{ +} + +AudioSource::~AudioSource() +{ +} + +void AudioSource::pause() +{ + m_bPaused = true; +} + +void AudioSource::play() +{ + m_bPaused = false; +} + +void AudioSource::notifySeek() +{ + while (m_bSeeking) { + processNextMsg(true); + } + m_bSeeking = true; +} + +void AudioSource::setVolume(float volume) +{ + m_Volume = volume; +} + +void AudioSource::fillAudioBuffer(AudioBufferPtr pBuffer) +{ + bool bContinue = true; + while (bContinue && m_bSeeking) { + bContinue = processNextMsg(false); + } + if (!m_bPaused) { + unsigned char* pDest = (unsigned char *)(pBuffer->getData()); + int framesLeftToFill = pBuffer->getNumFrames(); + AudioMsgPtr pMsg; + while (framesLeftToFill > 0) { + int framesLeftInBuffer = 0; + if (m_pInputAudioBuffer) { + framesLeftInBuffer = m_pInputAudioBuffer->getNumFrames() + - m_CurInputAudioPos; + } + while (framesLeftInBuffer > 0 && framesLeftToFill > 0) { + int framesToCopy = min(framesLeftToFill, framesLeftInBuffer); + // cerr << "framesToCopy: " << framesToCopy << endl; + char * pInputPos = (char*)m_pInputAudioBuffer->getData() + + m_CurInputAudioPos*pBuffer->getFrameSize(); + int bytesToCopy = framesToCopy*pBuffer->getFrameSize(); + memcpy(pDest, pInputPos, bytesToCopy); + m_CurInputAudioPos += framesToCopy; + framesLeftToFill -= framesToCopy; + framesLeftInBuffer -= framesToCopy; + pDest += bytesToCopy; + + m_LastTime += framesToCopy/m_SampleRate; + // cerr << " " << m_LastTime << endl; + } + if (framesLeftToFill != 0) { + bool bContinue = processNextMsg(false); + if (!bContinue) { + framesLeftToFill = 0; + } + } + } + pBuffer->volumize(m_LastVolume, m_Volume); + m_LastVolume = m_Volume; + + AudioMsgPtr pStatusMsg(new AudioMsg); + pStatusMsg->setAudioTime(m_LastTime); + m_StatusQ.push(pStatusMsg); + } +} + +bool AudioSource::processNextMsg(bool bWait) +{ + AudioMsgPtr pMsg = m_MsgQ.pop(bWait); + if (pMsg) { + switch (pMsg->getType()) { + case AudioMsg::AUDIO: + m_pInputAudioBuffer = pMsg->getAudioBuffer(); + m_CurInputAudioPos = 0; + m_LastTime = pMsg->getAudioTime(); +// cerr << " New buffer: " << m_LastTime << endl; + return true; + case AudioMsg::END_OF_FILE: { +// cerr << " AudioSource: EOF" << endl; + m_bSeeking = false; + AudioMsgPtr pStatusMsg(new AudioMsg); + pStatusMsg->setEOF(); + m_StatusQ.push(pStatusMsg); + return false; + } + case AudioMsg::SEEK_DONE: { +// cerr << " AudioSource: SEEK_DONE" << endl; + m_bSeeking = false; + m_pInputAudioBuffer = AudioBufferPtr(); + m_LastTime = pMsg->getSeekTime(); + AudioMsgPtr pStatusMsg(new AudioMsg); + pStatusMsg->setSeekDone(pMsg->getSeekSeqNum(), m_LastTime); + m_StatusQ.push(pStatusMsg); + return true; + } + default: + AVG_ASSERT(false); + return false; + } + } else { + // cerr << "no pop" << endl; + return false; + } +} + +} diff --git a/src/audio/AudioSource.h b/src/audio/AudioSource.h new file mode 100644 index 0000000..f90daed --- /dev/null +++ b/src/audio/AudioSource.h @@ -0,0 +1,66 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#ifndef _AudioSource_H_ +#define _AudioSource_H_ + +#include "../api.h" + +#include "AudioMsg.h" + +#include + +namespace avg +{ + +class AVG_API AudioSource +{ +public: + AudioSource(AudioMsgQueue& msgQ, AudioMsgQueue& statusQ, int sampleRate); + virtual ~AudioSource(); + + void pause(); + void play(); + void notifySeek(); + void setVolume(float volume); + + void fillAudioBuffer(AudioBufferPtr pBuffer); + +private: + bool processNextMsg(bool bWait); + + AudioMsgQueue& m_MsgQ; + AudioMsgQueue& m_StatusQ; + int m_SampleRate; + AudioBufferPtr m_pInputAudioBuffer; + float m_LastTime; + int m_CurInputAudioPos; + bool m_bPaused; + bool m_bSeeking; + float m_Volume; + float m_LastVolume; +}; + +typedef boost::shared_ptr AudioSourcePtr; + +} + +#endif diff --git a/src/audio/Dynamics.h b/src/audio/Dynamics.h new file mode 100644 index 0000000..e5293e5 --- /dev/null +++ b/src/audio/Dynamics.h @@ -0,0 +1,343 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// +// Original author of this file is Andreas Beisler. +// + +#pragma once +#ifndef __Dynamics_H__ +#define __Dynamics_H__ + +#include "../api.h" +#include "IProcessor.h" + +#include +#include +#include +#include + +#define LOOKAHEAD 64 +#define AVG1 27 +#define AVG2 38 + +namespace avg { + +// Dynamics processor (compressor & limiter). +template +class AVG_API Dynamics: public IProcessor +{ + public: + Dynamics(T fs); + virtual ~Dynamics(); + virtual void process(T* pSamples); + + void setThreshold(T threshold); + T getThreshold() const; + void setRmsTime(T rmsTime); + T getRmsTime() const; + void setRatio(T ratio); + T getRatio() const; + void setAttackTime(T attTime); + T getAttackTime() const; + void setReleaseTime(T relTime); + T getReleaseTime() const; + void setMakeupGain(T makeupGain); + T getMakeupGain() const; + + private: + void maxFilter(T& rms); + + T m_fs; + + T threshold_; + T preGain_; + + T rmsTime_; + T rmsCoef_; + T rms1_; + + T* lookaheadBuf_; + int lookaheadBufIdx_; + + T ratio_; + T inverseRatio_; + + T attTime_; + T attCoef_; + T relTime_; + T relCoef_; + T env1_; + + T* avg1Buf_; + int avg1BufRIdx_; + int avg1BufWIdx_; + T avg1Old_; + + T* avg2Buf_; + int avg2BufRIdx_; + int avg2BufWIdx_; + T avg2Old_; + + T* delayBuf_; + int delayBufIdx_; + + T makeupGain_; + T postGain_; +}; + +template +Dynamics::Dynamics(T fs) + : m_fs(fs), + threshold_(0.), + preGain_(1.), + rmsTime_(0.), + rmsCoef_(0.), + rms1_(0.), + lookaheadBuf_(0), + lookaheadBufIdx_(0), + ratio_(std::numeric_limits::infinity()), + inverseRatio_(0.), + attTime_(0.), + attCoef_(0.), + relTime_(0.), + relCoef_(0.), + env1_(0.), + avg1Buf_(0), + avg1BufRIdx_(0), + avg1BufWIdx_(AVG1 - 1), + avg1Old_(0.), + avg2Buf_(0), + avg2BufRIdx_(0), + avg2BufWIdx_(AVG2 - 1), + avg2Old_(0.), + delayBuf_(0), + delayBufIdx_(0), + makeupGain_(0.), + postGain_(1.) +{ + lookaheadBuf_ = new T[LOOKAHEAD]; + for (int i = 0; i < LOOKAHEAD; i++) { + lookaheadBuf_[i] = 1.f; + } + + avg1Buf_ = new T[AVG1]; + memset(avg1Buf_, 0, sizeof(T) * (AVG1)); + + avg2Buf_ = new T[AVG2]; + memset(avg2Buf_, 0, sizeof(T) * (AVG2)); + + delayBuf_ = new T[LOOKAHEAD*CHANNELS]; + memset(delayBuf_, 0, sizeof(T)*LOOKAHEAD*CHANNELS); + + setThreshold(0.); + setRmsTime(0.); + setRatio(std::numeric_limits::infinity()); + setAttackTime(0.); + setReleaseTime(0.05); + setMakeupGain(0.); +} + +template +Dynamics::~Dynamics() +{ + delete[] lookaheadBuf_; + + delete[] avg1Buf_; + delete[] avg2Buf_; + + delete[] delayBuf_; +} + +template +void Dynamics::maxFilter(T& rms) +{ + int j = lookaheadBufIdx_; + for (int i = 0; i < LOOKAHEAD; i++) + { + j = (j+1)&(LOOKAHEAD-1); + if (lookaheadBuf_[j] < rms) { + lookaheadBuf_[j] = rms; + } + } +} + +template +void Dynamics::process(T* pSamples) +{ + + //---------------- Preprocessing + T x = 0.f; + for (int i = 0; i < CHANNELS; i++) { + // Apply pregain + const T tmp = pSamples[i] * preGain_; + + T abs = std::fabs(tmp); + if (abs > x) { + x = abs; + } + } + + //---------------- RMS + T rms = (1.f - rmsCoef_) * x * x + rmsCoef_ * rms1_; + rms1_ = rms; + rms = sqrt(rms); + + //---------------- Max filter + if (rms > 1.) { + maxFilter(rms); + } + + //---------------- Ratio + T dbMax = std::log10(lookaheadBuf_[lookaheadBufIdx_]); + T dbComp = dbMax * inverseRatio_; + T comp = std::pow(static_cast(10.), dbComp); + T c = comp / lookaheadBuf_[lookaheadBufIdx_]; + + lookaheadBuf_[lookaheadBufIdx_] = 1.; + lookaheadBufIdx_ = (lookaheadBufIdx_+1)%LOOKAHEAD; + + //---------------- Attack/release envelope + if (env1_ <= c) { + c = c + (env1_ - c) * relCoef_; + } else { + c = c + (env1_ - c) * attCoef_; + } + env1_ = c; + + //---------------- Smoothing + const T tmp1 = avg1Old_ + c - avg1Buf_[avg1BufRIdx_]; + avg1Old_ = tmp1; + avg1Buf_[avg1BufWIdx_] = c; + c = tmp1; + avg1BufRIdx_ = (avg1BufRIdx_+1)%AVG1; + avg1BufWIdx_ = (avg1BufWIdx_+1)%AVG1; + + const T tmp2 = avg2Old_ + c - avg2Buf_[avg2BufRIdx_]; + avg2Old_ = tmp2; + avg2Buf_[avg2BufWIdx_] = c; + c = tmp2; + avg2BufRIdx_ = (avg2BufRIdx_+1)%AVG2; + avg2BufWIdx_ = (avg2BufWIdx_+1)%AVG2; + + c = c / (static_cast(AVG1) * static_cast(AVG2)); + + //---------------- Postprocessing + for (int i = 0; i < CHANNELS; i++) { + // Delay input samples + const T in = delayBuf_[delayBufIdx_*CHANNELS+i]; + delayBuf_[delayBufIdx_*CHANNELS+i] = pSamples[i]; + + // Apply control signal + pSamples[i] = in * c * postGain_; + } + + delayBufIdx_ = (delayBufIdx_+1)&(LOOKAHEAD-1); +} + +template +void Dynamics::setThreshold(T threshold) +{ + threshold_ = threshold; + preGain_ = std::pow(10.f, -threshold / 20.f); +} + +template +T Dynamics::getThreshold() const +{ + return threshold_; +} + +template +void Dynamics::setRmsTime(T rmsTime) +{ + rmsTime_ = rmsTime; + rmsCoef_ = 0.f; + if (rmsTime > 0.f) { + rmsCoef_ = std::pow(0.001f, 1.f / (m_fs * rmsTime)); + } +} + +template +T Dynamics::getRmsTime() const +{ + return rmsTime_; +} + +template +void Dynamics::setRatio(T ratio) +{ + ratio_ = ratio; + inverseRatio_ = 1.f / ratio; +} + +template +T Dynamics::getRatio() const +{ + return ratio_; +} + +template +void Dynamics::setAttackTime(T attTime) +{ + attTime_ = attTime; + attCoef_ = 0.f; + if (attTime > 0.f) { + attCoef_ = pow(0.001f, 1.f / (m_fs * attTime)); + } +} + +template +T Dynamics::getAttackTime() const +{ + return attTime_; +} + +template +void Dynamics::setReleaseTime(T relTime) +{ + relTime_ = relTime; + relCoef_ = 0.f; + if (relTime > 0.f) { + relCoef_ = pow(0.001f, 1.f / (m_fs * relTime)); + } +} + +template +T Dynamics::getReleaseTime() const +{ + return relTime_; +} + +template +void Dynamics::setMakeupGain(T makeupGain) +{ + makeupGain_ = makeupGain; + postGain_ = std::pow(10.f, makeupGain / 20.f); +} + +template +T Dynamics::getMakeupGain() const +{ + return makeupGain_; +} + +} + +#endif diff --git a/src/audio/IProcessor.h b/src/audio/IProcessor.h new file mode 100644 index 0000000..4eab2f0 --- /dev/null +++ b/src/audio/IProcessor.h @@ -0,0 +1,37 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#ifndef _Processor_H_ +#define _Processor_H_ + +namespace avg { + +template +class AVG_API IProcessor +{ +public: + virtual ~IProcessor() {}; + virtual void process(T* pSamples) = 0; + +}; + +} +#endif diff --git a/src/audio/Makefile.am b/src/audio/Makefile.am new file mode 100644 index 0000000..f475c7c --- /dev/null +++ b/src/audio/Makefile.am @@ -0,0 +1,17 @@ +AM_CPPFLAGS = -I.. @PTHREAD_CFLAGS@ + +ALL_H = AudioEngine.h AudioBuffer.h AudioParams.h \ + Dynamics.h IProcessor.h AudioMsg.h AudioSource.h + +TESTS = testlimiter + +noinst_LTLIBRARIES = libaudio.la +noinst_PROGRAMS = testlimiter + +libaudio_la_SOURCES = AudioEngine.cpp AudioBuffer.cpp AudioParams.cpp AudioMsg.cpp \ + AudioSource.cpp $(ALL_H) + +testlimiter_SOURCES = testlimiter.cpp $(ALL_H) +testlimiter_LDADD = ./libaudio.la ../base/libbase.la \ + ../base/triangulate/libtriangulate.la \ + @BOOST_THREAD_LIBS@ @PTHREAD_LIBS@ diff --git a/src/audio/testlimiter.cpp b/src/audio/testlimiter.cpp new file mode 100644 index 0000000..5c3a515 --- /dev/null +++ b/src/audio/testlimiter.cpp @@ -0,0 +1,112 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#include "Dynamics.h" + +#include "../base/TestSuite.h" +#include "../base/MathHelper.h" + +#include +#include + +using namespace avg; +using namespace std; + +class LimiterTest: public Test { +public: + LimiterTest() + : Test("LimiterTest", 2) + { + } + + void runTests() + { + const int CHANNELS = 2; + float fs = 44100.f; + int numSamples = int(fs * 0.1f); + + // Setup a brickwall limiter + typedef Dynamics TStereoLimiter; + TStereoLimiter* d = new TStereoLimiter(fs); + d->setThreshold(0.f); // in dB + d->setAttackTime(0.f); // in seconds + d->setReleaseTime(0.05f); // in seconds + d->setRmsTime(0.f); // in seconds + d->setRatio(std::numeric_limits::infinity()); + d->setMakeupGain(0.f); // in dB + + // Generate input and output test data + float* pSamples = new float[CHANNELS*numSamples]; + for (int j = 0; j < numSamples; j++) { + for (int i = 0; i < CHANNELS; i++) { + pSamples[j*CHANNELS+i] = 2*sin(j*(440.f/44100)*float(M_PI)); + } + } + + // Let the limiter work. + for (int i=0; iprocess(pSamples+i*CHANNELS); + } + + // Check if everything is ok. + bool bDiscontinuities = false; + bool bAboveThreshold = false; + for (int j = 1; j < numSamples; j++) { + for (int i = 0; i < CHANNELS; i++) { + // Test if anything is above the threshold. + if (pSamples[j*CHANNELS+i] > 1) { + bAboveThreshold = true; + } + if (fabs(pSamples[j*CHANNELS+i]-pSamples[(j-1)*CHANNELS+i]) > 0.05f) { + bDiscontinuities = true; +// cerr << j << ": " << outSamples[j*OUT_CHANNELS+i] << ", " << +// outSamples[(j-1)*OUT_CHANNELS+i] << endl; + } + } + } + TEST(!bAboveThreshold); + TEST(!bDiscontinuities); +/* + // Save data to ascii file. + FILE * pFile = fopen("data.txt", "w"); + for (int j = 0; j < numSamples; j++) { + fprintf(pFile, "%f\n", pSamples[j*OUT_CHANNELS]); + } + fclose(pFile); +*/ + // Free memory + delete d; + delete[] pSamples; + } +}; + +int main(int nargs, char** args) +{ + LimiterTest test; + test.runTests(); + bool bOK = test.isOk(); + + if (bOK) { + return 0; + } else { + return 1; + } +} diff --git a/src/avgconfig_win.h b/src/avgconfig_win.h new file mode 100644 index 0000000..9b2bb31 --- /dev/null +++ b/src/avgconfig_win.h @@ -0,0 +1,28 @@ +/* src/avgconfig.h.in. Generated from configure.in by autoheader. */ + +/* Enable DirectShow camera support */ +#define AVG_ENABLE_DSHOW + +/* Enable CMU 1394 Digital Camera Driver support */ +#define AVG_ENABLE_CMU1394 + +/* Enable firewire camera support */ +#undef AVG_ENABLE_1394 + +/* Enable firewire camera support v.2 */ +#undef AVG_ENABLE_1394_2 + +/* ffmpeg >= 0.5.0 */ +#define HAVE_LIBAVFORMAT_AVFORMAT_H + +/* Enable Video4Linux2 camera support */ +#undef AVG_ENABLE_V4L2 + +/* Enable parallel port support */ +#undef AVG_ENABLE_PARPORT + +/* Enable ffmpeg swscale support. */ +#define AVG_ENABLE_SWSCALE + +/* Name of package */ +#undef PACKAGE diff --git a/src/avgconfigwrapper.h b/src/avgconfigwrapper.h new file mode 100644 index 0000000..2408089 --- /dev/null +++ b/src/avgconfigwrapper.h @@ -0,0 +1,37 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#include "api.h" +#ifdef _WIN32 +#include "../avgconfig_win.h" +#else +#include "avgconfig.h" +#endif + +// These defines regularly cause multiple definition warnings and are usually +// completely unneeded. +#undef PACKAGE +#undef PACKAGE_BUGREPORT +#undef PACKAGE_NAME +#undef PACKAGE_STRING +#undef PACKAGE_TARNAME +#undef PACKAGE_VERSION + diff --git a/src/avgrc b/src/avgrc new file mode 100644 index 0000000..3f93e5a --- /dev/null +++ b/src/avgrc @@ -0,0 +1,42 @@ + + + false + 24 + false + false + true + 4 + 0 + auto + true + + + 2 + 44100 + 1024 + + + + 15 + + 300 + + 50 + 0.393 + 100 + + 900 + + 5 + + -1 + + 0.1 + 0.03 + + + 0, 0 + 0, 0 + + diff --git a/src/base/Backtrace.cpp b/src/base/Backtrace.cpp new file mode 100644 index 0000000..2b85cde --- /dev/null +++ b/src/base/Backtrace.cpp @@ -0,0 +1,120 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#include "Backtrace.h" + +#include "StringHelper.h" + +#ifndef _WIN32 +#include +#include +#endif + +#include +#include +#include + +using namespace std; + +namespace avg { + +void dumpBacktrace() +{ +#ifndef _WIN32 + vector sFuncs; + getBacktrace(sFuncs); + vector::iterator it = sFuncs.begin(); + ++it; + for (; it != sFuncs.end(); ++it) { + cerr << " " << *it << endl; + } +#endif +} + +string funcNameFromLine(const string& sLine) +{ + try { +#ifdef __APPLE__ + string::size_type addressPos = sLine.find("0x"); + string::size_type namePos = sLine.find(" ", addressPos); + namePos++; + string::size_type nameEndPos = sLine.find(" ", namePos); +#else + string::size_type namePos = sLine.find("("); + namePos++; + string::size_type nameEndPos = sLine.find_first_of(")+", namePos); +#endif + return sLine.substr(namePos, nameEndPos-namePos); + } catch (exception&) { + return sLine; + } +} + +void consolidateRepeatedLines(vector& sFuncs, unsigned& i, unsigned numSameLines) +{ + unsigned firstSameLine = i - numSameLines; + sFuncs[firstSameLine+1] = " [...]"; + sFuncs.erase(sFuncs.begin()+firstSameLine+2, sFuncs.begin()+i-1); + i = firstSameLine + 3; +} + +void getBacktrace(vector& sFuncs) +{ +#ifndef _WIN32 + void* callstack[128]; + int numFrames = backtrace(callstack, 128); + char** ppszLines = backtrace_symbols(callstack, numFrames); + for (int i = 1; i < numFrames; ++i) { + string sLine = ppszLines[i]; + string sFuncName = funcNameFromLine(sLine); + int result; + char * pszDemangledFuncName = abi::__cxa_demangle(sFuncName.c_str(), 0, 0, + &result); + if (!result) { + sFuncName = pszDemangledFuncName; + free(pszDemangledFuncName); + } + char szLineNum[10]; + sprintf(szLineNum, "%3d", i); + sFuncs.push_back(string(szLineNum)+" "+sFuncName); + } + free(ppszLines); + + unsigned numSameLines = 1; + unsigned i = 1; + for (i = 1; i < sFuncs.size(); ++i) { + if (sFuncs[i].substr(4, string::npos) == sFuncs[i-1].substr(4, string::npos)) { + numSameLines++; + } else { + if (numSameLines > 3) { + consolidateRepeatedLines(sFuncs, i, numSameLines); + } + numSameLines = 1; + } + } + if (numSameLines > 2) { + consolidateRepeatedLines(sFuncs, i, numSameLines); + } +#endif +} + +} + diff --git a/src/base/Backtrace.h b/src/base/Backtrace.h new file mode 100644 index 0000000..2eee387 --- /dev/null +++ b/src/base/Backtrace.h @@ -0,0 +1,36 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#ifndef _Backtrace_H_ +#define _Backtrace_H_ + +#include +#include + +namespace avg { + +void dumpBacktrace(); + +void getBacktrace(std::vector& sFuncs); + +} + +#endif diff --git a/src/base/BezierCurve.cpp b/src/base/BezierCurve.cpp new file mode 100644 index 0000000..7e5fb8e --- /dev/null +++ b/src/base/BezierCurve.cpp @@ -0,0 +1,56 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#include "BezierCurve.h" + +#include "GLMHelper.h" + +#include + +using namespace std; + +namespace avg { + +BezierCurve::BezierCurve(const glm::vec2& p0, const glm::vec2& p1, const glm::vec2& p2, + const glm::vec2& p3) + : m_P0(p0), + m_P1(p1), + m_P2(p2), + m_P3(p3) +{ +} + +glm::vec2 BezierCurve::interpolate(float t) const +{ + return (1.f-t)*(1.f-t)*(1.f-t)*m_P0+ + 3.f*t*(1.f-t)*(1.f-t) *m_P1+ + 3.f*t*t*(1.f-t) *m_P2+ + t*t*t *m_P3; +} + +glm::vec2 BezierCurve::getDeriv(float t) const +{ + return 3.f*(m_P1-m_P0)*(1.f-t)*(1.f-t)+ + 6.f*(m_P2-m_P1)*(1.f-t)*t+ + 3.f*(m_P3-m_P2)*t*t; +} + +} diff --git a/src/base/BezierCurve.h b/src/base/BezierCurve.h new file mode 100644 index 0000000..b2ec1dc --- /dev/null +++ b/src/base/BezierCurve.h @@ -0,0 +1,56 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#ifndef _BezierCurve_H_ +#define _BezierCurve_H_ + +#include "../api.h" + +#include "../glm/glm.hpp" + +#include +#include + +namespace avg { + +class AVG_API BezierCurve { +public: + BezierCurve(const glm::vec2& p0, const glm::vec2& p1, const glm::vec2& p2, + const glm::vec2& p3); + + glm::vec2 interpolate(float t) const; + glm::vec2 getDeriv(float t) const; + +private: + glm::vec2 m_P0; + glm::vec2 m_P1; + glm::vec2 m_P2; + glm::vec2 m_P3; +}; + +typedef boost::shared_ptr BezierCurvePtr; + +} + +#endif + + + diff --git a/src/base/CmdQueue.h b/src/base/CmdQueue.h new file mode 100644 index 0000000..9d38f37 --- /dev/null +++ b/src/base/CmdQueue.h @@ -0,0 +1,56 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#ifndef _CmdQueue_H_ +#define _CmdQueue_H_ + +#include "Command.h" +#include "Queue.h" + +#include "../api.h" + +namespace avg { + +template +class AVG_TEMPLATE_API CmdQueue: public Queue > +{ +public: + CmdQueue(int maxSize=-1); + typedef typename Queue >::QElementPtr CmdPtr; + void pushCmd(typename Command::CmdFunc func); + +}; + +template +CmdQueue::CmdQueue(int maxSize) + : Queue >(maxSize) +{ +} + +template +void CmdQueue::pushCmd(typename Command::CmdFunc func) +{ + this->push(CmdPtr(new Command(func))); +} + +} + +#endif diff --git a/src/base/Command.h b/src/base/Command.h new file mode 100644 index 0000000..fe18171 --- /dev/null +++ b/src/base/Command.h @@ -0,0 +1,56 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#ifndef _Command_H_ +#define _Command_H_ + +#include "../api.h" +#include + +namespace avg { + +template +class AVG_TEMPLATE_API Command { +public: + typedef boost::function CmdFunc; + + Command(CmdFunc Func); + void execute(RECEIVER* pTarget); + +private: + CmdFunc m_Func; +}; + +template +Command::Command(CmdFunc Func) + : m_Func(Func) +{ +} + +template +void Command::execute(RECEIVER* pTarget) +{ + m_Func(pTarget); +} + +} + +#endif diff --git a/src/base/ConfigMgr.cpp b/src/base/ConfigMgr.cpp new file mode 100644 index 0000000..0414037 --- /dev/null +++ b/src/base/ConfigMgr.cpp @@ -0,0 +1,361 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#include "ConfigMgr.h" +#include "Logger.h" +#include "Exception.h" +#include "OSHelper.h" + +#include + +#include +#include +#include + +#ifndef _WIN32 +#include +#else +#include +#endif + +using namespace std; + +namespace avg { + +ConfigOption::ConfigOption(const string& sName, const string& sValue) + : m_sName(sName), + m_sValue(sValue) +{ +} + +ConfigMgr* ConfigMgr::m_pGlobalConfigMgr = 0; + +void deleteConfigMgr() +{ + delete ConfigMgr::m_pGlobalConfigMgr; + ConfigMgr::m_pGlobalConfigMgr = 0; +} + +ConfigMgr* ConfigMgr::get() +{ + if (!m_pGlobalConfigMgr) { + m_pGlobalConfigMgr = new ConfigMgr; + atexit(deleteConfigMgr); + } + return m_pGlobalConfigMgr; +} + +ConfigMgr::ConfigMgr() +{ + addSubsys("scr"); + addOption("scr", "gles", "false"); + addOption("scr", "bpp", "24"); + addOption("scr", "fullscreen", "false"); + addOption("scr", "windowwidth", "0"); + addOption("scr", "windowheight", "0"); + addOption("scr", "dotspermm", "0"); + addOption("scr", "usepow2textures", "false"); + addOption("scr", "usepixelbuffers", "true"); + addOption("scr", "multisamplesamples", "8"); + addOption("scr", "shaderusage", "auto"); + addOption("scr", "gamma", "-1,-1,-1"); + addOption("scr", "vsyncmode", "auto"); + addOption("scr", "videoaccel", "true"); + + addSubsys("aud"); + addOption("aud", "channels", "2"); + addOption("aud", "samplerate", "44100"); + addOption("aud", "outputbuffersamples", "1024"); + + addSubsys("gesture"); + addOption("gesture", "maxtapdist", "15"); + addOption("gesture", "maxdoubletaptime", "300"); + addOption("gesture", "minswipedist", "50"); + addOption("gesture", "swipedirectiontolerance", "0.393"); // pi/8 + addOption("gesture", "maxswipecontactdist", "100"); + addOption("gesture", "holddelay", "500"); + addOption("gesture", "mindragdist", "5"); + addOption("gesture", "filtermincutoff", "0.1"); + addOption("gesture", "filterbeta", "0.03"); + addOption("gesture", "friction", "-1"); + + addSubsys("touch"); + addOption("touch", "area", "0, 0"); + addOption("touch", "offset", "0, 0"); + + m_sFName = "avgrc"; + loadFile(getGlobalConfigDir()+m_sFName); + char * pHome = getenv("HOME"); + if (pHome) { + loadFile(string(pHome)+"/."+m_sFName); + } +} + +void ConfigMgr::addSubsys(const string& sName) +{ + m_SubsysOptionMap[sName] = ConfigOptionVector(); +} + +void ConfigMgr::addOption(const string& sSubsys, const string& sName, + const std::string& sDefault) +{ + ConfigOptionVector& Subsys = m_SubsysOptionMap[sSubsys]; + Subsys.push_back(ConfigOption(sName, sDefault)); +} + +const ConfigOptionVector* ConfigMgr::getOptions(const string& sSubsys) const +{ + SubsysOptionMap::const_iterator it = m_SubsysOptionMap.find(sSubsys); + if (it == m_SubsysOptionMap.end()) { + return 0; + } else { + return &(*it).second; + } +} + +const string* ConfigMgr::getOption(const string& sSubsys, + const string& sName) const +{ + const ConfigOptionVector* pOptionVector = getOptions(sSubsys); + if (!pOptionVector) { + return 0; + } else { + for (unsigned int i=0; isize(); i++) { + if ((*pOptionVector)[i].m_sName == sName) { + return &(*pOptionVector)[i].m_sValue; + } + } + return 0; + } +} + +bool ConfigMgr::getBoolOption(const string& sSubsys, + const string& sName, bool bDefault) const +{ + const string * psOption = getOption(sSubsys, sName); + if (psOption == 0) { + return bDefault; + } + if (*psOption == "true") { + return true; + } else if (*psOption == "false") { + return false; + } else { + AVG_LOG_ERROR(m_sFName << ": Unrecognized value for option " << sName << ": " + << *psOption << ". Must be true or false. Aborting."); + exit(-1); + } +} + +int ConfigMgr::getIntOption(const string& sSubsys, + const string& sName, int Default) const +{ + errno = 0; + const string * psOption = getOption(sSubsys, sName); + if (psOption == 0) { + return Default; + } + int Result = strtol(psOption->c_str(), 0, 10); + int rc = errno; + if (rc == EINVAL || rc == ERANGE) { + AVG_LOG_ERROR(m_sFName << ": Unrecognized value for option "<c_str(), "%f,%f,%f", Val, Val+1, Val+2); + if (rc < 3) { + AVG_LOG_ERROR(m_sFName << ": Unrecognized value for option "<c_str(), "%f,%f", val, val+1); + if (rc < 2) { + AVG_LOG_ERROR(m_sFName << ": Unrecognized value for option " << sName << ": " + << *psOption << ". Must be 2 comma-separated numbers(x, y). Aborting."); + exit(-1); + } + return glm::vec2(val[0], val[1]); +} + +void ConfigMgr::getStringOption(const string& sSubsys, + const string& sName, const string& sDefault, string& sVal) const +{ + const string * psOption = getOption(sSubsys, sName); + if (psOption == 0) { + sVal = sDefault; + } else { + sVal = *psOption; + } +} + + +bool ConfigMgr::loadFile(const std::string& sPath) +{ + string sSubsys; + try { +#ifndef _WIN32 + // I don't think read permissions on config files are an issue under windows. + int err = access(sPath.c_str(), R_OK); + if (err == -1) { + if (errno == EACCES) { + AVG_LOG_WARNING(sPath+ + ": File exists, but process doesn't have read permissions!"); + } + return false; + } +#else + // but this actually prevents ugly XML parsing errors when file does not exist + // and cygwin is used + int err = _access(sPath.c_str(), 0); + if (err == -1) { + return false; + } +#endif + xmlDocPtr doc; + doc = xmlParseFile(sPath.c_str()); + if (!doc) { + throw Exception(AVG_ERR_XML_VALID, "Error parsing "+sPath + +". File is not well-formed."); + } + xmlNodePtr pRoot = xmlDocGetRootElement(doc); + if (xmlStrcmp(pRoot->name, (const xmlChar *)(m_sFName.c_str()))) { + AVG_LOG_ERROR(sPath+": Root node must be <"+m_sFName+">, found " + << pRoot->name << ". Aborting."); + exit(255); + } + xmlNodePtr pSubsysNode = pRoot->xmlChildrenNode; + while (pSubsysNode) { + if (xmlStrcmp(pSubsysNode->name, (const xmlChar *)"text") && + xmlStrcmp(pSubsysNode->name, (const xmlChar *)"comment")) + { + sSubsys = ((const char *)pSubsysNode->name); + xmlNodePtr pOptionNode = pSubsysNode->xmlChildrenNode; + if (!pOptionNode) { + AVG_LOG_ERROR(sPath << ": Option " << sSubsys + << " has no value. Ignoring."); + } else { + ConfigOptionVector& CurSubsys = getSubsys(sSubsys); + while (pOptionNode) { + if (xmlStrcmp(pOptionNode->name, (const xmlChar *)"text") && + xmlStrcmp(pOptionNode->name, (const xmlChar *)"comment")) + { + setOption(CurSubsys, doc, pOptionNode); + } + pOptionNode = pOptionNode->next; + } + } + } + pSubsysNode = pSubsysNode->next; + } + xmlFreeDoc(doc); + } catch (Exception& e) { + switch (e.getCode()) { + case AVG_ERR_OPTION_SUBSYS_UNKNOWN: + AVG_LOG_ERROR("While parsing " << sPath << ": Option group " << + e.getStr() << " unknown. Aborting."); + exit(255); + case AVG_ERR_OPTION_UNKNOWN: + AVG_LOG_ERROR("While parsing " << sPath << ": Option " << sSubsys << + ":" << e.getStr() << " unknown. Aborting."); + exit(255); + default: + throw; + } + } + return true; +} + +ConfigOptionVector& ConfigMgr::getSubsys(const string& sName) +{ + SubsysOptionMap::iterator pos = m_SubsysOptionMap.find(sName); + if (pos == m_SubsysOptionMap.end()) { + throw Exception(AVG_ERR_OPTION_SUBSYS_UNKNOWN, sName); + } else { + return pos->second; + } +} + +void ConfigMgr::setOption(ConfigOptionVector& optionVector, + xmlDocPtr doc, xmlNodePtr pNode) +{ + string sName = (const char *)pNode->name; + xmlChar * pVal = xmlNodeListGetString(doc, pNode->xmlChildrenNode, 1); + string sValue = (const char *)pVal; + xmlFree(pVal); + setOption(optionVector, sName, sValue); +} + +void ConfigMgr::setOption(ConfigOptionVector& optionVector, + const string& sName, const string& sValue) +{ + for (unsigned int i = 0; i < optionVector.size(); i++) { + if (optionVector[i].m_sName == sName) { + optionVector[i].m_sValue = sValue; + return; + } + } + throw Exception(AVG_ERR_OPTION_UNKNOWN, sName); +} + +void ConfigMgr::dump() const +{ + SubsysOptionMap::const_iterator it; + for (it = m_SubsysOptionMap.begin(); it != m_SubsysOptionMap.end(); ++it) { + cerr << (*it).first << ": " << endl; + const ConfigOptionVector& SubsysOptions = (*it).second; + for (unsigned int j = 0; j < SubsysOptions.size(); ++j) { + cerr << " " << SubsysOptions[j].m_sName << ": " + << SubsysOptions[j].m_sValue << endl; + } + } +} + +string getGlobalConfigDir() +{ +#ifdef _WIN32 + return getAvgLibPath()+"/etc/"; +#else + return "/etc/"; +#endif +} + +} + diff --git a/src/base/ConfigMgr.h b/src/base/ConfigMgr.h new file mode 100644 index 0000000..e2af8f1 --- /dev/null +++ b/src/base/ConfigMgr.h @@ -0,0 +1,93 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#ifndef _ConfigMgr_H_ +#define _ConfigMgr_H_ + +#include "../api.h" + +#include "GLMHelper.h" +#include + +#include +#include +#include + +namespace avg { + +struct ConfigOption { + ConfigOption(const std::string& sName, const std::string& sValue); + + std::string m_sName; + std::string m_sValue; +}; + +typedef std::vector ConfigOptionVector; + +class AVG_API ConfigMgr { +public: + static ConfigMgr* get(); + + void addSubsys(const std::string& sName); + void addOption(const std::string& sSubsys, const std::string& sName, + const std::string& sDefault); + + const ConfigOptionVector* getOptions(const std::string& sSubsys) const; + const std::string* getOption(const std::string& sSubsys, + const std::string& sName) const; + bool getBoolOption(const std::string& sSubsys, + const std::string& sName, bool bDefault) const; + int getIntOption(const std::string& sSubsys, + const std::string& sName, int Default) const; + void getGammaOption(const std::string& sSubsys, + const std::string& sName, float* Val) const; + glm::vec2 getSizeOption(const std::string& sSubsys, + const std::string& sName) const; + void getStringOption(const std::string& sSubsys, + const std::string& sName, const std::string& sDefault, std::string& sVal) + const; + + void dump() const; + +private: + ConfigMgr(); + + bool loadFile(const std::string& sPath); + ConfigOptionVector& getSubsys(const std::string& sName); + void setOption(ConfigOptionVector& optionVector, + xmlDocPtr doc, xmlNodePtr pNode); + void setOption(ConfigOptionVector& optionVector, const std::string& sName, + const std::string& sValue); + + typedef std::map SubsysOptionMap; + SubsysOptionMap m_SubsysOptionMap; + + std::string m_sFName; + + static ConfigMgr* m_pGlobalConfigMgr; + friend void deleteConfigMgr(); +}; + +std::string getGlobalConfigDir(); + +} +#endif + diff --git a/src/base/CubicSpline.cpp b/src/base/CubicSpline.cpp new file mode 100644 index 0000000..105563d --- /dev/null +++ b/src/base/CubicSpline.cpp @@ -0,0 +1,104 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#include "CubicSpline.h" +#include "Exception.h" +#include "MathHelper.h" + +#include + +using namespace std; + +namespace avg { + +CubicSpline::CubicSpline(const vector& x, const vector& y, bool bLoop) +{ + AVG_ASSERT(x.size() == y.size()); + for (unsigned i=0; i& pts, bool bLoop) + : m_Pts(pts) +{ + init(); +} + +CubicSpline::~CubicSpline() +{ +} + +float CubicSpline::interpolate(float orig) +{ + int len = m_Pts.size(); + int low = 0; + int high = len-1; + // Binary search. + while (high - low > 1) { + int avg = (high+low) / 2; + if (m_Pts[avg].x > orig) { + high = avg; + } else { + low = avg; + } + } + float h = m_Pts[high].x - m_Pts[low].x; + float a = (m_Pts[high].x-orig)/h; + float b = (orig-m_Pts[low].x)/h; + + float y = a*m_Pts[low].y + b*m_Pts[high].y + + ((a*a*a-a)*m_Y2[low] + (b*b*b-b)*m_Y2[high])*(h*h)/6.f; + return y; +} + +void CubicSpline::init() +{ + int len = m_Pts.size(); + for (int i=1; i u(len-1,0); + m_Y2.push_back(0.f); + u[0] = 0.f; + for (int i=1; i=0; i--) { + m_Y2[i] = m_Y2[i]*m_Y2[i+1]+u[i]; + } +} + +} diff --git a/src/base/CubicSpline.h b/src/base/CubicSpline.h new file mode 100644 index 0000000..a275413 --- /dev/null +++ b/src/base/CubicSpline.h @@ -0,0 +1,56 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#ifndef _CubicSpline_H_ +#define _CubicSpline_H_ + +#include "../api.h" +#include "../glm/glm.hpp" + +#include +#include + +namespace avg { + +class AVG_API CubicSpline { +public: + CubicSpline(const std::vector& x, const std::vector& y, + bool bLoop=false); + CubicSpline(const std::vector& pts, bool bLoop=false); + virtual ~CubicSpline(); + + float interpolate(float orig); + +private: + void init(); + + std::vector m_Pts; + std::vector m_Y2; // Second derivatives +}; + +typedef boost::shared_ptr CubicSplinePtr; + +} + +#endif + + + diff --git a/src/base/DAG.cpp b/src/base/DAG.cpp new file mode 100644 index 0000000..85ab8bb --- /dev/null +++ b/src/base/DAG.cpp @@ -0,0 +1,130 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#include "DAG.h" + +#include "Exception.h" + +#include + +using namespace std; + +namespace avg { + +class AVG_API DAGNode: public boost::enable_shared_from_this +{ +public: + DAGNode(long vertexID, const std::set& outgoingIDs); + void resolveIDs(DAG* pDAG); + + long m_VertexID; + std::set m_OutgoingIDs; + std::set m_pOutgoingNodes; + std::set m_pIncomingNodes; +}; + + +DAGNode::DAGNode(long vertexID, const set& outgoingIDs) +{ + m_VertexID = vertexID; + m_OutgoingIDs = outgoingIDs; +} + +void DAGNode::resolveIDs(DAG* pDAG) +{ + set::iterator it; + for (it=m_OutgoingIDs.begin(); it!=m_OutgoingIDs.end(); ++it) { + long outgoingID = *it; + DAGNodePtr pDestNode = pDAG->findNode(outgoingID); + m_pOutgoingNodes.insert(pDestNode); + pDestNode->m_pIncomingNodes.insert(shared_from_this()); + } + m_OutgoingIDs.clear(); +} + + +DAG::DAG() +{ +} + +DAG::~DAG() +{ +} + +void DAG::addNode(long vertexID, const set& outgoingIDs) +{ + DAGNode* pNode = new DAGNode(vertexID, outgoingIDs); + m_pNodes.insert(DAGNodePtr(pNode)); +} + +void DAG::sort(vector& pResults) +{ + resolveIDs(); + while (!m_pNodes.empty()) { + DAGNodePtr pCurNode = findStartNode(*m_pNodes.begin()); + removeNode(pCurNode); + pResults.push_back(pCurNode->m_VertexID); + } +} + +void DAG::resolveIDs() +{ + set::iterator it; + for (it=m_pNodes.begin(); it!=m_pNodes.end(); ++it) { + (*it)->resolveIDs(this); + } +} + +DAGNodePtr DAG::findNode(long id) +{ + set::iterator it; + for (it=m_pNodes.begin(); it!=m_pNodes.end(); ++it) { + if ((*it)->m_VertexID == id) { + return (*it); + } + } + AVG_ASSERT(false); + return DAGNodePtr(); +} + +void DAG::removeNode(DAGNodePtr pNode) +{ + set::iterator it; + for (it=pNode->m_pOutgoingNodes.begin(); it!=pNode->m_pOutgoingNodes.end(); ++it) { + DAGNodePtr pDestNode = *it; + pDestNode->m_pIncomingNodes.erase(pNode); + } + m_pNodes.erase(pNode); +} + +DAGNodePtr DAG::findStartNode(DAGNodePtr pNode, unsigned depth) +{ + if (pNode->m_pIncomingNodes.empty()) { + return pNode; + } else { + if (depth > m_pNodes.size()) { + throw Exception(AVG_ERR_INVALID_ARGS, "cyclic graph"); + } + return findStartNode(*pNode->m_pIncomingNodes.begin(), depth+1); + } +} + +} diff --git a/src/base/DAG.h b/src/base/DAG.h new file mode 100644 index 0000000..929ecd2 --- /dev/null +++ b/src/base/DAG.h @@ -0,0 +1,64 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#ifndef _DAG_H_ +#define _DAG_H_ + +#include "../api.h" + +#include +#include +#include + +namespace avg { + +class DAG; +class DAGNode; +typedef boost::shared_ptr DAGNodePtr; + +// Directed Acyclic Graph class. +// Only useful for sorting. The process of sorting destroys the DAG. +class AVG_API DAG +{ +public: + DAG(); + virtual ~DAG(); + + void addNode(long vertexID, const std::set& outgoingIDs); + void sort(std::vector& pResults); + +private: + friend class DAGNode; + + void resolveIDs(); + DAGNodePtr findNode(long pID); + void removeNode(DAGNodePtr pNode); + DAGNodePtr findStartNode(DAGNodePtr pNode, unsigned depth=0); + + std::set m_pNodes; +}; + +} + +#endif + + + diff --git a/src/base/DirEntry.cpp b/src/base/DirEntry.cpp new file mode 100644 index 0000000..c654e50 --- /dev/null +++ b/src/base/DirEntry.cpp @@ -0,0 +1,65 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#include "DirEntry.h" + +using namespace std; + +namespace avg { + +#ifdef _WIN32 +DirEntry::DirEntry(string sDirName, const _finddata_t& findData) + : m_sDirName(sDirName), + m_FindData(findData) +{ +} + +#else +DirEntry::DirEntry(string sDirName, dirent * pEntry) + : m_sDirName(sDirName), + m_pEntry(pEntry) +{ +} +#endif + +DirEntry::~DirEntry() +{ +} + +std::string DirEntry::getName() +{ +#ifdef _WIN32 + return m_FindData.name; +#else + return m_pEntry->d_name; +#endif +} + +void DirEntry::remove() +{ +#ifdef _WIN32 + ::_unlink((m_sDirName+"\\"+m_FindData.name).c_str()); +#else + ::unlink((m_sDirName+"/"+m_pEntry->d_name).c_str()); +#endif +} + +} diff --git a/src/base/DirEntry.h b/src/base/DirEntry.h new file mode 100644 index 0000000..ac2fca9 --- /dev/null +++ b/src/base/DirEntry.h @@ -0,0 +1,67 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#ifndef _DirEntry_H_ +#define _DirEntry_H_ + +#include "../api.h" +#include + +#ifdef _WIN32 +#include +#else +#include +#endif +#include + +namespace avg { + +class AVG_API DirEntry { +public: +#ifdef _WIN32 + DirEntry(std::string sDirName, const _finddata_t& findData); +#else + DirEntry(std::string sDirName, dirent * pEntry); +#endif + virtual ~DirEntry(); + + std::string getName(); + void remove(); + +private: + std::string m_sDirName; + +#ifdef _WIN32 + _finddata_t m_FindData; +#else + dirent * m_pEntry; +#endif + +}; + +typedef boost::shared_ptr DirEntryPtr; + +} + +#endif + + + diff --git a/src/base/Directory.cpp b/src/base/Directory.cpp new file mode 100644 index 0000000..bc40ecc --- /dev/null +++ b/src/base/Directory.cpp @@ -0,0 +1,135 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#include "Directory.h" + +#ifdef _WIN32 +#include +#endif +#include +#include + +using namespace std; + +namespace avg { + +Directory::Directory(std::string sName) + : m_sName(sName) +{ +#ifdef _WIN32 + m_hFile = -1; +#else + m_pDir = 0; +#endif +} + +Directory::~Directory() +{ +#ifdef _WIN32 + _findclose(m_hFile); +#else + if (m_pDir) { + closedir(m_pDir); + } +#endif +} + +int Directory::open(bool bCreateIfMissing) +{ +#ifdef _WIN32 + m_hFile = _findfirst((m_sName+"/*").c_str(), &m_FindData); + if(m_hFile == -1L) { + if (bCreateIfMissing) { + int err = CreateDirectory(m_sName.c_str(), 0); + if (err == 0) { + return -1; + } else { + m_hFile = _findfirst((m_sName+"/*").c_str(), &m_FindData); + m_bFirstFile = true; + return 0; + } + } else { + return -1; + } + } else { + m_bFirstFile = true; + return 0; + } +#else + m_pDir = opendir(m_sName.c_str()); + if (!m_pDir) { + if (bCreateIfMissing) { + int err = mkdir(m_sName.c_str(), + S_IRWXU | S_IRWXG | S_IRWXO); + if (err) { + return err; + } else { + m_pDir = opendir(m_sName.c_str()); + return 0; + } + } else { + return -1; + } + } else { + return 0; + } +#endif +} + +DirEntryPtr Directory::getNextEntry() +{ +#ifdef _WIN32 + if (!m_bFirstFile) { + int rc = _findnext(m_hFile, &m_FindData); + if (rc == -1) { + return DirEntryPtr(); + } + } + m_bFirstFile = false; + return DirEntryPtr(new DirEntry(m_sName, m_FindData)); +#else + dirent * pDirent; + pDirent = readdir(m_pDir); + if (pDirent) { + return DirEntryPtr(new DirEntry(m_sName, pDirent)); + } else { + return DirEntryPtr(); + } +#endif +} + +const std::string& Directory::getName() +{ + return m_sName; +} + +void Directory::empty() +{ + DirEntryPtr pEntry; + do { + pEntry = getNextEntry(); + if (pEntry) { + pEntry->remove(); + } + } while (pEntry); +} + +} diff --git a/src/base/Directory.h b/src/base/Directory.h new file mode 100644 index 0000000..f75107d --- /dev/null +++ b/src/base/Directory.h @@ -0,0 +1,64 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#ifndef _Directory_H_ +#define _Directory_H_ + +#include "../api.h" +#include "DirEntry.h" + +#ifdef _WIN32 +#include +#else +#include +#endif + +#include + +namespace avg { + +class AVG_API Directory { +public: + Directory(std::string sName); + virtual ~Directory(); + + int open(bool bCreateIfMissing = false); + DirEntryPtr getNextEntry(); + const std::string& getName(); + void empty(); + +private: + std::string m_sName; + +#ifdef _WIN32 + _finddata_t m_FindData; + intptr_t m_hFile; + bool m_bFirstFile; +#else + DIR * m_pDir; +#endif +}; + +} + +#endif + + diff --git a/src/base/DlfcnWrapper.cpp b/src/base/DlfcnWrapper.cpp new file mode 100644 index 0000000..f8011b1 --- /dev/null +++ b/src/base/DlfcnWrapper.cpp @@ -0,0 +1,61 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#include "DlfcnWrapper.h" + +#include +#include + +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include "windows.h" + +using namespace std; + +namespace avg { + +void* dlopen(const char *pszPath, int ignored) +{ + return LoadLibrary(pszPath); +} + +void dlclose(void* handle) +{ + FreeLibrary((HMODULE)handle); +} + +void* dlsym(void* handle, const char* functionName) +{ + return GetProcAddress((HMODULE)handle, functionName); +} + +const char* dlerror() +{ + static char buffer[1024]; + int err = GetLastError(); + ostringstream ss; + ss << err; + strncpy(buffer,ss.str().c_str(),1023); + return buffer; +} + +} diff --git a/src/base/DlfcnWrapper.h b/src/base/DlfcnWrapper.h new file mode 100644 index 0000000..883fb37 --- /dev/null +++ b/src/base/DlfcnWrapper.h @@ -0,0 +1,41 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#ifndef _DlfcnWrapper_h_ +#define _DlfcnWrapper_h_ + +#ifdef _WIN32 +#define RTLD_LOCAL 0 +#define RTLD_NOW 0 + +namespace avg { + +void* dlopen(const char *pszPath, int ignored); +void dlclose(void* handle); +void* dlsym(void* handle, const char* functionName); +const char* dlerror(); + +} +#else +#include +#endif + +#endif diff --git a/src/base/Exception.cpp b/src/base/Exception.cpp new file mode 100644 index 0000000..eb4f03c --- /dev/null +++ b/src/base/Exception.cpp @@ -0,0 +1,99 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#include "Exception.h" +#include "Backtrace.h" +#include "Logger.h" +#include "OSHelper.h" + +#include +#include + +#ifdef WIN32 +#include +#endif + +using namespace std; + +namespace avg { + +Exception::Exception(int code, const string& sErr) + : std::exception(), + m_Code (code), + m_sErr (sErr) +{ +} + +Exception::Exception(const Exception& ex) + : std::exception(), + m_Code (ex.getCode()), + m_sErr (ex.getStr()) +{ +} + +Exception::~Exception() throw() +{ +} + +int Exception::getCode() const +{ + return m_Code; +} + +const string& Exception::getStr() const +{ + return m_sErr; +} + +const char* Exception::what() const throw() +{ + return m_sErr.c_str(); +} + +void debugBreak() +{ +#ifdef _WIN32 + __debugbreak(); +#else + __builtin_trap(); +#endif +} + +void avgAssert(bool b, const char * pszFile, int line, const char * pszReason) +{ + if (!b) { + string sDummy; + static bool bBreak = getEnv("AVG_BREAK_ON_ASSERT", sDummy); + if (bBreak) { + debugBreak(); + } else { + stringstream ss; + ss << "Assertion failed in " << pszFile << ": " << line << endl; + if (pszReason) { + ss << "Reason: " << pszReason << endl; + } + dumpBacktrace(); + throw(Exception(AVG_ERR_ASSERT_FAILED, ss.str())); + } + } +} + +} diff --git a/src/base/Exception.h b/src/base/Exception.h new file mode 100644 index 0000000..b28dc1a --- /dev/null +++ b/src/base/Exception.h @@ -0,0 +1,88 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#ifndef _Exception_H_ +#define _Exception_H_ + +#include "../api.h" +#include +#include + +#define AVG_ERR_UNKNOWN -1 +#define AVG_ERR_XML_PARSE 1 +#define AVG_ERR_XML_VALID 2 +#define AVG_ERR_XML_EMPTY 3 +#define AVG_ERR_XML_NODE_UNKNOWN 4 +#define AVG_ERR_XML_DUPLICATE_ID 5 +#define AVG_ERR_VIDEO_INIT_FAILED 6 +#define AVG_ERR_VIDEO_GENERAL 7 +#define AVG_ERR_FONT_INIT_FAILED 10 +#define AVG_ERR_VIDEO_LOAD_FAILED 11 +#define AVG_ERR_UNSUPPORTED 12 +#define AVG_ERR_OPTION_SUBSYS_UNKNOWN 13 +#define AVG_ERR_OPTION_UNKNOWN 14 +#define AVG_ERR_FILEIO 15 +#define AVG_ERR_NOT_IN_SCENE 16 +#define AVG_ERR_OUT_OF_RANGE 17 +#define AVG_ERR_ALREADY_CONNECTED 18 +#define AVG_ERR_LOAD_DURING_PLAYBACK 19 +#define AVG_ERR_CANT_PARSE_STRING 20 +#define AVG_ERR_INVALID_CAPTURE 21 + +#define AVG_ERR_NO_NODE 23 +#define AVG_ERR_NO_ARG 24 +#define AVG_ERR_INVALID_ARGS 25 +#define AVG_ERR_NO_BUILDER 26 +#define AVG_ERR_TYPE 27 +#define AVG_ERR_CORRUPT_PLUGIN 28 +#define AVG_ERR_CAMERA_FATAL 29 +#define AVG_ERR_CAMERA_NONFATAL 30 +#define AVG_ERR_DEPRECATED 31 +#define AVG_ERR_ASSERT_FAILED 32 +#define AVG_ERR_MT_INIT 33 +#define AVG_ERR_DEBUG_CONTEXT_FAILED 34 + +namespace avg { + +class AVG_API Exception: public std::exception +{ + public: + Exception(int code, const std::string& sErr = ""); + Exception(const Exception& ex); + virtual ~Exception() throw(); + virtual int getCode() const; + virtual const std::string& getStr() const; + virtual const char* what() const throw(); + + private: + int m_Code; + std::string m_sErr; +}; + +void AVG_API debugBreak(); +void AVG_API avgAssert(bool b, const char * pszFile, int line, const char * pszReason=0); + +#define AVG_ASSERT(b) avgAssert((b) != 0, __FILE__, __LINE__); +#define AVG_ASSERT_MSG(b, pszReason) avgAssert((b) != 0, __FILE__, __LINE__, pszReason); + +} + +#endif diff --git a/src/base/FileHelper.cpp b/src/base/FileHelper.cpp new file mode 100644 index 0000000..d9221c4 --- /dev/null +++ b/src/base/FileHelper.cpp @@ -0,0 +1,164 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#include "FileHelper.h" +#include "Exception.h" + +#ifndef _WIN32 +#include +#else +#include +#endif +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +using namespace std; + +namespace avg { + +string getPath(const string& sFilename) +{ + if (sFilename.length() > 0 && sFilename.at(sFilename.length()-1) == '/') { + return sFilename; + } +#ifdef _WIN32 + int pos = int(sFilename.find_last_of("\\/")); + string dirName; + if (pos >= 0) { + dirName = sFilename.substr(0, pos+1); + } else { + dirName = sFilename; + } +#else + char * pszBuffer = strdup(sFilename.c_str()); + + string dirName(dirname(pszBuffer)); + free(pszBuffer); + dirName += "/"; +#endif + + return dirName; +} + +string getFilenamePart(const string& sFilename) +{ + if (sFilename.find_last_of("\\/") == 0) { + return sFilename; + } +#ifdef _WIN32 + int pos = int(sFilename.find_last_of("\\/")); + string BaseName(sFilename.substr(pos+1)); +#else + char * pszBuffer = strdup(sFilename.c_str()); + + string BaseName(basename(pszBuffer)); + free(pszBuffer); +#endif + + return BaseName; +} + +string getExtension(const string& sFilename) +{ + int pos = int(sFilename.find_last_of(".")); + if (pos == 0) { + return ""; + } else { + return sFilename.substr(pos+1); + } +} + +string getCWD() +{ + + char szBuf[1024]; +#ifdef _WIN32 + char * pBuf = _getcwd(szBuf, 1024); +#else + char * pBuf = getcwd(szBuf, 1024); +#endif + return string(pBuf)+"/"; +} + +bool isAbsPath(const std::string& path) +{ +#ifdef _WIN32 + return ((path.length() != 0) && path[1] == ':') || path[0] == '\\' || path[0] == '/'; +#else + return path[0] == '/'; +#endif + +} + +bool fileExists(const string& sFilename) +{ + struct stat myStat; + return stat(sFilename.c_str(), &myStat) != -1; +} + +void readWholeFile(const string& sFilename, string& sContent) +{ + ifstream file(sFilename.c_str()); + if (!file) { + throw Exception(AVG_ERR_FILEIO, "Opening "+sFilename+ + " for reading failed."); + } + vector buffer(65536); + sContent.resize(0); + while (file) { + file.read(&(*buffer.begin()), (streamsize)(buffer.size())); + sContent.append(&(*buffer.begin()), (unsigned)file.gcount()); + } + if (!file.eof() || file.bad()) { + throw Exception(AVG_ERR_FILEIO, "Reading "+sFilename+ + " failed."); + } +} + +void writeWholeFile(const string& sFilename, const string& sContent) +{ + ofstream outFile(sFilename.c_str()); + if (!outFile) { + throw Exception(AVG_ERR_FILEIO, "Opening "+sFilename+ + " for writing failed."); + } + outFile << sContent; +} + + +void copyFile(const string& sSourceFile, const string& sDestFile) +{ + string sData; + + readWholeFile(sSourceFile, sData); + writeWholeFile(sDestFile, sData); +} + +} diff --git a/src/base/FileHelper.h b/src/base/FileHelper.h new file mode 100644 index 0000000..f367d0b --- /dev/null +++ b/src/base/FileHelper.h @@ -0,0 +1,53 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#ifndef _FileHelper_H_ +#define _FileHelper_H_ + +#include "../api.h" +#include + +namespace avg { + +std::string AVG_API getPath(const std::string& sFilename); +std::string AVG_API getFilenamePart(const std::string& sFilename); +std::string AVG_API getExtension(const std::string& sFilename); +std::string AVG_API getCWD(); + +bool AVG_API isAbsPath(const std::string& path); + +bool AVG_API fileExists(const std::string& sFilename); + +void AVG_API readWholeFile(const std::string& sFilename, std::string& sContents); + +void AVG_API writeWholeFile(const std::string& sFilename, const std::string& sContent); + +void AVG_API copyFile(const std::string& sSourceFile, const std::string& sDestFile); + + +#ifdef WIN32 +#define unlink _unlink +#endif + +} + +#endif + diff --git a/src/base/GLMHelper.cpp b/src/base/GLMHelper.cpp new file mode 100644 index 0000000..e4b0f43 --- /dev/null +++ b/src/base/GLMHelper.cpp @@ -0,0 +1,183 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#include "GLMHelper.h" +#include "StringHelper.h" +#include "MathHelper.h" + +#include "../glm/gtx/rotate_vector.hpp" + +using namespace std; + +namespace avg { + +glm::vec2 getRotated(const glm::vec2& vec, float angle) +{ + return glm::rotate(vec, angle*180/PI); +} + +glm::vec2 getRotatedPivot(const glm::vec2& vec, float angle, const glm::vec2& pivot) +{ + // translate pivot to origin + glm::vec2 translated = vec - pivot; + + // calculate rotated coordinates about the origin + glm::vec2 rotated = glm::rotate(translated, angle*180/PI); + + // re-translate pivot to original position + rotated += pivot; + + return rotated; +} + +float getAngle(const glm::vec2& vec) +{ + return float(atan2(double(vec.y), double(vec.x))); +} + +glm::vec2 fromPolar(float angle, float radius) +{ + return glm::vec2(cos(angle)*radius, sin(angle)*radius); +} + +template +bool almostEqual(const glm::detail::tvec2& v1, const glm::detail::tvec2& v2) +{ + return (fabs(v1.x-v2.x)+fabs(v1.y-v2.y)) < 0.0001; +} + +template +bool almostEqual(const glm::detail::tvec4& v1, const glm::detail::tvec4& v2) +{ + return (fabs(v1.x-v2.x)+fabs(v1.y-v2.y)+fabs(v1.z-v2.z)+fabs(v1.w-v2.w)) < 0.0001; +} + +template +std::ostream& operator<<( std::ostream& os, const glm::detail::tvec2 &v) +{ + os << "(" << v.x << "," << v.y << ")"; + return os; +} + +template +std::ostream& operator<<( std::ostream& os, const glm::detail::tvec3 &v) +{ + os << "(" << v.x << "," << v.y << "," << v.z << ")"; + return os; +} + +template +std::ostream& operator<<( std::ostream& os, const glm::detail::tvec4 &v) +{ + os << "(" << v.x << "," << v.y << "," << v.z << ", " << v.a << ")"; + return os; +} + +template +std::ostream& operator<<( std::ostream& os, const glm::detail::tmat4x4 &m) +{ + os << "(" << m[0] << ", " << endl << + m[1] << ", " << endl << + m[2] << ", " << endl << + m[3] << ", " << endl << ")"; + return os; +} + +template +std::istream& operator>>(std::istream& is, glm::detail::tvec2& p) +{ + skipToken(is, '('); + is >> p.x; + skipToken(is, ','); + is >> p.y; + skipToken(is, ')'); + return is; +} + +template +std::istream& operator>>(std::istream& is, glm::detail::tvec3& p) +{ + skipToken(is, '('); + is >> p.x; + skipToken(is, ','); + is >> p.y; + skipToken(is, ','); + is >> p.z; + skipToken(is, ')'); + return is; +} + +glm::vec2 stringToVec2(const std::string& s) +{ + glm::vec2 pt; + fromString(s, pt); + return pt; +} + +glm::vec3 stringToVec3(const std::string& s) +{ + glm::vec3 pt; + fromString(s, pt); + return pt; +} + +glm::ivec3 stringToIVec3(const std::string& s) +{ + glm::ivec3 pt; + fromString(s, pt); + return pt; +} + + +template AVG_TEMPLATE_API std::ostream& operator<<(std::ostream& os, const glm::detail::tvec2 &p); +template AVG_TEMPLATE_API std::ostream& operator<<(std::ostream& os, const glm::detail::tvec2 &p); +template AVG_TEMPLATE_API std::ostream& operator<<(std::ostream& os, const glm::detail::tvec2 &p); + +template AVG_TEMPLATE_API std::istream& operator>>(std::istream& is, glm::detail::tvec2& p); +template AVG_TEMPLATE_API std::istream& operator>>(std::istream& is, glm::detail::tvec2& p); +template AVG_TEMPLATE_API std::istream& operator>>(std::istream& is, glm::detail::tvec2& p); + +template AVG_TEMPLATE_API std::ostream& operator<<(std::ostream& os, const glm::detail::tvec3 &p); +template AVG_TEMPLATE_API std::ostream& operator<<(std::ostream& os, const glm::detail::tvec3 &p); +template AVG_TEMPLATE_API std::ostream& operator<<(std::ostream& os, const glm::detail::tvec3 &p); + +template AVG_TEMPLATE_API std::istream& operator>>(std::istream& is, glm::detail::tvec3& p); +template AVG_TEMPLATE_API std::istream& operator>>(std::istream& is, glm::detail::tvec3& p); +template AVG_TEMPLATE_API std::istream& operator>>(std::istream& is, glm::detail::tvec3& p); + +template AVG_TEMPLATE_API std::ostream& operator<<(std::ostream& os, const glm::detail::tvec4 &p); +template AVG_TEMPLATE_API std::ostream& operator<<(std::ostream& os, const glm::detail::tvec4 &p); +template AVG_TEMPLATE_API std::ostream& operator<<(std::ostream& os, const glm::detail::tvec4 &p); + +template AVG_TEMPLATE_API std::ostream& operator<<(std::ostream& os, const glm::detail::tmat4x4 &p); +template AVG_TEMPLATE_API std::ostream& operator<<(std::ostream& os, + const glm::detail::tmat4x4 &p); + +template AVG_TEMPLATE_API bool almostEqual(const glm::detail::tvec2& v1, + const glm::detail::tvec2& v2); +template AVG_TEMPLATE_API bool almostEqual(const glm::detail::tvec2& v1, + const glm::detail::tvec2& v2); +template AVG_TEMPLATE_API bool almostEqual(const glm::detail::tvec4& v1, + const glm::detail::tvec4& v2); +template AVG_TEMPLATE_API bool almostEqual(const glm::detail::tvec4& v1, + const glm::detail::tvec4& v2); +} + diff --git a/src/base/GLMHelper.h b/src/base/GLMHelper.h new file mode 100644 index 0000000..4af8991 --- /dev/null +++ b/src/base/GLMHelper.h @@ -0,0 +1,70 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#ifndef _GLMHelper_H_ +#define _GLMHelper_H_ + +#include "../api.h" + +#include "../glm/glm.hpp" +#include "../glm/gtc/matrix_transform.hpp" +#include "../glm/gtc/type_ptr.hpp" + +#include +#include + +namespace avg { + +glm::vec2 getRotated(const glm::vec2& vec, float angle); +glm::vec2 getRotatedPivot(const glm::vec2& vec, float angle, + const glm::vec2& pivot=glm::vec2(0,0)); +float getAngle(const glm::vec2& vec); +glm::vec2 fromPolar(float angle, float radius); + +template +bool almostEqual(const glm::detail::tvec2& v1, const glm::detail::tvec2& v2); +template +bool almostEqual(const glm::detail::tvec4& v1, const glm::detail::tvec4& v2); + +template +std::ostream& operator<<(std::ostream& os, const glm::detail::tvec2 &v); +template +std::ostream& operator<<(std::ostream& os, const glm::detail::tvec3 &v); +template +std::ostream& operator<<(std::ostream& os, const glm::detail::tvec4 &v); +template +std::ostream& operator<<(std::ostream& os, const glm::detail::tmat4x4 &v); + +template +std::istream& operator>>(std::istream& is, glm::detail::tvec2& p); +template +std::istream& operator>>(std::istream& is, glm::detail::tvec3& p); + +typedef glm::ivec2 IntPoint; +typedef std::vector Vec2Vector; + +glm::vec2 stringToVec2(const std::string& s); +glm::vec3 stringToVec3(const std::string& s); +glm::ivec3 stringToIVec3(const std::string& s); + +} + +#endif diff --git a/src/base/GeomHelper.cpp b/src/base/GeomHelper.cpp new file mode 100644 index 0000000..da167ad --- /dev/null +++ b/src/base/GeomHelper.cpp @@ -0,0 +1,178 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#include "GeomHelper.h" + +#include +#include + +using namespace std; + +namespace avg { + +LineSegment::LineSegment(const glm::vec2& pt0, const glm::vec2& pt1) + : p0(pt0), + p1(pt1) +{ +} + +bool LineSegment::isPointOver(const glm::vec2& pt) +{ + glm::vec2 c = pt - p0; + glm::vec2 v = (p1 - p0); + float d = glm::length(v); + v /= d; + float t = glm::dot(v, c); + + return (t >= 0 && t <= d); +} + +// Code adapted from Antonio, Franklin, "Faster Line Segment Intersection," +// Graphics Gems III (David Kirk, ed.), Academic Press, pp. 199-202, 1992. +bool lineSegmentsIntersect(const LineSegment& l0, const LineSegment& l1) +{ + float xdiff0 = l0.p1.x-l0.p0.x; + float xdiff1 = l1.p0.x-l1.p1.x; + + float x1lo, x1hi; + + /* X bound box test*/ + if (xdiff0 < 0) { + x1lo=l0.p1.x; + x1hi=l0.p0.x; + } else { + x1hi=l0.p1.x; + x1lo=l0.p0.x; + } + if (xdiff1 > 0) { + if (x1hi < l1.p1.x || l1.p0.x < x1lo) { + return false; + } + } else { + if (x1hi < l1.p0.x || l1.p1.x < x1lo) { + return false; + } + } + + float ydiff0 = l0.p1.y-l0.p0.y; + float ydiff1 = l1.p0.y-l1.p1.y; + + float y1lo, y1hi; + + /* Y bound box test*/ + if (ydiff0 < 0) { + y1lo=l0.p1.y; + y1hi=l0.p0.y; + } else { + y1hi=l0.p1.y; + y1lo=l0.p0.y; + } + if (ydiff1 > 0) { + if (y1hi < l1.p1.y || l1.p0.y < y1lo) { + return false; + } + } else { + if (y1hi < l1.p0.y || l1.p1.y < y1lo) { + return false; + } + } + + float Cx = l0.p0.x-l1.p0.x; + float Cy = l0.p0.y-l1.p0.y; + float d = ydiff1*Cx - xdiff1*Cy; /* alpha numerator*/ + float f = ydiff0*xdiff1 - xdiff0*ydiff1; /* both denominator*/ + if (f > 0) { /* alpha tests*/ + if (d < 0 || d > f) { + return false; + } + } else { + if (d > 0 || d < f) { + return false; + } + } + + float e = xdiff0*Cy - ydiff0*Cx; /* beta numerator*/ + if(f > 0) { /* beta tests*/ + if (e < 0 || e > f) { + return false; + } + } else { + if (e > 0 || e < f) { + return false; + } + } + + if (f == 0) { + // Theoretically, lines could still intersect in this case, but we don't care + // because given numerical inaccuracies, the result is random anyway :-). + return false; + } + +// /*compute intersection coordinates*/ +// float num = d*xdiff0; /* numerator */ +// offset = SAME_SIGNS(num,f) ? f/2 : -f/2; /* round direction*/ +// *x = x1 + (num+offset) / f; /* intersection x */ +// +// num = d*ydiff0; +// offset = SAME_SIGNS(num,f) ? f/2 : -f/2; +// *y = y1 + (num+offset) / f; /* intersection y */ + + return true; +} + +// Original code from: +// http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html. +// Precomputing a bounding box for the polygon would speed this up a lot, +// but the function hasn't shown up on any profiles so far. +bool pointInPolygon(const glm::vec2& pt, const vector& poly) +{ + if (poly.size() < 3) { + return false; + } + bool bPtInPoly = false; + for (unsigned i = 0, j = poly.size()-1; i < poly.size(); j = i++) { + if (((poly[i].y > pt.y) != (poly[j].y > pt.y)) && + (pt.x < (poly[j].x-poly[i].x)*(pt.y-poly[i].y) / (poly[j].y-poly[i].y) + +poly[i].x)) + { + bPtInPoly = !bPtInPoly; + } + } + return bPtInPoly; +} + +glm::vec2 getLineLineIntersection(const glm::vec2& p1, const glm::vec2& v1, + const glm::vec2& p2, const glm::vec2& v2) +{ + float denom = v2.y*v1.x-v2.x*v1.y; + if (fabs(denom) < 0.0000001) { + // If the lines are parallel or coincident, we just return p2! + return p2; + } + float numer = v2.x*(p1.y-p2.y) - v2.y*(p1.x-p2.x); + float ua = numer/denom; + + return p1+ua*v1; + +} + + +} diff --git a/src/base/GeomHelper.h b/src/base/GeomHelper.h new file mode 100644 index 0000000..5774231 --- /dev/null +++ b/src/base/GeomHelper.h @@ -0,0 +1,51 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#ifndef _GeomHelper_H_ +#define _GeomHelper_H_ + +#include "../api.h" + +#include "../glm/glm.hpp" + +#include + +namespace avg { + +struct AVG_API LineSegment { +public: + LineSegment(const glm::vec2& pt0, const glm::vec2& pt1); + glm::vec2 p0; + glm::vec2 p1; + + bool isPointOver(const glm::vec2& pt); +}; + +bool AVG_API lineSegmentsIntersect(const LineSegment& l0, const LineSegment& l1); + +bool AVG_API pointInPolygon(const glm::vec2& pt, const std::vector& poly); + +glm::vec2 AVG_API getLineLineIntersection(const glm::vec2& p1, const glm::vec2& v1, + const glm::vec2& p2, const glm::vec2& v2); + +} +#endif + diff --git a/src/base/IFrameEndListener.h b/src/base/IFrameEndListener.h new file mode 100644 index 0000000..6147dbe --- /dev/null +++ b/src/base/IFrameEndListener.h @@ -0,0 +1,37 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#ifndef _IFrameEndListener_H_ +#define _IFrameEndListener_H_ + +#include "../api.h" + +namespace avg { + +class AVG_API IFrameEndListener { +public: + virtual ~IFrameEndListener() {}; + virtual void onFrameEnd() = 0; +}; + +} + +#endif diff --git a/src/base/ILogSink.h b/src/base/ILogSink.h new file mode 100644 index 0000000..de4c1da --- /dev/null +++ b/src/base/ILogSink.h @@ -0,0 +1,53 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de + +#ifndef _ILOGHANDLER_H_ +#define _ILOGHANDLER_H_ + +#include "UTF8String.h" + +#ifdef _WIN32 +#include +#else +#include +#endif + +#include + +using namespace std; + +namespace avg{ + +typedef unsigned severity_t; +typedef UTF8String category_t; + +class AVG_API ILogSink +{ +public: + virtual void logMessage(const tm* pTime, unsigned millis, const category_t& category, + severity_t severity, const UTF8String& sMsg) = 0; + +}; + +typedef boost::shared_ptr LogSinkPtr; + +} + +#endif diff --git a/src/base/IPlaybackEndListener.h b/src/base/IPlaybackEndListener.h new file mode 100644 index 0000000..f505177 --- /dev/null +++ b/src/base/IPlaybackEndListener.h @@ -0,0 +1,38 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#ifndef _IPlaybackEndListener_H_ +#define _IPlaybackEndListener_H_ + +#include "../api.h" + +namespace avg { + +class AVG_API IPlaybackEndListener { +public: + virtual ~IPlaybackEndListener() {}; + virtual void onPlaybackEnd() = 0; +}; + +} + +#endif + diff --git a/src/base/IPreRenderListener.h b/src/base/IPreRenderListener.h new file mode 100644 index 0000000..32c244e --- /dev/null +++ b/src/base/IPreRenderListener.h @@ -0,0 +1,35 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#ifndef _IPreRenderListener_H_ +#define _IPreRenderListener_H_ + +namespace avg { + +class AVG_API IPreRenderListener { +public: + virtual ~IPreRenderListener() {}; + virtual void onPreRender() = 0; +}; + +} + +#endif diff --git a/src/base/Logger.cpp b/src/base/Logger.cpp new file mode 100644 index 0000000..dd7efe1 --- /dev/null +++ b/src/base/Logger.cpp @@ -0,0 +1,280 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#include "Logger.h" +#include "Exception.h" +#include "StandardLogSink.h" +#include "OSHelper.h" + +#include + +#ifdef _WIN32 +#include +#include +#include +#undef ERROR +#else +#include +#include +#endif +#include +#include + +using namespace std; +namespace ba = boost::algorithm; + +namespace avg { + const severity_t Logger::severity::CRITICAL = 50; + const severity_t Logger::severity::ERROR = 40; + const severity_t Logger::severity::WARNING = 30; + const severity_t Logger::severity::INFO = 20; + const severity_t Logger::severity::DEBUG = 10; + const severity_t Logger::severity::NONE = 0; + + const category_t Logger::category::NONE = UTF8String("NONE"); + const category_t Logger::category::PROFILE = UTF8String("PROFILE"); + const category_t Logger::category::PROFILE_VIDEO = UTF8String("PROFILE_V"); + const category_t Logger::category::EVENTS = UTF8String("EVENTS"); + const category_t Logger::category::CONFIG = UTF8String("CONFIG"); + const category_t Logger::category::MEMORY = UTF8String("MEMORY"); + const category_t Logger::category::APP = UTF8String("APP"); + const category_t Logger::category::PLUGIN = UTF8String("PLUGIN"); + const category_t Logger::category::PLAYER = UTF8String("PLAYER"); + const category_t Logger::category::SHADER = UTF8String("SHADER"); + const category_t Logger::category::DEPRECATION = UTF8String("DEPREC"); + +namespace { + Logger* s_pLogger = 0; + boost::mutex s_logMutex; + boost::mutex s_traceMutex; + boost::mutex s_sinkMutex; + boost::mutex s_removeStdSinkMutex; +} + +boost::mutex Logger::m_CategoryMutex; + +Logger * Logger::get() +{ + lock_guard lock(s_logMutex); + if (!s_pLogger) { + s_pLogger = new Logger; + } + return s_pLogger; +} + +Logger::Logger() +{ + m_Severity = severity::WARNING; + string sEnvSeverity; + bool bEnvSeveritySet = getEnv("AVG_LOG_SEVERITY", sEnvSeverity); + if(bEnvSeveritySet) { + m_Severity = Logger::stringToSeverity(sEnvSeverity); + } + setupCategory(); + + string sEnvCategories; + bool bEnvSet = getEnv("AVG_LOG_CATEGORIES", sEnvCategories); + if (bEnvSet) { + vector sCategories; + ba::split(sCategories, sEnvCategories, ba::is_any_of(" "), ba::token_compress_on); + vector::iterator it; + for(it=sCategories.begin(); it!=sCategories.end(); it++) { + string::size_type pos = (*it).find(":"); + string sCategory; + string sSeverity = "NONE"; + if(pos == string::npos) { + sCategory = *it; + } else { + vector tmpValues; + ba::split( tmpValues, *it, ba::is_any_of(":"), ba::token_compress_on); + sCategory = tmpValues.at(0); + sSeverity = tmpValues.at(1); + } + severity_t severity = stringToSeverity(sSeverity); + configureCategory(sCategory, severity); + } + } + + string sDummy; + bool bEnvOmitStdErr = getEnv("AVG_LOG_OMIT_STDERR", sDummy); + if (!bEnvOmitStdErr) { + m_pStdSink = LogSinkPtr(new StandardLogSink); + addLogSink(m_pStdSink); + } +} + +Logger::~Logger() +{ +} + +void Logger::addLogSink(const LogSinkPtr& logSink) +{ + lock_guard lock(s_sinkMutex); + m_pSinks.push_back(logSink); +} + +void Logger::removeLogSink(const LogSinkPtr& logSink) +{ + lock_guard lock(s_sinkMutex); + std::vector::iterator it; + it = find(m_pSinks.begin(), m_pSinks.end(), logSink); + if ( it != m_pSinks.end() ) { + m_pSinks.erase(it); + } +} + +void Logger::removeStdLogSink() +{ + lock_guard lock(s_removeStdSinkMutex); + if ( m_pStdSink.get()) { + removeLogSink(m_pStdSink); + m_pStdSink = LogSinkPtr(); + } +} + +category_t Logger::configureCategory(category_t category, severity_t severity) +{ + lock_guard lock(m_CategoryMutex); + severity = (severity == Logger::severity::NONE) ? m_Severity : severity; + UTF8String sCategory = boost::to_upper_copy(string(category)); + CatToSeverityMap::iterator it; + it = m_CategorySeverities.find(sCategory); + if ( it != m_CategorySeverities.end()) { + m_CategorySeverities.erase(sCategory); + } + pair element(sCategory, severity); + m_CategorySeverities.insert(element); + return sCategory; +} + +CatToSeverityMap Logger::getCategories() +{ + return m_CategorySeverities; +} + +void Logger::trace(const UTF8String& sMsg, const category_t& category, + severity_t severity) const +{ + lock_guard lock(s_traceMutex); + struct tm* pTime; + #ifdef _WIN32 + __int64 now; + _time64(&now); + pTime = _localtime64(&now); + DWORD tms = timeGetTime(); + unsigned millis = unsigned(tms % 1000); + #else + struct timeval time; + gettimeofday(&time, NULL); + pTime = localtime(&time.tv_sec); + unsigned millis = time.tv_usec/1000; + #endif + lock_guard lockHandler(s_sinkMutex); + std::vector::const_iterator it; + for(it=m_pSinks.begin(); it!=m_pSinks.end(); ++it){ + (*it)->logMessage(pTime, millis, category, severity, sMsg); + } +} + +void Logger::logDebug(const UTF8String& msg, const category_t& category) const +{ + log(msg, category, Logger::severity::DEBUG); +} + +void Logger::logInfo(const UTF8String& msg, const category_t& category) const +{ + log(msg, category, Logger::severity::INFO); +} + +void Logger::logWarning(const UTF8String& msg, const category_t& category) const +{ + log(msg, category, Logger::severity::WARNING); +} + +void Logger::logError(const UTF8String& msg, const category_t& category) const +{ + log(msg, category, Logger::severity::ERROR); +} + +void Logger::logCritical(const UTF8String& msg, const category_t& category) const +{ + log(msg, category, Logger::severity::CRITICAL); +} + +void Logger::log(const UTF8String& msg, const category_t& category, + severity_t severity) const +{ + if(shouldLog(category, severity)) { + Logger::trace(msg, category, severity); + } +} + +void Logger::setupCategory() +{ + configureCategory(category::NONE); + configureCategory(category::PROFILE); + configureCategory(category::PROFILE_VIDEO); + configureCategory(category::EVENTS); + configureCategory(category::CONFIG); + configureCategory(category::MEMORY); + configureCategory(category::APP); + configureCategory(category::PLUGIN); + configureCategory(category::PLAYER); + configureCategory(category::SHADER); + configureCategory(category::DEPRECATION); +} + +severity_t Logger::stringToSeverity(const string& sSeverity) +{ + string severity = boost::to_upper_copy(string(sSeverity)); + if (severity == "CRIT") { + return Logger::severity::CRITICAL; + } else if (severity == "ERR") { + return Logger::severity::ERROR; + } else if (severity == "WARN") { + return Logger::severity::WARNING; + } else if (severity == "INFO") { + return Logger::severity::INFO; + } else if (severity == "DBG") { + return Logger::severity::DEBUG; + } else if (severity == "NONE") { + return Logger::severity::NONE; + } + throw Exception(AVG_ERR_INVALID_ARGS, severity + " is an invalid log severity"); +} + +const char * Logger::severityToString(severity_t severity) +{ + if(severity == Logger::severity::CRITICAL) { + return "CRIT"; + } else if(severity == Logger::severity::ERROR) { + return "ERR"; + } else if(severity == Logger::severity::WARNING) { + return "WARN"; + } else if(severity == Logger::severity::INFO) { + return "INFO"; + } else if(severity == Logger::severity::DEBUG) { + return "DBG"; + } + throw Exception(AVG_ERR_UNKNOWN, "Unkown log severity"); +} + +} diff --git a/src/base/Logger.h b/src/base/Logger.h new file mode 100644 index 0000000..197c0c2 --- /dev/null +++ b/src/base/Logger.h @@ -0,0 +1,154 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#ifndef _Logger_H_ +#define _Logger_H_ + +#include "Exception.h" +#include "ILogSink.h" +#include "UTF8String.h" +#include "ThreadHelper.h" +#include "../api.h" + +#include +#include +#include + +#include +#include +#include + +#ifdef ERROR +#undef ERROR +#endif + +namespace avg { + +typedef boost::unordered_map< const category_t, const severity_t > CatToSeverityMap; + +#ifdef _WIN32 +// non dll-interface class used as base for dll-interface class +#pragma warning(disable:4275) +#endif +class AVG_API Logger: private boost::noncopyable { +public: + struct AVG_API severity + { + static const severity_t CRITICAL; + static const severity_t ERROR; + static const severity_t WARNING; + static const severity_t INFO; + static const severity_t DEBUG; + static const severity_t NONE; + }; + + struct AVG_API category + { + static const category_t NONE; + static const category_t PROFILE; + static const category_t PROFILE_VIDEO; + static const category_t EVENTS; + static const category_t CONFIG; + static const category_t MEMORY; + static const category_t APP; + static const category_t PLUGIN; + static const category_t PLAYER; + static const category_t SHADER; + static const category_t DEPRECATION; + }; + + static Logger* get(); + virtual ~Logger(); + + static severity_t stringToSeverity(const string& sSeverity); + static const char * severityToString(const severity_t severity); + + void addLogSink(const LogSinkPtr& logSink); + void removeLogSink(const LogSinkPtr& logSink); + void removeStdLogSink(); + + category_t configureCategory(category_t category, + severity_t severity=severity::NONE); + CatToSeverityMap getCategories(); + + void trace(const UTF8String& sMsg, const category_t& category, + severity_t severity) const; + void logDebug(const UTF8String& msg, + const category_t& category=category::APP) const; + void logInfo(const UTF8String& msg, + const category_t& category=category::APP) const; + void logWarning(const UTF8String& msg, + const category_t& category=category::APP) const; + void logError(const UTF8String& msg, + const category_t& category=category::APP) const; + void logCritical(const UTF8String& msg, + const category_t& category=category::APP) const; + void log(const UTF8String& msg, const category_t& category=category::APP, + severity_t severity=severity::INFO) const; + + inline bool shouldLog(const category_t& category, severity_t severity) const { + lock_guard lock(m_CategoryMutex); + try { + severity_t targetSeverity = m_CategorySeverities.at(category); + return (targetSeverity <= severity); + } catch (out_of_range e){ + string msg("Unknown category: " + category); + throw Exception(AVG_ERR_INVALID_ARGS, msg); + } + } + +private: + Logger(); + void setupCategory(); + + std::vector m_pSinks; + LogSinkPtr m_pStdSink; + CatToSeverityMap m_CategorySeverities; + severity_t m_Severity; + static boost::mutex m_CategoryMutex; +}; + +#define AVG_TRACE(category, severity, sMsg) { \ +if (Logger::get()->shouldLog(category, severity)) { \ + std::stringstream tmp(std::stringstream::in | std::stringstream::out); \ + tmp << sMsg; \ + Logger::get()->trace(tmp.str(), category, severity); \ + }\ +}\ + +#define AVG_LOG_ERROR(sMsg){ \ + AVG_TRACE(Logger::category::NONE, Logger::severity::ERROR, sMsg); \ +}\ + +#define AVG_LOG_WARNING(sMsg){ \ + AVG_TRACE(Logger::category::NONE, Logger::severity::WARNING, sMsg); \ +}\ + +#define AVG_LOG_INFO(sMsg){ \ + AVG_TRACE(Logger::category::NONE, Logger::severity::INFO, sMsg); \ +}\ + +#define AVG_LOG_DEBUG(sMsg){ \ + AVG_TRACE(Logger::category::NONE, Logger::severity::DEBUG, sMsg); \ +}\ + +} +#endif diff --git a/src/base/Makefile.am b/src/base/Makefile.am new file mode 100644 index 0000000..ce995f2 --- /dev/null +++ b/src/base/Makefile.am @@ -0,0 +1,35 @@ +SUBDIRS = triangulate + +AM_CPPFLAGS = -I.. @XML2_CFLAGS@ @PTHREAD_CFLAGS@ +ALL_H = FileHelper.h Exception.h Logger.h ConfigMgr.h ObjectCounter.h \ + XMLHelper.h TimeSource.h ProfilingZone.h ThreadProfiler.h \ + ScopeTimer.h IFrameEndListener.h IPreRenderListener.h IPlaybackEndListener.h \ + Test.h TestSuite.h OSHelper.h Queue.h WorkerThread.h Command.h ObjectCounter.h \ + Rect.h Directory.h DirEntry.h StringHelper.h MathHelper.h GeomHelper.h \ + CubicSpline.h BezierCurve.h UTF8String.h Triangle.h DAG.h \ + WideLine.h DlfcnWrapper.h Signal.h Backtrace.h \ + CmdQueue.h ProfilingZoneID.h GLMHelper.h StandardLogSink.h ILogSink.h \ + ThreadHelper.h + +TESTS = testbase + +EXTRA_DIST = DlfcnWrapper.cpp + +noinst_LTLIBRARIES = libbase.la +libbase_la_SOURCES = FileHelper.cpp Exception.cpp Logger.cpp \ + ConfigMgr.cpp XMLHelper.cpp TimeSource.cpp OSHelper.cpp \ + ProfilingZone.cpp ThreadProfiler.cpp ScopeTimer.cpp Test.cpp \ + TestSuite.cpp ObjectCounter.cpp Directory.cpp DirEntry.cpp \ + StringHelper.cpp MathHelper.cpp GeomHelper.cpp CubicSpline.cpp \ + BezierCurve.cpp UTF8String.cpp Triangle.cpp DAG.cpp WideLine.cpp \ + Backtrace.cpp ProfilingZoneID.cpp GLMHelper.cpp \ + WorkerThread.cpp StandardLogSink.cpp ThreadHelper.cpp \ + $(ALL_H) +libbase_a_CXXFLAGS = -Wno-format-y2k + +noinst_PROGRAMS = testbase +testbase_SOURCES = testbase.cpp $(ALL_H) +testbase_LDADD = ./libbase.la ./triangulate/libtriangulate.la \ + @BOOST_THREAD_LIBS@ @XML2_LIBS@ @PTHREAD_LIBS@ +# -rdynamic needed only for testBacktrace to work under linux. +testbase_LDFLAGS = -rdynamic diff --git a/src/base/MathHelper.cpp b/src/base/MathHelper.cpp new file mode 100644 index 0000000..388859d --- /dev/null +++ b/src/base/MathHelper.cpp @@ -0,0 +1,78 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#include "MathHelper.h" + +#include +#include + +using namespace std; + +namespace avg { + +bool ispow2(int n) +{ + return ((n & (n-1)) == 0); +} + +int nextpow2(int n) +{ + n--; + n |= n >> 1; // handle 2 bit numbers + n |= n >> 2; // handle 4 bit numbers + n |= n >> 4; // handle 8 bit numbers + n |= n >> 8; // handle 16 bit numbers + n |= n >> 16; // handle 32 bit numbers + n++; + return n; +} + +int safeCeil(float d) +{ + if (fabs(d-int(d)) < EPSILON) { + return int(d); + } else { + return int(d)+1; + } +} + +float invSqrt(float x) +{ +#if 0 + // TODO: This gives incorrect results on Athlon X2, gcc 4.2. + float xhalf = 0.5f*x; + int i = *(int*)&x; // get bits for floating value + i = 0x5f3759d5 - (i>>1); // give initial guess y0 + x = *(float*)&i; // convert bits back to float + x *= 1.5f - xhalf*x*x; // newton step, repeating this step + // increases accuracy + x *= 1.5f - xhalf*x*x; + return x; +#endif + return 1/sqrt(x); +} + +bool almostEqual(float d1, float d2, float epsilon) +{ + return (fabs(d1-d2) +#include + +#include +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif + +namespace avg { + +static const float PI = 3.14159265358979323846f; +static const float EPSILON = 0.00001f; + +bool ispow2(int n); + +int nextpow2(int n); + +int safeCeil(float d); + +bool almostEqual(float d1, float d2, float epsilon=EPSILON); + +float invSqrt(float x); + +template +T sqr(T d) +{ + return d*d; +} + +template +int sgn(T val) +{ + return int(val/fabs(val)); +} + +template +std::vector vectorFromCArray(int n, T* pData) +{ + std::vector v; + for (int i=0; i +std::vector > vector2DFromCArray(int n, int m, T* pData) +{ + std::vector > v(4, std::vector()); + for (int i=0; i +T round(T d) +{ + return floor(d + 0.5f); +} +#endif + +} +#endif + diff --git a/src/base/OSHelper.cpp b/src/base/OSHelper.cpp new file mode 100644 index 0000000..377e725 --- /dev/null +++ b/src/base/OSHelper.cpp @@ -0,0 +1,308 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#include "OSHelper.h" +#include "FileHelper.h" +#include "Logger.h" +#include "FileHelper.h" +#include "Exception.h" + +#if defined(_WIN32) +#include +#include +#undef ERROR +#undef WARNING +#elif defined(__APPLE__) +#include +#include +#include +#elif defined(__linux) +#include +#include +#include +#endif + +#include +#include +#include + +using namespace std; + +namespace avg { + +#ifdef _WIN32 +string getWinErrMsg(unsigned err) +{ + LPVOID lpMsgBuf; + FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &lpMsgBuf, + 0, NULL ); + string sMsg((char*)lpMsgBuf); + LocalFree(lpMsgBuf); + return sMsg; +} +#endif + +#if defined(__linux) +// Adapted from binreloc +static char * +_br_find_exe_for_symbol (const void *symbol) +{ + #define SIZE 1024 + FILE *f; + size_t address_string_len; + char *address_string, line[SIZE], *found; + + if (symbol == NULL) + return (char *) NULL; + + f = fopen ("/proc/self/maps", "r"); + if (f == NULL) + return (char *) NULL; + + address_string_len = 4; + address_string = (char *) malloc(address_string_len); + found = (char *) NULL; + + + while (!feof (f)) { + char *start_addr, *end_addr, *end_addr_end, *file; + void *start_addr_p, *end_addr_p; + size_t len; + + if (fgets (line, SIZE, f) == NULL) + break; + + /* Sanity check. */ + if (strstr (line, " r-xp ") == NULL || strchr (line, '/') == NULL) + continue; + + /* Parse line. */ + start_addr = line; + end_addr = strchr (line, '-'); + file = strchr (line, '/'); + + /* More sanity check. */ + if (!(file > end_addr && end_addr != NULL && end_addr[0] == '-')) + continue; + + end_addr[0] = '\0'; + end_addr++; + end_addr_end = strchr (end_addr, ' '); + if (end_addr_end == NULL) + continue; + + end_addr_end[0] = '\0'; + len = strlen (file); + if (len == 0) + continue; + if (file[len - 1] == '\n') + file[len - 1] = '\0'; + + /* Get rid of "(deleted)" from the filename. */ + len = strlen (file); + if (len > 10 && strcmp (file + len - 10, " (deleted)") == 0) + file[len - 10] = '\0'; + + /* I don't know whether this can happen but better safe than sorry. */ + len = strlen (start_addr); + if (len != strlen (end_addr)) + continue; + + + /* Transform the addresses into a string in the form of 0xdeadbeef, + * then transform that into a pointer. */ + if (address_string_len < len + 3) { + address_string_len = len + 3; + address_string = (char *) realloc (address_string, address_string_len); + } + + memcpy (address_string, "0x", 2); + memcpy (address_string + 2, start_addr, len); + address_string[2 + len] = '\0'; + sscanf (address_string, "%p", &start_addr_p); + + memcpy (address_string, "0x", 2); + memcpy (address_string + 2, end_addr, len); + address_string[2 + len] = '\0'; + sscanf (address_string, "%p", &end_addr_p); + + + if (symbol >= start_addr_p && symbol < end_addr_p) { + found = file; + break; + } + } + + free (address_string); + fclose (f); + + if (found == NULL) + return (char *) NULL; + else + return strdup (found); +} +#endif + +string getAvgLibPath() +{ +#if defined(_WIN32) + HMODULE hModule = GetModuleHandle("avg.pyd"); + char szFilename[1024]; + DWORD ok = GetModuleFileName(hModule, szFilename, sizeof(szFilename)); + if (ok == 0) { + AVG_LOG_ERROR("getAvgLibPath(): " << getWinErrMsg(GetLastError())); + exit(5); + } + string sPath=getPath(szFilename); + return sPath; +#elif defined(__APPLE__) + // We need to iterate through all images attached to the current executable + // and figure out which one is the one we are interested in. + uint32_t numImages = _dyld_image_count(); + for (uint32_t i=0; i> vmsize >> rssize; + return rssize*(size_t)(getpagesize()); +#endif +#endif +} + +std::string convertUTF8ToFilename(const std::string & sName) +{ +#ifdef _WIN32 + // Conversion from utf-8 to something windows can use: + // utf-8 long filename -> utf-16 long filename -> utf-16 short filename (8.3) + // -> utf-8 short filename (= ASCII short filename). + wchar_t wideString[2048]; + int err1 = MultiByteToWideChar(CP_UTF8, 0, sName.c_str(), sName.size()+1, + wideString, 2048); + if (err1 == 0) { + AVG_LOG_WARNING("Error in unicode conversion (MultiByteToWideChar): " << + getWinErrMsg(GetLastError())); + return sName; + } + wchar_t wideShortFName[2048]; + DWORD err2 = GetShortPathNameW(wideString, wideShortFName, 1024); + if (err2 != 0) { + char pShortName[1024]; + err1 = WideCharToMultiByte(CP_UTF8, 0, wideShortFName, -1, pShortName, + 1024, 0, 0); + if (err1 == 0) { + AVG_LOG_WARNING("Error in unicode conversion (MultiByteToWideChar): " << + getWinErrMsg(GetLastError())); + } + return pShortName; + } else { + return sName; + } +#else + return sName; +#endif +} + +#ifdef __APPLE__ +int reallyGetOSXMajorVersion() +{ + utsname sysInfo; + int rc = uname(&sysInfo); + AVG_ASSERT(rc == 0); +// cerr << sysInfo.sysname << ", " << sysInfo.nodename << ", " << sysInfo.release << +// ", " << sysInfo.version << ", " << sysInfo.machine << endl; + istringstream ss(sysInfo.release); + int major; + int minor; + int dot; + char c; + ss >> major >> c >> minor >> c >> dot; + return major; +} + +int getOSXMajorVersion() +{ + static int major = reallyGetOSXMajorVersion(); // only called once for speed reasons. + return major; +} +#endif +} diff --git a/src/base/OSHelper.h b/src/base/OSHelper.h new file mode 100644 index 0000000..6abda5a --- /dev/null +++ b/src/base/OSHelper.h @@ -0,0 +1,52 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#ifndef _OSHelper_H_ +#define _OSHelper_H_ + +#include "../api.h" +#include + +namespace avg { + +#ifdef _WIN32 +std::string getWinErrMsg(unsigned err); +#endif + +std::string getAvgLibPath(); + +bool getEnv(const std::string & sName, std::string & sVal); +void setEnv(const std::string & sName, const std::string & sVal); + +size_t getMemoryUsage(); + +// Converts a utf-8-encoded filename to something windows can use. +// Under other operating systems, returns the input string. +AVG_API std::string convertUTF8ToFilename(const std::string & sName); + +#ifdef __APPLE__ +int getOSXMajorVersion(); +#endif + +} + +#endif + diff --git a/src/base/ObjectCounter.cpp b/src/base/ObjectCounter.cpp new file mode 100644 index 0000000..e8136b7 --- /dev/null +++ b/src/base/ObjectCounter.cpp @@ -0,0 +1,187 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#include "ObjectCounter.h" +#include "Exception.h" +#include "Logger.h" + +#include + +#include +#include +#include +#include + +#ifdef WIN32 +#include +#include +#else +#include +#endif + +#define DEBUG_ALLOC 1 + +namespace avg { + +using namespace std; + +ObjectCounter* ObjectCounter::s_pObjectCounter = 0; +bool ObjectCounter::s_bDeleted = false; +boost::mutex * pCounterMutex; + +void deleteObjectCounter() +{ + delete ObjectCounter::s_pObjectCounter; + delete pCounterMutex; + ObjectCounter::s_pObjectCounter = 0; +} + +ObjectCounter::ObjectCounter() +{ +} + +ObjectCounter::~ObjectCounter() +{ + s_bDeleted = true; +} + +ObjectCounter * ObjectCounter::get() +{ + if (!s_pObjectCounter) { + if (s_bDeleted) { + // This is _after_ the deleteObjectCounter has been called. + return 0; + } else { + s_pObjectCounter = new ObjectCounter; + pCounterMutex = new boost::mutex; + atexit(deleteObjectCounter); + } + } + return s_pObjectCounter; +} + +void ObjectCounter::incRef(const std::type_info* pType) +{ +#ifdef DEBUG_ALLOC + lock_guard Lock(*pCounterMutex); + TypeMap::iterator MapEntry = m_TypeMap.find(pType); + if (MapEntry == m_TypeMap.end()) { + m_TypeMap[pType] = 1; + } else { + (MapEntry->second)++; + } +// cerr << "incRef " << demangle(pType->name()) << ":" << m_TypeMap[pType] << endl; +#endif +} + +void ObjectCounter::decRef(const std::type_info* pType) +{ +#ifdef DEBUG_ALLOC + if (!this) { + // This happens if there are counted static objects that are deleted after + // s_pObjectCounter has been deleted. + return; + } + lock_guard Lock(*pCounterMutex); + TypeMap::iterator MapEntry = m_TypeMap.find(pType); + if (MapEntry == m_TypeMap.end()) { + cerr << "ObjectCounter for " << demangle(pType->name()) + << " does not exist." << endl; + // Can't decref a type that hasn't been incref'd. + AVG_ASSERT(false); + } else { + (MapEntry->second)--; + if (MapEntry->second < 0) { + cerr << "ObjectCounter: refcount for " << + demangle(MapEntry->first->name()) << + " < 0" << endl; + AVG_ASSERT(false); + } + } +// cerr << "decRef " << demangle(pType->name()) << ":" << MapEntry->second << endl; +#endif +} + +int ObjectCounter::getCount(const std::type_info* pType) +{ + TypeMap::iterator MapEntry = m_TypeMap.find(pType); + if (MapEntry == m_TypeMap.end()) { + return 0; + } else { + return MapEntry->second; + } + +} + +std::string ObjectCounter::dump() +{ + stringstream ss; + ss << "Object dump: " << endl; + TypeMap::iterator it; + vector strings; + for (it = m_TypeMap.begin(); it != m_TypeMap.end(); ++it) { + stringstream tempStream; + if (it->second > 0) { + tempStream << " " << demangle(it->first->name()) << ": " << it->second; + strings.push_back(tempStream.str()); + } + } + sort(strings.begin(), strings.end()); + for (vector::iterator it=strings.begin(); it != strings.end(); ++it) { + ss << *it << endl; + } + return ss.str(); +} + +string ObjectCounter::demangle(string s) +{ + int rc; + string sResult; +#ifdef _WIN32 + char szDemangledName[2048]; + rc = int(UnDecorateSymbolName(s.c_str(), szDemangledName, sizeof(szDemangledName), + UNDNAME_COMPLETE)); + if (rc) { + sResult = szDemangledName; + } else { + int error = GetLastError(); + printf("UnDecorateSymbolName returned error %d\n", error); + sResult = s; + } +#else + char * pszDemangled = abi::__cxa_demangle(s.c_str(), 0, 0, &rc); + if (rc) { + sResult = s; + } else { + sResult = pszDemangled; + } + if (pszDemangled) { + free(pszDemangled); + } +#endif + return sResult; +} + +TypeMap ObjectCounter::getObjectCount(){ + return m_TypeMap; +} + +} diff --git a/src/base/ObjectCounter.h b/src/base/ObjectCounter.h new file mode 100644 index 0000000..e370723 --- /dev/null +++ b/src/base/ObjectCounter.h @@ -0,0 +1,61 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#ifndef _ObjectCounter_H_ +#define _ObjectCounter_H_ + +#include "../api.h" +#include +#include +#include + +namespace avg { + +typedef std::map TypeMap; + +class AVG_API ObjectCounter { +public: + static ObjectCounter* get(); + virtual ~ObjectCounter(); + + void incRef(const std::type_info* pType); + void decRef(const std::type_info* pType); + + int getCount(const std::type_info* pType); + + std::string demangle(std::string s); + std::string dump(); + TypeMap getObjectCount(); + +private: + ObjectCounter(); + static void deleteSingleton(); + + TypeMap m_TypeMap; + + static ObjectCounter* s_pObjectCounter; + static bool s_bDeleted; + friend void deleteObjectCounter(); +}; + +} +#endif + diff --git a/src/base/ProfilingZone.cpp b/src/base/ProfilingZone.cpp new file mode 100644 index 0000000..9cdbbfe --- /dev/null +++ b/src/base/ProfilingZone.cpp @@ -0,0 +1,91 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#include "ProfilingZone.h" +#include "ObjectCounter.h" + +#include + +using namespace boost; +using namespace std; + +namespace avg { + +ProfilingZone::ProfilingZone(const ProfilingZoneID& zoneID) + : m_TimeSum(0), + m_AvgTime(0), + m_NumFrames(0), + m_Indent(0), + m_ZoneID(zoneID) +{ + ObjectCounter::get()->incRef(&typeid(*this)); +} + +ProfilingZone::~ProfilingZone() +{ + ObjectCounter::get()->decRef(&typeid(*this)); +} + +void ProfilingZone::restart() +{ + m_NumFrames = 0; + m_AvgTime = 0; + m_TimeSum = 0; +} + +void ProfilingZone::reset() +{ + m_NumFrames++; + m_AvgTime = (m_AvgTime*(m_NumFrames-1)+m_TimeSum)/m_NumFrames; + m_TimeSum = 0; +} + +long long ProfilingZone::getUSecs() const +{ + return m_TimeSum; +} + +long long ProfilingZone::getAvgUSecs() const +{ + return m_AvgTime; +} + +void ProfilingZone::setIndentLevel(int indent) +{ + m_Indent = indent; +} + +int ProfilingZone::getIndentLevel() const +{ + return m_Indent; +} + +string ProfilingZone::getIndentString() const +{ + return string(m_Indent, ' '); +} + +const string& ProfilingZone::getName() const +{ + return m_ZoneID.getName(); +} + +} diff --git a/src/base/ProfilingZone.h b/src/base/ProfilingZone.h new file mode 100644 index 0000000..0d0ee42 --- /dev/null +++ b/src/base/ProfilingZone.h @@ -0,0 +1,69 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#ifndef _ProfilingZone_H_ +#define _ProfilingZone_H_ + +#include "../api.h" +#include "ProfilingZoneID.h" +#include "TimeSource.h" + +#include + +namespace avg { + +class AVG_API ProfilingZone +{ +public: + ProfilingZone(const ProfilingZoneID& zoneID); + virtual ~ProfilingZone(); + void restart(); + + void start() + { + m_StartTime = TimeSource::get()->getCurrentMicrosecs(); + }; + void stop() + { + m_TimeSum += TimeSource::get()->getCurrentMicrosecs()-m_StartTime; + }; + void reset(); + long long getUSecs() const; + long long getAvgUSecs() const; + void setIndentLevel(int indent); + int getIndentLevel() const; + std::string getIndentString() const; + const std::string& getName() const; + +private: + long long m_TimeSum; + long long m_AvgTime; + long long m_StartTime; + int m_NumFrames; + int m_Indent; + const ProfilingZoneID& m_ZoneID; +}; + +typedef boost::shared_ptr ProfilingZonePtr; + +} + +#endif diff --git a/src/base/ProfilingZoneID.cpp b/src/base/ProfilingZoneID.cpp new file mode 100644 index 0000000..7256887 --- /dev/null +++ b/src/base/ProfilingZoneID.cpp @@ -0,0 +1,57 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#include "ProfilingZoneID.h" +#include "ThreadProfiler.h" + +using namespace std; + +namespace avg { + +ProfilingZoneID::ProfilingZoneID(const string& sName, bool bMultithreaded) + : m_sName(sName), + m_bMultithreaded(bMultithreaded), + m_pProfiler(0) +{ +} + +ProfilingZoneID::~ProfilingZoneID() +{ +} + +const string& ProfilingZoneID::getName() const +{ + return m_sName; +} + +ThreadProfiler* ProfilingZoneID::getProfiler() +{ + if (!m_pProfiler) { + if (m_bMultithreaded) { + return ThreadProfiler::get(); + } else { + m_pProfiler = ThreadProfiler::get(); + } + } + return m_pProfiler; +} + +} diff --git a/src/base/ProfilingZoneID.h b/src/base/ProfilingZoneID.h new file mode 100644 index 0000000..ca4d637 --- /dev/null +++ b/src/base/ProfilingZoneID.h @@ -0,0 +1,50 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#ifndef _ProfilingZoneID_H_ +#define _ProfilingZoneID_H_ + +#include "../api.h" + +#include + +namespace avg { + +class ThreadProfiler; + +class AVG_API ProfilingZoneID +{ +public: + ProfilingZoneID(const std::string& sName, bool bMultithreaded=false); + ~ProfilingZoneID(); + + const std::string& getName() const; + ThreadProfiler* getProfiler(); + +private: + std::string m_sName; + bool m_bMultithreaded; + ThreadProfiler* m_pProfiler; +}; + +} + +#endif diff --git a/src/base/Queue.h b/src/base/Queue.h new file mode 100644 index 0000000..36a0eba --- /dev/null +++ b/src/base/Queue.h @@ -0,0 +1,160 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#ifndef _Queue_H_ +#define _Queue_H_ + +#include "../api.h" +#include "Exception.h" + +#include +#include +#include + +#include +#include + +namespace avg { + +typedef boost::unique_lock unique_lock; + +template +class AVG_TEMPLATE_API Queue +{ +public: + typedef boost::shared_ptr QElementPtr; + + Queue(int maxSize=-1); + virtual ~Queue(); + + bool empty() const; + QElementPtr pop(bool bBlock = true); + void clear(); + void push(const QElementPtr& pElem); + QElementPtr peek(bool bBlock = true) const; + int size() const; + int getMaxSize() const; + +private: + QElementPtr getFrontElement(bool bBlock, unique_lock& Lock) const; + + std::deque m_pElements; + mutable boost::mutex m_Mutex; + mutable boost::condition m_Cond; + int m_MaxSize; +}; + +template +Queue::Queue(int maxSize) + : m_MaxSize(maxSize) +{ +} + +template +Queue::~Queue() +{ +} + +template +bool Queue::empty() const +{ + unique_lock Lock(m_Mutex); + return m_pElements.empty(); +} + +template +typename Queue::QElementPtr Queue::pop(bool bBlock) +{ + unique_lock lock(m_Mutex); + QElementPtr pElem = getFrontElement(bBlock, lock); + if (pElem) { + m_pElements.pop_front(); + m_Cond.notify_one(); + } + return pElem; +} + +template +void Queue::clear() +{ + QElementPtr pElem; + do { + pElem = pop(false); + } while (pElem); +} + +template +typename Queue::QElementPtr Queue::peek(bool bBlock) const +{ + unique_lock lock(m_Mutex); + QElementPtr pElem = getFrontElement(bBlock, lock); + if (pElem) { + m_Cond.notify_one(); + } + return pElem; +} + +template +void Queue::push(const QElementPtr& pElem) +{ + assert(pElem); + unique_lock lock(m_Mutex); + if (m_pElements.size() == (unsigned)m_MaxSize) { + while (m_pElements.size() == (unsigned)m_MaxSize) { + m_Cond.wait(lock); + } + } + m_pElements.push_back(pElem); + m_Cond.notify_one(); +} + +template +int Queue::size() const +{ + unique_lock lock(m_Mutex); + return int(m_pElements.size()); +} + +template +int Queue::getMaxSize() const +{ + unique_lock lock(m_Mutex); + return m_MaxSize; +} + +template +typename Queue::QElementPtr + Queue::getFrontElement(bool bBlock, unique_lock& lock) const +{ + if (m_pElements.empty()) { + if (bBlock) { + while (m_pElements.empty()) { + m_Cond.wait(lock); + } + } else { + return QElementPtr(); + } + } + return m_pElements.front(); +} + +} +#endif diff --git a/src/base/Rect.h b/src/base/Rect.h new file mode 100644 index 0000000..d668338 --- /dev/null +++ b/src/base/Rect.h @@ -0,0 +1,213 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#ifndef _Rect_H_ +#define _Rect_H_ + +#include "../api.h" + +#include "../base/GLMHelper.h" +#include "../glm/glm.hpp" + +#include + +namespace avg { + +// Simple rectangle class. +// If NUM is an integer, contains all points from tl up to but not including +// br. +template +class AVG_TEMPLATE_API Rect +{ +public: + typedef glm::detail::tvec2 Vec2; + Vec2 tl; + Vec2 br; + + Rect(); + Rect(NUM left, NUM top, NUM right, NUM bottom); + Rect(const Vec2& TL, const Vec2& BR); + template Rect(const Rect& rc); + + bool operator ==(const Rect& rect) const; + bool operator !=(const Rect & rect) const; + NUM width() const; + NUM height() const; + Vec2 center() const; + void setWidth(NUM width); + void setHeight(NUM height); + void setSize(const Vec2& size); + bool contains(const Vec2& pt) const; + bool contains(const Rect& rect) const; + bool intersects(const Rect& rect) const; + void expand(const Rect& rect); + void intersect(const Rect& rect); + Vec2 size() const; + Vec2 cropPoint(const Vec2& pt) const; +}; + +template +std::ostream& operator<<( std::ostream& os, const Rect &r) +{ + os << "(" << r.tl << "-" << r.br << ")"; + return os; +} + + +typedef Rect FRect; +typedef Rect IntRect; + +template +Rect::Rect() +{} + +template +Rect::Rect(const Vec2& TL, const Vec2& BR) + : tl(TL), br(BR) +{} + +template +Rect::Rect(NUM left, NUM top, NUM right, NUM bottom) + : tl(left, top), + br(right, bottom) +{} + +template +template +Rect::Rect(const Rect& rc) + : tl (NUM(rc.tl.x), NUM(rc.tl.y)), + br (NUM(rc.br.x), NUM(rc.br.y)) +{ +} + +template +bool Rect::operator ==(const Rect & rect) const +{ + return (tl == rect.tl && br == rect.br); +} + +template +bool Rect::operator !=(const Rect & rect) const +{ + return !(rect==*this); +} + +template +NUM Rect::width() const +{ + return br.x-tl.x; +} + +template +NUM Rect::height() const +{ + return br.y-tl.y; +} + +template +glm::detail::tvec2 Rect::center() const +{ + return Vec2(tl+br)/2; +} + +template +void Rect::setWidth(NUM width) +{ + br.x = tl.x+width; +} + +template +void Rect::setHeight(NUM height) +{ + br.y = tl.y+height; +} + +template +void Rect::setSize(const Vec2& size) +{ + setWidth(size.x); + setHeight(size.y); +} + +template +bool Rect::contains(const Vec2& pt) const +{ + return (pt.x >= tl.x && pt.x < br.x && + pt.y >= tl.y && pt.y < br.y); +} + +template +bool Rect::contains(const Rect& rect) const +{ + Vec2 brpt (rect.br.x-1, rect.br.y-1); + return Contains(rect.tl) && Contains(brpt); +} + +template +bool Rect::intersects(const Rect& rect) const +{ + if (rect.br.x <= tl.x || rect.tl.x >= br.x || + rect.br.y <= tl.y || rect.tl.y >= br.y) + return false; + else + return true; +} + +template +void Rect::expand(const Rect& rect) +{ + tl.x = glm::min(tl.x, rect.tl.x); + tl.y = glm::min(tl.y, rect.tl.y); + br.x = glm::max(br.x, rect.br.x); + br.y = glm::max(br.y, rect.br.y); +} + +template +void Rect::intersect(const Rect& rect) +{ + tl.x = glm::max(tl.x, rect.tl.x); + tl.y = glm::max(tl.y, rect.tl.y); + br.x = glm::min(br.x, rect.br.x); + br.y = glm::min(br.y, rect.br.y); +} + +template +glm::detail::tvec2 Rect::size() const +{ + return Vec2(width(), height()); +} + +template +glm::detail::tvec2 Rect::cropPoint(const Vec2& pt) const +{ + Vec2 Result; + Result.x = std::min(std::max(pt.x, tl.x), br.x-1); + Result.y = std::min(std::max(pt.y, tl.y), br.y-1); + return Result; +} + +#undef min +#undef max + +} + +#endif + diff --git a/src/base/ScopeTimer.cpp b/src/base/ScopeTimer.cpp new file mode 100644 index 0000000..eb95736 --- /dev/null +++ b/src/base/ScopeTimer.cpp @@ -0,0 +1,35 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#include "ScopeTimer.h" + +using namespace std; + +namespace avg { + +bool ScopeTimer::s_bTimersEnabled = false; + +void ScopeTimer::enableTimers(bool bEnable) +{ + s_bTimersEnabled = bEnable; +} + +} diff --git a/src/base/ScopeTimer.h b/src/base/ScopeTimer.h new file mode 100644 index 0000000..a87263f --- /dev/null +++ b/src/base/ScopeTimer.h @@ -0,0 +1,60 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#ifndef _ScopeTimer_H_ +#define _ScopeTimer_H_ + +#include "../api.h" +#include "ProfilingZoneID.h" +#include "ThreadProfiler.h" + +namespace avg { + +class AVG_API ScopeTimer { +public: + ScopeTimer(ProfilingZoneID& zoneID) + { + if (s_bTimersEnabled) { + m_pZoneID = &zoneID; + m_pZoneID->getProfiler()->startZone(zoneID); + } else { + m_pZoneID = 0; + } + }; + + ~ScopeTimer() + { + if (m_pZoneID) { + m_pZoneID->getProfiler()->stopZone(*m_pZoneID); + } + }; + + static void enableTimers(bool bEnable); + +private: + ProfilingZoneID* m_pZoneID; + + static bool s_bTimersEnabled; +}; + +} + +#endif diff --git a/src/base/Signal.h b/src/base/Signal.h new file mode 100644 index 0000000..b670822 --- /dev/null +++ b/src/base/Signal.h @@ -0,0 +1,119 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#ifndef _Signal_H_ +#define _Signal_H_ + +#include "../api.h" + +#include "Exception.h" + +#include + +namespace avg { + + +// Simple implementation of a signal/slot mechanism. +// Might need to be replaced by boost::signal when things get more complicated. +template +class AVG_TEMPLATE_API Signal { +public: + typedef void (LISTENEROBJ::*ListenerFunc)() ; + Signal(ListenerFunc pFunc); + virtual ~Signal(); + + void connect(LISTENEROBJ* pListener); + void disconnect(LISTENEROBJ* pListener); + + void emit(); + int getNumListeners() const; + +private: + ListenerFunc m_pFunc; + std::list m_Listeners; + typedef typename std::list::iterator ListenerIterator; + LISTENEROBJ* m_pCurrentListener; + bool m_bKillCurrentListener; +}; + +template +Signal::Signal(ListenerFunc pFunc) + : m_pFunc(pFunc), + m_pCurrentListener(0), + m_bKillCurrentListener(false) +{ +} + +template +Signal::~Signal() +{ +} + +template +void Signal::connect(LISTENEROBJ* pListener) +{ + ListenerIterator it; + it = find(m_Listeners.begin(), m_Listeners.end(), pListener); + // If the listener is already connected, something is wrong, unless we're + // deleting it at this very moment. + AVG_ASSERT(it == m_Listeners.end() || + (*it == m_pCurrentListener && m_bKillCurrentListener)); + m_Listeners.push_back(pListener); +} + +template +void Signal::disconnect(LISTENEROBJ* pListener) +{ + if (m_pCurrentListener == pListener) { + m_bKillCurrentListener = true; + } else { + ListenerIterator it; + it = find(m_Listeners.begin(), m_Listeners.end(), pListener); + AVG_ASSERT(it != m_Listeners.end()); + m_Listeners.erase(it); + } +} + +template +void Signal::emit() +{ + ListenerIterator it; + for (it=m_Listeners.begin(); it != m_Listeners.end();) { + m_pCurrentListener = *it; + ((*it)->*m_pFunc)(); // This is the actual call to the listener. + if (m_bKillCurrentListener) { + it = m_Listeners.erase(it); + m_bKillCurrentListener = false; + } else { + ++it; + } + } + m_pCurrentListener = 0; +} + +template +int Signal::getNumListeners() const +{ + return m_Listeners.size(); +} + +} +#endif diff --git a/src/base/StandardLogSink.cpp b/src/base/StandardLogSink.cpp new file mode 100644 index 0000000..510aa0b --- /dev/null +++ b/src/base/StandardLogSink.cpp @@ -0,0 +1,54 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de + +#include "StandardLogSink.h" +#include "Logger.h" + +#include +#include + +using namespace std; + +namespace avg +{ + +StandardLogSink::StandardLogSink() +{ + +} + +StandardLogSink::~StandardLogSink() +{ + +} + +void StandardLogSink::logMessage(const tm* pTime, unsigned millis, + const category_t& category, severity_t severity, const UTF8String& sMsg) +{ + char timeString[256]; + strftime(timeString, sizeof(timeString), "%y-%m-%d %H:%M:%S", pTime); + cerr << "[" << timeString << "." << + setw(3) << setfill('0') << millis << setw(0) << "]["; + cerr << setw(4) << setfill('.') << Logger::severityToString(severity) << "]["; + cerr << setw(9) << setfill('.') << category << "] : " << sMsg << endl; + cerr.flush(); +} + +} diff --git a/src/base/StandardLogSink.h b/src/base/StandardLogSink.h new file mode 100644 index 0000000..7cbfe2c --- /dev/null +++ b/src/base/StandardLogSink.h @@ -0,0 +1,39 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de + +#ifndef _StandardLogSink_H_ +#define _StandardLogSink_H_ + +#include "ILogSink.h" + +namespace avg{ + +class StandardLogSink: public ILogSink +{ +public: + StandardLogSink(); + virtual ~StandardLogSink (); + + virtual void logMessage(const tm* pTime, unsigned millis, const category_t& category, + severity_t severity, const UTF8String& sMsg); +}; + +} +#endif diff --git a/src/base/StringHelper.cpp b/src/base/StringHelper.cpp new file mode 100644 index 0000000..6155859 --- /dev/null +++ b/src/base/StringHelper.cpp @@ -0,0 +1,145 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#include "StringHelper.h" + +#include +#include +#include +#include +#include + +using namespace std; + +namespace avg { + +bool isWhitespace(const string& s) +{ + return s.find_first_not_of(" \n\r\t") == s.npos; +} + +void skipWhitespace(std::istream& is) +{ + string sWhitespace(" \n\r\t"); + bool bWhitespace; + do { + int i = is.peek(); + if (i == EOF) { + bWhitespace = false; + } else { + bWhitespace = (sWhitespace.find(char(i)) != sWhitespace.npos); + } + if (bWhitespace) { + is.ignore(); + } + } while (bWhitespace); +} + +void skipToken(std::istream& is, char token) +{ + skipWhitespace(is); + int i = is.peek(); + if (i == token) { + is.ignore(); + } else { + is.setstate(ios::failbit); + } +} + +int stringToInt(const string& s) +{ + int i; + fromString(s, i); + return i; +} + +float stringToFloat(const string& s) +{ + float d; + fromString(s, d); + return d; +} + +bool stringToBool(const string& s) +{ + // avg usually wants xml attributes in lowercase, but python only + // sees 'True' as true, so we'll accept that too. Also, python 2.3 + // has 1 as true, so that has to be ok too. + if (s == "True" || s == "true" || s == "1") { + return true; + } + if (s == "False" || s == "false" || s == "0") { + return false; + } + throw (Exception(AVG_ERR_TYPE, string("Could not convert ")+s+" to bool.")); +} + +std::string removeStartEndSpaces(const string& s) +{ + string sResult = s; + while (sResult.size() > 0 && (sResult[0] == ' ' || sResult[0] == '\n' + || sResult[0] == '\r' || sResult[0] == '\t')) + { + sResult.erase(0, 1); + } + if (sResult.size() == 0) { + return sResult; + } + char c = sResult[sResult.length()-1]; + while (c == ' ' || c == '\n' || c == '\r' || c == '\t') { + sResult.erase(sResult.length()-1, 1); + c = sResult[sResult.length()-1]; + } + return sResult; +} + +string toLowerCase(const string& s) +{ + string sResult; + for (unsigned i=0; i +#include +#include +#include +#include + +#ifdef __GNUC__ +#include +#endif + +namespace avg { + +bool AVG_API isWhitespace(const std::string& s); +void AVG_API skipWhitespace(std::istream& is); +void AVG_API skipToken(std::istream& is, char token); + +template +std::istream& operator >>(std::istream& is, std::vector& v) +{ + skipToken(is, '('); + skipWhitespace(is); + int c = is.peek(); + if (c == ')') { + is.ignore(); + return is; + } + bool bDone = false; + do { + T elem; + is >> elem; + v.push_back(elem); + skipWhitespace(is); + int c = is.peek(); + switch(c) { + case ',': + is.ignore(); + break; + case ')': + bDone = true; + is.ignore(); + break; + default: + is.setstate(std::ios::failbit); + bDone = true; + } + } while (!bDone); + return is; +} + +int AVG_API stringToInt(const std::string& s); +float AVG_API stringToFloat(const std::string& s); +bool AVG_API stringToBool(const std::string& s); + +std::string AVG_API removeStartEndSpaces(const std::string& s); + +std::string AVG_API toLowerCase(const std::string& s); + +bool AVG_API equalIgnoreCase(const std::string& s1, const std::string& s2); + +template +std::string toString(const T& i) +{ + std::stringstream stream; + stream << i; + return stream.str(); +} + +std::string AVG_API toString(const bool& b); + +template +std::string getFriendlyTypeName(const T& dummy) +{ + std::string sTypeName = typeid(T).name(); +#ifdef __GNUC__ + int status; + char* const pClearName = abi::__cxa_demangle (sTypeName.c_str(), 0, 0, &status); + if (status == 0) { + sTypeName = pClearName; + } +#endif + return sTypeName; +} + +template +void fromString(const std::string& s, T& result) +{ + std::stringstream stream(s); + bool bOk = (stream >> result) != 0; + if (bOk) { + std::string sLeftover; + stream >> sLeftover; + bOk = isWhitespace(sLeftover); + } + if (!bOk) { + std::string sTypeName = getFriendlyTypeName(result); + throw (Exception(AVG_ERR_TYPE, std::string("Could not convert '")+s + + "' to "+sTypeName+".")); + } +} + + +} + + + +#endif diff --git a/src/base/Test.cpp b/src/base/Test.cpp new file mode 100644 index 0000000..b2c0b12 --- /dev/null +++ b/src/base/Test.cpp @@ -0,0 +1,114 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#include "Test.h" + +#include "../base/OSHelper.h" + +#include +#include + +using namespace std; + +namespace avg { + +string Test::s_sSrcDirName; + +Test::Test(const string & sName, int indentLevel) + : m_IndentLevel(indentLevel), + m_NumSucceeded(0), + m_NumFailed(0), + m_sName(sName) +{ +} + +Test::~Test() +{ +} + +void Test::test(bool b, const char * pszFile, int line) +{ + if (b) { + m_NumSucceeded++; + } else { + cerr << string(m_IndentLevel, ' ') << " ---->> failed at " << pszFile + << ", " << line << endl; + m_NumFailed++; + } +} + + +bool Test::isOk() +{ + return m_NumFailed == 0; +} + +void Test::setFailed() +{ + m_NumFailed++; +} + +int Test::getNumSucceeded() const +{ + return m_NumSucceeded; +} + +int Test::getNumFailed() const +{ + return m_NumFailed; +} + +const std::string& Test::getName() const +{ + return m_sName; +} + +void Test::aggregateStatistics(const Test& ChildTest) +{ + m_NumSucceeded += ChildTest.getNumSucceeded(); + m_NumFailed += ChildTest.getNumFailed(); +} + +void Test::printResults() +{ + if (m_NumFailed == 0) { + cerr << string(m_IndentLevel, ' ') << m_sName << " succeeded." << endl; + } else { + cerr << string(m_IndentLevel, ' ') << "######## " << m_sName << + " failed. ########" << endl; + } + +} + +const string& Test::getSrcDirName() +{ + if (s_sSrcDirName == "") { + bool bInEnviron = getEnv("srcdir", s_sSrcDirName); + if (!bInEnviron) { + s_sSrcDirName = "."; + } + s_sSrcDirName += "/"; + } + return s_sSrcDirName; +} + +} + diff --git a/src/base/Test.h b/src/base/Test.h new file mode 100644 index 0000000..0cc20ba --- /dev/null +++ b/src/base/Test.h @@ -0,0 +1,81 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#ifndef _Test_H_ +#define _Test_H_ + +#include "../api.h" +#include + +#include +#include +#include + +namespace avg { +class AVG_API Test +{ +public: + Test(const std::string & sName, int indentLevel); + virtual ~Test(); + + bool isOk(); + virtual void runTests() = 0; + + void test(bool b, const char * pszFile, int line); + void setFailed(); + + int getNumSucceeded() const; + int getNumFailed() const; + const std::string& getName() const; + + void aggregateStatistics(const Test& childTest); + virtual void printResults(); + +protected: + static const std::string& getSrcDirName(); + static std::string s_sSrcDirName; + + int m_IndentLevel; + +private: + int m_NumSucceeded; + int m_NumFailed; + std::string m_sName; +}; + +typedef boost::shared_ptr TestPtr; + +#define TEST_FAILED(s) \ + cerr << string(m_IndentLevel+6, ' ') << s << endl; \ + test(false, __FILE__, __LINE__); + +#define TEST(b) \ + cerr << string(m_IndentLevel+4, ' ') << " TEST(" << #b << ")" << endl; \ + test(b, __FILE__, __LINE__); + +#define QUIET_TEST(b) \ + if(!(b)) { \ + cerr << string(m_IndentLevel+4, ' ') << " TEST(" << #b << ")" << endl; \ + } \ + test(b, __FILE__, __LINE__); +} +#endif + diff --git a/src/base/TestSuite.cpp b/src/base/TestSuite.cpp new file mode 100644 index 0000000..16a254c --- /dev/null +++ b/src/base/TestSuite.cpp @@ -0,0 +1,72 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#include "TestSuite.h" +#include "Exception.h" + +using namespace std; + +namespace avg { + +TestSuite::TestSuite(const string& sName) + : Test(sName, 0) +{ +} + +TestSuite::~TestSuite() +{ +} + +void TestSuite::addTest(TestPtr pNewTest) +{ + m_Tests.push_back(pNewTest); +} + +void TestSuite::runTests() +{ + cerr << string(m_IndentLevel, ' ') << "Running suite " << getName() << endl; + for (unsigned i = 0; i < m_Tests.size(); ++i) { + cerr << string(m_IndentLevel, ' ') << " Running " + << m_Tests[i]->getName() << endl; + try { + m_Tests[i]->runTests(); + aggregateStatistics(*m_Tests[i]); + m_Tests[i]->printResults(); + } catch (Exception& ex) { + cerr << string(m_IndentLevel, ' ') << ex.getStr() << endl; + setFailed(); + } catch (std::exception& ex) { + cerr << string(m_IndentLevel, ' ') << " ---->> failed, std::exception: " + << ex.what() << endl; + setFailed(); + } catch (...) { + cerr << string(m_IndentLevel, ' ') << + " ---->> failed, exception caught" << endl; + setFailed(); + } + } + + printResults(); +} + + +} + diff --git a/src/base/TestSuite.h b/src/base/TestSuite.h new file mode 100644 index 0000000..124bbc2 --- /dev/null +++ b/src/base/TestSuite.h @@ -0,0 +1,49 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#ifndef _TestSuite_H_ +#define _TestSuite_H_ + +#include "../api.h" +#include "Test.h" + +#include +#include +#include + +namespace avg { +class AVG_API TestSuite: public Test +{ +public: + TestSuite(const std::string& sName); + virtual ~TestSuite(); + + void addTest(TestPtr pNewTest); + + virtual void runTests(); + +private: + std::vector m_Tests; +}; + +} +#endif + diff --git a/src/base/ThreadHelper.cpp b/src/base/ThreadHelper.cpp new file mode 100644 index 0000000..105e116 --- /dev/null +++ b/src/base/ThreadHelper.cpp @@ -0,0 +1,94 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#include "ThreadHelper.h" +#include "OSHelper.h" + +#ifdef _WIN32 +#include +#endif + +namespace avg { + +void setAffinityMask(bool bIsMainThread) +{ + // The main thread gets the first processor to itself. All other threads share the + // rest of the processors available, unless, of course, there is only one processor + // in the machine. +#ifdef linux + static cpu_set_t allProcessors; + static bool bInitialized = false; + if (!bInitialized) { + int rc = sched_getaffinity(0, sizeof(allProcessors), &allProcessors); + AVG_ASSERT(rc == 0); +// cerr << "All processors: "; +// printAffinityMask(allProcessors); + bInitialized = true; + } + cpu_set_t mask; + if (bIsMainThread) { + CPU_ZERO(&mask); + CPU_SET(0, &mask); +// cerr << "Main Thread: "; + } else { + mask = allProcessors; + if (CPU_COUNT(&mask) > 1) { + CPU_CLR(0, &mask); + } +// cerr << "Aux Thread: "; + } +// printAffinityMask(mask); + int rc = sched_setaffinity(0, sizeof(mask), &mask); + AVG_ASSERT(rc == 0); +#elif defined _WIN32 + DWORD processAffinityMask; + DWORD systemAffinityMask; + BOOL rc = GetProcessAffinityMask(GetCurrentProcess(), &processAffinityMask, + &systemAffinityMask); + AVG_ASSERT(rc == TRUE); + DWORD mainThreadMask = 1 << getLowestBitSet(processAffinityMask); + DWORD mask; + if (bIsMainThread) { + mask = mainThreadMask; + } else { + mask = processAffinityMask & ~mainThreadMask; + if (mask == 0) { + mask = processAffinityMask; + } + } + DWORD_PTR pPrevMask = SetThreadAffinityMask(GetCurrentThread(), mask); + AVG_ASSERT_MSG(pPrevMask != 0, getWinErrMsg(GetLastError()).c_str()); +#endif +} + +unsigned getLowestBitSet(unsigned val) +{ + AVG_ASSERT(val != 0); // Doh + + unsigned pos = 0; + while (!(val & 1)) { + val >>= 1; + ++pos; + } + return pos; +} + +} diff --git a/src/base/ThreadHelper.h b/src/base/ThreadHelper.h new file mode 100644 index 0000000..7acf640 --- /dev/null +++ b/src/base/ThreadHelper.h @@ -0,0 +1,37 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#ifndef _ThreadHelper_H_ +#define _ThreadHelper_H_ + +#include "Exception.h" +#include +#include + +namespace avg { + +void AVG_API setAffinityMask(bool bIsMainThread); +typedef boost::lock_guard lock_guard; +unsigned getLowestBitSet(unsigned val); + +} + +#endif diff --git a/src/base/ThreadProfiler.cpp b/src/base/ThreadProfiler.cpp new file mode 100644 index 0000000..1f1a354 --- /dev/null +++ b/src/base/ThreadProfiler.cpp @@ -0,0 +1,184 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#include "ThreadProfiler.h" + +#include "Logger.h" +#include "Exception.h" +#include "ProfilingZone.h" +#include "ScopeTimer.h" + +#include +#include +#include + +using namespace std; +using namespace boost; + +namespace avg { + +thread_specific_ptr ThreadProfiler::s_pInstance; + +ThreadProfiler* ThreadProfiler::get() +{ + if (s_pInstance.get() == 0) { + s_pInstance.reset(new (ThreadProfiler*)); + *s_pInstance = new ThreadProfiler(); + } + return *s_pInstance; +} + +void ThreadProfiler::kill() +{ + delete *s_pInstance; + s_pInstance.reset(); +} + +ThreadProfiler::ThreadProfiler() + : m_sName(""), + m_LogCategory(Logger::category::PROFILE) +{ + m_bRunning = false; + ScopeTimer::enableTimers(Logger::get()->shouldLog(m_LogCategory, + Logger::severity::INFO)); +} + +ThreadProfiler::~ThreadProfiler() +{ +} + +void ThreadProfiler::setLogCategory(category_t category) +{ + AVG_ASSERT(!m_bRunning); + m_LogCategory = category; +} + +void ThreadProfiler::start() +{ + m_bRunning = true; +} + +void ThreadProfiler::restart() +{ + ZoneVector::iterator it; + for (it = m_Zones.begin(); it != m_Zones.end(); ++it) { + (*it)->restart(); + } +} + +void ThreadProfiler::startZone(const ProfilingZoneID& zoneID) +{ + ZoneMap::iterator it = m_ZoneMap.find(&zoneID); + // Duplicated code to avoid instantiating a new smart pointer when it's not + // necessary. + if (it == m_ZoneMap.end()) { + ProfilingZonePtr pZone = addZone(zoneID); + pZone->start(); + m_ActiveZones.push_back(pZone); + } else { + ProfilingZonePtr& pZone = it->second; + pZone->start(); + m_ActiveZones.push_back(pZone); + } +} + +void ThreadProfiler::stopZone(const ProfilingZoneID& zoneID) +{ + ZoneMap::iterator it = m_ZoneMap.find(&zoneID); + ProfilingZonePtr& pZone = it->second; + pZone->stop(); + m_ActiveZones.pop_back(); +} + +void ThreadProfiler::dumpStatistics() +{ + if (!m_Zones.empty()) { + AVG_TRACE(m_LogCategory, Logger::severity::INFO, "Thread " << m_sName); + AVG_TRACE(m_LogCategory, Logger::severity::INFO, + "Zone name Avg. time"); + AVG_TRACE(m_LogCategory, Logger::severity::INFO, + "--------- ---------"); + + ZoneVector::iterator it; + for (it = m_Zones.begin(); it != m_Zones.end(); ++it) { + AVG_TRACE(m_LogCategory, Logger::severity::INFO, + std::setw(35) << std::left + << ((*it)->getIndentString()+(*it)->getName()) + << std::setw(9) << std::right << (*it)->getAvgUSecs()); + } + AVG_TRACE(m_LogCategory, Logger::severity::INFO, ""); + } +} + +void ThreadProfiler::reset() +{ + ZoneVector::iterator it; + for (it = m_Zones.begin(); it != m_Zones.end(); ++it) { + (*it)->reset(); + } +} + +int ThreadProfiler::getNumZones() +{ + return m_Zones.size(); +} + +const std::string& ThreadProfiler::getName() const +{ + return m_sName; +} + +void ThreadProfiler::setName(const std::string& sName) +{ + m_sName = sName; +} + + +ProfilingZonePtr ThreadProfiler::addZone(const ProfilingZoneID& zoneID) +{ + ProfilingZonePtr pZone(new ProfilingZone(zoneID)); + m_ZoneMap[&zoneID] = pZone; + ZoneVector::iterator it; + int parentIndent = -2; + if (m_ActiveZones.empty()) { + it = m_Zones.end(); + } else { + ProfilingZonePtr pActiveZone = m_ActiveZones.back(); + bool bParentFound = false; + for (it = m_Zones.begin(); it != m_Zones.end(); ++it) + { + if (pActiveZone == *it) { + bParentFound = true; + break; + } + } + AVG_ASSERT(bParentFound); + parentIndent = pActiveZone->getIndentLevel(); + ++it; + for (; it != m_Zones.end() && (*it)->getIndentLevel() > parentIndent; ++it) {}; + } + m_Zones.insert(it, pZone); + pZone->setIndentLevel(parentIndent+2); + return pZone; +} + +} + diff --git a/src/base/ThreadProfiler.h b/src/base/ThreadProfiler.h new file mode 100644 index 0000000..a581271 --- /dev/null +++ b/src/base/ThreadProfiler.h @@ -0,0 +1,88 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#ifndef _ThreadProfiler_H_ +#define _ThreadProfiler_H_ + +#include "../api.h" +#include "ILogSink.h" + +#include +#include +#include + +#include +#include +#if defined(_WIN32) || defined(_LIBCPP_VERSION) +#include +#else +#include +#endif +namespace avg { + +class ThreadProfiler; +typedef boost::shared_ptr ThreadProfilerPtr; +class ProfilingZone; +typedef boost::shared_ptr ProfilingZonePtr; +class ProfilingZoneID; + +class AVG_API ThreadProfiler +{ +public: + static ThreadProfiler* get(); + static void kill(); + ThreadProfiler(); + virtual ~ThreadProfiler(); + void setLogCategory(category_t category); + + void start(); + void restart(); + void startZone(const ProfilingZoneID& zoneID); + void stopZone(const ProfilingZoneID& zoneID); + void dumpStatistics(); + void reset(); + int getNumZones(); + + const std::string& getName() const; + void setName(const std::string& sName); + +private: + ProfilingZonePtr addZone(const ProfilingZoneID& zoneID); + std::string m_sName; + +#if defined(_WIN32) || defined(_LIBCPP_VERSION) + typedef std::unordered_map ZoneMap; +#else + typedef std::tr1::unordered_map ZoneMap; +#endif + typedef std::vector ZoneVector; + ZoneMap m_ZoneMap; + ZoneVector m_ActiveZones; + ZoneVector m_Zones; + bool m_bRunning; + category_t m_LogCategory; + + static boost::thread_specific_ptr s_pInstance; +}; + +} + +#endif diff --git a/src/base/TimeSource.cpp b/src/base/TimeSource.cpp new file mode 100644 index 0000000..e90575d --- /dev/null +++ b/src/base/TimeSource.cpp @@ -0,0 +1,128 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#include "TimeSource.h" + +#include "Logger.h" +#include "Exception.h" + +#ifdef _WIN32 +#include +#include +#include +#include +#else +#include +#endif +#include +#include + +#include +#include +#include +#include +#include + +using namespace std; + +namespace avg { + +TimeSource* TimeSource::m_pTimeSource = 0; + +TimeSource * TimeSource::get() +{ + if (!m_pTimeSource) { +#ifdef _WIN32 + TIMECAPS tc; + UINT wTimerRes; + MMRESULT err = timeGetDevCaps(&tc, sizeof(TIMECAPS)); + AVG_ASSERT(err == TIMERR_NOERROR); + wTimerRes = max(tc.wPeriodMin, 1); + timeBeginPeriod(wTimerRes); +#endif + m_pTimeSource = new TimeSource; + } + return m_pTimeSource; +} + +TimeSource::TimeSource() +{ +#ifdef __APPLE__ + mach_timebase_info(&m_TimebaseInfo); +#endif +} + +TimeSource::~TimeSource() +{ +} + +long long TimeSource::getCurrentMillisecs() +{ + return getCurrentMicrosecs()/1000; +} + +long long TimeSource::getCurrentMicrosecs() +{ +#ifdef _WIN32 + return (long long)(timeGetTime())*1000; +#else +#ifdef __APPLE__ + long long systemTime = mach_absolute_time(); + return (systemTime * m_TimebaseInfo.numer/m_TimebaseInfo.denom)/1000; +#else + struct timespec now; + int rc = clock_gettime(CLOCK_MONOTONIC, &now); + assert(rc == 0); + return ((long long)now.tv_sec)*1000000+now.tv_nsec/1000; +#endif +#endif +} + +void TimeSource::sleepUntil(long long targetTime) +{ + long long now = getCurrentMillisecs(); +#ifdef __APPLE__ + if (targetTime > now) { + msleep(targetTime-now); + } +#else + while (now +#endif + +namespace avg { + + +// This class is a monotonic time source with an undefined start time. Time is guarranteed +// to increase monotonically. The time source has no jumps and does not go backwards, +// even if system time is changed. +class AVG_API TimeSource { +public: + static TimeSource* get(); + virtual ~TimeSource(); + + long long getCurrentMillisecs(); + long long getCurrentMicrosecs(); + + void sleepUntil(long long targetTime); + +private: + TimeSource(); +#ifdef __APPLE__ + mach_timebase_info_data_t m_TimebaseInfo; +#endif + + static TimeSource* m_pTimeSource; +}; + +void AVG_API msleep(int millisecs); + +} + +#endif diff --git a/src/base/Triangle.cpp b/src/base/Triangle.cpp new file mode 100644 index 0000000..7efe9f7 --- /dev/null +++ b/src/base/Triangle.cpp @@ -0,0 +1,105 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#include "Triangle.h" + +#include "GLMHelper.h" + +#include + +namespace avg { + +Triangle::Triangle(const glm::vec2& P0, const glm::vec2& P1, const glm::vec2& P2) + : p0(P0), + p1(P1), + p2(P2) +{ +} + +Triangle::Triangle() +{ +} + +bool Triangle::operator ==(const Triangle & tri) const +{ + return (p0 == tri.p0 && p1 == tri.p1 && p2 == tri.p2); +} + +bool Triangle::isInside(const glm::vec2& pt) const +{ +/* Slower func that only works for cw triangles. + + glm::vec2 a = p2-p1; + glm::vec2 bp = pt-p1; + float aCROSSbp = a.x*bp.y - a.y*bp.x; + if (aCROSSbp < 0.0) { + return false; + } + + glm::vec2 b = p0-p2; + glm::vec2 cp = pt-p2; + float bCROSScp = b.x*cp.y - b.y*cp.x; + if (bCROSScp < 0.0) { + return false; + } + + glm::vec2 c = p1-p0; + glm::vec2 ap = pt-p0; + float cCROSSap = c.x*ap.y - c.y*ap.x; + return cCROSSap >= 0.0; +*/ + glm::vec2 v0 = p2 - p0; + glm::vec2 v1 = p1 - p0; + glm::vec2 v2 = pt - p0; + + float dot00 = glm::dot(v0, v0); + float dot01 = glm::dot(v0, v1); + float dot02 = glm::dot(v0, v2); + float dot11 = glm::dot(v1, v1); + float dot12 = glm::dot(v1, v2); + + float invDenom = 1 / (dot00 * dot11 - dot01 * dot01); + float u = (dot11 * dot02 - dot01 * dot12) * invDenom; + float v = (dot00 * dot12 - dot01 * dot02) * invDenom; + + return (u > 0) && (v > 0) && (u + v < 1); + +} + +float Triangle::getArea() const +{ + return fabs((((p1.x-p0.x)*(p2.y-p0.y)) - ((p1.y-p0.y)*(p2.x-p0.x)))/2); +} + +bool Triangle::isClockwise() const +{ + return ((p1.x-p0.x)*(p2.y-p0.y)) - ((p1.y-p0.y)*(p2.x-p0.x)) < 0; +} + +std::ostream& operator<<(std::ostream& os, const Triangle& tri) +{ + os << "(" << tri.p0 << "," << tri.p1 << "," << tri.p2 << ")"; + return os; +} + + +} + diff --git a/src/base/Triangle.h b/src/base/Triangle.h new file mode 100644 index 0000000..21ad35f --- /dev/null +++ b/src/base/Triangle.h @@ -0,0 +1,52 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#ifndef _Triangle_H_ +#define _Triangle_H_ + +#include "../api.h" + +#include "../glm/glm.hpp" + +#include + +namespace avg { + +struct AVG_API Triangle { +public: + glm::vec2 p0; + glm::vec2 p1; + glm::vec2 p2; + + Triangle(const glm::vec2& P0, const glm::vec2& P1, const glm::vec2& P2); + Triangle(); + + bool operator ==(const Triangle & tri) const; + bool isInside(const glm::vec2& pt) const; + float getArea() const; + bool isClockwise() const; +}; + +std::ostream& operator<<(std::ostream& os, const Triangle& tri); + +} + +#endif diff --git a/src/base/UTF8String.cpp b/src/base/UTF8String.cpp new file mode 100644 index 0000000..4855364 --- /dev/null +++ b/src/base/UTF8String.cpp @@ -0,0 +1,62 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#include "UTF8String.h" + +#include + +using namespace std; + +namespace avg { + +UTF8String::UTF8String() +{ +} + +UTF8String::UTF8String(const string& s) + : string(s) +{ +} + +UTF8String::UTF8String(const char * psz) + : string(psz) +{ + +} + +UTF8String& UTF8String::operator =(const string& s) +{ + *dynamic_cast(this) = s; + return *this; +} + +UTF8String& UTF8String::operator =(const char* psz) +{ + *dynamic_cast(this) = psz; + return *this; +} + +std::size_t hash_value(const avg::UTF8String& x) +{ + boost::hash hasher; + return hasher(x); +}; +} diff --git a/src/base/UTF8String.h b/src/base/UTF8String.h new file mode 100644 index 0000000..3cee69d --- /dev/null +++ b/src/base/UTF8String.h @@ -0,0 +1,46 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#ifndef _UTF8String_H_ +#define _UTF8String_H_ + +#include "../api.h" +#include +#include + +namespace avg { + +class AVG_TEMPLATE_API UTF8String: public std::string +{ +public: + UTF8String(); + UTF8String(const std::string& s); + UTF8String(const char * psz); + + UTF8String& operator =(const std::string& s); + UTF8String& operator =(const char * psz); + +}; + +std::size_t hash_value(const avg::UTF8String& x); + +} +#endif diff --git a/src/base/WideLine.cpp b/src/base/WideLine.cpp new file mode 100644 index 0000000..84f4096 --- /dev/null +++ b/src/base/WideLine.cpp @@ -0,0 +1,53 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#include "WideLine.h" + +#include "GLMHelper.h" + +namespace avg { + +WideLine::WideLine(const glm::vec2& p0, const glm::vec2& p1, float width) + : pt0(p0), + pt1(p1) +{ + glm::vec2 m = glm::normalize(pt1-pt0); + glm::vec2 w = glm::vec2(m.y, -m.x)*(width/2); + pl0 = p0-w; + pr0 = p0+w; + pl1 = p1-w; + pr1 = p1+w; + dir = glm::vec2(w.y, -w.x); +} + +float WideLine::getLen() const +{ + return glm::length(pt1-pt0); +} + +std::ostream& operator<<(std::ostream& os, const WideLine& line) +{ + os << "(" << line.pt0 << "," << line.pt1 << ")"; + return os; +} + +} + diff --git a/src/base/WideLine.h b/src/base/WideLine.h new file mode 100644 index 0000000..28584ef --- /dev/null +++ b/src/base/WideLine.h @@ -0,0 +1,48 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#ifndef _WideLine_H_ +#define _WideLine_H_ + +#include "../api.h" + +#include "../glm/glm.hpp" + +#include + +namespace avg { + +struct AVG_API WideLine { + WideLine(const glm::vec2& p0, const glm::vec2& p1, float width); + + float getLen() const; + + glm::vec2 pt0, pt1; + glm::vec2 pl0, pl1; + glm::vec2 pr0, pr1; + glm::vec2 dir; +}; + +std::ostream& operator<<(std::ostream& os, const WideLine& line); + +} + +#endif diff --git a/src/base/WorkerThread.cpp b/src/base/WorkerThread.cpp new file mode 100644 index 0000000..f2efb0a --- /dev/null +++ b/src/base/WorkerThread.cpp @@ -0,0 +1,41 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#include "WorkerThread.h" + +#include "OSHelper.h" + +namespace avg { + +using namespace std; + +#ifdef linux +void printAffinityMask(cpu_set_t& mask) +{ + for (int i=0; i<32; ++i) { + cerr << int(CPU_ISSET(i, &mask)); + } + cerr << endl; +} +#endif + +} + diff --git a/src/base/WorkerThread.h b/src/base/WorkerThread.h new file mode 100644 index 0000000..c4cc3c4 --- /dev/null +++ b/src/base/WorkerThread.h @@ -0,0 +1,169 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#ifndef _WorkerThread_H_ +#define _WorkerThread_H_ + +#include "../api.h" +#include "Command.h" +#include "Exception.h" +#include "Logger.h" +#include "Queue.h" +#include "ThreadHelper.h" +#include "ThreadProfiler.h" +#include "CmdQueue.h" + +#include + +#include + +namespace avg { + + +template +class AVG_TEMPLATE_API WorkerThread { +public: + typedef Command Cmd; + typedef typename boost::shared_ptr CmdPtr; + typedef CmdQueue CQueue; + typedef typename boost::shared_ptr CQueuePtr; + + WorkerThread(const std::string& sName, CQueue& CmdQ, + category_t logCategory=Logger::category::PROFILE); + WorkerThread(WorkerThread const& other); + virtual ~WorkerThread(); + void operator()(); + + void waitForCommand(); + void stop(); + +protected: + int getNumCmdsInQueue() const; + +private: + virtual bool init(); + virtual bool work() = 0; + virtual void deinit() {}; + + void processCommands(); + + std::string m_sName; + bool m_bShouldStop; + CQueue& m_CmdQ; + category_t m_LogCategory; +}; + +template +WorkerThread::WorkerThread(const std::string& sName, CQueue& CmdQ, + category_t logCategory) + : m_sName(sName), + m_bShouldStop(false), + m_CmdQ(CmdQ), + m_LogCategory(logCategory) +{ +} + +template +WorkerThread::WorkerThread(WorkerThread const& other) + : m_CmdQ(other.m_CmdQ) +{ + m_sName = other.m_sName; + m_bShouldStop = other.m_bShouldStop; + m_LogCategory = other.m_LogCategory; +} + +template +WorkerThread::~WorkerThread() +{ +} + +template +void WorkerThread::operator()() +{ + try { + setAffinityMask(false); + ThreadProfiler* pProfiler = ThreadProfiler::get(); + pProfiler->setName(m_sName); + pProfiler->setLogCategory(m_LogCategory); + bool bOK; + bOK = init(); + if (!bOK) { + return; + } + pProfiler->start(); + while (!m_bShouldStop) { + bOK = work(); + if (!bOK) { + m_bShouldStop = true; + } + if (!m_bShouldStop) { + processCommands(); + } + } + deinit(); + pProfiler->dumpStatistics(); + pProfiler->kill(); + } catch (const Exception& e) { + AVG_LOG_ERROR("Uncaught exception in thread " << m_sName << ": " << e.getStr()); + throw; + } +} + +template +void WorkerThread::waitForCommand() +{ + CmdPtr pCmd = m_CmdQ.pop(true); + pCmd->execute(dynamic_cast(this)); +} + +template +void WorkerThread::stop() +{ + m_bShouldStop = true; +} + +template +int WorkerThread::getNumCmdsInQueue() const +{ + return m_CmdQ.size(); +} + +template +bool WorkerThread::init() +{ + return true; +} + +template +void WorkerThread::processCommands() +{ + CmdPtr pCmd = m_CmdQ.pop(false); + while (pCmd && !m_bShouldStop) { + pCmd->execute(dynamic_cast(this)); + if (!m_bShouldStop) { + pCmd = m_CmdQ.pop(false); + } + } +} + +} + +#endif diff --git a/src/base/XMLHelper.cpp b/src/base/XMLHelper.cpp new file mode 100644 index 0000000..6f362e8 --- /dev/null +++ b/src/base/XMLHelper.cpp @@ -0,0 +1,225 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#include "XMLHelper.h" +#include "Exception.h" +#include "Logger.h" + +#include +#include +#include + +using namespace std; + +namespace avg { + +string getXmlChildrenAsString(const xmlDocPtr xmlDoc, const xmlNodePtr& xmlNode) +{ + string s; + xmlBufferPtr pBuffer = xmlBufferCreate(); + xmlNodeDump(pBuffer, xmlDoc, xmlNode, 0, 0); + + s = (const char *)xmlBufferContent(pBuffer); + size_t StartPos = s.find('>')+1; + size_t EndPos = s.rfind('<')-1; + if (StartPos > EndPos) { + s = ""; + } else { + s = s.substr(StartPos, EndPos-StartPos+1); + } + xmlBufferFree(pBuffer); + return s; +} + +static xmlExternalEntityLoader DefaultLoaderProc = 0; +static std::map g_DTDMap; + +xmlParserInputPtr +DTDExternalEntityLoader(const char *pURL, const char *pID, xmlParserCtxtPtr ctxt) +{ + xmlParserInputPtr ret; + /* lookup for the fileID depending on ID */ + std::map::iterator it = g_DTDMap.find(pURL); + + if (it != g_DTDMap.end()) { + ret = xmlNewStringInputStream(ctxt, (const xmlChar *)(it->second.c_str())); + return(ret); + } else { + ret = DefaultLoaderProc(pURL, pID, ctxt); + return(ret); + } +} + +void registerDTDEntityLoader(const string& sID, const string& sDTD) +{ + g_DTDMap[sID] = sDTD; + if (!DefaultLoaderProc) { + DefaultLoaderProc = xmlGetExternalEntityLoader(); + } + xmlSetExternalEntityLoader(DTDExternalEntityLoader); +} + + +XMLParser::XMLParser() + : m_SchemaParserCtxt(0), + m_Schema(0), + m_SchemaValidCtxt(0), + m_DTD(0), + m_DTDValidCtxt(0), + m_Doc(0) +{ + xmlPedanticParserDefault(1); + xmlSetGenericErrorFunc(this, errorOutputFunc); + xmlDoValidityCheckingDefaultValue = 0; +} + +XMLParser::~XMLParser() +{ + if (m_Schema) { + xmlSchemaFree(m_Schema); + } + if (m_SchemaParserCtxt) { + xmlSchemaFreeParserCtxt(m_SchemaParserCtxt); + } + if (m_SchemaValidCtxt) { + xmlSchemaFreeValidCtxt(m_SchemaValidCtxt); + } + if (m_DTD) { + xmlFreeDtd(m_DTD); + } + if (m_DTDValidCtxt) { + xmlFreeValidCtxt(m_DTDValidCtxt); + } + if (m_Doc) { + xmlFreeDoc(m_Doc); + } + xmlSetGenericErrorFunc(0, 0); +} + +void XMLParser::setSchema(const string& sSchema, const string& sSchemaName) +{ + AVG_ASSERT(!m_SchemaParserCtxt); + AVG_ASSERT(!m_Schema); + AVG_ASSERT(!m_SchemaValidCtxt); + AVG_ASSERT(!m_DTD); + AVG_ASSERT(!m_DTDValidCtxt); + + m_SchemaParserCtxt = xmlSchemaNewMemParserCtxt(sSchema.c_str(), sSchema.length()); + checkError(!m_SchemaParserCtxt, sSchemaName); + + m_Schema = xmlSchemaParse(m_SchemaParserCtxt); + checkError(!m_Schema, sSchemaName); + + m_SchemaValidCtxt = xmlSchemaNewValidCtxt(m_Schema); + checkError(!m_SchemaValidCtxt, sSchemaName); +} + +void XMLParser::setDTD(const std::string& sDTD, const std::string& sDTDName) +{ + AVG_ASSERT(!m_SchemaParserCtxt); + AVG_ASSERT(!m_Schema); + AVG_ASSERT(!m_SchemaValidCtxt); + AVG_ASSERT(!m_DTD); + AVG_ASSERT(!m_DTDValidCtxt); + + registerDTDEntityLoader("memory.dtd", sDTD.c_str()); + string sDTDFName = "memory.dtd"; + m_DTD = xmlParseDTD(NULL, (const xmlChar*) sDTDFName.c_str()); + checkError(!m_DTD, sDTDName); + + m_DTDValidCtxt = xmlNewValidCtxt(); + checkError(!m_DTDValidCtxt, sDTDName); + m_DTDValidCtxt->error = xmlParserValidityError; + m_DTDValidCtxt->warning = xmlParserValidityWarning; +} + +void XMLParser::parse(const string& sXML, const string& sXMLName) +{ + if (m_Doc) { + xmlFreeDoc(m_Doc); + } + m_Doc = xmlParseMemory(sXML.c_str(), int(sXML.length())); + checkError(!m_Doc, sXMLName); + + bool bOK = true; + if (m_SchemaValidCtxt) { + int err = xmlSchemaValidateDoc(m_SchemaValidCtxt, m_Doc); + AVG_ASSERT(err != -1); + bOK = (err == 0); + } + if (m_DTD) { + int err = xmlValidateDtd(m_DTDValidCtxt, m_Doc, m_DTD); + bOK = (err != 0); + } + if (!bOK) { + xmlFreeDoc(m_Doc); + m_Doc = 0; + checkError(true, sXMLName); + } +} + +xmlDocPtr XMLParser::getDoc() +{ + AVG_ASSERT(m_Doc); + return m_Doc; +} + +xmlNodePtr XMLParser::getRootNode() +{ + AVG_ASSERT(m_Doc); + return xmlDocGetRootElement(m_Doc); +} + +void XMLParser::errorOutputFunc(void * ctx, const char * msg, ...) +{ + va_list args; + va_start(args, msg); + ((XMLParser*)ctx)->internalErrorHandler(msg, args); + va_end(args); +} + +void XMLParser::internalErrorHandler(const char * msg, va_list args) +{ + char psz[1024]; + vsnprintf(psz, 1024, msg, args); + m_sError += psz; +} + +void XMLParser::checkError(bool bError, const string& sXMLName) +{ + if (bError) { + string sError = "Error parsing "+sXMLName+".\n"; + sError += m_sError; + m_sError = ""; + throw (Exception(AVG_ERR_XML_PARSE, sError)); + } +} + +void validateXml(const string& sXML, const string& sSchema, const string& sXMLName, + const string& sSchemaName) +{ + XMLParser parser; + parser.setSchema(sSchema, sSchemaName); + + parser.parse(sXML, sXMLName); +} + +} diff --git a/src/base/XMLHelper.h b/src/base/XMLHelper.h new file mode 100644 index 0000000..e258de2 --- /dev/null +++ b/src/base/XMLHelper.h @@ -0,0 +1,78 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#ifndef _XMLHelper_H_ +#define _XMLHelper_H_ + +#include "../api.h" + +#include +#include +#include + +#include +#include +#include + +namespace avg { + +std::string getXmlChildrenAsString(const xmlDocPtr xmlDoc, const xmlNodePtr& xmlNode); + +void registerDTDEntityLoader(const std::string& sID, const std::string& sDTD); + +class XMLParser +{ +public: + XMLParser(); + virtual ~XMLParser(); + + void setSchema(const std::string& sSchema, const std::string& sSchemaName); + void setDTD(const std::string& sDTD, const std::string& sDTDName); + void parse(const std::string& sXML, const std::string& sXMLName); + + xmlDocPtr getDoc(); + xmlNodePtr getRootNode(); + +private: + static void errorOutputFunc(void * ctx, const char * msg, ...); + void internalErrorHandler(const char * msg, va_list args); + + void checkError(bool bError, const std::string& sXMLName); + + xmlSchemaParserCtxtPtr m_SchemaParserCtxt; + xmlSchemaPtr m_Schema; + xmlSchemaValidCtxtPtr m_SchemaValidCtxt; + + xmlDtdPtr m_DTD; + xmlValidCtxtPtr m_DTDValidCtxt; + + xmlDocPtr m_Doc; + + std::string m_sError; +}; + +void validateXml(const std::string& sXML, const std::string& sSchema, + const std::string& sXMLName, const std::string& sSchemaName); + +} + +#endif + diff --git a/src/base/testbase.cpp b/src/base/testbase.cpp new file mode 100644 index 0000000..57faf36 --- /dev/null +++ b/src/base/testbase.cpp @@ -0,0 +1,1024 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#include "DAG.h" +#include "Queue.h" +#include "Command.h" +#include "WorkerThread.h" +#include "ObjectCounter.h" +#include "triangulate/Triangulate.h" +#include "GLMHelper.h" +#include "GeomHelper.h" +#include "OSHelper.h" +#include "FileHelper.h" +#include "StringHelper.h" +#include "MathHelper.h" +#include "CubicSpline.h" +#include "BezierCurve.h" +#include "Signal.h" +#include "Backtrace.h" +#include "WideLine.h" +#include "Rect.h" +#include "Triangle.h" +#include "TestSuite.h" +#include "TimeSource.h" +#include "XMLHelper.h" +#include "Logger.h" + +#include + +#include + +#include +#include +#include +#include + +using namespace avg; +using namespace std; +using namespace boost; + +class DAGTest: public Test +{ +public: + DAGTest() + : Test("DAGTest", 2) + { + } + + void runTests() + { + { + DAG dag; + + dag.addNode(1, set()); + long outgoing2[] = {1}; + dag.addNode(0, makeOutgoing(1, outgoing2)); + + long expected[] = {0, 1}; + checkResults(&dag, expected); + } + { + DAG dag; + + dag.addNode(2, set()); + long outgoing2[] = {1}; + dag.addNode(0, makeOutgoing(1, outgoing2)); + long outgoing3[] = {2}; + dag.addNode(1, makeOutgoing(1, outgoing3)); + + long expected[] = {0, 1, 2}; + checkResults(&dag, expected); + } + { + DAG dag; + + long outgoing2[] = {1}; + dag.addNode(0, makeOutgoing(1, outgoing2)); + dag.addNode(2, set()); + long outgoing3[] = {2}; + dag.addNode(1, makeOutgoing(1, outgoing3)); + + long expected[] = {0, 1, 2}; + checkResults(&dag, expected); + } + { + DAG dag; + + dag.addNode(2, set()); + long outgoing2[] = {1, 2}; + dag.addNode(0, makeOutgoing(1, outgoing2)); + long outgoing3[] = {2}; + dag.addNode(1, makeOutgoing(1, outgoing3)); + + long expected[] = {0, 1, 2}; + checkResults(&dag, expected); + } + { + DAG dag; + + long outgoing2[] = {1}; + dag.addNode(0, makeOutgoing(1, outgoing2)); + long outgoing3[] = {0}; + dag.addNode(1, makeOutgoing(1, outgoing3)); + + bool bExceptionThrown = false; + long expected[] = {0, 1, 2}; + try { + checkResults(&dag, expected); + } catch (const Exception&) { + bExceptionThrown = true; + } + TEST(bExceptionThrown); + } + } + +private: + set makeOutgoing(int n, long ids[]) + { + set v; + for (int i=0; i results; + pDAG->sort(results); + + for (unsigned i=0; i::QElementPtr ElemPtr; + + void runSingleThreadTests() + { + Queue q; + typedef Queue::QElementPtr ElemPtr; + TEST(q.empty()); + q.push(ElemPtr(new string("1"))); + TEST(q.size() == 1); + TEST(!q.empty()); + q.push(ElemPtr(new string("2"))); + q.push(ElemPtr(new string("3"))); + TEST(q.size() == 3); + TEST(*q.pop() == "1"); + TEST(*q.pop() == "2"); + q.push(ElemPtr(new string("4"))); + TEST(*q.pop() == "3"); + TEST(*q.peek() == "4"); + TEST(*q.pop() == "4"); + TEST(q.empty()); + ElemPtr pElem = q.pop(false); + TEST(!pElem); + } + + void runMultiThreadTests() + { + { + Queue q(10); + thread pusher(boost::bind(&pushThread, &q, 100)); + thread popper(boost::bind(&popThread, &q, 100)); + pusher.join(); + popper.join(); + TEST(q.empty()); + } + { + Queue q(10); + thread pusher1(boost::bind(&pushThread, &q, 100)); + thread pusher2(boost::bind(&pushThread, &q, 100)); + thread popper(boost::bind(&popThread, &q, 200)); + pusher1.join(); + pusher2.join(); + popper.join(); + TEST(q.empty()); + } + { + Queue q(10); + thread pusher(boost::bind(&pushClearThread, &q, 100)); + thread popper(boost::bind(&popClearThread, &q)); + pusher.join(); + popper.join(); + TEST(q.empty()); + } + } + + static void pushThread(Queue* pq, int numPushes) + { + for (int i=0; ipush(ElemPtr(new int(i))); + msleep(1); + } + } + + static void popThread(Queue* pq, int numPops) + { + for (int i=0; ipeek(); + pq->pop(); + msleep(3); + } + } + + static void pushClearThread(Queue* pq, int numPushes) + { + typedef Queue::QElementPtr ElemPtr; + for (int i=0; ipush(ElemPtr(new int(i))); + if (i%7 == 0) { + pq->clear(); + } + msleep(1); + } + pq->push(ElemPtr(new int(-1))); + } + + static void popClearThread(Queue* pq) + { + ElemPtr pElem; + do { + pElem = pq->pop(); + } while (*pElem != -1); + } +}; + +class TestWorkerThread: public WorkerThread +{ +public: + TestWorkerThread(CQueue& cmdQ, int* pNumFuncCalls, int* pIntParam, + string* pStringParam) + : WorkerThread("Thread1", cmdQ), + m_pNumFuncCalls(pNumFuncCalls), + m_pIntParam(pIntParam), + m_pStringParam(pStringParam) + { + } + + bool init() + { + (*m_pNumFuncCalls)++; + return true; + } + + bool work() + { + (*m_pNumFuncCalls)++; + waitForCommand(); + return true; + } + + void deinit() + { + (*m_pNumFuncCalls)++; + } + + void doSomething(int i, std::string s) + { + *m_pIntParam = i; + *m_pStringParam = s; + } + +private: + int * m_pNumFuncCalls; + int * m_pIntParam; + std::string * m_pStringParam; +}; + + +class WorkerThreadTest: public Test +{ +public: + WorkerThreadTest() + : Test("WorkerThreadTest", 2) + { + } + + void runTests() + { + typedef TestWorkerThread::CmdPtr CmdPtr; + TestWorkerThread::CQueue cmdQ; + boost::thread* pTestThread; + int numFuncCalls = 0; + int intParam = 0; + std::string stringParam; + cmdQ.pushCmd(boost::bind(&TestWorkerThread::doSomething, _1, 23, "foo")); + cmdQ.pushCmd(boost::bind(&TestWorkerThread::stop, _1)); + pTestThread = new boost::thread(TestWorkerThread(cmdQ, &numFuncCalls, + &intParam, &stringParam)); + pTestThread->join(); + delete pTestThread; + TEST(numFuncCalls == 3); + TEST(intParam == 23); + TEST(stringParam == "foo"); + } +}; + + +class DummyClass +{ +public: + DummyClass() + { + ObjectCounter::get()->incRef(&typeid(*this)); + } + + virtual ~DummyClass() + { + ObjectCounter::get()->decRef(&typeid(*this)); + } + + int i; +}; + + +class ObjectCounterTest: public Test { +public: + ObjectCounterTest() + : Test("ObjectCounterTest", 2) + { + } + + void runTests() + { + TEST(ObjectCounter::get()->getCount(&typeid(DummyClass)) == 0); + { + DummyClass dummy1; + DummyClass dummy2; + TEST(ObjectCounter::get()->getCount(&typeid(dummy1)) == 2); + } + TEST(ObjectCounter::get()->getCount(&typeid(DummyClass)) == 0); + } +}; + + +// The following pragmas avoid a compiler warning (potential division by 0) +#ifdef _MSC_VER +#pragma optimize("", off) +#pragma warning(push) +#pragma warning(disable:4723) +#endif +class GeomTest: public Test +{ +public: + GeomTest() + : Test("GeomTest", 2) + { + } + + void runTests() + { + // TODO: Move to a separate math test once we're done here. + TEST(almostEqual(invSqrt(1), 1)); + TEST(almostEqual(invSqrt(4), 0.5)); + + { + LineSegment l1(glm::vec2(0,0), glm::vec2(2,2)); + LineSegment l2(glm::vec2(2,0), glm::vec2(0,2)); + TEST(lineSegmentsIntersect(l1, l2)); + TEST(lineSegmentsIntersect(l2, l1)); + } + { + LineSegment l1(glm::vec2(0,0), glm::vec2(0,2)); + LineSegment l2(glm::vec2(2,0), glm::vec2(2,2)); + TEST(!lineSegmentsIntersect(l1, l2)); + } + { + LineSegment l1(glm::vec2(0,0), glm::vec2(2,0)); + LineSegment l2(glm::vec2(0,2), glm::vec2(2,2)); + TEST(!lineSegmentsIntersect(l1, l2)); + } + { + LineSegment l1(glm::vec2(0,0), glm::vec2(2,0)); + TEST(l1.isPointOver(glm::vec2(1,23))); + TEST(l1.isPointOver(glm::vec2(1.9,-5))); + TEST(!l1.isPointOver(glm::vec2(-1,1))); + TEST(!l1.isPointOver(glm::vec2(3,-1))); + } + { + glm::vec2 pt0(glm::vec2(1,1)); + glm::vec2 pt1(glm::vec2(1,3)); + glm::vec2 pt2(glm::vec2(1,-2)); + vector poly; + poly.push_back(glm::vec2(0,0)); + poly.push_back(glm::vec2(2,0)); + poly.push_back(glm::vec2(2,2)); + poly.push_back(glm::vec2(0,2)); + TEST(pointInPolygon(pt0, poly)); + TEST(!pointInPolygon(pt1, poly)); + TEST(!pointInPolygon(pt2, poly)); + poly.push_back(glm::vec2(2,1)); + TEST(!pointInPolygon(pt0, poly)); + } + { + glm::vec2 p1(glm::vec2(0,0)); + glm::vec2 v1(glm::vec2(1,1)); + glm::vec2 p2(glm::vec2(2,1)); + glm::vec2 v2(glm::vec2(1,0)); + TEST(getLineLineIntersection(p1, v1, p2, v2) == glm::vec2(1,1)); + } + TEST(almostEqual(getRotatedPivot(glm::vec2(10,0), M_PI, glm::vec2(15,5)), + glm::vec2(20,10))); + TEST(almostEqual(getRotatedPivot(glm::vec2(10,0), M_PI*0.5, glm::vec2(15,5)), + glm::vec2(20,0))); + TEST(almostEqual(getRotatedPivot(glm::vec2(10,0), M_PI*1.5, glm::vec2(15,5)), + glm::vec2(10,10))); + TEST(almostEqual(getRotatedPivot(glm::vec2(10,0), M_PI*2, glm::vec2(15,5)), + glm::vec2(10,0))); + TEST(almostEqual(getRotatedPivot(glm::vec2(23,0), M_PI*0.5), glm::vec2(0,23))); + + { + // TODO: More tests + FRect(0,0,10,10); + } + } +}; +#ifdef _MSC_VER +#pragma warning(pop) +#pragma optimize("", on) +#endif + + +class TriangleTest: public Test +{ +public: + TriangleTest() + : Test("TriangleTest", 2) + { + } + + void runTests() + { + Triangle tri(glm::vec2(0,0), glm::vec2(4,4), glm::vec2(4,8)); + TEST(tri.isInside(glm::vec2(3,4))); + TEST(!tri.isInside(glm::vec2(1,4))); + TEST(!tri.isInside(glm::vec2(2,1))); + TEST(!tri.isInside(glm::vec2(-2,5))); + TEST(!tri.isInside(glm::vec2(5,5))); + tri = Triangle(glm::vec2(0,0), glm::vec2(4,8), glm::vec2(4,4)); + TEST(tri.isInside(glm::vec2(3,4))); + + glm::vec2 polyArray[] = {glm::vec2(0,0), glm::vec2(8,2), glm::vec2(9,0), glm::vec2(9,3), + glm::vec2(1,1), glm::vec2(0,3)}; + + Vec2Vector poly = vectorFromCArray(6, polyArray); + vector triangulation; + triangulatePolygon(triangulation, poly); + + TEST(triangulation.size() == 4*3); + unsigned int baselineIndexes[] = {5,0,4, 1,4,0, 4,1,3, 1,2,3}; + TEST(triangulation == vectorFromCArray(12, baselineIndexes)); +/* + for (unsigned int i=0; i v; + fromString("(1,2,3,4,5)", v); + TEST(v.size() == 5 && v[0] == 1 && v[4] == 5); + v.clear(); + fromString("()", v); + TEST(v.size() == 0); + } +}; + + +class SplineTest: public Test +{ +public: + SplineTest() + : Test("SplineTest", 2) + { + } + + void runTests() + { + { + float xd[] = {0,1,2,3}; + vector x = vectorFromCArray(4, xd); + float yd[] = {3,2,1,0}; + vector y = vectorFromCArray(4, yd); + CubicSpline spline(x, y); + TEST(almostEqual(spline.interpolate(-1), 4)); + TEST(almostEqual(spline.interpolate(0), 3)); + TEST(almostEqual(spline.interpolate(0.5), 2.5)); + TEST(almostEqual(spline.interpolate(3), 0)); + TEST(almostEqual(spline.interpolate(3.5), -0.5)); + } + { + float xd[] = {2,4,6,8}; + vector x = vectorFromCArray(4, xd); + float yd[] = {0,1,3,6}; + vector y = vectorFromCArray(4, yd); + CubicSpline spline(x, y); + TEST(almostEqual(spline.interpolate(0), -1)); + TEST(almostEqual(spline.interpolate(2), 0)); + TEST(spline.interpolate(3) < 0.5); + TEST(spline.interpolate(3) > 0); + TEST(spline.interpolate(7) > 4); + TEST(spline.interpolate(7) < 5); + TEST(almostEqual(spline.interpolate(8), 6)); + TEST(almostEqual(spline.interpolate(10), 9)); + } + { + float xd[] = {0,1,1}; + vector x = vectorFromCArray(3, xd); + float yd[] = {1,2,1}; + vector y = vectorFromCArray(3, yd); + bool bExceptionThrown = false; + try { + CubicSpline spline(x, y); + } catch (const Exception&) { + bExceptionThrown = true; + } + TEST(bExceptionThrown); + } +/* + { + float xd[] = {0,1,2}; + vector x = vectorFromCArray(3, xd); + float yd[] = {1,2,1}; + vector y = vectorFromCArray(3, yd); + CubicSpline spline(x, y, true); + TEST(almostEqual(spline.interpolate(0), 1)); + TEST(almostEqual(spline.interpolate(0.5), 1.5)); + TEST(almostEqual(spline.interpolate(2), 1)); + TEST(almostEqual(spline.interpolate(3), 2)); + } +*/ + } +}; + + +class BezierCurveTest: public Test +{ +public: + BezierCurveTest() + : Test("BezierCurveTest", 2) + { + } + + void runTests() + { + BezierCurve curve(glm::vec2(0,0), glm::vec2(1,0), glm::vec2(1,1), glm::vec2(0,1)); + TEST(almostEqual(curve.interpolate(0), glm::vec2(0,0))); + TEST(almostEqual(curve.getDeriv(0), glm::vec2(3, 0))); + TEST(almostEqual(curve.interpolate(1), glm::vec2(0,1))); + TEST(almostEqual(curve.getDeriv(1), glm::vec2(-3, 0))); + TEST(almostEqual(curve.interpolate(0.5), glm::vec2(0.75,0.5))); + } +}; + + +class WideLineTest: public Test +{ +public: + WideLineTest() + : Test("WideLineTest", 2) + { + } + + void runTests() + { + WideLine line(glm::vec2(0,0), glm::vec2(4,3), 2); + TEST(almostEqual(line.getLen(), 5)); + } +}; + + +class Listener +{ +public: + Listener(Signal& signal) + : m_Signal(signal), + m_bFuncCalled(false) + { + } + + virtual ~Listener() + {} + + virtual void func() + { + m_bFuncCalled = true; + } + + bool funcCalled() const + { + return m_bFuncCalled; + } + + void reset() + { + m_bFuncCalled = false; + } + +protected: + Signal& m_Signal; + +private: + bool m_bFuncCalled; +}; + + +class DisconnectingSelfListener: public Listener +{ +public: + DisconnectingSelfListener(Signal& signal) + : Listener(signal) + { + } + + virtual void func() + { + Listener::func(); + m_Signal.disconnect(this); + } +}; + + +class DisconnectingOtherListener: public Listener +{ +public: + DisconnectingOtherListener(Signal& signal, Listener* pOther) + : Listener(signal), + m_pOther(pOther) + { + } + + virtual void func() + { + Listener::func(); + if (m_pOther) { + m_Signal.disconnect(m_pOther); + m_pOther = 0; + } + } + +private: + Listener* m_pOther; +}; + + +class ConnectingOtherListener: public Listener +{ +public: + ConnectingOtherListener(Signal& signal, Listener* pOther) + : Listener(signal), + m_pOther(pOther) + { + } + + virtual void func() + { + Listener::func(); + if (m_pOther) { + m_Signal.connect(m_pOther); + m_pOther = 0; + } + } + +private: + Listener* m_pOther; +}; + + +class SignalTest: public Test +{ +public: + SignalTest() + : Test("SignalTest", 2) + { + } + + void runTests() + { + Signal s(&Listener::func); + Listener l1(s); + Listener l2(s); + s.connect(&l1); + s.connect(&l2); + s.emit(); + TEST(l1.funcCalled() && l2.funcCalled()); + l1.reset(); + l2.reset(); + + s.disconnect(&l1); + s.emit(); + TEST(!(l1.funcCalled()) && l2.funcCalled()); + l2.reset(); + + { + DisconnectingSelfListener disconnecter(s); + s.connect(&disconnecter); + s.emit(); + TEST(l2.funcCalled() && disconnecter.funcCalled()); + TEST(s.getNumListeners() == 1); + l2.reset(); + disconnecter.reset(); + + s.emit(); + TEST(l2.funcCalled() && !(disconnecter.funcCalled())); + l2.reset(); + } + { + DisconnectingOtherListener disconnecter(s, &l2); + s.connect(&disconnecter); + s.emit(); + TEST(l2.funcCalled() && disconnecter.funcCalled()); + TEST(s.getNumListeners() == 1); + l2.reset(); + disconnecter.reset(); + + s.emit(); + TEST(!(l2.funcCalled()) && disconnecter.funcCalled()); + s.disconnect(&disconnecter); + } + { + ConnectingOtherListener connecter(s, &l2); + s.connect(&connecter); + s.emit(); + TEST(l2.funcCalled() && connecter.funcCalled()); + TEST(s.getNumListeners() == 2); + l2.reset(); + connecter.reset(); + + s.emit(); + TEST(l2.funcCalled() && connecter.funcCalled()); + } + } +}; + + +class BacktraceTest: public Test +{ +public: + BacktraceTest() + : Test("BacktraceTest", 2) + { + } + + void runTests() + { + vector sFuncs; + getBacktrace(sFuncs); +#ifndef _WIN32 + TEST(sFuncs[0].find("runTests") != string::npos); +#endif + } +}; + + +class PolygonTest: public Test +{ +public: + PolygonTest() + : Test("PolygonTest", 2) + { + } + + void runTests() + { + glm::vec2 polyArray[] = {glm::vec2(30,0), glm::vec2(40,20), glm::vec2(60,30), + glm::vec2(40,40), glm::vec2(30,60), glm::vec2(20,40), glm::vec2(0,30), + glm::vec2(20,20)}; + + Vec2Vector poly = vectorFromCArray(8, polyArray); + vector triangulation; + triangulatePolygon(triangulation, poly); + + TEST(triangulation.size() == 6*3); + unsigned int baselineIndexes[] = {6,7,5, 5,7,1, 7,0,1, 5,1,3, 3,1,2, 4,5,3}; + TEST(triangulation == vectorFromCArray(18, baselineIndexes)); +/* + for (unsigned int i=0; i" + "" + " John Smith" + ""; + + { + string sSchema = "" + "" + "" + " " + " " + " " + " " + " " + " " + "" + ""; + + XMLParser parser; + parser.setSchema(sSchema, "shiporder.xsd"); + parser.parse(sXmlString, "shiporder.xml"); + } + { + string sDTD = + "" + "" + ""; + XMLParser parser; + parser.setDTD(sDTD, "shiporder.dtd"); + parser.parse(sXmlString, "shiporder.xml"); + } + } +}; + + +class StandardLoggerTest: public Test +{ +public: + StandardLoggerTest() + : Test("StandardLoggerTest", 2) + { + } + + void runTests() + { + std::stringstream buffer; + std::streambuf *sbuf = std::cerr.rdbuf(); + Logger *logger = Logger::get(); + { + std::cerr.rdbuf(buffer.rdbuf()); + string msg("Test log message"); + AVG_TRACE(Logger::category::NONE, Logger::severity::WARNING, msg); + std::cerr.rdbuf(sbuf); + TEST(buffer.str().find(msg) != string::npos); + buffer.str(string()); + + std::cerr.rdbuf(buffer.rdbuf()); + AVG_TRACE(Logger::category::NONE, Logger::severity::DEBUG, msg); + std::cerr.rdbuf(sbuf); + std::cout << buffer.str(); + TEST(buffer.str().find(msg) == string::npos); + buffer.str(string()); + } + { + std::cerr.rdbuf(buffer.rdbuf()); + category_t CUSTOM_CAT = logger->configureCategory("CUSTOM_CAT 1"); + string msg("CUSTOM_CAT LOG"); + AVG_TRACE(CUSTOM_CAT, Logger::severity::WARNING, msg); + std::cerr.rdbuf(sbuf); + TEST(buffer.str().find(msg) != string::npos); + buffer.str(string()); + } + { + std::cerr.rdbuf(buffer.rdbuf()); + category_t CUSTOM_CAT = logger->configureCategory("CUSTOM_CAT 1", + Logger::severity::CRITICAL); + string msg_info("CUSTOM_CAT LOG INFO"); + AVG_TRACE(CUSTOM_CAT, Logger::severity::WARNING, msg_info); + std::cerr.rdbuf(sbuf); + TEST(buffer.str().find(msg_info) == string::npos); + buffer.str(string()); + + std::cerr.rdbuf(buffer.rdbuf()); + string msg_critical("CUSTOM_CAT LOG CRITICAL"); + AVG_TRACE(CUSTOM_CAT, Logger::severity::CRITICAL, msg_critical); + std::cerr.rdbuf(sbuf); + TEST(buffer.str().find(msg_critical) != string::npos); + buffer.str(string()); + } + } +}; + +class BaseTestSuite: public TestSuite +{ +public: + BaseTestSuite() + : TestSuite("BaseTestSuite") + { + addTest(TestPtr(new DAGTest)); + addTest(TestPtr(new QueueTest)); + addTest(TestPtr(new WorkerThreadTest)); + addTest(TestPtr(new ObjectCounterTest)); + addTest(TestPtr(new GeomTest)); + addTest(TestPtr(new TriangleTest)); + addTest(TestPtr(new FileTest)); + addTest(TestPtr(new OSTest)); + addTest(TestPtr(new StringTest)); + addTest(TestPtr(new SplineTest)); + addTest(TestPtr(new BezierCurveTest)); + addTest(TestPtr(new SignalTest)); + addTest(TestPtr(new BacktraceTest)); + addTest(TestPtr(new PolygonTest)); + addTest(TestPtr(new XmlParserTest)); + addTest(TestPtr(new StandardLoggerTest)); + } +}; + + +int main(int nargs, char** args) +{ + BaseTestSuite suite; + suite.runTests(); + bool bOK = suite.isOk(); + + if (bOK) { + return 0; + } else { + return 1; + } +} + diff --git a/src/base/triangulate/AdvancingFront.cpp b/src/base/triangulate/AdvancingFront.cpp new file mode 100644 index 0000000..d14f1d3 --- /dev/null +++ b/src/base/triangulate/AdvancingFront.cpp @@ -0,0 +1,104 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +// +// Based on Poly2Tri algorithm. +// Poly2Tri Copyright (c) 2009-2010, Poly2Tri Contributors +// http://code.google.com/p/poly2tri/ +// + +#include "AdvancingFront.h" + +namespace avg { + +AdvancingFront::AdvancingFront(Node& head, Node& tail) +{ + m_Head = &head; + m_Tail = &tail; + m_SearchNode = &head; +} + +Node* AdvancingFront::locateNode(const double& x) +{ + Node* node = m_SearchNode; + + if (x < node->m_Value) { + while ((node = node->m_Prev) != NULL) { + if (x >= node->m_Value) { + m_SearchNode = node; + return node; + } + } + } else { + while ((node = node->m_Next) != NULL) { + if (x < node->m_Value) { + m_SearchNode = node->m_Prev; + return node->m_Prev; + } + } + } + return NULL; +} + +Node* AdvancingFront::findSearchNode(const double& x) +{ + // TO DO: implement BST index + return m_SearchNode; +} + +Node* AdvancingFront::locatePoint(const Point* point) +{ + const double px = point->m_X; + Node* node = findSearchNode(px); + const double nx = node->m_Point->m_X; + + if (px == nx) { + if (point != node->m_Point) { + // We might have two nodes with same x value for a short time + if (point == node->m_Prev->m_Point) { + node = node->m_Prev; + } else if (point == node->m_Next->m_Point) { + node = node->m_Next; + } else { + assert(0); + } + } + } else if (px < nx) { + while ((node = node->m_Prev) != NULL) { + if (point == node->m_Point) { + break; + } + } + } else { + while ((node = node->m_Next) != NULL) { + if (point == node->m_Point) + break; + } + } + if (node) + m_SearchNode = node; + return node; +} + +AdvancingFront::~AdvancingFront() {} + +} + diff --git a/src/base/triangulate/AdvancingFront.h b/src/base/triangulate/AdvancingFront.h new file mode 100644 index 0000000..3bb0d5b --- /dev/null +++ b/src/base/triangulate/AdvancingFront.h @@ -0,0 +1,118 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +// +// Based on Poly2Tri algorithm. +// Poly2Tri Copyright (c) 2009-2010, Poly2Tri Contributors +// http://code.google.com/p/poly2tri/ +// + +#ifndef ADVANCED_FRONT_H +#define ADVANCED_FRONT_H + +#include "Shapes.h" + +namespace avg { + +struct Node; + +struct Node +{ + Point* m_Point; + TriangulationTriangle* m_Triangle; + + Node* m_Next; + Node* m_Prev; + + double m_Value; + + Node() : m_Point(NULL), m_Triangle(NULL), m_Next(NULL), m_Prev(NULL), m_Value(0) + {} + + Node(Point& p) : m_Point(&p), m_Triangle(NULL), m_Next(NULL), m_Prev(NULL), m_Value(p.m_X) + {} + + Node(Point& p, TriangulationTriangle& t) : m_Point(&p), m_Triangle(&t), m_Next(NULL), m_Prev(NULL), m_Value(p.m_X) + {} + +}; + + +class AdvancingFront +{ + +public: + +AdvancingFront(Node& head, Node& tail); + +~AdvancingFront(); + +Node* head(); +void setHead(Node* node); +Node* tail(); +void setTail(Node* node); +Node* search(); +void setSearch(Node* node); + +/// Locate insertion point along advancing front +Node* locateNode(const double& x); + +Node* locatePoint(const Point* point); + +private: + +Node* m_Head, *m_Tail, *m_SearchNode; + +Node* findSearchNode(const double& x); +}; + + +inline Node* AdvancingFront::head() +{ + return m_Head; +} +inline void AdvancingFront::setHead(Node* node) +{ + m_Head = node; +} + +inline Node* AdvancingFront::tail() +{ + return m_Tail; +} +inline void AdvancingFront::setTail(Node* node) +{ + m_Tail = node; +} + +inline Node* AdvancingFront::search() +{ + return m_SearchNode; +} + +inline void AdvancingFront::setSearch(Node* node) +{ + m_SearchNode = node; +} + +} + +#endif diff --git a/src/base/triangulate/Makefile.am b/src/base/triangulate/Makefile.am new file mode 100644 index 0000000..9381e58 --- /dev/null +++ b/src/base/triangulate/Makefile.am @@ -0,0 +1,8 @@ +AM_CPPFLAGS = -I.. @XML2_CFLAGS@ @PTHREAD_CFLAGS@ +ALL_H = Triangulate.h Shapes.h Utils.h \ + AdvancingFront.h Sweep.h SweepContext.h + +noinst_LTLIBRARIES = libtriangulate.la +libtriangulate_la_SOURCES = Triangulate.cpp Shapes.cpp \ + AdvancingFront.cpp Sweep.cpp SweepContext.cpp \ + $(ALL_H) diff --git a/src/base/triangulate/Shapes.cpp b/src/base/triangulate/Shapes.cpp new file mode 100644 index 0000000..08e2e13 --- /dev/null +++ b/src/base/triangulate/Shapes.cpp @@ -0,0 +1,353 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +// +// Based on Poly2Tri algorithm. +// Poly2Tri Copyright (c) 2009-2010, Poly2Tri Contributors +// http://code.google.com/p/poly2tri/ +// + +#include "Shapes.h" +#include + +namespace avg { + +TriangulationTriangle::TriangulationTriangle(Point& a, Point& b, Point& c) +{ + m_Points[0] = &a; + m_Points[1] = &b; + m_Points[2] = &c; + m_Neighbors[0] = NULL; + m_Neighbors[1] = NULL; + m_Neighbors[2] = NULL; + m_ConstrainedEdge[0] = m_ConstrainedEdge[1] = m_ConstrainedEdge[2] = false; + m_DelaunayEdge[0] = m_DelaunayEdge[1] = m_DelaunayEdge[2] = false; + m_Interior = false; +} + +// Update neighbor pointers +void TriangulationTriangle::markNeighbor(Point* p1, Point* p2, + TriangulationTriangle* t) +{ + if ((p1 == m_Points[2] && p2 == m_Points[1]) + || (p1 == m_Points[1] && p2 == m_Points[2])) { + m_Neighbors[0] = t; + } else if ((p1 == m_Points[0] && p2 == m_Points[2]) + || (p1 == m_Points[2] && p2 == m_Points[0])) { + m_Neighbors[1] = t; + } else if ((p1 == m_Points[0] && p2 == m_Points[1]) + || (p1 == m_Points[1] && p2 == m_Points[0])) { + m_Neighbors[2] = t; + } else { + assert(0); + } + +} + +// Exhaustive search to update neighbor pointers +void TriangulationTriangle::markNeighbor(TriangulationTriangle& t) +{ + if (t.contains(m_Points[1], m_Points[2])) { + m_Neighbors[0] = &t; + t.markNeighbor(m_Points[1], m_Points[2], this); + } else if (t.contains(m_Points[0], m_Points[2])) { + m_Neighbors[1] = &t; + t.markNeighbor(m_Points[0], m_Points[2], this); + } else if (t.contains(m_Points[0], m_Points[1])) { + m_Neighbors[2] = &t; + t.markNeighbor(m_Points[0], m_Points[1], this); + } +} + +void TriangulationTriangle::clear() +{ + TriangulationTriangle *t; + for (int i = 0; i < 3; i++) { + t = m_Neighbors[i]; + if (t != NULL) { + t->clearNeighbor(this); + } + } + clearNeighbors(); + m_Points[0] = m_Points[1] = m_Points[2] = NULL; +} + +void TriangulationTriangle::clearNeighbor(TriangulationTriangle *triangle) +{ + if (m_Neighbors[0] == triangle) { + m_Neighbors[0] = NULL; + } else if (m_Neighbors[1] == triangle) { + m_Neighbors[1] = NULL; + } else { + m_Neighbors[2] = NULL; + } +} + +void TriangulationTriangle::clearNeighbors() +{ + m_Neighbors[0] = NULL; + m_Neighbors[1] = NULL; + m_Neighbors[2] = NULL; +} + +void TriangulationTriangle::clearDelunayEdges() +{ + m_DelaunayEdge[0] = m_DelaunayEdge[1] = m_DelaunayEdge[2] = false; +} + +Point* TriangulationTriangle::oppositePoint(TriangulationTriangle& t, + Point& p) { + Point *cw = t.pointCW(p); + return pointCW(*cw); +} + +// Legalized triangle by rotating clockwise around point(0) +void TriangulationTriangle::legalize(Point& point) +{ + m_Points[1] = m_Points[0]; + m_Points[0] = m_Points[2]; + m_Points[2] = &point; +} + +// Legalize triagnle by rotating clockwise around oPoint +void TriangulationTriangle::legalize(Point& opoint, Point& npoint) +{ + if (&opoint == m_Points[0]) { + m_Points[1] = m_Points[0]; + m_Points[0] = m_Points[2]; + m_Points[2] = &npoint; + } else if (&opoint == m_Points[1]) { + m_Points[2] = m_Points[1]; + m_Points[1] = m_Points[0]; + m_Points[0] = &npoint; + } else if (&opoint == m_Points[2]) { + m_Points[0] = m_Points[2]; + m_Points[2] = m_Points[1]; + m_Points[1] = &npoint; + } else { + assert(0); + } +} + +unsigned int TriangulationTriangle::index(const Point* p) +{ + if (p == m_Points[0]) { + return 0; + } else if (p == m_Points[1]) { + return 1; + } else if (p == m_Points[2]) { + return 2; + } + assert(0); + return 0; +} + +unsigned int TriangulationTriangle::edgeIndex(const Point* p1, const Point* p2) +{ + if (m_Points[0] == p1) { + if (m_Points[1] == p2) { + return 2; + } else if (m_Points[2] == p2) { + return 1; + } + } else if (m_Points[1] == p1) { + if (m_Points[2] == p2) { + return 0; + } else if (m_Points[0] == p2) { + return 2; + } + } else if (m_Points[2] == p1) { + if (m_Points[0] == p2) { + return 1; + } else if (m_Points[1] == p2) { + return 0; + } + } + return -1; +} + +void TriangulationTriangle::markConstrainedEdge(const int index) +{ + m_ConstrainedEdge[index] = true; +} + +void TriangulationTriangle::markConstrainedEdge(Edge& edge) +{ + markConstrainedEdge(edge.m_P, edge.m_Q); +} + +void TriangulationTriangle::markConstrainedEdge(Point* p, Point* q) +{ + if ((q == m_Points[0] && p == m_Points[1]) + || (q == m_Points[1] && p == m_Points[0])) { + m_ConstrainedEdge[2] = true; + } else if ((q == m_Points[0] && p == m_Points[2]) + || (q == m_Points[2] && p == m_Points[0])) { + m_ConstrainedEdge[1] = true; + } else if ((q == m_Points[1] && p == m_Points[2]) + || (q == m_Points[2] && p == m_Points[1])) { + m_ConstrainedEdge[0] = true; + } +} + +// The point counter-clockwise to given point +Point* TriangulationTriangle::pointCW(Point& point) +{ + if (&point == m_Points[0]) { + return m_Points[2]; + } else if (&point == m_Points[1]) { + return m_Points[0]; + } else if (&point == m_Points[2]) { + return m_Points[1]; + } + assert(0); + return 0; // Silence compiler warning +} + +Point* TriangulationTriangle::pointCCW(Point& point) +{ + if (&point == m_Points[0]) { + return m_Points[1]; + } else if (&point == m_Points[1]) { + return m_Points[2]; + } else if (&point == m_Points[2]) { + return m_Points[0]; + } + assert(0); + return 0; // Silence compiler warning +} + +TriangulationTriangle* TriangulationTriangle::neighborCW(Point& point) +{ + if (&point == m_Points[0]) { + return m_Neighbors[1]; + } else if (&point == m_Points[1]) { + return m_Neighbors[2]; + } + return m_Neighbors[0]; +} + +TriangulationTriangle* TriangulationTriangle::neighborCCW(Point& point) +{ + if (&point == m_Points[0]) { + return m_Neighbors[2]; + } else if (&point == m_Points[1]) { + return m_Neighbors[0]; + } + return m_Neighbors[1]; +} + +bool TriangulationTriangle::getConstrainedEdgeCCW(Point& p) +{ + if (&p == m_Points[0]) { + return m_ConstrainedEdge[2]; + } else if (&p == m_Points[1]) { + return m_ConstrainedEdge[0]; + } + return m_ConstrainedEdge[1]; +} + +bool TriangulationTriangle::getConstrainedEdgeCW(Point& p) +{ + if (&p == m_Points[0]) { + return m_ConstrainedEdge[1]; + } else if (&p == m_Points[1]) { + return m_ConstrainedEdge[2]; + } + return m_ConstrainedEdge[0]; +} + +void TriangulationTriangle::setConstrainedEdgeCCW(Point& p, bool ce) +{ + if (&p == m_Points[0]) { + m_ConstrainedEdge[2] = ce; + } else if (&p == m_Points[1]) { + m_ConstrainedEdge[0] = ce; + } else { + m_ConstrainedEdge[1] = ce; + } +} + +void TriangulationTriangle::setConstrainedEdgeCW(Point& p, bool ce) +{ + if (&p == m_Points[0]) { + m_ConstrainedEdge[1] = ce; + } else if (&p == m_Points[1]) { + m_ConstrainedEdge[2] = ce; + } else { + m_ConstrainedEdge[0] = ce; + } +} + +bool TriangulationTriangle::getDelunayEdgeCCW(Point& p) +{ + if (&p == m_Points[0]) { + return m_DelaunayEdge[2]; + } else if (&p == m_Points[1]) { + return m_DelaunayEdge[0]; + } + return m_DelaunayEdge[1]; +} + +bool TriangulationTriangle::getDelunayEdgeCW(Point& p) +{ + if (&p == m_Points[0]) { + return m_DelaunayEdge[1]; + } else if (&p == m_Points[1]) { + return m_DelaunayEdge[2]; + } + return m_DelaunayEdge[0]; +} + +void TriangulationTriangle::setDelunayEdgeCCW(Point& p, bool e) +{ + if (&p == m_Points[0]) { + m_DelaunayEdge[2] = e; + } else if (&p == m_Points[1]) { + m_DelaunayEdge[0] = e; + } else { + m_DelaunayEdge[1] = e; + } +} + +void TriangulationTriangle::setDelunayEdgeCW(Point& p, bool e) +{ + if (&p == m_Points[0]) { + m_DelaunayEdge[1] = e; + } else if (&p == m_Points[1]) { + m_DelaunayEdge[2] = e; + } else { + m_DelaunayEdge[0] = e; + } +} + +TriangulationTriangle& TriangulationTriangle::neighborAcross(Point& opoint) +{ + if (&opoint == m_Points[0]) { + return *m_Neighbors[0]; + } else if (&opoint == m_Points[1]) { + return *m_Neighbors[1]; + } + return *m_Neighbors[2]; +} + +} + diff --git a/src/base/triangulate/Shapes.h b/src/base/triangulate/Shapes.h new file mode 100644 index 0000000..0417d7c --- /dev/null +++ b/src/base/triangulate/Shapes.h @@ -0,0 +1,296 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +// +// Based on Poly2Tri algorithm. +// Poly2Tri Copyright (c) 2009-2010, Poly2Tri Contributors +// http://code.google.com/p/poly2tri/ +// + +#ifndef SHAPES_H +#define SHAPES_H + +#include +#include +#include +#include + +namespace avg { + +struct Edge; + +struct Point +{ + double m_X, m_Y; + int m_Index; + + /// The edges this point constitutes an upper ending point + std::vector m_EdgeList; + + /// Default constructor does nothing (for performance). + Point() { + m_X = 0.0; + m_Y = 0.0; + m_Index = 0; + } + + Point(double x, double y, int index) : + m_X(x), m_Y(y), m_Index(index) {} + + void set_zero() + { + m_X = 0.0; + m_Y = 0.0; + } + + void set(double x_, double y_) + { + m_X = x_; + m_Y = y_; + } + + Point operator -() const + { + Point v; + v.set(-m_X, -m_Y); + return v; + } + + void operator +=(const Point& v) + { + m_X += v.m_X; + m_Y += v.m_Y; + } + + void operator -=(const Point& v) + { + m_X -= v.m_X; + m_Y -= v.m_Y; + } + + void operator *=(double a) + { + m_X *= a; + m_Y *= a; + } + + double length() const + { + return sqrt(m_X * m_X + m_Y * m_Y); + } + + /// Convert this point into a unit point. Returns the Length. + double normalize() + { + double len = length(); + m_X /= len; + m_Y /= len; + return len; + } + +}; + + +// Represents a simple polygon's edge +struct Edge +{ + Point* m_P, *m_Q; + + Edge(Point& p1, Point& p2) :m_P(&p1), m_Q(&p2) + { + if (p1.m_Y > p2.m_Y) { + m_Q = &p1; + m_P = &p2; + } else if (p1.m_Y == p2.m_Y) { + if (p1.m_X > p2.m_X) { + m_Q = &p1; + m_P = &p2; + } else if (p1.m_X == p2.m_X) { + // Repeat points + assert(false); + } + } + m_Q->m_EdgeList.push_back(this); + } +}; + + +class TriangulationTriangle +{ + +public: + + TriangulationTriangle(Point& a, Point& b, Point& c); + +/// Flags to determine if an edge is a Constrained edge + bool m_ConstrainedEdge[3]; +/// Flags to determine if an edge is a Delauney edge + bool m_DelaunayEdge[3]; + + Point* getPoint(const int& index); + Point* pointCW(Point& point); + Point* pointCCW(Point& point); + Point* oppositePoint(TriangulationTriangle& t, Point& p); + + TriangulationTriangle* getNeighbor(const int& index); + void markNeighbor(Point* p1, Point* p2, TriangulationTriangle* t); + void markNeighbor(TriangulationTriangle& t); + + void markConstrainedEdge(const int index); + void markConstrainedEdge(Edge& edge); + void markConstrainedEdge(Point* p, Point* q); + + unsigned int index(const Point* p); + unsigned int edgeIndex(const Point* p1, const Point* p2); + + TriangulationTriangle* neighborCW(Point& point); + TriangulationTriangle* neighborCCW(Point& point); + bool getConstrainedEdgeCCW(Point& p); + bool getConstrainedEdgeCW(Point& p); + void setConstrainedEdgeCCW(Point& p, bool ce); + void setConstrainedEdgeCW(Point& p, bool ce); + bool getDelunayEdgeCCW(Point& p); + bool getDelunayEdgeCW(Point& p); + void setDelunayEdgeCCW(Point& p, bool e); + void setDelunayEdgeCW(Point& p, bool e); + + bool contains(Point* p); + bool contains(const Edge& e); + bool contains(Point* p, Point* q); + void legalize(Point& point); + void legalize(Point& opoint, Point& npoint); + + void clear(); + void clearNeighbor(TriangulationTriangle *triangle); + void clearNeighbors(); + void clearDelunayEdges(); + + inline bool isInterior(); + inline void isInterior(bool b); + + TriangulationTriangle& neighborAcross(Point& opoint); + +private: + + Point* m_Points[3]; + + TriangulationTriangle* m_Neighbors[3]; + + bool m_Interior; +}; + +inline bool cmp(const Point* a, const Point* b) +{ + if (a->m_Y < b->m_Y) { + return true; + } else if (a->m_Y == b->m_Y) { + // Make sure q is point with greater x value + if (a->m_X < b->m_X) { + return true; + } + } + return false; +} +/* + inline Point operator +(const Point& a, const Point& b) + { + return Point(a.x + b.x, a.y + b.y); + } + + inline Point operator -(const Point& a, const Point& b) + { + return Point(a.x - b.x, a.y - b.y); + } + + inline Point operator *(double s, const Point& a) + { + return Point(s * a.x, s * a.y, a.index); + } */ + +inline bool operator ==(const Point& a, const Point& b) +{ + return a.m_X == b.m_X && a.m_Y == b.m_Y; +} + +inline bool operator !=(const Point& a, const Point& b) +{ + return a.m_X != b.m_X && a.m_Y != b.m_Y; +} + +inline double dot(const Point& a, const Point& b) +{ + return a.m_X * b.m_X + a.m_Y * b.m_Y; +} + +inline double cross(const Point& a, const Point& b) +{ + return a.m_X * b.m_Y - a.m_Y * b.m_X; +} + +inline Point cross(const Point& a, double s) +{ + return Point(s * a.m_Y, -s * a.m_X, a.m_Index); +} + +inline Point cross(const double s, const Point& a) +{ + return Point(-s * a.m_Y, s * a.m_X, a.m_Index); +} + +inline Point* TriangulationTriangle::getPoint(const int& index) +{ + return m_Points[index]; +} + +inline TriangulationTriangle* TriangulationTriangle::getNeighbor( + const int& index) +{ + return m_Neighbors[index]; +} + +inline bool TriangulationTriangle::contains(Point* p) +{ + return p == m_Points[0] || p == m_Points[1] || p == m_Points[2]; +} + +inline bool TriangulationTriangle::contains(const Edge& e) +{ + return contains(e.m_P) && contains(e.m_Q); +} + +inline bool TriangulationTriangle::contains(Point* p, Point* q) +{ + return contains(p) && contains(q); +} + +inline bool TriangulationTriangle::isInterior() +{ + return m_Interior; +} + +inline void TriangulationTriangle::isInterior(bool b) +{ + m_Interior = b; +} + +} + +#endif diff --git a/src/base/triangulate/Sweep.cpp b/src/base/triangulate/Sweep.cpp new file mode 100644 index 0000000..2655cb0 --- /dev/null +++ b/src/base/triangulate/Sweep.cpp @@ -0,0 +1,796 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +// +// Based on Poly2Tri algorithm. +// Poly2Tri Copyright (c) 2009-2010, Poly2Tri Contributors +// http://code.google.com/p/poly2tri/ +// + +#include +#include "Sweep.h" +#include "SweepContext.h" +#include "AdvancingFront.h" +#include "Utils.h" + +namespace avg { + +void Sweep::Triangulate(SweepContext& sc) +{ + arrayCount = 0; + for (unsigned int i = 0; i < (unsigned)sc.pointCount(); i++) { + m_Nodes.push_back(new Node()); + } + sc.initTriangulation(); + sc.createAdvancingFront(); + // Sweep points; build mesh + sweepPoints(sc); + // Clean up + finalizationPolygon(sc); +} + +void Sweep::sweepPoints(SweepContext& sc) +{ + for (int i = 1; i < sc.pointCount(); i++) { + Point& point = *sc.getPoint(i); + Node* node = &pointEvent(sc, point); + for (unsigned int i = 0; i < point.m_EdgeList.size(); i++) { + edgeEvent(sc, point.m_EdgeList[i], node); + } + } +} + +void Sweep::finalizationPolygon(SweepContext& sc) +{ + // Get an Internal triangle to start with + TriangulationTriangle* t = sc.front()->head()->m_Next->m_Triangle; + Point* p = sc.front()->head()->m_Next->m_Point; + while (!t->getConstrainedEdgeCW(*p)) { + t = t->neighborCCW(*p); + } + + // Collect interior triangles constrained by edges + sc.meshClean(*t); +} + +Node& Sweep::pointEvent(SweepContext& sc, Point& point) +{ + Node& node = sc.locateNode(point); + Node& new_node = newFrontTriangle(sc, point, node); + + // Only need to check +epsilon since point never have smaller + // x value than node due to how we fetch nodes from the front + if (point.m_X <= node.m_Point->m_X + EPSILON) { + fill(sc, node); + } + + //tcx.AddNode(new_node); + + fillAdvancingFront(sc, new_node); + return new_node; +} + +void Sweep::edgeEvent(SweepContext& sc, Edge* edge, Node* node) +{ + sc.m_EdgeEvent.m_ConstrainedEdge = edge; + sc.m_EdgeEvent.m_Right = (edge->m_P->m_X > edge->m_Q->m_X); + + if (isEdgeSideOfTriangle(*node->m_Triangle, *edge->m_P, *edge->m_Q)) { + return; + } + + // to do: integrate with flip process might give some better performance + // but for now this avoid the issue with cases that needs both flips and fills + fillEdgeEvent(sc, edge, node); + edgeEvent(sc, *edge->m_P, *edge->m_Q, node->m_Triangle, *edge->m_Q); +} + +void Sweep::edgeEvent(SweepContext& sc, Point& ep, Point& eq, + TriangulationTriangle* triangle, Point& point) +{ + if (isEdgeSideOfTriangle(*triangle, ep, eq)) { + return; + } + + Point* p1 = triangle->pointCCW(point); + Orientation o1 = orient2d(eq, *p1, ep); + if (o1 == COLLINEAR) { + if (triangle->contains(&eq, p1)) { + triangle->markConstrainedEdge(&eq, p1); + // We are modifying the constraint maybe it would be better to + // not change the given constraint and just keep a variable for the new constraint + sc.m_EdgeEvent.m_ConstrainedEdge->m_Q = p1; + triangle = &triangle->neighborAcross(point); + edgeEvent(sc, ep, *p1, triangle, *p1); + } else { + std::runtime_error("EdgeEvent - collinear points not supported"); + assert(0); + } + return; + } + + Point* p2 = triangle->pointCW(point); + Orientation o2 = orient2d(eq, *p2, ep); + if (o2 == COLLINEAR) { + if (triangle->contains(&eq, p2)) { + triangle->markConstrainedEdge(&eq, p2); + // We are modifying the constraint maybe it would be better to + // not change the given constraint and just keep a variable for the new constraint + sc.m_EdgeEvent.m_ConstrainedEdge->m_Q = p2; + triangle = &triangle->neighborAcross(point); + edgeEvent(sc, ep, *p2, triangle, *p2); + } else { + std::runtime_error("EdgeEvent - collinear points not supported"); + assert(0); + } + return; + } + + if (o1 == o2) { + // Need to decide if we are rotating CW or CCW to get to a triangle + // that will cross edge + if (o1 == CW) { + triangle = triangle->neighborCCW(point); + } else { + triangle = triangle->neighborCW(point); + } + edgeEvent(sc, ep, eq, triangle, point); + } else { + // This triangle crosses constraint so lets flippin start! + flipEdgeEvent(sc, ep, eq, triangle, point); + } +} + +bool Sweep::isEdgeSideOfTriangle(TriangulationTriangle& triangle, Point& ep, + Point& eq) +{ + int index = triangle.edgeIndex(&ep, &eq); + + if (index != -1) { + triangle.markConstrainedEdge(index); + TriangulationTriangle* t = triangle.getNeighbor(index); + if (t) { + t->markConstrainedEdge(&ep, &eq); + } + return true; + } + return false; +} + +Node& Sweep::newFrontTriangle(SweepContext& sc, Point& point, Node& node) +{ + TriangulationTriangle* triangle = new TriangulationTriangle(point, + *node.m_Point, *node.m_Next->m_Point); + + triangle->markNeighbor(*node.m_Triangle); + sc.addToMap(triangle); + + Node* newNode = m_Nodes[arrayCount++]; //new Node(point); + newNode->m_Point = &point; + newNode->m_Value = point.m_X; +// m_Nodes.push_back(newNode); + + newNode->m_Next = node.m_Next; + newNode->m_Prev = &node; + node.m_Next->m_Prev = newNode; + node.m_Next = newNode; + + if (!legalize(sc, *triangle)) { + sc.mapTriangleToNodes(*triangle); + } + + return *newNode; +} + +void Sweep::fill(SweepContext& sc, Node& node) +{ + TriangulationTriangle* triangle = new TriangulationTriangle( + *node.m_Prev->m_Point, *node.m_Point, *node.m_Next->m_Point); + + // TO DO: should copy the constrained_edge value from neighbor triangles + // for now constrained_edge values are copied during the legalize + triangle->markNeighbor(*node.m_Prev->m_Triangle); + triangle->markNeighbor(*node.m_Triangle); + + sc.addToMap(triangle); + + // Update the advancing front + node.m_Prev->m_Next = node.m_Next; + node.m_Next->m_Prev = node.m_Prev; + + // If it was legalized the triangle has already been mapped + if (!legalize(sc, *triangle)) { + sc.mapTriangleToNodes(*triangle); + } + +} + +void Sweep::fillAdvancingFront(SweepContext& sc, Node& n) +{ + Node* node = n.m_Next; + + while (node->m_Next) { + double angle = holeAngle(*node); + if (angle > M_PI_2 || angle < -M_PI_2) + break; +// ---------- LEAK FIX -------------- +// Fill(tcx, *node); +// node = node->m_next; + + + Node *tmp = node; + node = node->m_Next; + fill(sc, *tmp); +// ---------------------------------- + } + + node = n.m_Prev; + + while (node->m_Prev) { + double angle = holeAngle(*node); + if (angle > M_PI_2 || angle < -M_PI_2) + break; + fill(sc, *node); + node = node->m_Prev; + } + + if (n.m_Next && n.m_Next->m_Next) { + double angle = basinAngle(n); + if (angle < PI_3div4) { + fillBasin(sc, n); + } + } +} + +double Sweep::basinAngle(Node& node) +{ + double ax = node.m_Point->m_X - node.m_Next->m_Next->m_Point->m_X; + double ay = node.m_Point->m_Y - node.m_Next->m_Next->m_Point->m_Y; + return atan2(ay, ax); +} + +double Sweep::holeAngle(Node& node) +{ + /* Complex plane + * ab = cosA +i*sinA + * ab = (ax + ay*i)(bx + by*i) = (ax*bx + ay*by) + i(ax*by-ay*bx) + * atan2(y,x) computes the principal value of the argument function + * applied to the complex number x+iy + * Where x = ax*bx + ay*by + * y = ax*by - ay*bx + */ + double ax = node.m_Next->m_Point->m_X - node.m_Point->m_X; + double ay = node.m_Next->m_Point->m_Y - node.m_Point->m_Y; + double bx = node.m_Prev->m_Point->m_X - node.m_Point->m_X; + double by = node.m_Prev->m_Point->m_Y - node.m_Point->m_Y; + return atan2(ax * by - ay * bx, ax * bx + ay * by); +} + +bool Sweep::legalize(SweepContext& sc, TriangulationTriangle& t) +{ + // To legalize a triangle we start by finding if any of the three edges + // violate the Delaunay condition + for (int i = 0; i < 3; i++) { + if (t.m_DelaunayEdge[i]) + continue; + + TriangulationTriangle* ot = t.getNeighbor(i); + + if (ot) { + Point* p = t.getPoint(i); + Point* op = ot->oppositePoint(t, *p); + int oi = ot->index(op); + + // If this is a Constrained Edge or a Delaunay Edge(only during recursive legalization) + // then we should not try to legalize + if (ot->m_ConstrainedEdge[oi] || ot->m_DelaunayEdge[oi]) { + t.m_ConstrainedEdge[i] = ot->m_ConstrainedEdge[oi]; + continue; + } + + bool inside = incircle(*p, *t.pointCCW(*p), *t.pointCW(*p), *op); + + if (inside) { + // Lets mark this shared edge as Delaunay + t.m_DelaunayEdge[i] = true; + ot->m_DelaunayEdge[oi] = true; + + // Lets rotate shared edge one vertex CW to legalize it + rotateTrianglePair(t, *p, *ot, *op); + + // We now got one valid Delaunay Edge shared by two triangles + // This gives us 4 new edges to check for Delaunay + + // Make sure that triangle to node mapping is done only one time for a specific triangle + bool notLegalized = !legalize(sc, t); + if (notLegalized) { + sc.mapTriangleToNodes(t); + } + + notLegalized = !legalize(sc, *ot); + if (notLegalized) + sc.mapTriangleToNodes(*ot); + + // Reset the Delaunay edges, since they only are valid Delaunay edges + // until we add a new triangle or point. + // XX X: need to think about this. Can these edges be tried after we + // return to previous recursive level? + t.m_DelaunayEdge[i] = false; + ot->m_DelaunayEdge[oi] = false; + + // If triangle have been legalized no need to check the other edges since + // the recursive legalization will handles those so we can end here. + return true; + } + } + } + return false; +} + +bool Sweep::incircle(Point& pa, Point& pb, Point& pc, Point& pd) +{ + double adx = pa.m_X - pd.m_X; + double ady = pa.m_Y - pd.m_Y; + double bdx = pb.m_X - pd.m_X; + double bdy = pb.m_Y - pd.m_Y; + + double adxbdy = adx * bdy; + double bdxady = bdx * ady; + double oabd = adxbdy - bdxady; + + if (oabd <= 0) { + return false; + } + + double cdx = pc.m_X - pd.m_X; + double cdy = pc.m_Y - pd.m_Y; + + double cdxady = cdx * ady; + double adxcdy = adx * cdy; + double ocad = cdxady - adxcdy; + + if (ocad <= 0) { + return false; + } + + double bdxcdy = bdx * cdy; + double cdxbdy = cdx * bdy; + + double alift = adx * adx + ady * ady; + double blift = bdx * bdx + bdy * bdy; + double clift = cdx * cdx + cdy * cdy; + + double det = alift * (bdxcdy - cdxbdy) + blift * ocad + clift * oabd; + + return det > 0; +} + +void Sweep::rotateTrianglePair(TriangulationTriangle& t, Point& p, + TriangulationTriangle& ot, Point& op) +{ + TriangulationTriangle* n1, *n2, *n3, *n4; + n1 = t.neighborCCW(p); + n2 = t.neighborCW(p); + n3 = ot.neighborCCW(op); + n4 = ot.neighborCW(op); + + bool ce1, ce2, ce3, ce4; + ce1 = t.getConstrainedEdgeCCW(p); + ce2 = t.getConstrainedEdgeCW(p); + ce3 = ot.getConstrainedEdgeCCW(op); + ce4 = ot.getConstrainedEdgeCW(op); + + bool de1, de2, de3, de4; + de1 = t.getDelunayEdgeCCW(p); + de2 = t.getDelunayEdgeCW(p); + de3 = ot.getDelunayEdgeCCW(op); + de4 = ot.getDelunayEdgeCW(op); + + t.legalize(p, op); + ot.legalize(op, p); + + // Remap delaunay_edge + ot.setDelunayEdgeCCW(p, de1); + t.setDelunayEdgeCW(p, de2); + t.setDelunayEdgeCCW(op, de3); + ot.setDelunayEdgeCW(op, de4); + + // Remap constrained_edge + ot.setConstrainedEdgeCCW(p, ce1); + t.setConstrainedEdgeCW(p, ce2); + t.setConstrainedEdgeCCW(op, ce3); + ot.setConstrainedEdgeCW(op, ce4); + + // Remap neighbors + // XX X: might optimize the markNeighbor by keeping track of + // what side should be assigned to what neighbor after the + // rotation. Now mark neighbor does lots of testing to find + // the right side. + t.clearNeighbors(); + ot.clearNeighbors(); + if (n1) { + ot.markNeighbor(*n1); + } + if (n2) { + t.markNeighbor(*n2); + } + if (n3) { + t.markNeighbor(*n3); + } + if (n4) { + ot.markNeighbor(*n4); + } + t.markNeighbor(ot); +} + +void Sweep::fillBasin(SweepContext& sc, Node& node) +{ + if (orient2d(*node.m_Point, *node.m_Next->m_Point, *node.m_Next->m_Next->m_Point) + == CCW) { + sc.m_Basin.m_LeftNode = node.m_Next->m_Next; + } else { + sc.m_Basin.m_LeftNode = node.m_Next; + } + + // Find the bottom and right node + sc.m_Basin.m_BottomNode = sc.m_Basin.m_LeftNode; + while (sc.m_Basin.m_BottomNode->m_Next + && sc.m_Basin.m_BottomNode->m_Point->m_Y + >= sc.m_Basin.m_BottomNode->m_Next->m_Point->m_Y) { + sc.m_Basin.m_BottomNode = sc.m_Basin.m_BottomNode->m_Next; + } + if (sc.m_Basin.m_BottomNode == sc.m_Basin.m_LeftNode) { + // No valid basin + return; + } + + sc.m_Basin.m_RightNode = sc.m_Basin.m_BottomNode; + while (sc.m_Basin.m_RightNode->m_Next + && sc.m_Basin.m_RightNode->m_Point->m_Y + < sc.m_Basin.m_RightNode->m_Next->m_Point->m_Y) { + sc.m_Basin.m_RightNode = sc.m_Basin.m_RightNode->m_Next; + } + if (sc.m_Basin.m_RightNode == sc.m_Basin.m_BottomNode) { + // No valid basins + return; + } + + sc.m_Basin.m_Width = sc.m_Basin.m_RightNode->m_Point->m_X + - sc.m_Basin.m_LeftNode->m_Point->m_X; + sc.m_Basin.m_LeftHighest = sc.m_Basin.m_LeftNode->m_Point->m_Y + > sc.m_Basin.m_RightNode->m_Point->m_Y; + + fillBasinReq(sc, sc.m_Basin.m_BottomNode); +} + +void Sweep::fillBasinReq(SweepContext& sc, Node* node) +{ + // if shallow stop filling + if (isShallow(sc, *node)) { + return; + } + + fill(sc, *node); + + if (node->m_Prev == sc.m_Basin.m_LeftNode + && node->m_Next == sc.m_Basin.m_RightNode) { + return; + } else if (node->m_Prev == sc.m_Basin.m_LeftNode) { + Orientation o = orient2d(*node->m_Point, *node->m_Next->m_Point, + *node->m_Next->m_Next->m_Point); + if (o == CW) { + return; + } + node = node->m_Next; + } else if (node->m_Next == sc.m_Basin.m_RightNode) { + Orientation o = orient2d(*node->m_Point, *node->m_Prev->m_Point, + *node->m_Prev->m_Prev->m_Point); + if (o == CCW) { + return; + } + node = node->m_Prev; + } else { + // Continue with the neighbor node with lowest Y value + if (node->m_Prev->m_Point->m_Y < node->m_Next->m_Point->m_Y) { + node = node->m_Prev; + } else { + node = node->m_Next; + } + } + + fillBasinReq(sc, node); +} + +bool Sweep::isShallow(SweepContext& sc, Node& node) +{ + double height; + + if (sc.m_Basin.m_LeftHighest) { + height = sc.m_Basin.m_LeftNode->m_Point->m_Y - node.m_Point->m_Y; + } else { + height = sc.m_Basin.m_RightNode->m_Point->m_Y - node.m_Point->m_Y; + } + + // if shallow stop filling + if (sc.m_Basin.m_Width > height) { + return true; + } + return false; +} + +void Sweep::fillEdgeEvent(SweepContext& sc, Edge* edge, Node* node) +{ + if (sc.m_EdgeEvent.m_Right) { + fillRightAboveEdgeEvent(sc, edge, node); + } else { + fillLeftAboveEdgeEvent(sc, edge, node); + } +} + +void Sweep::fillRightAboveEdgeEvent(SweepContext& sc, Edge* edge, Node* node) +{ + while (node->m_Next->m_Point->m_X < edge->m_P->m_X) { + // Check if next node is below the edge + if (orient2d(*edge->m_Q, *node->m_Next->m_Point, *edge->m_P) == CCW) { + fillRightBelowEdgeEvent(sc, edge, *node); + } else { + node = node->m_Next; + } + } +} + +void Sweep::fillRightBelowEdgeEvent(SweepContext& sc, Edge* edge, Node& node) +{ + if (node.m_Point->m_X < edge->m_P->m_X) { + if (orient2d(*node.m_Point, *node.m_Next->m_Point, *node.m_Next->m_Next->m_Point) + == CCW) { + // Concave + fillRightConcaveEdgeEvent(sc, edge, node); + } else { + // Convex + fillRightConvexEdgeEvent(sc, edge, node); + // Retry this one + fillRightBelowEdgeEvent(sc, edge, node); + } + } +} + +void Sweep::fillRightConcaveEdgeEvent(SweepContext& sc, Edge* edge, Node& node) +{ + fill(sc, *node.m_Next); + if (node.m_Next->m_Point != edge->m_P) { + // Next above or below edge? + if (orient2d(*edge->m_Q, *node.m_Next->m_Point, *edge->m_P) == CCW) { + // Below + if (orient2d(*node.m_Point, *node.m_Next->m_Point, + *node.m_Next->m_Next->m_Point) == CCW) { + // Next is concave + fillRightConcaveEdgeEvent(sc, edge, node); + } else { + // Next is convex + } + } + } + +} + +void Sweep::fillRightConvexEdgeEvent(SweepContext& sc, Edge* edge, Node& node) +{ + // Next concave or convex? + if (orient2d(*node.m_Next->m_Point, *node.m_Next->m_Next->m_Point, + *node.m_Next->m_Next->m_Next->m_Point) == CCW) { + // Concave + fillRightConcaveEdgeEvent(sc, edge, *node.m_Next); + } else { + // Convex + // Next above or below edge? + if (orient2d(*edge->m_Q, *node.m_Next->m_Next->m_Point, *edge->m_P) == CCW) { + // Below + fillRightConvexEdgeEvent(sc, edge, *node.m_Next); + } else { + // Above + } + } +} + +void Sweep::fillLeftAboveEdgeEvent(SweepContext& sc, Edge* edge, Node* node) +{ + while (node->m_Prev->m_Point->m_X > edge->m_P->m_X) { + // Check if next node is below the edge + if (orient2d(*edge->m_Q, *node->m_Prev->m_Point, *edge->m_P) == CW) { + fillLeftBelowEdgeEvent(sc, edge, *node); + } else { + node = node->m_Prev; + } + } +} + +void Sweep::fillLeftBelowEdgeEvent(SweepContext& sc, Edge* edge, Node& node) +{ + if (node.m_Point->m_X > edge->m_P->m_X) { + if (orient2d(*node.m_Point, *node.m_Prev->m_Point, *node.m_Prev->m_Prev->m_Point) + == CW) { + // Concave + fillLeftConcaveEdgeEvent(sc, edge, node); + } else { + // Convex + fillLeftConvexEdgeEvent(sc, edge, node); + // Retry this one + fillLeftBelowEdgeEvent(sc, edge, node); + } + } +} + +void Sweep::fillLeftConvexEdgeEvent(SweepContext& sc, Edge* edge, Node& node) +{ + // Next concave or convex? + if (orient2d(*node.m_Prev->m_Point, *node.m_Prev->m_Prev->m_Point, + *node.m_Prev->m_Prev->m_Prev->m_Point) == CW) { + // Concave + fillLeftConcaveEdgeEvent(sc, edge, *node.m_Prev); + } else { + // Convex + // Next above or below edge? + if (orient2d(*edge->m_Q, *node.m_Prev->m_Prev->m_Point, *edge->m_P) == CW) { + // Below + fillLeftConvexEdgeEvent(sc, edge, *node.m_Prev); + } else { + // Above + } + } +} + +void Sweep::fillLeftConcaveEdgeEvent(SweepContext& sc, Edge* edge, Node& node) +{ + fill(sc, *node.m_Prev); + if (node.m_Prev->m_Point != edge->m_P) { + // Next above or below edge? + if (orient2d(*edge->m_Q, *node.m_Prev->m_Point, *edge->m_P) == CW) { + // Below + if (orient2d(*node.m_Point, *node.m_Prev->m_Point, + *node.m_Prev->m_Prev->m_Point) == CW) { + // Next is concave + fillLeftConcaveEdgeEvent(sc, edge, node); + } else { + // Next is convex + } + } + } + +} + +void Sweep::flipEdgeEvent(SweepContext& sc, Point& ep, Point& eq, + TriangulationTriangle* t, Point& p) +{ + TriangulationTriangle& ot = t->neighborAcross(p); + Point& op = *ot.oppositePoint(*t, p); + + if (&ot == NULL) { + // If we want to integrate the fillEdgeEvent do it here + // With current implementation we should never get here + //throw new RuntimeException( "[BUG:FIXM E] FLIP failed due to missing triangle"); + assert(0); + } + + if (inScanArea(p, *t->pointCCW(p), *t->pointCW(p), op)) { + // Lets rotate shared edge one vertex CW + rotateTrianglePair(*t, p, ot, op); + sc.mapTriangleToNodes(*t); + sc.mapTriangleToNodes(ot); + + if (p == eq && op == ep) { + if (eq == *sc.m_EdgeEvent.m_ConstrainedEdge->m_Q + && ep == *sc.m_EdgeEvent.m_ConstrainedEdge->m_P) { + t->markConstrainedEdge(&ep, &eq); + ot.markConstrainedEdge(&ep, &eq); + legalize(sc, *t); + legalize(sc, ot); + } else { + // One of the triangles should be legalized here? + } + } else { + Orientation o = orient2d(eq, op, ep); + t = &nextFlipTriangle(sc, (int) o, *t, ot, p, op); + flipEdgeEvent(sc, ep, eq, t, p); + } + } else { + Point& newP = nextFlipPoint(ep, eq, ot, op); + flipScanEdgeEvent(sc, ep, eq, *t, ot, newP); + edgeEvent(sc, ep, eq, t, p); + } +} + +TriangulationTriangle& Sweep::nextFlipTriangle(SweepContext& sc, int o, + TriangulationTriangle& t, TriangulationTriangle& ot, Point& p, Point& op) +{ + if (o == CCW) { + // ot is not crossing edge after flip + int edgeIndex = ot.edgeIndex(&p, &op); + ot.m_DelaunayEdge[edgeIndex] = true; + legalize(sc, ot); + ot.clearDelunayEdges(); + return t; + } + + // t is not crossing edge after flip + int edgeIndex = t.edgeIndex(&p, &op); + + t.m_DelaunayEdge[edgeIndex] = true; + legalize(sc, t); + t.clearDelunayEdges(); + return ot; +} + +Point& Sweep::nextFlipPoint(Point& ep, Point& eq, TriangulationTriangle& ot, Point& op) +{ + Orientation o2d = orient2d(eq, op, ep); + if (o2d == CW) { + // Right + return *ot.pointCCW(op); + } else if (o2d == CCW) { + // Left + return *ot.pointCW(op); + } else { + //throw new RuntimeException("[Unsupported] Opposing point on constrained edge"); + assert(0); + return ep; // Silence compiler warning. + } +} + +void Sweep::flipScanEdgeEvent(SweepContext& sc, Point& ep, Point& eq, + TriangulationTriangle& flipTriangle, TriangulationTriangle& t, Point& p) +{ + TriangulationTriangle& ot = t.neighborAcross(p); + Point& op = *ot.oppositePoint(t, p); + + if (&t.neighborAcross(p) == NULL) { + // If we want to integrate the fillEdgeEvent do it here + // With current implementation we should never get here + //throw new RuntimeException( "[BUG:FIXM E] FLIP failed due to missing triangle"); + assert(0); + } + + if (inScanArea(eq, *flipTriangle.pointCCW(eq), *flipTriangle.pointCW(eq), + op)) { + // flip with new edge op->eq + flipEdgeEvent(sc, eq, op, &ot, op); + // To do: Actually I just figured out that it should be possible to + // improve this by getting the next ot and op before the the above + // flip and continue the flipScanEdgeEvent here + // set new ot and op here and loop back to inScanArea test + // also need to set a new flip_triangle first + // Turns out at first glance that this is somewhat complicated + // so it will have to wait. + } else { + Point& newP = nextFlipPoint(ep, eq, ot, op); + flipScanEdgeEvent(sc, ep, eq, flipTriangle, ot, newP); + } +} + +Sweep::~Sweep() +{ + for (unsigned int i = 0; i < m_Nodes.size(); i++) { + delete m_Nodes[i]; + } + +} + +} diff --git a/src/base/triangulate/Sweep.h b/src/base/triangulate/Sweep.h new file mode 100644 index 0000000..48cd13a --- /dev/null +++ b/src/base/triangulate/Sweep.h @@ -0,0 +1,201 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +// +// Based on Poly2Tri algorithm. +// Poly2Tri Copyright (c) 2009-2010, Poly2Tri Contributors +// http://code.google.com/p/poly2tri/ +// + +#ifndef SWEEP_H +#define SWEEP_H + +#include + +namespace avg { + +class SweepContext; +struct Node; +struct Point; +struct Edge; +class TriangulationTriangle; + +class Sweep +{ + +public: + + void Triangulate(SweepContext& sc); + + ~Sweep(); + +private: + + void sweepPoints(SweepContext& sc); + + Node& pointEvent(SweepContext& sc, Point& point); + + void edgeEvent(SweepContext& sc, Edge* edge, Node* node); + + void edgeEvent(SweepContext& sc, Point& ep, Point& eq, + TriangulationTriangle* triangle, Point& point); + + Node& newFrontTriangle(SweepContext& sc, Point& point, Node& node); + + void fill(SweepContext& sc, Node& node); + + bool legalize(SweepContext& sc, TriangulationTriangle& t); + + /** + * Requirement:
+ * 1. a,b and c form a triangle.
+ * 2. a and d is know to be on opposite side of bc
+ *
+     *                a
+     *                +
+     *               / \
+     *              /   \
+     *            b/     \c
+     *            +-------+
+     *           /    d    \
+     *          /           \
+     * 
+ * Fact: d has to be in area B to have a chance to be inside the circle formed by + * a,b and c
+ * d is outside B if orient2d(a,b,d) or orient2d(c,a,d) is CW
+ * This preknowledge gives us a way to optimize the incircle test + * @param a - triangle point, opposite d + * @param b - triangle point + * @param c - triangle point + * @param d - point opposite a + * @return true if d is inside circle, false if on circle edge + */ + bool incircle(Point& pa, Point& pb, Point& pc, Point& pd); + + /** + * Rotates a triangle pair one vertex CW + *
+     *       n2                    n2
+     *  P +-----+             P +-----+
+     *    | t  /|               |\  t |
+     *    |   / |               | \   |
+     *  n1|  /  |n3           n1|  \  |n3
+     *    | /   |    after CW   |   \ |
+     *    |/ oT |               | oT \|
+     *    +-----+ oP            +-----+
+     *       n4                    n4
+     * 
+ */ + void rotateTrianglePair(TriangulationTriangle& t, Point& p, TriangulationTriangle& ot, + Point& op); + + void fillAdvancingFront(SweepContext& sc, Node& n); + + double holeAngle(Node& node); + + /** + * The basin angle is decided against the horizontal line [1,0] + */ + double basinAngle(Node& node); + + void fillBasin(SweepContext& sc, Node& node); + + void fillBasinReq(SweepContext& sc, Node* node); + + bool isShallow(SweepContext& sc, Node& node); + + bool isEdgeSideOfTriangle(TriangulationTriangle& triangle, Point& ep, Point& eq); + + void fillEdgeEvent(SweepContext& sc, Edge* edge, Node* node); + + void fillRightAboveEdgeEvent(SweepContext& sc, Edge* edge, Node* node); + + void fillRightBelowEdgeEvent(SweepContext& sc, Edge* edge, Node& node); + + void fillRightConcaveEdgeEvent(SweepContext& sc, Edge* edge, Node& node); + + void fillRightConvexEdgeEvent(SweepContext& sc, Edge* edge, Node& node); + + void fillLeftAboveEdgeEvent(SweepContext& sc, Edge* edge, Node* node); + + void fillLeftBelowEdgeEvent(SweepContext& sc, Edge* edge, Node& node); + + void fillLeftConcaveEdgeEvent(SweepContext& sc, Edge* edge, Node& node); + + void fillLeftConvexEdgeEvent(SweepContext& sc, Edge* edge, Node& node); + + void flipEdgeEvent(SweepContext& sc, Point& ep, Point& eq, TriangulationTriangle* t, + Point& p); + + /** + * After a flip we have two triangles and know that only one will still be + * intersecting the edge. So decide which to contiune with and legalize the other + * + * @param sc + * @param o - should be the result of an orient2d( eq, op, ep ) + * @param t - triangle 1 + * @param ot - triangle 2 + * @param p - a point shared by both triangles + * @param op - another point shared by both triangles + * @return returns the triangle still intersecting the edge + */ + TriangulationTriangle& nextFlipTriangle(SweepContext& sc, int o, + TriangulationTriangle& t, TriangulationTriangle& ot, Point& p, Point& op); + + /** + * When we need to traverse from one triangle to the next we need + * the point in current triangle that is the opposite point to the next + * triangle. + * + * @param ep + * @param eq + * @param ot + * @param op + * @return + */ + Point& nextFlipPoint(Point& ep, Point& eq, TriangulationTriangle& ot, Point& op); + + /** + * Scan part of the FlipScan algorithm
+ * When a triangle pair isn't flippable we will scan for the next + * point that is inside the flip triangle scan area. When found + * we generate a new flipEdgeEvent + * + * @param sc + * @param ep - last point on the edge we are traversing + * @param eq - first point on the edge we are traversing + * @param flipTriangle - the current triangle sharing the point eq with edge + * @param t + * @param p + */ + void flipScanEdgeEvent(SweepContext& sc, Point& ep, Point& eq, + TriangulationTriangle& flip_triangle, TriangulationTriangle& t, Point& p); + + void finalizationPolygon(SweepContext& sc); + + std::vector m_Nodes; + unsigned int arrayCount; + +}; + +} + +#endif diff --git a/src/base/triangulate/SweepContext.cpp b/src/base/triangulate/SweepContext.cpp new file mode 100644 index 0000000..16e642e --- /dev/null +++ b/src/base/triangulate/SweepContext.cpp @@ -0,0 +1,196 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +// +// Based on Poly2Tri algorithm. +// Poly2Tri Copyright (c) 2009-2010, Poly2Tri Contributors +// http://code.google.com/p/poly2tri/ +// + +#include "SweepContext.h" +#include +#include "AdvancingFront.h" + +namespace avg { + +SweepContext::SweepContext(std::vector polyline) +{ + m_Basin = Basin(); + m_EdgeEvent = EdgeEvent(); + + m_Points = polyline; + + initEdges(m_Points); +} + +void SweepContext::addHole(std::vector polyline) +{ + initEdges(polyline); + for (unsigned int i = 0; i < polyline.size(); i++) { + m_Points.push_back(polyline[i]); + } +} + +void SweepContext::addPoint(Point* point) +{ + m_Points.push_back(point); +} + +std::vector& SweepContext::getTriangles() +{ + return m_Triangles; +} + +void SweepContext::initTriangulation() +{ + double xmax(m_Points[0]->m_X), xmin(m_Points[0]->m_X); + double ymax(m_Points[0]->m_Y), ymin(m_Points[0]->m_Y); + + // Calculate bounds. + for (unsigned int i = 0; i < m_Points.size(); i++) { + Point& p = *m_Points[i]; + if (p.m_X > xmax) { + xmax = p.m_X; + } + if (p.m_X < xmin) { + xmin = p.m_X; + } + if (p.m_Y > ymax) { + ymax = p.m_Y; + } + if (p.m_Y < ymin) { + ymin = p.m_Y; + } + } + + double dx = kAlpha * (xmax - xmin); + double dy = kAlpha * (ymax - ymin); + m_Head = new Point(xmax + dx, ymin - dy, 0); + m_Tail = new Point(xmin - dx, ymin - dy, 0); + + // Sort along y-axis + std::sort(m_Points.begin(), m_Points.end(), cmp); + +} + +void SweepContext::initEdges(std::vector polyline) +{ + int numPoints = polyline.size(); + for (int i = 0; i < numPoints; i++) { + int j = i < numPoints - 1 ? i + 1 : 0; + + m_EdgeList.push_back(new Edge(*polyline[i], *polyline[j])); + } +} + +Point* SweepContext::getPoint(const int& index) +{ + return m_Points[index]; +} + +void SweepContext::addToMap(TriangulationTriangle* triangle) +{ + m_Map.push_back(triangle); +} + +Node& SweepContext::locateNode(Point& point) +{ + // TO DO implement search tree + return *m_Front->locateNode(point.m_X); +} + +void SweepContext::createAdvancingFront() +{ + // Initial triangle + TriangulationTriangle* triangle = new TriangulationTriangle(*m_Points[0], *m_Tail, + *m_Head); + + m_Map.push_back(triangle); + + m_AfHead = new Node(*triangle->getPoint(1), *triangle); + m_AfMiddle = new Node(*triangle->getPoint(0), *triangle); + m_AfTail = new Node(*triangle->getPoint(2)); + m_Front = new AdvancingFront(*m_AfHead, *m_AfTail); + + m_AfHead->m_Next = m_AfMiddle; + m_AfMiddle->m_Next = m_AfTail; + m_AfMiddle->m_Prev = m_AfHead; + m_AfTail->m_Prev = m_AfMiddle; +} + +void SweepContext::removeNode(Node* node) +{ + delete node; +} + +void SweepContext::mapTriangleToNodes(TriangulationTriangle& t) +{ + for (int i = 0; i < 3; i++) { + if (!t.getNeighbor(i)) { + Node* n = m_Front->locatePoint(t.pointCW(*t.getPoint(i))); + if (n) { + n->m_Triangle = &t; + } + } + } +} + +void SweepContext::removeFromMap(TriangulationTriangle* triangle) +{ + m_Map.remove(triangle); +} + +void SweepContext::meshClean(TriangulationTriangle& triangle) +{ + if (&triangle != NULL && !triangle.isInterior()) { + triangle.isInterior(true); + m_Triangles.push_back(&triangle); + for (int i = 0; i < 3; i++) { + if (!triangle.m_ConstrainedEdge[i]) + meshClean(*triangle.getNeighbor(i)); + } + } +} + +SweepContext::~SweepContext() +{ + + delete m_Head; + delete m_Tail; + delete m_Front; + delete m_AfHead; + delete m_AfMiddle; + delete m_AfTail; + + typedef std::list type_list; + + for (type_list::iterator iter = m_Map.begin(); iter != m_Map.end(); ++iter) { + TriangulationTriangle* ptr = *iter; + delete ptr; + } + + for (unsigned int i = 0; i < m_EdgeList.size(); i++) { + delete m_EdgeList[i]; + } + +} + +} diff --git a/src/base/triangulate/SweepContext.h b/src/base/triangulate/SweepContext.h new file mode 100644 index 0000000..0b9e51d --- /dev/null +++ b/src/base/triangulate/SweepContext.h @@ -0,0 +1,181 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +// +// Based on Poly2Tri algorithm. +// Poly2Tri Copyright (c) 2009-2010, Poly2Tri Contributors +// http://code.google.com/p/poly2tri/ +// + +#ifndef SWEEP_CONTEXT_H +#define SWEEP_CONTEXT_H + +#include +#include +#include + +namespace avg { + +// Inital triangle factor, seed triangle will extend 30% of +// PointSet width to both left and right. +const double kAlpha = 0.3; + +struct Point; +class TriangulationTriangle; +struct Node; +struct Edge; +class AdvancingFront; + +class SweepContext +{ + +public: + + SweepContext(std::vector polyline); + + ~SweepContext(); + + void setHead(Point* p1); + + Point* head(); + + void setTail(Point* p1); + + Point* tail(); + + int pointCount(); + + Node& locateNode(Point& point); + + void removeNode(Node* node); + + void createAdvancingFront(); + +/// Try to map a node to all sides of this triangle that don't have a neighbor + void mapTriangleToNodes(TriangulationTriangle& t); + + void addToMap(TriangulationTriangle* triangle); + + Point* getPoint(const int& index); + + Point* GetPoints(); + + void removeFromMap(TriangulationTriangle* triangle); + + void addHole(std::vector polyline); + + void addPoint(Point* point); + + AdvancingFront* front(); + + void meshClean(TriangulationTriangle& triangle); + + std::vector& getTriangles(); + + std::vector m_EdgeList; + + struct Basin + { + Node* m_LeftNode; + Node* m_BottomNode; + Node* m_RightNode; + double m_Width; + bool m_LeftHighest; + + Basin() + { + clear(); + } + + void clear() { + m_LeftNode = NULL; + m_BottomNode = NULL; + m_RightNode = NULL; + m_Width = 0.0; + m_LeftHighest = false; + } + }; + + struct EdgeEvent + { + Edge* m_ConstrainedEdge; + bool m_Right; + + EdgeEvent() : + m_ConstrainedEdge(NULL), m_Right(false) { + } + }; + + Basin m_Basin; + EdgeEvent m_EdgeEvent; + +private: + + friend class Sweep; + + std::vector m_Triangles; + std::list m_Map; + std::vector m_Points; + + AdvancingFront* m_Front; + Point* m_Head; + Point* m_Tail; + + Node *m_AfHead, *m_AfMiddle, *m_AfTail; + + void initTriangulation(); + void initEdges(std::vector polyline); + +}; + +inline AdvancingFront* SweepContext::front() +{ + return m_Front; +} + +inline int SweepContext::pointCount() +{ + return m_Points.size(); +} + +inline void SweepContext::setHead(Point* p1) +{ + m_Head = p1; +} + +inline Point* SweepContext::head() +{ + return m_Head; +} + +inline void SweepContext::setTail(Point* p1) +{ + m_Tail = p1; +} + +inline Point* SweepContext::tail() +{ + return m_Tail; +} + +} + +#endif diff --git a/src/base/triangulate/Triangulate.cpp b/src/base/triangulate/Triangulate.cpp new file mode 100644 index 0000000..9206327 --- /dev/null +++ b/src/base/triangulate/Triangulate.cpp @@ -0,0 +1,90 @@ +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +// +// Based on Poly2Tri algorithm. +// Poly2Tri Copyright (c) 2009-2010, Poly2Tri Contributors +// http://code.google.com/p/poly2tri/ +// + +#include "Triangulate.h" +#include "Sweep.h" +#include "SweepContext.h" + +#include "Shapes.h" + +using namespace std; + +namespace avg { + +void triangulatePolygon(std::vector& dest, const Vec2Vector& points, + const std::vector& holeIndexes) +{ + std::vector polyline; + std::vector holeLine; + unsigned int contourEnd; + + if (holeIndexes.size() > 0) { + contourEnd = holeIndexes[0]; + } else { + contourEnd = points.size(); + } + + for (unsigned int i = 0; i < contourEnd; i++) { + polyline.push_back(new Point(points[i].x, points[i].y, i)); + } + + SweepContext* sweepContext = new SweepContext(polyline); + Sweep* sweep = new Sweep; + + if (holeIndexes.size() > 0) { + for (unsigned int i = 0; i < holeIndexes.size(); i++) { + if ( i < holeIndexes.size()-1) { + for (unsigned int j = holeIndexes[i]; j < points.size() && j < + holeIndexes[i+1]; j++) + { + holeLine.push_back(new Point(points[j].x, points[j].y, j)); + } + } else { + for (unsigned int j = holeIndexes[i]; j < points.size(); j++) { + holeLine.push_back(new Point(points[j].x, points[j].y, j)); + } + } + sweepContext->addHole(holeLine); + holeLine.clear(); + } + } + + sweep->Triangulate(*sweepContext); + + std::vector& triangles = sweepContext->getTriangles(); + for (unsigned int i = 0; i < triangles.size(); ++i) { + dest.push_back(triangles[i]->getPoint(0)->m_Index); + dest.push_back(triangles[i]->getPoint(1)->m_Index); + dest.push_back(triangles[i]->getPoint(2)->m_Index); + } + + delete sweep; + delete sweepContext; + + for (unsigned int i = 0; i < polyline.size(); i++) { + delete polyline[i]; + } +} + +} diff --git a/src/base/triangulate/Triangulate.h b/src/base/triangulate/Triangulate.h new file mode 100644 index 0000000..af538a6 --- /dev/null +++ b/src/base/triangulate/Triangulate.h @@ -0,0 +1,33 @@ +// +// libavg - Media Playback Engine. +// Copyright (C) 2003-2014 Ulrich von Zadow +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Current versions can be found at www.libavg.de +// + +#ifndef TRIANGULATION_H_ +#define TRIANGULATION_H_ + +#include "../GLMHelper.h" +namespace avg { + + void triangulatePolygon(std::vector& dest, const Vec2Vector& points, + const std::vector& holeIndexes = std::vector()); + +} + +#endif /* TRIANGULATION_H_ */ diff --git a/src/base/triangulate/Utils.h b/src/base/triangulate/Utils.h new file mode 100644 index 0000000..5dd6685 --- /dev/null +++ b/src/base/triangulate/Utils.h @@ -0,0 +1,124 @@ +/* + * Poly2Tri Copyright (c) 2009-2010, Poly2Tri Contributors + * http://code.google.com/p/poly2tri/ + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * * Neither the name of Poly2Tri nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific + * prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef UTILS_H +#define UTILS_H + +// Otherwise #defines like M_PI are undeclared under Visual Studio +#define _USE_MATH_DEFINES + +#include +#include + +namespace avg { + +const double PI_3div4 = 3 * M_PI / 4; +const double EPSILON = 1e-12; + +enum Orientation +{ + CW, CCW, COLLINEAR +}; + +/** + * Forumla to calculate signed area
+ * Positive if CCW
+ * Negative if CW
+ * 0 if collinear
+ *
+ * A[P1,P2,P3]  =  (x1*y2 - y1*x2) + (x2*y3 - y2*x3) + (x3*y1 - y3*x1)
+ *              =  (x1-x3)*(y2-y3) - (y1-y3)*(x2-x3)
+ * 
+ */ +Orientation orient2d(Point& pa, Point& pb, Point& pc) +{ + double detleft = (pa.m_X - pc.m_X) * (pb.m_Y - pc.m_Y); + double detright = (pa.m_Y - pc.m_Y) * (pb.m_X - pc.m_X); + double val = detleft - detright; + if (val > -EPSILON && val < EPSILON) { + return COLLINEAR; + } else if (val > 0) { + return CCW; + } + return CW; +} + +/* + bool InScanArea(Point& pa, Point& pb, Point& pc, Point& pd) + { + double pdx = pd.x; + double pdy = pd.y; + double adx = pa.x - pdx; + double ady = pa.y - pdy; + double bdx = pb.x - pdx; + double bdy = pb.y - pdy; + + double adxbdy = adx * bdy; + double bdxady = bdx * ady; + double oabd = adxbdy - bdxady; + + if (oabd <= EPSILON) { + return false; + } + + double cdx = pc.x - pdx; + double cdy = pc.y - pdy; + + double cdxady = cdx * ady; + double adxcdy = adx * cdy; + double ocad = cdxady - adxcdy; + + if (ocad <= EPSILON) { + return false; + } + + return true; + } + + */ + +bool inScanArea(Point& pa, Point& pb, Point& pc, Point& pd) +{ + double oadb = (pa.m_X - pb.m_X) * (pd.m_Y - pb.m_Y) - (pd.m_X - pb.m_X) * (pa.m_Y - pb.m_Y); + if (oadb >= -EPSILON) { + return false; + } + + double oadc = (pa.m_X - pc.m_X) * (pd.m_Y - pc.m_Y) - (pd.m_X - pc.m_X) * (pa.m_Y - pc.m_Y); + if (oadc <= EPSILON) { + return false; + } + return true; +} + +} + +#endif diff --git a/src/glm/CMakeLists.txt b/src/glm/CMakeLists.txt new file mode 100644 index 0000000..d5ba209 --- /dev/null +++ b/src/glm/CMakeLists.txt @@ -0,0 +1,43 @@ +set(NAME glm) + +file(GLOB ROOT_SOURCE *.cpp) +file(GLOB ROOT_INLINE *.inl) +file(GLOB ROOT_HEADER *.hpp) + +file(GLOB_RECURSE CORE_SOURCE ./core/*.cpp) +file(GLOB_RECURSE CORE_INLINE ./core/*.inl) +file(GLOB_RECURSE CORE_HEADER ./core/*.hpp) + +file(GLOB_RECURSE GTC_SOURCE ./gtc/*.cpp) +file(GLOB_RECURSE GTC_INLINE ./gtc/*.inl) +file(GLOB_RECURSE GTC_HEADER ./gtc/*.hpp) + +file(GLOB_RECURSE GTX_SOURCE ./gtx/*.cpp) +file(GLOB_RECURSE GTX_INLINE ./gtx/*.inl) +file(GLOB_RECURSE GTX_HEADER ./gtx/*.hpp) + +file(GLOB_RECURSE VIRTREV_SOURCE ./virtrev/*.cpp) +file(GLOB_RECURSE VIRTREV_INLINE ./virtrev/*.inl) +file(GLOB_RECURSE VIRTREV_HEADER ./virtrev/*.hpp) + +source_group("Core Files" FILES ${CORE_SOURCE}) +source_group("Core Files" FILES ${CORE_INLINE}) +source_group("Core Files" FILES ${CORE_HEADER}) +source_group("GTC Files" FILES ${GTC_SOURCE}) +source_group("GTC Files" FILES ${GTC_INLINE}) +source_group("GTC Files" FILES ${GTC_HEADER}) +source_group("GTX Files" FILES ${GTX_SOURCE}) +source_group("GTX Files" FILES ${GTX_INLINE}) +source_group("GTX Files" FILES ${GTX_HEADER}) +source_group("VIRTREV Files" FILES ${VIRTREV_SOURCE}) +source_group("VIRTREV Files" FILES ${VIRTREV_INLINE}) +source_group("VIRTREV Files" FILES ${VIRTREV_HEADER}) + +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..) + +add_executable(${NAME} + ${ROOT_SOURCE} ${ROOT_INLINE} ${ROOT_HEADER} + ${CORE_SOURCE} ${CORE_INLINE} ${CORE_HEADER} + ${GTC_SOURCE} ${GTC_INLINE} ${GTC_HEADER} + ${GTX_SOURCE} ${GTX_INLINE} ${GTX_HEADER} + ${VIRTREV_SOURCE} ${VIRTREV_INLINE} ${VIRTREV_HEADER}) diff --git a/src/glm/core/_detail.hpp b/src/glm/core/_detail.hpp new file mode 100644 index 0000000..1ef629c --- /dev/null +++ b/src/glm/core/_detail.hpp @@ -0,0 +1,356 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-07-24 +// Updated : 2008-08-31 +// Licence : This source is under MIT License +// File : glm/core/_detail.hpp +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_core_detail +#define glm_core_detail + +#include "setup.hpp" +#include + +namespace glm{ +namespace detail +{ + class thalf; + +#if(__STDC_VERSION__ >= 199901L) // C99 detected, 64 bit types available + typedef int64_t sint64; + typedef uint64_t uint64; +#elif(GLM_COMPILER & GLM_COMPILER_VC) + typedef signed __int64 sint64; + typedef unsigned __int64 uint64; +#elif(GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_LLVM_GCC | GLM_COMPILER_CLANG)) + __extension__ typedef signed long long sint64; + __extension__ typedef unsigned long long uint64; +#elif(GLM_COMPILER & GLM_COMPILER_BC) + typedef Int64 sint64; + typedef Uint64 uint64; +#else//unknown compiler + typedef signed long long sint64; + typedef unsigned long long uint64; +#endif//GLM_COMPILER + + template + struct If + { + template + static GLM_FUNC_QUALIFIER T apply(F functor, const T& val) + { + return functor(val); + } + }; + + template<> + struct If + { + template + static GLM_FUNC_QUALIFIER T apply(F, const T& val) + { + return val; + } + }; + + //template + //struct traits + //{ + // static const bool is_signed = false; + // static const bool is_float = false; + // static const bool is_vector = false; + // static const bool is_matrix = false; + // static const bool is_genType = false; + // static const bool is_genIType = false; + // static const bool is_genUType = false; + //}; + + //template <> + //struct traits + //{ + // static const bool is_float = true; + // static const bool is_genType = true; + //}; + + //template <> + //struct traits + //{ + // static const bool is_float = true; + // static const bool is_genType = true; + //}; + + //template <> + //struct traits + //{ + // static const bool is_float = true; + // static const bool is_genType = true; + //}; + + //template + //struct desc + //{ + // typedef genType type; + // typedef genType * pointer; + // typedef genType const* const_pointer; + // typedef genType const *const const_pointer_const; + // typedef genType *const pointer_const; + // typedef genType & reference; + // typedef genType const& const_reference; + // typedef genType const& param_type; + + // typedef typename genType::value_type value_type; + // typedef typename genType::size_type size_type; + // static const typename size_type value_size; + //}; + + //template + //const typename desc::size_type desc::value_size = genType::value_size(); + + union uif32 + { + GLM_FUNC_QUALIFIER uif32() : + i(0) + {} + + GLM_FUNC_QUALIFIER uif32(float f) : + f(f) + {} + + GLM_FUNC_QUALIFIER uif32(unsigned int i) : + i(i) + {} + + float f; + unsigned int i; + }; + + union uif64 + { + GLM_FUNC_QUALIFIER uif64() : + i(0) + {} + + GLM_FUNC_QUALIFIER uif64(double f) : + f(f) + {} + + GLM_FUNC_QUALIFIER uif64(uint64 i) : + i(i) + {} + + double f; + uint64 i; + }; + + typedef uif32 uif; + + ////////////////// + // int + + template + struct is_int + { + enum is_int_enum + { + _YES = 0, + _NO = 1 + }; + }; + +#define GLM_DETAIL_IS_INT(T) \ + template <> \ + struct is_int \ + { \ + enum is_int_enum \ + { \ + _YES = 1, \ + _NO = 0 \ + }; \ + } + + ////////////////// + // uint + + template + struct is_uint + { + enum is_uint_enum + { + _YES = 0, + _NO = 1 + }; + }; + +#define GLM_DETAIL_IS_UINT(T) \ + template <> \ + struct is_uint \ + { \ + enum is_uint_enum \ + { \ + _YES = 1, \ + _NO = 0 \ + }; \ + } + + //GLM_DETAIL_IS_UINT(unsigned long long) + + ////////////////// + // float + + template + struct is_float + { + enum is_float_enum + { + _YES = 0, + _NO = 1 + }; + }; + +#define GLM_DETAIL_IS_FLOAT(T) \ + template <> \ + struct is_float \ + { \ + enum is_float_enum \ + { \ + _YES = 1, \ + _NO = 0 \ + }; \ + } + + ////////////////// + // bool + + template + struct is_bool + { + enum is_bool_enum + { + _YES = 0, + _NO = 1 + }; + }; + + template <> + struct is_bool + { + enum is_bool_enum + { + _YES = 1, + _NO = 0 + }; + }; + + ////////////////// + // vector + + template + struct is_vector + { + enum is_vector_enum + { + _YES = 0, + _NO = 1 + }; + }; + +# define GLM_DETAIL_IS_VECTOR(TYPE) \ + template \ + struct is_vector > \ + { \ + enum is_vector_enum \ + { \ + _YES = 1, \ + _NO = 0 \ + }; \ + } + + ////////////////// + // matrix + + template + struct is_matrix + { + enum is_matrix_enum + { + _YES = 0, + _NO = 1 + }; + }; + +#define GLM_DETAIL_IS_MATRIX(T) \ + template <> \ + struct is_matrix \ + { \ + enum is_matrix_enum \ + { \ + _YES = 1, \ + _NO = 0 \ + }; \ + } + + ////////////////// + // type + + template + struct type + { + enum type_enum + { + is_float = is_float::_YES, + is_int = is_int::_YES, + is_uint = is_uint::_YES, + is_bool = is_bool::_YES + }; + }; + + ////////////////// + // type + + typedef signed char int8; + typedef signed short int16; + typedef signed int int32; + typedef detail::sint64 int64; + + typedef unsigned char uint8; + typedef unsigned short uint16; + typedef unsigned int uint32; + typedef detail::uint64 uint64; + + typedef detail::thalf float16; + typedef float float32; + typedef double float64; + +}//namespace detail +}//namespace glm + +#if((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2005)) +# define GLM_DEPRECATED __declspec(deprecated) +# define GLM_ALIGN(x) __declspec(align(x)) +# define GLM_ALIGNED_STRUCT(x) __declspec(align(x)) struct +# define GLM_RESTRICT __declspec(restrict) +# define GLM_RESTRICT_VAR __restrict +#elif((GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_LLVM_GCC)) && (GLM_COMPILER >= GLM_COMPILER_GCC31)) +# define GLM_DEPRECATED __attribute__((__deprecated__)) +# define GLM_ALIGN(x) __attribute__((aligned(x))) +# define GLM_ALIGNED_STRUCT(x) struct __attribute__((aligned(x))) +# if(GLM_COMPILER >= GLM_COMPILER_GCC33) +# define GLM_RESTRICT __restrict__ +# define GLM_RESTRICT_VAR __restrict__ +# else +# define GLM_RESTRICT +# define GLM_RESTRICT_VAR +# endif +# define GLM_RESTRICT __restrict__ +# define GLM_RESTRICT_VAR __restrict__ +#else +# define GLM_DEPRECATED +# define GLM_ALIGN +# define GLM_ALIGNED_STRUCT(x) +# define GLM_RESTRICT +# define GLM_RESTRICT_VAR +#endif//GLM_COMPILER + +#endif//glm_core_detail diff --git a/src/glm/core/_fixes.hpp b/src/glm/core/_fixes.hpp new file mode 100644 index 0000000..50631b5 --- /dev/null +++ b/src/glm/core/_fixes.hpp @@ -0,0 +1,18 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2011-02-21 +// Updated : 2011-02-21 +// Licence : This source is under MIT License +// File : glm/core/_fixes.hpp +/////////////////////////////////////////////////////////////////////////////////////////////////// + +//! Workaround for compatibility with other libraries +#ifdef max +#undef max +#endif + +//! Workaround for compatibility with other libraries +#ifdef min +#undef min +#endif diff --git a/src/glm/core/_swizzle.hpp b/src/glm/core/_swizzle.hpp new file mode 100644 index 0000000..04c85a0 --- /dev/null +++ b/src/glm/core/_swizzle.hpp @@ -0,0 +1,1085 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2006-04-20 +// Updated : 2008-08-22 +// Licence : This source is under MIT License +// File : glm/core/_swizzle.hpp +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_core_swizzle +#define glm_core_swizzle + +namespace glm +{ + enum comp + { + X = 0, + R = 0, + S = 0, + Y = 1, + G = 1, + T = 1, + Z = 2, + B = 2, + P = 2, + W = 3, + A = 3, + Q = 3 + }; +}//namespace glm + +#if(defined(GLM_SWIZZLE_XYZW) || defined(GLM_SWIZZLE)) + +#define xx swizzle(glm::X, glm::X) +#define yx swizzle(glm::Y, glm::X) +#define zx swizzle(glm::Z, glm::X) +#define wx swizzle(glm::W, glm::X) +#define xy swizzle(glm::X, glm::Y) +#define yy swizzle(glm::Y, glm::Y) +#define zy swizzle(glm::Z, glm::Y) +#define wy swizzle(glm::W, glm::Y) +#define xz swizzle(glm::X, glm::Z) +#define yz swizzle(glm::Y, glm::Z) +#define zz swizzle(glm::Z, glm::Z) +#define wz swizzle(glm::W, glm::Z) +#define xw swizzle(glm::X, glm::W) +#define yw swizzle(glm::Y, glm::W) +#define zw swizzle(glm::Z, glm::W) +#define ww swizzle(glm::W, glm::W) + +#endif + +#if(defined(GLM_SWIZZLE_RGBA) || defined(GLM_SWIZZLE)) + +#define rr swizzle(glm::X, glm::X) +#define gr swizzle(glm::Y, glm::X) +#define br swizzle(glm::Z, glm::X) +#define ar swizzle(glm::W, glm::X) +#define rg swizzle(glm::X, glm::Y) +#define gg swizzle(glm::Y, glm::Y) +#define bg swizzle(glm::Z, glm::Y) +#define ag swizzle(glm::W, glm::Y) +#define rb swizzle(glm::X, glm::Z) +#define gb swizzle(glm::Y, glm::Z) +#define bb swizzle(glm::Z, glm::Z) +#define ab swizzle(glm::W, glm::Z) +#define ra swizzle(glm::X, glm::W) +#define ga swizzle(glm::Y, glm::W) +#define ba swizzle(glm::Z, glm::W) +#define aa swizzle(glm::W, glm::W) + +#endif + +#if(defined(GLM_FORCE_SWIZZLE_STPQ) || defined(GLM_SWIZZLE)) + +#define ss swizzle(glm::X, glm::X) +#define ts swizzle(glm::Y, glm::X) +#define ps swizzle(glm::Z, glm::X) +#define qs swizzle(glm::W, glm::X) +#define st swizzle(glm::X, glm::Y) +#define tt swizzle(glm::Y, glm::Y) +#define pt swizzle(glm::Z, glm::Y) +#define qt swizzle(glm::W, glm::Y) +#define sp swizzle(glm::X, glm::Z) +#define tp swizzle(glm::Y, glm::Z) +#define pp swizzle(glm::Z, glm::Z) +#define qp swizzle(glm::W, glm::Z) +#define sq swizzle(glm::X, glm::W) +#define tq swizzle(glm::Y, glm::W) +#define pq swizzle(glm::Z, glm::W) +#define qq swizzle(glm::W, glm::W) + +#endif + +#if(defined(GLM_SWIZZLE_XYZW) || defined(GLM_SWIZZLE)) + +#define xxx swizzle(glm::X, glm::X, glm::X) +#define yxx swizzle(glm::Y, glm::X, glm::X) +#define zxx swizzle(glm::Z, glm::X, glm::X) +#define wxx swizzle(glm::W, glm::X, glm::X) +#define xyx swizzle(glm::X, glm::Y, glm::X) +#define yyx swizzle(glm::Y, glm::Y, glm::X) +#define zyx swizzle(glm::Z, glm::Y, glm::X) +#define wyx swizzle(glm::W, glm::Y, glm::X) +#define xzx swizzle(glm::X, glm::Z, glm::X) +#define yzx swizzle(glm::Y, glm::Z, glm::X) +#define zzx swizzle(glm::Z, glm::Z, glm::X) +#define wzx swizzle(glm::W, glm::Z, glm::X) +#define xwx swizzle(glm::X, glm::W, glm::X) +#define ywx swizzle(glm::Y, glm::W, glm::X) +#define zwx swizzle(glm::Z, glm::W, glm::X) +#define wwx swizzle(glm::W, glm::W, glm::X) +#define xxy swizzle(glm::X, glm::X, glm::Y) +#define yxy swizzle(glm::Y, glm::X, glm::Y) +#define zxy swizzle(glm::Z, glm::X, glm::Y) +#define wxy swizzle(glm::W, glm::X, glm::Y) +#define xyy swizzle(glm::X, glm::Y, glm::Y) +#define yyy swizzle(glm::Y, glm::Y, glm::Y) +#define zyy swizzle(glm::Z, glm::Y, glm::Y) +#define wyy swizzle(glm::W, glm::Y, glm::Y) +#define xzy swizzle(glm::X, glm::Z, glm::Y) +#define yzy swizzle(glm::Y, glm::Z, glm::Y) +#define zzy swizzle(glm::Z, glm::Z, glm::Y) +#define wzy swizzle(glm::W, glm::Z, glm::Y) +#define xwy swizzle(glm::X, glm::W, glm::Y) +#define ywy swizzle(glm::Y, glm::W, glm::Y) +#define zwy swizzle(glm::Z, glm::W, glm::Y) +#define wwy swizzle(glm::W, glm::W, glm::Y) +#define xxz swizzle(glm::X, glm::X, glm::Z) +#define yxz swizzle(glm::Y, glm::X, glm::Z) +#define zxz swizzle(glm::Z, glm::X, glm::Z) +#define wxz swizzle(glm::W, glm::X, glm::Z) +#define xyz swizzle(glm::X, glm::Y, glm::Z) +#define yyz swizzle(glm::Y, glm::Y, glm::Z) +#define zyz swizzle(glm::Z, glm::Y, glm::Z) +#define wyz swizzle(glm::W, glm::Y, glm::Z) +#define xzz swizzle(glm::X, glm::Z, glm::Z) +#define yzz swizzle(glm::Y, glm::Z, glm::Z) +#define zzz swizzle(glm::Z, glm::Z, glm::Z) +#define wzz swizzle(glm::W, glm::Z, glm::Z) +#define xwz swizzle(glm::X, glm::W, glm::Z) +#define ywz swizzle(glm::Y, glm::W, glm::Z) +#define zwz swizzle(glm::Z, glm::W, glm::Z) +#define wwz swizzle(glm::W, glm::W, glm::Z) +#define xxw swizzle(glm::X, glm::X, glm::W) +#define yxw swizzle(glm::Y, glm::X, glm::W) +#define zxw swizzle(glm::Z, glm::X, glm::W) +#define wxw swizzle(glm::W, glm::X, glm::W) +#define xyw swizzle(glm::X, glm::Y, glm::W) +#define yyw swizzle(glm::Y, glm::Y, glm::W) +#define zyw swizzle(glm::Z, glm::Y, glm::W) +#define wyw swizzle(glm::W, glm::Y, glm::W) +#define xzw swizzle(glm::X, glm::Z, glm::W) +#define yzw swizzle(glm::Y, glm::Z, glm::W) +#define zzw swizzle(glm::Z, glm::Z, glm::W) +#define wzw swizzle(glm::W, glm::Z, glm::W) +#define xww swizzle(glm::X, glm::W, glm::W) +#define yww swizzle(glm::Y, glm::W, glm::W) +#define zww swizzle(glm::Z, glm::W, glm::W) +#define www swizzle(glm::W, glm::W, glm::W) + +#endif + +#if(defined(GLM_SWIZZLE_RGBA) || defined(GLM_SWIZZLE)) + +#define rrr swizzle(glm::X, glm::X, glm::X) +#define grr swizzle(glm::Y, glm::X, glm::X) +#define brr swizzle(glm::Z, glm::X, glm::X) +#define arr swizzle(glm::W, glm::X, glm::X) +#define rgr swizzle(glm::X, glm::Y, glm::X) +#define ggr swizzle(glm::Y, glm::Y, glm::X) +#define bgr swizzle(glm::Z, glm::Y, glm::X) +#define agr swizzle(glm::W, glm::Y, glm::X) +#define rbr swizzle(glm::X, glm::Z, glm::X) +#define gbr swizzle(glm::Y, glm::Z, glm::X) +#define bbr swizzle(glm::Z, glm::Z, glm::X) +#define abr swizzle(glm::W, glm::Z, glm::X) +#define rar swizzle(glm::X, glm::W, glm::X) +#define gar swizzle(glm::Y, glm::W, glm::X) +#define bar swizzle(glm::Z, glm::W, glm::X) +#define aar swizzle(glm::W, glm::W, glm::X) +#define rrg swizzle(glm::X, glm::X, glm::Y) +#define grg swizzle(glm::Y, glm::X, glm::Y) +#define brg swizzle(glm::Z, glm::X, glm::Y) +#define arg swizzle(glm::W, glm::X, glm::Y) +#define rgg swizzle(glm::X, glm::Y, glm::Y) +#define ggg swizzle(glm::Y, glm::Y, glm::Y) +#define bgg swizzle(glm::Z, glm::Y, glm::Y) +#define agg swizzle(glm::W, glm::Y, glm::Y) +#define rbg swizzle(glm::X, glm::Z, glm::Y) +#define gbg swizzle(glm::Y, glm::Z, glm::Y) +#define bbg swizzle(glm::Z, glm::Z, glm::Y) +#define abg swizzle(glm::W, glm::Z, glm::Y) +#define rag swizzle(glm::X, glm::W, glm::Y) +#define gag swizzle(glm::Y, glm::W, glm::Y) +#define bag swizzle(glm::Z, glm::W, glm::Y) +#define aag swizzle(glm::W, glm::W, glm::Y) +#define rrb swizzle(glm::X, glm::X, glm::Z) +#define grb swizzle(glm::Y, glm::X, glm::Z) +#define brb swizzle(glm::Z, glm::X, glm::Z) +#define arb swizzle(glm::W, glm::X, glm::Z) +#define rgb swizzle(glm::X, glm::Y, glm::Z) +#define ggb swizzle(glm::Y, glm::Y, glm::Z) +#define bgb swizzle(glm::Z, glm::Y, glm::Z) +#define agb swizzle(glm::W, glm::Y, glm::Z) +#define rbb swizzle(glm::X, glm::Z, glm::Z) +#define gbb swizzle(glm::Y, glm::Z, glm::Z) +#define bbb swizzle(glm::Z, glm::Z, glm::Z) +#define abb swizzle(glm::W, glm::Z, glm::Z) +#define rab swizzle(glm::X, glm::W, glm::Z) +#define gab swizzle(glm::Y, glm::W, glm::Z) +#define bab swizzle(glm::Z, glm::W, glm::Z) +#define aab swizzle(glm::W, glm::W, glm::Z) +#define rra swizzle(glm::X, glm::X, glm::W) +#define gra swizzle(glm::Y, glm::X, glm::W) +#define bra swizzle(glm::Z, glm::X, glm::W) +#define ara swizzle(glm::W, glm::X, glm::W) +#define rga swizzle(glm::X, glm::Y, glm::W) +#define gga swizzle(glm::Y, glm::Y, glm::W) +#define bga swizzle(glm::Z, glm::Y, glm::W) +#define aga swizzle(glm::W, glm::Y, glm::W) +#define rba swizzle(glm::X, glm::Z, glm::W) +#define gba swizzle(glm::Y, glm::Z, glm::W) +#define bba swizzle(glm::Z, glm::Z, glm::W) +#define aba swizzle(glm::W, glm::Z, glm::W) +#define raa swizzle(glm::X, glm::W, glm::W) +#define gaa swizzle(glm::Y, glm::W, glm::W) +#define baa swizzle(glm::Z, glm::W, glm::W) +#define aaa swizzle(glm::W, glm::W, glm::W) + +#endif + +#if(defined(GLM_FORCE_SWIZZLE_STPQ) || defined(GLM_SWIZZLE)) + +#define sss swizzle(glm::X, glm::X, glm::X) +#define tss swizzle(glm::Y, glm::X, glm::X) +#define pss swizzle(glm::Z, glm::X, glm::X) +#define qss swizzle(glm::W, glm::X, glm::X) +#define sts swizzle(glm::X, glm::Y, glm::X) +#define tts swizzle(glm::Y, glm::Y, glm::X) +#define pts swizzle(glm::Z, glm::Y, glm::X) +#define qts swizzle(glm::W, glm::Y, glm::X) +#define sps swizzle(glm::X, glm::Z, glm::X) +#define tps swizzle(glm::Y, glm::Z, glm::X) +#define pps swizzle(glm::Z, glm::Z, glm::X) +#define qps swizzle(glm::W, glm::Z, glm::X) +#define sqs swizzle(glm::X, glm::W, glm::X) +#define tqs swizzle(glm::Y, glm::W, glm::X) +#define pqs swizzle(glm::Z, glm::W, glm::X) +#define qqs swizzle(glm::W, glm::W, glm::X) +#define sst swizzle(glm::X, glm::X, glm::Y) +#define tst swizzle(glm::Y, glm::X, glm::Y) +#define pst swizzle(glm::Z, glm::X, glm::Y) +#define qst swizzle(glm::W, glm::X, glm::Y) +#define stt swizzle(glm::X, glm::Y, glm::Y) +#define ttt swizzle(glm::Y, glm::Y, glm::Y) +#define ptt swizzle(glm::Z, glm::Y, glm::Y) +#define qtt swizzle(glm::W, glm::Y, glm::Y) +#define spt swizzle(glm::X, glm::Z, glm::Y) +#define tpt swizzle(glm::Y, glm::Z, glm::Y) +#define ppt swizzle(glm::Z, glm::Z, glm::Y) +#define qpt swizzle(glm::W, glm::Z, glm::Y) +#define sqt swizzle(glm::X, glm::W, glm::Y) +#define tqt swizzle(glm::Y, glm::W, glm::Y) +#define pqt swizzle(glm::Z, glm::W, glm::Y) +#define qqt swizzle(glm::W, glm::W, glm::Y) +#define ssp swizzle(glm::X, glm::X, glm::Z) +#define tsp swizzle(glm::Y, glm::X, glm::Z) +#define psp swizzle(glm::Z, glm::X, glm::Z) +#define qsp swizzle(glm::W, glm::X, glm::Z) +#define stp swizzle(glm::X, glm::Y, glm::Z) +#define ttp swizzle(glm::Y, glm::Y, glm::Z) +#define ptp swizzle(glm::Z, glm::Y, glm::Z) +#define qtp swizzle(glm::W, glm::Y, glm::Z) +#define spp swizzle(glm::X, glm::Z, glm::Z) +#define tpp swizzle(glm::Y, glm::Z, glm::Z) +#define ppp swizzle(glm::Z, glm::Z, glm::Z) +#define qpp swizzle(glm::W, glm::Z, glm::Z) +#define sqp swizzle(glm::X, glm::W, glm::Z) +#define tqp swizzle(glm::Y, glm::W, glm::Z) +#define pqp swizzle(glm::Z, glm::W, glm::Z) +#define qqp swizzle(glm::W, glm::W, glm::Z) +#define ssq swizzle(glm::X, glm::X, glm::W) +#define tsq swizzle(glm::Y, glm::X, glm::W) +#define psq swizzle(glm::Z, glm::X, glm::W) +#define qsq swizzle(glm::W, glm::X, glm::W) +#define stq swizzle(glm::X, glm::Y, glm::W) +#define ttq swizzle(glm::Y, glm::Y, glm::W) +#define ptq swizzle(glm::Z, glm::Y, glm::W) +#define qtq swizzle(glm::W, glm::Y, glm::W) +#define spq swizzle(glm::X, glm::Z, glm::W) +#define tpq swizzle(glm::Y, glm::Z, glm::W) +#define ppq swizzle(glm::Z, glm::Z, glm::W) +#define qpq swizzle(glm::W, glm::Z, glm::W) +#define sqq swizzle(glm::X, glm::W, glm::W) +#define tqq swizzle(glm::Y, glm::W, glm::W) +#define pqq swizzle(glm::Z, glm::W, glm::W) +#define qqq swizzle(glm::W, glm::W, glm::W) + +#endif + +#if(defined(GLM_SWIZZLE_XYZW) || defined(GLM_SWIZZLE)) + +#define xxxx swizzle(glm::X, glm::X, glm::X, glm::X) +#define yxxx swizzle(glm::Y, glm::X, glm::X, glm::X) +#define zxxx swizzle(glm::Z, glm::X, glm::X, glm::X) +#define wxxx swizzle(glm::W, glm::X, glm::X, glm::X) +#define xyxx swizzle(glm::X, glm::Y, glm::X, glm::X) +#define yyxx swizzle(glm::Y, glm::Y, glm::X, glm::X) +#define zyxx swizzle(glm::Z, glm::Y, glm::X, glm::X) +#define wyxx swizzle(glm::W, glm::Y, glm::X, glm::X) +#define xzxx swizzle(glm::X, glm::Z, glm::X, glm::X) +#define yzxx swizzle(glm::Y, glm::Z, glm::X, glm::X) +#define zzxx swizzle(glm::Z, glm::Z, glm::X, glm::X) +#define wzxx swizzle(glm::W, glm::Z, glm::X, glm::X) +#define xwxx swizzle(glm::X, glm::W, glm::X, glm::X) +#define ywxx swizzle(glm::Y, glm::W, glm::X, glm::X) +#define zwxx swizzle(glm::Z, glm::W, glm::X, glm::X) +#define wwxx swizzle(glm::W, glm::W, glm::X, glm::X) +#define xxyx swizzle(glm::X, glm::X, glm::Y, glm::X) +#define yxyx swizzle(glm::Y, glm::X, glm::Y, glm::X) +#define zxyx swizzle(glm::Z, glm::X, glm::Y, glm::X) +#define wxyx swizzle(glm::W, glm::X, glm::Y, glm::X) +#define xyyx swizzle(glm::X, glm::Y, glm::Y, glm::X) +#define yyyx swizzle(glm::Y, glm::Y, glm::Y, glm::X) +#define zyyx swizzle(glm::Z, glm::Y, glm::Y, glm::X) +#define wyyx swizzle(glm::W, glm::Y, glm::Y, glm::X) +#define xzyx swizzle(glm::X, glm::Z, glm::Y, glm::X) +#define yzyx swizzle(glm::Y, glm::Z, glm::Y, glm::X) +#define zzyx swizzle(glm::Z, glm::Z, glm::Y, glm::X) +#define wzyx swizzle(glm::W, glm::Z, glm::Y, glm::X) +#define xwyx swizzle(glm::X, glm::W, glm::Y, glm::X) +#define ywyx swizzle(glm::Y, glm::W, glm::Y, glm::X) +#define zwyx swizzle(glm::Z, glm::W, glm::Y, glm::X) +#define wwyx swizzle(glm::W, glm::W, glm::Y, glm::X) +#define xxzx swizzle(glm::X, glm::X, glm::Z, glm::X) +#define yxzx swizzle(glm::Y, glm::X, glm::Z, glm::X) +#define zxzx swizzle(glm::Z, glm::X, glm::Z, glm::X) +#define wxzx swizzle(glm::W, glm::X, glm::Z, glm::X) +#define xyzx swizzle(glm::X, glm::Y, glm::Z, glm::X) +#define yyzx swizzle(glm::Y, glm::Y, glm::Z, glm::X) +#define zyzx swizzle(glm::Z, glm::Y, glm::Z, glm::X) +#define wyzx swizzle(glm::W, glm::Y, glm::Z, glm::X) +#define xzzx swizzle(glm::X, glm::Z, glm::Z, glm::X) +#define yzzx swizzle(glm::Y, glm::Z, glm::Z, glm::X) +#define zzzx swizzle(glm::Z, glm::Z, glm::Z, glm::X) +#define wzzx swizzle(glm::W, glm::Z, glm::Z, glm::X) +#define xwzx swizzle(glm::X, glm::W, glm::Z, glm::X) +#define ywzx swizzle(glm::Y, glm::W, glm::Z, glm::X) +#define zwzx swizzle(glm::Z, glm::W, glm::Z, glm::X) +#define wwzx swizzle(glm::W, glm::W, glm::Z, glm::X) +#define xxwx swizzle(glm::X, glm::X, glm::W, glm::X) +#define yxwx swizzle(glm::Y, glm::X, glm::W, glm::X) +#define zxwx swizzle(glm::Z, glm::X, glm::W, glm::X) +#define wxwx swizzle(glm::W, glm::X, glm::W, glm::X) +#define xywx swizzle(glm::X, glm::Y, glm::W, glm::X) +#define yywx swizzle(glm::Y, glm::Y, glm::W, glm::X) +#define zywx swizzle(glm::Z, glm::Y, glm::W, glm::X) +#define wywx swizzle(glm::W, glm::Y, glm::W, glm::X) +#define xzwx swizzle(glm::X, glm::Z, glm::W, glm::X) +#define yzwx swizzle(glm::Y, glm::Z, glm::W, glm::X) +#define zzwx swizzle(glm::Z, glm::Z, glm::W, glm::X) +#define wzwx swizzle(glm::W, glm::Z, glm::W, glm::X) +#define xwwx swizzle(glm::X, glm::W, glm::W, glm::X) +#define ywwx swizzle(glm::Y, glm::W, glm::W, glm::X) +#define zwwx swizzle(glm::Z, glm::W, glm::W, glm::X) +#define wwwx swizzle(glm::W, glm::W, glm::W, glm::X) +#define xxxy swizzle(glm::X, glm::X, glm::X, glm::Y) +#define yxxy swizzle(glm::Y, glm::X, glm::X, glm::Y) +#define zxxy swizzle(glm::Z, glm::X, glm::X, glm::Y) +#define wxxy swizzle(glm::W, glm::X, glm::X, glm::Y) +#define xyxy swizzle(glm::X, glm::Y, glm::X, glm::Y) +#define yyxy swizzle(glm::Y, glm::Y, glm::X, glm::Y) +#define zyxy swizzle(glm::Z, glm::Y, glm::X, glm::Y) +#define wyxy swizzle(glm::W, glm::Y, glm::X, glm::Y) +#define xzxy swizzle(glm::X, glm::Z, glm::X, glm::Y) +#define yzxy swizzle(glm::Y, glm::Z, glm::X, glm::Y) +#define zzxy swizzle(glm::Z, glm::Z, glm::X, glm::Y) +#define wzxy swizzle(glm::W, glm::Z, glm::X, glm::Y) +#define xwxy swizzle(glm::X, glm::W, glm::X, glm::Y) +#define ywxy swizzle(glm::Y, glm::W, glm::X, glm::Y) +#define zwxy swizzle(glm::Z, glm::W, glm::X, glm::Y) +#define wwxy swizzle(glm::W, glm::W, glm::X, glm::Y) +#define xxyy swizzle(glm::X, glm::X, glm::Y, glm::Y) +#define yxyy swizzle(glm::Y, glm::X, glm::Y, glm::Y) +#define zxyy swizzle(glm::Z, glm::X, glm::Y, glm::Y) +#define wxyy swizzle(glm::W, glm::X, glm::Y, glm::Y) +#define xyyy swizzle(glm::X, glm::Y, glm::Y, glm::Y) +#define yyyy swizzle(glm::Y, glm::Y, glm::Y, glm::Y) +#define zyyy swizzle(glm::Z, glm::Y, glm::Y, glm::Y) +#define wyyy swizzle(glm::W, glm::Y, glm::Y, glm::Y) +#define xzyy swizzle(glm::X, glm::Z, glm::Y, glm::Y) +#define yzyy swizzle(glm::Y, glm::Z, glm::Y, glm::Y) +#define zzyy swizzle(glm::Z, glm::Z, glm::Y, glm::Y) +#define wzyy swizzle(glm::W, glm::Z, glm::Y, glm::Y) +#define xwyy swizzle(glm::X, glm::W, glm::Y, glm::Y) +#define ywyy swizzle(glm::Y, glm::W, glm::Y, glm::Y) +#define zwyy swizzle(glm::Z, glm::W, glm::Y, glm::Y) +#define wwyy swizzle(glm::W, glm::W, glm::Y, glm::Y) +#define xxzy swizzle(glm::X, glm::X, glm::Z, glm::Y) +#define yxzy swizzle(glm::Y, glm::X, glm::Z, glm::Y) +#define zxzy swizzle(glm::Z, glm::X, glm::Z, glm::Y) +#define wxzy swizzle(glm::W, glm::X, glm::Z, glm::Y) +#define xyzy swizzle(glm::X, glm::Y, glm::Z, glm::Y) +#define yyzy swizzle(glm::Y, glm::Y, glm::Z, glm::Y) +#define zyzy swizzle(glm::Z, glm::Y, glm::Z, glm::Y) +#define wyzy swizzle(glm::W, glm::Y, glm::Z, glm::Y) +#define xzzy swizzle(glm::X, glm::Z, glm::Z, glm::Y) +#define yzzy swizzle(glm::Y, glm::Z, glm::Z, glm::Y) +#define zzzy swizzle(glm::Z, glm::Z, glm::Z, glm::Y) +#define wzzy swizzle(glm::W, glm::Z, glm::Z, glm::Y) +#define xwzy swizzle(glm::X, glm::W, glm::Z, glm::Y) +#define ywzy swizzle(glm::Y, glm::W, glm::Z, glm::Y) +#define zwzy swizzle(glm::Z, glm::W, glm::Z, glm::Y) +#define wwzy swizzle(glm::W, glm::W, glm::Z, glm::Y) +#define xxwy swizzle(glm::X, glm::X, glm::W, glm::Y) +#define yxwy swizzle(glm::Y, glm::X, glm::W, glm::Y) +#define zxwy swizzle(glm::Z, glm::X, glm::W, glm::Y) +#define wxwy swizzle(glm::W, glm::X, glm::W, glm::Y) +#define xywy swizzle(glm::X, glm::Y, glm::W, glm::Y) +#define yywy swizzle(glm::Y, glm::Y, glm::W, glm::Y) +#define zywy swizzle(glm::Z, glm::Y, glm::W, glm::Y) +#define wywy swizzle(glm::W, glm::Y, glm::W, glm::Y) +#define xzwy swizzle(glm::X, glm::Z, glm::W, glm::Y) +#define yzwy swizzle(glm::Y, glm::Z, glm::W, glm::Y) +#define zzwy swizzle(glm::Z, glm::Z, glm::W, glm::Y) +#define wzwy swizzle(glm::W, glm::Z, glm::W, glm::Y) +#define xwwy swizzle(glm::X, glm::W, glm::W, glm::Y) +#define ywwy swizzle(glm::Y, glm::W, glm::W, glm::Y) +#define zwwy swizzle(glm::Z, glm::W, glm::W, glm::Y) +#define wwwy swizzle(glm::W, glm::W, glm::W, glm::Y) +#define xxxz swizzle(glm::X, glm::X, glm::X, glm::Z) +#define yxxz swizzle(glm::Y, glm::X, glm::X, glm::Z) +#define zxxz swizzle(glm::Z, glm::X, glm::X, glm::Z) +#define wxxz swizzle(glm::W, glm::X, glm::X, glm::Z) +#define xyxz swizzle(glm::X, glm::Y, glm::X, glm::Z) +#define yyxz swizzle(glm::Y, glm::Y, glm::X, glm::Z) +#define zyxz swizzle(glm::Z, glm::Y, glm::X, glm::Z) +#define wyxz swizzle(glm::W, glm::Y, glm::X, glm::Z) +#define xzxz swizzle(glm::X, glm::Z, glm::X, glm::Z) +#define yzxz swizzle(glm::Y, glm::Z, glm::X, glm::Z) +#define zzxz swizzle(glm::Z, glm::Z, glm::X, glm::Z) +#define wzxz swizzle(glm::W, glm::Z, glm::X, glm::Z) +#define xwxz swizzle(glm::X, glm::W, glm::X, glm::Z) +#define ywxz swizzle(glm::Y, glm::W, glm::X, glm::Z) +#define zwxz swizzle(glm::Z, glm::W, glm::X, glm::Z) +#define wwxz swizzle(glm::W, glm::W, glm::X, glm::Z) +#define xxyz swizzle(glm::X, glm::X, glm::Y, glm::Z) +#define yxyz swizzle(glm::Y, glm::X, glm::Y, glm::Z) +#define zxyz swizzle(glm::Z, glm::X, glm::Y, glm::Z) +#define wxyz swizzle(glm::W, glm::X, glm::Y, glm::Z) +#define xyyz swizzle(glm::X, glm::Y, glm::Y, glm::Z) +#define yyyz swizzle(glm::Y, glm::Y, glm::Y, glm::Z) +#define zyyz swizzle(glm::Z, glm::Y, glm::Y, glm::Z) +#define wyyz swizzle(glm::W, glm::Y, glm::Y, glm::Z) +#define xzyz swizzle(glm::X, glm::Z, glm::Y, glm::Z) +#define yzyz swizzle(glm::Y, glm::Z, glm::Y, glm::Z) +#define zzyz swizzle(glm::Z, glm::Z, glm::Y, glm::Z) +#define wzyz swizzle(glm::W, glm::Z, glm::Y, glm::Z) +#define xwyz swizzle(glm::X, glm::W, glm::Y, glm::Z) +#define ywyz swizzle(glm::Y, glm::W, glm::Y, glm::Z) +#define zwyz swizzle(glm::Z, glm::W, glm::Y, glm::Z) +#define wwyz swizzle(glm::W, glm::W, glm::Y, glm::Z) +#define xxzz swizzle(glm::X, glm::X, glm::Z, glm::Z) +#define yxzz swizzle(glm::Y, glm::X, glm::Z, glm::Z) +#define zxzz swizzle(glm::Z, glm::X, glm::Z, glm::Z) +#define wxzz swizzle(glm::W, glm::X, glm::Z, glm::Z) +#define xyzz swizzle(glm::X, glm::Y, glm::Z, glm::Z) +#define yyzz swizzle(glm::Y, glm::Y, glm::Z, glm::Z) +#define zyzz swizzle(glm::Z, glm::Y, glm::Z, glm::Z) +#define wyzz swizzle(glm::W, glm::Y, glm::Z, glm::Z) +#define xzzz swizzle(glm::X, glm::Z, glm::Z, glm::Z) +#define yzzz swizzle(glm::Y, glm::Z, glm::Z, glm::Z) +#define zzzz swizzle(glm::Z, glm::Z, glm::Z, glm::Z) +#define wzzz swizzle(glm::W, glm::Z, glm::Z, glm::Z) +#define xwzz swizzle(glm::X, glm::W, glm::Z, glm::Z) +#define ywzz swizzle(glm::Y, glm::W, glm::Z, glm::Z) +#define zwzz swizzle(glm::Z, glm::W, glm::Z, glm::Z) +#define wwzz swizzle(glm::W, glm::W, glm::Z, glm::Z) +#define xxwz swizzle(glm::X, glm::X, glm::W, glm::Z) +#define yxwz swizzle(glm::Y, glm::X, glm::W, glm::Z) +#define zxwz swizzle(glm::Z, glm::X, glm::W, glm::Z) +#define wxwz swizzle(glm::W, glm::X, glm::W, glm::Z) +#define xywz swizzle(glm::X, glm::Y, glm::W, glm::Z) +#define yywz swizzle(glm::Y, glm::Y, glm::W, glm::Z) +#define zywz swizzle(glm::Z, glm::Y, glm::W, glm::Z) +#define wywz swizzle(glm::W, glm::Y, glm::W, glm::Z) +#define xzwz swizzle(glm::X, glm::Z, glm::W, glm::Z) +#define yzwz swizzle(glm::Y, glm::Z, glm::W, glm::Z) +#define zzwz swizzle(glm::Z, glm::Z, glm::W, glm::Z) +#define wzwz swizzle(glm::W, glm::Z, glm::W, glm::Z) +#define xwwz swizzle(glm::X, glm::W, glm::W, glm::Z) +#define ywwz swizzle(glm::Y, glm::W, glm::W, glm::Z) +#define zwwz swizzle(glm::Z, glm::W, glm::W, glm::Z) +#define wwwz swizzle(glm::W, glm::W, glm::W, glm::Z) +#define xxxw swizzle(glm::X, glm::X, glm::X, glm::W) +#define yxxw swizzle(glm::Y, glm::X, glm::X, glm::W) +#define zxxw swizzle(glm::Z, glm::X, glm::X, glm::W) +#define wxxw swizzle(glm::W, glm::X, glm::X, glm::W) +#define xyxw swizzle(glm::X, glm::Y, glm::X, glm::W) +#define yyxw swizzle(glm::Y, glm::Y, glm::X, glm::W) +#define zyxw swizzle(glm::Z, glm::Y, glm::X, glm::W) +#define wyxw swizzle(glm::W, glm::Y, glm::X, glm::W) +#define xzxw swizzle(glm::X, glm::Z, glm::X, glm::W) +#define yzxw swizzle(glm::Y, glm::Z, glm::X, glm::W) +#define zzxw swizzle(glm::Z, glm::Z, glm::X, glm::W) +#define wzxw swizzle(glm::W, glm::Z, glm::X, glm::W) +#define xwxw swizzle(glm::X, glm::W, glm::X, glm::W) +#define ywxw swizzle(glm::Y, glm::W, glm::X, glm::W) +#define zwxw swizzle(glm::Z, glm::W, glm::X, glm::W) +#define wwxw swizzle(glm::W, glm::W, glm::X, glm::W) +#define xxyw swizzle(glm::X, glm::X, glm::Y, glm::W) +#define yxyw swizzle(glm::Y, glm::X, glm::Y, glm::W) +#define zxyw swizzle(glm::Z, glm::X, glm::Y, glm::W) +#define wxyw swizzle(glm::W, glm::X, glm::Y, glm::W) +#define xyyw swizzle(glm::X, glm::Y, glm::Y, glm::W) +#define yyyw swizzle(glm::Y, glm::Y, glm::Y, glm::W) +#define zyyw swizzle(glm::Z, glm::Y, glm::Y, glm::W) +#define wyyw swizzle(glm::W, glm::Y, glm::Y, glm::W) +#define xzyw swizzle(glm::X, glm::Z, glm::Y, glm::W) +#define yzyw swizzle(glm::Y, glm::Z, glm::Y, glm::W) +#define zzyw swizzle(glm::Z, glm::Z, glm::Y, glm::W) +#define wzyw swizzle(glm::W, glm::Z, glm::Y, glm::W) +#define xwyw swizzle(glm::X, glm::W, glm::Y, glm::W) +#define ywyw swizzle(glm::Y, glm::W, glm::Y, glm::W) +#define zwyw swizzle(glm::Z, glm::W, glm::Y, glm::W) +#define wwyw swizzle(glm::W, glm::W, glm::Y, glm::W) +#define xxzw swizzle(glm::X, glm::X, glm::Z, glm::W) +#define yxzw swizzle(glm::Y, glm::X, glm::Z, glm::W) +#define zxzw swizzle(glm::Z, glm::X, glm::Z, glm::W) +#define wxzw swizzle(glm::W, glm::X, glm::Z, glm::W) +#define xyzw swizzle(glm::X, glm::Y, glm::Z, glm::W) +#define yyzw swizzle(glm::Y, glm::Y, glm::Z, glm::W) +#define zyzw swizzle(glm::Z, glm::Y, glm::Z, glm::W) +#define wyzw swizzle(glm::W, glm::Y, glm::Z, glm::W) +#define xzzw swizzle(glm::X, glm::Z, glm::Z, glm::W) +#define yzzw swizzle(glm::Y, glm::Z, glm::Z, glm::W) +#define zzzw swizzle(glm::Z, glm::Z, glm::Z, glm::W) +#define wzzw swizzle(glm::W, glm::Z, glm::Z, glm::W) +#define xwzw swizzle(glm::X, glm::W, glm::Z, glm::W) +#define ywzw swizzle(glm::Y, glm::W, glm::Z, glm::W) +#define zwzw swizzle(glm::Z, glm::W, glm::Z, glm::W) +#define wwzw swizzle(glm::W, glm::W, glm::Z, glm::W) +#define xxww swizzle(glm::X, glm::X, glm::W, glm::W) +#define yxww swizzle(glm::Y, glm::X, glm::W, glm::W) +#define zxww swizzle(glm::Z, glm::X, glm::W, glm::W) +#define wxww swizzle(glm::W, glm::X, glm::W, glm::W) +#define xyww swizzle(glm::X, glm::Y, glm::W, glm::W) +#define yyww swizzle(glm::Y, glm::Y, glm::W, glm::W) +#define zyww swizzle(glm::Z, glm::Y, glm::W, glm::W) +#define wyww swizzle(glm::W, glm::Y, glm::W, glm::W) +#define xzww swizzle(glm::X, glm::Z, glm::W, glm::W) +#define yzww swizzle(glm::Y, glm::Z, glm::W, glm::W) +#define zzww swizzle(glm::Z, glm::Z, glm::W, glm::W) +#define wzww swizzle(glm::W, glm::Z, glm::W, glm::W) +#define xwww swizzle(glm::X, glm::W, glm::W, glm::W) +#define ywww swizzle(glm::Y, glm::W, glm::W, glm::W) +#define zwww swizzle(glm::Z, glm::W, glm::W, glm::W) +#define wwww swizzle(glm::W, glm::W, glm::W, glm::W) + +#endif + +#if(defined(GLM_SWIZZLE_RGBA) || defined(GLM_SWIZZLE)) + +#define rrrr swizzle(glm::X, glm::X, glm::X, glm::X) +#define grrr swizzle(glm::Y, glm::X, glm::X, glm::X) +#define brrr swizzle(glm::Z, glm::X, glm::X, glm::X) +#define arrr swizzle(glm::W, glm::X, glm::X, glm::X) +#define rgrr swizzle(glm::X, glm::Y, glm::X, glm::X) +#define ggrr swizzle(glm::Y, glm::Y, glm::X, glm::X) +#define bgrr swizzle(glm::Z, glm::Y, glm::X, glm::X) +#define agrr swizzle(glm::W, glm::Y, glm::X, glm::X) +#define rbrr swizzle(glm::X, glm::Z, glm::X, glm::X) +#define gbrr swizzle(glm::Y, glm::Z, glm::X, glm::X) +#define bbrr swizzle(glm::Z, glm::Z, glm::X, glm::X) +#define abrr swizzle(glm::W, glm::Z, glm::X, glm::X) +#define rarr swizzle(glm::X, glm::W, glm::X, glm::X) +#define garr swizzle(glm::Y, glm::W, glm::X, glm::X) +#define barr swizzle(glm::Z, glm::W, glm::X, glm::X) +#define aarr swizzle(glm::W, glm::W, glm::X, glm::X) +#define rrgr swizzle(glm::X, glm::X, glm::Y, glm::X) +#define grgr swizzle(glm::Y, glm::X, glm::Y, glm::X) +#define brgr swizzle(glm::Z, glm::X, glm::Y, glm::X) +#define argr swizzle(glm::W, glm::X, glm::Y, glm::X) +#define rggr swizzle(glm::X, glm::Y, glm::Y, glm::X) +#define gggr swizzle(glm::Y, glm::Y, glm::Y, glm::X) +#define bggr swizzle(glm::Z, glm::Y, glm::Y, glm::X) +#define aggr swizzle(glm::W, glm::Y, glm::Y, glm::X) +#define rbgr swizzle(glm::X, glm::Z, glm::Y, glm::X) +#define gbgr swizzle(glm::Y, glm::Z, glm::Y, glm::X) +#define bbgr swizzle(glm::Z, glm::Z, glm::Y, glm::X) +#define abgr swizzle(glm::W, glm::Z, glm::Y, glm::X) +#define ragr swizzle(glm::X, glm::W, glm::Y, glm::X) +#define gagr swizzle(glm::Y, glm::W, glm::Y, glm::X) +#define bagr swizzle(glm::Z, glm::W, glm::Y, glm::X) +#define aagr swizzle(glm::W, glm::W, glm::Y, glm::X) +#define rrbr swizzle(glm::X, glm::X, glm::Z, glm::X) +#define grbr swizzle(glm::Y, glm::X, glm::Z, glm::X) +#define brbr swizzle(glm::Z, glm::X, glm::Z, glm::X) +#define arbr swizzle(glm::W, glm::X, glm::Z, glm::X) +#define rgbr swizzle(glm::X, glm::Y, glm::Z, glm::X) +#define ggbr swizzle(glm::Y, glm::Y, glm::Z, glm::X) +#define bgbr swizzle(glm::Z, glm::Y, glm::Z, glm::X) +#define agbr swizzle(glm::W, glm::Y, glm::Z, glm::X) +#define rbbr swizzle(glm::X, glm::Z, glm::Z, glm::X) +#define gbbr swizzle(glm::Y, glm::Z, glm::Z, glm::X) +#define bbbr swizzle(glm::Z, glm::Z, glm::Z, glm::X) +#define abbr swizzle(glm::W, glm::Z, glm::Z, glm::X) +#define rabr swizzle(glm::X, glm::W, glm::Z, glm::X) +#define gabr swizzle(glm::Y, glm::W, glm::Z, glm::X) +#define babr swizzle(glm::Z, glm::W, glm::Z, glm::X) +#define aabr swizzle(glm::W, glm::W, glm::Z, glm::X) +#define rrar swizzle(glm::X, glm::X, glm::W, glm::X) +#define grar swizzle(glm::Y, glm::X, glm::W, glm::X) +#define brar swizzle(glm::Z, glm::X, glm::W, glm::X) +#define arar swizzle(glm::W, glm::X, glm::W, glm::X) +#define rgar swizzle(glm::X, glm::Y, glm::W, glm::X) +#define ggar swizzle(glm::Y, glm::Y, glm::W, glm::X) +#define bgar swizzle(glm::Z, glm::Y, glm::W, glm::X) +#define agar swizzle(glm::W, glm::Y, glm::W, glm::X) +#define rbar swizzle(glm::X, glm::Z, glm::W, glm::X) +#define gbar swizzle(glm::Y, glm::Z, glm::W, glm::X) +#define bbar swizzle(glm::Z, glm::Z, glm::W, glm::X) +#define abar swizzle(glm::W, glm::Z, glm::W, glm::X) +#define raar swizzle(glm::X, glm::W, glm::W, glm::X) +#define gaar swizzle(glm::Y, glm::W, glm::W, glm::X) +#define baar swizzle(glm::Z, glm::W, glm::W, glm::X) +#define aaar swizzle(glm::W, glm::W, glm::W, glm::X) +#define rrrg swizzle(glm::X, glm::X, glm::X, glm::Y) +#define grrg swizzle(glm::Y, glm::X, glm::X, glm::Y) +#define brrg swizzle(glm::Z, glm::X, glm::X, glm::Y) +#define arrg swizzle(glm::W, glm::X, glm::X, glm::Y) +#define rgrg swizzle(glm::X, glm::Y, glm::X, glm::Y) +#define ggrg swizzle(glm::Y, glm::Y, glm::X, glm::Y) +#define bgrg swizzle(glm::Z, glm::Y, glm::X, glm::Y) +#define agrg swizzle(glm::W, glm::Y, glm::X, glm::Y) +#define rbrg swizzle(glm::X, glm::Z, glm::X, glm::Y) +#define gbrg swizzle(glm::Y, glm::Z, glm::X, glm::Y) +#define bbrg swizzle(glm::Z, glm::Z, glm::X, glm::Y) +#define abrg swizzle(glm::W, glm::Z, glm::X, glm::Y) +#define rarg swizzle(glm::X, glm::W, glm::X, glm::Y) +#define garg swizzle(glm::Y, glm::W, glm::X, glm::Y) +#define barg swizzle(glm::Z, glm::W, glm::X, glm::Y) +#define aarg swizzle(glm::W, glm::W, glm::X, glm::Y) +#define rrgg swizzle(glm::X, glm::X, glm::Y, glm::Y) +#define grgg swizzle(glm::Y, glm::X, glm::Y, glm::Y) +#define brgg swizzle(glm::Z, glm::X, glm::Y, glm::Y) +#define argg swizzle(glm::W, glm::X, glm::Y, glm::Y) +#define rggg swizzle(glm::X, glm::Y, glm::Y, glm::Y) +#define gggg swizzle(glm::Y, glm::Y, glm::Y, glm::Y) +#define bggg swizzle(glm::Z, glm::Y, glm::Y, glm::Y) +#define aggg swizzle(glm::W, glm::Y, glm::Y, glm::Y) +#define rbgg swizzle(glm::X, glm::Z, glm::Y, glm::Y) +#define gbgg swizzle(glm::Y, glm::Z, glm::Y, glm::Y) +#define bbgg swizzle(glm::Z, glm::Z, glm::Y, glm::Y) +#define abgg swizzle(glm::W, glm::Z, glm::Y, glm::Y) +#define ragg swizzle(glm::X, glm::W, glm::Y, glm::Y) +#define gagg swizzle(glm::Y, glm::W, glm::Y, glm::Y) +#define bagg swizzle(glm::Z, glm::W, glm::Y, glm::Y) +#define aagg swizzle(glm::W, glm::W, glm::Y, glm::Y) +#define rrbg swizzle(glm::X, glm::X, glm::Z, glm::Y) +#define grbg swizzle(glm::Y, glm::X, glm::Z, glm::Y) +#define brbg swizzle(glm::Z, glm::X, glm::Z, glm::Y) +#define arbg swizzle(glm::W, glm::X, glm::Z, glm::Y) +#define rgbg swizzle(glm::X, glm::Y, glm::Z, glm::Y) +#define ggbg swizzle(glm::Y, glm::Y, glm::Z, glm::Y) +#define bgbg swizzle(glm::Z, glm::Y, glm::Z, glm::Y) +#define agbg swizzle(glm::W, glm::Y, glm::Z, glm::Y) +#define rbbg swizzle(glm::X, glm::Z, glm::Z, glm::Y) +#define gbbg swizzle(glm::Y, glm::Z, glm::Z, glm::Y) +#define bbbg swizzle(glm::Z, glm::Z, glm::Z, glm::Y) +#define abbg swizzle(glm::W, glm::Z, glm::Z, glm::Y) +#define rabg swizzle(glm::X, glm::W, glm::Z, glm::Y) +#define gabg swizzle(glm::Y, glm::W, glm::Z, glm::Y) +#define babg swizzle(glm::Z, glm::W, glm::Z, glm::Y) +#define aabg swizzle(glm::W, glm::W, glm::Z, glm::Y) +#define rrag swizzle(glm::X, glm::X, glm::W, glm::Y) +#define grag swizzle(glm::Y, glm::X, glm::W, glm::Y) +#define brag swizzle(glm::Z, glm::X, glm::W, glm::Y) +#define arag swizzle(glm::W, glm::X, glm::W, glm::Y) +#define rgag swizzle(glm::X, glm::Y, glm::W, glm::Y) +#define ggag swizzle(glm::Y, glm::Y, glm::W, glm::Y) +#define bgag swizzle(glm::Z, glm::Y, glm::W, glm::Y) +#define agag swizzle(glm::W, glm::Y, glm::W, glm::Y) +#define rbag swizzle(glm::X, glm::Z, glm::W, glm::Y) +#define gbag swizzle(glm::Y, glm::Z, glm::W, glm::Y) +#define bbag swizzle(glm::Z, glm::Z, glm::W, glm::Y) +#define abag swizzle(glm::W, glm::Z, glm::W, glm::Y) +#define raag swizzle(glm::X, glm::W, glm::W, glm::Y) +#define gaag swizzle(glm::Y, glm::W, glm::W, glm::Y) +#define baag swizzle(glm::Z, glm::W, glm::W, glm::Y) +#define aaag swizzle(glm::W, glm::W, glm::W, glm::Y) +#define rrrb swizzle(glm::X, glm::X, glm::X, glm::Z) +#define grrb swizzle(glm::Y, glm::X, glm::X, glm::Z) +#define brrb swizzle(glm::Z, glm::X, glm::X, glm::Z) +#define arrb swizzle(glm::W, glm::X, glm::X, glm::Z) +#define rgrb swizzle(glm::X, glm::Y, glm::X, glm::Z) +#define ggrb swizzle(glm::Y, glm::Y, glm::X, glm::Z) +#define bgrb swizzle(glm::Z, glm::Y, glm::X, glm::Z) +#define agrb swizzle(glm::W, glm::Y, glm::X, glm::Z) +#define rbrb swizzle(glm::X, glm::Z, glm::X, glm::Z) +#define gbrb swizzle(glm::Y, glm::Z, glm::X, glm::Z) +#define bbrb swizzle(glm::Z, glm::Z, glm::X, glm::Z) +#define abrb swizzle(glm::W, glm::Z, glm::X, glm::Z) +#define rarb swizzle(glm::X, glm::W, glm::X, glm::Z) +#define garb swizzle(glm::Y, glm::W, glm::X, glm::Z) +#define barb swizzle(glm::Z, glm::W, glm::X, glm::Z) +#define aarb swizzle(glm::W, glm::W, glm::X, glm::Z) +#define rrgb swizzle(glm::X, glm::X, glm::Y, glm::Z) +#define grgb swizzle(glm::Y, glm::X, glm::Y, glm::Z) +#define brgb swizzle(glm::Z, glm::X, glm::Y, glm::Z) +#define argb swizzle(glm::W, glm::X, glm::Y, glm::Z) +#define rggb swizzle(glm::X, glm::Y, glm::Y, glm::Z) +#define gggb swizzle(glm::Y, glm::Y, glm::Y, glm::Z) +#define bggb swizzle(glm::Z, glm::Y, glm::Y, glm::Z) +#define aggb swizzle(glm::W, glm::Y, glm::Y, glm::Z) +#define rbgb swizzle(glm::X, glm::Z, glm::Y, glm::Z) +#define gbgb swizzle(glm::Y, glm::Z, glm::Y, glm::Z) +#define bbgb swizzle(glm::Z, glm::Z, glm::Y, glm::Z) +#define abgb swizzle(glm::W, glm::Z, glm::Y, glm::Z) +#define ragb swizzle(glm::X, glm::W, glm::Y, glm::Z) +#define gagb swizzle(glm::Y, glm::W, glm::Y, glm::Z) +#define bagb swizzle(glm::Z, glm::W, glm::Y, glm::Z) +#define aagb swizzle(glm::W, glm::W, glm::Y, glm::Z) +#define rrbb swizzle(glm::X, glm::X, glm::Z, glm::Z) +#define grbb swizzle(glm::Y, glm::X, glm::Z, glm::Z) +#define brbb swizzle(glm::Z, glm::X, glm::Z, glm::Z) +#define arbb swizzle(glm::W, glm::X, glm::Z, glm::Z) +#define rgbb swizzle(glm::X, glm::Y, glm::Z, glm::Z) +#define ggbb swizzle(glm::Y, glm::Y, glm::Z, glm::Z) +#define bgbb swizzle(glm::Z, glm::Y, glm::Z, glm::Z) +#define agbb swizzle(glm::W, glm::Y, glm::Z, glm::Z) +#define rbbb swizzle(glm::X, glm::Z, glm::Z, glm::Z) +#define gbbb swizzle(glm::Y, glm::Z, glm::Z, glm::Z) +#define bbbb swizzle(glm::Z, glm::Z, glm::Z, glm::Z) +#define abbb swizzle(glm::W, glm::Z, glm::Z, glm::Z) +#define rabb swizzle(glm::X, glm::W, glm::Z, glm::Z) +#define gabb swizzle(glm::Y, glm::W, glm::Z, glm::Z) +#define babb swizzle(glm::Z, glm::W, glm::Z, glm::Z) +#define aabb swizzle(glm::W, glm::W, glm::Z, glm::Z) +#define rrab swizzle(glm::X, glm::X, glm::W, glm::Z) +#define grab swizzle(glm::Y, glm::X, glm::W, glm::Z) +#define brab swizzle(glm::Z, glm::X, glm::W, glm::Z) +#define arab swizzle(glm::W, glm::X, glm::W, glm::Z) +#define rgab swizzle(glm::X, glm::Y, glm::W, glm::Z) +#define ggab swizzle(glm::Y, glm::Y, glm::W, glm::Z) +#define bgab swizzle(glm::Z, glm::Y, glm::W, glm::Z) +#define agab swizzle(glm::W, glm::Y, glm::W, glm::Z) +#define rbab swizzle(glm::X, glm::Z, glm::W, glm::Z) +#define gbab swizzle(glm::Y, glm::Z, glm::W, glm::Z) +#define bbab swizzle(glm::Z, glm::Z, glm::W, glm::Z) +#define abab swizzle(glm::W, glm::Z, glm::W, glm::Z) +#define raab swizzle(glm::X, glm::W, glm::W, glm::Z) +#define gaab swizzle(glm::Y, glm::W, glm::W, glm::Z) +#define baab swizzle(glm::Z, glm::W, glm::W, glm::Z) +#define aaab swizzle(glm::W, glm::W, glm::W, glm::Z) +#define rrra swizzle(glm::X, glm::X, glm::X, glm::W) +#define grra swizzle(glm::Y, glm::X, glm::X, glm::W) +#define brra swizzle(glm::Z, glm::X, glm::X, glm::W) +#define arra swizzle(glm::W, glm::X, glm::X, glm::W) +#define rgra swizzle(glm::X, glm::Y, glm::X, glm::W) +#define ggra swizzle(glm::Y, glm::Y, glm::X, glm::W) +#define bgra swizzle(glm::Z, glm::Y, glm::X, glm::W) +#define agra swizzle(glm::W, glm::Y, glm::X, glm::W) +#define rbra swizzle(glm::X, glm::Z, glm::X, glm::W) +#define gbra swizzle(glm::Y, glm::Z, glm::X, glm::W) +#define bbra swizzle(glm::Z, glm::Z, glm::X, glm::W) +#define abra swizzle(glm::W, glm::Z, glm::X, glm::W) +#define rara swizzle(glm::X, glm::W, glm::X, glm::W) +#define gara swizzle(glm::Y, glm::W, glm::X, glm::W) +#define bara swizzle(glm::Z, glm::W, glm::X, glm::W) +#define aara swizzle(glm::W, glm::W, glm::X, glm::W) +#define rrga swizzle(glm::X, glm::X, glm::Y, glm::W) +#define grga swizzle(glm::Y, glm::X, glm::Y, glm::W) +#define brga swizzle(glm::Z, glm::X, glm::Y, glm::W) +#define arga swizzle(glm::W, glm::X, glm::Y, glm::W) +#define rgga swizzle(glm::X, glm::Y, glm::Y, glm::W) +#define ggga swizzle(glm::Y, glm::Y, glm::Y, glm::W) +#define bgga swizzle(glm::Z, glm::Y, glm::Y, glm::W) +#define agga swizzle(glm::W, glm::Y, glm::Y, glm::W) +#define rbga swizzle(glm::X, glm::Z, glm::Y, glm::W) +#define gbga swizzle(glm::Y, glm::Z, glm::Y, glm::W) +#define bbga swizzle(glm::Z, glm::Z, glm::Y, glm::W) +#define abga swizzle(glm::W, glm::Z, glm::Y, glm::W) +#define raga swizzle(glm::X, glm::W, glm::Y, glm::W) +#define gaga swizzle(glm::Y, glm::W, glm::Y, glm::W) +#define baga swizzle(glm::Z, glm::W, glm::Y, glm::W) +#define aaga swizzle(glm::W, glm::W, glm::Y, glm::W) +#define rrba swizzle(glm::X, glm::X, glm::Z, glm::W) +#define grba swizzle(glm::Y, glm::X, glm::Z, glm::W) +#define brba swizzle(glm::Z, glm::X, glm::Z, glm::W) +#define arba swizzle(glm::W, glm::X, glm::Z, glm::W) +#define rgba swizzle(glm::X, glm::Y, glm::Z, glm::W) +#define ggba swizzle(glm::Y, glm::Y, glm::Z, glm::W) +#define bgba swizzle(glm::Z, glm::Y, glm::Z, glm::W) +#define agba swizzle(glm::W, glm::Y, glm::Z, glm::W) +#define rbba swizzle(glm::X, glm::Z, glm::Z, glm::W) +#define gbba swizzle(glm::Y, glm::Z, glm::Z, glm::W) +#define bbba swizzle(glm::Z, glm::Z, glm::Z, glm::W) +#define abba swizzle(glm::W, glm::Z, glm::Z, glm::W) +#define raba swizzle(glm::X, glm::W, glm::Z, glm::W) +#define gaba swizzle(glm::Y, glm::W, glm::Z, glm::W) +#define baba swizzle(glm::Z, glm::W, glm::Z, glm::W) +#define aaba swizzle(glm::W, glm::W, glm::Z, glm::W) +#define rraa swizzle(glm::X, glm::X, glm::W, glm::W) +#define graa swizzle(glm::Y, glm::X, glm::W, glm::W) +#define braa swizzle(glm::Z, glm::X, glm::W, glm::W) +#define araa swizzle(glm::W, glm::X, glm::W, glm::W) +#define rgaa swizzle(glm::X, glm::Y, glm::W, glm::W) +#define ggaa swizzle(glm::Y, glm::Y, glm::W, glm::W) +#define bgaa swizzle(glm::Z, glm::Y, glm::W, glm::W) +#define agaa swizzle(glm::W, glm::Y, glm::W, glm::W) +#define rbaa swizzle(glm::X, glm::Z, glm::W, glm::W) +#define gbaa swizzle(glm::Y, glm::Z, glm::W, glm::W) +#define bbaa swizzle(glm::Z, glm::Z, glm::W, glm::W) +#define abaa swizzle(glm::W, glm::Z, glm::W, glm::W) +#define raaa swizzle(glm::X, glm::W, glm::W, glm::W) +#define gaaa swizzle(glm::Y, glm::W, glm::W, glm::W) +#define baaa swizzle(glm::Z, glm::W, glm::W, glm::W) +#define aaaa swizzle(glm::W, glm::W, glm::W, glm::W) + +#endif + +#if(defined(GLM_FORCE_SWIZZLE_STPQ) || defined(GLM_SWIZZLE)) + +#define ssss swizzle(glm::X, glm::X, glm::X, glm::X) +#define tsss swizzle(glm::Y, glm::X, glm::X, glm::X) +#define psss swizzle(glm::Z, glm::X, glm::X, glm::X) +#define qsss swizzle(glm::W, glm::X, glm::X, glm::X) +#define stss swizzle(glm::X, glm::Y, glm::X, glm::X) +#define ttss swizzle(glm::Y, glm::Y, glm::X, glm::X) +#define ptss swizzle(glm::Z, glm::Y, glm::X, glm::X) +#define qtss swizzle(glm::W, glm::Y, glm::X, glm::X) +#define spss swizzle(glm::X, glm::Z, glm::X, glm::X) +#define tpss swizzle(glm::Y, glm::Z, glm::X, glm::X) +#define ppss swizzle(glm::Z, glm::Z, glm::X, glm::X) +#define qpss swizzle(glm::W, glm::Z, glm::X, glm::X) +#define sqss swizzle(glm::X, glm::W, glm::X, glm::X) +#define tqss swizzle(glm::Y, glm::W, glm::X, glm::X) +#define pqss swizzle(glm::Z, glm::W, glm::X, glm::X) +#define qqss swizzle(glm::W, glm::W, glm::X, glm::X) +#define ssts swizzle(glm::X, glm::X, glm::Y, glm::X) +#define tsts swizzle(glm::Y, glm::X, glm::Y, glm::X) +#define psts swizzle(glm::Z, glm::X, glm::Y, glm::X) +#define qsts swizzle(glm::W, glm::X, glm::Y, glm::X) +#define stts swizzle(glm::X, glm::Y, glm::Y, glm::X) +#define ttts swizzle(glm::Y, glm::Y, glm::Y, glm::X) +#define ptts swizzle(glm::Z, glm::Y, glm::Y, glm::X) +#define qtts swizzle(glm::W, glm::Y, glm::Y, glm::X) +#define spts swizzle(glm::X, glm::Z, glm::Y, glm::X) +#define tpts swizzle(glm::Y, glm::Z, glm::Y, glm::X) +#define ppts swizzle(glm::Z, glm::Z, glm::Y, glm::X) +#define qpts swizzle(glm::W, glm::Z, glm::Y, glm::X) +#define sqts swizzle(glm::X, glm::W, glm::Y, glm::X) +#define tqts swizzle(glm::Y, glm::W, glm::Y, glm::X) +#define pqts swizzle(glm::Z, glm::W, glm::Y, glm::X) +#define qqts swizzle(glm::W, glm::W, glm::Y, glm::X) +#define ssps swizzle(glm::X, glm::X, glm::Z, glm::X) +#define tsps swizzle(glm::Y, glm::X, glm::Z, glm::X) +#define psps swizzle(glm::Z, glm::X, glm::Z, glm::X) +#define qsps swizzle(glm::W, glm::X, glm::Z, glm::X) +#define stps swizzle(glm::X, glm::Y, glm::Z, glm::X) +#define ttps swizzle(glm::Y, glm::Y, glm::Z, glm::X) +#define ptps swizzle(glm::Z, glm::Y, glm::Z, glm::X) +#define qtps swizzle(glm::W, glm::Y, glm::Z, glm::X) +#define spps swizzle(glm::X, glm::Z, glm::Z, glm::X) +#define tpps swizzle(glm::Y, glm::Z, glm::Z, glm::X) +#define ppps swizzle(glm::Z, glm::Z, glm::Z, glm::X) +#define qpps swizzle(glm::W, glm::Z, glm::Z, glm::X) +#define sqps swizzle(glm::X, glm::W, glm::Z, glm::X) +#define tqps swizzle(glm::Y, glm::W, glm::Z, glm::X) +#define pqps swizzle(glm::Z, glm::W, glm::Z, glm::X) +#define qqps swizzle(glm::W, glm::W, glm::Z, glm::X) +#define ssqs swizzle(glm::X, glm::X, glm::W, glm::X) +#define tsqs swizzle(glm::Y, glm::X, glm::W, glm::X) +#define psqs swizzle(glm::Z, glm::X, glm::W, glm::X) +#define qsqs swizzle(glm::W, glm::X, glm::W, glm::X) +#define stqs swizzle(glm::X, glm::Y, glm::W, glm::X) +#define ttqs swizzle(glm::Y, glm::Y, glm::W, glm::X) +#define ptqs swizzle(glm::Z, glm::Y, glm::W, glm::X) +#define qtqs swizzle(glm::W, glm::Y, glm::W, glm::X) +#define spqs swizzle(glm::X, glm::Z, glm::W, glm::X) +#define tpqs swizzle(glm::Y, glm::Z, glm::W, glm::X) +#define ppqs swizzle(glm::Z, glm::Z, glm::W, glm::X) +#define qpqs swizzle(glm::W, glm::Z, glm::W, glm::X) +#define sqqs swizzle(glm::X, glm::W, glm::W, glm::X) +#define tqqs swizzle(glm::Y, glm::W, glm::W, glm::X) +#define pqqs swizzle(glm::Z, glm::W, glm::W, glm::X) +#define qqqs swizzle(glm::W, glm::W, glm::W, glm::X) +#define ssst swizzle(glm::X, glm::X, glm::X, glm::Y) +#define tsst swizzle(glm::Y, glm::X, glm::X, glm::Y) +#define psst swizzle(glm::Z, glm::X, glm::X, glm::Y) +#define qsst swizzle(glm::W, glm::X, glm::X, glm::Y) +#define stst swizzle(glm::X, glm::Y, glm::X, glm::Y) +#define ttst swizzle(glm::Y, glm::Y, glm::X, glm::Y) +#define ptst swizzle(glm::Z, glm::Y, glm::X, glm::Y) +#define qtst swizzle(glm::W, glm::Y, glm::X, glm::Y) +#define spst swizzle(glm::X, glm::Z, glm::X, glm::Y) +#define tpst swizzle(glm::Y, glm::Z, glm::X, glm::Y) +#define ppst swizzle(glm::Z, glm::Z, glm::X, glm::Y) +#define qpst swizzle(glm::W, glm::Z, glm::X, glm::Y) +#define sqst swizzle(glm::X, glm::W, glm::X, glm::Y) +#define tqst swizzle(glm::Y, glm::W, glm::X, glm::Y) +#define pqst swizzle(glm::Z, glm::W, glm::X, glm::Y) +#define qqst swizzle(glm::W, glm::W, glm::X, glm::Y) +#define sstt swizzle(glm::X, glm::X, glm::Y, glm::Y) +#define tstt swizzle(glm::Y, glm::X, glm::Y, glm::Y) +#define pstt swizzle(glm::Z, glm::X, glm::Y, glm::Y) +#define qstt swizzle(glm::W, glm::X, glm::Y, glm::Y) +#define sttt swizzle(glm::X, glm::Y, glm::Y, glm::Y) +#define tttt swizzle(glm::Y, glm::Y, glm::Y, glm::Y) +#define pttt swizzle(glm::Z, glm::Y, glm::Y, glm::Y) +#define qttt swizzle(glm::W, glm::Y, glm::Y, glm::Y) +#define sptt swizzle(glm::X, glm::Z, glm::Y, glm::Y) +#define tptt swizzle(glm::Y, glm::Z, glm::Y, glm::Y) +#define pptt swizzle(glm::Z, glm::Z, glm::Y, glm::Y) +#define qptt swizzle(glm::W, glm::Z, glm::Y, glm::Y) +#define sqtt swizzle(glm::X, glm::W, glm::Y, glm::Y) +#define tqtt swizzle(glm::Y, glm::W, glm::Y, glm::Y) +#define pqtt swizzle(glm::Z, glm::W, glm::Y, glm::Y) +#define qqtt swizzle(glm::W, glm::W, glm::Y, glm::Y) +#define sspt swizzle(glm::X, glm::X, glm::Z, glm::Y) +#define tspt swizzle(glm::Y, glm::X, glm::Z, glm::Y) +#define pspt swizzle(glm::Z, glm::X, glm::Z, glm::Y) +#define qspt swizzle(glm::W, glm::X, glm::Z, glm::Y) +#define stpt swizzle(glm::X, glm::Y, glm::Z, glm::Y) +#define ttpt swizzle(glm::Y, glm::Y, glm::Z, glm::Y) +#define ptpt swizzle(glm::Z, glm::Y, glm::Z, glm::Y) +#define qtpt swizzle(glm::W, glm::Y, glm::Z, glm::Y) +#define sppt swizzle(glm::X, glm::Z, glm::Z, glm::Y) +#define tppt swizzle(glm::Y, glm::Z, glm::Z, glm::Y) +#define pppt swizzle(glm::Z, glm::Z, glm::Z, glm::Y) +#define qppt swizzle(glm::W, glm::Z, glm::Z, glm::Y) +#define sqpt swizzle(glm::X, glm::W, glm::Z, glm::Y) +#define tqpt swizzle(glm::Y, glm::W, glm::Z, glm::Y) +#define pqpt swizzle(glm::Z, glm::W, glm::Z, glm::Y) +#define qqpt swizzle(glm::W, glm::W, glm::Z, glm::Y) +#define ssqt swizzle(glm::X, glm::X, glm::W, glm::Y) +#define tsqt swizzle(glm::Y, glm::X, glm::W, glm::Y) +#define psqt swizzle(glm::Z, glm::X, glm::W, glm::Y) +#define qsqt swizzle(glm::W, glm::X, glm::W, glm::Y) +#define stqt swizzle(glm::X, glm::Y, glm::W, glm::Y) +#define ttqt swizzle(glm::Y, glm::Y, glm::W, glm::Y) +#define ptqt swizzle(glm::Z, glm::Y, glm::W, glm::Y) +#define qtqt swizzle(glm::W, glm::Y, glm::W, glm::Y) +#define spqt swizzle(glm::X, glm::Z, glm::W, glm::Y) +#define tpqt swizzle(glm::Y, glm::Z, glm::W, glm::Y) +#define ppqt swizzle(glm::Z, glm::Z, glm::W, glm::Y) +#define qpqt swizzle(glm::W, glm::Z, glm::W, glm::Y) +#define sqqt swizzle(glm::X, glm::W, glm::W, glm::Y) +#define tqqt swizzle(glm::Y, glm::W, glm::W, glm::Y) +#define pqqt swizzle(glm::Z, glm::W, glm::W, glm::Y) +#define qqqt swizzle(glm::W, glm::W, glm::W, glm::Y) +#define sssp swizzle(glm::X, glm::X, glm::X, glm::Z) +#define tssp swizzle(glm::Y, glm::X, glm::X, glm::Z) +#define pssp swizzle(glm::Z, glm::X, glm::X, glm::Z) +#define qssp swizzle(glm::W, glm::X, glm::X, glm::Z) +#define stsp swizzle(glm::X, glm::Y, glm::X, glm::Z) +#define ttsp swizzle(glm::Y, glm::Y, glm::X, glm::Z) +#define ptsp swizzle(glm::Z, glm::Y, glm::X, glm::Z) +#define qtsp swizzle(glm::W, glm::Y, glm::X, glm::Z) +#define spsp swizzle(glm::X, glm::Z, glm::X, glm::Z) +#define tpsp swizzle(glm::Y, glm::Z, glm::X, glm::Z) +#define ppsp swizzle(glm::Z, glm::Z, glm::X, glm::Z) +#define qpsp swizzle(glm::W, glm::Z, glm::X, glm::Z) +#define sqsp swizzle(glm::X, glm::W, glm::X, glm::Z) +#define tqsp swizzle(glm::Y, glm::W, glm::X, glm::Z) +#define pqsp swizzle(glm::Z, glm::W, glm::X, glm::Z) +#define qqsp swizzle(glm::W, glm::W, glm::X, glm::Z) +#define sstp swizzle(glm::X, glm::X, glm::Y, glm::Z) +#define tstp swizzle(glm::Y, glm::X, glm::Y, glm::Z) +#define pstp swizzle(glm::Z, glm::X, glm::Y, glm::Z) +#define qstp swizzle(glm::W, glm::X, glm::Y, glm::Z) +#define sttp swizzle(glm::X, glm::Y, glm::Y, glm::Z) +#define tttp swizzle(glm::Y, glm::Y, glm::Y, glm::Z) +#define pttp swizzle(glm::Z, glm::Y, glm::Y, glm::Z) +#define qttp swizzle(glm::W, glm::Y, glm::Y, glm::Z) +#define sptp swizzle(glm::X, glm::Z, glm::Y, glm::Z) +#define tptp swizzle(glm::Y, glm::Z, glm::Y, glm::Z) +#define pptp swizzle(glm::Z, glm::Z, glm::Y, glm::Z) +#define qptp swizzle(glm::W, glm::Z, glm::Y, glm::Z) +#define sqtp swizzle(glm::X, glm::W, glm::Y, glm::Z) +#define tqtp swizzle(glm::Y, glm::W, glm::Y, glm::Z) +#define pqtp swizzle(glm::Z, glm::W, glm::Y, glm::Z) +#define qqtp swizzle(glm::W, glm::W, glm::Y, glm::Z) +#define sspp swizzle(glm::X, glm::X, glm::Z, glm::Z) +#define tspp swizzle(glm::Y, glm::X, glm::Z, glm::Z) +#define pspp swizzle(glm::Z, glm::X, glm::Z, glm::Z) +#define qspp swizzle(glm::W, glm::X, glm::Z, glm::Z) +#define stpp swizzle(glm::X, glm::Y, glm::Z, glm::Z) +#define ttpp swizzle(glm::Y, glm::Y, glm::Z, glm::Z) +#define ptpp swizzle(glm::Z, glm::Y, glm::Z, glm::Z) +#define qtpp swizzle(glm::W, glm::Y, glm::Z, glm::Z) +#define sppp swizzle(glm::X, glm::Z, glm::Z, glm::Z) +#define tppp swizzle(glm::Y, glm::Z, glm::Z, glm::Z) +#define pppp swizzle(glm::Z, glm::Z, glm::Z, glm::Z) +#define qppp swizzle(glm::W, glm::Z, glm::Z, glm::Z) +#define sqpp swizzle(glm::X, glm::W, glm::Z, glm::Z) +#define tqpp swizzle(glm::Y, glm::W, glm::Z, glm::Z) +#define pqpp swizzle(glm::Z, glm::W, glm::Z, glm::Z) +#define qqpp swizzle(glm::W, glm::W, glm::Z, glm::Z) +#define ssqp swizzle(glm::X, glm::X, glm::W, glm::Z) +#define tsqp swizzle(glm::Y, glm::X, glm::W, glm::Z) +#define psqp swizzle(glm::Z, glm::X, glm::W, glm::Z) +#define qsqp swizzle(glm::W, glm::X, glm::W, glm::Z) +#define stqp swizzle(glm::X, glm::Y, glm::W, glm::Z) +#define ttqp swizzle(glm::Y, glm::Y, glm::W, glm::Z) +#define ptqp swizzle(glm::Z, glm::Y, glm::W, glm::Z) +#define qtqp swizzle(glm::W, glm::Y, glm::W, glm::Z) +#define spqp swizzle(glm::X, glm::Z, glm::W, glm::Z) +#define tpqp swizzle(glm::Y, glm::Z, glm::W, glm::Z) +#define ppqp swizzle(glm::Z, glm::Z, glm::W, glm::Z) +#define qpqp swizzle(glm::W, glm::Z, glm::W, glm::Z) +#define sqqp swizzle(glm::X, glm::W, glm::W, glm::Z) +#define tqqp swizzle(glm::Y, glm::W, glm::W, glm::Z) +#define pqqp swizzle(glm::Z, glm::W, glm::W, glm::Z) +#define qqqp swizzle(glm::W, glm::W, glm::W, glm::Z) +#define sssq swizzle(glm::X, glm::X, glm::X, glm::W) +#define tssq swizzle(glm::Y, glm::X, glm::X, glm::W) +#define pssq swizzle(glm::Z, glm::X, glm::X, glm::W) +#define qssq swizzle(glm::W, glm::X, glm::X, glm::W) +#define stsq swizzle(glm::X, glm::Y, glm::X, glm::W) +#define ttsq swizzle(glm::Y, glm::Y, glm::X, glm::W) +#define ptsq swizzle(glm::Z, glm::Y, glm::X, glm::W) +#define qtsq swizzle(glm::W, glm::Y, glm::X, glm::W) +#define spsq swizzle(glm::X, glm::Z, glm::X, glm::W) +#define tpsq swizzle(glm::Y, glm::Z, glm::X, glm::W) +#define ppsq swizzle(glm::Z, glm::Z, glm::X, glm::W) +#define qpsq swizzle(glm::W, glm::Z, glm::X, glm::W) +#define sqsq swizzle(glm::X, glm::W, glm::X, glm::W) +#define tqsq swizzle(glm::Y, glm::W, glm::X, glm::W) +#define pqsq swizzle(glm::Z, glm::W, glm::X, glm::W) +#define qqsq swizzle(glm::W, glm::W, glm::X, glm::W) +#define sstq swizzle(glm::X, glm::X, glm::Y, glm::W) +#define tstq swizzle(glm::Y, glm::X, glm::Y, glm::W) +#define pstq swizzle(glm::Z, glm::X, glm::Y, glm::W) +#define qstq swizzle(glm::W, glm::X, glm::Y, glm::W) +#define sttq swizzle(glm::X, glm::Y, glm::Y, glm::W) +#define tttq swizzle(glm::Y, glm::Y, glm::Y, glm::W) +#define pttq swizzle(glm::Z, glm::Y, glm::Y, glm::W) +#define qttq swizzle(glm::W, glm::Y, glm::Y, glm::W) +#define sptq swizzle(glm::X, glm::Z, glm::Y, glm::W) +#define tptq swizzle(glm::Y, glm::Z, glm::Y, glm::W) +#define pptq swizzle(glm::Z, glm::Z, glm::Y, glm::W) +#define qptq swizzle(glm::W, glm::Z, glm::Y, glm::W) +#define sqtq swizzle(glm::X, glm::W, glm::Y, glm::W) +#define tqtq swizzle(glm::Y, glm::W, glm::Y, glm::W) +#define pqtq swizzle(glm::Z, glm::W, glm::Y, glm::W) +#define qqtq swizzle(glm::W, glm::W, glm::Y, glm::W) +#define sspq swizzle(glm::X, glm::X, glm::Z, glm::W) +#define tspq swizzle(glm::Y, glm::X, glm::Z, glm::W) +#define pspq swizzle(glm::Z, glm::X, glm::Z, glm::W) +#define qspq swizzle(glm::W, glm::X, glm::Z, glm::W) +#define stpq swizzle(glm::X, glm::Y, glm::Z, glm::W) +#define ttpq swizzle(glm::Y, glm::Y, glm::Z, glm::W) +#define ptpq swizzle(glm::Z, glm::Y, glm::Z, glm::W) +#define qtpq swizzle(glm::W, glm::Y, glm::Z, glm::W) +#define sppq swizzle(glm::X, glm::Z, glm::Z, glm::W) +#define tppq swizzle(glm::Y, glm::Z, glm::Z, glm::W) +#define pppq swizzle(glm::Z, glm::Z, glm::Z, glm::W) +#define qppq swizzle(glm::W, glm::Z, glm::Z, glm::W) +#define sqpq swizzle(glm::X, glm::W, glm::Z, glm::W) +#define tqpq swizzle(glm::Y, glm::W, glm::Z, glm::W) +#define pqpq swizzle(glm::Z, glm::W, glm::Z, glm::W) +#define qqpq swizzle(glm::W, glm::W, glm::Z, glm::W) +#define ssqq swizzle(glm::X, glm::X, glm::W, glm::W) +#define tsqq swizzle(glm::Y, glm::X, glm::W, glm::W) +#define psqq swizzle(glm::Z, glm::X, glm::W, glm::W) +#define qsqq swizzle(glm::W, glm::X, glm::W, glm::W) +#define stqq swizzle(glm::X, glm::Y, glm::W, glm::W) +#define ttqq swizzle(glm::Y, glm::Y, glm::W, glm::W) +#define ptqq swizzle(glm::Z, glm::Y, glm::W, glm::W) +#define qtqq swizzle(glm::W, glm::Y, glm::W, glm::W) +#define spqq swizzle(glm::X, glm::Z, glm::W, glm::W) +#define tpqq swizzle(glm::Y, glm::Z, glm::W, glm::W) +#define ppqq swizzle(glm::Z, glm::Z, glm::W, glm::W) +#define qpqq swizzle(glm::W, glm::Z, glm::W, glm::W) +#define sqqq swizzle(glm::X, glm::W, glm::W, glm::W) +#define tqqq swizzle(glm::Y, glm::W, glm::W, glm::W) +#define pqqq swizzle(glm::Z, glm::W, glm::W, glm::W) +#define qqqq swizzle(glm::W, glm::W, glm::W, glm::W) + +#endif + +#endif//glm_core_swizzle diff --git a/src/glm/core/dummy.cpp b/src/glm/core/dummy.cpp new file mode 100644 index 0000000..3c603ff --- /dev/null +++ b/src/glm/core/dummy.cpp @@ -0,0 +1,20 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2011-01-19 +// Updated : 2011-01-19 +// Licence : This source is under MIT License +// File : glm/setup.hpp +/////////////////////////////////////////////////////////////////////////////////////////////////// +// GLM is a header only library. There is nothing to compile. +// dummy.cpp exist only a wordaround for CMake file. + +#include "../glm.hpp" +#include "../ext.hpp" + +//#error "GLM is a header only library" + +int main() +{ + +} diff --git a/src/glm/core/func_common.hpp b/src/glm/core/func_common.hpp new file mode 100644 index 0000000..1a233ec --- /dev/null +++ b/src/glm/core/func_common.hpp @@ -0,0 +1,337 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-03-08 +// Updated : 2010-01-26 +// Licence : This source is under MIT License +// File : glm/core/func_common.hpp +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_core_func_common +#define glm_core_func_common + +#include "_fixes.hpp" + +namespace glm +{ + namespace core{ + namespace function{ + namespace common{ //!< Define common functions from Section 8.3 of GLSL 1.30.8 specification. Included in glm namespace. + + /// \addtogroup core_funcs + ///@{ + + //! Returns x if x >= 0; otherwise, it returns -x. + //! + //! \li GLSL abs man page + //! \li GLSL 1.30.08 specification, section 8.3 + template + genFIType abs(genFIType const & x); + + //! Returns 1.0 if x > 0, 0.0 if x == 0, or -1.0 if x < 0. + //! + //! \li GLSL sign man page + //! \li GLSL 1.30.08 specification, section 8.3 + template + genFIType sign(genFIType const & x); + + //! Returns a value equal to the nearest integer that is less then or equal to x. + //! + //! \li GLSL floor man page + //! \li GLSL 1.30.08 specification, section 8.3 + template + genType floor(genType const & x); + + //! Returns a value equal to the nearest integer to x + //! whose absolute value is not larger than the absolute value of x. + //! + //! \li GLSL trunc man page + //! \li GLSL 1.30.08 specification, section 8.3 + template + genType trunc(genType const & x); + + //! Returns a value equal to the nearest integer to x. + //! The fraction 0.5 will round in a direction chosen by the + //! implementation, presumably the direction that is fastest. + //! This includes the possibility that round(x) returns the + //! same value as roundEven(x) for all values of x. + //! + //! \li GLSL round man page + //! \li GLSL 1.30.08 specification, section 8.3 + template + genType round(genType const & x); + + //! Returns a value equal to the nearest integer to x. + //! A fractional part of 0.5 will round toward the nearest even + //! integer. (Both 3.5 and 4.5 for x will return 4.0.) + //! + //! \li GLSL roundEven man page + //! \li GLSL 1.30.08 specification, section 8.3 + template + genType roundEven(genType const & x); + + //! Returns a value equal to the nearest integer + //! that is greater than or equal to x. + //! + //! \li GLSL ceil man page + //! \li GLSL 1.30.08 specification, section 8.3 + template + genType ceil(genType const & x); + + //! Return x - floor(x). + //! + //! \li GLSL fract man page + //! \li GLSL 1.30.08 specification, section 8.3 + template + genType fract(genType const & x); + + //! Modulus. Returns x - y * floor(x / y) + //! for each component in x using the floating point value y. + //! + //! \li GLSL mod man page + //! \li GLSL 1.30.08 specification, section 8.3 + template + genType mod( + genType const & x, + genType const & y); + + //! Modulus. Returns x - y * floor(x / y) + //! for each component in x using the floating point value y. + //! + //! \li GLSL mod man page + //! \li GLSL 1.30.08 specification, section 8.3 + template + genType mod( + genType const & x, + typename genType::value_type const & y); + + //! Returns the fractional part of x and sets i to the integer + //! part (as a whole number floating point value). Both the + //! return value and the output parameter will have the same + //! sign as x. + //! + //! \li GLSL modf man page + //! \li GLSL 1.30.08 specification, section 8.3 + template + genType modf( + genType const & x, + genType & i); + + //! Returns y if y < x; otherwise, it returns x. + //! + //! \li GLSL min man page + //! \li GLSL 1.30.08 specification, section 8.3 + template + genType min( + genType const & x, + genType const & y); + + template + genType min( + genType const & x, + typename genType::value_type const & y); + + //! Returns y if x < y; otherwise, it returns x. + //! + //! \li GLSL max man page + //! \li GLSL 1.30.08 specification, section 8.3 + template + genType max( + genType const & x, + genType const & y); + + template + genType max( + genType const & x, + typename genType::value_type const & y); + + //! Returns min(max(x, minVal), maxVal) for each component in x + //! using the floating-point values minVal and maxVal. + //! + //! \li GLSL clamp man page + //! \li GLSL 1.30.08 specification, section 8.3 + template + genType clamp( + genType const & x, + genType const & minVal, + genType const & maxVal); + + template + genType clamp( + genType const & x, + typename genType::value_type const & minVal, + typename genType::value_type const & maxVal); + + //! \return If genTypeU is a floating scalar or vector: + //! Returns x * (1.0 - a) + y * a, i.e., the linear blend of + //! x and y using the floating-point value a. + //! The value for a is not restricted to the range [0, 1]. + //! + //! \return If genTypeU is a boolean scalar or vector: + //! Selects which vector each returned component comes + //! from. For a component of a that is false, the + //! corresponding component of x is returned. For a + //! component of a that is true, the corresponding + //! component of y is returned. Components of x and y that + //! are not selected are allowed to be invalid floating point + //! values and will have no effect on the results. Thus, this + //! provides different functionality than + //! genType mix(genType x, genType y, genType(a)) + //! where a is a Boolean vector. + //! + //! \li GLSL mix man page + //! \li GLSL 1.30.08 specification, section 8.3 + //! + //! \param[in] x Floating point scalar or vector. + //! \param[in] y Floating point scalar or vector. + //! \param[in] a Floating point or boolean scalar or vector. + //! + // \todo Test when 'a' is a boolean. + template + genTypeT mix(genTypeT const & x, genTypeT const & y, genTypeU const & a); + + //! Returns 0.0 if x < edge, otherwise it returns 1.0. + //! + //! \li GLSL step man page + //! \li GLSL 1.30.08 specification, section 8.3 + template + genType step( + genType const & edge, + genType const & x); + + template + genType step( + typename genType::value_type const & edge, + genType const & x); + + //! Returns 0.0 if x <= edge0 and 1.0 if x >= edge1 and + //! performs smooth Hermite interpolation between 0 and 1 + //! when edge0 < x < edge1. This is useful in cases where + //! you would want a threshold function with a smooth + //! transition. This is equivalent to: + //! genType t; + //! t = clamp ((x edge0) / (edge1 edge0), 0, 1); + //! return t * t * (3 2 * t); + //! Results are undefined if edge0 >= edge1. + //! + //! \li GLSL smoothstep man page + //! \li GLSL 1.30.08 specification, section 8.3 + template + genType smoothstep( + genType const & edge0, + genType const & edge1, + genType const & x); + + template + genType smoothstep( + typename genType::value_type const & edge0, + typename genType::value_type const & edge1, + genType const & x); + + //! Returns true if x holds a NaN (not a number) + //! representation in the underlying implementation's set of + //! floating point representations. Returns false otherwise, + //! including for implementations with no NaN + //! representations. + //! + //! \li GLSL isnan man page + //! \li GLSL 1.30.08 specification, section 8.3 + template + typename genType::bool_type isnan(genType const & x); + + //! Returns true if x holds a positive infinity or negative + //! infinity representation in the underlying implementation's + //! set of floating point representations. Returns false + //! otherwise, including for implementations with no infinity + //! representations. + //! + //! \li GLSL isinf man page + //! \li GLSL 1.30.08 specification, section 8.3 + template + typename genType::bool_type isinf(genType const & x); + + //! Returns a signed integer value representing + //! the encoding of a floating-point value. The floatingpoint + //! value's bit-level representation is preserved. + //! + //! \li GLSL floatBitsToInt man page + //! \li GLSL 4.00.08 specification, section 8.3 + template + genIType floatBitsToInt(genType const & value); + + //! Returns a unsigned integer value representing + //! the encoding of a floating-point value. The floatingpoint + //! value's bit-level representation is preserved. + //! + //! \li GLSL floatBitsToUint man page + //! \li GLSL 4.00.08 specification, section 8.3 + template + genUType floatBitsToUint(genType const & value); + + //! Returns a floating-point value corresponding to a signed + //! integer encoding of a floating-point value. + //! If an inf or NaN is passed in, it will not signal, and the + //! resulting floating point value is unspecified. Otherwise, + //! the bit-level representation is preserved. + //! + //! \li GLSL intBitsToFloat man page + //! \li GLSL 4.00.08 specification, section 8.3 + template + genType intBitsToFloat(genIType const & value); + + //! Returns a floating-point value corresponding to a + //! unsigned integer encoding of a floating-point value. + //! If an inf or NaN is passed in, it will not signal, and the + //! resulting floating point value is unspecified. Otherwise, + //! the bit-level representation is preserved. + //! + //! \li GLSL uintBitsToFloat man page + //! \li GLSL 4.00.08 specification, section 8.3 + template + genType uintBitsToFloat(genUType const & value); + + //! Computes and returns a * b + c. + //! + //! \li GLSL fma man page + //! \li GLSL 4.00.08 specification, section 8.3 + template + genType fma(genType const & a, genType const & b, genType const & c); + + //! Splits x into a floating-point significand in the range + //! [0.5, 1.0) and an integral exponent of two, such that: + //! x = significand * exp(2, exponent) + //! + //! The significand is returned by the function and the + //! exponent is returned in the parameter exp. For a + //! floating-point value of zero, the significant and exponent + //! are both zero. For a floating-point value that is an + //! infinity or is not a number, the results are undefined. + //! + //! \li GLSL frexp man page + //! \li GLSL 4.00.08 specification, section 8.3 + template + genType frexp(genType const & x, genIType & exp); + + //! Builds a floating-point number from x and the + //! corresponding integral exponent of two in exp, returning: + //! significand * exp(2, exponent) + //! + //! If this product is too large to be represented in the + //! floating-point type, the result is undefined. + //! + //! \li GLSL ldexp man page; + //! \li GLSL 4.00.08 specification, section 8.3 + template + genType ldexp(genType const & x, genIType const & exp); + + ///@} + }//namespace common + }//namespace function + }//namespace core + + using namespace core::function::common; +}//namespace glm + +#include "func_common.inl" + +#endif//glm_core_func_common diff --git a/src/glm/core/func_common.inl b/src/glm/core/func_common.inl new file mode 100644 index 0000000..38c65c9 --- /dev/null +++ b/src/glm/core/func_common.inl @@ -0,0 +1,1577 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-08-03 +// Updated : 2010-01-26 +// Licence : This source is under MIT License +// File : glm/core/func_common.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm +{ + namespace detail + { + template + struct Abs_ + { + }; + + template + struct Abs_ + { + static genFIType get(genFIType const & x) + { + GLM_STATIC_ASSERT( + detail::type::is_float || + detail::type::is_int, "'abs' only accept floating-point and integer inputs"); + return x >= genFIType(0) ? x : -x; + } + }; + + template + struct Abs_ + { + static genFIType get(genFIType const & x) + { + GLM_STATIC_ASSERT( + detail::type::is_uint, "'abs' only accept floating-point and integer inputs"); + + return x; + } + }; + }//namespace detail + + namespace core{ + namespace function{ + namespace common{ + + // abs + template + GLM_FUNC_QUALIFIER genFIType abs( + genFIType const & x) + { + return detail::Abs_::is_signed>::get(x); + } + + //template + //GLM_FUNC_QUALIFIER detail::tvec1 abs( + // detail::tvec1 const & v) + //{ + // return detail::tvec1( + // abs(v.x)); + //} + + template + GLM_FUNC_QUALIFIER detail::tvec2 abs( + detail::tvec2 const & v) + { + return detail::tvec2( + abs(v.x), + abs(v.y)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 abs( + detail::tvec3 const & v) + { + return detail::tvec3( + abs(v.x), + abs(v.y), + abs(v.z)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 abs( + detail::tvec4 const & v) + { + return detail::tvec4( + abs(v.x), + abs(v.y), + abs(v.z), + abs(v.w)); + } + + // sign + + //Try something like based on x >> 31 to get the sign bit + template + GLM_FUNC_QUALIFIER genFIType sign( + genFIType const & x) + { + GLM_STATIC_ASSERT( + detail::type::is_float || + detail::type::is_int, "'sign' only accept signed inputs"); + + genFIType result; + if(x > genFIType(0)) + result = genFIType(1); + else if(x < genFIType(0)) + result = genFIType(-1); + else + result = genFIType(0); + return result; + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 sign( + detail::tvec2 const & x) + { + return detail::tvec2( + sign(x.x), + sign(x.y)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 sign( + detail::tvec3 const & x) + { + return detail::tvec3( + sign(x.x), + sign(x.y), + sign(x.z)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 sign( + detail::tvec4 const & x) + { + return detail::tvec4( + sign(x.x), + sign(x.y), + sign(x.z), + sign(x.w)); + } + + // floor + template <> + GLM_FUNC_QUALIFIER detail::thalf floor(detail::thalf const& x) + { + return detail::thalf(::std::floor(float(x))); + } + + template + GLM_FUNC_QUALIFIER genType floor(genType const& x) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'floor' only accept floating-point inputs"); + + return ::std::floor(x); + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 floor(detail::tvec2 const& x) + { + return detail::tvec2( + floor(x.x), + floor(x.y)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 floor(detail::tvec3 const& x) + { + return detail::tvec3( + floor(x.x), + floor(x.y), + floor(x.z)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 floor(detail::tvec4 const& x) + { + return detail::tvec4( + floor(x.x), + floor(x.y), + floor(x.z), + floor(x.w)); + } + + // trunc + template + GLM_FUNC_QUALIFIER genType trunc(genType const & x) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'trunc' only accept floating-point inputs"); + return x < 0 ? -floor(-x) : floor(x); + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 trunc(detail::tvec2 const & x) + { + return detail::tvec2( + trunc(x.x), + trunc(x.y)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 trunc(detail::tvec3 const & x) + { + return detail::tvec3( + trunc(x.x), + trunc(x.y), + trunc(x.z)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 trunc(detail::tvec4 const & x) + { + return detail::tvec4( + trunc(x.x), + trunc(x.y), + trunc(x.z), + trunc(x.w)); + } + + // round + template + GLM_FUNC_QUALIFIER genType round(genType const& x) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'round' only accept floating-point inputs"); + + return genType(int(x + genType(0.5))); + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 round(detail::tvec2 const& x) + { + return detail::tvec2( + round(x.x), + round(x.y)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 round(detail::tvec3 const& x) + { + return detail::tvec3( + round(x.x), + round(x.y), + round(x.z)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 round(detail::tvec4 const& x) + { + return detail::tvec4( + round(x.x), + round(x.y), + round(x.z), + round(x.w)); + } + + // roundEven + template + GLM_FUNC_QUALIFIER genType roundEven(genType const& x) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'roundEven' only accept floating-point inputs"); + + return genType(int(x + genType(int(x) % 2))); + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 roundEven(detail::tvec2 const& x) + { + return detail::tvec2( + roundEven(x.x), + roundEven(x.y)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 roundEven(detail::tvec3 const& x) + { + return detail::tvec3( + roundEven(x.x), + roundEven(x.y), + roundEven(x.z)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 roundEven(detail::tvec4 const& x) + { + return detail::tvec4( + roundEven(x.x), + roundEven(x.y), + roundEven(x.z), + roundEven(x.w)); + } + + // ceil + template + GLM_FUNC_QUALIFIER genType ceil(genType const & x) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'ceil' only accept floating-point inputs"); + + return ::std::ceil(x); + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 ceil(detail::tvec2 const & x) + { + return detail::tvec2( + ceil(x.x), + ceil(x.y)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 ceil(detail::tvec3 const & x) + { + return detail::tvec3( + ceil(x.x), + ceil(x.y), + ceil(x.z)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 ceil(detail::tvec4 const & x) + { + return detail::tvec4( + ceil(x.x), + ceil(x.y), + ceil(x.z), + ceil(x.w)); + } + + // fract + template + GLM_FUNC_QUALIFIER genType fract + ( + genType const & x + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'fract' only accept floating-point inputs"); + + return x - ::std::floor(x); + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 fract + ( + detail::tvec2 const & x + ) + { + return detail::tvec2( + fract(x.x), + fract(x.y)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 fract + ( + detail::tvec3 const & x + ) + { + return detail::tvec3( + fract(x.x), + fract(x.y), + fract(x.z)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 fract + ( + detail::tvec4 const & x + ) + { + return detail::tvec4( + fract(x.x), + fract(x.y), + fract(x.z), + fract(x.w)); + } + + // mod + template + GLM_FUNC_QUALIFIER genType mod + ( + genType const & x, + genType const & y + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'mod' only accept floating-point inputs"); + + return x - y * floor(x / y); + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 mod + ( + detail::tvec2 const & x, + typename detail::tvec2::value_type const & y + ) + { + return detail::tvec2( + mod(x.x, y), + mod(x.y, y)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 mod + ( + detail::tvec3 const & x, + typename detail::tvec3::value_type const & y + ) + { + return detail::tvec3( + mod(x.x, y), + mod(x.y, y), + mod(x.z, y)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 mod + ( + detail::tvec4 const & x, + typename detail::tvec4::value_type const & y + ) + { + return detail::tvec4( + mod(x.x, y), + mod(x.y, y), + mod(x.z, y), + mod(x.w, y)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 mod + ( + detail::tvec2 const & x, + detail::tvec2 const & y + ) + { + return detail::tvec2( + mod(x.x, y.x), + mod(x.y, y.y)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 mod + ( + detail::tvec3 const & x, + detail::tvec3 const & y + ) + { + return detail::tvec3( + mod(x.x, y.x), + mod(x.y, y.y), + mod(x.z, y.z)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 mod + ( + detail::tvec4 const & x, + detail::tvec4 const & y + ) + { + return detail::tvec4( + mod(x.x, y.x), + mod(x.y, y.y), + mod(x.z, y.z), + mod(x.w, y.w)); + } + + // modf + template + GLM_FUNC_QUALIFIER genType modf + ( + genType const & x, + genType & i + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'modf' only accept floating-point inputs"); + + i = glm::floor(x); + + return x - i; + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 modf + ( + detail::tvec2 const & x, + detail::tvec2 const & y + ) + { + return detail::tvec2( + modf(x.x, y.x), + modf(x.y, y.y)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 modf + ( + detail::tvec3 const & x, + detail::tvec3 const & y + ) + { + return detail::tvec3( + modf(x.x, y.x), + modf(x.y, y.y), + modf(x.z, y.z)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 modf + ( + detail::tvec4 const & x, + detail::tvec4 const & y + ) + { + return detail::tvec4( + modf(x.x, y.x), + modf(x.y, y.y), + modf(x.z, y.z), + modf(x.w, y.w)); + } + + //// Only valid if (INT_MIN <= x-y <= INT_MAX) + //// min(x,y) + //r = y + ((x - y) & ((x - y) >> (sizeof(int) * + //CHAR_BIT 1))); + //// max(x,y) + //r = x - ((x - y) & ((x - y) >> (sizeof(int) * + //CHAR_BIT - 1))); + + // min + template + GLM_FUNC_QUALIFIER genType min + ( + genType const & x, + genType const & y + ) + { + GLM_STATIC_ASSERT( + detail::type::is_float || + detail::type::is_int || + detail::type::is_uint, "'min' only accept numbers"); + + return x < y ? x : y; + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 min + ( + detail::tvec2 const & x, + typename detail::tvec2::value_type const & y + ) + { + return detail::tvec2( + min(x.x, y), + min(x.y, y)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 min + ( + detail::tvec3 const & x, + typename detail::tvec3::value_type const & y + ) + { + return detail::tvec3( + min(x.x, y), + min(x.y, y), + min(x.z, y)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 min + ( + detail::tvec4 const & x, + typename detail::tvec4::value_type const & y + ) + { + return detail::tvec4( + min(x.x, y), + min(x.y, y), + min(x.z, y), + min(x.w, y)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 min + ( + detail::tvec2 const & x, + detail::tvec2 const & y + ) + { + return detail::tvec2( + min(x.x, y.x), + min(x.y, y.y)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 min + ( + detail::tvec3 const & x, + detail::tvec3 const & y + ) + { + return detail::tvec3( + min(x.x, y.x), + min(x.y, y.y), + min(x.z, y.z)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 min + ( + detail::tvec4 const & x, + detail::tvec4 const & y + ) + { + return detail::tvec4( + min(x.x, y.x), + min(x.y, y.y), + min(x.z, y.z), + min(x.w, y.w)); + } + + // max + template + GLM_FUNC_QUALIFIER genType max + ( + genType const & x, + genType const & y + ) + { + GLM_STATIC_ASSERT( + detail::type::is_float || + detail::type::is_int || + detail::type::is_uint, "'max' only accept numbers"); + + return x > y ? x : y; + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 max + ( + detail::tvec2 const & x, + typename detail::tvec2::value_type y + ) + { + return detail::tvec2( + max(x.x, y), + max(x.y, y)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 max + ( + detail::tvec3 const & x, + typename detail::tvec3::value_type y + ) + { + return detail::tvec3( + max(x.x, y), + max(x.y, y), + max(x.z, y)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 max + ( + detail::tvec4 const & x, + typename detail::tvec4::value_type y + ) + { + return detail::tvec4( + max(x.x, y), + max(x.y, y), + max(x.z, y), + max(x.w, y)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 max + ( + detail::tvec2 const & x, + detail::tvec2 const & y + ) + { + return detail::tvec2( + max(x.x, y.x), + max(x.y, y.y)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 max + ( + detail::tvec3 const & x, + detail::tvec3 const & y + ) + { + return detail::tvec3( + max(x.x, y.x), + max(x.y, y.y), + max(x.z, y.z)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 max + ( + detail::tvec4 const & x, + detail::tvec4 const & y) + { + return detail::tvec4( + max(x.x, y.x), + max(x.y, y.y), + max(x.z, y.z), + max(x.w, y.w)); + } + + // clamp + template + GLM_FUNC_QUALIFIER valType clamp + ( + valType const & x, + valType const & minVal, + valType const & maxVal + ) + { + GLM_STATIC_ASSERT( + detail::type::is_float || + detail::type::is_int || + detail::type::is_uint, "'clamp' only accept numbers"); + + // Old implementation, less predictable branching + //if(x >= maxVal) return maxVal; + //if(x <= minVal) return minVal; + //return x; + return glm::max(glm::min(x, maxVal), minVal); + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 clamp + ( + detail::tvec2 const & x, + typename detail::tvec2::value_type const & minVal, + typename detail::tvec2::value_type const & maxVal + ) + { + return detail::tvec2( + clamp(x.x, minVal, maxVal), + clamp(x.y, minVal, maxVal)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 clamp + ( + detail::tvec3 const & x, + typename detail::tvec3::value_type const & minVal, + typename detail::tvec3::value_type const & maxVal + ) + { + return detail::tvec3( + clamp(x.x, minVal, maxVal), + clamp(x.y, minVal, maxVal), + clamp(x.z, minVal, maxVal)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 clamp + ( + detail::tvec4 const & x, + typename detail::tvec4::value_type const & minVal, + typename detail::tvec4::value_type const & maxVal + ) + { + return detail::tvec4( + clamp(x.x, minVal, maxVal), + clamp(x.y, minVal, maxVal), + clamp(x.z, minVal, maxVal), + clamp(x.w, minVal, maxVal)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 clamp + ( + detail::tvec2 const & x, + detail::tvec2 const & minVal, + detail::tvec2 const & maxVal + ) + { + return detail::tvec2( + clamp(x.x, minVal.x, maxVal.x), + clamp(x.y, minVal.y, maxVal.y)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 clamp + ( + detail::tvec3 const & x, + detail::tvec3 const & minVal, + detail::tvec3 const & maxVal + ) + { + return detail::tvec3( + clamp(x.x, minVal.x, maxVal.x), + clamp(x.y, minVal.y, maxVal.y), + clamp(x.z, minVal.z, maxVal.z)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 clamp + ( + detail::tvec4 const & x, + detail::tvec4 const & minVal, + detail::tvec4 const & maxVal + ) + { + return detail::tvec4( + clamp(x.x, minVal.x, maxVal.x), + clamp(x.y, minVal.y, maxVal.y), + clamp(x.z, minVal.z, maxVal.z), + clamp(x.w, minVal.w, maxVal.w)); + } + + // mix + template + GLM_FUNC_QUALIFIER genTypeT mix + ( + genTypeT const & x, + genTypeT const & y, + genTypeU const & a + ) + { + // It could be a vector too + //GLM_STATIC_ASSERT( + // detail::type::is_float && + // detail::type::is_float); + + //return x + a * (y - x); + return genTypeT(genTypeU(x) + a * genTypeU(y - x)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 mix + ( + detail::tvec2 const & x, + detail::tvec2 const & y, + valTypeB const & a + ) + { + return detail::tvec2( + detail::tvec2(x) + a * detail::tvec2(y - x)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 mix + ( + detail::tvec3 const & x, + detail::tvec3 const & y, + valTypeB const & a + ) + { + return detail::tvec3( + detail::tvec3(x) + a * detail::tvec3(y - x)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 mix + ( + detail::tvec4 const & x, + detail::tvec4 const & y, + valTypeB const & a + ) + { + return detail::tvec4( + detail::tvec4(x) + a * detail::tvec4(y - x)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 mix + ( + detail::tvec2 const & x, + detail::tvec2 const & y, + detail::tvec2 const & a + ) + { + return detail::tvec2( + detail::tvec2(x) + a * detail::tvec2(y - x)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 mix + ( + detail::tvec3 const & x, + detail::tvec3 const & y, + detail::tvec3 const & a + ) + { + return detail::tvec3( + detail::tvec3(x) + a * detail::tvec3(y - x)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 mix + ( + detail::tvec4 const & x, + detail::tvec4 const & y, + detail::tvec4 const & a + ) + { + return detail::tvec4( + detail::tvec4(x) + a * detail::tvec4(y - x)); + } + + //template + //GLM_FUNC_QUALIFIER genTypeT mix + //( + // genTypeT const & x, + // genTypeT const & y, + // float const & a + //) + //{ + // // It could be a vector too + // //GLM_STATIC_ASSERT( + // // detail::type::is_float && + // // detail::type::is_float); + + // return x + a * (y - x); + //} + + template + GLM_FUNC_QUALIFIER genType mix + ( + genType const & x, + genType const & y, + bool a + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'mix' only accept floating-point inputs"); + + return a ? x : y; + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 mix + ( + detail::tvec2 const & x, + detail::tvec2 const & y, + typename detail::tvec2::bool_type a + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'mix' only accept floating-point inputs"); + + detail::tvec2 result; + for + ( + typename detail::tvec2::size_type i = 0; + i < detail::tvec2::value_size(); + ++i + ) + { + result[i] = a[i] ? x[i] : y[i]; + } + return result; + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 mix + ( + detail::tvec3 const & x, + detail::tvec3 const & y, + typename detail::tvec3::bool_type a + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'mix' only accept floating-point inputs"); + + detail::tvec3 result; + for + ( + typename detail::tvec3::size_type i = 0; + i < detail::tvec3::value_size(); + ++i + ) + { + result[i] = a[i] ? x[i] : y[i]; + } + return result; + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 mix + ( + detail::tvec4 const & x, + detail::tvec4 const & y, + typename detail::tvec4::bool_type a + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'mix' only accept floating-point inputs"); + + detail::tvec4 result; + for + ( + typename detail::tvec4::size_type i = 0; + i < detail::tvec4::value_size(); + ++i + ) + { + result[i] = a[i] ? x[i] : y[i]; + } + return result; + } + + // step + template + GLM_FUNC_QUALIFIER genType step + ( + genType const & edge, + genType const & x + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'mix' only accept floating-point inputs"); + + return x <= edge ? genType(0) : genType(1); + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 step + ( + typename detail::tvec2::value_type const & edge, + detail::tvec2 const & x + ) + { + return detail::tvec2( + x.x <= edge ? T(0) : T(1), + x.y <= edge ? T(0) : T(1)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 step + ( + typename detail::tvec3::value_type const & edge, + detail::tvec3 const & x + ) + { + return detail::tvec3( + x.x <= edge ? T(0) : T(1), + x.y <= edge ? T(0) : T(1), + x.z <= edge ? T(0) : T(1)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 step + ( + typename detail::tvec4::value_type const & edge, + detail::tvec4 const & x + ) + { + return detail::tvec4( + x.x <= edge ? T(0) : T(1), + x.y <= edge ? T(0) : T(1), + x.z <= edge ? T(0) : T(1), + x.w <= edge ? T(0) : T(1)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 step + ( + detail::tvec2 const & edge, + detail::tvec2 const & x + ) + { + return detail::tvec2( + x.x <= edge.x ? T(0) : T(1), + x.y <= edge.y ? T(0) : T(1)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 step + ( + detail::tvec3 const & edge, + detail::tvec3 const & x + ) + { + return detail::tvec3( + x.x <= edge.x ? T(0) : T(1), + x.y <= edge.y ? T(0) : T(1), + x.z <= edge.z ? T(0) : T(1)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 step + ( + detail::tvec4 const & edge, + detail::tvec4 const & x + ) + { + return detail::tvec4( + x.x <= edge.x ? T(0) : T(1), + x.y <= edge.y ? T(0) : T(1), + x.z <= edge.z ? T(0) : T(1), + x.w <= edge.w ? T(0) : T(1)); + } + + // smoothstep + template + GLM_FUNC_QUALIFIER genType smoothstep + ( + genType const & edge0, + genType const & edge1, + genType const & x + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'mix' only accept floating-point inputs"); + + genType tmp = clamp((x - edge0) / (edge1 - edge0), genType(0), genType(1)); + return tmp * tmp * (genType(3) - genType(2) * tmp); + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 smoothstep + ( + typename detail::tvec2::value_type const & edge0, + typename detail::tvec2::value_type const & edge1, + detail::tvec2 const & x + ) + { + return detail::tvec2( + smoothstep(edge0, edge1, x.x), + smoothstep(edge0, edge1, x.y)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 smoothstep + ( + typename detail::tvec3::value_type const & edge0, + typename detail::tvec3::value_type const & edge1, + detail::tvec3 const & x + ) + { + return detail::tvec3( + smoothstep(edge0, edge1, x.x), + smoothstep(edge0, edge1, x.y), + smoothstep(edge0, edge1, x.z)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 smoothstep + ( + typename detail::tvec4::value_type const & edge0, + typename detail::tvec4::value_type const & edge1, + detail::tvec4 const & x + ) + { + return detail::tvec4( + smoothstep(edge0, edge1, x.x), + smoothstep(edge0, edge1, x.y), + smoothstep(edge0, edge1, x.z), + smoothstep(edge0, edge1, x.w)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 smoothstep + ( + detail::tvec2 const & edge0, + detail::tvec2 const & edge1, + detail::tvec2 const & x + ) + { + return detail::tvec2( + smoothstep(edge0.x, edge1.x, x.x), + smoothstep(edge0.y, edge1.y, x.y)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 smoothstep + ( + detail::tvec3 const & edge0, + detail::tvec3 const & edge1, + detail::tvec3 const & x + ) + { + return detail::tvec3( + smoothstep(edge0.x, edge1.x, x.x), + smoothstep(edge0.y, edge1.y, x.y), + smoothstep(edge0.z, edge1.z, x.z)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 smoothstep + ( + detail::tvec4 const & edge0, + detail::tvec4 const & edge1, + detail::tvec4 const & x + ) + { + return detail::tvec4( + smoothstep(edge0.x, edge1.x, x.x), + smoothstep(edge0.y, edge1.y, x.y), + smoothstep(edge0.z, edge1.z, x.z), + smoothstep(edge0.w, edge1.w, x.w)); + } + + template + GLM_FUNC_QUALIFIER typename genType::bool_type isnan + ( + genType const & x + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'mix' only accept floating-point inputs"); + +#if(GLM_COMPILER & GLM_COMPILER_VC) + return typename genType::bool_type(_isnan(x)); +#else + return typename genType::bool_type(std::isnan(x)); +#endif + } + + template + GLM_FUNC_QUALIFIER typename detail::tvec2::bool_type isnan + ( + detail::tvec2 const & x + ) + { + return typename detail::tvec2::bool_type( + isnan(x.x), + isnan(x.y)); + } + + template + GLM_FUNC_QUALIFIER typename detail::tvec3::bool_type isnan + ( + detail::tvec3 const & x + ) + { + return typename detail::tvec3::bool_type( + isnan(x.x), + isnan(x.y), + isnan(x.z)); + } + + template + GLM_FUNC_QUALIFIER typename detail::tvec4::bool_type isnan + ( + detail::tvec4 const & x + ) + { + return typename detail::tvec4::bool_type( + isnan(x.x), + isnan(x.y), + isnan(x.z), + isnan(x.w)); + } + + template + GLM_FUNC_QUALIFIER typename genType::bool_type isinf + ( + genType const & x + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'isinf' only accept floating-point inputs"); + +#if(GLM_COMPILER & GLM_COMPILER_VC) + return typename genType::bool_type(_fpclass(x) == _FPCLASS_NINF || _fpclass(x) == _FPCLASS_PINF); +#else + return typename genType::bool_type(std::isinf(x)); +#endif + } + + template + GLM_FUNC_QUALIFIER typename detail::tvec2::bool_type isinf + ( + detail::tvec2 const & x + ) + { + return typename detail::tvec2::bool_type( + isnan(x.x), + isnan(x.y)); + } + + template + GLM_FUNC_QUALIFIER typename detail::tvec3::bool_type isinf + ( + detail::tvec3 const & x + ) + { + return typename detail::tvec3::bool_type( + isnan(x.x), + isnan(x.y), + isnan(x.z)); + } + + template + GLM_FUNC_QUALIFIER typename detail::tvec4::bool_type isinf + ( + detail::tvec4 const & x + ) + { + return typename detail::tvec4::bool_type( + isnan(x.x), + isnan(x.y), + isnan(x.z), + isnan(x.w)); + } + + GLM_FUNC_QUALIFIER int floatBitsToInt(float const & value) + { + union + { + float f; + int i; + } fi; + + fi.f = value; + return fi.i; + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 floatBitsToInt + ( + detail::tvec2 const & value + ) + { + return detail::tvec2( + floatBitsToInt(value.x), + floatBitsToInt(value.y)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 floatBitsToInt + ( + detail::tvec3 const & value + ) + { + return detail::tvec3( + floatBitsToInt(value.x), + floatBitsToInt(value.y)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 floatBitsToInt + ( + detail::tvec4 const & value + ) + { + return detail::tvec4( + floatBitsToInt(value.x), + floatBitsToInt(value.y)); + } + + GLM_FUNC_QUALIFIER uint floatBitsToUint(float const & value) + { + union + { + float f; + uint u; + } fu; + + fu.f = value; + return fu.u; + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 floatBitsToUint + ( + detail::tvec2 const & value + ) + { + return detail::tvec2( + floatBitsToUint(value.x), + floatBitsToUint(value.y)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 floatBitsToUint + ( + detail::tvec3 const & value + ) + { + return detail::tvec3( + floatBitsToUint(value.x), + floatBitsToUint(value.y)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 floatBitsToUint + ( + detail::tvec4 const & value + ) + { + return detail::tvec4( + floatBitsToUint(value.x), + floatBitsToUint(value.y)); + } + + GLM_FUNC_QUALIFIER float intBitsToFloat(int const & value) + { + union + { + float f; + int i; + } fi; + + fi.i = value; + return fi.f; + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 intBitsToFloat + ( + detail::tvec2 const & value + ) + { + return detail::tvec2( + intBitsToFloat(value.x), + intBitsToFloat(value.y)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 intBitsToFloat + ( + detail::tvec3 const & value + ) + { + return detail::tvec3( + intBitsToFloat(value.x), + intBitsToFloat(value.y)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 intBitsToFloat + ( + detail::tvec4 const & value + ) + { + return detail::tvec4( + intBitsToFloat(value.x), + intBitsToFloat(value.y)); + } + + GLM_FUNC_QUALIFIER float uintBitsToFloat(uint const & value) + { + union + { + float f; + uint u; + } fu; + + fu.u = value; + return fu.f; + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 uintBitsToFloat + ( + detail::tvec2 const & value + ) + { + return detail::tvec2( + uintBitsToFloat(value.x), + uintBitsToFloat(value.y)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 uintBitsToFloat + ( + detail::tvec3 const & value + ) + { + return detail::tvec3( + uintBitsToFloat(value.x), + uintBitsToFloat(value.y)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 uintBitsToFloat + ( + detail::tvec4 const & value + ) + { + return detail::tvec4( + uintBitsToFloat(value.x), + uintBitsToFloat(value.y)); + } + + template + GLM_FUNC_QUALIFIER genType fma + ( + genType const & a, + genType const & b, + genType const & c + ) + { + return a * b + c; + } + + template + GLM_FUNC_QUALIFIER genType frexp + ( + genType const & x, + int & exp + ) + { + return std::frexp(x, exp); + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 frexp + ( + detail::tvec2 const & x, + detail::tvec2 & exp + ) + { + return std::frexp(x, exp); + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 frexp + ( + detail::tvec3 const & x, + detail::tvec3 & exp + ) + { + return std::frexp(x, exp); + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 frexp + ( + detail::tvec4 const & x, + detail::tvec4 & exp + ) + { + return std::frexp(x, exp); + } + + template + GLM_FUNC_QUALIFIER genType ldexp + ( + genType const & x, + int const & exp + ) + { + return std::frexp(x, exp); + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 ldexp + ( + detail::tvec2 const & x, + detail::tvec2 const & exp + ) + { + return std::frexp(x, exp); + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 ldexp + ( + detail::tvec3 const & x, + detail::tvec3 const & exp + ) + { + return std::frexp(x, exp); + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 ldexp + ( + detail::tvec4 const & x, + detail::tvec4 const & exp + ) + { + return std::frexp(x, exp); + } + + }//namespace common + }//namespace function + }//namespace core +}//namespace glm diff --git a/src/glm/core/func_exponential.hpp b/src/glm/core/func_exponential.hpp new file mode 100644 index 0000000..c24ef04 --- /dev/null +++ b/src/glm/core/func_exponential.hpp @@ -0,0 +1,86 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-08-08 +// Updated : 2010-02-04 +// Licence : This source is under MIT License +// File : glm/core/func_exponential.hpp +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_core_func_exponential +#define glm_core_func_exponential + +namespace glm +{ + namespace core{ + namespace function{ + //! Define all exponential functions from Section 8.2 of GLSL 1.30.8 specification. Included in glm namespace. + namespace exponential{ + + /// \addtogroup core_funcs + ///@{ + + //! Returns x raised to the y power. + //! + //! \li GLSL pow man page + //! \li GLSL 1.30.08 specification, section 8.2 + template + genType pow(genType const & x, genType const & y); + + //! Returns the natural exponentiation of x, i.e., e^x. + //! + //! \li GLSL exp man page + //! \li GLSL 1.30.08 specification, section 8.2 + template + genType exp(genType const & x); + + //! Returns the natural logarithm of x, i.e., + //! returns the value y which satisfies the equation x = e^y. + //! Results are undefined if x <= 0. + //! + //! \li GLSL log man page + //! \li GLSL 1.30.08 specification, section 8.2 + template + genType log(genType const & x); + + //! Returns 2 raised to the x power. + //! + //! \li GLSL exp2 man page + //! \li GLSL 1.30.08 specification, section 8.2 + template + genType exp2(genType const & x); + + //! Returns the base 2 log of x, i.e., returns the value y, + //! which satisfies the equation x = 2 ^ y. + //! + //! \li GLSL log2 man page + //! \li GLSL 1.30.08 specification, section 8.2 + template + genType log2(genType const & x); + + //! Returns the positive square root of x. + //! + //! \li GLSL sqrt man page + //! \li GLSL 1.30.08 specification, section 8.2 + template + genType sqrt(genType const & x); + + //! Returns the reciprocal of the positive square root of x. + //! + //! \li GLSL inversesqrt man page + //! \li GLSL 1.30.08 specification, section 8.2 + template + genType inversesqrt(genType const & x); + + ///@} + + }//namespace exponential + }//namespace function + }//namespace core + + using namespace core::function::exponential; +}//namespace glm + +#include "func_exponential.inl" + +#endif//glm_core_func_exponential diff --git a/src/glm/core/func_exponential.inl b/src/glm/core/func_exponential.inl new file mode 100644 index 0000000..181596f --- /dev/null +++ b/src/glm/core/func_exponential.inl @@ -0,0 +1,358 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-08-03 +// Updated : 2010-02-04 +// Licence : This source is under MIT License +// File : glm/core/func_exponential.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm +{ + namespace core{ + namespace function{ + namespace exponential{ + + // pow + template + GLM_FUNC_QUALIFIER genType pow + ( + genType const & x, + genType const & y + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'pow' only accept floating-point input"); + + return ::std::pow(x, y); + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 pow + ( + detail::tvec2 const & x, + detail::tvec2 const & y + ) + { + return detail::tvec2( + pow(x.x, y.x), + pow(x.y, y.y)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 pow + ( + detail::tvec3 const & x, + detail::tvec3 const & y + ) + { + return detail::tvec3( + pow(x.x, y.x), + pow(x.y, y.y), + pow(x.z, y.z)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 pow + ( + detail::tvec4 const & x, + detail::tvec4 const & y + ) + { + return detail::tvec4( + pow(x.x, y.x), + pow(x.y, y.y), + pow(x.z, y.z), + pow(x.w, y.w)); + } + + // exp + template + GLM_FUNC_QUALIFIER genType exp + ( + genType const & x + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'exp' only accept floating-point input"); + + return ::std::exp(x); + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 exp + ( + detail::tvec2 const & x + ) + { + return detail::tvec2( + exp(x.x), + exp(x.y)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 exp + ( + detail::tvec3 const & x + ) + { + return detail::tvec3( + exp(x.x), + exp(x.y), + exp(x.z)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 exp + ( + detail::tvec4 const & x + ) + { + return detail::tvec4( + exp(x.x), + exp(x.y), + exp(x.z), + exp(x.w)); + } + + // log + template + GLM_FUNC_QUALIFIER genType log + ( + genType const & x + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'log' only accept floating-point input"); + + return ::std::log(x); + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 log + ( + detail::tvec2 const & x + ) + { + return detail::tvec2( + log(x.x), + log(x.y)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 log + ( + detail::tvec3 const & x + ) + { + return detail::tvec3( + log(x.x), + log(x.y), + log(x.z)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 log + ( + detail::tvec4 const & x + ) + { + return detail::tvec4( + log(x.x), + log(x.y), + log(x.z), + log(x.w)); + } + + //exp2, ln2 = 0.69314718055994530941723212145818f + template + GLM_FUNC_QUALIFIER genType exp2 + ( + genType const & x + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'exp2' only accept floating-point input"); + + return ::std::exp(genType(0.69314718055994530941723212145818) * x); + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 exp2 + ( + detail::tvec2 const & x + ) + { + return detail::tvec2( + exp2(x.x), + exp2(x.y)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 exp2 + ( + detail::tvec3 const & x + ) + { + return detail::tvec3( + exp2(x.x), + exp2(x.y), + exp2(x.z)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 exp2 + ( + detail::tvec4 const & x + ) + { + return detail::tvec4( + exp2(x.x), + exp2(x.y), + exp2(x.z), + exp2(x.w)); + } + + // log2, ln2 = 0.69314718055994530941723212145818f + template + GLM_FUNC_QUALIFIER genType log2 + ( + genType const & x + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'log2' only accept floating-point input"); + + return ::std::log(x) / genType(0.69314718055994530941723212145818); + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 log2 + ( + detail::tvec2 const & x + ) + { + return detail::tvec2( + log2(x.x), + log2(x.y)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 log2 + ( + detail::tvec3 const & x + ) + { + return detail::tvec3( + log2(x.x), + log2(x.y), + log2(x.z)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 log2 + ( + detail::tvec4 const & x + ) + { + return detail::tvec4( + log2(x.x), + log2(x.y), + log2(x.z), + log2(x.w)); + } + + // sqrt + template + GLM_FUNC_QUALIFIER genType sqrt + ( + genType const & x + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'sqrt' only accept floating-point input"); + + return genType(::std::sqrt(x)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 sqrt + ( + detail::tvec2 const & x + ) + { + return detail::tvec2( + sqrt(x.x), + sqrt(x.y)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 sqrt + ( + detail::tvec3 const & x + ) + { + return detail::tvec3( + sqrt(x.x), + sqrt(x.y), + sqrt(x.z)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 sqrt + ( + detail::tvec4 const & x + ) + { + return detail::tvec4( + sqrt(x.x), + sqrt(x.y), + sqrt(x.z), + sqrt(x.w)); + } + + template + GLM_FUNC_QUALIFIER genType inversesqrt + ( + genType const & x + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'inversesqrt' only accept floating-point input"); + + return genType(1) / ::std::sqrt(x); + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 inversesqrt + ( + detail::tvec2 const & x + ) + { + return detail::tvec2( + inversesqrt(x.x), + inversesqrt(x.y)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 inversesqrt + ( + detail::tvec3 const & x + ) + { + return detail::tvec3( + inversesqrt(x.x), + inversesqrt(x.y), + inversesqrt(x.z)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 inversesqrt + ( + detail::tvec4 const & x + ) + { + return detail::tvec4( + inversesqrt(x.x), + inversesqrt(x.y), + inversesqrt(x.z), + inversesqrt(x.w)); + } + + }//namespace exponential + }//namespace function + }//namespace core +}//namespace glm diff --git a/src/glm/core/func_geometric.hpp b/src/glm/core/func_geometric.hpp new file mode 100644 index 0000000..a42ae1b --- /dev/null +++ b/src/glm/core/func_geometric.hpp @@ -0,0 +1,108 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-08-03 +// Updated : 2010-02-04 +// Licence : This source is under MIT License +// File : glm/core/func_geometric.hpp +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_core_func_geometric +#define glm_core_func_geometric + +namespace glm +{ + namespace core{ + namespace function{ + namespace geometric{ //!< Define all geometric functions from Section 8.4 of GLSL 1.30.8 specification. Included in glm namespace. + + /// \addtogroup core_funcs + ///@{ + + //! Returns the length of x, i.e., sqrt(x * x). + //! + //! \li GLSL length man page + //! \li GLSL 1.30.08 specification, section 8.4 + template + typename genType::value_type length( + genType const & x); + + //! Returns the distance betwwen p0 and p1, i.e., length(p0 - p1). + //! + //! \li GLSL distance man page + //! \li GLSL 1.30.08 specification, section 8.4 + template + typename genType::value_type distance( + genType const & p0, + genType const & p1); + + //! Returns the dot product of x and y, i.e., result = x * y. + //! + //! \li GLSL dot man page + //! \li GLSL 1.30.08 specification, section 8.4 + template + typename genType::value_type dot( + genType const & x, + genType const & y); + + //! Returns the cross product of x and y. + //! + //! \li GLSL cross man page + //! \li GLSL 1.30.08 specification, section 8.4 + template + detail::tvec3 cross( + detail::tvec3 const & x, + detail::tvec3 const & y); + + //! Returns a vector in the same direction as x but with length of 1. + //! + //! \li GLSL normalize man page + //! \li GLSL 1.30.08 specification, section 8.4 + template + genType normalize( + genType const & x); + + //! If dot(Nref, I) < 0.0, return N, otherwise, return -N. + //! + //! \li GLSL faceforward man page + //! \li GLSL 1.30.08 specification, section 8.4 + template + genType faceforward( + genType const & N, + genType const & I, + genType const & Nref); + + //! For the incident vector I and surface orientation N, + //! returns the reflection direction : result = I - 2.0 * dot(N, I) * N. + //! + //! \li GLSL reflect man page + //! \li GLSL 1.30.08 specification, section 8.4 + template + genType reflect( + genType const & I, + genType const & N); + + //! For the incident vector I and surface normal N, + //! and the ratio of indices of refraction eta, + //! return the refraction vector. + //! + //! \li GLSL refract man page + //! \li GLSL 1.30.08 specification, section 8.4 + template + genType refract( + genType const & I, + genType const & N, + typename genType::value_type const & eta); + + ///@} + + }//namespace geometric + }//namespace function + }//namespace core + + using namespace core::function::geometric; +}//namespace glm + +#include "func_geometric.inl" + +#endif//glm_core_func_geometric diff --git a/src/glm/core/func_geometric.inl b/src/glm/core/func_geometric.inl new file mode 100644 index 0000000..9ffe8ca --- /dev/null +++ b/src/glm/core/func_geometric.inl @@ -0,0 +1,290 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-08-03 +// Updated : 2010-02-04 +// Licence : This source is under MIT License +// File : glm/core/func_geometric.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm +{ + namespace core{ + namespace function{ + namespace geometric{ + + // length + template + GLM_FUNC_QUALIFIER genType length + ( + genType const & x + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'length' only accept floating-point inputs"); + + genType sqr = x * x; + return sqrt(sqr); + } + + template + GLM_FUNC_QUALIFIER typename detail::tvec2::value_type length + ( + detail::tvec2 const & v + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'length' only accept floating-point inputs"); + + typename detail::tvec2::value_type sqr = v.x * v.x + v.y * v.y; + return sqrt(sqr); + } + + template + GLM_FUNC_QUALIFIER typename detail::tvec3::value_type length + ( + detail::tvec3 const & v + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'length' only accept floating-point inputs"); + + typename detail::tvec3::value_type sqr = v.x * v.x + v.y * v.y + v.z * v.z; + return sqrt(sqr); + } + + template + GLM_FUNC_QUALIFIER typename detail::tvec4::value_type length + ( + detail::tvec4 const & v + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'length' only accept floating-point inputs"); + + typename detail::tvec4::value_type sqr = v.x * v.x + v.y * v.y + v.z * v.z + v.w * v.w; + return sqrt(sqr); + } + + // distance + template + GLM_FUNC_QUALIFIER genType distance + ( + genType const & p0, + genType const & p1 + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'distance' only accept floating-point inputs"); + + return length(p1 - p0); + } + + template + GLM_FUNC_QUALIFIER typename detail::tvec2::value_type distance + ( + detail::tvec2 const & p0, + detail::tvec2 const & p1 + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'distance' only accept floating-point inputs"); + + return length(p1 - p0); + } + + template + GLM_FUNC_QUALIFIER typename detail::tvec3::value_type distance + ( + detail::tvec3 const & p0, + detail::tvec3 const & p1 + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'distance' only accept floating-point inputs"); + + return length(p1 - p0); + } + + template + GLM_FUNC_QUALIFIER typename detail::tvec4::value_type distance + ( + detail::tvec4 const & p0, + detail::tvec4 const & p1 + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'distance' only accept floating-point inputs"); + + return length(p1 - p0); + } + + // dot + template + GLM_FUNC_QUALIFIER genType dot + ( + genType const & x, + genType const & y + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'dot' only accept floating-point inputs"); + + return x * y; + } + + template + GLM_FUNC_QUALIFIER typename detail::tvec2::value_type dot + ( + detail::tvec2 const & x, + detail::tvec2 const & y + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'dot' only accept floating-point inputs"); + + return x.x * y.x + x.y * y.y; + } + + template + GLM_FUNC_QUALIFIER T dot + ( + detail::tvec3 const & x, + detail::tvec3 const & y + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'dot' only accept floating-point inputs"); + + return x.x * y.x + x.y * y.y + x.z * y.z; + } +/* // SSE3 + GLM_FUNC_QUALIFIER float dot(const tvec4& x, const tvec4& y) + { + float Result; + __asm + { + mov esi, x + mov edi, y + movaps xmm0, [esi] + mulps xmm0, [edi] + haddps( _xmm0, _xmm0 ) + haddps( _xmm0, _xmm0 ) + movss Result, xmm0 + } + return Result; + } +*/ + template + GLM_FUNC_QUALIFIER T dot + ( + detail::tvec4 const & x, + detail::tvec4 const & y + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'dot' only accept floating-point inputs"); + + return x.x * y.x + x.y * y.y + x.z * y.z + x.w * y.w; + } + + // cross + template + GLM_FUNC_QUALIFIER detail::tvec3 cross + ( + detail::tvec3 const & x, + detail::tvec3 const & y + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'cross' only accept floating-point inputs"); + + return detail::tvec3( + x.y * y.z - y.y * x.z, + x.z * y.x - y.z * x.x, + x.x * y.y - y.x * x.y); + } + + // normalize + template + GLM_FUNC_QUALIFIER genType normalize + ( + genType const & x + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'normalize' only accept floating-point inputs"); + + return x < genType(0) ? genType(-1) : genType(1); + } + + // According to issue 10 GLSL 1.10 specification, if length(x) == 0 then result is undefine and generate an error + template + GLM_FUNC_QUALIFIER detail::tvec2 normalize + ( + detail::tvec2 const & x + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'normalize' only accept floating-point inputs"); + + typename detail::tvec2::value_type sqr = x.x * x.x + x.y * x.y; + return x * inversesqrt(sqr); + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 normalize + ( + detail::tvec3 const & x + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'normalize' only accept floating-point inputs"); + + typename detail::tvec3::value_type sqr = x.x * x.x + x.y * x.y + x.z * x.z; + return x * inversesqrt(sqr); + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 normalize + ( + detail::tvec4 const & x + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'normalize' only accept floating-point inputs"); + + typename detail::tvec4::value_type sqr = x.x * x.x + x.y * x.y + x.z * x.z + x.w * x.w; + return x * inversesqrt(sqr); + } + + // faceforward + template + GLM_FUNC_QUALIFIER genType faceforward + ( + genType const & N, + genType const & I, + genType const & Nref + ) + { + return dot(Nref, I) < 0 ? N : -N; + } + + // reflect + template + genType reflect + ( + genType const & I, + genType const & N + ) + { + return I - N * dot(N, I) * float(2); + } + + // refract + template + GLM_FUNC_QUALIFIER genType refract + ( + genType const & I, + genType const & N, + typename genType::value_type const & eta + ) + { + //It could be a vector + //GLM_STATIC_ASSERT(detail::type::is_float); + + typename genType::value_type dotValue = dot(N, I); + typename genType::value_type k = typename genType::value_type(1) - eta * eta * (typename genType::value_type(1) - dotValue * dotValue); + if(k < typename genType::value_type(0)) + return genType(0); + else + return eta * I - (eta * dotValue + sqrt(k)) * N; + } + + }//namespace geometric + }//namespace function + }//namespace core +}//namespace glm diff --git a/src/glm/core/func_integer.hpp b/src/glm/core/func_integer.hpp new file mode 100644 index 0000000..5e3d68d --- /dev/null +++ b/src/glm/core/func_integer.hpp @@ -0,0 +1,158 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2010-03-17 +// Updated : 2010-03-31 +// Licence : This source is under MIT License +// File : glm/core/func_integer.hpp +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_core_func_integer +#define glm_core_func_integer + +namespace glm +{ + namespace core{ + namespace function{ + //! Define integer functions from Section 8.8 of GLSL 4.00.8 specification. + namespace integer{ + + /// \addtogroup core_funcs + ///@{ + + //! Adds 32-bit unsigned integer x and y, returning the sum + //! modulo pow(2, 32). The value carry is set to 0 if the sum was + //! less than pow(2, 32), or to 1 otherwise. + //! + //! \li GLSL uaddCarry man page + //! \li GLSL 4.00.08 specification, section 8.8 + template + genUType uaddCarry( + genUType const & x, + genUType const & y, + genUType & carry); + + //! Subtracts the 32-bit unsigned integer y from x, returning + //! the difference if non-negative, or pow(2, 32) plus the difference + //! otherwise. The value borrow is set to 0 if x >= y, or to 1 otherwise. + //! + //! \li GLSL usubBorrow man page + //! \li GLSL 4.00.08 specification, section 8.8 + template + genUType usubBorrow( + genUType const & x, + genUType const & y, + genUType & borrow); + + //! Multiplies 32-bit integers x and y, producing a 64-bit + //! result. The 32 least-significant bits are returned in lsb. + //! The 32 most-significant bits are returned in msb. + //! + //! \li GLSL umulExtended man page + //! \li GLSL 4.00.08 specification, section 8.8 + template + void umulExtended( + genUType const & x, + genUType const & y, + genUType & msb, + genUType & lsb); + + //! Multiplies 32-bit integers x and y, producing a 64-bit + //! result. The 32 least-significant bits are returned in lsb. + //! The 32 most-significant bits are returned in msb. + //! + //! \li GLSL imulExtended man page + //! \li GLSL 4.00.08 specification, section 8.8 + template + void imulExtended( + genIType const & x, + genIType const & y, + genIType & msb, + genIType & lsb); + + //! Extracts bits [offset, offset + bits - 1] from value, + //! returning them in the least significant bits of the result. + //! For unsigned data types, the most significant bits of the + //! result will be set to zero. For signed data types, the + //! most significant bits will be set to the value of bit offset + base 1. + //! + //! If bits is zero, the result will be zero. The result will be + //! undefined if offset or bits is negative, or if the sum of + //! offset and bits is greater than the number of bits used + //! to store the operand. + //! + //! \li GLSL bitfieldExtract man page + //! \li GLSL 4.00.08 specification, section 8.8 + template + genIUType bitfieldExtract( + genIUType const & Value, + int const & Offset, + int const & Bits); + + //! Returns the insertion the bits least-significant bits of insert into base. + //! + //! The result will have bits [offset, offset + bits - 1] taken + //! from bits [0, bits 1] of insert, and all other bits taken + //! directly from the corresponding bits of base. If bits is + //! zero, the result will simply be base. The result will be + //! undefined if offset or bits is negative, or if the sum of + //! offset and bits is greater than the number of bits used to + //! store the operand. + //! + //! \li GLSL bitfieldInsert man page + //! \li GLSL 4.00.08 specification, section 8.8 + template + genIUType bitfieldInsert( + genIUType const & Base, + genIUType const & Insert, + int const & Offset, + int const & Bits); + + //! Returns the reversal of the bits of value. + //! The bit numbered n of the result will be taken from bit (bits - 1) - n of value, + //! where bits is the total number of bits used to represent value. + //! + //! \li GLSL bitfieldReverse man page + //! \li GLSL 4.00.08 specification, section 8.8 + template + genIUType bitfieldReverse(genIUType const & value); + + //! Returns the number of bits set to 1 in the binary representation of value. + //! + //! \li GLSL bitCount man page + //! \li GLSL 4.00.08 specification, section 8.8 + template class C> + typename C::signed_type bitCount(C const & Value); + + //! Returns the bit number of the least significant bit set to + //! 1 in the binary representation of value. + //! If value is zero, -1 will be returned. + //! + //! \li GLSL findLSB man page + //! \li GLSL 4.00.08 specification, section 8.8 + template class C> + typename C::signed_type findLSB(C const & Value); + + //! Returns the bit number of the most significant bit in the binary representation of value. + //! For positive integers, the result will be the bit number of the most significant bit set to 1. + //! For negative integers, the result will be the bit number of the most significant + //! bit set to 0. For a value of zero or negative one, -1 will be returned. + //! + //! \li GLSL findMSB man page + //! \li GLSL 4.00.08 specification, section 8.8 + template class C> + typename C::signed_type findMSB(C const & Value); + + ///@} + + }//namespace integer + }//namespace function + }//namespace core + + using namespace core::function::integer; +}//namespace glm + +#include "func_integer.inl" + +#endif//glm_core_func_integer + diff --git a/src/glm/core/func_integer.inl b/src/glm/core/func_integer.inl new file mode 100644 index 0000000..f68be11 --- /dev/null +++ b/src/glm/core/func_integer.inl @@ -0,0 +1,597 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2010-03-17 +// Updated : 2010-03-31 +// Licence : This source is under MIT License +// File : glm/core/func_integer.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm +{ + namespace detail + { + + }//namespace detail + + namespace core{ + namespace function{ + namespace integer + { + // uaddCarry + template + GLM_FUNC_QUALIFIER genUType uaddCarry + ( + genUType const & x, + genUType const & y, + genUType & Carry + ) + { + detail::highp_uint_t Value64 = detail::highp_uint_t(x) + detail::highp_uint_t(y); + genUType Result = genUType(Value64 % (detail::highp_uint_t(1) << detail::highp_uint_t(32))); + Carry = (Value64 % (detail::highp_uint_t(1) << detail::highp_uint_t(32))) > 1 ? 1 : 0; + return Result; + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 uaddCarry + ( + detail::tvec2 const & x, + detail::tvec2 const & y, + detail::tvec2 & Carry + ) + { + return detail::tvec2( + uaddCarry(x[0], y[0], Carry[0]), + uaddCarry(x[1], y[1], Carry[1])); + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 uaddCarry + ( + detail::tvec3 const & x, + detail::tvec3 const & y, + detail::tvec3 & Carry + ) + { + return detail::tvec3( + uaddCarry(x[0], y[0], Carry[0]), + uaddCarry(x[1], y[1], Carry[1]), + uaddCarry(x[2], y[2], Carry[2])); + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 uaddCarry + ( + detail::tvec4 const & x, + detail::tvec4 const & y, + detail::tvec4 & Carry + ) + { + return detail::tvec4( + uaddCarry(x[0], y[0], Carry[0]), + uaddCarry(x[1], y[1], Carry[1]), + uaddCarry(x[2], y[2], Carry[2]), + uaddCarry(x[3], y[3], Carry[3])); + } + + // usubBorrow + template + GLM_FUNC_QUALIFIER genUType usubBorrow + ( + genUType const & x, + genUType const & y, + genUType & Borrow + ) + { + Borrow = x >= y ? 0 : 1; + if(x > y) + return genUType(detail::highp_int_t(x) - detail::highp_int_t(y)); + else + return genUType(detail::highp_int_t(1) << (detail::highp_int_t(32) + detail::highp_int_t(x) - detail::highp_int_t(y))); + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 usubBorrow + ( + detail::tvec2 const & x, + detail::tvec2 const & y, + detail::tvec2 & Borrow + ) + { + return detail::tvec2( + usubBorrow(x[0], y[0], Borrow[0]), + usubBorrow(x[1], y[1], Borrow[1])); + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 usubBorrow + ( + detail::tvec3 const & x, + detail::tvec3 const & y, + detail::tvec3 & Borrow + ) + { + return detail::tvec3( + usubBorrow(x[0], y[0], Borrow[0]), + usubBorrow(x[1], y[1], Borrow[1]), + usubBorrow(x[2], y[2], Borrow[2])); + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 usubBorrow + ( + detail::tvec4 const & x, + detail::tvec4 const & y, + detail::tvec4 & Borrow + ) + { + return detail::tvec4( + usubBorrow(x[0], y[0], Borrow[0]), + usubBorrow(x[1], y[1], Borrow[1]), + usubBorrow(x[2], y[2], Borrow[2]), + usubBorrow(x[3], y[3], Borrow[3])); + } + + // umulExtended + template + GLM_FUNC_QUALIFIER void umulExtended + ( + genUType const & x, + genUType const & y, + genUType & msb, + genUType & lsb + ) + { + detail::highp_uint_t ValueX64 = x; + detail::highp_uint_t ValueY64 = y; + detail::highp_uint_t Value64 = ValueX64 * ValueY64; + msb = *(genUType*)&genUType(Value64 & ((detail::highp_uint_t(1) << detail::highp_uint_t(32)) - detail::highp_uint_t(1))); + lsb = *(genUType*)&genUType(Value64 >> detail::highp_uint_t(32)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 umulExtended + ( + detail::tvec2 const & x, + detail::tvec2 const & y, + detail::tvec2 & msb, + detail::tvec2 & lsb + ) + { + return detail::tvec2( + umulExtended(x[0], y[0], msb, lsb), + umulExtended(x[1], y[1], msb, lsb)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 umulExtended + ( + detail::tvec3 const & x, + detail::tvec3 const & y, + detail::tvec3 & msb, + detail::tvec3 & lsb + ) + { + return detail::tvec3( + umulExtended(x[0], y[0], msb, lsb), + umulExtended(x[1], y[1], msb, lsb), + umulExtended(x[2], y[2], msb, lsb)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 umulExtended + ( + detail::tvec4 const & x, + detail::tvec4 const & y, + detail::tvec4 & msb, + detail::tvec4 & lsb + ) + { + return detail::tvec4( + umulExtended(x[0], y[0], msb, lsb), + umulExtended(x[1], y[1], msb, lsb), + umulExtended(x[2], y[2], msb, lsb), + umulExtended(x[3], y[3], msb, lsb)); + } + + // imulExtended + template + GLM_FUNC_QUALIFIER void imulExtended + ( + genIType const & x, + genIType const & y, + genIType & msb, + genIType & lsb + ) + { + detail::highp_int_t ValueX64 = x; + detail::highp_int_t ValueY64 = y; + detail::highp_int_t Value64 = ValueX64 * ValueY64; + msb = *(genIType*)&genIType(Value64 & ((detail::highp_uint_t(1) << detail::highp_uint_t(32)) - detail::highp_uint_t(1))); + lsb = *(genIType*)&genIType(Value64 >> detail::highp_uint_t(32)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 imulExtended + ( + detail::tvec2 const & x, + detail::tvec2 const & y, + detail::tvec2 & msb, + detail::tvec2 & lsb + ) + { + return detail::tvec2( + imulExtended(x[0], y[0], msb, lsb), + imulExtended(x[1], y[1], msb, lsb)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 imulExtended + ( + detail::tvec3 const & x, + detail::tvec3 const & y, + detail::tvec3 & msb, + detail::tvec3 & lsb + ) + { + return detail::tvec3( + imulExtended(x[0], y[0], msb, lsb), + imulExtended(x[1], y[1], msb, lsb), + imulExtended(x[2], y[2], msb, lsb)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 imulExtended + ( + detail::tvec4 const & x, + detail::tvec4 const & y, + detail::tvec4 & msb, + detail::tvec4 & lsb + ) + { + return detail::tvec4( + imulExtended(x[0], y[0], msb, lsb), + imulExtended(x[1], y[1], msb, lsb), + imulExtended(x[2], y[2], msb, lsb), + imulExtended(x[3], y[3], msb, lsb)); + } + + // bitfieldExtract + template + GLM_FUNC_QUALIFIER genIUType bitfieldExtract + ( + genIUType const & Value, + int const & Offset, + int const & Bits + ) + { + int GenSize = int(sizeof(genIUType)) << int(3); + + assert(Offset + Bits <= GenSize); + + genIUType ShiftLeft = Bits ? Value << (GenSize - (Bits + Offset)) : genIUType(0); + genIUType ShiftBack = ShiftLeft >> genIUType(GenSize - Bits); + + return ShiftBack; + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 bitfieldExtract + ( + detail::tvec2 const & Value, + int const & Offset, + int const & Bits + ) + { + return detail::tvec2( + bitfieldExtract(Value[0]), + bitfieldExtract(Value[1])); + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 bitfieldExtract + ( + detail::tvec3 const & Value, + int const & Offset, + int const & Bits + ) + { + return detail::tvec3( + bitfieldExtract(Value[0]), + bitfieldExtract(Value[1]), + bitfieldExtract(Value[2])); + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 bitfieldExtract + ( + detail::tvec4 const & Value, + int const & Offset, + int const & Bits + ) + { + return detail::tvec4( + bitfieldExtract(Value[0]), + bitfieldExtract(Value[1]), + bitfieldExtract(Value[2]), + bitfieldExtract(Value[3])); + } + + // bitfieldInsert + template + GLM_FUNC_QUALIFIER genIUType bitfieldInsert + ( + genIUType const & Base, + genIUType const & Insert, + int const & Offset, + int const & Bits + ) + { + GLM_STATIC_ASSERT(std::numeric_limits::is_integer, "'bitfieldInsert' only accept integer values"); + assert(Offset + Bits <= sizeof(genIUType)); + + if(Bits == 0) + return Base; + + genIUType Mask = 0; + for(int Bit = Offset; Bit < Offset + Bits; ++Bit) + Mask |= (1 << Bit); + + return (Base & ~Mask) | (Insert & Mask); + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 bitfieldInsert + ( + detail::tvec2 const & Base, + detail::tvec2 const & Insert, + int const & Offset, + int const & Bits + ) + { + return detail::tvec2( + bitfieldInsert(Base[0], Insert[0], Offset, Bits), + bitfieldInsert(Base[1], Insert[1], Offset, Bits)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 bitfieldInsert + ( + detail::tvec3 const & Base, + detail::tvec3 const & Insert, + int const & Offset, + int const & Bits + ) + { + return detail::tvec3( + bitfieldInsert(Base[0], Insert[0], Offset, Bits), + bitfieldInsert(Base[1], Insert[1], Offset, Bits), + bitfieldInsert(Base[2], Insert[2], Offset, Bits)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 bitfieldInsert + ( + detail::tvec4 const & Base, + detail::tvec4 const & Insert, + int const & Offset, + int const & Bits + ) + { + return detail::tvec4( + bitfieldInsert(Base[0], Insert[0], Offset, Bits), + bitfieldInsert(Base[1], Insert[1], Offset, Bits), + bitfieldInsert(Base[2], Insert[2], Offset, Bits), + bitfieldInsert(Base[3], Insert[3], Offset, Bits)); + } + + // bitfieldReverse + template + GLM_FUNC_QUALIFIER genIUType bitfieldReverse(genIUType const & Value) + { + GLM_STATIC_ASSERT(std::numeric_limits::is_integer, "'bitfieldReverse' only accept integer values"); + + genIUType Out = 0; + std::size_t BitSize = sizeof(genIUType) * 8; + for(std::size_t i = 0; i < BitSize; ++i) + if(Value & (genIUType(1) << i)) + Out |= genIUType(1) << (BitSize - 1 - i); + return Out; + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 bitfieldReverse + ( + detail::tvec2 const & value + ) + { + return detail::tvec2( + bitfieldReverse(value[0]), + bitfieldReverse(value[1])); + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 bitfieldReverse + ( + detail::tvec3 const & value + ) + { + return detail::tvec3( + bitfieldReverse(value[0]), + bitfieldReverse(value[1]), + bitfieldReverse(value[2])); + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 bitfieldReverse + ( + detail::tvec4 const & value + ) + { + return detail::tvec4( + bitfieldReverse(value[0]), + bitfieldReverse(value[1]), + bitfieldReverse(value[2]), + bitfieldReverse(value[3])); + } + + // bitCount + template + GLM_FUNC_QUALIFIER int bitCount(genIUType const & Value) + { + GLM_STATIC_ASSERT(std::numeric_limits::is_integer, "'bitCount' only accept integer values"); + + int Count = 0; + for(std::size_t i = 0; i < sizeof(genIUType) * std::size_t(8); ++i) + { + if(Value & (1 << i)) + ++Count; + } + return Count; + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 bitCount + ( + detail::tvec2 const & value + ) + { + return detail::tvec2( + bitCount(value[0]), + bitCount(value[1])); + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 bitCount + ( + detail::tvec3 const & value + ) + { + return detail::tvec3( + bitCount(value[0]), + bitCount(value[1]), + bitCount(value[2])); + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 bitCount + ( + detail::tvec4 const & value + ) + { + return detail::tvec4( + bitCount(value[0]), + bitCount(value[1]), + bitCount(value[2]), + bitCount(value[3])); + } + + // findLSB + template + GLM_FUNC_QUALIFIER int findLSB + ( + genIUType const & Value + ) + { + GLM_STATIC_ASSERT(std::numeric_limits::is_integer, "'findLSB' only accept integer values"); + if(Value == 0) + return -1; + + genIUType Bit; + for(Bit = genIUType(0); !(Value & (1 << Bit)); ++Bit){} + return Bit; + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 findLSB + ( + detail::tvec2 const & value + ) + { + return detail::tvec2( + findLSB(value[0]), + findLSB(value[1])); + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 findLSB + ( + detail::tvec3 const & value + ) + { + return detail::tvec3( + findLSB(value[0]), + findLSB(value[1]), + findLSB(value[2])); + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 findLSB + ( + detail::tvec4 const & value + ) + { + return detail::tvec4( + findLSB(value[0]), + findLSB(value[1]), + findLSB(value[2]), + findLSB(value[3])); + } + + // findMSB + template + GLM_FUNC_QUALIFIER int findMSB + ( + genIUType const & Value + ) + { + GLM_STATIC_ASSERT(std::numeric_limits::is_integer, "'findMSB' only accept integer values"); + if(Value == 0) + return -1; + + genIUType bit = genIUType(-1); + for(genIUType tmp = Value; tmp; tmp >>= 1, ++bit){} + return bit; + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 findMSB + ( + detail::tvec2 const & value + ) + { + return detail::tvec2( + findMSB(value[0]), + findMSB(value[1])); + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 findMSB + ( + detail::tvec3 const & value + ) + { + return detail::tvec3( + findMSB(value[0]), + findMSB(value[1]), + findMSB(value[2])); + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 findMSB + ( + detail::tvec4 const & value + ) + { + return detail::tvec4( + findMSB(value[0]), + findMSB(value[1]), + findMSB(value[2]), + findMSB(value[3])); + } + + }//namespace integer + }//namespace function + }//namespace core +}//namespace glm diff --git a/src/glm/core/func_matrix.hpp b/src/glm/core/func_matrix.hpp new file mode 100644 index 0000000..b41e980 --- /dev/null +++ b/src/glm/core/func_matrix.hpp @@ -0,0 +1,111 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-08-03 +// Updated : 2010-02-04 +// Licence : This source is under MIT License +// File : glm/core/func_matrix.hpp +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_core_func_matrix +#define glm_core_func_matrix + +namespace glm +{ + namespace core{ + namespace function{ + //! Define all matrix functions from Section 8.5 of GLSL 1.30.8 specification. Included in glm namespace. + namespace matrix{ + + /// \addtogroup core_funcs + ///@{ + + //! Multiply matrix x by matrix y component-wise, i.e., + //! result[i][j] is the scalar product of x[i][j] and y[i][j]. + //! + //! \li GLSL matrixCompMult man page + //! \li GLSL 1.30.08 specification, section 8.5 + template + matType matrixCompMult( + matType const & x, + matType const & y); + + //! Treats the first parameter c as a column vector + //! and the second parameter r as a row vector + //! and does a linear algebraic matrix multiply c * r. + //! + //! \li GLSL outerProduct man page + //! \li GLSL 1.30.08 specification, section 8.5 + template + matType outerProduct( + vecType const & c, + vecType const & r); + + //! Returns the transposed matrix of x + //! + //! \li GLSL transpose man page + //! \li GLSL 1.30.08 specification, section 8.5 + template + typename matType::transpose_type transpose( + matType const & x); + + //! Return the determinant of a mat2 matrix. + //! + //! \li GLSL determinant man page + //! \li GLSL 1.30.08 specification, section 8.5 + template + typename detail::tmat2x2::value_type determinant( + detail::tmat2x2 const & m); + + //! Return the determinant of a mat3 matrix. + //! + //! \li GLSL determinant man page + //! \li GLSL 1.30.08 specification, section 8.5 + template + typename detail::tmat3x3::value_type determinant( + detail::tmat3x3 const & m); + + //! Return the determinant of a mat4 matrix. + //! + //! \li GLSL determinant man page + //! \li GLSL 1.30.08 specification, section 8.5 + template + typename detail::tmat4x4::value_type determinant( + detail::tmat4x4 const & m); + + //! Return the inverse of a mat2 matrix. + //! + //! \li GLSL inverse man page + //! \li GLSL 1.40.07 specification, section 8.5 + template + detail::tmat2x2 inverse( + detail::tmat2x2 const & m); + + //! Return the inverse of a mat3 matrix. + //! + //! \li GLSL inverse man page + //! \li GLSL 1.40.07 specification, section 8.5 + template + detail::tmat3x3 inverse( + detail::tmat3x3 const & m); + + //! Return the inverse of a mat4 matrix. + //! + //! \li GLSL inverse man page + //! \li GLSL 1.40.07 specification, section 8.5 + template + detail::tmat4x4 inverse( + detail::tmat4x4 const & m); + + ///@} + + }//namespace matrix + }//namespace function + }//namespace core + + using namespace core::function::matrix; +}//namespace glm + +#include "func_matrix.inl" + +#endif//glm_core_func_matrix diff --git a/src/glm/core/func_matrix.inl b/src/glm/core/func_matrix.inl new file mode 100644 index 0000000..fb2adb8 --- /dev/null +++ b/src/glm/core/func_matrix.inl @@ -0,0 +1,571 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-03-08 +// Updated : 2010-02-04 +// Licence : This source is under MIT License +// File : glm/core/func_matrix.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm +{ + namespace core{ + namespace function{ + namespace matrix{ + + // matrixCompMult + template + GLM_FUNC_QUALIFIER matType matrixCompMult + ( + matType const & x, + matType const & y + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'matrixCompMult' only accept floating-point inputs"); + + matType result(matType::null); + for(typename matType::size_type i = 0; i < matType::col_size(); ++i) + result[i] = x[i] * y[i]; + return result; + } + + // outerProduct + template + GLM_FUNC_QUALIFIER detail::tmat2x2 outerProduct + ( + detail::tvec2 const & c, + detail::tvec2 const & r + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'outerProduct' only accept floating-point inputs"); + + detail::tmat2x2 m(detail::tmat2x2::null); + m[0][0] = c[0] * r[0]; + m[0][1] = c[1] * r[0]; + m[1][0] = c[0] * r[1]; + m[1][1] = c[1] * r[1]; + return m; + } + + template + GLM_FUNC_QUALIFIER detail::tmat3x3 outerProduct + ( + detail::tvec3 const & c, + detail::tvec3 const & r + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'outerProduct' only accept floating-point inputs"); + + detail::tmat3x3 m(detail::tmat3x3::null); + for(typename detail::tmat3x3::size_type i = 0; i < detail::tmat3x3::col_size(); ++i) + m[i] = c * r[i]; + return m; + } + + template + GLM_FUNC_QUALIFIER detail::tmat4x4 outerProduct + ( + detail::tvec4 const & c, + detail::tvec4 const & r + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'outerProduct' only accept floating-point inputs"); + + detail::tmat4x4 m(detail::tmat4x4::null); + for(typename detail::tmat4x4::size_type i = 0; i < detail::tmat4x4::col_size(); ++i) + m[i] = c * r[i]; + return m; + } + + template + GLM_FUNC_QUALIFIER detail::tmat2x3 outerProduct + ( + detail::tvec3 const & c, + detail::tvec2 const & r + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'outerProduct' only accept floating-point inputs"); + + detail::tmat2x3 m(detail::tmat2x3::null); + m[0][0] = c.x * r.x; + m[0][1] = c.y * r.x; + m[0][2] = c.z * r.x; + m[1][0] = c.x * r.y; + m[1][1] = c.y * r.y; + m[1][2] = c.z * r.y; + return m; + } + + template + GLM_FUNC_QUALIFIER detail::tmat3x2 outerProduct + ( + detail::tvec2 const & c, + detail::tvec3 const & r + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'outerProduct' only accept floating-point inputs"); + + detail::tmat3x2 m(detail::tmat3x2::null); + m[0][0] = c.x * r.x; + m[0][1] = c.y * r.x; + m[1][0] = c.x * r.y; + m[1][1] = c.y * r.y; + m[2][0] = c.x * r.z; + m[2][1] = c.y * r.z; + return m; + } + + template + GLM_FUNC_QUALIFIER detail::tmat2x4 outerProduct + ( + detail::tvec2 const & c, + detail::tvec4 const & r + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'outerProduct' only accept floating-point inputs"); + + detail::tmat2x4 m(detail::tmat2x4::null); + m[0][0] = c.x * r.x; + m[0][1] = c.y * r.x; + m[0][2] = c.z * r.x; + m[0][3] = c.w * r.x; + m[1][0] = c.x * r.y; + m[1][1] = c.y * r.y; + m[1][2] = c.z * r.y; + m[1][3] = c.w * r.y; + return m; + } + + template + GLM_FUNC_QUALIFIER detail::tmat4x2 outerProduct + ( + detail::tvec4 const & c, + detail::tvec2 const & r + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'outerProduct' only accept floating-point inputs"); + + detail::tmat4x2 m(detail::tmat4x2::null); + m[0][0] = c.x * r.x; + m[0][1] = c.y * r.x; + m[1][0] = c.x * r.y; + m[1][1] = c.y * r.y; + m[2][0] = c.x * r.z; + m[2][1] = c.y * r.z; + m[3][0] = c.x * r.w; + m[3][1] = c.y * r.w; + return m; + } + + template + GLM_FUNC_QUALIFIER detail::tmat3x4 outerProduct + ( + detail::tvec4 const & c, + detail::tvec3 const & r + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'outerProduct' only accept floating-point inputs"); + + detail::tmat3x4 m(detail::tmat3x4::null); + m[0][0] = c.x * r.x; + m[0][1] = c.y * r.x; + m[0][2] = c.z * r.x; + m[0][3] = c.w * r.x; + m[1][0] = c.x * r.y; + m[1][1] = c.y * r.y; + m[1][2] = c.z * r.y; + m[1][3] = c.w * r.y; + m[2][0] = c.x * r.z; + m[2][1] = c.y * r.z; + m[2][2] = c.z * r.z; + m[2][3] = c.w * r.z; + return m; + } + + template + GLM_FUNC_QUALIFIER detail::tmat4x3 outerProduct + ( + detail::tvec3 const & c, + detail::tvec4 const & r + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'outerProduct' only accept floating-point inputs"); + + detail::tmat4x3 m(detail::tmat4x3::null); + m[0][0] = c.x * r.x; + m[0][1] = c.y * r.x; + m[0][2] = c.z * r.x; + m[1][0] = c.x * r.y; + m[1][1] = c.y * r.y; + m[1][2] = c.z * r.y; + m[2][0] = c.x * r.z; + m[2][1] = c.y * r.z; + m[2][2] = c.z * r.z; + m[3][0] = c.x * r.w; + m[3][1] = c.y * r.w; + m[3][2] = c.z * r.w; + return m; + } + + template + GLM_FUNC_QUALIFIER detail::tmat2x2 transpose + ( + detail::tmat2x2 const & m + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'transpose' only accept floating-point inputs"); + + detail::tmat2x2 result(detail::tmat2x2::null); + result[0][0] = m[0][0]; + result[0][1] = m[1][0]; + result[1][0] = m[0][1]; + result[1][1] = m[1][1]; + return result; + } + + template + GLM_FUNC_QUALIFIER detail::tmat3x3 transpose + ( + detail::tmat3x3 const & m + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'transpose' only accept floating-point inputs"); + + detail::tmat3x3 result(detail::tmat3x3::null); + result[0][0] = m[0][0]; + result[0][1] = m[1][0]; + result[0][2] = m[2][0]; + + result[1][0] = m[0][1]; + result[1][1] = m[1][1]; + result[1][2] = m[2][1]; + + result[2][0] = m[0][2]; + result[2][1] = m[1][2]; + result[2][2] = m[2][2]; + return result; + } + + template + GLM_FUNC_QUALIFIER detail::tmat4x4 transpose + ( + detail::tmat4x4 const & m + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'transpose' only accept floating-point inputs"); + + detail::tmat4x4 result(detail::tmat4x4::null); + result[0][0] = m[0][0]; + result[0][1] = m[1][0]; + result[0][2] = m[2][0]; + result[0][3] = m[3][0]; + + result[1][0] = m[0][1]; + result[1][1] = m[1][1]; + result[1][2] = m[2][1]; + result[1][3] = m[3][1]; + + result[2][0] = m[0][2]; + result[2][1] = m[1][2]; + result[2][2] = m[2][2]; + result[2][3] = m[3][2]; + + result[3][0] = m[0][3]; + result[3][1] = m[1][3]; + result[3][2] = m[2][3]; + result[3][3] = m[3][3]; + return result; + } + + template + GLM_FUNC_QUALIFIER detail::tmat2x3 transpose + ( + detail::tmat3x2 const & m + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'transpose' only accept floating-point inputs"); + + detail::tmat2x3 result(detail::tmat2x3::null); + result[0][0] = m[0][0]; + result[0][1] = m[1][0]; + result[0][2] = m[2][0]; + result[1][0] = m[0][1]; + result[1][1] = m[1][1]; + result[1][2] = m[2][1]; + return result; + } + + template + GLM_FUNC_QUALIFIER detail::tmat3x2 transpose + ( + detail::tmat2x3 const & m + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'transpose' only accept floating-point inputs"); + + detail::tmat3x2 result(detail::tmat3x2::null); + result[0][0] = m[0][0]; + result[0][1] = m[1][0]; + result[1][0] = m[0][1]; + result[1][1] = m[1][1]; + result[2][0] = m[0][2]; + result[2][1] = m[1][2]; + return result; + } + + template + GLM_FUNC_QUALIFIER detail::tmat2x4 transpose + ( + detail::tmat4x2 const & m + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'transpose' only accept floating-point inputs"); + + detail::tmat2x4 result(detail::tmat2x4::null); + result[0][0] = m[0][0]; + result[0][1] = m[1][0]; + result[0][2] = m[2][0]; + result[0][3] = m[3][0]; + result[1][0] = m[0][1]; + result[1][1] = m[1][1]; + result[1][2] = m[2][1]; + result[1][3] = m[3][1]; + return result; + } + + template + GLM_FUNC_QUALIFIER detail::tmat4x2 transpose + ( + detail::tmat2x4 const & m + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'transpose' only accept floating-point inputs"); + + detail::tmat4x2 result(detail::tmat4x2::null); + result[0][0] = m[0][0]; + result[0][1] = m[1][0]; + result[1][0] = m[0][1]; + result[1][1] = m[1][1]; + result[2][0] = m[0][2]; + result[2][1] = m[1][2]; + result[3][0] = m[0][3]; + result[3][1] = m[1][3]; + return result; + } + + template + GLM_FUNC_QUALIFIER detail::tmat3x4 transpose + ( + detail::tmat4x3 const & m + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'transpose' only accept floating-point inputs"); + + detail::tmat3x4 result(detail::tmat3x4::null); + result[0][0] = m[0][0]; + result[0][1] = m[1][0]; + result[0][2] = m[2][0]; + result[0][3] = m[3][0]; + result[1][0] = m[0][1]; + result[1][1] = m[1][1]; + result[1][2] = m[2][1]; + result[1][3] = m[3][1]; + result[2][0] = m[0][2]; + result[2][1] = m[1][2]; + result[2][2] = m[2][2]; + result[2][3] = m[3][2]; + return result; + } + + template + GLM_FUNC_QUALIFIER detail::tmat4x3 transpose + ( + detail::tmat3x4 const & m + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'transpose' only accept floating-point inputs"); + + detail::tmat4x3 result(detail::tmat4x3::null); + result[0][0] = m[0][0]; + result[0][1] = m[1][0]; + result[0][2] = m[2][0]; + result[1][0] = m[0][1]; + result[1][1] = m[1][1]; + result[1][2] = m[2][1]; + result[2][0] = m[0][2]; + result[2][1] = m[1][2]; + result[2][2] = m[2][2]; + result[3][0] = m[0][3]; + result[3][1] = m[1][3]; + result[3][2] = m[2][3]; + return result; + } + + template + GLM_FUNC_QUALIFIER typename detail::tmat2x2::value_type determinant + ( + detail::tmat2x2 const & m + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'determinant' only accept floating-point inputs"); + + return m[0][0] * m[1][1] - m[1][0] * m[0][1]; + } + + template + GLM_FUNC_QUALIFIER typename detail::tmat3x3::value_type determinant + ( + detail::tmat3x3 const & m + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'determinant' only accept floating-point inputs"); + + return + + m[0][0] * (m[1][1] * m[2][2] - m[2][1] * m[1][2]) + - m[1][0] * (m[0][1] * m[2][2] - m[2][1] * m[0][2]) + + m[2][0] * (m[0][1] * m[1][2] - m[1][1] * m[0][2]); + } + + template + GLM_FUNC_QUALIFIER typename detail::tmat4x4::value_type determinant + ( + detail::tmat4x4 const & m + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'determinant' only accept floating-point inputs"); + + T SubFactor00 = m[2][2] * m[3][3] - m[3][2] * m[2][3]; + T SubFactor01 = m[2][1] * m[3][3] - m[3][1] * m[2][3]; + T SubFactor02 = m[2][1] * m[3][2] - m[3][1] * m[2][2]; + T SubFactor03 = m[2][0] * m[3][3] - m[3][0] * m[2][3]; + T SubFactor04 = m[2][0] * m[3][2] - m[3][0] * m[2][2]; + T SubFactor05 = m[2][0] * m[3][1] - m[3][0] * m[2][1]; + + detail::tvec4 DetCof( + + (m[1][1] * SubFactor00 - m[1][2] * SubFactor01 + m[1][3] * SubFactor02), + - (m[1][0] * SubFactor00 - m[1][2] * SubFactor03 + m[1][3] * SubFactor04), + + (m[1][0] * SubFactor01 - m[1][1] * SubFactor03 + m[1][3] * SubFactor05), + - (m[1][0] * SubFactor02 - m[1][1] * SubFactor04 + m[1][2] * SubFactor05)); + + return m[0][0] * DetCof[0] + + m[0][1] * DetCof[1] + + m[0][2] * DetCof[2] + + m[0][3] * DetCof[3]; + } + + template + GLM_FUNC_QUALIFIER detail::tmat2x2 inverse + ( + detail::tmat2x2 const & m + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'inverse' only accept floating-point inputs"); + + //valType Determinant = m[0][0] * m[1][1] - m[1][0] * m[0][1]; + T Determinant = determinant(m); + + detail::tmat2x2 Inverse( + + m[1][1] / Determinant, + - m[0][1] / Determinant, + - m[1][0] / Determinant, + + m[0][0] / Determinant); + + return Inverse; + } + + template + GLM_FUNC_QUALIFIER detail::tmat3x3 inverse + ( + detail::tmat3x3 const & m + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'inverse' only accept floating-point inputs"); + + //valType Determinant = m[0][0] * (m[1][1] * m[2][2] - m[2][1] * m[1][2]) + // - m[1][0] * (m[0][1] * m[2][2] - m[2][1] * m[0][2]) + // + m[2][0] * (m[0][1] * m[1][2] - m[1][1] * m[0][2]); + + T Determinant = determinant(m); + + detail::tmat3x3 Inverse(detail::tmat3x3::null); + Inverse[0][0] = + (m[1][1] * m[2][2] - m[2][1] * m[1][2]); + Inverse[1][0] = - (m[1][0] * m[2][2] - m[2][0] * m[1][2]); + Inverse[2][0] = + (m[1][0] * m[2][1] - m[2][0] * m[1][1]); + Inverse[0][1] = - (m[0][1] * m[2][2] - m[2][1] * m[0][2]); + Inverse[1][1] = + (m[0][0] * m[2][2] - m[2][0] * m[0][2]); + Inverse[2][1] = - (m[0][0] * m[2][1] - m[2][0] * m[0][1]); + Inverse[0][2] = + (m[0][1] * m[1][2] - m[1][1] * m[0][2]); + Inverse[1][2] = - (m[0][0] * m[1][2] - m[1][0] * m[0][2]); + Inverse[2][2] = + (m[0][0] * m[1][1] - m[1][0] * m[0][1]); + Inverse /= Determinant; + + return Inverse; + } + + template + GLM_FUNC_QUALIFIER detail::tmat4x4 inverse + ( + detail::tmat4x4 const & m + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'inverse' only accept floating-point inputs"); + + T Coef00 = m[2][2] * m[3][3] - m[3][2] * m[2][3]; + T Coef02 = m[1][2] * m[3][3] - m[3][2] * m[1][3]; + T Coef03 = m[1][2] * m[2][3] - m[2][2] * m[1][3]; + + T Coef04 = m[2][1] * m[3][3] - m[3][1] * m[2][3]; + T Coef06 = m[1][1] * m[3][3] - m[3][1] * m[1][3]; + T Coef07 = m[1][1] * m[2][3] - m[2][1] * m[1][3]; + + T Coef08 = m[2][1] * m[3][2] - m[3][1] * m[2][2]; + T Coef10 = m[1][1] * m[3][2] - m[3][1] * m[1][2]; + T Coef11 = m[1][1] * m[2][2] - m[2][1] * m[1][2]; + + T Coef12 = m[2][0] * m[3][3] - m[3][0] * m[2][3]; + T Coef14 = m[1][0] * m[3][3] - m[3][0] * m[1][3]; + T Coef15 = m[1][0] * m[2][3] - m[2][0] * m[1][3]; + + T Coef16 = m[2][0] * m[3][2] - m[3][0] * m[2][2]; + T Coef18 = m[1][0] * m[3][2] - m[3][0] * m[1][2]; + T Coef19 = m[1][0] * m[2][2] - m[2][0] * m[1][2]; + + T Coef20 = m[2][0] * m[3][1] - m[3][0] * m[2][1]; + T Coef22 = m[1][0] * m[3][1] - m[3][0] * m[1][1]; + T Coef23 = m[1][0] * m[2][1] - m[2][0] * m[1][1]; + + detail::tvec4 const SignA(+1, -1, +1, -1); + detail::tvec4 const SignB(-1, +1, -1, +1); + + detail::tvec4 Fac0(Coef00, Coef00, Coef02, Coef03); + detail::tvec4 Fac1(Coef04, Coef04, Coef06, Coef07); + detail::tvec4 Fac2(Coef08, Coef08, Coef10, Coef11); + detail::tvec4 Fac3(Coef12, Coef12, Coef14, Coef15); + detail::tvec4 Fac4(Coef16, Coef16, Coef18, Coef19); + detail::tvec4 Fac5(Coef20, Coef20, Coef22, Coef23); + + detail::tvec4 Vec0(m[1][0], m[0][0], m[0][0], m[0][0]); + detail::tvec4 Vec1(m[1][1], m[0][1], m[0][1], m[0][1]); + detail::tvec4 Vec2(m[1][2], m[0][2], m[0][2], m[0][2]); + detail::tvec4 Vec3(m[1][3], m[0][3], m[0][3], m[0][3]); + + detail::tvec4 Inv0 = SignA * (Vec1 * Fac0 - Vec2 * Fac1 + Vec3 * Fac2); + detail::tvec4 Inv1 = SignB * (Vec0 * Fac0 - Vec2 * Fac3 + Vec3 * Fac4); + detail::tvec4 Inv2 = SignA * (Vec0 * Fac1 - Vec1 * Fac3 + Vec3 * Fac5); + detail::tvec4 Inv3 = SignB * (Vec0 * Fac2 - Vec1 * Fac4 + Vec2 * Fac5); + + detail::tmat4x4 Inverse(Inv0, Inv1, Inv2, Inv3); + + detail::tvec4 Row0(Inverse[0][0], Inverse[1][0], Inverse[2][0], Inverse[3][0]); + + T Determinant = glm::dot(m[0], Row0); + + Inverse /= Determinant; + + return Inverse; + } + + }//namespace matrix + }//namespace function + }//namespace core +}//namespace glm diff --git a/src/glm/core/func_noise.hpp b/src/glm/core/func_noise.hpp new file mode 100644 index 0000000..0dd0631 --- /dev/null +++ b/src/glm/core/func_noise.hpp @@ -0,0 +1,62 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-08-01 +// Updated : 2008-09-10 +// Licence : This source is under MIT License +// File : glm/core/func_noise.hpp +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_core_func_noise +#define glm_core_func_noise + +namespace glm +{ + namespace core{ + namespace function{ + // Define all noise functions from Section 8.9 of GLSL 1.30.8 specification. Included in glm namespace. + namespace noise{ + + /// \addtogroup core_funcs + ///@{ + + //! Returns a 1D noise value based on the input value x. + //! + //! \li GLSL noise1 man page + //! \li GLSL 1.30.08 specification, section 8.9 + template + typename genType::value_type noise1(genType const & x); + + //! Returns a 2D noise value based on the input value x. + //! + //! \li GLSL noise2 man page + //! \li GLSL 1.30.08 specification, section 8.9 + template + detail::tvec2 noise2(genType const & x); + + //! Returns a 3D noise value based on the input value x. + //! + //! \li GLSL noise3 man page + //! \li GLSL 1.30.08 specification, section 8.9 + template + detail::tvec3 noise3(genType const & x); + + //! Returns a 4D noise value based on the input value x. + //! + //! \li GLSL noise4 man page + //! \li GLSL 1.30.08 specification, section 8.9 + template + detail::tvec4 noise4(genType const & x); + + ///@} + + }//namespace noise + }//namespace function + }//namespace core + + using namespace core::function::noise; +}//namespace glm + +#include "func_noise.inl" + +#endif//glm_core_func_noise diff --git a/src/glm/core/func_noise.inl b/src/glm/core/func_noise.inl new file mode 100644 index 0000000..f5a02dc --- /dev/null +++ b/src/glm/core/func_noise.inl @@ -0,0 +1,21 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-08-01 +// Updated : 2011-04-14 +// Licence : This source is under MIT License +// File : glm/core/func_noise.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm +{ + namespace core{ + namespace function{ + namespace noise{ + + + + }//namespace noise + }//namespace function + }//namespace core +}//namespace glm diff --git a/src/glm/core/func_packing.hpp b/src/glm/core/func_packing.hpp new file mode 100644 index 0000000..a84036a --- /dev/null +++ b/src/glm/core/func_packing.hpp @@ -0,0 +1,132 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2010-03-17 +// Updated : 2010-03-17 +// Licence : This source is under MIT License +// File : glm/core/func_packing.hpp +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_core_func_packing +#define glm_core_func_packing + +namespace glm +{ + namespace core{ + namespace function{ + //! Define packing functions from section 8.4 floating-point pack and unpack functions of GLSL 4.00.8 specification + namespace packing + { + /// \addtogroup core_funcs + ///@{ + + //! First, converts each component of the normalized floating-point value v into 8- or 16-bit integer values. + //! Then, the results are packed into the returned 32-bit unsigned integer. + //! + //! The conversion for component c of v to fixed point is done as follows: + //! packUnorm2x16: round(clamp(c, 0, +1) * 65535.0) + //! + //! The first component of the vector will be written to the least significant bits of the output; + //! the last component will be written to the most significant bits. + //! + //! \li GLSL packUnorm2x16 man page + //! \li GLSL 4.00.08 specification, section 8.4 + detail::uint32 packUnorm2x16(detail::tvec2 const & v); + + //! First, converts each component of the normalized floating-point value v into 8- or 16-bit integer values. + //! Then, the results are packed into the returned 32-bit unsigned integer. + //! + //! The conversion for component c of v to fixed point is done as follows: + //! packUnorm4x8: round(clamp(c, 0, +1) * 255.0) + //! + //! The first component of the vector will be written to the least significant bits of the output; + //! the last component will be written to the most significant bits. + //! + //! \li GLSL packUnorm4x8 man page + //! \li GLSL 4.00.08 specification, section 8.4 + detail::uint32 packUnorm4x8(detail::tvec4 const & v); + + //! First, converts each component of the normalized floating-point value v into 8- or 16-bit integer values. + //! Then, the results are packed into the returned 32-bit unsigned integer. + //! + //! The conversion for component c of v to fixed point is done as follows: + //! packSnorm4x8: round(clamp(c, -1, +1) * 127.0) + //! + //! The first component of the vector will be written to the least significant bits of the output; + //! the last component will be written to the most significant bits. + //! + //! \li GLSL packSnorm4x8 man page + //! \li GLSL 4.00.08 specification, section 8.4 + detail::uint32 packSnorm4x8(detail::tvec4 const & v); + + //! First, unpacks a single 32-bit unsigned integer p into a pair of 16-bit unsigned integers, four 8-bit unsigned integers, or four 8-bit signed integers. + //! Then, each component is converted to a normalized floating-point value to generate the returned two- or four-component vector. + //! + //! The conversion for unpacked fixed-point value f to floating point is done as follows: + //! unpackUnorm2x16: f / 65535.0 + //! + //! The first component of the returned vector will be extracted from the least significant bits of the input; + //! the last component will be extracted from the most significant bits. + //! + //! \li GLSL unpackUnorm2x16 man page + //! \li GLSL 4.00.08 specification, section 8.4 + detail::tvec2 unpackUnorm2x16(detail::uint32 const & p); + + //! First, unpacks a single 32-bit unsigned integer p into a pair of 16-bit unsigned integers, four 8-bit unsigned integers, or four 8-bit signed integers. + //! Then, each component is converted to a normalized floating-point value to generate the returned two- or four-component vector. + //! + //! The conversion for unpacked fixed-point value f to floating point is done as follows: + //! unpackUnorm4x8: f / 255.0 + //! + //! The first component of the returned vector will be extracted from the least significant bits of the input; + //! the last component will be extracted from the most significant bits. + //! + //! \li GLSL unpackUnorm4x8 man page + //! \li GLSL 4.00.08 specification, section 8.4 + detail::tvec4 unpackUnorm4x8(detail::uint32 const & p); + + //! First, unpacks a single 32-bit unsigned integer p into a pair of 16-bit unsigned integers, four 8-bit unsigned integers, or four 8-bit signed integers. + //! Then, each component is converted to a normalized floating-point value to generate the returned two- or four-component vector. + //! + //! The conversion for unpacked fixed-point value f to floating point is done as follows: + //! unpackSnorm4x8: clamp(f / 127.0, -1, +1) + //! + //! The first component of the returned vector will be extracted from the least significant bits of the input; + //! the last component will be extracted from the most significant bits. + //! + //! \li GLSL unpackSnorm4x8 man page + //! \li GLSL 4.00.08 specification, section 8.4 + detail::tvec4 unpackSnorm4x8(detail::uint32 const & p); + + //! Returns a double-precision value obtained by packing the components of v into a 64-bit value. + //! If an IEEE 754 Inf or NaN is created, it will not signal, and the resulting floating point value is unspecified. + //! Otherwise, the bit- level representation of v is preserved. + //! The first vector component specifies the 32 least significant bits; + //! the second component specifies the 32 most significant bits. + //! + //! \li GLSL packDouble2x32 man page + //! \li GLSL 4.00.08 specification, section 8.4 + double packDouble2x32(detail::tvec2 const & v); + + //! Returns a two-component unsigned integer vector representation of v. + //! The bit-level representation of v is preserved. + //! The first component of the vector contains the 32 least significant bits of the double; + //! the second component consists the 32 most significant bits. + //! + //! \li GLSL unpackDouble2x32 man page + //! \li GLSL 4.00.08 specification, section 8.4 + detail::tvec2 unpackDouble2x32(double const & v); + + ///@} + + }//namespace packing + }//namespace function + }//namespace core + + using namespace core::function::packing; +}//namespace glm + +#include "func_packing.inl" + +#endif//glm_core_func_packing + diff --git a/src/glm/core/func_packing.inl b/src/glm/core/func_packing.inl new file mode 100644 index 0000000..d582b0e --- /dev/null +++ b/src/glm/core/func_packing.inl @@ -0,0 +1,94 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2010-03-17 +// Updated : 2010-03-17 +// Licence : This source is under MIT License +// File : glm/core/func_packing.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm +{ + namespace detail + { + + }//namespace detail + + namespace core{ + namespace function{ + namespace packing + { + GLM_FUNC_QUALIFIER detail::uint32 packUnorm2x16(detail::tvec2 const & v) + { + detail::uint16 A((detail::uint16)round(clamp(v.x, 0.0f, 1.0f) * 65535.0f)); + detail::uint16 B((detail::uint16)round(clamp(v.y, 0.0f, 1.0f) * 65535.0f)); + return detail::uint32((B << 16) | A); + } + + GLM_FUNC_QUALIFIER detail::uint32 packUnorm4x8(detail::tvec4 const & v) + { + detail::uint8 A((detail::uint8)round(clamp(v.x, 0.0f, 1.0f) * 255.0f)); + detail::uint8 B((detail::uint8)round(clamp(v.y, 0.0f, 1.0f) * 255.0f)); + detail::uint8 C((detail::uint8)round(clamp(v.z, 0.0f, 1.0f) * 255.0f)); + detail::uint8 D((detail::uint8)round(clamp(v.w, 0.0f, 1.0f) * 255.0f)); + return detail::uint32((D << 24) | (C << 16) | (B << 8) | A); + } + + GLM_FUNC_QUALIFIER detail::uint32 packSnorm4x8(detail::tvec4 const & v) + { + detail::uint8 A((detail::uint8)round(clamp(v.x,-1.0f, 1.0f) * 255.0f)); + detail::uint8 B((detail::uint8)round(clamp(v.y,-1.0f, 1.0f) * 255.0f)); + detail::uint8 C((detail::uint8)round(clamp(v.z,-1.0f, 1.0f) * 255.0f)); + detail::uint8 D((detail::uint8)round(clamp(v.w,-1.0f, 1.0f) * 255.0f)); + return detail::uint32((D << 24) | (C << 16) | (B << 8) | A); + } + + GLM_FUNC_QUALIFIER detail::tvec2 unpackUnorm2x16(detail::uint32 const & p) + { + detail::uint16 A(detail::uint16(p >> 0)); + detail::uint16 B(detail::uint16(p >> 16)); + return detail::tvec2( + A * 1.0f / 65535.0f, + B * 1.0f / 65535.0f); + } + + GLM_FUNC_QUALIFIER detail::tvec4 unpackUnorm4x8(detail::uint32 const & p) + { + detail::uint8 A(detail::uint8(p >> 0)); + detail::uint8 B(detail::uint8(p >> 8)); + detail::uint8 C(detail::uint8(p >> 16)); + detail::uint8 D(detail::uint8(p >> 24)); + return detail::tvec4( + A * 1.0f / 255.0f, + B * 1.0f / 255.0f, + C * 1.0f / 255.0f, + D * 1.0f / 255.0f); + } + + GLM_FUNC_QUALIFIER detail::tvec4 unpackSnorm4x8(detail::uint32 const & p) + { + detail::uint8 A(detail::uint8(p >> 0)); + detail::uint8 B(detail::uint8(p >> 8)); + detail::uint8 C(detail::uint8(p >> 16)); + detail::uint8 D(detail::uint8(p >> 24)); + return clamp(detail::tvec4( + A * 1.0f / 127.0f, + B * 1.0f / 127.0f, + C * 1.0f / 127.0f, + D * 1.0f / 127.0f), -1.0f, 1.0f); + } + + GLM_FUNC_QUALIFIER double packDouble2x32(detail::tvec2 const & v) + { + return *(double*)&v; + } + + GLM_FUNC_QUALIFIER detail::tvec2 unpackDouble2x32(double const & v) + { + return *(detail::tvec2*)&v; + } + + }//namespace packing + }//namespace function + }//namespace core +}//namespace glm diff --git a/src/glm/core/func_trigonometric.hpp b/src/glm/core/func_trigonometric.hpp new file mode 100644 index 0000000..4626f1e --- /dev/null +++ b/src/glm/core/func_trigonometric.hpp @@ -0,0 +1,156 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-08-01 +// Updated : 2008-09-10 +// Licence : This source is under MIT License +// File : glm/core/func_trigonometric.hpp +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_core_func_trigonometric +#define glm_core_func_trigonometric + +namespace glm +{ + namespace core{ + namespace function{ + //! Define Angle and trigonometry functions + //! from Section 8.1 of GLSL 1.30.8 specification. + //! Included in glm namespace. + namespace trigonometric{ + + /// \addtogroup core_funcs + ///@{ + + //! Converts degrees to radians and returns the result. + //! + //! \li GLSL radians man page + //! \li GLSL 1.30.08 specification, section 8.1 + template + genType radians(genType const & degrees); + + //! Converts radians to degrees and returns the result. + //! + //! \li GLSL degrees man page + //! \li GLSL 1.30.08 specification, section 8.1 + template + genType degrees(genType const & radians); + + //! The standard trigonometric sine function. + //! The values returned by this function will range from [-1, 1]. + //! + //! \li GLSL sin man page + //! \li GLSL 1.30.08 specification, section 8.1 + template + genType sin(genType const & angle); + + //! The standard trigonometric cosine function. + //! The values returned by this function will range from [-1, 1]. + //! + //! \li GLSL cos man page + //! \li GLSL 1.30.08 specification, section 8.1 + template + genType cos(genType const & angle); + + //! The standard trigonometric tangent function. + //! + //! \li GLSL tan man page + //! \li GLSL 1.30.08 specification, section 8.1 + template + genType tan(genType const & angle); + + //! Arc sine. Returns an angle whose sine is x. + //! The range of values returned by this function is [-PI/2, PI/2]. + //! Results are undefined if |x| > 1. + //! + //! \li GLSL asin man page + //! \li GLSL 1.30.08 specification, section 8.1 + template + genType asin(genType const & x); + + //! Arc cosine. Returns an angle whose sine is x. + //! The range of values returned by this function is [0, PI]. + //! Results are undefined if |x| > 1. + //! + //! \li GLSL acos man page + //! \li GLSL 1.30.08 specification, section 8.1 + template + genType acos(genType const & x); + + //! Arc tangent. Returns an angle whose tangent is y/x. + //! The signs of x and y are used to determine what + //! quadrant the angle is in. The range of values returned + //! by this function is [-PI, PI]. Results are undefined + //! if x and y are both 0. + //! + //! \li GLSL atan man page + //! \li GLSL 1.30.08 specification, section 8.1 + template + genType atan(genType const & y, genType const & x); + + //! Arc tangent. Returns an angle whose tangent is y_over_x. + //! The range of values returned by this function is [-PI/2, PI/2]. + //! + //! \li GLSL atan man page + //! \li GLSL 1.30.08 specification, section 8.1 + template + genType atan(genType const & y_over_x); + + //! Returns the hyperbolic sine function, (exp(x) - exp(-x)) / 2 + //! + //! \li GLSL sinh man page + //! \li GLSL 1.30.08 specification, section 8.1 + template + genType sinh(genType const & angle); + + //! Returns the hyperbolic cosine function, (exp(x) + exp(-x)) / 2 + //! + //! \li GLSL cosh man page + //! \li GLSL 1.30.08 specification, section 8.1 + template + genType cosh(genType const & angle); + + //! Returns the hyperbolic tangent function, sinh(angle) / cosh(angle) + //! + //! \li GLSL tanh man page + //! \li GLSL 1.30.08 specification, section 8.1 + template + genType tanh(genType const & angle); + + //! Arc hyperbolic sine; returns the inverse of sinh. + //! + //! \li GLSL asinh man page + //! \li GLSL 1.30.08 specification, section 8.1 + template + genType asinh(genType const & x); + + //! Arc hyperbolic cosine; returns the non-negative inverse + //! of cosh. Results are undefined if x < 1. + //! + //! \li GLSL acosh man page + //! \li GLSL 1.30.08 specification, section 8.1 + template + genType acosh(genType const & x); + + //! Arc hyperbolic tangent; returns the inverse of tanh. + //! Results are undefined if abs(x) >= 1. + //! + //! \li GLSL atanh man page + //! \li GLSL 1.30.08 specification, section 8.1 + template + genType atanh(genType const & x); + + ///@} + + }//namespace trigonometric + }//namespace function + }//namespace core + + using namespace core::function::trigonometric; +}//namespace glm + +#include "func_trigonometric.inl" + +#endif//glm_core_func_trigonometric + + diff --git a/src/glm/core/func_trigonometric.inl b/src/glm/core/func_trigonometric.inl new file mode 100644 index 0000000..07490e9 --- /dev/null +++ b/src/glm/core/func_trigonometric.inl @@ -0,0 +1,745 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-08-03 +// Updated : 2008-09-14 +// Licence : This source is under MIT License +// File : glm/core/func_trigonometric.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm +{ + namespace core{ + namespace function{ + namespace trigonometric{ + + // radians + template + GLM_FUNC_QUALIFIER genType radians + ( + genType const & degrees + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'radians' only accept floating-point input"); + + const genType pi = genType(3.1415926535897932384626433832795); + return degrees * (pi / genType(180)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 radians + ( + detail::tvec2 const & degrees + ) + { + return detail::tvec2( + radians(degrees.x), + radians(degrees.y)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 radians + ( + detail::tvec3 const & degrees + ) + { + return detail::tvec3( + radians(degrees.x), + radians(degrees.y), + radians(degrees.z)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 radians + ( + detail::tvec4 const & degrees + ) + { + return detail::tvec4( + radians(degrees.x), + radians(degrees.y), + radians(degrees.z), + radians(degrees.w)); + } + + // degrees + template + GLM_FUNC_QUALIFIER genType degrees + ( + genType const & radians + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'degrees' only accept floating-point input"); + + const genType pi = genType(3.1415926535897932384626433832795); + return radians * (genType(180) / pi); + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 degrees + ( + detail::tvec2 const & radians + ) + { + return detail::tvec2( + degrees(radians.x), + degrees(radians.y)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 degrees + ( + detail::tvec3 const & radians + ) + { + return detail::tvec3( + degrees(radians.x), + degrees(radians.y), + degrees(radians.z)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 degrees + ( + detail::tvec4 const & radians + ) + { + return detail::tvec4( + degrees(radians.x), + degrees(radians.y), + degrees(radians.z), + degrees(radians.w)); + } + + // sin + template + GLM_FUNC_QUALIFIER genType sin + ( + genType const & angle + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'sin' only accept floating-point input"); + + return ::std::sin(angle); + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 sin + ( + detail::tvec2 const & angle + ) + { + return detail::tvec2( + sin(angle.x), + sin(angle.y)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 sin + ( + detail::tvec3 const & angle + ) + { + return detail::tvec3( + sin(angle.x), + sin(angle.y), + sin(angle.z)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 sin + ( + detail::tvec4 const & angle + ) + { + return detail::tvec4( + sin(angle.x), + sin(angle.y), + sin(angle.z), + sin(angle.w)); + } + + // cos + template + GLM_FUNC_QUALIFIER genType cos(genType const & angle) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'cos' only accept floating-point input"); + + return ::std::cos(angle); + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 cos + ( + detail::tvec2 const & angle + ) + { + return detail::tvec2( + cos(angle.x), + cos(angle.y)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 cos + ( + detail::tvec3 const & angle + ) + { + return detail::tvec3( + cos(angle.x), + cos(angle.y), + cos(angle.z)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 cos + ( + detail::tvec4 const & angle + ) + { + return detail::tvec4( + cos(angle.x), + cos(angle.y), + cos(angle.z), + cos(angle.w)); + } + + // tan + template + GLM_FUNC_QUALIFIER genType tan + ( + genType const & angle + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'tan' only accept floating-point input"); + + return ::std::tan(angle); + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 tan + ( + detail::tvec2 const & angle + ) + { + return detail::tvec2( + tan(angle.x), + tan(angle.y)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 tan + ( + detail::tvec3 const & angle + ) + { + return detail::tvec3( + tan(angle.x), + tan(angle.y), + tan(angle.z)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 tan + ( + detail::tvec4 const & angle + ) + { + return detail::tvec4( + tan(angle.x), + tan(angle.y), + tan(angle.z), + tan(angle.w)); + } + + // asin + template + GLM_FUNC_QUALIFIER genType asin + ( + genType const & x + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'asin' only accept floating-point input"); + + return ::std::asin(x); + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 asin + ( + detail::tvec2 const & x + ) + { + return detail::tvec2( + asin(x.x), + asin(x.y)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 asin + ( + detail::tvec3 const & x + ) + { + return detail::tvec3( + asin(x.x), + asin(x.y), + asin(x.z)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 asin + ( + detail::tvec4 const & x + ) + { + return detail::tvec4( + asin(x.x), + asin(x.y), + asin(x.z), + asin(x.w)); + } + + // acos + template + GLM_FUNC_QUALIFIER genType acos + ( + genType const & x + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'acos' only accept floating-point input"); + + return ::std::acos(x); + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 acos + ( + detail::tvec2 const & x + ) + { + return detail::tvec2( + acos(x.x), + acos(x.y)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 acos + ( + detail::tvec3 const & x + ) + { + return detail::tvec3( + acos(x.x), + acos(x.y), + acos(x.z)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 acos + ( + detail::tvec4 const & x + ) + { + return detail::tvec4( + acos(x.x), + acos(x.y), + acos(x.z), + acos(x.w)); + } + + // atan + template + GLM_FUNC_QUALIFIER genType atan + ( + genType const & y, + genType const & x + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'atan' only accept floating-point input"); + + return ::std::atan2(y, x); + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 atan + ( + detail::tvec2 const & y, + detail::tvec2 const & x + ) + { + return detail::tvec2( + atan(y.x, x.x), + atan(y.y, x.y)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 atan + ( + detail::tvec3 const & y, + detail::tvec3 const & x + ) + { + return detail::tvec3( + atan(y.x, x.x), + atan(y.y, x.y), + atan(y.z, x.z)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 atan + ( + detail::tvec4 const & y, + detail::tvec4 const & x + ) + { + return detail::tvec4( + atan(y.x, x.x), + atan(y.y, x.y), + atan(y.z, x.z), + atan(y.w, x.w)); + } + + template + GLM_FUNC_QUALIFIER genType atan + ( + genType const & x + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'atan' only accept floating-point input"); + + return ::std::atan(x); + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 atan + ( + detail::tvec2 const & x + ) + { + return detail::tvec2( + atan(x.x), + atan(x.y)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 atan + ( + detail::tvec3 const & x + ) + { + return detail::tvec3( + atan(x.x), + atan(x.y), + atan(x.z)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 atan + ( + detail::tvec4 const & x + ) + { + return detail::tvec4( + atan(x.x), + atan(x.y), + atan(x.z), + atan(x.w)); + } + + // sinh + template + GLM_FUNC_QUALIFIER genType sinh + ( + genType const & angle + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'sinh' only accept floating-point input"); + + return std::sinh(angle); + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 sinh + ( + detail::tvec2 const & angle + ) + { + return detail::tvec2( + sinh(angle.x), + sinh(angle.y)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 sinh + ( + detail::tvec3 const & angle + ) + { + return detail::tvec3( + sinh(angle.x), + sinh(angle.y), + sinh(angle.z)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 sinh + ( + detail::tvec4 const & angle + ) + { + return detail::tvec4( + sinh(angle.x), + sinh(angle.y), + sinh(angle.z), + sinh(angle.w)); + } + + // cosh + template + GLM_FUNC_QUALIFIER genType cosh + ( + genType const & angle + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'cosh' only accept floating-point input"); + + return std::cosh(angle); + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 cosh + ( + detail::tvec2 const & angle + ) + { + return detail::tvec2( + cosh(angle.x), + cosh(angle.y)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 cosh + ( + detail::tvec3 const & angle + ) + { + return detail::tvec3( + cosh(angle.x), + cosh(angle.y), + cosh(angle.z)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 cosh + ( + detail::tvec4 const & angle + ) + { + return detail::tvec4( + cosh(angle.x), + cosh(angle.y), + cosh(angle.z), + cosh(angle.w)); + } + + // tanh + template + GLM_FUNC_QUALIFIER genType tanh + ( + genType const & angle + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'tanh' only accept floating-point input"); + + return std::tanh(angle); + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 tanh + ( + detail::tvec2 const & angle + ) + { + return detail::tvec2( + tanh(angle.x), + tanh(angle.y)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 tanh + ( + detail::tvec3 const & angle + ) + { + return detail::tvec3( + tanh(angle.x), + tanh(angle.y), + tanh(angle.z)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 tanh + ( + detail::tvec4 const & angle + ) + { + return detail::tvec4( + tanh(angle.x), + tanh(angle.y), + tanh(angle.z), + tanh(angle.w)); + } + + // asinh + template + GLM_FUNC_QUALIFIER genType asinh + ( + genType const & x + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'asinh' only accept floating-point input"); + + return (x < genType(0) ? genType(-1) : (x > genType(0) ? genType(1) : genType(0))) * log(abs(x) + sqrt(genType(1) + x * x)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 asinh + ( + detail::tvec2 const & x + ) + { + return detail::tvec2( + asinh(x.x), + asinh(x.y)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 asinh + ( + detail::tvec3 const & x + ) + { + return detail::tvec3( + asinh(x.x), + asinh(x.y), + asinh(x.z)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 asinh + ( + detail::tvec4 const & x + ) + { + return detail::tvec4( + asinh(x.x), + asinh(x.y), + asinh(x.z), + asinh(x.w)); + } + + // acosh + template + GLM_FUNC_QUALIFIER genType acosh + ( + genType const & x + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'acosh' only accept floating-point input"); + + if(x < genType(1)) + return genType(0); + return log(x + sqrt(x * x - genType(1))); + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 acosh + ( + detail::tvec2 const & x + ) + { + return detail::tvec2( + acosh(x.x), + acosh(x.y)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 acosh + ( + detail::tvec3 const & x + ) + { + return detail::tvec3( + acosh(x.x), + acosh(x.y), + acosh(x.z)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 acosh + ( + detail::tvec4 const & x + ) + { + return detail::tvec4( + acosh(x.x), + acosh(x.y), + acosh(x.z), + acosh(x.w)); + } + + // atanh + template + GLM_FUNC_QUALIFIER genType atanh + ( + genType const & x + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'atanh' only accept floating-point input"); + + if(abs(x) >= genType(1)) + return 0; + return genType(0.5) * log((genType(1) + x) / (genType(1) - x)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 atanh + ( + detail::tvec2 const & x + ) + { + return detail::tvec2( + atanh(x.x), + atanh(x.y)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 atanh + ( + detail::tvec3 const & x + ) + { + return detail::tvec3( + atanh(x.x), + atanh(x.y), + atanh(x.z)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 atanh + ( + detail::tvec4 const & x + ) + { + return detail::tvec4( + atanh(x.x), + atanh(x.y), + atanh(x.z), + atanh(x.w)); + } + + }//namespace trigonometric + }//namespace function + }//namespace core +}//namespace glm diff --git a/src/glm/core/func_vector_relational.hpp b/src/glm/core/func_vector_relational.hpp new file mode 100644 index 0000000..e8d9677 --- /dev/null +++ b/src/glm/core/func_vector_relational.hpp @@ -0,0 +1,215 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-08-03 +// Updated : 2008-09-09 +// Licence : This source is under MIT License +// File : glm/core/func_vector_relational.hpp +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_core_func_vector_relational +#define glm_core_func_vector_relational + +#include "_detail.hpp" + +namespace glm +{ + namespace core{ + namespace function{ + //! Define vector relational functions from Section 8.6 of GLSL 1.30.8 specification. + //! Included in glm namespace. + namespace vector_relational + { + /// \addtogroup core_funcs + ///@{ + + //! Returns the component-wise comparison result of x < y. + //! + //! \li GLSL lessThan man page + //! \li GLSL 1.30.08 specification, section 8.6 + template class vecType> + GLM_FUNC_QUALIFIER typename vecType::bool_type lessThan + ( + vecType const & x, + vecType const & y + ) + { + GLM_STATIC_ASSERT(detail::is_vector >::_YES, + "Invalid template instantiation of 'lessThan', GLM vector types required"); + GLM_STATIC_ASSERT(detail::is_bool::_NO, + "Invalid template instantiation of 'lessThan', GLM vector types required floating-point or integer value types vectors"); + + typename vecType::bool_type Result(vecType::null); + for(typename vecType::size_type i = 0; i < vecType::value_size(); ++i) + Result[i] = x[i] < y[i]; + + return Result; + } + + //! Returns the component-wise comparison of result x <= y. + //! + //! \li GLSL lessThanEqual man page + //! \li GLSL 1.30.08 specification, section 8.6 + template class vecType> + GLM_FUNC_QUALIFIER typename vecType::bool_type lessThanEqual + ( + vecType const & x, + vecType const & y + ) + { + GLM_STATIC_ASSERT(detail::is_vector >::_YES, + "Invalid template instantiation of 'lessThanEqual', GLM vector types required"); + GLM_STATIC_ASSERT(detail::is_bool::_NO, + "Invalid template instantiation of 'lessThanEqual', GLM vector types required floating-point or integer value types vectors"); + + typename vecType::bool_type Result(vecType::null); + for(typename vecType::size_type i = 0; i < vecType::value_size(); ++i) + Result[i] = x[i] <= y[i]; + return Result; + } + + //! Returns the component-wise comparison of result x > y. + //! + //! \li GLSL greaterThan man page + //! \li GLSL 1.30.08 specification, section 8.6 + template class vecType> + GLM_FUNC_QUALIFIER typename vecType::bool_type greaterThan + ( + vecType const & x, + vecType const & y + ) + { + GLM_STATIC_ASSERT(detail::is_vector >::_YES, + "Invalid template instantiation of 'greaterThan', GLM vector types required"); + GLM_STATIC_ASSERT(detail::is_bool::_NO, + "Invalid template instantiation of 'greaterThan', GLM vector types required floating-point or integer value types vectors"); + + typename vecType::bool_type Result(vecType::null); + for(typename vecType::size_type i = 0; i < vecType::value_size(); ++i) + Result[i] = x[i] > y[i]; + return Result; + } + + //! Returns the component-wise comparison of result x >= y. + //! + //! \li GLSL greaterThanEqual man page + //! \li GLSL 1.30.08 specification, section 8.6 + template class vecType> + GLM_FUNC_QUALIFIER typename vecType::bool_type greaterThanEqual + ( + vecType const & x, + vecType const & y + ) + { + GLM_STATIC_ASSERT(detail::is_vector >::_YES, + "Invalid template instantiation of 'greaterThanEqual', GLM vector types required"); + GLM_STATIC_ASSERT(detail::is_bool::_NO, + "Invalid template instantiation of 'greaterThanEqual', GLM vector types required floating-point or integer value types vectors"); + + typename vecType::bool_type Result(vecType::null); + for(typename vecType::size_type i = 0; i < vecType::value_size(); ++i) + Result[i] = x[i] >= y[i]; + return Result; + } + + //! Returns the component-wise comparison of result x == y. + //! + //! \li GLSL equal man page + //! \li GLSL 1.30.08 specification, section 8.6 + template class vecType> + GLM_FUNC_QUALIFIER typename vecType::bool_type equal + ( + vecType const & x, + vecType const & y + ) + { + GLM_STATIC_ASSERT(detail::is_vector >::_YES, + "Invalid template instantiation of 'equal', GLM vector types required"); + + typename vecType::bool_type Result(vecType::null); + for(typename vecType::size_type i = 0; i < vecType::value_size(); ++i) + Result[i] = x[i] == y[i]; + return Result; + } + + //! Returns the component-wise comparison of result x != y. + //! + //! \li GLSL notEqual man page + //! \li GLSL 1.30.08 specification, section 8.6 + template class vecType> + GLM_FUNC_QUALIFIER typename vecType::bool_type notEqual + ( + vecType const & x, + vecType const & y + ) + { + GLM_STATIC_ASSERT(detail::is_vector >::_YES, + "Invalid template instantiation of 'notEqual', GLM vector types required"); + + typename vecType::bool_type Result(vecType::null); + for(typename vecType::size_type i = 0; i < vecType::value_size(); ++i) + Result[i] = x[i] != y[i]; + return Result; + } + + //! Returns true if any component of x is true. + //! + //! \li GLSL any man page + //! \li GLSL 1.30.08 specification, section 8.6 + template