summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDimitri John Ledkov <dimitri.ledkov@canonical.com>2014-02-20 16:10:52 +0000
committerDimitri John Ledkov <dimitri.ledkov@canonical.com>2014-02-20 19:15:57 +0000
commitd20f4a64eba38690337ac914a04a113de7caf125 (patch)
tree6828990e93ca5d8847b8cde2f2febb6566b0d53f /src
parent28161e9209f21be1a600f637565ecede94855a36 (diff)
New upstream release. Closes: #721047debian/1.8.0-1
Drop all patches, none are needed with this new upstream release. Port to dh. Specify foreign in configure.ac.
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am19
-rw-r--r--src/Makefile.in87
-rw-r--r--src/anim/Anim.cpp2
-rw-r--r--src/anim/Anim.h2
-rw-r--r--src/anim/AttrAnim.cpp12
-rw-r--r--src/anim/AttrAnim.h8
-rw-r--r--src/anim/ContinuousAnim.cpp18
-rw-r--r--src/anim/ContinuousAnim.h2
-rw-r--r--src/anim/EaseInOutAnim.cpp22
-rw-r--r--src/anim/EaseInOutAnim.h8
-rw-r--r--src/anim/LinearAnim.cpp8
-rw-r--r--src/anim/LinearAnim.h8
-rw-r--r--src/anim/Makefile.am5
-rw-r--r--src/anim/Makefile.in91
-rw-r--r--src/anim/ParallelAnim.cpp2
-rw-r--r--src/anim/ParallelAnim.h2
-rw-r--r--src/anim/SimpleAnim.cpp56
-rw-r--r--src/anim/SimpleAnim.h6
-rw-r--r--src/anim/StateAnim.cpp2
-rw-r--r--src/anim/StateAnim.h3
-rw-r--r--src/anim/WaitAnim.cpp6
-rw-r--r--src/anim/WaitAnim.h6
-rw-r--r--src/api.h8
-rw-r--r--src/audio/AudioBuffer.cpp29
-rw-r--r--src/audio/AudioBuffer.h6
-rw-r--r--src/audio/AudioEngine.cpp242
-rw-r--r--src/audio/AudioEngine.h62
-rw-r--r--src/audio/AudioMsg.cpp165
-rw-r--r--src/audio/AudioMsg.h85
-rw-r--r--src/audio/AudioParams.cpp2
-rw-r--r--src/audio/AudioParams.h2
-rw-r--r--src/audio/AudioSource.cpp156
-rw-r--r--src/audio/AudioSource.h66
-rw-r--r--src/audio/Dynamics.h28
-rw-r--r--src/audio/IProcessor.h2
-rw-r--r--src/audio/Makefile.am19
-rw-r--r--src/audio/Makefile.in124
-rw-r--r--src/audio/SDLAudioEngine.cpp228
-rw-r--r--src/audio/SDLAudioEngine.h78
-rw-r--r--src/audio/testlimiter.cpp26
-rw-r--r--src/avgconfig.h.in17
-rw-r--r--src/avgconfigwrapper.h2
-rw-r--r--src/avgrc28
-rw-r--r--src/base/Backtrace.cpp39
-rw-r--r--src/base/Backtrace.h2
-rw-r--r--src/base/BezierCurve.cpp27
-rw-r--r--src/base/BezierCurve.h20
-rw-r--r--src/base/CmdLine.cpp82
-rw-r--r--src/base/CmdQueue.h9
-rw-r--r--src/base/Command.h2
-rw-r--r--src/base/ConfigMgr.cpp99
-rw-r--r--src/base/ConfigMgr.h16
-rw-r--r--src/base/CubicSpline.cpp97
-rw-r--r--src/base/CubicSpline.h16
-rw-r--r--src/base/DAG.cpp130
-rw-r--r--src/base/DAG.h64
-rw-r--r--src/base/DirEntry.cpp2
-rw-r--r--src/base/DirEntry.h2
-rw-r--r--src/base/Directory.cpp2
-rw-r--r--src/base/Directory.h2
-rw-r--r--src/base/DlfcnWrapper.cpp2
-rw-r--r--src/base/DlfcnWrapper.h2
-rw-r--r--src/base/Exception.cpp28
-rw-r--r--src/base/Exception.h10
-rw-r--r--src/base/FileHelper.cpp11
-rw-r--r--src/base/FileHelper.h20
-rw-r--r--src/base/GLMHelper.cpp183
-rw-r--r--src/base/GLMHelper.h70
-rw-r--r--src/base/GeomHelper.cpp54
-rw-r--r--src/base/GeomHelper.h23
-rw-r--r--src/base/IFrameEndListener.h2
-rw-r--r--src/base/ILogSink.h53
-rw-r--r--src/base/IPlaybackEndListener.h2
-rw-r--r--src/base/IPreRenderListener.h2
-rw-r--r--src/base/Logger.cpp339
-rw-r--r--src/base/Logger.h150
-rw-r--r--src/base/Makefile.am32
-rw-r--r--src/base/Makefile.in371
-rw-r--r--src/base/MathHelper.cpp32
-rw-r--r--src/base/MathHelper.h12
-rw-r--r--src/base/Matrix3x4.cpp128
-rw-r--r--src/base/OSHelper.cpp142
-rw-r--r--src/base/OSHelper.h6
-rw-r--r--src/base/ObjectCounter.cpp11
-rw-r--r--src/base/ObjectCounter.h9
-rw-r--r--src/base/Point.cpp325
-rw-r--r--src/base/Point.h124
-rw-r--r--src/base/ProfilingZone.cpp14
-rw-r--r--src/base/ProfilingZone.h6
-rw-r--r--src/base/ProfilingZoneID.cpp21
-rw-r--r--src/base/ProfilingZoneID.h11
-rw-r--r--src/base/Queue.h46
-rw-r--r--src/base/Rect.h61
-rw-r--r--src/base/ScopeTimer.cpp13
-rw-r--r--src/base/ScopeTimer.h31
-rw-r--r--src/base/Signal.h2
-rw-r--r--src/base/StandardLogSink.cpp54
-rw-r--r--src/base/StandardLogSink.h39
-rw-r--r--src/base/StringHelper.cpp36
-rw-r--r--src/base/StringHelper.h38
-rw-r--r--src/base/Test.cpp4
-rw-r--r--src/base/Test.h3
-rw-r--r--src/base/TestSuite.cpp6
-rw-r--r--src/base/TestSuite.h2
-rw-r--r--src/base/ThreadHelper.cpp94
-rw-r--r--src/base/ThreadHelper.h37
-rw-r--r--src/base/ThreadProfiler.cpp61
-rw-r--r--src/base/ThreadProfiler.h38
-rw-r--r--src/base/TimeSource.cpp18
-rw-r--r--src/base/TimeSource.h2
-rw-r--r--src/base/Triangle.cpp50
-rw-r--r--src/base/Triangle.h18
-rw-r--r--src/base/Triangulate.cpp139
-rw-r--r--src/base/Triangulate.h22
-rw-r--r--src/base/Triple.cpp107
-rw-r--r--src/base/UTF8String.cpp7
-rw-r--r--src/base/UTF8String.h5
-rw-r--r--src/base/WideLine.cpp16
-rw-r--r--src/base/WideLine.h16
-rw-r--r--src/base/WorkerThread.cpp41
-rw-r--r--src/base/WorkerThread.h43
-rw-r--r--src/base/XMLHelper.cpp149
-rw-r--r--src/base/XMLHelper.h40
-rw-r--r--src/base/testbase.cpp553
-rw-r--r--src/base/triangulate/AdvancingFront.cpp104
-rw-r--r--src/base/triangulate/AdvancingFront.h118
-rw-r--r--src/base/triangulate/Makefile.am8
-rw-r--r--src/base/triangulate/Makefile.in (renamed from src/conradrelais/Makefile.in)125
-rw-r--r--src/base/triangulate/Shapes.cpp353
-rw-r--r--src/base/triangulate/Shapes.h296
-rw-r--r--src/base/triangulate/Sweep.cpp796
-rw-r--r--src/base/triangulate/Sweep.h201
-rw-r--r--src/base/triangulate/SweepContext.cpp196
-rw-r--r--src/base/triangulate/SweepContext.h181
-rw-r--r--src/base/triangulate/Triangulate.cpp90
-rw-r--r--src/base/triangulate/Triangulate.h33
-rw-r--r--src/base/triangulate/Utils.h124
-rw-r--r--src/conradrelais/ConradRelais.cpp179
-rw-r--r--src/conradrelais/ConradRelais.h74
-rw-r--r--src/conradrelais/Makefile.am7
-rw-r--r--src/glm/core/_detail.hpp356
-rw-r--r--src/glm/core/_fixes.hpp18
-rw-r--r--src/glm/core/_swizzle.hpp1085
-rw-r--r--src/glm/core/func_common.hpp337
-rw-r--r--src/glm/core/func_common.inl1577
-rw-r--r--src/glm/core/func_exponential.hpp86
-rw-r--r--src/glm/core/func_exponential.inl358
-rw-r--r--src/glm/core/func_geometric.hpp108
-rw-r--r--src/glm/core/func_geometric.inl290
-rw-r--r--src/glm/core/func_integer.hpp158
-rw-r--r--src/glm/core/func_integer.inl597
-rw-r--r--src/glm/core/func_matrix.hpp111
-rw-r--r--src/glm/core/func_matrix.inl571
-rw-r--r--src/glm/core/func_noise.hpp62
-rw-r--r--src/glm/core/func_noise.inl21
-rw-r--r--src/glm/core/func_packing.hpp132
-rw-r--r--src/glm/core/func_packing.inl94
-rw-r--r--src/glm/core/func_trigonometric.hpp156
-rw-r--r--src/glm/core/func_trigonometric.inl745
-rw-r--r--src/glm/core/func_vector_relational.hpp215
-rw-r--r--src/glm/core/func_vector_relational.inl20
-rw-r--r--src/glm/core/hint.hpp21
-rw-r--r--src/glm/core/intrinsic_common.hpp70
-rw-r--r--src/glm/core/intrinsic_common.inl283
-rw-r--r--src/glm/core/intrinsic_exponential.hpp60
-rw-r--r--src/glm/core/intrinsic_exponential.inl0
-rw-r--r--src/glm/core/intrinsic_geometric.hpp57
-rw-r--r--src/glm/core/intrinsic_geometric.inl123
-rw-r--r--src/glm/core/intrinsic_matrix.hpp50
-rw-r--r--src/glm/core/intrinsic_matrix.inl1051
-rw-r--r--src/glm/core/intrinsic_trigonometric.hpp29
-rw-r--r--src/glm/core/intrinsic_trigonometric.inl0
-rw-r--r--src/glm/core/intrinsic_vector_relational.hpp29
-rw-r--r--src/glm/core/intrinsic_vector_relational.inl347
-rw-r--r--src/glm/core/setup.hpp480
-rw-r--r--src/glm/core/type.hpp322
-rw-r--r--src/glm/core/type_float.hpp74
-rw-r--r--src/glm/core/type_gentype.hpp150
-rw-r--r--src/glm/core/type_gentype.inl347
-rw-r--r--src/glm/core/type_half.hpp78
-rw-r--r--src/glm/core/type_half.inl357
-rw-r--r--src/glm/core/type_int.hpp109
-rw-r--r--src/glm/core/type_mat.hpp56
-rw-r--r--src/glm/core/type_mat.inl0
-rw-r--r--src/glm/core/type_mat2x2.hpp281
-rw-r--r--src/glm/core/type_mat2x2.inl648
-rw-r--r--src/glm/core/type_mat2x3.hpp227
-rw-r--r--src/glm/core/type_mat2x3.inl583
-rw-r--r--src/glm/core/type_mat2x4.hpp225
-rw-r--r--src/glm/core/type_mat2x4.inl611
-rw-r--r--src/glm/core/type_mat3x2.hpp231
-rw-r--r--src/glm/core/type_mat3x2.inl623
-rw-r--r--src/glm/core/type_mat3x3.hpp283
-rw-r--r--src/glm/core/type_mat3x3.inl750
-rw-r--r--src/glm/core/type_mat3x4.hpp232
-rw-r--r--src/glm/core/type_mat3x4.inl653
-rw-r--r--src/glm/core/type_mat4x2.hpp242
-rw-r--r--src/glm/core/type_mat4x2.inl670
-rw-r--r--src/glm/core/type_mat4x3.hpp240
-rw-r--r--src/glm/core/type_mat4x3.inl675
-rw-r--r--src/glm/core/type_mat4x4.hpp286
-rw-r--r--src/glm/core/type_mat4x4.inl840
-rw-r--r--src/glm/core/type_size.hpp24
-rw-r--r--src/glm/core/type_vec.hpp22
-rw-r--r--src/glm/core/type_vec.inl0
-rw-r--r--src/glm/core/type_vec1.hpp172
-rw-r--r--src/glm/core/type_vec1.inl884
-rw-r--r--src/glm/core/type_vec2.hpp263
-rw-r--r--src/glm/core/type_vec2.inl1010
-rw-r--r--src/glm/core/type_vec3.hpp269
-rw-r--r--src/glm/core/type_vec3.inl1097
-rw-r--r--src/glm/core/type_vec4.hpp282
-rw-r--r--src/glm/core/type_vec4.inl1226
-rw-r--r--src/glm/ext.hpp97
-rw-r--r--src/glm/glm.hpp93
-rw-r--r--src/glm/gtc/half_float.hpp401
-rw-r--r--src/glm/gtc/half_float.inl975
-rw-r--r--src/glm/gtc/matrix_access.hpp70
-rw-r--r--src/glm/gtc/matrix_access.inl59
-rw-r--r--src/glm/gtc/matrix_integer.hpp204
-rw-r--r--src/glm/gtc/matrix_inverse.hpp51
-rw-r--r--src/glm/gtc/matrix_inverse.inl139
-rw-r--r--src/glm/gtc/matrix_transform.hpp158
-rw-r--r--src/glm/gtc/matrix_transform.inl397
-rw-r--r--src/glm/gtc/quaternion.hpp245
-rw-r--r--src/glm/gtc/quaternion.inl584
-rw-r--r--src/glm/gtc/swizzle.hpp354
-rw-r--r--src/glm/gtc/swizzle.inl177
-rw-r--r--src/glm/gtc/type_precision.hpp220
-rw-r--r--src/glm/gtc/type_precision.inl13
-rw-r--r--src/glm/gtc/type_ptr.hpp449
-rw-r--r--src/glm/gtc/type_ptr.inl0
-rw-r--r--src/glm/gtx/associated_min_max.hpp82
-rw-r--r--src/glm/gtx/associated_min_max.inl916
-rw-r--r--src/glm/gtx/bit.hpp107
-rw-r--r--src/glm/gtx/bit.inl743
-rw-r--r--src/glm/gtx/closest_point.hpp47
-rw-r--r--src/glm/gtx/closest_point.inl41
-rw-r--r--src/glm/gtx/color_cast.hpp107
-rw-r--r--src/glm/gtx/color_cast.inl739
-rw-r--r--src/glm/gtx/color_space.hpp77
-rw-r--r--src/glm/gtx/color_space.inl154
-rw-r--r--src/glm/gtx/color_space_YCoCg.hpp65
-rw-r--r--src/glm/gtx/color_space_YCoCg.inl69
-rw-r--r--src/glm/gtx/compatibility.hpp170
-rw-r--r--src/glm/gtx/compatibility.inl141
-rw-r--r--src/glm/gtx/component_wise.hpp63
-rw-r--r--src/glm/gtx/component_wise.inl52
-rw-r--r--src/glm/gtx/epsilon.hpp59
-rw-r--r--src/glm/gtx/epsilon.inl234
-rw-r--r--src/glm/gtx/euler_angles.hpp141
-rw-r--r--src/glm/gtx/euler_angles.inl249
-rw-r--r--src/glm/gtx/extend.hpp47
-rw-r--r--src/glm/gtx/extend.inl60
-rw-r--r--src/glm/gtx/extented_min_max.hpp175
-rw-r--r--src/glm/gtx/extented_min_max.inl182
-rw-r--r--src/glm/gtx/fast_exponential.hpp81
-rw-r--r--src/glm/gtx/fast_exponential.inl294
-rw-r--r--src/glm/gtx/fast_square_root.hpp68
-rw-r--r--src/glm/gtx/fast_square_root.inl237
-rw-r--r--src/glm/gtx/fast_trigonometry.hpp81
-rw-r--r--src/glm/gtx/fast_trigonometry.inl272
-rw-r--r--src/glm/gtx/gradient_paint.hpp55
-rw-r--r--src/glm/gtx/gradient_paint.inl44
-rw-r--r--src/glm/gtx/handed_coordinate_space.hpp55
-rw-r--r--src/glm/gtx/handed_coordinate_space.inl34
-rw-r--r--src/glm/gtx/inertia.hpp95
-rw-r--r--src/glm/gtx/inertia.inl103
-rw-r--r--src/glm/gtx/int_10_10_10_2.hpp47
-rw-r--r--src/glm/gtx/int_10_10_10_2.inl21
-rw-r--r--src/glm/gtx/integer.hpp56
-rw-r--r--src/glm/gtx/integer.inl91
-rw-r--r--src/glm/gtx/intersect.hpp73
-rw-r--r--src/glm/gtx/intersect.inl201
-rw-r--r--src/glm/gtx/log_base.hpp47
-rw-r--r--src/glm/gtx/log_base.inl92
-rw-r--r--src/glm/gtx/matrix_cross_product.hpp51
-rw-r--r--src/glm/gtx/matrix_cross_product.inl44
-rw-r--r--src/glm/gtx/matrix_interpolation.hpp66
-rw-r--r--src/glm/gtx/matrix_interpolation.inl117
-rw-r--r--src/glm/gtx/matrix_major_storage.hpp123
-rw-r--r--src/glm/gtx/matrix_major_storage.inl176
-rw-r--r--src/glm/gtx/matrix_operation.hpp93
-rw-r--r--src/glm/gtx/matrix_operation.inl129
-rw-r--r--src/glm/gtx/matrix_query.hpp95
-rw-r--r--src/glm/gtx/matrix_query.inl144
-rw-r--r--src/glm/gtx/mixed_product.hpp46
-rw-r--r--src/glm/gtx/mixed_product.inl36
-rw-r--r--src/glm/gtx/multiple.hpp53
-rw-r--r--src/glm/gtx/multiple.inl191
-rw-r--r--src/glm/gtx/noise.hpp63
-rw-r--r--src/glm/gtx/noise.inl792
-rw-r--r--src/glm/gtx/norm.hpp143
-rw-r--r--src/glm/gtx/norm.inl130
-rw-r--r--src/glm/gtx/normal.hpp47
-rw-r--r--src/glm/gtx/normal.inl27
-rw-r--r--src/glm/gtx/normalize_dot.hpp59
-rw-r--r--src/glm/gtx/normalize_dot.inl120
-rw-r--r--src/glm/gtx/number_precision.hpp69
-rw-r--r--src/glm/gtx/number_precision.inl13
-rw-r--r--src/glm/gtx/ocl_type.hpp110
-rw-r--r--src/glm/gtx/ocl_type.inl0
-rw-r--r--src/glm/gtx/optimum_pow.hpp70
-rw-r--r--src/glm/gtx/optimum_pow.inl63
-rw-r--r--src/glm/gtx/orthonormalize.hpp52
-rw-r--r--src/glm/gtx/orthonormalize.inl49
-rw-r--r--src/glm/gtx/perpendicular.hpp62
-rw-r--r--src/glm/gtx/perpendicular.inl40
-rw-r--r--src/glm/gtx/polar_coordinates.hpp49
-rw-r--r--src/glm/gtx/polar_coordinates.inl42
-rw-r--r--src/glm/gtx/projection.hpp60
-rw-r--r--src/glm/gtx/projection.inl40
-rw-r--r--src/glm/gtx/quaternion.hpp217
-rw-r--r--src/glm/gtx/quaternion.inl303
-rw-r--r--src/glm/gtx/random.hpp89
-rw-r--r--src/glm/gtx/random.inl536
-rw-r--r--src/glm/gtx/raw_data.hpp58
-rw-r--r--src/glm/gtx/raw_data.inl11
-rw-r--r--src/glm/gtx/reciprocal.hpp99
-rw-r--r--src/glm/gtx/reciprocal.inl593
-rw-r--r--src/glm/gtx/rotate_vector.hpp114
-rw-r--r--src/glm/gtx/rotate_vector.inl149
-rw-r--r--src/glm/gtx/simd_mat4.hpp183
-rw-r--r--src/glm/gtx/simd_mat4.inl309
-rw-r--r--src/glm/gtx/simd_vec4.hpp474
-rw-r--r--src/glm/gtx/simd_vec4.inl730
-rw-r--r--src/glm/gtx/simplex.hpp70
-rw-r--r--src/glm/gtx/simplex.inl0
-rw-r--r--src/glm/gtx/spline.hpp73
-rw-r--r--src/glm/gtx/spline.inl74
-rw-r--r--src/glm/gtx/std_based_type.hpp72
-rw-r--r--src/glm/gtx/std_based_type.inl13
-rw-r--r--src/glm/gtx/string_cast.hpp57
-rw-r--r--src/glm/gtx/string_cast.inl597
-rw-r--r--src/glm/gtx/transform.hpp103
-rw-r--r--src/glm/gtx/transform.inl94
-rw-r--r--src/glm/gtx/transform2.hpp118
-rw-r--r--src/glm/gtx/transform2.inl159
-rw-r--r--src/glm/gtx/ulp.hpp70
-rw-r--r--src/glm/gtx/ulp.inl396
-rw-r--r--src/glm/gtx/unsigned_int.hpp59
-rw-r--r--src/glm/gtx/unsigned_int.inl45
-rw-r--r--src/glm/gtx/vec1.hpp121
-rw-r--r--src/glm/gtx/vec1.inl0
-rw-r--r--src/glm/gtx/vector_access.hpp66
-rw-r--r--src/glm/gtx/vector_access.inl58
-rw-r--r--src/glm/gtx/vector_angle.hpp72
-rw-r--r--src/glm/gtx/vector_angle.inl58
-rw-r--r--src/glm/gtx/vector_query.hpp95
-rw-r--r--src/glm/gtx/vector_query.inl174
-rw-r--r--src/glm/gtx/verbose_operator.hpp64
-rw-r--r--src/glm/gtx/verbose_operator.inl129
-rw-r--r--src/glm/gtx/wrap.hpp54
-rw-r--r--src/glm/gtx/wrap.inl173
-rw-r--r--src/glm/virtrev/xstream.hpp148
-rw-r--r--src/graphics/AppleDisplay.cpp75
-rw-r--r--src/graphics/AppleDisplay.h46
-rw-r--r--src/graphics/BCMDisplay.cpp142
-rw-r--r--src/graphics/BCMDisplay.h (renamed from src/graphics/OGLImagingContext.h)43
-rw-r--r--src/graphics/Bitmap.cpp253
-rw-r--r--src/graphics/Bitmap.h17
-rw-r--r--src/graphics/BitmapLoader.cpp156
-rw-r--r--src/graphics/BitmapLoader.h55
-rw-r--r--src/graphics/BmpTextureMover.cpp56
-rw-r--r--src/graphics/BmpTextureMover.h2
-rw-r--r--src/graphics/CGLContext.cpp114
-rw-r--r--src/graphics/CGLContext.h56
-rw-r--r--src/graphics/ContribDefs.h22
-rw-r--r--src/graphics/Display.cpp136
-rw-r--r--src/graphics/Display.h71
-rw-r--r--src/graphics/EGLContext.cpp202
-rw-r--r--src/graphics/EGLContext.h (renamed from src/base/Matrix3x4.h)49
-rw-r--r--src/graphics/FBO.cpp278
-rw-r--r--src/graphics/FBO.h19
-rw-r--r--src/graphics/Filter.cpp2
-rw-r--r--src/graphics/Filter.h2
-rw-r--r--src/graphics/Filter3x3.cpp4
-rw-r--r--src/graphics/Filter3x3.h26
-rw-r--r--src/graphics/FilterBandpass.cpp4
-rw-r--r--src/graphics/FilterBandpass.h4
-rw-r--r--src/graphics/FilterBlur.cpp2
-rw-r--r--src/graphics/FilterBlur.h2
-rw-r--r--src/graphics/FilterConvol.h18
-rw-r--r--src/graphics/FilterDilation.cpp2
-rw-r--r--src/graphics/FilterDilation.h2
-rw-r--r--src/graphics/FilterErosion.cpp2
-rw-r--r--src/graphics/FilterErosion.h2
-rw-r--r--src/graphics/FilterFastBandpass.cpp2
-rw-r--r--src/graphics/FilterFastBandpass.h2
-rw-r--r--src/graphics/FilterFastDownscale.cpp2
-rw-r--r--src/graphics/FilterFastDownscale.h2
-rw-r--r--src/graphics/FilterFloodfill.h4
-rw-r--r--src/graphics/FilterGauss.cpp10
-rw-r--r--src/graphics/FilterGauss.h6
-rw-r--r--src/graphics/FilterGetAlpha.cpp2
-rw-r--r--src/graphics/FilterGetAlpha.h2
-rw-r--r--src/graphics/FilterHighpass.cpp2
-rw-r--r--src/graphics/FilterHighpass.h2
-rw-r--r--src/graphics/FilterIntensity.cpp4
-rw-r--r--src/graphics/FilterIntensity.h6
-rw-r--r--src/graphics/FilterMask.cpp2
-rw-r--r--src/graphics/FilterMask.h2
-rw-r--r--src/graphics/FilterNormalize.cpp4
-rw-r--r--src/graphics/FilterNormalize.h2
-rw-r--r--src/graphics/FilterResizeBilinear.cpp2
-rw-r--r--src/graphics/FilterResizeBilinear.h2
-rw-r--r--src/graphics/FilterResizeGaussian.cpp4
-rw-r--r--src/graphics/FilterResizeGaussian.h6
-rw-r--r--src/graphics/FilterThreshold.cpp2
-rw-r--r--src/graphics/FilterThreshold.h2
-rw-r--r--src/graphics/FilterUnmultiplyAlpha.cpp43
-rw-r--r--src/graphics/FilterUnmultiplyAlpha.h6
-rw-r--r--src/graphics/Filtercolorize.cpp30
-rw-r--r--src/graphics/Filtercolorize.h8
-rw-r--r--src/graphics/Filterfill.h2
-rw-r--r--src/graphics/Filterfillrect.h2
-rw-r--r--src/graphics/Filterflip.cpp2
-rw-r--r--src/graphics/Filterflip.h2
-rw-r--r--src/graphics/FilterflipX.cpp2
-rw-r--r--src/graphics/FilterflipX.h2
-rw-r--r--src/graphics/Filterfliprgb.cpp58
-rw-r--r--src/graphics/Filterfliprgb.h9
-rw-r--r--src/graphics/Filterfliprgba.cpp2
-rw-r--r--src/graphics/Filterfliprgba.h2
-rw-r--r--src/graphics/Filterflipuv.cpp2
-rw-r--r--src/graphics/Filterflipuv.h2
-rw-r--r--src/graphics/Filtergrayscale.cpp2
-rw-r--r--src/graphics/Filtergrayscale.h2
-rw-r--r--src/graphics/GL/glext.h6154
-rw-r--r--src/graphics/GLBufferCache.cpp11
-rw-r--r--src/graphics/GLBufferCache.h6
-rw-r--r--src/graphics/GLConfig.cpp55
-rw-r--r--src/graphics/GLConfig.h18
-rw-r--r--src/graphics/GLContext.cpp677
-rw-r--r--src/graphics/GLContext.h114
-rw-r--r--src/graphics/GLContextAttribs.cpp67
-rw-r--r--src/graphics/GLContextAttribs.h44
-rw-r--r--src/graphics/GLShaderParam.cpp87
-rw-r--r--src/graphics/GLShaderParam.h128
-rw-r--r--src/graphics/GLTexture.cpp130
-rw-r--r--src/graphics/GLTexture.h16
-rw-r--r--src/graphics/GLXContext.cpp265
-rw-r--r--src/graphics/GLXContext.h65
-rw-r--r--src/graphics/GPUBandpassFilter.cpp58
-rw-r--r--src/graphics/GPUBandpassFilter.h17
-rw-r--r--src/graphics/GPUBlurFilter.cpp110
-rw-r--r--src/graphics/GPUBlurFilter.h24
-rw-r--r--src/graphics/GPUBrightnessFilter.cpp42
-rw-r--r--src/graphics/GPUBrightnessFilter.h12
-rw-r--r--src/graphics/GPUChromaKeyFilter.cpp230
-rw-r--r--src/graphics/GPUChromaKeyFilter.h38
-rw-r--r--src/graphics/GPUFilter.cpp307
-rw-r--r--src/graphics/GPUFilter.h36
-rw-r--r--src/graphics/GPUHueSatFilter.cpp87
-rw-r--r--src/graphics/GPUHueSatFilter.h15
-rw-r--r--src/graphics/GPUInvertFilter.cpp38
-rw-r--r--src/graphics/GPUInvertFilter.h10
-rw-r--r--src/graphics/GPUNullFilter.cpp31
-rw-r--r--src/graphics/GPUNullFilter.h5
-rw-r--r--src/graphics/GPURGB2YUVFilter.cpp32
-rw-r--r--src/graphics/GPURGB2YUVFilter.h3
-rw-r--r--src/graphics/GPUShadowFilter.cpp144
-rw-r--r--src/graphics/GPUShadowFilter.h41
-rw-r--r--src/graphics/GraphicsTest.cpp32
-rw-r--r--src/graphics/GraphicsTest.h10
-rw-r--r--src/graphics/HistoryPreProcessor.cpp2
-rw-r--r--src/graphics/HistoryPreProcessor.h2
-rw-r--r--src/graphics/ImagingProjection.cpp62
-rw-r--r--src/graphics/ImagingProjection.h15
-rw-r--r--src/graphics/Makefile.am85
-rw-r--r--src/graphics/Makefile.in560
-rw-r--r--src/graphics/OGLHelper.cpp319
-rw-r--r--src/graphics/OGLHelper.h240
-rw-r--r--src/graphics/OGLImagingContext.cpp105
-rw-r--r--src/graphics/OGLShader.cpp223
-rw-r--r--src/graphics/OGLShader.h69
-rw-r--r--src/graphics/PBO.cpp90
-rw-r--r--src/graphics/PBO.h7
-rw-r--r--src/graphics/Pixel16.h2
-rw-r--r--src/graphics/Pixel24.h2
-rw-r--r--src/graphics/Pixel32.cpp52
-rw-r--r--src/graphics/Pixel32.h7
-rw-r--r--src/graphics/Pixel8.h2
-rw-r--r--src/graphics/PixelFormat.cpp36
-rw-r--r--src/graphics/PixelFormat.h7
-rw-r--r--src/graphics/Pixeldefs.h2
-rw-r--r--src/graphics/ShaderRegistry.cpp133
-rw-r--r--src/graphics/ShaderRegistry.h26
-rw-r--r--src/graphics/StandardShader.cpp216
-rw-r--r--src/graphics/StandardShader.h106
-rw-r--r--src/graphics/SubVertexArray.cpp103
-rw-r--r--src/graphics/SubVertexArray.h75
-rw-r--r--src/graphics/TextureMover.cpp6
-rw-r--r--src/graphics/TextureMover.h4
-rw-r--r--src/graphics/TwoPassScale.h37
-rw-r--r--src/graphics/VertexArray.cpp217
-rw-r--r--src/graphics/VertexArray.h49
-rw-r--r--src/graphics/VertexData.cpp253
-rw-r--r--src/graphics/VertexData.h100
-rw-r--r--src/graphics/X11Display.cpp124
-rw-r--r--src/graphics/X11Display.h59
-rw-r--r--src/graphics/baseline/ChromaKeyMedianResult.pngbin622 -> 607 bytes
-rw-r--r--src/graphics/baseline/ResizeBilinearResultB8G8R8.pngbin0 -> 876 bytes
-rw-r--r--src/graphics/baseline/blur05_flat.pngbin1161 -> 1312 bytes
-rw-r--r--src/graphics/baseline/blur_rgb24-64x64.pngbin3649 -> 3659 bytes
-rw-r--r--src/graphics/baseline/invert_rgb24-64x64.pngbin0 -> 2393 bytes
-rw-r--r--src/graphics/benchmarkgraphics.cpp8
-rw-r--r--src/graphics/shaders/Makefile.am3
-rw-r--r--src/graphics/shaders/Makefile.in492
-rw-r--r--src/graphics/shaders/bandpass.frag (renamed from src/video/IDemuxer.h)38
-rw-r--r--src/graphics/shaders/brightness.frag (renamed from src/video/AVCCOpaque.cpp)35
-rw-r--r--src/graphics/shaders/chromakey.frag134
-rw-r--r--src/graphics/shaders/chromakey_erosion.frag47
-rw-r--r--src/graphics/shaders/helper.frag109
-rw-r--r--src/graphics/shaders/horizblur.frag43
-rw-r--r--src/graphics/shaders/horizshadow.frag44
-rw-r--r--src/graphics/shaders/huesat.frag72
-rw-r--r--src/graphics/shaders/invert.frag41
-rw-r--r--src/graphics/shaders/minimal.frag (renamed from src/video/AVCCOpaque.h)32
-rw-r--r--src/graphics/shaders/null.frag (renamed from src/video/FrameAge.h)22
-rw-r--r--src/graphics/shaders/rgb2yuv.frag38
-rw-r--r--src/graphics/shaders/standard.frag101
-rw-r--r--src/graphics/shaders/standard.vert (renamed from src/video/FrameAge.cpp)20
-rw-r--r--src/graphics/shaders/vertblur.frag42
-rw-r--r--src/graphics/shaders/vertshadow.frag54
-rw-r--r--src/graphics/testgpu.cpp468
-rw-r--r--src/graphics/testgraphics.cpp74
-rw-r--r--src/imaging/Blob.cpp64
-rw-r--r--src/imaging/Blob.h46
-rw-r--r--src/imaging/CMUCamera.cpp177
-rw-r--r--src/imaging/CMUCamera.h17
-rw-r--r--src/imaging/CMUCameraUtils.cpp170
-rw-r--r--src/imaging/CMUCameraUtils.h8
-rw-r--r--src/imaging/Camera.cpp95
-rw-r--r--src/imaging/Camera.h27
-rw-r--r--src/imaging/CameraInfo.cpp159
-rw-r--r--src/imaging/CameraInfo.h100
-rw-r--r--src/imaging/CoordTransformer.cpp2
-rw-r--r--src/imaging/CoordTransformer.h8
-rw-r--r--src/imaging/DSCamera.cpp298
-rw-r--r--src/imaging/DSCamera.h19
-rw-r--r--src/imaging/DSHelper.cpp60
-rw-r--r--src/imaging/DSHelper.h5
-rw-r--r--[-rwxr-xr-x]src/imaging/DSSampleGrabber.cpp2
-rw-r--r--[-rwxr-xr-x]src/imaging/DSSampleGrabber.h2
-rw-r--r--src/imaging/DeDistort.cpp104
-rw-r--r--src/imaging/DeDistort.h42
-rw-r--r--src/imaging/FWCamera.cpp259
-rw-r--r--src/imaging/FWCamera.h25
-rw-r--r--src/imaging/FWCameraUtils.cpp191
-rw-r--r--src/imaging/FWCameraUtils.h10
-rw-r--r--src/imaging/FakeCamera.cpp25
-rw-r--r--src/imaging/FakeCamera.h5
-rw-r--r--src/imaging/FilterClearBorder.cpp2
-rw-r--r--src/imaging/FilterClearBorder.h4
-rw-r--r--src/imaging/FilterDistortion.cpp4
-rw-r--r--src/imaging/FilterDistortion.h4
-rw-r--r--src/imaging/FilterWipeBorder.cpp2
-rw-r--r--src/imaging/FilterWipeBorder.h3
-rw-r--r--src/imaging/Makefile.am20
-rw-r--r--src/imaging/Makefile.in153
-rw-r--r--src/imaging/Run.cpp4
-rw-r--r--src/imaging/Run.h6
-rw-r--r--src/imaging/TrackerConfig.cpp53
-rw-r--r--src/imaging/TrackerConfig.h9
-rw-r--r--src/imaging/TrackerThread.cpp72
-rw-r--r--src/imaging/TrackerThread.h8
-rw-r--r--src/imaging/V4LCamera.cpp397
-rw-r--r--src/imaging/V4LCamera.h54
-rw-r--r--src/imaging/checktracking.cpp101
-rw-r--r--src/imaging/testimaging.cpp101
-rw-r--r--src/imaging/trackerconfigdtd.cpp2
-rw-r--r--src/imaging/trackerconfigdtd.h2
-rw-r--r--src/lmfit/Makefile.am7
-rw-r--r--src/lmfit/Makefile.in83
-rw-r--r--src/oscpack/Makefile.am1
-rw-r--r--src/oscpack/Makefile.in87
-rw-r--r--src/parport/Makefile.am6
-rw-r--r--src/parport/ParPort.cpp234
-rw-r--r--src/parport/ParPort.h80
-rw-r--r--src/player/AVGNode.cpp15
-rw-r--r--src/player/AVGNode.h4
-rw-r--r--src/player/AppleTrackpadInputDevice.cpp28
-rw-r--r--src/player/AreaNode.cpp193
-rw-r--r--src/player/AreaNode.h78
-rw-r--r--src/player/Arg.cpp19
-rw-r--r--src/player/Arg.h27
-rw-r--r--src/player/ArgBase.cpp2
-rw-r--r--src/player/ArgBase.h6
-rw-r--r--src/player/ArgList.cpp154
-rw-r--r--src/player/ArgList.h12
-rw-r--r--src/player/BitmapManager.cpp (renamed from src/graphics/BitmapManager.cpp)92
-rw-r--r--src/player/BitmapManager.h (renamed from src/graphics/BitmapManager.h)17
-rw-r--r--src/player/BitmapManagerMsg.cpp (renamed from src/graphics/BitmapManagerMsg.cpp)56
-rw-r--r--src/player/BitmapManagerMsg.h (renamed from src/graphics/BitmapManagerMsg.h)22
-rw-r--r--src/player/BitmapManagerThread.cpp (renamed from src/graphics/BitmapManagerThread.cpp)39
-rw-r--r--src/player/BitmapManagerThread.h (renamed from src/graphics/BitmapManagerThread.h)8
-rw-r--r--src/player/BlurFXNode.cpp22
-rw-r--r--src/player/BlurFXNode.h11
-rw-r--r--src/player/BoostPython.h4
-rw-r--r--src/player/CameraNode.cpp48
-rw-r--r--src/player/CameraNode.h17
-rw-r--r--src/player/Canvas.cpp141
-rw-r--r--src/player/Canvas.h38
-rw-r--r--src/player/CanvasNode.cpp13
-rw-r--r--src/player/CanvasNode.h5
-rw-r--r--src/player/ChromaKeyFXNode.cpp27
-rw-r--r--src/player/ChromaKeyFXNode.h32
-rw-r--r--src/player/CircleNode.cpp230
-rw-r--r--src/player/CircleNode.h50
-rw-r--r--src/player/Contact.cpp88
-rw-r--r--src/player/Contact.h25
-rw-r--r--src/player/CursorEvent.cpp21
-rw-r--r--src/player/CursorEvent.h16
-rw-r--r--src/player/CursorState.cpp8
-rw-r--r--src/player/CursorState.h12
-rw-r--r--src/player/CurveNode.cpp101
-rw-r--r--src/player/CurveNode.h54
-rw-r--r--src/player/DisplayEngine.cpp68
-rw-r--r--src/player/DisplayEngine.h18
-rw-r--r--src/player/DisplayParams.cpp16
-rw-r--r--src/player/DisplayParams.h9
-rw-r--r--src/player/DivNode.cpp133
-rw-r--r--src/player/DivNode.h25
-rw-r--r--src/player/Event.cpp38
-rw-r--r--src/player/Event.h20
-rw-r--r--src/player/EventDispatcher.cpp59
-rw-r--r--src/player/EventDispatcher.h7
-rw-r--r--src/player/ExportedObject.cpp105
-rw-r--r--src/player/ExportedObject.h73
-rw-r--r--src/player/FXNode.cpp17
-rw-r--r--src/player/FXNode.h8
-rw-r--r--src/player/FilledVectorNode.cpp75
-rw-r--r--src/player/FilledVectorNode.h42
-rw-r--r--src/player/FontStyle.cpp315
-rw-r--r--src/player/FontStyle.h114
-rw-r--r--src/player/HueSatFXNode.cpp34
-rw-r--r--src/player/HueSatFXNode.h7
-rw-r--r--src/player/IBitmapLoadedListener.h (renamed from src/graphics/FilterId.h)30
-rw-r--r--src/player/IInputDevice.h2
-rw-r--r--src/player/Image.cpp65
-rw-r--r--src/player/Image.h5
-rw-r--r--src/player/ImageNode.cpp49
-rw-r--r--src/player/ImageNode.h11
-rw-r--r--src/player/InvertFXNode.cpp15
-rw-r--r--src/player/InvertFXNode.h2
-rw-r--r--src/player/KeyEvent.cpp6
-rw-r--r--src/player/KeyEvent.h2
-rw-r--r--src/player/LibMTDevInputDevice.cpp19
-rw-r--r--src/player/LibMTDevInputDevice.h2
-rw-r--r--src/player/LineNode.cpp39
-rw-r--r--src/player/LineNode.h30
-rw-r--r--src/player/MainCanvas.cpp15
-rw-r--r--src/player/MainCanvas.h4
-rw-r--r--src/player/Makefile.am71
-rw-r--r--src/player/Makefile.in307
-rw-r--r--src/player/MaterialInfo.cpp2
-rw-r--r--src/player/MaterialInfo.h4
-rw-r--r--src/player/MeshNode.cpp74
-rw-r--r--src/player/MeshNode.h37
-rw-r--r--src/player/MessageID.cpp62
-rw-r--r--src/player/MessageID.h (renamed from src/video/PacketVideoMsg.cpp)41
-rw-r--r--src/player/MouseEvent.cpp6
-rw-r--r--src/player/MouseEvent.h4
-rw-r--r--src/player/MultitouchInputDevice.cpp32
-rw-r--r--src/player/MultitouchInputDevice.h13
-rw-r--r--src/player/Node.cpp255
-rw-r--r--src/player/Node.h93
-rw-r--r--src/player/NodeRegistry.cpp126
-rw-r--r--src/player/NullFXNode.cpp3
-rw-r--r--src/player/NullFXNode.h2
-rw-r--r--src/player/OGLSurface.cpp281
-rw-r--r--src/player/OGLSurface.h33
-rw-r--r--src/player/OffscreenCanvas.cpp75
-rw-r--r--src/player/OffscreenCanvas.h11
-rw-r--r--src/player/OffscreenCanvasNode.cpp11
-rw-r--r--src/player/OffscreenCanvasNode.h4
-rw-r--r--src/player/PanoImageNode.cpp351
-rw-r--r--src/player/PanoImageNode.h95
-rw-r--r--src/player/Player.cpp959
-rw-r--r--src/player/Player.h106
-rw-r--r--src/player/PluginManager.cpp28
-rw-r--r--src/player/PluginManager.h4
-rw-r--r--src/player/PolyLineNode.cpp38
-rw-r--r--src/player/PolyLineNode.h22
-rw-r--r--src/player/PolygonNode.cpp105
-rw-r--r--src/player/PolygonNode.h32
-rw-r--r--src/player/Publisher.cpp248
-rw-r--r--src/player/Publisher.h113
-rw-r--r--src/player/PublisherDefinition.cpp90
-rw-r--r--src/player/PublisherDefinition.h62
-rw-r--r--src/player/PublisherDefinitionRegistry.cpp90
-rw-r--r--src/player/PublisherDefinitionRegistry.h (renamed from src/base/Triple.h)61
-rw-r--r--src/player/PythonLogSink.cpp90
-rw-r--r--src/player/PythonLogSink.h (renamed from src/base/CmdLine.h)38
-rw-r--r--src/player/RasterNode.cpp315
-rw-r--r--src/player/RasterNode.h78
-rw-r--r--src/player/RectNode.cpp137
-rw-r--r--src/player/RectNode.h34
-rw-r--r--src/player/SDLDisplayEngine.cpp577
-rw-r--r--src/player/SDLDisplayEngine.h45
-rw-r--r--src/player/SVG.cpp62
-rw-r--r--src/player/SVG.h21
-rw-r--r--src/player/SVGElement.cpp23
-rw-r--r--src/player/SVGElement.h12
-rw-r--r--src/player/ShadowFXNode.cpp47
-rw-r--r--src/player/ShadowFXNode.h26
-rw-r--r--src/player/Shape.cpp50
-rw-r--r--src/player/Shape.h14
-rw-r--r--src/player/SoundNode.cpp113
-rw-r--r--src/player/SoundNode.h22
-rw-r--r--src/player/SubscriberInfo.cpp85
-rw-r--r--src/player/SubscriberInfo.h58
-rw-r--r--src/player/TUIOInputDevice.cpp44
-rw-r--r--src/player/TUIOInputDevice.h4
-rw-r--r--src/player/TestHelper.cpp21
-rw-r--r--src/player/TestHelper.h6
-rw-r--r--src/player/TextEngine.cpp40
-rw-r--r--src/player/TextEngine.h2
-rw-r--r--src/player/Timeout.cpp20
-rw-r--r--src/player/Timeout.h10
-rw-r--r--src/player/TouchEvent.cpp44
-rw-r--r--src/player/TouchEvent.h40
-rw-r--r--src/player/TouchStatus.cpp6
-rw-r--r--src/player/TouchStatus.h4
-rw-r--r--src/player/TrackerCalibrator.cpp29
-rw-r--r--src/player/TrackerCalibrator.h12
-rw-r--r--src/player/TrackerInputDevice.cpp66
-rw-r--r--src/player/TrackerInputDevice.h10
-rw-r--r--src/player/TrackerTouchStatus.cpp22
-rw-r--r--src/player/TrackerTouchStatus.h12
-rw-r--r--src/player/TypeDefinition.cpp (renamed from src/player/NodeDefinition.cpp)50
-rw-r--r--src/player/TypeDefinition.h (renamed from src/player/NodeDefinition.h)41
-rw-r--r--src/player/TypeRegistry.cpp159
-rw-r--r--src/player/TypeRegistry.h (renamed from src/player/NodeRegistry.h)33
-rw-r--r--src/player/VectorNode.cpp229
-rw-r--r--src/player/VectorNode.h47
-rw-r--r--src/player/VersionInfo.cpp72
-rw-r--r--src/player/VersionInfo.h (renamed from src/audio/IAudioSource.h)31
-rw-r--r--src/player/VideoNode.cpp240
-rw-r--r--src/player/VideoNode.h33
-rw-r--r--src/player/VideoWriter.cpp45
-rw-r--r--src/player/VideoWriter.h9
-rw-r--r--src/player/VideoWriterThread.cpp52
-rw-r--r--src/player/VideoWriterThread.h8
-rw-r--r--src/player/WordsNode.cpp523
-rw-r--r--src/player/WordsNode.h72
-rw-r--r--src/player/WrapPython.cpp72
-rw-r--r--src/player/WrapPython.h23
-rw-r--r--src/player/XInputMTInputDevice.cpp26
-rw-r--r--src/player/XInputMTInputDevice.h7
-rw-r--r--src/player/testcalibrator.cpp39
-rw-r--r--src/player/testplayer.cpp19
-rw-r--r--src/python/Makefile.am12
-rw-r--r--src/python/Makefile.in88
-rw-r--r--src/python/__init__.py22
-rw-r--r--src/python/anim.py487
-rw-r--r--src/python/app/Makefile.am3
-rw-r--r--src/python/app/Makefile.in (renamed from src/python/ui/Makefile.in)122
-rw-r--r--src/python/app/__init__.py29
-rw-r--r--src/python/app/app.py385
-rw-r--r--src/python/app/debugpanel.py697
-rw-r--r--src/python/app/flashmessage.py98
-rw-r--r--src/python/app/keyboardmanager.py204
-rw-r--r--src/python/app/settings.py277
-rw-r--r--src/python/app/touchvisualization.py188
-rw-r--r--src/python/apphelpers.py158
-rw-r--r--src/python/appstarter.py161
-rw-r--r--src/python/avgapp.py (renamed from src/python/app.py)44
-rw-r--r--src/python/camcalibrator.py117
-rw-r--r--src/python/clusteredEventList.py257
-rw-r--r--src/python/coordcalibrator.py45
-rw-r--r--src/python/data/Makefile.am6
-rw-r--r--src/python/data/Makefile.in66
-rw-r--r--src/python/data/SimpleSkin.xml83
-rw-r--r--src/python/data/button_bg_down.pngbin0 -> 4089 bytes
-rw-r--r--src/python/data/button_bg_up.pngbin0 -> 3995 bytes
-rw-r--r--src/python/data/camcalibrator.avg27
-rw-r--r--src/python/data/checkbox_checked_disabled.pngbin0 -> 2908 bytes
-rw-r--r--src/python/data/checkbox_checked_down.pngbin0 -> 2902 bytes
-rw-r--r--src/python/data/checkbox_checked_up.pngbin0 -> 2902 bytes
-rw-r--r--src/python/data/checkbox_unchecked_disabled.pngbin0 -> 2856 bytes
-rw-r--r--src/python/data/checkbox_unchecked_down.pngbin0 -> 2849 bytes
-rw-r--r--src/python/data/checkbox_unchecked_up.pngbin0 -> 2849 bytes
-rw-r--r--src/python/data/mpeg1-48x48-sound.avi (renamed from src/video/testfiles/mpeg1-48x48-sound.avi)bin28534 -> 28534 bytes
-rw-r--r--src/python/data/mpeg1-48x48.movbin0 -> 9863 bytes
-rw-r--r--src/python/data/pause_button_down.pngbin0 -> 2826 bytes
-rw-r--r--src/python/data/pause_button_up.pngbin0 -> 2825 bytes
-rw-r--r--src/python/data/play_button_down.pngbin0 -> 2927 bytes
-rw-r--r--src/python/data/play_button_up.pngbin0 -> 2928 bytes
-rw-r--r--src/python/data/rgb24alpha-64x64.png (renamed from src/graphics/testfiles/rgb24alpha-64x64.png)bin3392 -> 3392 bytes
-rw-r--r--src/python/data/scrollarea_border.pngbin0 -> 3262 bytes
-rw-r--r--src/python/data/scrollbar_horiz_thumb_down.pngbin0 -> 2990 bytes
-rw-r--r--src/python/data/scrollbar_horiz_thumb_up.pngbin0 -> 2977 bytes
-rw-r--r--src/python/data/scrollbar_horiz_track.pngbin0 -> 2874 bytes
-rw-r--r--src/python/data/scrollbar_horiz_track_disabled.pngbin0 -> 2873 bytes
-rw-r--r--src/python/data/scrollbar_vert_thumb_down.pngbin0 -> 3008 bytes
-rw-r--r--src/python/data/scrollbar_vert_thumb_up.pngbin0 -> 2998 bytes
-rw-r--r--src/python/data/scrollbar_vert_track.pngbin0 -> 2903 bytes
-rw-r--r--src/python/data/scrollbar_vert_track_disabled.pngbin0 -> 2902 bytes
-rw-r--r--src/python/data/skin.xsd137
-rw-r--r--src/python/data/slider_horiz_track.pngbin0 -> 2858 bytes
-rw-r--r--src/python/data/slider_horiz_track_disabled.pngbin0 -> 2859 bytes
-rw-r--r--src/python/data/slider_thumb_down.pngbin0 -> 3200 bytes
-rw-r--r--src/python/data/slider_thumb_up.pngbin0 -> 3225 bytes
-rw-r--r--src/python/data/slider_vert_track.pngbin0 -> 2867 bytes
-rw-r--r--src/python/data/slider_vert_track_disabled.pngbin0 -> 2866 bytes
-rw-r--r--src/python/draggable.py107
-rw-r--r--src/python/enumcompat.py37
-rw-r--r--src/python/eventList.py174
-rw-r--r--src/python/filter.py95
-rw-r--r--src/python/gameapp.py327
-rw-r--r--src/python/geom.py32
-rw-r--r--src/python/gesture.py1000
-rw-r--r--src/python/grabbable.py320
-rw-r--r--src/python/graph.py264
-rw-r--r--src/python/mathutil.py2
-rw-r--r--src/python/methodref.py69
-rw-r--r--src/python/mtemu.py180
-rw-r--r--src/python/parsecamargs.py10
-rw-r--r--src/python/persist.py157
-rw-r--r--src/python/statemachine.py71
-rw-r--r--src/python/textarea.py458
-rw-r--r--src/python/trackerhelper.py58
-rw-r--r--src/python/ui/Makefile.am2
-rwxr-xr-xsrc/python/ui/__init__.py4
-rw-r--r--src/python/ui/button.py364
-rw-r--r--src/python/ui/gesture.py746
-rw-r--r--src/python/ui/helper.py61
-rw-r--r--src/python/ui/keyboard.py243
-rw-r--r--src/python/utils.py52
-rw-r--r--src/python/widget/Makefile.am3
-rw-r--r--src/python/widget/Makefile.in512
-rw-r--r--src/python/widget/__init__.py7
-rw-r--r--src/python/widget/base.py267
-rw-r--r--src/python/widget/button.py443
-rw-r--r--src/python/widget/keyboard.py302
-rw-r--r--src/python/widget/mediacontrol.py161
-rw-r--r--src/python/widget/scrollarea.py240
-rw-r--r--src/python/widget/skin.py161
-rw-r--r--src/python/widget/slider.py371
-rw-r--r--src/samples/Makefile.am1
-rw-r--r--src/samples/Makefile.in361
-rwxr-xr-xsrc/samples/abort_gestures.py114
-rwxr-xr-xsrc/samples/anim1.py6
-rwxr-xr-xsrc/samples/anim2.py6
-rwxr-xr-xsrc/samples/app_complete.py58
-rwxr-xr-xsrc/samples/app_minimal.py17
-rwxr-xr-xsrc/samples/asyncload.py33
-rwxr-xr-xsrc/samples/attributes.py9
-rw-r--r--src/samples/canvas.avg6
-rwxr-xr-xsrc/samples/canvas.py19
-rwxr-xr-xsrc/samples/drag.py15
-rwxr-xr-xsrc/samples/event1.py17
-rw-r--r--src/samples/event2.avg6
-rwxr-xr-xsrc/samples/event2.py15
-rwxr-xr-xsrc/samples/event3.py31
-rw-r--r--src/samples/firebirds/Makefile.am3
-rw-r--r--src/samples/firebirds/Makefile.in713
-rwxr-xr-xsrc/samples/firebirds/firebirds.py469
-rw-r--r--src/samples/firebirds/media/Fire_Birds.mp3bin0 -> 1824809 bytes
-rw-r--r--src/samples/firebirds/media/Makefile.am5
-rw-r--r--src/samples/firebirds/media/Makefile.in496
-rw-r--r--src/samples/firebirds/media/bullet.gifbin0 -> 188 bytes
-rw-r--r--src/samples/firebirds/media/bullet.movbin0 -> 37232 bytes
-rw-r--r--src/samples/firebirds/media/bulletSound.mp3bin0 -> 20062 bytes
-rw-r--r--src/samples/firebirds/media/enemy.gifbin0 -> 1123 bytes
-rw-r--r--src/samples/firebirds/media/enemy.movbin0 -> 603181 bytes
-rw-r--r--src/samples/firebirds/media/enemyDeath.mp3bin0 -> 63529 bytes
-rw-r--r--src/samples/firebirds/media/explosion.movbin0 -> 2218276 bytes
-rw-r--r--src/samples/firebirds/media/flySound.mp3bin0 -> 193097 bytes
-rw-r--r--src/samples/firebirds/media/ground.jpgbin0 -> 262162 bytes
-rw-r--r--src/samples/firebirds/media/gui_frame.pngbin0 -> 124453 bytes
-rw-r--r--src/samples/firebirds/media/gui_heatbar_bg.pngbin0 -> 12626 bytes
-rw-r--r--src/samples/firebirds/media/gui_heatbar_fg.pngbin0 -> 13937 bytes
-rw-r--r--src/samples/firebirds/media/gui_lives_bg.pngbin0 -> 3679 bytes
-rw-r--r--src/samples/firebirds/media/gui_lives_fg.pngbin0 -> 4655 bytes
-rw-r--r--src/samples/firebirds/media/gui_numbers.pngbin0 -> 12640 bytes
-rw-r--r--src/samples/firebirds/media/spitfire.gifbin0 -> 1109 bytes
-rw-r--r--src/samples/firebirds/media/spitfire.movbin0 -> 612657 bytes
-rw-r--r--src/samples/firebirds/plugin/CollisionDetector.cpp122
-rw-r--r--src/samples/firebirds/plugin/CollisionDetector.h28
-rw-r--r--src/samples/firebirds/plugin/Makefile.am16
-rw-r--r--src/samples/firebirds/plugin/Makefile.in (renamed from src/parport/Makefile.in)206
-rw-r--r--src/samples/flashmessages.py58
-rwxr-xr-xsrc/samples/fontstyle.py23
-rwxr-xr-xsrc/samples/gestures.py169
-rw-r--r--src/samples/globalcoords.avg4
-rwxr-xr-xsrc/samples/globalcoords.py9
-rwxr-xr-xsrc/samples/gpuhuefx.py77
-rwxr-xr-x[-rw-r--r--]src/samples/invertfx.py23
-rw-r--r--src/samples/localcoords.avg7
-rwxr-xr-xsrc/samples/localcoords.py10
-rw-r--r--src/samples/localcoordsrot.avg7
-rwxr-xr-xsrc/samples/localcoordsrot.py11
-rwxr-xr-xsrc/samples/logsample.py55
-rwxr-xr-xsrc/samples/mesh.py15
-rwxr-xr-xsrc/samples/minimal.py7
-rwxr-xr-xsrc/samples/plugin.py16
-rw-r--r--src/samples/rotcustompivot.avg5
-rwxr-xr-xsrc/samples/rotcustompivot.py11
-rw-r--r--src/samples/rotdefaultpivot.avg5
-rwxr-xr-xsrc/samples/rotdefaultpivot.py11
-rwxr-xr-xsrc/samples/sampleapp.py29
-rwxr-xr-xsrc/samples/showvideo.py12
-rwxr-xr-xsrc/samples/slideshow.py159
-rwxr-xr-xsrc/samples/subclass.py40
-rw-r--r--src/samples/text.avg4
-rwxr-xr-xsrc/samples/timer.py10
-rwxr-xr-xsrc/samples/timer2.py13
-rwxr-xr-xsrc/samples/timer3.py14
-rwxr-xr-xsrc/samples/twovideos.py57
-rwxr-xr-xsrc/samples/video.py8
-rwxr-xr-xsrc/samples/videochooser.py71
-rwxr-xr-xsrc/samples/widget.py77
-rw-r--r--src/samples/words1.avg6
-rw-r--r--src/samples/words2.avg7
-rw-r--r--src/samples/wordspos.avg11
-rwxr-xr-xsrc/samples/wordspos.py15
-rw-r--r--src/test/AVGAppTest.py45
-rw-r--r--src/test/AVTest.py403
-rw-r--r--src/test/AnimTest.py188
-rw-r--r--src/test/AppTest.py314
-rw-r--r--src/test/DynamicsTest.py205
-rw-r--r--src/test/EventTest.py803
-rw-r--r--src/test/FXTest.py331
-rw-r--r--src/test/GestureTest.py1048
-rw-r--r--src/test/ImageTest.py271
-rw-r--r--src/test/InputDeviceTest.py107
-rw-r--r--src/test/LoggerTest.py96
-rw-r--r--src/test/Makefile.am6
-rw-r--r--src/test/Makefile.in93
-rw-r--r--src/test/OffscreenTest.py216
-rw-r--r--src/test/PlayerTest.py514
-rw-r--r--src/test/PluginTest.py37
-rw-r--r--src/test/PythonTest.py370
-rwxr-xr-xsrc/test/Test.py34
-rw-r--r--src/test/UITest.py1370
-rw-r--r--src/test/VectorTest.py276
-rw-r--r--src/test/WidgetTest.py900
-rw-r--r--src/test/WordsTest.py244
-rw-r--r--src/test/baseline/testBitmap2.pngbin0 -> 2816 bytes
-rw-r--r--src/test/baseline/testBitmap3.pngbin0 -> 2918 bytes
-rw-r--r--src/test/baseline/testBitmap4.pngbin0 -> 3666 bytes
-rw-r--r--src/test/baseline/testCanvasNullFX3.pngbin0 -> 1042 bytes
-rw-r--r--src/test/baseline/testChromaKeyFX1.pngbin0 -> 2428 bytes
-rw-r--r--src/test/baseline/testChromaKeyFX2.pngbin0 -> 2230 bytes
-rw-r--r--src/test/baseline/testChromaKeyFX3.pngbin0 -> 2309 bytes
-rw-r--r--src/test/baseline/testChromaKeyFX4.pngbin0 -> 2186 bytes
-rw-r--r--src/test/baseline/testFontStyle1.pngbin0 -> 1971 bytes
-rw-r--r--src/test/baseline/testFontStyle2.pngbin0 -> 2566 bytes
-rw-r--r--src/test/baseline/testHVStretchNode1.pngbin0 -> 339 bytes
-rw-r--r--src/test/baseline/testHVStretchNode2.pngbin0 -> 409 bytes
-rw-r--r--src/test/baseline/testImgWarp2.pngbin0 -> 2522 bytes
-rw-r--r--src/test/baseline/testMediaControl1.pngbin0 -> 1041 bytes
-rw-r--r--src/test/baseline/testMediaControl2.pngbin0 -> 1032 bytes
-rw-r--r--src/test/baseline/testMediaControl3.pngbin0 -> 1202 bytes
-rw-r--r--src/test/baseline/testMediaControl4.pngbin0 -> 1108 bytes
-rw-r--r--src/test/baseline/testMediaControl5.pngbin0 -> 930 bytes
-rw-r--r--src/test/baseline/testMesh7.pngbin0 -> 1481 bytes
-rw-r--r--src/test/baseline/testMesh8.pngbin0 -> 1870 bytes
-rw-r--r--src/test/baseline/testMipmap.pngbin506 -> 371 bytes
-rw-r--r--src/test/baseline/testOpacity.pngbin0 -> 2457 bytes
-rw-r--r--src/test/baseline/testOutlines.pngbin3149 -> 3282 bytes
-rw-r--r--src/test/baseline/testPolygon7.pngbin0 -> 567 bytes
-rw-r--r--src/test/baseline/testPolygon8.pngbin0 -> 547 bytes
-rw-r--r--src/test/baseline/testPolygon9.pngbin0 -> 579 bytes
-rw-r--r--src/test/baseline/testPolygonHole1.pngbin0 -> 637 bytes
-rw-r--r--src/test/baseline/testPolygonHole2.pngbin0 -> 727 bytes
-rw-r--r--src/test/baseline/testProgressBar1.pngbin0 -> 318 bytes
-rw-r--r--src/test/baseline/testProgressBar2.pngbin0 -> 321 bytes
-rw-r--r--src/test/baseline/testProgressBar3.pngbin0 -> 303 bytes
-rw-r--r--src/test/baseline/testScrollArea1.pngbin0 -> 741 bytes
-rw-r--r--src/test/baseline/testScrollArea2.pngbin0 -> 857 bytes
-rw-r--r--src/test/baseline/testScrollArea3.pngbin0 -> 745 bytes
-rw-r--r--src/test/baseline/testScrollBarHoriz1.pngbin0 -> 313 bytes
-rw-r--r--src/test/baseline/testScrollBarHoriz10.pngbin0 -> 319 bytes
-rw-r--r--src/test/baseline/testScrollBarHoriz11.pngbin0 -> 322 bytes
-rw-r--r--src/test/baseline/testScrollBarHoriz12.pngbin0 -> 314 bytes
-rw-r--r--src/test/baseline/testScrollBarHoriz2.pngbin0 -> 318 bytes
-rw-r--r--src/test/baseline/testScrollBarHoriz3.pngbin0 -> 315 bytes
-rw-r--r--src/test/baseline/testScrollBarHoriz4.pngbin0 -> 301 bytes
-rw-r--r--src/test/baseline/testScrollBarHoriz5.pngbin0 -> 327 bytes
-rw-r--r--src/test/baseline/testScrollBarHoriz6.pngbin0 -> 297 bytes
-rw-r--r--src/test/baseline/testScrollBarHoriz7.pngbin0 -> 331 bytes
-rw-r--r--src/test/baseline/testScrollBarHoriz8.pngbin0 -> 326 bytes
-rw-r--r--src/test/baseline/testScrollBarHoriz9.pngbin0 -> 331 bytes
-rw-r--r--src/test/baseline/testScrollBarVert1.pngbin0 -> 521 bytes
-rw-r--r--src/test/baseline/testScrollBarVert2.pngbin0 -> 523 bytes
-rw-r--r--src/test/baseline/testScrollBarVert3.pngbin0 -> 537 bytes
-rw-r--r--src/test/baseline/testScrollBarVert4.pngbin0 -> 520 bytes
-rw-r--r--src/test/baseline/testScrollBarVert5.pngbin0 -> 555 bytes
-rw-r--r--src/test/baseline/testScrollBarVert6.pngbin0 -> 500 bytes
-rw-r--r--src/test/baseline/testScrollBarVert7.pngbin0 -> 517 bytes
-rw-r--r--src/test/baseline/testScrollBarVert8.pngbin0 -> 539 bytes
-rw-r--r--src/test/baseline/testScrollBarVert9.pngbin0 -> 525 bytes
-rw-r--r--src/test/baseline/testScrollPane4.pngbin1012 -> 0 bytes
-rw-r--r--src/test/baseline/testSeekAfterEOF.pngbin0 -> 4114 bytes
-rw-r--r--src/test/baseline/testSliderHoriz1.pngbin0 -> 412 bytes
-rw-r--r--src/test/baseline/testSliderHoriz2.pngbin0 -> 424 bytes
-rw-r--r--src/test/baseline/testSliderHoriz3.pngbin0 -> 431 bytes
-rw-r--r--src/test/baseline/testSliderHoriz4.pngbin0 -> 390 bytes
-rw-r--r--src/test/baseline/testSliderHoriz5.pngbin0 -> 381 bytes
-rw-r--r--src/test/baseline/testSliderVert1.pngbin0 -> 578 bytes
-rw-r--r--src/test/baseline/testSliderVert2.pngbin0 -> 581 bytes
-rw-r--r--src/test/baseline/testSliderVert3.pngbin0 -> 578 bytes
-rw-r--r--src/test/baseline/testSliderVert4.pngbin0 -> 504 bytes
-rw-r--r--src/test/baseline/testSliderVert5.pngbin0 -> 502 bytes
-rw-r--r--src/test/baseline/testStretchNodeHoriz1.pngbin0 -> 1098 bytes
-rw-r--r--src/test/baseline/testStretchNodeHoriz2.pngbin0 -> 1118 bytes
-rw-r--r--src/test/baseline/testStretchNodeVert1.pngbin0 -> 1091 bytes
-rw-r--r--src/test/baseline/testStretchNodeVert2.pngbin0 -> 1224 bytes
-rw-r--r--src/test/baseline/testTextArea1.pngbin2681 -> 2792 bytes
-rw-r--r--src/test/baseline/testTextArea2.pngbin354 -> 460 bytes
-rw-r--r--src/test/baseline/testTextArea3.pngbin0 -> 511 bytes
-rw-r--r--src/test/baseline/testTextArea4.pngbin0 -> 1056 bytes
-rw-r--r--src/test/baseline/testTextArea5.pngbin0 -> 1100 bytes
-rw-r--r--src/test/baseline/testTextButtonDisabled.pngbin0 -> 1099 bytes
-rw-r--r--src/test/baseline/testTextButtonDown.pngbin0 -> 975 bytes
-rw-r--r--src/test/baseline/testTextButtonDownNewText.pngbin0 -> 1438 bytes
-rw-r--r--src/test/baseline/testTextButtonUp.pngbin0 -> 1099 bytes
-rw-r--r--src/test/baseline/testTextButtonUpNewText.pngbin0 -> 1559 bytes
-rw-r--r--src/test/baseline/testTexturedPolyLine4.pngbin2482 -> 2329 bytes
-rw-r--r--src/test/baseline/testTimeSliderHoriz1.pngbin0 -> 416 bytes
-rw-r--r--src/test/baseline/testTimeSliderHoriz2.pngbin0 -> 501 bytes
-rw-r--r--src/test/baseline/testTimeSliderHoriz3.pngbin0 -> 499 bytes
-rw-r--r--src/test/baseline/testTimeSliderHoriz4.pngbin0 -> 461 bytes
-rw-r--r--src/test/baseline/testTimeSliderHoriz5.pngbin0 -> 461 bytes
-rw-r--r--src/test/baseline/testTimeSliderVert1.pngbin0 -> 570 bytes
-rw-r--r--src/test/baseline/testTimeSliderVert2.pngbin0 -> 674 bytes
-rw-r--r--src/test/baseline/testTimeSliderVert3.pngbin0 -> 665 bytes
-rw-r--r--src/test/baseline/testTimeSliderVert4.pngbin0 -> 591 bytes
-rw-r--r--src/test/baseline/testTimeSliderVert5.pngbin0 -> 591 bytes
-rw-r--r--src/test/baseline/testUICheckBoxChecked_Down.pngbin0 -> 1506 bytes
-rw-r--r--src/test/baseline/testUICheckBoxChecked_Up.pngbin0 -> 1499 bytes
-rw-r--r--src/test/baseline/testUICheckBoxUnchecked_Disabled.pngbin0 -> 1440 bytes
-rw-r--r--src/test/baseline/testUICheckBoxUnchecked_Down.pngbin0 -> 1430 bytes
-rw-r--r--src/test/baseline/testUICheckBoxUnchecked_Up.pngbin0 -> 1471 bytes
-rw-r--r--src/test/baseline/testUIKeyboard.pngbin971 -> 859 bytes
-rw-r--r--src/test/baseline/testUIKeyboard1S.pngbin0 -> 911 bytes
-rw-r--r--src/test/baseline/testUIKeyboardA.pngbin0 -> 878 bytes
-rw-r--r--src/test/baseline/testUIKeyboardA1S.pngbin0 -> 885 bytes
-rw-r--r--src/test/baseline/testUIKeyboardAS.pngbin0 -> 883 bytes
-rw-r--r--src/test/baseline/testUIKeyboardDown11.pngbin0 -> 1979 bytes
-rw-r--r--src/test/baseline/testUIKeyboardDownA1.pngbin1285 -> 0 bytes
-rw-r--r--src/test/baseline/testUIKeyboardDownA111S1.pngbin1530 -> 0 bytes
-rw-r--r--src/test/baseline/testUIKeyboardDownA212S2.pngbin1531 -> 2191 bytes
-rw-r--r--src/test/baseline/testUIKeyboardDownA2S1.pngbin0 -> 1205 bytes
-rw-r--r--src/test/baseline/testUIKeyboardDownS1.pngbin1200 -> 0 bytes
-rw-r--r--src/test/baseline/testUIKeyboardFB.pngbin0 -> 859 bytes
-rw-r--r--src/test/baseline/testUIKeyboardFB1.pngbin0 -> 1616 bytes
-rw-r--r--src/test/baseline/testUIKeyboardFBA1S.pngbin0 -> 1587 bytes
-rw-r--r--src/test/baseline/testUIKeyboardFBAS.pngbin0 -> 2065 bytes
-rw-r--r--src/test/baseline/testUIKeyboardFBS.pngbin0 -> 854 bytes
-rw-r--r--src/test/baseline/testUIKeyboardNoFB1S.pngbin0 -> 910 bytes
-rw-r--r--src/test/baseline/testUIKeyboardS.pngbin0 -> 855 bytes
-rw-r--r--src/test/baseline/testUIToggleChecked_Disabled.pngbin0 -> 1276 bytes
-rw-r--r--src/test/baseline/testUIToggleChecked_Down.pngbin0 -> 1458 bytes
-rw-r--r--src/test/baseline/testUIToggleChecked_Up.pngbin0 -> 1450 bytes
-rw-r--r--src/test/baseline/testUIToggleUnchecked_Disabled.pngbin0 -> 959 bytes
-rw-r--r--src/test/baseline/testUIToggleUnchecked_Down.pngbin0 -> 1113 bytes
-rw-r--r--src/test/baseline/testUIToggleUnchecked_Up.pngbin0 -> 1115 bytes
-rw-r--r--src/test/baseline/testVideo-mpeg1-48x48.mov1.png (renamed from src/test/baseline/testVideo-mpeg1-48x48.mpg1.png)bin10904 -> 10904 bytes
-rw-r--r--src/test/baseline/testVideo-mpeg4-48x48.avi1.pngbin0 -> 10964 bytes
-rw-r--r--src/test/baseline/testWordsGamma1.pngbin0 -> 3194 bytes
-rw-r--r--src/test/baseline/testWordsGamma2.pngbin0 -> 3174 bytes
-rw-r--r--src/test/baseline/testWordsIntensity.pngbin0 -> 2239 bytes
-rw-r--r--src/test/baseline/testWordsMask7.pngbin0 -> 3853 bytes
-rw-r--r--src/test/baseline/testWordsOutlines.pngbin0 -> 1024 bytes
-rw-r--r--src/test/baseline/testplugin1.pngbin356 -> 371 bytes
-rw-r--r--src/test/baseline/testplugin2.pngbin357 -> 375 bytes
-rw-r--r--src/test/camcfgs.py2
-rwxr-xr-xsrc/test/checkcamera.py20
-rwxr-xr-xsrc/test/checkspeed.py105
-rw-r--r--src/test/extrafonts/.svn/entries62
-rw-r--r--src/test/extrafonts/.svn/prop-base/testaddfontdir.ttf.svn-base5
-rw-r--r--src/test/extrafonts/.svn/text-base/testaddfontdir.ttf.svn-basebin1736 -> 0 bytes
-rw-r--r--src/test/fonts/.svn/entries164
-rw-r--r--src/test/fonts/.svn/prop-base/Vera.ttf.svn-base5
-rw-r--r--src/test/fonts/.svn/prop-base/VeraBI.ttf.svn-base5
-rw-r--r--src/test/fonts/.svn/prop-base/VeraBd.ttf.svn-base5
-rw-r--r--src/test/fonts/.svn/prop-base/VeraIt.ttf.svn-base5
-rw-r--r--src/test/fonts/.svn/text-base/Vera.ttf.svn-basebin65932 -> 0 bytes
-rw-r--r--src/test/fonts/.svn/text-base/VeraBI.ttf.svn-basebin63208 -> 0 bytes
-rw-r--r--src/test/fonts/.svn/text-base/VeraBd.ttf.svn-basebin58716 -> 0 bytes
-rw-r--r--src/test/fonts/.svn/text-base/VeraIt.ttf.svn-basebin63684 -> 0 bytes
-rw-r--r--src/test/image.avg2
-rw-r--r--src/test/media/1x1_white.png (renamed from src/test/1x1_white.png)bin2791 -> 2791 bytes
-rwxr-xr-xsrc/test/media/22.050Hz_16bit_mono.wav (renamed from src/video/testfiles/22.050Hz_16bit_mono.wav)bin4454 -> 4454 bytes
-rw-r--r--src/test/media/44.1kHz_16bit_6Chan.ogg (renamed from src/video/testfiles/44.1kHz_16bit_6Chan.ogg)bin159170 -> 159170 bytes
-rwxr-xr-xsrc/test/media/44.1kHz_16bit_mono.wav (renamed from src/video/testfiles/44.1kHz_16bit_mono.wav)bin8864 -> 8864 bytes
-rwxr-xr-xsrc/test/media/44.1kHz_16bit_stereo.aif (renamed from src/video/testfiles/44.1kHz_16bit_stereo.aif)bin352854 -> 352854 bytes
-rwxr-xr-xsrc/test/media/44.1kHz_16bit_stereo.wav (renamed from src/video/testfiles/44.1kHz_16bit_stereo.wav)bin352844 -> 352844 bytes
-rwxr-xr-xsrc/test/media/44.1kHz_24bit_mono.wav (renamed from src/video/testfiles/44.1kHz_24bit_mono.wav)bin8864 -> 8864 bytes
-rwxr-xr-xsrc/test/media/44.1kHz_24bit_stereo.aif (renamed from src/video/testfiles/44.1kHz_24bit_stereo.aif)bin529254 -> 529254 bytes
-rwxr-xr-xsrc/test/media/44.1kHz_24bit_stereo.wav (renamed from src/video/testfiles/44.1kHz_24bit_stereo.wav)bin352844 -> 352844 bytes
-rwxr-xr-xsrc/test/media/44.1kHz_mono.ogg (renamed from src/video/testfiles/44.1kHz_mono.ogg)bin4177 -> 4177 bytes
-rw-r--r--src/test/media/44.1kHz_stereo.mp3 (renamed from src/video/testfiles/44.1kHz_stereo.mp3)bin47647 -> 47647 bytes
-rw-r--r--src/test/media/44.1kHz_stereo.ogg (renamed from src/video/testfiles/44.1kHz_stereo.ogg)bin10211 -> 10211 bytes
-rwxr-xr-xsrc/test/media/48kHz_16bit_mono.wav (renamed from src/video/testfiles/48kHz_16bit_mono.wav)bin9644 -> 9644 bytes
-rwxr-xr-xsrc/test/media/48kHz_16bit_stereo.aif (renamed from src/video/testfiles/48kHz_16bit_stereo.aif)bin384054 -> 384054 bytes
-rwxr-xr-xsrc/test/media/48kHz_16bit_stereo.wav (renamed from src/video/testfiles/48kHz_16bit_stereo.wav)bin384044 -> 384044 bytes
-rwxr-xr-xsrc/test/media/48kHz_24bit_mono.wav (renamed from src/video/testfiles/48kHz_24bit_mono.wav)bin9644 -> 9644 bytes
-rwxr-xr-xsrc/test/media/48kHz_24bit_stereo.aif (renamed from src/video/testfiles/48kHz_24bit_stereo.aif)bin576054 -> 576054 bytes
-rwxr-xr-xsrc/test/media/48kHz_24bit_stereo.wav (renamed from src/video/testfiles/48kHz_24bit_stereo.wav)bin384044 -> 384044 bytes
-rw-r--r--src/test/media/48kHz_stereo.mp3 (renamed from src/video/testfiles/48kHz_stereo.mp3)bin47808 -> 47808 bytes
-rw-r--r--src/test/media/48kHz_stereo.ogg (renamed from src/video/testfiles/48kHz_stereo.ogg)bin104701 -> 104701 bytes
-rw-r--r--src/test/media/CustomSkin.xml83
-rw-r--r--src/test/media/SimpleSkin.xml83
-rw-r--r--src/test/media/button_bg_down.pngbin0 -> 3212 bytes
-rw-r--r--src/test/media/button_bg_up.pngbin0 -> 3085 bytes
-rw-r--r--src/test/media/button_check.png (renamed from src/test/button_check.png)bin3040 -> 3040 bytes
-rw-r--r--src/test/media/button_disabled.png (renamed from src/test/button_disabled.png)bin4308 -> 4308 bytes
-rw-r--r--src/test/media/button_down.png (renamed from src/test/button_down.png)bin4221 -> 4221 bytes
-rw-r--r--src/test/media/button_over.png (renamed from src/test/button_over.png)bin4131 -> 4131 bytes
-rw-r--r--src/test/media/button_up.png (renamed from src/test/button_up.png)bin3923 -> 3923 bytes
-rw-r--r--src/test/media/checkbox_checked_disabled.pngbin0 -> 2908 bytes
-rw-r--r--src/test/media/checkbox_checked_down.pngbin0 -> 2902 bytes
-rw-r--r--src/test/media/checkbox_checked_up.pngbin0 -> 2902 bytes
-rw-r--r--src/test/media/checkbox_unchecked_disabled.pngbin0 -> 2856 bytes
-rw-r--r--src/test/media/checkbox_unchecked_down.pngbin0 -> 2849 bytes
-rw-r--r--src/test/media/checkbox_unchecked_up.pngbin0 -> 2849 bytes
-rw-r--r--src/test/media/checker.png (renamed from src/test/checker.png)bin3526 -> 3526 bytes
-rw-r--r--src/test/media/chromakey-median.png (renamed from src/graphics/testfiles/chromakey-median.png)bin3331 -> 3331 bytes
-rw-r--r--src/test/media/chromakey.png (renamed from src/graphics/testfiles/chromakey.png)bin2995 -> 2995 bytes
-rw-r--r--src/test/media/colorramp.png (renamed from src/test/colorramp.png)bin4471 -> 4471 bytes
-rw-r--r--src/test/media/corebin0 -> 71188480 bytes
-rw-r--r--src/test/media/crop_bkgd.png (renamed from src/test/crop_bkgd.png)bin369 -> 369 bytes
-rw-r--r--src/test/media/dilation.png (renamed from src/graphics/testfiles/dilation.png)bin80 -> 80 bytes
-rw-r--r--src/test/media/erosion.png (renamed from src/graphics/testfiles/erosion.png)bin960 -> 960 bytes
-rw-r--r--src/test/media/filterwipeborder.png (renamed from src/imaging/testfiles/filterwipeborder.png)bin1166 -> 1166 bytes
-rw-r--r--src/test/media/flat.png (renamed from src/graphics/testfiles/flat.png)bin2861 -> 2861 bytes
-rw-r--r--src/test/media/floodfill.png (renamed from src/graphics/testfiles/floodfill.png)bin119 -> 119 bytes
-rw-r--r--src/test/media/freidrehen.jpg (renamed from src/test/freidrehen.jpg)bin3856 -> 3856 bytes
-rw-r--r--src/test/media/greyscale.png (renamed from src/test/greyscale.png)bin2245 -> 2245 bytes
-rw-r--r--src/test/media/h264-48x48.h264 (renamed from src/video/testfiles/h264-48x48.h264)bin131081 -> 131081 bytes
-rw-r--r--src/test/media/hsl.png (renamed from src/graphics/testfiles/hsl.png)bin3131 -> 3131 bytes
-rw-r--r--src/test/media/i8-64x64.png (renamed from src/graphics/testfiles/i8-64x64.png)bin2256 -> 2256 bytes
-rw-r--r--src/test/media/incompleteSkinMedia/IncompleteSkin.xml11
-rw-r--r--src/test/media/incompleteSkinMedia/scrollbar_horiz_thumb_down.pngbin0 -> 2990 bytes
-rw-r--r--src/test/media/incompleteSkinMedia/scrollbar_horiz_thumb_up.pngbin0 -> 2948 bytes
-rw-r--r--src/test/media/incompleteSkinMedia/scrollbar_horiz_track.pngbin0 -> 2843 bytes
-rw-r--r--src/test/media/incompleteSkinMedia/scrollbar_horiz_track_disabled.pngbin0 -> 2873 bytes
-rw-r--r--src/test/media/keyboard_bg.png (renamed from src/test/keyboard_bg.png)bin781 -> 781 bytes
-rw-r--r--src/test/media/keyboard_down.png (renamed from src/test/keyboard_ovl.png)bin775 -> 775 bytes
-rw-r--r--src/test/media/keyboard_feedback.pngbin0 -> 2711 bytes
-rw-r--r--src/test/media/mask.png (renamed from src/test/mask.png)bin1270 -> 1270 bytes
-rw-r--r--src/test/media/mask1.png (renamed from src/test/mask1.png)bin227 -> 227 bytes
-rw-r--r--src/test/media/mask2.png (renamed from src/test/mask2.png)bin1598 -> 1598 bytes
-rw-r--r--src/test/media/mjpeg-48x48.avi (renamed from src/video/testfiles/mjpeg-48x48.avi)bin329852 -> 329852 bytes
-rw-r--r--src/test/media/mpeg1-48x48-sound.avibin0 -> 28534 bytes
-rw-r--r--src/test/media/mpeg1-48x48.movbin0 -> 9863 bytes
-rw-r--r--src/test/media/mpeg4-48x48.avibin0 -> 15126 bytes
-rw-r--r--src/test/media/oe.png (renamed from src/test/oe.png)bin3178 -> 3178 bytes
-rw-r--r--src/test/media/pause_button_down.pngbin0 -> 2826 bytes
-rw-r--r--src/test/media/pause_button_up.pngbin0 -> 2825 bytes
-rw-r--r--src/test/media/play_button_down.pngbin0 -> 2927 bytes
-rw-r--r--src/test/media/play_button_up.pngbin0 -> 2928 bytes
-rw-r--r--src/test/media/rect.svg (renamed from src/test/rect.svg)0
-rw-r--r--src/test/media/rectborder.png (renamed from src/test/rectborder.png)bin2810 -> 2810 bytes
-rw-r--r--src/test/media/rgb24-32x32.png (renamed from src/test/rgb24-32x32.png)bin3584 -> 3584 bytes
-rw-r--r--src/test/media/rgb24-64x64.png (renamed from src/graphics/testfiles/rgb24-64x64.png)bin2092 -> 2092 bytes
-rw-r--r--src/test/media/rgb24-65x65.png (renamed from src/graphics/testfiles/rgb24-65x65.png)bin2210 -> 2210 bytes
-rw-r--r--src/test/media/rgb24alpha-32x32.png (renamed from src/test/rgb24alpha-32x32.png)bin4088 -> 4088 bytes
-rw-r--r--src/test/media/rgb24alpha-64x64.png (renamed from src/test/rgb24alpha-64x64.png)bin3392 -> 3392 bytes
-rw-r--r--src/test/media/rgba-48x48.mov (renamed from src/video/testfiles/rgba-48x48.mov)bin127378 -> 127378 bytes
-rw-r--r--src/test/media/scrollarea_border.pngbin0 -> 3262 bytes
-rw-r--r--src/test/media/scrollbar_horiz_thumb_disabled.pngbin0 -> 2924 bytes
-rw-r--r--src/test/media/scrollbar_horiz_thumb_down.pngbin0 -> 2990 bytes
-rw-r--r--src/test/media/scrollbar_horiz_thumb_up.pngbin0 -> 2948 bytes
-rw-r--r--src/test/media/scrollbar_horiz_track.pngbin0 -> 2843 bytes
-rw-r--r--src/test/media/scrollbar_horiz_track_disabled.pngbin0 -> 2873 bytes
-rw-r--r--src/test/media/scrollbar_vert_thumb_disabled.pngbin0 -> 2911 bytes
-rw-r--r--src/test/media/scrollbar_vert_thumb_down.pngbin0 -> 3008 bytes
-rw-r--r--src/test/media/scrollbar_vert_thumb_up.pngbin0 -> 2998 bytes
-rw-r--r--src/test/media/scrollbar_vert_track.pngbin0 -> 2903 bytes
-rw-r--r--src/test/media/scrollbar_vert_track_disabled.pngbin0 -> 2902 bytes
-rw-r--r--src/test/media/shadow.png (renamed from src/test/shadow.png)bin3168 -> 3168 bytes
-rw-r--r--src/test/media/slider_horiz_track.pngbin0 -> 2858 bytes
-rw-r--r--src/test/media/slider_horiz_track_disabled.pngbin0 -> 2859 bytes
-rw-r--r--src/test/media/slider_thumb_down.pngbin0 -> 3200 bytes
-rw-r--r--src/test/media/slider_thumb_up.pngbin0 -> 3225 bytes
-rw-r--r--src/test/media/slider_vert_track.pngbin0 -> 2867 bytes
-rw-r--r--src/test/media/slider_vert_track_disabled.pngbin0 -> 2866 bytes
-rw-r--r--src/test/media/spike.png (renamed from src/graphics/testfiles/spike.png)bin2820 -> 2820 bytes
-rw-r--r--src/test/media/toggle_checked_Disabled.pngbin0 -> 3886 bytes
-rw-r--r--src/test/media/toggle_checked_Down.pngbin0 -> 3873 bytes
-rw-r--r--src/test/media/toggle_checked_Up.pngbin0 -> 3867 bytes
-rw-r--r--src/test/media/toggle_unchecked_Disabled.pngbin0 -> 3555 bytes
-rw-r--r--src/test/media/toggle_unchecked_Down.pngbin0 -> 3506 bytes
-rw-r--r--src/test/media/toggle_unchecked_Up.pngbin0 -> 3517 bytes
-rw-r--r--src/test/media/vp6a-yuva-48x48.flv (renamed from src/video/testfiles/vp6a-yuva-48x48.flv)bin13669 -> 13669 bytes
-rw-r--r--src/test/media/widebmp.jpg (renamed from src/test/widebmp.jpg)bin33903 -> 33903 bytes
-rw-r--r--src/test/panoimage.pngbin58076 -> 0 bytes
-rw-r--r--src/test/plugin/ColorNode.cpp66
-rw-r--r--src/test/plugin/Makefile.am14
-rw-r--r--src/test/plugin/Makefile.in94
-rw-r--r--src/test/rgb24-64x64.pngbin2092 -> 0 bytes
-rw-r--r--src/test/rgb24-65x65.pngbin2210 -> 0 bytes
-rw-r--r--src/test/rgb24alpha.tifbin29970 -> 0 bytes
-rw-r--r--src/test/testapp.py99
-rw-r--r--src/test/testcase.py286
-rw-r--r--src/utils/Makefile.am4
-rw-r--r--src/utils/Makefile.in83
-rwxr-xr-xsrc/utils/avg_audioplayer.py44
-rwxr-xr-xsrc/utils/avg_checkpolygonspeed.py145
-rwxr-xr-xsrc/utils/avg_checkspeed.py141
-rwxr-xr-xsrc/utils/avg_checktouch.py27
-rwxr-xr-xsrc/utils/avg_checkvsync.py28
-rwxr-xr-xsrc/utils/avg_chromakey.py207
-rwxr-xr-xsrc/utils/avg_jitterfilter.py111
-rwxr-xr-xsrc/utils/avg_showcamera.py316
-rwxr-xr-xsrc/utils/avg_showfile.py14
-rwxr-xr-xsrc/utils/avg_showfont.py94
-rwxr-xr-xsrc/utils/avg_showsvg.py69
-rwxr-xr-xsrc/utils/avg_videoinfo.py418
-rwxr-xr-xsrc/utils/avg_videoplayer.py136
-rw-r--r--src/version.h12
-rw-r--r--src/video/AsyncDemuxer.cpp152
-rw-r--r--src/video/AsyncDemuxer.h63
-rw-r--r--src/video/AsyncVideoDecoder.cpp585
-rw-r--r--src/video/AsyncVideoDecoder.h88
-rw-r--r--src/video/AudioDecoderThread.cpp305
-rw-r--r--src/video/AudioDecoderThread.h41
-rw-r--r--src/video/FFMpegDecoder.cpp1208
-rw-r--r--src/video/FFMpegDecoder.h178
-rw-r--r--src/video/FFMpegDemuxer.cpp57
-rw-r--r--src/video/FFMpegDemuxer.h41
-rw-r--r--src/video/FFMpegFrameDecoder.cpp266
-rw-r--r--src/video/FFMpegFrameDecoder.h72
-rw-r--r--src/video/Makefile.am53
-rw-r--r--src/video/Makefile.in189
-rw-r--r--src/video/PacketVideoMsg.h55
-rw-r--r--src/video/SyncVideoDecoder.cpp261
-rw-r--r--src/video/SyncVideoDecoder.h77
-rw-r--r--src/video/VDPAU.cpp393
-rw-r--r--src/video/VDPAUDecoder.cpp249
-rw-r--r--src/video/VDPAUDecoder.h67
-rw-r--r--src/video/VDPAUHelper.cpp182
-rw-r--r--src/video/VDPAUHelper.h (renamed from src/video/VDPAU.h)75
-rw-r--r--src/video/VideoDecoder.cpp481
-rw-r--r--src/video/VideoDecoder.h110
-rw-r--r--src/video/VideoDecoderThread.cpp219
-rw-r--r--src/video/VideoDecoderThread.h40
-rw-r--r--src/video/VideoDemuxerThread.cpp85
-rw-r--r--src/video/VideoDemuxerThread.h22
-rw-r--r--src/video/VideoInfo.cpp46
-rw-r--r--src/video/VideoInfo.h26
-rw-r--r--src/video/VideoMsg.cpp95
-rw-r--r--src/video/VideoMsg.h50
-rw-r--r--src/video/WrapFFMpeg.h24
-rw-r--r--src/video/baseline/mpeg1-48x48.mov_1.pngbin0 -> 3451 bytes
-rw-r--r--src/video/baseline/mpeg1-48x48.mov_2.pngbin0 -> 3301 bytes
-rw-r--r--src/video/baseline/mpeg1-48x48.mov_end.pngbin0 -> 3284 bytes
-rw-r--r--src/video/baseline/mpeg1-48x48.mov_loop.pngbin0 -> 3451 bytes
-rw-r--r--src/video/baseline/mpeg1-48x48.mpg_1.pngbin6127 -> 0 bytes
-rw-r--r--src/video/baseline/mpeg1-48x48.mpg_2.pngbin5951 -> 0 bytes
-rw-r--r--src/video/baseline/mpeg1-48x48.mpg_end.pngbin5953 -> 0 bytes
-rw-r--r--src/video/baseline/mpeg1-48x48.mpg_loop.pngbin6138 -> 0 bytes
-rw-r--r--src/video/baseline/mpeg4-48x48.avi_1.pngbin0 -> 3434 bytes
-rw-r--r--src/video/baseline/mpeg4-48x48.avi_2.pngbin0 -> 3368 bytes
-rw-r--r--src/video/baseline/mpeg4-48x48.avi_end.pngbin0 -> 3335 bytes
-rw-r--r--src/video/baseline/mpeg4-48x48.avi_loop.pngbin0 -> 3434 bytes
-rw-r--r--src/video/testfiles/mpeg1-48x48.mpgbin10240 -> 0 bytes
-rw-r--r--src/video/testvideo.cpp324
-rw-r--r--src/wrapper/Makefile.am32
-rw-r--r--src/wrapper/Makefile.in128
-rw-r--r--src/wrapper/WrapHelper.cpp247
-rw-r--r--src/wrapper/WrapHelper.h121
-rw-r--r--src/wrapper/anim_wrap.cpp69
-rw-r--r--src/wrapper/avg_wrap.cpp441
-rw-r--r--src/wrapper/bitmap_wrap.cpp115
-rw-r--r--src/wrapper/device_wrap.cpp93
-rw-r--r--src/wrapper/event_wrap.cpp71
-rw-r--r--src/wrapper/fx_wrap.cpp15
-rw-r--r--src/wrapper/node_wrap.cpp71
-rw-r--r--src/wrapper/raster_wrap.cpp85
-rw-r--r--src/wrapper/raw_constructor.hpp2
1278 files changed, 94224 insertions, 26329 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 9752f5d..bfb11d4 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,9 +1,16 @@
-if ENABLE_TESTS
- TESTDIRS = test
-endif
+SUBDIRS = base graphics imaging lmfit oscpack audio video player \
+ anim wrapper python test utils samples
-SUBDIRS = base graphics imaging lmfit oscpack audio video player conradrelais parport \
- anim wrapper python utils samples $(TESTDIRS)
+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)
-EXTRA_DIST = avgrc avgconfigwrapper.h api.h avgconfig_win.h
+BUILT_SOURCES = version.h
+DISTCLEANFILES = version.h
+version.h: FORCE
+ $(top_srcdir)/CreateVersionFile.py $(top_builddir)/src
+
+FORCE:
diff --git a/src/Makefile.in b/src/Makefile.in
index 91a5913..1c5cab2 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# Makefile.in generated by automake 1.11.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
-# Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -41,22 +41,23 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ac_cxx_namespaces.m4 \
$(top_srcdir)/m4/ac_path_generic.m4 \
$(top_srcdir)/m4/ax_boost_thread.m4 \
- $(top_srcdir)/m4/ax_check_gl.m4 $(top_srcdir)/m4/libtool.m4 \
- $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
- $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
- $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/m4/python_dev.m4 \
- $(top_srcdir)/configure.in
+ $(top_srcdir)/m4/ax_check_gl.m4 \
+ $(top_srcdir)/m4/ax_python_devel.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/pkg.m4 \
+ $(top_srcdir)/m4/avg_version.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = avgconfig.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
-AM_V_GEN = $(am__v_GEN_$(V))
-am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
-AM_V_at = $(am__v_at_$(V))
-am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
SOURCES =
DIST_SOURCES =
@@ -110,7 +111,7 @@ AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BOOST_PYTHON_LIBS = @BOOST_PYTHON_LIBS@
-BOOST_THREAD_LIB = @BOOST_THREAD_LIB@
+BOOST_THREAD_LIBS = @BOOST_THREAD_LIBS@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
@@ -125,6 +126,7 @@ DC1394_2_CFLAGS = @DC1394_2_CFLAGS@
DC1394_2_LIBS = @DC1394_2_LIBS@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
@@ -165,6 +167,7 @@ LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
MTDEV_CFLAGS = @MTDEV_CFLAGS@
MTDEV_LIBS = @MTDEV_LIBS@
@@ -194,11 +197,13 @@ PTHREAD_CC = @PTHREAD_CC@
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
PTHREAD_LIBS = @PTHREAD_LIBS@
PYTHON = @PYTHON@
+PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@
PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
-PYTHON_INCLUDES = @PYTHON_INCLUDES@
-PYTHON_LIBS = @PYTHON_LIBS@
+PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@
+PYTHON_LDFLAGS = @PYTHON_LDFLAGS@
PYTHON_PLATFORM = @PYTHON_PLATFORM@
PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_SITE_PKG = @PYTHON_SITE_PKG@
PYTHON_VERSION = @PYTHON_VERSION@
RANLIB = @RANLIB@
SDL_CFLAGS = @SDL_CFLAGS@
@@ -221,6 +226,7 @@ abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
@@ -255,7 +261,6 @@ libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
@@ -279,11 +284,18 @@ target_vendor = @target_vendor@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-SUBDIRS = base graphics imaging lmfit oscpack audio video player conradrelais parport \
+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
-all: avgconfig.h
+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
+all: $(BUILT_SOURCES) avgconfig.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive
.SUFFIXES:
@@ -319,10 +331,8 @@ $(ACLOCAL_M4): $(am__aclocal_m4_deps)
$(am__aclocal_m4_deps):
avgconfig.h: stamp-h1
- @if test ! -f $@; then \
- rm -f stamp-h1; \
- $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \
- else :; fi
+ @if test ! -f $@; then rm -f stamp-h1; else :; fi
+ @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h1; else :; fi
stamp-h1: $(srcdir)/avgconfig.h.in $(top_builddir)/config.status
@rm -f stamp-h1
@@ -535,11 +545,13 @@ distdir: $(DISTFILES)
fi; \
done
check-am: all-am
-check: check-recursive
+check: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) check-recursive
all-am: Makefile avgconfig.h
installdirs: installdirs-recursive
installdirs-am:
-install: install-recursive
+install: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive
@@ -549,10 +561,15 @@ install-am: all-am
installcheck: installcheck-recursive
install-strip:
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- `test -z '$(STRIP)' || \
- echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
mostlyclean-generic:
clean-generic:
@@ -560,10 +577,12 @@ clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+ -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
clean: clean-recursive
clean-am: clean-generic clean-libtool mostlyclean-am
@@ -630,8 +649,9 @@ ps-am:
uninstall-am:
-.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all \
- ctags-recursive install-am install-strip tags-recursive
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all check \
+ ctags-recursive install install-am install-strip \
+ tags-recursive
.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
all all-am check check-am clean clean-generic clean-libtool \
@@ -648,6 +668,11 @@ uninstall-am:
tags tags-recursive uninstall uninstall-am
+version.h: FORCE
+ $(top_srcdir)/CreateVersionFile.py $(top_builddir)/src
+
+FORCE:
+
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
diff --git a/src/anim/Anim.cpp b/src/anim/Anim.cpp
index c5dc830..69b245d 100644
--- a/src/anim/Anim.cpp
+++ b/src/anim/Anim.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/anim/Anim.h b/src/anim/Anim.h
index b704090..3080141 100644
--- a/src/anim/Anim.h
+++ b/src/anim/Anim.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/anim/AttrAnim.cpp b/src/anim/AttrAnim.cpp
index 8a01471..2791ed2 100644
--- a/src/anim/AttrAnim.cpp
+++ b/src/anim/AttrAnim.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -29,16 +29,14 @@ using namespace boost::python;
using namespace std;
namespace avg {
-
+
AttrAnim::AttrAnimationMap AttrAnim::s_ActiveAnimations;
bool ObjAttrID::operator < (const ObjAttrID& other) const
{
- Node * pNode = extract<Node*>(m_Node);
- Node * pOtherNode = extract<Node*>(other.m_Node);
- if (pNode < pOtherNode) {
+ if (m_ObjHash < other.m_ObjHash) {
return true;
- } else if (pNode > pOtherNode) {
+ } else if (m_ObjHash > other.m_ObjHash) {
return false;
} else if (m_sAttrName < other.m_sAttrName) {
return true;
@@ -102,6 +100,4 @@ void AttrAnim::stopActiveAttrAnim()
}
}
-
-
}
diff --git a/src/anim/AttrAnim.h b/src/anim/AttrAnim.h
index 44c09c4..a546c95 100644
--- a/src/anim/AttrAnim.h
+++ b/src/anim/AttrAnim.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -38,12 +38,12 @@
namespace avg {
struct ObjAttrID {
- ObjAttrID(const boost::python::object& node, const std::string& sAttrName)
- : m_Node(node),
+ ObjAttrID(const boost::python::object& obj, const std::string& sAttrName)
+ : m_ObjHash(boost::python::extract<long>(obj.attr("__hash__")())),
m_sAttrName(sAttrName)
{
}
- boost::python::object m_Node;
+ long m_ObjHash;
std::string m_sAttrName;
bool operator < (const ObjAttrID& other) const;
};
diff --git a/src/anim/ContinuousAnim.cpp b/src/anim/ContinuousAnim.cpp
index a5e84e4..e6b8b02 100644
--- a/src/anim/ContinuousAnim.cpp
+++ b/src/anim/ContinuousAnim.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -66,19 +66,19 @@ void ContinuousAnim::abort()
bool ContinuousAnim::step()
{
object curValue;
- double time = (Player::get()->getFrameTime()-m_StartTime)/1000.0;
- if (isPythonType<double>(m_EffStartValue)) {
- curValue = object(time*extract<double>(m_Speed)+m_EffStartValue);
+ float time = (Player::get()->getFrameTime()-m_StartTime)/1000.0f;
+ if (isPythonType<float>(m_EffStartValue)) {
+ curValue = object(time*extract<float>(m_Speed)+m_EffStartValue);
if (m_bUseInt) {
- double d = extract<double>(curValue);
+ float d = extract<float>(curValue);
curValue = object(round(d));
}
- } else if (isPythonType<DPoint>(m_EffStartValue)) {
- DPoint pt = extract<DPoint>(m_Speed);
+ } else if (isPythonType<glm::vec2>(m_EffStartValue)) {
+ glm::vec2 pt = extract<glm::vec2>(m_Speed)();
curValue = object(time*pt+m_EffStartValue);
if (m_bUseInt) {
- DPoint pt = extract<DPoint>(curValue);
- curValue = object(DPoint(round(pt.x), round(pt.y)));
+ glm::vec2 pt = extract<glm::vec2>(curValue)();
+ curValue = object(glm::vec2(round(pt.x), round(pt.y)));
}
} else {
throw (Exception(AVG_ERR_TYPE,
diff --git a/src/anim/ContinuousAnim.h b/src/anim/ContinuousAnim.h
index d87d601..c0bcb67 100644
--- a/src/anim/ContinuousAnim.h
+++ b/src/anim/ContinuousAnim.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/anim/EaseInOutAnim.cpp b/src/anim/EaseInOutAnim.cpp
index b2fd956..c8a3cf7 100644
--- a/src/anim/EaseInOutAnim.cpp
+++ b/src/anim/EaseInOutAnim.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -37,8 +37,8 @@ EaseInOutAnim::EaseInOutAnim(const object& node, const string& sAttrName,
const object& startCallback, const object& stopCallback)
: SimpleAnim(node, sAttrName, duration, startValue, endValue, bUseInt, startCallback,
stopCallback),
- m_EaseInDuration(double(easeInDuration)/duration),
- m_EaseOutDuration(double(easeOutDuration)/duration)
+ m_EaseInDuration(float(easeInDuration)/duration),
+ m_EaseOutDuration(float(easeOutDuration)/duration)
{
}
@@ -46,20 +46,20 @@ EaseInOutAnim::~EaseInOutAnim()
{
}
-double EaseInOutAnim::interpolate(double t)
+float EaseInOutAnim::interpolate(float t)
{
- double accelDist = m_EaseInDuration*2/M_PI;
- double decelDist = m_EaseOutDuration*2/M_PI;
- double dist;
+ float accelDist = m_EaseInDuration*2/PI;
+ float decelDist = m_EaseOutDuration*2/PI;
+ float dist;
if (t<m_EaseInDuration) {
// Acceleration stage
- double nt = t/m_EaseInDuration;
- double s = sin(-M_PI/2+nt*M_PI/2)+1;
+ float nt = t/m_EaseInDuration;
+ float s = sin(-PI/2+nt*PI/2)+1;
dist = s*accelDist;
} else if (t > 1-m_EaseOutDuration) {
// Deceleration stage
- double nt = (t-(1-m_EaseOutDuration))/m_EaseOutDuration;
- double s = sin(nt*M_PI/2);
+ 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
diff --git a/src/anim/EaseInOutAnim.h b/src/anim/EaseInOutAnim.h
index 0555c68..d4326da 100644
--- a/src/anim/EaseInOutAnim.h
+++ b/src/anim/EaseInOutAnim.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -40,11 +40,11 @@ public:
virtual ~EaseInOutAnim();
protected:
- virtual double interpolate(double t);
+ virtual float interpolate(float t);
private:
- double m_EaseInDuration;
- double m_EaseOutDuration;
+ float m_EaseInDuration;
+ float m_EaseOutDuration;
};
}
diff --git a/src/anim/LinearAnim.cpp b/src/anim/LinearAnim.cpp
index 58abffe..7e34cfd 100644
--- a/src/anim/LinearAnim.cpp
+++ b/src/anim/LinearAnim.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -40,17 +40,17 @@ LinearAnim::~LinearAnim()
{
}
-double LinearAnim::interpolate(double t)
+float LinearAnim::interpolate(float t)
{
return t;
}
-double LinearAnim::getStartPart(double start, double end, double cur)
+float LinearAnim::getStartPart(float start, float end, float cur)
{
return (cur-start)/(end-start);
}
-AnimPtr fadeIn(const boost::python::object& node, long long duration, double max,
+AnimPtr fadeIn(const boost::python::object& node, long long duration, float max,
const boost::python::object& stopCallback)
{
object startVal = node.attr("opacity");
diff --git a/src/anim/LinearAnim.h b/src/anim/LinearAnim.h
index b7870aa..1b58613 100644
--- a/src/anim/LinearAnim.h
+++ b/src/anim/LinearAnim.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -40,13 +40,13 @@ public:
virtual ~LinearAnim();
protected:
- virtual double interpolate(double t);
+ virtual float interpolate(float t);
private:
- double getStartPart(double start, double end, double cur);
+ float getStartPart(float start, float end, float cur);
};
-AnimPtr fadeIn(const boost::python::object& node, long long duration, double max=1.0,
+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,
diff --git a/src/anim/Makefile.am b/src/anim/Makefile.am
index 1ac89b5..6c37d2a 100644
--- a/src/anim/Makefile.am
+++ b/src/anim/Makefile.am
@@ -1,10 +1,9 @@
-INCLUDES = -I.. @XML2_CFLAGS@ @PYTHON_INCLUDES@
+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
+ EaseInOutAnim.cpp WaitAnim.cpp ParallelAnim.cpp StateAnim.cpp
noinst_LTLIBRARIES = libanim.la
libanim_la_SOURCES = $(ALL_CPP) $(ALL_H)
diff --git a/src/anim/Makefile.in b/src/anim/Makefile.in
index 1fc5ad2..fcb3e02 100644
--- a/src/anim/Makefile.in
+++ b/src/anim/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# Makefile.in generated by automake 1.11.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
-# Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -41,11 +41,12 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ac_cxx_namespaces.m4 \
$(top_srcdir)/m4/ac_path_generic.m4 \
$(top_srcdir)/m4/ax_boost_thread.m4 \
- $(top_srcdir)/m4/ax_check_gl.m4 $(top_srcdir)/m4/libtool.m4 \
- $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
- $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
- $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/m4/python_dev.m4 \
- $(top_srcdir)/configure.in
+ $(top_srcdir)/m4/ax_check_gl.m4 \
+ $(top_srcdir)/m4/ax_python_devel.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/pkg.m4 \
+ $(top_srcdir)/m4/avg_version.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
@@ -60,8 +61,8 @@ am__objects_1 = Anim.lo SimpleAnim.lo LinearAnim.lo AttrAnim.lo \
am__objects_2 =
am_libanim_la_OBJECTS = $(am__objects_1) $(am__objects_2)
libanim_la_OBJECTS = $(am_libanim_la_OBJECTS)
-AM_V_lt = $(am__v_lt_$(V))
-am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
am__v_lt_0 = --silent
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src
depcomp = $(SHELL) $(top_srcdir)/depcomp
@@ -73,18 +74,18 @@ LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CXXFLAGS) $(CXXFLAGS)
-AM_V_CXX = $(am__v_CXX_$(V))
-am__v_CXX_ = $(am__v_CXX_$(AM_DEFAULT_VERBOSITY))
+AM_V_CXX = $(am__v_CXX_@AM_V@)
+am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@)
am__v_CXX_0 = @echo " CXX " $@;
-AM_V_at = $(am__v_at_$(V))
-am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
CXXLD = $(CXX)
CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
$(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
-AM_V_CXXLD = $(am__v_CXXLD_$(V))
-am__v_CXXLD_ = $(am__v_CXXLD_$(AM_DEFAULT_VERBOSITY))
+AM_V_CXXLD = $(am__v_CXXLD_@AM_V@)
+am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@)
am__v_CXXLD_0 = @echo " CXXLD " $@;
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@@ -92,18 +93,18 @@ LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
-AM_V_CC = $(am__v_CC_$(V))
-am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
+AM_V_CC = $(am__v_CC_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
am__v_CC_0 = @echo " CC " $@;
CCLD = $(CC)
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
-AM_V_CCLD = $(am__v_CCLD_$(V))
-am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
-AM_V_GEN = $(am__v_GEN_$(V))
-am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
SOURCES = $(libanim_la_SOURCES)
DIST_SOURCES = $(libanim_la_SOURCES)
@@ -119,7 +120,7 @@ AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BOOST_PYTHON_LIBS = @BOOST_PYTHON_LIBS@
-BOOST_THREAD_LIB = @BOOST_THREAD_LIB@
+BOOST_THREAD_LIBS = @BOOST_THREAD_LIBS@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
@@ -134,6 +135,7 @@ DC1394_2_CFLAGS = @DC1394_2_CFLAGS@
DC1394_2_LIBS = @DC1394_2_LIBS@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
@@ -174,6 +176,7 @@ LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
MTDEV_CFLAGS = @MTDEV_CFLAGS@
MTDEV_LIBS = @MTDEV_LIBS@
@@ -203,11 +206,13 @@ PTHREAD_CC = @PTHREAD_CC@
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
PTHREAD_LIBS = @PTHREAD_LIBS@
PYTHON = @PYTHON@
+PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@
PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
-PYTHON_INCLUDES = @PYTHON_INCLUDES@
-PYTHON_LIBS = @PYTHON_LIBS@
+PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@
+PYTHON_LDFLAGS = @PYTHON_LDFLAGS@
PYTHON_PLATFORM = @PYTHON_PLATFORM@
PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_SITE_PKG = @PYTHON_SITE_PKG@
PYTHON_VERSION = @PYTHON_VERSION@
RANLIB = @RANLIB@
SDL_CFLAGS = @SDL_CFLAGS@
@@ -230,6 +235,7 @@ abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
@@ -264,7 +270,6 @@ libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
@@ -288,12 +293,12 @@ target_vendor = @target_vendor@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-INCLUDES = -I.. @XML2_CFLAGS@ @PYTHON_INCLUDES@
+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
+ EaseInOutAnim.cpp WaitAnim.cpp ParallelAnim.cpp StateAnim.cpp
noinst_LTLIBRARIES = libanim.la
libanim_la_SOURCES = $(ALL_CPP) $(ALL_H)
@@ -340,7 +345,7 @@ clean-noinstLTLIBRARIES:
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
-libanim.la: $(libanim_la_OBJECTS) $(libanim_la_DEPENDENCIES)
+libanim.la: $(libanim_la_OBJECTS) $(libanim_la_DEPENDENCIES) $(EXTRA_libanim_la_DEPENDENCIES)
$(AM_V_CXXLD)$(CXXLINK) $(libanim_la_OBJECTS) $(libanim_la_LIBADD) $(LIBS)
mostlyclean-compile:
@@ -362,26 +367,23 @@ distclean-compile:
.cpp.o:
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $<
.cpp.obj:
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
.cpp.lo:
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
-@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
@@ -485,10 +487,15 @@ install-am: all-am
installcheck: installcheck-am
install-strip:
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- `test -z '$(STRIP)' || \
- echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
mostlyclean-generic:
clean-generic:
diff --git a/src/anim/ParallelAnim.cpp b/src/anim/ParallelAnim.cpp
index 1833fab..0cfe799 100644
--- a/src/anim/ParallelAnim.cpp
+++ b/src/anim/ParallelAnim.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/anim/ParallelAnim.h b/src/anim/ParallelAnim.h
index 5e5b651..44d8e27 100644
--- a/src/anim/ParallelAnim.h
+++ b/src/anim/ParallelAnim.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/anim/SimpleAnim.cpp b/src/anim/SimpleAnim.cpp
index 9f0b002..67d3862 100644
--- a/src/anim/SimpleAnim.cpp
+++ b/src/anim/SimpleAnim.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -72,7 +72,7 @@ void SimpleAnim::abort()
}
template<class T>
-object typedLERP(const object& startValue, const object& endValue, double part)
+object typedLERP(const object& startValue, const object& endValue, float part)
{
T start = extract<T>(startValue);
T end = extract<T>(endValue);
@@ -83,7 +83,7 @@ object typedLERP(const object& startValue, const object& endValue, double part)
bool SimpleAnim::step()
{
assert(isRunning());
- double t = ((double(Player::get()->getFrameTime())-m_StartTime)
+ float t = ((float(Player::get()->getFrameTime())-m_StartTime)
/m_Duration);
if (t >= 1.0) {
setValue(m_EndValue);
@@ -91,18 +91,18 @@ bool SimpleAnim::step()
return true;
} else {
object curValue;
- double part = interpolate(t);
- if (isPythonType<double>(m_StartValue)) {
- curValue = typedLERP<double>(m_StartValue, m_EndValue, part);
+ float part = interpolate(t);
+ if (isPythonType<float>(m_StartValue)) {
+ curValue = typedLERP<float>(m_StartValue, m_EndValue, part);
if (m_bUseInt) {
- double d = extract<double>(curValue);
+ float d = extract<float>(curValue);
curValue = object(round(d));
}
- } else if (isPythonType<DPoint>(m_StartValue)) {
- curValue = typedLERP<DPoint>(m_StartValue, m_EndValue, part);
+ } else if (isPythonType<glm::vec2>(m_StartValue)) {
+ curValue = typedLERP<glm::vec2>(m_StartValue, m_EndValue, part);
if (m_bUseInt) {
- DPoint pt = extract<DPoint>(curValue);
- curValue = object(DPoint(round(pt.x), round(pt.y)));
+ glm::vec2 pt = extract<glm::vec2>(curValue);
+ curValue = object(glm::vec2(round(pt.x), round(pt.y)));
}
} else {
throw (Exception(AVG_ERR_TYPE,
@@ -125,22 +125,22 @@ long long SimpleAnim::getDuration() const
long long SimpleAnim::calcStartTime()
{
- double part;
- if (isPythonType<double>(m_StartValue)) {
+ float part;
+ if (isPythonType<float>(m_StartValue)) {
if (m_EndValue == m_StartValue) {
part = 0;
} else {
- part = getStartPart(extract<double>(m_StartValue),
- extract<double>(m_EndValue), extract<double>(getValue()));
+ part = getStartPart(extract<float>(m_StartValue),
+ extract<float>(m_EndValue), extract<float>(getValue()));
}
- } else if (isPythonType<DPoint>(m_StartValue)) {
- double start = DPoint(extract<DPoint>(m_StartValue)).x;
- double end = DPoint(extract<DPoint>(m_EndValue)).x;
- double cur = DPoint(extract<DPoint>(getValue())).x;
+ } else if (isPythonType<glm::vec2>(m_StartValue)) {
+ float start = glm::vec2(extract<glm::vec2>(m_StartValue)()).x;
+ float end = glm::vec2(extract<glm::vec2>(m_EndValue)()).x;
+ float cur = glm::vec2(extract<glm::vec2>(getValue())()).x;
if (start == end) {
- start = DPoint(extract<DPoint>(m_StartValue)).y;
- end = DPoint(extract<DPoint>(m_EndValue)).y;
- start = DPoint(extract<DPoint>(getValue())).y;
+ start = glm::vec2(extract<glm::vec2>(m_StartValue)()).y;
+ end = glm::vec2(extract<glm::vec2>(m_EndValue)()).y;
+ start = glm::vec2(extract<glm::vec2>(getValue())()).y;
}
if (start == end) {
part = 0;
@@ -154,15 +154,15 @@ long long SimpleAnim::calcStartTime()
return Player::get()->getFrameTime()-(long long)(part*getDuration());
}
-double SimpleAnim::getStartPart(double start, double end, double cur)
+float SimpleAnim::getStartPart(float start, float end, float cur)
{
- double tstart = 0;
- double tend = 1;
+ float tstart = 0;
+ float tend = 1;
bool bDir = (start < end);
for (int i=0; i<10; ++i) {
- double tmiddle = (tstart+tend)/2;
- double part = interpolate(tmiddle);
- double middle = start+(end-start)*part;
+ 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 {
diff --git a/src/anim/SimpleAnim.h b/src/anim/SimpleAnim.h
index 874359d..502505b 100644
--- a/src/anim/SimpleAnim.h
+++ b/src/anim/SimpleAnim.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -55,14 +55,14 @@ public:
virtual bool step();
protected:
- virtual double interpolate(double t)=0;
+ virtual float interpolate(float t)=0;
void remove();
private:
long long getStartTime() const;
long long getDuration() const;
long long calcStartTime();
- virtual double getStartPart(double start, double end, double cur);
+ virtual float getStartPart(float start, float end, float cur);
long long m_Duration;
boost::python::object m_StartValue;
diff --git a/src/anim/StateAnim.cpp b/src/anim/StateAnim.cpp
index 543a06a..4858c23 100644
--- a/src/anim/StateAnim.cpp
+++ b/src/anim/StateAnim.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/anim/StateAnim.h b/src/anim/StateAnim.h
index 2d614fa..135668a 100644
--- a/src/anim/StateAnim.h
+++ b/src/anim/StateAnim.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -58,7 +58,6 @@ private:
std::map<std::string, AnimState> m_States;
bool m_bDebug;
- bool m_bIsAborting;
std::string m_sCurStateName;
};
diff --git a/src/anim/WaitAnim.cpp b/src/anim/WaitAnim.cpp
index a73ae6b..7509504 100644
--- a/src/anim/WaitAnim.cpp
+++ b/src/anim/WaitAnim.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -23,6 +23,7 @@
#include "../player/Player.h"
+using namespace boost;
using namespace boost::python;
using namespace std;
@@ -41,6 +42,7 @@ WaitAnim::~WaitAnim()
void WaitAnim::start(bool bKeepAttr)
{
+ m_pThis = dynamic_pointer_cast<WaitAnim>(shared_from_this());
Anim::start();
m_StartTime = Player::get()->getFrameTime();
}
@@ -48,6 +50,7 @@ void WaitAnim::start(bool bKeepAttr)
void WaitAnim::abort()
{
setStopped();
+ m_pThis = WaitAnimPtr();
}
bool WaitAnim::step()
@@ -55,6 +58,7 @@ 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
index a8d8446..e90daf2 100644
--- a/src/anim/WaitAnim.h
+++ b/src/anim/WaitAnim.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -28,6 +28,9 @@
namespace avg {
+class WaitAnim;
+typedef boost::shared_ptr<class WaitAnim> WaitAnimPtr;
+
class AVG_API WaitAnim: public Anim {
public:
WaitAnim(long long duration = -1,
@@ -43,6 +46,7 @@ public:
private:
long long m_Duration;
long long m_StartTime;
+ WaitAnimPtr m_pThis; // Make sure we're not deleted while running.
};
}
diff --git a/src/api.h b/src/api.h
index 31dd3e2..cd6001b 100644
--- a/src/api.h
+++ b/src/api.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -40,5 +40,11 @@
#define AVG_PLUGIN_API extern "C"
#endif
+#ifdef __APPLE__
+// Workaround for snow leopard incompatibility between c++ headers and python headers:
+// <iostream> always needs to be included before Python.h.
+#include <iostream>
+#endif
+
#endif
diff --git a/src/audio/AudioBuffer.cpp b/src/audio/AudioBuffer.cpp
index 705cee1..64032c3 100644
--- a/src/audio/AudioBuffer.cpp
+++ b/src/audio/AudioBuffer.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -26,6 +26,8 @@
#include <string>
#include <cstring>
+#define VOLUME_FADE_SAMPLES 100
+
namespace avg {
AudioBuffer::AudioBuffer(int numFrames, AudioParams ap)
@@ -75,4 +77,29 @@ 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
index ccb52ec..1dbf068 100644
--- a/src/audio/AudioBuffer.h
+++ b/src/audio/AudioBuffer.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -46,6 +46,8 @@ class AVG_API AudioBuffer
int getRate();
void clear();
+ void volumize(float lastVol, float curVol);
+
private:
int m_NumFrames;
short* m_pData;
@@ -56,4 +58,4 @@ typedef boost::shared_ptr<AudioBuffer> AudioBufferPtr;
}
-#endif /*AUDIOFRAME_H_*/
+#endif
diff --git a/src/audio/AudioEngine.cpp b/src/audio/AudioEngine.cpp
index 109951e..aad1b9f 100644
--- a/src/audio/AudioEngine.cpp
+++ b/src/audio/AudioEngine.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -23,28 +23,121 @@
#include "AudioEngine.h"
-#include "../base/ObjectCounter.h"
+#include "Dynamics.h"
+
#include "../base/Exception.h"
+#include "../base/Logger.h"
+
+#include <iostream>
using namespace std;
+using namespace boost;
namespace avg {
+AudioEngine* AudioEngine::s_pInstance = 0;
+
+AudioEngine* AudioEngine::get()
+{
+ return s_pInstance;
+}
+
AudioEngine::AudioEngine()
- : m_bEnabled(true),
+ : m_pTempBuffer(),
+ m_pMixBuffer(0),
+ m_pLimiter(0),
+ m_bEnabled(true),
m_Volume(1)
{
- ObjectCounter::get()->incRef(&typeid(*this));
+ 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()
{
- ObjectCounter::get()->decRef(&typeid(*this));
+ 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<float, 2>* pLimiter = new Dynamics<float, 2>(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<float>::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) {
@@ -52,48 +145,151 @@ void AudioEngine::setAudioEnabled(bool bEnabled)
} else {
pause();
}
+ SDL_UnlockAudio();
}
-void AudioEngine::init(const AudioParams& ap, double volume)
+void AudioEngine::play()
{
- m_Volume = volume;
+ SDL_PauseAudio(0);
}
-AudioSourceList& AudioEngine::getSources()
+void AudioEngine::pause()
{
- return m_AudioSources;
+ SDL_PauseAudio(1);
}
-void AudioEngine::addSource(IAudioSource* pSource)
+int AudioEngine::addSource(AudioMsgQueue& dataQ, AudioMsgQueue& statusQ)
{
- m_AudioSources.push_back(pSource);
+ 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(IAudioSource* pSource)
+void AudioEngine::removeSource(int id)
{
- AudioSourceList::iterator it;
- for(it = m_AudioSources.begin(); it != m_AudioSources.end(); it++)
- {
- if (*it == pSource) {
- m_AudioSources.erase(it);
- break;
- }
- }
+ SDL_LockAudio();
+ lock_guard lock(m_Mutex);
+ int numErased = m_AudioSources.erase(id);
+ AVG_ASSERT(numErased == 1);
+ SDL_UnlockAudio();
}
-void AudioEngine::setVolume(double volume)
+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();
}
-double AudioEngine::getVolume() const
+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
index 7659bd3..bb93196 100644
--- a/src/audio/AudioEngine.h
+++ b/src/audio/AudioEngine.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -25,44 +25,68 @@
#define _AudioEngine_H_
#include "../api.h"
-#include "IAudioSource.h"
+#include "AudioSource.h"
#include "AudioParams.h"
+#include "AudioBuffer.h"
+#include "IProcessor.h"
-#include <vector>
+#include <SDL/SDL.h>
+
+#include <boost/thread/mutex.hpp>
+
+#include <map>
namespace avg {
-typedef std::vector<IAudioSource*> AudioSourceList;
+typedef std::map<int, AudioSourcePtr> AudioSourceMap;
class AVG_API AudioEngine
{
public:
+ static AudioEngine* get();
AudioEngine();
virtual ~AudioEngine();
- virtual int getChannels() = 0;
- virtual int getSampleRate() = 0;
- virtual const AudioParams * getParams() = 0;
+ int getChannels();
+ int getSampleRate();
+ const AudioParams * getParams();
- virtual void setAudioEnabled(bool bEnabled);
+ void setAudioEnabled(bool bEnabled);
- virtual void init(const AudioParams& ap, double volume);
- virtual void teardown() = 0;
+ void init(const AudioParams& ap, float volume);
+ void teardown();
- virtual void play() = 0;
- virtual void pause() = 0;
+ void play();
+ void pause();
- AudioSourceList& getSources();
- virtual void addSource(IAudioSource* pSource);
- virtual void removeSource(IAudioSource* pSource);
- virtual void setVolume(double volume);
- double getVolume() const;
+ 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<float>* m_pLimiter;
+ boost::mutex m_Mutex;
+
bool m_bEnabled;
- AudioSourceList m_AudioSources;
- double m_Volume;
+ AudioSourceMap m_AudioSources;
+ float m_Volume;
+
+ static AudioEngine* s_pInstance;
};
}
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 <iostream>
+
+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 <boost/shared_ptr.hpp>
+
+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<AudioMsg> AudioMsgPtr;
+typedef Queue<AudioMsg> AudioMsgQueue;
+typedef boost::shared_ptr<AudioMsgQueue> AudioMsgQueuePtr;
+
+}
+#endif
+
diff --git a/src/audio/AudioParams.cpp b/src/audio/AudioParams.cpp
index f7eca98..eee3768 100644
--- a/src/audio/AudioParams.cpp
+++ b/src/audio/AudioParams.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/audio/AudioParams.h b/src/audio/AudioParams.h
index c4e1203..5e04b1d 100644
--- a/src/audio/AudioParams.h
+++ b/src/audio/AudioParams.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
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 <string>
+#include <algorithm>
+
+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 <boost/shared_ptr.hpp>
+
+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<AudioSource> AudioSourcePtr;
+
+}
+
+#endif
diff --git a/src/audio/Dynamics.h b/src/audio/Dynamics.h
index ae05a7e..e5293e5 100644
--- a/src/audio/Dynamics.h
+++ b/src/audio/Dynamics.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -195,7 +195,7 @@ void Dynamics<T, CHANNELS>::process(T* pSamples)
}
//---------------- RMS
- T rms = (1. - rmsCoef_) * x * x + rmsCoef_ * rms1_;
+ T rms = (1.f - rmsCoef_) * x * x + rmsCoef_ * rms1_;
rms1_ = rms;
rms = sqrt(rms);
@@ -255,7 +255,7 @@ template<typename T, int CHANNELS>
void Dynamics<T, CHANNELS>::setThreshold(T threshold)
{
threshold_ = threshold;
- preGain_ = std::pow(10., -threshold / 20.);
+ preGain_ = std::pow(10.f, -threshold / 20.f);
}
template<typename T, int CHANNELS>
@@ -268,9 +268,9 @@ template<typename T, int CHANNELS>
void Dynamics<T, CHANNELS>::setRmsTime(T rmsTime)
{
rmsTime_ = rmsTime;
- rmsCoef_ = 0.;
- if (rmsTime > 0.) {
- rmsCoef_ = std::pow(0.001, 1. / (m_fs * rmsTime));
+ rmsCoef_ = 0.f;
+ if (rmsTime > 0.f) {
+ rmsCoef_ = std::pow(0.001f, 1.f / (m_fs * rmsTime));
}
}
@@ -284,7 +284,7 @@ template<typename T, int CHANNELS>
void Dynamics<T, CHANNELS>::setRatio(T ratio)
{
ratio_ = ratio;
- inverseRatio_ = 1. / ratio;
+ inverseRatio_ = 1.f / ratio;
}
template<typename T, int CHANNELS>
@@ -297,9 +297,9 @@ template<typename T, int CHANNELS>
void Dynamics<T, CHANNELS>::setAttackTime(T attTime)
{
attTime_ = attTime;
- attCoef_ = 0.;
- if (attTime > 0.) {
- attCoef_ = pow(0.001, 1. / (m_fs * attTime));
+ attCoef_ = 0.f;
+ if (attTime > 0.f) {
+ attCoef_ = pow(0.001f, 1.f / (m_fs * attTime));
}
}
@@ -313,9 +313,9 @@ template<typename T, int CHANNELS>
void Dynamics<T, CHANNELS>::setReleaseTime(T relTime)
{
relTime_ = relTime;
- relCoef_ = 0.;
- if (relTime > 0.) {
- relCoef_ = pow(0.001, 1. / (m_fs * relTime));
+ relCoef_ = 0.f;
+ if (relTime > 0.f) {
+ relCoef_ = pow(0.001f, 1.f / (m_fs * relTime));
}
}
@@ -329,7 +329,7 @@ template<typename T, int CHANNELS>
void Dynamics<T, CHANNELS>::setMakeupGain(T makeupGain)
{
makeupGain_ = makeupGain;
- postGain_ = std::pow(10., makeupGain / 20.);
+ postGain_ = std::pow(10.f, makeupGain / 20.f);
}
template<typename T, int CHANNELS>
diff --git a/src/audio/IProcessor.h b/src/audio/IProcessor.h
index 8faea24..4eab2f0 100644
--- a/src/audio/IProcessor.h
+++ b/src/audio/IProcessor.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/audio/Makefile.am b/src/audio/Makefile.am
index 74a6c05..f475c7c 100644
--- a/src/audio/Makefile.am
+++ b/src/audio/Makefile.am
@@ -1,18 +1,17 @@
+AM_CPPFLAGS = -I.. @PTHREAD_CFLAGS@
-INCLUDES = -I.. @PTHREAD_CFLAGS@ @FFMPEG_CFLAGS@
+ALL_H = AudioEngine.h AudioBuffer.h AudioParams.h \
+ Dynamics.h IProcessor.h AudioMsg.h AudioSource.h
-ALL_H = AudioEngine.h AudioBuffer.h AudioParams.h IAudioSource.h SDLAudioEngine.h \
- Dynamics.h IProcessor.h
-
-TESTS=testlimiter
+TESTS = testlimiter
noinst_LTLIBRARIES = libaudio.la
-noinst_PROGRAMS=testlimiter
+noinst_PROGRAMS = testlimiter
-libaudio_la_SOURCES = AudioEngine.cpp AudioBuffer.cpp AudioParams.cpp \
- SDLAudioEngine.cpp \
- $(ALL_H)
+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 \
- -l@BOOST_THREAD_LIB@ -lboost_system @PTHREAD_LIBS@
+ ../base/triangulate/libtriangulate.la \
+ @BOOST_THREAD_LIBS@ @PTHREAD_LIBS@
diff --git a/src/audio/Makefile.in b/src/audio/Makefile.in
index 10bf73a..04f2e56 100644
--- a/src/audio/Makefile.in
+++ b/src/audio/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# Makefile.in generated by automake 1.11.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
-# Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -44,11 +44,12 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ac_cxx_namespaces.m4 \
$(top_srcdir)/m4/ac_path_generic.m4 \
$(top_srcdir)/m4/ax_boost_thread.m4 \
- $(top_srcdir)/m4/ax_check_gl.m4 $(top_srcdir)/m4/libtool.m4 \
- $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
- $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
- $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/m4/python_dev.m4 \
- $(top_srcdir)/configure.in
+ $(top_srcdir)/m4/ax_check_gl.m4 \
+ $(top_srcdir)/m4/ax_python_devel.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/pkg.m4 \
+ $(top_srcdir)/m4/avg_version.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
@@ -59,15 +60,16 @@ LTLIBRARIES = $(noinst_LTLIBRARIES)
libaudio_la_LIBADD =
am__objects_1 =
am_libaudio_la_OBJECTS = AudioEngine.lo AudioBuffer.lo AudioParams.lo \
- SDLAudioEngine.lo $(am__objects_1)
+ AudioMsg.lo AudioSource.lo $(am__objects_1)
libaudio_la_OBJECTS = $(am_libaudio_la_OBJECTS)
-AM_V_lt = $(am__v_lt_$(V))
-am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
am__v_lt_0 = --silent
PROGRAMS = $(noinst_PROGRAMS)
am_testlimiter_OBJECTS = testlimiter.$(OBJEXT) $(am__objects_1)
testlimiter_OBJECTS = $(am_testlimiter_OBJECTS)
-testlimiter_DEPENDENCIES = ./libaudio.la ../base/libbase.la
+testlimiter_DEPENDENCIES = ./libaudio.la ../base/libbase.la \
+ ../base/triangulate/libtriangulate.la
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@@ -78,18 +80,18 @@ LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CXXFLAGS) $(CXXFLAGS)
-AM_V_CXX = $(am__v_CXX_$(V))
-am__v_CXX_ = $(am__v_CXX_$(AM_DEFAULT_VERBOSITY))
+AM_V_CXX = $(am__v_CXX_@AM_V@)
+am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@)
am__v_CXX_0 = @echo " CXX " $@;
-AM_V_at = $(am__v_at_$(V))
-am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
CXXLD = $(CXX)
CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
$(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
-AM_V_CXXLD = $(am__v_CXXLD_$(V))
-am__v_CXXLD_ = $(am__v_CXXLD_$(AM_DEFAULT_VERBOSITY))
+AM_V_CXXLD = $(am__v_CXXLD_@AM_V@)
+am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@)
am__v_CXXLD_0 = @echo " CXXLD " $@;
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@@ -97,18 +99,18 @@ LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
-AM_V_CC = $(am__v_CC_$(V))
-am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
+AM_V_CC = $(am__v_CC_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
am__v_CC_0 = @echo " CC " $@;
CCLD = $(CC)
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
-AM_V_CCLD = $(am__v_CCLD_$(V))
-am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
-AM_V_GEN = $(am__v_GEN_$(V))
-am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
SOURCES = $(libaudio_la_SOURCES) $(testlimiter_SOURCES)
DIST_SOURCES = $(libaudio_la_SOURCES) $(testlimiter_SOURCES)
@@ -126,7 +128,7 @@ AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BOOST_PYTHON_LIBS = @BOOST_PYTHON_LIBS@
-BOOST_THREAD_LIB = @BOOST_THREAD_LIB@
+BOOST_THREAD_LIBS = @BOOST_THREAD_LIBS@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
@@ -141,6 +143,7 @@ DC1394_2_CFLAGS = @DC1394_2_CFLAGS@
DC1394_2_LIBS = @DC1394_2_LIBS@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
@@ -181,6 +184,7 @@ LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
MTDEV_CFLAGS = @MTDEV_CFLAGS@
MTDEV_LIBS = @MTDEV_LIBS@
@@ -210,11 +214,13 @@ PTHREAD_CC = @PTHREAD_CC@
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
PTHREAD_LIBS = @PTHREAD_LIBS@
PYTHON = @PYTHON@
+PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@
PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
-PYTHON_INCLUDES = @PYTHON_INCLUDES@
-PYTHON_LIBS = @PYTHON_LIBS@
+PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@
+PYTHON_LDFLAGS = @PYTHON_LDFLAGS@
PYTHON_PLATFORM = @PYTHON_PLATFORM@
PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_SITE_PKG = @PYTHON_SITE_PKG@
PYTHON_VERSION = @PYTHON_VERSION@
RANLIB = @RANLIB@
SDL_CFLAGS = @SDL_CFLAGS@
@@ -237,6 +243,7 @@ abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
@@ -271,7 +278,6 @@ libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
@@ -295,18 +301,18 @@ target_vendor = @target_vendor@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-INCLUDES = -I.. @PTHREAD_CFLAGS@ @FFMPEG_CFLAGS@
-ALL_H = AudioEngine.h AudioBuffer.h AudioParams.h IAudioSource.h SDLAudioEngine.h \
- Dynamics.h IProcessor.h
+AM_CPPFLAGS = -I.. @PTHREAD_CFLAGS@
+ALL_H = AudioEngine.h AudioBuffer.h AudioParams.h \
+ Dynamics.h IProcessor.h AudioMsg.h AudioSource.h
noinst_LTLIBRARIES = libaudio.la
-libaudio_la_SOURCES = AudioEngine.cpp AudioBuffer.cpp AudioParams.cpp \
- SDLAudioEngine.cpp \
- $(ALL_H)
+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 \
- -l@BOOST_THREAD_LIB@ @PTHREAD_LIBS@
+ ../base/triangulate/libtriangulate.la \
+ @BOOST_THREAD_LIBS@ @PTHREAD_LIBS@
all: all-am
@@ -351,7 +357,7 @@ clean-noinstLTLIBRARIES:
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
-libaudio.la: $(libaudio_la_OBJECTS) $(libaudio_la_DEPENDENCIES)
+libaudio.la: $(libaudio_la_OBJECTS) $(libaudio_la_DEPENDENCIES) $(EXTRA_libaudio_la_DEPENDENCIES)
$(AM_V_CXXLD)$(CXXLINK) $(libaudio_la_OBJECTS) $(libaudio_la_LIBADD) $(LIBS)
clean-noinstPROGRAMS:
@@ -362,7 +368,7 @@ clean-noinstPROGRAMS:
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
echo " rm -f" $$list; \
rm -f $$list
-testlimiter$(EXEEXT): $(testlimiter_OBJECTS) $(testlimiter_DEPENDENCIES)
+testlimiter$(EXEEXT): $(testlimiter_OBJECTS) $(testlimiter_DEPENDENCIES) $(EXTRA_testlimiter_DEPENDENCIES)
@rm -f testlimiter$(EXEEXT)
$(AM_V_CXXLD)$(CXXLINK) $(testlimiter_OBJECTS) $(testlimiter_LDADD) $(LIBS)
@@ -374,33 +380,31 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/AudioBuffer.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/AudioEngine.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/AudioMsg.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/AudioParams.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SDLAudioEngine.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/AudioSource.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testlimiter.Po@am__quote@
.cpp.o:
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $<
.cpp.obj:
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
.cpp.lo:
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
-@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
@@ -541,14 +545,15 @@ check-TESTS: $(TESTS)
fi; \
dashes=`echo "$$dashes" | sed s/./=/g`; \
if test "$$failed" -eq 0; then \
- echo "$$grn$$dashes"; \
+ col="$$grn"; \
else \
- echo "$$red$$dashes"; \
+ col="$$red"; \
fi; \
- echo "$$banner"; \
- test -z "$$skipped" || echo "$$skipped"; \
- test -z "$$report" || echo "$$report"; \
- echo "$$dashes$$std"; \
+ echo "$${col}$$dashes$${std}"; \
+ echo "$${col}$$banner$${std}"; \
+ test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \
+ test -z "$$report" || echo "$${col}$$report$${std}"; \
+ echo "$${col}$$dashes$${std}"; \
test "$$failed" -eq 0; \
else :; fi
@@ -597,10 +602,15 @@ install-am: all-am
installcheck: installcheck-am
install-strip:
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- `test -z '$(STRIP)' || \
- echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
mostlyclean-generic:
clean-generic:
diff --git a/src/audio/SDLAudioEngine.cpp b/src/audio/SDLAudioEngine.cpp
deleted file mode 100644
index e2f673c..0000000
--- a/src/audio/SDLAudioEngine.cpp
+++ /dev/null
@@ -1,228 +0,0 @@
-//
-// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 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 "SDLAudioEngine.h"
-#include "Dynamics.h"
-
-#include "../base/Exception.h"
-#include "../base/Logger.h"
-
-#include <iostream>
-
-namespace avg {
-
-using namespace std;
-using namespace boost;
-
-SDLAudioEngine* SDLAudioEngine::s_pInstance = 0;
-
-SDLAudioEngine* SDLAudioEngine::get()
-{
- return s_pInstance;
-}
-
-SDLAudioEngine::SDLAudioEngine()
- : m_pTempBuffer(),
- m_pMixBuffer(0),
- m_pLimiter(0)
-{
- AVG_ASSERT(s_pInstance == 0);
- if (SDL_InitSubSystem(SDL_INIT_AUDIO) == -1) {
- AVG_TRACE(Logger::ERROR, "Can't init SDL audio subsystem.");
- exit(-1);
- }
- s_pInstance = this;
-}
-
-SDLAudioEngine::~SDLAudioEngine()
-{
- if (m_pMixBuffer) {
- delete[] m_pMixBuffer;
- }
- SDL_QuitSubSystem(SDL_INIT_AUDIO);
-}
-
-int SDLAudioEngine::getChannels()
-{
- return m_AP.m_Channels;
-}
-
-int SDLAudioEngine::getSampleRate()
-{
- return m_AP.m_SampleRate;
-}
-
-const AudioParams * SDLAudioEngine::getParams()
-{
- if (isEnabled()) {
- return &m_AP;
- } else {
- return 0;
- }
-}
-
-void SDLAudioEngine::init(const AudioParams& ap, double volume)
-{
- AudioEngine::init(ap, volume);
- m_AP = ap;
- Dynamics<double, 2>* pLimiter = new Dynamics<double, 2>(m_AP.m_SampleRate);
- pLimiter->setThreshold(0.); // in dB
- pLimiter->setAttackTime(0.); // in seconds
- pLimiter->setReleaseTime(0.05); // in seconds
- pLimiter->setRmsTime(0.); // in seconds
- pLimiter->setRatio(std::numeric_limits<double>::infinity());
- pLimiter->setMakeupGain(0.); // 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;
-
- if (SDL_OpenAudio(&desired, 0) < 0) {
- //throw new Exception("Cannot open audio device");
- }
-}
-
-void SDLAudioEngine::teardown()
-{
- {
- mutex::scoped_lock Lock(m_Mutex);
- SDL_PauseAudio(1);
- }
- // Optimized away - takes too long.
-// SDL_CloseAudio();
-
- getSources().clear();
- if (m_pLimiter) {
- delete m_pLimiter;
- m_pLimiter = 0;
- }
-}
-
-void SDLAudioEngine::setAudioEnabled(bool bEnabled)
-{
- SDL_LockAudio();
- mutex::scoped_lock Lock(m_Mutex);
- AudioEngine::setAudioEnabled(bEnabled);
- SDL_UnlockAudio();
-}
-
-void SDLAudioEngine::play()
-{
- SDL_PauseAudio(0);
-}
-
-void SDLAudioEngine::pause()
-{
- SDL_PauseAudio(1);
-}
-
-void SDLAudioEngine::addSource(IAudioSource* pSource)
-{
- SDL_LockAudio();
- mutex::scoped_lock Lock(m_Mutex);
- AudioEngine::addSource(pSource);
- SDL_UnlockAudio();
-}
-
-void SDLAudioEngine::removeSource(IAudioSource* pSource)
-{
- SDL_LockAudio();
- mutex::scoped_lock Lock(m_Mutex);
- AudioEngine::removeSource(pSource);
- SDL_UnlockAudio();
-}
-
-void SDLAudioEngine::setVolume(double volume)
-{
- SDL_LockAudio();
- mutex::scoped_lock Lock(m_Mutex);
- AudioEngine::setVolume(volume);
- SDL_UnlockAudio();
-}
-
-void SDLAudioEngine::mixAudio(Uint8 *pDestBuffer, int destBufferLen)
-{
- int numFrames = destBufferLen/(2*getChannels()); // 16 bit samples.
-
- if (getSources().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 double[getChannels()*numFrames];
- }
-
- for (int i = 0; i < getChannels()*numFrames; ++i) {
- m_pMixBuffer[i]=0;
- }
- {
- mutex::scoped_lock Lock(m_Mutex);
- AudioSourceList::iterator it;
- for(it = getSources().begin(); it != getSources().end(); it++) {
- m_pTempBuffer->clear();
- (*it)->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 SDLAudioEngine::audioCallback(void *userData, Uint8 *audioBuffer, int audioBufferLen)
-{
- SDLAudioEngine *pThis = (SDLAudioEngine*)userData;
- pThis->mixAudio(audioBuffer, audioBufferLen);
-}
-
-void SDLAudioEngine::addBuffers(double *pDest, AudioBufferPtr pSrc)
-{
- int numFrames = pSrc->getNumFrames();
- short * pData = pSrc->getData();
- for(int i = 0; i < numFrames*getChannels(); ++i) {
- pDest[i] += pData[i]/32768.0;
- }
-}
-
-void SDLAudioEngine::calcVolume(double *pBuffer, int numSamples, double 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/SDLAudioEngine.h b/src/audio/SDLAudioEngine.h
deleted file mode 100644
index f7c33a2..0000000
--- a/src/audio/SDLAudioEngine.h
+++ /dev/null
@@ -1,78 +0,0 @@
-//
-// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 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 _SDLAudioEngine_H_
-#define _SDLAudioEngine_H_
-
-#include "../api.h"
-#include "AudioEngine.h"
-#include "AudioBuffer.h"
-#include "IProcessor.h"
-
-#include <SDL/SDL.h>
-
-#include <boost/thread/mutex.hpp>
-
-namespace avg {
-
-class AVG_API SDLAudioEngine : public AudioEngine
-{
- public:
- static SDLAudioEngine* get();
- SDLAudioEngine();
- virtual ~SDLAudioEngine();
-
- virtual int getChannels();
- virtual int getSampleRate();
- virtual const AudioParams * getParams();
-
- virtual void init(const AudioParams& AP, double volume);
- virtual void teardown();
-
- virtual void setAudioEnabled(bool bEnabled);
-
- virtual void play();
- virtual void pause();
-
- virtual void addSource(IAudioSource* pSource);
- virtual void removeSource(IAudioSource* pSource);
- virtual void setVolume(double volume);
-
- private:
- void mixAudio(Uint8 *pDestBuffer, int destBufferLen);
- static void audioCallback(void *userData, Uint8 *audioBuffer, int audioBufferLen);
- void addBuffers(double *pDest, AudioBufferPtr pSrc);
- void calcVolume(double *pBuffer, int numSamples, double volume);
-
- AudioParams m_AP;
- AudioBufferPtr m_pTempBuffer;
- double * m_pMixBuffer;
- IProcessor<double>* m_pLimiter;
- boost::mutex m_Mutex;
-
- static SDLAudioEngine* s_pInstance;
-};
-
-}
-
-#endif //_SDLAudioEngine_H_
diff --git a/src/audio/testlimiter.cpp b/src/audio/testlimiter.cpp
index 1813bef..5c3a515 100644
--- a/src/audio/testlimiter.cpp
+++ b/src/audio/testlimiter.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -40,24 +40,24 @@ public:
void runTests()
{
const int CHANNELS = 2;
- double fs = 44100.;
- int numSamples = int(fs * 0.1);
+ float fs = 44100.f;
+ int numSamples = int(fs * 0.1f);
// Setup a brickwall limiter
- typedef Dynamics<double, CHANNELS> TStereoLimiter;
+ typedef Dynamics<float, CHANNELS> TStereoLimiter;
TStereoLimiter* d = new TStereoLimiter(fs);
- d->setThreshold(0.); // in dB
- d->setAttackTime(0.); // in seconds
- d->setReleaseTime(0.05); // in seconds
- d->setRmsTime(0.); // in seconds
- d->setRatio(std::numeric_limits<double>::infinity());
- d->setMakeupGain(0.); // in dB
+ 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<float>::infinity());
+ d->setMakeupGain(0.f); // in dB
// Generate input and output test data
- double* pSamples = new double[CHANNELS*numSamples];
+ 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./44100)*M_PI);
+ pSamples[j*CHANNELS+i] = 2*sin(j*(440.f/44100)*float(M_PI));
}
}
@@ -75,7 +75,7 @@ public:
if (pSamples[j*CHANNELS+i] > 1) {
bAboveThreshold = true;
}
- if (fabs(pSamples[j*CHANNELS+i]-pSamples[(j-1)*CHANNELS+i]) > 0.05) {
+ 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;
diff --git a/src/avgconfig.h.in b/src/avgconfig.h.in
index 9868511..2ab5d1f 100644
--- a/src/avgconfig.h.in
+++ b/src/avgconfig.h.in
@@ -1,14 +1,23 @@
-/* src/avgconfig.h.in. Generated from configure.in by autoheader. */
+/* src/avgconfig.h.in. Generated from configure.ac by autoheader. */
/* Enable firewire camera support v.2 */
#undef AVG_ENABLE_1394_2
+/* Enable EGL support */
+#undef AVG_ENABLE_EGL
+
/* Enable Linux kernel multitouch */
#undef AVG_ENABLE_MTDEV
+/* Enable OpenGL support */
+#undef AVG_ENABLE_OPENGL
+
/* Enable parallel port support */
#undef AVG_ENABLE_PARPORT
+/* Build on RaspberryPi */
+#undef AVG_ENABLE_RPI
+
/* Enable Video4Linux2 camera support */
#undef AVG_ENABLE_V4L2
@@ -33,6 +42,9 @@
/* Define to 1 if you have the <libavformat/avformat.h> header file. */
#undef HAVE_LIBAVFORMAT_AVFORMAT_H
+/* Define to 1 if you have the `dl' library (-ldl). */
+#undef HAVE_LIBDL
+
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
@@ -42,6 +54,9 @@
/* Define if you have POSIX threads libraries and header files. */
#undef HAVE_PTHREAD
+/* If available, contains the Python version number currently in use. */
+#undef HAVE_PYTHON
+
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
diff --git a/src/avgconfigwrapper.h b/src/avgconfigwrapper.h
index 1e62d00..2408089 100644
--- a/src/avgconfigwrapper.h
+++ b/src/avgconfigwrapper.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/avgrc b/src/avgrc
index 4d4c063..3f93e5a 100644
--- a/src/avgrc
+++ b/src/avgrc
@@ -1,16 +1,42 @@
<avgrc>
<scr>
+ <gles>false</gles>
<bpp>24</bpp>
<fullscreen>false</fullscreen>
<usepow2textures>false</usepow2textures>
- <useshaders>true</useshaders>
<usepixelbuffers>true</usepixelbuffers>
<multisamplesamples>4</multisamplesamples>
<dotspermm>0</dotspermm>
+ <shaderusage>auto</shaderusage>
+ <videoaccel>true</videoaccel>
</scr>
<aud>
<channels>2</channels>
<samplerate>44100</samplerate>
<outputbuffersamples>1024</outputbuffersamples>
</aud>
+ <gesture>
+ <!-- Max finger movement in millimeters for tap, doubletap and hold gestures. -->
+ <maxtapdist>15</maxtapdist>
+ <!-- Maximum duration of one phase of a doubletap in milliseconds. -->
+ <maxdoubletaptime>300</maxdoubletaptime>
+ <!-- Swipe parameters -->
+ <minswipedist>50</minswipedist>
+ <swipedirectiontolerance>0.393</swipedirectiontolerance>
+ <maxswipecontactdist>100</maxswipecontactdist>
+ <!-- Min. time in milliseconds for a hold gesture. -->
+ <holddelay>900</holddelay>
+ <!-- Min. finger movement in millimeters for a drag. -->
+ <mindragdist>5</mindragdist>
+ <!-- Friction for drag and transform gestures with inertia. -1 means no friction. -->
+ <friction>-1</friction>
+ <!-- The following two parameters configure the jitter filter for transform
+ gestures. Use avg_jitterfilter.py to find correct values for your hardware. -->
+ <filtermincutoff>0.1</filtermincutoff>
+ <filterbeta>0.03</filterbeta>
+ </gesture>
+ <touch>
+ <area>0, 0</area>
+ <offset>0, 0</offset>
+ </touch>
</avgrc>
diff --git a/src/base/Backtrace.cpp b/src/base/Backtrace.cpp
index f6d1d77..2b85cde 100644
--- a/src/base/Backtrace.cpp
+++ b/src/base/Backtrace.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -21,6 +21,8 @@
#include "Backtrace.h"
+#include "StringHelper.h"
+
#ifndef _WIN32
#include <execinfo.h>
#include <cxxabi.h>
@@ -28,6 +30,7 @@
#include <stdlib.h>
#include <iostream>
+#include <stdio.h>
using namespace std;
@@ -38,12 +41,10 @@ void dumpBacktrace()
#ifndef _WIN32
vector<string> sFuncs;
getBacktrace(sFuncs);
- int i=0;
vector<string>::iterator it = sFuncs.begin();
++it;
for (; it != sFuncs.end(); ++it) {
- cerr << " " << i << ": " << *it << endl;
- i++;
+ cerr << " " << *it << endl;
}
#endif
}
@@ -67,7 +68,15 @@ string funcNameFromLine(const string& sLine)
}
}
-void getBacktrace(std::vector<std::string>& sFuncs)
+void consolidateRepeatedLines(vector<string>& 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<string>& sFuncs)
{
#ifndef _WIN32
void* callstack[128];
@@ -83,9 +92,27 @@ void getBacktrace(std::vector<std::string>& sFuncs)
sFuncName = pszDemangledFuncName;
free(pszDemangledFuncName);
}
- sFuncs.push_back(sFuncName);
+ 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
index cc49964..2eee387 100644
--- a/src/base/Backtrace.h
+++ b/src/base/Backtrace.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/base/BezierCurve.cpp b/src/base/BezierCurve.cpp
index 3d1ea72..7e5fb8e 100644
--- a/src/base/BezierCurve.cpp
+++ b/src/base/BezierCurve.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -21,14 +21,16 @@
#include "BezierCurve.h"
+#include "GLMHelper.h"
+
#include <iostream>
using namespace std;
namespace avg {
-BezierCurve::BezierCurve(const DPoint& p0, const DPoint& p1, const DPoint& p2,
- const DPoint& p3)
+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),
@@ -36,18 +38,19 @@ BezierCurve::BezierCurve(const DPoint& p0, const DPoint& p1, const DPoint& p2,
{
}
-DPoint BezierCurve::interpolate(double t) const
+glm::vec2 BezierCurve::interpolate(float t) const
{
- return (1-t)*(1-t)*(1-t)*m_P0+
- 3*t*(1-t)*(1-t) *m_P1+
- 3*t*t*(1-t) *m_P2+
- t*t*t *m_P3;
+ 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;
}
-DPoint BezierCurve::getDeriv(double t) const
+
+glm::vec2 BezierCurve::getDeriv(float t) const
{
- return 3*(m_P1-m_P0)*(1-t)*(1-t)+
- 6*(m_P2-m_P1)*(1-t)*t+
- 3*(m_P3-m_P2)*t*t;
+ 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
index b7e00f4..b2ec1dc 100644
--- a/src/base/BezierCurve.h
+++ b/src/base/BezierCurve.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -23,7 +23,8 @@
#define _BezierCurve_H_
#include "../api.h"
-#include "Point.h"
+
+#include "../glm/glm.hpp"
#include <boost/shared_ptr.hpp>
#include <vector>
@@ -32,16 +33,17 @@ namespace avg {
class AVG_API BezierCurve {
public:
- BezierCurve(const DPoint& p0, const DPoint& p1, const DPoint& p2, const DPoint& p3);
+ BezierCurve(const glm::vec2& p0, const glm::vec2& p1, const glm::vec2& p2,
+ const glm::vec2& p3);
- DPoint interpolate(double t) const;
- DPoint getDeriv(double t) const;
+ glm::vec2 interpolate(float t) const;
+ glm::vec2 getDeriv(float t) const;
private:
- DPoint m_P0;
- DPoint m_P1;
- DPoint m_P2;
- DPoint m_P3;
+ glm::vec2 m_P0;
+ glm::vec2 m_P1;
+ glm::vec2 m_P2;
+ glm::vec2 m_P3;
};
typedef boost::shared_ptr<BezierCurve> BezierCurvePtr;
diff --git a/src/base/CmdLine.cpp b/src/base/CmdLine.cpp
deleted file mode 100644
index d081ec5..0000000
--- a/src/base/CmdLine.cpp
+++ /dev/null
@@ -1,82 +0,0 @@
-//
-// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 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 "CmdLine.h"
-
-#include <iostream>
-
-using namespace std;
-
-namespace avg {
-
-CmdLine::CmdLine(int argc, char **argv)
-{
- for (int i = 1; i < argc; ++i) {
- string sArg(argv[i]);
- if (sArg.substr(0, 2) == "--") {
- string::size_type DelimPos = sArg.find('=');
- string sOptName;
- string sOptVal;
- if (DelimPos == sArg.npos) {
- sOptName = sArg.substr(2);
- sOptVal = "";
- } else {
- sOptName = sArg.substr(2, DelimPos-2);
- sOptVal = sArg.substr(DelimPos+1);
- }
- m_Options[sOptName] = sOptVal;
- } else {
- m_Args.push_back(sArg);
- }
- }
-}
-
-const OptionMap& CmdLine::getOptions() const
-{
- return m_Options;
-}
-
-const string* CmdLine::getOption(const string& sName) const
-{
- OptionMap::const_iterator it = m_Options.find(sName);
- if (it == m_Options.end()) {
- return 0;
- } else {
- return &(*it).second;
- }
-}
-
-int CmdLine::getNumArgs() const
-{
- return int(m_Args.size());
-}
-
-const string* CmdLine::getArg(unsigned int i) const
-{
- if (i>=m_Args.size()) {
- return 0;
- } else {
- return &m_Args[i];
- }
-}
-
-}
-
diff --git a/src/base/CmdQueue.h b/src/base/CmdQueue.h
index a2dc6a3..9d38f37 100644
--- a/src/base/CmdQueue.h
+++ b/src/base/CmdQueue.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -33,12 +33,19 @@ template<class RECEIVER>
class AVG_TEMPLATE_API CmdQueue: public Queue<Command<RECEIVER> >
{
public:
+ CmdQueue(int maxSize=-1);
typedef typename Queue<Command<RECEIVER> >::QElementPtr CmdPtr;
void pushCmd(typename Command<RECEIVER>::CmdFunc func);
};
template<class RECEIVER>
+CmdQueue<RECEIVER>::CmdQueue(int maxSize)
+ : Queue<Command<RECEIVER> >(maxSize)
+{
+}
+
+template<class RECEIVER>
void CmdQueue<RECEIVER>::pushCmd(typename Command<RECEIVER>::CmdFunc func)
{
this->push(CmdPtr(new Command<RECEIVER>(func)));
diff --git a/src/base/Command.h b/src/base/Command.h
index 79c48a6..fe18171 100644
--- a/src/base/Command.h
+++ b/src/base/Command.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/base/ConfigMgr.cpp b/src/base/ConfigMgr.cpp
index 04b756d..0414037 100644
--- a/src/base/ConfigMgr.cpp
+++ b/src/base/ConfigMgr.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -66,29 +66,45 @@ ConfigMgr* ConfigMgr::get()
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", "useshaders", "true");
addOption("scr", "usepixelbuffers", "true");
- addOption("scr", "multisamplesamples", "1");
+ 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) {
- AVG_TRACE(Logger::WARNING, "No home directory set.");
- } else {
+ if (pHome) {
loadFile(string(pHome)+"/."+m_sFName);
}
}
@@ -131,8 +147,8 @@ const string* ConfigMgr::getOption(const string& sSubsys,
}
}
-bool ConfigMgr::getBoolOption(const std::string& sSubsys,
- const std::string& sName, bool bDefault) const
+bool ConfigMgr::getBoolOption(const string& sSubsys,
+ const string& sName, bool bDefault) const
{
const string * psOption = getOption(sSubsys, sName);
if (psOption == 0) {
@@ -143,15 +159,14 @@ bool ConfigMgr::getBoolOption(const std::string& sSubsys,
} else if (*psOption == "false") {
return false;
} else {
- AVG_TRACE(Logger::ERROR,
- m_sFName << ": Unrecognized value for option "<<sName<<": "
+ AVG_LOG_ERROR(m_sFName << ": Unrecognized value for option " << sName << ": "
<< *psOption << ". Must be true or false. Aborting.");
exit(-1);
}
}
-int ConfigMgr::getIntOption(const std::string& sSubsys,
- const std::string& sName, int Default) const
+int ConfigMgr::getIntOption(const string& sSubsys,
+ const string& sName, int Default) const
{
errno = 0;
const string * psOption = getOption(sSubsys, sName);
@@ -161,30 +176,57 @@ int ConfigMgr::getIntOption(const std::string& sSubsys,
int Result = strtol(psOption->c_str(), 0, 10);
int rc = errno;
if (rc == EINVAL || rc == ERANGE) {
- AVG_TRACE(Logger::ERROR,
- m_sFName << ": Unrecognized value for option "<<sName<<": "
+ AVG_LOG_ERROR(m_sFName << ": Unrecognized value for option "<<sName<<": "
<< *psOption << ". Must be an integer. Aborting.");
exit(-1);
}
return Result;
}
-void ConfigMgr::getGammaOption(const std::string& sSubsys,
- const std::string& sName, double* Val) const
+void ConfigMgr::getGammaOption(const string& sSubsys,
+ const string& sName, float* Val) const
{
const string * psOption = getOption(sSubsys, sName);
if (psOption == 0) {
return;
}
- int rc = sscanf(psOption->c_str(), "%lf,%lf,%lf", Val, Val+1, Val+2);
+ int rc = sscanf(psOption->c_str(), "%f,%f,%f", Val, Val+1, Val+2);
if (rc < 3) {
- AVG_TRACE(Logger::ERROR,
- m_sFName << ": Unrecognized value for option "<<sName<<": "
+ AVG_LOG_ERROR(m_sFName << ": Unrecognized value for option "<<sName<<": "
<< *psOption << ". Must be three comma-separated numbers. Aborting.");
exit(-1);
}
}
+glm::vec2 ConfigMgr::getSizeOption(const string& sSubsys,
+ const string& sName) const
+{
+ const string * psOption = getOption(sSubsys, sName);
+ if (psOption == 0) {
+ return glm::vec2(0, 0);
+ }
+ float val[2];
+ int rc = sscanf(psOption->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;
@@ -194,8 +236,8 @@ bool ConfigMgr::loadFile(const std::string& sPath)
int err = access(sPath.c_str(), R_OK);
if (err == -1) {
if (errno == EACCES) {
- AVG_TRACE(Logger::WARNING,
- sPath+": File exists, but process doesn't have read permissions!");
+ AVG_LOG_WARNING(sPath+
+ ": File exists, but process doesn't have read permissions!");
}
return false;
}
@@ -215,8 +257,7 @@ bool ConfigMgr::loadFile(const std::string& sPath)
}
xmlNodePtr pRoot = xmlDocGetRootElement(doc);
if (xmlStrcmp(pRoot->name, (const xmlChar *)(m_sFName.c_str()))) {
- AVG_TRACE(Logger::ERROR,
- sPath+": Root node must be <"+m_sFName+">, found "
+ AVG_LOG_ERROR(sPath+": Root node must be <"+m_sFName+">, found "
<< pRoot->name << ". Aborting.");
exit(255);
}
@@ -228,8 +269,7 @@ bool ConfigMgr::loadFile(const std::string& sPath)
sSubsys = ((const char *)pSubsysNode->name);
xmlNodePtr pOptionNode = pSubsysNode->xmlChildrenNode;
if (!pOptionNode) {
- AVG_TRACE(Logger::ERROR,
- sPath << ": Option " << sSubsys
+ AVG_LOG_ERROR(sPath << ": Option " << sSubsys
<< " has no value. Ignoring.");
} else {
ConfigOptionVector& CurSubsys = getSubsys(sSubsys);
@@ -249,13 +289,12 @@ bool ConfigMgr::loadFile(const std::string& sPath)
} catch (Exception& e) {
switch (e.getCode()) {
case AVG_ERR_OPTION_SUBSYS_UNKNOWN:
- AVG_TRACE(Logger::ERROR, "While parsing " << sPath
- << ": Option group " << e.getStr() << " unknown. Aborting.");
+ AVG_LOG_ERROR("While parsing " << sPath << ": Option group " <<
+ e.getStr() << " unknown. Aborting.");
exit(255);
case AVG_ERR_OPTION_UNKNOWN:
- AVG_TRACE(Logger::ERROR, "While parsing " << sPath
- << ": Option " << sSubsys << ":" << e.getStr()
- << " unknown. Aborting.");
+ AVG_LOG_ERROR("While parsing " << sPath << ": Option " << sSubsys <<
+ ":" << e.getStr() << " unknown. Aborting.");
exit(255);
default:
throw;
diff --git a/src/base/ConfigMgr.h b/src/base/ConfigMgr.h
index 421c399..e2af8f1 100644
--- a/src/base/ConfigMgr.h
+++ b/src/base/ConfigMgr.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -23,8 +23,8 @@
#define _ConfigMgr_H_
#include "../api.h"
-#include "CmdLine.h"
+#include "GLMHelper.h"
#include <libxml/parser.h>
#include <string>
@@ -49,9 +49,8 @@ public:
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 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,
@@ -59,7 +58,12 @@ public:
int getIntOption(const std::string& sSubsys,
const std::string& sName, int Default) const;
void getGammaOption(const std::string& sSubsys,
- const std::string& sName, double* Val) const;
+ 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;
diff --git a/src/base/CubicSpline.cpp b/src/base/CubicSpline.cpp
index f03f7f5..105563d 100644
--- a/src/base/CubicSpline.cpp
+++ b/src/base/CubicSpline.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -21,6 +21,7 @@
#include "CubicSpline.h"
#include "Exception.h"
+#include "MathHelper.h"
#include <iostream>
@@ -28,61 +29,75 @@ using namespace std;
namespace avg {
-CubicSpline::CubicSpline(const vector<double>& x, const vector<double>& y)
- : m_X(x),
- m_Y(y)
+CubicSpline::CubicSpline(const vector<float>& x, const vector<float>& y, bool bLoop)
{
AVG_ASSERT(x.size() == y.size());
- // Add fake points before the first and after the last point so all derivatives
- // are defined.
- double edgeX = 2*m_X[0]-m_X[1];
- double edgeY = 2*m_Y[0]-m_Y[1];
- m_X.insert(m_X.begin(), edgeX);
- m_Y.insert(m_Y.begin(), edgeY);
+ for (unsigned i=0; i<x.size(); ++i) {
+ m_Pts.push_back(glm::vec2(x[i], y[i]));
+ }
+ init();
+}
- int len = m_X.size();
- edgeX = 2*m_X[len-1]-m_X[len-2];
- edgeY = 2*m_Y[len-1]-m_Y[len-2];
- m_X.push_back(edgeX);
- m_Y.push_back(edgeY);
+CubicSpline::CubicSpline(const vector<glm::vec2>& pts, bool bLoop)
+ : m_Pts(pts)
+{
+ init();
}
CubicSpline::~CubicSpline()
{
}
-double normedInterpolate(double y0, double y1, double y2, double y3, double mu)
+float CubicSpline::interpolate(float orig)
{
- double mu2 = mu*mu;
- double a0 = y3 - y2 - y0 + y1;
- double a1 = y0 - y1 - a0;
- double a2 = y2 - y0;
- double a3 = y1;
-
- return(a0*mu*mu2+a1*mu2+a2*mu+a3);
+ 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;
}
-
-double CubicSpline::interpolate(double orig)
+void CubicSpline::init()
{
- unsigned i = 0;
- if (m_X[m_X.size()-1] <= orig) {
- i = m_X.size();
- } else {
- while (m_X[i] < orig) {
- i++;
+ int len = m_Pts.size();
+ for (int i=1; i<len; ++i) {
+ if (m_Pts[i].x <= m_Pts[i-1].x) {
+ throw Exception(AVG_ERR_INVALID_ARGS,
+ "CubicSplines must have increasing x coordinates.");
}
}
- if (i < 2) {
- double dxdy = (m_X[1]-m_X[0])/(m_Y[1]-m_Y[0]);
- return m_Y[1]+(orig-m_X[1])/dxdy;
- } else if (i > m_X.size()-2) {
- unsigned len = m_X.size();
- double dxdy = (m_X[len-1]-m_X[len-2])/(m_Y[len-1]-m_Y[len-2]);
- return m_Y[len-2]+(orig-m_X[len-2])/dxdy;
- } else {
- double ratio = (orig-m_X[i-1])/(m_X[i]-m_X[i-1]);
- return normedInterpolate(m_Y[i-2], m_Y[i-1], m_Y[i], m_Y[i+1], ratio);
+ vector<float> u(len-1,0);
+ m_Y2.push_back(0.f);
+ u[0] = 0.f;
+ for (int i=1; i<len-1; ++i) {
+ float sig = (m_Pts[i].x-m_Pts[i-1].x) / (m_Pts[i+1].x-m_Pts[i-1].x);
+ float p = sig * m_Y2[i-1]+2.0f;
+ m_Y2.push_back((sig-1.0f)/p);
+ u[i] = (m_Pts[i+1].y-m_Pts[i].y) / (m_Pts[i+1].x-m_Pts[i].x) -
+ (m_Pts[i].y - m_Pts[i-1].y) / (m_Pts[i].x-m_Pts[i-1].x);
+ u[i] = (6.f*u[i]/(m_Pts[i+1].x-m_Pts[i-1].x) - sig*u[i-1]) / p;
+ }
+ float qn = 0.f;
+ float un = 0.f;
+
+ m_Y2.push_back((un-qn*u[len-2]) / (qn*m_Y2[len-2]-1.0f));
+
+ for (int i=len-2; 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
index 276f41c..a275413 100644
--- a/src/base/CubicSpline.h
+++ b/src/base/CubicSpline.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -23,6 +23,8 @@
#define _CubicSpline_H_
#include "../api.h"
+#include "../glm/glm.hpp"
+
#include <boost/shared_ptr.hpp>
#include <vector>
@@ -30,14 +32,18 @@ namespace avg {
class AVG_API CubicSpline {
public:
- CubicSpline(const std::vector<double>& x, const std::vector<double>& y);
+ CubicSpline(const std::vector<float>& x, const std::vector<float>& y,
+ bool bLoop=false);
+ CubicSpline(const std::vector<glm::vec2>& pts, bool bLoop=false);
virtual ~CubicSpline();
- double interpolate(double orig);
+ float interpolate(float orig);
private:
- std::vector<double> m_X;
- std::vector<double> m_Y;
+ void init();
+
+ std::vector<glm::vec2> m_Pts;
+ std::vector<float> m_Y2; // Second derivatives
};
typedef boost::shared_ptr<CubicSpline> CubicSplinePtr;
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 <boost/enable_shared_from_this.hpp>
+
+using namespace std;
+
+namespace avg {
+
+class AVG_API DAGNode: public boost::enable_shared_from_this<DAGNode>
+{
+public:
+ DAGNode(long vertexID, const std::set<long>& outgoingIDs);
+ void resolveIDs(DAG* pDAG);
+
+ long m_VertexID;
+ std::set<long> m_OutgoingIDs;
+ std::set<DAGNodePtr> m_pOutgoingNodes;
+ std::set<DAGNodePtr> m_pIncomingNodes;
+};
+
+
+DAGNode::DAGNode(long vertexID, const set<long>& outgoingIDs)
+{
+ m_VertexID = vertexID;
+ m_OutgoingIDs = outgoingIDs;
+}
+
+void DAGNode::resolveIDs(DAG* pDAG)
+{
+ set<long>::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<long>& outgoingIDs)
+{
+ DAGNode* pNode = new DAGNode(vertexID, outgoingIDs);
+ m_pNodes.insert(DAGNodePtr(pNode));
+}
+
+void DAG::sort(vector<long>& pResults)
+{
+ resolveIDs();
+ while (!m_pNodes.empty()) {
+ DAGNodePtr pCurNode = findStartNode(*m_pNodes.begin());
+ removeNode(pCurNode);
+ pResults.push_back(pCurNode->m_VertexID);
+ }
+}
+
+void DAG::resolveIDs()
+{
+ set<DAGNodePtr>::iterator it;
+ for (it=m_pNodes.begin(); it!=m_pNodes.end(); ++it) {
+ (*it)->resolveIDs(this);
+ }
+}
+
+DAGNodePtr DAG::findNode(long id)
+{
+ set<DAGNodePtr>::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<DAGNodePtr>::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 <set>
+#include <vector>
+#include <boost/shared_ptr.hpp>
+
+namespace avg {
+
+class DAG;
+class DAGNode;
+typedef boost::shared_ptr<DAGNode> 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<long>& outgoingIDs);
+ void sort(std::vector<long>& pResults);
+
+private:
+ friend class DAGNode;
+
+ void resolveIDs();
+ DAGNodePtr findNode(long pID);
+ void removeNode(DAGNodePtr pNode);
+ DAGNodePtr findStartNode(DAGNodePtr pNode, unsigned depth=0);
+
+ std::set<DAGNodePtr> m_pNodes;
+};
+
+}
+
+#endif
+
+
+
diff --git a/src/base/DirEntry.cpp b/src/base/DirEntry.cpp
index 7da4edb..c654e50 100644
--- a/src/base/DirEntry.cpp
+++ b/src/base/DirEntry.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/base/DirEntry.h b/src/base/DirEntry.h
index d23388d..ac2fca9 100644
--- a/src/base/DirEntry.h
+++ b/src/base/DirEntry.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/base/Directory.cpp b/src/base/Directory.cpp
index dda1e8d..bc40ecc 100644
--- a/src/base/Directory.cpp
+++ b/src/base/Directory.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/base/Directory.h b/src/base/Directory.h
index 1edb139..f75107d 100644
--- a/src/base/Directory.h
+++ b/src/base/Directory.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/base/DlfcnWrapper.cpp b/src/base/DlfcnWrapper.cpp
index 8dfbfbc..f8011b1 100644
--- a/src/base/DlfcnWrapper.cpp
+++ b/src/base/DlfcnWrapper.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/base/DlfcnWrapper.h b/src/base/DlfcnWrapper.h
index 4cc0e98..883fb37 100644
--- a/src/base/DlfcnWrapper.h
+++ b/src/base/DlfcnWrapper.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/base/Exception.cpp b/src/base/Exception.cpp
index e694320..eb4f03c 100644
--- a/src/base/Exception.cpp
+++ b/src/base/Exception.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -27,23 +27,29 @@
#include <cstdlib>
#include <sstream>
+#ifdef WIN32
+#include <intrin.h>
+#endif
+
using namespace std;
namespace avg {
Exception::Exception(int code, const string& sErr)
- : m_Code (code),
+ : std::exception(),
+ m_Code (code),
m_sErr (sErr)
{
}
Exception::Exception(const Exception& ex)
- : m_Code (ex.getCode()),
+ : std::exception(),
+ m_Code (ex.getCode()),
m_sErr (ex.getStr())
{
}
-Exception::~Exception()
+Exception::~Exception() throw()
{
}
@@ -57,23 +63,17 @@ const string& Exception::getStr() const
return m_sErr;
}
-void fatalError(const string& sMsg)
+const char* Exception::what() const throw()
{
- AVG_TRACE(Logger::ERROR, "Internal error: "+sMsg+" Aborting.");
- exit(-1);
+ return m_sErr.c_str();
}
void debugBreak()
{
#ifdef _WIN32
- __asm int 3;
-#elseifdef __x86_64
- asm("int $3");
-#elseifdef __i386__
- asm("int $3");
+ __debugbreak();
#else
- //deliberately dereferencing a null pointer should break in most debuggers
- *((char *)0) = 0;
+ __builtin_trap();
#endif
}
diff --git a/src/base/Exception.h b/src/base/Exception.h
index 1524cb5..b28dc1a 100644
--- a/src/base/Exception.h
+++ b/src/base/Exception.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -24,6 +24,7 @@
#include "../api.h"
#include <string>
+#include <exception>
#define AVG_ERR_UNKNOWN -1
#define AVG_ERR_XML_PARSE 1
@@ -57,24 +58,25 @@
#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
+class AVG_API Exception: public std::exception
{
public:
Exception(int code, const std::string& sErr = "");
Exception(const Exception& ex);
- virtual ~Exception();
+ 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 fatalError(const std::string& sMsg);
void AVG_API debugBreak();
void AVG_API avgAssert(bool b, const char * pszFile, int line, const char * pszReason=0);
diff --git a/src/base/FileHelper.cpp b/src/base/FileHelper.cpp
index 9e38e51..d9221c4 100644
--- a/src/base/FileHelper.cpp
+++ b/src/base/FileHelper.cpp
@@ -1,6 +1,6 @@
//
-// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -20,7 +20,6 @@
//
#include "FileHelper.h"
-#include "ConfigMgr.h"
#include "Exception.h"
#ifndef _WIN32
@@ -32,7 +31,9 @@
#include <sys/stat.h>
#include <string.h>
#include <unistd.h>
+#include <stdlib.h>
+#include <vector>
#include <map>
#include <cstring>
#include <iostream>
@@ -113,7 +114,7 @@ bool isAbsPath(const std::string& path)
#else
return path[0] == '/';
#endif
-
+
}
bool fileExists(const string& sFilename)
@@ -155,7 +156,7 @@ void writeWholeFile(const string& sFilename, const string& 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
index c5724f5..f367d0b 100644
--- a/src/base/FileHelper.h
+++ b/src/base/FileHelper.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -27,20 +27,20 @@
namespace avg {
-std::string getPath(const std::string& sFilename);
-std::string getFilenamePart(const std::string& sFilename);
-std::string getExtension(const std::string& sFilename);
-std::string getCWD();
+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 isAbsPath(const std::string& path);
+bool AVG_API isAbsPath(const std::string& path);
-bool fileExists(const std::string& sFilename);
+bool AVG_API fileExists(const std::string& sFilename);
-void readWholeFile(const std::string& sFilename, std::string& sContents);
+void AVG_API readWholeFile(const std::string& sFilename, std::string& sContents);
-void writeWholeFile(const std::string& sFilename, const std::string& sContent);
+void AVG_API writeWholeFile(const std::string& sFilename, const std::string& sContent);
-void copyFile(const std::string& sSourceFile, const std::string& sDestFile);
+void AVG_API copyFile(const std::string& sSourceFile, const std::string& sDestFile);
#ifdef WIN32
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<class NUM>
+bool almostEqual(const glm::detail::tvec2<NUM>& v1, const glm::detail::tvec2<NUM>& v2)
+{
+ return (fabs(v1.x-v2.x)+fabs(v1.y-v2.y)) < 0.0001;
+}
+
+template<class NUM>
+bool almostEqual(const glm::detail::tvec4<NUM>& v1, const glm::detail::tvec4<NUM>& 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<class NUM>
+std::ostream& operator<<( std::ostream& os, const glm::detail::tvec2<NUM> &v)
+{
+ os << "(" << v.x << "," << v.y << ")";
+ return os;
+}
+
+template<class NUM>
+std::ostream& operator<<( std::ostream& os, const glm::detail::tvec3<NUM> &v)
+{
+ os << "(" << v.x << "," << v.y << "," << v.z << ")";
+ return os;
+}
+
+template<class NUM>
+std::ostream& operator<<( std::ostream& os, const glm::detail::tvec4<NUM> &v)
+{
+ os << "(" << v.x << "," << v.y << "," << v.z << ", " << v.a << ")";
+ return os;
+}
+
+template<class NUM>
+std::ostream& operator<<( std::ostream& os, const glm::detail::tmat4x4<NUM> &m)
+{
+ os << "(" << m[0] << ", " << endl <<
+ m[1] << ", " << endl <<
+ m[2] << ", " << endl <<
+ m[3] << ", " << endl << ")";
+ return os;
+}
+
+template<class NUM>
+std::istream& operator>>(std::istream& is, glm::detail::tvec2<NUM>& p)
+{
+ skipToken(is, '(');
+ is >> p.x;
+ skipToken(is, ',');
+ is >> p.y;
+ skipToken(is, ')');
+ return is;
+}
+
+template<class NUM>
+std::istream& operator>>(std::istream& is, glm::detail::tvec3<NUM>& 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<int> &p);
+template AVG_TEMPLATE_API std::ostream& operator<<(std::ostream& os, const glm::detail::tvec2<float> &p);
+template AVG_TEMPLATE_API std::ostream& operator<<(std::ostream& os, const glm::detail::tvec2<double> &p);
+
+template AVG_TEMPLATE_API std::istream& operator>>(std::istream& is, glm::detail::tvec2<int>& p);
+template AVG_TEMPLATE_API std::istream& operator>>(std::istream& is, glm::detail::tvec2<float>& p);
+template AVG_TEMPLATE_API std::istream& operator>>(std::istream& is, glm::detail::tvec2<double>& p);
+
+template AVG_TEMPLATE_API std::ostream& operator<<(std::ostream& os, const glm::detail::tvec3<int> &p);
+template AVG_TEMPLATE_API std::ostream& operator<<(std::ostream& os, const glm::detail::tvec3<float> &p);
+template AVG_TEMPLATE_API std::ostream& operator<<(std::ostream& os, const glm::detail::tvec3<double> &p);
+
+template AVG_TEMPLATE_API std::istream& operator>>(std::istream& is, glm::detail::tvec3<int>& p);
+template AVG_TEMPLATE_API std::istream& operator>>(std::istream& is, glm::detail::tvec3<float>& p);
+template AVG_TEMPLATE_API std::istream& operator>>(std::istream& is, glm::detail::tvec3<double>& p);
+
+template AVG_TEMPLATE_API std::ostream& operator<<(std::ostream& os, const glm::detail::tvec4<int> &p);
+template AVG_TEMPLATE_API std::ostream& operator<<(std::ostream& os, const glm::detail::tvec4<float> &p);
+template AVG_TEMPLATE_API std::ostream& operator<<(std::ostream& os, const glm::detail::tvec4<double> &p);
+
+template AVG_TEMPLATE_API std::ostream& operator<<(std::ostream& os, const glm::detail::tmat4x4<float> &p);
+template AVG_TEMPLATE_API std::ostream& operator<<(std::ostream& os,
+ const glm::detail::tmat4x4<double> &p);
+
+template AVG_TEMPLATE_API bool almostEqual(const glm::detail::tvec2<float>& v1,
+ const glm::detail::tvec2<float>& v2);
+template AVG_TEMPLATE_API bool almostEqual(const glm::detail::tvec2<double>& v1,
+ const glm::detail::tvec2<double>& v2);
+template AVG_TEMPLATE_API bool almostEqual(const glm::detail::tvec4<float>& v1,
+ const glm::detail::tvec4<float>& v2);
+template AVG_TEMPLATE_API bool almostEqual(const glm::detail::tvec4<double>& v1,
+ const glm::detail::tvec4<double>& 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 <iostream>
+#include <vector>
+
+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<class NUM>
+bool almostEqual(const glm::detail::tvec2<NUM>& v1, const glm::detail::tvec2<NUM>& v2);
+template<class NUM>
+bool almostEqual(const glm::detail::tvec4<NUM>& v1, const glm::detail::tvec4<NUM>& v2);
+
+template<class NUM>
+std::ostream& operator<<(std::ostream& os, const glm::detail::tvec2<NUM> &v);
+template<class NUM>
+std::ostream& operator<<(std::ostream& os, const glm::detail::tvec3<NUM> &v);
+template<class NUM>
+std::ostream& operator<<(std::ostream& os, const glm::detail::tvec4<NUM> &v);
+template<class NUM>
+std::ostream& operator<<(std::ostream& os, const glm::detail::tmat4x4<NUM> &v);
+
+template<class NUM>
+std::istream& operator>>(std::istream& is, glm::detail::tvec2<NUM>& p);
+template<class NUM>
+std::istream& operator>>(std::istream& is, glm::detail::tvec3<NUM>& p);
+
+typedef glm::ivec2 IntPoint;
+typedef std::vector<glm::vec2> 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
index c1fa7a8..da167ad 100644
--- a/src/base/GeomHelper.cpp
+++ b/src/base/GeomHelper.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -28,31 +28,31 @@ using namespace std;
namespace avg {
-DLineSegment::DLineSegment(const DPoint& pt0, const DPoint& pt1)
+LineSegment::LineSegment(const glm::vec2& pt0, const glm::vec2& pt1)
: p0(pt0),
p1(pt1)
{
}
-bool DLineSegment::isPointOver(const DPoint& pt)
+bool LineSegment::isPointOver(const glm::vec2& pt)
{
- DPoint c = pt - p0; // DPoint from a to Point
- DPoint v = (p1 - p0);
- double d = v.getNorm(); // Length of the line segment
- v /= d; // Unit DPoint from a to b
- double t = dotProduct(v, c); // Intersection point Distance from a
+ 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 DLineSegment& l0, const DLineSegment& l1)
+bool lineSegmentsIntersect(const LineSegment& l0, const LineSegment& l1)
{
- double xdiff0 = l0.p1.x-l0.p0.x;
- double xdiff1 = l1.p0.x-l1.p1.x;
+ float xdiff0 = l0.p1.x-l0.p0.x;
+ float xdiff1 = l1.p0.x-l1.p1.x;
- double x1lo, x1hi;
+ float x1lo, x1hi;
/* X bound box test*/
if (xdiff0 < 0) {
@@ -72,10 +72,10 @@ bool lineSegmentsIntersect(const DLineSegment& l0, const DLineSegment& l1)
}
}
- double ydiff0 = l0.p1.y-l0.p0.y;
- double ydiff1 = l1.p0.y-l1.p1.y;
+ float ydiff0 = l0.p1.y-l0.p0.y;
+ float ydiff1 = l1.p0.y-l1.p1.y;
- double y1lo, y1hi;
+ float y1lo, y1hi;
/* Y bound box test*/
if (ydiff0 < 0) {
@@ -95,10 +95,10 @@ bool lineSegmentsIntersect(const DLineSegment& l0, const DLineSegment& l1)
}
}
- double Cx = l0.p0.x-l1.p0.x;
- double Cy = l0.p0.y-l1.p0.y;
- double d = ydiff1*Cx - xdiff1*Cy; /* alpha numerator*/
- double f = ydiff0*xdiff1 - xdiff0*ydiff1; /* both denominator*/
+ 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;
@@ -109,7 +109,7 @@ bool lineSegmentsIntersect(const DLineSegment& l0, const DLineSegment& l1)
}
}
- double e = xdiff0*Cy - ydiff0*Cx; /* beta numerator*/
+ float e = xdiff0*Cy - ydiff0*Cx; /* beta numerator*/
if(f > 0) { /* beta tests*/
if (e < 0 || e > f) {
return false;
@@ -127,7 +127,7 @@ bool lineSegmentsIntersect(const DLineSegment& l0, const DLineSegment& l1)
}
// /*compute intersection coordinates*/
-// double num = d*xdiff0; /* numerator */
+// float num = d*xdiff0; /* numerator */
// offset = SAME_SIGNS(num,f) ? f/2 : -f/2; /* round direction*/
// *x = x1 + (num+offset) / f; /* intersection x */
//
@@ -142,7 +142,7 @@ bool lineSegmentsIntersect(const DLineSegment& l0, const DLineSegment& l1)
// 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 DPoint& pt, const vector<DPoint>& poly)
+bool pointInPolygon(const glm::vec2& pt, const vector<glm::vec2>& poly)
{
if (poly.size() < 3) {
return false;
@@ -159,16 +159,16 @@ bool pointInPolygon(const DPoint& pt, const vector<DPoint>& poly)
return bPtInPoly;
}
-DPoint getLineLineIntersection(const DPoint& p1, const DPoint& v1, const DPoint& p2,
- const DPoint& v2)
+glm::vec2 getLineLineIntersection(const glm::vec2& p1, const glm::vec2& v1,
+ const glm::vec2& p2, const glm::vec2& v2)
{
- double denom = v2.y*v1.x-v2.x*v1.y;
+ 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;
}
- double numer = v2.x*(p1.y-p2.y) - v2.y*(p1.x-p2.x);
- double ua = numer/denom;
+ 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
index 272a8ef..5774231 100644
--- a/src/base/GeomHelper.h
+++ b/src/base/GeomHelper.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -23,27 +23,28 @@
#define _GeomHelper_H_
#include "../api.h"
-#include "Point.h"
+
+#include "../glm/glm.hpp"
#include <vector>
namespace avg {
-struct AVG_API DLineSegment {
+struct AVG_API LineSegment {
public:
- DLineSegment(const DPoint& pt0, const DPoint& pt1);
- DPoint p0;
- DPoint p1;
+ LineSegment(const glm::vec2& pt0, const glm::vec2& pt1);
+ glm::vec2 p0;
+ glm::vec2 p1;
- bool isPointOver(const DPoint& pt);
+ bool isPointOver(const glm::vec2& pt);
};
-bool AVG_API lineSegmentsIntersect(const DLineSegment& l0, const DLineSegment& l1);
+bool AVG_API lineSegmentsIntersect(const LineSegment& l0, const LineSegment& l1);
-bool AVG_API pointInPolygon(const DPoint& pt, const std::vector<DPoint>& poly);
+bool AVG_API pointInPolygon(const glm::vec2& pt, const std::vector<glm::vec2>& poly);
-DPoint AVG_API getLineLineIntersection(const DPoint& p1, const DPoint& v1, const DPoint& p2,
- const DPoint& v2);
+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
index 5f172d2..6147dbe 100644
--- a/src/base/IFrameEndListener.h
+++ b/src/base/IFrameEndListener.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
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 <time.h>
+#else
+#include <sys/time.h>
+#endif
+
+#include <boost/shared_ptr.hpp>
+
+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<ILogSink> LogSinkPtr;
+
+}
+
+#endif
diff --git a/src/base/IPlaybackEndListener.h b/src/base/IPlaybackEndListener.h
index 08d8c41..f505177 100644
--- a/src/base/IPlaybackEndListener.h
+++ b/src/base/IPlaybackEndListener.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/base/IPreRenderListener.h b/src/base/IPreRenderListener.h
index 5fe4d82..32c244e 100644
--- a/src/base/IPreRenderListener.h
+++ b/src/base/IPreRenderListener.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/base/Logger.cpp b/src/base/Logger.cpp
index 286f76c..dd7efe1 100644
--- a/src/base/Logger.cpp
+++ b/src/base/Logger.cpp
@@ -1,6 +1,6 @@
//
-// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -20,77 +20,104 @@
//
#include "Logger.h"
-
-#include "OSHelper.h"
#include "Exception.h"
+#include "StandardLogSink.h"
+#include "OSHelper.h"
+
+#include <boost/algorithm/string.hpp>
#ifdef _WIN32
#include <Winsock2.h>
-#undef ERROR
-#undef WARNING
#include <time.h>
#include <Mmsystem.h>
+#undef ERROR
#else
#include <sys/time.h>
#include <syslog.h>
#endif
#include <iostream>
#include <iomanip>
-#include <boost/thread.hpp>
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 long Logger::NONE=0;
-const long Logger::BLTS=1;
-const long Logger::PROFILE=2;
-const long Logger::PROFILE_LATEFRAMES=4;
-const long Logger::PROFILE_VIDEO=8;
-const long Logger::EVENTS=16;
-const long Logger::EVENTS2=32;
-const long Logger::CONFIG=64;
-const long Logger::WARNING=128;
-const long Logger::ERROR=256;
-const long Logger::MEMORY=512;
-const long Logger::APP=1024;
-const long Logger::PLUGIN=2048;
-const long Logger::PLAYER=4096;
-
-Logger* Logger::m_pLogger = 0;
-boost::mutex log_Mutex;
+ 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()
{
-
- if (!m_pLogger) {
- boost::mutex::scoped_lock Lock(log_Mutex);
- m_pLogger = new Logger;
+ lock_guard lock(s_logMutex);
+ if (!s_pLogger) {
+ s_pLogger = new Logger;
}
- return m_pLogger;
+ return s_pLogger;
}
Logger::Logger()
{
- m_Flags = ERROR | WARNING | APP;
+ 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) {
- m_Flags = ERROR | APP;
- bool bDone = false;
- string sCategory;
- do {
- string::size_type pos = sEnvCategories.find(":");
- if (pos == string::npos) {
- sCategory = sEnvCategories;
- bDone = true;
+ vector<string> sCategories;
+ ba::split(sCategories, sEnvCategories, ba::is_any_of(" "), ba::token_compress_on);
+ vector<string>::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 {
- sCategory = sEnvCategories.substr(0, pos);
- sEnvCategories = sEnvCategories.substr(pos+1);
+ vector<string> tmpValues;
+ ba::split( tmpValues, *it, ba::is_any_of(":"), ba::token_compress_on);
+ sCategory = tmpValues.at(0);
+ sSeverity = tmpValues.at(1);
}
- long category = stringToCategory(sCategory);
- m_Flags |= category;
- } while (!bDone);
+ 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);
}
}
@@ -98,116 +125,156 @@ Logger::~Logger()
{
}
-void Logger::setCategories(int flags)
+void Logger::addLogSink(const LogSinkPtr& logSink)
{
- boost::mutex::scoped_lock Lock(log_Mutex);
- m_Flags = flags | ERROR | WARNING;
+ lock_guard lock(s_sinkMutex);
+ m_pSinks.push_back(logSink);
}
-
-void Logger::pushCategories()
+
+void Logger::removeLogSink(const LogSinkPtr& logSink)
{
- m_FlagStack.push_back(m_Flags);
+ lock_guard lock(s_sinkMutex);
+ std::vector<LogSinkPtr>::iterator it;
+ it = find(m_pSinks.begin(), m_pSinks.end(), logSink);
+ if ( it != m_pSinks.end() ) {
+ m_pSinks.erase(it);
+ }
}
-void Logger::popCategories()
+void Logger::removeStdLogSink()
{
- if (m_FlagStack.empty()) {
- throw Exception(AVG_ERR_OUT_OF_RANGE, "popCategories: Nothing to pop.");
+ lock_guard lock(s_removeStdSinkMutex);
+ if ( m_pStdSink.get()) {
+ removeLogSink(m_pStdSink);
+ m_pStdSink = LogSinkPtr();
}
- m_Flags = m_FlagStack.back();
- m_FlagStack.pop_back();
}
-void Logger::trace(int category, const UTF8String& sMsg)
+category_t Logger::configureCategory(category_t category, severity_t severity)
{
- boost::mutex::scoped_lock Lock(log_Mutex);
- if (category & m_Flags) {
- 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
- char timeString[256];
- strftime(timeString, sizeof(timeString), "%y-%m-%d %H:%M:%S", pTime);
- cerr << "[" << timeString << "." <<
- setw(3) << setfill('0') << millis << setw(0) << "] ";
- cerr << categoryToString(category) << ": ";
- cerr << sMsg << endl;
- cerr.flush();
+ 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<const category_t, const severity_t> 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<LogSinkPtr>::const_iterator it;
+ for(it=m_pSinks.begin(); it!=m_pSinks.end(); ++it){
+ (*it)->logMessage(pTime, millis, category, severity, sMsg);
}
}
-const char * Logger::categoryToString(int category)
-{
- switch(category) {
- case BLTS:
- return "BLTS";
- case PROFILE:
- case PROFILE_LATEFRAMES:
- case PROFILE_VIDEO:
- return "PROFILE";
- case EVENTS:
- case EVENTS2:
- return "EVENTS";
- case CONFIG:
- return "CONFIG";
- case WARNING:
- return "WARNING";
- case ERROR:
- return "ERROR";
- case MEMORY:
- return "MEMORY";
- case APP:
- return "APP";
- case PLUGIN:
- return "PLUGIN";
- case PLAYER:
- return "PLAYER";
- default:
- return "UNKNOWN";
+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");
}
-int Logger::stringToCategory(const string& sCategory)
-{
- if (sCategory == "BLTS") {
- return BLTS;
- } else if (sCategory == "PROFILE") {
- return PROFILE;
- } else if (sCategory == "PROFILE_LATEFRAMES") {
- return PROFILE_LATEFRAMES;
- } else if (sCategory == "PROFILE_VIDEO") {
- return PROFILE_VIDEO;
- } else if (sCategory == "EVENTS") {
- return EVENTS;
- } else if (sCategory == "EVENTS2") {
- return EVENTS2;
- } else if (sCategory == "CONFIG") {
- return CONFIG;
- } else if (sCategory == "WARNING") {
- return WARNING;
- } else if (sCategory == "ERROR") {
- return ERROR;
- } else if (sCategory == "MEMORY") {
- return MEMORY;
- } else if (sCategory == "APP") {
- return APP;
- } else if (sCategory == "PLUGIN") {
- return PLUGIN;
- } else if (sCategory == "PLAYER") {
- return PLAYER;
- } else {
- throw Exception (AVG_ERR_INVALID_ARGS, "Unknown logger category " + sCategory
- + " set using AVG_LOG_CATEGORIES.");
+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
index 34be8b8..197c0c2 100644
--- a/src/base/Logger.h
+++ b/src/base/Logger.h
@@ -1,6 +1,6 @@
//
-// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -19,68 +19,136 @@
// Current versions can be found at www.libavg.de
//
-#ifndef _Logger_H_
+#ifndef _Logger_H_
#define _Logger_H_
-#include "../api.h"
+#include "Exception.h"
+#include "ILogSink.h"
#include "UTF8String.h"
+#include "ThreadHelper.h"
+#include "../api.h"
+
+#include <boost/noncopyable.hpp>
+#include <boost/functional/hash.hpp>
+#include <boost/unordered_map.hpp>
#include <string>
#include <vector>
#include <sstream>
-namespace avg {
-
#ifdef ERROR
#undef ERROR
#endif
-class AVG_API Logger {
+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();
-
- void setCategories(int flags);
- void pushCategories();
- void popCategories();
- void trace(int category, const UTF8String& sMsg);
- inline bool isFlagSet(int category) {
- return (category & m_Flags) != 0;
- }
- static const long NONE;
- static const long BLTS;
- static const long PROFILE;
- static const long PROFILE_LATEFRAMES;
- static const long PROFILE_VIDEO;
- static const long EVENTS;
- static const long EVENTS2;
- static const long CONFIG;
- static const long WARNING;
- static const long ERROR;
- static const long MEMORY;
- static const long APP;
- static const long PLUGIN;
- static const long PLAYER;
+ 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();
- static const char * categoryToString(int category);
- int stringToCategory(const std::string& sCategory);
-
- static Logger* m_pLogger;
+ void setupCategory();
- int m_Flags;
- std::vector<int> m_FlagStack;
+ std::vector<LogSinkPtr> m_pSinks;
+ LogSinkPtr m_pStdSink;
+ CatToSeverityMap m_CategorySeverities;
+ severity_t m_Severity;
+ static boost::mutex m_CategoryMutex;
};
-#define AVG_TRACE(category, sMsg) { \
- if (Logger::get()->isFlagSet(category)) { \
- std::stringstream tmp(std::stringstream::in | std::stringstream::out); \
- tmp << sMsg; \
- Logger::get()->trace(category, tmp.str()); \
+#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
index 5fe4c94..ce995f2 100644
--- a/src/base/Makefile.am
+++ b/src/base/Makefile.am
@@ -1,31 +1,35 @@
+SUBDIRS = triangulate
-INCLUDES = -I.. @XML2_CFLAGS@ @PTHREAD_CFLAGS@
-ALL_H = FileHelper.h CmdLine.h Exception.h Logger.h ConfigMgr.h ObjectCounter.h \
+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 \
- Point.h Rect.h Directory.h DirEntry.h StringHelper.h MathHelper.h GeomHelper.h \
- CubicSpline.h BezierCurve.h UTF8String.h Triangle.h \
- Triangulate.h WideLine.h Triple.h DlfcnWrapper.h Signal.h Backtrace.h \
- CmdQueue.h Matrix3x4.h ProfilingZoneID.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
+TESTS = testbase
EXTRA_DIST = DlfcnWrapper.cpp
noinst_LTLIBRARIES = libbase.la
-libbase_la_SOURCES = FileHelper.cpp CmdLine.cpp Exception.cpp Logger.cpp \
+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 Point.cpp Directory.cpp DirEntry.cpp \
+ TestSuite.cpp ObjectCounter.cpp Directory.cpp DirEntry.cpp \
StringHelper.cpp MathHelper.cpp GeomHelper.cpp CubicSpline.cpp \
- BezierCurve.cpp UTF8String.cpp Triangle.cpp Triangulate.cpp WideLine.cpp \
- Triple.cpp Backtrace.cpp Matrix3x4.cpp ProfilingZoneID.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 -l@BOOST_THREAD_LIB@ -lboost_system @PTHREAD_LIBS@
+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/Makefile.in b/src/base/Makefile.in
index cc935b7..2383ebb 100644
--- a/src/base/Makefile.in
+++ b/src/base/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# Makefile.in generated by automake 1.11.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
-# Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -44,11 +44,12 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ac_cxx_namespaces.m4 \
$(top_srcdir)/m4/ac_path_generic.m4 \
$(top_srcdir)/m4/ax_boost_thread.m4 \
- $(top_srcdir)/m4/ax_check_gl.m4 $(top_srcdir)/m4/libtool.m4 \
- $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
- $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
- $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/m4/python_dev.m4 \
- $(top_srcdir)/configure.in
+ $(top_srcdir)/m4/ax_check_gl.m4 \
+ $(top_srcdir)/m4/ax_python_devel.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/pkg.m4 \
+ $(top_srcdir)/m4/avg_version.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
@@ -58,22 +59,22 @@ CONFIG_CLEAN_VPATH_FILES =
LTLIBRARIES = $(noinst_LTLIBRARIES)
libbase_la_LIBADD =
am__objects_1 =
-am_libbase_la_OBJECTS = FileHelper.lo CmdLine.lo Exception.lo \
- Logger.lo ConfigMgr.lo XMLHelper.lo TimeSource.lo OSHelper.lo \
+am_libbase_la_OBJECTS = FileHelper.lo Exception.lo Logger.lo \
+ ConfigMgr.lo XMLHelper.lo TimeSource.lo OSHelper.lo \
ProfilingZone.lo ThreadProfiler.lo ScopeTimer.lo Test.lo \
- TestSuite.lo ObjectCounter.lo Point.lo Directory.lo \
- DirEntry.lo StringHelper.lo MathHelper.lo GeomHelper.lo \
- CubicSpline.lo BezierCurve.lo UTF8String.lo Triangle.lo \
- Triangulate.lo WideLine.lo Triple.lo Backtrace.lo Matrix3x4.lo \
- ProfilingZoneID.lo $(am__objects_1)
+ TestSuite.lo ObjectCounter.lo Directory.lo DirEntry.lo \
+ StringHelper.lo MathHelper.lo GeomHelper.lo CubicSpline.lo \
+ BezierCurve.lo UTF8String.lo Triangle.lo DAG.lo WideLine.lo \
+ Backtrace.lo ProfilingZoneID.lo GLMHelper.lo WorkerThread.lo \
+ StandardLogSink.lo ThreadHelper.lo $(am__objects_1)
libbase_la_OBJECTS = $(am_libbase_la_OBJECTS)
-AM_V_lt = $(am__v_lt_$(V))
-am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
am__v_lt_0 = --silent
PROGRAMS = $(noinst_PROGRAMS)
am_testbase_OBJECTS = testbase.$(OBJEXT) $(am__objects_1)
testbase_OBJECTS = $(am_testbase_OBJECTS)
-testbase_DEPENDENCIES = ./libbase.la
+testbase_DEPENDENCIES = ./libbase.la ./triangulate/libtriangulate.la
testbase_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
$(CXXFLAGS) $(testbase_LDFLAGS) $(LDFLAGS) -o $@
@@ -87,18 +88,18 @@ LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CXXFLAGS) $(CXXFLAGS)
-AM_V_CXX = $(am__v_CXX_$(V))
-am__v_CXX_ = $(am__v_CXX_$(AM_DEFAULT_VERBOSITY))
+AM_V_CXX = $(am__v_CXX_@AM_V@)
+am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@)
am__v_CXX_0 = @echo " CXX " $@;
-AM_V_at = $(am__v_at_$(V))
-am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
CXXLD = $(CXX)
CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
$(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
-AM_V_CXXLD = $(am__v_CXXLD_$(V))
-am__v_CXXLD_ = $(am__v_CXXLD_$(AM_DEFAULT_VERBOSITY))
+AM_V_CXXLD = $(am__v_CXXLD_@AM_V@)
+am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@)
am__v_CXXLD_0 = @echo " CXXLD " $@;
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@@ -106,26 +107,64 @@ LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
-AM_V_CC = $(am__v_CC_$(V))
-am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
+AM_V_CC = $(am__v_CC_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
am__v_CC_0 = @echo " CC " $@;
CCLD = $(CC)
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
-AM_V_CCLD = $(am__v_CCLD_$(V))
-am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
-AM_V_GEN = $(am__v_GEN_$(V))
-am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
SOURCES = $(libbase_la_SOURCES) $(testbase_SOURCES)
DIST_SOURCES = $(libbase_la_SOURCES) $(testbase_SOURCES)
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-dvi-recursive install-exec-recursive \
+ install-html-recursive install-info-recursive \
+ install-pdf-recursive install-ps-recursive install-recursive \
+ installcheck-recursive installdirs-recursive pdf-recursive \
+ ps-recursive uninstall-recursive
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
+ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
+ distdir
ETAGS = etags
CTAGS = ctags
am__tty_colors = \
red=; grn=; lgn=; blu=; std=
+DIST_SUBDIRS = $(SUBDIRS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+am__relativize = \
+ dir0=`pwd`; \
+ sed_first='s,^\([^/]*\)/.*$$,\1,'; \
+ sed_rest='s,^[^/]*/*,,'; \
+ sed_last='s,^.*/\([^/]*\)$$,\1,'; \
+ sed_butlast='s,/*[^/]*$$,,'; \
+ while test -n "$$dir1"; do \
+ first=`echo "$$dir1" | sed -e "$$sed_first"`; \
+ if test "$$first" != "."; then \
+ if test "$$first" = ".."; then \
+ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
+ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
+ else \
+ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
+ if test "$$first2" = "$$first"; then \
+ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
+ else \
+ dir2="../$$dir2"; \
+ fi; \
+ dir0="$$dir0"/"$$first"; \
+ fi; \
+ fi; \
+ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
+ done; \
+ reldir="$$dir2"
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
@@ -135,7 +174,7 @@ AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BOOST_PYTHON_LIBS = @BOOST_PYTHON_LIBS@
-BOOST_THREAD_LIB = @BOOST_THREAD_LIB@
+BOOST_THREAD_LIBS = @BOOST_THREAD_LIBS@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
@@ -150,6 +189,7 @@ DC1394_2_CFLAGS = @DC1394_2_CFLAGS@
DC1394_2_LIBS = @DC1394_2_LIBS@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
@@ -190,6 +230,7 @@ LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
MTDEV_CFLAGS = @MTDEV_CFLAGS@
MTDEV_LIBS = @MTDEV_LIBS@
@@ -219,11 +260,13 @@ PTHREAD_CC = @PTHREAD_CC@
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
PTHREAD_LIBS = @PTHREAD_LIBS@
PYTHON = @PYTHON@
+PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@
PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
-PYTHON_INCLUDES = @PYTHON_INCLUDES@
-PYTHON_LIBS = @PYTHON_LIBS@
+PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@
+PYTHON_LDFLAGS = @PYTHON_LDFLAGS@
PYTHON_PLATFORM = @PYTHON_PLATFORM@
PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_SITE_PKG = @PYTHON_SITE_PKG@
PYTHON_VERSION = @PYTHON_VERSION@
RANLIB = @RANLIB@
SDL_CFLAGS = @SDL_CFLAGS@
@@ -246,6 +289,7 @@ abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
@@ -280,7 +324,6 @@ libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
@@ -304,33 +347,38 @@ target_vendor = @target_vendor@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-INCLUDES = -I.. @XML2_CFLAGS@ @PTHREAD_CFLAGS@
-ALL_H = FileHelper.h CmdLine.h Exception.h Logger.h ConfigMgr.h ObjectCounter.h \
+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 \
- Point.h Rect.h Directory.h DirEntry.h StringHelper.h MathHelper.h GeomHelper.h \
- CubicSpline.h BezierCurve.h UTF8String.h Triangle.h \
- Triangulate.h WideLine.h Triple.h DlfcnWrapper.h Signal.h Backtrace.h \
- CmdQueue.h Matrix3x4.h ProfilingZoneID.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
EXTRA_DIST = DlfcnWrapper.cpp
noinst_LTLIBRARIES = libbase.la
-libbase_la_SOURCES = FileHelper.cpp CmdLine.cpp Exception.cpp Logger.cpp \
+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 Point.cpp Directory.cpp DirEntry.cpp \
+ TestSuite.cpp ObjectCounter.cpp Directory.cpp DirEntry.cpp \
StringHelper.cpp MathHelper.cpp GeomHelper.cpp CubicSpline.cpp \
- BezierCurve.cpp UTF8String.cpp Triangle.cpp Triangulate.cpp WideLine.cpp \
- Triple.cpp Backtrace.cpp Matrix3x4.cpp ProfilingZoneID.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
testbase_SOURCES = testbase.cpp $(ALL_H)
-testbase_LDADD = ./libbase.la -l@BOOST_THREAD_LIB@ @PTHREAD_LIBS@
+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
-all: all-am
+all: all-recursive
.SUFFIXES:
.SUFFIXES: .cpp .lo .o .obj
@@ -373,7 +421,7 @@ clean-noinstLTLIBRARIES:
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
-libbase.la: $(libbase_la_OBJECTS) $(libbase_la_DEPENDENCIES)
+libbase.la: $(libbase_la_OBJECTS) $(libbase_la_DEPENDENCIES) $(EXTRA_libbase_la_DEPENDENCIES)
$(AM_V_CXXLD)$(CXXLINK) $(libbase_la_OBJECTS) $(libbase_la_LIBADD) $(LIBS)
clean-noinstPROGRAMS:
@@ -384,7 +432,7 @@ clean-noinstPROGRAMS:
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
echo " rm -f" $$list; \
rm -f $$list
-testbase$(EXEEXT): $(testbase_OBJECTS) $(testbase_DEPENDENCIES)
+testbase$(EXEEXT): $(testbase_OBJECTS) $(testbase_DEPENDENCIES) $(EXTRA_testbase_DEPENDENCIES)
@rm -f testbase$(EXEEXT)
$(AM_V_CXXLD)$(testbase_LINK) $(testbase_OBJECTS) $(testbase_LDADD) $(LIBS)
@@ -396,59 +444,56 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Backtrace.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BezierCurve.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CmdLine.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ConfigMgr.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CubicSpline.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DAG.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DirEntry.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Directory.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Exception.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FileHelper.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GLMHelper.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GeomHelper.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Logger.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MathHelper.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Matrix3x4.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OSHelper.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ObjectCounter.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Point.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ProfilingZone.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ProfilingZoneID.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ScopeTimer.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/StandardLogSink.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/StringHelper.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Test.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TestSuite.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ThreadHelper.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ThreadProfiler.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TimeSource.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Triangle.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Triangulate.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Triple.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/UTF8String.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/WideLine.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/WorkerThread.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/XMLHelper.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testbase.Po@am__quote@
.cpp.o:
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $<
.cpp.obj:
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
.cpp.lo:
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
-@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
@@ -456,6 +501,76 @@ mostlyclean-libtool:
clean-libtool:
-rm -rf .libs _libs
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @fail= failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+ @fail= failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
@@ -466,10 +581,23 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
mkid -fID $$unique
tags: TAGS
-TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
set x; \
here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
@@ -488,7 +616,7 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
fi; \
fi
ctags: CTAGS
-CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
@@ -589,14 +717,15 @@ check-TESTS: $(TESTS)
fi; \
dashes=`echo "$$dashes" | sed s/./=/g`; \
if test "$$failed" -eq 0; then \
- echo "$$grn$$dashes"; \
+ col="$$grn"; \
else \
- echo "$$red$$dashes"; \
+ col="$$red"; \
fi; \
- echo "$$banner"; \
- test -z "$$skipped" || echo "$$skipped"; \
- test -z "$$report" || echo "$$report"; \
- echo "$$dashes$$std"; \
+ echo "$${col}$$dashes$${std}"; \
+ echo "$${col}$$banner$${std}"; \
+ test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \
+ test -z "$$report" || echo "$${col}$$report$${std}"; \
+ echo "$${col}$$dashes$${std}"; \
test "$$failed" -eq 0; \
else :; fi
@@ -630,25 +759,59 @@ distdir: $(DISTFILES)
|| exit 1; \
fi; \
done
+ @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
+ fi; \
+ done
+ @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
+ $(am__relativize); \
+ new_distdir=$$reldir; \
+ dir1=$$subdir; dir2="$(top_distdir)"; \
+ $(am__relativize); \
+ new_top_distdir=$$reldir; \
+ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
+ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
+ ($(am__cd) $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$new_top_distdir" \
+ distdir="$$new_distdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ am__skip_mode_fix=: \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
check-am: all-am
$(MAKE) $(AM_MAKEFLAGS) check-TESTS
-check: check-am
+check: check-recursive
all-am: Makefile $(LTLIBRARIES) $(PROGRAMS)
-installdirs:
-install: install-am
-install-exec: install-exec-am
-install-data: install-data-am
-uninstall: uninstall-am
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-installcheck: installcheck-am
+installcheck: installcheck-recursive
install-strip:
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- `test -z '$(STRIP)' || \
- echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
mostlyclean-generic:
clean-generic:
@@ -660,92 +823,94 @@ distclean-generic:
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
-clean: clean-am
+clean: clean-recursive
clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
clean-noinstPROGRAMS mostlyclean-am
-distclean: distclean-am
+distclean: distclean-recursive
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
-dvi: dvi-am
+dvi: dvi-recursive
dvi-am:
-html: html-am
+html: html-recursive
html-am:
-info: info-am
+info: info-recursive
info-am:
install-data-am:
-install-dvi: install-dvi-am
+install-dvi: install-dvi-recursive
install-dvi-am:
install-exec-am:
-install-html: install-html-am
+install-html: install-html-recursive
install-html-am:
-install-info: install-info-am
+install-info: install-info-recursive
install-info-am:
install-man:
-install-pdf: install-pdf-am
+install-pdf: install-pdf-recursive
install-pdf-am:
-install-ps: install-ps-am
+install-ps: install-ps-recursive
install-ps-am:
installcheck-am:
-maintainer-clean: maintainer-clean-am
+maintainer-clean: maintainer-clean-recursive
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
-mostlyclean: mostlyclean-am
+mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
-pdf: pdf-am
+pdf: pdf-recursive
pdf-am:
-ps: ps-am
+ps: ps-recursive
ps-am:
uninstall-am:
-.MAKE: check-am install-am install-strip
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) check-am \
+ ctags-recursive install-am install-strip tags-recursive
-.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \
- clean-generic clean-libtool clean-noinstLTLIBRARIES \
- clean-noinstPROGRAMS ctags distclean distclean-compile \
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+ all all-am check check-TESTS check-am clean clean-generic \
+ clean-libtool clean-noinstLTLIBRARIES clean-noinstPROGRAMS \
+ ctags ctags-recursive distclean distclean-compile \
distclean-generic distclean-libtool distclean-tags distdir dvi \
dvi-am html html-am info info-am install install-am \
install-data install-data-am install-dvi install-dvi-am \
install-exec install-exec-am install-html install-html-am \
install-info install-info-am install-man install-pdf \
install-pdf-am install-ps install-ps-am install-strip \
- installcheck installcheck-am installdirs maintainer-clean \
- maintainer-clean-generic mostlyclean mostlyclean-compile \
- mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
- tags uninstall uninstall-am
+ installcheck installcheck-am installdirs installdirs-am \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags tags-recursive uninstall uninstall-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
diff --git a/src/base/MathHelper.cpp b/src/base/MathHelper.cpp
index ea7093e..388859d 100644
--- a/src/base/MathHelper.cpp
+++ b/src/base/MathHelper.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -35,27 +35,17 @@ bool ispow2(int n)
int nextpow2(int n)
{
- int ret=1;
- while (ret < n) {
- ret *= 2;
- }
- return ret;
-/* TODO: Fix this fast version :-).
- int RetVal = 1;
- __asm__ __volatile__(
- "xorl %%ecx, %%ecx\n\t"
- "bsrl %1, %%ecx\n\t"
- "incl %%ecx\n\t"
- "shlb %%cl, %0\n\t"
- : "=m" (RetVal)
- : "m" (n)
- : "cc", "ecx"
- );
- return RetVal;
-*/
+ 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(double d)
+int safeCeil(float d)
{
if (fabs(d-int(d)) < EPSILON) {
return int(d);
@@ -80,7 +70,7 @@ float invSqrt(float x)
return 1/sqrt(x);
}
-bool almostEqual(double d1, double d2, double epsilon)
+bool almostEqual(float d1, float d2, float epsilon)
{
return (fabs(d1-d2)<epsilon);
}
diff --git a/src/base/MathHelper.h b/src/base/MathHelper.h
index 16132c4..587ff2c 100644
--- a/src/base/MathHelper.h
+++ b/src/base/MathHelper.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -24,6 +24,7 @@
#include "../api.h"
#include <vector>
+#include <set>
#include <math.h>
#ifndef M_PI
@@ -32,15 +33,16 @@
namespace avg {
-static const double EPSILON = 0.00001;
+static const float PI = 3.14159265358979323846f;
+static const float EPSILON = 0.00001f;
bool ispow2(int n);
int nextpow2(int n);
-int safeCeil(double d);
+int safeCeil(float d);
-bool almostEqual(double d1, double d2, double epsilon=EPSILON);
+bool almostEqual(float d1, float d2, float epsilon=EPSILON);
float invSqrt(float x);
@@ -82,7 +84,7 @@ std::vector<std::vector<T> > vector2DFromCArray(int n, int m, T* pData)
template<class T>
T round(T d)
{
- return floor( d + 0.5 );
+ return floor(d + 0.5f);
}
#endif
diff --git a/src/base/Matrix3x4.cpp b/src/base/Matrix3x4.cpp
deleted file mode 100644
index e065d2b..0000000
--- a/src/base/Matrix3x4.cpp
+++ /dev/null
@@ -1,128 +0,0 @@
-//
-// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 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 "Matrix3x4.h"
-#include "MathHelper.h"
-
-#include <math.h>
-
-using namespace std;
-
-namespace avg {
-
-Matrix3x4::Matrix3x4()
-{
- setIdent();
-}
-
-Matrix3x4::Matrix3x4(const float *v)
-{
- for (int x=0; x<3; ++x) {
- for (int y=0; y<4; ++y) {
- val[x][y] = v[x*4+y];
- }
- }
-}
-
-Matrix3x4 Matrix3x4::createTranslate(float x, float y, float z)
-{
- Matrix3x4 mat;
- mat.val[0][3] = x;
- mat.val[1][3] = y;
- mat.val[2][3] = z;
- return mat;
-}
-
-Matrix3x4 Matrix3x4::createTranslate(const DTriple& tr)
-{
- return createTranslate(float(tr.x), float(tr.y), float(tr.z));
-}
-
-Matrix3x4 Matrix3x4::createScale(float x, float y, float z)
-{
- Matrix3x4 mat;
- mat.val[0][0] = x;
- mat.val[1][1] = y;
- mat.val[2][2] = z;
- return mat;
-}
-
-Matrix3x4 Matrix3x4::createScale(const DTriple& tr)
-{
- return createScale(float(tr.x), float(tr.y), float(tr.z));
-}
-
-const Matrix3x4& Matrix3x4::operator *=(const Matrix3x4& mat)
-{
- for (int x=0; x<3; ++x) {
- float t0 = val[x][0] * mat.val[0][0] + val[x][1] * mat.val[1][0]
- + val[x][2] * mat.val[2][0];
- float t1 = val[x][0] * mat.val[0][1] + val[x][1] * mat.val[1][1]
- + val[x][2] * mat.val[2][1];
- float t2 = val[x][0] * mat.val[0][2] + val[x][1] * mat.val[1][2]
- + val[x][2] * mat.val[2][2];
- val[x][3] = val[x][0] * mat.val[0][3] + val[x][1] * mat.val[1][3]
- + val[x][2] * mat.val[2][3] + val[x][3];
- val[x][0] = t0;
- val[x][1] = t1;
- val[x][2] = t2;
- }
- return *this;
-}
-
-void Matrix3x4::setIdent()
-{
- for (int x=0; x<3; ++x) {
- for (int y=0; y<4; ++y) {
- val[x][y] = 0.0;
- }
- }
- val[0][0] = 1.0;
- val[1][1] = 1.0;
- val[2][2] = 1.0;
-}
-
-bool almostEqual(const Matrix3x4& mat1, const Matrix3x4& mat2)
-{
- for (int x=0; x<3; ++x) {
- for (int y=0; y<4; ++y) {
- if (!almostEqual(mat1.val[x][y], mat2.val[x][y])) {
- return false;
- }
- }
- }
- return true;
-}
-
-std::ostream& operator<<(ostream& os, const Matrix3x4& mat)
-{
- os << "{" << endl;
- for (int y=0; y<4; ++y) {
- os << " {" << mat.val[0][y] << "," << mat.val[1][y] << "," << mat.val[2][y]
- << "}" << endl;
- }
- os << "}" << endl;
- return os;
-}
-
-
-}
-
diff --git a/src/base/OSHelper.cpp b/src/base/OSHelper.cpp
index 852a7f0..377e725 100644
--- a/src/base/OSHelper.cpp
+++ b/src/base/OSHelper.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -33,12 +33,15 @@
#elif defined(__APPLE__)
#include <mach-o/dyld.h>
#include <mach/mach.h>
+#include <sys/utsname.h>
#elif defined(__linux)
#include <fstream>
#include <unistd.h>
+#include <string.h>
#endif
#include <stdlib.h>
+#include <iostream>
#include <cstdlib>
using namespace std;
@@ -59,6 +62,107 @@ string getWinErrMsg(unsigned err)
}
#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)
@@ -66,7 +170,7 @@ string getAvgLibPath()
char szFilename[1024];
DWORD ok = GetModuleFileName(hModule, szFilename, sizeof(szFilename));
if (ok == 0) {
- AVG_TRACE(Logger::ERROR, "getAvgLibPath(): " << getWinErrMsg(GetLastError()));
+ AVG_LOG_ERROR("getAvgLibPath(): " << getWinErrMsg(GetLastError()));
exit(5);
}
string sPath=getPath(szFilename);
@@ -89,8 +193,9 @@ string getAvgLibPath()
_NSGetExecutablePath(path, &pathLen);
return getPath(path);
#else
- // For a linux solution, see http://www.autopackage.org/docs/binreloc/
- return "";
+ char* pszFilename;
+ pszFilename = _br_find_exe_for_symbol((const void *)"");
+ return pszFilename;
#endif
}
@@ -154,8 +259,7 @@ std::string convertUTF8ToFilename(const std::string & sName)
int err1 = MultiByteToWideChar(CP_UTF8, 0, sName.c_str(), sName.size()+1,
wideString, 2048);
if (err1 == 0) {
- AVG_TRACE(Logger::WARNING,
- "Error in unicode conversion (MultiByteToWideChar): " <<
+ AVG_LOG_WARNING("Error in unicode conversion (MultiByteToWideChar): " <<
getWinErrMsg(GetLastError()));
return sName;
}
@@ -166,8 +270,7 @@ std::string convertUTF8ToFilename(const std::string & sName)
err1 = WideCharToMultiByte(CP_UTF8, 0, wideShortFName, -1, pShortName,
1024, 0, 0);
if (err1 == 0) {
- AVG_TRACE(Logger::WARNING,
- "Error in unicode conversion (MultiByteToWideChar): " <<
+ AVG_LOG_WARNING("Error in unicode conversion (MultiByteToWideChar): " <<
getWinErrMsg(GetLastError()));
}
return pShortName;
@@ -179,4 +282,27 @@ std::string convertUTF8ToFilename(const std::string & 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
index de6924b..6abda5a 100644
--- a/src/base/OSHelper.h
+++ b/src/base/OSHelper.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -42,6 +42,10 @@ size_t getMemoryUsage();
// 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
index 00015aa..e8136b7 100644
--- a/src/base/ObjectCounter.cpp
+++ b/src/base/ObjectCounter.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -21,6 +21,7 @@
#include "ObjectCounter.h"
#include "Exception.h"
+#include "Logger.h"
#include <boost/thread/mutex.hpp>
@@ -80,7 +81,7 @@ ObjectCounter * ObjectCounter::get()
void ObjectCounter::incRef(const std::type_info* pType)
{
#ifdef DEBUG_ALLOC
- boost::mutex::scoped_lock Lock(*pCounterMutex);
+ lock_guard Lock(*pCounterMutex);
TypeMap::iterator MapEntry = m_TypeMap.find(pType);
if (MapEntry == m_TypeMap.end()) {
m_TypeMap[pType] = 1;
@@ -99,7 +100,7 @@ void ObjectCounter::decRef(const std::type_info* pType)
// s_pObjectCounter has been deleted.
return;
}
- boost::mutex::scoped_lock Lock(*pCounterMutex);
+ lock_guard Lock(*pCounterMutex);
TypeMap::iterator MapEntry = m_TypeMap.find(pType);
if (MapEntry == m_TypeMap.end()) {
cerr << "ObjectCounter for " << demangle(pType->name())
@@ -179,4 +180,8 @@ string ObjectCounter::demangle(string s)
return sResult;
}
+TypeMap ObjectCounter::getObjectCount(){
+ return m_TypeMap;
+}
+
}
diff --git a/src/base/ObjectCounter.h b/src/base/ObjectCounter.h
index 506a3c9..e370723 100644
--- a/src/base/ObjectCounter.h
+++ b/src/base/ObjectCounter.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -29,6 +29,8 @@
namespace avg {
+typedef std::map<const std::type_info *, int> TypeMap;
+
class AVG_API ObjectCounter {
public:
static ObjectCounter* get();
@@ -38,14 +40,15 @@ public:
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();
- std::string demangle(std::string s);
static void deleteSingleton();
- typedef std::map<const std::type_info *, int> TypeMap;
TypeMap m_TypeMap;
static ObjectCounter* s_pObjectCounter;
diff --git a/src/base/Point.cpp b/src/base/Point.cpp
deleted file mode 100644
index 24208ca..0000000
--- a/src/base/Point.cpp
+++ /dev/null
@@ -1,325 +0,0 @@
-//
-// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 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 "Point.h"
-
-#include "MathHelper.h"
-#include "Exception.h"
-
-#if defined(__SSE__) || defined(_WIN32)
-#include <xmmintrin.h>
-#endif
-
-#include <math.h>
-#include <float.h>
-
-#include <string>
-
-namespace avg {
-
-template<class NUM>
-Point<NUM>::Point()
-{
-// ObjectCounter::get()->incRef(&typeid(*this));
-}
-
-template<class NUM>
-Point<NUM>::Point(NUM X, NUM Y)
-{
-// ObjectCounter::get()->incRef(&typeid(*this));
- x = X;
- y = Y;
-}
-
-template<class NUM>
-Point<NUM>::Point(const Point<NUM>& p)
-{
-// ObjectCounter::get()->incRef(&typeid(*this));
- x = p.x;
- y = p.y;
-}
-
-template<class NUM>
-Point<NUM>::Point(const std::vector<NUM>& v)
-{
- AVG_ASSERT_MSG(v.size() == 2,
- "Point can only be constructed from 2-component vector");
- x = v[0];
- y = v[1];
-}
-
-template<class NUM>
-Point<NUM>::~Point()
-{
-// ObjectCounter::get()->decRef(&typeid(*this));
-}
-
-template<class NUM>
-double Point<NUM>::getNorm() const
-{
- return sqrt(double(x*x+y*y));
-}
-
-template<class NUM>
-bool Point<NUM>::isNaN() const
-{
- return isnan(x) || isnan(y);
-}
-
-template<class NUM>
-bool Point<NUM>::isInf() const
-{
- return isinf(x) || isinf(y);
-}
-
-template<class NUM>
-Point<NUM> Point<NUM>::getRotated(double angle) const
-{
- double cosVal = cos(angle);
- double sinVal = sin(angle);
- return Point<NUM>(NUM(x*cosVal - y*sinVal), NUM(x*sinVal + y*cosVal));
-}
-
-template<class NUM>
-Point<NUM> Point<NUM>::getRotatedPivot(double angle, const Point<NUM>& pivot) const
-{
- // translate pivot to origin
- Point<NUM> translated = *this - pivot;
-
- // calculate rotated coordinates about the origin
- Point<NUM> rotated = translated.getRotated(angle);
-
- // re-translate pivot to original position
- rotated += pivot;
-
- return rotated;
-}
-
-template<class NUM>
-Point<NUM>& Point<NUM>::operator =(const Point<NUM>& p)
-{
- x = p.x;
- y = p.y;
- return *this;
-}
-
-template<class NUM>
-bool Point<NUM>::operator ==(const Point<NUM> & pt) const
-{
- return (x == pt.x && y == pt.y);
-}
-
-template<class NUM>
-bool Point<NUM>::operator !=(const Point<NUM> & pt) const
-{
- return (x != pt.x || y != pt.y);
-}
-
-template<class NUM>
-void Point<NUM>::operator +=(const Point<NUM>& pt)
-{
- x += pt.x;
- y += pt.y;
-}
-
-template<class NUM>
-void Point<NUM>::operator -=(const Point<NUM> & pt)
-{
- x -= pt.x;
- y -= pt.y;
-}
-
-template<class NUM>
-void Point<NUM>::operator *=(NUM f)
-{
- x *= f;
- y *= f;
-}
-
-template<class NUM>
-void Point<NUM>::operator /=(NUM f)
-{
- x /= f;
- y /= f;
-}
-
-template<class NUM>
-Point<NUM> Point<NUM>::operator -() const
-{
- return Point<NUM>(-x, -y);
-}
-
-template<class NUM>
-Point<NUM> Point<NUM>::operator +(const Point<NUM> & pt) const
-{
- return Point<NUM>(x + pt.x, y + pt.y);
-}
-
-template<class NUM>
-Point<NUM> Point<NUM>::operator -(const Point<NUM> & pt) const
-{
- return Point<NUM>(x - pt.x, y - pt.y);
-}
-
-template<class NUM>
-Point<NUM> Point<NUM>::operator /(double f) const
-{
- return Point<NUM> (NUM(x/f), NUM(y/f));
-}
-
-template<class NUM>
-Point<NUM> Point<NUM>::operator *(double f) const
-{
- return Point<NUM> (NUM(x*f), NUM(y*f));
-}
-
-template<class NUM>
-Point<NUM> Point<NUM>::operator *(const Point<NUM>& pt) const
-{
- return Point<NUM> (x*pt.x, y*pt.y);
-}
-
-template<>
-Point<int> Point<int>::fromPolar(double angle, double radius)
-{
- AVG_ASSERT_MSG(false, "fromPolar undefined for IntPoint");
- return Point<int>(0,0);
-}
-
-template<>
-Point<double> Point<double>::fromPolar(double angle, double radius)
-{
- return Point<double>(cos(angle)*radius, sin(angle)*radius);
-}
-
-template<class NUM>
-double Point<NUM>::getAngle() const
-{
- return atan2(double(y), double(x));
-}
-
-template<>
-Point<int> Point<int>::getNormalized() const
-{
- AVG_ASSERT_MSG(false, "getNormalized undefined for IntPoint");
- return Point<int>(0,0);
-}
-
-template<>
-Point<double> Point<double>::getNormalized() const
-{
- // This is imprecise but fast
-#if defined(__SSE__) || defined(_WIN32)
-#pragma pack(16)
- float result[4];
- float normSqr = float(x*x+y*y);
- __m128 src = _mm_setr_ps(float(x), float(y), 0, 0);
- __m128 normSqrVec = _mm_set_ps1(normSqr);
- __m128 invSqrt = _mm_rsqrt_ps(normSqrVec);
- __m128 resultVec = _mm_mul_ps(src, invSqrt);
- _mm_storeu_ps(result, resultVec);
- return Point<double>(result[0], result[1]);
-#pragma pack()
-#else
- double invNorm = invSqrt(float(x*x+y*y));
- if (invNorm != 0) {
- return Point<double>(x*invNorm, y*invNorm);
- } else {
- return *this;
- }
-#endif
-}
-
-template<>
-Point<double> Point<double>::safeGetNormalized() const
-{
- // This is precise but slower, and the version exported to python
- if (x==0 && y==0) {
- throw Exception(AVG_ERR_OUT_OF_RANGE, "Can't normalize (0,0).");
- } else {
- double invNorm = 1/sqrt(x*x+y*y);
- return Point<double>(x*invNorm, y*invNorm);
- }
-}
-
-template<>
-Point<int> Point<int>::safeGetNormalized() const
-{
- // Not implemented - done to silence compiler warnings.
- AVG_ASSERT(false);
- return Point<int>(0,0);
-}
-
-template<class NUM>
-std::ostream& operator<<( std::ostream& os, const Point<NUM> &p)
-{
- os << "(" << p.x << "," << p.y << ")";
- return os;
-}
-
-template<class NUM>
-Point<NUM> operator *(double f, const Point<NUM>& pt)
-{
- return pt*f;
-}
-
-template<class NUM>
-Point<NUM> operator /(double f, const Point<NUM>& pt)
-{
- return pt/f;
-}
-
-bool almostEqual(const DPoint& pt1, const DPoint& pt2)
-{
- return (fabs(pt1.x-pt2.x)+fabs(pt1.y-pt2.y)) < 0.0001;
-}
-
-double vecAngle(const DPoint& pt1, const DPoint pt2)
-{
- double angle = fmod((atan2(pt1.y, pt1.x) - atan2(pt2.y, pt2.x)), 2*M_PI);
- if (angle < 0) {
- angle += 2*M_PI;
- }
- return angle;
-}
-
-template<class NUM>
-double calcDist(const Point<NUM>& pt1, const Point<NUM>& pt2)
-{
- return sqrt(double(sqr(pt1.x-pt2.x)+sqr(pt1.y-pt2.y)));
-}
-
-// Explicit instantiations.
-template class Point<double>;
-template std::ostream& operator<<( std::ostream& os, const Point<double> &p);
-template Point<double> operator *(double f, const Point<double>& pt);
-template Point<double> operator /(double f, const Point<double>& pt);
-template double calcDist(const Point<double>& pt1, const Point<double>& pt2);
-template double calcDistSquared(const Point<double>& pt1, const Point<double>& pt2);
-
-template class Point<int>;
-template std::ostream& operator<<( std::ostream& os, const Point<int> &p);
-template Point<int> operator *(double f, const Point<int>& pt);
-template Point<int> operator /(double f, const Point<int>& pt);
-template double calcDist(const Point<int>& pt1, const Point<int>& pt2);
-template double calcDistSquared(const Point<int>& pt1, const Point<int>& pt2);
-
-}
diff --git a/src/base/Point.h b/src/base/Point.h
deleted file mode 100644
index 3156aed..0000000
--- a/src/base/Point.h
+++ /dev/null
@@ -1,124 +0,0 @@
-//
-// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 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 _Point_H_
-#define _Point_H_
-
-#include "../api.h"
-#include "MathHelper.h"
-
-#include <ostream>
-#include <vector>
-
-// Fix for non-C99 win compilers up to MSVC++2008
-#if defined _MSC_VER
-#define isinf(x) (!_finite(x))
-#define isnan(x) (_isnan(x))
-#endif
-
-namespace avg {
-
-template<class NUM>
-class AVG_TEMPLATE_API Point
-{
-public:
- NUM x;
- NUM y;
-
- Point ();
- template<class ORIGNUM> explicit Point(const Point<ORIGNUM>& p);
- Point(NUM X, NUM Y);
- Point(const Point<NUM>& p);
- Point(const std::vector<NUM>& v);
- ~Point();
-
- Point<NUM> getNormalized() const;
- Point<NUM> safeGetNormalized() const;
- double getNorm() const;
- bool isNaN() const;
- bool isInf() const;
- Point getRotated(double angle) const;
- Point getRotatedPivot(double angle, const Point& pivot = Point(0,0)) const;
-
- Point<NUM> & operator =(const Point<NUM>& p);
-
- bool operator ==(const Point<NUM> & pt) const;
- bool operator !=(const Point<NUM> & pt) const;
- void operator +=(const Point<NUM> & pt);
- void operator -=(const Point<NUM> & pt);
- void operator *=(NUM f);
- void operator /=(NUM f);
- Point<NUM> operator -() const;
- Point<NUM> operator +(const Point<NUM> & pt) const;
- Point<NUM> operator -(const Point<NUM> & pt) const;
- Point<NUM> operator /(double f) const;
- Point<NUM> operator *(double f) const;
- Point<NUM> operator *(const Point<NUM> & pt) const;
-
- static Point<NUM> fromPolar(double angle, double radius);
- double getAngle() const;
-};
-
-template<class NUM>
-std::ostream& operator<<( std::ostream& os, const Point<NUM> &p);
-
-template<class NUM>
-Point<NUM> operator *(double f, const Point<NUM>& pt);
-
-template<class NUM>
-Point<NUM> operator /(double f, const Point<NUM>& pt);
-
-template<class NUM>
-template<class ORIGNUM>
-Point<NUM>::Point(const Point<ORIGNUM>& p)
- : x(NUM(p.x)),
- y(NUM(p.y))
-{
-// ObjectCounter::get()->incRef(&typeid(*this));
-}
-
-template<class NUM>
-double calcDist(const Point<NUM>& pt1, const Point<NUM>& pt2);
-
-template<class NUM>
-double calcDistSquared(const Point<NUM>& pt1, const Point<NUM>& pt2)
-{
- return sqr(pt1.x-pt2.x)+sqr(pt1.y-pt2.y);
-}
-
-typedef Point<double> DPoint;
-typedef Point<int> IntPoint;
-
-bool almostEqual(const DPoint& pt1, const DPoint& pt2);
-
-inline
-double dotProduct(const DPoint& pt1, const DPoint pt2)
-{
- return pt1.x*pt2.x+pt1.y*pt2.y;
-}
-
-double vecAngle(const DPoint& pt1, const DPoint pt2);
-
-typedef std::vector<DPoint> DPointVector;
-
-}
-
-#endif
diff --git a/src/base/ProfilingZone.cpp b/src/base/ProfilingZone.cpp
index a12f5e3..9cdbbfe 100644
--- a/src/base/ProfilingZone.cpp
+++ b/src/base/ProfilingZone.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -30,12 +30,11 @@ using namespace std;
namespace avg {
ProfilingZone::ProfilingZone(const ProfilingZoneID& zoneID)
- : m_ZoneID(zoneID),
- m_TimeSum(0),
+ : m_TimeSum(0),
m_AvgTime(0),
m_NumFrames(0),
m_Indent(0),
- m_bIsRegistered(false)
+ m_ZoneID(zoneID)
{
ObjectCounter::get()->incRef(&typeid(*this));
}
@@ -45,6 +44,13 @@ ProfilingZone::~ProfilingZone()
ObjectCounter::get()->decRef(&typeid(*this));
}
+void ProfilingZone::restart()
+{
+ m_NumFrames = 0;
+ m_AvgTime = 0;
+ m_TimeSum = 0;
+}
+
void ProfilingZone::reset()
{
m_NumFrames++;
diff --git a/src/base/ProfilingZone.h b/src/base/ProfilingZone.h
index f226d59..0d0ee42 100644
--- a/src/base/ProfilingZone.h
+++ b/src/base/ProfilingZone.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -35,6 +35,7 @@ class AVG_API ProfilingZone
public:
ProfilingZone(const ProfilingZoneID& zoneID);
virtual ~ProfilingZone();
+ void restart();
void start()
{
@@ -53,13 +54,12 @@ public:
const std::string& getName() const;
private:
- const ProfilingZoneID& m_ZoneID;
long long m_TimeSum;
long long m_AvgTime;
long long m_StartTime;
int m_NumFrames;
int m_Indent;
- bool m_bIsRegistered;
+ const ProfilingZoneID& m_ZoneID;
};
typedef boost::shared_ptr<ProfilingZone> ProfilingZonePtr;
diff --git a/src/base/ProfilingZoneID.cpp b/src/base/ProfilingZoneID.cpp
index 025be66..7256887 100644
--- a/src/base/ProfilingZoneID.cpp
+++ b/src/base/ProfilingZoneID.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -20,13 +20,16 @@
//
#include "ProfilingZoneID.h"
+#include "ThreadProfiler.h"
using namespace std;
namespace avg {
-ProfilingZoneID::ProfilingZoneID(const string& sName)
- : m_sName(sName)
+ProfilingZoneID::ProfilingZoneID(const string& sName, bool bMultithreaded)
+ : m_sName(sName),
+ m_bMultithreaded(bMultithreaded),
+ m_pProfiler(0)
{
}
@@ -39,4 +42,16 @@ 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
index c590b3d..ca4d637 100644
--- a/src/base/ProfilingZoneID.h
+++ b/src/base/ProfilingZoneID.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -28,16 +28,21 @@
namespace avg {
+class ThreadProfiler;
+
class AVG_API ProfilingZoneID
{
public:
- ProfilingZoneID(const std::string& sName);
- virtual ~ProfilingZoneID();
+ 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;
};
}
diff --git a/src/base/Queue.h b/src/base/Queue.h
index 35c8d92..36a0eba 100644
--- a/src/base/Queue.h
+++ b/src/base/Queue.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -34,7 +34,7 @@
namespace avg {
-typedef boost::mutex::scoped_lock scoped_lock;
+typedef boost::unique_lock<boost::mutex> unique_lock;
template<class QElement>
class AVG_TEMPLATE_API Queue
@@ -42,18 +42,19 @@ class AVG_TEMPLATE_API Queue
public:
typedef boost::shared_ptr<QElement> QElementPtr;
- Queue(int MaxSize=-1);
+ Queue(int maxSize=-1);
virtual ~Queue();
bool empty() const;
QElementPtr pop(bool bBlock = true);
- void push(const QElementPtr& Elem);
+ void clear();
+ void push(const QElementPtr& pElem);
QElementPtr peek(bool bBlock = true) const;
int size() const;
int getMaxSize() const;
private:
- QElementPtr getFrontElement(bool bBlock, scoped_lock& Lock) const;
+ QElementPtr getFrontElement(bool bBlock, unique_lock& Lock) const;
std::deque<QElementPtr> m_pElements;
mutable boost::mutex m_Mutex;
@@ -62,8 +63,8 @@ private:
};
template<class QElement>
-Queue<QElement>::Queue(int MaxSize)
- : m_MaxSize(MaxSize)
+Queue<QElement>::Queue(int maxSize)
+ : m_MaxSize(maxSize)
{
}
@@ -75,15 +76,15 @@ Queue<QElement>::~Queue()
template<class QElement>
bool Queue<QElement>::empty() const
{
- scoped_lock Lock(m_Mutex);
+ unique_lock Lock(m_Mutex);
return m_pElements.empty();
}
template<class QElement>
typename Queue<QElement>::QElementPtr Queue<QElement>::pop(bool bBlock)
{
- scoped_lock Lock(m_Mutex);
- QElementPtr pElem = getFrontElement(bBlock, Lock);
+ unique_lock lock(m_Mutex);
+ QElementPtr pElem = getFrontElement(bBlock, lock);
if (pElem) {
m_pElements.pop_front();
m_Cond.notify_one();
@@ -92,10 +93,19 @@ typename Queue<QElement>::QElementPtr Queue<QElement>::pop(bool bBlock)
}
template<class QElement>
+void Queue<QElement>::clear()
+{
+ QElementPtr pElem;
+ do {
+ pElem = pop(false);
+ } while (pElem);
+}
+
+template<class QElement>
typename Queue<QElement>::QElementPtr Queue<QElement>::peek(bool bBlock) const
{
- scoped_lock Lock(m_Mutex);
- QElementPtr pElem = getFrontElement(bBlock, Lock);
+ unique_lock lock(m_Mutex);
+ QElementPtr pElem = getFrontElement(bBlock, lock);
if (pElem) {
m_Cond.notify_one();
}
@@ -106,10 +116,10 @@ template<class QElement>
void Queue<QElement>::push(const QElementPtr& pElem)
{
assert(pElem);
- scoped_lock Lock(m_Mutex);
+ unique_lock lock(m_Mutex);
if (m_pElements.size() == (unsigned)m_MaxSize) {
while (m_pElements.size() == (unsigned)m_MaxSize) {
- m_Cond.wait(Lock);
+ m_Cond.wait(lock);
}
}
m_pElements.push_back(pElem);
@@ -119,25 +129,25 @@ void Queue<QElement>::push(const QElementPtr& pElem)
template<class QElement>
int Queue<QElement>::size() const
{
- scoped_lock Lock(m_Mutex);
+ unique_lock lock(m_Mutex);
return int(m_pElements.size());
}
template<class QElement>
int Queue<QElement>::getMaxSize() const
{
- scoped_lock Lock(m_Mutex);
+ unique_lock lock(m_Mutex);
return m_MaxSize;
}
template<class QElement>
typename Queue<QElement>::QElementPtr
- Queue<QElement>::getFrontElement(bool bBlock, scoped_lock& Lock) const
+ Queue<QElement>::getFrontElement(bool bBlock, unique_lock& lock) const
{
if (m_pElements.empty()) {
if (bBlock) {
while (m_pElements.empty()) {
- m_Cond.wait(Lock);
+ m_Cond.wait(lock);
}
} else {
return QElementPtr();
diff --git a/src/base/Rect.h b/src/base/Rect.h
index 25756de..d668338 100644
--- a/src/base/Rect.h
+++ b/src/base/Rect.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -23,7 +23,9 @@
#define _Rect_H_
#include "../api.h"
-#include "Point.h"
+
+#include "../base/GLMHelper.h"
+#include "../glm/glm.hpp"
#include <algorithm>
@@ -36,29 +38,30 @@ template<class NUM>
class AVG_TEMPLATE_API Rect
{
public:
- Point<NUM> tl;
- Point<NUM> br;
+ typedef glm::detail::tvec2<NUM> Vec2;
+ Vec2 tl;
+ Vec2 br;
Rect();
Rect(NUM left, NUM top, NUM right, NUM bottom);
- Rect(const Point<NUM>& TL, const Point<NUM>& BR);
+ Rect(const Vec2& TL, const Vec2& BR);
template<class ORIGNUM> Rect(const Rect<ORIGNUM>& rc);
bool operator ==(const Rect<NUM>& rect) const;
bool operator !=(const Rect<NUM> & rect) const;
NUM width() const;
NUM height() const;
- Point<NUM> center() const;
+ Vec2 center() const;
void setWidth(NUM width);
void setHeight(NUM height);
- void setSize(const Point<NUM>& size);
- bool contains(const Point<NUM>& pt) const;
+ void setSize(const Vec2& size);
+ bool contains(const Vec2& pt) const;
bool contains(const Rect<NUM>& rect) const;
bool intersects(const Rect<NUM>& rect) const;
void expand(const Rect<NUM>& rect);
void intersect(const Rect<NUM>& rect);
- Point<NUM> size() const;
- Point<NUM> cropPoint(const Point<NUM>& pt) const;
+ Vec2 size() const;
+ Vec2 cropPoint(const Vec2& pt) const;
};
template<class NUM>
@@ -69,7 +72,7 @@ std::ostream& operator<<( std::ostream& os, const Rect<NUM> &r)
}
-typedef Rect<double> DRect;
+typedef Rect<float> FRect;
typedef Rect<int> IntRect;
template<class NUM>
@@ -77,7 +80,7 @@ Rect<NUM>::Rect()
{}
template<class NUM>
-Rect<NUM>::Rect(const Point<NUM>& TL, const Point<NUM>& BR)
+Rect<NUM>::Rect(const Vec2& TL, const Vec2& BR)
: tl(TL), br(BR)
{}
@@ -120,9 +123,9 @@ NUM Rect<NUM>::height() const
}
template<class NUM>
-Point<NUM> Rect<NUM>::center() const
+glm::detail::tvec2<NUM> Rect<NUM>::center() const
{
- return Point<NUM>(tl+br)/2;
+ return Vec2(tl+br)/2;
}
template<class NUM>
@@ -138,14 +141,14 @@ void Rect<NUM>::setHeight(NUM height)
}
template<class NUM>
-void Rect<NUM>::setSize(const Point<NUM>& size)
+void Rect<NUM>::setSize(const Vec2& size)
{
setWidth(size.x);
setHeight(size.y);
}
template<class NUM>
-bool Rect<NUM>::contains(const Point<NUM>& pt) const
+bool Rect<NUM>::contains(const Vec2& pt) const
{
return (pt.x >= tl.x && pt.x < br.x &&
pt.y >= tl.y && pt.y < br.y);
@@ -154,7 +157,7 @@ bool Rect<NUM>::contains(const Point<NUM>& pt) const
template<class NUM>
bool Rect<NUM>::contains(const Rect<NUM>& rect) const
{
- Point<NUM> brpt (rect.br.x-1, rect.br.y-1);
+ Vec2 brpt (rect.br.x-1, rect.br.y-1);
return Contains(rect.tl) && Contains(brpt);
}
@@ -171,31 +174,31 @@ bool Rect<NUM>::intersects(const Rect<NUM>& rect) const
template<class NUM>
void Rect<NUM>::expand(const Rect<NUM>& rect)
{
- tl.x = std::min(tl.x, rect.tl.x);
- tl.y = std::min(tl.y, rect.tl.y);
- br.x = std::max(br.x, rect.br.x);
- br.y = std::max(br.y, rect.br.y);
+ 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<class NUM>
void Rect<NUM>::intersect(const Rect<NUM>& rect)
{
- tl.x = std::max(tl.x, rect.tl.x);
- tl.y = std::max(tl.y, rect.tl.y);
- br.x = std::min(br.x, rect.br.x);
- br.y = std::min(br.y, rect.br.y);
+ 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<class NUM>
-Point<NUM> Rect<NUM>::size() const
+glm::detail::tvec2<NUM> Rect<NUM>::size() const
{
- return Point<NUM>(width(), height());
+ return Vec2(width(), height());
}
template<class NUM>
-Point<NUM> Rect<NUM>::cropPoint(const Point<NUM>& pt) const
+glm::detail::tvec2<NUM> Rect<NUM>::cropPoint(const Vec2& pt) const
{
- Point<NUM> Result;
+ 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;
diff --git a/src/base/ScopeTimer.cpp b/src/base/ScopeTimer.cpp
index 1a353e8..eb95736 100644
--- a/src/base/ScopeTimer.cpp
+++ b/src/base/ScopeTimer.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -20,21 +20,16 @@
//
#include "ScopeTimer.h"
-#include "ThreadProfiler.h"
using namespace std;
namespace avg {
-ScopeTimer::ScopeTimer(ProfilingZoneID& zoneID)
- : m_ZoneID(zoneID)
-{
- ThreadProfiler::get()->startZone(zoneID);
-}
+bool ScopeTimer::s_bTimersEnabled = false;
-ScopeTimer::~ScopeTimer()
+void ScopeTimer::enableTimers(bool bEnable)
{
- ThreadProfiler::get()->stopZone(m_ZoneID);
+ s_bTimersEnabled = bEnable;
}
}
diff --git a/src/base/ScopeTimer.h b/src/base/ScopeTimer.h
index de62eb2..a87263f 100644
--- a/src/base/ScopeTimer.h
+++ b/src/base/ScopeTimer.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -24,16 +24,35 @@
#include "../api.h"
#include "ProfilingZoneID.h"
+#include "ThreadProfiler.h"
namespace avg {
-
+
class AVG_API ScopeTimer {
public:
- ScopeTimer(ProfilingZoneID& zoneID);
- virtual ~ScopeTimer();
-
+ 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_ZoneID;
+ ProfilingZoneID* m_pZoneID;
+
+ static bool s_bTimersEnabled;
};
}
diff --git a/src/base/Signal.h b/src/base/Signal.h
index 0e6beb2..b670822 100644
--- a/src/base/Signal.h
+++ b/src/base/Signal.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
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 <iostream>
+#include <iomanip>
+
+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
index ba02038..6155859 100644
--- a/src/base/StringHelper.cpp
+++ b/src/base/StringHelper.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -71,9 +71,9 @@ int stringToInt(const string& s)
return i;
}
-double stringToDouble(const string& s)
+float stringToFloat(const string& s)
{
- double d;
+ float d;
fromString(s, d);
return d;
}
@@ -92,28 +92,17 @@ bool stringToBool(const string& s)
throw (Exception(AVG_ERR_TYPE, string("Could not convert ")+s+" to bool."));
}
-DPoint stringToDPoint(const std::string& s)
-{
- DPoint pt;
- fromString(s, pt);
- return pt;
-}
-
-IntTriple stringToIntTriple(const std::string& s)
-{
- IntTriple pt;
- fromString(s, pt);
- return pt;
-}
-
std::string removeStartEndSpaces(const string& s)
{
string sResult = s;
- while (sResult[0] == ' ' || sResult[0] == '\n' || sResult[0] == '\r'
- || sResult[0] == '\t')
+ 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);
@@ -143,5 +132,14 @@ bool equalIgnoreCase(const string& s1, const string& s2)
return sUpper1 == sUpper2;
}
+string toString(const bool& b)
+{
+ if (b) {
+ return "true";
+ } else {
+ return "false";
+ }
+}
+
}
diff --git a/src/base/StringHelper.h b/src/base/StringHelper.h
index 154a5f0..82713eb 100644
--- a/src/base/StringHelper.h
+++ b/src/base/StringHelper.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -24,13 +24,12 @@
#include "../api.h"
#include "Exception.h"
-#include "Point.h"
-#include "Triple.h"
#include <string>
#include <sstream>
#include <typeinfo>
#include <iostream>
+#include <vector>
#ifdef __GNUC__
#include <cxxabi.h>
@@ -38,20 +37,9 @@
namespace avg {
-bool isWhitespace(const std::string& s);
-void skipWhitespace(std::istream& is);
-void skipToken(std::istream& is, char token);
-
-template<class NUM>
-std::istream& operator>>(std::istream& is, Point<NUM>& p)
-{
- skipToken(is, '(');
- is >> p.x;
- skipToken(is, ',');
- is >> p.y;
- skipToken(is, ')');
- return is;
-}
+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<class T>
std::istream& operator >>(std::istream& is, std::vector<T>& v)
@@ -86,17 +74,15 @@ std::istream& operator >>(std::istream& is, std::vector<T>& v)
return is;
}
-int stringToInt(const std::string& s);
-double stringToDouble(const std::string& s);
-bool stringToBool(const std::string& s);
-DPoint stringToDPoint(const std::string& s);
-IntTriple stringToIntTriple(const std::string& s);
+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 removeStartEndSpaces(const std::string& s);
+std::string AVG_API removeStartEndSpaces(const std::string& s);
-std::string toLowerCase(const std::string& s);
+std::string AVG_API toLowerCase(const std::string& s);
-bool equalIgnoreCase(const std::string& s1, const std::string& s2);
+bool AVG_API equalIgnoreCase(const std::string& s1, const std::string& s2);
template<class T>
std::string toString(const T& i)
@@ -106,6 +92,8 @@ std::string toString(const T& i)
return stream.str();
}
+std::string AVG_API toString(const bool& b);
+
template<class T>
std::string getFriendlyTypeName(const T& dummy)
{
diff --git a/src/base/Test.cpp b/src/base/Test.cpp
index 8825d45..b2c0b12 100644
--- a/src/base/Test.cpp
+++ b/src/base/Test.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -44,7 +44,7 @@ Test::~Test()
{
}
-void Test::test (bool b, const char * pszFile, int line)
+void Test::test(bool b, const char * pszFile, int line)
{
if (b) {
m_NumSucceeded++;
diff --git a/src/base/Test.h b/src/base/Test.h
index ef39bc5..0cc20ba 100644
--- a/src/base/Test.h
+++ b/src/base/Test.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -56,7 +56,6 @@ protected:
int m_IndentLevel;
private:
- bool m_bOk;
int m_NumSucceeded;
int m_NumFailed;
std::string m_sName;
diff --git a/src/base/TestSuite.cpp b/src/base/TestSuite.cpp
index 87130da..16a254c 100644
--- a/src/base/TestSuite.cpp
+++ b/src/base/TestSuite.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -53,6 +53,10 @@ void TestSuite::runTests()
} 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;
diff --git a/src/base/TestSuite.h b/src/base/TestSuite.h
index d85eef8..124bbc2 100644
--- a/src/base/TestSuite.h
+++ b/src/base/TestSuite.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
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 <Windows.h>
+#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 <boost/thread.hpp>
+#include <boost/thread/locks.hpp>
+
+namespace avg {
+
+void AVG_API setAffinityMask(bool bIsMainThread);
+typedef boost::lock_guard<boost::mutex> lock_guard;
+unsigned getLowestBitSet(unsigned val);
+
+}
+
+#endif
diff --git a/src/base/ThreadProfiler.cpp b/src/base/ThreadProfiler.cpp
index 12715c7..1f1a354 100644
--- a/src/base/ThreadProfiler.cpp
+++ b/src/base/ThreadProfiler.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -20,8 +20,11 @@
//
#include "ThreadProfiler.h"
+
#include "Logger.h"
#include "Exception.h"
+#include "ProfilingZone.h"
+#include "ScopeTimer.h"
#include <sstream>
#include <iomanip>
@@ -32,33 +35,37 @@ using namespace boost;
namespace avg {
-thread_specific_ptr<ThreadProfilerPtr> ThreadProfiler::s_pInstance;
+thread_specific_ptr<ThreadProfiler*> ThreadProfiler::s_pInstance;
-ThreadProfilerPtr& ThreadProfiler::get()
+ThreadProfiler* ThreadProfiler::get()
{
if (s_pInstance.get() == 0) {
- s_pInstance.reset(new ThreadProfilerPtr(new ThreadProfiler()));
+ 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::PROFILE)
+ m_LogCategory(Logger::category::PROFILE)
{
m_bRunning = false;
+ ScopeTimer::enableTimers(Logger::get()->shouldLog(m_LogCategory,
+ Logger::severity::INFO));
}
ThreadProfiler::~ThreadProfiler()
{
}
-void ThreadProfiler::setLogCategory(long category)
+void ThreadProfiler::setLogCategory(category_t category)
{
AVG_ASSERT(!m_bRunning);
m_LogCategory = category;
@@ -69,9 +76,12 @@ void ThreadProfiler::start()
m_bRunning = true;
}
-bool ThreadProfiler::isRunning()
+void ThreadProfiler::restart()
{
- return m_bRunning;
+ ZoneVector::iterator it;
+ for (it = m_Zones.begin(); it != m_Zones.end(); ++it) {
+ (*it)->restart();
+ }
}
void ThreadProfiler::startZone(const ProfilingZoneID& zoneID)
@@ -93,47 +103,34 @@ void ThreadProfiler::startZone(const ProfilingZoneID& zoneID)
void ThreadProfiler::stopZone(const ProfilingZoneID& zoneID)
{
ZoneMap::iterator it = m_ZoneMap.find(&zoneID);
- AVG_ASSERT(it != m_ZoneMap.end());
ProfilingZonePtr& pZone = it->second;
- AVG_ASSERT(m_ActiveZones.back() == pZone);
pZone->stop();
m_ActiveZones.pop_back();
}
-void ThreadProfiler::dumpFrame()
-{
- AVG_TRACE(Logger::PROFILE_LATEFRAMES, "Frame Profile:");
- ZoneList::iterator it;
- for (it = m_Zones.begin(); it != m_Zones.end(); ++it) {
- AVG_TRACE(Logger::PROFILE_LATEFRAMES,
- std::setw(35) << std::left
- << ((*it)->getIndentString() + (*it)->getName())
- << std::setw(9) << std::right << (*it)->getUSecs());
- }
- AVG_TRACE(Logger::PROFILE_LATEFRAMES, "");
-}
-
void ThreadProfiler::dumpStatistics()
{
if (!m_Zones.empty()) {
- AVG_TRACE(m_LogCategory, "Thread " << m_sName);
- AVG_TRACE(m_LogCategory, "Zone name Avg. time");
- AVG_TRACE(m_LogCategory, "--------- ---------");
+ 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,
+ "--------- ---------");
- ZoneList::iterator it;
+ ZoneVector::iterator it;
for (it = m_Zones.begin(); it != m_Zones.end(); ++it) {
- AVG_TRACE(m_LogCategory,
+ 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, "");
+ AVG_TRACE(m_LogCategory, Logger::severity::INFO, "");
}
}
void ThreadProfiler::reset()
{
- ZoneList::iterator it;
+ ZoneVector::iterator it;
for (it = m_Zones.begin(); it != m_Zones.end(); ++it) {
(*it)->reset();
}
@@ -159,7 +156,7 @@ ProfilingZonePtr ThreadProfiler::addZone(const ProfilingZoneID& zoneID)
{
ProfilingZonePtr pZone(new ProfilingZone(zoneID));
m_ZoneMap[&zoneID] = pZone;
- ZoneList::iterator it;
+ ZoneVector::iterator it;
int parentIndent = -2;
if (m_ActiveZones.empty()) {
it = m_Zones.end();
@@ -176,7 +173,7 @@ ProfilingZonePtr ThreadProfiler::addZone(const ProfilingZoneID& zoneID)
AVG_ASSERT(bParentFound);
parentIndent = pActiveZone->getIndentLevel();
++it;
- for (; it != m_Zones.end() && (*it)->getIndentLevel() > parentIndent; ++it);
+ for (; it != m_Zones.end() && (*it)->getIndentLevel() > parentIndent; ++it) {};
}
m_Zones.insert(it, pZone);
pZone->setIndentLevel(parentIndent+2);
diff --git a/src/base/ThreadProfiler.h b/src/base/ThreadProfiler.h
index a571220..a581271 100644
--- a/src/base/ThreadProfiler.h
+++ b/src/base/ThreadProfiler.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -23,34 +23,40 @@
#define _ThreadProfiler_H_
#include "../api.h"
-#include "ProfilingZone.h"
+#include "ILogSink.h"
#include <boost/thread.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/thread/tss.hpp>
-#include <list>
+#include <vector>
#include <map>
-
+#if defined(_WIN32) || defined(_LIBCPP_VERSION)
+#include <unordered_map>
+#else
+#include <tr1/unordered_map>
+#endif
namespace avg {
class ThreadProfiler;
typedef boost::shared_ptr<ThreadProfiler> ThreadProfilerPtr;
+class ProfilingZone;
+typedef boost::shared_ptr<ProfilingZone> ProfilingZonePtr;
+class ProfilingZoneID;
class AVG_API ThreadProfiler
{
public:
- static ThreadProfilerPtr& get();
+ static ThreadProfiler* get();
static void kill();
ThreadProfiler();
virtual ~ThreadProfiler();
- void setLogCategory(long category);
+ void setLogCategory(category_t category);
void start();
- bool isRunning();
+ void restart();
void startZone(const ProfilingZoneID& zoneID);
void stopZone(const ProfilingZoneID& zoneID);
- void dumpFrame();
void dumpStatistics();
void reset();
int getNumZones();
@@ -62,15 +68,19 @@ private:
ProfilingZonePtr addZone(const ProfilingZoneID& zoneID);
std::string m_sName;
- typedef std::map<const ProfilingZoneID*, ProfilingZonePtr> ZoneMap;
- typedef std::list<ProfilingZonePtr> ZoneList;
+#if defined(_WIN32) || defined(_LIBCPP_VERSION)
+ typedef std::unordered_map<const ProfilingZoneID*, ProfilingZonePtr> ZoneMap;
+#else
+ typedef std::tr1::unordered_map<const ProfilingZoneID*, ProfilingZonePtr> ZoneMap;
+#endif
+ typedef std::vector<ProfilingZonePtr> ZoneVector;
ZoneMap m_ZoneMap;
- ZoneList m_ActiveZones;
- ZoneList m_Zones;
+ ZoneVector m_ActiveZones;
+ ZoneVector m_Zones;
bool m_bRunning;
- long m_LogCategory;
+ category_t m_LogCategory;
- static boost::thread_specific_ptr<ThreadProfilerPtr> s_pInstance;
+ static boost::thread_specific_ptr<ThreadProfiler*> s_pInstance;
};
}
diff --git a/src/base/TimeSource.cpp b/src/base/TimeSource.cpp
index 320b3ff..e90575d 100644
--- a/src/base/TimeSource.cpp
+++ b/src/base/TimeSource.cpp
@@ -1,6 +1,6 @@
//
-// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -34,12 +34,12 @@
#endif
#include <sys/stat.h>
#include <sys/types.h>
-#include <unistd.h>
#include <errno.h>
#include <assert.h>
#include <iostream>
#include <sstream>
+#include <unistd.h>
using namespace std;
@@ -56,8 +56,8 @@ TimeSource * TimeSource::get()
MMRESULT err = timeGetDevCaps(&tc, sizeof(TIMECAPS));
AVG_ASSERT(err == TIMERR_NOERROR);
wTimerRes = max(tc.wPeriodMin, 1);
- timeBeginPeriod(wTimerRes);
-#endif
+ timeBeginPeriod(wTimerRes);
+#endif
m_pTimeSource = new TimeSource;
}
return m_pTimeSource;
@@ -92,15 +92,15 @@ long long TimeSource::getCurrentMicrosecs()
int rc = clock_gettime(CLOCK_MONOTONIC, &now);
assert(rc == 0);
return ((long long)now.tv_sec)*1000000+now.tv_nsec/1000;
-#endif
-#endif
+#endif
+#endif
}
void TimeSource::sleepUntil(long long targetTime)
{
long long now = getCurrentMillisecs();
#ifdef __APPLE__
- if (targetTime > now) {
+ if (targetTime > now) {
msleep(targetTime-now);
}
#else
@@ -114,7 +114,7 @@ void TimeSource::sleepUntil(long long targetTime)
}
#endif
}
-
+
void msleep(int millisecs)
{
#if _WIN32
diff --git a/src/base/TimeSource.h b/src/base/TimeSource.h
index 63679fe..a4ca9ae 100644
--- a/src/base/TimeSource.h
+++ b/src/base/TimeSource.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/base/Triangle.cpp b/src/base/Triangle.cpp
index 039c643..7efe9f7 100644
--- a/src/base/Triangle.cpp
+++ b/src/base/Triangle.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -21,11 +21,13 @@
#include "Triangle.h"
+#include "GLMHelper.h"
+
#include <math.h>
namespace avg {
-Triangle::Triangle(const DPoint& P0, const DPoint& P1, const DPoint& P2)
+Triangle::Triangle(const glm::vec2& P0, const glm::vec2& P1, const glm::vec2& P2)
: p0(P0),
p1(P1),
p2(P2)
@@ -41,48 +43,48 @@ bool Triangle::operator ==(const Triangle & tri) const
return (p0 == tri.p0 && p1 == tri.p1 && p2 == tri.p2);
}
-bool Triangle::isInside(const DPoint& pt) const
+bool Triangle::isInside(const glm::vec2& pt) const
{
/* Slower func that only works for cw triangles.
- DPoint a = p2-p1;
- DPoint bp = pt-p1;
- double aCROSSbp = a.x*bp.y - a.y*bp.x;
+ 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;
}
- DPoint b = p0-p2;
- DPoint cp = pt-p2;
- double bCROSScp = b.x*cp.y - b.y*cp.x;
+ 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;
}
- DPoint c = p1-p0;
- DPoint ap = pt-p0;
- double cCROSSap = c.x*ap.y - c.y*ap.x;
+ glm::vec2 c = p1-p0;
+ glm::vec2 ap = pt-p0;
+ float cCROSSap = c.x*ap.y - c.y*ap.x;
return cCROSSap >= 0.0;
*/
- DPoint v0 = p2 - p0;
- DPoint v1 = p1 - p0;
- DPoint v2 = pt - p0;
+ glm::vec2 v0 = p2 - p0;
+ glm::vec2 v1 = p1 - p0;
+ glm::vec2 v2 = pt - p0;
- double dot00 = dotProduct(v0, v0);
- double dot01 = dotProduct(v0, v1);
- double dot02 = dotProduct(v0, v2);
- double dot11 = dotProduct(v1, v1);
- double dot12 = dotProduct(v1, v2);
+ 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);
- double invDenom = 1 / (dot00 * dot11 - dot01 * dot01);
- double u = (dot11 * dot02 - dot01 * dot12) * invDenom;
- double v = (dot00 * dot12 - dot01 * dot02) * invDenom;
+ 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);
}
-double Triangle::getArea() const
+float Triangle::getArea() const
{
return fabs((((p1.x-p0.x)*(p2.y-p0.y)) - ((p1.y-p0.y)*(p2.x-p0.x)))/2);
}
diff --git a/src/base/Triangle.h b/src/base/Triangle.h
index a9722fb..21ad35f 100644
--- a/src/base/Triangle.h
+++ b/src/base/Triangle.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -24,22 +24,24 @@
#include "../api.h"
-#include "Point.h"
+#include "../glm/glm.hpp"
+
+#include <iostream>
namespace avg {
struct AVG_API Triangle {
public:
- DPoint p0;
- DPoint p1;
- DPoint p2;
+ glm::vec2 p0;
+ glm::vec2 p1;
+ glm::vec2 p2;
- Triangle(const DPoint& P0, const DPoint& P1, const DPoint& P2);
+ Triangle(const glm::vec2& P0, const glm::vec2& P1, const glm::vec2& P2);
Triangle();
bool operator ==(const Triangle & tri) const;
- bool isInside(const DPoint& pt) const;
- double getArea() const;
+ bool isInside(const glm::vec2& pt) const;
+ float getArea() const;
bool isClockwise() const;
};
diff --git a/src/base/Triangulate.cpp b/src/base/Triangulate.cpp
deleted file mode 100644
index bbd9ef5..0000000
--- a/src/base/Triangulate.cpp
+++ /dev/null
@@ -1,139 +0,0 @@
-// Original code by John W. Ratcliff presumed to be in the public domain. Found
-// at http://www.flipcode.com/archives/Efficient_Polygon_Triangulation.shtml.
-
-#include "Triangulate.h"
-#include "Exception.h"
-
-#include "../base/Exception.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <iostream>
-
-namespace avg {
-
-using namespace std;
-
-double getPolygonArea(const DPointVector &contour)
-{
- int n = contour.size();
-
- double A=0.0;
-
- for (int p=n-1,q=0; q<n; p=q++) {
- A += contour[p].x*contour[q].y - contour[q].x*contour[p].y;
- }
- return A*0.5;
-}
-
-
-bool snip(const DPointVector &contour,int u,int v,int w,int n,int *V)
-{
- int p;
- Triangle tri;
- tri.p0 = contour[V[u]];
- tri.p1 = contour[V[v]];
- tri.p2 = contour[V[w]];
-
-// double area = tri.getArea();
-
- if (tri.isClockwise()) {
- return false;
- }
-
- for (p=0; p<n; p++) {
- if( (p == u) || (p == v) || (p == w) ) {
- continue;
- }
- if (tri.isInside(contour[V[p]])) {
- return false;
- }
- }
-
- return true;
-}
-
-
-// TODO: There's code that's probably faster in Graphics Gems V:
-// http://tog.acm.org/resources/GraphicsGems/gemsv/ch7-5/
-void triangulatePolygon(const DPointVector &contour, vector<int> &resultIndexes)
-{
- /* allocate and initialize list of Vertices in polygon */
-
- int n = contour.size();
- AVG_ASSERT(n>2);
-
- int *V = new int[n];
-
- // we want a counter-clockwise polygon in V.
- if (0.0 < getPolygonArea(contour)) {
- for (int v=0; v<n; v++) {
- V[v] = v;
- }
- } else {
- for(int v=0; v<n; v++) {
- V[v] = (n-1)-v;
- }
- }
-
- int nv = n;
-
- /* remove nv-2 Vertices, creating 1 triangle every time */
- int count = 2*nv; /* error detection */
-
- for(int m=0, v=nv-1; nv>2; )
- {
- if (count <= 0) {
- delete V;
- throw Exception(AVG_ERR_INVALID_ARGS,
- "Non-simple polygon: Self-intersecting polygons or degenerate polygons are not supported.");
- }
- count--;
-
- /* three consecutive vertices in current polygon, <u,v,w> */
- int u = v;
- if (nv <= u) {
- u = 0; /* previous */
- }
- v = u+1;
- if (nv <= v) {
- v = 0;
- }
- int w = v+1;
- if (nv <= w) {
- w = 0;
- }
-
- if (snip(contour,u,v,w,nv,V))
- {
- int a,b,c,s,t;
-
- /* true names of the vertices */
- a = V[u]; b = V[v]; c = V[w];
-
- /* output Triangle */
-
- resultIndexes.push_back(a);
- resultIndexes.push_back(b);
- resultIndexes.push_back(c);
-
- m++;
-
- /* remove v from remaining polygon */
- for(s=v,t=v+1; t<nv; s++,t++) {
- V[s] = V[t];
- }
- nv--;
-
- /* resest error detection counter */
- count = 2*nv;
-
- }
- }
-
- delete[] V;
-}
-
-}
-
diff --git a/src/base/Triangulate.h b/src/base/Triangulate.h
deleted file mode 100644
index d2b4ef6..0000000
--- a/src/base/Triangulate.h
+++ /dev/null
@@ -1,22 +0,0 @@
-// Original code by John W. Ratcliff presumed to be in the public domain. Found
-// at http://www.flipcode.com/archives/Efficient_Polygon_Triangulation.shtml.
-
-#ifndef _Triangulate_H_
-#define _Triangulate_H_
-
-#include "Point.h"
-#include "Triangle.h"
-
-#include <vector>
-
-namespace avg {
-
-// Result type is suitable for use in a Triangle Vertex Array.
-void triangulatePolygon(const DPointVector &contour, std::vector<int> &resultIndexes);
-
-double getPolygonArea(const DPointVector &contour);
-
-}
-
-#endif
-
diff --git a/src/base/Triple.cpp b/src/base/Triple.cpp
deleted file mode 100644
index 8249f72..0000000
--- a/src/base/Triple.cpp
+++ /dev/null
@@ -1,107 +0,0 @@
-//
-// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 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 "Triple.h"
-
-#include "MathHelper.h"
-#include "StringHelper.h"
-#include "Exception.h"
-
-#if defined(__SSE__) || defined(_WIN32)
-#include <xmmintrin.h>
-#endif
-
-#include <math.h>
-#include <float.h>
-
-#include <string>
-
-namespace avg {
-
-template<class NUM>
-Triple<NUM>::Triple()
-{
- x = 0;
- y = 0;
- z = 0;
-}
-
-template<class NUM>
-Triple<NUM>::Triple(NUM X, NUM Y, NUM Z)
-{
- x = X;
- y = Y;
- z = Z;
-}
-
-template<class NUM>
-Triple<NUM>::Triple(const Triple<NUM>& p)
-{
- x = p.x;
- y = p.y;
- z = p.z;
-}
-
-
-template<class NUM>
-Triple<NUM>::Triple(const std::vector<NUM>& v)
-{
- AVG_ASSERT(v.size() == 3);
- x = v[0];
- y = v[1];
- z = v[2];
-}
-
-template<class NUM>
-Triple<NUM>::~Triple()
-{
-}
-
-template<class NUM>
-std::ostream& operator<<(std::ostream& os, const Triple<NUM> &p)
-{
- os << "(" << p.x << "," << p.y << "," << p.z << ")";
- return os;
-}
-
-template<class NUM>
-std::istream& operator>>(std::istream& is, Triple<NUM>& p)
-{
- skipToken(is, '(');
- is >> p.x;
- skipToken(is, ',');
- is >> p.y;
- skipToken(is, ',');
- is >> p.z;
- skipToken(is, ')');
- return is;
-}
-
-// Explicit instantiations.
-template class Triple<double>;
-template std::ostream& operator<<(std::ostream& os, const Triple<double> &p);
-template std::istream& operator>>(std::istream& is, Triple<double>& p);
-
-template class Triple<int>;
-template std::ostream& operator<<(std::ostream& os, const Triple<int> &p);
-template std::istream& operator>>(std::istream& is, Triple<int>& p);
-
-}
diff --git a/src/base/UTF8String.cpp b/src/base/UTF8String.cpp
index 214901b..4855364 100644
--- a/src/base/UTF8String.cpp
+++ b/src/base/UTF8String.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -54,4 +54,9 @@ UTF8String& UTF8String::operator =(const char* psz)
return *this;
}
+std::size_t hash_value(const avg::UTF8String& x)
+{
+ boost::hash<std::string> hasher;
+ return hasher(x);
+};
}
diff --git a/src/base/UTF8String.h b/src/base/UTF8String.h
index 2c0f1be..3cee69d 100644
--- a/src/base/UTF8String.h
+++ b/src/base/UTF8String.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -23,6 +23,7 @@
#define _UTF8String_H_
#include "../api.h"
+#include <boost/functional/hash.hpp>
#include <string>
namespace avg {
@@ -39,5 +40,7 @@ public:
};
+std::size_t hash_value(const avg::UTF8String& x);
+
}
#endif
diff --git a/src/base/WideLine.cpp b/src/base/WideLine.cpp
index 04e3162..84f4096 100644
--- a/src/base/WideLine.cpp
+++ b/src/base/WideLine.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -21,24 +21,26 @@
#include "WideLine.h"
+#include "GLMHelper.h"
+
namespace avg {
-WideLine::WideLine(const DPoint& p0, const DPoint& p1, double width)
+WideLine::WideLine(const glm::vec2& p0, const glm::vec2& p1, float width)
: pt0(p0),
pt1(p1)
{
- DPoint m = (pt1-pt0).getNormalized();
- DPoint w = DPoint(m.y, -m.x)*width/2;
+ 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 = DPoint(w.y, -w.x);
+ dir = glm::vec2(w.y, -w.x);
}
-double WideLine::getLen() const
+float WideLine::getLen() const
{
- return calcDist(pt0, pt1);
+ return glm::length(pt1-pt0);
}
std::ostream& operator<<(std::ostream& os, const WideLine& line)
diff --git a/src/base/WideLine.h b/src/base/WideLine.h
index 0235c20..28584ef 100644
--- a/src/base/WideLine.h
+++ b/src/base/WideLine.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -24,21 +24,21 @@
#include "../api.h"
-#include "Point.h"
+#include "../glm/glm.hpp"
#include <iostream>
namespace avg {
struct AVG_API WideLine {
- WideLine(const DPoint& p0, const DPoint& p1, double width);
+ WideLine(const glm::vec2& p0, const glm::vec2& p1, float width);
- double getLen() const;
+ float getLen() const;
- DPoint pt0, pt1;
- DPoint pl0, pl1;
- DPoint pr0, pr1;
- DPoint dir;
+ glm::vec2 pt0, pt1;
+ glm::vec2 pl0, pl1;
+ glm::vec2 pr0, pr1;
+ glm::vec2 dir;
};
std::ostream& operator<<(std::ostream& os, const WideLine& line);
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
index 6e5dba0..c4cc3c4 100644
--- a/src/base/WorkerThread.h
+++ b/src/base/WorkerThread.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -27,8 +27,8 @@
#include "Exception.h"
#include "Logger.h"
#include "Queue.h"
+#include "ThreadHelper.h"
#include "ThreadProfiler.h"
-#include "ObjectCounter.h"
#include "CmdQueue.h"
#include <boost/shared_ptr.hpp>
@@ -47,7 +47,7 @@ public:
typedef typename boost::shared_ptr<CQueue> CQueuePtr;
WorkerThread(const std::string& sName, CQueue& CmdQ,
- long logCategory=Logger::PROFILE);
+ category_t logCategory=Logger::category::PROFILE);
WorkerThread(WorkerThread const& other);
virtual ~WorkerThread();
void operator()();
@@ -55,6 +55,9 @@ public:
void waitForCommand();
void stop();
+protected:
+ int getNumCmdsInQueue() const;
+
private:
virtual bool init();
virtual bool work() = 0;
@@ -65,18 +68,17 @@ private:
std::string m_sName;
bool m_bShouldStop;
CQueue& m_CmdQ;
- long m_LogCategory;
+ category_t m_LogCategory;
};
template<class DERIVED_THREAD>
WorkerThread<DERIVED_THREAD>::WorkerThread(const std::string& sName, CQueue& CmdQ,
- long logCategory)
+ category_t logCategory)
: m_sName(sName),
m_bShouldStop(false),
m_CmdQ(CmdQ),
m_LogCategory(logCategory)
{
- ObjectCounter::get()->incRef(&typeid(*this));
}
template<class DERIVED_THREAD>
@@ -86,20 +88,19 @@ WorkerThread<DERIVED_THREAD>::WorkerThread(WorkerThread const& other)
m_sName = other.m_sName;
m_bShouldStop = other.m_bShouldStop;
m_LogCategory = other.m_LogCategory;
- ObjectCounter::get()->incRef(&typeid(*this));
}
template<class DERIVED_THREAD>
WorkerThread<DERIVED_THREAD>::~WorkerThread()
{
- ObjectCounter::get()->decRef(&typeid(*this));
}
template<class DERIVED_THREAD>
void WorkerThread<DERIVED_THREAD>::operator()()
{
try {
- ThreadProfilerPtr pProfiler = ThreadProfiler::get();
+ setAffinityMask(false);
+ ThreadProfiler* pProfiler = ThreadProfiler::get();
pProfiler->setName(m_sName);
pProfiler->setLogCategory(m_LogCategory);
bool bOK;
@@ -112,7 +113,8 @@ void WorkerThread<DERIVED_THREAD>::operator()()
bOK = work();
if (!bOK) {
m_bShouldStop = true;
- } else {
+ }
+ if (!m_bShouldStop) {
processCommands();
}
}
@@ -120,8 +122,7 @@ void WorkerThread<DERIVED_THREAD>::operator()()
pProfiler->dumpStatistics();
pProfiler->kill();
} catch (const Exception& e) {
- AVG_TRACE(Logger::ERROR, "Uncaught exception in thread " << m_sName << ": "
- << e.getStr());
+ AVG_LOG_ERROR("Uncaught exception in thread " << m_sName << ": " << e.getStr());
throw;
}
}
@@ -140,6 +141,12 @@ void WorkerThread<DERIVED_THREAD>::stop()
}
template<class DERIVED_THREAD>
+int WorkerThread<DERIVED_THREAD>::getNumCmdsInQueue() const
+{
+ return m_CmdQ.size();
+}
+
+template<class DERIVED_THREAD>
bool WorkerThread<DERIVED_THREAD>::init()
{
return true;
@@ -148,17 +155,13 @@ bool WorkerThread<DERIVED_THREAD>::init()
template<class DERIVED_THREAD>
void WorkerThread<DERIVED_THREAD>::processCommands()
{
- try {
- CmdPtr pCmd = m_CmdQ.pop(false);
- while (pCmd) {
- pCmd->execute(dynamic_cast<DERIVED_THREAD*>(this));
+ CmdPtr pCmd = m_CmdQ.pop(false);
+ while (pCmd && !m_bShouldStop) {
+ pCmd->execute(dynamic_cast<DERIVED_THREAD*>(this));
+ if (!m_bShouldStop) {
pCmd = m_CmdQ.pop(false);
}
- } catch (const Exception& e) {
- AVG_TRACE(Logger::ERROR, "Uncaught exception in thread "
- << m_sName << ": " << e.getStr());
}
-
}
}
diff --git a/src/base/XMLHelper.cpp b/src/base/XMLHelper.cpp
index 0fa6bdf..6f362e8 100644
--- a/src/base/XMLHelper.cpp
+++ b/src/base/XMLHelper.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -20,6 +20,8 @@
//
#include "XMLHelper.h"
+#include "Exception.h"
+#include "Logger.h"
#include <libxml/parserInternals.h>
#include <cstring>
@@ -75,4 +77,149 @@ void registerDTDEntityLoader(const string& sID, const string& sDTD)
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
index 5557faf..e258de2 100644
--- a/src/base/XMLHelper.h
+++ b/src/base/XMLHelper.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -23,10 +23,10 @@
#define _XMLHelper_H_
#include "../api.h"
-#include "Point.h"
#include <libxml/parser.h>
#include <libxml/xmlwriter.h>
+#include <libxml/xmlschemas.h>
#include <string>
#include <map>
@@ -38,7 +38,41 @@ std::string getXmlChildrenAsString(const xmlDocPtr xmlDoc, const xmlNodePtr& xml
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 //_XMLHelper_H_
+#endif
diff --git a/src/base/testbase.cpp b/src/base/testbase.cpp
index 656714e..57faf36 100644
--- a/src/base/testbase.cpp
+++ b/src/base/testbase.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -19,13 +19,13 @@
// 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 "Point.h"
-#include "Matrix3x4.h"
-#include "Triangulate.h"
+#include "triangulate/Triangulate.h"
+#include "GLMHelper.h"
#include "GeomHelper.h"
#include "OSHelper.h"
#include "FileHelper.h"
@@ -35,9 +35,13 @@
#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 <boost/thread/thread.hpp>
@@ -52,6 +56,102 @@ 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>());
+ long outgoing2[] = {1};
+ dag.addNode(0, makeOutgoing(1, outgoing2));
+
+ long expected[] = {0, 1};
+ checkResults(&dag, expected);
+ }
+ {
+ DAG dag;
+
+ dag.addNode(2, set<long>());
+ 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>());
+ long outgoing3[] = {2};
+ dag.addNode(1, makeOutgoing(1, outgoing3));
+
+ long expected[] = {0, 1, 2};
+ checkResults(&dag, expected);
+ }
+ {
+ DAG dag;
+
+ dag.addNode(2, set<long>());
+ 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<long> makeOutgoing(int n, long ids[])
+ {
+ set<long> v;
+ for (int i=0; i<n; ++i) {
+ v.insert(ids[i]);
+ }
+ return v;
+ }
+
+ void checkResults(DAG* pDAG, long expected[])
+ {
+ vector<long> results;
+ pDAG->sort(results);
+
+ for (unsigned i=0; i<results.size(); ++i) {
+ QUIET_TEST(results[i] == expected[i]);
+ }
+ }
+};
+
class QueueTest: public Test
{
public:
@@ -67,6 +167,8 @@ public:
}
private:
+ typedef Queue<int>::QElementPtr ElemPtr;
+
void runSingleThreadTests()
{
Queue<string> q;
@@ -92,7 +194,7 @@ private:
void runMultiThreadTests()
{
{
- Queue<string> q(10);
+ Queue<int> q(10);
thread pusher(boost::bind(&pushThread, &q, 100));
thread popper(boost::bind(&popThread, &q, 100));
pusher.join();
@@ -100,7 +202,7 @@ private:
TEST(q.empty());
}
{
- Queue<string> q(10);
+ Queue<int> q(10);
thread pusher1(boost::bind(&pushThread, &q, 100));
thread pusher2(boost::bind(&pushThread, &q, 100));
thread popper(boost::bind(&popThread, &q, 200));
@@ -109,21 +211,25 @@ private:
popper.join();
TEST(q.empty());
}
+ {
+ Queue<int> 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<string>* pq, int numPushes)
+ static void pushThread(Queue<int>* pq, int numPushes)
{
- typedef Queue<string>::QElementPtr ElemPtr;
for (int i=0; i<numPushes; ++i) {
- stringstream ss;
- ss << i;
- string s = ss.str();
- pq->push(ElemPtr(new string(s)));
+ pq->push(ElemPtr(new int(i)));
msleep(1);
}
}
- static void popThread(Queue<string>* pq, int numPops)
+ static void popThread(Queue<int>* pq, int numPops)
{
for (int i=0; i<numPops; ++i) {
pq->peek();
@@ -131,6 +237,27 @@ private:
msleep(3);
}
}
+
+ static void pushClearThread(Queue<int>* pq, int numPushes)
+ {
+ typedef Queue<int>::QElementPtr ElemPtr;
+ for (int i=0; i<numPushes; ++i) {
+ pq->push(ElemPtr(new int(i)));
+ if (i%7 == 0) {
+ pq->clear();
+ }
+ msleep(1);
+ }
+ pq->push(ElemPtr(new int(-1)));
+ }
+
+ static void popClearThread(Queue<int>* pq)
+ {
+ ElemPtr pElem;
+ do {
+ pElem = pq->pop();
+ } while (*pElem != -1);
+ }
};
class TestWorkerThread: public WorkerThread<TestWorkerThread>
@@ -248,103 +375,79 @@ public:
#pragma warning(push)
#pragma warning(disable:4723)
#endif
-class PointTest: public Test
+class GeomTest: public Test
{
public:
- PointTest()
- : Test("PointTest", 2)
+ GeomTest()
+ : Test("GeomTest", 2)
{
}
void runTests()
{
- double one = 1;
- double zero = 0;
-
- TEST(isinf(-one/zero) != 0);
- TEST(isinf(one/zero) != 0);
- TEST(isinf(one) == 0);
- TEST(isnan(sqrt(-one)) != 0);
- TEST(isnan(sqrt(one+one)) == 0);
-
// TODO: Move to a separate math test once we're done here.
TEST(almostEqual(invSqrt(1), 1));
TEST(almostEqual(invSqrt(4), 0.5));
- // TODO: The point tests aren't complete!
- DPoint pt1(0,0);
- DPoint pt2(3,4);
- TEST(calcDist(pt1, pt2)-5 < 0.0001);
- TEST(!almostEqual(pt1, pt2));
- TEST(almostEqual(pt1, pt1));
- std::vector<double> v;
- v.push_back(3);
- v.push_back(4);
- DPoint pt3(v);
- TEST(almostEqual(pt2, pt3));
- TEST(almostEqual(pt3.getNorm(), 5));
- DPoint pt4 = pt3.getNormalized();
- TEST(almostEqual(pt4.getNorm(), 1, 0.0001));
{
- DLineSegment l1(DPoint(0,0), DPoint(2,2));
- DLineSegment l2(DPoint(2,0), DPoint(0,2));
+ 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));
}
{
- DLineSegment l1(DPoint(0,0), DPoint(0,2));
- DLineSegment l2(DPoint(2,0), DPoint(2,2));
+ LineSegment l1(glm::vec2(0,0), glm::vec2(0,2));
+ LineSegment l2(glm::vec2(2,0), glm::vec2(2,2));
TEST(!lineSegmentsIntersect(l1, l2));
}
{
- DLineSegment l1(DPoint(0,0), DPoint(2,0));
- DLineSegment l2(DPoint(0,2), DPoint(2,2));
+ LineSegment l1(glm::vec2(0,0), glm::vec2(2,0));
+ LineSegment l2(glm::vec2(0,2), glm::vec2(2,2));
TEST(!lineSegmentsIntersect(l1, l2));
}
{
- DLineSegment l1(DPoint(0,0), DPoint(2,0));
- TEST(l1.isPointOver(DPoint(1,23)));
- TEST(l1.isPointOver(DPoint(1.9,-5)));
- TEST(!l1.isPointOver(DPoint(-1,1)));
- TEST(!l1.isPointOver(DPoint(3,-1)));
+ 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)));
}
{
- DPoint pt0(DPoint(1,1));
- DPoint pt1(DPoint(1,3));
- DPoint pt2(DPoint(1,-2));
- vector<DPoint> poly;
- poly.push_back(DPoint(0,0));
- poly.push_back(DPoint(2,0));
- poly.push_back(DPoint(2,2));
- poly.push_back(DPoint(0,2));
+ glm::vec2 pt0(glm::vec2(1,1));
+ glm::vec2 pt1(glm::vec2(1,3));
+ glm::vec2 pt2(glm::vec2(1,-2));
+ vector<glm::vec2> 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(DPoint(2,1));
+ poly.push_back(glm::vec2(2,1));
TEST(!pointInPolygon(pt0, poly));
}
{
- DPoint p1(DPoint(0,0));
- DPoint v1(DPoint(1,1));
- DPoint p2(DPoint(2,1));
- DPoint v2(DPoint(1,0));
- TEST(getLineLineIntersection(p1, v1, p2, v2) == DPoint(1,1));
- }
- TEST(almostEqual(DPoint(10,0).getRotatedPivot(M_PI, DPoint(15,5)), DPoint(20,10)));
- TEST(almostEqual(DPoint(10,0).getRotatedPivot(M_PI*0.5, DPoint(15,5)),
- DPoint(20,0)));
- TEST(almostEqual(DPoint(10,0).getRotatedPivot(M_PI*1.5, DPoint(15,5)),
- DPoint(10,10)));
- TEST(almostEqual(DPoint(10,0).getRotatedPivot(M_PI*2, DPoint(15,5)),
- DPoint(10,0)));
- TEST(almostEqual(DPoint(23,0).getRotatedPivot(M_PI*0.5), DPoint(0,23)));
-
- TEST(almostEqual(DPoint(10,0), DPoint::fromPolar(0, 10)));
- TEST(almostEqual(DPoint(0,10), DPoint::fromPolar(M_PI*0.5, 10)));
- TEST(almostEqual(DPoint(0,-1), DPoint::fromPolar(M_PI*1.5, 1)));
- TEST(almostEqual(vecAngle(DPoint(0,1),DPoint(1,0)), M_PI*0.5));
- TEST(almostEqual(vecAngle(DPoint(0,-1),DPoint(1,0)), M_PI*1.5));
- TEST(almostEqual(vecAngle(DPoint(0,2),DPoint(1,0)), M_PI*0.5));
+ 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
@@ -353,32 +456,6 @@ public:
#endif
-class Matrix3x4Test: public Test
-{
-public:
- Matrix3x4Test()
- : Test("Matrix3x4Test", 2)
- {
- }
-
- void runTests()
- {
- Matrix3x4 mat1;
- Matrix3x4 mat2;
- mat1 *= mat2;
- TEST(almostEqual(mat1, Matrix3x4()));
-
- mat2 = Matrix3x4::createTranslate(0,0,0);
- mat1 *= mat2;
- TEST(almostEqual(mat1, Matrix3x4()));
-
- mat2 = Matrix3x4::createScale(1,1,1);
- mat1 *= mat2;
- TEST(almostEqual(mat1, Matrix3x4()));
- }
-};
-
-
class TriangleTest: public Test
{
public:
@@ -389,31 +466,30 @@ public:
void runTests()
{
- Triangle tri(DPoint(0,0), DPoint(4,4), DPoint(4,8));
- TEST(tri.isInside(DPoint(3,4)));
- TEST(!tri.isInside(DPoint(1,4)));
- TEST(!tri.isInside(DPoint(2,1)));
- TEST(!tri.isInside(DPoint(-2,5)));
- TEST(!tri.isInside(DPoint(5,5)));
- tri = Triangle(DPoint(0,0), DPoint(4,8), DPoint(4,4));
- TEST(tri.isInside(DPoint(3,4)));
-
- DPoint polyArray[] = {DPoint(0,0), DPoint(8,2), DPoint(9,0), DPoint(9,3),
- DPoint(1,1), DPoint(0,3)};
-
- DPointVector poly = vectorFromCArray(6, polyArray);
-
- vector<int> triangulation;
- triangulatePolygon(poly, triangulation);
+ 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<unsigned int> triangulation;
+ triangulatePolygon(triangulation, poly);
TEST(triangulation.size() == 4*3);
- int baselineIndexes[] = {1,2,3, 4,5,0, 0,1,3, 3,4,0};
+ 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<triangulation.size(); i++) {
cerr << i << ":" << triangulation[i] << endl;
}
-*/
+*/
}
};
@@ -445,9 +521,8 @@ public:
void runTests()
{
-#if defined(__APPLE__) || defined(_WIN32)
+ cerr << getAvgLibPath() << endl;
TEST(getAvgLibPath() != "");
-#endif
#ifdef __APPLE__
TEST(getMemoryUsage() != 0);
#endif
@@ -466,7 +541,7 @@ public:
void runTests()
{
TEST(stringToInt("5") == 5);
- TEST(almostEqual(stringToDouble("5.5"), 5.5));
+ TEST(almostEqual(stringToFloat("5.5"), 5.5f));
TEST(stringToBool("False") == false);
bool bExceptionThrown = false;
try {
@@ -477,8 +552,8 @@ public:
}
}
TEST(bExceptionThrown);
- TEST(stringToDPoint(" ( 3.4 , 2.1 ) ") == DPoint(3.4, 2.1));
- vector<double> v;
+ TEST(stringToVec2(" ( 3.4 , 2.1 ) ") == glm::vec2(3.4f, 2.1f));
+ vector<float> v;
fromString("(1,2,3,4,5)", v);
TEST(v.size() == 5 && v[0] == 1 && v[4] == 5);
v.clear();
@@ -499,10 +574,10 @@ public:
void runTests()
{
{
- double xd[] = {0,1,2,3};
- vector<double> x = vectorFromCArray(4, xd);
- double yd[] = {3,2,1,0};
- vector<double> y = vectorFromCArray(4, yd);
+ float xd[] = {0,1,2,3};
+ vector<float> x = vectorFromCArray(4, xd);
+ float yd[] = {3,2,1,0};
+ vector<float> y = vectorFromCArray(4, yd);
CubicSpline spline(x, y);
TEST(almostEqual(spline.interpolate(-1), 4));
TEST(almostEqual(spline.interpolate(0), 3));
@@ -511,19 +586,46 @@ public:
TEST(almostEqual(spline.interpolate(3.5), -0.5));
}
{
- double xd[] = {2,4,6,8};
- vector<double> x = vectorFromCArray(4, xd);
- double yd[] = {0,1,3,6};
- vector<double> y = vectorFromCArray(4, yd);
+ float xd[] = {2,4,6,8};
+ vector<float> x = vectorFromCArray(4, xd);
+ float yd[] = {0,1,3,6};
+ vector<float> y = vectorFromCArray(4, yd);
CubicSpline spline(x, y);
TEST(almostEqual(spline.interpolate(0), -1));
- TEST(almostEqual(spline.interpolate(1), -0.5));
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(9), 7.5));
TEST(almostEqual(spline.interpolate(10), 9));
}
+ {
+ float xd[] = {0,1,1};
+ vector<float> x = vectorFromCArray(3, xd);
+ float yd[] = {1,2,1};
+ vector<float> 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<float> x = vectorFromCArray(3, xd);
+ float yd[] = {1,2,1};
+ vector<float> 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));
+ }
+*/
}
};
@@ -538,12 +640,28 @@ public:
void runTests()
{
- BezierCurve curve(DPoint(0,0), DPoint(1,0), DPoint(1,1), DPoint(0,1));
- TEST(almostEqual(curve.interpolate(0), DPoint(0,0)));
- TEST(almostEqual(curve.getDeriv(0), DPoint(3, 0)));
- TEST(almostEqual(curve.interpolate(1), DPoint(0,1)));
- TEST(almostEqual(curve.getDeriv(1), DPoint(-3, 0)));
- TEST(almostEqual(curve.interpolate(0.5), DPoint(0.75,0.5)));
+ 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));
}
};
@@ -731,17 +849,151 @@ public:
};
+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<unsigned int> 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<triangulation.size(); i++) {
+ cerr << i << ":" << triangulation[i] << endl;
+ }/
+*/
+ }
+
+};
+
+
+class XmlParserTest: public Test
+{
+public:
+ XmlParserTest()
+ : Test("XmlParserTest", 2)
+ {
+ }
+
+ void runTests()
+ {
+ string sXmlString = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+ "<shiporder orderid=\"889923\">"
+ " <orderperson>John Smith</orderperson>"
+ "</shiporder>";
+
+ {
+ string sSchema = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+ "<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">"
+ "<xs:element name=\"shiporder\">"
+ " <xs:complexType>"
+ " <xs:sequence>"
+ " <xs:element name=\"orderperson\" type=\"xs:string\"/>"
+ " </xs:sequence>"
+ " <xs:attribute name=\"orderid\" type=\"xs:string\" use=\"required\"/>"
+ " </xs:complexType>"
+ "</xs:element>"
+ "</xs:schema>";
+
+ XMLParser parser;
+ parser.setSchema(sSchema, "shiporder.xsd");
+ parser.parse(sXmlString, "shiporder.xml");
+ }
+ {
+ string sDTD =
+ "<!ELEMENT shiporder (orderperson)* >"
+ "<!ATTLIST shiporder"
+ " orderid CDATA #IMPLIED>"
+ "<!ELEMENT orderperson (#PCDATA) >";
+ 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 PointTest));
- addTest(TestPtr(new Matrix3x4Test));
+ addTest(TestPtr(new GeomTest));
addTest(TestPtr(new TriangleTest));
addTest(TestPtr(new FileTest));
addTest(TestPtr(new OSTest));
@@ -750,6 +1002,9 @@ public:
addTest(TestPtr(new BezierCurveTest));
addTest(TestPtr(new SignalTest));
addTest(TestPtr(new BacktraceTest));
+ addTest(TestPtr(new PolygonTest));
+ addTest(TestPtr(new XmlParserTest));
+ addTest(TestPtr(new StandardLoggerTest));
}
};
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/conradrelais/Makefile.in b/src/base/triangulate/Makefile.in
index 8bce698..4b8384a 100644
--- a/src/conradrelais/Makefile.in
+++ b/src/base/triangulate/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# Makefile.in generated by automake 1.11.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
-# Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -35,17 +35,18 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
-subdir = src/conradrelais
+subdir = src/base/triangulate
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ac_cxx_namespaces.m4 \
$(top_srcdir)/m4/ac_path_generic.m4 \
$(top_srcdir)/m4/ax_boost_thread.m4 \
- $(top_srcdir)/m4/ax_check_gl.m4 $(top_srcdir)/m4/libtool.m4 \
- $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
- $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
- $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/m4/python_dev.m4 \
- $(top_srcdir)/configure.in
+ $(top_srcdir)/m4/ax_check_gl.m4 \
+ $(top_srcdir)/m4/ax_python_devel.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/pkg.m4 \
+ $(top_srcdir)/m4/avg_version.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
@@ -53,12 +54,13 @@ CONFIG_HEADER = $(top_builddir)/src/avgconfig.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
LTLIBRARIES = $(noinst_LTLIBRARIES)
-libconradrelais_la_LIBADD =
+libtriangulate_la_LIBADD =
am__objects_1 =
-am_libconradrelais_la_OBJECTS = ConradRelais.lo $(am__objects_1)
-libconradrelais_la_OBJECTS = $(am_libconradrelais_la_OBJECTS)
-AM_V_lt = $(am__v_lt_$(V))
-am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
+am_libtriangulate_la_OBJECTS = Triangulate.lo Shapes.lo \
+ AdvancingFront.lo Sweep.lo SweepContext.lo $(am__objects_1)
+libtriangulate_la_OBJECTS = $(am_libtriangulate_la_OBJECTS)
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
am__v_lt_0 = --silent
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src
depcomp = $(SHELL) $(top_srcdir)/depcomp
@@ -70,18 +72,18 @@ LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CXXFLAGS) $(CXXFLAGS)
-AM_V_CXX = $(am__v_CXX_$(V))
-am__v_CXX_ = $(am__v_CXX_$(AM_DEFAULT_VERBOSITY))
+AM_V_CXX = $(am__v_CXX_@AM_V@)
+am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@)
am__v_CXX_0 = @echo " CXX " $@;
-AM_V_at = $(am__v_at_$(V))
-am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
CXXLD = $(CXX)
CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
$(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
-AM_V_CXXLD = $(am__v_CXXLD_$(V))
-am__v_CXXLD_ = $(am__v_CXXLD_$(AM_DEFAULT_VERBOSITY))
+AM_V_CXXLD = $(am__v_CXXLD_@AM_V@)
+am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@)
am__v_CXXLD_0 = @echo " CXXLD " $@;
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@@ -89,21 +91,21 @@ LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
-AM_V_CC = $(am__v_CC_$(V))
-am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
+AM_V_CC = $(am__v_CC_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
am__v_CC_0 = @echo " CC " $@;
CCLD = $(CC)
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
-AM_V_CCLD = $(am__v_CCLD_$(V))
-am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
-AM_V_GEN = $(am__v_GEN_$(V))
-am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
-SOURCES = $(libconradrelais_la_SOURCES)
-DIST_SOURCES = $(libconradrelais_la_SOURCES)
+SOURCES = $(libtriangulate_la_SOURCES)
+DIST_SOURCES = $(libtriangulate_la_SOURCES)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -116,7 +118,7 @@ AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BOOST_PYTHON_LIBS = @BOOST_PYTHON_LIBS@
-BOOST_THREAD_LIB = @BOOST_THREAD_LIB@
+BOOST_THREAD_LIBS = @BOOST_THREAD_LIBS@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
@@ -131,6 +133,7 @@ DC1394_2_CFLAGS = @DC1394_2_CFLAGS@
DC1394_2_LIBS = @DC1394_2_LIBS@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
@@ -171,6 +174,7 @@ LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
MTDEV_CFLAGS = @MTDEV_CFLAGS@
MTDEV_LIBS = @MTDEV_LIBS@
@@ -200,11 +204,13 @@ PTHREAD_CC = @PTHREAD_CC@
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
PTHREAD_LIBS = @PTHREAD_LIBS@
PYTHON = @PYTHON@
+PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@
PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
-PYTHON_INCLUDES = @PYTHON_INCLUDES@
-PYTHON_LIBS = @PYTHON_LIBS@
+PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@
+PYTHON_LDFLAGS = @PYTHON_LDFLAGS@
PYTHON_PLATFORM = @PYTHON_PLATFORM@
PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_SITE_PKG = @PYTHON_SITE_PKG@
PYTHON_VERSION = @PYTHON_VERSION@
RANLIB = @RANLIB@
SDL_CFLAGS = @SDL_CFLAGS@
@@ -227,6 +233,7 @@ abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
@@ -261,7 +268,6 @@ libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
@@ -285,10 +291,15 @@ target_vendor = @target_vendor@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-INCLUDES = -I. @XML2_CFLAGS@ @PYTHON_INCLUDES@ @PTHREAD_CFLAGS@
-ALL_H = ConradRelais.h
-noinst_LTLIBRARIES = libconradrelais.la
-libconradrelais_la_SOURCES = ConradRelais.cpp $(ALL_H)
+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)
+
all: all-am
.SUFFIXES:
@@ -302,9 +313,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/conradrelais/Makefile'; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/base/triangulate/Makefile'; \
$(am__cd) $(top_srcdir) && \
- $(AUTOMAKE) --foreign src/conradrelais/Makefile
+ $(AUTOMAKE) --foreign src/base/triangulate/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
@@ -332,8 +343,8 @@ clean-noinstLTLIBRARIES:
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
-libconradrelais.la: $(libconradrelais_la_OBJECTS) $(libconradrelais_la_DEPENDENCIES)
- $(AM_V_CXXLD)$(CXXLINK) $(libconradrelais_la_OBJECTS) $(libconradrelais_la_LIBADD) $(LIBS)
+libtriangulate.la: $(libtriangulate_la_OBJECTS) $(libtriangulate_la_DEPENDENCIES) $(EXTRA_libtriangulate_la_DEPENDENCIES)
+ $(AM_V_CXXLD)$(CXXLINK) $(libtriangulate_la_OBJECTS) $(libtriangulate_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
@@ -341,31 +352,32 @@ mostlyclean-compile:
distclean-compile:
-rm -f *.tab.c
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ConradRelais.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/AdvancingFront.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Shapes.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Sweep.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SweepContext.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Triangulate.Plo@am__quote@
.cpp.o:
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $<
.cpp.obj:
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
.cpp.lo:
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
-@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
@@ -469,10 +481,15 @@ install-am: all-am
installcheck: installcheck-am
install-strip:
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- `test -z '$(STRIP)' || \
- echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
mostlyclean-generic:
clean-generic:
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 <iostream>
+
+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 <vector>
+#include <cstddef>
+#include <assert.h>
+#include <cmath>
+
+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<Edge*> 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 <stdexcept>
+#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 <vector>
+
+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);
+
+ /**
+ * <b>Requirement</b>:<br>
+ * 1. a,b and c form a triangle.<br>
+ * 2. a and d is know to be on opposite side of bc<br>
+ * <pre>
+ * a
+ * +
+ * / \
+ * / \
+ * b/ \c
+ * +-------+
+ * / d \
+ * / \
+ * </pre>
+ * <b>Fact</b>: d has to be in area B to have a chance to be inside the circle formed by
+ * a,b and c<br>
+ * d is outside B if orient2d(a,b,d) or orient2d(c,a,d) is CW<br>
+ * 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
+ *<pre>
+ * n2 n2
+ * P +-----+ P +-----+
+ * | t /| |\ t |
+ * | / | | \ |
+ * n1| / |n3 n1| \ |n3
+ * | / | after CW | \ |
+ * |/ oT | | oT \|
+ * +-----+ oP +-----+
+ * n4 n4
+ * </pre>
+ */
+ 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<br>
+ * 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<Node*> 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 <algorithm>
+#include "AdvancingFront.h"
+
+namespace avg {
+
+SweepContext::SweepContext(std::vector<Point*> polyline)
+{
+ m_Basin = Basin();
+ m_EdgeEvent = EdgeEvent();
+
+ m_Points = polyline;
+
+ initEdges(m_Points);
+}
+
+void SweepContext::addHole(std::vector<Point*> 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<TriangulationTriangle*>& 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<Point*> 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<TriangulationTriangle*> 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 <list>
+#include <vector>
+#include <cstddef>
+
+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<Point*> 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<Point*> polyline);
+
+ void addPoint(Point* point);
+
+ AdvancingFront* front();
+
+ void meshClean(TriangulationTriangle& triangle);
+
+ std::vector<TriangulationTriangle*>& getTriangles();
+
+ std::vector<Edge*> 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<TriangulationTriangle*> m_Triangles;
+ std::list<TriangulationTriangle*> m_Map;
+ std::vector<Point*> m_Points;
+
+ AdvancingFront* m_Front;
+ Point* m_Head;
+ Point* m_Tail;
+
+ Node *m_AfHead, *m_AfMiddle, *m_AfTail;
+
+ void initTriangulation();
+ void initEdges(std::vector<Point*> 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<unsigned int>& dest, const Vec2Vector& points,
+ const std::vector<unsigned int>& holeIndexes)
+{
+ std::vector<Point*> polyline;
+ std::vector<Point*> 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<avg::TriangulationTriangle*>& 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<unsigned int>& dest, const Vec2Vector& points,
+ const std::vector<unsigned int>& holeIndexes = std::vector<unsigned int>());
+
+}
+
+#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 <exception>
+#include <math.h>
+
+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<br>
+ * Positive if CCW<br>
+ * Negative if CW<br>
+ * 0 if collinear<br>
+ * <pre>
+ * A[P1,P2,P3] = (x1*y2 - y1*x2) + (x2*y3 - y2*x3) + (x3*y1 - y3*x1)
+ * = (x1-x3)*(y2-y3) - (y1-y3)*(x2-x3)
+ * </pre>
+ */
+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/conradrelais/ConradRelais.cpp b/src/conradrelais/ConradRelais.cpp
deleted file mode 100644
index 3fa4336..0000000
--- a/src/conradrelais/ConradRelais.cpp
+++ /dev/null
@@ -1,179 +0,0 @@
-//
-// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 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 "ConradRelais.h"
-#include "../base/Logger.h"
-
-#include <termios.h>
-#include <unistd.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <math.h>
-#include <errno.h>
-#include <iostream>
-#include <sstream>
-#include <string>
-
-using namespace std;
-
-namespace avg {
-
-ConradRelais::ConradRelais(Player * pPlayer, int port)
- : m_IsInitialized(false),
- m_File(-1),
- m_NumCards(0),
- m_pPlayer(pPlayer)
-{
- m_Port = port;
- stringstream s;
- s << "/dev/ttyS" << m_Port;
- m_File = open(s.str().c_str(), O_RDWR | O_NOCTTY | O_NDELAY); //O_NONBLOCK);
- if (m_File == -1) {
- AVG_TRACE(Logger::ERROR, "Could not open " << s.str()
- << " for conrad relais card (Reason:'" << strerror(errno)
- << "'). Disabling.");
- } else {
- initBoard();
- if (m_File != -1) {
- pPlayer->registerFrameEndListener(this);
- }
- }
-}
-
-ConradRelais::~ConradRelais()
-{
- if (m_File != -1) {
- send();
- m_pPlayer->unregisterFrameEndListener(this);
- close(m_File);
- m_File = -1;
- }
-}
-
-int ConradRelais::getNumCards()
-{
- return m_NumCards;
-}
-
-void ConradRelais::set(int card, int index, bool bOn)
-{
- if (m_File != -1) {
- unsigned char bitMask = (unsigned char)(pow((double)2, index));
- if (bOn) {
- m_State[card] |= bitMask;
- } else {
- m_State[card] &= 255-bitMask;
- }
- }
-}
-
-bool ConradRelais::get(int card, int index)
-{
- unsigned char bitMask = (unsigned char)(pow((double)2, index));
- return (bitMask & m_State[card]) == bitMask;
-}
-
-void ConradRelais::send()
-{
- if (m_File != -1) {
- for (int i=0; i<m_NumCards; i++) {
- sendCmd(3,i+1,m_State[i]);
- }
- }
-}
-
-void ConradRelais::initBoard()
-{
- fcntl(m_File, F_SETFL, 0);
-
- /* get the current options */
- struct termios options;
- tcgetattr(m_File, &options);
-
- /* set in and out speed */
- cfsetispeed(&options, B19200);
- cfsetospeed(&options, B19200);
-
- options.c_cflag &= ~PARENB;
- options.c_cflag &= ~CSTOPB;
- options.c_cflag &= ~CSIZE; /* Mask the character size bits */
- options.c_cflag |= CS8; /* Select 8 data bits */
-
- /* set raw input, 1 second timeout */
- options.c_cflag |= (CLOCAL | CREAD);
- options.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG);
- options.c_oflag &= ~OPOST;
- options.c_cc[VMIN] = 0;
- options.c_cc[VTIME] = 10;
-
- /* set the options */
- tcsetattr(m_File, TCSAFLUSH, &options);
-
- /*
- * init the circuit board
- */
- sendCmd(1, 1, 0);
- fcntl(m_File, F_SETFL, FNDELAY);
- fcntl(m_File, F_SETFL, 0);
- unsigned char rbuf[4];
- m_NumCards = 0;
- bool bOk = true;
- // One read per card should succeed.
- while (bOk) {
- ssize_t rc = read(m_File, rbuf, 4);
- if (rc != 4 || rbuf[0] != 254 || rbuf[1] != m_NumCards+1) {
- bOk = false;
- } else {
- m_NumCards++;
- }
- }
- if (m_NumCards == 0) {
- AVG_TRACE(Logger::ERROR,
- "No Conrad Relais cards detected. Disabling relais output.");
- close(m_File);
- m_File = -1;
- }
-}
-
-void ConradRelais::sendCmd(unsigned char a, unsigned char b, unsigned char c)
-{
- unsigned char Buffer[4];
- Buffer[0] = a;
- Buffer[1] = b;
- Buffer[2] = c;
- Buffer[3] = Buffer[0]^Buffer[1]^Buffer[2];
-
- ssize_t BytesWritten = write(m_File, Buffer, 4);
- if (BytesWritten != 4) {
- AVG_TRACE(Logger::ERROR,
- "Could not send data to conrad relais card. Disabling.");
- close(m_File);
- m_File = -1;
- }
-}
-
-void ConradRelais::onFrameEnd()
-{
- send();
-}
-
-}
diff --git a/src/conradrelais/ConradRelais.h b/src/conradrelais/ConradRelais.h
deleted file mode 100644
index e133048..0000000
--- a/src/conradrelais/ConradRelais.h
+++ /dev/null
@@ -1,74 +0,0 @@
-//
-// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 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 _ConradRelais_H_
-#define _ConradRelais_H_
-
-#include "../api.h"
-#include "../base/IFrameEndListener.h"
-
-#include "../player/Player.h"
-
-namespace avg {
-
-/**
- * Interface to one or more conrad relais card connected to a serial
- * port. Per card, up to eight 220V devices can be turned on or off.
- */
-class AVG_API ConradRelais: public IFrameEndListener
-{
- public:
- ConradRelais (Player * pPlayer, int port);
- virtual ~ConradRelais ();
-
- /**
- * Returns the number of cards connected to the serial port.
- */
- int getNumCards();
- /**
- * Sets or resets one of the relais. index selects the relais
- * to set.
- */
- void set(int card, int index, bool bOn);
- /**
- * Returns the state of one of the relais. index selects the
- * relais to query.
- */
- bool get(int card, int index);
-
- void send();
-
- virtual void onFrameEnd();
-
- private:
- void sendCmd(unsigned char a, unsigned char b, unsigned char c);
- void initBoard();
- unsigned char m_State[256];
- bool m_IsInitialized;
- int m_Port;
- int m_File;
- int m_NumCards;
-
- Player * m_pPlayer;
-};
-
-}
-#endif
diff --git a/src/conradrelais/Makefile.am b/src/conradrelais/Makefile.am
deleted file mode 100644
index 57eb05e..0000000
--- a/src/conradrelais/Makefile.am
+++ /dev/null
@@ -1,7 +0,0 @@
-
-INCLUDES = -I. @XML2_CFLAGS@ @PYTHON_INCLUDES@ @PTHREAD_CFLAGS@
-
-ALL_H = ConradRelais.h
-
-noinst_LTLIBRARIES = libconradrelais.la
-libconradrelais_la_SOURCES = ConradRelais.cpp $(ALL_H)
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 <cassert>
+
+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<bool C>
+ struct If
+ {
+ template<typename F, typename T>
+ static GLM_FUNC_QUALIFIER T apply(F functor, const T& val)
+ {
+ return functor(val);
+ }
+ };
+
+ template<>
+ struct If<false>
+ {
+ template<typename F, typename T>
+ static GLM_FUNC_QUALIFIER T apply(F, const T& val)
+ {
+ return val;
+ }
+ };
+
+ //template <typename T>
+ //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<half>
+ //{
+ // static const bool is_float = true;
+ // static const bool is_genType = true;
+ //};
+
+ //template <>
+ //struct traits<float>
+ //{
+ // static const bool is_float = true;
+ // static const bool is_genType = true;
+ //};
+
+ //template <>
+ //struct traits<double>
+ //{
+ // static const bool is_float = true;
+ // static const bool is_genType = true;
+ //};
+
+ //template <typename genType>
+ //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 <typename genType>
+ //const typename desc<genType>::size_type desc<genType>::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 <typename T>
+ struct is_int
+ {
+ enum is_int_enum
+ {
+ _YES = 0,
+ _NO = 1
+ };
+ };
+
+#define GLM_DETAIL_IS_INT(T) \
+ template <> \
+ struct is_int<T> \
+ { \
+ enum is_int_enum \
+ { \
+ _YES = 1, \
+ _NO = 0 \
+ }; \
+ }
+
+ //////////////////
+ // uint
+
+ template <typename T>
+ struct is_uint
+ {
+ enum is_uint_enum
+ {
+ _YES = 0,
+ _NO = 1
+ };
+ };
+
+#define GLM_DETAIL_IS_UINT(T) \
+ template <> \
+ struct is_uint<T> \
+ { \
+ enum is_uint_enum \
+ { \
+ _YES = 1, \
+ _NO = 0 \
+ }; \
+ }
+
+ //GLM_DETAIL_IS_UINT(unsigned long long)
+
+ //////////////////
+ // float
+
+ template <typename T>
+ struct is_float
+ {
+ enum is_float_enum
+ {
+ _YES = 0,
+ _NO = 1
+ };
+ };
+
+#define GLM_DETAIL_IS_FLOAT(T) \
+ template <> \
+ struct is_float<T> \
+ { \
+ enum is_float_enum \
+ { \
+ _YES = 1, \
+ _NO = 0 \
+ }; \
+ }
+
+ //////////////////
+ // bool
+
+ template <typename T>
+ struct is_bool
+ {
+ enum is_bool_enum
+ {
+ _YES = 0,
+ _NO = 1
+ };
+ };
+
+ template <>
+ struct is_bool<bool>
+ {
+ enum is_bool_enum
+ {
+ _YES = 1,
+ _NO = 0
+ };
+ };
+
+ //////////////////
+ // vector
+
+ template <typename T>
+ struct is_vector
+ {
+ enum is_vector_enum
+ {
+ _YES = 0,
+ _NO = 1
+ };
+ };
+
+# define GLM_DETAIL_IS_VECTOR(TYPE) \
+ template <typename T> \
+ struct is_vector<TYPE<T> > \
+ { \
+ enum is_vector_enum \
+ { \
+ _YES = 1, \
+ _NO = 0 \
+ }; \
+ }
+
+ //////////////////
+ // matrix
+
+ template <typename T>
+ 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 <typename T>
+ struct type
+ {
+ enum type_enum
+ {
+ is_float = is_float<T>::_YES,
+ is_int = is_int<T>::_YES,
+ is_uint = is_uint<T>::_YES,
+ is_bool = is_bool<T>::_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/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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/abs.xml">GLSL abs man page</a>
+ //! \li GLSL 1.30.08 specification, section 8.3
+ template <typename genFIType>
+ genFIType abs(genFIType const & x);
+
+ //! Returns 1.0 if x > 0, 0.0 if x == 0, or -1.0 if x < 0.
+ //!
+ //! \li <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/sign.xml">GLSL sign man page</a>
+ //! \li GLSL 1.30.08 specification, section 8.3
+ template <typename genFIType>
+ genFIType sign(genFIType const & x);
+
+ //! Returns a value equal to the nearest integer that is less then or equal to x.
+ //!
+ //! \li <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/floor.xml">GLSL floor man page</a>
+ //! \li GLSL 1.30.08 specification, section 8.3
+ template <typename genType>
+ 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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/trunc.xml">GLSL trunc man page</a>
+ //! \li GLSL 1.30.08 specification, section 8.3
+ template <typename genType>
+ 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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/round.xml">GLSL round man page</a>
+ //! \li GLSL 1.30.08 specification, section 8.3
+ template <typename genType>
+ 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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/roundEven.xml">GLSL roundEven man page</a>
+ //! \li GLSL 1.30.08 specification, section 8.3
+ template <typename genType>
+ genType roundEven(genType const & x);
+
+ //! Returns a value equal to the nearest integer
+ //! that is greater than or equal to x.
+ //!
+ //! \li <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/ceil.xml">GLSL ceil man page</a>
+ //! \li GLSL 1.30.08 specification, section 8.3
+ template <typename genType>
+ genType ceil(genType const & x);
+
+ //! Return x - floor(x).
+ //!
+ //! \li <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/fract.xml">GLSL fract man page</a>
+ //! \li GLSL 1.30.08 specification, section 8.3
+ template <typename genType>
+ genType fract(genType const & x);
+
+ //! Modulus. Returns x - y * floor(x / y)
+ //! for each component in x using the floating point value y.
+ //!
+ //! \li <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/mod.xml">GLSL mod man page</a>
+ //! \li GLSL 1.30.08 specification, section 8.3
+ template <typename genType>
+ 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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/mod.xml">GLSL mod man page</a>
+ //! \li GLSL 1.30.08 specification, section 8.3
+ template <typename genType>
+ 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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/modf.xml">GLSL modf man page</a>
+ //! \li GLSL 1.30.08 specification, section 8.3
+ template <typename genType>
+ genType modf(
+ genType const & x,
+ genType & i);
+
+ //! Returns y if y < x; otherwise, it returns x.
+ //!
+ //! \li <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/min.xml">GLSL min man page</a>
+ //! \li GLSL 1.30.08 specification, section 8.3
+ template <typename genType>
+ genType min(
+ genType const & x,
+ genType const & y);
+
+ template <typename genType>
+ genType min(
+ genType const & x,
+ typename genType::value_type const & y);
+
+ //! Returns y if x < y; otherwise, it returns x.
+ //!
+ //! \li <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/max.xml">GLSL max man page</a>
+ //! \li GLSL 1.30.08 specification, section 8.3
+ template <typename genType>
+ genType max(
+ genType const & x,
+ genType const & y);
+
+ template <typename genType>
+ 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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/clamp.xml">GLSL clamp man page</a>
+ //! \li GLSL 1.30.08 specification, section 8.3
+ template <typename genType>
+ genType clamp(
+ genType const & x,
+ genType const & minVal,
+ genType const & maxVal);
+
+ template <typename genType>
+ 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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/mix.xml">GLSL mix man page</a>
+ //! \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 <typename genTypeT, typename genTypeU>
+ genTypeT mix(genTypeT const & x, genTypeT const & y, genTypeU const & a);
+
+ //! Returns 0.0 if x < edge, otherwise it returns 1.0.
+ //!
+ //! \li <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/step.xml">GLSL step man page</a>
+ //! \li GLSL 1.30.08 specification, section 8.3
+ template <typename genType>
+ genType step(
+ genType const & edge,
+ genType const & x);
+
+ template <typename genType>
+ 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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/smoothstep.xml">GLSL smoothstep man page</a>
+ //! \li GLSL 1.30.08 specification, section 8.3
+ template <typename genType>
+ genType smoothstep(
+ genType const & edge0,
+ genType const & edge1,
+ genType const & x);
+
+ template <typename genType>
+ 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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/isnan.xml">GLSL isnan man page</a>
+ //! \li GLSL 1.30.08 specification, section 8.3
+ template <typename genType>
+ 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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/isinf.xml">GLSL isinf man page</a>
+ //! \li GLSL 1.30.08 specification, section 8.3
+ template <typename genType>
+ 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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/floatBitsToInt.xml">GLSL floatBitsToInt man page</a>
+ //! \li GLSL 4.00.08 specification, section 8.3
+ template <typename genType, typename genIType>
+ 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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/floatBitsToUint.xml">GLSL floatBitsToUint man page</a>
+ //! \li GLSL 4.00.08 specification, section 8.3
+ template <typename genType, typename genUType>
+ 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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/intBitsToFloat.xml">GLSL intBitsToFloat man page</a>
+ //! \li GLSL 4.00.08 specification, section 8.3
+ template <typename genType, typename genIType>
+ 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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/uintBitsToFloat.xml">GLSL uintBitsToFloat man page</a>
+ //! \li GLSL 4.00.08 specification, section 8.3
+ template <typename genType, typename genUType>
+ genType uintBitsToFloat(genUType const & value);
+
+ //! Computes and returns a * b + c.
+ //!
+ //! \li <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/fma.xml">GLSL fma man page</a>
+ //! \li GLSL 4.00.08 specification, section 8.3
+ template <typename genType>
+ 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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/frexp.xml">GLSL frexp man page</a>
+ //! \li GLSL 4.00.08 specification, section 8.3
+ template <typename genType, typename genIType>
+ 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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/ldexp.xml">GLSL ldexp man page</a>;
+ //! \li GLSL 4.00.08 specification, section 8.3
+ template <typename genType, typename genIType>
+ 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 <typename genFIType, bool /*signed*/>
+ struct Abs_
+ {
+ };
+
+ template <typename genFIType>
+ struct Abs_<genFIType, true>
+ {
+ static genFIType get(genFIType const & x)
+ {
+ GLM_STATIC_ASSERT(
+ detail::type<genFIType>::is_float ||
+ detail::type<genFIType>::is_int, "'abs' only accept floating-point and integer inputs");
+ return x >= genFIType(0) ? x : -x;
+ }
+ };
+
+ template <typename genFIType>
+ struct Abs_<genFIType, false>
+ {
+ static genFIType get(genFIType const & x)
+ {
+ GLM_STATIC_ASSERT(
+ detail::type<genFIType>::is_uint, "'abs' only accept floating-point and integer inputs");
+
+ return x;
+ }
+ };
+ }//namespace detail
+
+ namespace core{
+ namespace function{
+ namespace common{
+
+ // abs
+ template <typename genFIType>
+ GLM_FUNC_QUALIFIER genFIType abs(
+ genFIType const & x)
+ {
+ return detail::Abs_<genFIType, std::numeric_limits<genFIType>::is_signed>::get(x);
+ }
+
+ //template <typename T>
+ //GLM_FUNC_QUALIFIER detail::tvec1<T> abs(
+ // detail::tvec1<T> const & v)
+ //{
+ // return detail::tvec1<T>(
+ // abs(v.x));
+ //}
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> abs(
+ detail::tvec2<T> const & v)
+ {
+ return detail::tvec2<T>(
+ abs(v.x),
+ abs(v.y));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> abs(
+ detail::tvec3<T> const & v)
+ {
+ return detail::tvec3<T>(
+ abs(v.x),
+ abs(v.y),
+ abs(v.z));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> abs(
+ detail::tvec4<T> const & v)
+ {
+ return detail::tvec4<T>(
+ 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 <typename genFIType>
+ GLM_FUNC_QUALIFIER genFIType sign(
+ genFIType const & x)
+ {
+ GLM_STATIC_ASSERT(
+ detail::type<genFIType>::is_float ||
+ detail::type<genFIType>::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 <typename valFIType>
+ GLM_FUNC_QUALIFIER detail::tvec2<valFIType> sign(
+ detail::tvec2<valFIType> const & x)
+ {
+ return detail::tvec2<valFIType>(
+ sign(x.x),
+ sign(x.y));
+ }
+
+ template <typename valFIType>
+ GLM_FUNC_QUALIFIER detail::tvec3<valFIType> sign(
+ detail::tvec3<valFIType> const & x)
+ {
+ return detail::tvec3<valFIType>(
+ sign(x.x),
+ sign(x.y),
+ sign(x.z));
+ }
+
+ template <typename valFIType>
+ GLM_FUNC_QUALIFIER detail::tvec4<valFIType> sign(
+ detail::tvec4<valFIType> const & x)
+ {
+ return detail::tvec4<valFIType>(
+ sign(x.x),
+ sign(x.y),
+ sign(x.z),
+ sign(x.w));
+ }
+
+ // floor
+ template <>
+ GLM_FUNC_QUALIFIER detail::thalf floor<detail::thalf>(detail::thalf const& x)
+ {
+ return detail::thalf(::std::floor(float(x)));
+ }
+
+ template <typename genType>
+ GLM_FUNC_QUALIFIER genType floor(genType const& x)
+ {
+ GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'floor' only accept floating-point inputs");
+
+ return ::std::floor(x);
+ }
+
+ template <typename valType>
+ GLM_FUNC_QUALIFIER detail::tvec2<valType> floor(detail::tvec2<valType> const& x)
+ {
+ return detail::tvec2<valType>(
+ floor(x.x),
+ floor(x.y));
+ }
+
+ template <typename valType>
+ GLM_FUNC_QUALIFIER detail::tvec3<valType> floor(detail::tvec3<valType> const& x)
+ {
+ return detail::tvec3<valType>(
+ floor(x.x),
+ floor(x.y),
+ floor(x.z));
+ }
+
+ template <typename valType>
+ GLM_FUNC_QUALIFIER detail::tvec4<valType> floor(detail::tvec4<valType> const& x)
+ {
+ return detail::tvec4<valType>(
+ floor(x.x),
+ floor(x.y),
+ floor(x.z),
+ floor(x.w));
+ }
+
+ // trunc
+ template <typename genType>
+ GLM_FUNC_QUALIFIER genType trunc(genType const & x)
+ {
+ GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'trunc' only accept floating-point inputs");
+ return x < 0 ? -floor(-x) : floor(x);
+ }
+
+ template <typename valType>
+ GLM_FUNC_QUALIFIER detail::tvec2<valType> trunc(detail::tvec2<valType> const & x)
+ {
+ return detail::tvec2<valType>(
+ trunc(x.x),
+ trunc(x.y));
+ }
+
+ template <typename valType>
+ GLM_FUNC_QUALIFIER detail::tvec3<valType> trunc(detail::tvec3<valType> const & x)
+ {
+ return detail::tvec3<valType>(
+ trunc(x.x),
+ trunc(x.y),
+ trunc(x.z));
+ }
+
+ template <typename valType>
+ GLM_FUNC_QUALIFIER detail::tvec4<valType> trunc(detail::tvec4<valType> const & x)
+ {
+ return detail::tvec4<valType>(
+ trunc(x.x),
+ trunc(x.y),
+ trunc(x.z),
+ trunc(x.w));
+ }
+
+ // round
+ template <typename genType>
+ GLM_FUNC_QUALIFIER genType round(genType const& x)
+ {
+ GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'round' only accept floating-point inputs");
+
+ return genType(int(x + genType(0.5)));
+ }
+
+ template <typename valType>
+ GLM_FUNC_QUALIFIER detail::tvec2<valType> round(detail::tvec2<valType> const& x)
+ {
+ return detail::tvec2<valType>(
+ round(x.x),
+ round(x.y));
+ }
+
+ template <typename valType>
+ GLM_FUNC_QUALIFIER detail::tvec3<valType> round(detail::tvec3<valType> const& x)
+ {
+ return detail::tvec3<valType>(
+ round(x.x),
+ round(x.y),
+ round(x.z));
+ }
+
+ template <typename valType>
+ GLM_FUNC_QUALIFIER detail::tvec4<valType> round(detail::tvec4<valType> const& x)
+ {
+ return detail::tvec4<valType>(
+ round(x.x),
+ round(x.y),
+ round(x.z),
+ round(x.w));
+ }
+
+ // roundEven
+ template <typename genType>
+ GLM_FUNC_QUALIFIER genType roundEven(genType const& x)
+ {
+ GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'roundEven' only accept floating-point inputs");
+
+ return genType(int(x + genType(int(x) % 2)));
+ }
+
+ template <typename valType>
+ GLM_FUNC_QUALIFIER detail::tvec2<valType> roundEven(detail::tvec2<valType> const& x)
+ {
+ return detail::tvec2<valType>(
+ roundEven(x.x),
+ roundEven(x.y));
+ }
+
+ template <typename valType>
+ GLM_FUNC_QUALIFIER detail::tvec3<valType> roundEven(detail::tvec3<valType> const& x)
+ {
+ return detail::tvec3<valType>(
+ roundEven(x.x),
+ roundEven(x.y),
+ roundEven(x.z));
+ }
+
+ template <typename valType>
+ GLM_FUNC_QUALIFIER detail::tvec4<valType> roundEven(detail::tvec4<valType> const& x)
+ {
+ return detail::tvec4<valType>(
+ roundEven(x.x),
+ roundEven(x.y),
+ roundEven(x.z),
+ roundEven(x.w));
+ }
+
+ // ceil
+ template <typename genType>
+ GLM_FUNC_QUALIFIER genType ceil(genType const & x)
+ {
+ GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'ceil' only accept floating-point inputs");
+
+ return ::std::ceil(x);
+ }
+
+ template <typename valType>
+ GLM_FUNC_QUALIFIER detail::tvec2<valType> ceil(detail::tvec2<valType> const & x)
+ {
+ return detail::tvec2<valType>(
+ ceil(x.x),
+ ceil(x.y));
+ }
+
+ template <typename valType>
+ GLM_FUNC_QUALIFIER detail::tvec3<valType> ceil(detail::tvec3<valType> const & x)
+ {
+ return detail::tvec3<valType>(
+ ceil(x.x),
+ ceil(x.y),
+ ceil(x.z));
+ }
+
+ template <typename valType>
+ GLM_FUNC_QUALIFIER detail::tvec4<valType> ceil(detail::tvec4<valType> const & x)
+ {
+ return detail::tvec4<valType>(
+ ceil(x.x),
+ ceil(x.y),
+ ceil(x.z),
+ ceil(x.w));
+ }
+
+ // fract
+ template <typename genType>
+ GLM_FUNC_QUALIFIER genType fract
+ (
+ genType const & x
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'fract' only accept floating-point inputs");
+
+ return x - ::std::floor(x);
+ }
+
+ template <typename valType>
+ GLM_FUNC_QUALIFIER detail::tvec2<valType> fract
+ (
+ detail::tvec2<valType> const & x
+ )
+ {
+ return detail::tvec2<valType>(
+ fract(x.x),
+ fract(x.y));
+ }
+
+ template <typename valType>
+ GLM_FUNC_QUALIFIER detail::tvec3<valType> fract
+ (
+ detail::tvec3<valType> const & x
+ )
+ {
+ return detail::tvec3<valType>(
+ fract(x.x),
+ fract(x.y),
+ fract(x.z));
+ }
+
+ template <typename valType>
+ GLM_FUNC_QUALIFIER detail::tvec4<valType> fract
+ (
+ detail::tvec4<valType> const & x
+ )
+ {
+ return detail::tvec4<valType>(
+ fract(x.x),
+ fract(x.y),
+ fract(x.z),
+ fract(x.w));
+ }
+
+ // mod
+ template <typename genType>
+ GLM_FUNC_QUALIFIER genType mod
+ (
+ genType const & x,
+ genType const & y
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'mod' only accept floating-point inputs");
+
+ return x - y * floor(x / y);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> mod
+ (
+ detail::tvec2<T> const & x,
+ typename detail::tvec2<T>::value_type const & y
+ )
+ {
+ return detail::tvec2<T>(
+ mod(x.x, y),
+ mod(x.y, y));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> mod
+ (
+ detail::tvec3<T> const & x,
+ typename detail::tvec3<T>::value_type const & y
+ )
+ {
+ return detail::tvec3<T>(
+ mod(x.x, y),
+ mod(x.y, y),
+ mod(x.z, y));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> mod
+ (
+ detail::tvec4<T> const & x,
+ typename detail::tvec4<T>::value_type const & y
+ )
+ {
+ return detail::tvec4<T>(
+ mod(x.x, y),
+ mod(x.y, y),
+ mod(x.z, y),
+ mod(x.w, y));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> mod
+ (
+ detail::tvec2<T> const & x,
+ detail::tvec2<T> const & y
+ )
+ {
+ return detail::tvec2<T>(
+ mod(x.x, y.x),
+ mod(x.y, y.y));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> mod
+ (
+ detail::tvec3<T> const & x,
+ detail::tvec3<T> const & y
+ )
+ {
+ return detail::tvec3<T>(
+ mod(x.x, y.x),
+ mod(x.y, y.y),
+ mod(x.z, y.z));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> mod
+ (
+ detail::tvec4<T> const & x,
+ detail::tvec4<T> const & y
+ )
+ {
+ return detail::tvec4<T>(
+ mod(x.x, y.x),
+ mod(x.y, y.y),
+ mod(x.z, y.z),
+ mod(x.w, y.w));
+ }
+
+ // modf
+ template <typename genType>
+ GLM_FUNC_QUALIFIER genType modf
+ (
+ genType const & x,
+ genType & i
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'modf' only accept floating-point inputs");
+
+ i = glm::floor(x);
+
+ return x - i;
+ }
+
+ template <typename valType>
+ GLM_FUNC_QUALIFIER detail::tvec2<valType> modf
+ (
+ detail::tvec2<valType> const & x,
+ detail::tvec2<valType> const & y
+ )
+ {
+ return detail::tvec2<valType>(
+ modf(x.x, y.x),
+ modf(x.y, y.y));
+ }
+
+ template <typename valType>
+ GLM_FUNC_QUALIFIER detail::tvec3<valType> modf
+ (
+ detail::tvec3<valType> const & x,
+ detail::tvec3<valType> const & y
+ )
+ {
+ return detail::tvec3<valType>(
+ modf(x.x, y.x),
+ modf(x.y, y.y),
+ modf(x.z, y.z));
+ }
+
+ template <typename valType>
+ GLM_FUNC_QUALIFIER detail::tvec4<valType> modf
+ (
+ detail::tvec4<valType> const & x,
+ detail::tvec4<valType> const & y
+ )
+ {
+ return detail::tvec4<valType>(
+ 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 <typename genType>
+ GLM_FUNC_QUALIFIER genType min
+ (
+ genType const & x,
+ genType const & y
+ )
+ {
+ GLM_STATIC_ASSERT(
+ detail::type<genType>::is_float ||
+ detail::type<genType>::is_int ||
+ detail::type<genType>::is_uint, "'min' only accept numbers");
+
+ return x < y ? x : y;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> min
+ (
+ detail::tvec2<T> const & x,
+ typename detail::tvec2<T>::value_type const & y
+ )
+ {
+ return detail::tvec2<T>(
+ min(x.x, y),
+ min(x.y, y));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> min
+ (
+ detail::tvec3<T> const & x,
+ typename detail::tvec3<T>::value_type const & y
+ )
+ {
+ return detail::tvec3<T>(
+ min(x.x, y),
+ min(x.y, y),
+ min(x.z, y));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> min
+ (
+ detail::tvec4<T> const & x,
+ typename detail::tvec4<T>::value_type const & y
+ )
+ {
+ return detail::tvec4<T>(
+ min(x.x, y),
+ min(x.y, y),
+ min(x.z, y),
+ min(x.w, y));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> min
+ (
+ detail::tvec2<T> const & x,
+ detail::tvec2<T> const & y
+ )
+ {
+ return detail::tvec2<T>(
+ min(x.x, y.x),
+ min(x.y, y.y));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> min
+ (
+ detail::tvec3<T> const & x,
+ detail::tvec3<T> const & y
+ )
+ {
+ return detail::tvec3<T>(
+ min(x.x, y.x),
+ min(x.y, y.y),
+ min(x.z, y.z));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> min
+ (
+ detail::tvec4<T> const & x,
+ detail::tvec4<T> const & y
+ )
+ {
+ return detail::tvec4<T>(
+ min(x.x, y.x),
+ min(x.y, y.y),
+ min(x.z, y.z),
+ min(x.w, y.w));
+ }
+
+ // max
+ template <typename genType>
+ GLM_FUNC_QUALIFIER genType max
+ (
+ genType const & x,
+ genType const & y
+ )
+ {
+ GLM_STATIC_ASSERT(
+ detail::type<genType>::is_float ||
+ detail::type<genType>::is_int ||
+ detail::type<genType>::is_uint, "'max' only accept numbers");
+
+ return x > y ? x : y;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> max
+ (
+ detail::tvec2<T> const & x,
+ typename detail::tvec2<T>::value_type y
+ )
+ {
+ return detail::tvec2<T>(
+ max(x.x, y),
+ max(x.y, y));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> max
+ (
+ detail::tvec3<T> const & x,
+ typename detail::tvec3<T>::value_type y
+ )
+ {
+ return detail::tvec3<T>(
+ max(x.x, y),
+ max(x.y, y),
+ max(x.z, y));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> max
+ (
+ detail::tvec4<T> const & x,
+ typename detail::tvec4<T>::value_type y
+ )
+ {
+ return detail::tvec4<T>(
+ max(x.x, y),
+ max(x.y, y),
+ max(x.z, y),
+ max(x.w, y));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> max
+ (
+ detail::tvec2<T> const & x,
+ detail::tvec2<T> const & y
+ )
+ {
+ return detail::tvec2<T>(
+ max(x.x, y.x),
+ max(x.y, y.y));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> max
+ (
+ detail::tvec3<T> const & x,
+ detail::tvec3<T> const & y
+ )
+ {
+ return detail::tvec3<T>(
+ max(x.x, y.x),
+ max(x.y, y.y),
+ max(x.z, y.z));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> max
+ (
+ detail::tvec4<T> const & x,
+ detail::tvec4<T> const & y)
+ {
+ return detail::tvec4<T>(
+ max(x.x, y.x),
+ max(x.y, y.y),
+ max(x.z, y.z),
+ max(x.w, y.w));
+ }
+
+ // clamp
+ template <typename valType>
+ GLM_FUNC_QUALIFIER valType clamp
+ (
+ valType const & x,
+ valType const & minVal,
+ valType const & maxVal
+ )
+ {
+ GLM_STATIC_ASSERT(
+ detail::type<valType>::is_float ||
+ detail::type<valType>::is_int ||
+ detail::type<valType>::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 <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> clamp
+ (
+ detail::tvec2<T> const & x,
+ typename detail::tvec2<T>::value_type const & minVal,
+ typename detail::tvec2<T>::value_type const & maxVal
+ )
+ {
+ return detail::tvec2<T>(
+ clamp(x.x, minVal, maxVal),
+ clamp(x.y, minVal, maxVal));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> clamp
+ (
+ detail::tvec3<T> const & x,
+ typename detail::tvec3<T>::value_type const & minVal,
+ typename detail::tvec3<T>::value_type const & maxVal
+ )
+ {
+ return detail::tvec3<T>(
+ clamp(x.x, minVal, maxVal),
+ clamp(x.y, minVal, maxVal),
+ clamp(x.z, minVal, maxVal));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> clamp
+ (
+ detail::tvec4<T> const & x,
+ typename detail::tvec4<T>::value_type const & minVal,
+ typename detail::tvec4<T>::value_type const & maxVal
+ )
+ {
+ return detail::tvec4<T>(
+ clamp(x.x, minVal, maxVal),
+ clamp(x.y, minVal, maxVal),
+ clamp(x.z, minVal, maxVal),
+ clamp(x.w, minVal, maxVal));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> clamp
+ (
+ detail::tvec2<T> const & x,
+ detail::tvec2<T> const & minVal,
+ detail::tvec2<T> const & maxVal
+ )
+ {
+ return detail::tvec2<T>(
+ clamp(x.x, minVal.x, maxVal.x),
+ clamp(x.y, minVal.y, maxVal.y));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> clamp
+ (
+ detail::tvec3<T> const & x,
+ detail::tvec3<T> const & minVal,
+ detail::tvec3<T> const & maxVal
+ )
+ {
+ return detail::tvec3<T>(
+ clamp(x.x, minVal.x, maxVal.x),
+ clamp(x.y, minVal.y, maxVal.y),
+ clamp(x.z, minVal.z, maxVal.z));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> clamp
+ (
+ detail::tvec4<T> const & x,
+ detail::tvec4<T> const & minVal,
+ detail::tvec4<T> const & maxVal
+ )
+ {
+ return detail::tvec4<T>(
+ 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 <typename genTypeT, typename genTypeU>
+ 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<genTypeT>::is_float &&
+ // detail::type<genTypeU>::is_float);
+
+ //return x + a * (y - x);
+ return genTypeT(genTypeU(x) + a * genTypeU(y - x));
+ }
+
+ template <typename valTypeA, typename valTypeB>
+ GLM_FUNC_QUALIFIER detail::tvec2<valTypeA> mix
+ (
+ detail::tvec2<valTypeA> const & x,
+ detail::tvec2<valTypeA> const & y,
+ valTypeB const & a
+ )
+ {
+ return detail::tvec2<valTypeA>(
+ detail::tvec2<valTypeB>(x) + a * detail::tvec2<valTypeB>(y - x));
+ }
+
+ template <typename valTypeA, typename valTypeB>
+ GLM_FUNC_QUALIFIER detail::tvec3<valTypeA> mix
+ (
+ detail::tvec3<valTypeA> const & x,
+ detail::tvec3<valTypeA> const & y,
+ valTypeB const & a
+ )
+ {
+ return detail::tvec3<valTypeA>(
+ detail::tvec3<valTypeB>(x) + a * detail::tvec3<valTypeB>(y - x));
+ }
+
+ template <typename valTypeA, typename valTypeB>
+ GLM_FUNC_QUALIFIER detail::tvec4<valTypeA> mix
+ (
+ detail::tvec4<valTypeA> const & x,
+ detail::tvec4<valTypeA> const & y,
+ valTypeB const & a
+ )
+ {
+ return detail::tvec4<valTypeA>(
+ detail::tvec4<valTypeB>(x) + a * detail::tvec4<valTypeB>(y - x));
+ }
+
+ template <typename valTypeA, typename valTypeB>
+ GLM_FUNC_QUALIFIER detail::tvec2<valTypeA> mix
+ (
+ detail::tvec2<valTypeA> const & x,
+ detail::tvec2<valTypeA> const & y,
+ detail::tvec2<valTypeB> const & a
+ )
+ {
+ return detail::tvec2<valTypeA>(
+ detail::tvec2<valTypeB>(x) + a * detail::tvec2<valTypeB>(y - x));
+ }
+
+ template <typename valTypeA, typename valTypeB>
+ GLM_FUNC_QUALIFIER detail::tvec3<valTypeA> mix
+ (
+ detail::tvec3<valTypeA> const & x,
+ detail::tvec3<valTypeA> const & y,
+ detail::tvec3<valTypeB> const & a
+ )
+ {
+ return detail::tvec3<valTypeA>(
+ detail::tvec3<valTypeB>(x) + a * detail::tvec3<valTypeB>(y - x));
+ }
+
+ template <typename valTypeA, typename valTypeB>
+ GLM_FUNC_QUALIFIER detail::tvec4<valTypeA> mix
+ (
+ detail::tvec4<valTypeA> const & x,
+ detail::tvec4<valTypeA> const & y,
+ detail::tvec4<valTypeB> const & a
+ )
+ {
+ return detail::tvec4<valTypeA>(
+ detail::tvec4<valTypeB>(x) + a * detail::tvec4<valTypeB>(y - x));
+ }
+
+ //template <typename genTypeT>
+ //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<genTypeT>::is_float &&
+ // // detail::type<genTypeU>::is_float);
+
+ // return x + a * (y - x);
+ //}
+
+ template <typename genType>
+ GLM_FUNC_QUALIFIER genType mix
+ (
+ genType const & x,
+ genType const & y,
+ bool a
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'mix' only accept floating-point inputs");
+
+ return a ? x : y;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> mix
+ (
+ detail::tvec2<T> const & x,
+ detail::tvec2<T> const & y,
+ typename detail::tvec2<T>::bool_type a
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<T>::is_float, "'mix' only accept floating-point inputs");
+
+ detail::tvec2<T> result;
+ for
+ (
+ typename detail::tvec2<T>::size_type i = 0;
+ i < detail::tvec2<T>::value_size();
+ ++i
+ )
+ {
+ result[i] = a[i] ? x[i] : y[i];
+ }
+ return result;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> mix
+ (
+ detail::tvec3<T> const & x,
+ detail::tvec3<T> const & y,
+ typename detail::tvec3<T>::bool_type a
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<T>::is_float, "'mix' only accept floating-point inputs");
+
+ detail::tvec3<T> result;
+ for
+ (
+ typename detail::tvec3<T>::size_type i = 0;
+ i < detail::tvec3<T>::value_size();
+ ++i
+ )
+ {
+ result[i] = a[i] ? x[i] : y[i];
+ }
+ return result;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> mix
+ (
+ detail::tvec4<T> const & x,
+ detail::tvec4<T> const & y,
+ typename detail::tvec4<T>::bool_type a
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<T>::is_float, "'mix' only accept floating-point inputs");
+
+ detail::tvec4<T> result;
+ for
+ (
+ typename detail::tvec4<T>::size_type i = 0;
+ i < detail::tvec4<T>::value_size();
+ ++i
+ )
+ {
+ result[i] = a[i] ? x[i] : y[i];
+ }
+ return result;
+ }
+
+ // step
+ template <typename genType>
+ GLM_FUNC_QUALIFIER genType step
+ (
+ genType const & edge,
+ genType const & x
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'mix' only accept floating-point inputs");
+
+ return x <= edge ? genType(0) : genType(1);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> step
+ (
+ typename detail::tvec2<T>::value_type const & edge,
+ detail::tvec2<T> const & x
+ )
+ {
+ return detail::tvec2<T>(
+ x.x <= edge ? T(0) : T(1),
+ x.y <= edge ? T(0) : T(1));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> step
+ (
+ typename detail::tvec3<T>::value_type const & edge,
+ detail::tvec3<T> const & x
+ )
+ {
+ return detail::tvec3<T>(
+ x.x <= edge ? T(0) : T(1),
+ x.y <= edge ? T(0) : T(1),
+ x.z <= edge ? T(0) : T(1));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> step
+ (
+ typename detail::tvec4<T>::value_type const & edge,
+ detail::tvec4<T> const & x
+ )
+ {
+ return detail::tvec4<T>(
+ 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 <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> step
+ (
+ detail::tvec2<T> const & edge,
+ detail::tvec2<T> const & x
+ )
+ {
+ return detail::tvec2<T>(
+ x.x <= edge.x ? T(0) : T(1),
+ x.y <= edge.y ? T(0) : T(1));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> step
+ (
+ detail::tvec3<T> const & edge,
+ detail::tvec3<T> const & x
+ )
+ {
+ return detail::tvec3<T>(
+ 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 <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> step
+ (
+ detail::tvec4<T> const & edge,
+ detail::tvec4<T> const & x
+ )
+ {
+ return detail::tvec4<T>(
+ 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 <typename genType>
+ GLM_FUNC_QUALIFIER genType smoothstep
+ (
+ genType const & edge0,
+ genType const & edge1,
+ genType const & x
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<genType>::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 <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> smoothstep
+ (
+ typename detail::tvec2<T>::value_type const & edge0,
+ typename detail::tvec2<T>::value_type const & edge1,
+ detail::tvec2<T> const & x
+ )
+ {
+ return detail::tvec2<T>(
+ smoothstep(edge0, edge1, x.x),
+ smoothstep(edge0, edge1, x.y));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> smoothstep
+ (
+ typename detail::tvec3<T>::value_type const & edge0,
+ typename detail::tvec3<T>::value_type const & edge1,
+ detail::tvec3<T> const & x
+ )
+ {
+ return detail::tvec3<T>(
+ smoothstep(edge0, edge1, x.x),
+ smoothstep(edge0, edge1, x.y),
+ smoothstep(edge0, edge1, x.z));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> smoothstep
+ (
+ typename detail::tvec4<T>::value_type const & edge0,
+ typename detail::tvec4<T>::value_type const & edge1,
+ detail::tvec4<T> const & x
+ )
+ {
+ return detail::tvec4<T>(
+ smoothstep(edge0, edge1, x.x),
+ smoothstep(edge0, edge1, x.y),
+ smoothstep(edge0, edge1, x.z),
+ smoothstep(edge0, edge1, x.w));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> smoothstep
+ (
+ detail::tvec2<T> const & edge0,
+ detail::tvec2<T> const & edge1,
+ detail::tvec2<T> const & x
+ )
+ {
+ return detail::tvec2<T>(
+ smoothstep(edge0.x, edge1.x, x.x),
+ smoothstep(edge0.y, edge1.y, x.y));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> smoothstep
+ (
+ detail::tvec3<T> const & edge0,
+ detail::tvec3<T> const & edge1,
+ detail::tvec3<T> const & x
+ )
+ {
+ return detail::tvec3<T>(
+ smoothstep(edge0.x, edge1.x, x.x),
+ smoothstep(edge0.y, edge1.y, x.y),
+ smoothstep(edge0.z, edge1.z, x.z));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> smoothstep
+ (
+ detail::tvec4<T> const & edge0,
+ detail::tvec4<T> const & edge1,
+ detail::tvec4<T> const & x
+ )
+ {
+ return detail::tvec4<T>(
+ 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 <typename genType>
+ GLM_FUNC_QUALIFIER typename genType::bool_type isnan
+ (
+ genType const & x
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<genType>::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 <typename T>
+ GLM_FUNC_QUALIFIER typename detail::tvec2<T>::bool_type isnan
+ (
+ detail::tvec2<T> const & x
+ )
+ {
+ return typename detail::tvec2<T>::bool_type(
+ isnan(x.x),
+ isnan(x.y));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename detail::tvec3<T>::bool_type isnan
+ (
+ detail::tvec3<T> const & x
+ )
+ {
+ return typename detail::tvec3<T>::bool_type(
+ isnan(x.x),
+ isnan(x.y),
+ isnan(x.z));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename detail::tvec4<T>::bool_type isnan
+ (
+ detail::tvec4<T> const & x
+ )
+ {
+ return typename detail::tvec4<T>::bool_type(
+ isnan(x.x),
+ isnan(x.y),
+ isnan(x.z),
+ isnan(x.w));
+ }
+
+ template <typename genType>
+ GLM_FUNC_QUALIFIER typename genType::bool_type isinf
+ (
+ genType const & x
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<genType>::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 <typename T>
+ GLM_FUNC_QUALIFIER typename detail::tvec2<T>::bool_type isinf
+ (
+ detail::tvec2<T> const & x
+ )
+ {
+ return typename detail::tvec2<T>::bool_type(
+ isnan(x.x),
+ isnan(x.y));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename detail::tvec3<T>::bool_type isinf
+ (
+ detail::tvec3<T> const & x
+ )
+ {
+ return typename detail::tvec3<T>::bool_type(
+ isnan(x.x),
+ isnan(x.y),
+ isnan(x.z));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename detail::tvec4<T>::bool_type isinf
+ (
+ detail::tvec4<T> const & x
+ )
+ {
+ return typename detail::tvec4<T>::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 <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<int> floatBitsToInt
+ (
+ detail::tvec2<T> const & value
+ )
+ {
+ return detail::tvec2<T>(
+ floatBitsToInt(value.x),
+ floatBitsToInt(value.y));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<int> floatBitsToInt
+ (
+ detail::tvec3<T> const & value
+ )
+ {
+ return detail::tvec3<T>(
+ floatBitsToInt(value.x),
+ floatBitsToInt(value.y));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<int> floatBitsToInt
+ (
+ detail::tvec4<T> const & value
+ )
+ {
+ return detail::tvec4<T>(
+ 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 <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<uint> floatBitsToUint
+ (
+ detail::tvec2<T> const & value
+ )
+ {
+ return detail::tvec2<T>(
+ floatBitsToUint(value.x),
+ floatBitsToUint(value.y));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<uint> floatBitsToUint
+ (
+ detail::tvec3<T> const & value
+ )
+ {
+ return detail::tvec3<T>(
+ floatBitsToUint(value.x),
+ floatBitsToUint(value.y));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<uint> floatBitsToUint
+ (
+ detail::tvec4<T> const & value
+ )
+ {
+ return detail::tvec4<T>(
+ 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 <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<float> intBitsToFloat
+ (
+ detail::tvec2<T> const & value
+ )
+ {
+ return detail::tvec2<T>(
+ intBitsToFloat(value.x),
+ intBitsToFloat(value.y));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<float> intBitsToFloat
+ (
+ detail::tvec3<T> const & value
+ )
+ {
+ return detail::tvec3<T>(
+ intBitsToFloat(value.x),
+ intBitsToFloat(value.y));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<float> intBitsToFloat
+ (
+ detail::tvec4<T> const & value
+ )
+ {
+ return detail::tvec4<T>(
+ 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 <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<float> uintBitsToFloat
+ (
+ detail::tvec2<T> const & value
+ )
+ {
+ return detail::tvec2<T>(
+ uintBitsToFloat(value.x),
+ uintBitsToFloat(value.y));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<float> uintBitsToFloat
+ (
+ detail::tvec3<T> const & value
+ )
+ {
+ return detail::tvec3<T>(
+ uintBitsToFloat(value.x),
+ uintBitsToFloat(value.y));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<float> uintBitsToFloat
+ (
+ detail::tvec4<T> const & value
+ )
+ {
+ return detail::tvec4<T>(
+ uintBitsToFloat(value.x),
+ uintBitsToFloat(value.y));
+ }
+
+ template <typename genType>
+ GLM_FUNC_QUALIFIER genType fma
+ (
+ genType const & a,
+ genType const & b,
+ genType const & c
+ )
+ {
+ return a * b + c;
+ }
+
+ template <typename genType>
+ GLM_FUNC_QUALIFIER genType frexp
+ (
+ genType const & x,
+ int & exp
+ )
+ {
+ return std::frexp(x, exp);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> frexp
+ (
+ detail::tvec2<T> const & x,
+ detail::tvec2<int> & exp
+ )
+ {
+ return std::frexp(x, exp);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> frexp
+ (
+ detail::tvec3<T> const & x,
+ detail::tvec3<int> & exp
+ )
+ {
+ return std::frexp(x, exp);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> frexp
+ (
+ detail::tvec4<T> const & x,
+ detail::tvec4<int> & exp
+ )
+ {
+ return std::frexp(x, exp);
+ }
+
+ template <typename genType>
+ GLM_FUNC_QUALIFIER genType ldexp
+ (
+ genType const & x,
+ int const & exp
+ )
+ {
+ return std::frexp(x, exp);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> ldexp
+ (
+ detail::tvec2<T> const & x,
+ detail::tvec2<int> const & exp
+ )
+ {
+ return std::frexp(x, exp);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> ldexp
+ (
+ detail::tvec3<T> const & x,
+ detail::tvec3<int> const & exp
+ )
+ {
+ return std::frexp(x, exp);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> ldexp
+ (
+ detail::tvec4<T> const & x,
+ detail::tvec4<int> 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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/pow.xml">GLSL pow man page</a>
+ //! \li GLSL 1.30.08 specification, section 8.2
+ template <typename genType>
+ genType pow(genType const & x, genType const & y);
+
+ //! Returns the natural exponentiation of x, i.e., e^x.
+ //!
+ //! \li <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/exp.xml">GLSL exp man page</a>
+ //! \li GLSL 1.30.08 specification, section 8.2
+ template <typename genType>
+ 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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/log.xml">GLSL log man page</a>
+ //! \li GLSL 1.30.08 specification, section 8.2
+ template <typename genType>
+ genType log(genType const & x);
+
+ //! Returns 2 raised to the x power.
+ //!
+ //! \li <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/exp2.xml">GLSL exp2 man page</a>
+ //! \li GLSL 1.30.08 specification, section 8.2
+ template <typename genType>
+ 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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/log2.xml">GLSL log2 man page</a>
+ //! \li GLSL 1.30.08 specification, section 8.2
+ template <typename genType>
+ genType log2(genType const & x);
+
+ //! Returns the positive square root of x.
+ //!
+ //! \li <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/sqrt.xml">GLSL sqrt man page</a>
+ //! \li GLSL 1.30.08 specification, section 8.2
+ template <typename genType>
+ genType sqrt(genType const & x);
+
+ //! Returns the reciprocal of the positive square root of x.
+ //!
+ //! \li <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/inversesqrt.xml">GLSL inversesqrt man page</a>
+ //! \li GLSL 1.30.08 specification, section 8.2
+ template <typename genType>
+ 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 <typename genType>
+ GLM_FUNC_QUALIFIER genType pow
+ (
+ genType const & x,
+ genType const & y
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'pow' only accept floating-point input");
+
+ return ::std::pow(x, y);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> pow
+ (
+ detail::tvec2<T> const & x,
+ detail::tvec2<T> const & y
+ )
+ {
+ return detail::tvec2<T>(
+ pow(x.x, y.x),
+ pow(x.y, y.y));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> pow
+ (
+ detail::tvec3<T> const & x,
+ detail::tvec3<T> const & y
+ )
+ {
+ return detail::tvec3<T>(
+ pow(x.x, y.x),
+ pow(x.y, y.y),
+ pow(x.z, y.z));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> pow
+ (
+ detail::tvec4<T> const & x,
+ detail::tvec4<T> const & y
+ )
+ {
+ return detail::tvec4<T>(
+ pow(x.x, y.x),
+ pow(x.y, y.y),
+ pow(x.z, y.z),
+ pow(x.w, y.w));
+ }
+
+ // exp
+ template <typename genType>
+ GLM_FUNC_QUALIFIER genType exp
+ (
+ genType const & x
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'exp' only accept floating-point input");
+
+ return ::std::exp(x);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> exp
+ (
+ detail::tvec2<T> const & x
+ )
+ {
+ return detail::tvec2<T>(
+ exp(x.x),
+ exp(x.y));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> exp
+ (
+ detail::tvec3<T> const & x
+ )
+ {
+ return detail::tvec3<T>(
+ exp(x.x),
+ exp(x.y),
+ exp(x.z));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> exp
+ (
+ detail::tvec4<T> const & x
+ )
+ {
+ return detail::tvec4<T>(
+ exp(x.x),
+ exp(x.y),
+ exp(x.z),
+ exp(x.w));
+ }
+
+ // log
+ template <typename genType>
+ GLM_FUNC_QUALIFIER genType log
+ (
+ genType const & x
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'log' only accept floating-point input");
+
+ return ::std::log(x);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> log
+ (
+ detail::tvec2<T> const & x
+ )
+ {
+ return detail::tvec2<T>(
+ log(x.x),
+ log(x.y));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> log
+ (
+ detail::tvec3<T> const & x
+ )
+ {
+ return detail::tvec3<T>(
+ log(x.x),
+ log(x.y),
+ log(x.z));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> log
+ (
+ detail::tvec4<T> const & x
+ )
+ {
+ return detail::tvec4<T>(
+ log(x.x),
+ log(x.y),
+ log(x.z),
+ log(x.w));
+ }
+
+ //exp2, ln2 = 0.69314718055994530941723212145818f
+ template <typename genType>
+ GLM_FUNC_QUALIFIER genType exp2
+ (
+ genType const & x
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'exp2' only accept floating-point input");
+
+ return ::std::exp(genType(0.69314718055994530941723212145818) * x);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> exp2
+ (
+ detail::tvec2<T> const & x
+ )
+ {
+ return detail::tvec2<T>(
+ exp2(x.x),
+ exp2(x.y));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> exp2
+ (
+ detail::tvec3<T> const & x
+ )
+ {
+ return detail::tvec3<T>(
+ exp2(x.x),
+ exp2(x.y),
+ exp2(x.z));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> exp2
+ (
+ detail::tvec4<T> const & x
+ )
+ {
+ return detail::tvec4<T>(
+ exp2(x.x),
+ exp2(x.y),
+ exp2(x.z),
+ exp2(x.w));
+ }
+
+ // log2, ln2 = 0.69314718055994530941723212145818f
+ template <typename genType>
+ GLM_FUNC_QUALIFIER genType log2
+ (
+ genType const & x
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'log2' only accept floating-point input");
+
+ return ::std::log(x) / genType(0.69314718055994530941723212145818);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> log2
+ (
+ detail::tvec2<T> const & x
+ )
+ {
+ return detail::tvec2<T>(
+ log2(x.x),
+ log2(x.y));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> log2
+ (
+ detail::tvec3<T> const & x
+ )
+ {
+ return detail::tvec3<T>(
+ log2(x.x),
+ log2(x.y),
+ log2(x.z));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> log2
+ (
+ detail::tvec4<T> const & x
+ )
+ {
+ return detail::tvec4<T>(
+ log2(x.x),
+ log2(x.y),
+ log2(x.z),
+ log2(x.w));
+ }
+
+ // sqrt
+ template <typename genType>
+ GLM_FUNC_QUALIFIER genType sqrt
+ (
+ genType const & x
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'sqrt' only accept floating-point input");
+
+ return genType(::std::sqrt(x));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> sqrt
+ (
+ detail::tvec2<T> const & x
+ )
+ {
+ return detail::tvec2<T>(
+ sqrt(x.x),
+ sqrt(x.y));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> sqrt
+ (
+ detail::tvec3<T> const & x
+ )
+ {
+ return detail::tvec3<T>(
+ sqrt(x.x),
+ sqrt(x.y),
+ sqrt(x.z));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> sqrt
+ (
+ detail::tvec4<T> const & x
+ )
+ {
+ return detail::tvec4<T>(
+ sqrt(x.x),
+ sqrt(x.y),
+ sqrt(x.z),
+ sqrt(x.w));
+ }
+
+ template <typename genType>
+ GLM_FUNC_QUALIFIER genType inversesqrt
+ (
+ genType const & x
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'inversesqrt' only accept floating-point input");
+
+ return genType(1) / ::std::sqrt(x);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> inversesqrt
+ (
+ detail::tvec2<T> const & x
+ )
+ {
+ return detail::tvec2<T>(
+ inversesqrt(x.x),
+ inversesqrt(x.y));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> inversesqrt
+ (
+ detail::tvec3<T> const & x
+ )
+ {
+ return detail::tvec3<T>(
+ inversesqrt(x.x),
+ inversesqrt(x.y),
+ inversesqrt(x.z));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> inversesqrt
+ (
+ detail::tvec4<T> const & x
+ )
+ {
+ return detail::tvec4<T>(
+ 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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/length.xml">GLSL length man page</a>
+ //! \li GLSL 1.30.08 specification, section 8.4
+ template <typename genType>
+ typename genType::value_type length(
+ genType const & x);
+
+ //! Returns the distance betwwen p0 and p1, i.e., length(p0 - p1).
+ //!
+ //! \li <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/distance.xml">GLSL distance man page</a>
+ //! \li GLSL 1.30.08 specification, section 8.4
+ template <typename genType>
+ 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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/dot.xml">GLSL dot man page</a>
+ //! \li GLSL 1.30.08 specification, section 8.4
+ template <typename genType>
+ typename genType::value_type dot(
+ genType const & x,
+ genType const & y);
+
+ //! Returns the cross product of x and y.
+ //!
+ //! \li <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/cross.xml">GLSL cross man page</a>
+ //! \li GLSL 1.30.08 specification, section 8.4
+ template <typename T>
+ detail::tvec3<T> cross(
+ detail::tvec3<T> const & x,
+ detail::tvec3<T> const & y);
+
+ //! Returns a vector in the same direction as x but with length of 1.
+ //!
+ //! \li <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/normalize.xml">GLSL normalize man page</a>
+ //! \li GLSL 1.30.08 specification, section 8.4
+ template <typename genType>
+ genType normalize(
+ genType const & x);
+
+ //! If dot(Nref, I) < 0.0, return N, otherwise, return -N.
+ //!
+ //! \li <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/faceforward.xml">GLSL faceforward man page</a>
+ //! \li GLSL 1.30.08 specification, section 8.4
+ template <typename genType>
+ 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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/reflect.xml">GLSL reflect man page</a>
+ //! \li GLSL 1.30.08 specification, section 8.4
+ template <typename genType>
+ 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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/refract.xml">GLSL refract man page</a>
+ //! \li GLSL 1.30.08 specification, section 8.4
+ template <typename genType>
+ 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 <typename genType>
+ GLM_FUNC_QUALIFIER genType length
+ (
+ genType const & x
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'length' only accept floating-point inputs");
+
+ genType sqr = x * x;
+ return sqrt(sqr);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename detail::tvec2<T>::value_type length
+ (
+ detail::tvec2<T> const & v
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<T>::is_float, "'length' only accept floating-point inputs");
+
+ typename detail::tvec2<T>::value_type sqr = v.x * v.x + v.y * v.y;
+ return sqrt(sqr);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename detail::tvec3<T>::value_type length
+ (
+ detail::tvec3<T> const & v
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<T>::is_float, "'length' only accept floating-point inputs");
+
+ typename detail::tvec3<T>::value_type sqr = v.x * v.x + v.y * v.y + v.z * v.z;
+ return sqrt(sqr);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename detail::tvec4<T>::value_type length
+ (
+ detail::tvec4<T> const & v
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<T>::is_float, "'length' only accept floating-point inputs");
+
+ typename detail::tvec4<T>::value_type sqr = v.x * v.x + v.y * v.y + v.z * v.z + v.w * v.w;
+ return sqrt(sqr);
+ }
+
+ // distance
+ template <typename genType>
+ GLM_FUNC_QUALIFIER genType distance
+ (
+ genType const & p0,
+ genType const & p1
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'distance' only accept floating-point inputs");
+
+ return length(p1 - p0);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename detail::tvec2<T>::value_type distance
+ (
+ detail::tvec2<T> const & p0,
+ detail::tvec2<T> const & p1
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<T>::is_float, "'distance' only accept floating-point inputs");
+
+ return length(p1 - p0);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename detail::tvec3<T>::value_type distance
+ (
+ detail::tvec3<T> const & p0,
+ detail::tvec3<T> const & p1
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<T>::is_float, "'distance' only accept floating-point inputs");
+
+ return length(p1 - p0);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename detail::tvec4<T>::value_type distance
+ (
+ detail::tvec4<T> const & p0,
+ detail::tvec4<T> const & p1
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<T>::is_float, "'distance' only accept floating-point inputs");
+
+ return length(p1 - p0);
+ }
+
+ // dot
+ template <typename genType>
+ GLM_FUNC_QUALIFIER genType dot
+ (
+ genType const & x,
+ genType const & y
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'dot' only accept floating-point inputs");
+
+ return x * y;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename detail::tvec2<T>::value_type dot
+ (
+ detail::tvec2<T> const & x,
+ detail::tvec2<T> const & y
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<T>::is_float, "'dot' only accept floating-point inputs");
+
+ return x.x * y.x + x.y * y.y;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER T dot
+ (
+ detail::tvec3<T> const & x,
+ detail::tvec3<T> const & y
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<T>::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<float>& x, const tvec4<float>& 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 <typename T>
+ GLM_FUNC_QUALIFIER T dot
+ (
+ detail::tvec4<T> const & x,
+ detail::tvec4<T> const & y
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<T>::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 <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> cross
+ (
+ detail::tvec3<T> const & x,
+ detail::tvec3<T> const & y
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<T>::is_float, "'cross' only accept floating-point inputs");
+
+ return detail::tvec3<T>(
+ 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 <typename genType>
+ GLM_FUNC_QUALIFIER genType normalize
+ (
+ genType const & x
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<genType>::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 <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> normalize
+ (
+ detail::tvec2<T> const & x
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<T>::is_float, "'normalize' only accept floating-point inputs");
+
+ typename detail::tvec2<T>::value_type sqr = x.x * x.x + x.y * x.y;
+ return x * inversesqrt(sqr);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> normalize
+ (
+ detail::tvec3<T> const & x
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<T>::is_float, "'normalize' only accept floating-point inputs");
+
+ typename detail::tvec3<T>::value_type sqr = x.x * x.x + x.y * x.y + x.z * x.z;
+ return x * inversesqrt(sqr);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> normalize
+ (
+ detail::tvec4<T> const & x
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<T>::is_float, "'normalize' only accept floating-point inputs");
+
+ typename detail::tvec4<T>::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 <typename genType>
+ GLM_FUNC_QUALIFIER genType faceforward
+ (
+ genType const & N,
+ genType const & I,
+ genType const & Nref
+ )
+ {
+ return dot(Nref, I) < 0 ? N : -N;
+ }
+
+ // reflect
+ template <typename genType>
+ genType reflect
+ (
+ genType const & I,
+ genType const & N
+ )
+ {
+ return I - N * dot(N, I) * float(2);
+ }
+
+ // refract
+ template <typename genType>
+ 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<genType>::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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/uaddCarry.xml">GLSL uaddCarry man page</a>
+ //! \li GLSL 4.00.08 specification, section 8.8
+ template <typename genUType>
+ 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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/usubBorrow.xml">GLSL usubBorrow man page</a>
+ //! \li GLSL 4.00.08 specification, section 8.8
+ template <typename genUType>
+ 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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/umulExtended.xml">GLSL umulExtended man page</a>
+ //! \li GLSL 4.00.08 specification, section 8.8
+ template <typename genUType>
+ 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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/imulExtended.xml">GLSL imulExtended man page</a>
+ //! \li GLSL 4.00.08 specification, section 8.8
+ template <typename genIType>
+ 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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/bitfieldExtract.xml">GLSL bitfieldExtract man page</a>
+ //! \li GLSL 4.00.08 specification, section 8.8
+ template <typename genIUType>
+ 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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/bitfieldInsert.xml">GLSL bitfieldInsert man page</a>
+ //! \li GLSL 4.00.08 specification, section 8.8
+ template <typename genIUType>
+ 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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/bitfieldReverse.xml">GLSL bitfieldReverse man page</a>
+ //! \li GLSL 4.00.08 specification, section 8.8
+ template <typename genIUType>
+ genIUType bitfieldReverse(genIUType const & value);
+
+ //! Returns the number of bits set to 1 in the binary representation of value.
+ //!
+ //! \li <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/bitCount.xml">GLSL bitCount man page</a>
+ //! \li GLSL 4.00.08 specification, section 8.8
+ template <typename T, template <typename> class C>
+ typename C<T>::signed_type bitCount(C<T> 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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/findLSB.xml">GLSL findLSB man page</a>
+ //! \li GLSL 4.00.08 specification, section 8.8
+ template <typename T, template <typename> class C>
+ typename C<T>::signed_type findLSB(C<T> 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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/findMSB.xml">GLSL findMSB man page</a>
+ //! \li GLSL 4.00.08 specification, section 8.8
+ template <typename T, template <typename> class C>
+ typename C<T>::signed_type findMSB(C<T> 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 <typename genUType>
+ 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 <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> uaddCarry
+ (
+ detail::tvec2<T> const & x,
+ detail::tvec2<T> const & y,
+ detail::tvec2<T> & Carry
+ )
+ {
+ return detail::tvec2<T>(
+ uaddCarry(x[0], y[0], Carry[0]),
+ uaddCarry(x[1], y[1], Carry[1]));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> uaddCarry
+ (
+ detail::tvec3<T> const & x,
+ detail::tvec3<T> const & y,
+ detail::tvec3<T> & Carry
+ )
+ {
+ return detail::tvec3<T>(
+ uaddCarry(x[0], y[0], Carry[0]),
+ uaddCarry(x[1], y[1], Carry[1]),
+ uaddCarry(x[2], y[2], Carry[2]));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> uaddCarry
+ (
+ detail::tvec4<T> const & x,
+ detail::tvec4<T> const & y,
+ detail::tvec4<T> & Carry
+ )
+ {
+ return detail::tvec4<T>(
+ 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 <typename genUType>
+ 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 <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> usubBorrow
+ (
+ detail::tvec2<T> const & x,
+ detail::tvec2<T> const & y,
+ detail::tvec2<T> & Borrow
+ )
+ {
+ return detail::tvec2<T>(
+ usubBorrow(x[0], y[0], Borrow[0]),
+ usubBorrow(x[1], y[1], Borrow[1]));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> usubBorrow
+ (
+ detail::tvec3<T> const & x,
+ detail::tvec3<T> const & y,
+ detail::tvec3<T> & Borrow
+ )
+ {
+ return detail::tvec3<T>(
+ usubBorrow(x[0], y[0], Borrow[0]),
+ usubBorrow(x[1], y[1], Borrow[1]),
+ usubBorrow(x[2], y[2], Borrow[2]));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> usubBorrow
+ (
+ detail::tvec4<T> const & x,
+ detail::tvec4<T> const & y,
+ detail::tvec4<T> & Borrow
+ )
+ {
+ return detail::tvec4<T>(
+ 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 <typename genUType>
+ 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 <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> umulExtended
+ (
+ detail::tvec2<T> const & x,
+ detail::tvec2<T> const & y,
+ detail::tvec2<T> & msb,
+ detail::tvec2<T> & lsb
+ )
+ {
+ return detail::tvec2<T>(
+ umulExtended(x[0], y[0], msb, lsb),
+ umulExtended(x[1], y[1], msb, lsb));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> umulExtended
+ (
+ detail::tvec3<T> const & x,
+ detail::tvec3<T> const & y,
+ detail::tvec3<T> & msb,
+ detail::tvec3<T> & lsb
+ )
+ {
+ return detail::tvec3<T>(
+ umulExtended(x[0], y[0], msb, lsb),
+ umulExtended(x[1], y[1], msb, lsb),
+ umulExtended(x[2], y[2], msb, lsb));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> umulExtended
+ (
+ detail::tvec4<T> const & x,
+ detail::tvec4<T> const & y,
+ detail::tvec4<T> & msb,
+ detail::tvec4<T> & lsb
+ )
+ {
+ return detail::tvec4<T>(
+ 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 <typename genIType>
+ 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 <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> imulExtended
+ (
+ detail::tvec2<T> const & x,
+ detail::tvec2<T> const & y,
+ detail::tvec2<T> & msb,
+ detail::tvec2<T> & lsb
+ )
+ {
+ return detail::tvec2<T>(
+ imulExtended(x[0], y[0], msb, lsb),
+ imulExtended(x[1], y[1], msb, lsb));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> imulExtended
+ (
+ detail::tvec3<T> const & x,
+ detail::tvec3<T> const & y,
+ detail::tvec3<T> & msb,
+ detail::tvec3<T> & lsb
+ )
+ {
+ return detail::tvec3<T>(
+ imulExtended(x[0], y[0], msb, lsb),
+ imulExtended(x[1], y[1], msb, lsb),
+ imulExtended(x[2], y[2], msb, lsb));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> imulExtended
+ (
+ detail::tvec4<T> const & x,
+ detail::tvec4<T> const & y,
+ detail::tvec4<T> & msb,
+ detail::tvec4<T> & lsb
+ )
+ {
+ return detail::tvec4<T>(
+ 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 <typename genIUType>
+ 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 <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> bitfieldExtract
+ (
+ detail::tvec2<T> const & Value,
+ int const & Offset,
+ int const & Bits
+ )
+ {
+ return detail::tvec2<T>(
+ bitfieldExtract(Value[0]),
+ bitfieldExtract(Value[1]));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> bitfieldExtract
+ (
+ detail::tvec3<T> const & Value,
+ int const & Offset,
+ int const & Bits
+ )
+ {
+ return detail::tvec3<T>(
+ bitfieldExtract(Value[0]),
+ bitfieldExtract(Value[1]),
+ bitfieldExtract(Value[2]));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> bitfieldExtract
+ (
+ detail::tvec4<T> const & Value,
+ int const & Offset,
+ int const & Bits
+ )
+ {
+ return detail::tvec4<T>(
+ bitfieldExtract(Value[0]),
+ bitfieldExtract(Value[1]),
+ bitfieldExtract(Value[2]),
+ bitfieldExtract(Value[3]));
+ }
+
+ // bitfieldInsert
+ template <typename genIUType>
+ GLM_FUNC_QUALIFIER genIUType bitfieldInsert
+ (
+ genIUType const & Base,
+ genIUType const & Insert,
+ int const & Offset,
+ int const & Bits
+ )
+ {
+ GLM_STATIC_ASSERT(std::numeric_limits<genIUType>::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 <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> bitfieldInsert
+ (
+ detail::tvec2<T> const & Base,
+ detail::tvec2<T> const & Insert,
+ int const & Offset,
+ int const & Bits
+ )
+ {
+ return detail::tvec2<T>(
+ bitfieldInsert(Base[0], Insert[0], Offset, Bits),
+ bitfieldInsert(Base[1], Insert[1], Offset, Bits));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> bitfieldInsert
+ (
+ detail::tvec3<T> const & Base,
+ detail::tvec3<T> const & Insert,
+ int const & Offset,
+ int const & Bits
+ )
+ {
+ return detail::tvec3<T>(
+ bitfieldInsert(Base[0], Insert[0], Offset, Bits),
+ bitfieldInsert(Base[1], Insert[1], Offset, Bits),
+ bitfieldInsert(Base[2], Insert[2], Offset, Bits));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> bitfieldInsert
+ (
+ detail::tvec4<T> const & Base,
+ detail::tvec4<T> const & Insert,
+ int const & Offset,
+ int const & Bits
+ )
+ {
+ return detail::tvec4<T>(
+ 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 <typename genIUType>
+ GLM_FUNC_QUALIFIER genIUType bitfieldReverse(genIUType const & Value)
+ {
+ GLM_STATIC_ASSERT(std::numeric_limits<genIUType>::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 <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> bitfieldReverse
+ (
+ detail::tvec2<T> const & value
+ )
+ {
+ return detail::tvec2<T>(
+ bitfieldReverse(value[0]),
+ bitfieldReverse(value[1]));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> bitfieldReverse
+ (
+ detail::tvec3<T> const & value
+ )
+ {
+ return detail::tvec3<T>(
+ bitfieldReverse(value[0]),
+ bitfieldReverse(value[1]),
+ bitfieldReverse(value[2]));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> bitfieldReverse
+ (
+ detail::tvec4<T> const & value
+ )
+ {
+ return detail::tvec4<T>(
+ bitfieldReverse(value[0]),
+ bitfieldReverse(value[1]),
+ bitfieldReverse(value[2]),
+ bitfieldReverse(value[3]));
+ }
+
+ // bitCount
+ template <typename genIUType>
+ GLM_FUNC_QUALIFIER int bitCount(genIUType const & Value)
+ {
+ GLM_STATIC_ASSERT(std::numeric_limits<genIUType>::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 <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<int> bitCount
+ (
+ detail::tvec2<T> const & value
+ )
+ {
+ return detail::tvec2<int>(
+ bitCount(value[0]),
+ bitCount(value[1]));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<int> bitCount
+ (
+ detail::tvec3<T> const & value
+ )
+ {
+ return detail::tvec3<int>(
+ bitCount(value[0]),
+ bitCount(value[1]),
+ bitCount(value[2]));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<int> bitCount
+ (
+ detail::tvec4<T> const & value
+ )
+ {
+ return detail::tvec4<int>(
+ bitCount(value[0]),
+ bitCount(value[1]),
+ bitCount(value[2]),
+ bitCount(value[3]));
+ }
+
+ // findLSB
+ template <typename genIUType>
+ GLM_FUNC_QUALIFIER int findLSB
+ (
+ genIUType const & Value
+ )
+ {
+ GLM_STATIC_ASSERT(std::numeric_limits<genIUType>::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 <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<int> findLSB
+ (
+ detail::tvec2<T> const & value
+ )
+ {
+ return detail::tvec2<int>(
+ findLSB(value[0]),
+ findLSB(value[1]));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<int> findLSB
+ (
+ detail::tvec3<T> const & value
+ )
+ {
+ return detail::tvec3<int>(
+ findLSB(value[0]),
+ findLSB(value[1]),
+ findLSB(value[2]));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<int> findLSB
+ (
+ detail::tvec4<T> const & value
+ )
+ {
+ return detail::tvec4<int>(
+ findLSB(value[0]),
+ findLSB(value[1]),
+ findLSB(value[2]),
+ findLSB(value[3]));
+ }
+
+ // findMSB
+ template <typename genIUType>
+ GLM_FUNC_QUALIFIER int findMSB
+ (
+ genIUType const & Value
+ )
+ {
+ GLM_STATIC_ASSERT(std::numeric_limits<genIUType>::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 <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<int> findMSB
+ (
+ detail::tvec2<T> const & value
+ )
+ {
+ return detail::tvec2<int>(
+ findMSB(value[0]),
+ findMSB(value[1]));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<int> findMSB
+ (
+ detail::tvec3<T> const & value
+ )
+ {
+ return detail::tvec3<int>(
+ findMSB(value[0]),
+ findMSB(value[1]),
+ findMSB(value[2]));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<int> findMSB
+ (
+ detail::tvec4<T> const & value
+ )
+ {
+ return detail::tvec4<int>(
+ 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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/matrixCompMult.xml">GLSL matrixCompMult man page</a>
+ //! \li GLSL 1.30.08 specification, section 8.5
+ template <typename matType>
+ 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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/outerProduct.xml">GLSL outerProduct man page</a>
+ //! \li GLSL 1.30.08 specification, section 8.5
+ template <typename vecType, typename matType>
+ matType outerProduct(
+ vecType const & c,
+ vecType const & r);
+
+ //! Returns the transposed matrix of x
+ //!
+ //! \li <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/transpose.xml">GLSL transpose man page</a>
+ //! \li GLSL 1.30.08 specification, section 8.5
+ template <typename matType>
+ typename matType::transpose_type transpose(
+ matType const & x);
+
+ //! Return the determinant of a mat2 matrix.
+ //!
+ //! \li <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/determinant.xml">GLSL determinant man page</a>
+ //! \li GLSL 1.30.08 specification, section 8.5
+ template <typename T>
+ typename detail::tmat2x2<T>::value_type determinant(
+ detail::tmat2x2<T> const & m);
+
+ //! Return the determinant of a mat3 matrix.
+ //!
+ //! \li <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/determinant.xml">GLSL determinant man page</a>
+ //! \li GLSL 1.30.08 specification, section 8.5
+ template <typename T>
+ typename detail::tmat3x3<T>::value_type determinant(
+ detail::tmat3x3<T> const & m);
+
+ //! Return the determinant of a mat4 matrix.
+ //!
+ //! \li <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/determinant.xml">GLSL determinant man page</a>
+ //! \li GLSL 1.30.08 specification, section 8.5
+ template <typename T>
+ typename detail::tmat4x4<T>::value_type determinant(
+ detail::tmat4x4<T> const & m);
+
+ //! Return the inverse of a mat2 matrix.
+ //!
+ //! \li <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/inverse.xml">GLSL inverse man page</a>
+ //! \li GLSL 1.40.07 specification, section 8.5
+ template <typename T>
+ detail::tmat2x2<T> inverse(
+ detail::tmat2x2<T> const & m);
+
+ //! Return the inverse of a mat3 matrix.
+ //!
+ //! \li <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/inverse.xml">GLSL inverse man page</a>
+ //! \li GLSL 1.40.07 specification, section 8.5
+ template <typename T>
+ detail::tmat3x3<T> inverse(
+ detail::tmat3x3<T> const & m);
+
+ //! Return the inverse of a mat4 matrix.
+ //!
+ //! \li <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/inverse.xml">GLSL inverse man page</a>
+ //! \li GLSL 1.40.07 specification, section 8.5
+ template <typename T>
+ detail::tmat4x4<T> inverse(
+ detail::tmat4x4<T> 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 <typename matType>
+ GLM_FUNC_QUALIFIER matType matrixCompMult
+ (
+ matType const & x,
+ matType const & y
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<typename matType::value_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 <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat2x2<T> outerProduct
+ (
+ detail::tvec2<T> const & c,
+ detail::tvec2<T> const & r
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<T>::is_float, "'outerProduct' only accept floating-point inputs");
+
+ detail::tmat2x2<T> m(detail::tmat2x2<T>::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 <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat3x3<T> outerProduct
+ (
+ detail::tvec3<T> const & c,
+ detail::tvec3<T> const & r
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<T>::is_float, "'outerProduct' only accept floating-point inputs");
+
+ detail::tmat3x3<T> m(detail::tmat3x3<T>::null);
+ for(typename detail::tmat3x3<T>::size_type i = 0; i < detail::tmat3x3<T>::col_size(); ++i)
+ m[i] = c * r[i];
+ return m;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat4x4<T> outerProduct
+ (
+ detail::tvec4<T> const & c,
+ detail::tvec4<T> const & r
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<T>::is_float, "'outerProduct' only accept floating-point inputs");
+
+ detail::tmat4x4<T> m(detail::tmat4x4<T>::null);
+ for(typename detail::tmat4x4<T>::size_type i = 0; i < detail::tmat4x4<T>::col_size(); ++i)
+ m[i] = c * r[i];
+ return m;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat2x3<T> outerProduct
+ (
+ detail::tvec3<T> const & c,
+ detail::tvec2<T> const & r
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<T>::is_float, "'outerProduct' only accept floating-point inputs");
+
+ detail::tmat2x3<T> m(detail::tmat2x3<T>::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 <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat3x2<T> outerProduct
+ (
+ detail::tvec2<T> const & c,
+ detail::tvec3<T> const & r
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<T>::is_float, "'outerProduct' only accept floating-point inputs");
+
+ detail::tmat3x2<T> m(detail::tmat3x2<T>::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 <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat2x4<T> outerProduct
+ (
+ detail::tvec2<T> const & c,
+ detail::tvec4<T> const & r
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<T>::is_float, "'outerProduct' only accept floating-point inputs");
+
+ detail::tmat2x4<T> m(detail::tmat2x4<T>::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 <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat4x2<T> outerProduct
+ (
+ detail::tvec4<T> const & c,
+ detail::tvec2<T> const & r
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<T>::is_float, "'outerProduct' only accept floating-point inputs");
+
+ detail::tmat4x2<T> m(detail::tmat4x2<T>::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 <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat3x4<T> outerProduct
+ (
+ detail::tvec4<T> const & c,
+ detail::tvec3<T> const & r
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<T>::is_float, "'outerProduct' only accept floating-point inputs");
+
+ detail::tmat3x4<T> m(detail::tmat3x4<T>::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 <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat4x3<T> outerProduct
+ (
+ detail::tvec3<T> const & c,
+ detail::tvec4<T> const & r
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<T>::is_float, "'outerProduct' only accept floating-point inputs");
+
+ detail::tmat4x3<T> m(detail::tmat4x3<T>::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 <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat2x2<T> transpose
+ (
+ detail::tmat2x2<T> const & m
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<T>::is_float, "'transpose' only accept floating-point inputs");
+
+ detail::tmat2x2<T> result(detail::tmat2x2<T>::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 <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat3x3<T> transpose
+ (
+ detail::tmat3x3<T> const & m
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<T>::is_float, "'transpose' only accept floating-point inputs");
+
+ detail::tmat3x3<T> result(detail::tmat3x3<T>::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 <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat4x4<T> transpose
+ (
+ detail::tmat4x4<T> const & m
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<T>::is_float, "'transpose' only accept floating-point inputs");
+
+ detail::tmat4x4<T> result(detail::tmat4x4<T>::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 <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat2x3<T> transpose
+ (
+ detail::tmat3x2<T> const & m
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<T>::is_float, "'transpose' only accept floating-point inputs");
+
+ detail::tmat2x3<T> result(detail::tmat2x3<T>::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 <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat3x2<T> transpose
+ (
+ detail::tmat2x3<T> const & m
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<T>::is_float, "'transpose' only accept floating-point inputs");
+
+ detail::tmat3x2<T> result(detail::tmat3x2<T>::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 <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat2x4<T> transpose
+ (
+ detail::tmat4x2<T> const & m
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<T>::is_float, "'transpose' only accept floating-point inputs");
+
+ detail::tmat2x4<T> result(detail::tmat2x4<T>::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 <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat4x2<T> transpose
+ (
+ detail::tmat2x4<T> const & m
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<T>::is_float, "'transpose' only accept floating-point inputs");
+
+ detail::tmat4x2<T> result(detail::tmat4x2<T>::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 <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat3x4<T> transpose
+ (
+ detail::tmat4x3<T> const & m
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<T>::is_float, "'transpose' only accept floating-point inputs");
+
+ detail::tmat3x4<T> result(detail::tmat3x4<T>::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 <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat4x3<T> transpose
+ (
+ detail::tmat3x4<T> const & m
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<T>::is_float, "'transpose' only accept floating-point inputs");
+
+ detail::tmat4x3<T> result(detail::tmat4x3<T>::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 <typename T>
+ GLM_FUNC_QUALIFIER typename detail::tmat2x2<T>::value_type determinant
+ (
+ detail::tmat2x2<T> const & m
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<T>::is_float, "'determinant' only accept floating-point inputs");
+
+ return m[0][0] * m[1][1] - m[1][0] * m[0][1];
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename detail::tmat3x3<T>::value_type determinant
+ (
+ detail::tmat3x3<T> const & m
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<T>::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 <typename T>
+ GLM_FUNC_QUALIFIER typename detail::tmat4x4<T>::value_type determinant
+ (
+ detail::tmat4x4<T> const & m
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<T>::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<T> 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 <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat2x2<T> inverse
+ (
+ detail::tmat2x2<T> const & m
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<T>::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<T> Inverse(
+ + m[1][1] / Determinant,
+ - m[0][1] / Determinant,
+ - m[1][0] / Determinant,
+ + m[0][0] / Determinant);
+
+ return Inverse;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat3x3<T> inverse
+ (
+ detail::tmat3x3<T> const & m
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<T>::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<T> Inverse(detail::tmat3x3<T>::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 <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat4x4<T> inverse
+ (
+ detail::tmat4x4<T> const & m
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<T>::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<T> const SignA(+1, -1, +1, -1);
+ detail::tvec4<T> const SignB(-1, +1, -1, +1);
+
+ detail::tvec4<T> Fac0(Coef00, Coef00, Coef02, Coef03);
+ detail::tvec4<T> Fac1(Coef04, Coef04, Coef06, Coef07);
+ detail::tvec4<T> Fac2(Coef08, Coef08, Coef10, Coef11);
+ detail::tvec4<T> Fac3(Coef12, Coef12, Coef14, Coef15);
+ detail::tvec4<T> Fac4(Coef16, Coef16, Coef18, Coef19);
+ detail::tvec4<T> Fac5(Coef20, Coef20, Coef22, Coef23);
+
+ detail::tvec4<T> Vec0(m[1][0], m[0][0], m[0][0], m[0][0]);
+ detail::tvec4<T> Vec1(m[1][1], m[0][1], m[0][1], m[0][1]);
+ detail::tvec4<T> Vec2(m[1][2], m[0][2], m[0][2], m[0][2]);
+ detail::tvec4<T> Vec3(m[1][3], m[0][3], m[0][3], m[0][3]);
+
+ detail::tvec4<T> Inv0 = SignA * (Vec1 * Fac0 - Vec2 * Fac1 + Vec3 * Fac2);
+ detail::tvec4<T> Inv1 = SignB * (Vec0 * Fac0 - Vec2 * Fac3 + Vec3 * Fac4);
+ detail::tvec4<T> Inv2 = SignA * (Vec0 * Fac1 - Vec1 * Fac3 + Vec3 * Fac5);
+ detail::tvec4<T> Inv3 = SignB * (Vec0 * Fac2 - Vec1 * Fac4 + Vec2 * Fac5);
+
+ detail::tmat4x4<T> Inverse(Inv0, Inv1, Inv2, Inv3);
+
+ detail::tvec4<T> 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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/noise1.xml">GLSL noise1 man page</a>
+ //! \li GLSL 1.30.08 specification, section 8.9
+ template <typename genType>
+ typename genType::value_type noise1(genType const & x);
+
+ //! Returns a 2D noise value based on the input value x.
+ //!
+ //! \li <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/noise2.xml">GLSL noise2 man page</a>
+ //! \li GLSL 1.30.08 specification, section 8.9
+ template <typename genType>
+ detail::tvec2<typename genType::value_type> noise2(genType const & x);
+
+ //! Returns a 3D noise value based on the input value x.
+ //!
+ //! \li <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/noise3.xml">GLSL noise3 man page</a>
+ //! \li GLSL 1.30.08 specification, section 8.9
+ template <typename genType>
+ detail::tvec3<typename genType::value_type> noise3(genType const & x);
+
+ //! Returns a 4D noise value based on the input value x.
+ //!
+ //! \li <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/noise4.xml">GLSL noise4 man page</a>
+ //! \li GLSL 1.30.08 specification, section 8.9
+ template <typename genType>
+ detail::tvec4<typename genType::value_type> 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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packUnorm2x16.xml">GLSL packUnorm2x16 man page</a>
+ //! \li GLSL 4.00.08 specification, section 8.4
+ detail::uint32 packUnorm2x16(detail::tvec2<detail::float32> 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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packUnorm4x8.xml">GLSL packUnorm4x8 man page</a>
+ //! \li GLSL 4.00.08 specification, section 8.4
+ detail::uint32 packUnorm4x8(detail::tvec4<detail::float32> 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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packSnorm4x8.xml">GLSL packSnorm4x8 man page</a>
+ //! \li GLSL 4.00.08 specification, section 8.4
+ detail::uint32 packSnorm4x8(detail::tvec4<detail::float32> 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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackUnorm2x16.xml">GLSL unpackUnorm2x16 man page</a>
+ //! \li GLSL 4.00.08 specification, section 8.4
+ detail::tvec2<detail::float32> 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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackUnorm4x8.xml">GLSL unpackUnorm4x8 man page</a>
+ //! \li GLSL 4.00.08 specification, section 8.4
+ detail::tvec4<detail::float32> 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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackSnorm4x8.xml">GLSL unpackSnorm4x8 man page</a>
+ //! \li GLSL 4.00.08 specification, section 8.4
+ detail::tvec4<detail::float32> 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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packDouble2x32.xml">GLSL packDouble2x32 man page</a>
+ //! \li GLSL 4.00.08 specification, section 8.4
+ double packDouble2x32(detail::tvec2<detail::uint32> 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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackDouble2x32.xml">GLSL unpackDouble2x32 man page</a>
+ //! \li GLSL 4.00.08 specification, section 8.4
+ detail::tvec2<detail::uint32> 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<detail::float32> 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<detail::float32> 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<detail::float32> 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<detail::float32> unpackUnorm2x16(detail::uint32 const & p)
+ {
+ detail::uint16 A(detail::uint16(p >> 0));
+ detail::uint16 B(detail::uint16(p >> 16));
+ return detail::tvec2<detail::float32>(
+ A * 1.0f / 65535.0f,
+ B * 1.0f / 65535.0f);
+ }
+
+ GLM_FUNC_QUALIFIER detail::tvec4<detail::float32> 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<detail::float32>(
+ 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<detail::float32> 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<detail::float32>(
+ 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<detail::uint32> const & v)
+ {
+ return *(double*)&v;
+ }
+
+ GLM_FUNC_QUALIFIER detail::tvec2<detail::uint32> unpackDouble2x32(double const & v)
+ {
+ return *(detail::tvec2<detail::uint32>*)&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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/radians.xml">GLSL radians man page</a>
+ //! \li GLSL 1.30.08 specification, section 8.1
+ template <typename genType>
+ genType radians(genType const & degrees);
+
+ //! Converts radians to degrees and returns the result.
+ //!
+ //! \li <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/degrees.xml">GLSL degrees man page</a>
+ //! \li GLSL 1.30.08 specification, section 8.1
+ template <typename genType>
+ genType degrees(genType const & radians);
+
+ //! The standard trigonometric sine function.
+ //! The values returned by this function will range from [-1, 1].
+ //!
+ //! \li <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/sin.xml">GLSL sin man page</a>
+ //! \li GLSL 1.30.08 specification, section 8.1
+ template <typename genType>
+ genType sin(genType const & angle);
+
+ //! The standard trigonometric cosine function.
+ //! The values returned by this function will range from [-1, 1].
+ //!
+ //! \li <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/cos.xml">GLSL cos man page</a>
+ //! \li GLSL 1.30.08 specification, section 8.1
+ template <typename genType>
+ genType cos(genType const & angle);
+
+ //! The standard trigonometric tangent function.
+ //!
+ //! \li <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/tan.xml">GLSL tan man page</a>
+ //! \li GLSL 1.30.08 specification, section 8.1
+ template <typename genType>
+ 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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/asin.xml">GLSL asin man page</a>
+ //! \li GLSL 1.30.08 specification, section 8.1
+ template <typename genType>
+ 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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/acos.xml">GLSL acos man page</a>
+ //! \li GLSL 1.30.08 specification, section 8.1
+ template <typename genType>
+ 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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/atan.xml">GLSL atan man page</a>
+ //! \li GLSL 1.30.08 specification, section 8.1
+ template <typename genType>
+ 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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/atan.xml">GLSL atan man page</a>
+ //! \li GLSL 1.30.08 specification, section 8.1
+ template <typename genType>
+ genType atan(genType const & y_over_x);
+
+ //! Returns the hyperbolic sine function, (exp(x) - exp(-x)) / 2
+ //!
+ //! \li <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/sinh.xml">GLSL sinh man page</a>
+ //! \li GLSL 1.30.08 specification, section 8.1
+ template <typename genType>
+ genType sinh(genType const & angle);
+
+ //! Returns the hyperbolic cosine function, (exp(x) + exp(-x)) / 2
+ //!
+ //! \li <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/cosh.xml">GLSL cosh man page</a>
+ //! \li GLSL 1.30.08 specification, section 8.1
+ template <typename genType>
+ genType cosh(genType const & angle);
+
+ //! Returns the hyperbolic tangent function, sinh(angle) / cosh(angle)
+ //!
+ //! \li <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/tanh.xml">GLSL tanh man page</a>
+ //! \li GLSL 1.30.08 specification, section 8.1
+ template <typename genType>
+ genType tanh(genType const & angle);
+
+ //! Arc hyperbolic sine; returns the inverse of sinh.
+ //!
+ //! \li <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/asinh.xml">GLSL asinh man page</a>
+ //! \li GLSL 1.30.08 specification, section 8.1
+ template <typename genType>
+ genType asinh(genType const & x);
+
+ //! Arc hyperbolic cosine; returns the non-negative inverse
+ //! of cosh. Results are undefined if x < 1.
+ //!
+ //! \li <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/acosh.xml">GLSL acosh man page</a>
+ //! \li GLSL 1.30.08 specification, section 8.1
+ template <typename genType>
+ genType acosh(genType const & x);
+
+ //! Arc hyperbolic tangent; returns the inverse of tanh.
+ //! Results are undefined if abs(x) >= 1.
+ //!
+ //! \li <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/atanh.xml">GLSL atanh man page</a>
+ //! \li GLSL 1.30.08 specification, section 8.1
+ template <typename genType>
+ 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 <typename genType>
+ GLM_FUNC_QUALIFIER genType radians
+ (
+ genType const & degrees
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'radians' only accept floating-point input");
+
+ const genType pi = genType(3.1415926535897932384626433832795);
+ return degrees * (pi / genType(180));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> radians
+ (
+ detail::tvec2<T> const & degrees
+ )
+ {
+ return detail::tvec2<T>(
+ radians(degrees.x),
+ radians(degrees.y));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> radians
+ (
+ detail::tvec3<T> const & degrees
+ )
+ {
+ return detail::tvec3<T>(
+ radians(degrees.x),
+ radians(degrees.y),
+ radians(degrees.z));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> radians
+ (
+ detail::tvec4<T> const & degrees
+ )
+ {
+ return detail::tvec4<T>(
+ radians(degrees.x),
+ radians(degrees.y),
+ radians(degrees.z),
+ radians(degrees.w));
+ }
+
+ // degrees
+ template <typename genType>
+ GLM_FUNC_QUALIFIER genType degrees
+ (
+ genType const & radians
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'degrees' only accept floating-point input");
+
+ const genType pi = genType(3.1415926535897932384626433832795);
+ return radians * (genType(180) / pi);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> degrees
+ (
+ detail::tvec2<T> const & radians
+ )
+ {
+ return detail::tvec2<T>(
+ degrees(radians.x),
+ degrees(radians.y));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> degrees
+ (
+ detail::tvec3<T> const & radians
+ )
+ {
+ return detail::tvec3<T>(
+ degrees(radians.x),
+ degrees(radians.y),
+ degrees(radians.z));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> degrees
+ (
+ detail::tvec4<T> const & radians
+ )
+ {
+ return detail::tvec4<T>(
+ degrees(radians.x),
+ degrees(radians.y),
+ degrees(radians.z),
+ degrees(radians.w));
+ }
+
+ // sin
+ template <typename genType>
+ GLM_FUNC_QUALIFIER genType sin
+ (
+ genType const & angle
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'sin' only accept floating-point input");
+
+ return ::std::sin(angle);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> sin
+ (
+ detail::tvec2<T> const & angle
+ )
+ {
+ return detail::tvec2<T>(
+ sin(angle.x),
+ sin(angle.y));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> sin
+ (
+ detail::tvec3<T> const & angle
+ )
+ {
+ return detail::tvec3<T>(
+ sin(angle.x),
+ sin(angle.y),
+ sin(angle.z));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> sin
+ (
+ detail::tvec4<T> const & angle
+ )
+ {
+ return detail::tvec4<T>(
+ sin(angle.x),
+ sin(angle.y),
+ sin(angle.z),
+ sin(angle.w));
+ }
+
+ // cos
+ template <typename genType>
+ GLM_FUNC_QUALIFIER genType cos(genType const & angle)
+ {
+ GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'cos' only accept floating-point input");
+
+ return ::std::cos(angle);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> cos
+ (
+ detail::tvec2<T> const & angle
+ )
+ {
+ return detail::tvec2<T>(
+ cos(angle.x),
+ cos(angle.y));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> cos
+ (
+ detail::tvec3<T> const & angle
+ )
+ {
+ return detail::tvec3<T>(
+ cos(angle.x),
+ cos(angle.y),
+ cos(angle.z));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> cos
+ (
+ detail::tvec4<T> const & angle
+ )
+ {
+ return detail::tvec4<T>(
+ cos(angle.x),
+ cos(angle.y),
+ cos(angle.z),
+ cos(angle.w));
+ }
+
+ // tan
+ template <typename genType>
+ GLM_FUNC_QUALIFIER genType tan
+ (
+ genType const & angle
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'tan' only accept floating-point input");
+
+ return ::std::tan(angle);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> tan
+ (
+ detail::tvec2<T> const & angle
+ )
+ {
+ return detail::tvec2<T>(
+ tan(angle.x),
+ tan(angle.y));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> tan
+ (
+ detail::tvec3<T> const & angle
+ )
+ {
+ return detail::tvec3<T>(
+ tan(angle.x),
+ tan(angle.y),
+ tan(angle.z));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> tan
+ (
+ detail::tvec4<T> const & angle
+ )
+ {
+ return detail::tvec4<T>(
+ tan(angle.x),
+ tan(angle.y),
+ tan(angle.z),
+ tan(angle.w));
+ }
+
+ // asin
+ template <typename genType>
+ GLM_FUNC_QUALIFIER genType asin
+ (
+ genType const & x
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'asin' only accept floating-point input");
+
+ return ::std::asin(x);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> asin
+ (
+ detail::tvec2<T> const & x
+ )
+ {
+ return detail::tvec2<T>(
+ asin(x.x),
+ asin(x.y));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> asin
+ (
+ detail::tvec3<T> const & x
+ )
+ {
+ return detail::tvec3<T>(
+ asin(x.x),
+ asin(x.y),
+ asin(x.z));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> asin
+ (
+ detail::tvec4<T> const & x
+ )
+ {
+ return detail::tvec4<T>(
+ asin(x.x),
+ asin(x.y),
+ asin(x.z),
+ asin(x.w));
+ }
+
+ // acos
+ template <typename genType>
+ GLM_FUNC_QUALIFIER genType acos
+ (
+ genType const & x
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'acos' only accept floating-point input");
+
+ return ::std::acos(x);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> acos
+ (
+ detail::tvec2<T> const & x
+ )
+ {
+ return detail::tvec2<T>(
+ acos(x.x),
+ acos(x.y));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> acos
+ (
+ detail::tvec3<T> const & x
+ )
+ {
+ return detail::tvec3<T>(
+ acos(x.x),
+ acos(x.y),
+ acos(x.z));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> acos
+ (
+ detail::tvec4<T> const & x
+ )
+ {
+ return detail::tvec4<T>(
+ acos(x.x),
+ acos(x.y),
+ acos(x.z),
+ acos(x.w));
+ }
+
+ // atan
+ template <typename genType>
+ GLM_FUNC_QUALIFIER genType atan
+ (
+ genType const & y,
+ genType const & x
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'atan' only accept floating-point input");
+
+ return ::std::atan2(y, x);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> atan
+ (
+ detail::tvec2<T> const & y,
+ detail::tvec2<T> const & x
+ )
+ {
+ return detail::tvec2<T>(
+ atan(y.x, x.x),
+ atan(y.y, x.y));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> atan
+ (
+ detail::tvec3<T> const & y,
+ detail::tvec3<T> const & x
+ )
+ {
+ return detail::tvec3<T>(
+ atan(y.x, x.x),
+ atan(y.y, x.y),
+ atan(y.z, x.z));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> atan
+ (
+ detail::tvec4<T> const & y,
+ detail::tvec4<T> const & x
+ )
+ {
+ return detail::tvec4<T>(
+ atan(y.x, x.x),
+ atan(y.y, x.y),
+ atan(y.z, x.z),
+ atan(y.w, x.w));
+ }
+
+ template <typename genType>
+ GLM_FUNC_QUALIFIER genType atan
+ (
+ genType const & x
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'atan' only accept floating-point input");
+
+ return ::std::atan(x);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> atan
+ (
+ detail::tvec2<T> const & x
+ )
+ {
+ return detail::tvec2<T>(
+ atan(x.x),
+ atan(x.y));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> atan
+ (
+ detail::tvec3<T> const & x
+ )
+ {
+ return detail::tvec3<T>(
+ atan(x.x),
+ atan(x.y),
+ atan(x.z));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> atan
+ (
+ detail::tvec4<T> const & x
+ )
+ {
+ return detail::tvec4<T>(
+ atan(x.x),
+ atan(x.y),
+ atan(x.z),
+ atan(x.w));
+ }
+
+ // sinh
+ template <typename genType>
+ GLM_FUNC_QUALIFIER genType sinh
+ (
+ genType const & angle
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'sinh' only accept floating-point input");
+
+ return std::sinh(angle);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> sinh
+ (
+ detail::tvec2<T> const & angle
+ )
+ {
+ return detail::tvec2<T>(
+ sinh(angle.x),
+ sinh(angle.y));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> sinh
+ (
+ detail::tvec3<T> const & angle
+ )
+ {
+ return detail::tvec3<T>(
+ sinh(angle.x),
+ sinh(angle.y),
+ sinh(angle.z));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> sinh
+ (
+ detail::tvec4<T> const & angle
+ )
+ {
+ return detail::tvec4<T>(
+ sinh(angle.x),
+ sinh(angle.y),
+ sinh(angle.z),
+ sinh(angle.w));
+ }
+
+ // cosh
+ template <typename genType>
+ GLM_FUNC_QUALIFIER genType cosh
+ (
+ genType const & angle
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'cosh' only accept floating-point input");
+
+ return std::cosh(angle);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> cosh
+ (
+ detail::tvec2<T> const & angle
+ )
+ {
+ return detail::tvec2<T>(
+ cosh(angle.x),
+ cosh(angle.y));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> cosh
+ (
+ detail::tvec3<T> const & angle
+ )
+ {
+ return detail::tvec3<T>(
+ cosh(angle.x),
+ cosh(angle.y),
+ cosh(angle.z));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> cosh
+ (
+ detail::tvec4<T> const & angle
+ )
+ {
+ return detail::tvec4<T>(
+ cosh(angle.x),
+ cosh(angle.y),
+ cosh(angle.z),
+ cosh(angle.w));
+ }
+
+ // tanh
+ template <typename genType>
+ GLM_FUNC_QUALIFIER genType tanh
+ (
+ genType const & angle
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'tanh' only accept floating-point input");
+
+ return std::tanh(angle);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> tanh
+ (
+ detail::tvec2<T> const & angle
+ )
+ {
+ return detail::tvec2<T>(
+ tanh(angle.x),
+ tanh(angle.y));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> tanh
+ (
+ detail::tvec3<T> const & angle
+ )
+ {
+ return detail::tvec3<T>(
+ tanh(angle.x),
+ tanh(angle.y),
+ tanh(angle.z));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> tanh
+ (
+ detail::tvec4<T> const & angle
+ )
+ {
+ return detail::tvec4<T>(
+ tanh(angle.x),
+ tanh(angle.y),
+ tanh(angle.z),
+ tanh(angle.w));
+ }
+
+ // asinh
+ template <typename genType>
+ GLM_FUNC_QUALIFIER genType asinh
+ (
+ genType const & x
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<genType>::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 <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> asinh
+ (
+ detail::tvec2<T> const & x
+ )
+ {
+ return detail::tvec2<T>(
+ asinh(x.x),
+ asinh(x.y));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> asinh
+ (
+ detail::tvec3<T> const & x
+ )
+ {
+ return detail::tvec3<T>(
+ asinh(x.x),
+ asinh(x.y),
+ asinh(x.z));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> asinh
+ (
+ detail::tvec4<T> const & x
+ )
+ {
+ return detail::tvec4<T>(
+ asinh(x.x),
+ asinh(x.y),
+ asinh(x.z),
+ asinh(x.w));
+ }
+
+ // acosh
+ template <typename genType>
+ GLM_FUNC_QUALIFIER genType acosh
+ (
+ genType const & x
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'acosh' only accept floating-point input");
+
+ if(x < genType(1))
+ return genType(0);
+ return log(x + sqrt(x * x - genType(1)));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> acosh
+ (
+ detail::tvec2<T> const & x
+ )
+ {
+ return detail::tvec2<T>(
+ acosh(x.x),
+ acosh(x.y));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> acosh
+ (
+ detail::tvec3<T> const & x
+ )
+ {
+ return detail::tvec3<T>(
+ acosh(x.x),
+ acosh(x.y),
+ acosh(x.z));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> acosh
+ (
+ detail::tvec4<T> const & x
+ )
+ {
+ return detail::tvec4<T>(
+ acosh(x.x),
+ acosh(x.y),
+ acosh(x.z),
+ acosh(x.w));
+ }
+
+ // atanh
+ template <typename genType>
+ GLM_FUNC_QUALIFIER genType atanh
+ (
+ genType const & x
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<genType>::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 <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> atanh
+ (
+ detail::tvec2<T> const & x
+ )
+ {
+ return detail::tvec2<T>(
+ atanh(x.x),
+ atanh(x.y));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> atanh
+ (
+ detail::tvec3<T> const & x
+ )
+ {
+ return detail::tvec3<T>(
+ atanh(x.x),
+ atanh(x.y),
+ atanh(x.z));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> atanh
+ (
+ detail::tvec4<T> const & x
+ )
+ {
+ return detail::tvec4<T>(
+ 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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/lessThan.xml">GLSL lessThan man page</a>
+ //! \li GLSL 1.30.08 specification, section 8.6
+ template <typename T, template <typename> class vecType>
+ GLM_FUNC_QUALIFIER typename vecType<T>::bool_type lessThan
+ (
+ vecType<T> const & x,
+ vecType<T> const & y
+ )
+ {
+ GLM_STATIC_ASSERT(detail::is_vector<vecType<T> >::_YES,
+ "Invalid template instantiation of 'lessThan', GLM vector types required");
+ GLM_STATIC_ASSERT(detail::is_bool<T>::_NO,
+ "Invalid template instantiation of 'lessThan', GLM vector types required floating-point or integer value types vectors");
+
+ typename vecType<bool>::bool_type Result(vecType<bool>::null);
+ for(typename vecType<bool>::size_type i = 0; i < vecType<bool>::value_size(); ++i)
+ Result[i] = x[i] < y[i];
+
+ return Result;
+ }
+
+ //! Returns the component-wise comparison of result x <= y.
+ //!
+ //! \li <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/lessThanEqual.xml">GLSL lessThanEqual man page</a>
+ //! \li GLSL 1.30.08 specification, section 8.6
+ template <typename T, template <typename> class vecType>
+ GLM_FUNC_QUALIFIER typename vecType<T>::bool_type lessThanEqual
+ (
+ vecType<T> const & x,
+ vecType<T> const & y
+ )
+ {
+ GLM_STATIC_ASSERT(detail::is_vector<vecType<T> >::_YES,
+ "Invalid template instantiation of 'lessThanEqual', GLM vector types required");
+ GLM_STATIC_ASSERT(detail::is_bool<T>::_NO,
+ "Invalid template instantiation of 'lessThanEqual', GLM vector types required floating-point or integer value types vectors");
+
+ typename vecType<bool>::bool_type Result(vecType<bool>::null);
+ for(typename vecType<bool>::size_type i = 0; i < vecType<bool>::value_size(); ++i)
+ Result[i] = x[i] <= y[i];
+ return Result;
+ }
+
+ //! Returns the component-wise comparison of result x > y.
+ //!
+ //! \li <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/greaterThan.xml">GLSL greaterThan man page</a>
+ //! \li GLSL 1.30.08 specification, section 8.6
+ template <typename T, template <typename> class vecType>
+ GLM_FUNC_QUALIFIER typename vecType<T>::bool_type greaterThan
+ (
+ vecType<T> const & x,
+ vecType<T> const & y
+ )
+ {
+ GLM_STATIC_ASSERT(detail::is_vector<vecType<T> >::_YES,
+ "Invalid template instantiation of 'greaterThan', GLM vector types required");
+ GLM_STATIC_ASSERT(detail::is_bool<T>::_NO,
+ "Invalid template instantiation of 'greaterThan', GLM vector types required floating-point or integer value types vectors");
+
+ typename vecType<bool>::bool_type Result(vecType<bool>::null);
+ for(typename vecType<bool>::size_type i = 0; i < vecType<bool>::value_size(); ++i)
+ Result[i] = x[i] > y[i];
+ return Result;
+ }
+
+ //! Returns the component-wise comparison of result x >= y.
+ //!
+ //! \li <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/greaterThanEqual.xml">GLSL greaterThanEqual man page</a>
+ //! \li GLSL 1.30.08 specification, section 8.6
+ template <typename T, template <typename> class vecType>
+ GLM_FUNC_QUALIFIER typename vecType<T>::bool_type greaterThanEqual
+ (
+ vecType<T> const & x,
+ vecType<T> const & y
+ )
+ {
+ GLM_STATIC_ASSERT(detail::is_vector<vecType<T> >::_YES,
+ "Invalid template instantiation of 'greaterThanEqual', GLM vector types required");
+ GLM_STATIC_ASSERT(detail::is_bool<T>::_NO,
+ "Invalid template instantiation of 'greaterThanEqual', GLM vector types required floating-point or integer value types vectors");
+
+ typename vecType<bool>::bool_type Result(vecType<bool>::null);
+ for(typename vecType<bool>::size_type i = 0; i < vecType<bool>::value_size(); ++i)
+ Result[i] = x[i] >= y[i];
+ return Result;
+ }
+
+ //! Returns the component-wise comparison of result x == y.
+ //!
+ //! \li <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/equal.xml">GLSL equal man page</a>
+ //! \li GLSL 1.30.08 specification, section 8.6
+ template <typename T, template <typename> class vecType>
+ GLM_FUNC_QUALIFIER typename vecType<T>::bool_type equal
+ (
+ vecType<T> const & x,
+ vecType<T> const & y
+ )
+ {
+ GLM_STATIC_ASSERT(detail::is_vector<vecType<T> >::_YES,
+ "Invalid template instantiation of 'equal', GLM vector types required");
+
+ typename vecType<bool>::bool_type Result(vecType<bool>::null);
+ for(typename vecType<bool>::size_type i = 0; i < vecType<bool>::value_size(); ++i)
+ Result[i] = x[i] == y[i];
+ return Result;
+ }
+
+ //! Returns the component-wise comparison of result x != y.
+ //!
+ //! \li <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/notEqual.xml">GLSL notEqual man page</a>
+ //! \li GLSL 1.30.08 specification, section 8.6
+ template <typename T, template <typename> class vecType>
+ GLM_FUNC_QUALIFIER typename vecType<T>::bool_type notEqual
+ (
+ vecType<T> const & x,
+ vecType<T> const & y
+ )
+ {
+ GLM_STATIC_ASSERT(detail::is_vector<vecType<T> >::_YES,
+ "Invalid template instantiation of 'notEqual', GLM vector types required");
+
+ typename vecType<bool>::bool_type Result(vecType<bool>::null);
+ for(typename vecType<bool>::size_type i = 0; i < vecType<bool>::value_size(); ++i)
+ Result[i] = x[i] != y[i];
+ return Result;
+ }
+
+ //! Returns true if any component of x is true.
+ //!
+ //! \li <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/any.xml">GLSL any man page</a>
+ //! \li GLSL 1.30.08 specification, section 8.6
+ template <template <typename> class vecType>
+ GLM_FUNC_QUALIFIER bool any(vecType<bool> const & v)
+ {
+ GLM_STATIC_ASSERT(detail::is_vector<vecType<bool> >::_YES,
+ "Invalid template instantiation of 'any', GLM boolean vector types required");
+
+ bool Result = false;
+ for(typename vecType<bool>::size_type i = 0; i < vecType<bool>::value_size(); ++i)
+ Result = Result || v[i];
+ return Result;
+ }
+
+ //! Returns true if all components of x are true.
+ //!
+ //! \li <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/all.xml">GLSL all man page</a>
+ //! \li GLSL 1.30.08 specification, section 8.6
+ template <template <typename> class vecType>
+ GLM_FUNC_QUALIFIER bool all(vecType<bool> const & v)
+ {
+ GLM_STATIC_ASSERT(detail::is_vector<vecType<bool> >::_YES,
+ "Invalid template instantiation of 'all', GLM boolean vector types required");
+
+ bool Result = true;
+ for(typename vecType<bool>::size_type i = 0; i < vecType<bool>::value_size(); ++i)
+ Result = Result && v[i];
+ return Result;
+ }
+
+ //! Returns the component-wise logical complement of x.
+ //! /!\ Because of language incompatibilities between C++ and GLSL, GLM defines the function not but not_ instead.
+ //!
+ //! \li <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/not.xml">GLSL not man page</a>
+ //! \li GLSL 1.30.08 specification, section 8.6
+ template <template <typename> class vecType>
+ GLM_FUNC_QUALIFIER vecType<bool> not_(vecType<bool> const & v)
+ {
+ GLM_STATIC_ASSERT(detail::is_vector<vecType<bool> >::_YES,
+ "Invalid template instantiation of 'not_', GLM vector types required");
+
+ typename vecType<bool>::bool_type Result(vecType<bool>::null);
+ for(typename vecType<bool>::size_type i = 0; i < vecType<bool>::value_size(); ++i)
+ Result[i] = !v[i];
+ return Result;
+ }
+
+ ///@}
+
+ }//namespace vector_relational
+ }//namespace function
+ }//namespace core
+
+ using namespace core::function::vector_relational;
+}//namespace glm
+
+#include "func_vector_relational.inl"
+
+#endif//glm_core_func_vector_relational
diff --git a/src/glm/core/func_vector_relational.inl b/src/glm/core/func_vector_relational.inl
new file mode 100644
index 0000000..35fc30e
--- /dev/null
+++ b/src/glm/core/func_vector_relational.inl
@@ -0,0 +1,20 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// 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_vector_relational.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm
+{
+ namespace core{
+ namespace function{
+ namespace vector_relational{
+
+ }//namespace vector_relational
+ }//namespace function
+ }//namespace core
+}//namespace glm
+
diff --git a/src/glm/core/hint.hpp b/src/glm/core/hint.hpp
new file mode 100644
index 0000000..ae75a79
--- /dev/null
+++ b/src/glm/core/hint.hpp
@@ -0,0 +1,21 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2008-08-14
+// Updated : 2008-08-14
+// Licence : This source is under MIT License
+// File : glm/core/hint.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_core_type
+#define glm_core_type
+
+namespace glm
+{
+ // Use dont_care, nicest and fastest to optimize implementations.
+ class dont_care {};
+ class nicest {};
+ class fastest {};
+};
+
+#endif//glm_core_type
diff --git a/src/glm/core/intrinsic_common.hpp b/src/glm/core/intrinsic_common.hpp
new file mode 100644
index 0000000..455464b
--- /dev/null
+++ b/src/glm/core/intrinsic_common.hpp
@@ -0,0 +1,70 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2009-05-11
+// Updated : 2009-05-11
+// Licence : This source is under MIT License
+// File : glm/core/intrinsic_common.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_detail_intrinsic_common
+#define glm_detail_intrinsic_common
+
+#include "setup.hpp"
+
+#if((GLM_ARCH & GLM_ARCH_SSE2) != GLM_ARCH_SSE2)
+# error "SSE2 instructions not supported or enabled"
+#else
+
+namespace glm{
+namespace detail
+{
+ __m128 sse_abs_ps(__m128 x);
+
+ __m128 sse_sgn_ps(__m128 x);
+
+ //floor
+ __m128 sse_flr_ps(__m128 v);
+
+ //trunc
+ __m128 sse_trc_ps(__m128 v);
+
+ //round
+ __m128 sse_nd_ps(__m128 v);
+
+ //roundEven
+ __m128 sse_rde_ps(__m128 v);
+
+ __m128 sse_rnd_ps(__m128 x);
+
+ __m128 sse_ceil_ps(__m128 v);
+
+ __m128 sse_frc_ps(__m128 x);
+
+ __m128 sse_mod_ps(__m128 x, __m128 y);
+
+ __m128 sse_modf_ps(__m128 x, __m128i & i);
+
+ //GLM_FUNC_QUALIFIER __m128 sse_min_ps(__m128 x, __m128 y)
+
+ //GLM_FUNC_QUALIFIER __m128 sse_max_ps(__m128 x, __m128 y)
+
+ __m128 sse_clp_ps(__m128 v, __m128 minVal, __m128 maxVal);
+
+ __m128 sse_mix_ps(__m128 v1, __m128 v2, __m128 a);
+
+ __m128 sse_stp_ps(__m128 edge, __m128 x);
+
+ __m128 sse_ssp_ps(__m128 edge0, __m128 edge1, __m128 x);
+
+ __m128 sse_nan_ps(__m128 x);
+
+ __m128 sse_inf_ps(__m128 x);
+
+}//namespace detail
+}//namespace glm
+
+#include "intrinsic_common.inl"
+
+#endif//GLM_ARCH
+#endif//glm_detail_intrinsic_common
diff --git a/src/glm/core/intrinsic_common.inl b/src/glm/core/intrinsic_common.inl
new file mode 100644
index 0000000..b7792aa
--- /dev/null
+++ b/src/glm/core/intrinsic_common.inl
@@ -0,0 +1,283 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2009-05-08
+// Updated : 2009-05-08
+// Licence : This source is under MIT License
+// File : glm/core/intrinsic_common.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm{
+namespace detail{
+
+ union ieee754_QNAN
+ {
+ const float f;
+ struct i
+ {
+ const unsigned int mantissa:23, exp:8, sign:1;
+ };
+
+ ieee754_QNAN() : f(0.0)/*, mantissa(0x7FFFFF), exp(0xFF), sign(0x0)*/ {}
+ };
+
+ static const __m128 GLM_VAR_USED zero = _mm_setzero_ps();
+ static const __m128 GLM_VAR_USED one = _mm_set_ps1(1.0f);
+ static const __m128 GLM_VAR_USED minus_one = _mm_set_ps1(-1.0f);
+ static const __m128 GLM_VAR_USED two = _mm_set_ps1(2.0f);
+ static const __m128 GLM_VAR_USED three = _mm_set_ps1(3.0f);
+ static const __m128 GLM_VAR_USED pi = _mm_set_ps1(3.1415926535897932384626433832795f);
+ static const __m128 GLM_VAR_USED hundred_eighty = _mm_set_ps1(180.f);
+ static const __m128 GLM_VAR_USED pi_over_hundred_eighty = _mm_set_ps1(0.017453292519943295769236907684886f);
+ static const __m128 GLM_VAR_USED hundred_eighty_over_pi = _mm_set_ps1(57.295779513082320876798154814105f);
+
+ static const ieee754_QNAN absMask;
+ static const __m128 GLM_VAR_USED abs4Mask = _mm_set_ps1(absMask.f);
+
+ static const __m128 GLM_VAR_USED _epi32_sign_mask = _mm_castsi128_ps(_mm_set1_epi32(0x80000000));
+ //static const __m128 GLM_VAR_USED _epi32_inv_sign_mask = _mm_castsi128_ps(_mm_set1_epi32(0x7FFFFFFF));
+ //static const __m128 GLM_VAR_USED _epi32_mant_mask = _mm_castsi128_ps(_mm_set1_epi32(0x7F800000));
+ //static const __m128 GLM_VAR_USED _epi32_inv_mant_mask = _mm_castsi128_ps(_mm_set1_epi32(0x807FFFFF));
+ //static const __m128 GLM_VAR_USED _epi32_min_norm_pos = _mm_castsi128_ps(_mm_set1_epi32(0x00800000));
+ static const __m128 GLM_VAR_USED _epi32_0 = _mm_set_ps1(0);
+ static const __m128 GLM_VAR_USED _epi32_1 = _mm_set_ps1(1);
+ static const __m128 GLM_VAR_USED _epi32_2 = _mm_set_ps1(2);
+ static const __m128 GLM_VAR_USED _epi32_3 = _mm_set_ps1(3);
+ static const __m128 GLM_VAR_USED _epi32_4 = _mm_set_ps1(4);
+ static const __m128 GLM_VAR_USED _epi32_5 = _mm_set_ps1(5);
+ static const __m128 GLM_VAR_USED _epi32_6 = _mm_set_ps1(6);
+ static const __m128 GLM_VAR_USED _epi32_7 = _mm_set_ps1(7);
+ static const __m128 GLM_VAR_USED _epi32_8 = _mm_set_ps1(8);
+ static const __m128 GLM_VAR_USED _epi32_9 = _mm_set_ps1(9);
+ static const __m128 GLM_VAR_USED _epi32_127 = _mm_set_ps1(127);
+ //static const __m128 GLM_VAR_USED _epi32_ninf = _mm_castsi128_ps(_mm_set1_epi32(0xFF800000));
+ //static const __m128 GLM_VAR_USED _epi32_pinf = _mm_castsi128_ps(_mm_set1_epi32(0x7F800000));
+
+ static const __m128 GLM_VAR_USED _ps_1_3 = _mm_set_ps1(0.33333333333333333333333333333333f);
+ static const __m128 GLM_VAR_USED _ps_0p5 = _mm_set_ps1(0.5f);
+ static const __m128 GLM_VAR_USED _ps_1 = _mm_set_ps1(1.0f);
+ static const __m128 GLM_VAR_USED _ps_m1 = _mm_set_ps1(-1.0f);
+ static const __m128 GLM_VAR_USED _ps_2 = _mm_set_ps1(2.0f);
+ static const __m128 GLM_VAR_USED _ps_3 = _mm_set_ps1(3.0f);
+ static const __m128 GLM_VAR_USED _ps_127 = _mm_set_ps1(127.0f);
+ static const __m128 GLM_VAR_USED _ps_255 = _mm_set_ps1(255.0f);
+ static const __m128 GLM_VAR_USED _ps_2pow23 = _mm_set_ps1(8388608.0f);
+
+ static const __m128 GLM_VAR_USED _ps_1_0_0_0 = _mm_set_ps(1.0f, 0.0f, 0.0f, 0.0f);
+ static const __m128 GLM_VAR_USED _ps_0_1_0_0 = _mm_set_ps(0.0f, 1.0f, 0.0f, 0.0f);
+ static const __m128 GLM_VAR_USED _ps_0_0_1_0 = _mm_set_ps(0.0f, 0.0f, 1.0f, 0.0f);
+ static const __m128 GLM_VAR_USED _ps_0_0_0_1 = _mm_set_ps(0.0f, 0.0f, 0.0f, 1.0f);
+
+ static const __m128 GLM_VAR_USED _ps_pi = _mm_set_ps1(3.1415926535897932384626433832795f);
+ static const __m128 GLM_VAR_USED _ps_pi2 = _mm_set_ps1(6.283185307179586476925286766560f);
+ static const __m128 GLM_VAR_USED _ps_2_pi = _mm_set_ps1(0.63661977236758134307553505349006f);
+ static const __m128 GLM_VAR_USED _ps_pi_2 = _mm_set_ps1(1.5707963267948966192313216916398f);
+ static const __m128 GLM_VAR_USED _ps_4_pi = _mm_set_ps1(1.2732395447351626861510701069801f);
+ static const __m128 GLM_VAR_USED _ps_pi_4 = _mm_set_ps1(0.78539816339744830961566084581988f);
+
+ static const __m128 GLM_VAR_USED _ps_sincos_p0 = _mm_set_ps1(0.15707963267948963959e1f);
+ static const __m128 GLM_VAR_USED _ps_sincos_p1 = _mm_set_ps1(-0.64596409750621907082e0f);
+ static const __m128 GLM_VAR_USED _ps_sincos_p2 = _mm_set_ps1(0.7969262624561800806e-1f);
+ static const __m128 GLM_VAR_USED _ps_sincos_p3 = _mm_set_ps1(-0.468175413106023168e-2f);
+ static const __m128 GLM_VAR_USED _ps_tan_p0 = _mm_set_ps1(-1.79565251976484877988e7f);
+ static const __m128 GLM_VAR_USED _ps_tan_p1 = _mm_set_ps1(1.15351664838587416140e6f);
+ static const __m128 GLM_VAR_USED _ps_tan_p2 = _mm_set_ps1(-1.30936939181383777646e4f);
+ static const __m128 GLM_VAR_USED _ps_tan_q0 = _mm_set_ps1(-5.38695755929454629881e7f);
+ static const __m128 GLM_VAR_USED _ps_tan_q1 = _mm_set_ps1(2.50083801823357915839e7f);
+ static const __m128 GLM_VAR_USED _ps_tan_q2 = _mm_set_ps1(-1.32089234440210967447e6f);
+ static const __m128 GLM_VAR_USED _ps_tan_q3 = _mm_set_ps1(1.36812963470692954678e4f);
+ static const __m128 GLM_VAR_USED _ps_tan_poleval = _mm_set_ps1(3.68935e19f);
+ static const __m128 GLM_VAR_USED _ps_atan_t0 = _mm_set_ps1(-0.91646118527267623468e-1f);
+ static const __m128 GLM_VAR_USED _ps_atan_t1 = _mm_set_ps1(-0.13956945682312098640e1f);
+ static const __m128 GLM_VAR_USED _ps_atan_t2 = _mm_set_ps1(-0.94393926122725531747e2f);
+ static const __m128 GLM_VAR_USED _ps_atan_t3 = _mm_set_ps1(0.12888383034157279340e2f);
+ static const __m128 GLM_VAR_USED _ps_atan_s0 = _mm_set_ps1(0.12797564625607904396e1f);
+ static const __m128 GLM_VAR_USED _ps_atan_s1 = _mm_set_ps1(0.21972168858277355914e1f);
+ static const __m128 GLM_VAR_USED _ps_atan_s2 = _mm_set_ps1(0.68193064729268275701e1f);
+ static const __m128 GLM_VAR_USED _ps_atan_s3 = _mm_set_ps1(0.28205206687035841409e2f);
+
+ static const __m128 GLM_VAR_USED _ps_exp_hi = _mm_set_ps1(88.3762626647949f);
+ static const __m128 GLM_VAR_USED _ps_exp_lo = _mm_set_ps1(-88.3762626647949f);
+ static const __m128 GLM_VAR_USED _ps_exp_rln2 = _mm_set_ps1(1.4426950408889634073599f);
+ static const __m128 GLM_VAR_USED _ps_exp_p0 = _mm_set_ps1(1.26177193074810590878e-4f);
+ static const __m128 GLM_VAR_USED _ps_exp_p1 = _mm_set_ps1(3.02994407707441961300e-2f);
+ static const __m128 GLM_VAR_USED _ps_exp_q0 = _mm_set_ps1(3.00198505138664455042e-6f);
+ static const __m128 GLM_VAR_USED _ps_exp_q1 = _mm_set_ps1(2.52448340349684104192e-3f);
+ static const __m128 GLM_VAR_USED _ps_exp_q2 = _mm_set_ps1(2.27265548208155028766e-1f);
+ static const __m128 GLM_VAR_USED _ps_exp_q3 = _mm_set_ps1(2.00000000000000000009e0f);
+ static const __m128 GLM_VAR_USED _ps_exp_c1 = _mm_set_ps1(6.93145751953125e-1f);
+ static const __m128 GLM_VAR_USED _ps_exp_c2 = _mm_set_ps1(1.42860682030941723212e-6f);
+ static const __m128 GLM_VAR_USED _ps_exp2_hi = _mm_set_ps1(127.4999961853f);
+ static const __m128 GLM_VAR_USED _ps_exp2_lo = _mm_set_ps1(-127.4999961853f);
+ static const __m128 GLM_VAR_USED _ps_exp2_p0 = _mm_set_ps1(2.30933477057345225087e-2f);
+ static const __m128 GLM_VAR_USED _ps_exp2_p1 = _mm_set_ps1(2.02020656693165307700e1f);
+ static const __m128 GLM_VAR_USED _ps_exp2_p2 = _mm_set_ps1(1.51390680115615096133e3f);
+ static const __m128 GLM_VAR_USED _ps_exp2_q0 = _mm_set_ps1(2.33184211722314911771e2f);
+ static const __m128 GLM_VAR_USED _ps_exp2_q1 = _mm_set_ps1(4.36821166879210612817e3f);
+ static const __m128 GLM_VAR_USED _ps_log_p0 = _mm_set_ps1(-7.89580278884799154124e-1f);
+ static const __m128 GLM_VAR_USED _ps_log_p1 = _mm_set_ps1(1.63866645699558079767e1f);
+ static const __m128 GLM_VAR_USED _ps_log_p2 = _mm_set_ps1(-6.41409952958715622951e1f);
+ static const __m128 GLM_VAR_USED _ps_log_q0 = _mm_set_ps1(-3.56722798256324312549e1f);
+ static const __m128 GLM_VAR_USED _ps_log_q1 = _mm_set_ps1(3.12093766372244180303e2f);
+ static const __m128 GLM_VAR_USED _ps_log_q2 = _mm_set_ps1(-7.69691943550460008604e2f);
+ static const __m128 GLM_VAR_USED _ps_log_c0 = _mm_set_ps1(0.693147180559945f);
+ static const __m128 GLM_VAR_USED _ps_log2_c0 = _mm_set_ps1(1.44269504088896340735992f);
+
+GLM_FUNC_QUALIFIER __m128 sse_abs_ps(__m128 x)
+{
+ return _mm_and_ps(glm::detail::abs4Mask, x);
+}
+
+GLM_FUNC_QUALIFIER __m128 sse_sgn_ps(__m128 x)
+{
+ __m128 Neg = _mm_set1_ps(-1.0f);
+ __m128 Pos = _mm_set1_ps(1.0f);
+
+ __m128 Cmp0 = _mm_cmplt_ps(x, zero);
+ __m128 Cmp1 = _mm_cmpgt_ps(x, zero);
+
+ __m128 And0 = _mm_and_ps(Cmp0, Neg);
+ __m128 And1 = _mm_and_ps(Cmp1, Pos);
+
+ return _mm_or_ps(And0, And1);
+}
+
+//floor
+GLM_FUNC_QUALIFIER __m128 sse_flr_ps(__m128 x)
+{
+ __m128 rnd0 = sse_rnd_ps(x);
+ __m128 cmp0 = _mm_cmplt_ps(x, rnd0);
+ __m128 and0 = _mm_and_ps(cmp0, glm::detail::_ps_1);
+ __m128 sub0 = _mm_sub_ps(rnd0, and0);
+ return sub0;
+}
+
+//trunc
+/*
+GLM_FUNC_QUALIFIER __m128 _mm_trc_ps(__m128 v)
+{
+ return __m128();
+}
+*/
+//round
+GLM_FUNC_QUALIFIER __m128 sse_rnd_ps(__m128 x)
+{
+ __m128 and0 = _mm_and_ps(glm::detail::_epi32_sign_mask, x);
+ __m128 or0 = _mm_or_ps(and0, glm::detail::_ps_2pow23);
+ __m128 add0 = _mm_add_ps(x, or0);
+ __m128 sub0 = _mm_sub_ps(add0, or0);
+ return sub0;
+}
+
+//roundEven
+GLM_FUNC_QUALIFIER __m128 sse_rde_ps(__m128 x)
+{
+ __m128 and0 = _mm_and_ps(glm::detail::_epi32_sign_mask, x);
+ __m128 or0 = _mm_or_ps(and0, glm::detail::_ps_2pow23);
+ __m128 add0 = _mm_add_ps(x, or0);
+ __m128 sub0 = _mm_sub_ps(add0, or0);
+ return sub0;
+}
+
+GLM_FUNC_QUALIFIER __m128 sse_ceil_ps(__m128 x)
+{
+ __m128 rnd0 = sse_rnd_ps(x);
+ __m128 cmp0 = _mm_cmpgt_ps(x, rnd0);
+ __m128 and0 = _mm_and_ps(cmp0, glm::detail::_ps_1);
+ __m128 add0 = _mm_add_ps(rnd0, and0);
+ return add0;
+}
+
+GLM_FUNC_QUALIFIER __m128 sse_frc_ps(__m128 x)
+{
+ __m128 flr0 = sse_flr_ps(x);
+ __m128 sub0 = _mm_sub_ps(x, flr0);
+ return sub0;
+}
+
+GLM_FUNC_QUALIFIER __m128 sse_mod_ps(__m128 x, __m128 y)
+{
+ __m128 div0 = _mm_div_ps(x, y);
+ __m128 flr0 = sse_flr_ps(div0);
+ __m128 mul0 = _mm_mul_ps(y, flr0);
+ __m128 sub0 = _mm_sub_ps(x, mul0);
+ return sub0;
+}
+
+/// TODO
+GLM_FUNC_QUALIFIER __m128 sse_modf_ps(__m128 x, __m128i & i)
+{
+ __m128 empty;
+ return empty;
+}
+
+//GLM_FUNC_QUALIFIER __m128 _mm_min_ps(__m128 x, __m128 y)
+
+//GLM_FUNC_QUALIFIER __m128 _mm_max_ps(__m128 x, __m128 y)
+
+GLM_FUNC_QUALIFIER __m128 sse_clp_ps(__m128 v, __m128 minVal, __m128 maxVal)
+{
+ __m128 min0 = _mm_min_ps(v, maxVal);
+ __m128 max0 = _mm_max_ps(min0, minVal);
+ return max0;
+}
+
+GLM_FUNC_QUALIFIER __m128 sse_mix_ps(__m128 v1, __m128 v2, __m128 a)
+{
+ __m128 sub0 = _mm_sub_ps(glm::detail::one, a);
+ __m128 mul0 = _mm_mul_ps(v1, sub0);
+ __m128 mul1 = _mm_mul_ps(v2, a);
+ __m128 add0 = _mm_add_ps(mul0, mul1);
+ return add0;
+}
+
+GLM_FUNC_QUALIFIER __m128 sse_stp_ps(__m128 edge, __m128 x)
+{
+ __m128 cmp = _mm_cmple_ps(x, edge);
+ if(_mm_movemask_ps(cmp) == 0)
+ return glm::detail::one;
+ else
+ return glm::detail::zero;
+}
+
+GLM_FUNC_QUALIFIER __m128 sse_ssp_ps(__m128 edge0, __m128 edge1, __m128 x)
+{
+ __m128 sub0 = _mm_sub_ps(x, edge0);
+ __m128 sub1 = _mm_sub_ps(edge1, edge0);
+ __m128 div0 = _mm_sub_ps(sub0, sub1);
+ __m128 clp0 = sse_clp_ps(div0, glm::detail::zero, glm::detail::one);
+ __m128 mul0 = _mm_mul_ps(glm::detail::two, clp0);
+ __m128 sub2 = _mm_sub_ps(glm::detail::three, mul0);
+ __m128 mul1 = _mm_mul_ps(clp0, clp0);
+ __m128 mul2 = _mm_mul_ps(mul1, sub2);
+ return mul2;
+}
+
+/// \todo
+GLM_FUNC_QUALIFIER __m128 sse_nan_ps(__m128 x)
+{
+ __m128 empty;
+ return empty;
+}
+
+/// \todo
+GLM_FUNC_QUALIFIER __m128 sse_inf_ps(__m128 x)
+{
+ __m128 empty;
+ return empty;
+}
+
+// SSE scalar reciprocal sqrt using rsqrt op, plus one Newton-Rhaphson iteration
+// By Elan Ruskin, http://assemblyrequired.crashworks.org/
+GLM_FUNC_QUALIFIER __m128 sse_sqrt_wip_ss(__m128 const & x)
+{
+ __m128 recip = _mm_rsqrt_ss(x); // "estimate" opcode
+ const static __m128 three = {3, 3, 3, 3}; // aligned consts for fast load
+ const static __m128 half = {0.5,0.5,0.5,0.5};
+ __m128 halfrecip = _mm_mul_ss(half, recip);
+ __m128 threeminus_xrr = _mm_sub_ss(three, _mm_mul_ss(x, _mm_mul_ss (recip, recip)));
+ return _mm_mul_ss( halfrecip, threeminus_xrr);
+}
+
+}//namespace detail
+}//namespace glms
diff --git a/src/glm/core/intrinsic_exponential.hpp b/src/glm/core/intrinsic_exponential.hpp
new file mode 100644
index 0000000..1e105ca
--- /dev/null
+++ b/src/glm/core/intrinsic_exponential.hpp
@@ -0,0 +1,60 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2009-05-11
+// Updated : 2009-05-11
+// Licence : This source is under MIT License
+// File : glm/core/intrinsic_exponential.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_detail_intrinsic_exponential
+#define glm_detail_intrinsic_exponential
+
+#include "setup.hpp"
+
+#if((GLM_ARCH & GLM_ARCH_SSE2) != GLM_ARCH_SSE2)
+# error "SSE2 instructions not supported or enabled"
+#else
+
+namespace glm{
+namespace detail
+{
+/*
+GLM_FUNC_QUALIFIER __m128 sse_rsqrt_nr_ss(__m128 const x)
+{
+ __m128 recip = _mm_rsqrt_ss( x ); // "estimate" opcode
+ const static __m128 three = { 3, 3, 3, 3 }; // aligned consts for fast load
+ const static __m128 half = { 0.5,0.5,0.5,0.5 };
+ __m128 halfrecip = _mm_mul_ss( half, recip );
+ __m128 threeminus_xrr = _mm_sub_ss( three, _mm_mul_ss( x, _mm_mul_ss ( recip, recip ) ) );
+ return _mm_mul_ss( halfrecip, threeminus_xrr );
+}
+
+GLM_FUNC_QUALIFIER __m128 sse_normalize_fast_ps( float * RESTRICT vOut, float * RESTRICT vIn )
+{
+ __m128 x = _mm_load_ss(&vIn[0]);
+ __m128 y = _mm_load_ss(&vIn[1]);
+ __m128 z = _mm_load_ss(&vIn[2]);
+
+ const __m128 l = // compute x*x + y*y + z*z
+ _mm_add_ss(
+ _mm_add_ss( _mm_mul_ss(x,x),
+ _mm_mul_ss(y,y)
+ ),
+ _mm_mul_ss( z, z )
+ );
+
+
+ const __m128 rsqt = _mm_rsqrt_nr_ss( l );
+ _mm_store_ss( &vOut[0] , _mm_mul_ss( rsqt, x ) );
+ _mm_store_ss( &vOut[1] , _mm_mul_ss( rsqt, y ) );
+ _mm_store_ss( &vOut[2] , _mm_mul_ss( rsqt, z ) );
+
+ return _mm_mul_ss( l , rsqt );
+}
+*/
+}//namespace detail
+}//namespace glm
+
+#endif//GLM_ARCH
+#endif//glm_detail_intrinsic_exponential
diff --git a/src/glm/core/intrinsic_exponential.inl b/src/glm/core/intrinsic_exponential.inl
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/glm/core/intrinsic_exponential.inl
diff --git a/src/glm/core/intrinsic_geometric.hpp b/src/glm/core/intrinsic_geometric.hpp
new file mode 100644
index 0000000..cb6e45d
--- /dev/null
+++ b/src/glm/core/intrinsic_geometric.hpp
@@ -0,0 +1,57 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2009-05-08
+// Updated : 2009-05-08
+// Licence : This source is under MIT License
+// File : glm/core/intrinsic_geometric.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_core_intrinsic_geometric
+#define glm_core_intrinsic_geometric
+
+#include "setup.hpp"
+
+#if((GLM_ARCH & GLM_ARCH_SSE2) != GLM_ARCH_SSE2)
+# error "SSE2 instructions not supported or enabled"
+#else
+
+#include "intrinsic_common.hpp"
+
+namespace glm{
+namespace detail
+{
+ //length
+ __m128 sse_len_ps(__m128 x);
+
+ //distance
+ __m128 sse_dst_ps(__m128 p0, __m128 p1);
+
+ //dot
+ __m128 sse_dot_ps(__m128 v1, __m128 v2);
+
+ // SSE1
+ __m128 sse_dot_ss(__m128 v1, __m128 v2);
+
+ //cross
+ __m128 sse_xpd_ps(__m128 v1, __m128 v2);
+
+ //normalize
+ __m128 sse_nrm_ps(__m128 v);
+
+ //faceforward
+ __m128 sse_ffd_ps(__m128 N, __m128 I, __m128 Nref);
+
+ //reflect
+ __m128 sse_rfe_ps(__m128 I, __m128 N);
+
+ //refract
+ __m128 sse_rfa_ps(__m128 I, __m128 N, __m128 eta);
+
+}//namespace detail
+}//namespace glm
+
+#include "intrinsic_geometric.inl"
+
+#endif//GLM_ARCH
+#endif//glm_core_intrinsic_geometric
diff --git a/src/glm/core/intrinsic_geometric.inl b/src/glm/core/intrinsic_geometric.inl
new file mode 100644
index 0000000..06f0ee7
--- /dev/null
+++ b/src/glm/core/intrinsic_geometric.inl
@@ -0,0 +1,123 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2009-05-08
+// Updated : 2009-05-08
+// Licence : This source is under MIT License
+// File : glm/core/intrinsic_geometric.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm{
+namespace detail{
+
+//length
+GLM_FUNC_QUALIFIER __m128 sse_len_ps(__m128 x)
+{
+ __m128 dot0 = sse_dot_ps(x, x);
+ __m128 sqt0 = _mm_sqrt_ps(dot0);
+ return sqt0;
+}
+
+//distance
+GLM_FUNC_QUALIFIER __m128 sse_dst_ps(__m128 p0, __m128 p1)
+{
+ __m128 sub0 = _mm_sub_ps(p0, p1);
+ __m128 len0 = sse_len_ps(sub0);
+ return len0;
+}
+
+//dot
+GLM_FUNC_QUALIFIER __m128 sse_dot_ps(__m128 v1, __m128 v2)
+{
+ __m128 mul0 = _mm_mul_ps(v1, v2);
+ __m128 swp0 = _mm_shuffle_ps(mul0, mul0, _MM_SHUFFLE(2, 3, 0, 1));
+ __m128 add0 = _mm_add_ps(mul0, swp0);
+ __m128 swp1 = _mm_shuffle_ps(add0, add0, _MM_SHUFFLE(0, 1, 2, 3));
+ __m128 add1 = _mm_add_ps(add0, swp1);
+ return add1;
+}
+
+// SSE1
+GLM_FUNC_QUALIFIER __m128 sse_dot_ss(__m128 v1, __m128 v2)
+{
+ __m128 mul0 = _mm_mul_ps(v1, v2);
+ __m128 mov0 = _mm_movehl_ps(mul0, mul0);
+ __m128 add0 = _mm_add_ps(mov0, mul0);
+ __m128 swp1 = _mm_shuffle_ps(add0, add0, 1);
+ __m128 add1 = _mm_add_ss(add0, swp1);
+ return add1;
+}
+
+//cross
+GLM_FUNC_QUALIFIER __m128 sse_xpd_ps(__m128 v1, __m128 v2)
+{
+ __m128 swp0 = _mm_shuffle_ps(v1, v1, _MM_SHUFFLE(3, 0, 2, 1));
+ __m128 swp1 = _mm_shuffle_ps(v1, v1, _MM_SHUFFLE(3, 1, 0, 2));
+ __m128 swp2 = _mm_shuffle_ps(v2, v2, _MM_SHUFFLE(3, 0, 2, 1));
+ __m128 swp3 = _mm_shuffle_ps(v2, v2, _MM_SHUFFLE(3, 1, 0, 2));
+ __m128 mul0 = _mm_mul_ps(swp0, swp3);
+ __m128 mul1 = _mm_mul_ps(swp1, swp2);
+ __m128 sub0 = _mm_sub_ps(mul0, mul1);
+ return sub0;
+}
+
+//normalize
+GLM_FUNC_QUALIFIER __m128 sse_nrm_ps(__m128 v)
+{
+ __m128 dot0 = sse_dot_ps(v, v);
+ __m128 isr0 = _mm_rsqrt_ps(dot0);
+ __m128 mul0 = _mm_mul_ps(v, isr0);
+ return mul0;
+}
+
+//faceforward
+GLM_FUNC_QUALIFIER __m128 sse_ffd_ps(__m128 N, __m128 I, __m128 Nref)
+{
+ //__m128 dot0 = _mm_dot_ps(v, v);
+ //__m128 neg0 = _mm_neg_ps(N);
+ //__m128 sgn0 = _mm_sgn_ps(dot0);
+ //__m128 mix0 = _mm_mix_ps(N, neg0, sgn0);
+ //return mix0;
+
+ __m128 dot0 = sse_dot_ps(Nref, I);
+ __m128 sgn0 = sse_sgn_ps(dot0);
+ __m128 mul0 = _mm_mul_ps(sgn0, glm::detail::minus_one);
+ __m128 mul1 = _mm_mul_ps(N, mul0);
+ return mul1;
+}
+
+//reflect
+GLM_FUNC_QUALIFIER __m128 sse_rfe_ps(__m128 I, __m128 N)
+{
+ __m128 dot0 = sse_dot_ps(N, I);
+ __m128 mul0 = _mm_mul_ps(N, dot0);
+ __m128 mul1 = _mm_mul_ps(mul0, glm::detail::two);
+ __m128 sub0 = _mm_sub_ps(I, mul1);
+ return sub0;
+}
+
+//refract
+GLM_FUNC_QUALIFIER __m128 sse_rfa_ps(__m128 I, __m128 N, __m128 eta)
+{
+ __m128 dot0 = sse_dot_ps(N, I);
+ __m128 mul0 = _mm_mul_ps(eta, eta);
+ __m128 mul1 = _mm_mul_ps(dot0, dot0);
+ __m128 sub0 = _mm_sub_ps(glm::detail::one, mul0);
+ __m128 sub1 = _mm_sub_ps(glm::detail::one, mul1);
+ __m128 mul2 = _mm_mul_ps(sub0, sub1);
+
+ if(_mm_movemask_ps(_mm_cmplt_ss(mul2, glm::detail::zero)) == 0)
+ return glm::detail::zero;
+
+ __m128 sqt0 = _mm_sqrt_ps(mul2);
+ __m128 mul3 = _mm_mul_ps(eta, dot0);
+ __m128 add0 = _mm_add_ps(mul3, sqt0);
+ __m128 mul4 = _mm_mul_ps(add0, N);
+ __m128 mul5 = _mm_mul_ps(eta, I);
+ __m128 sub2 = _mm_sub_ps(mul5, mul4);
+
+ return sub2;
+}
+
+}//namespace detail
+}//namespace glm
diff --git a/src/glm/core/intrinsic_matrix.hpp b/src/glm/core/intrinsic_matrix.hpp
new file mode 100644
index 0000000..2744318
--- /dev/null
+++ b/src/glm/core/intrinsic_matrix.hpp
@@ -0,0 +1,50 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2009-06-05
+// Updated : 2009-06-05
+// Licence : This source is under MIT License
+// File : glm/core/intrinsic_common.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_detail_intrinsic_matrix
+#define glm_detail_intrinsic_matrix
+
+#include "setup.hpp"
+
+#if((GLM_ARCH & GLM_ARCH_SSE2) != GLM_ARCH_SSE2)
+# error "SSE2 instructions not supported or enabled"
+#else
+
+#include "intrinsic_geometric.hpp"
+
+namespace glm{
+namespace detail
+{
+ void sse_add_ps(__m128 in1[4], __m128 in2[4], __m128 out[4]);
+
+ void sse_sub_ps(__m128 in1[4], __m128 in2[4], __m128 out[4]);
+
+ __m128 sse_mul_ps(__m128 m[4], __m128 v);
+
+ __m128 sse_mul_ps(__m128 v, __m128 m[4]);
+
+ void sse_mul_ps(__m128 const in1[4], __m128 const in2[4], __m128 out[4]);
+
+ void sse_transpose_ps(__m128 const in[4], __m128 out[4]);
+
+ void sse_inverse_ps(__m128 const in[4], __m128 out[4]);
+
+ void sse_rotate_ps(__m128 const in[4], float Angle, float const v[3], __m128 out[4]);
+
+ __m128 sse_det_ps(__m128 const m[4]);
+
+ __m128 sse_slow_det_ps(__m128 const m[4]);
+
+}//namespace detail
+}//namespace glm
+
+#include "intrinsic_matrix.inl"
+
+#endif//GLM_ARCH
+#endif//glm_detail_intrinsic_matrix
diff --git a/src/glm/core/intrinsic_matrix.inl b/src/glm/core/intrinsic_matrix.inl
new file mode 100644
index 0000000..b3c1d6d
--- /dev/null
+++ b/src/glm/core/intrinsic_matrix.inl
@@ -0,0 +1,1051 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2009-06-05
+// Updated : 2009-06-05
+// Licence : This source is under MIT License
+// File : glm/core/intrinsic_common.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm{
+namespace detail{
+
+static const __m128 GLM_VAR_USED _m128_rad_ps = _mm_set_ps1(3.141592653589793238462643383279f / 180.f);
+static const __m128 GLM_VAR_USED _m128_deg_ps = _mm_set_ps1(180.f / 3.141592653589793238462643383279f);
+
+template <typename matType>
+GLM_FUNC_QUALIFIER matType sse_comp_mul_ps
+(
+ __m128 const in1[4],
+ __m128 const in2[4],
+ __m128 out[4]
+)
+{
+ out[0] = _mm_mul_ps(in1[0], in2[0]);
+ out[1] = _mm_mul_ps(in1[1], in2[1]);
+ out[2] = _mm_mul_ps(in1[2], in2[2]);
+ out[3] = _mm_mul_ps(in1[3], in2[3]);
+}
+
+GLM_FUNC_QUALIFIER void sse_add_ps(__m128 in1[4], __m128 in2[4], __m128 out[4])
+{
+ {
+ out[0] = _mm_add_ps(in1[0], in2[0]);
+ out[1] = _mm_add_ps(in1[1], in2[1]);
+ out[2] = _mm_add_ps(in1[2], in2[2]);
+ out[3] = _mm_add_ps(in1[3], in2[3]);
+ }
+}
+
+GLM_FUNC_QUALIFIER void sse_sub_ps(__m128 in1[4], __m128 in2[4], __m128 out[4])
+{
+ {
+ out[0] = _mm_sub_ps(in1[0], in2[0]);
+ out[1] = _mm_sub_ps(in1[1], in2[1]);
+ out[2] = _mm_sub_ps(in1[2], in2[2]);
+ out[3] = _mm_sub_ps(in1[3], in2[3]);
+ }
+}
+
+GLM_FUNC_QUALIFIER __m128 sse_mul_ps(__m128 m[4], __m128 v)
+{
+ __m128 v0 = _mm_shuffle_ps(v, v, _MM_SHUFFLE(0, 0, 0, 0));
+ __m128 v1 = _mm_shuffle_ps(v, v, _MM_SHUFFLE(1, 1, 1, 1));
+ __m128 v2 = _mm_shuffle_ps(v, v, _MM_SHUFFLE(2, 2, 2, 2));
+ __m128 v3 = _mm_shuffle_ps(v, v, _MM_SHUFFLE(3, 3, 3, 3));
+
+ __m128 m0 = _mm_mul_ps(m[0], v0);
+ __m128 m1 = _mm_mul_ps(m[1], v1);
+ __m128 m2 = _mm_mul_ps(m[2], v2);
+ __m128 m3 = _mm_mul_ps(m[3], v3);
+
+ __m128 a0 = _mm_add_ps(m0, m1);
+ __m128 a1 = _mm_add_ps(m2, m3);
+ __m128 a2 = _mm_add_ps(a0, a1);
+
+ return a2;
+}
+
+GLM_FUNC_QUALIFIER __m128 sse_mul_ps(__m128 v, __m128 m[4])
+{
+ __m128 i0 = m[0];
+ __m128 i1 = m[1];
+ __m128 i2 = m[2];
+ __m128 i3 = m[3];
+
+ __m128 m0 = _mm_mul_ps(v, i0);
+ __m128 m1 = _mm_mul_ps(v, i1);
+ __m128 m2 = _mm_mul_ps(v, i2);
+ __m128 m3 = _mm_mul_ps(v, i3);
+
+ __m128 u0 = _mm_unpacklo_ps(m0, m1);
+ __m128 u1 = _mm_unpackhi_ps(m0, m1);
+ __m128 a0 = _mm_add_ps(u0, u1);
+
+ __m128 u2 = _mm_unpacklo_ps(m2, m3);
+ __m128 u3 = _mm_unpackhi_ps(m2, m3);
+ __m128 a1 = _mm_add_ps(u2, u3);
+
+ __m128 f0 = _mm_movelh_ps(a0, a1);
+ __m128 f1 = _mm_movehl_ps(a1, a0);
+ __m128 f2 = _mm_add_ps(f0, f1);
+
+ return f2;
+}
+
+GLM_FUNC_QUALIFIER void sse_mul_ps(__m128 const in1[4], __m128 const in2[4], __m128 out[4])
+{
+ {
+ __m128 e0 = _mm_shuffle_ps(in2[0], in2[0], _MM_SHUFFLE(0, 0, 0, 0));
+ __m128 e1 = _mm_shuffle_ps(in2[0], in2[0], _MM_SHUFFLE(1, 1, 1, 1));
+ __m128 e2 = _mm_shuffle_ps(in2[0], in2[0], _MM_SHUFFLE(2, 2, 2, 2));
+ __m128 e3 = _mm_shuffle_ps(in2[0], in2[0], _MM_SHUFFLE(3, 3, 3, 3));
+
+ __m128 m0 = _mm_mul_ps(in1[0], e0);
+ __m128 m1 = _mm_mul_ps(in1[1], e1);
+ __m128 m2 = _mm_mul_ps(in1[2], e2);
+ __m128 m3 = _mm_mul_ps(in1[3], e3);
+
+ __m128 a0 = _mm_add_ps(m0, m1);
+ __m128 a1 = _mm_add_ps(m2, m3);
+ __m128 a2 = _mm_add_ps(a0, a1);
+
+ out[0] = a2;
+ }
+
+ {
+ __m128 e0 = _mm_shuffle_ps(in2[1], in2[1], _MM_SHUFFLE(0, 0, 0, 0));
+ __m128 e1 = _mm_shuffle_ps(in2[1], in2[1], _MM_SHUFFLE(1, 1, 1, 1));
+ __m128 e2 = _mm_shuffle_ps(in2[1], in2[1], _MM_SHUFFLE(2, 2, 2, 2));
+ __m128 e3 = _mm_shuffle_ps(in2[1], in2[1], _MM_SHUFFLE(3, 3, 3, 3));
+
+ __m128 m0 = _mm_mul_ps(in1[0], e0);
+ __m128 m1 = _mm_mul_ps(in1[1], e1);
+ __m128 m2 = _mm_mul_ps(in1[2], e2);
+ __m128 m3 = _mm_mul_ps(in1[3], e3);
+
+ __m128 a0 = _mm_add_ps(m0, m1);
+ __m128 a1 = _mm_add_ps(m2, m3);
+ __m128 a2 = _mm_add_ps(a0, a1);
+
+ out[1] = a2;
+ }
+
+ {
+ __m128 e0 = _mm_shuffle_ps(in2[2], in2[2], _MM_SHUFFLE(0, 0, 0, 0));
+ __m128 e1 = _mm_shuffle_ps(in2[2], in2[2], _MM_SHUFFLE(1, 1, 1, 1));
+ __m128 e2 = _mm_shuffle_ps(in2[2], in2[2], _MM_SHUFFLE(2, 2, 2, 2));
+ __m128 e3 = _mm_shuffle_ps(in2[2], in2[2], _MM_SHUFFLE(3, 3, 3, 3));
+
+ __m128 m0 = _mm_mul_ps(in1[0], e0);
+ __m128 m1 = _mm_mul_ps(in1[1], e1);
+ __m128 m2 = _mm_mul_ps(in1[2], e2);
+ __m128 m3 = _mm_mul_ps(in1[3], e3);
+
+ __m128 a0 = _mm_add_ps(m0, m1);
+ __m128 a1 = _mm_add_ps(m2, m3);
+ __m128 a2 = _mm_add_ps(a0, a1);
+
+ out[2] = a2;
+ }
+
+ {
+ //(__m128&)_mm_shuffle_epi32(__m128i&)in2[0], _MM_SHUFFLE(3, 3, 3, 3))
+ __m128 e0 = _mm_shuffle_ps(in2[3], in2[3], _MM_SHUFFLE(0, 0, 0, 0));
+ __m128 e1 = _mm_shuffle_ps(in2[3], in2[3], _MM_SHUFFLE(1, 1, 1, 1));
+ __m128 e2 = _mm_shuffle_ps(in2[3], in2[3], _MM_SHUFFLE(2, 2, 2, 2));
+ __m128 e3 = _mm_shuffle_ps(in2[3], in2[3], _MM_SHUFFLE(3, 3, 3, 3));
+
+ __m128 m0 = _mm_mul_ps(in1[0], e0);
+ __m128 m1 = _mm_mul_ps(in1[1], e1);
+ __m128 m2 = _mm_mul_ps(in1[2], e2);
+ __m128 m3 = _mm_mul_ps(in1[3], e3);
+
+ __m128 a0 = _mm_add_ps(m0, m1);
+ __m128 a1 = _mm_add_ps(m2, m3);
+ __m128 a2 = _mm_add_ps(a0, a1);
+
+ out[3] = a2;
+ }
+}
+
+GLM_FUNC_QUALIFIER void sse_transpose_ps(__m128 const in[4], __m128 out[4])
+{
+ __m128 tmp0 = _mm_shuffle_ps(in[0], in[1], 0x44);
+ __m128 tmp2 = _mm_shuffle_ps(in[0], in[1], 0xEE);
+ __m128 tmp1 = _mm_shuffle_ps(in[2], in[3], 0x44);
+ __m128 tmp3 = _mm_shuffle_ps(in[2], in[3], 0xEE);
+
+ out[0] = _mm_shuffle_ps(tmp0, tmp1, 0x88);
+ out[1] = _mm_shuffle_ps(tmp0, tmp1, 0xDD);
+ out[2] = _mm_shuffle_ps(tmp2, tmp3, 0x88);
+ out[3] = _mm_shuffle_ps(tmp2, tmp3, 0xDD);
+}
+
+GLM_FUNC_QUALIFIER __m128 sse_slow_det_ps(__m128 const in[4])
+{
+ __m128 Fac0;
+ {
+ // valType SubFactor00 = m[2][2] * m[3][3] - m[3][2] * m[2][3];
+ // valType SubFactor00 = m[2][2] * m[3][3] - m[3][2] * m[2][3];
+ // valType SubFactor06 = m[1][2] * m[3][3] - m[3][2] * m[1][3];
+ // valType SubFactor13 = m[1][2] * m[2][3] - m[2][2] * m[1][3];
+
+ __m128 Swp0a = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(3, 3, 3, 3));
+ __m128 Swp0b = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(2, 2, 2, 2));
+
+ __m128 Swp00 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(2, 2, 2, 2));
+ __m128 Swp01 = _mm_shuffle_ps(Swp0a, Swp0a, _MM_SHUFFLE(2, 0, 0, 0));
+ __m128 Swp02 = _mm_shuffle_ps(Swp0b, Swp0b, _MM_SHUFFLE(2, 0, 0, 0));
+ __m128 Swp03 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(3, 3, 3, 3));
+
+ __m128 Mul00 = _mm_mul_ps(Swp00, Swp01);
+ __m128 Mul01 = _mm_mul_ps(Swp02, Swp03);
+ Fac0 = _mm_sub_ps(Mul00, Mul01);
+ }
+
+ __m128 Fac1;
+ {
+ // valType SubFactor01 = m[2][1] * m[3][3] - m[3][1] * m[2][3];
+ // valType SubFactor01 = m[2][1] * m[3][3] - m[3][1] * m[2][3];
+ // valType SubFactor07 = m[1][1] * m[3][3] - m[3][1] * m[1][3];
+ // valType SubFactor14 = m[1][1] * m[2][3] - m[2][1] * m[1][3];
+
+ __m128 Swp0a = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(3, 3, 3, 3));
+ __m128 Swp0b = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(1, 1, 1, 1));
+
+ __m128 Swp00 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(1, 1, 1, 1));
+ __m128 Swp01 = _mm_shuffle_ps(Swp0a, Swp0a, _MM_SHUFFLE(2, 0, 0, 0));
+ __m128 Swp02 = _mm_shuffle_ps(Swp0b, Swp0b, _MM_SHUFFLE(2, 0, 0, 0));
+ __m128 Swp03 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(3, 3, 3, 3));
+
+ __m128 Mul00 = _mm_mul_ps(Swp00, Swp01);
+ __m128 Mul01 = _mm_mul_ps(Swp02, Swp03);
+ Fac1 = _mm_sub_ps(Mul00, Mul01);
+ }
+
+
+ __m128 Fac2;
+ {
+ // valType SubFactor02 = m[2][1] * m[3][2] - m[3][1] * m[2][2];
+ // valType SubFactor02 = m[2][1] * m[3][2] - m[3][1] * m[2][2];
+ // valType SubFactor08 = m[1][1] * m[3][2] - m[3][1] * m[1][2];
+ // valType SubFactor15 = m[1][1] * m[2][2] - m[2][1] * m[1][2];
+
+ __m128 Swp0a = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(2, 2, 2, 2));
+ __m128 Swp0b = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(1, 1, 1, 1));
+
+ __m128 Swp00 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(1, 1, 1, 1));
+ __m128 Swp01 = _mm_shuffle_ps(Swp0a, Swp0a, _MM_SHUFFLE(2, 0, 0, 0));
+ __m128 Swp02 = _mm_shuffle_ps(Swp0b, Swp0b, _MM_SHUFFLE(2, 0, 0, 0));
+ __m128 Swp03 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(2, 2, 2, 2));
+
+ __m128 Mul00 = _mm_mul_ps(Swp00, Swp01);
+ __m128 Mul01 = _mm_mul_ps(Swp02, Swp03);
+ Fac2 = _mm_sub_ps(Mul00, Mul01);
+ }
+
+ __m128 Fac3;
+ {
+ // valType SubFactor03 = m[2][0] * m[3][3] - m[3][0] * m[2][3];
+ // valType SubFactor03 = m[2][0] * m[3][3] - m[3][0] * m[2][3];
+ // valType SubFactor09 = m[1][0] * m[3][3] - m[3][0] * m[1][3];
+ // valType SubFactor16 = m[1][0] * m[2][3] - m[2][0] * m[1][3];
+
+ __m128 Swp0a = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(3, 3, 3, 3));
+ __m128 Swp0b = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(0, 0, 0, 0));
+
+ __m128 Swp00 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(0, 0, 0, 0));
+ __m128 Swp01 = _mm_shuffle_ps(Swp0a, Swp0a, _MM_SHUFFLE(2, 0, 0, 0));
+ __m128 Swp02 = _mm_shuffle_ps(Swp0b, Swp0b, _MM_SHUFFLE(2, 0, 0, 0));
+ __m128 Swp03 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(3, 3, 3, 3));
+
+ __m128 Mul00 = _mm_mul_ps(Swp00, Swp01);
+ __m128 Mul01 = _mm_mul_ps(Swp02, Swp03);
+ Fac3 = _mm_sub_ps(Mul00, Mul01);
+ }
+
+ __m128 Fac4;
+ {
+ // valType SubFactor04 = m[2][0] * m[3][2] - m[3][0] * m[2][2];
+ // valType SubFactor04 = m[2][0] * m[3][2] - m[3][0] * m[2][2];
+ // valType SubFactor10 = m[1][0] * m[3][2] - m[3][0] * m[1][2];
+ // valType SubFactor17 = m[1][0] * m[2][2] - m[2][0] * m[1][2];
+
+ __m128 Swp0a = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(2, 2, 2, 2));
+ __m128 Swp0b = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(0, 0, 0, 0));
+
+ __m128 Swp00 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(0, 0, 0, 0));
+ __m128 Swp01 = _mm_shuffle_ps(Swp0a, Swp0a, _MM_SHUFFLE(2, 0, 0, 0));
+ __m128 Swp02 = _mm_shuffle_ps(Swp0b, Swp0b, _MM_SHUFFLE(2, 0, 0, 0));
+ __m128 Swp03 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(2, 2, 2, 2));
+
+ __m128 Mul00 = _mm_mul_ps(Swp00, Swp01);
+ __m128 Mul01 = _mm_mul_ps(Swp02, Swp03);
+ Fac4 = _mm_sub_ps(Mul00, Mul01);
+ }
+
+ __m128 Fac5;
+ {
+ // valType SubFactor05 = m[2][0] * m[3][1] - m[3][0] * m[2][1];
+ // valType SubFactor05 = m[2][0] * m[3][1] - m[3][0] * m[2][1];
+ // valType SubFactor12 = m[1][0] * m[3][1] - m[3][0] * m[1][1];
+ // valType SubFactor18 = m[1][0] * m[2][1] - m[2][0] * m[1][1];
+
+ __m128 Swp0a = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(1, 1, 1, 1));
+ __m128 Swp0b = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(0, 0, 0, 0));
+
+ __m128 Swp00 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(0, 0, 0, 0));
+ __m128 Swp01 = _mm_shuffle_ps(Swp0a, Swp0a, _MM_SHUFFLE(2, 0, 0, 0));
+ __m128 Swp02 = _mm_shuffle_ps(Swp0b, Swp0b, _MM_SHUFFLE(2, 0, 0, 0));
+ __m128 Swp03 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(1, 1, 1, 1));
+
+ __m128 Mul00 = _mm_mul_ps(Swp00, Swp01);
+ __m128 Mul01 = _mm_mul_ps(Swp02, Swp03);
+ Fac5 = _mm_sub_ps(Mul00, Mul01);
+ }
+
+ __m128 SignA = _mm_set_ps( 1.0f,-1.0f, 1.0f,-1.0f);
+ __m128 SignB = _mm_set_ps(-1.0f, 1.0f,-1.0f, 1.0f);
+
+ // m[1][0]
+ // m[0][0]
+ // m[0][0]
+ // m[0][0]
+ __m128 Temp0 = _mm_shuffle_ps(in[1], in[0], _MM_SHUFFLE(0, 0, 0, 0));
+ __m128 Vec0 = _mm_shuffle_ps(Temp0, Temp0, _MM_SHUFFLE(2, 2, 2, 0));
+
+ // m[1][1]
+ // m[0][1]
+ // m[0][1]
+ // m[0][1]
+ __m128 Temp1 = _mm_shuffle_ps(in[1], in[0], _MM_SHUFFLE(1, 1, 1, 1));
+ __m128 Vec1 = _mm_shuffle_ps(Temp1, Temp1, _MM_SHUFFLE(2, 2, 2, 0));
+
+ // m[1][2]
+ // m[0][2]
+ // m[0][2]
+ // m[0][2]
+ __m128 Temp2 = _mm_shuffle_ps(in[1], in[0], _MM_SHUFFLE(2, 2, 2, 2));
+ __m128 Vec2 = _mm_shuffle_ps(Temp2, Temp2, _MM_SHUFFLE(2, 2, 2, 0));
+
+ // m[1][3]
+ // m[0][3]
+ // m[0][3]
+ // m[0][3]
+ __m128 Temp3 = _mm_shuffle_ps(in[1], in[0], _MM_SHUFFLE(3, 3, 3, 3));
+ __m128 Vec3 = _mm_shuffle_ps(Temp3, Temp3, _MM_SHUFFLE(2, 2, 2, 0));
+
+ // col0
+ // + (Vec1[0] * Fac0[0] - Vec2[0] * Fac1[0] + Vec3[0] * Fac2[0]),
+ // - (Vec1[1] * Fac0[1] - Vec2[1] * Fac1[1] + Vec3[1] * Fac2[1]),
+ // + (Vec1[2] * Fac0[2] - Vec2[2] * Fac1[2] + Vec3[2] * Fac2[2]),
+ // - (Vec1[3] * Fac0[3] - Vec2[3] * Fac1[3] + Vec3[3] * Fac2[3]),
+ __m128 Mul00 = _mm_mul_ps(Vec1, Fac0);
+ __m128 Mul01 = _mm_mul_ps(Vec2, Fac1);
+ __m128 Mul02 = _mm_mul_ps(Vec3, Fac2);
+ __m128 Sub00 = _mm_sub_ps(Mul00, Mul01);
+ __m128 Add00 = _mm_add_ps(Sub00, Mul02);
+ __m128 Inv0 = _mm_mul_ps(SignB, Add00);
+
+ // col1
+ // - (Vec0[0] * Fac0[0] - Vec2[0] * Fac3[0] + Vec3[0] * Fac4[0]),
+ // + (Vec0[0] * Fac0[1] - Vec2[1] * Fac3[1] + Vec3[1] * Fac4[1]),
+ // - (Vec0[0] * Fac0[2] - Vec2[2] * Fac3[2] + Vec3[2] * Fac4[2]),
+ // + (Vec0[0] * Fac0[3] - Vec2[3] * Fac3[3] + Vec3[3] * Fac4[3]),
+ __m128 Mul03 = _mm_mul_ps(Vec0, Fac0);
+ __m128 Mul04 = _mm_mul_ps(Vec2, Fac3);
+ __m128 Mul05 = _mm_mul_ps(Vec3, Fac4);
+ __m128 Sub01 = _mm_sub_ps(Mul03, Mul04);
+ __m128 Add01 = _mm_add_ps(Sub01, Mul05);
+ __m128 Inv1 = _mm_mul_ps(SignA, Add01);
+
+ // col2
+ // + (Vec0[0] * Fac1[0] - Vec1[0] * Fac3[0] + Vec3[0] * Fac5[0]),
+ // - (Vec0[0] * Fac1[1] - Vec1[1] * Fac3[1] + Vec3[1] * Fac5[1]),
+ // + (Vec0[0] * Fac1[2] - Vec1[2] * Fac3[2] + Vec3[2] * Fac5[2]),
+ // - (Vec0[0] * Fac1[3] - Vec1[3] * Fac3[3] + Vec3[3] * Fac5[3]),
+ __m128 Mul06 = _mm_mul_ps(Vec0, Fac1);
+ __m128 Mul07 = _mm_mul_ps(Vec1, Fac3);
+ __m128 Mul08 = _mm_mul_ps(Vec3, Fac5);
+ __m128 Sub02 = _mm_sub_ps(Mul06, Mul07);
+ __m128 Add02 = _mm_add_ps(Sub02, Mul08);
+ __m128 Inv2 = _mm_mul_ps(SignB, Add02);
+
+ // col3
+ // - (Vec1[0] * Fac2[0] - Vec1[0] * Fac4[0] + Vec2[0] * Fac5[0]),
+ // + (Vec1[0] * Fac2[1] - Vec1[1] * Fac4[1] + Vec2[1] * Fac5[1]),
+ // - (Vec1[0] * Fac2[2] - Vec1[2] * Fac4[2] + Vec2[2] * Fac5[2]),
+ // + (Vec1[0] * Fac2[3] - Vec1[3] * Fac4[3] + Vec2[3] * Fac5[3]));
+ __m128 Mul09 = _mm_mul_ps(Vec0, Fac2);
+ __m128 Mul10 = _mm_mul_ps(Vec1, Fac4);
+ __m128 Mul11 = _mm_mul_ps(Vec2, Fac5);
+ __m128 Sub03 = _mm_sub_ps(Mul09, Mul10);
+ __m128 Add03 = _mm_add_ps(Sub03, Mul11);
+ __m128 Inv3 = _mm_mul_ps(SignA, Add03);
+
+ __m128 Row0 = _mm_shuffle_ps(Inv0, Inv1, _MM_SHUFFLE(0, 0, 0, 0));
+ __m128 Row1 = _mm_shuffle_ps(Inv2, Inv3, _MM_SHUFFLE(0, 0, 0, 0));
+ __m128 Row2 = _mm_shuffle_ps(Row0, Row1, _MM_SHUFFLE(2, 0, 2, 0));
+
+ // valType Determinant = m[0][0] * Inverse[0][0]
+ // + m[0][1] * Inverse[1][0]
+ // + m[0][2] * Inverse[2][0]
+ // + m[0][3] * Inverse[3][0];
+ __m128 Det0 = sse_dot_ps(in[0], Row2);
+ return Det0;
+}
+
+GLM_FUNC_QUALIFIER __m128 sse_detd_ps
+(
+ __m128 const m[4]
+)
+{
+ // _mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(
+
+ //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];
+
+ // First 2 columns
+ __m128 Swp2A = _mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(m[2]), _MM_SHUFFLE(0, 1, 1, 2)));
+ __m128 Swp3A = _mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(m[3]), _MM_SHUFFLE(3, 2, 3, 3)));
+ __m128 MulA = _mm_mul_ps(Swp2A, Swp3A);
+
+ // Second 2 columns
+ __m128 Swp2B = _mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(m[2]), _MM_SHUFFLE(3, 2, 3, 3)));
+ __m128 Swp3B = _mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(m[3]), _MM_SHUFFLE(0, 1, 1, 2)));
+ __m128 MulB = _mm_mul_ps(Swp2B, Swp3B);
+
+ // Columns subtraction
+ __m128 SubE = _mm_sub_ps(MulA, MulB);
+
+ // Last 2 rows
+ __m128 Swp2C = _mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(m[2]), _MM_SHUFFLE(0, 0, 1, 2)));
+ __m128 Swp3C = _mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(m[3]), _MM_SHUFFLE(1, 2, 0, 0)));
+ __m128 MulC = _mm_mul_ps(Swp2C, Swp3C);
+ __m128 SubF = _mm_sub_ps(_mm_movehl_ps(MulC, MulC), MulC);
+
+ //detail::tvec4<T> 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));
+
+ __m128 SubFacA = _mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(SubE), _MM_SHUFFLE(2, 1, 0, 0)));
+ __m128 SwpFacA = _mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(m[1]), _MM_SHUFFLE(0, 0, 0, 1)));
+ __m128 MulFacA = _mm_mul_ps(SwpFacA, SubFacA);
+
+ __m128 SubTmpB = _mm_shuffle_ps(SubE, SubF, _MM_SHUFFLE(0, 0, 3, 1));
+ __m128 SubFacB = _mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(SubTmpB), _MM_SHUFFLE(3, 1, 1, 0)));//SubF[0], SubE[3], SubE[3], SubE[1];
+ __m128 SwpFacB = _mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(m[1]), _MM_SHUFFLE(1, 1, 2, 2)));
+ __m128 MulFacB = _mm_mul_ps(SwpFacB, SubFacB);
+
+ __m128 SubRes = _mm_sub_ps(MulFacA, MulFacB);
+
+ __m128 SubTmpC = _mm_shuffle_ps(SubE, SubF, _MM_SHUFFLE(1, 0, 2, 2));
+ __m128 SubFacC = _mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(SubTmpC), _MM_SHUFFLE(3, 3, 2, 0)));
+ __m128 SwpFacC = _mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(m[1]), _MM_SHUFFLE(2, 3, 3, 3)));
+ __m128 MulFacC = _mm_mul_ps(SwpFacC, SubFacC);
+
+ __m128 AddRes = _mm_add_ps(SubRes, MulFacC);
+ __m128 DetCof = _mm_mul_ps(AddRes, _mm_setr_ps( 1.0f,-1.0f, 1.0f,-1.0f));
+
+ //return m[0][0] * DetCof[0]
+ // + m[0][1] * DetCof[1]
+ // + m[0][2] * DetCof[2]
+ // + m[0][3] * DetCof[3];
+
+ return sse_dot_ps(m[0], DetCof);
+}
+
+GLM_FUNC_QUALIFIER __m128 sse_det_ps
+(
+ __m128 const m[4]
+)
+{
+ // _mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(add)
+
+ //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];
+
+ // First 2 columns
+ __m128 Swp2A = _mm_shuffle_ps(m[2], m[2], _MM_SHUFFLE(0, 1, 1, 2));
+ __m128 Swp3A = _mm_shuffle_ps(m[3], m[3], _MM_SHUFFLE(3, 2, 3, 3));
+ __m128 MulA = _mm_mul_ps(Swp2A, Swp3A);
+
+ // Second 2 columns
+ __m128 Swp2B = _mm_shuffle_ps(m[2], m[2], _MM_SHUFFLE(3, 2, 3, 3));
+ __m128 Swp3B = _mm_shuffle_ps(m[3], m[3], _MM_SHUFFLE(0, 1, 1, 2));
+ __m128 MulB = _mm_mul_ps(Swp2B, Swp3B);
+
+ // Columns subtraction
+ __m128 SubE = _mm_sub_ps(MulA, MulB);
+
+ // Last 2 rows
+ __m128 Swp2C = _mm_shuffle_ps(m[2], m[2], _MM_SHUFFLE(0, 0, 1, 2));
+ __m128 Swp3C = _mm_shuffle_ps(m[3], m[3], _MM_SHUFFLE(1, 2, 0, 0));
+ __m128 MulC = _mm_mul_ps(Swp2C, Swp3C);
+ __m128 SubF = _mm_sub_ps(_mm_movehl_ps(MulC, MulC), MulC);
+
+ //detail::tvec4<T> 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));
+
+ __m128 SubFacA = _mm_shuffle_ps(SubE, SubE, _MM_SHUFFLE(2, 1, 0, 0));
+ __m128 SwpFacA = _mm_shuffle_ps(m[1], m[1], _MM_SHUFFLE(0, 0, 0, 1));
+ __m128 MulFacA = _mm_mul_ps(SwpFacA, SubFacA);
+
+ __m128 SubTmpB = _mm_shuffle_ps(SubE, SubF, _MM_SHUFFLE(0, 0, 3, 1));
+ __m128 SubFacB = _mm_shuffle_ps(SubTmpB, SubTmpB, _MM_SHUFFLE(3, 1, 1, 0));//SubF[0], SubE[3], SubE[3], SubE[1];
+ __m128 SwpFacB = _mm_shuffle_ps(m[1], m[1], _MM_SHUFFLE(1, 1, 2, 2));
+ __m128 MulFacB = _mm_mul_ps(SwpFacB, SubFacB);
+
+ __m128 SubRes = _mm_sub_ps(MulFacA, MulFacB);
+
+ __m128 SubTmpC = _mm_shuffle_ps(SubE, SubF, _MM_SHUFFLE(1, 0, 2, 2));
+ __m128 SubFacC = _mm_shuffle_ps(SubTmpC, SubTmpC, _MM_SHUFFLE(3, 3, 2, 0));
+ __m128 SwpFacC = _mm_shuffle_ps(m[1], m[1], _MM_SHUFFLE(2, 3, 3, 3));
+ __m128 MulFacC = _mm_mul_ps(SwpFacC, SubFacC);
+
+ __m128 AddRes = _mm_add_ps(SubRes, MulFacC);
+ __m128 DetCof = _mm_mul_ps(AddRes, _mm_setr_ps( 1.0f,-1.0f, 1.0f,-1.0f));
+
+ //return m[0][0] * DetCof[0]
+ // + m[0][1] * DetCof[1]
+ // + m[0][2] * DetCof[2]
+ // + m[0][3] * DetCof[3];
+
+ return sse_dot_ps(m[0], DetCof);
+}
+
+GLM_FUNC_QUALIFIER void sse_inverse_ps(__m128 const in[4], __m128 out[4])
+{
+ __m128 Fac0;
+ {
+ // valType SubFactor00 = m[2][2] * m[3][3] - m[3][2] * m[2][3];
+ // valType SubFactor00 = m[2][2] * m[3][3] - m[3][2] * m[2][3];
+ // valType SubFactor06 = m[1][2] * m[3][3] - m[3][2] * m[1][3];
+ // valType SubFactor13 = m[1][2] * m[2][3] - m[2][2] * m[1][3];
+
+ __m128 Swp0a = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(3, 3, 3, 3));
+ __m128 Swp0b = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(2, 2, 2, 2));
+
+ __m128 Swp00 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(2, 2, 2, 2));
+ __m128 Swp01 = _mm_shuffle_ps(Swp0a, Swp0a, _MM_SHUFFLE(2, 0, 0, 0));
+ __m128 Swp02 = _mm_shuffle_ps(Swp0b, Swp0b, _MM_SHUFFLE(2, 0, 0, 0));
+ __m128 Swp03 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(3, 3, 3, 3));
+
+ __m128 Mul00 = _mm_mul_ps(Swp00, Swp01);
+ __m128 Mul01 = _mm_mul_ps(Swp02, Swp03);
+ Fac0 = _mm_sub_ps(Mul00, Mul01);
+ }
+
+ __m128 Fac1;
+ {
+ // valType SubFactor01 = m[2][1] * m[3][3] - m[3][1] * m[2][3];
+ // valType SubFactor01 = m[2][1] * m[3][3] - m[3][1] * m[2][3];
+ // valType SubFactor07 = m[1][1] * m[3][3] - m[3][1] * m[1][3];
+ // valType SubFactor14 = m[1][1] * m[2][3] - m[2][1] * m[1][3];
+
+ __m128 Swp0a = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(3, 3, 3, 3));
+ __m128 Swp0b = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(1, 1, 1, 1));
+
+ __m128 Swp00 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(1, 1, 1, 1));
+ __m128 Swp01 = _mm_shuffle_ps(Swp0a, Swp0a, _MM_SHUFFLE(2, 0, 0, 0));
+ __m128 Swp02 = _mm_shuffle_ps(Swp0b, Swp0b, _MM_SHUFFLE(2, 0, 0, 0));
+ __m128 Swp03 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(3, 3, 3, 3));
+
+ __m128 Mul00 = _mm_mul_ps(Swp00, Swp01);
+ __m128 Mul01 = _mm_mul_ps(Swp02, Swp03);
+ Fac1 = _mm_sub_ps(Mul00, Mul01);
+ }
+
+
+ __m128 Fac2;
+ {
+ // valType SubFactor02 = m[2][1] * m[3][2] - m[3][1] * m[2][2];
+ // valType SubFactor02 = m[2][1] * m[3][2] - m[3][1] * m[2][2];
+ // valType SubFactor08 = m[1][1] * m[3][2] - m[3][1] * m[1][2];
+ // valType SubFactor15 = m[1][1] * m[2][2] - m[2][1] * m[1][2];
+
+ __m128 Swp0a = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(2, 2, 2, 2));
+ __m128 Swp0b = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(1, 1, 1, 1));
+
+ __m128 Swp00 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(1, 1, 1, 1));
+ __m128 Swp01 = _mm_shuffle_ps(Swp0a, Swp0a, _MM_SHUFFLE(2, 0, 0, 0));
+ __m128 Swp02 = _mm_shuffle_ps(Swp0b, Swp0b, _MM_SHUFFLE(2, 0, 0, 0));
+ __m128 Swp03 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(2, 2, 2, 2));
+
+ __m128 Mul00 = _mm_mul_ps(Swp00, Swp01);
+ __m128 Mul01 = _mm_mul_ps(Swp02, Swp03);
+ Fac2 = _mm_sub_ps(Mul00, Mul01);
+ }
+
+ __m128 Fac3;
+ {
+ // valType SubFactor03 = m[2][0] * m[3][3] - m[3][0] * m[2][3];
+ // valType SubFactor03 = m[2][0] * m[3][3] - m[3][0] * m[2][3];
+ // valType SubFactor09 = m[1][0] * m[3][3] - m[3][0] * m[1][3];
+ // valType SubFactor16 = m[1][0] * m[2][3] - m[2][0] * m[1][3];
+
+ __m128 Swp0a = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(3, 3, 3, 3));
+ __m128 Swp0b = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(0, 0, 0, 0));
+
+ __m128 Swp00 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(0, 0, 0, 0));
+ __m128 Swp01 = _mm_shuffle_ps(Swp0a, Swp0a, _MM_SHUFFLE(2, 0, 0, 0));
+ __m128 Swp02 = _mm_shuffle_ps(Swp0b, Swp0b, _MM_SHUFFLE(2, 0, 0, 0));
+ __m128 Swp03 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(3, 3, 3, 3));
+
+ __m128 Mul00 = _mm_mul_ps(Swp00, Swp01);
+ __m128 Mul01 = _mm_mul_ps(Swp02, Swp03);
+ Fac3 = _mm_sub_ps(Mul00, Mul01);
+ }
+
+ __m128 Fac4;
+ {
+ // valType SubFactor04 = m[2][0] * m[3][2] - m[3][0] * m[2][2];
+ // valType SubFactor04 = m[2][0] * m[3][2] - m[3][0] * m[2][2];
+ // valType SubFactor10 = m[1][0] * m[3][2] - m[3][0] * m[1][2];
+ // valType SubFactor17 = m[1][0] * m[2][2] - m[2][0] * m[1][2];
+
+ __m128 Swp0a = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(2, 2, 2, 2));
+ __m128 Swp0b = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(0, 0, 0, 0));
+
+ __m128 Swp00 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(0, 0, 0, 0));
+ __m128 Swp01 = _mm_shuffle_ps(Swp0a, Swp0a, _MM_SHUFFLE(2, 0, 0, 0));
+ __m128 Swp02 = _mm_shuffle_ps(Swp0b, Swp0b, _MM_SHUFFLE(2, 0, 0, 0));
+ __m128 Swp03 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(2, 2, 2, 2));
+
+ __m128 Mul00 = _mm_mul_ps(Swp00, Swp01);
+ __m128 Mul01 = _mm_mul_ps(Swp02, Swp03);
+ Fac4 = _mm_sub_ps(Mul00, Mul01);
+ }
+
+ __m128 Fac5;
+ {
+ // valType SubFactor05 = m[2][0] * m[3][1] - m[3][0] * m[2][1];
+ // valType SubFactor05 = m[2][0] * m[3][1] - m[3][0] * m[2][1];
+ // valType SubFactor12 = m[1][0] * m[3][1] - m[3][0] * m[1][1];
+ // valType SubFactor18 = m[1][0] * m[2][1] - m[2][0] * m[1][1];
+
+ __m128 Swp0a = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(1, 1, 1, 1));
+ __m128 Swp0b = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(0, 0, 0, 0));
+
+ __m128 Swp00 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(0, 0, 0, 0));
+ __m128 Swp01 = _mm_shuffle_ps(Swp0a, Swp0a, _MM_SHUFFLE(2, 0, 0, 0));
+ __m128 Swp02 = _mm_shuffle_ps(Swp0b, Swp0b, _MM_SHUFFLE(2, 0, 0, 0));
+ __m128 Swp03 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(1, 1, 1, 1));
+
+ __m128 Mul00 = _mm_mul_ps(Swp00, Swp01);
+ __m128 Mul01 = _mm_mul_ps(Swp02, Swp03);
+ Fac5 = _mm_sub_ps(Mul00, Mul01);
+ }
+
+ __m128 SignA = _mm_set_ps( 1.0f,-1.0f, 1.0f,-1.0f);
+ __m128 SignB = _mm_set_ps(-1.0f, 1.0f,-1.0f, 1.0f);
+
+ // m[1][0]
+ // m[0][0]
+ // m[0][0]
+ // m[0][0]
+ __m128 Temp0 = _mm_shuffle_ps(in[1], in[0], _MM_SHUFFLE(0, 0, 0, 0));
+ __m128 Vec0 = _mm_shuffle_ps(Temp0, Temp0, _MM_SHUFFLE(2, 2, 2, 0));
+
+ // m[1][1]
+ // m[0][1]
+ // m[0][1]
+ // m[0][1]
+ __m128 Temp1 = _mm_shuffle_ps(in[1], in[0], _MM_SHUFFLE(1, 1, 1, 1));
+ __m128 Vec1 = _mm_shuffle_ps(Temp1, Temp1, _MM_SHUFFLE(2, 2, 2, 0));
+
+ // m[1][2]
+ // m[0][2]
+ // m[0][2]
+ // m[0][2]
+ __m128 Temp2 = _mm_shuffle_ps(in[1], in[0], _MM_SHUFFLE(2, 2, 2, 2));
+ __m128 Vec2 = _mm_shuffle_ps(Temp2, Temp2, _MM_SHUFFLE(2, 2, 2, 0));
+
+ // m[1][3]
+ // m[0][3]
+ // m[0][3]
+ // m[0][3]
+ __m128 Temp3 = _mm_shuffle_ps(in[1], in[0], _MM_SHUFFLE(3, 3, 3, 3));
+ __m128 Vec3 = _mm_shuffle_ps(Temp3, Temp3, _MM_SHUFFLE(2, 2, 2, 0));
+
+ // col0
+ // + (Vec1[0] * Fac0[0] - Vec2[0] * Fac1[0] + Vec3[0] * Fac2[0]),
+ // - (Vec1[1] * Fac0[1] - Vec2[1] * Fac1[1] + Vec3[1] * Fac2[1]),
+ // + (Vec1[2] * Fac0[2] - Vec2[2] * Fac1[2] + Vec3[2] * Fac2[2]),
+ // - (Vec1[3] * Fac0[3] - Vec2[3] * Fac1[3] + Vec3[3] * Fac2[3]),
+ __m128 Mul00 = _mm_mul_ps(Vec1, Fac0);
+ __m128 Mul01 = _mm_mul_ps(Vec2, Fac1);
+ __m128 Mul02 = _mm_mul_ps(Vec3, Fac2);
+ __m128 Sub00 = _mm_sub_ps(Mul00, Mul01);
+ __m128 Add00 = _mm_add_ps(Sub00, Mul02);
+ __m128 Inv0 = _mm_mul_ps(SignB, Add00);
+
+ // col1
+ // - (Vec0[0] * Fac0[0] - Vec2[0] * Fac3[0] + Vec3[0] * Fac4[0]),
+ // + (Vec0[0] * Fac0[1] - Vec2[1] * Fac3[1] + Vec3[1] * Fac4[1]),
+ // - (Vec0[0] * Fac0[2] - Vec2[2] * Fac3[2] + Vec3[2] * Fac4[2]),
+ // + (Vec0[0] * Fac0[3] - Vec2[3] * Fac3[3] + Vec3[3] * Fac4[3]),
+ __m128 Mul03 = _mm_mul_ps(Vec0, Fac0);
+ __m128 Mul04 = _mm_mul_ps(Vec2, Fac3);
+ __m128 Mul05 = _mm_mul_ps(Vec3, Fac4);
+ __m128 Sub01 = _mm_sub_ps(Mul03, Mul04);
+ __m128 Add01 = _mm_add_ps(Sub01, Mul05);
+ __m128 Inv1 = _mm_mul_ps(SignA, Add01);
+
+ // col2
+ // + (Vec0[0] * Fac1[0] - Vec1[0] * Fac3[0] + Vec3[0] * Fac5[0]),
+ // - (Vec0[0] * Fac1[1] - Vec1[1] * Fac3[1] + Vec3[1] * Fac5[1]),
+ // + (Vec0[0] * Fac1[2] - Vec1[2] * Fac3[2] + Vec3[2] * Fac5[2]),
+ // - (Vec0[0] * Fac1[3] - Vec1[3] * Fac3[3] + Vec3[3] * Fac5[3]),
+ __m128 Mul06 = _mm_mul_ps(Vec0, Fac1);
+ __m128 Mul07 = _mm_mul_ps(Vec1, Fac3);
+ __m128 Mul08 = _mm_mul_ps(Vec3, Fac5);
+ __m128 Sub02 = _mm_sub_ps(Mul06, Mul07);
+ __m128 Add02 = _mm_add_ps(Sub02, Mul08);
+ __m128 Inv2 = _mm_mul_ps(SignB, Add02);
+
+ // col3
+ // - (Vec1[0] * Fac2[0] - Vec1[0] * Fac4[0] + Vec2[0] * Fac5[0]),
+ // + (Vec1[0] * Fac2[1] - Vec1[1] * Fac4[1] + Vec2[1] * Fac5[1]),
+ // - (Vec1[0] * Fac2[2] - Vec1[2] * Fac4[2] + Vec2[2] * Fac5[2]),
+ // + (Vec1[0] * Fac2[3] - Vec1[3] * Fac4[3] + Vec2[3] * Fac5[3]));
+ __m128 Mul09 = _mm_mul_ps(Vec0, Fac2);
+ __m128 Mul10 = _mm_mul_ps(Vec1, Fac4);
+ __m128 Mul11 = _mm_mul_ps(Vec2, Fac5);
+ __m128 Sub03 = _mm_sub_ps(Mul09, Mul10);
+ __m128 Add03 = _mm_add_ps(Sub03, Mul11);
+ __m128 Inv3 = _mm_mul_ps(SignA, Add03);
+
+ __m128 Row0 = _mm_shuffle_ps(Inv0, Inv1, _MM_SHUFFLE(0, 0, 0, 0));
+ __m128 Row1 = _mm_shuffle_ps(Inv2, Inv3, _MM_SHUFFLE(0, 0, 0, 0));
+ __m128 Row2 = _mm_shuffle_ps(Row0, Row1, _MM_SHUFFLE(2, 0, 2, 0));
+
+ // valType Determinant = m[0][0] * Inverse[0][0]
+ // + m[0][1] * Inverse[1][0]
+ // + m[0][2] * Inverse[2][0]
+ // + m[0][3] * Inverse[3][0];
+ __m128 Det0 = sse_dot_ps(in[0], Row2);
+ __m128 Rcp0 = _mm_div_ps(one, Det0);
+ //__m128 Rcp0 = _mm_rcp_ps(Det0);
+
+ // Inverse /= Determinant;
+ out[0] = _mm_mul_ps(Inv0, Rcp0);
+ out[1] = _mm_mul_ps(Inv1, Rcp0);
+ out[2] = _mm_mul_ps(Inv2, Rcp0);
+ out[3] = _mm_mul_ps(Inv3, Rcp0);
+}
+
+GLM_FUNC_QUALIFIER void sse_inverse_fast_ps(__m128 const in[4], __m128 out[4])
+{
+ __m128 Fac0;
+ {
+ // valType SubFactor00 = m[2][2] * m[3][3] - m[3][2] * m[2][3];
+ // valType SubFactor00 = m[2][2] * m[3][3] - m[3][2] * m[2][3];
+ // valType SubFactor06 = m[1][2] * m[3][3] - m[3][2] * m[1][3];
+ // valType SubFactor13 = m[1][2] * m[2][3] - m[2][2] * m[1][3];
+
+ __m128 Swp0a = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(3, 3, 3, 3));
+ __m128 Swp0b = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(2, 2, 2, 2));
+
+ __m128 Swp00 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(2, 2, 2, 2));
+ __m128 Swp01 = _mm_shuffle_ps(Swp0a, Swp0a, _MM_SHUFFLE(2, 0, 0, 0));
+ __m128 Swp02 = _mm_shuffle_ps(Swp0b, Swp0b, _MM_SHUFFLE(2, 0, 0, 0));
+ __m128 Swp03 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(3, 3, 3, 3));
+
+ __m128 Mul00 = _mm_mul_ps(Swp00, Swp01);
+ __m128 Mul01 = _mm_mul_ps(Swp02, Swp03);
+ Fac0 = _mm_sub_ps(Mul00, Mul01);
+ }
+
+ __m128 Fac1;
+ {
+ // valType SubFactor01 = m[2][1] * m[3][3] - m[3][1] * m[2][3];
+ // valType SubFactor01 = m[2][1] * m[3][3] - m[3][1] * m[2][3];
+ // valType SubFactor07 = m[1][1] * m[3][3] - m[3][1] * m[1][3];
+ // valType SubFactor14 = m[1][1] * m[2][3] - m[2][1] * m[1][3];
+
+ __m128 Swp0a = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(3, 3, 3, 3));
+ __m128 Swp0b = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(1, 1, 1, 1));
+
+ __m128 Swp00 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(1, 1, 1, 1));
+ __m128 Swp01 = _mm_shuffle_ps(Swp0a, Swp0a, _MM_SHUFFLE(2, 0, 0, 0));
+ __m128 Swp02 = _mm_shuffle_ps(Swp0b, Swp0b, _MM_SHUFFLE(2, 0, 0, 0));
+ __m128 Swp03 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(3, 3, 3, 3));
+
+ __m128 Mul00 = _mm_mul_ps(Swp00, Swp01);
+ __m128 Mul01 = _mm_mul_ps(Swp02, Swp03);
+ Fac1 = _mm_sub_ps(Mul00, Mul01);
+ }
+
+
+ __m128 Fac2;
+ {
+ // valType SubFactor02 = m[2][1] * m[3][2] - m[3][1] * m[2][2];
+ // valType SubFactor02 = m[2][1] * m[3][2] - m[3][1] * m[2][2];
+ // valType SubFactor08 = m[1][1] * m[3][2] - m[3][1] * m[1][2];
+ // valType SubFactor15 = m[1][1] * m[2][2] - m[2][1] * m[1][2];
+
+ __m128 Swp0a = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(2, 2, 2, 2));
+ __m128 Swp0b = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(1, 1, 1, 1));
+
+ __m128 Swp00 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(1, 1, 1, 1));
+ __m128 Swp01 = _mm_shuffle_ps(Swp0a, Swp0a, _MM_SHUFFLE(2, 0, 0, 0));
+ __m128 Swp02 = _mm_shuffle_ps(Swp0b, Swp0b, _MM_SHUFFLE(2, 0, 0, 0));
+ __m128 Swp03 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(2, 2, 2, 2));
+
+ __m128 Mul00 = _mm_mul_ps(Swp00, Swp01);
+ __m128 Mul01 = _mm_mul_ps(Swp02, Swp03);
+ Fac2 = _mm_sub_ps(Mul00, Mul01);
+ }
+
+ __m128 Fac3;
+ {
+ // valType SubFactor03 = m[2][0] * m[3][3] - m[3][0] * m[2][3];
+ // valType SubFactor03 = m[2][0] * m[3][3] - m[3][0] * m[2][3];
+ // valType SubFactor09 = m[1][0] * m[3][3] - m[3][0] * m[1][3];
+ // valType SubFactor16 = m[1][0] * m[2][3] - m[2][0] * m[1][3];
+
+ __m128 Swp0a = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(3, 3, 3, 3));
+ __m128 Swp0b = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(0, 0, 0, 0));
+
+ __m128 Swp00 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(0, 0, 0, 0));
+ __m128 Swp01 = _mm_shuffle_ps(Swp0a, Swp0a, _MM_SHUFFLE(2, 0, 0, 0));
+ __m128 Swp02 = _mm_shuffle_ps(Swp0b, Swp0b, _MM_SHUFFLE(2, 0, 0, 0));
+ __m128 Swp03 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(3, 3, 3, 3));
+
+ __m128 Mul00 = _mm_mul_ps(Swp00, Swp01);
+ __m128 Mul01 = _mm_mul_ps(Swp02, Swp03);
+ Fac3 = _mm_sub_ps(Mul00, Mul01);
+ }
+
+ __m128 Fac4;
+ {
+ // valType SubFactor04 = m[2][0] * m[3][2] - m[3][0] * m[2][2];
+ // valType SubFactor04 = m[2][0] * m[3][2] - m[3][0] * m[2][2];
+ // valType SubFactor10 = m[1][0] * m[3][2] - m[3][0] * m[1][2];
+ // valType SubFactor17 = m[1][0] * m[2][2] - m[2][0] * m[1][2];
+
+ __m128 Swp0a = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(2, 2, 2, 2));
+ __m128 Swp0b = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(0, 0, 0, 0));
+
+ __m128 Swp00 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(0, 0, 0, 0));
+ __m128 Swp01 = _mm_shuffle_ps(Swp0a, Swp0a, _MM_SHUFFLE(2, 0, 0, 0));
+ __m128 Swp02 = _mm_shuffle_ps(Swp0b, Swp0b, _MM_SHUFFLE(2, 0, 0, 0));
+ __m128 Swp03 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(2, 2, 2, 2));
+
+ __m128 Mul00 = _mm_mul_ps(Swp00, Swp01);
+ __m128 Mul01 = _mm_mul_ps(Swp02, Swp03);
+ Fac4 = _mm_sub_ps(Mul00, Mul01);
+ }
+
+ __m128 Fac5;
+ {
+ // valType SubFactor05 = m[2][0] * m[3][1] - m[3][0] * m[2][1];
+ // valType SubFactor05 = m[2][0] * m[3][1] - m[3][0] * m[2][1];
+ // valType SubFactor12 = m[1][0] * m[3][1] - m[3][0] * m[1][1];
+ // valType SubFactor18 = m[1][0] * m[2][1] - m[2][0] * m[1][1];
+
+ __m128 Swp0a = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(1, 1, 1, 1));
+ __m128 Swp0b = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(0, 0, 0, 0));
+
+ __m128 Swp00 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(0, 0, 0, 0));
+ __m128 Swp01 = _mm_shuffle_ps(Swp0a, Swp0a, _MM_SHUFFLE(2, 0, 0, 0));
+ __m128 Swp02 = _mm_shuffle_ps(Swp0b, Swp0b, _MM_SHUFFLE(2, 0, 0, 0));
+ __m128 Swp03 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(1, 1, 1, 1));
+
+ __m128 Mul00 = _mm_mul_ps(Swp00, Swp01);
+ __m128 Mul01 = _mm_mul_ps(Swp02, Swp03);
+ Fac5 = _mm_sub_ps(Mul00, Mul01);
+ }
+
+ __m128 SignA = _mm_set_ps( 1.0f,-1.0f, 1.0f,-1.0f);
+ __m128 SignB = _mm_set_ps(-1.0f, 1.0f,-1.0f, 1.0f);
+
+ // m[1][0]
+ // m[0][0]
+ // m[0][0]
+ // m[0][0]
+ __m128 Temp0 = _mm_shuffle_ps(in[1], in[0], _MM_SHUFFLE(0, 0, 0, 0));
+ __m128 Vec0 = _mm_shuffle_ps(Temp0, Temp0, _MM_SHUFFLE(2, 2, 2, 0));
+
+ // m[1][1]
+ // m[0][1]
+ // m[0][1]
+ // m[0][1]
+ __m128 Temp1 = _mm_shuffle_ps(in[1], in[0], _MM_SHUFFLE(1, 1, 1, 1));
+ __m128 Vec1 = _mm_shuffle_ps(Temp1, Temp1, _MM_SHUFFLE(2, 2, 2, 0));
+
+ // m[1][2]
+ // m[0][2]
+ // m[0][2]
+ // m[0][2]
+ __m128 Temp2 = _mm_shuffle_ps(in[1], in[0], _MM_SHUFFLE(2, 2, 2, 2));
+ __m128 Vec2 = _mm_shuffle_ps(Temp2, Temp2, _MM_SHUFFLE(2, 2, 2, 0));
+
+ // m[1][3]
+ // m[0][3]
+ // m[0][3]
+ // m[0][3]
+ __m128 Temp3 = _mm_shuffle_ps(in[1], in[0], _MM_SHUFFLE(3, 3, 3, 3));
+ __m128 Vec3 = _mm_shuffle_ps(Temp3, Temp3, _MM_SHUFFLE(2, 2, 2, 0));
+
+ // col0
+ // + (Vec1[0] * Fac0[0] - Vec2[0] * Fac1[0] + Vec3[0] * Fac2[0]),
+ // - (Vec1[1] * Fac0[1] - Vec2[1] * Fac1[1] + Vec3[1] * Fac2[1]),
+ // + (Vec1[2] * Fac0[2] - Vec2[2] * Fac1[2] + Vec3[2] * Fac2[2]),
+ // - (Vec1[3] * Fac0[3] - Vec2[3] * Fac1[3] + Vec3[3] * Fac2[3]),
+ __m128 Mul00 = _mm_mul_ps(Vec1, Fac0);
+ __m128 Mul01 = _mm_mul_ps(Vec2, Fac1);
+ __m128 Mul02 = _mm_mul_ps(Vec3, Fac2);
+ __m128 Sub00 = _mm_sub_ps(Mul00, Mul01);
+ __m128 Add00 = _mm_add_ps(Sub00, Mul02);
+ __m128 Inv0 = _mm_mul_ps(SignB, Add00);
+
+ // col1
+ // - (Vec0[0] * Fac0[0] - Vec2[0] * Fac3[0] + Vec3[0] * Fac4[0]),
+ // + (Vec0[0] * Fac0[1] - Vec2[1] * Fac3[1] + Vec3[1] * Fac4[1]),
+ // - (Vec0[0] * Fac0[2] - Vec2[2] * Fac3[2] + Vec3[2] * Fac4[2]),
+ // + (Vec0[0] * Fac0[3] - Vec2[3] * Fac3[3] + Vec3[3] * Fac4[3]),
+ __m128 Mul03 = _mm_mul_ps(Vec0, Fac0);
+ __m128 Mul04 = _mm_mul_ps(Vec2, Fac3);
+ __m128 Mul05 = _mm_mul_ps(Vec3, Fac4);
+ __m128 Sub01 = _mm_sub_ps(Mul03, Mul04);
+ __m128 Add01 = _mm_add_ps(Sub01, Mul05);
+ __m128 Inv1 = _mm_mul_ps(SignA, Add01);
+
+ // col2
+ // + (Vec0[0] * Fac1[0] - Vec1[0] * Fac3[0] + Vec3[0] * Fac5[0]),
+ // - (Vec0[0] * Fac1[1] - Vec1[1] * Fac3[1] + Vec3[1] * Fac5[1]),
+ // + (Vec0[0] * Fac1[2] - Vec1[2] * Fac3[2] + Vec3[2] * Fac5[2]),
+ // - (Vec0[0] * Fac1[3] - Vec1[3] * Fac3[3] + Vec3[3] * Fac5[3]),
+ __m128 Mul06 = _mm_mul_ps(Vec0, Fac1);
+ __m128 Mul07 = _mm_mul_ps(Vec1, Fac3);
+ __m128 Mul08 = _mm_mul_ps(Vec3, Fac5);
+ __m128 Sub02 = _mm_sub_ps(Mul06, Mul07);
+ __m128 Add02 = _mm_add_ps(Sub02, Mul08);
+ __m128 Inv2 = _mm_mul_ps(SignB, Add02);
+
+ // col3
+ // - (Vec1[0] * Fac2[0] - Vec1[0] * Fac4[0] + Vec2[0] * Fac5[0]),
+ // + (Vec1[0] * Fac2[1] - Vec1[1] * Fac4[1] + Vec2[1] * Fac5[1]),
+ // - (Vec1[0] * Fac2[2] - Vec1[2] * Fac4[2] + Vec2[2] * Fac5[2]),
+ // + (Vec1[0] * Fac2[3] - Vec1[3] * Fac4[3] + Vec2[3] * Fac5[3]));
+ __m128 Mul09 = _mm_mul_ps(Vec0, Fac2);
+ __m128 Mul10 = _mm_mul_ps(Vec1, Fac4);
+ __m128 Mul11 = _mm_mul_ps(Vec2, Fac5);
+ __m128 Sub03 = _mm_sub_ps(Mul09, Mul10);
+ __m128 Add03 = _mm_add_ps(Sub03, Mul11);
+ __m128 Inv3 = _mm_mul_ps(SignA, Add03);
+
+ __m128 Row0 = _mm_shuffle_ps(Inv0, Inv1, _MM_SHUFFLE(0, 0, 0, 0));
+ __m128 Row1 = _mm_shuffle_ps(Inv2, Inv3, _MM_SHUFFLE(0, 0, 0, 0));
+ __m128 Row2 = _mm_shuffle_ps(Row0, Row1, _MM_SHUFFLE(2, 0, 2, 0));
+
+ // valType Determinant = m[0][0] * Inverse[0][0]
+ // + m[0][1] * Inverse[1][0]
+ // + m[0][2] * Inverse[2][0]
+ // + m[0][3] * Inverse[3][0];
+ __m128 Det0 = sse_dot_ps(in[0], Row2);
+ __m128 Rcp0 = _mm_rcp_ps(Det0);
+ //__m128 Rcp0 = _mm_div_ps(one, Det0);
+ // Inverse /= Determinant;
+ out[0] = _mm_mul_ps(Inv0, Rcp0);
+ out[1] = _mm_mul_ps(Inv1, Rcp0);
+ out[2] = _mm_mul_ps(Inv2, Rcp0);
+ out[3] = _mm_mul_ps(Inv3, Rcp0);
+}
+/*
+GLM_FUNC_QUALIFIER void sse_rotate_ps(__m128 const in[4], float Angle, float const v[3], __m128 out[4])
+{
+ float a = glm::radians(Angle);
+ float c = cos(a);
+ float s = sin(a);
+
+ glm::vec4 AxisA(v[0], v[1], v[2], float(0));
+ __m128 AxisB = _mm_set_ps(AxisA.w, AxisA.z, AxisA.y, AxisA.x);
+ __m128 AxisC = detail::sse_nrm_ps(AxisB);
+
+ __m128 Cos0 = _mm_set_ss(c);
+ __m128 CosA = _mm_shuffle_ps(Cos0, Cos0, _MM_SHUFFLE(0, 0, 0, 0));
+ __m128 Sin0 = _mm_set_ss(s);
+ __m128 SinA = _mm_shuffle_ps(Sin0, Sin0, _MM_SHUFFLE(0, 0, 0, 0));
+
+ // detail::tvec3<valType> temp = (valType(1) - c) * axis;
+ __m128 Temp0 = _mm_sub_ps(one, CosA);
+ __m128 Temp1 = _mm_mul_ps(Temp0, AxisC);
+
+ //Rotate[0][0] = c + temp[0] * axis[0];
+ //Rotate[0][1] = 0 + temp[0] * axis[1] + s * axis[2];
+ //Rotate[0][2] = 0 + temp[0] * axis[2] - s * axis[1];
+ __m128 Axis0 = _mm_shuffle_ps(AxisC, AxisC, _MM_SHUFFLE(0, 0, 0, 0));
+ __m128 TmpA0 = _mm_mul_ps(Axis0, AxisC);
+ __m128 CosA0 = _mm_shuffle_ps(Cos0, Cos0, _MM_SHUFFLE(1, 1, 1, 0));
+ __m128 TmpA1 = _mm_add_ps(CosA0, TmpA0);
+ __m128 SinA0 = SinA;//_mm_set_ps(0.0f, s, -s, 0.0f);
+ __m128 TmpA2 = _mm_shuffle_ps(AxisC, AxisC, _MM_SHUFFLE(3, 1, 2, 3));
+ __m128 TmpA3 = _mm_mul_ps(SinA0, TmpA2);
+ __m128 TmpA4 = _mm_add_ps(TmpA1, TmpA3);
+
+ //Rotate[1][0] = 0 + temp[1] * axis[0] - s * axis[2];
+ //Rotate[1][1] = c + temp[1] * axis[1];
+ //Rotate[1][2] = 0 + temp[1] * axis[2] + s * axis[0];
+ __m128 Axis1 = _mm_shuffle_ps(AxisC, AxisC, _MM_SHUFFLE(1, 1, 1, 1));
+ __m128 TmpB0 = _mm_mul_ps(Axis1, AxisC);
+ __m128 CosA1 = _mm_shuffle_ps(Cos0, Cos0, _MM_SHUFFLE(1, 1, 0, 1));
+ __m128 TmpB1 = _mm_add_ps(CosA1, TmpB0);
+ __m128 SinB0 = SinA;//_mm_set_ps(-s, 0.0f, s, 0.0f);
+ __m128 TmpB2 = _mm_shuffle_ps(AxisC, AxisC, _MM_SHUFFLE(3, 0, 3, 2));
+ __m128 TmpB3 = _mm_mul_ps(SinA0, TmpB2);
+ __m128 TmpB4 = _mm_add_ps(TmpB1, TmpB3);
+
+ //Rotate[2][0] = 0 + temp[2] * axis[0] + s * axis[1];
+ //Rotate[2][1] = 0 + temp[2] * axis[1] - s * axis[0];
+ //Rotate[2][2] = c + temp[2] * axis[2];
+ __m128 Axis2 = _mm_shuffle_ps(AxisC, AxisC, _MM_SHUFFLE(2, 2, 2, 2));
+ __m128 TmpC0 = _mm_mul_ps(Axis2, AxisC);
+ __m128 CosA2 = _mm_shuffle_ps(Cos0, Cos0, _MM_SHUFFLE(1, 0, 1, 1));
+ __m128 TmpC1 = _mm_add_ps(CosA2, TmpC0);
+ __m128 SinC0 = SinA;//_mm_set_ps(s, -s, 0.0f, 0.0f);
+ __m128 TmpC2 = _mm_shuffle_ps(AxisC, AxisC, _MM_SHUFFLE(3, 3, 0, 1));
+ __m128 TmpC3 = _mm_mul_ps(SinA0, TmpC2);
+ __m128 TmpC4 = _mm_add_ps(TmpC1, TmpC3);
+
+ __m128 Result[4];
+ Result[0] = TmpA4;
+ Result[1] = TmpB4;
+ Result[2] = TmpC4;
+ Result[3] = _mm_set_ps(1, 0, 0, 0);
+
+ //detail::tmat4x4<valType> Result(detail::tmat4x4<valType>::null);
+ //Result[0] = m[0] * Rotate[0][0] + m[1] * Rotate[0][1] + m[2] * Rotate[0][2];
+ //Result[1] = m[0] * Rotate[1][0] + m[1] * Rotate[1][1] + m[2] * Rotate[1][2];
+ //Result[2] = m[0] * Rotate[2][0] + m[1] * Rotate[2][1] + m[2] * Rotate[2][2];
+ //Result[3] = m[3];
+ //return Result;
+ sse_mul_ps(in, Result, out);
+}
+*/
+GLM_FUNC_QUALIFIER void sse_outer_ps(__m128 const & c, __m128 const & r, __m128 out[4])
+{
+ out[0] = _mm_mul_ps(c, _mm_shuffle_ps(r, r, _MM_SHUFFLE(0, 0, 0, 0)));
+ out[1] = _mm_mul_ps(c, _mm_shuffle_ps(r, r, _MM_SHUFFLE(1, 1, 1, 1)));
+ out[2] = _mm_mul_ps(c, _mm_shuffle_ps(r, r, _MM_SHUFFLE(2, 2, 2, 2)));
+ out[3] = _mm_mul_ps(c, _mm_shuffle_ps(r, r, _MM_SHUFFLE(3, 3, 3, 3)));
+}
+
+}//namespace detail
+}//namespace glm
diff --git a/src/glm/core/intrinsic_trigonometric.hpp b/src/glm/core/intrinsic_trigonometric.hpp
new file mode 100644
index 0000000..9b69bf7
--- /dev/null
+++ b/src/glm/core/intrinsic_trigonometric.hpp
@@ -0,0 +1,29 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2009-06-09
+// Updated : 2009-06-09
+// Licence : This source is under MIT License
+// File : glm/core/intrinsic_trigonometric.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_detail_intrinsic_trigonometric
+#define glm_detail_intrinsic_trigonometric
+
+#include "setup.hpp"
+
+#if((GLM_ARCH & GLM_ARCH_SSE2) != GLM_ARCH_SSE2)
+# error "SSE2 instructions not supported or enabled"
+#else
+
+namespace glm{
+namespace detail
+{
+
+}//namespace detail
+}//namespace glm
+
+#include "intrinsic_trigonometric.inl"
+
+#endif//GLM_ARCH
+#endif//glm_detail_intrinsic_trigonometric
diff --git a/src/glm/core/intrinsic_trigonometric.inl b/src/glm/core/intrinsic_trigonometric.inl
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/glm/core/intrinsic_trigonometric.inl
diff --git a/src/glm/core/intrinsic_vector_relational.hpp b/src/glm/core/intrinsic_vector_relational.hpp
new file mode 100644
index 0000000..f064995
--- /dev/null
+++ b/src/glm/core/intrinsic_vector_relational.hpp
@@ -0,0 +1,29 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2009-06-09
+// Updated : 2009-06-09
+// Licence : This source is under MIT License
+// File : glm/core/intrinsic_vector_relational.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_detail_intrinsic_vector_relational
+#define glm_detail_intrinsic_vector_relational
+
+#include "setup.hpp"
+
+#if((GLM_ARCH & GLM_ARCH_SSE2) != GLM_ARCH_SSE2)
+# error "SSE2 instructions not supported or enabled"
+#else
+
+namespace glm{
+namespace detail
+{
+
+}//namespace detail
+}//namespace glm
+
+#include "intrinsic_vector_relational.inl"
+
+#endif//GLM_ARCH
+#endif//glm_detail_intrinsic_vector_relational
diff --git a/src/glm/core/intrinsic_vector_relational.inl b/src/glm/core/intrinsic_vector_relational.inl
new file mode 100644
index 0000000..0b8dc9d
--- /dev/null
+++ b/src/glm/core/intrinsic_vector_relational.inl
@@ -0,0 +1,347 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2009-06-09
+// Updated : 2009-06-09
+// Licence : This source is under MIT License
+// File : glm/core/intrinsic_vector_relational.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+//
+//// lessThan
+//template <typename valType>
+//GLM_FUNC_QUALIFIER typename detail::tvec2<valType>::bool_type lessThan
+//(
+// detail::tvec2<valType> const & x,
+// detail::tvec2<valType> const & y
+//)
+//{
+// GLM_STATIC_ASSERT(
+// detail::type<valType>::is_float ||
+// detail::type<valType>::is_int ||
+// detail::type<valType>::is_uint);
+//
+// return typename detail::tvec2<bool>::bool_type(x.x < y.x, x.y < y.y);
+//}
+//
+//template <typename valType>
+//GLM_FUNC_QUALIFIER typename detail::tvec3<valType>::bool_type lessThan
+//(
+// detail::tvec3<valType> const & x,
+// detail::tvec3<valType> const & y
+//)
+//{
+// GLM_STATIC_ASSERT(
+// detail::type<valType>::is_float ||
+// detail::type<valType>::is_int ||
+// detail::type<valType>::is_uint);
+//
+// return typename detail::tvec3<bool>::bool_type(x.x < y.x, x.y < y.y, x.z < y.z);
+//}
+//
+//template <typename valType>
+//GLM_FUNC_QUALIFIER typename detail::tvec4<valType>::bool_type lessThan
+//(
+// detail::tvec4<valType> const & x,
+// detail::tvec4<valType> const & y
+//)
+//{
+// GLM_STATIC_ASSERT(
+// detail::type<valType>::is_float ||
+// detail::type<valType>::is_int ||
+// detail::type<valType>::is_uint);
+//
+// return typename detail::tvec4<bool>::bool_type(x.x < y.x, x.y < y.y, x.z < y.z, x.w < y.w);
+//}
+//
+//// lessThanEqual
+//template <typename valType>
+//GLM_FUNC_QUALIFIER typename detail::tvec2<valType>::bool_type lessThanEqual
+//(
+// detail::tvec2<valType> const & x,
+// detail::tvec2<valType> const & y
+//)
+//{
+// GLM_STATIC_ASSERT(
+// detail::type<valType>::is_float ||
+// detail::type<valType>::is_int ||
+// detail::type<valType>::is_uint);
+//
+// return typename detail::tvec2<bool>::bool_type(x.x <= y.x, x.y <= y.y);
+//}
+//
+//template <typename valType>
+//GLM_FUNC_QUALIFIER typename detail::tvec3<valType>::bool_type lessThanEqual
+//(
+// detail::tvec3<valType> const & x,
+// detail::tvec3<valType> const & y
+//)
+//{
+// GLM_STATIC_ASSERT(
+// detail::type<valType>::is_float ||
+// detail::type<valType>::is_int ||
+// detail::type<valType>::is_uint);
+//
+// return typename detail::tvec3<bool>::bool_type(x.x <= y.x, x.y <= y.y, x.z <= y.z);
+//}
+//
+//template <typename valType>
+//GLM_FUNC_QUALIFIER typename detail::tvec4<valType>::bool_type lessThanEqual
+//(
+// detail::tvec4<valType> const & x,
+// detail::tvec4<valType> const & y
+//)
+//{
+// GLM_STATIC_ASSERT(
+// detail::type<valType>::is_float ||
+// detail::type<valType>::is_int ||
+// detail::type<valType>::is_uint);
+//
+// return typename detail::tvec4<bool>::bool_type(x.x <= y.x, x.y <= y.y, x.z <= y.z, x.w <= y.w);
+//}
+//
+//// greaterThan
+//template <typename valType>
+//GLM_FUNC_QUALIFIER typename detail::tvec2<valType>::bool_type greaterThan
+//(
+// detail::tvec2<valType> const & x,
+// detail::tvec2<valType> const & y
+//)
+//{
+// GLM_STATIC_ASSERT(
+// detail::type<valType>::is_float ||
+// detail::type<valType>::is_int ||
+// detail::type<valType>::is_uint);
+//
+// return typename detail::tvec2<bool>::bool_type(x.x > y.x, x.y > y.y);
+//}
+//
+//template <typename valType>
+//GLM_FUNC_QUALIFIER typename detail::tvec3<valType>::bool_type greaterThan
+//(
+// detail::tvec3<valType> const & x,
+// detail::tvec3<valType> const & y
+//)
+//{
+// GLM_STATIC_ASSERT(
+// detail::type<valType>::is_float ||
+// detail::type<valType>::is_int ||
+// detail::type<valType>::is_uint);
+//
+// return typename detail::tvec3<bool>::bool_type(x.x > y.x, x.y > y.y, x.z > y.z);
+//}
+//
+//template <typename valType>
+//GLM_FUNC_QUALIFIER typename detail::tvec4<valType>::bool_type greaterThan
+//(
+// detail::tvec4<valType> const & x,
+// detail::tvec4<valType> const & y
+//)
+//{
+// GLM_STATIC_ASSERT(
+// detail::type<valType>::is_float ||
+// detail::type<valType>::is_int ||
+// detail::type<valType>::is_uint);
+//
+// return typename detail::tvec4<bool>::bool_type(x.x > y.x, x.y > y.y, x.z > y.z, x.w > y.w);
+//}
+//
+//// greaterThanEqual
+//template <typename valType>
+//GLM_FUNC_QUALIFIER typename detail::tvec2<valType>::bool_type greaterThanEqual
+//(
+// detail::tvec2<valType> const & x,
+// detail::tvec2<valType> const & y
+//)
+//{
+// GLM_STATIC_ASSERT(
+// detail::type<valType>::is_float ||
+// detail::type<valType>::is_int ||
+// detail::type<valType>::is_uint);
+//
+// return typename detail::tvec2<bool>::bool_type(x.x >= y.x, x.y >= y.y);
+//}
+//
+//template <typename valType>
+//GLM_FUNC_QUALIFIER typename detail::tvec3<valType>::bool_type greaterThanEqual
+//(
+// detail::tvec3<valType> const & x,
+// detail::tvec3<valType> const & y
+//)
+//{
+// GLM_STATIC_ASSERT(
+// detail::type<valType>::is_float ||
+// detail::type<valType>::is_int ||
+// detail::type<valType>::is_uint);
+//
+// return typename detail::tvec3<bool>::bool_type(x.x >= y.x, x.y >= y.y, x.z >= y.z);
+//}
+//
+//template <typename valType>
+//GLM_FUNC_QUALIFIER typename detail::tvec4<valType>::bool_type greaterThanEqual
+//(
+// detail::tvec4<valType> const & x,
+// detail::tvec4<valType> const & y
+//)
+//{
+// GLM_STATIC_ASSERT(
+// detail::type<valType>::is_float ||
+// detail::type<valType>::is_int ||
+// detail::type<valType>::is_uint);
+//
+// return typename detail::tvec4<bool>::bool_type(x.x >= y.x, x.y >= y.y, x.z >= y.z, x.w >= y.w);
+//}
+//
+//// equal
+//template <typename valType>
+//GLM_FUNC_QUALIFIER typename detail::tvec2<valType>::bool_type equal
+//(
+// detail::tvec2<valType> const & x,
+// detail::tvec2<valType> const & y
+//)
+//{
+// GLM_STATIC_ASSERT(
+// detail::type<valType>::is_float ||
+// detail::type<valType>::is_int ||
+// detail::type<valType>::is_uint ||
+// detail::type<valType>::is_bool);
+//
+// return typename detail::tvec2<valType>::bool_type(x.x == y.x, x.y == y.y);
+//}
+//
+//template <typename valType>
+//GLM_FUNC_QUALIFIER typename detail::tvec3<valType>::bool_type equal
+//(
+// detail::tvec3<valType> const & x,
+// detail::tvec3<valType> const & y
+//)
+//{
+// GLM_STATIC_ASSERT(
+// detail::type<valType>::is_float ||
+// detail::type<valType>::is_int ||
+// detail::type<valType>::is_uint ||
+// detail::type<valType>::is_bool);
+//
+// return typename detail::tvec3<valType>::bool_type(x.x == y.x, x.y == y.y, x.z == y.z);
+//}
+//
+//template <typename valType>
+//GLM_FUNC_QUALIFIER typename detail::tvec4<valType>::bool_type equal
+//(
+// detail::tvec4<valType> const & x,
+// detail::tvec4<valType> const & y
+//)
+//{
+// GLM_STATIC_ASSERT(
+// detail::type<valType>::is_float ||
+// detail::type<valType>::is_int ||
+// detail::type<valType>::is_uint ||
+// detail::type<valType>::is_bool);
+//
+// return typename detail::tvec4<valType>::bool_type(x.x == y.x, x.y == y.y, x.z == y.z, x.w == y.w);
+//}
+//
+//// notEqual
+//template <typename valType>
+//GLM_FUNC_QUALIFIER typename detail::tvec2<valType>::bool_type notEqual
+//(
+// detail::tvec2<valType> const & x,
+// detail::tvec2<valType> const & y
+//)
+//{
+// GLM_STATIC_ASSERT(
+// detail::type<valType>::is_float ||
+// detail::type<valType>::is_int ||
+// detail::type<valType>::is_uint ||
+// detail::type<valType>::is_bool);
+//
+// return typename detail::tvec2<valType>::bool_type(x.x != y.x, x.y != y.y);
+//}
+//
+//template <typename valType>
+//GLM_FUNC_QUALIFIER typename detail::tvec3<valType>::bool_type notEqual
+//(
+// detail::tvec3<valType> const & x,
+// detail::tvec3<valType> const & y
+//)
+//{
+// GLM_STATIC_ASSERT(
+// detail::type<valType>::is_float ||
+// detail::type<valType>::is_int ||
+// detail::type<valType>::is_uint ||
+// detail::type<valType>::is_bool);
+//
+// return typename detail::tvec3<valType>::bool_type(x.x != y.x, x.y != y.y, x.z != y.z);
+//}
+//
+//template <typename valType>
+//GLM_FUNC_QUALIFIER typename detail::tvec4<valType>::bool_type notEqual
+//(
+// detail::tvec4<valType> const & x,
+// detail::tvec4<valType> const & y
+//)
+//{
+// GLM_STATIC_ASSERT(
+// detail::type<valType>::is_float ||
+// detail::type<valType>::is_int ||
+// detail::type<valType>::is_uint ||
+// detail::type<valType>::is_bool);
+//
+// return typename detail::tvec4<valType>::bool_type(x.x != y.x, x.y != y.y, x.z != y.z, x.w != y.w);
+//}
+//
+//// any
+//GLM_FUNC_QUALIFIER bool any(detail::tvec2<bool> const & x)
+//{
+// return x.x || x.y;
+//}
+//
+//GLM_FUNC_QUALIFIER bool any(detail::tvec3<bool> const & x)
+//{
+// return x.x || x.y || x.z;
+//}
+//
+//GLM_FUNC_QUALIFIER bool any(detail::tvec4<bool> const & x)
+//{
+// return x.x || x.y || x.z || x.w;
+//}
+//
+//// all
+//GLM_FUNC_QUALIFIER bool all(const detail::tvec2<bool>& x)
+//{
+// return x.x && x.y;
+//}
+//
+//GLM_FUNC_QUALIFIER bool all(const detail::tvec3<bool>& x)
+//{
+// return x.x && x.y && x.z;
+//}
+//
+//GLM_FUNC_QUALIFIER bool all(const detail::tvec4<bool>& x)
+//{
+// return x.x && x.y && x.z && x.w;
+//}
+//
+//// not
+//GLM_FUNC_QUALIFIER detail::tvec2<bool>::bool_type not_
+//(
+// detail::tvec2<bool> const & v
+//)
+//{
+// return detail::tvec2<bool>::bool_type(!v.x, !v.y);
+//}
+//
+//GLM_FUNC_QUALIFIER detail::tvec3<bool>::bool_type not_
+//(
+// detail::tvec3<bool> const & v
+//)
+//{
+// return detail::tvec3<bool>::bool_type(!v.x, !v.y, !v.z);
+//}
+//
+//GLM_FUNC_QUALIFIER detail::tvec4<bool>::bool_type not_
+//(
+// detail::tvec4<bool> const & v
+//)
+//{
+// return detail::tvec4<bool>::bool_type(!v.x, !v.y, !v.z, !v.w);
+//} \ No newline at end of file
diff --git a/src/glm/core/setup.hpp b/src/glm/core/setup.hpp
new file mode 100644
index 0000000..05f68d4
--- /dev/null
+++ b/src/glm/core/setup.hpp
@@ -0,0 +1,480 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2006-11-13
+// Updated : 2011-01-26
+// Licence : This source is under MIT License
+// File : glm/setup.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_setup
+#define glm_setup
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Version
+
+#define GLM_VERSION 92
+#define GLM_VERSION_MAJOR 0
+#define GLM_VERSION_MINOR 9
+#define GLM_VERSION_PATCH 2
+#define GLM_VERSION_REVISION 3
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Compiler
+
+// User defines: GLM_FORCE_COMPILER_UNKNOWN
+// TODO ? __llvm__
+
+#define GLM_COMPILER_UNKNOWN 0x00000000
+
+// Visual C++ defines
+#define GLM_COMPILER_VC 0x01000000
+#define GLM_COMPILER_VC2 0x01000010
+#define GLM_COMPILER_VC4 0x01000020
+#define GLM_COMPILER_VC5 0x01000030
+#define GLM_COMPILER_VC6 0x01000040
+#define GLM_COMPILER_VC2002 0x01000050
+#define GLM_COMPILER_VC2003 0x01000060
+#define GLM_COMPILER_VC2005 0x01000070
+#define GLM_COMPILER_VC2008 0x01000080
+#define GLM_COMPILER_VC2010 0x01000090
+#define GLM_COMPILER_VC2011 0x010000A0
+
+// GCC defines
+#define GLM_COMPILER_GCC 0x02000000
+#define GLM_COMPILER_GCC_LLVM 0x02000001
+#define GLM_COMPILER_GCC_CLANG 0x02000002
+#define GLM_COMPILER_GCC30 0x02000010
+#define GLM_COMPILER_GCC31 0x02000020
+#define GLM_COMPILER_GCC32 0x02000030
+#define GLM_COMPILER_GCC33 0x02000040
+#define GLM_COMPILER_GCC34 0x02000050
+#define GLM_COMPILER_GCC35 0x02000060
+#define GLM_COMPILER_GCC40 0x02000070
+#define GLM_COMPILER_GCC41 0x02000080
+#define GLM_COMPILER_GCC42 0x02000090
+#define GLM_COMPILER_GCC43 0x020000A0
+#define GLM_COMPILER_GCC44 0x020000B0
+#define GLM_COMPILER_GCC45 0x020000C0
+#define GLM_COMPILER_GCC46 0x020000D0
+#define GLM_COMPILER_GCC47 0x020000E0
+#define GLM_COMPILER_GCC48 0x020000F0
+#define GLM_COMPILER_GCC49 0x02000100
+#define GLM_COMPILER_GCC50 0x02000200
+
+// G++ command line to display defined
+// echo "" | g++ -E -dM -x c++ - | sort
+
+// Borland C++ defines. How to identify BC?
+#define GLM_COMPILER_BC 0x04000000
+#define GLM_COMPILER_BCB4 0x04000100
+#define GLM_COMPILER_BCB5 0x04000200
+#define GLM_COMPILER_BCB6 0x04000300
+//#define GLM_COMPILER_BCBX 0x04000400 // What's the version value?
+#define GLM_COMPILER_BCB2009 0x04000500
+
+// CodeWarrior
+#define GLM_COMPILER_CODEWARRIOR 0x08000000
+
+// CUDA
+#define GLM_COMPILER_CUDA 0x10000000
+#define GLM_COMPILER_CUDA30 0x10000010
+#define GLM_COMPILER_CUDA31 0x10000020
+#define GLM_COMPILER_CUDA32 0x10000030
+#define GLM_COMPILER_CUDA40 0x10000040
+
+// Clang
+#define GLM_COMPILER_CLANG 0x20000000
+#define GLM_COMPILER_CLANG26 0x20000010
+#define GLM_COMPILER_CLANG27 0x20000020
+#define GLM_COMPILER_CLANG28 0x20000030
+#define GLM_COMPILER_CLANG29 0x20000040
+
+// LLVM GCC
+#define GLM_COMPILER_LLVM_GCC 0x40000000
+
+// Build model
+#define GLM_MODEL_32 0x00000010
+#define GLM_MODEL_64 0x00000020
+
+// Force generic C++ compiler
+#ifdef GLM_FORCE_COMPILER_UNKNOWN
+# define GLM_COMPILER GLM_COMPILER_UNKNOWN
+
+// CUDA
+#elif defined(__CUDACC__)
+# define GLM_COMPILER GLM_COMPILER_CUDA
+
+// Visual C++
+#elif defined(_MSC_VER)
+# if _MSC_VER == 900
+# define GLM_COMPILER GLM_COMPILER_VC2
+# elif _MSC_VER == 1000
+# define GLM_COMPILER GLM_COMPILER_VC4
+# elif _MSC_VER == 1100
+# define GLM_COMPILER GLM_COMPILER_VC5
+# elif _MSC_VER == 1200
+# define GLM_COMPILER GLM_COMPILER_VC6
+# elif _MSC_VER == 1300
+# define GLM_COMPILER GLM_COMPILER_VC2002
+# elif _MSC_VER == 1310
+# define GLM_COMPILER GLM_COMPILER_VC2003
+# elif _MSC_VER == 1400
+# define GLM_COMPILER GLM_COMPILER_VC2005
+# elif _MSC_VER == 1500
+# define GLM_COMPILER GLM_COMPILER_VC2008
+# elif _MSC_VER == 1600
+# define GLM_COMPILER GLM_COMPILER_VC2010
+# elif _MSC_VER == 1700
+# define GLM_COMPILER GLM_COMPILER_VC2011
+# else//_MSC_VER
+# define GLM_COMPILER GLM_COMPILER_VC
+# endif//_MSC_VER
+
+// G++
+#elif defined(__GNUC__) || defined(__llvm__) || defined(__clang__)
+# if defined (__llvm__)
+# define GLM_COMPILER_GCC_EXTRA GLM_COMPILER_GCC_LLVM
+# elif defined (__clang__)
+# define GLM_COMPILER_GCC_EXTRA GLM_COMPILER_GCC_CLANG
+# else
+# define GLM_COMPILER_GCC_EXTRA 0
+# endif
+#
+# if (__GNUC__ == 3) && (__GNUC_MINOR__ == 2)
+# define GLM_COMPILER GLM_COMPILER_GCC32
+# elif (__GNUC__ == 3) && (__GNUC_MINOR__ == 3)
+# define GLM_COMPILER GLM_COMPILER_GCC33
+# elif (__GNUC__ == 3) && (__GNUC_MINOR__ == 4)
+# define GLM_COMPILER GLM_COMPILER_GCC34
+# elif (__GNUC__ == 3) && (__GNUC_MINOR__ == 5)
+# define GLM_COMPILER GLM_COMPILER_GCC35
+# elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 0)
+# define GLM_COMPILER (GLM_COMPILER_GCC40 | GLM_COMPILER_GCC_EXTRA)
+# elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 1)
+# define GLM_COMPILER (GLM_COMPILER_GCC41 | GLM_COMPILER_GCC_EXTRA)
+# elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 2)
+# define GLM_COMPILER (GLM_COMPILER_GCC42 | GLM_COMPILER_GCC_EXTRA)
+# elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 3)
+# define GLM_COMPILER (GLM_COMPILER_GCC43 | GLM_COMPILER_GCC_EXTRA)
+# elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 4)
+# define GLM_COMPILER (GLM_COMPILER_GCC44 | GLM_COMPILER_GCC_EXTRA)
+# elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 5)
+# define GLM_COMPILER (GLM_COMPILER_GCC45 | GLM_COMPILER_GCC_EXTRA)
+# elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 6)
+# define GLM_COMPILER (GLM_COMPILER_GCC46 | GLM_COMPILER_GCC_EXTRA)
+# elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 7)
+# define GLM_COMPILER (GLM_COMPILER_GCC47 | GLM_COMPILER_GCC_EXTRA)
+# elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 8)
+# define GLM_COMPILER (GLM_COMPILER_GCC48 | GLM_COMPILER_GCC_EXTRA)
+# elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 9)
+# define GLM_COMPILER (GLM_COMPILER_GCC49 | GLM_COMPILER_GCC_EXTRA)
+# elif (__GNUC__ == 5) && (__GNUC_MINOR__ == 0)
+# define GLM_COMPILER (GLM_COMPILER_GCC50 | GLM_COMPILER_GCC_EXTRA)
+# else
+# define GLM_COMPILER (GLM_COMPILER_GCC | GLM_COMPILER_GCC_EXTRA)
+# endif
+
+// Borland C++
+#elif defined(_BORLANDC_)
+# if defined(VER125)
+# define GLM_COMPILER GLM_COMPILER_BCB4
+# elif defined(VER130)
+# define GLM_COMPILER GLM_COMPILER_BCB5
+# elif defined(VER140)
+# define GLM_COMPILER GLM_COMPILER_BCB6
+# elif defined(VER200)
+# define GLM_COMPILER GLM_COMPILER_BCB2009
+# else
+# define GLM_COMPILER GLM_COMPILER_BC
+# endif
+
+// Codewarrior
+#elif defined(__MWERKS__)
+# define GLM_COMPILER GLM_COMPILER_CODEWARRIOR
+
+#else
+# define GLM_COMPILER GLM_COMPILER_UNKNOWN
+#endif
+
+#ifndef GLM_COMPILER
+#error "GLM_COMPILER undefined, your compiler may not be supported by GLM. Add #define GLM_COMPILER 0 to ignore this message."
+#endif//GLM_COMPILER
+
+// Report compiler detection
+#if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_COMPILER_DISPLAYED))
+# define GLM_MESSAGE_COMPILER_DISPLAYED
+# if(GLM_COMPILER & GLM_COMPILER_CUDA)
+# pragma message("GLM: CUDA compiler detected")
+# elif(GLM_COMPILER & GLM_COMPILER_VC)
+# pragma message("GLM: Visual C++ compiler detected")
+# elif(GLM_COMPILER & GLM_COMPILER_CLANG)
+# pragma message("GLM: Clang compiler detected")
+# elif(GLM_COMPILER & GLM_COMPILER_LLVM_GCC)
+# pragma message("GLM: LLVM GCC compiler detected")
+# elif(GLM_COMPILER & GLM_COMPILER_GCC)
+# if(GLM_COMPILER == GLM_COMPILER_GCC_LLVM)
+# pragma message("GLM: LLVM GCC compiler detected")
+# elif(GLM_COMPILER == GLM_COMPILER_GCC_CLANG)
+# pragma message("GLM: CLANG compiler detected")
+# else
+# pragma message("GLM: GCC compiler detected")
+# endif
+# elif(GLM_COMPILER & GLM_COMPILER_BC)
+# pragma message("GLM: Borland compiler detected but not supported")
+# elif(GLM_COMPILER & GLM_COMPILER_CODEWARRIOR)
+# pragma message("GLM: Codewarrior compiler detected but not supported")
+# else
+# pragma message("GLM: Compiler not detected")
+# endif
+#endif//GLM_MESSAGE
+
+/////////////////
+// Build model //
+
+#if(GLM_COMPILER & GLM_COMPILER_VC)
+# if defined(_M_X64)
+# define GLM_MODEL GLM_MODEL_64
+# else
+# define GLM_MODEL GLM_MODEL_32
+# endif//_M_X64
+#elif(GLM_COMPILER & GLM_COMPILER_GCC)
+# if(defined(__WORDSIZE) && (__WORDSIZE == 64)) || defined(__arch64__) || defined(__LP64__) || defined(__x86_64__)
+# define GLM_MODEL GLM_MODEL_64
+# else
+# define GLM_MODEL GLM_MODEL_32
+# endif//
+#else
+# define GLM_MODEL GLM_MODEL_32
+#endif//
+
+#if(!defined(GLM_MODEL) && GLM_COMPILER != 0)
+#error "GLM_MODEL undefined, your compiler may not be supported by GLM. Add #define GLM_MODEL 0 to ignore this message."
+#endif//GLM_MODEL
+
+#if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_MODEL_DISPLAYED))
+# define GLM_MESSAGE_MODEL_DISPLAYED
+# if(GLM_MODEL == GLM_MODEL_64)
+# pragma message("GLM: 64 bits model")
+# elif(GLM_MODEL == GLM_MODEL_32)
+# pragma message("GLM: 32 bits model")
+# endif//GLM_MODEL
+#endif//GLM_MESSAGE
+
+/////////////////
+// C++ Version //
+
+// User defines: GLM_FORCE_CXX98
+
+#define GLM_LANG_CXX 0
+#define GLM_LANG_CXX98 1
+#define GLM_LANG_CXX0X 2
+#define GLM_LANG_CXXMS 3
+#define GLM_LANG_CXXGNU 4
+
+#if(defined(GLM_FORCE_CXX98))
+# define GLM_LANG GLM_LANG_CXX98
+#elif(((GLM_COMPILER & GLM_COMPILER_GCC) == GLM_COMPILER_GCC) && defined(__GXX_EXPERIMENTAL_CXX0X__)) // -std=c++0x or -std=gnu++0x
+# define GLM_LANG GLM_LANG_CXX0X
+#elif(GLM_COMPILER == GLM_COMPILER_VC2010) //_MSC_EXTENSIONS for MS language extensions
+# define GLM_LANG GLM_LANG_CXX0X
+#elif(((GLM_COMPILER & GLM_COMPILER_GCC) == GLM_COMPILER_GCC) && defined(__STRICT_ANSI__))
+# define GLM_LANG GLM_LANG_CXX98
+#elif(((GLM_COMPILER & GLM_COMPILER_VC) == GLM_COMPILER_VC) && !defined(_MSC_EXTENSIONS))
+# define GLM_LANG GLM_LANG_CXX98
+#else
+# define GLM_LANG GLM_LANG_CXX
+#endif
+
+#if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_LANG_DISPLAYED))
+# define GLM_MESSAGE_LANG_DISPLAYED
+# if(GLM_LANG == GLM_LANG_CXX98)
+# pragma message("GLM: C++98")
+# elif(GLM_LANG == GLM_LANG_CXX0X)
+# pragma message("GLM: C++0x")
+# endif//GLM_MODEL
+#endif//GLM_MESSAGE
+
+/////////////////
+// Platform
+
+// User defines: GLM_FORCE_PURE GLM_FORCE_SSE2 GLM_FORCE_AVX
+
+#define GLM_ARCH_PURE 0x0000 //(0x0000)
+#define GLM_ARCH_SSE2 0x0001 //(0x0001)
+#define GLM_ARCH_SSE3 0x0003 //(0x0002 | GLM_ARCH_SSE2)
+#define GLM_ARCH_AVX 0x0007 //(0x0004 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
+
+#if(defined(GLM_FORCE_PURE))
+# define GLM_ARCH GLM_ARCH_PURE
+#elif(defined(GLM_FORCE_AVX))
+# define GLM_ARCH GLM_ARCH_AVX
+#elif(defined(GLM_FORCE_SSE3))
+# define GLM_ARCH GLM_ARCH_SSE3
+#elif(defined(GLM_FORCE_SSE2))
+# define GLM_ARCH GLM_ARCH_SSE2
+#elif((GLM_COMPILER & GLM_COMPILER_VC) && (defined(_M_IX86) || defined(_M_X64)))
+# if(defined(_M_CEE_PURE))
+# define GLM_ARCH GLM_ARCH_PURE
+# elif(GLM_COMPILER >= GLM_COMPILER_VC2010)
+# if(_MSC_FULL_VER >= 160031118) //160031118: VC2010 SP1 beta full version
+# define GLM_ARCH GLM_ARCH_AVX //GLM_ARCH_AVX (Require SP1)
+# else
+# define GLM_ARCH GLM_ARCH_SSE3
+# endif
+# elif(GLM_COMPILER >= GLM_COMPILER_VC2008)
+# define GLM_ARCH GLM_ARCH_SSE3
+# elif(GLM_COMPILER >= GLM_COMPILER_VC2005)
+# define GLM_ARCH GLM_ARCH_SSE2
+# else
+# define GLM_ARCH GLM_ARCH_PURE
+# endif
+#elif(GLM_COMPILER & GLM_COMPILER_LLVM_GCC)
+# if(defined(__AVX__))
+# define GLM_ARCH GLM_ARCH_AVX
+# elif(defined(__SSE3__))
+# define GLM_ARCH GLM_ARCH_SSE3
+# elif(defined(__SSE2__))
+# define GLM_ARCH GLM_ARCH_SSE2
+# else
+# define GLM_ARCH GLM_ARCH_PURE
+# endif
+#elif((GLM_COMPILER & GLM_COMPILER_GCC) && (defined(__i386__) || defined(__x86_64__)))
+# if(defined(__AVX__))
+# define GLM_ARCH GLM_ARCH_AVX
+# elif(defined(__SSE3__))
+# define GLM_ARCH GLM_ARCH_SSE3
+# elif(defined(__SSE2__))
+# define GLM_ARCH GLM_ARCH_SSE2
+# else
+# define GLM_ARCH GLM_ARCH_PURE
+# endif
+#else
+# define GLM_ARCH GLM_ARCH_PURE
+#endif
+
+#if(GLM_ARCH != GLM_ARCH_PURE)
+#if((GLM_ARCH & GLM_ARCH_AVX) == GLM_ARCH_AVX)
+# include <immintrin.h>
+#endif//GLM_ARCH
+#if((GLM_ARCH & GLM_ARCH_SSE3) == GLM_ARCH_SSE3)
+# include <pmmintrin.h>
+#endif//GLM_ARCH
+#if((GLM_ARCH & GLM_ARCH_SSE2) == GLM_ARCH_SSE2)
+# include <emmintrin.h>
+#endif//GLM_ARCH
+#endif//(GLM_ARCH != GLM_ARCH_PURE)
+
+#if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_ARCH_DISPLAYED))
+# define GLM_MESSAGE_ARCH_DISPLAYED
+# if(GLM_ARCH == GLM_ARCH_PURE)
+# pragma message("GLM: Platform independent")
+# elif(GLM_ARCH == GLM_ARCH_SSE2)
+# pragma message("GLM: SSE2 build platform")
+# elif(GLM_ARCH == GLM_ARCH_SSE3)
+# pragma message("GLM: SSE3 build platform")
+# elif(GLM_ARCH == GLM_ARCH_AVX)
+# pragma message("GLM: AVX build platform")
+# endif//GLM_ARCH
+#endif//GLM_MESSAGE
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Components
+
+//#define GLM_FORCE_ONLY_XYZW
+#define GLM_COMPONENT_GLSL_NAMES 0
+#define GLM_COMPONENT_ONLY_XYZW 1 // To disable multiple vector component names access.
+#define GLM_COMPONENT_MS_EXT 2 // To use anonymous union to provide multiple component names access for class valType. Visual C++ only.
+
+#ifndef GLM_FORCE_ONLY_XYZW
+# if((GLM_COMPILER & GLM_COMPILER_VC) && defined(_MSC_EXTENSIONS))
+# define GLM_COMPONENT GLM_COMPONENT_MS_EXT
+# else
+# define GLM_COMPONENT GLM_COMPONENT_GLSL_NAMES
+# endif
+#else
+# define GLM_COMPONENT GLM_COMPONENT_ONLY_XYZW
+#endif
+
+#if((GLM_COMPONENT == GLM_COMPONENT_MS_EXT) && !(GLM_COMPILER & GLM_COMPILER_VC))
+# error "GLM_COMPONENT value is GLM_COMPONENT_MS_EXT but this is not allowed with the current compiler."
+#endif
+
+#if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_COMPONENT_DISPLAYED))
+# define GLM_MESSAGE_COMPONENT_DISPLAYED
+# if(GLM_COMPONENT == GLM_COMPONENT_GLSL_NAMES)
+# pragma message("GLM: GLSL multiple vector component names")
+# elif(GLM_COMPONENT == GLM_COMPONENT_ONLY_XYZW)
+# pragma message("GLM: x,y,z,w vector component names only")
+# elif(GLM_COMPONENT == GLM_COMPONENT_MS_EXT)
+# pragma message("GLM: Multiple vector component names through Visual C++ language extensions")
+# else
+# error "GLM_COMPONENT value unknown"
+# endif//GLM_MESSAGE_COMPONENT_DISPLAYED
+#endif//GLM_MESSAGE
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Static assert
+
+#if(GLM_LANG == GLM_LANG_CXX0X)
+# define GLM_STATIC_ASSERT(x, message) static_assert(x, message)
+#elif(defined(BOOST_STATIC_ASSERT))
+# define GLM_STATIC_ASSERT(x, message) BOOST_STATIC_ASSERT(x)
+#elif(GLM_COMPILER & GLM_COMPILER_VC)
+# define GLM_STATIC_ASSERT(x, message) typedef char __CASSERT__##__LINE__[(x) ? 1 : -1]
+#else
+# define GLM_STATIC_ASSERT(x, message)
+# define GLM_STATIC_ASSERT_NULL
+#endif//GLM_LANG
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Qualifiers
+
+// User defines: GLM_FORCE_INLINE GLM_FORCE_CUDA
+
+#if(defined(GLM_FORCE_CUDA) || (GLM_COMPILER & GLM_COMPILER_CUDA))
+# define GLM_CUDA_FUNC_DEF __device__ __host__
+# define GLM_CUDA_FUNC_DECL __device__ __host__
+#else
+# define GLM_CUDA_FUNC_DEF
+# define GLM_CUDA_FUNC_DECL
+#endif
+
+#if GLM_COMPILER & GLM_COMPILER_GCC
+#define GLM_VAR_USED __attribute__ ((unused))
+#else
+#define GLM_VAR_USED
+#endif
+
+#if(defined(GLM_FORCE_INLINE))
+# if((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2005))
+# define GLM_INLINE __forceinline
+# elif((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC34))
+# define GLM_INLINE __attribute__((always_inline))
+# else
+# define GLM_INLINE inline
+# endif//GLM_COMPILER
+#else
+# define GLM_INLINE inline
+#endif//defined(GLM_FORCE_INLINE)
+
+#define GLM_FUNC_DECL GLM_CUDA_FUNC_DECL
+#define GLM_FUNC_QUALIFIER GLM_CUDA_FUNC_DEF GLM_INLINE
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Swizzle operators
+
+// User defines: GLM_SWIZZLE_XYZW GLM_SWIZZLE_RGBA GLM_SWIZZLE_STQP GLM_SWIZZLE
+
+#if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_SWIZZLE_DISPLAYED))
+# define GLM_MESSAGE_SWIZZLE_DISPLAYED
+# if(defined(GLM_SWIZZLE))
+# pragma message("GLM: Full swizzling operator enabled")
+# elif(!defined(GLM_SWIZZLE_XYZW) && !defined(GLM_SWIZZLE_RGBA) && !defined(GLM_SWIZZLE_STQP) && !defined(GLM_SWIZZLE))
+# pragma message("GLM: No swizzling operator enabled")
+# else
+# pragma message("GLM: Partial swizzling operator enabled")
+# endif
+#endif//GLM_MESSAGE
+
+#endif//glm_setup
diff --git a/src/glm/core/type.hpp b/src/glm/core/type.hpp
new file mode 100644
index 0000000..25585cb
--- /dev/null
+++ b/src/glm/core/type.hpp
@@ -0,0 +1,322 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2008-01-08
+// Updated : 2008-01-08
+// Licence : This source is under MIT License
+// File : glm/core/type.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_core_type
+#define glm_core_type
+
+#include "type_half.hpp"
+#include "type_float.hpp"
+#include "type_int.hpp"
+
+#include "type_gentype.hpp"
+
+#include "type_vec1.hpp"
+#include "type_vec2.hpp"
+#include "type_vec3.hpp"
+#include "type_vec4.hpp"
+
+#include "type_mat2x2.hpp"
+#include "type_mat2x3.hpp"
+#include "type_mat2x4.hpp"
+#include "type_mat3x2.hpp"
+#include "type_mat3x3.hpp"
+#include "type_mat3x4.hpp"
+#include "type_mat4x2.hpp"
+#include "type_mat4x3.hpp"
+#include "type_mat4x4.hpp"
+
+namespace glm{
+namespace core{
+namespace type
+{
+ //////////////////////////
+ // Float definition
+
+#if(defined(GLM_PRECISION_HIGHP_FLOAT))
+ typedef precision::highp_vec2 vec2;
+ typedef precision::highp_vec3 vec3;
+ typedef precision::highp_vec4 vec4;
+ typedef precision::highp_mat2x2 mat2x2;
+ typedef precision::highp_mat2x3 mat2x3;
+ typedef precision::highp_mat2x4 mat2x4;
+ typedef precision::highp_mat3x2 mat3x2;
+ typedef precision::highp_mat3x3 mat3x3;
+ typedef precision::highp_mat3x4 mat3x4;
+ typedef precision::highp_mat4x2 mat4x2;
+ typedef precision::highp_mat4x3 mat4x3;
+ typedef precision::highp_mat4x4 mat4x4;
+#elif(defined(GLM_PRECISION_MEDIUMP_FLOAT))
+ typedef precision::mediump_vec2 vec2;
+ typedef precision::mediump_vec3 vec3;
+ typedef precision::mediump_vec4 vec4;
+ typedef precision::mediump_mat2x2 mat2x2;
+ typedef precision::mediump_mat2x3 mat2x3;
+ typedef precision::mediump_mat2x4 mat2x4;
+ typedef precision::mediump_mat3x2 mat3x2;
+ typedef precision::mediump_mat3x3 mat3x3;
+ typedef precision::mediump_mat3x4 mat3x4;
+ typedef precision::mediump_mat4x2 mat4x2;
+ typedef precision::mediump_mat4x3 mat4x3;
+ typedef precision::mediump_mat4x4 mat4x4;
+#elif(defined(GLM_PRECISION_LOWP_FLOAT))
+ typedef precision::lowp_vec2 vec2;
+ typedef precision::lowp_vec3 vec3;
+ typedef precision::lowp_vec4 vec4;
+ typedef precision::lowp_mat2x2 mat2x2;
+ typedef precision::lowp_mat2x3 mat2x3;
+ typedef precision::lowp_mat2x4 mat2x4;
+ typedef precision::lowp_mat3x2 mat3x2;
+ typedef precision::lowp_mat3x3 mat3x3;
+ typedef precision::lowp_mat3x4 mat3x4;
+ typedef precision::lowp_mat4x2 mat4x2;
+ typedef precision::lowp_mat4x3 mat4x3;
+ typedef precision::lowp_mat4x4 mat4x4;
+#else
+ //! 2 components vector of floating-point numbers.
+ //! From GLSL 1.30.8 specification, section 4.1.5 Vectors.
+ //! \ingroup core_types
+ typedef precision::mediump_vec2 vec2;
+
+ //! 3 components vector of floating-point numbers.
+ //! From GLSL 1.30.8 specification, section 4.1.5 Vectors.
+ //! \ingroup core_types
+ typedef precision::mediump_vec3 vec3;
+
+ //! 4 components vector of floating-point numbers.
+ //! From GLSL 1.30.8 specification, section 4.1.5 Vectors.
+ //! \ingroup core_types
+ typedef precision::mediump_vec4 vec4;
+
+ //! 2 columns of 2 components matrix of floating-point numbers.
+ //! (From GLSL 1.30.8 specification, section 4.1.6 Matrices)
+ //! \ingroup core_types
+ typedef precision::mediump_mat2x2 mat2x2;
+
+ //! 2 columns of 3 components matrix of floating-point numbers.
+ //! (From GLSL 1.30.8 specification, section 4.1.6 Matrices)
+ //! \ingroup core_types
+ typedef precision::mediump_mat2x3 mat2x3;
+
+ //! 2 columns of 4 components matrix of floating-point numbers.
+ //! (From GLSL 1.30.8 specification, section 4.1.6 Matrices)
+ //! \ingroup core_types
+ typedef precision::mediump_mat2x4 mat2x4;
+
+ //! 3 columns of 2 components matrix of floating-point numbers.
+ //! (From GLSL 1.30.8 specification, section 4.1.6 Matrices)
+ //! \ingroup core_types
+ typedef precision::mediump_mat3x2 mat3x2;
+
+ //! 3 columns of 3 components matrix of floating-point numbers.
+ //! (From GLSL 1.30.8 specification, section 4.1.6 Matrices)
+ //! \ingroup core_types
+ typedef precision::mediump_mat3x3 mat3x3;
+
+ //! 3 columns of 4 components matrix of floating-point numbers.
+ //! (From GLSL 1.30.8 specification, section 4.1.6 Matrices)
+ //! \ingroup core_types
+ typedef precision::mediump_mat3x4 mat3x4;
+
+ //! 4 columns of 2 components matrix of floating-point numbers.
+ //! (From GLSL 1.30.8 specification, section 4.1.6 Matrices)
+ //! \ingroup core_types
+ typedef precision::mediump_mat4x2 mat4x2;
+
+ //! 4 columns of 3 components matrix of floating-point numbers.
+ //! (From GLSL 1.30.8 specification, section 4.1.6 Matrices)
+ //! \ingroup core_types
+ typedef precision::mediump_mat4x3 mat4x3;
+
+ //! 4 columns of 4 components matrix of floating-point numbers.
+ //! (From GLSL 1.30.8 specification, section 4.1.6 Matrices)
+ //! \ingroup core_types
+ typedef precision::mediump_mat4x4 mat4x4;
+
+#endif//GLM_PRECISION
+
+ //! 2 columns of 2 components matrix of floating-point numbers.
+ //! (From GLSL 1.30.8 specification, section 4.1.6 Matrices)
+ //! \ingroup core_types
+ typedef mat2x2 mat2;
+
+ //! 3 columns of 3 components matrix of floating-point numbers.
+ //! (From GLSL 1.30.8 specification, section 4.1.6 Matrices)
+ //! \ingroup core_types
+ typedef mat3x3 mat3;
+
+ //! 4 columns of 4 components matrix of floating-point numbers.
+ //! (From GLSL 1.30.8 specification, section 4.1.6 Matrices)
+ //! \ingroup core_types
+ typedef mat4x4 mat4;
+
+ //////////////////////////
+ // Signed integer definition
+
+#if(defined(GLM_PRECISION_HIGHP_INT))
+ typedef precision::highp_ivec2 ivec2;
+ typedef precision::highp_ivec3 ivec3;
+ typedef precision::highp_ivec4 ivec4;
+#elif(defined(GLM_PRECISION_MEDIUMP_INT))
+ typedef precision::mediump_ivec2 ivec2;
+ typedef precision::mediump_ivec3 ivec3;
+ typedef precision::mediump_ivec4 ivec4;
+#elif(defined(GLM_PRECISION_LOWP_INT))
+ typedef precision::lowp_ivec2 ivec2;
+ typedef precision::lowp_ivec3 ivec3;
+ typedef precision::lowp_ivec4 ivec4;
+#else
+ //! 2 components vector of signed integer numbers.
+ //! From GLSL 1.30.8 specification, section 4.1.5 Vectors.
+ //! \ingroup core_types
+ typedef precision::mediump_ivec2 ivec2;
+
+ //! 3 components vector of signed integer numbers.
+ //! From GLSL 1.30.8 specification, section 4.1.5 Vectors.
+ //! \ingroup core_types
+ typedef precision::mediump_ivec3 ivec3;
+
+ //! 4 components vector of signed integer numbers.
+ //! From GLSL 1.30.8 specification, section 4.1.5 Vectors.
+ //! \ingroup core_types
+ typedef precision::mediump_ivec4 ivec4;
+#endif//GLM_PRECISION
+
+ //////////////////////////
+ // Unsigned integer definition
+
+#if(defined(GLM_PRECISION_HIGHP_UINT))
+ typedef precision::highp_uvec2 uvec2;
+ typedef precision::highp_uvec3 uvec3;
+ typedef precision::highp_uvec4 uvec4;
+#elif(defined(GLM_PRECISION_MEDIUMP_UINT))
+ typedef precision::mediump_uvec2 uvec2;
+ typedef precision::mediump_uvec3 uvec3;
+ typedef precision::mediump_uvec4 uvec4;
+#elif(defined(GLM_PRECISION_LOWP_UINT))
+ typedef precision::lowp_uvec2 uvec2;
+ typedef precision::lowp_uvec3 uvec3;
+ typedef precision::lowp_uvec4 uvec4;
+#else
+ //! 2 components vector of unsigned integer numbers.
+ //! From GLSL 1.30.8 specification, section 4.1.5 Vectors.
+ //! \ingroup core_types
+ typedef precision::mediump_uvec2 uvec2;
+
+ //! 3 components vector of unsigned integer numbers.
+ //! From GLSL 1.30.8 specification, section 4.1.5 Vectors.
+ //! \ingroup core_types
+ typedef precision::mediump_uvec3 uvec3;
+
+ //! 4 components vector of unsigned integer numbers.
+ //! From GLSL 1.30.8 specification, section 4.1.5 Vectors.
+ //! \ingroup core_types
+ typedef precision::mediump_uvec4 uvec4;
+#endif//GLM_PRECISION
+
+ //////////////////////////
+ // Boolean definition
+
+ //! 2 components vector of boolean.
+ //! From GLSL 1.30.8 specification, section 4.1.5 Vectors.
+ //! \ingroup core_types
+ typedef detail::tvec2<bool> bvec2;
+
+ //! 3 components vector of boolean.
+ //! From GLSL 1.30.8 specification, section 4.1.5 Vectors.
+ //! \ingroup core_types
+ typedef detail::tvec3<bool> bvec3;
+
+ //! 4 components vector of boolean.
+ //! From GLSL 1.30.8 specification, section 4.1.5 Vectors.
+ //! \ingroup core_types
+ typedef detail::tvec4<bool> bvec4;
+
+ //////////////////////////
+ // Double definition
+
+ //! Vector of 2 double-precision floating-point numbers.
+ //! From GLSL 4.00.8 specification, section 4.1 Basic Types.
+ //! \ingroup core_types
+ typedef detail::tvec2<double> dvec2;
+
+ //! Vector of 3 double-precision floating-point numbers.
+ //! From GLSL 4.00.8 specification, section 4.1 Basic Types.
+ //! \ingroup core_types
+ typedef detail::tvec3<double> dvec3;
+
+ //! Vector of 4 double-precision floating-point numbers.
+ //! From GLSL 4.00.8 specification, section 4.1 Basic Types.
+ //! \ingroup core_types
+ typedef detail::tvec4<double> dvec4;
+
+ //! 2 * 2 matrix of double-precision floating-point numbers.
+ //! From GLSL 4.00.8 specification, section 4.1 Basic Types.
+ //! \ingroup core_types
+ typedef detail::tmat2x2<double> dmat2;
+
+ //! 3 * 3 matrix of double-precision floating-point numbers.
+ //! From GLSL 4.00.8 specification, section 4.1 Basic Types.
+ //! \ingroup core_types
+ typedef detail::tmat3x3<double> dmat3;
+
+ //! 4 * 4 matrix of double-precision floating-point numbers.
+ //! From GLSL 4.00.8 specification, section 4.1 Basic Types.
+ //! \ingroup core_types
+ typedef detail::tmat4x4<double> dmat4;
+
+ //! 2 * 2 matrix of double-precision floating-point numbers.
+ //! From GLSL 4.00.8 specification, section 4.1 Basic Types.
+ //! \ingroup core_types
+ typedef detail::tmat2x2<double> dmat2x2;
+
+ //! 2 * 3 matrix of double-precision floating-point numbers.
+ //! From GLSL 4.00.8 specification, section 4.1 Basic Types.
+ //! \ingroup core_types
+ typedef detail::tmat2x3<double> dmat2x3;
+
+ //! 2 * 4 matrix of double-precision floating-point numbers.
+ //! From GLSL 4.00.8 specification, section 4.1 Basic Types.
+ //! \ingroup core_types
+ typedef detail::tmat2x4<double> dmat2x4;
+
+ //! 3 * 2 matrix of double-precision floating-point numbers.
+ //! From GLSL 4.00.8 specification, section 4.1 Basic Types.
+ //! \ingroup core_types
+ typedef detail::tmat3x2<double> dmat3x2;
+
+ //! 3 * 3 matrix of double-precision floating-point numbers.
+ //! From GLSL 4.00.8 specification, section 4.1 Basic Types.
+ //! \ingroup core_types
+ typedef detail::tmat3x3<double> dmat3x3;
+
+ //! 3 * 4 matrix of double-precision floating-point numbers.
+ //! From GLSL 4.00.8 specification, section 4.1 Basic Types.
+ //! \ingroup core_types
+ typedef detail::tmat3x4<double> dmat3x4;
+
+ //! 4 * 2 matrix of double-precision floating-point numbers.
+ //! From GLSL 4.00.8 specification, section 4.1 Basic Types.
+ //! \ingroup core_types
+ typedef detail::tmat4x2<double> dmat4x2;
+
+ //! 4 * 3 matrix of double-precision floating-point numbers.
+ //! From GLSL 4.00.8 specification, section 4.1 Basic Types.
+ //! \ingroup core_types
+ typedef detail::tmat4x3<double> dmat4x3;
+
+ //! 4 * 4 matrix of double-precision floating-point numbers.
+ //! From GLSL 4.00.8 specification, section 4.1 Basic Types.
+ //! \ingroup core_types
+ typedef detail::tmat4x4<double> dmat4x4;
+
+}//namespace type
+}//namespace core
+}//namespace glm
+
+#endif//glm_core_type
diff --git a/src/glm/core/type_float.hpp b/src/glm/core/type_float.hpp
new file mode 100644
index 0000000..1d96eae
--- /dev/null
+++ b/src/glm/core/type_float.hpp
@@ -0,0 +1,74 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2008-08-22
+// Updated : 2010-02-08
+// Licence : This source is under MIT License
+// File : glm/core/type_float.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_core_type_float
+#define glm_core_type_float
+
+#include "type_half.hpp"
+#include "setup.hpp"
+
+namespace glm
+{
+ namespace detail
+ {
+ GLM_DETAIL_IS_FLOAT(detail::thalf);
+ GLM_DETAIL_IS_FLOAT(float);
+ GLM_DETAIL_IS_FLOAT(double);
+ GLM_DETAIL_IS_FLOAT(long double);
+ }
+ //namespace detail
+
+ namespace core{
+ namespace type{
+
+ namespace precision
+ {
+#ifdef GLM_USE_HALF_SCALAR
+ typedef detail::thalf lowp_float_t;
+#else//GLM_USE_HALF_SCALAR
+ typedef float lowp_float_t;
+#endif//GLM_USE_HALF_SCALAR
+ typedef float mediump_float_t;
+ typedef double highp_float_t;
+
+ //! Low precision floating-point numbers.
+ //! There is no guarantee on the actual precision.
+ //! From GLSL 1.30.8 specification
+ //! \ingroup core_precision
+ typedef lowp_float_t lowp_float;
+ //! Medium precision floating-point numbers.
+ //! There is no guarantee on the actual precision.
+ //! From GLSL 1.30.8 specification
+ //! \ingroup core_precision
+ typedef mediump_float_t mediump_float;
+ //! High precision floating-point numbers.
+ //! There is no guarantee on the actual precision.
+ //! From GLSL 1.30.8 specification
+ //! \ingroup core_precision
+ typedef highp_float_t highp_float;
+ }
+ //namespace precision
+
+#if(!defined(GLM_PRECISION_HIGHP_FLOAT) && !defined(GLM_PRECISION_MEDIUMP_FLOAT) && !defined(GLM_PRECISION_LOWP_FLOAT))
+ typedef precision::mediump_float float_t;
+#elif(defined(GLM_PRECISION_HIGHP_FLOAT) && !defined(GLM_PRECISION_MEDIUMP_FLOAT) && !defined(GLM_PRECISION_LOWP_FLOAT))
+ typedef precision::highp_float float_t;
+#elif(!defined(GLM_PRECISION_HIGHP_FLOAT) && defined(GLM_PRECISION_MEDIUMP_FLOAT) && !defined(GLM_PRECISION_LOWP_FLOAT))
+ typedef precision::mediump_float float_t;
+#elif(!defined(GLM_PRECISION_HIGHP_FLOAT) && !defined(GLM_PRECISION_MEDIUMP_FLOAT) && defined(GLM_PRECISION_LOWP_FLOAT))
+ typedef precision::lowp_float float_t;
+#else
+# error "GLM error: multiple default precision requested for floating-point types"
+#endif
+
+ }//namespace type
+ }//namespace core
+}//namespace glm
+
+#endif//glm_core_type_float
diff --git a/src/glm/core/type_gentype.hpp b/src/glm/core/type_gentype.hpp
new file mode 100644
index 0000000..3b59b2c
--- /dev/null
+++ b/src/glm/core/type_gentype.hpp
@@ -0,0 +1,150 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2008-10-05
+// Updated : 2010-01-26
+// Licence : This source is under MIT License
+// File : glm/core/type_gentype.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_core_type_gentype
+#define glm_core_type_gentype
+
+#include "type_size.hpp"
+
+namespace glm
+{
+ enum profile
+ {
+ nice,
+ fast,
+ simd
+ };
+
+namespace detail
+{
+ template
+ <
+ typename VALTYPE,
+ template <typename> class TYPE
+ >
+ struct genType
+ {
+ public:
+ enum ctor{null};
+
+ typedef VALTYPE value_type;
+ typedef VALTYPE & value_reference;
+ typedef VALTYPE * value_pointer;
+ typedef VALTYPE const * value_const_pointer;
+ typedef TYPE<bool> bool_type;
+
+ typedef sizeType size_type;
+ static bool is_vector();
+ static bool is_matrix();
+
+ typedef TYPE<VALTYPE> type;
+ typedef TYPE<VALTYPE> * pointer;
+ typedef TYPE<VALTYPE> const * const_pointer;
+ typedef TYPE<VALTYPE> const * const const_pointer_const;
+ typedef TYPE<VALTYPE> * const pointer_const;
+ typedef TYPE<VALTYPE> & reference;
+ typedef TYPE<VALTYPE> const & const_reference;
+ typedef TYPE<VALTYPE> const & param_type;
+
+ //////////////////////////////////////
+ // Address (Implementation details)
+
+ value_const_pointer value_address() const{return value_pointer(this);}
+ value_pointer value_address(){return value_pointer(this);}
+
+ //protected:
+ // enum kind
+ // {
+ // GEN_TYPE,
+ // VEC_TYPE,
+ // MAT_TYPE
+ // };
+
+ // typedef typename TYPE::kind kind;
+ };
+
+ template
+ <
+ typename VALTYPE,
+ template <typename> class TYPE
+ >
+ bool genType<VALTYPE, TYPE>::is_vector()
+ {
+ return true;
+ }
+/*
+ template <typename valTypeT, unsigned int colT, unsigned int rowT, profile proT = nice>
+ class base
+ {
+ public:
+ //////////////////////////////////////
+ // Traits
+
+ typedef sizeType size_type;
+ typedef valTypeT value_type;
+
+ typedef base<value_type, colT, rowT> class_type;
+
+ typedef base<bool, colT, rowT> bool_type;
+ typedef base<value_type, rowT, 1> col_type;
+ typedef base<value_type, colT, 1> row_type;
+ typedef base<value_type, rowT, colT> transpose_type;
+
+ static size_type col_size();
+ static size_type row_size();
+ static size_type value_size();
+ static bool is_scalar();
+ static bool is_vector();
+ static bool is_matrix();
+
+ private:
+ // Data
+ col_type value[colT];
+
+ public:
+ //////////////////////////////////////
+ // Constructors
+ base();
+ base(class_type const & m);
+
+ explicit base(value_type const & x);
+ explicit base(value_type const * const x);
+ explicit base(col_type const * const x);
+
+ //////////////////////////////////////
+ // Conversions
+ template <typename vU, uint cU, uint rU, profile pU>
+ explicit base(base<vU, cU, rU, pU> const & m);
+
+ //////////////////////////////////////
+ // Accesses
+ col_type& operator[](size_type i);
+ col_type const & operator[](size_type i) const;
+
+ //////////////////////////////////////
+ // Unary updatable operators
+ class_type& operator= (class_type const & x);
+ class_type& operator+= (value_type const & x);
+ class_type& operator+= (class_type const & x);
+ class_type& operator-= (value_type const & x);
+ class_type& operator-= (class_type const & x);
+ class_type& operator*= (value_type const & x);
+ class_type& operator*= (class_type const & x);
+ class_type& operator/= (value_type const & x);
+ class_type& operator/= (class_type const & x);
+ class_type& operator++ ();
+ class_type& operator-- ();
+ };
+*/
+ }//namespace detail
+}//namespace glm
+
+//#include "type_gentype.inl"
+
+#endif//glm_core_type_gentype
diff --git a/src/glm/core/type_gentype.inl b/src/glm/core/type_gentype.inl
new file mode 100644
index 0000000..ab2e18f
--- /dev/null
+++ b/src/glm/core/type_gentype.inl
@@ -0,0 +1,347 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2008-10-05
+// Updated : 2008-10-05
+// Licence : This source is under MIT License
+// File : glm/core/type_gentype.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm{
+namespace detail{
+
+/////////////////////////////////
+// Static functions
+
+template <typename vT, uint cT, uint rT, profile pT>
+typename base<vT, cT, rT, pT>::size_type base<vT, cT, rT, pT>::col_size()
+{
+ return cT;
+}
+
+template <typename vT, uint cT, uint rT, profile pT>
+typename base<vT, cT, rT, pT>::size_type base<vT, cT, rT, pT>::row_size()
+{
+ return rT;
+}
+
+template <typename vT, uint cT, uint rT, profile pT>
+typename base<vT, cT, rT, pT>::size_type base<vT, cT, rT, pT>::value_size()
+{
+ return rT * cT;
+}
+
+template <typename vT, uint cT, uint rT, profile pT>
+bool base<vT, cT, rT, pT>::is_scalar()
+{
+ return rT == 1 && cT == 1;
+}
+
+template <typename vT, uint cT, uint rT, profile pT>
+bool base<vT, cT, rT, pT>::is_vector()
+{
+ return rT == 1;
+}
+
+template <typename vT, uint cT, uint rT, profile pT>
+bool base<vT, cT, rT, pT>::is_matrix()
+{
+ return rT != 1;
+}
+
+/////////////////////////////////
+// Constructor
+
+template <typename vT, uint cT, uint rT, profile pT>
+base<vT, cT, rT, pT>::base()
+{
+ memset(&this->value, 0, cT * rT * sizeof(vT));
+}
+
+template <typename vT, uint cT, uint rT, profile pT>
+base<vT, cT, rT, pT>::base
+(
+ typename base<vT, cT, rT, pT>::class_type const & m
+)
+{
+ for
+ (
+ typename genType<vT, cT, rT, pT>::size_type i = typename base<vT, cT, rT, pT>::size_type(0);
+ i < base<vT, cT, rT, pT>::col_size();
+ ++i
+ )
+ {
+ this->value[i] = m[i];
+ }
+}
+
+template <typename vT, uint cT, uint rT, profile pT>
+base<vT, cT, rT, pT>::base
+(
+ typename base<vT, cT, rT, pT>::value_type const & x
+)
+{
+ if(rT == 1) // vector
+ {
+ for
+ (
+ typename base<vT, cT, rT, pT>::size_type i = typename base<vT, cT, rT, pT>::size_type(0);
+ i < base<vT, cT, rT, pT>::col_size();
+ ++i
+ )
+ {
+ this->value[i][rT] = x;
+ }
+ }
+ else // matrix
+ {
+ memset(&this->value, 0, cT * rT * sizeof(vT));
+
+ typename base<vT, cT, rT, pT>::size_type stop = cT < rT ? cT : rT;
+
+ for
+ (
+ typename base<vT, cT, rT, pT>::size_type i = typename base<vT, cT, rT, pT>::size_type(0);
+ i < stop;
+ ++i
+ )
+ {
+ this->value[i][i] = x;
+ }
+ }
+}
+
+template <typename vT, uint cT, uint rT, profile pT>
+base<vT, cT, rT, pT>::base
+(
+ typename base<vT, cT, rT, pT>::value_type const * const x
+)
+{
+ memcpy(&this->value, &x.value, cT * rT * sizeof(vT));
+}
+
+template <typename vT, uint cT, uint rT, profile pT>
+base<vT, cT, rT, pT>::base
+(
+ typename base<vT, cT, rT, pT>::col_type const * const x
+)
+{
+ for
+ (
+ typename base<vT, cT, rT, pT>::size_type i = typename base<vT, cT, rT, pT>::size_type(0);
+ i < base<vT, cT, rT, pT>::col_size();
+ ++i
+ )
+ {
+ this->value[i] = x[i];
+ }
+}
+
+template <typename vT, uint cT, uint rT, profile pT>
+template <typename vU, uint cU, uint rU, profile pU>
+base<vT, cT, rT, pT>::base
+(
+ base<vU, cU, rU, pU> const & m
+)
+{
+ for
+ (
+ typename base<vT, cT, rT, pT>::size_type i = typename base<vT, cT, rT, pT>::size_type(0);
+ i < base<vT, cT, rT, pT>::col_size();
+ ++i
+ )
+ {
+ this->value[i] = base<vT, cT, rT, pT>(m[i]);
+ }
+}
+
+//////////////////////////////////////
+// Accesses
+
+template <typename vT, uint cT, uint rT, profile pT>
+typename base<vT, cT, rT, pT>::col_type& base<vT, cT, rT, pT>::operator[]
+(
+ typename base<vT, cT, rT, pT>::size_type i
+)
+{
+ return this->value[i];
+}
+
+template <typename vT, uint cT, uint rT, profile pT>
+typename base<vT, cT, rT, pT>::col_type const & base<vT, cT, rT, pT>::operator[]
+(
+ typename base<vT, cT, rT, pT>::size_type i
+) const
+{
+ return this->value[i];
+}
+
+//////////////////////////////////////
+// Unary updatable operators
+
+template <typename vT, uint cT, uint rT, profile pT>
+typename base<vT, cT, rT, pT>::class_type& base<vT, cT, rT, pT>::operator=
+(
+ typename base<vT, cT, rT, pT>::class_type const & x
+)
+{
+ memcpy(&this->value, &x.value, cT * rT * sizeof(vT));
+ return *this;
+}
+
+template <typename vT, uint cT, uint rT, profile pT>
+typename base<vT, cT, rT, pT>::class_type& base<vT, cT, rT, pT>::operator+=
+(
+ typename base<vT, cT, rT, pT>::value_type const & x
+)
+{
+ typename base<vT, cT, rT, pT>::size_type stop_col = x.col_size();
+ typename base<vT, cT, rT, pT>::size_type stop_row = x.row_size();
+
+ for(typename base<vT, cT, rT, pT>::size_type j = 0; j < stop_col; ++j)
+ for(typename base<vT, cT, rT, pT>::size_type i = 0; i < stop_row; ++i)
+ this->value[j][i] += x;
+
+ return *this;
+}
+
+template <typename vT, uint cT, uint rT, profile pT>
+typename base<vT, cT, rT, pT>::class_type& base<vT, cT, rT, pT>::operator+=
+(
+ typename base<vT, cT, rT, pT>::class_type const & x
+)
+{
+ typename base<vT, cT, rT, pT>::size_type stop_col = x.col_size();
+ typename base<vT, cT, rT, pT>::size_type stop_row = x.row_size();
+
+ for(typename base<vT, cT, rT, pT>::size_type j = 0; j < stop_col; ++j)
+ for(typename base<vT, cT, rT, pT>::size_type i = 0; i < stop_row; ++i)
+ this->value[j][i] += x[j][i];
+
+ return *this;
+}
+
+template <typename vT, uint cT, uint rT, profile pT>
+typename base<vT, cT, rT, pT>::class_type& base<vT, cT, rT, pT>::operator-=
+(
+ typename base<vT, cT, rT, pT>::value_type const & x
+)
+{
+ typename base<vT, cT, rT, pT>::size_type stop_col = x.col_size();
+ typename base<vT, cT, rT, pT>::size_type stop_row = x.row_size();
+
+ for(typename base<vT, cT, rT, pT>::size_type j = 0; j < stop_col; ++j)
+ for(typename base<vT, cT, rT, pT>::size_type i = 0; i < stop_row; ++i)
+ this->value[j][i] -= x;
+
+ return *this;
+}
+
+template <typename vT, uint cT, uint rT, profile pT>
+typename base<vT, cT, rT, pT>::class_type& base<vT, cT, rT, pT>::operator-=
+(
+ typename base<vT, cT, rT, pT>::class_type const & x
+)
+{
+ typename base<vT, cT, rT, pT>::size_type stop_col = x.col_size();
+ typename base<vT, cT, rT, pT>::size_type stop_row = x.row_size();
+
+ for(typename base<vT, cT, rT, pT>::size_type j = 0; j < stop_col; ++j)
+ for(typename base<vT, cT, rT, pT>::size_type i = 0; i < stop_row; ++i)
+ this->value[j][i] -= x[j][i];
+
+ return *this;
+}
+
+template <typename vT, uint cT, uint rT, profile pT>
+typename base<vT, cT, rT, pT>::class_type& base<vT, cT, rT, pT>::operator*=
+(
+ typename base<vT, cT, rT, pT>::value_type const & x
+)
+{
+ typename base<vT, cT, rT, pT>::size_type stop_col = x.col_size();
+ typename base<vT, cT, rT, pT>::size_type stop_row = x.row_size();
+
+ for(typename base<vT, cT, rT, pT>::size_type j = 0; j < stop_col; ++j)
+ for(typename base<vT, cT, rT, pT>::size_type i = 0; i < stop_row; ++i)
+ this->value[j][i] *= x;
+
+ return *this;
+}
+
+template <typename vT, uint cT, uint rT, profile pT>
+typename base<vT, cT, rT, pT>::class_type& base<vT, cT, rT, pT>::operator*=
+(
+ typename base<vT, cT, rT, pT>::class_type const & x
+)
+{
+ typename base<vT, cT, rT, pT>::size_type stop_col = x.col_size();
+ typename base<vT, cT, rT, pT>::size_type stop_row = x.row_size();
+
+ for(typename base<vT, cT, rT, pT>::size_type j = 0; j < stop_col; ++j)
+ for(typename base<vT, cT, rT, pT>::size_type i = 0; i < stop_row; ++i)
+ this->value[j][i] *= x[j][i];
+
+ return *this;
+}
+
+template <typename vT, uint cT, uint rT, profile pT>
+typename base<vT, cT, rT, pT>::class_type& base<vT, cT, rT, pT>::operator/=
+(
+ typename base<vT, cT, rT, pT>::value_type const & x
+)
+{
+ typename base<vT, cT, rT, pT>::size_type stop_col = x.col_size();
+ typename base<vT, cT, rT, pT>::size_type stop_row = x.row_size();
+
+ for(typename base<vT, cT, rT, pT>::size_type j = 0; j < stop_col; ++j)
+ for(typename base<vT, cT, rT, pT>::size_type i = 0; i < stop_row; ++i)
+ this->value[j][i] /= x;
+
+ return *this;
+}
+
+template <typename vT, uint cT, uint rT, profile pT>
+typename base<vT, cT, rT, pT>::class_type& base<vT, cT, rT, pT>::operator/=
+(
+ typename base<vT, cT, rT, pT>::class_type const & x
+)
+{
+ typename base<vT, cT, rT, pT>::size_type stop_col = x.col_size();
+ typename base<vT, cT, rT, pT>::size_type stop_row = x.row_size();
+
+ for(typename base<vT, cT, rT, pT>::size_type j = 0; j < stop_col; ++j)
+ for(typename base<vT, cT, rT, pT>::size_type i = 0; i < stop_row; ++i)
+ this->value[j][i] /= x[j][i];
+
+ return *this;
+}
+
+template <typename vT, uint cT, uint rT, profile pT>
+typename base<vT, cT, rT, pT>::class_type& base<vT, cT, rT, pT>::operator++ ()
+{
+ typename base<vT, cT, rT, pT>::size_type stop_col = col_size();
+ typename base<vT, cT, rT, pT>::size_type stop_row = row_size();
+
+ for(typename base<vT, cT, rT, pT>::size_type j = 0; j < stop_col; ++j)
+ for(typename base<vT, cT, rT, pT>::size_type i = 0; i < stop_row; ++i)
+ ++this->value[j][i];
+
+ return *this;
+}
+
+template <typename vT, uint cT, uint rT, profile pT>
+typename base<vT, cT, rT, pT>::class_type& base<vT, cT, rT, pT>::operator-- ()
+{
+ typename base<vT, cT, rT, pT>::size_type stop_col = col_size();
+ typename base<vT, cT, rT, pT>::size_type stop_row = row_size();
+
+ for(typename base<vT, cT, rT, pT>::size_type j = 0; j < stop_col; ++j)
+ for(typename base<vT, cT, rT, pT>::size_type i = 0; i < stop_row; ++i)
+ --this->value[j][i];
+
+ return *this;
+}
+
+} //namespace detail
+} //namespace glm
diff --git a/src/glm/core/type_half.hpp b/src/glm/core/type_half.hpp
new file mode 100644
index 0000000..b6bcd48
--- /dev/null
+++ b/src/glm/core/type_half.hpp
@@ -0,0 +1,78 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2008-08-17
+// Updated : 2010-02-17
+// Licence : This source is under MIT License
+// File : glm/core/type_half.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_core_type_half
+#define glm_core_type_half
+
+#include <cstdlib>
+
+namespace glm{
+namespace detail
+{
+ typedef short hdata;
+
+ float toFloat32(hdata value);
+ hdata toFloat16(float const & value);
+
+ ///16-bit floating point type.
+ /// \ingroup gtc_half_float
+ class thalf
+ {
+ public:
+ // Constructors
+ GLM_FUNC_DECL thalf();
+ GLM_FUNC_DECL thalf(thalf const & s);
+
+ template <typename U>
+ GLM_FUNC_DECL explicit thalf(U const & s);
+
+ // Cast
+ //operator float();
+ GLM_FUNC_DECL operator float() const;
+ //operator double();
+ //operator double() const;
+
+ // Unary updatable operators
+ GLM_FUNC_DECL thalf& operator= (thalf const & s);
+ GLM_FUNC_DECL thalf& operator+=(thalf const & s);
+ GLM_FUNC_DECL thalf& operator-=(thalf const & s);
+ GLM_FUNC_DECL thalf& operator*=(thalf const & s);
+ GLM_FUNC_DECL thalf& operator/=(thalf const & s);
+ GLM_FUNC_DECL thalf& operator++();
+ GLM_FUNC_DECL thalf& operator--();
+
+ GLM_FUNC_DECL float toFloat() const{return toFloat32(data);}
+
+ GLM_FUNC_DECL hdata _data() const{return data;}
+
+ private:
+ hdata data;
+ };
+
+ thalf operator+ (thalf const & s1, thalf const & s2);
+
+ thalf operator- (thalf const & s1, thalf const & s2);
+
+ thalf operator* (thalf const & s1, thalf const & s2);
+
+ thalf operator/ (thalf const & s1, thalf const & s2);
+
+ // Unary constant operators
+ thalf operator- (thalf const & s);
+
+ thalf operator-- (thalf const & s, int);
+
+ thalf operator++ (thalf const & s, int);
+
+}//namespace detail
+}//namespace glm
+
+#include "type_half.inl"
+
+#endif//glm_core_type_half
diff --git a/src/glm/core/type_half.inl b/src/glm/core/type_half.inl
new file mode 100644
index 0000000..c98cd5b
--- /dev/null
+++ b/src/glm/core/type_half.inl
@@ -0,0 +1,357 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2008-08-17
+// Updated : 2009-11-12
+// Licence : This source is under MIT License
+// File : glm/core/type_half.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Copyright:
+// This half implementation is based on OpenEXR which is Copyright (c) 2002,
+// Industrial Light & Magic, a division of Lucas Digital Ltd. LLC
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include "_detail.hpp"
+
+namespace glm{
+namespace detail
+{
+ GLM_FUNC_QUALIFIER float overflow()
+ {
+ volatile float f = 1e10;
+
+ for(int i = 0; i < 10; ++i)
+ f *= f; // this will overflow before
+ // the for­loop terminates
+ return f;
+ }
+
+ GLM_FUNC_QUALIFIER float toFloat32(hdata value)
+ {
+ int s = (value >> 15) & 0x00000001;
+ int e = (value >> 10) & 0x0000001f;
+ int m = value & 0x000003ff;
+
+ if(e == 0)
+ {
+ if(m == 0)
+ {
+ //
+ // Plus or minus zero
+ //
+
+ detail::uif result;
+ result.i = s << 31;
+ return result.f;
+ }
+ else
+ {
+ //
+ // Denormalized number -- renormalize it
+ //
+
+ while(!(m & 0x00000400))
+ {
+ m <<= 1;
+ e -= 1;
+ }
+
+ e += 1;
+ m &= ~0x00000400;
+ }
+ }
+ else if(e == 31)
+ {
+ if(m == 0)
+ {
+ //
+ // Positive or negative infinity
+ //
+
+ uif result;
+ result.i = (s << 31) | 0x7f800000;
+ return result.f;
+ }
+ else
+ {
+ //
+ // Nan -- preserve sign and significand bits
+ //
+
+ uif result;
+ result.i = (s << 31) | 0x7f800000 | (m << 13);
+ return result.f;
+ }
+ }
+
+ //
+ // Normalized number
+ //
+
+ e = e + (127 - 15);
+ m = m << 13;
+
+ //
+ // Assemble s, e and m.
+ //
+
+ uif Result;
+ Result.i = (s << 31) | (e << 23) | m;
+ return Result.f;
+ }
+
+ GLM_FUNC_QUALIFIER hdata toFloat16(float const & f)
+ {
+ uif Entry;
+ Entry.f = f;
+ int i = Entry.i;
+
+ //
+ // Our floating point number, f, is represented by the bit
+ // pattern in integer i. Disassemble that bit pattern into
+ // the sign, s, the exponent, e, and the significand, m.
+ // Shift s into the position where it will go in in the
+ // resulting half number.
+ // Adjust e, accounting for the different exponent bias
+ // of float and half (127 versus 15).
+ //
+
+ register int s = (i >> 16) & 0x00008000;
+ register int e = ((i >> 23) & 0x000000ff) - (127 - 15);
+ register int m = i & 0x007fffff;
+
+ //
+ // Now reassemble s, e and m into a half:
+ //
+
+ if(e <= 0)
+ {
+ if(e < -10)
+ {
+ //
+ // E is less than -10. The absolute value of f is
+ // less than half_MIN (f may be a small normalized
+ // float, a denormalized float or a zero).
+ //
+ // We convert f to a _halfGTX zero.
+ //
+
+ return 0;
+ }
+
+ //
+ // E is between -10 and 0. F is a normalized float,
+ // whose magnitude is less than __half_NRM_MIN.
+ //
+ // We convert f to a denormalized _halfGTX.
+ //
+
+ m = (m | 0x00800000) >> (1 - e);
+
+ //
+ // Round to nearest, round "0.5" up.
+ //
+ // Rounding may cause the significand to overflow and make
+ // our number normalized. Because of the way a half's bits
+ // are laid out, we don't have to treat this case separately;
+ // the code below will handle it correctly.
+ //
+
+ if(m & 0x00001000)
+ m += 0x00002000;
+
+ //
+ // Assemble the _halfGTX from s, e (zero) and m.
+ //
+
+ return hdata(s | (m >> 13));
+ }
+ else if(e == 0xff - (127 - 15))
+ {
+ if(m == 0)
+ {
+ //
+ // F is an infinity; convert f to a half
+ // infinity with the same sign as f.
+ //
+
+ return hdata(s | 0x7c00);
+ }
+ else
+ {
+ //
+ // F is a NAN; we produce a half NAN that preserves
+ // the sign bit and the 10 leftmost bits of the
+ // significand of f, with one exception: If the 10
+ // leftmost bits are all zero, the NAN would turn
+ // into an infinity, so we have to set at least one
+ // bit in the significand.
+ //
+
+ m >>= 13;
+
+ return hdata(s | 0x7c00 | m | (m == 0));
+ }
+ }
+ else
+ {
+ //
+ // E is greater than zero. F is a normalized float.
+ // We try to convert f to a normalized half.
+ //
+
+ //
+ // Round to nearest, round "0.5" up
+ //
+
+ if(m & 0x00001000)
+ {
+ m += 0x00002000;
+
+ if(m & 0x00800000)
+ {
+ m = 0; // overflow in significand,
+ e += 1; // adjust exponent
+ }
+ }
+
+ //
+ // Handle exponent overflow
+ //
+
+ if (e > 30)
+ {
+ overflow(); // Cause a hardware floating point overflow;
+
+ return hdata(s | 0x7c00);
+ // if this returns, the half becomes an
+ } // infinity with the same sign as f.
+
+ //
+ // Assemble the half from s, e and m.
+ //
+
+ return hdata(s | (e << 10) | (m >> 13));
+ }
+ }
+
+ GLM_FUNC_QUALIFIER thalf::thalf() :
+ data(0)
+ {}
+
+ GLM_FUNC_QUALIFIER thalf::thalf(thalf const & s) :
+ data(s.data)
+ {}
+
+ template <typename U>
+ GLM_FUNC_QUALIFIER thalf::thalf(U const & s) :
+ data(toFloat16(float(s)))
+ {}
+
+ // Cast
+ //GLM_FUNC_QUALIFIER half::operator float()
+ //{
+ // return toFloat();
+ //}
+
+ GLM_FUNC_QUALIFIER thalf::operator float() const
+ {
+ return toFloat32(this->data);
+ }
+
+ //GLM_FUNC_QUALIFIER half::operator double()
+ //{
+ // return double(toFloat());
+ //}
+
+ //GLM_FUNC_QUALIFIER half::operator double() const
+ //{
+ // return double(toFloat());
+ //}
+
+ // Unary updatable operators
+ GLM_FUNC_QUALIFIER thalf& thalf::operator= (thalf const & s)
+ {
+ data = s.data;
+ return *this;
+ }
+
+ GLM_FUNC_QUALIFIER thalf& thalf::operator+=(thalf const & s)
+ {
+ data = toFloat16(toFloat32(data) + toFloat32(s.data));
+ return *this;
+ }
+
+ GLM_FUNC_QUALIFIER thalf& thalf::operator-=(thalf const & s)
+ {
+ data = toFloat16(toFloat32(data) - toFloat32(s.data));
+ return *this;
+ }
+
+ GLM_FUNC_QUALIFIER thalf& thalf::operator*=(thalf const & s)
+ {
+ data = toFloat16(toFloat32(data) * toFloat32(s.data));
+ return *this;
+ }
+
+ GLM_FUNC_QUALIFIER thalf& thalf::operator/=(thalf const & s)
+ {
+ data = toFloat16(toFloat32(data) / toFloat32(s.data));
+ return *this;
+ }
+
+ GLM_FUNC_QUALIFIER thalf& thalf::operator++()
+ {
+ float Casted = toFloat32(data);
+ data = toFloat16(++Casted);
+ return *this;
+ }
+
+ GLM_FUNC_QUALIFIER thalf& thalf::operator--()
+ {
+ float Casted = toFloat32(data);
+ data = toFloat16(--Casted);
+ return *this;
+ }
+
+ //////////////////////////////////////
+ // Binary arithmetic operators
+
+ GLM_FUNC_QUALIFIER detail::thalf operator+ (detail::thalf const & s1, detail::thalf const & s2)
+ {
+ return detail::thalf(float(s1) + float(s2));
+ }
+
+ GLM_FUNC_QUALIFIER detail::thalf operator- (detail::thalf const & s1, detail::thalf const & s2)
+ {
+ return detail::thalf(float(s1) - float(s2));
+ }
+
+ GLM_FUNC_QUALIFIER detail::thalf operator* (detail::thalf const & s1, detail::thalf const & s2)
+ {
+ return detail::thalf(float(s1) * float(s2));
+ }
+
+ GLM_FUNC_QUALIFIER detail::thalf operator/ (detail::thalf const & s1, detail::thalf const & s2)
+ {
+ return detail::thalf(float(s1) / float(s2));
+ }
+
+ // Unary constant operators
+ GLM_FUNC_QUALIFIER detail::thalf operator- (detail::thalf const & s)
+ {
+ return detail::thalf(-float(s));
+ }
+
+ GLM_FUNC_QUALIFIER detail::thalf operator-- (detail::thalf const & s, int)
+ {
+ return detail::thalf(float(s) - 1.0f);
+ }
+
+ GLM_FUNC_QUALIFIER detail::thalf operator++ (detail::thalf const & s, int)
+ {
+ return detail::thalf(float(s) + 1.0f);
+ }
+
+}//namespace detail
+}//namespace glm
diff --git a/src/glm/core/type_int.hpp b/src/glm/core/type_int.hpp
new file mode 100644
index 0000000..eda4bed
--- /dev/null
+++ b/src/glm/core/type_int.hpp
@@ -0,0 +1,109 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2008-08-22
+// Updated : 2008-09-17
+// Licence : This source is under MIT License
+// File : glm/core/type_int.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_core_type_int
+#define glm_core_type_int
+
+#include "setup.hpp"
+#include "_detail.hpp"
+
+namespace glm{
+namespace detail
+{
+ typedef signed short lowp_int_t;
+ typedef signed int mediump_int_t;
+ typedef sint64 highp_int_t;
+
+ typedef unsigned short lowp_uint_t;
+ typedef unsigned int mediump_uint_t;
+ typedef uint64 highp_uint_t;
+
+ GLM_DETAIL_IS_INT(signed char);
+ GLM_DETAIL_IS_INT(signed short);
+ GLM_DETAIL_IS_INT(signed int);
+ GLM_DETAIL_IS_INT(signed long);
+ GLM_DETAIL_IS_INT(highp_int_t);
+
+ GLM_DETAIL_IS_UINT(unsigned char);
+ GLM_DETAIL_IS_UINT(unsigned short);
+ GLM_DETAIL_IS_UINT(unsigned int);
+ GLM_DETAIL_IS_UINT(unsigned long);
+ GLM_DETAIL_IS_UINT(highp_uint_t);
+}//namespace detail
+
+namespace core{
+namespace type{
+namespace precision //!< Namespace for precision stuff.
+{
+ //! Low precision signed integer.
+ //! There is no guarantee on the actual precision.
+ //! From GLSL 1.30.8 specification.
+ //! \ingroup core_precision
+ typedef detail::lowp_int_t lowp_int;
+ //! Medium precision signed integer.
+ //! There is no guarantee on the actual precision.
+ //! From GLSL 1.30.8 specification.
+ //! \ingroup core_precision
+ typedef detail::mediump_int_t mediump_int;
+ //! High precision signed integer.
+ //! There is no guarantee on the actual precision.
+ //! From GLSL 1.30.8 specification.
+ //! \ingroup core_precision
+ typedef detail::highp_int_t highp_int;
+
+ //! Low precision unsigned integer.
+ //! There is no guarantee on the actual precision.
+ //! From GLSL 1.30.8 specification.
+ //! \ingroup core_precision
+ typedef detail::lowp_uint_t lowp_uint;
+ //! Medium precision unsigned integer.
+ //! There is no guarantee on the actual precision.
+ //! From GLSL 1.30.8 specification.
+ //! \ingroup core_precision
+ typedef detail::mediump_uint_t mediump_uint;
+ //! High precision unsigned integer.
+ //! There is no guarantee on the actual precision.
+ //! From GLSL 1.30.8 specification.
+ //! \ingroup core_precision
+ typedef detail::highp_uint_t highp_uint;
+}//namespace precision
+
+#if(!defined(GLM_PRECISION_HIGHP_INT) && !defined(GLM_PRECISION_MEDIUMP_INT) && !defined(GLM_PRECISION_LOWP_INT))
+ typedef precision::mediump_int int_t;
+#elif(defined(GLM_PRECISION_HIGHP_INT) && !defined(GLM_PRECISION_MEDIUMP_INT) && !defined(GLM_PRECISION_LOWP_INT))
+ typedef precision::highp_int int_t;
+#elif(!defined(GLM_PRECISION_HIGHP_INT) && defined(GLM_PRECISION_MEDIUMP_INT) && !defined(GLM_PRECISION_LOWP_INT))
+ typedef precision::mediump_int int_t;
+#elif(!defined(GLM_PRECISION_HIGHP_INT) && !defined(GLM_PRECISION_MEDIUMP_INT) && defined(GLM_PRECISION_LOWP_INT))
+ typedef precision::lowp_int int_t;
+#else
+# error "GLM error: multiple default precision requested for signed interger types"
+#endif
+
+#if(!defined(GLM_PRECISION_HIGHP_UINT) && !defined(GLM_PRECISION_MEDIUMP_UINT) && !defined(GLM_PRECISION_LOWP_UINT))
+ typedef precision::mediump_uint uint_t;
+#elif(defined(GLM_PRECISION_HIGHP_UINT) && !defined(GLM_PRECISION_MEDIUMP_UINT) && !defined(GLM_PRECISION_LOWP_UINT))
+ typedef precision::highp_uint uint_t;
+#elif(!defined(GLM_PRECISION_HIGHP_UINT) && defined(GLM_PRECISION_MEDIUMP_UINT) && !defined(GLM_PRECISION_LOWP_UINT))
+ typedef precision::mediump_uint uint_t;
+#elif(!defined(GLM_PRECISION_HIGHP_UINT) && !defined(GLM_PRECISION_MEDIUMP_UINT) && defined(GLM_PRECISION_LOWP_UINT))
+ typedef precision::lowp_uint uint_t;
+#else
+# error "GLM error: multiple default precision requested for unsigned interger types"
+#endif
+
+ //! Unsigned integer.
+ //! From GLSL 1.30.8 specification section 4.1.3 Integers.
+ typedef uint_t uint;
+
+}//namespace type
+}//namespace core
+}//namespace glm
+
+#endif//glm_core_type_int
diff --git a/src/glm/core/type_mat.hpp b/src/glm/core/type_mat.hpp
new file mode 100644
index 0000000..027e0eb
--- /dev/null
+++ b/src/glm/core/type_mat.hpp
@@ -0,0 +1,56 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2010-01-26
+// Updated : 2010-01-26
+// Licence : This source is under MIT License
+// File : glm/core/type_mat.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_core_type_mat
+#define glm_core_type_mat
+
+#include "type_gentype.hpp"
+
+namespace glm{
+namespace detail
+{
+ //template
+ //<
+ // typename T,
+ // template <typename> class C,
+ // template <typename> class R
+ //>
+ //struct matType
+ //{
+ // enum ctor{null};
+ // typedef T value_type;
+ // typedef std::size_t size_type;
+ // typedef C<T> col_type;
+ // typedef R<T> row_type;
+ // static size_type const col_size;
+ // static size_type const row_size;
+ //};
+
+ //template
+ //<
+ // typename T,
+ // template <typename> class C,
+ // template <typename> class R
+ //>
+ //typename matType<T, C, R>::size_type const
+ //matType<T, C, R>::col_size = matType<T, C, R>::col_type::value_size;
+
+ //template
+ //<
+ // typename T,
+ // template <typename> class C,
+ // template <typename> class R
+ //>
+ //typename matType<T, C, R>::size_type const
+ //matType<T, C, R>::row_size = matType<T, C, R>::row_type::value_size;
+
+}//namespace detail
+}//namespace glm
+
+#endif//glm_core_type_mat
diff --git a/src/glm/core/type_mat.inl b/src/glm/core/type_mat.inl
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/glm/core/type_mat.inl
diff --git a/src/glm/core/type_mat2x2.hpp b/src/glm/core/type_mat2x2.hpp
new file mode 100644
index 0000000..74f5295
--- /dev/null
+++ b/src/glm/core/type_mat2x2.hpp
@@ -0,0 +1,281 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2005-01-27
+// Updated : 2010-02-11
+// Licence : This source is under MIT License
+// File : glm/core/type_mat2x2.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_core_type_mat2x2
+#define glm_core_type_mat2x2
+
+#include "type_mat.hpp"
+
+namespace glm{
+namespace detail
+{
+ template <typename T> struct tvec1;
+ template <typename T> struct tvec2;
+ template <typename T> struct tvec3;
+ template <typename T> struct tvec4;
+ template <typename T> struct tmat2x2;
+ template <typename T> struct tmat2x3;
+ template <typename T> struct tmat2x4;
+ template <typename T> struct tmat3x2;
+ template <typename T> struct tmat3x3;
+ template <typename T> struct tmat3x4;
+ template <typename T> struct tmat4x2;
+ template <typename T> struct tmat4x3;
+ template <typename T> struct tmat4x4;
+
+ //! \brief Template for 2 * 2 matrix of floating-point numbers.
+ //! \ingroup core_template
+ template <typename T>
+ struct tmat2x2
+ {
+ enum ctor{null};
+ typedef T value_type;
+ typedef std::size_t size_type;
+ typedef tvec2<T> col_type;
+ typedef tvec2<T> row_type;
+ static GLM_FUNC_DECL size_type col_size();
+ static GLM_FUNC_DECL size_type row_size();
+
+ typedef tmat2x2<T> type;
+ typedef tmat2x2<T> transpose_type;
+
+ public:
+ // Implementation detail
+ GLM_FUNC_DECL tmat2x2<T> _inverse() const;
+
+ private:
+ //////////////////////////////////////
+ // Data
+ col_type value[2];
+
+ public:
+ //////////////////////////////////////
+ // Constructors
+ GLM_FUNC_DECL tmat2x2();
+ GLM_FUNC_DECL tmat2x2(
+ tmat2x2 const & m);
+
+ GLM_FUNC_DECL explicit tmat2x2(
+ ctor Null);
+ GLM_FUNC_DECL explicit tmat2x2(
+ value_type const & x);
+ GLM_FUNC_DECL explicit tmat2x2(
+ value_type const & x1, value_type const & y1,
+ value_type const & x2, value_type const & y2);
+ GLM_FUNC_DECL explicit tmat2x2(
+ col_type const & v1,
+ col_type const & v2);
+
+ //////////////////////////////////////
+ // Conversions
+ template <typename U>
+ GLM_FUNC_DECL explicit tmat2x2(
+ U const & x);
+
+ template <typename U, typename V, typename M, typename N>
+ GLM_FUNC_DECL explicit tmat2x2(
+ U const & x1, V const & y1,
+ M const & x2, N const & y2);
+
+ template <typename U, typename V>
+ GLM_FUNC_DECL explicit tmat2x2(
+ tvec2<U> const & v1,
+ tvec2<V> const & v2);
+
+ //////////////////////////////////////
+ // Matrix conversions
+ template <typename U>
+ GLM_FUNC_DECL explicit tmat2x2(tmat2x2<U> const & m);
+
+ GLM_FUNC_DECL explicit tmat2x2(tmat3x3<T> const & x);
+ GLM_FUNC_DECL explicit tmat2x2(tmat4x4<T> const & x);
+ GLM_FUNC_DECL explicit tmat2x2(tmat2x3<T> const & x);
+ GLM_FUNC_DECL explicit tmat2x2(tmat3x2<T> const & x);
+ GLM_FUNC_DECL explicit tmat2x2(tmat2x4<T> const & x);
+ GLM_FUNC_DECL explicit tmat2x2(tmat4x2<T> const & x);
+ GLM_FUNC_DECL explicit tmat2x2(tmat3x4<T> const & x);
+ GLM_FUNC_DECL explicit tmat2x2(tmat4x3<T> const & x);
+
+ //////////////////////////////////////
+ // Accesses
+
+ GLM_FUNC_DECL col_type & operator[](size_type i);
+ GLM_FUNC_DECL col_type const & operator[](size_type i) const;
+
+ // Unary updatable operators
+ GLM_FUNC_DECL tmat2x2<T> & operator=(tmat2x2<T> const & m);
+ template <typename U>
+ GLM_FUNC_DECL tmat2x2<T> & operator=(tmat2x2<U> const & m);
+ template <typename U>
+ GLM_FUNC_DECL tmat2x2<T> & operator+=(U const & s);
+ template <typename U>
+ GLM_FUNC_DECL tmat2x2<T> & operator+=(tmat2x2<U> const & m);
+ template <typename U>
+ GLM_FUNC_DECL tmat2x2<T> & operator-=(U const & s);
+ template <typename U>
+ GLM_FUNC_DECL tmat2x2<T> & operator-=(tmat2x2<U> const & m);
+ template <typename U>
+ GLM_FUNC_DECL tmat2x2<T> & operator*=(U const & s);
+ template <typename U>
+ GLM_FUNC_DECL tmat2x2<T> & operator*=(tmat2x2<U> const & m);
+ template <typename U>
+ GLM_FUNC_DECL tmat2x2<T> & operator/=(U const & s);
+ template <typename U>
+ GLM_FUNC_DECL tmat2x2<T> & operator/=(tmat2x2<U> const & m);
+ GLM_FUNC_DECL tmat2x2<T> & operator++();
+ GLM_FUNC_DECL tmat2x2<T> & operator--();
+ };
+
+ // Binary operators
+ template <typename T>
+ tmat2x2<T> operator+ (
+ tmat2x2<T> const & m,
+ typename tmat2x2<T>::value_type const & s);
+
+ template <typename T>
+ tmat2x2<T> operator+ (
+ typename tmat2x2<T>::value_type const & s,
+ tmat2x2<T> const & m);
+
+ template <typename T>
+ tmat2x2<T> operator+ (
+ tmat2x2<T> const & m1,
+ tmat2x2<T> const & m2);
+
+ template <typename T>
+ tmat2x2<T> operator- (
+ tmat2x2<T> const & m,
+ typename tmat2x2<T>::value_type const & s);
+
+ template <typename T>
+ tmat2x2<T> operator- (
+ typename tmat2x2<T>::value_type const & s,
+ tmat2x2<T> const & m);
+
+ template <typename T>
+ tmat2x2<T> operator- (
+ tmat2x2<T> const & m1,
+ tmat2x2<T> const & m2);
+
+ template <typename T>
+ tmat2x2<T> operator* (
+ tmat2x2<T> const & m,
+ typename tmat2x2<T>::value_type const & s);
+
+ template <typename T>
+ tmat2x2<T> operator* (
+ typename tmat2x2<T>::value_type const & s,
+ tmat2x2<T> const & m);
+
+ template <typename T>
+ typename tmat2x2<T>::col_type operator* (
+ tmat2x2<T> const & m,
+ typename tmat2x2<T>::row_type const & v);
+
+ template <typename T>
+ typename tmat2x2<T>::row_type operator* (
+ typename tmat2x2<T>::col_type const & v,
+ tmat2x2<T> const & m);
+
+ template <typename T>
+ tmat2x2<T> operator* (
+ tmat2x2<T> const & m1,
+ tmat2x2<T> const & m2);
+
+ template <typename T>
+ tmat2x2<T> operator/ (
+ tmat2x2<T> const & m,
+ typename tmat2x2<T>::value_type const & s);
+
+ template <typename T>
+ tmat2x2<T> operator/ (
+ typename tmat2x2<T>::value_type const & s,
+ tmat2x2<T> const & m);
+
+ template <typename T>
+ typename tmat2x2<T>::col_type operator/ (
+ tmat2x2<T> const & m,
+ typename tmat2x2<T>::row_type const & v);
+
+ template <typename T>
+ typename tmat2x2<T>::row_type operator/ (
+ typename tmat2x2<T>::col_type const & v,
+ tmat2x2<T> const & m);
+
+ template <typename T>
+ tmat2x2<T> operator/ (
+ tmat2x2<T> const & m1,
+ tmat2x2<T> const & m2);
+
+ // Unary constant operators
+ template <typename T>
+ tmat2x2<T> const operator- (
+ tmat2x2<T> const & m);
+
+ template <typename T>
+ tmat2x2<T> const operator-- (
+ tmat2x2<T> const & m,
+ int);
+
+ template <typename T>
+ tmat2x2<T> const operator++ (
+ tmat2x2<T> const & m,
+ int);
+} //namespace detail
+
+namespace core{
+namespace type{
+namespace precision
+{
+ //! 2 columns of 2 components matrix of low precision floating-point numbers.
+ //! There is no guarantee on the actual precision.
+ //! From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers
+ //! \ingroup core_precision
+ typedef detail::tmat2x2<lowp_float> lowp_mat2;
+
+ //! 2 columns of 2 components matrix of medium precision floating-point numbers.
+ //! There is no guarantee on the actual precision.
+ //! From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers
+ //! \ingroup core_precision
+ typedef detail::tmat2x2<mediump_float> mediump_mat2;
+
+ //! 2 columns of 2 components matrix of high precision floating-point numbers.
+ //! There is no guarantee on the actual precision.
+ //! From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers
+ //! \ingroup core_precision
+ typedef detail::tmat2x2<highp_float> highp_mat2;
+
+ //! 2 columns of 2 components matrix of low precision floating-point numbers.
+ //! There is no guarantee on the actual precision.
+ //! From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers
+ //! \ingroup core_precision
+ typedef detail::tmat2x2<lowp_float> lowp_mat2x2;
+
+ //! 2 columns of 2 components matrix of medium precision floating-point numbers.
+ //! There is no guarantee on the actual precision.
+ //! From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers
+ //! \ingroup core_precision
+ typedef detail::tmat2x2<mediump_float> mediump_mat2x2;
+
+ //! 2 columns of 2 components matrix of high precision floating-point numbers.
+ //! There is no guarantee on the actual precision.
+ //! From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers
+ //! \ingroup core_precision
+ typedef detail::tmat2x2<highp_float> highp_mat2x2;
+
+}//namespace precision
+}//namespace type
+}//namespace core
+}//namespace glm
+
+#ifndef GLM_EXTERNAL_TEMPLATE
+#include "type_mat2x2.inl"
+#endif
+
+#endif //glm_core_type_mat2x2
diff --git a/src/glm/core/type_mat2x2.inl b/src/glm/core/type_mat2x2.inl
new file mode 100644
index 0000000..bdb663d
--- /dev/null
+++ b/src/glm/core/type_mat2x2.inl
@@ -0,0 +1,648 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2005-01-16
+// Updated : 2010-02-11
+// Licence : This source is under MIT License
+// File : glm/core/type_mat2x2.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm{
+namespace detail
+{
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tmat2x2<T>::size_type tmat2x2<T>::col_size()
+ {
+ return 2;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tmat2x2<T>::size_type tmat2x2<T>::row_size()
+ {
+ return 2;
+ }
+
+ //////////////////////////////////////
+ // Accesses
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tmat2x2<T>::col_type &
+ tmat2x2<T>::operator[]
+ (
+ size_type i
+ )
+ {
+ assert(i < this->row_size());
+ return this->value[i];
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tmat2x2<T>::col_type const &
+ tmat2x2<T>::operator[]
+ (
+ size_type i
+ ) const
+ {
+ assert(i < this->row_size());
+ return this->value[i];
+ }
+
+ //////////////////////////////////////////////////////////////
+ // Constructors
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x2<T>::tmat2x2()
+ {
+ this->value[0] = col_type(1, 0);
+ this->value[1] = col_type(0, 1);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x2<T>::tmat2x2
+ (
+ tmat2x2<T> const & m
+ )
+ {
+ this->value[0] = m.value[0];
+ this->value[1] = m.value[1];
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x2<T>::tmat2x2
+ (
+ ctor
+ )
+ {}
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x2<T>::tmat2x2
+ (
+ value_type const & s
+ )
+ {
+ value_type const Zero(0);
+ this->value[0] = col_type(s, Zero);
+ this->value[1] = col_type(Zero, s);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x2<T>::tmat2x2
+ (
+ value_type const & x0, value_type const & y0,
+ value_type const & x1, value_type const & y1
+ )
+ {
+ this->value[0] = col_type(x0, y0);
+ this->value[1] = col_type(x1, y1);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x2<T>::tmat2x2
+ (
+ col_type const & v0,
+ col_type const & v1
+ )
+ {
+ this->value[0] = v0;
+ this->value[1] = v1;
+ }
+
+ //////////////////////////////////////
+ // Convertion constructors
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_DECL tmat2x2<T>::tmat2x2
+ (
+ U const & s
+ )
+ {
+ value_type const Zero(0);
+ this->value[0] = tvec2<T>(value_type(s), Zero);
+ this->value[1] = tvec2<T>(Zero, value_type(s));
+ }
+
+ template <typename T>
+ template <typename X1, typename Y1, typename X2, typename Y2>
+ GLM_FUNC_DECL tmat2x2<T>::tmat2x2
+ (
+ X1 const & x1, Y1 const & y1,
+ X2 const & x2, Y2 const & y2
+ )
+ {
+ this->value[0] = col_type(value_type(x1), value_type(y1));
+ this->value[1] = col_type(value_type(x2), value_type(y2));
+ }
+
+ template <typename T>
+ template <typename V1, typename V2>
+ GLM_FUNC_DECL tmat2x2<T>::tmat2x2
+ (
+ tvec2<V1> const & v1,
+ tvec2<V2> const & v2
+ )
+ {
+ this->value[0] = col_type(v1);
+ this->value[1] = col_type(v2);
+ }
+
+ //////////////////////////////////////////////////////////////
+ // mat2x2 matrix conversions
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat2x2<T>::tmat2x2
+ (
+ tmat2x2<U> const & m
+ )
+ {
+ this->value[0] = col_type(m[0]);
+ this->value[1] = col_type(m[1]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x2<T>::tmat2x2
+ (
+ tmat3x3<T> const & m
+ )
+ {
+ this->value[0] = col_type(m[0]);
+ this->value[1] = col_type(m[1]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x2<T>::tmat2x2
+ (
+ tmat4x4<T> const & m
+ )
+ {
+ this->value[0] = col_type(m[0]);
+ this->value[1] = col_type(m[1]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x2<T>::tmat2x2
+ (
+ tmat2x3<T> const & m
+ )
+ {
+ this->value[0] = col_type(m[0]);
+ this->value[1] = col_type(m[1]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x2<T>::tmat2x2
+ (
+ tmat3x2<T> const & m
+ )
+ {
+ this->value[0] = m[0];
+ this->value[1] = m[1];
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x2<T>::tmat2x2
+ (
+ tmat2x4<T> const & m
+ )
+ {
+ this->value[0] = col_type(m[0]);
+ this->value[1] = col_type(m[1]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x2<T>::tmat2x2
+ (
+ tmat4x2<T> const & m
+ )
+ {
+ this->value[0] = m[0];
+ this->value[1] = m[1];
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x2<T>::tmat2x2
+ (
+ tmat3x4<T> const & m
+ )
+ {
+ this->value[0] = col_type(m[0]);
+ this->value[1] = col_type(m[1]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x2<T>::tmat2x2
+ (
+ tmat4x3<T> const & m
+ )
+ {
+ this->value[0] = col_type(m[0]);
+ this->value[1] = col_type(m[1]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x2<T> tmat2x2<T>::_inverse() const
+ {
+ typename tmat2x2<T>::value_type Determinant = this->value[0][0] * this->value[1][1] - this->value[1][0] * this->value[0][1];
+
+ tmat2x2<T> Inverse(
+ + this->value[1][1] / Determinant,
+ - this->value[1][0] / Determinant,
+ - this->value[0][1] / Determinant,
+ + this->value[0][0] / Determinant);
+ return Inverse;
+ }
+
+ //////////////////////////////////////////////////////////////
+ // mat2x2 operators
+
+ // This function shouldn't required but it seems that VC7.1 have an optimisation bug if this operator wasn't declared
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x2<T>& tmat2x2<T>::operator=
+ (
+ tmat2x2<T> const & m
+ )
+ {
+ this->value[0] = m[0];
+ this->value[1] = m[1];
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat2x2<T>& tmat2x2<T>::operator=
+ (
+ tmat2x2<U> const & m
+ )
+ {
+ this->value[0] = m[0];
+ this->value[1] = m[1];
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat2x2<T>& tmat2x2<T>::operator+=
+ (
+ U const & s
+ )
+ {
+ this->value[0] += s;
+ this->value[1] += s;
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat2x2<T>& tmat2x2<T>::operator+=
+ (
+ tmat2x2<U> const & m
+ )
+ {
+ this->value[0] += m[0];
+ this->value[1] += m[1];
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat2x2<T>& tmat2x2<T>::operator-=
+ (
+ U const & s
+ )
+ {
+ this->value[0] -= s;
+ this->value[1] -= s;
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat2x2<T>& tmat2x2<T>::operator-=
+ (
+ tmat2x2<U> const & m
+ )
+ {
+ this->value[0] -= m[0];
+ this->value[1] -= m[1];
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat2x2<T>& tmat2x2<T>::operator*=
+ (
+ U const & s
+ )
+ {
+ this->value[0] *= s;
+ this->value[1] *= s;
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat2x2<T>& tmat2x2<T>::operator*=
+ (
+ tmat2x2<U> const & m
+ )
+ {
+ return (*this = *this * m);
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat2x2<T>& tmat2x2<T>::operator/=
+ (
+ U const & s
+ )
+ {
+ this->value[0] /= s;
+ this->value[1] /= s;
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat2x2<T>& tmat2x2<T>::operator/=
+ (
+ tmat2x2<U> const & m
+ )
+ {
+ return (*this = *this / m);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x2<T>& tmat2x2<T>::operator++ ()
+ {
+ ++this->value[0];
+ ++this->value[1];
+ return *this;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x2<T>& tmat2x2<T>::operator-- ()
+ {
+ --this->value[0];
+ --this->value[1];
+ return *this;
+ }
+
+ //////////////////////////////////////////////////////////////
+ // Binary operators
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x2<T> operator+
+ (
+ tmat2x2<T> const & m,
+ typename tmat2x2<T>::value_type const & s
+ )
+ {
+ return tmat2x2<T>(
+ m[0] + s,
+ m[1] + s);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x2<T> operator+
+ (
+ typename tmat2x2<T>::value_type const & s,
+ tmat2x2<T> const & m
+ )
+ {
+ return tmat2x2<T>(
+ m[0] + s,
+ m[1] + s);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x2<T> operator+
+ (
+ tmat2x2<T> const & m1,
+ tmat2x2<T> const & m2
+ )
+ {
+ return tmat2x2<T>(
+ m1[0] + m2[0],
+ m1[1] + m2[1]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x2<T> operator-
+ (
+ tmat2x2<T> const & m,
+ typename tmat2x2<T>::value_type const & s
+ )
+ {
+ return tmat2x2<T>(
+ m[0] - s,
+ m[1] - s);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x2<T> operator-
+ (
+ typename tmat2x2<T>::value_type const & s,
+ tmat2x2<T> const & m
+ )
+ {
+ return tmat2x2<T>(
+ s - m[0],
+ s - m[1]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x2<T> operator-
+ (
+ tmat2x2<T> const & m1,
+ tmat2x2<T> const & m2
+ )
+ {
+ return tmat2x2<T>(
+ m1[0] - m2[0],
+ m1[1] - m2[1]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x2<T> operator*
+ (
+ tmat2x2<T> const & m,
+ typename tmat2x2<T>::value_type const & s
+ )
+ {
+ return tmat2x2<T>(
+ m[0] * s,
+ m[1] * s);
+ }
+
+ // X
+ // X
+ // X X
+ // X X
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x2<T> operator*
+ (
+ typename tmat2x2<T>::value_type const & s,
+ tmat2x2<T> const & m
+ )
+ {
+ return tmat2x2<T>(
+ m[0] * s,
+ m[1] * s);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tmat2x2<T>::col_type operator*
+ (
+ tmat2x2<T> const & m,
+ typename tmat2x2<T>::row_type const & v
+ )
+ {
+ return detail::tvec2<T>(
+ m[0][0] * v.x + m[1][0] * v.y,
+ m[0][1] * v.x + m[1][1] * v.y);
+ }
+
+ // X X
+ // X X
+ // X X
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tmat2x2<T>::row_type operator*
+ (
+ typename tmat2x2<T>::col_type const & v,
+ tmat2x2<T> const & m
+ )
+ {
+ return detail::tvec2<T>(
+ v.x * m[0][0] + v.y * m[0][1],
+ v.x * m[1][0] + v.y * m[1][1]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x2<T> operator*
+ (
+ tmat2x2<T> const & m1,
+ tmat2x2<T> const & m2
+ )
+ {
+ return tmat2x2<T>(
+ m1[0][0] * m2[0][0] + m1[1][0] * m2[0][1],
+ m1[0][1] * m2[0][0] + m1[1][1] * m2[0][1],
+ m1[0][0] * m2[1][0] + m1[1][0] * m2[1][1],
+ m1[0][1] * m2[1][0] + m1[1][1] * m2[1][1]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x2<T> operator/
+ (
+ tmat2x2<T> const & m,
+ typename tmat2x2<T>::value_type const & s
+ )
+ {
+ return tmat2x2<T>(
+ m[0] / s,
+ m[1] / s);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x2<T> operator/
+ (
+ typename tmat2x2<T>::value_type const & s,
+ tmat2x2<T> const & m
+ )
+ {
+ return tmat2x2<T>(
+ s / m[0],
+ s / m[1]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tmat2x2<T>::col_type operator/
+ (
+ tmat2x2<T> const & m,
+ typename tmat2x2<T>::row_type & v
+ )
+ {
+ return m._inverse() * v;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tmat2x2<T>::row_type operator/
+ (
+ typename tmat2x2<T>::col_type const & v,
+ tmat2x2<T> const & m
+ )
+ {
+ return v * m._inverse();
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x2<T> operator/
+ (
+ tmat2x2<T> const & m1,
+ tmat2x2<T> const & m2
+ )
+ {
+ return m1 * m2._inverse();
+ }
+
+ // Unary constant operators
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x2<T> const operator-
+ (
+ tmat2x2<T> const & m
+ )
+ {
+ return tmat2x2<T>(
+ -m[0],
+ -m[1]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x2<T> const operator++
+ (
+ tmat2x2<T> const & m,
+ int
+ )
+ {
+ return tmat2x2<T>(
+ m[0] + T(1),
+ m[1] + T(1));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x2<T> const operator--
+ (
+ tmat2x2<T> const & m,
+ int
+ )
+ {
+ return tmat2x2<T>(
+ m[0] - T(1),
+ m[1] - T(1));
+ }
+
+ //////////////////////////////////////
+ // Boolean operators
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER bool operator==
+ (
+ tmat2x2<T> const & m1,
+ tmat2x2<T> const & m2
+ )
+ {
+ return (m1[0] == m2[0]) && (m1[1] == m2[1]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER bool operator!=
+ (
+ tmat2x2<T> const & m1,
+ tmat2x2<T> const & m2
+ )
+ {
+ return (m1[0] != m2[0]) || (m1[1] != m2[1]);
+ }
+
+} //namespace detail
+} //namespace glm
diff --git a/src/glm/core/type_mat2x3.hpp b/src/glm/core/type_mat2x3.hpp
new file mode 100644
index 0000000..63d1d0e
--- /dev/null
+++ b/src/glm/core/type_mat2x3.hpp
@@ -0,0 +1,227 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2006-10-01
+// Updated : 2010-02-03
+// Licence : This source is under MIT License
+// File : glm/core/type_mat2x3.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_core_type_mat2x3
+#define glm_core_type_mat2x3
+
+#include "type_mat.hpp"
+
+namespace glm{
+namespace detail
+{
+ template <typename T> struct tvec1;
+ template <typename T> struct tvec2;
+ template <typename T> struct tvec3;
+ template <typename T> struct tvec4;
+ template <typename T> struct tmat2x2;
+ template <typename T> struct tmat2x3;
+ template <typename T> struct tmat2x4;
+ template <typename T> struct tmat3x2;
+ template <typename T> struct tmat3x3;
+ template <typename T> struct tmat3x4;
+ template <typename T> struct tmat4x2;
+ template <typename T> struct tmat4x3;
+ template <typename T> struct tmat4x4;
+
+ //! \brief Template for 2 columns and 3 rows matrix of floating-point numbers.
+ //! \ingroup core_template
+ template <typename T>
+ struct tmat2x3
+ {
+ enum ctor{null};
+ typedef T value_type;
+ typedef std::size_t size_type;
+ typedef tvec3<T> col_type;
+ typedef tvec2<T> row_type;
+ static GLM_FUNC_DECL size_type col_size();
+ static GLM_FUNC_DECL size_type row_size();
+
+ typedef tmat2x3<T> type;
+ typedef tmat3x2<T> transpose_type;
+
+ private:
+ // Data
+ col_type value[2];
+
+ public:
+ // Constructors
+ GLM_FUNC_DECL tmat2x3();
+ GLM_FUNC_DECL tmat2x3(tmat2x3 const & m);
+
+ GLM_FUNC_DECL explicit tmat2x3(
+ ctor);
+ GLM_FUNC_DECL explicit tmat2x3(
+ value_type const & s);
+ GLM_FUNC_DECL explicit tmat2x3(
+ value_type const & x0, value_type const & y0, value_type const & z0,
+ value_type const & x1, value_type const & y1, value_type const & z1);
+ GLM_FUNC_DECL explicit tmat2x3(
+ col_type const & v0,
+ col_type const & v1);
+
+
+ //////////////////////////////////////
+ // Conversions
+ template <typename U>
+ GLM_FUNC_DECL explicit tmat2x3(
+ U const & x);
+
+ template <typename X1, typename Y1, typename Z1, typename X2, typename Y2, typename Z2>
+ GLM_FUNC_DECL explicit tmat2x3(
+ X1 const & x1, Y1 const & y1, Z1 const & z1,
+ X2 const & x2, Y2 const & y2, Z2 const & z2);
+
+ template <typename U, typename V>
+ GLM_FUNC_DECL explicit tmat2x3(
+ tvec3<U> const & v1,
+ tvec3<V> const & v2);
+
+ //////////////////////////////////////
+ // Matrix conversion
+ template <typename U>
+ GLM_FUNC_DECL explicit tmat2x3(tmat2x3<U> const & m);
+
+ GLM_FUNC_DECL explicit tmat2x3(tmat2x2<T> const & x);
+ GLM_FUNC_DECL explicit tmat2x3(tmat3x3<T> const & x);
+ GLM_FUNC_DECL explicit tmat2x3(tmat4x4<T> const & x);
+ GLM_FUNC_DECL explicit tmat2x3(tmat2x4<T> const & x);
+ GLM_FUNC_DECL explicit tmat2x3(tmat3x2<T> const & x);
+ GLM_FUNC_DECL explicit tmat2x3(tmat3x4<T> const & x);
+ GLM_FUNC_DECL explicit tmat2x3(tmat4x2<T> const & x);
+ GLM_FUNC_DECL explicit tmat2x3(tmat4x3<T> const & x);
+
+ // Accesses
+ col_type & operator[](size_type i);
+ col_type const & operator[](size_type i) const;
+
+ // Unary updatable operators
+ GLM_FUNC_DECL tmat2x3<T> & operator= (tmat2x3<T> const & m);
+ template <typename U>
+ GLM_FUNC_DECL tmat2x3<T> & operator= (tmat2x3<U> const & m);
+ template <typename U>
+ GLM_FUNC_DECL tmat2x3<T> & operator+= (U const & s);
+ template <typename U>
+ GLM_FUNC_DECL tmat2x3<T> & operator+= (tmat2x3<U> const & m);
+ template <typename U>
+ GLM_FUNC_DECL tmat2x3<T> & operator-= (U const & s);
+ template <typename U>
+ GLM_FUNC_DECL tmat2x3<T> & operator-= (tmat2x3<U> const & m);
+ template <typename U>
+ GLM_FUNC_DECL tmat2x3<T> & operator*= (U const & s);
+ template <typename U>
+ GLM_FUNC_DECL tmat2x3<T> & operator*= (tmat2x3<U> const & m);
+ template <typename U>
+ GLM_FUNC_DECL tmat2x3<T> & operator/= (U const & s);
+
+ GLM_FUNC_DECL tmat2x3<T> & operator++ ();
+ GLM_FUNC_DECL tmat2x3<T> & operator-- ();
+ };
+
+ // Binary operators
+ template <typename T>
+ tmat2x3<T> operator+ (
+ tmat2x3<T> const & m,
+ typename tmat2x3<T>::value_type const & s);
+
+ template <typename T>
+ tmat2x3<T> operator+ (
+ tmat2x3<T> const & m1,
+ tmat2x3<T> const & m2);
+
+ template <typename T>
+ tmat2x3<T> operator- (
+ tmat2x3<T> const & m,
+ typename tmat2x3<T>::value_type const & s);
+
+ template <typename T>
+ tmat2x3<T> operator- (
+ tmat2x3<T> const & m1,
+ tmat2x3<T> const & m2);
+
+ template <typename T>
+ tmat2x3<T> operator* (
+ tmat2x3<T> const & m,
+ typename tmat2x3<T>::value_type const & s);
+
+ template <typename T>
+ tmat2x3<T> operator* (
+ typename tmat2x3<T>::value_type const & s,
+ tmat2x3<T> const & m);
+
+ template <typename T>
+ typename tmat2x3<T>::col_type operator* (
+ tmat2x3<T> const & m,
+ typename tmat2x3<T>::row_type const & v);
+
+ template <typename T>
+ typename tmat2x3<T>::row_type operator* (
+ typename tmat2x3<T>::col_type const & v,
+ tmat2x3<T> const & m);
+
+ template <typename T>
+ tmat3x3<T> operator* (
+ tmat2x3<T> const & m1,
+ tmat3x2<T> const & m2);
+
+ template <typename T>
+ tmat2x3<T> operator/ (
+ tmat2x3<T> const & m,
+ typename tmat2x3<T>::value_type const & s);
+
+ template <typename T>
+ tmat2x3<T> operator/ (
+ typename tmat2x3<T>::value_type const & s,
+ tmat2x3<T> const & m);
+
+ // Unary constant operators
+ template <typename T>
+ tmat2x3<T> const operator- (
+ tmat2x3<T> const & m);
+
+ template <typename T>
+ tmat2x3<T> const operator-- (
+ tmat2x3<T> const & m,
+ int);
+
+ template <typename T>
+ tmat2x3<T> const operator++ (
+ tmat2x3<T> const & m,
+ int);
+
+} //namespace detail
+
+namespace core{
+namespace type{
+namespace precision
+{
+ //! 2 columns of 3 components matrix of low precision floating-point numbers.
+ //! There is no guarantee on the actual precision.
+ //! (From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers)
+ //! \ingroup core_precision
+ typedef detail::tmat2x3<lowp_float> lowp_mat2x3;
+ //! 2 columns of 3 components matrix of medium precision floating-point numbers.
+ //! There is no guarantee on the actual precision.
+ //! (From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers)
+ //! \ingroup core_precision
+ typedef detail::tmat2x3<mediump_float> mediump_mat2x3;
+ //! 2 columns of 3 components matrix of high precision floating-point numbers.
+ //! There is no guarantee on the actual precision.
+ //! (From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers)
+ //! \ingroup core_precision
+ typedef detail::tmat2x3<highp_float> highp_mat2x3;
+}//namespace precision
+}//namespace type
+}//namespace core
+}//namespace glm
+
+#ifndef GLM_EXTERNAL_TEMPLATE
+#include "type_mat2x3.inl"
+#endif
+
+#endif //glm_core_type_mat2x3
diff --git a/src/glm/core/type_mat2x3.inl b/src/glm/core/type_mat2x3.inl
new file mode 100644
index 0000000..7b987e0
--- /dev/null
+++ b/src/glm/core/type_mat2x3.inl
@@ -0,0 +1,583 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2006-08-05
+// Updated : 2010-02-03
+// Licence : This source is under MIT License
+// File : glm/core/type_mat2x3.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm{
+namespace detail
+{
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tmat2x3<T>::size_type tmat2x3<T>::col_size()
+ {
+ return 3;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tmat2x3<T>::size_type tmat2x3<T>::row_size()
+ {
+ return 2;
+ }
+
+ //////////////////////////////////////
+ // Accesses
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tmat2x3<T>::col_type &
+ tmat2x3<T>::operator[]
+ (
+ size_type i
+ )
+ {
+ assert(i < this->row_size());
+ return this->value[i];
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tmat2x3<T>::col_type const &
+ tmat2x3<T>::operator[]
+ (
+ size_type i
+ ) const
+ {
+ assert(i < this->row_size());
+ return this->value[i];
+ }
+
+ //////////////////////////////////////////////////////////////
+ // Constructors
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x3<T>::tmat2x3()
+ {
+ this->value[0] = col_type(T(1), T(0), T(0));
+ this->value[1] = col_type(T(0), T(1), T(0));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x3<T>::tmat2x3
+ (
+ tmat2x3<T> const & m
+ )
+ {
+ this->value[0] = m.value[0];
+ this->value[1] = m.value[1];
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x3<T>::tmat2x3
+ (
+ ctor
+ )
+ {}
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x3<T>::tmat2x3
+ (
+ value_type const & s
+ )
+ {
+ this->value[0] = col_type(s, T(0), T(0));
+ this->value[1] = col_type(T(0), s, T(0));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x3<T>::tmat2x3
+ (
+ value_type const & x0, value_type const & y0, value_type const & z0,
+ value_type const & x1, value_type const & y1, value_type const & z1
+ )
+ {
+ this->value[0] = col_type(x0, y0, z0);
+ this->value[1] = col_type(x1, y1, z1);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x3<T>::tmat2x3
+ (
+ col_type const & v0,
+ col_type const & v1
+ )
+ {
+ this->value[0] = v0;
+ this->value[1] = v1;
+ }
+
+ //////////////////////////////////////
+ // Convertion constructors
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_DECL tmat2x3<T>::tmat2x3
+ (
+ U const & s
+ )
+ {
+ value_type const Zero(0);
+ this->value[0] = tvec3<T>(value_type(s), Zero, Zero);
+ this->value[1] = tvec3<T>(Zero, value_type(s), Zero);
+ }
+
+ template <typename T>
+ template <
+ typename X1, typename Y1, typename Z1,
+ typename X2, typename Y2, typename Z2>
+ GLM_FUNC_DECL tmat2x3<T>::tmat2x3
+ (
+ X1 const & x1, Y1 const & y1, Z1 const & z1,
+ X2 const & x2, Y2 const & y2, Z2 const & z2
+ )
+ {
+ this->value[0] = col_type(value_type(x1), value_type(y1), value_type(z1));
+ this->value[1] = col_type(value_type(x2), value_type(y2), value_type(z2));
+ }
+
+ template <typename T>
+ template <typename V1, typename V2>
+ GLM_FUNC_DECL tmat2x3<T>::tmat2x3
+ (
+ tvec3<V1> const & v1,
+ tvec3<V2> const & v2
+ )
+ {
+ this->value[0] = col_type(v1);
+ this->value[1] = col_type(v2);
+ }
+
+ //////////////////////////////////////
+ // Matrix conversions
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat2x3<T>::tmat2x3
+ (
+ tmat2x3<U> const & m
+ )
+ {
+ this->value[0] = col_type(m[0]);
+ this->value[1] = col_type(m[1]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x3<T>::tmat2x3
+ (
+ tmat2x2<T> const & m
+ )
+ {
+ this->value[0] = col_type(m[0], T(0));
+ this->value[1] = col_type(m[1], T(0));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x3<T>::tmat2x3
+ (
+ tmat3x3<T> const & m
+ )
+ {
+ this->value[0] = col_type(m[0]);
+ this->value[1] = col_type(m[1]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x3<T>::tmat2x3
+ (
+ tmat4x4<T> const & m
+ )
+ {
+ this->value[0] = col_type(m[0]);
+ this->value[1] = col_type(m[1]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x3<T>::tmat2x3
+ (
+ tmat2x4<T> const & m
+ )
+ {
+ this->value[0] = col_type(m[0]);
+ this->value[1] = col_type(m[1]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x3<T>::tmat2x3
+ (
+ tmat3x2<T> const & m
+ )
+ {
+ this->value[0] = col_type(m[0], T(0));
+ this->value[1] = col_type(m[1], T(0));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x3<T>::tmat2x3
+ (
+ tmat3x4<T> const & m
+ )
+ {
+ this->value[0] = col_type(m[0]);
+ this->value[1] = col_type(m[1]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x3<T>::tmat2x3
+ (
+ tmat4x2<T> const & m
+ )
+ {
+ this->value[0] = col_type(m[0], T(0));
+ this->value[1] = col_type(m[1], T(0));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x3<T>::tmat2x3
+ (
+ tmat4x3<T> const & m
+ )
+ {
+ this->value[0] = m[0];
+ this->value[1] = m[1];
+ }
+
+ //////////////////////////////////////////////////////////////
+ // Unary updatable operators
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x3<T>& tmat2x3<T>::operator=
+ (
+ tmat2x3<T> const & m
+ )
+ {
+ this->value[0] = m[0];
+ this->value[1] = m[1];
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat2x3<T>& tmat2x3<T>::operator=
+ (
+ tmat2x3<U> const & m
+ )
+ {
+ this->value[0] = m[0];
+ this->value[1] = m[1];
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat2x3<T> & tmat2x3<T>::operator+=
+ (
+ U const & s
+ )
+ {
+ this->value[0] += s;
+ this->value[1] += s;
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat2x3<T>& tmat2x3<T>::operator+=
+ (
+ tmat2x3<U> const & m
+ )
+ {
+ this->value[0] += m[0];
+ this->value[1] += m[1];
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat2x3<T>& tmat2x3<T>::operator-=
+ (
+ U const & s
+ )
+ {
+ this->value[0] -= s;
+ this->value[1] -= s;
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat2x3<T>& tmat2x3<T>::operator-=
+ (
+ tmat2x3<U> const & m
+ )
+ {
+ this->value[0] -= m[0];
+ this->value[1] -= m[1];
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat2x3<T>& tmat2x3<T>::operator*=
+ (
+ U const & s
+ )
+ {
+ this->value[0] *= s;
+ this->value[1] *= s;
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat2x3<T> & tmat2x3<T>::operator*=
+ (
+ tmat2x3<U> const & m
+ )
+ {
+ return (*this = tmat2x3<U>(*this * m));
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat2x3<T> & tmat2x3<T>::operator/=
+ (
+ U const & s
+ )
+ {
+ this->value[0] /= s;
+ this->value[1] /= s;
+ return *this;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x3<T> & tmat2x3<T>::operator++ ()
+ {
+ ++this->value[0];
+ ++this->value[1];
+ return *this;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x3<T> & tmat2x3<T>::operator-- ()
+ {
+ --this->value[0];
+ --this->value[1];
+ return *this;
+ }
+
+ //////////////////////////////////////////////////////////////
+ // Binary operators
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x3<T> operator+
+ (
+ tmat2x3<T> const & m,
+ typename tmat2x3<T>::value_type const & s
+ )
+ {
+ return tmat2x3<T>(
+ m[0] + s,
+ m[1] + s);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x3<T> operator+
+ (
+ tmat2x3<T> const & m1,
+ tmat2x3<T> const & m2
+ )
+ {
+ return tmat2x3<T>(
+ m1[0] + m2[0],
+ m1[1] + m2[1]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x3<T> operator-
+ (
+ tmat2x3<T> const & m,
+ typename tmat2x3<T>::value_type const & s
+ )
+ {
+ return tmat2x3<T>(
+ m[0] - s,
+ m[1] - s);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x3<T> operator-
+ (
+ tmat2x3<T> const & m1,
+ tmat2x3<T> const & m2
+ )
+ {
+ return tmat2x3<T>(
+ m1[0] - m2[0],
+ m1[1] - m2[1]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x3<T> operator*
+ (
+ tmat2x3<T> const & m,
+ typename tmat2x3<T>::value_type const & s
+ )
+ {
+ return tmat2x3<T>(
+ m[0] * s,
+ m[1] * s);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x3<T> operator*
+ (
+ typename tmat2x3<T>::value_type const & s,
+ tmat2x3<T> const & m
+ )
+ {
+ return tmat2x3<T>(
+ m[0] * s,
+ m[1] * s);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tmat2x3<T>::col_type operator*
+ (
+ tmat2x3<T> const & m,
+ typename tmat2x3<T>::row_type const & v)
+ {
+ return typename tmat2x3<T>::col_type(
+ m[0][0] * v.x + m[1][0] * v.y,
+ m[0][1] * v.x + m[1][1] * v.y,
+ m[0][2] * v.x + m[1][2] * v.y);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tmat2x3<T>::row_type operator*
+ (
+ typename tmat2x3<T>::col_type const & v,
+ tmat2x3<T> const & m)
+ {
+ return typename tmat2x3<T>::row_type(
+ v.x * m[0][0] + v.y * m[0][1] + v.z * m[0][2],
+ v.x * m[1][0] + v.y * m[1][1] + v.z * m[1][2]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x3<T> operator*
+ (
+ tmat2x3<T> const & m1,
+ tmat3x2<T> const & m2
+ )
+ {
+ typename tmat2x3<T>::value_type SrcA00 = m1[0][0];
+ typename tmat2x3<T>::value_type SrcA01 = m1[0][1];
+ typename tmat2x3<T>::value_type SrcA02 = m1[0][2];
+ typename tmat2x3<T>::value_type SrcA10 = m1[1][0];
+ typename tmat2x3<T>::value_type SrcA11 = m1[1][1];
+ typename tmat2x3<T>::value_type SrcA12 = m1[1][2];
+
+ typename tmat2x3<T>::value_type SrcB00 = m2[0][0];
+ typename tmat2x3<T>::value_type SrcB01 = m2[0][1];
+ typename tmat2x3<T>::value_type SrcB10 = m2[1][0];
+ typename tmat2x3<T>::value_type SrcB11 = m2[1][1];
+ typename tmat2x3<T>::value_type SrcB20 = m2[2][0];
+ typename tmat2x3<T>::value_type SrcB21 = m2[2][1];
+
+ tmat3x3<T> Result(tmat3x3<T>::null);
+ Result[0][0] = SrcA00 * SrcB00 + SrcA10 * SrcB01;
+ Result[0][1] = SrcA01 * SrcB00 + SrcA11 * SrcB01;
+ Result[0][2] = SrcA02 * SrcB00 + SrcA12 * SrcB01;
+ Result[1][0] = SrcA00 * SrcB10 + SrcA10 * SrcB11;
+ Result[1][1] = SrcA01 * SrcB10 + SrcA11 * SrcB11;
+ Result[1][2] = SrcA02 * SrcB10 + SrcA12 * SrcB11;
+ Result[2][0] = SrcA00 * SrcB20 + SrcA10 * SrcB21;
+ Result[2][1] = SrcA01 * SrcB20 + SrcA11 * SrcB21;
+ Result[2][2] = SrcA02 * SrcB20 + SrcA12 * SrcB21;
+ return Result;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x3<T> operator/
+ (
+ tmat2x3<T> const & m,
+ typename tmat2x3<T>::value_type const & s
+ )
+ {
+ return tmat2x3<T>(
+ m[0] / s,
+ m[1] / s);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x3<T> operator/
+ (
+ typename tmat2x3<T>::value_type const & s,
+ tmat2x3<T> const & m
+ )
+ {
+ return tmat2x3<T>(
+ s / m[0],
+ s / m[1]);
+ }
+
+ // Unary constant operators
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x3<T> const operator-
+ (
+ tmat2x3<T> const & m
+ )
+ {
+ return tmat2x3<T>(
+ -m[0],
+ -m[1]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x3<T> const operator++
+ (
+ tmat2x3<T> const & m,
+ int
+ )
+ {
+ return tmat2x3<T>(
+ m[0] + typename tmat2x3<T>::value_type(1),
+ m[1] + typename tmat2x3<T>::value_type(1));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x3<T> const operator--
+ (
+ tmat2x3<T> const & m,
+ int
+ )
+ {
+ return tmat2x3<T>(
+ m[0] - typename tmat2x3<T>::value_type(1),
+ m[1] - typename tmat2x3<T>::value_type(1));
+ }
+
+ //////////////////////////////////////
+ // Boolean operators
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER bool operator==
+ (
+ tmat2x3<T> const & m1,
+ tmat2x3<T> const & m2
+ )
+ {
+ return (m1[0] == m2[0]) && (m1[1] == m2[1]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER bool operator!=
+ (
+ tmat2x3<T> const & m1,
+ tmat2x3<T> const & m2
+ )
+ {
+ return (m1[0] != m2[0]) || (m1[1] != m2[1]);
+ }
+
+} //namespace detail
+} //namespace glm
diff --git a/src/glm/core/type_mat2x4.hpp b/src/glm/core/type_mat2x4.hpp
new file mode 100644
index 0000000..0016ed4
--- /dev/null
+++ b/src/glm/core/type_mat2x4.hpp
@@ -0,0 +1,225 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2006-08-05
+// Updated : 2010-02-11
+// Licence : This source is under MIT License
+// File : glm/core/type_mat2x4.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_core_type_mat2x4
+#define glm_core_type_mat2x4
+
+#include "type_mat.hpp"
+
+namespace glm{
+namespace detail
+{
+ template <typename T> struct tvec1;
+ template <typename T> struct tvec2;
+ template <typename T> struct tvec3;
+ template <typename T> struct tvec4;
+ template <typename T> struct tmat2x2;
+ template <typename T> struct tmat2x3;
+ template <typename T> struct tmat2x4;
+ template <typename T> struct tmat3x2;
+ template <typename T> struct tmat3x3;
+ template <typename T> struct tmat3x4;
+ template <typename T> struct tmat4x2;
+ template <typename T> struct tmat4x3;
+ template <typename T> struct tmat4x4;
+
+ //! Template for 2 columns and 4 rows matrix of floating-point numbers.
+ //! \ingroup core_template
+ template <typename T>
+ struct tmat2x4
+ {
+ enum ctor{null};
+ typedef T value_type;
+ typedef std::size_t size_type;
+ typedef tvec4<T> col_type;
+ typedef tvec2<T> row_type;
+ static GLM_FUNC_DECL size_type col_size();
+ static GLM_FUNC_DECL size_type row_size();
+
+ typedef tmat2x4<T> type;
+ typedef tmat4x2<T> transpose_type;
+
+ private:
+ // Data
+ col_type value[2];
+
+ public:
+ // Constructors
+ GLM_FUNC_DECL tmat2x4();
+ GLM_FUNC_DECL tmat2x4(tmat2x4 const & m);
+
+ GLM_FUNC_DECL explicit tmat2x4(
+ ctor);
+ GLM_FUNC_DECL explicit tmat2x4(
+ value_type const & s);
+ GLM_FUNC_DECL explicit tmat2x4(
+ value_type const & x0, value_type const & y0, value_type const & z0, value_type const & w0,
+ value_type const & x1, value_type const & y1, value_type const & z1, value_type const & w1);
+ GLM_FUNC_DECL explicit tmat2x4(
+ col_type const & v0,
+ col_type const & v1);
+
+ //////////////////////////////////////
+ // Conversions
+ template <typename U>
+ GLM_FUNC_DECL explicit tmat2x4(
+ U const & x);
+
+ template <
+ typename X1, typename Y1, typename Z1, typename W1,
+ typename X2, typename Y2, typename Z2, typename W2>
+ GLM_FUNC_DECL explicit tmat2x4(
+ X1 const & x1, Y1 const & y1, Z1 const & z1, W1 const & w1,
+ X2 const & x2, Y2 const & y2, Z2 const & z2, W2 const & w2);
+
+ template <typename U, typename V>
+ GLM_FUNC_DECL explicit tmat2x4(
+ tvec4<U> const & v1,
+ tvec4<V> const & v2);
+
+ //////////////////////////////////////
+ // Matrix conversions
+ template <typename U>
+ GLM_FUNC_DECL explicit tmat2x4(tmat2x4<U> const & m);
+
+ GLM_FUNC_DECL explicit tmat2x4(tmat2x2<T> const & x);
+ GLM_FUNC_DECL explicit tmat2x4(tmat3x3<T> const & x);
+ GLM_FUNC_DECL explicit tmat2x4(tmat4x4<T> const & x);
+ GLM_FUNC_DECL explicit tmat2x4(tmat2x3<T> const & x);
+ GLM_FUNC_DECL explicit tmat2x4(tmat3x2<T> const & x);
+ GLM_FUNC_DECL explicit tmat2x4(tmat3x4<T> const & x);
+ GLM_FUNC_DECL explicit tmat2x4(tmat4x2<T> const & x);
+ GLM_FUNC_DECL explicit tmat2x4(tmat4x3<T> const & x);
+
+ // Accesses
+ GLM_FUNC_DECL col_type & operator[](size_type i);
+ GLM_FUNC_DECL col_type const & operator[](size_type i) const;
+
+ // Unary updatable operators
+ GLM_FUNC_DECL tmat2x4<T>& operator= (tmat2x4<T> const & m);
+ template <typename U>
+ GLM_FUNC_DECL tmat2x4<T>& operator= (tmat2x4<U> const & m);
+ template <typename U>
+ GLM_FUNC_DECL tmat2x4<T>& operator+= (U const & s);
+ template <typename U>
+ GLM_FUNC_DECL tmat2x4<T>& operator+= (tmat2x4<U> const & m);
+ template <typename U>
+ GLM_FUNC_DECL tmat2x4<T>& operator-= (U const & s);
+ template <typename U>
+ GLM_FUNC_DECL tmat2x4<T>& operator-= (tmat2x4<U> const & m);
+ template <typename U>
+ GLM_FUNC_DECL tmat2x4<T>& operator*= (U const & s);
+ template <typename U>
+ GLM_FUNC_DECL tmat2x4<T>& operator*= (tmat2x4<U> const & m);
+ template <typename U>
+ GLM_FUNC_DECL tmat2x4<T>& operator/= (U const & s);
+
+ GLM_FUNC_DECL tmat2x4<T>& operator++ ();
+ GLM_FUNC_DECL tmat2x4<T>& operator-- ();
+ };
+
+ // Binary operators
+ template <typename T>
+ tmat2x4<T> operator+ (
+ tmat2x4<T> const & m,
+ typename tmat2x4<T>::value_type const & s);
+
+ template <typename T>
+ tmat2x4<T> operator+ (
+ tmat2x4<T> const & m1,
+ tmat2x4<T> const & m2);
+
+ template <typename T>
+ tmat2x4<T> operator- (
+ tmat2x4<T> const & m,
+ typename tmat2x4<T>::value_type const & s);
+
+ template <typename T>
+ tmat2x4<T> operator- (
+ tmat2x4<T> const & m1,
+ tmat2x4<T> const & m2);
+
+ template <typename T>
+ tmat2x4<T> operator* (
+ tmat2x4<T> const & m,
+ typename tmat2x4<T>::value_type const & s);
+
+ template <typename T>
+ tmat2x4<T> operator* (
+ typename tmat2x4<T>::value_type const & s,
+ tmat2x4<T> const & m);
+
+ template <typename T>
+ typename tmat2x4<T>::col_type operator* (
+ tmat2x4<T> const & m,
+ typename tmat2x4<T>::row_type const & v);
+
+ template <typename T>
+ typename tmat2x4<T>::row_type operator* (
+ typename tmat2x4<T>::col_type const & v,
+ tmat2x4<T> const & m);
+
+ template <typename T>
+ tmat2x4<T> operator* (
+ tmat2x4<T> const & m1,
+ tmat2x4<T> const & m2);
+
+ template <typename T>
+ tmat2x4<T> operator/ (
+ tmat2x4<T> const & m,
+ typename tmat2x4<T>::value_type const & s);
+
+ template <typename T>
+ tmat2x4<T> operator/ (
+ typename tmat2x4<T>::value_type const & s,
+ tmat2x4<T> const & m);
+
+ // Unary constant operators
+ template <typename T>
+ tmat2x4<T> const operator- (
+ tmat2x4<T> const & m);
+
+ template <typename T>
+ tmat2x4<T> const operator-- (
+ tmat2x4<T> const & m,
+ int);
+
+ template <typename T>
+ tmat2x4<T> const operator++ (
+ tmat2x4<T> const & m,
+ int);
+
+} //namespace detail
+
+namespace core{
+namespace type{
+namespace precision
+{
+ //! 2 columns of 4 components matrix of low precision floating-point numbers.
+ //! There is no guarantee on the actual precision.
+ //! (From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers)
+ typedef detail::tmat2x4<lowp_float> lowp_mat2x4;
+ //! 2 columns of 4 components matrix of medium precision floating-point numbers.
+ //! There is no guarantee on the actual precision.
+ //! (From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers)
+ typedef detail::tmat2x4<mediump_float> mediump_mat2x4;
+ //! 2 columns of 4 components matrix of high precision floating-point numbers.
+ //! There is no guarantee on the actual precision.
+ //! (From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers)
+ typedef detail::tmat2x4<highp_float> highp_mat2x4;
+}//namespace precision
+}//namespace type
+}//namespace core
+}//namespace glm
+
+#ifndef GLM_EXTERNAL_TEMPLATE
+#include "type_mat2x4.inl"
+#endif
+
+#endif //glm_core_type_mat2x4
diff --git a/src/glm/core/type_mat2x4.inl b/src/glm/core/type_mat2x4.inl
new file mode 100644
index 0000000..94e9852
--- /dev/null
+++ b/src/glm/core/type_mat2x4.inl
@@ -0,0 +1,611 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2006-08-05
+// Updated : 2010-02-03
+// Licence : This source is under MIT License
+// File : glm/core/type_mat2x4.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm{
+namespace detail
+{
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tmat2x4<T>::size_type tmat2x4<T>::col_size()
+ {
+ return 4;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tmat2x4<T>::size_type tmat2x4<T>::row_size()
+ {
+ return 2;
+ }
+
+ //////////////////////////////////////
+ // Accesses
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tmat2x4<T>::col_type &
+ tmat2x4<T>::operator[]
+ (
+ size_type i
+ )
+ {
+ assert(i < this->row_size());
+ return this->value[i];
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tmat2x4<T>::col_type const &
+ tmat2x4<T>::operator[]
+ (
+ size_type i
+ ) const
+ {
+ assert(i < this->row_size());
+ return this->value[i];
+ }
+
+ //////////////////////////////////////////////////////////////
+ // Constructors
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x4<T>::tmat2x4()
+ {
+ value_type const Zero(0);
+ value_type const One(1);
+ this->value[0] = col_type(One, Zero, Zero, Zero);
+ this->value[1] = col_type(Zero, One, Zero, Zero);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x4<T>::tmat2x4
+ (
+ tmat2x4<T> const & m
+ )
+ {
+ this->value[0] = m.value[0];
+ this->value[1] = m.value[1];
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x4<T>::tmat2x4
+ (
+ ctor
+ )
+ {}
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x4<T>::tmat2x4
+ (
+ value_type const & s
+ )
+ {
+ value_type const Zero(0);
+ this->value[0] = col_type(s, Zero, Zero, Zero);
+ this->value[1] = col_type(Zero, Zero, Zero, Zero);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x4<T>::tmat2x4
+ (
+ value_type const & x0, value_type const & y0, value_type const & z0, value_type const & w0,
+ value_type const & x1, value_type const & y1, value_type const & z1, value_type const & w1
+ )
+ {
+ this->value[0] = col_type(x0, y0, z0, w0);
+ this->value[1] = col_type(x1, y1, z1, w1);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x4<T>::tmat2x4
+ (
+ col_type const & v0,
+ col_type const & v1
+ )
+ {
+ this->value[0] = v0;
+ this->value[1] = v1;
+ }
+
+ //////////////////////////////////////
+ // Convertion constructors
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_DECL tmat2x4<T>::tmat2x4
+ (
+ U const & s
+ )
+ {
+ value_type const Zero(0);
+ this->value[0] = tvec4<T>(value_type(s), Zero, Zero, Zero);
+ this->value[1] = tvec4<T>(Zero, value_type(s), Zero, Zero);
+ }
+
+ template <typename T>
+ template <
+ typename X1, typename Y1, typename Z1, typename W1,
+ typename X2, typename Y2, typename Z2, typename W2>
+ GLM_FUNC_DECL tmat2x4<T>::tmat2x4
+ (
+ X1 const & x1, Y1 const & y1, Z1 const & z1, W1 const & w1,
+ X2 const & x2, Y2 const & y2, Z2 const & z2, W2 const & w2
+ )
+ {
+ this->value[0] = col_type(value_type(x1), value_type(y1), value_type(z1), value_type(w1));
+ this->value[1] = col_type(value_type(x2), value_type(y2), value_type(z2), value_type(w2));
+ }
+
+ template <typename T>
+ template <typename V1, typename V2>
+ GLM_FUNC_DECL tmat2x4<T>::tmat2x4
+ (
+ tvec4<V1> const & v1,
+ tvec4<V2> const & v2
+ )
+ {
+ this->value[0] = col_type(v1);
+ this->value[1] = col_type(v2);
+ }
+
+ //////////////////////////////////////
+ // Matrix conversions
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat2x4<T>::tmat2x4
+ (
+ tmat2x4<U> const & m
+ )
+ {
+ this->value[0] = col_type(m[0]);
+ this->value[1] = col_type(m[1]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x4<T>::tmat2x4
+ (
+ tmat2x2<T> const & m
+ )
+ {
+ this->value[0] = col_type(m[0], detail::tvec2<T>(0));
+ this->value[1] = col_type(m[1], detail::tvec2<T>(0));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x4<T>::tmat2x4
+ (
+ tmat3x3<T> const & m
+ )
+ {
+ this->value[0] = col_type(m[0], T(0));
+ this->value[1] = col_type(m[1], T(0));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x4<T>::tmat2x4
+ (
+ tmat4x4<T> const & m
+ )
+ {
+ this->value[0] = col_type(m[0]);
+ this->value[1] = col_type(m[1]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x4<T>::tmat2x4
+ (
+ tmat2x3<T> const & m
+ )
+ {
+ this->value[0] = col_type(m[0], T(0));
+ this->value[1] = col_type(m[1], T(0));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x4<T>::tmat2x4
+ (
+ tmat3x2<T> const & m
+ )
+ {
+ this->value[0] = col_type(m[0], detail::tvec2<T>(0));
+ this->value[1] = col_type(m[1], detail::tvec2<T>(0));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x4<T>::tmat2x4
+ (
+ tmat3x4<T> const & m
+ )
+ {
+ this->value[0] = m[0];
+ this->value[1] = m[1];
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x4<T>::tmat2x4
+ (
+ tmat4x2<T> const & m
+ )
+ {
+ this->value[0] = col_type(m[0], detail::tvec2<T>(T(0)));
+ this->value[1] = col_type(m[1], detail::tvec2<T>(T(0)));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x4<T>::tmat2x4
+ (
+ tmat4x3<T> const & m
+ )
+ {
+ this->value[0] = col_type(m[0], T(0));
+ this->value[1] = col_type(m[1], T(0));
+ }
+
+ //////////////////////////////////////////////////////////////
+ // Unary updatable operators
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x4<T>& tmat2x4<T>::operator=
+ (
+ tmat2x4<T> const & m
+ )
+ {
+ this->value[0] = m[0];
+ this->value[1] = m[1];
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat2x4<T>& tmat2x4<T>::operator=
+ (
+ tmat2x4<U> const & m
+ )
+ {
+ this->value[0] = m[0];
+ this->value[1] = m[1];
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat2x4<T>& tmat2x4<T>::operator+=
+ (
+ U const & s
+ )
+ {
+ this->value[0] += s;
+ this->value[1] += s;
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat2x4<T>& tmat2x4<T>::operator+=
+ (
+ tmat2x4<U> const & m
+ )
+ {
+ this->value[0] += m[0];
+ this->value[1] += m[1];
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat2x4<T>& tmat2x4<T>::operator-=
+ (
+ U const & s
+ )
+ {
+ this->value[0] -= s;
+ this->value[1] -= s;
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat2x4<T>& tmat2x4<T>::operator-=
+ (
+ tmat2x4<U> const & m
+ )
+ {
+ this->value[0] -= m[0];
+ this->value[1] -= m[1];
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat2x4<T>& tmat2x4<T>::operator*=
+ (
+ U const & s
+ )
+ {
+ this->value[0] *= s;
+ this->value[1] *= s;
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat2x4<T>& tmat2x4<T>::operator*=
+ (
+ tmat2x4<U> const & m
+ )
+ {
+ return (*this = tmat2x4<T>(*this * m));
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat2x4<T> & tmat2x4<T>::operator/=
+ (
+ U const & s
+ )
+ {
+ this->value[0] /= s;
+ this->value[1] /= s;
+ return *this;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x4<T>& tmat2x4<T>::operator++ ()
+ {
+ ++this->value[0];
+ ++this->value[1];
+ return *this;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x4<T>& tmat2x4<T>::operator-- ()
+ {
+ --this->value[0];
+ --this->value[1];
+ return *this;
+ }
+
+ //////////////////////////////////////////////////////////////
+ // Binary operators
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x4<T> operator+
+ (
+ tmat2x4<T> const & m,
+ typename tmat2x4<T>::value_type const & s
+ )
+ {
+ return tmat2x4<T>(
+ m[0] + s,
+ m[1] + s);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x4<T> operator+
+ (
+ tmat2x4<T> const & m1,
+ tmat2x4<T> const & m2
+ )
+ {
+ return tmat2x4<T>(
+ m1[0] + m2[0],
+ m1[1] + m2[1]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x4<T> operator-
+ (
+ tmat2x4<T> const & m,
+ typename tmat2x4<T>::value_type const & s
+ )
+ {
+ return tmat2x4<T>(
+ m[0] - s,
+ m[1] - s);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x4<T> operator-
+ (
+ tmat2x4<T> const & m1,
+ tmat2x4<T> const & m2
+ )
+ {
+ return tmat2x4<T>(
+ m1[0] - m2[0],
+ m1[1] - m2[1]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x4<T> operator*
+ (
+ tmat2x4<T> const & m,
+ typename tmat2x4<T>::value_type const & s
+ )
+ {
+ return tmat2x4<T>(
+ m[0] * s,
+ m[1] * s);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x4<T> operator*
+ (
+ typename tmat2x4<T>::value_type const & s,
+ tmat2x4<T> const & m
+ )
+ {
+ return tmat2x4<T>(
+ m[0] * s,
+ m[1] * s);
+ }
+
+ // X
+ // X
+ // X X
+ // X X
+ // X X
+ // X X
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tmat2x4<T>::col_type operator*
+ (
+ tmat2x4<T> const & m,
+ typename tmat2x4<T>::row_type const & v
+ )
+ {
+ return typename tmat2x4<T>::col_type(
+ m[0][0] * v.x + m[1][0] * v.y,
+ m[0][1] * v.x + m[1][1] * v.y,
+ m[0][2] * v.x + m[1][2] * v.y,
+ m[0][3] * v.x + m[1][3] * v.y);
+ }
+
+ // X X
+ // X X
+ // X X
+ // X X
+ // X X X X
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tmat2x4<T>::row_type operator*
+ (
+ typename tmat2x4<T>::col_type const & v,
+ tmat2x4<T> const & m
+ )
+ {
+ return typename tmat2x4<T>::row_type(
+ v.x * m[0][0] + v.y * m[0][1] + v.z * m[0][2] + v.w * m[0][3],
+ v.x * m[1][0] + v.y * m[1][1] + v.z * m[1][2] + v.w * m[1][3]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x4<T> operator*
+ (
+ tmat2x4<T> const & m1,
+ tmat4x2<T> const & m2
+ )
+ {
+ typename tmat2x4<T>::value_type SrcA00 = m1[0][0];
+ typename tmat2x4<T>::value_type SrcA01 = m1[0][1];
+ typename tmat2x4<T>::value_type SrcA02 = m1[0][2];
+ typename tmat2x4<T>::value_type SrcA03 = m1[0][3];
+ typename tmat2x4<T>::value_type SrcA10 = m1[1][0];
+ typename tmat2x4<T>::value_type SrcA11 = m1[1][1];
+ typename tmat2x4<T>::value_type SrcA12 = m1[1][2];
+ typename tmat2x4<T>::value_type SrcA13 = m1[1][3];
+
+ typename tmat2x4<T>::value_type SrcB00 = m2[0][0];
+ typename tmat2x4<T>::value_type SrcB01 = m2[0][1];
+ typename tmat2x4<T>::value_type SrcB10 = m2[1][0];
+ typename tmat2x4<T>::value_type SrcB11 = m2[1][1];
+ typename tmat2x4<T>::value_type SrcB20 = m2[2][0];
+ typename tmat2x4<T>::value_type SrcB21 = m2[2][1];
+ typename tmat2x4<T>::value_type SrcB30 = m2[3][0];
+ typename tmat2x4<T>::value_type SrcB31 = m2[3][1];
+
+ tmat4x4<T> Result(tmat4x4<T>::null);
+ Result[0][0] = SrcA00 * SrcB00 + SrcA10 * SrcB01;
+ Result[0][1] = SrcA01 * SrcB00 + SrcA11 * SrcB01;
+ Result[0][2] = SrcA02 * SrcB00 + SrcA12 * SrcB01;
+ Result[0][3] = SrcA03 * SrcB00 + SrcA13 * SrcB01;
+ Result[1][0] = SrcA00 * SrcB10 + SrcA10 * SrcB11;
+ Result[1][1] = SrcA01 * SrcB10 + SrcA11 * SrcB11;
+ Result[1][2] = SrcA02 * SrcB10 + SrcA12 * SrcB11;
+ Result[1][3] = SrcA03 * SrcB10 + SrcA13 * SrcB11;
+ Result[2][0] = SrcA00 * SrcB20 + SrcA10 * SrcB21;
+ Result[2][1] = SrcA01 * SrcB20 + SrcA11 * SrcB21;
+ Result[2][2] = SrcA02 * SrcB20 + SrcA12 * SrcB21;
+ Result[2][3] = SrcA03 * SrcB20 + SrcA13 * SrcB21;
+ Result[3][0] = SrcA00 * SrcB30 + SrcA10 * SrcB31;
+ Result[3][1] = SrcA01 * SrcB30 + SrcA11 * SrcB31;
+ Result[3][2] = SrcA02 * SrcB30 + SrcA12 * SrcB31;
+ Result[3][3] = SrcA03 * SrcB30 + SrcA13 * SrcB31;
+ return Result;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x4<T> operator/
+ (
+ tmat2x4<T> const & m,
+ typename tmat2x4<T>::value_type const & s
+ )
+ {
+ return tmat2x4<T>(
+ m[0] / s,
+ m[1] / s);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x4<T> operator/
+ (
+ typename tmat2x4<T>::value_type const & s,
+ tmat2x4<T> const & m
+ )
+ {
+ return tmat2x4<T>(
+ s / m[0],
+ s / m[1]);
+ }
+
+ // Unary constant operators
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x4<T> const operator-
+ (
+ tmat2x4<T> const & m
+ )
+ {
+ return tmat2x4<T>(
+ -m[0],
+ -m[1]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x4<T> const operator++
+ (
+ tmat2x4<T> const & m,
+ int
+ )
+ {
+ return tmat2x4<T>(
+ m[0] + typename tmat2x4<T>::value_type(1),
+ m[1] + typename tmat2x4<T>::value_type(1));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x4<T> const operator--
+ (
+ tmat2x4<T> const & m,
+ int
+ )
+ {
+ return tmat2x4<T>(
+ m[0] - typename tmat2x4<T>::value_type(1),
+ m[1] - typename tmat2x4<T>::value_type(1));
+ }
+
+ //////////////////////////////////////
+ // Boolean operators
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER bool operator==
+ (
+ tmat2x4<T> const & m1,
+ tmat2x4<T> const & m2
+ )
+ {
+ return (m1[0] == m2[0]) && (m1[1] == m2[1]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER bool operator!=
+ (
+ tmat2x4<T> const & m1,
+ tmat2x4<T> const & m2
+ )
+ {
+ return (m1[0] != m2[0]) || (m1[1] != m2[1]);
+ }
+
+} //namespace detail
+} //namespace glm
diff --git a/src/glm/core/type_mat3x2.hpp b/src/glm/core/type_mat3x2.hpp
new file mode 100644
index 0000000..1a89835
--- /dev/null
+++ b/src/glm/core/type_mat3x2.hpp
@@ -0,0 +1,231 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2006-08-05
+// Updated : 2010-02-05
+// Licence : This source is under MIT License
+// File : glm/core/type_mat3x2.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_core_type_mat3x2
+#define glm_core_type_mat3x2
+
+#include "type_mat.hpp"
+
+namespace glm{
+namespace detail
+{
+ template <typename T> struct tvec1;
+ template <typename T> struct tvec2;
+ template <typename T> struct tvec3;
+ template <typename T> struct tvec4;
+ template <typename T> struct tmat2x2;
+ template <typename T> struct tmat2x3;
+ template <typename T> struct tmat2x4;
+ template <typename T> struct tmat3x2;
+ template <typename T> struct tmat3x3;
+ template <typename T> struct tmat3x4;
+ template <typename T> struct tmat4x2;
+ template <typename T> struct tmat4x3;
+ template <typename T> struct tmat4x4;
+
+ //! \brief Template for 3 columns and 2 rows matrix of floating-point numbers.
+ //! \ingroup core_template
+ template <typename T>
+ struct tmat3x2
+ {
+ enum ctor{null};
+ typedef T value_type;
+ typedef std::size_t size_type;
+ typedef tvec2<T> col_type;
+ typedef tvec3<T> row_type;
+ static GLM_FUNC_DECL size_type col_size();
+ static GLM_FUNC_DECL size_type row_size();
+
+ typedef tmat3x2<T> type;
+ typedef tmat2x3<T> transpose_type;
+
+ private:
+ // Data
+ col_type value[3];
+
+ public:
+ // Constructors
+ GLM_FUNC_DECL tmat3x2();
+ GLM_FUNC_DECL tmat3x2(tmat3x2 const & m);
+
+ GLM_FUNC_DECL explicit tmat3x2(
+ ctor);
+ GLM_FUNC_DECL explicit tmat3x2(
+ value_type const & s);
+ GLM_FUNC_DECL explicit tmat3x2(
+ value_type const & x0, value_type const & y0,
+ value_type const & x1, value_type const & y1,
+ value_type const & x2, value_type const & y2);
+ GLM_FUNC_DECL explicit tmat3x2(
+ col_type const & v0,
+ col_type const & v1,
+ col_type const & v2);
+
+ //////////////////////////////////////
+ // Conversions
+ template <typename U>
+ GLM_FUNC_DECL explicit tmat3x2(
+ U const & x);
+
+ template
+ <
+ typename X1, typename Y1,
+ typename X2, typename Y2,
+ typename X3, typename Y3
+ >
+ GLM_FUNC_DECL explicit tmat3x2(
+ X1 const & x1, Y1 const & y1,
+ X2 const & x2, Y2 const & y2,
+ X3 const & x3, Y3 const & y3);
+
+ template <typename V1, typename V2, typename V3>
+ GLM_FUNC_DECL explicit tmat3x2(
+ tvec2<V1> const & v1,
+ tvec2<V2> const & v2,
+ tvec2<V3> const & v3);
+
+ // Matrix conversions
+ template <typename U>
+ GLM_FUNC_DECL explicit tmat3x2(tmat3x2<U> const & m);
+
+ GLM_FUNC_DECL explicit tmat3x2(tmat2x2<T> const & x);
+ GLM_FUNC_DECL explicit tmat3x2(tmat3x3<T> const & x);
+ GLM_FUNC_DECL explicit tmat3x2(tmat4x4<T> const & x);
+ GLM_FUNC_DECL explicit tmat3x2(tmat2x3<T> const & x);
+ GLM_FUNC_DECL explicit tmat3x2(tmat2x4<T> const & x);
+ GLM_FUNC_DECL explicit tmat3x2(tmat3x4<T> const & x);
+ GLM_FUNC_DECL explicit tmat3x2(tmat4x2<T> const & x);
+ GLM_FUNC_DECL explicit tmat3x2(tmat4x3<T> const & x);
+
+ // Accesses
+ GLM_FUNC_DECL col_type & operator[](size_type i);
+ GLM_FUNC_DECL col_type const & operator[](size_type i) const;
+
+ // Unary updatable operators
+ GLM_FUNC_DECL tmat3x2<T> & operator= (tmat3x2<T> const & m);
+ template <typename U>
+ GLM_FUNC_DECL tmat3x2<T> & operator= (tmat3x2<U> const & m);
+ template <typename U>
+ GLM_FUNC_DECL tmat3x2<T> & operator+= (U const & s);
+ template <typename U>
+ GLM_FUNC_DECL tmat3x2<T> & operator+= (tmat3x2<U> const & m);
+ template <typename U>
+ GLM_FUNC_DECL tmat3x2<T> & operator-= (U const & s);
+ template <typename U>
+ GLM_FUNC_DECL tmat3x2<T> & operator-= (tmat3x2<U> const & m);
+ template <typename U>
+ GLM_FUNC_DECL tmat3x2<T> & operator*= (U const & s);
+ template <typename U>
+ GLM_FUNC_DECL tmat3x2<T> & operator*= (tmat3x2<U> const & m);
+ template <typename U>
+ GLM_FUNC_DECL tmat3x2<T> & operator/= (U const & s);
+
+ GLM_FUNC_DECL tmat3x2<T> & operator++ ();
+ GLM_FUNC_DECL tmat3x2<T> & operator-- ();
+ };
+
+ // Binary operators
+ template <typename T>
+ tmat3x2<T> operator+ (
+ tmat3x2<T> const & m,
+ typename tmat3x2<T>::value_type const & s);
+
+ template <typename T>
+ tmat3x2<T> operator+ (
+ tmat3x2<T> const & m1,
+ tmat3x2<T> const & m2);
+
+ template <typename T>
+ tmat3x2<T> operator- (
+ tmat3x2<T> const & m,
+ typename tmat3x2<T>::value_type const & s);
+
+ template <typename T>
+ tmat3x2<T> operator- (
+ tmat3x2<T> const & m1,
+ tmat3x2<T> const & m2);
+
+ template <typename T>
+ tmat3x2<T> operator* (
+ tmat3x2<T> const & m,
+ typename tmat3x2<T>::value_type const & s);
+
+ template <typename T>
+ tmat3x2<T> operator* (
+ typename tmat3x2<T>::value_type const & s,
+ tmat3x2<T> const & m);
+
+ template <typename T>
+ typename tmat3x2<T>::col_type operator* (
+ tmat3x2<T> const & m,
+ typename tmat3x2<T>::row_type const & v);
+
+ template <typename T>
+ typename tmat3x2<T>::row_type operator* (
+ typename tmat3x2<T>::col_type const & v,
+ tmat3x2<T> const & m);
+
+ template <typename T>
+ tmat2x2<T> operator* (
+ tmat3x2<T> const & m1,
+ tmat2x3<T> const & m2);
+
+ template <typename T>
+ tmat3x2<T> operator/ (
+ tmat3x2<T> const & m,
+ typename tmat3x2<T>::value_type const & s);
+
+ template <typename T>
+ tmat3x2<T> operator/ (
+ typename tmat3x2<T>::value_type const & s,
+ tmat3x2<T> const & m);
+
+ // Unary constant operators
+ template <typename T>
+ tmat3x2<T> const operator- (
+ tmat3x2<T> const & m);
+
+ template <typename T>
+ tmat3x2<T> const operator-- (
+ tmat3x2<T> const & m,
+ int);
+
+ template <typename T>
+ tmat3x2<T> const operator++ (
+ tmat3x2<T> const & m,
+ int);
+
+} //namespace detail
+
+namespace core{
+namespace type{
+namespace precision
+{
+ //! 3 columns of 2 components matrix of low precision floating-point numbers.
+ //! There is no guarantee on the actual precision.
+ //! (From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers)
+ typedef detail::tmat3x2<lowp_float> lowp_mat3x2;
+ //! 3 columns of 2 components matrix of medium precision floating-point numbers.
+ //! There is no guarantee on the actual precision.
+ //! (From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers)
+ typedef detail::tmat3x2<mediump_float> mediump_mat3x2;
+ //! 3 columns of 2 components matrix of high precision floating-point numbers.
+ //! There is no guarantee on the actual precision.
+ //! (From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers)
+ typedef detail::tmat3x2<highp_float> highp_mat3x2;
+}//namespace precision
+}//namespace type
+}//namespace core
+}//namespace glm
+
+#ifndef GLM_EXTERNAL_TEMPLATE
+#include "type_mat3x2.inl"
+#endif
+
+#endif //glm_core_type_mat3x2
diff --git a/src/glm/core/type_mat3x2.inl b/src/glm/core/type_mat3x2.inl
new file mode 100644
index 0000000..51e56a4
--- /dev/null
+++ b/src/glm/core/type_mat3x2.inl
@@ -0,0 +1,623 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2006-08-05
+// Updated : 2010-01-05
+// Licence : This source is under MIT License
+// File : glm/core/type_mat3x2.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm{
+namespace detail
+{
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tmat3x2<T>::size_type tmat3x2<T>::col_size()
+ {
+ return 2;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tmat3x2<T>::size_type tmat3x2<T>::row_size()
+ {
+ return 3;
+ }
+
+ //////////////////////////////////////
+ // Accesses
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tmat3x2<T>::col_type &
+ tmat3x2<T>::operator[]
+ (
+ size_type i
+ )
+ {
+ assert(i < this->row_size());
+ return this->value[i];
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tmat3x2<T>::col_type const &
+ tmat3x2<T>::operator[]
+ (
+ size_type i
+ ) const
+ {
+ assert(i < this->row_size());
+ return this->value[i];
+ }
+
+ //////////////////////////////////////////////////////////////
+ // Constructors
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x2<T>::tmat3x2()
+ {
+ this->value[0] = col_type(1, 0);
+ this->value[1] = col_type(0, 1);
+ this->value[2] = col_type(0, 0);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x2<T>::tmat3x2
+ (
+ tmat3x2<T> const & m
+ )
+ {
+ this->value[0] = m.value[0];
+ this->value[1] = m.value[1];
+ this->value[2] = m.value[2];
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x2<T>::tmat3x2
+ (
+ ctor
+ )
+ {}
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x2<T>::tmat3x2
+ (
+ value_type const & s
+ )
+ {
+ this->value[0] = col_type(s, 0);
+ this->value[1] = col_type(0, s);
+ this->value[2] = col_type(0, 0);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x2<T>::tmat3x2
+ (
+ value_type const & x0, value_type const & y0,
+ value_type const & x1, value_type const & y1,
+ value_type const & x2, value_type const & y2
+ )
+ {
+ this->value[0] = col_type(x0, y0);
+ this->value[1] = col_type(x1, y1);
+ this->value[2] = col_type(x2, y2);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x2<T>::tmat3x2
+ (
+ col_type const & v0,
+ col_type const & v1,
+ col_type const & v2
+ )
+ {
+ this->value[0] = v0;
+ this->value[1] = v1;
+ this->value[2] = v2;
+ }
+
+ //////////////////////////////////////
+ // Convertion constructors
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_DECL tmat3x2<T>::tmat3x2
+ (
+ U const & s
+ )
+ {
+ value_type const Zero(0);
+ this->value[0] = tvec2<T>(value_type(s), Zero);
+ this->value[1] = tvec2<T>(Zero, value_type(s));
+ this->value[2] = tvec2<T>(Zero);
+ }
+
+ template <typename T>
+ template <
+ typename X1, typename Y1,
+ typename X2, typename Y2,
+ typename X3, typename Y3>
+ GLM_FUNC_DECL tmat3x2<T>::tmat3x2
+ (
+ X1 const & x1, Y1 const & y1,
+ X2 const & x2, Y2 const & y2,
+ X3 const & x3, Y3 const & y3
+ )
+ {
+ this->value[0] = col_type(value_type(x1), value_type(y1));
+ this->value[1] = col_type(value_type(x2), value_type(y2));
+ this->value[2] = col_type(value_type(x3), value_type(y3));
+ }
+
+ template <typename T>
+ template <typename V1, typename V2, typename V3>
+ GLM_FUNC_DECL tmat3x2<T>::tmat3x2
+ (
+ tvec2<V1> const & v1,
+ tvec2<V2> const & v2,
+ tvec2<V3> const & v3
+ )
+ {
+ this->value[0] = col_type(v1);
+ this->value[1] = col_type(v2);
+ this->value[2] = col_type(v3);
+ }
+
+ //////////////////////////////////////////////////////////////
+ // mat3x2 matrix conversions
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat3x2<T>::tmat3x2
+ (
+ tmat3x2<U> const & m
+ )
+ {
+ this->value[0] = col_type(m[0]);
+ this->value[1] = col_type(m[1]);
+ this->value[2] = col_type(m[2]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x2<T>::tmat3x2
+ (
+ tmat2x2<T> const & m
+ )
+ {
+ this->value[0] = m[0];
+ this->value[1] = m[1];
+ this->value[2] = col_type(T(0));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x2<T>::tmat3x2
+ (
+ tmat3x3<T> const & m
+ )
+ {
+ this->value[0] = col_type(m[0]);
+ this->value[1] = col_type(m[1]);
+ this->value[2] = col_type(m[2]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x2<T>::tmat3x2
+ (
+ tmat4x4<T> const & m
+ )
+ {
+ this->value[0] = col_type(m[0]);
+ this->value[1] = col_type(m[1]);
+ this->value[2] = col_type(m[2]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x2<T>::tmat3x2
+ (
+ tmat2x3<T> const & m
+ )
+ {
+ this->value[0] = col_type(m[0]);
+ this->value[1] = col_type(m[1]);
+ this->value[2] = col_type(T(0));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x2<T>::tmat3x2
+ (
+ tmat2x4<T> const & m
+ )
+ {
+ this->value[0] = col_type(m[0]);
+ this->value[1] = col_type(m[1]);
+ this->value[2] = col_type(T(0));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x2<T>::tmat3x2
+ (
+ tmat3x4<T> const & m
+ )
+ {
+ this->value[0] = col_type(m[0]);
+ this->value[1] = col_type(m[1]);
+ this->value[2] = col_type(m[2]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x2<T>::tmat3x2
+ (
+ tmat4x2<T> const & m
+ )
+ {
+ this->value[0] = m[0];
+ this->value[1] = m[1];
+ this->value[2] = m[2];
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x2<T>::tmat3x2
+ (
+ tmat4x3<T> const & m
+ )
+ {
+ this->value[0] = col_type(m[0]);
+ this->value[1] = col_type(m[1]);
+ this->value[2] = col_type(m[2]);
+ }
+
+ //////////////////////////////////////////////////////////////
+ // Unary updatable operators
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x2<T>& tmat3x2<T>::operator=
+ (
+ tmat3x2<T> const & m
+ )
+ {
+ this->value[0] = m[0];
+ this->value[1] = m[1];
+ this->value[2] = m[2];
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat3x2<T>& tmat3x2<T>::operator=
+ (
+ tmat3x2<U> const & m
+ )
+ {
+ this->value[0] = m[0];
+ this->value[1] = m[1];
+ this->value[2] = m[2];
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat3x2<T>& tmat3x2<T>::operator+=
+ (
+ U const & s
+ )
+ {
+ this->value[0] += s;
+ this->value[1] += s;
+ this->value[2] += s;
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat3x2<T>& tmat3x2<T>::operator+=
+ (
+ tmat3x2<U> const & m
+ )
+ {
+ this->value[0] += m[0];
+ this->value[1] += m[1];
+ this->value[2] += m[2];
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat3x2<T>& tmat3x2<T>::operator-=
+ (
+ U const & s
+ )
+ {
+ this->value[0] -= s;
+ this->value[1] -= s;
+ this->value[2] -= s;
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat3x2<T>& tmat3x2<T>::operator-=
+ (
+ tmat3x2<U> const & m
+ )
+ {
+ this->value[0] -= m[0];
+ this->value[1] -= m[1];
+ this->value[2] -= m[2];
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat3x2<T>& tmat3x2<T>::operator*=
+ (
+ U const & s
+ )
+ {
+ this->value[0] *= s;
+ this->value[1] *= s;
+ this->value[2] *= s;
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat3x2<T>& tmat3x2<T>::operator*=
+ (
+ tmat3x2<U> const & m
+ )
+ {
+ return (*this = tmat3x2<T>(*this * m));
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat3x2<T> & tmat3x2<T>::operator/=
+ (
+ U const & s
+ )
+ {
+ this->value[0] /= s;
+ this->value[1] /= s;
+ this->value[2] /= s;
+ return *this;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x2<T>& tmat3x2<T>::operator++ ()
+ {
+ ++this->value[0];
+ ++this->value[1];
+ ++this->value[2];
+ return *this;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x2<T>& tmat3x2<T>::operator-- ()
+ {
+ --this->value[0];
+ --this->value[1];
+ --this->value[2];
+ return *this;
+ }
+
+ //////////////////////////////////////////////////////////////
+ // Binary operators
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x2<T> operator+
+ (
+ tmat3x2<T> const & m,
+ typename tmat3x2<T>::value_type const & s
+ )
+ {
+ return tmat3x2<T>(
+ m[0] + s,
+ m[1] + s,
+ m[2] + s);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x2<T> operator+
+ (
+ tmat3x2<T> const & m1,
+ tmat3x2<T> const & m2
+ )
+ {
+ return tmat3x2<T>(
+ m1[0] + m2[0],
+ m1[1] + m2[1],
+ m1[2] + m2[2]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x2<T> operator-
+ (
+ tmat3x2<T> const & m,
+ typename tmat3x2<T>::value_type const & s
+ )
+ {
+ return tmat3x2<T>(
+ m[0] - s,
+ m[1] - s,
+ m[2] - s);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x2<T> operator-
+ (
+ tmat3x2<T> const & m1,
+ tmat3x2<T> const & m2
+ )
+ {
+ return tmat3x2<T>(
+ m1[0] - m2[0],
+ m1[1] - m2[1],
+ m1[2] - m2[2]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x2<T> operator*
+ (
+ tmat3x2<T> const & m,
+ typename tmat3x2<T>::value_type const & s
+ )
+ {
+ return tmat3x2<T>(
+ m[0] * s,
+ m[1] * s,
+ m[2] * s);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x2<T> operator*
+ (
+ typename tmat3x2<T>::value_type const & s,
+ tmat3x2<T> const & m
+ )
+ {
+ return tmat3x2<T>(
+ m[0] * s,
+ m[1] * s,
+ m[2] * s);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tmat3x2<T>::col_type operator*
+ (
+ tmat3x2<T> const & m,
+ typename tmat3x2<T>::row_type const & v)
+ {
+ return typename tmat3x2<T>::col_type(
+ m[0][0] * v.x + m[1][0] * v.y + m[2][0] * v.z,
+ m[0][1] * v.x + m[1][1] * v.y + m[2][1] * v.z);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tmat3x2<T>::row_type operator*
+ (
+ typename tmat3x2<T>::col_type const & v,
+ tmat3x2<T> const & m)
+ {
+ return typename tmat3x2<T>::row_type(
+ v.x * m[0][0] + v.y * m[0][1],
+ v.x * m[1][0] + v.y * m[1][1],
+ v.x * m[2][0] + v.y * m[2][1]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x2<T> operator*
+ (
+ tmat3x2<T> const & m1,
+ tmat2x3<T> const & m2
+ )
+ {
+ const T SrcA00 = m1[0][0];
+ const T SrcA01 = m1[0][1];
+ const T SrcA10 = m1[1][0];
+ const T SrcA11 = m1[1][1];
+ const T SrcA20 = m1[2][0];
+ const T SrcA21 = m1[2][1];
+
+ const T SrcB00 = m2[0][0];
+ const T SrcB01 = m2[0][1];
+ const T SrcB02 = m2[0][2];
+ const T SrcB10 = m2[1][0];
+ const T SrcB11 = m2[1][1];
+ const T SrcB12 = m2[1][2];
+
+ tmat2x2<T> Result(tmat2x2<T>::null);
+ Result[0][0] = SrcA00 * SrcB00 + SrcA10 * SrcB01 + SrcA20 * SrcB02;
+ Result[0][1] = SrcA01 * SrcB00 + SrcA11 * SrcB01 + SrcA21 * SrcB02;
+ Result[1][0] = SrcA00 * SrcB10 + SrcA10 * SrcB11 + SrcA20 * SrcB12;
+ Result[1][1] = SrcA01 * SrcB10 + SrcA11 * SrcB11 + SrcA21 * SrcB12;
+ return Result;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x2<T> operator/
+ (
+ tmat3x2<T> const & m,
+ typename tmat3x2<T>::value_type const & s
+ )
+ {
+ return tmat3x2<T>(
+ m[0] / s,
+ m[1] / s,
+ m[2] / s);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x2<T> operator/
+ (
+ typename tmat3x2<T>::value_type const & s,
+ tmat3x2<T> const & m
+ )
+ {
+ return tmat3x2<T>(
+ s / m[0],
+ s / m[1],
+ s / m[2]);
+ }
+
+ // Unary constant operators
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x2<T> const operator-
+ (
+ tmat3x2<T> const & m
+ )
+ {
+ return tmat3x2<T>(
+ -m[0],
+ -m[1],
+ -m[2]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x2<T> const operator++
+ (
+ tmat3x2<T> const & m,
+ int
+ )
+ {
+ typename tmat3x2<T>::value_type One(1);
+ return tmat3x2<T>(
+ m[0] + One,
+ m[1] + One,
+ m[2] + One);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x2<T> const operator--
+ (
+ tmat3x2<T> const & m,
+ int
+ )
+ {
+ typename tmat3x2<T>::value_type One(1);
+ return tmat3x2<T>(
+ m[0] - One,
+ m[1] - One,
+ m[2] - One);
+ }
+
+ //////////////////////////////////////
+ // Boolean operators
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER bool operator==
+ (
+ tmat3x2<T> const & m1,
+ tmat3x2<T> const & m2
+ )
+ {
+ return (m1[0] == m2[0]) && (m1[1] == m2[1]) && (m1[2] == m2[2]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER bool operator!=
+ (
+ tmat3x2<T> const & m1,
+ tmat3x2<T> const & m2
+ )
+ {
+ return (m1[0] != m2[0]) || (m1[1] != m2[1]) || (m1[2] != m2[2]);
+ }
+
+} //namespace detail
+} //namespace glm
diff --git a/src/glm/core/type_mat3x3.hpp b/src/glm/core/type_mat3x3.hpp
new file mode 100644
index 0000000..36a695f
--- /dev/null
+++ b/src/glm/core/type_mat3x3.hpp
@@ -0,0 +1,283 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2005-01-27
+// Updated : 2010-02-03
+// Licence : This source is under MIT License
+// File : glm/core/type_mat3x3.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_core_type_mat3x3
+#define glm_core_type_mat3x3
+
+#include "type_mat.hpp"
+
+namespace glm{
+namespace detail
+{
+ template <typename T> struct tvec1;
+ template <typename T> struct tvec2;
+ template <typename T> struct tvec3;
+ template <typename T> struct tvec4;
+ template <typename T> struct tmat2x2;
+ template <typename T> struct tmat2x3;
+ template <typename T> struct tmat2x4;
+ template <typename T> struct tmat3x2;
+ template <typename T> struct tmat3x3;
+ template <typename T> struct tmat3x4;
+ template <typename T> struct tmat4x2;
+ template <typename T> struct tmat4x3;
+ template <typename T> struct tmat4x4;
+
+ //! \brief Template for 3 * 3 matrix of floating-point numbers.
+ //! \ingroup core_template
+ template <typename T>
+ struct tmat3x3
+ {
+ enum ctor{null};
+ typedef T value_type;
+ typedef std::size_t size_type;
+ typedef tvec3<T> col_type;
+ typedef tvec3<T> row_type;
+ static GLM_FUNC_DECL size_type col_size();
+ static GLM_FUNC_DECL size_type row_size();
+
+ typedef tmat3x3<T> type;
+ typedef tmat3x3<T> transpose_type;
+
+ public:
+ // Implementation detail
+ GLM_FUNC_DECL tmat3x3<T> _inverse() const;
+
+ private:
+ // Data
+ col_type value[3];
+
+ public:
+ // Constructors
+ GLM_FUNC_DECL tmat3x3();
+ GLM_FUNC_DECL tmat3x3(tmat3x3 const & m);
+
+ GLM_FUNC_DECL explicit tmat3x3(
+ ctor Null);
+ GLM_FUNC_DECL explicit tmat3x3(
+ value_type const & s);
+ GLM_FUNC_DECL explicit tmat3x3(
+ value_type const & x0, value_type const & y0, value_type const & z0,
+ value_type const & x1, value_type const & y1, value_type const & z1,
+ value_type const & x2, value_type const & y2, value_type const & z2);
+ GLM_FUNC_DECL explicit tmat3x3(
+ col_type const & v0,
+ col_type const & v1,
+ col_type const & v2);
+
+ //////////////////////////////////////
+ // Conversions
+ template <typename U>
+ GLM_FUNC_DECL explicit tmat3x3(
+ U const & x);
+
+ template
+ <
+ typename X1, typename Y1, typename Z1,
+ typename X2, typename Y2, typename Z2,
+ typename X3, typename Y3, typename Z3
+ >
+ GLM_FUNC_DECL explicit tmat3x3(
+ X1 const & x1, Y1 const & y1, Z1 const & z1,
+ X2 const & x2, Y2 const & y2, Z2 const & z2,
+ X3 const & x3, Y3 const & y3, Z3 const & z3);
+
+ template <typename V1, typename V2, typename V3>
+ GLM_FUNC_DECL explicit tmat3x3(
+ tvec3<V1> const & v1,
+ tvec3<V2> const & v2,
+ tvec3<V3> const & v3);
+
+ // Matrix conversions
+ template <typename U>
+ GLM_FUNC_DECL explicit tmat3x3(tmat3x3<U> const & m);
+
+ GLM_FUNC_DECL explicit tmat3x3(tmat2x2<T> const & x);
+ GLM_FUNC_DECL explicit tmat3x3(tmat4x4<T> const & x);
+ GLM_FUNC_DECL explicit tmat3x3(tmat2x3<T> const & x);
+ GLM_FUNC_DECL explicit tmat3x3(tmat3x2<T> const & x);
+ GLM_FUNC_DECL explicit tmat3x3(tmat2x4<T> const & x);
+ GLM_FUNC_DECL explicit tmat3x3(tmat4x2<T> const & x);
+ GLM_FUNC_DECL explicit tmat3x3(tmat3x4<T> const & x);
+ GLM_FUNC_DECL explicit tmat3x3(tmat4x3<T> const & x);
+
+ // Accesses
+ GLM_FUNC_DECL col_type & operator[](size_type i);
+ GLM_FUNC_DECL col_type const & operator[](size_type i) const;
+
+ // Unary updatable operators
+ GLM_FUNC_DECL tmat3x3<T>& operator= (tmat3x3<T> const & m);
+ template <typename U>
+ GLM_FUNC_DECL tmat3x3<T>& operator= (tmat3x3<U> const & m);
+ template <typename U>
+ GLM_FUNC_DECL tmat3x3<T>& operator+= (U const & s);
+ template <typename U>
+ GLM_FUNC_DECL tmat3x3<T>& operator+= (tmat3x3<U> const & m);
+ template <typename U>
+ GLM_FUNC_DECL tmat3x3<T>& operator-= (U const & s);
+ template <typename U>
+ GLM_FUNC_DECL tmat3x3<T>& operator-= (tmat3x3<U> const & m);
+ template <typename U>
+ GLM_FUNC_DECL tmat3x3<T>& operator*= (U const & s);
+ template <typename U>
+ GLM_FUNC_DECL tmat3x3<T>& operator*= (tmat3x3<U> const & m);
+ template <typename U>
+ GLM_FUNC_DECL tmat3x3<T>& operator/= (U const & s);
+ template <typename U>
+ GLM_FUNC_DECL tmat3x3<T>& operator/= (tmat3x3<U> const & m);
+ GLM_FUNC_DECL tmat3x3<T>& operator++ ();
+ GLM_FUNC_DECL tmat3x3<T>& operator-- ();
+ };
+
+ // Binary operators
+ template <typename T>
+ tmat3x3<T> operator+ (
+ tmat3x3<T> const & m,
+ typename tmat3x3<T>::value_type const & s);
+
+ template <typename T>
+ tmat3x3<T> operator+ (
+ typename tmat3x3<T>::value_type const & s,
+ tmat3x3<T> const & m);
+
+ template <typename T>
+ tmat3x3<T> operator+ (
+ tmat3x3<T> const & m1,
+ tmat3x3<T> const & m2);
+
+ template <typename T>
+ tmat3x3<T> operator- (
+ tmat3x3<T> const & m,
+ typename tmat3x3<T>::value_type const & s);
+
+ template <typename T>
+ tmat3x3<T> operator- (
+ typename tmat3x3<T>::value_type const & s,
+ tmat3x3<T> const & m);
+
+ template <typename T>
+ tmat3x3<T> operator- (
+ tmat3x3<T> const & m1,
+ tmat3x3<T> const & m2);
+
+ template <typename T>
+ tmat3x3<T> operator* (
+ tmat3x3<T> const & m,
+ typename tmat3x3<T>::value_type const & s);
+
+ template <typename T>
+ tmat3x3<T> operator* (
+ typename tmat3x3<T>::value_type const & s,
+ tmat3x3<T> const & m);
+
+ template <typename T>
+ typename tmat3x3<T>::col_type operator* (
+ tmat3x3<T> const & m,
+ typename tmat3x3<T>::row_type const & v);
+
+ template <typename T>
+ typename tmat3x3<T>::row_type operator* (
+ typename tmat3x3<T>::col_type const & v,
+ tmat3x3<T> const & m);
+
+ template <typename T>
+ tmat3x3<T> operator* (
+ tmat3x3<T> const & m1,
+ tmat3x3<T> const & m2);
+
+ template <typename T>
+ tmat3x3<T> operator/ (
+ tmat3x3<T> const & m,
+ typename tmat3x3<T>::value_type const & s);
+
+ template <typename T>
+ tmat3x3<T> operator/ (
+ typename tmat3x3<T>::value_type const & s,
+ tmat3x3<T> const & m);
+
+ template <typename T>
+ typename tmat3x3<T>::col_type operator/ (
+ tmat3x3<T> const & m,
+ typename tmat3x3<T>::row_type const & v);
+
+ template <typename T>
+ typename tmat3x3<T>::row_type operator/ (
+ typename tmat3x3<T>::col_type const & v,
+ tmat3x3<T> const & m);
+
+ template <typename T>
+ tmat3x3<T> operator/ (
+ tmat3x3<T> const & m1,
+ tmat3x3<T> const & m2);
+
+ // Unary constant operators
+ template <typename T>
+ tmat3x3<T> const operator- (
+ tmat3x3<T> const & m);
+
+ template <typename T>
+ tmat3x3<T> const operator-- (
+ tmat3x3<T> const & m,
+ int);
+
+ template <typename T>
+ tmat3x3<T> const operator++ (
+ tmat3x3<T> const & m,
+ int);
+
+} //namespace detail
+
+namespace core{
+namespace type{
+namespace precision
+{
+ //! 3 columns of 3 components matrix of low precision floating-point numbers.
+ //! There is no guarantee on the actual precision.
+ //! From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers
+ //! \ingroup core_precision
+ typedef detail::tmat3x3<lowp_float> lowp_mat3;
+ //! 3 columns of 3 components matrix of medium precision floating-point numbers.
+ //! There is no guarantee on the actual precision.
+ //! From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers
+ //! \ingroup core_precision
+ typedef detail::tmat3x3<mediump_float> mediump_mat3;
+ //! 3 columns of 3 components matrix of high precision floating-point numbers.
+ //! There is no guarantee on the actual precision.
+ //! From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers
+ //! \ingroup core_precision
+ typedef detail::tmat3x3<highp_float> highp_mat3;
+
+ //! 3 columns of 3 components matrix of low precision floating-point numbers.
+ //! There is no guarantee on the actual precision.
+ //! From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers
+ //! \ingroup core_precision
+ typedef detail::tmat3x3<lowp_float> lowp_mat3x3;
+
+ //! 3 columns of 3 components matrix of medium precision floating-point numbers.
+ //! There is no guarantee on the actual precision.
+ //! From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers
+ //! \ingroup core_precision
+ typedef detail::tmat3x3<mediump_float> mediump_mat3x3;
+
+ //! 3 columns of 3 components matrix of high precision floating-point numbers.
+ //! There is no guarantee on the actual precision.
+ //! From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers
+ //! \ingroup core_precision
+ typedef detail::tmat3x3<highp_float> highp_mat3x3;
+
+}//namespace precision
+}//namespace type
+}//namespace core
+}//namespace glm
+
+#ifndef GLM_EXTERNAL_TEMPLATE
+#include "type_mat3x3.inl"
+#endif
+
+#endif //glm_core_type_mat3x3
diff --git a/src/glm/core/type_mat3x3.inl b/src/glm/core/type_mat3x3.inl
new file mode 100644
index 0000000..a9fdfcc
--- /dev/null
+++ b/src/glm/core/type_mat3x3.inl
@@ -0,0 +1,750 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2005-01-27
+// Updated : 2010-02-03
+// Licence : This source is under MIT License
+// File : glm/core/type_mat3x3.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm{
+namespace detail
+{
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tmat3x3<T>::size_type tmat3x3<T>::col_size()
+ {
+ return 3;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tmat3x3<T>::size_type tmat3x3<T>::row_size()
+ {
+ return 3;
+ }
+
+ //////////////////////////////////////
+ // Accesses
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tmat3x3<T>::col_type &
+ tmat3x3<T>::operator[]
+ (
+ size_type i
+ )
+ {
+ assert(i < this->row_size());
+ return this->value[i];
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tmat3x3<T>::col_type const &
+ tmat3x3<T>::operator[]
+ (
+ size_type i
+ ) const
+ {
+ assert(i < this->row_size());
+ return this->value[i];
+ }
+
+ //////////////////////////////////////////////////////////////
+ // Constructors
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x3<T>::tmat3x3()
+ {
+ value_type const Zero(0);
+ value_type const One(1);
+ this->value[0] = col_type(One, Zero, Zero);
+ this->value[1] = col_type(Zero, One, Zero);
+ this->value[2] = col_type(Zero, Zero, One);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x3<T>::tmat3x3
+ (
+ tmat3x3<T> const & m
+ )
+ {
+ this->value[0] = m.value[0];
+ this->value[1] = m.value[1];
+ this->value[2] = m.value[2];
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x3<T>::tmat3x3
+ (
+ ctor
+ )
+ {}
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x3<T>::tmat3x3
+ (
+ value_type const & s
+ )
+ {
+ value_type const Zero(0);
+ this->value[0] = col_type(s, Zero, Zero);
+ this->value[1] = col_type(Zero, s, Zero);
+ this->value[2] = col_type(Zero, Zero, s);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x3<T>::tmat3x3
+ (
+ value_type const & x0, value_type const & y0, value_type const & z0,
+ value_type const & x1, value_type const & y1, value_type const & z1,
+ value_type const & x2, value_type const & y2, value_type const & z2
+ )
+ {
+ this->value[0] = col_type(x0, y0, z0);
+ this->value[1] = col_type(x1, y1, z1);
+ this->value[2] = col_type(x2, y2, z2);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x3<T>::tmat3x3
+ (
+ col_type const & v0,
+ col_type const & v1,
+ col_type const & v2
+ )
+ {
+ this->value[0] = v0;
+ this->value[1] = v1;
+ this->value[2] = v2;
+ }
+
+ //////////////////////////////////////
+ // Convertion constructors
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_DECL tmat3x3<T>::tmat3x3
+ (
+ U const & s
+ )
+ {
+ value_type const Zero(0);
+ this->value[0] = tvec3<T>(value_type(s), Zero, Zero);
+ this->value[1] = tvec3<T>(Zero, value_type(s), Zero);
+ this->value[2] = tvec3<T>(Zero, Zero, value_type(s));
+ }
+
+ template <typename T>
+ template <
+ typename X1, typename Y1, typename Z1,
+ typename X2, typename Y2, typename Z2,
+ typename X3, typename Y3, typename Z3>
+ GLM_FUNC_DECL tmat3x3<T>::tmat3x3
+ (
+ X1 const & x1, Y1 const & y1, Z1 const & z1,
+ X2 const & x2, Y2 const & y2, Z2 const & z2,
+ X3 const & x3, Y3 const & y3, Z3 const & z3
+ )
+ {
+ this->value[0] = col_type(value_type(x1), value_type(y1), value_type(z1));
+ this->value[1] = col_type(value_type(x2), value_type(y2), value_type(z2));
+ this->value[2] = col_type(value_type(x3), value_type(y3), value_type(z3));
+ }
+
+ template <typename T>
+ template <typename V1, typename V2, typename V3>
+ GLM_FUNC_DECL tmat3x3<T>::tmat3x3
+ (
+ tvec3<V1> const & v1,
+ tvec3<V2> const & v2,
+ tvec3<V3> const & v3
+ )
+ {
+ this->value[0] = col_type(v1);
+ this->value[1] = col_type(v2);
+ this->value[2] = col_type(v3);
+ }
+
+ //////////////////////////////////////////////////////////////
+ // Conversions
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat3x3<T>::tmat3x3
+ (
+ tmat3x3<U> const & m
+ )
+ {
+ this->value[0] = col_type(m[0]);
+ this->value[1] = col_type(m[1]);
+ this->value[2] = col_type(m[2]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x3<T>::tmat3x3
+ (
+ tmat2x2<T> const & m
+ )
+ {
+ this->value[0] = col_type(m[0], value_type(0));
+ this->value[1] = col_type(m[1], value_type(0));
+ this->value[2] = col_type(detail::tvec2<T>(0), value_type(1));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x3<T>::tmat3x3
+ (
+ tmat4x4<T> const & m
+ )
+ {
+ this->value[0] = col_type(m[0]);
+ this->value[1] = col_type(m[1]);
+ this->value[2] = col_type(m[2]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x3<T>::tmat3x3
+ (
+ tmat2x3<T> const & m
+ )
+ {
+ this->value[0] = m[0];
+ this->value[1] = m[1];
+ this->value[2] = col_type(detail::tvec2<T>(0), value_type(1));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x3<T>::tmat3x3
+ (
+ tmat3x2<T> const & m
+ )
+ {
+ this->value[0] = col_type(m[0], value_type(0));
+ this->value[1] = col_type(m[1], value_type(0));
+ this->value[2] = col_type(m[2], value_type(1));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x3<T>::tmat3x3
+ (
+ tmat2x4<T> const & m
+ )
+ {
+ this->value[0] = col_type(m[0]);
+ this->value[1] = col_type(m[1]);
+ this->value[2] = col_type(detail::tvec2<T>(0), value_type(1));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x3<T>::tmat3x3
+ (
+ tmat4x2<T> const & m
+ )
+ {
+ this->value[0] = col_type(m[0], value_type(0));
+ this->value[1] = col_type(m[1], value_type(0));
+ this->value[2] = col_type(m[2], value_type(1));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x3<T>::tmat3x3
+ (
+ tmat3x4<T> const & m
+ )
+ {
+ this->value[0] = col_type(m[0]);
+ this->value[1] = col_type(m[1]);
+ this->value[2] = col_type(m[2]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x3<T>::tmat3x3
+ (
+ tmat4x3<T> const & m
+ )
+ {
+ this->value[0] = m[0];
+ this->value[1] = m[1];
+ this->value[2] = m[2];
+ }
+
+ //////////////////////////////////////////////////////////////
+ // Operators
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x3<T> & tmat3x3<T>::operator=
+ (
+ tmat3x3<T> const & m
+ )
+ {
+ this->value[0] = m[0];
+ this->value[1] = m[1];
+ this->value[2] = m[2];
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat3x3<T> & tmat3x3<T>::operator=
+ (
+ tmat3x3<U> const & m
+ )
+ {
+ this->value[0] = m[0];
+ this->value[1] = m[1];
+ this->value[2] = m[2];
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat3x3<T> & tmat3x3<T>::operator+=
+ (
+ U const & s
+ )
+ {
+ this->value[0] += s;
+ this->value[1] += s;
+ this->value[2] += s;
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat3x3<T> & tmat3x3<T>::operator+=
+ (
+ tmat3x3<U> const & m
+ )
+ {
+ this->value[0] += m[0];
+ this->value[1] += m[1];
+ this->value[2] += m[2];
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat3x3<T> & tmat3x3<T>::operator-=
+ (
+ U const & s
+ )
+ {
+ this->value[0] -= s;
+ this->value[1] -= s;
+ this->value[2] -= s;
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat3x3<T> & tmat3x3<T>::operator-=
+ (
+ tmat3x3<U> const & m
+ )
+ {
+ this->value[0] -= m[0];
+ this->value[1] -= m[1];
+ this->value[2] -= m[2];
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat3x3<T> & tmat3x3<T>::operator*=
+ (
+ U const & s
+ )
+ {
+ this->value[0] *= s;
+ this->value[1] *= s;
+ this->value[2] *= s;
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat3x3<T> & tmat3x3<T>::operator*=
+ (
+ tmat3x3<U> const & m
+ )
+ {
+ return (*this = *this * m);
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat3x3<T> & tmat3x3<T>::operator/=
+ (
+ U const & s
+ )
+ {
+ this->value[0] /= s;
+ this->value[1] /= s;
+ this->value[2] /= s;
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat3x3<T> & tmat3x3<T>::operator/=
+ (
+ tmat3x3<U> const & m
+ )
+ {
+ return (*this = *this / m);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x3<T> & tmat3x3<T>::operator++ ()
+ {
+ ++this->value[0];
+ ++this->value[1];
+ ++this->value[2];
+ return *this;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x3<T> & tmat3x3<T>::operator-- ()
+ {
+ --this->value[0];
+ --this->value[1];
+ --this->value[2];
+ return *this;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x3<T> tmat3x3<T>::_inverse() const
+ {
+ T S00 = value[0][0];
+ T S01 = value[0][1];
+ T S02 = value[0][2];
+
+ T S10 = value[1][0];
+ T S11 = value[1][1];
+ T S12 = value[1][2];
+
+ T S20 = value[2][0];
+ T S21 = value[2][1];
+ T S22 = value[2][2];
+/*
+ tmat3x3<T> Inverse(
+ + (S11 * S22 - S21 * S12),
+ - (S10 * S22 - S20 * S12),
+ + (S10 * S21 - S20 * S11),
+ - (S01 * S22 - S21 * S02),
+ + (S00 * S22 - S20 * S02),
+ - (S00 * S21 - S20 * S01),
+ + (S01 * S12 - S11 * S02),
+ - (S00 * S12 - S10 * S02),
+ + (S00 * S11 - S10 * S01));
+*/
+ tmat3x3<T> Inverse(
+ S11 * S22 - S21 * S12,
+ S12 * S20 - S22 * S10,
+ S10 * S21 - S20 * S11,
+ S02 * S21 - S01 * S22,
+ S00 * S22 - S02 * S20,
+ S01 * S20 - S00 * S21,
+ S12 * S01 - S11 * S02,
+ S10 * S02 - S12 * S00,
+ S11 * S00 - S10 * S01);
+
+ T Determinant = S00 * (S11 * S22 - S21 * S12)
+ - S10 * (S01 * S22 - S21 * S02)
+ + S20 * (S01 * S12 - S11 * S02);
+
+ Inverse /= Determinant;
+ return Inverse;
+ }
+
+ //////////////////////////////////////////////////////////////
+ // Binary operators
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x3<T> operator+
+ (
+ tmat3x3<T> const & m,
+ typename tmat3x3<T>::value_type const & s
+ )
+ {
+ return tmat3x3<T>(
+ m[0] + s,
+ m[1] + s,
+ m[2] + s);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x3<T> operator+
+ (
+ typename tmat3x3<T>::value_type const & s,
+ tmat3x3<T> const & m
+ )
+ {
+ return tmat3x3<T>(
+ m[0] + s,
+ m[1] + s,
+ m[2] + s);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x3<T> operator+
+ (
+ tmat3x3<T> const & m1,
+ tmat3x3<T> const & m2
+ )
+ {
+ return tmat3x3<T>(
+ m1[0] + m2[0],
+ m1[1] + m2[1],
+ m1[2] + m2[2]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x3<T> operator-
+ (
+ tmat3x3<T> const & m,
+ typename tmat3x3<T>::value_type const & s
+ )
+ {
+ return tmat3x3<T>(
+ m[0] - s,
+ m[1] - s,
+ m[2] - s);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x3<T> operator-
+ (
+ typename tmat3x3<T>::value_type const & s,
+ tmat3x3<T> const & m
+ )
+ {
+ return tmat3x3<T>(
+ s - m[0],
+ s - m[1],
+ s - m[2]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x3<T> operator-
+ (
+ tmat3x3<T> const & m1,
+ tmat3x3<T> const & m2
+ )
+ {
+ return tmat3x3<T>(
+ m1[0] - m2[0],
+ m1[1] - m2[1],
+ m1[2] - m2[2]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x3<T> operator*
+ (
+ tmat3x3<T> const & m,
+ typename tmat3x3<T>::value_type const & s
+ )
+ {
+ return tmat3x3<T>(
+ m[0] * s,
+ m[1] * s,
+ m[2] * s);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x3<T> operator*
+ (
+ typename tmat3x3<T>::value_type const & s,
+ tmat3x3<T> const & m
+ )
+ {
+ return tmat3x3<T>(
+ m[0] * s,
+ m[1] * s,
+ m[2] * s);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tmat3x3<T>::col_type operator*
+ (
+ tmat3x3<T> const & m,
+ typename tmat3x3<T>::row_type const & v
+ )
+ {
+ return typename tmat3x3<T>::col_type(
+ m[0][0] * v.x + m[1][0] * v.y + m[2][0] * v.z,
+ m[0][1] * v.x + m[1][1] * v.y + m[2][1] * v.z,
+ m[0][2] * v.x + m[1][2] * v.y + m[2][2] * v.z);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tmat3x3<T>::row_type operator*
+ (
+ typename tmat3x3<T>::col_type const & v,
+ tmat3x3<T> const & m
+ )
+ {
+ return typename tmat3x3<T>::row_type(
+ m[0][0] * v.x + m[0][1] * v.y + m[0][2] * v.z,
+ m[1][0] * v.x + m[1][1] * v.y + m[1][2] * v.z,
+ m[2][0] * v.x + m[2][1] * v.y + m[2][2] * v.z);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x3<T> operator*
+ (
+ tmat3x3<T> const & m1,
+ tmat3x3<T> const & m2
+ )
+ {
+ typename tmat3x3<T>::value_type const SrcA00 = m1[0][0];
+ typename tmat3x3<T>::value_type const SrcA01 = m1[0][1];
+ typename tmat3x3<T>::value_type const SrcA02 = m1[0][2];
+ typename tmat3x3<T>::value_type const SrcA10 = m1[1][0];
+ typename tmat3x3<T>::value_type const SrcA11 = m1[1][1];
+ typename tmat3x3<T>::value_type const SrcA12 = m1[1][2];
+ typename tmat3x3<T>::value_type const SrcA20 = m1[2][0];
+ typename tmat3x3<T>::value_type const SrcA21 = m1[2][1];
+ typename tmat3x3<T>::value_type const SrcA22 = m1[2][2];
+
+ typename tmat3x3<T>::value_type const SrcB00 = m2[0][0];
+ typename tmat3x3<T>::value_type const SrcB01 = m2[0][1];
+ typename tmat3x3<T>::value_type const SrcB02 = m2[0][2];
+ typename tmat3x3<T>::value_type const SrcB10 = m2[1][0];
+ typename tmat3x3<T>::value_type const SrcB11 = m2[1][1];
+ typename tmat3x3<T>::value_type const SrcB12 = m2[1][2];
+ typename tmat3x3<T>::value_type const SrcB20 = m2[2][0];
+ typename tmat3x3<T>::value_type const SrcB21 = m2[2][1];
+ typename tmat3x3<T>::value_type const SrcB22 = m2[2][2];
+
+ tmat3x3<T> Result(tmat3x3<T>::null);
+ Result[0][0] = SrcA00 * SrcB00 + SrcA10 * SrcB01 + SrcA20 * SrcB02;
+ Result[0][1] = SrcA01 * SrcB00 + SrcA11 * SrcB01 + SrcA21 * SrcB02;
+ Result[0][2] = SrcA02 * SrcB00 + SrcA12 * SrcB01 + SrcA22 * SrcB02;
+ Result[1][0] = SrcA00 * SrcB10 + SrcA10 * SrcB11 + SrcA20 * SrcB12;
+ Result[1][1] = SrcA01 * SrcB10 + SrcA11 * SrcB11 + SrcA21 * SrcB12;
+ Result[1][2] = SrcA02 * SrcB10 + SrcA12 * SrcB11 + SrcA22 * SrcB12;
+ Result[2][0] = SrcA00 * SrcB20 + SrcA10 * SrcB21 + SrcA20 * SrcB22;
+ Result[2][1] = SrcA01 * SrcB20 + SrcA11 * SrcB21 + SrcA21 * SrcB22;
+ Result[2][2] = SrcA02 * SrcB20 + SrcA12 * SrcB21 + SrcA22 * SrcB22;
+ return Result;
+ }
+
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x3<T> operator/
+ (
+ tmat3x3<T> const & m,
+ typename tmat3x3<T>::value_type const & s
+ )
+ {
+ return tmat3x3<T>(
+ m[0] / s,
+ m[1] / s,
+ m[2] / s);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x3<T> operator/
+ (
+ typename tmat3x3<T>::value_type const & s,
+ tmat3x3<T> const & m
+ )
+ {
+ return tmat3x3<T>(
+ s / m[0],
+ s / m[1],
+ s / m[2]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tmat3x3<T>::col_type operator/
+ (
+ tmat3x3<T> const & m,
+ typename tmat3x3<T>::row_type const & v
+ )
+ {
+ return m._inverse() * v;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tmat3x3<T>::row_type operator/
+ (
+ typename tmat3x3<T>::col_type const & v,
+ tmat3x3<T> const & m
+ )
+ {
+ return v * m._inverse();
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x3<T> operator/
+ (
+ tmat3x3<T> const & m1,
+ tmat3x3<T> const & m2
+ )
+ {
+ return m1 * m2._inverse();
+ }
+
+ // Unary constant operators
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x3<T> const operator-
+ (
+ tmat3x3<T> const & m
+ )
+ {
+ return tmat3x3<T>(
+ -m[0],
+ -m[1],
+ -m[2]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x3<T> const operator++
+ (
+ tmat3x3<T> const & m,
+ int
+ )
+ {
+ return tmat3x3<T>(
+ m[0] + T(1),
+ m[1] + T(1),
+ m[2] + T(1));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x3<T> const operator--
+ (
+ tmat3x3<T> const & m,
+ int
+ )
+ {
+ return tmat3x3<T>(
+ m[0] - T(1),
+ m[1] - T(1),
+ m[2] - T(1));
+ }
+
+ //////////////////////////////////////
+ // Boolean operators
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER bool operator==
+ (
+ tmat3x3<T> const & m1,
+ tmat3x3<T> const & m2
+ )
+ {
+ return (m1[0] == m2[0]) && (m1[1] == m2[1]) && (m1[2] == m2[2]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER bool operator!=
+ (
+ tmat3x3<T> const & m1,
+ tmat3x3<T> const & m2
+ )
+ {
+ return (m1[0] != m2[0]) || (m1[1] != m2[1]) || (m1[2] != m2[2]);
+ }
+
+} //namespace detail
+} //namespace glm
diff --git a/src/glm/core/type_mat3x4.hpp b/src/glm/core/type_mat3x4.hpp
new file mode 100644
index 0000000..26e6d29
--- /dev/null
+++ b/src/glm/core/type_mat3x4.hpp
@@ -0,0 +1,232 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2006-08-05
+// Updated : 2010-02-05
+// Licence : This source is under MIT License
+// File : glm/core/type_mat3x4.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_core_type_mat3x4
+#define glm_core_type_mat3x4
+
+#include "type_mat.hpp"
+
+namespace glm{
+namespace detail
+{
+ template <typename T> struct tvec1;
+ template <typename T> struct tvec2;
+ template <typename T> struct tvec3;
+ template <typename T> struct tvec4;
+ template <typename T> struct tmat2x2;
+ template <typename T> struct tmat2x3;
+ template <typename T> struct tmat2x4;
+ template <typename T> struct tmat3x2;
+ template <typename T> struct tmat3x3;
+ template <typename T> struct tmat3x4;
+ template <typename T> struct tmat4x2;
+ template <typename T> struct tmat4x3;
+ template <typename T> struct tmat4x4;
+
+ //! \brief Template for 3 columns and 4 rows matrix of floating-point numbers.
+ //! \ingroup core_template
+ template <typename T>
+ struct tmat3x4
+ {
+ enum ctor{null};
+ typedef T value_type;
+ typedef std::size_t size_type;
+ typedef tvec4<T> col_type;
+ typedef tvec3<T> row_type;
+ static GLM_FUNC_DECL size_type col_size();
+ static GLM_FUNC_DECL size_type row_size();
+
+ typedef tmat3x4<T> type;
+ typedef tmat4x3<T> transpose_type;
+
+ private:
+ // Data
+ col_type value[3];
+
+ public:
+ // Constructors
+ GLM_FUNC_DECL tmat3x4();
+ GLM_FUNC_DECL tmat3x4(tmat3x4 const & m);
+
+ GLM_FUNC_DECL explicit tmat3x4(
+ ctor Null);
+ GLM_FUNC_DECL explicit tmat3x4(
+ value_type const & s);
+ GLM_FUNC_DECL explicit tmat3x4(
+ value_type const & x0, value_type const & y0, value_type const & z0, value_type const & w0,
+ value_type const & x1, value_type const & y1, value_type const & z1, value_type const & w1,
+ value_type const & x2, value_type const & y2, value_type const & z2, value_type const & w2);
+ GLM_FUNC_DECL explicit tmat3x4(
+ col_type const & v0,
+ col_type const & v1,
+ col_type const & v2);
+
+ //////////////////////////////////////
+ // Conversions
+ template <typename U>
+ GLM_FUNC_DECL explicit tmat3x4(
+ U const & x);
+
+ template
+ <
+ typename X1, typename Y1, typename Z1, typename W1,
+ typename X2, typename Y2, typename Z2, typename W2,
+ typename X3, typename Y3, typename Z3, typename W3
+ >
+ GLM_FUNC_DECL explicit tmat3x4(
+ X1 const & x1, Y1 const & y1, Z1 const & z1, W1 const & w1,
+ X2 const & x2, Y2 const & y2, Z2 const & z2, W2 const & w2,
+ X3 const & x3, Y3 const & y3, Z3 const & z3, W3 const & w3);
+
+ template <typename V1, typename V2, typename V3>
+ GLM_FUNC_DECL explicit tmat3x4(
+ tvec4<V1> const & v1,
+ tvec4<V2> const & v2,
+ tvec4<V3> const & v3);
+
+ // Matrix conversion
+ template <typename U>
+ GLM_FUNC_DECL explicit tmat3x4(tmat3x4<U> const & m);
+
+ GLM_FUNC_DECL explicit tmat3x4(tmat2x2<T> const & x);
+ GLM_FUNC_DECL explicit tmat3x4(tmat3x3<T> const & x);
+ GLM_FUNC_DECL explicit tmat3x4(tmat4x4<T> const & x);
+ GLM_FUNC_DECL explicit tmat3x4(tmat2x3<T> const & x);
+ GLM_FUNC_DECL explicit tmat3x4(tmat3x2<T> const & x);
+ GLM_FUNC_DECL explicit tmat3x4(tmat2x4<T> const & x);
+ GLM_FUNC_DECL explicit tmat3x4(tmat4x2<T> const & x);
+ GLM_FUNC_DECL explicit tmat3x4(tmat4x3<T> const & x);
+
+ // Accesses
+ col_type & operator[](size_type i);
+ col_type const & operator[](size_type i) const;
+
+ // Unary updatable operators
+ GLM_FUNC_DECL tmat3x4<T> & operator= (tmat3x4<T> const & m);
+ template <typename U>
+ GLM_FUNC_DECL tmat3x4<T> & operator= (tmat3x4<U> const & m);
+ template <typename U>
+ GLM_FUNC_DECL tmat3x4<T> & operator+= (U const & s);
+ template <typename U>
+ GLM_FUNC_DECL tmat3x4<T> & operator+= (tmat3x4<U> const & m);
+ template <typename U>
+ GLM_FUNC_DECL tmat3x4<T> & operator-= (U const & s);
+ template <typename U>
+ GLM_FUNC_DECL tmat3x4<T> & operator-= (tmat3x4<U> const & m);
+ template <typename U>
+ GLM_FUNC_DECL tmat3x4<T> & operator*= (U const & s);
+ template <typename U>
+ GLM_FUNC_DECL tmat3x4<T> & operator*= (tmat3x4<U> const & m);
+ template <typename U>
+ GLM_FUNC_DECL tmat3x4<T> & operator/= (U const & s);
+
+ GLM_FUNC_DECL tmat3x4<T> & operator++ ();
+ GLM_FUNC_DECL tmat3x4<T> & operator-- ();
+ };
+
+ // Binary operators
+ template <typename T>
+ tmat3x4<T> operator+ (
+ tmat3x4<T> const & m,
+ typename tmat3x4<T>::value_type const & s);
+
+ template <typename T>
+ tmat3x4<T> operator+ (
+ tmat3x4<T> const & m1,
+ tmat3x4<T> const & m2);
+
+ template <typename T>
+ tmat3x4<T> operator- (
+ tmat3x4<T> const & m,
+ typename tmat3x4<T>::value_type const & s);
+
+ template <typename T>
+ tmat3x4<T> operator- (
+ tmat3x4<T> const & m1,
+ tmat3x4<T> const & m2);
+
+ template <typename T>
+ tmat3x4<T> operator* (
+ tmat3x4<T> const & m,
+ typename tmat3x4<T>::value_type const & s);
+
+ template <typename T>
+ tmat3x4<T> operator* (
+ typename tmat3x4<T>::value_type const & s,
+ tmat3x4<T> const & m);
+
+ template <typename T>
+ typename tmat3x4<T>::col_type operator* (
+ tmat3x4<T> const & m,
+ typename tmat3x4<T>::row_type const & v);
+
+ template <typename T>
+ typename tmat3x4<T>::row_type operator* (
+ typename tmat3x4<T>::col_type const & v,
+ tmat3x4<T> const & m);
+
+ template <typename T>
+ tmat4x4<T> operator* (
+ tmat3x4<T> const & m1,
+ tmat4x3<T> const & m2);
+
+ template <typename T>
+ tmat3x4<T> operator/ (
+ tmat3x4<T> const & m,
+ typename tmat3x4<T>::value_type const & s);
+
+ template <typename T>
+ tmat3x4<T> operator/ (
+ typename tmat3x4<T>::value_type const & s,
+ tmat3x4<T> const & m);
+
+ // Unary constant operators
+ template <typename T>
+ tmat3x4<T> const operator- (
+ tmat3x4<T> const & m);
+
+ template <typename T>
+ tmat3x4<T> const operator-- (
+ tmat3x4<T> const & m,
+ int);
+
+ template <typename T>
+ tmat3x4<T> const operator++ (
+ tmat3x4<T> const & m,
+ int);
+
+}//namespace detail
+
+namespace core{
+namespace type{
+namespace precision
+{
+ //! 3 columns of 4 components matrix of low precision floating-point numbers.
+ //! There is no guarantee on the actual precision.
+ //! (From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers)
+ typedef detail::tmat3x4<lowp_float> lowp_mat3x4;
+ //! 3 columns of 4 components matrix of medium precision floating-point numbers.
+ //! There is no guarantee on the actual precision.
+ //! (From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers)
+ typedef detail::tmat3x4<mediump_float> mediump_mat3x4;
+ //! 3 columns of 4 components matrix of high precision floating-point numbers.
+ //! There is no guarantee on the actual precision.
+ //! (From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers)
+ typedef detail::tmat3x4<highp_float> highp_mat3x4;
+
+}//namespace precision
+}//namespace type
+}//namespace core
+}//namespace glm
+
+#ifndef GLM_EXTERNAL_TEMPLATE
+#include "type_mat3x4.inl"
+#endif
+
+#endif //glm_core_type_mat3x4
diff --git a/src/glm/core/type_mat3x4.inl b/src/glm/core/type_mat3x4.inl
new file mode 100644
index 0000000..542bfaa
--- /dev/null
+++ b/src/glm/core/type_mat3x4.inl
@@ -0,0 +1,653 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2006-08-05
+// Updated : 2010-02-05
+// Licence : This source is under MIT License
+// File : glm/core/type_mat3x4.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm{
+namespace detail
+{
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tmat3x4<T>::size_type tmat3x4<T>::col_size()
+ {
+ return 4;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tmat3x4<T>::size_type tmat3x4<T>::row_size()
+ {
+ return 3;
+ }
+
+ //////////////////////////////////////
+ // Accesses
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tmat3x4<T>::col_type &
+ tmat3x4<T>::operator[]
+ (
+ size_type i
+ )
+ {
+ assert(i < this->row_size());
+ return this->value[i];
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tmat3x4<T>::col_type const &
+ tmat3x4<T>::operator[]
+ (
+ size_type i
+ ) const
+ {
+ assert(i < this->row_size());
+ return this->value[i];
+ }
+
+ //////////////////////////////////////////////////////////////
+ // Constructors
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x4<T>::tmat3x4()
+ {
+ this->value[0] = col_type(1, 0, 0, 0);
+ this->value[1] = col_type(0, 1, 0, 0);
+ this->value[2] = col_type(0, 0, 1, 0);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x4<T>::tmat3x4
+ (
+ tmat3x4<T> const & m
+ )
+ {
+ this->value[0] = m.value[0];
+ this->value[1] = m.value[1];
+ this->value[2] = m.value[2];
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x4<T>::tmat3x4
+ (
+ ctor
+ )
+ {}
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x4<T>::tmat3x4
+ (
+ value_type const & s
+ )
+ {
+ value_type const Zero(0);
+ this->value[0] = col_type(s, Zero, Zero, Zero);
+ this->value[1] = col_type(Zero, s, Zero, Zero);
+ this->value[2] = col_type(Zero, Zero, s, Zero);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x4<T>::tmat3x4
+ (
+ value_type const & x0, value_type const & y0, value_type const & z0, value_type const & w0,
+ value_type const & x1, value_type const & y1, value_type const & z1, value_type const & w1,
+ value_type const & x2, value_type const & y2, value_type const & z2, value_type const & w2
+ )
+ {
+ this->value[0] = col_type(x0, y0, z0, w0);
+ this->value[1] = col_type(x1, y1, z1, w1);
+ this->value[2] = col_type(x2, y2, z2, w2);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x4<T>::tmat3x4
+ (
+ col_type const & v0,
+ col_type const & v1,
+ col_type const & v2
+ )
+ {
+ this->value[0] = v0;
+ this->value[1] = v1;
+ this->value[2] = v2;
+ }
+
+ //////////////////////////////////////
+ // Convertion constructors
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_DECL tmat3x4<T>::tmat3x4
+ (
+ U const & s
+ )
+ {
+ value_type const Zero(0);
+ this->value[0] = tvec4<T>(value_type(s), Zero, Zero, Zero);
+ this->value[1] = tvec4<T>(Zero, value_type(s), Zero, Zero);
+ this->value[2] = tvec4<T>(Zero, Zero, value_type(s), Zero);
+ }
+
+ template <typename T>
+ template <
+ typename X1, typename Y1, typename Z1, typename W1,
+ typename X2, typename Y2, typename Z2, typename W2,
+ typename X3, typename Y3, typename Z3, typename W3>
+ GLM_FUNC_DECL tmat3x4<T>::tmat3x4
+ (
+ X1 const & x1, Y1 const & y1, Z1 const & z1, W1 const & w1,
+ X2 const & x2, Y2 const & y2, Z2 const & z2, W2 const & w2,
+ X3 const & x3, Y3 const & y3, Z3 const & z3, W3 const & w3
+ )
+ {
+ this->value[0] = col_type(value_type(x1), value_type(y1), value_type(z1), value_type(w1));
+ this->value[1] = col_type(value_type(x2), value_type(y2), value_type(z2), value_type(w2));
+ this->value[2] = col_type(value_type(x3), value_type(y3), value_type(z3), value_type(w3));
+ }
+
+ template <typename T>
+ template <typename V1, typename V2, typename V3>
+ GLM_FUNC_DECL tmat3x4<T>::tmat3x4
+ (
+ tvec4<V1> const & v1,
+ tvec4<V2> const & v2,
+ tvec4<V3> const & v3
+ )
+ {
+ this->value[0] = col_type(v1);
+ this->value[1] = col_type(v2);
+ this->value[2] = col_type(v3);
+ }
+
+ // Conversion
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat3x4<T>::tmat3x4
+ (
+ tmat3x4<U> const & m
+ )
+ {
+ this->value[0] = col_type(m[0]);
+ this->value[1] = col_type(m[1]);
+ this->value[2] = col_type(m[2]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x4<T>::tmat3x4
+ (
+ tmat2x2<T> const & m
+ )
+ {
+ this->value[0] = col_type(m[0], detail::tvec2<T>(0));
+ this->value[1] = col_type(m[1], detail::tvec2<T>(0));
+ this->value[2] = col_type(T(0), T(0), T(1), T(0));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x4<T>::tmat3x4
+ (
+ tmat3x3<T> const & m
+ )
+ {
+ this->value[0] = col_type(m[0], T(0));
+ this->value[1] = col_type(m[1], T(0));
+ this->value[2] = col_type(m[2], T(0));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x4<T>::tmat3x4
+ (
+ tmat4x4<T> const & m
+ )
+ {
+ this->value[0] = col_type(m[0]);
+ this->value[1] = col_type(m[1]);
+ this->value[2] = col_type(m[2]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x4<T>::tmat3x4
+ (
+ tmat2x3<T> const & m
+ )
+ {
+ this->value[0] = col_type(m[0], T(0));
+ this->value[1] = col_type(m[1], T(0));
+ this->value[2] = col_type(T(0), T(0), T(1), T(0));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x4<T>::tmat3x4
+ (
+ tmat3x2<T> const & m
+ )
+ {
+ this->value[0] = col_type(m[0], detail::tvec2<T>(0));
+ this->value[1] = col_type(m[1], detail::tvec2<T>(0));
+ this->value[2] = col_type(m[2], T(0), T(1));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x4<T>::tmat3x4
+ (
+ tmat2x4<T> const & m
+ )
+ {
+ this->value[0] = col_type(m[0]);
+ this->value[1] = col_type(m[1]);
+ this->value[2] = col_type(T(0), T(0), T(1), T(0));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x4<T>::tmat3x4
+ (
+ tmat4x2<T> const & m
+ )
+ {
+ this->value[0] = col_type(m[0], detail::tvec2<T>(T(0)));
+ this->value[1] = col_type(m[1], detail::tvec2<T>(T(0)));
+ this->value[2] = col_type(m[2], detail::tvec2<T>(T(1), T(0)));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x4<T>::tmat3x4
+ (
+ tmat4x3<T> const & m
+ )
+ {
+ this->value[0] = col_type(m[0], T(0));
+ this->value[1] = col_type(m[1], T(0));
+ this->value[2] = col_type(m[2], T(0));
+ }
+
+ //////////////////////////////////////////////////////////////
+ // Unary updatable operators
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x4<T>& tmat3x4<T>::operator=
+ (
+ tmat3x4<T> const & m
+ )
+ {
+ this->value[0] = m[0];
+ this->value[1] = m[1];
+ this->value[2] = m[2];
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat3x4<T>& tmat3x4<T>::operator=
+ (
+ tmat3x4<U> const & m
+ )
+ {
+ this->value[0] = m[0];
+ this->value[1] = m[1];
+ this->value[2] = m[2];
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat3x4<T>& tmat3x4<T>::operator+=
+ (
+ U const & s
+ )
+ {
+ this->value[0] += s;
+ this->value[1] += s;
+ this->value[2] += s;
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat3x4<T>& tmat3x4<T>::operator+=
+ (
+ tmat3x4<U> const & m
+ )
+ {
+ this->value[0] += m[0];
+ this->value[1] += m[1];
+ this->value[2] += m[2];
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat3x4<T>& tmat3x4<T>::operator-=
+ (
+ U const & s
+ )
+ {
+ this->value[0] -= s;
+ this->value[1] -= s;
+ this->value[2] -= s;
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat3x4<T>& tmat3x4<T>::operator-=
+ (
+ tmat3x4<U> const & m
+ )
+ {
+ this->value[0] -= m[0];
+ this->value[1] -= m[1];
+ this->value[2] -= m[2];
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat3x4<T>& tmat3x4<T>::operator*=
+ (
+ U const & s
+ )
+ {
+ this->value[0] *= s;
+ this->value[1] *= s;
+ this->value[2] *= s;
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat3x4<T>& tmat3x4<T>::operator*=
+ (
+ tmat3x4<U> const & m
+ )
+ {
+ return (*this = tmat3x4<T>(*this * m));
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat3x4<T> & tmat3x4<T>::operator/=
+ (
+ U const & s
+ )
+ {
+ this->value[0] /= s;
+ this->value[1] /= s;
+ this->value[2] /= s;
+ return *this;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x4<T>& tmat3x4<T>::operator++ ()
+ {
+ ++this->value[0];
+ ++this->value[1];
+ ++this->value[2];
+ return *this;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x4<T>& tmat3x4<T>::operator-- ()
+ {
+ --this->value[0];
+ --this->value[1];
+ --this->value[2];
+ return *this;
+ }
+
+ //////////////////////////////////////////////////////////////
+ // Binary operators
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x4<T> operator+
+ (
+ tmat3x4<T> const & m,
+ typename tmat3x4<T>::value_type const & s
+ )
+ {
+ return tmat3x4<T>(
+ m[0] + s,
+ m[1] + s,
+ m[2] + s);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x4<T> operator+
+ (
+ tmat3x4<T> const & m1,
+ tmat3x4<T> const & m2
+ )
+ {
+ return tmat3x4<T>(
+ m1[0] + m2[0],
+ m1[1] + m2[1],
+ m1[2] + m2[2]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x4<T> operator-
+ (
+ tmat3x4<T> const & m,
+ typename tmat3x4<T>::value_type const & s
+ )
+ {
+ return tmat3x4<T>(
+ m[0] - s,
+ m[1] - s,
+ m[2] - s);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x4<T> operator-
+ (
+ tmat3x4<T> const & m1,
+ tmat3x4<T> const & m2
+ )
+ {
+ return tmat3x4<T>(
+ m1[0] - m2[0],
+ m1[1] - m2[1],
+ m1[2] - m2[2]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x4<T> operator*
+ (
+ tmat3x4<T> const & m,
+ typename tmat3x4<T>::value_type const & s
+ )
+ {
+ return tmat3x4<T>(
+ m[0] * s,
+ m[1] * s,
+ m[2] * s);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x4<T> operator*
+ (
+ typename tmat3x4<T>::value_type const & s,
+ tmat3x4<T> const & m
+ )
+ {
+ return tmat3x4<T>(
+ m[0] * s,
+ m[1] * s,
+ m[2] * s);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tmat3x4<T>::col_type operator*
+ (
+ tmat3x4<T> const & m,
+ typename tmat3x4<T>::row_type const & v
+ )
+ {
+ return typename tmat3x4<T>::col_type(
+ m[0][0] * v.x + m[1][0] * v.y + m[2][0] * v.z,
+ m[0][1] * v.x + m[1][1] * v.y + m[2][1] * v.z,
+ m[0][2] * v.x + m[1][2] * v.y + m[2][2] * v.z,
+ m[0][3] * v.x + m[1][3] * v.y + m[2][3] * v.z);
+ }
+
+ // X X X
+ // X X X
+ // X X X
+ // X X X
+ // X X X X
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tmat3x4<T>::row_type operator*
+ (
+ typename tmat3x4<T>::col_type const & v,
+ tmat3x4<T> const & m
+ )
+ {
+ return typename tmat3x4<T>::row_type(
+ v.x * m[0][0] + v.y * m[0][1] + v.z * m[0][2] + v.w * m[0][3],
+ v.x * m[1][0] + v.y * m[1][1] + v.z * m[1][2] + v.w * m[1][3],
+ v.x * m[2][0] + v.y * m[2][1] + v.z * m[2][2] + v.w * m[2][3]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x4<T> operator*
+ (
+ tmat3x4<T> const & m1,
+ tmat4x3<T> const & m2
+ )
+ {
+ const T SrcA00 = m1[0][0];
+ const T SrcA01 = m1[0][1];
+ const T SrcA02 = m1[0][2];
+ const T SrcA03 = m1[0][3];
+ const T SrcA10 = m1[1][0];
+ const T SrcA11 = m1[1][1];
+ const T SrcA12 = m1[1][2];
+ const T SrcA13 = m1[1][3];
+ const T SrcA20 = m1[2][0];
+ const T SrcA21 = m1[2][1];
+ const T SrcA22 = m1[2][2];
+ const T SrcA23 = m1[2][3];
+
+ const T SrcB00 = m2[0][0];
+ const T SrcB01 = m2[0][1];
+ const T SrcB02 = m2[0][2];
+ const T SrcB10 = m2[1][0];
+ const T SrcB11 = m2[1][1];
+ const T SrcB12 = m2[1][2];
+ const T SrcB20 = m2[2][0];
+ const T SrcB21 = m2[2][1];
+ const T SrcB22 = m2[2][2];
+ const T SrcB30 = m2[3][0];
+ const T SrcB31 = m2[3][1];
+ const T SrcB32 = m2[3][2];
+
+ tmat4x4<T> Result(tmat4x4<T>::null);
+ Result[0][0] = SrcA00 * SrcB00 + SrcA10 * SrcB01 + SrcA20 * SrcB02;
+ Result[0][1] = SrcA01 * SrcB00 + SrcA11 * SrcB01 + SrcA21 * SrcB02;
+ Result[0][2] = SrcA02 * SrcB00 + SrcA12 * SrcB01 + SrcA22 * SrcB02;
+ Result[0][3] = SrcA03 * SrcB00 + SrcA13 * SrcB01 + SrcA23 * SrcB02;
+ Result[1][0] = SrcA00 * SrcB10 + SrcA10 * SrcB11 + SrcA20 * SrcB12;
+ Result[1][1] = SrcA01 * SrcB10 + SrcA11 * SrcB11 + SrcA21 * SrcB12;
+ Result[1][2] = SrcA02 * SrcB10 + SrcA12 * SrcB11 + SrcA22 * SrcB12;
+ Result[1][3] = SrcA03 * SrcB10 + SrcA13 * SrcB11 + SrcA23 * SrcB12;
+ Result[2][0] = SrcA00 * SrcB20 + SrcA10 * SrcB21 + SrcA20 * SrcB22;
+ Result[2][1] = SrcA01 * SrcB20 + SrcA11 * SrcB21 + SrcA21 * SrcB22;
+ Result[2][2] = SrcA02 * SrcB20 + SrcA12 * SrcB21 + SrcA22 * SrcB22;
+ Result[2][3] = SrcA03 * SrcB20 + SrcA13 * SrcB21 + SrcA23 * SrcB22;
+ Result[3][0] = SrcA00 * SrcB30 + SrcA10 * SrcB31 + SrcA20 * SrcB32;
+ Result[3][1] = SrcA01 * SrcB30 + SrcA11 * SrcB31 + SrcA21 * SrcB32;
+ Result[3][2] = SrcA02 * SrcB30 + SrcA12 * SrcB31 + SrcA22 * SrcB32;
+ Result[3][3] = SrcA03 * SrcB30 + SrcA13 * SrcB31 + SrcA23 * SrcB32;
+ return Result;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x4<T> operator/
+ (
+ tmat3x4<T> const & m,
+ typename tmat3x4<T>::value_type const & s
+ )
+ {
+ return tmat3x4<T>(
+ m[0] / s,
+ m[1] / s,
+ m[2] / s);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x4<T> operator/
+ (
+ typename tmat3x4<T>::value_type const & s,
+ tmat3x4<T> const & m
+ )
+ {
+ return tmat3x4<T>(
+ s / m[0],
+ s / m[1],
+ s / m[2]);
+ }
+
+ // Unary constant operators
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x4<T> const operator-
+ (
+ tmat3x4<T> const & m
+ )
+ {
+ return tmat3x4<T>(
+ -m[0],
+ -m[1],
+ -m[2]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x4<T> const operator++
+ (
+ tmat3x4<T> const & m,
+ int
+ )
+ {
+ return tmat3x4<T>(
+ m[0] + T(1),
+ m[1] + T(1),
+ m[2] + T(1));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x4<T> const operator--
+ (
+ tmat3x4<T> const & m,
+ int
+ )
+ {
+ return tmat3x4<T>(
+ m[0] - T(1),
+ m[1] - T(1),
+ m[2] - T(1));
+ }
+
+ //////////////////////////////////////
+ // Boolean operators
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER bool operator==
+ (
+ tmat3x4<T> const & m1,
+ tmat3x4<T> const & m2
+ )
+ {
+ return (m1[0] == m2[0]) && (m1[1] == m2[1]) && (m1[2] == m2[2]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER bool operator!=
+ (
+ tmat3x4<T> const & m1,
+ tmat3x4<T> const & m2
+ )
+ {
+ return (m1[0] != m2[0]) || (m1[1] != m2[1]) || (m1[2] != m2[2]);
+ }
+
+} //namespace detail
+} //namespace glm
diff --git a/src/glm/core/type_mat4x2.hpp b/src/glm/core/type_mat4x2.hpp
new file mode 100644
index 0000000..35388bc
--- /dev/null
+++ b/src/glm/core/type_mat4x2.hpp
@@ -0,0 +1,242 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2006-10-01
+// Updated : 2010-02-11
+// Licence : This source is under MIT License
+// File : glm/core/type_mat4x2.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_core_type_mat4x2
+#define glm_core_type_mat4x2
+
+#include "type_mat.hpp"
+
+namespace glm{
+namespace detail
+{
+ template <typename T> struct tvec1;
+ template <typename T> struct tvec2;
+ template <typename T> struct tvec3;
+ template <typename T> struct tvec4;
+ template <typename T> struct tmat2x2;
+ template <typename T> struct tmat2x3;
+ template <typename T> struct tmat2x4;
+ template <typename T> struct tmat3x2;
+ template <typename T> struct tmat3x3;
+ template <typename T> struct tmat3x4;
+ template <typename T> struct tmat4x2;
+ template <typename T> struct tmat4x3;
+ template <typename T> struct tmat4x4;
+
+ //! \brief Template for 4 columns and 2 rows matrix of floating-point numbers.
+ //! \ingroup core_template
+ template <typename T>
+ struct tmat4x2
+ {
+ enum ctor{null};
+ typedef T value_type;
+ typedef std::size_t size_type;
+ typedef tvec2<T> col_type;
+ typedef tvec4<T> row_type;
+ static GLM_FUNC_DECL size_type col_size();
+ static GLM_FUNC_DECL size_type row_size();
+
+ typedef tmat4x2<T> type;
+ typedef tmat2x4<T> transpose_type;
+
+ private:
+ // Data
+ col_type value[4];
+
+ public:
+ // Constructors
+ GLM_FUNC_DECL tmat4x2();
+ GLM_FUNC_DECL tmat4x2(tmat4x2 const & m);
+
+ GLM_FUNC_DECL explicit tmat4x2(
+ ctor Null);
+ GLM_FUNC_DECL explicit tmat4x2(
+ value_type const & x);
+ GLM_FUNC_DECL explicit tmat4x2(
+ value_type const & x0, value_type const & y0,
+ value_type const & x1, value_type const & y1,
+ value_type const & x2, value_type const & y2,
+ value_type const & x3, value_type const & y3);
+ GLM_FUNC_DECL explicit tmat4x2(
+ col_type const & v0,
+ col_type const & v1,
+ col_type const & v2,
+ col_type const & v3);
+
+ //////////////////////////////////////
+ // Conversions
+ template <typename U>
+ GLM_FUNC_DECL explicit tmat4x2(
+ U const & x);
+
+ template
+ <
+ typename X1, typename Y1,
+ typename X2, typename Y2,
+ typename X3, typename Y3,
+ typename X4, typename Y4
+ >
+ GLM_FUNC_DECL explicit tmat4x2(
+ X1 const & x1, Y1 const & y1,
+ X2 const & x2, Y2 const & y2,
+ X3 const & x3, Y3 const & y3,
+ X4 const & x4, Y4 const & y4);
+
+ template <typename V1, typename V2, typename V3, typename V4>
+ GLM_FUNC_DECL explicit tmat4x2(
+ tvec2<V1> const & v1,
+ tvec2<V2> const & v2,
+ tvec2<V3> const & v3,
+ tvec2<V4> const & v4);
+
+ // Matrix conversions
+ template <typename U>
+ GLM_FUNC_DECL explicit tmat4x2(tmat4x2<U> const & m);
+
+ GLM_FUNC_DECL explicit tmat4x2(tmat2x2<T> const & x);
+ GLM_FUNC_DECL explicit tmat4x2(tmat3x3<T> const & x);
+ GLM_FUNC_DECL explicit tmat4x2(tmat4x4<T> const & x);
+ GLM_FUNC_DECL explicit tmat4x2(tmat2x3<T> const & x);
+ GLM_FUNC_DECL explicit tmat4x2(tmat3x2<T> const & x);
+ GLM_FUNC_DECL explicit tmat4x2(tmat2x4<T> const & x);
+ GLM_FUNC_DECL explicit tmat4x2(tmat4x3<T> const & x);
+ GLM_FUNC_DECL explicit tmat4x2(tmat3x4<T> const & x);
+
+ // Accesses
+ GLM_FUNC_DECL col_type & operator[](size_type i);
+ GLM_FUNC_DECL col_type const & operator[](size_type i) const;
+
+ // Unary updatable operators
+ GLM_FUNC_DECL tmat4x2<T>& operator= (tmat4x2<T> const & m);
+ template <typename U>
+ GLM_FUNC_DECL tmat4x2<T>& operator= (tmat4x2<U> const & m);
+ template <typename U>
+ GLM_FUNC_DECL tmat4x2<T>& operator+= (U const & s);
+ template <typename U>
+ GLM_FUNC_DECL tmat4x2<T>& operator+= (tmat4x2<U> const & m);
+ template <typename U>
+ GLM_FUNC_DECL tmat4x2<T>& operator-= (U const & s);
+ template <typename U>
+ GLM_FUNC_DECL tmat4x2<T>& operator-= (tmat4x2<U> const & m);
+ template <typename U>
+ GLM_FUNC_DECL tmat4x2<T>& operator*= (U const & s);
+ template <typename U>
+ GLM_FUNC_DECL tmat4x2<T>& operator*= (tmat4x2<U> const & m);
+ template <typename U>
+ GLM_FUNC_DECL tmat4x2<T>& operator/= (U const & s);
+
+ GLM_FUNC_DECL tmat4x2<T>& operator++ ();
+ GLM_FUNC_DECL tmat4x2<T>& operator-- ();
+ };
+
+ // Binary operators
+ template <typename T>
+ tmat4x2<T> operator+ (
+ tmat4x2<T> const & m,
+ typename tmat4x2<T>::value_type const & s);
+
+ template <typename T>
+ tmat4x2<T> operator+ (
+ tmat4x2<T> const & m1,
+ tmat4x2<T> const & m2);
+
+ template <typename T>
+ tmat4x2<T> operator- (
+ tmat4x2<T> const & m,
+ typename tmat4x2<T>::value_type const & s);
+
+ template <typename T>
+ tmat4x2<T> operator- (
+ tmat4x2<T> const & m1,
+ tmat4x2<T> const & m2);
+
+ template <typename T>
+ tmat4x2<T> operator* (
+ tmat4x2<T> const & m,
+ typename tmat4x2<T>::value_type const & s);
+
+ template <typename T>
+ tmat4x2<T> operator* (
+ typename tmat4x2<T>::value_type const & s,
+ tmat4x2<T> const & m);
+
+ template <typename T>
+ typename tmat4x2<T>::col_type operator* (
+ tmat4x2<T> const & m,
+ typename tmat4x2<T>::row_type const & v);
+
+ template <typename T>
+ typename tmat4x2<T>::row_type operator* (
+ typename tmat4x2<T>::col_type const & v,
+ tmat4x2<T> const & m);
+
+ template <typename T>
+ tmat2x2<T> operator* (
+ tmat4x2<T> const & m1,
+ tmat2x4<T> const & m2);
+
+ template <typename T>
+ tmat4x2<T> operator/ (
+ tmat4x2<T> const & m,
+ typename tmat4x2<T>::value_type const & s);
+
+ template <typename T>
+ tmat4x2<T> operator/ (
+ typename tmat4x2<T>::value_type const & s,
+ tmat4x2<T> const & m);
+
+ // Unary constant operators
+ template <typename T>
+ tmat4x2<T> const operator- (
+ tmat4x2<T> const & m);
+
+ template <typename T>
+ tmat4x2<T> const operator-- (
+ tmat4x2<T> const & m,
+ int);
+
+ template <typename T>
+ tmat4x2<T> const operator++ (
+ tmat4x2<T> const & m,
+ int);
+
+} //namespace detail
+
+namespace core{
+namespace type{
+namespace precision
+{
+ //! 4 columns of 2 components matrix of low precision floating-point numbers.
+ //! There is no guarantee on the actual precision.
+ //! (From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers)
+ //! \ingroup core_precision
+ typedef detail::tmat4x2<lowp_float> lowp_mat4x2;
+
+ //! 4 columns of 2 components matrix of medium precision floating-point numbers.
+ //! There is no guarantee on the actual precision.
+ //! (From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers)
+ //! \ingroup core_precision
+ typedef detail::tmat4x2<mediump_float> mediump_mat4x2;
+
+ //! 4 columns of 2 components matrix of high precision floating-point numbers.
+ //! There is no guarantee on the actual precision.
+ //! (From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers)
+ //! \ingroup core_precision
+ typedef detail::tmat4x2<highp_float> highp_mat4x2;
+
+}//namespace precision
+}//namespace type
+}//namespace core
+}//namespace glm
+
+#ifndef GLM_EXTERNAL_TEMPLATE
+#include "type_mat4x2.inl"
+#endif
+
+#endif //glm_core_type_mat4x2
diff --git a/src/glm/core/type_mat4x2.inl b/src/glm/core/type_mat4x2.inl
new file mode 100644
index 0000000..9f01899
--- /dev/null
+++ b/src/glm/core/type_mat4x2.inl
@@ -0,0 +1,670 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2006-10-01
+// Updated : 2010-02-03
+// Licence : This source is under MIT License
+// File : glm/core/type_mat4x2.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm{
+namespace detail
+{
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tmat4x2<T>::size_type tmat4x2<T>::col_size()
+ {
+ return 2;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tmat4x2<T>::size_type tmat4x2<T>::row_size()
+ {
+ return 4;
+ }
+
+ //////////////////////////////////////
+ // Accesses
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tmat4x2<T>::col_type &
+ tmat4x2<T>::operator[]
+ (
+ size_type i
+ )
+ {
+ assert(i < this->row_size());
+ return this->value[i];
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tmat4x2<T>::col_type const &
+ tmat4x2<T>::operator[]
+ (
+ size_type i
+ ) const
+ {
+ assert(i < this->row_size());
+ return this->value[i];
+ }
+
+ //////////////////////////////////////////////////////////////
+ // Constructors
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x2<T>::tmat4x2()
+ {
+ value_type const Zero(0);
+ value_type const One(1);
+ this->value[0] = col_type(One, Zero);
+ this->value[1] = col_type(Zero, One);
+ this->value[2] = col_type(Zero, Zero);
+ this->value[3] = col_type(Zero, Zero);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x2<T>::tmat4x2
+ (
+ tmat4x2<T> const & m
+ )
+ {
+ this->value[0] = m.value[0];
+ this->value[1] = m.value[1];
+ this->value[2] = m.value[2];
+ this->value[3] = m.value[3];
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x2<T>::tmat4x2
+ (
+ ctor
+ )
+ {}
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x2<T>::tmat4x2
+ (
+ value_type const & s
+ )
+ {
+ value_type const Zero(0);
+ this->value[0] = col_type(s, Zero);
+ this->value[1] = col_type(Zero, s);
+ this->value[2] = col_type(Zero, Zero);
+ this->value[3] = col_type(Zero, Zero);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x2<T>::tmat4x2
+ (
+ value_type const & x0, value_type const & y0,
+ value_type const & x1, value_type const & y1,
+ value_type const & x2, value_type const & y2,
+ value_type const & x3, value_type const & y3
+ )
+ {
+ this->value[0] = col_type(x0, y0);
+ this->value[1] = col_type(x1, y1);
+ this->value[2] = col_type(x2, y2);
+ this->value[3] = col_type(x3, y3);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x2<T>::tmat4x2
+ (
+ col_type const & v0,
+ col_type const & v1,
+ col_type const & v2,
+ col_type const & v3
+ )
+ {
+ this->value[0] = v0;
+ this->value[1] = v1;
+ this->value[2] = v2;
+ this->value[3] = v3;
+ }
+
+ //////////////////////////////////////
+ // Convertion constructors
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_DECL tmat4x2<T>::tmat4x2
+ (
+ U const & s
+ )
+ {
+ value_type const Zero(0);
+ this->value[0] = tvec2<T>(value_type(s), Zero);
+ this->value[1] = tvec2<T>(Zero, value_type(s));
+ this->value[2] = tvec2<T>(Zero, Zero);
+ this->value[3] = tvec2<T>(Zero, Zero);
+ }
+
+ template <typename T>
+ template <
+ typename X1, typename Y1,
+ typename X2, typename Y2,
+ typename X3, typename Y3,
+ typename X4, typename Y4>
+ GLM_FUNC_DECL tmat4x2<T>::tmat4x2
+ (
+ X1 const & x1, Y1 const & y1,
+ X2 const & x2, Y2 const & y2,
+ X3 const & x3, Y3 const & y3,
+ X4 const & x4, Y4 const & y4
+ )
+ {
+ this->value[0] = col_type(value_type(x1), value_type(y1));
+ this->value[1] = col_type(value_type(x2), value_type(y2));
+ this->value[2] = col_type(value_type(x3), value_type(y3));
+ this->value[3] = col_type(value_type(x4), value_type(y4));
+ }
+
+ template <typename T>
+ template <typename V1, typename V2, typename V3, typename V4>
+ GLM_FUNC_DECL tmat4x2<T>::tmat4x2
+ (
+ tvec2<V1> const & v1,
+ tvec2<V2> const & v2,
+ tvec2<V3> const & v3,
+ tvec2<V4> const & v4
+ )
+ {
+ this->value[0] = col_type(v1);
+ this->value[1] = col_type(v2);
+ this->value[2] = col_type(v3);
+ this->value[3] = col_type(v4);
+ }
+
+ // Conversion
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat4x2<T>::tmat4x2
+ (
+ tmat4x2<U> const & m
+ )
+ {
+ this->value[0] = col_type(m[0]);
+ this->value[1] = col_type(m[1]);
+ this->value[2] = col_type(m[2]);
+ this->value[3] = col_type(m[3]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x2<T>::tmat4x2
+ (
+ tmat2x2<T> const & m
+ )
+ {
+ this->value[0] = col_type(m[0]);
+ this->value[1] = col_type(m[1]);
+ this->value[2] = col_type(value_type(0));
+ this->value[3] = col_type(value_type(0));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x2<T>::tmat4x2
+ (
+ tmat3x3<T> const & m
+ )
+ {
+ this->value[0] = col_type(m[0]);
+ this->value[1] = col_type(m[1]);
+ this->value[2] = col_type(m[2]);
+ this->value[3] = col_type(value_type(0));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x2<T>::tmat4x2
+ (
+ tmat4x4<T> const & m
+ )
+ {
+ this->value[0] = col_type(m[0]);
+ this->value[1] = col_type(m[1]);
+ this->value[2] = col_type(m[2]);
+ this->value[3] = col_type(m[3]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x2<T>::tmat4x2
+ (
+ tmat2x3<T> const & m
+ )
+ {
+ this->value[0] = col_type(m[0]);
+ this->value[1] = col_type(m[1]);
+ this->value[2] = col_type(value_type(0));
+ this->value[3] = col_type(value_type(0));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x2<T>::tmat4x2
+ (
+ tmat3x2<T> const & m
+ )
+ {
+ this->value[0] = col_type(m[0]);
+ this->value[1] = col_type(m[1]);
+ this->value[2] = col_type(m[2]);
+ this->value[3] = col_type(value_type(0));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x2<T>::tmat4x2
+ (
+ tmat2x4<T> const & m
+ )
+ {
+ this->value[0] = col_type(m[0]);
+ this->value[1] = col_type(m[1]);
+ this->value[2] = col_type(value_type(0));
+ this->value[3] = col_type(value_type(0));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x2<T>::tmat4x2
+ (
+ tmat4x3<T> const & m
+ )
+ {
+ this->value[0] = col_type(m[0]);
+ this->value[1] = col_type(m[1]);
+ this->value[2] = col_type(m[2]);
+ this->value[3] = col_type(m[3]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x2<T>::tmat4x2
+ (
+ tmat3x4<T> const & m
+ )
+ {
+ this->value[0] = col_type(m[0]);
+ this->value[1] = col_type(m[1]);
+ this->value[2] = col_type(m[2]);
+ this->value[3] = col_type(value_type(0));
+ }
+
+ //////////////////////////////////////////////////////////////
+ // Unary updatable operators
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x2<T>& tmat4x2<T>::operator=
+ (
+ tmat4x2<T> const & m
+ )
+ {
+ this->value[0] = m[0];
+ this->value[1] = m[1];
+ this->value[2] = m[2];
+ this->value[3] = m[3];
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat4x2<T>& tmat4x2<T>::operator=
+ (
+ tmat4x2<U> const & m
+ )
+ {
+ this->value[0] = m[0];
+ this->value[1] = m[1];
+ this->value[2] = m[2];
+ this->value[3] = m[3];
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat4x2<T> & tmat4x2<T>::operator+=
+ (
+ U const & s
+ )
+ {
+ this->value[0] += s;
+ this->value[1] += s;
+ this->value[2] += s;
+ this->value[3] += s;
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat4x2<T> & tmat4x2<T>::operator+=
+ (
+ tmat4x2<U> const & m
+ )
+ {
+ this->value[0] += m[0];
+ this->value[1] += m[1];
+ this->value[2] += m[2];
+ this->value[3] += m[3];
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat4x2<T> & tmat4x2<T>::operator-=
+ (
+ U const & s
+ )
+ {
+ this->value[0] -= s;
+ this->value[1] -= s;
+ this->value[2] -= s;
+ this->value[3] -= s;
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat4x2<T> & tmat4x2<T>::operator-=
+ (
+ tmat4x2<U> const & m
+ )
+ {
+ this->value[0] -= m[0];
+ this->value[1] -= m[1];
+ this->value[2] -= m[2];
+ this->value[3] -= m[3];
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat4x2<T> & tmat4x2<T>::operator*=
+ (
+ U const & s
+ )
+ {
+ this->value[0] *= s;
+ this->value[1] *= s;
+ this->value[2] *= s;
+ this->value[3] *= s;
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat4x2<T> & tmat4x2<T>::operator*=
+ (
+ tmat4x2<U> const & m
+ )
+ {
+ return (*this = tmat4x2<T>(*this * m));
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat4x2<T> & tmat4x2<T>::operator/=
+ (
+ U const & s
+ )
+ {
+ this->value[0] /= s;
+ this->value[1] /= s;
+ this->value[2] /= s;
+ this->value[3] /= s;
+ return *this;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x2<T> & tmat4x2<T>::operator++ ()
+ {
+ ++this->value[0];
+ ++this->value[1];
+ ++this->value[2];
+ ++this->value[3];
+ return *this;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x2<T> & tmat4x2<T>::operator-- ()
+ {
+ --this->value[0];
+ --this->value[1];
+ --this->value[2];
+ --this->value[3];
+ return *this;
+ }
+
+ //////////////////////////////////////////////////////////////
+ // Binary operators
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x2<T> operator+
+ (
+ tmat4x2<T> const & m,
+ typename tmat4x2<T>::value_type const & s
+ )
+ {
+ return tmat4x2<T>(
+ m[0] + s,
+ m[1] + s,
+ m[2] + s,
+ m[3] + s);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x2<T> operator+
+ (
+ tmat4x2<T> const & m1,
+ tmat4x2<T> const & m2
+ )
+ {
+ return tmat4x2<T>(
+ m1[0] + m2[0],
+ m1[1] + m2[1],
+ m1[2] + m2[2],
+ m1[3] + m2[3]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x2<T> operator-
+ (
+ tmat4x2<T> const & m,
+ typename tmat4x2<T>::value_type const & s
+ )
+ {
+ return tmat4x2<T>(
+ m[0] - s,
+ m[1] - s,
+ m[2] - s,
+ m[3] - s);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x2<T> operator-
+ (
+ tmat4x2<T> const & m1,
+ tmat4x2<T> const & m2
+ )
+ {
+ return tmat4x2<T>(
+ m1[0] - m2[0],
+ m1[1] - m2[1],
+ m1[2] - m2[2],
+ m1[3] - m2[3]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x2<T> operator*
+ (
+ tmat4x2<T> const & m,
+ typename tmat4x2<T>::value_type const & s
+ )
+ {
+ return tmat4x2<T>(
+ m[0] * s,
+ m[1] * s,
+ m[2] * s,
+ m[3] * s);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x2<T> operator*
+ (
+ typename tmat4x2<T>::value_type const & s,
+ tmat4x2<T> const & m
+ )
+ {
+ return tmat4x2<T>(
+ m[0] * s,
+ m[1] * s,
+ m[2] * s,
+ m[3] * s);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tmat4x2<T>::col_type operator*
+ (
+ tmat4x2<T> const & m,
+ typename tmat4x2<T>::row_type const & v)
+ {
+ return typename tmat4x2<T>::col_type(
+ m[0][0] * v.x + m[1][0] * v.y + m[2][0] * v.z + m[3][0] * v.w,
+ m[0][1] * v.x + m[1][1] * v.y + m[2][1] * v.z + m[3][1] * v.w);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tmat4x2<T>::row_type operator*
+ (
+ typename tmat4x2<T>::col_type const & v,
+ tmat4x2<T> const & m)
+ {
+ return typename tmat4x2<T>::row_type(
+ v.x * m[0][0] + v.y * m[0][1],
+ v.x * m[1][0] + v.y * m[1][1],
+ v.x * m[2][0] + v.y * m[2][1],
+ v.x * m[3][0] + v.y * m[3][1]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat2x2<T> operator*
+ (
+ tmat4x2<T> const & m1,
+ tmat2x4<T> const & m2
+ )
+ {
+ T const SrcA00 = m1[0][0];
+ T const SrcA01 = m1[0][1];
+ T const SrcA10 = m1[1][0];
+ T const SrcA11 = m1[1][1];
+ T const SrcA20 = m1[2][0];
+ T const SrcA21 = m1[2][1];
+ T const SrcA30 = m1[3][0];
+ T const SrcA31 = m1[3][1];
+
+ T const SrcB00 = m2[0][0];
+ T const SrcB01 = m2[0][1];
+ T const SrcB02 = m2[0][2];
+ T const SrcB03 = m2[0][3];
+ T const SrcB10 = m2[1][0];
+ T const SrcB11 = m2[1][1];
+ T const SrcB12 = m2[1][2];
+ T const SrcB13 = m2[1][3];
+
+ tmat2x2<T> Result(tmat2x2<T>::null);
+ Result[0][0] = SrcA00 * SrcB00 + SrcA10 * SrcB01 + SrcA20 * SrcB02 + SrcA30 * SrcB03;
+ Result[0][1] = SrcA01 * SrcB00 + SrcA11 * SrcB01 + SrcA21 * SrcB02 + SrcA31 * SrcB03;
+ Result[1][0] = SrcA00 * SrcB10 + SrcA10 * SrcB11 + SrcA20 * SrcB12 + SrcA30 * SrcB13;
+ Result[1][1] = SrcA01 * SrcB10 + SrcA11 * SrcB11 + SrcA21 * SrcB12 + SrcA31 * SrcB13;
+ return Result;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x2<T> operator/
+ (
+ tmat4x2<T> const & m,
+ typename tmat4x2<T>::value_type const & s
+ )
+ {
+ return tmat4x2<T>(
+ m[0] / s,
+ m[1] / s,
+ m[2] / s,
+ m[3] / s);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x2<T> operator/
+ (
+ typename tmat4x2<T>::value_type const & s,
+ tmat4x2<T> const & m
+ )
+ {
+ return tmat4x2<T>(
+ s / m[0],
+ s / m[1],
+ s / m[2],
+ s / m[3]);
+ }
+
+ // Unary constant operators
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x2<T> const operator-
+ (
+ tmat4x2<T> const & m
+ )
+ {
+ return tmat4x2<T>(
+ -m[0],
+ -m[1],
+ -m[2],
+ -m[3]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x2<T> const operator++
+ (
+ tmat4x2<T> const & m,
+ int
+ )
+ {
+ return tmat4x2<T>(
+ m[0] + typename tmat4x2<T>::value_type(1),
+ m[1] + typename tmat4x2<T>::value_type(1),
+ m[2] + typename tmat4x2<T>::value_type(1),
+ m[3] + typename tmat4x2<T>::value_type(1));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x2<T> const operator--
+ (
+ tmat4x2<T> const & m,
+ int
+ )
+ {
+ return tmat4x2<T>(
+ m[0] - typename tmat4x2<T>::value_type(1),
+ m[1] - typename tmat4x2<T>::value_type(1),
+ m[2] - typename tmat4x2<T>::value_type(1),
+ m[3] - typename tmat4x2<T>::value_type(1));
+ }
+
+ //////////////////////////////////////
+ // Boolean operators
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER bool operator==
+ (
+ tmat4x2<T> const & m1,
+ tmat4x2<T> const & m2
+ )
+ {
+ return (m1[0] == m2[0]) && (m1[1] == m2[1]) && (m1[2] == m2[2]) && (m1[3] == m2[3]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER bool operator!=
+ (
+ tmat4x2<T> const & m1,
+ tmat4x2<T> const & m2
+ )
+ {
+ return (m1[0] != m2[0]) || (m1[1] != m2[1]) || (m1[2] != m2[2]) || (m1[3] != m2[3]);
+ }
+
+} //namespace detail
+} //namespace glm
diff --git a/src/glm/core/type_mat4x3.hpp b/src/glm/core/type_mat4x3.hpp
new file mode 100644
index 0000000..bd1ad9f
--- /dev/null
+++ b/src/glm/core/type_mat4x3.hpp
@@ -0,0 +1,240 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2006-08-04
+// Updated : 2010-02-11
+// Licence : This source is under MIT License
+// File : glm/core/type_mat4x3.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_core_type_mat4x3
+#define glm_core_type_mat4x3
+
+#include "type_mat.hpp"
+
+namespace glm{
+namespace detail
+{
+ template <typename T> struct tvec1;
+ template <typename T> struct tvec2;
+ template <typename T> struct tvec3;
+ template <typename T> struct tvec4;
+ template <typename T> struct tmat2x2;
+ template <typename T> struct tmat2x3;
+ template <typename T> struct tmat2x4;
+ template <typename T> struct tmat3x2;
+ template <typename T> struct tmat3x3;
+ template <typename T> struct tmat3x4;
+ template <typename T> struct tmat4x2;
+ template <typename T> struct tmat4x3;
+ template <typename T> struct tmat4x4;
+
+ //! \brief Template for 4 columns and 3 rows matrix of floating-point numbers.
+ //! \ingroup core_template
+ template <typename T>
+ struct tmat4x3
+ {
+ enum ctor{null};
+ typedef T value_type;
+ typedef std::size_t size_type;
+ typedef tvec3<T> col_type;
+ typedef tvec4<T> row_type;
+ static GLM_FUNC_DECL size_type col_size();
+ static GLM_FUNC_DECL size_type row_size();
+
+ typedef tmat4x3<T> type;
+ typedef tmat3x4<T> transpose_type;
+
+ private:
+ // Data
+ col_type value[4];
+
+ public:
+ // Constructors
+ GLM_FUNC_DECL tmat4x3();
+ GLM_FUNC_DECL tmat4x3(tmat4x3 const & m);
+
+ GLM_FUNC_DECL explicit tmat4x3(
+ ctor Null);
+ GLM_FUNC_DECL explicit tmat4x3(
+ value_type const & x);
+ GLM_FUNC_DECL explicit tmat4x3(
+ value_type const & x0, value_type const & y0, value_type const & z0,
+ value_type const & x1, value_type const & y1, value_type const & z1,
+ value_type const & x2, value_type const & y2, value_type const & z2,
+ value_type const & x3, value_type const & y3, value_type const & z3);
+ GLM_FUNC_DECL explicit tmat4x3(
+ col_type const & v0,
+ col_type const & v1,
+ col_type const & v2,
+ col_type const & v3);
+
+ //////////////////////////////////////
+ // Conversions
+ template <typename U>
+ GLM_FUNC_DECL explicit tmat4x3(
+ U const & x);
+
+ template <
+ typename X1, typename Y1, typename Z1,
+ typename X2, typename Y2, typename Z2,
+ typename X3, typename Y3, typename Z3,
+ typename X4, typename Y4, typename Z4>
+ GLM_FUNC_DECL explicit tmat4x3(
+ X1 const & x1, Y1 const & y1, Z1 const & z1,
+ X2 const & x2, Y2 const & y2, Z2 const & z2,
+ X3 const & x3, Y3 const & y3, Z3 const & z3,
+ X4 const & x4, Y4 const & y4, Z4 const & z4);
+
+ template <typename V1, typename V2, typename V3, typename V4>
+ GLM_FUNC_DECL explicit tmat4x3(
+ tvec3<V1> const & v1,
+ tvec3<V2> const & v2,
+ tvec3<V3> const & v3,
+ tvec3<V4> const & v4);
+
+ // Matrix conversions
+ template <typename U>
+ GLM_FUNC_DECL explicit tmat4x3(tmat4x3<U> const & m);
+
+ GLM_FUNC_DECL explicit tmat4x3(tmat2x2<T> const & x);
+ GLM_FUNC_DECL explicit tmat4x3(tmat3x3<T> const & x);
+ GLM_FUNC_DECL explicit tmat4x3(tmat4x4<T> const & x);
+ GLM_FUNC_DECL explicit tmat4x3(tmat2x3<T> const & x);
+ GLM_FUNC_DECL explicit tmat4x3(tmat3x2<T> const & x);
+ GLM_FUNC_DECL explicit tmat4x3(tmat2x4<T> const & x);
+ GLM_FUNC_DECL explicit tmat4x3(tmat4x2<T> const & x);
+ GLM_FUNC_DECL explicit tmat4x3(tmat3x4<T> const & x);
+
+ // Accesses
+ col_type & operator[](size_type i);
+ col_type const & operator[](size_type i) const;
+
+ // Unary updatable operators
+ GLM_FUNC_DECL tmat4x3<T> & operator= (tmat4x3<T> const & m);
+ template <typename U>
+ GLM_FUNC_DECL tmat4x3<T> & operator= (tmat4x3<U> const & m);
+ template <typename U>
+ GLM_FUNC_DECL tmat4x3<T> & operator+= (U const & s);
+ template <typename U>
+ GLM_FUNC_DECL tmat4x3<T> & operator+= (tmat4x3<U> const & m);
+ template <typename U>
+ GLM_FUNC_DECL tmat4x3<T> & operator-= (U const & s);
+ template <typename U>
+ GLM_FUNC_DECL tmat4x3<T> & operator-= (tmat4x3<U> const & m);
+ template <typename U>
+ GLM_FUNC_DECL tmat4x3<T> & operator*= (U const & s);
+ template <typename U>
+ GLM_FUNC_DECL tmat4x3<T> & operator*= (tmat4x3<U> const & m);
+ template <typename U>
+ GLM_FUNC_DECL tmat4x3<T> & operator/= (U const & s);
+
+ GLM_FUNC_DECL tmat4x3<T> & operator++ ();
+ GLM_FUNC_DECL tmat4x3<T> & operator-- ();
+ };
+
+ // Binary operators
+ template <typename T>
+ tmat4x3<T> operator+ (
+ tmat4x3<T> const & m,
+ typename tmat4x3<T>::value_type const & s);
+
+ template <typename T>
+ tmat4x3<T> operator+ (
+ tmat4x3<T> const & m1,
+ tmat4x3<T> const & m2);
+
+ template <typename T>
+ tmat4x3<T> operator- (
+ tmat4x3<T> const & m,
+ typename tmat4x3<T>::value_type const & s);
+
+ template <typename T>
+ tmat4x3<T> operator- (
+ tmat4x3<T> const & m1,
+ tmat4x3<T> const & m2);
+
+ template <typename T>
+ tmat4x3<T> operator* (
+ tmat4x3<T> const & m,
+ typename tmat4x3<T>::value_type const & s);
+
+ template <typename T>
+ tmat4x3<T> operator* (
+ typename tmat4x3<T>::value_type const & s,
+ tmat4x3<T> const & m);
+
+ template <typename T>
+ typename tmat4x3<T>::col_type operator* (
+ tmat4x3<T> const & m,
+ typename tmat4x3<T>::row_type const & v);
+
+ template <typename T>
+ typename tmat4x3<T>::row_type operator* (
+ typename tmat4x3<T>::col_type const & v,
+ tmat4x3<T> const & m);
+
+ template <typename T>
+ tmat3x3<T> operator* (
+ tmat4x3<T> const & m1,
+ tmat3x4<T> const & m2);
+
+ template <typename T>
+ tmat4x3<T> operator/ (
+ tmat4x3<T> const & m,
+ typename tmat4x3<T>::value_type const & s);
+
+ template <typename T>
+ tmat4x3<T> operator/ (
+ typename tmat4x3<T>::value_type const & s,
+ tmat4x3<T> const & m);
+
+ // Unary constant operators
+ template <typename T>
+ tmat4x3<T> const operator- (
+ tmat4x3<T> const & m);
+
+ template <typename T>
+ tmat4x3<T> const operator-- (
+ tmat4x3<T> const & m,
+ int);
+
+ template <typename T>
+ tmat4x3<T> const operator++ (
+ tmat4x3<T> const & m,
+ int);
+
+}//namespace detail
+
+namespace core{
+namespace type{
+namespace precision
+{
+ //! 4 columns of 3 components matrix of low precision floating-point numbers.
+ //! There is no guarantee on the actual precision.
+ //! (From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers)
+ //! \ingroup core_precision
+ typedef detail::tmat4x3<lowp_float> lowp_mat4x3;
+
+ //! 4 columns of 3 components matrix of medium precision floating-point numbers.
+ //! There is no guarantee on the actual precision.
+ //! (From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers)
+ //! \ingroup core_precision
+ typedef detail::tmat4x3<mediump_float> mediump_mat4x3;
+
+ //! 4 columns of 3 components matrix of high precision floating-point numbers.
+ //! There is no guarantee on the actual precision.
+ //! (From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers)
+ //! \ingroup core_precision
+ typedef detail::tmat4x3<highp_float> highp_mat4x3;
+
+}//namespace precision
+}//namespace type
+}//namespace core
+}//namespace glm
+
+#ifndef GLM_EXTERNAL_TEMPLATE
+#include "type_mat4x3.inl"
+#endif //GLM_EXTERNAL_TEMPLATE
+
+#endif//glm_core_type_mat4x3
diff --git a/src/glm/core/type_mat4x3.inl b/src/glm/core/type_mat4x3.inl
new file mode 100644
index 0000000..b07c078
--- /dev/null
+++ b/src/glm/core/type_mat4x3.inl
@@ -0,0 +1,675 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2006-04-17
+// Updated : 2010-02-02
+// Licence : This source is under MIT License
+// File : glm/core/type_mat4x3.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm{
+namespace detail
+{
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tmat4x3<T>::size_type tmat4x3<T>::col_size()
+ {
+ return 3;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tmat4x3<T>::size_type tmat4x3<T>::row_size()
+ {
+ return 4;
+ }
+
+ //////////////////////////////////////
+ // Accesses
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tmat4x3<T>::col_type &
+ tmat4x3<T>::operator[]
+ (
+ size_type i
+ )
+ {
+ assert(i < this->row_size());
+ return this->value[i];
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tmat4x3<T>::col_type const &
+ tmat4x3<T>::operator[]
+ (
+ size_type i
+ ) const
+ {
+ assert(i < this->row_size());
+ return this->value[i];
+ }
+
+ //////////////////////////////////////////////////////////////
+ // Constructors
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x3<T>::tmat4x3()
+ {
+ value_type const Zero(0);
+ value_type const One(1);
+ this->value[0] = col_type(One, Zero, Zero);
+ this->value[1] = col_type(Zero, One, Zero);
+ this->value[2] = col_type(Zero, Zero, One);
+ this->value[3] = col_type(Zero, Zero, Zero);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x3<T>::tmat4x3
+ (
+ tmat4x3<T> const & m
+ )
+ {
+ this->value[0] = m.value[0];
+ this->value[1] = m.value[1];
+ this->value[2] = m.value[2];
+ this->value[3] = m.value[3];
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x3<T>::tmat4x3
+ (
+ ctor
+ )
+ {}
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x3<T>::tmat4x3
+ (
+ value_type const & s
+ )
+ {
+ value_type const Zero(0);
+ this->value[0] = col_type(s, Zero, Zero);
+ this->value[1] = col_type(Zero, s, Zero);
+ this->value[2] = col_type(Zero, Zero, s);
+ this->value[3] = col_type(Zero, Zero, Zero);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x3<T>::tmat4x3
+ (
+ value_type const & x0, value_type const & y0, value_type const & z0,
+ value_type const & x1, value_type const & y1, value_type const & z1,
+ value_type const & x2, value_type const & y2, value_type const & z2,
+ value_type const & x3, value_type const & y3, value_type const & z3
+ )
+ {
+ this->value[0] = col_type(x0, y0, z0);
+ this->value[1] = col_type(x1, y1, z1);
+ this->value[2] = col_type(x2, y2, z2);
+ this->value[3] = col_type(x3, y3, z3);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x3<T>::tmat4x3
+ (
+ col_type const & v0,
+ col_type const & v1,
+ col_type const & v2,
+ col_type const & v3
+ )
+ {
+ this->value[0] = v0;
+ this->value[1] = v1;
+ this->value[2] = v2;
+ this->value[3] = v3;
+ }
+
+ //////////////////////////////////////
+ // Convertion constructors
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_DECL tmat4x3<T>::tmat4x3
+ (
+ U const & s
+ )
+ {
+ value_type const Zero(0);
+ this->value[0] = tvec3<T>(value_type(s), Zero, Zero);
+ this->value[1] = tvec3<T>(Zero, value_type(s), Zero);
+ this->value[2] = tvec3<T>(Zero, Zero, value_type(s));
+ this->value[3] = tvec3<T>(Zero, Zero, Zero);
+ }
+
+ template <typename T>
+ template <
+ typename X1, typename Y1, typename Z1,
+ typename X2, typename Y2, typename Z2,
+ typename X3, typename Y3, typename Z3,
+ typename X4, typename Y4, typename Z4>
+ GLM_FUNC_DECL tmat4x3<T>::tmat4x3
+ (
+ X1 const & x1, Y1 const & y1, Z1 const & z1,
+ X2 const & x2, Y2 const & y2, Z2 const & z2,
+ X3 const & x3, Y3 const & y3, Z3 const & z3,
+ X4 const & x4, Y4 const & y4, Z4 const & z4
+ )
+ {
+ this->value[0] = col_type(value_type(x1), value_type(y1), value_type(z1));
+ this->value[1] = col_type(value_type(x2), value_type(y2), value_type(z2));
+ this->value[2] = col_type(value_type(x3), value_type(y3), value_type(z3));
+ this->value[3] = col_type(value_type(x4), value_type(y4), value_type(z4));
+ }
+
+ template <typename T>
+ template <typename V1, typename V2, typename V3, typename V4>
+ GLM_FUNC_DECL tmat4x3<T>::tmat4x3
+ (
+ tvec3<V1> const & v1,
+ tvec3<V2> const & v2,
+ tvec3<V3> const & v3,
+ tvec3<V4> const & v4
+ )
+ {
+ this->value[0] = col_type(v1);
+ this->value[1] = col_type(v2);
+ this->value[2] = col_type(v3);
+ this->value[3] = col_type(v4);
+ }
+
+ //////////////////////////////////////////////////////////////
+ // Matrix conversions
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat4x3<T>::tmat4x3
+ (
+ tmat4x3<U> const & m
+ )
+ {
+ this->value[0] = col_type(m[0]);
+ this->value[1] = col_type(m[1]);
+ this->value[2] = col_type(m[2]);
+ this->value[3] = col_type(m[3]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x3<T>::tmat4x3
+ (
+ tmat2x2<T> const & m
+ )
+ {
+ this->value[0] = col_type(m[0], value_type(0));
+ this->value[1] = col_type(m[1], value_type(0));
+ this->value[2] = col_type(m[2], value_type(1));
+ this->value[3] = col_type(value_type(0));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x3<T>::tmat4x3
+ (
+ tmat3x3<T> const & m
+ )
+ {
+ this->value[0] = col_type(m[0]);
+ this->value[1] = col_type(m[1]);
+ this->value[2] = col_type(m[2]);
+ this->value[3] = col_type(value_type(0));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x3<T>::tmat4x3
+ (
+ tmat4x4<T> const & m
+ )
+ {
+ this->value[0] = col_type(m[0]);
+ this->value[1] = col_type(m[1]);
+ this->value[2] = col_type(m[2]);
+ this->value[3] = col_type(m[3]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x3<T>::tmat4x3
+ (
+ tmat2x3<T> const & m
+ )
+ {
+ this->value[0] = col_type(m[0]);
+ this->value[1] = col_type(m[1]);
+ this->value[2] = col_type(value_type(0), value_type(0), value_type(1));
+ this->value[3] = col_type(value_type(0));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x3<T>::tmat4x3
+ (
+ tmat3x2<T> const & m
+ )
+ {
+ this->value[0] = col_type(m[0], value_type(0));
+ this->value[1] = col_type(m[1], value_type(0));
+ this->value[2] = col_type(m[2], value_type(1));
+ this->value[3] = col_type(value_type(0));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x3<T>::tmat4x3
+ (
+ tmat2x4<T> const & m
+ )
+ {
+ this->value[0] = col_type(m[0]);
+ this->value[1] = col_type(m[1]);
+ this->value[2] = col_type(value_type(0), value_type(0), value_type(1));
+ this->value[3] = col_type(value_type(0));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x3<T>::tmat4x3
+ (
+ tmat4x2<T> const & m
+ )
+ {
+ this->value[0] = col_type(m[0], value_type(0));
+ this->value[1] = col_type(m[1], value_type(0));
+ this->value[2] = col_type(m[2], value_type(1));
+ this->value[3] = col_type(m[3], value_type(0));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x3<T>::tmat4x3
+ (
+ tmat3x4<T> const & m
+ )
+ {
+ this->value[0] = col_type(m[0]);
+ this->value[1] = col_type(m[1]);
+ this->value[2] = col_type(m[2]);
+ this->value[3] = col_type(value_type(0));
+ }
+
+ //////////////////////////////////////////////////////////////
+ // Unary updatable operators
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x3<T>& tmat4x3<T>::operator=
+ (
+ tmat4x3<T> const & m
+ )
+ {
+ this->value[0] = m[0];
+ this->value[1] = m[1];
+ this->value[2] = m[2];
+ this->value[3] = m[3];
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat4x3<T>& tmat4x3<T>::operator=
+ (
+ tmat4x3<U> const & m
+ )
+ {
+ this->value[0] = m[0];
+ this->value[1] = m[1];
+ this->value[2] = m[2];
+ this->value[3] = m[3];
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat4x3<T> & tmat4x3<T>::operator+=
+ (
+ U const & s
+ )
+ {
+ this->value[0] += s;
+ this->value[1] += s;
+ this->value[2] += s;
+ this->value[3] += s;
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat4x3<T> & tmat4x3<T>::operator+=
+ (
+ tmat4x3<U> const & m
+ )
+ {
+ this->value[0] += m[0];
+ this->value[1] += m[1];
+ this->value[2] += m[2];
+ this->value[3] += m[3];
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat4x3<T> & tmat4x3<T>::operator-=
+ (
+ U const & s
+ )
+ {
+ this->value[0] -= s;
+ this->value[1] -= s;
+ this->value[2] -= s;
+ this->value[3] -= s;
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat4x3<T> & tmat4x3<T>::operator-=
+ (
+ tmat4x3<U> const & m
+ )
+ {
+ this->value[0] -= m[0];
+ this->value[1] -= m[1];
+ this->value[2] -= m[2];
+ this->value[3] -= m[3];
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat4x3<T> & tmat4x3<T>::operator*=
+ (
+ U const & s
+ )
+ {
+ this->value[0] *= s;
+ this->value[1] *= s;
+ this->value[2] *= s;
+ this->value[3] *= s;
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat4x3<T> & tmat4x3<T>::operator*=
+ (
+ tmat4x3<U> const & m
+ )
+ {
+ return (*this = tmat4x3<T>(*this * m));
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat4x3<T> & tmat4x3<T>::operator/=
+ (
+ U const & s
+ )
+ {
+ this->value[0] /= s;
+ this->value[1] /= s;
+ this->value[2] /= s;
+ this->value[3] /= s;
+ return *this;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x3<T> & tmat4x3<T>::operator++ ()
+ {
+ ++this->value[0];
+ ++this->value[1];
+ ++this->value[2];
+ ++this->value[3];
+ return *this;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x3<T> & tmat4x3<T>::operator-- ()
+ {
+ --this->value[0];
+ --this->value[1];
+ --this->value[2];
+ --this->value[3];
+ return *this;
+ }
+
+ //////////////////////////////////////////////////////////////
+ // Binary operators
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x3<T> operator+ (
+ tmat4x3<T> const & m,
+ typename tmat4x3<T>::value_type const & s)
+ {
+ return tmat4x3<T>(
+ m[0] + s,
+ m[1] + s,
+ m[2] + s,
+ m[3] + s);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x3<T> operator+ (
+ tmat4x3<T> const & m1,
+ tmat4x3<T> const & m2)
+ {
+ return tmat4x3<T>(
+ m1[0] + m2[0],
+ m1[1] + m2[1],
+ m1[2] + m2[2],
+ m1[3] + m2[3]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x3<T> operator- (
+ tmat4x3<T> const & m,
+ typename tmat4x3<T>::value_type const & s)
+ {
+ return tmat4x3<T>(
+ m[0] - s,
+ m[1] - s,
+ m[2] - s,
+ m[3] - s);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x3<T> operator- (
+ tmat4x3<T> const & m1,
+ tmat4x3<T> const & m2)
+ {
+ return tmat4x3<T>(
+ m1[0] - m2[0],
+ m1[1] - m2[1],
+ m1[2] - m2[2],
+ m1[3] - m2[3]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x3<T> operator* (
+ tmat4x3<T> const & m,
+ typename tmat4x3<T>::value_type const & s)
+ {
+ return tmat4x3<T>(
+ m[0] * s,
+ m[1] * s,
+ m[2] * s,
+ m[3] * s);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x3<T> operator* (
+ typename tmat4x3<T>::value_type const & s,
+ tmat4x3<T> const & m)
+ {
+ return tmat4x3<T>(
+ m[0] * s,
+ m[1] * s,
+ m[2] * s,
+ m[3] * s);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tmat4x3<T>::col_type operator*
+ (
+ tmat4x3<T> const & m,
+ typename tmat4x3<T>::row_type const & v)
+ {
+ return typename tmat4x3<T>::col_type(
+ m[0][0] * v.x + m[1][0] * v.y + m[2][0] * v.z + m[3][0] * v.w,
+ m[0][1] * v.x + m[1][1] * v.y + m[2][1] * v.z + m[3][1] * v.w,
+ m[0][2] * v.x + m[1][2] * v.y + m[2][2] * v.z + m[3][2] * v.w);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tmat4x3<T>::row_type operator*
+ (
+ typename tmat4x3<T>::col_type const & v,
+ tmat4x3<T> const & m)
+ {
+ return typename tmat4x3<T>::row_type(
+ v.x * m[0][0] + v.y * m[0][1] + v.z * m[0][2],
+ v.x * m[1][0] + v.y * m[1][1] + v.z * m[1][2],
+ v.x * m[2][0] + v.y * m[2][1] + v.z * m[2][2],
+ v.x * m[3][0] + v.y * m[3][1] + v.z * m[3][2]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat3x3<T> operator*
+ (
+ tmat4x3<T> const & m1,
+ tmat3x4<T> const & m2
+ )
+ {
+ T const SrcA00 = m1[0][0];
+ T const SrcA01 = m1[0][1];
+ T const SrcA02 = m1[0][2];
+ T const SrcA10 = m1[1][0];
+ T const SrcA11 = m1[1][1];
+ T const SrcA12 = m1[1][2];
+ T const SrcA20 = m1[2][0];
+ T const SrcA21 = m1[2][1];
+ T const SrcA22 = m1[2][2];
+ T const SrcA30 = m1[3][0];
+ T const SrcA31 = m1[3][1];
+ T const SrcA32 = m1[3][2];
+
+ T const SrcB00 = m2[0][0];
+ T const SrcB01 = m2[0][1];
+ T const SrcB02 = m2[0][2];
+ T const SrcB03 = m2[0][3];
+ T const SrcB10 = m2[1][0];
+ T const SrcB11 = m2[1][1];
+ T const SrcB12 = m2[1][2];
+ T const SrcB13 = m2[1][3];
+ T const SrcB20 = m2[2][0];
+ T const SrcB21 = m2[2][1];
+ T const SrcB22 = m2[2][2];
+ T const SrcB23 = m2[2][3];
+
+ tmat3x3<T> Result(tmat3x3<T>::null);
+ Result[0][0] = SrcA00 * SrcB00 + SrcA10 * SrcB01 + SrcA20 * SrcB02 + SrcA30 * SrcB03;
+ Result[0][1] = SrcA01 * SrcB00 + SrcA11 * SrcB01 + SrcA21 * SrcB02 + SrcA31 * SrcB03;
+ Result[0][2] = SrcA02 * SrcB00 + SrcA12 * SrcB01 + SrcA22 * SrcB02 + SrcA32 * SrcB03;
+ Result[1][0] = SrcA00 * SrcB10 + SrcA10 * SrcB11 + SrcA20 * SrcB12 + SrcA30 * SrcB13;
+ Result[1][1] = SrcA01 * SrcB10 + SrcA11 * SrcB11 + SrcA21 * SrcB12 + SrcA31 * SrcB13;
+ Result[1][2] = SrcA02 * SrcB10 + SrcA12 * SrcB11 + SrcA22 * SrcB12 + SrcA32 * SrcB13;
+ Result[2][0] = SrcA00 * SrcB20 + SrcA10 * SrcB21 + SrcA20 * SrcB22 + SrcA30 * SrcB23;
+ Result[2][1] = SrcA01 * SrcB20 + SrcA11 * SrcB21 + SrcA21 * SrcB22 + SrcA31 * SrcB23;
+ Result[2][2] = SrcA02 * SrcB20 + SrcA12 * SrcB21 + SrcA22 * SrcB22 + SrcA32 * SrcB23;
+ return Result;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x3<T> operator/
+ (
+ tmat4x3<T> const & m,
+ typename tmat4x3<T>::value_type const & s
+ )
+ {
+ return tmat4x3<T>(
+ m[0] / s,
+ m[1] / s,
+ m[2] / s,
+ m[3] / s);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x3<T> operator/
+ (
+ typename tmat4x3<T>::value_type const & s,
+ tmat4x3<T> const & m
+ )
+ {
+ return tmat4x3<T>(
+ s / m[0],
+ s / m[1],
+ s / m[2],
+ s / m[3]);
+ }
+
+ // Unary constant operators
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x3<T> const operator-
+ (
+ tmat4x3<T> const & m
+ )
+ {
+ return tmat4x3<T>(
+ -m[0],
+ -m[1],
+ -m[2],
+ -m[3]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x3<T> const operator++
+ (
+ tmat4x3<T> const & m,
+ int
+ )
+ {
+ return tmat4x3<T>(
+ m[0] + T(1),
+ m[1] + T(1),
+ m[2] + T(1),
+ m[3] + T(1));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x3<T> const operator--
+ (
+ tmat4x3<T> const & m,
+ int
+ )
+ {
+ return tmat4x3<T>(
+ m[0] - T(1),
+ m[1] - T(1),
+ m[2] - T(1),
+ m[3] - T(1));
+ }
+
+ //////////////////////////////////////
+ // Boolean operators
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER bool operator==
+ (
+ tmat4x3<T> const & m1,
+ tmat4x3<T> const & m2
+ )
+ {
+ return (m1[0] == m2[0]) && (m1[1] == m2[1]) && (m1[2] == m2[2]) && (m1[3] == m2[3]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER bool operator!=
+ (
+ tmat4x3<T> const & m1,
+ tmat4x3<T> const & m2
+ )
+ {
+ return (m1[0] != m2[0]) || (m1[1] != m2[1]) || (m1[2] != m2[2]) || (m1[3] != m2[3]);
+ }
+
+} //namespace detail
+} //namespace glm
+
diff --git a/src/glm/core/type_mat4x4.hpp b/src/glm/core/type_mat4x4.hpp
new file mode 100644
index 0000000..da93efd
--- /dev/null
+++ b/src/glm/core/type_mat4x4.hpp
@@ -0,0 +1,286 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2005-01-27
+// Updated : 2011-06-02
+// Licence : This source is under MIT License
+// File : glm/core/type_mat4x4.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_core_type_mat4x4
+#define glm_core_type_mat4x4
+
+#include "type_mat.hpp"
+
+namespace glm{
+namespace detail
+{
+ template <typename T> struct tvec1;
+ template <typename T> struct tvec2;
+ template <typename T> struct tvec3;
+ template <typename T> struct tvec4;
+ template <typename T> struct tmat2x2;
+ template <typename T> struct tmat2x3;
+ template <typename T> struct tmat2x4;
+ template <typename T> struct tmat3x2;
+ template <typename T> struct tmat3x3;
+ template <typename T> struct tmat3x4;
+ template <typename T> struct tmat4x2;
+ template <typename T> struct tmat4x3;
+ template <typename T> struct tmat4x4;
+
+ //! \brief Template for 4 * 4 matrix of floating-point numbers.
+ //! \ingroup core_template
+ template <typename T>
+ struct tmat4x4
+ {
+ enum ctor{null};
+ typedef T value_type;
+ typedef std::size_t size_type;
+ typedef tvec4<T> col_type;
+ typedef tvec4<T> row_type;
+ static GLM_FUNC_DECL size_type col_size();
+ static GLM_FUNC_DECL size_type row_size();
+
+ typedef tmat4x4<T> type;
+ typedef tmat4x4<T> transpose_type;
+
+ public:
+ // Implementation detail
+ GLM_FUNC_DECL tmat4x4<T> _inverse() const;
+
+ private:
+ // Data
+ col_type value[4];
+
+ public:
+ // Constructors
+ GLM_FUNC_DECL tmat4x4();
+ GLM_FUNC_DECL tmat4x4(tmat4x4 const & m);
+
+ GLM_FUNC_DECL explicit tmat4x4(
+ ctor Null);
+ GLM_FUNC_DECL explicit tmat4x4(
+ value_type const & x);
+ GLM_FUNC_DECL explicit tmat4x4(
+ value_type const & x0, value_type const & y0, value_type const & z0, value_type const & w0,
+ value_type const & x1, value_type const & y1, value_type const & z1, value_type const & w1,
+ value_type const & x2, value_type const & y2, value_type const & z2, value_type const & w2,
+ value_type const & x3, value_type const & y3, value_type const & z3, value_type const & w3);
+ GLM_FUNC_DECL explicit tmat4x4(
+ col_type const & v0,
+ col_type const & v1,
+ col_type const & v2,
+ col_type const & v3);
+
+ //////////////////////////////////////
+ // Conversions
+ template <typename U>
+ GLM_FUNC_DECL explicit tmat4x4(
+ U const & x);
+
+ template <
+ typename X1, typename Y1, typename Z1, typename W1,
+ typename X2, typename Y2, typename Z2, typename W2,
+ typename X3, typename Y3, typename Z3, typename W3,
+ typename X4, typename Y4, typename Z4, typename W4>
+ GLM_FUNC_DECL explicit tmat4x4(
+ X1 const & x1, Y1 const & y1, Z1 const & z1, W1 const & w1,
+ X2 const & x2, Y2 const & y2, Z2 const & z2, W2 const & w2,
+ X3 const & x3, Y3 const & y3, Z3 const & z3, W3 const & w3,
+ X4 const & x4, Y4 const & y4, Z4 const & z4, W4 const & w4);
+
+ template <typename V1, typename V2, typename V3, typename V4>
+ GLM_FUNC_DECL explicit tmat4x4(
+ tvec4<V1> const & v1,
+ tvec4<V2> const & v2,
+ tvec4<V3> const & v3,
+ tvec4<V4> const & v4);
+
+ // Matrix conversions
+ template <typename U>
+ GLM_FUNC_DECL explicit tmat4x4(tmat4x4<U> const & m);
+
+ GLM_FUNC_DECL explicit tmat4x4(tmat2x2<T> const & x);
+ GLM_FUNC_DECL explicit tmat4x4(tmat3x3<T> const & x);
+ GLM_FUNC_DECL explicit tmat4x4(tmat2x3<T> const & x);
+ GLM_FUNC_DECL explicit tmat4x4(tmat3x2<T> const & x);
+ GLM_FUNC_DECL explicit tmat4x4(tmat2x4<T> const & x);
+ GLM_FUNC_DECL explicit tmat4x4(tmat4x2<T> const & x);
+ GLM_FUNC_DECL explicit tmat4x4(tmat3x4<T> const & x);
+ GLM_FUNC_DECL explicit tmat4x4(tmat4x3<T> const & x);
+
+ // Accesses
+ GLM_FUNC_DECL col_type & operator[](size_type i);
+ GLM_FUNC_DECL col_type const & operator[](size_type i) const;
+
+ // Unary updatable operators
+ GLM_FUNC_DECL tmat4x4<T> & operator= (tmat4x4<T> const & m);
+ template <typename U>
+ GLM_FUNC_DECL tmat4x4<T> & operator= (tmat4x4<U> const & m);
+ template <typename U>
+ GLM_FUNC_DECL tmat4x4<T> & operator+= (U const & s);
+ template <typename U>
+ GLM_FUNC_DECL tmat4x4<T> & operator+= (tmat4x4<U> const & m);
+ template <typename U>
+ GLM_FUNC_DECL tmat4x4<T> & operator-= (U const & s);
+ template <typename U>
+ GLM_FUNC_DECL tmat4x4<T> & operator-= (tmat4x4<U> const & m);
+ template <typename U>
+ GLM_FUNC_DECL tmat4x4<T> & operator*= (U const & s);
+ template <typename U>
+ GLM_FUNC_DECL tmat4x4<T> & operator*= (tmat4x4<U> const & m);
+ template <typename U>
+ GLM_FUNC_DECL tmat4x4<T> & operator/= (U const & s);
+ template <typename U>
+ GLM_FUNC_DECL tmat4x4<T> & operator/= (tmat4x4<U> const & m);
+ GLM_FUNC_DECL tmat4x4<T> & operator++ ();
+ GLM_FUNC_DECL tmat4x4<T> & operator-- ();
+ };
+
+ // Binary operators
+ template <typename T>
+ tmat4x4<T> operator+ (
+ tmat4x4<T> const & m,
+ typename tmat4x4<T>::value_type const & s);
+
+ template <typename T>
+ tmat4x4<T> operator+ (
+ typename tmat4x4<T>::value_type const & s,
+ tmat4x4<T> const & m);
+
+ template <typename T>
+ tmat4x4<T> operator+ (
+ tmat4x4<T> const & m1,
+ tmat4x4<T> const & m2);
+
+ template <typename T>
+ tmat4x4<T> operator- (
+ tmat4x4<T> const & m,
+ typename tmat4x4<T>::value_type const & s);
+
+ template <typename T>
+ tmat4x4<T> operator- (
+ typename tmat4x4<T>::value_type const & s,
+ tmat4x4<T> const & m);
+
+ template <typename T>
+ tmat4x4<T> operator- (
+ tmat4x4<T> const & m1,
+ tmat4x4<T> const & m2);
+
+ template <typename T>
+ tmat4x4<T> operator* (
+ tmat4x4<T> const & m,
+ typename tmat4x4<T>::value_type const & s);
+
+ template <typename T>
+ tmat4x4<T> operator* (
+ typename tmat4x4<T>::value_type const & s,
+ tmat4x4<T> const & m);
+
+ template <typename T>
+ typename tmat4x4<T>::col_type operator* (
+ tmat4x4<T> const & m,
+ typename tmat4x4<T>::row_type const & v);
+
+ template <typename T>
+ typename tmat4x4<T>::row_type operator* (
+ typename tmat4x4<T>::col_type const & v,
+ tmat4x4<T> const & m);
+
+ template <typename T>
+ tmat4x4<T> operator* (
+ tmat4x4<T> const & m1,
+ tmat4x4<T> const & m2);
+
+ template <typename T>
+ tmat4x4<T> operator/ (
+ tmat4x4<T> const & m,
+ typename tmat4x4<T>::value_type const & s);
+
+ template <typename T>
+ tmat4x4<T> operator/ (
+ typename tmat4x4<T>::value_type const & s,
+ tmat4x4<T> const & m);
+
+ template <typename T>
+ typename tmat4x4<T>::col_type operator/ (
+ tmat4x4<T> const & m,
+ typename tmat4x4<T>::row_type const & v);
+
+ template <typename T>
+ typename tmat4x4<T>::row_type operator/ (
+ typename tmat4x4<T>::col_type & v,
+ tmat4x4<T> const & m);
+
+ template <typename T>
+ tmat4x4<T> operator/ (
+ tmat4x4<T> const & m1,
+ tmat4x4<T> const & m2);
+
+ // Unary constant operators
+ template <typename T>
+ tmat4x4<T> const operator- (
+ tmat4x4<T> const & m);
+
+ template <typename T>
+ tmat4x4<T> const operator-- (
+ tmat4x4<T> const & m, int);
+
+ template <typename T>
+ tmat4x4<T> const operator++ (
+ tmat4x4<T> const & m, int);
+
+} //namespace detail
+
+namespace core{
+namespace type{
+namespace precision
+{
+ //! 4 columns of 4 components matrix of low precision floating-point numbers.
+ //! There is no guarantee on the actual precision.
+ //! From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers
+ //! \ingroup core_precision
+ typedef detail::tmat4x4<lowp_float> lowp_mat4;
+
+ //! 4 columns of 4 components matrix of medium precision floating-point numbers.
+ //! There is no guarantee on the actual precision.
+ //! From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers
+ //! \ingroup core_precision
+ typedef detail::tmat4x4<mediump_float> mediump_mat4;
+
+ //! 4 columns of 4 components matrix of high precision floating-point numbers.
+ //! There is no guarantee on the actual precision.
+ //! From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers
+ //! \ingroup core_precision
+ typedef detail::tmat4x4<highp_float> highp_mat4;
+
+ //! 4 columns of 4 components matrix of low precision floating-point numbers.
+ //! There is no guarantee on the actual precision.
+ //! From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers
+ //! \ingroup core_precision
+ typedef detail::tmat4x4<lowp_float> lowp_mat4x4;
+
+ //! 4 columns of 4 components matrix of medium precision floating-point numbers.
+ //! There is no guarantee on the actual precision.
+ //! From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers
+ //! \ingroup core_precision
+ typedef detail::tmat4x4<mediump_float> mediump_mat4x4;
+
+ //! 4 columns of 4 components matrix of high precision floating-point numbers.
+ //! There is no guarantee on the actual precision.
+ //! From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers
+ //! \ingroup core_precision
+ typedef detail::tmat4x4<highp_float> highp_mat4x4;
+
+}//namespace precision
+}//namespace type
+}//namespace core
+}//namespace glm
+
+#ifndef GLM_EXTERNAL_TEMPLATE
+#include "type_mat4x4.inl"
+#endif//GLM_EXTERNAL_TEMPLATE
+
+#endif//glm_core_type_mat4x4
diff --git a/src/glm/core/type_mat4x4.inl b/src/glm/core/type_mat4x4.inl
new file mode 100644
index 0000000..b1322db
--- /dev/null
+++ b/src/glm/core/type_mat4x4.inl
@@ -0,0 +1,840 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2005-01-27
+// Updated : 2010-02-05
+// Licence : This source is under MIT License
+// File : glm/core/type_mat4x4.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm{
+namespace detail
+{
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tmat4x4<T>::size_type tmat4x4<T>::col_size()
+ {
+ return 4;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tmat4x4<T>::size_type tmat4x4<T>::row_size()
+ {
+ return 4;
+ }
+
+ //////////////////////////////////////
+ // Accesses
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tmat4x4<T>::col_type &
+ tmat4x4<T>::operator[]
+ (
+ size_type i
+ )
+ {
+ assert(i < this->row_size());
+ return this->value[i];
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tmat4x4<T>::col_type const &
+ tmat4x4<T>::operator[]
+ (
+ size_type i
+ ) const
+ {
+ assert(i < this->row_size());
+ return this->value[i];
+ }
+
+ //////////////////////////////////////////////////////////////
+ // Constructors
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x4<T>::tmat4x4()
+ {
+ value_type Zero(0);
+ value_type One(1);
+ this->value[0] = col_type(One, Zero, Zero, Zero);
+ this->value[1] = col_type(Zero, One, Zero, Zero);
+ this->value[2] = col_type(Zero, Zero, One, Zero);
+ this->value[3] = col_type(Zero, Zero, Zero, One);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x4<T>::tmat4x4
+ (
+ tmat4x4<T> const & m
+ )
+ {
+ this->value[0] = m.value[0];
+ this->value[1] = m.value[1];
+ this->value[2] = m.value[2];
+ this->value[3] = m.value[3];
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x4<T>::tmat4x4
+ (
+ ctor
+ )
+ {}
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x4<T>::tmat4x4
+ (
+ value_type const & s
+ )
+ {
+ value_type const Zero(0);
+ this->value[0] = col_type(s, Zero, Zero, Zero);
+ this->value[1] = col_type(Zero, s, Zero, Zero);
+ this->value[2] = col_type(Zero, Zero, s, Zero);
+ this->value[3] = col_type(Zero, Zero, Zero, s);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x4<T>::tmat4x4
+ (
+ value_type const & x0, value_type const & y0, value_type const & z0, value_type const & w0,
+ value_type const & x1, value_type const & y1, value_type const & z1, value_type const & w1,
+ value_type const & x2, value_type const & y2, value_type const & z2, value_type const & w2,
+ value_type const & x3, value_type const & y3, value_type const & z3, value_type const & w3
+ )
+ {
+ this->value[0] = col_type(x0, y0, z0, w0);
+ this->value[1] = col_type(x1, y1, z1, w1);
+ this->value[2] = col_type(x2, y2, z2, w2);
+ this->value[3] = col_type(x3, y3, z3, w3);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x4<T>::tmat4x4
+ (
+ col_type const & v0,
+ col_type const & v1,
+ col_type const & v2,
+ col_type const & v3
+ )
+ {
+ this->value[0] = v0;
+ this->value[1] = v1;
+ this->value[2] = v2;
+ this->value[3] = v3;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat4x4<T>::tmat4x4
+ (
+ tmat4x4<U> const & m
+ )
+ {
+ this->value[0] = col_type(m[0]);
+ this->value[1] = col_type(m[1]);
+ this->value[2] = col_type(m[2]);
+ this->value[3] = col_type(m[3]);
+ }
+
+ //////////////////////////////////////
+ // Convertion constructors
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_DECL tmat4x4<T>::tmat4x4
+ (
+ U const & s
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<U>::is_float || std::numeric_limits<U>::is_integer, "*mat4x4 constructor only takes float and integer types");
+
+ value_type const Zero(0);
+ this->value[0] = tvec4<T>(value_type(s), Zero, Zero, Zero);
+ this->value[1] = tvec4<T>(Zero, value_type(s), Zero, Zero);
+ this->value[2] = tvec4<T>(Zero, Zero, value_type(s), Zero);
+ this->value[3] = tvec4<T>(Zero, Zero, Zero, value_type(s));
+ }
+
+ template <typename T>
+ template <
+ typename X1, typename Y1, typename Z1, typename W1,
+ typename X2, typename Y2, typename Z2, typename W2,
+ typename X3, typename Y3, typename Z3, typename W3,
+ typename X4, typename Y4, typename Z4, typename W4>
+ GLM_FUNC_DECL tmat4x4<T>::tmat4x4
+ (
+ X1 const & x1, Y1 const & y1, Z1 const & z1, W1 const & w1,
+ X2 const & x2, Y2 const & y2, Z2 const & z2, W2 const & w2,
+ X3 const & x3, Y3 const & y3, Z3 const & z3, W3 const & w3,
+ X4 const & x4, Y4 const & y4, Z4 const & z4, W4 const & w4
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<X1>::is_float || std::numeric_limits<X1>::is_integer, "*mat4x4 constructor only takes float and integer types, 1st parameter type invalid.");
+ GLM_STATIC_ASSERT(detail::type<Y1>::is_float || std::numeric_limits<Y1>::is_integer, "*mat4x4 constructor only takes float and integer types, 2nd parameter type invalid.");
+ GLM_STATIC_ASSERT(detail::type<Z1>::is_float || std::numeric_limits<Z1>::is_integer, "*mat4x4 constructor only takes float and integer types, 3rd parameter type invalid.");
+ GLM_STATIC_ASSERT(detail::type<W1>::is_float || std::numeric_limits<W1>::is_integer, "*mat4x4 constructor only takes float and integer types, 4th parameter type invalid.");
+
+ GLM_STATIC_ASSERT(detail::type<X2>::is_float || std::numeric_limits<X2>::is_integer, "*mat4x4 constructor only takes float and integer types, 5th parameter type invalid.");
+ GLM_STATIC_ASSERT(detail::type<Y2>::is_float || std::numeric_limits<Y2>::is_integer, "*mat4x4 constructor only takes float and integer types, 6th parameter type invalid.");
+ GLM_STATIC_ASSERT(detail::type<Z2>::is_float || std::numeric_limits<Z2>::is_integer, "*mat4x4 constructor only takes float and integer types, 7th parameter type invalid.");
+ GLM_STATIC_ASSERT(detail::type<W2>::is_float || std::numeric_limits<W2>::is_integer, "*mat4x4 constructor only takes float and integer types, 8th parameter type invalid.");
+
+ GLM_STATIC_ASSERT(detail::type<X3>::is_float || std::numeric_limits<X3>::is_integer, "*mat4x4 constructor only takes float and integer types, 9th parameter type invalid.");
+ GLM_STATIC_ASSERT(detail::type<Y3>::is_float || std::numeric_limits<Y3>::is_integer, "*mat4x4 constructor only takes float and integer types, 10th parameter type invalid.");
+ GLM_STATIC_ASSERT(detail::type<Z3>::is_float || std::numeric_limits<Z3>::is_integer, "*mat4x4 constructor only takes float and integer types, 11th parameter type invalid.");
+ GLM_STATIC_ASSERT(detail::type<W3>::is_float || std::numeric_limits<W3>::is_integer, "*mat4x4 constructor only takes float and integer types, 12th parameter type invalid.");
+
+ GLM_STATIC_ASSERT(detail::type<X4>::is_float || std::numeric_limits<X4>::is_integer, "*mat4x4 constructor only takes float and integer types, 13th parameter type invalid.");
+ GLM_STATIC_ASSERT(detail::type<Y4>::is_float || std::numeric_limits<Y4>::is_integer, "*mat4x4 constructor only takes float and integer types, 14th parameter type invalid.");
+ GLM_STATIC_ASSERT(detail::type<Z4>::is_float || std::numeric_limits<Z4>::is_integer, "*mat4x4 constructor only takes float and integer types, 15th parameter type invalid.");
+ GLM_STATIC_ASSERT(detail::type<W4>::is_float || std::numeric_limits<W4>::is_integer, "*mat4x4 constructor only takes float and integer types, 16th parameter type invalid.");
+
+ this->value[0] = col_type(value_type(x1), value_type(y1), value_type(z1), value_type(w1));
+ this->value[1] = col_type(value_type(x2), value_type(y2), value_type(z2), value_type(w2));
+ this->value[2] = col_type(value_type(x3), value_type(y3), value_type(z3), value_type(w3));
+ this->value[3] = col_type(value_type(x4), value_type(y4), value_type(z4), value_type(w4));
+ }
+
+ template <typename T>
+ template <typename V1, typename V2, typename V3, typename V4>
+ GLM_FUNC_DECL tmat4x4<T>::tmat4x4
+ (
+ tvec4<V1> const & v1,
+ tvec4<V2> const & v2,
+ tvec4<V3> const & v3,
+ tvec4<V4> const & v4
+ )
+ {
+ GLM_STATIC_ASSERT(detail::type<V1>::is_float || std::numeric_limits<V1>::is_integer, "*mat4x4 constructor only takes float and integer types, 1st parameter type invalid.");
+ GLM_STATIC_ASSERT(detail::type<V2>::is_float || std::numeric_limits<V2>::is_integer, "*mat4x4 constructor only takes float and integer types, 2nd parameter type invalid.");
+ GLM_STATIC_ASSERT(detail::type<V3>::is_float || std::numeric_limits<V3>::is_integer, "*mat4x4 constructor only takes float and integer types, 3rd parameter type invalid.");
+ GLM_STATIC_ASSERT(detail::type<V4>::is_float || std::numeric_limits<V4>::is_integer, "*mat4x4 constructor only takes float and integer types, 4th parameter type invalid.");
+
+ this->value[0] = col_type(v1);
+ this->value[1] = col_type(v2);
+ this->value[2] = col_type(v3);
+ this->value[3] = col_type(v4);
+ }
+
+ //////////////////////////////////////
+ // Matrix convertion constructors
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x4<T>::tmat4x4
+ (
+ tmat2x2<T> const & m
+ )
+ {
+ this->value[0] = col_type(m[0], detail::tvec2<T>(0));
+ this->value[1] = col_type(m[1], detail::tvec2<T>(0));
+ this->value[2] = col_type(value_type(0));
+ this->value[3] = col_type(value_type(0), value_type(0), value_type(0), value_type(1));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x4<T>::tmat4x4
+ (
+ tmat3x3<T> const & m
+ )
+ {
+ this->value[0] = col_type(m[0], value_type(0));
+ this->value[1] = col_type(m[1], value_type(0));
+ this->value[2] = col_type(m[2], value_type(0));
+ this->value[3] = col_type(value_type(0), value_type(0), value_type(0), value_type(1));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x4<T>::tmat4x4
+ (
+ tmat2x3<T> const & m
+ )
+ {
+ this->value[0] = col_type(m[0], value_type(0));
+ this->value[1] = col_type(m[1], value_type(0));
+ this->value[2] = col_type(value_type(0));
+ this->value[3] = col_type(value_type(0), value_type(0), value_type(0), value_type(1));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x4<T>::tmat4x4
+ (
+ tmat3x2<T> const & m
+ )
+ {
+ this->value[0] = col_type(m[0], detail::tvec2<T>(0));
+ this->value[1] = col_type(m[1], detail::tvec2<T>(0));
+ this->value[2] = col_type(m[2], detail::tvec2<T>(0));
+ this->value[3] = col_type(value_type(0), value_type(0), value_type(0), value_type(1));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x4<T>::tmat4x4
+ (
+ tmat2x4<T> const & m
+ )
+ {
+ this->value[0] = m[0];
+ this->value[1] = m[1];
+ this->value[2] = col_type(T(0));
+ this->value[3] = col_type(T(0), T(0), T(0), T(1));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x4<T>::tmat4x4
+ (
+ tmat4x2<T> const & m
+ )
+ {
+ this->value[0] = col_type(m[0], detail::tvec2<T>(0));
+ this->value[1] = col_type(m[1], detail::tvec2<T>(0));
+ this->value[2] = col_type(T(0));
+ this->value[3] = col_type(T(0), T(0), T(0), T(1));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x4<T>::tmat4x4
+ (
+ tmat3x4<T> const & m
+ )
+ {
+ this->value[0] = m[0];
+ this->value[1] = m[1];
+ this->value[2] = m[2];
+ this->value[3] = col_type(T(0), T(0), T(0), T(1));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x4<T>::tmat4x4
+ (
+ tmat4x3<T> const & m
+ )
+ {
+ this->value[0] = col_type(m[0], T(0));
+ this->value[1] = col_type(m[1], T(0));
+ this->value[2] = col_type(m[2], T(0));
+ this->value[3] = col_type(m[3], T(1));
+ }
+
+ //////////////////////////////////////////////////////////////
+ // Operators
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x4<T>& tmat4x4<T>::operator=
+ (
+ tmat4x4<T> const & m
+ )
+ {
+ //memcpy could be faster
+ //memcpy(&this->value, &m.value, 16 * sizeof(valType));
+ this->value[0] = m[0];
+ this->value[1] = m[1];
+ this->value[2] = m[2];
+ this->value[3] = m[3];
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat4x4<T>& tmat4x4<T>::operator=
+ (
+ tmat4x4<U> const & m
+ )
+ {
+ //memcpy could be faster
+ //memcpy(&this->value, &m.value, 16 * sizeof(valType));
+ this->value[0] = m[0];
+ this->value[1] = m[1];
+ this->value[2] = m[2];
+ this->value[3] = m[3];
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat4x4<T>& tmat4x4<T>::operator+=
+ (
+ U const & s
+ )
+ {
+ this->value[0] += s;
+ this->value[1] += s;
+ this->value[2] += s;
+ this->value[3] += s;
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat4x4<T>& tmat4x4<T>::operator+=
+ (
+ tmat4x4<U> const & m
+ )
+ {
+ this->value[0] += m[0];
+ this->value[1] += m[1];
+ this->value[2] += m[2];
+ this->value[3] += m[3];
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat4x4<T> & tmat4x4<T>::operator-=
+ (
+ U const & s
+ )
+ {
+ this->value[0] -= s;
+ this->value[1] -= s;
+ this->value[2] -= s;
+ this->value[3] -= s;
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat4x4<T> & tmat4x4<T>::operator-=
+ (
+ tmat4x4<U> const & m
+ )
+ {
+ this->value[0] -= m[0];
+ this->value[1] -= m[1];
+ this->value[2] -= m[2];
+ this->value[3] -= m[3];
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat4x4<T> & tmat4x4<T>::operator*=
+ (
+ U const & s
+ )
+ {
+ this->value[0] *= s;
+ this->value[1] *= s;
+ this->value[2] *= s;
+ this->value[3] *= s;
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat4x4<T> & tmat4x4<T>::operator*=
+ (
+ tmat4x4<U> const & m
+ )
+ {
+ return (*this = *this * m);
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat4x4<T> & tmat4x4<T>::operator/=
+ (
+ U const & s
+ )
+ {
+ this->value[0] /= s;
+ this->value[1] /= s;
+ this->value[2] /= s;
+ this->value[3] /= s;
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tmat4x4<T> & tmat4x4<T>::operator/=
+ (
+ tmat4x4<U> const & m
+ )
+ {
+ return (*this = *this / m);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x4<T> & tmat4x4<T>::operator++ ()
+ {
+ ++this->value[0];
+ ++this->value[1];
+ ++this->value[2];
+ ++this->value[3];
+ return *this;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x4<T> & tmat4x4<T>::operator-- ()
+ {
+ --this->value[0];
+ --this->value[1];
+ --this->value[2];
+ --this->value[3];
+ return *this;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x4<T> tmat4x4<T>::_inverse() const
+ {
+ // Calculate all mat2 determinants
+ value_type SubFactor00 = this->value[2][2] * this->value[3][3] - this->value[3][2] * this->value[2][3];
+ value_type SubFactor01 = this->value[2][1] * this->value[3][3] - this->value[3][1] * this->value[2][3];
+ value_type SubFactor02 = this->value[2][1] * this->value[3][2] - this->value[3][1] * this->value[2][2];
+ value_type SubFactor03 = this->value[2][0] * this->value[3][3] - this->value[3][0] * this->value[2][3];
+ value_type SubFactor04 = this->value[2][0] * this->value[3][2] - this->value[3][0] * this->value[2][2];
+ value_type SubFactor05 = this->value[2][0] * this->value[3][1] - this->value[3][0] * this->value[2][1];
+ value_type SubFactor06 = this->value[1][2] * this->value[3][3] - this->value[3][2] * this->value[1][3];
+ value_type SubFactor07 = this->value[1][1] * this->value[3][3] - this->value[3][1] * this->value[1][3];
+ value_type SubFactor08 = this->value[1][1] * this->value[3][2] - this->value[3][1] * this->value[1][2];
+ value_type SubFactor09 = this->value[1][0] * this->value[3][3] - this->value[3][0] * this->value[1][3];
+ value_type SubFactor10 = this->value[1][0] * this->value[3][2] - this->value[3][0] * this->value[1][2];
+ value_type SubFactor11 = this->value[1][1] * this->value[3][3] - this->value[3][1] * this->value[1][3];
+ value_type SubFactor12 = this->value[1][0] * this->value[3][1] - this->value[3][0] * this->value[1][1];
+ value_type SubFactor13 = this->value[1][2] * this->value[2][3] - this->value[2][2] * this->value[1][3];
+ value_type SubFactor14 = this->value[1][1] * this->value[2][3] - this->value[2][1] * this->value[1][3];
+ value_type SubFactor15 = this->value[1][1] * this->value[2][2] - this->value[2][1] * this->value[1][2];
+ value_type SubFactor16 = this->value[1][0] * this->value[2][3] - this->value[2][0] * this->value[1][3];
+ value_type SubFactor17 = this->value[1][0] * this->value[2][2] - this->value[2][0] * this->value[1][2];
+ value_type SubFactor18 = this->value[1][0] * this->value[2][1] - this->value[2][0] * this->value[1][1];
+/*
+ tmat4x4<T> Inverse(
+ + (this->value[1][1] * SubFactor00 - this->value[1][2] * SubFactor01 + this->value[1][3] * SubFactor02),
+ - (this->value[1][0] * SubFactor00 - this->value[1][2] * SubFactor03 + this->value[1][3] * SubFactor04),
+ + (this->value[1][0] * SubFactor01 - this->value[1][1] * SubFactor03 + this->value[1][3] * SubFactor05),
+ - (this->value[1][0] * SubFactor02 - this->value[1][1] * SubFactor04 + this->value[1][2] * SubFactor05),
+
+ - (this->value[0][1] * SubFactor00 - this->value[0][2] * SubFactor01 + this->value[0][3] * SubFactor02),
+ + (this->value[0][0] * SubFactor00 - this->value[0][2] * SubFactor03 + this->value[0][3] * SubFactor04),
+ - (this->value[0][0] * SubFactor01 - this->value[0][1] * SubFactor03 + this->value[0][3] * SubFactor05),
+ + (this->value[0][0] * SubFactor02 - this->value[0][1] * SubFactor04 + this->value[0][2] * SubFactor05),
+
+ + (this->value[0][1] * SubFactor06 - this->value[0][2] * SubFactor07 + this->value[0][3] * SubFactor08),
+ - (this->value[0][0] * SubFactor06 - this->value[0][2] * SubFactor09 + this->value[0][3] * SubFactor10),
+ + (this->value[0][0] * SubFactor11 - this->value[0][1] * SubFactor09 + this->value[0][3] * SubFactor12),
+ - (this->value[0][0] * SubFactor08 - this->value[0][1] * SubFactor10 + this->value[0][2] * SubFactor12),
+
+ - (this->value[0][1] * SubFactor13 - this->value[0][2] * SubFactor14 + this->value[0][3] * SubFactor15),
+ + (this->value[0][0] * SubFactor13 - this->value[0][2] * SubFactor16 + this->value[0][3] * SubFactor17),
+ - (this->value[0][0] * SubFactor14 - this->value[0][1] * SubFactor16 + this->value[0][3] * SubFactor18),
+ + (this->value[0][0] * SubFactor15 - this->value[0][1] * SubFactor17 + this->value[0][2] * SubFactor18));
+*/
+ tmat4x4<T> Inverse(
+ + this->value[1][1] * SubFactor00 - this->value[1][2] * SubFactor01 + this->value[1][3] * SubFactor02,
+ - this->value[1][0] * SubFactor00 + this->value[1][2] * SubFactor03 - this->value[1][3] * SubFactor04,
+ + this->value[1][0] * SubFactor01 - this->value[1][1] * SubFactor03 + this->value[1][3] * SubFactor05,
+ - this->value[1][0] * SubFactor02 + this->value[1][1] * SubFactor04 - this->value[1][2] * SubFactor05,
+
+ - this->value[0][1] * SubFactor00 + this->value[0][2] * SubFactor01 - this->value[0][3] * SubFactor02,
+ + this->value[0][0] * SubFactor00 - this->value[0][2] * SubFactor03 + this->value[0][3] * SubFactor04,
+ - this->value[0][0] * SubFactor01 + this->value[0][1] * SubFactor03 - this->value[0][3] * SubFactor05,
+ + this->value[0][0] * SubFactor02 - this->value[0][1] * SubFactor04 + this->value[0][2] * SubFactor05,
+
+ + this->value[0][1] * SubFactor06 - this->value[0][2] * SubFactor07 + this->value[0][3] * SubFactor08,
+ - this->value[0][0] * SubFactor06 + this->value[0][2] * SubFactor09 - this->value[0][3] * SubFactor10,
+ + this->value[0][0] * SubFactor11 - this->value[0][1] * SubFactor09 + this->value[0][3] * SubFactor12,
+ - this->value[0][0] * SubFactor08 + this->value[0][1] * SubFactor10 - this->value[0][2] * SubFactor12,
+
+ - this->value[0][1] * SubFactor13 + this->value[0][2] * SubFactor14 - this->value[0][3] * SubFactor15,
+ + this->value[0][0] * SubFactor13 - this->value[0][2] * SubFactor16 + this->value[0][3] * SubFactor17,
+ - this->value[0][0] * SubFactor14 + this->value[0][1] * SubFactor16 - this->value[0][3] * SubFactor18,
+ + this->value[0][0] * SubFactor15 - this->value[0][1] * SubFactor17 + this->value[0][2] * SubFactor18);
+
+ value_type Determinant =
+ + this->value[0][0] * Inverse[0][0]
+ + this->value[0][1] * Inverse[1][0]
+ + this->value[0][2] * Inverse[2][0]
+ + this->value[0][3] * Inverse[3][0];
+
+ Inverse /= Determinant;
+ return Inverse;
+ }
+
+ // Binary operators
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x4<T> operator+
+ (
+ tmat4x4<T> const & m,
+ typename tmat4x4<T>::value_type const & s
+ )
+ {
+ return tmat4x4<T>(
+ m[0] + s,
+ m[1] + s,
+ m[2] + s,
+ m[3] + s);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x4<T> operator+
+ (
+ typename tmat4x4<T>::value_type const & s,
+ tmat4x4<T> const & m
+ )
+ {
+ return tmat4x4<T>(
+ m[0] + s,
+ m[1] + s,
+ m[2] + s,
+ m[3] + s);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x4<T> operator+
+ (
+ tmat4x4<T> const & m1,
+ tmat4x4<T> const & m2
+ )
+ {
+ return tmat4x4<T>(
+ m1[0] + m2[0],
+ m1[1] + m2[1],
+ m1[2] + m2[2],
+ m1[3] + m2[3]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x4<T> operator-
+ (
+ tmat4x4<T> const & m,
+ typename tmat4x4<T>::value_type const & s
+ )
+ {
+ return tmat4x4<T>(
+ m[0] - s,
+ m[1] - s,
+ m[2] - s,
+ m[3] - s);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x4<T> operator-
+ (
+ typename tmat4x4<T>::value_type const & s,
+ tmat4x4<T> const & m
+ )
+ {
+ return tmat4x4<T>(
+ s - m[0],
+ s - m[1],
+ s - m[2],
+ s - m[3]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x4<T> operator-
+ (
+ tmat4x4<T> const & m1,
+ tmat4x4<T> const & m2
+ )
+ {
+ return tmat4x4<T>(
+ m1[0] - m2[0],
+ m1[1] - m2[1],
+ m1[2] - m2[2],
+ m1[3] - m2[3]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x4<T> operator*
+ (
+ tmat4x4<T> const & m,
+ typename tmat4x4<T>::value_type const & s
+ )
+ {
+ return tmat4x4<T>(
+ m[0] * s,
+ m[1] * s,
+ m[2] * s,
+ m[3] * s);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x4<T> operator*
+ (
+ typename tmat4x4<T>::value_type const & s,
+ tmat4x4<T> const & m
+ )
+ {
+ return tmat4x4<T>(
+ m[0] * s,
+ m[1] * s,
+ m[2] * s,
+ m[3] * s);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tmat4x4<T>::col_type operator*
+ (
+ tmat4x4<T> const & m,
+ typename tmat4x4<T>::row_type const & v
+ )
+ {
+ return typename tmat4x4<T>::col_type(
+ m[0][0] * v.x + m[1][0] * v.y + m[2][0] * v.z + m[3][0] * v.w,
+ m[0][1] * v.x + m[1][1] * v.y + m[2][1] * v.z + m[3][1] * v.w,
+ m[0][2] * v.x + m[1][2] * v.y + m[2][2] * v.z + m[3][2] * v.w,
+ m[0][3] * v.x + m[1][3] * v.y + m[2][3] * v.z + m[3][3] * v.w);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tmat4x4<T>::row_type operator*
+ (
+ typename tmat4x4<T>::col_type const & v,
+ tmat4x4<T> const & m
+ )
+ {
+ return typename tmat4x4<T>::row_type(
+ m[0][0] * v.x + m[0][1] * v.y + m[0][2] * v.z + m[0][3] * v.w,
+ m[1][0] * v.x + m[1][1] * v.y + m[1][2] * v.z + m[1][3] * v.w,
+ m[2][0] * v.x + m[2][1] * v.y + m[2][2] * v.z + m[2][3] * v.w,
+ m[3][0] * v.x + m[3][1] * v.y + m[3][2] * v.z + m[3][3] * v.w);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x4<T> operator*
+ (
+ tmat4x4<T> const & m1,
+ tmat4x4<T> const & m2
+ )
+ {
+ typename tmat4x4<T>::col_type const SrcA0 = m1[0];
+ typename tmat4x4<T>::col_type const SrcA1 = m1[1];
+ typename tmat4x4<T>::col_type const SrcA2 = m1[2];
+ typename tmat4x4<T>::col_type const SrcA3 = m1[3];
+
+ typename tmat4x4<T>::col_type const SrcB0 = m2[0];
+ typename tmat4x4<T>::col_type const SrcB1 = m2[1];
+ typename tmat4x4<T>::col_type const SrcB2 = m2[2];
+ typename tmat4x4<T>::col_type const SrcB3 = m2[3];
+
+ tmat4x4<T> Result(tmat4x4<T>::null);
+ Result[0] = SrcA0 * SrcB0[0] + SrcA1 * SrcB0[1] + SrcA2 * SrcB0[2] + SrcA3 * SrcB0[3];
+ Result[1] = SrcA0 * SrcB1[0] + SrcA1 * SrcB1[1] + SrcA2 * SrcB1[2] + SrcA3 * SrcB1[3];
+ Result[2] = SrcA0 * SrcB2[0] + SrcA1 * SrcB2[1] + SrcA2 * SrcB2[2] + SrcA3 * SrcB2[3];
+ Result[3] = SrcA0 * SrcB3[0] + SrcA1 * SrcB3[1] + SrcA2 * SrcB3[2] + SrcA3 * SrcB3[3];
+ return Result;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x4<T> operator/
+ (
+ tmat4x4<T> const & m,
+ typename tmat4x4<T>::value_type const & s
+ )
+ {
+ return tmat4x4<T>(
+ m[0] / s,
+ m[1] / s,
+ m[2] / s,
+ m[3] / s);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x4<T> operator/
+ (
+ typename tmat4x4<T>::value_type const & s,
+ tmat4x4<T> const & m
+ )
+ {
+ return tmat4x4<T>(
+ s / m[0],
+ s / m[1],
+ s / m[2],
+ s / m[3]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tmat4x4<T>::col_type operator/
+ (
+ tmat4x4<T> const & m,
+ typename tmat4x4<T>::row_type const & v
+ )
+ {
+ return m._inverse() * v;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tmat4x4<T>::row_type operator/
+ (
+ typename tmat4x4<T>::col_type const & v,
+ tmat4x4<T> const & m
+ )
+ {
+ return v * m._inverse();
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x4<T> operator/
+ (
+ tmat4x4<T> const & m1,
+ tmat4x4<T> const & m2
+ )
+ {
+ return m1 * m2._inverse();
+ }
+
+ // Unary constant operators
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x4<T> const operator-
+ (
+ tmat4x4<T> const & m
+ )
+ {
+ return tmat4x4<T>(
+ -m[0],
+ -m[1],
+ -m[2],
+ -m[3]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x4<T> const operator++
+ (
+ tmat4x4<T> const & m,
+ int
+ )
+ {
+ return tmat4x4<T>(
+ m[0] + typename tmat4x4<T>::value_type(1),
+ m[1] + typename tmat4x4<T>::value_type(1),
+ m[2] + typename tmat4x4<T>::value_type(1),
+ m[3] + typename tmat4x4<T>::value_type(1));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tmat4x4<T> const operator--
+ (
+ tmat4x4<T> const & m,
+ int
+ )
+ {
+ return tmat4x4<T>(
+ m[0] - typename tmat4x4<T>::value_type(1),
+ m[1] - typename tmat4x4<T>::value_type(1),
+ m[2] - typename tmat4x4<T>::value_type(1),
+ m[3] - typename tmat4x4<T>::value_type(1));
+ }
+
+ //////////////////////////////////////
+ // Boolean operators
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER bool operator==
+ (
+ tmat4x4<T> const & m1,
+ tmat4x4<T> const & m2
+ )
+ {
+ return (m1[0] == m2[0]) && (m1[1] == m2[1]) && (m1[2] == m2[2]) && (m1[3] == m2[3]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER bool operator!=
+ (
+ tmat4x4<T> const & m1,
+ tmat4x4<T> const & m2
+ )
+ {
+ return (m1[0] != m2[0]) || (m1[1] != m2[1]) || (m1[2] != m2[2]) || (m1[3] != m2[3]);
+ }
+
+} //namespace detail
+} //namespace glm
diff --git a/src/glm/core/type_size.hpp b/src/glm/core/type_size.hpp
new file mode 100644
index 0000000..a0b0815
--- /dev/null
+++ b/src/glm/core/type_size.hpp
@@ -0,0 +1,24 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2008-10-05
+// Updated : 2008-10-05
+// Licence : This source is under MIT License
+// File : glm/core/type_size.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_core_type_size
+#define glm_core_type_size
+
+#include <cstdlib>
+
+namespace glm{
+namespace detail
+{
+ //typedef std::size_t size_t;
+ typedef int sizeType;
+
+}//namespace detail
+}//namespace glm
+
+#endif//glm_core_type_size
diff --git a/src/glm/core/type_vec.hpp b/src/glm/core/type_vec.hpp
new file mode 100644
index 0000000..06569b0
--- /dev/null
+++ b/src/glm/core/type_vec.hpp
@@ -0,0 +1,22 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2010-01-26
+// Updated : 2010-02-04
+// Licence : This source is under MIT License
+// File : glm/core/type_vec.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_core_type_vec
+#define glm_core_type_vec
+
+#include "type_gentype.hpp"
+
+namespace glm{
+namespace detail
+{
+
+}//namespace detail
+}//namespace glm
+
+#endif//glm_core_type_vec
diff --git a/src/glm/core/type_vec.inl b/src/glm/core/type_vec.inl
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/glm/core/type_vec.inl
diff --git a/src/glm/core/type_vec1.hpp b/src/glm/core/type_vec1.hpp
new file mode 100644
index 0000000..3059196
--- /dev/null
+++ b/src/glm/core/type_vec1.hpp
@@ -0,0 +1,172 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2008-08-25
+// Updated : 2010-02-04
+// Licence : This source is under MIT License
+// File : glm/core/type_vec1.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_core_type_gentype1
+#define glm_core_type_gentype1
+
+#include "type_vec.hpp"
+#include "type_float.hpp"
+#include "type_int.hpp"
+#include "type_size.hpp"
+#include "_swizzle.hpp"
+
+namespace glm{
+namespace detail
+{
+ template <typename T> struct tref1;
+ template <typename T> struct tref2;
+ template <typename T> struct tref3;
+ template <typename T> struct tref4;
+ template <typename T> struct tvec1;
+ template <typename T> struct tvec2;
+ template <typename T> struct tvec3;
+ template <typename T> struct tvec4;
+
+ template <typename T>
+ struct tvec1
+ {
+ enum ctor{null};
+
+ typedef T value_type;
+ typedef std::size_t size_type;
+ GLM_FUNC_DECL size_type length() const;
+ static GLM_FUNC_DECL size_type value_size();
+
+ typedef tvec1<T> type;
+ typedef tvec1<bool> bool_type;
+
+ //////////////////////////////////////
+ // Data
+
+# if(GLM_COMPONENT == GLM_COMPONENT_ONLY_XYZW)
+ value_type x;
+# else//(GLM_COMPONENT == GLM_COMPONENT_GLSL_NAMES)
+ union {value_type x, r, s;};
+# endif//GLM_COMPONENT
+
+ //////////////////////////////////////
+ // Accesses
+
+ GLM_FUNC_DECL value_type & operator[](size_type i);
+ GLM_FUNC_DECL value_type const & operator[](size_type i) const;
+
+ //////////////////////////////////////
+ // Implicit basic constructors
+
+ GLM_FUNC_DECL tvec1();
+ GLM_FUNC_DECL tvec1(tvec1<T> const & v);
+
+ //////////////////////////////////////
+ // Explicit basic constructors
+
+ GLM_FUNC_DECL explicit tvec1(
+ ctor);
+ GLM_FUNC_DECL explicit tvec1(
+ value_type const & s);
+
+ //////////////////////////////////////
+ // Swizzle constructors
+
+ GLM_FUNC_DECL tvec1(tref1<T> const & r);
+
+ //////////////////////////////////////
+ // Convertion scalar constructors
+
+ //! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
+ template <typename U>
+ GLM_FUNC_DECL explicit tvec1(U const & s);
+
+ //////////////////////////////////////
+ // Convertion vector constructors
+
+ //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
+ template <typename U>
+ GLM_FUNC_DECL explicit tvec1(tvec2<U> const & v);
+ //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
+ template <typename U>
+ GLM_FUNC_DECL explicit tvec1(tvec3<U> const & v);
+ //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
+ template <typename U>
+ GLM_FUNC_DECL explicit tvec1(tvec4<U> const & v);
+
+ //////////////////////////////////////
+ // Unary arithmetic operators
+
+ GLM_FUNC_DECL tvec1<T> & operator= (tvec1<T> const & v);
+
+ GLM_FUNC_DECL tvec1<T> & operator+=(value_type const & s);
+ GLM_FUNC_DECL tvec1<T> & operator+=(tvec1<T> const & v);
+ GLM_FUNC_DECL tvec1<T> & operator-=(value_type const & s);
+ GLM_FUNC_DECL tvec1<T> & operator-=(tvec1<T> const & v);
+ GLM_FUNC_DECL tvec1<T> & operator*=(value_type const & s);
+ GLM_FUNC_DECL tvec1<T> & operator*=(tvec1<T> const & v);
+ GLM_FUNC_DECL tvec1<T> & operator/=(value_type const & s);
+ GLM_FUNC_DECL tvec1<T> & operator/=(tvec1<T> const & v);
+ GLM_FUNC_DECL tvec1<T> & operator++();
+ GLM_FUNC_DECL tvec1<T> & operator--();
+
+ //////////////////////////////////////
+ // Unary bit operators
+
+ GLM_FUNC_DECL tvec1<T> & operator%=(value_type const & s);
+ GLM_FUNC_DECL tvec1<T> & operator%=(tvec1<T> const & v);
+ GLM_FUNC_DECL tvec1<T> & operator&=(value_type const & s);
+ GLM_FUNC_DECL tvec1<T> & operator&=(tvec1<T> const & v);
+ GLM_FUNC_DECL tvec1<T> & operator|=(value_type const & s);
+ GLM_FUNC_DECL tvec1<T> & operator|=(tvec1<T> const & v);
+ GLM_FUNC_DECL tvec1<T> & operator^=(value_type const & s);
+ GLM_FUNC_DECL tvec1<T> & operator^=(tvec1<T> const & v);
+ GLM_FUNC_DECL tvec1<T> & operator<<=(value_type const & s);
+ GLM_FUNC_DECL tvec1<T> & operator<<=(tvec1<T> const & v);
+ GLM_FUNC_DECL tvec1<T> & operator>>=(value_type const & s);
+ GLM_FUNC_DECL tvec1<T> & operator>>=(tvec1<T> const & v);
+
+ //////////////////////////////////////
+ // Swizzle operators
+
+ GLM_FUNC_DECL value_type swizzle(comp X) const;
+ GLM_FUNC_DECL tvec2<T> swizzle(comp X, comp Y) const;
+ GLM_FUNC_DECL tvec3<T> swizzle(comp X, comp Y, comp Z) const;
+ GLM_FUNC_DECL tvec4<T> swizzle(comp X, comp Y, comp Z, comp W) const;
+ GLM_FUNC_DECL tref1<T> swizzle(comp X);
+ };
+
+ template <typename T>
+ struct tref1
+ {
+ GLM_FUNC_DECL tref1(T & x);
+ GLM_FUNC_DECL tref1(tref1<T> const & r);
+ GLM_FUNC_DECL tref1(tvec1<T> const & v);
+
+ GLM_FUNC_DECL tref1<T> & operator= (tref1<T> const & r);
+ GLM_FUNC_DECL tref1<T> & operator= (tvec1<T> const & v);
+
+ T& x;
+ };
+
+ GLM_DETAIL_IS_VECTOR(tvec1);
+
+ typedef detail::tvec1<core::type::precision::highp_float> highp_vec1_t;
+ typedef detail::tvec1<core::type::precision::mediump_float> mediump_vec1_t;
+ typedef detail::tvec1<core::type::precision::lowp_float> lowp_vec1_t;
+ typedef detail::tvec1<core::type::precision::highp_int> highp_ivec1_t;
+ typedef detail::tvec1<core::type::precision::mediump_int> mediump_ivec1_t;
+ typedef detail::tvec1<core::type::precision::lowp_int> lowp_ivec1_t;
+ typedef detail::tvec1<core::type::precision::highp_uint> highp_uvec1_t;
+ typedef detail::tvec1<core::type::precision::mediump_uint> mediump_uvec1_t;
+ typedef detail::tvec1<core::type::precision::lowp_uint> lowp_uvec1_t;
+
+}//namespace detail
+}//namespace glm
+
+#ifndef GLM_EXTERNAL_TEMPLATE
+#include "type_vec1.inl"
+#endif//GLM_EXTERNAL_TEMPLATE
+
+#endif//glm_core_type_gentype1
diff --git a/src/glm/core/type_vec1.inl b/src/glm/core/type_vec1.inl
new file mode 100644
index 0000000..25d4f87
--- /dev/null
+++ b/src/glm/core/type_vec1.inl
@@ -0,0 +1,884 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2008-08-25
+// Updated : 2010-02-04
+// Licence : This source is under MIT License
+// File : glm/core/type_vec1.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm{
+namespace detail
+{
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tvec1<T>::size_type tvec1<T>::length() const
+ {
+ return 1;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tvec1<T>::size_type tvec1<T>::value_size()
+ {
+ return 1;
+ }
+
+ //////////////////////////////////////
+ // Accesses
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tvec1<T>::value_type & tvec1<T>::operator[]
+ (
+ size_type i
+ )
+ {
+ assert(i < value_size());
+ return (&x)[i];
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tvec1<T>::value_type const & tvec1<T>::operator[]
+ (
+ size_type i
+ ) const
+ {
+ assert(i < value_size());
+ return (&x)[i];
+ }
+
+ //////////////////////////////////////
+ // Implicit basic constructors
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec1<T>::tvec1() :
+ x(value_type(0))
+ {}
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec1<T>::tvec1
+ (
+ ctor
+ )
+ {}
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec1<T>::tvec1
+ (
+ tvec1<T> const & v
+ ) :
+ x(v.x)
+ {}
+
+ //////////////////////////////////////
+ // Explicit basic constructors
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec1<T>::tvec1
+ (
+ value_type const & s
+ ) :
+ x(s)
+ {}
+
+ //////////////////////////////////////
+ // Swizzle constructors
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec1<T>::tvec1
+ (
+ tref1<T> const & r
+ ) :
+ x(r.x)
+ {}
+
+ //////////////////////////////////////
+ // Convertion scalar constructors
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec1<T>::tvec1
+ (
+ U const & s
+ ) :
+ x(value_type(s))
+ {}
+
+ //////////////////////////////////////
+ // Convertion vector constructors
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec1<T>::tvec1
+ (
+ tvec2<U> const & v
+ ) :
+ x(value_type(v.x))
+ {}
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec1<T>::tvec1
+ (
+ tvec3<U> const & v
+ ) :
+ x(value_type(v.x))
+ {}
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec1<T>::tvec1
+ (
+ tvec4<U> const & v
+ ) :
+ x(value_type(v.x))
+ {}
+
+ //////////////////////////////////////
+ // Unary arithmetic operators
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec1<T> & tvec1<T>::operator=
+ (
+ tvec1<T> const & v
+ )
+ {
+ this->x = v.x;
+ return *this;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec1<T> & tvec1<T>::operator+=
+ (
+ value_type const & s
+ )
+ {
+ this->x += s;
+ return *this;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec1<T> & tvec1<T>::operator+=
+ (
+ tvec1<T> const & v
+ )
+ {
+ this->x += v.x;
+ return *this;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec1<T> & tvec1<T>::operator-=
+ (
+ value_type const & s
+ )
+ {
+ this->x -= s;
+ return *this;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec1<T> & tvec1<T>::operator-=
+ (
+ tvec1<T> const & v
+ )
+ {
+ this->x -= v.x;
+ return *this;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec1<T> & tvec1<T>::operator*=
+ (
+ value_type const & s
+ )
+ {
+ this->x *= s;
+ return *this;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec1<T> & tvec1<T>::operator*=
+ (
+ tvec1<T> const & v
+ )
+ {
+ this->x *= v.x;
+ return *this;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec1<T> & tvec1<T>::operator/=
+ (
+ value_type const & s
+ )
+ {
+ this->x /= s;
+ return *this;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec1<T> & tvec1<T>::operator/=
+ (
+ tvec1<T> const & v
+ )
+ {
+ this->x /= v.x;
+ return *this;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec1<T> & tvec1<T>::operator++()
+ {
+ ++this->x;
+ return *this;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec1<T> & tvec1<T>::operator--()
+ {
+ --this->x;
+ return *this;
+ }
+
+ //////////////////////////////////////
+ // Boolean operators
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER bool operator==
+ (
+ tvec1<T> const & v1,
+ tvec1<T> const & v2
+ )
+ {
+ return (v1.x == v2.x);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER bool operator!=
+ (
+ tvec1<T> const & v1,
+ tvec1<T> const & v2
+ )
+ {
+ return (v1.x != v2.x);
+ }
+
+ //////////////////////////////////////
+ // Unary bit operators
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec1<T> & tvec1<T>::operator%=
+ (
+ value_type const & s
+ )
+ {
+ this->x %= s;
+ return *this;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec1<T> & tvec1<T>::operator%=
+ (
+ tvec1<T> const & v
+ )
+ {
+ this->x %= v.x;
+ return *this;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec1<T> & tvec1<T>::operator&=
+ (
+ value_type const & s
+ )
+ {
+ this->x &= s;
+ return *this;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec1<T> & tvec1<T>::operator&=
+ (
+ tvec1<T> const & v
+ )
+ {
+ this->x &= v.x;
+ return *this;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec1<T> & tvec1<T>::operator|=
+ (
+ value_type const & s
+ )
+ {
+ this->x |= s;
+ return *this;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec1<T> & tvec1<T>::operator|=
+ (
+ tvec1<T> const & v
+ )
+ {
+ this->x |= v.x;
+ return *this;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec1<T> & tvec1<T>::operator^=
+ (
+ value_type const & s
+ )
+ {
+ this->x ^= s;
+ return *this;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec1<T> & tvec1<T>::operator^=
+ (
+ tvec1<T> const & v
+ )
+ {
+ this->x ^= v.x;
+ return *this;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec1<T> & tvec1<T>::operator<<=
+ (
+ value_type const & s
+ )
+ {
+ this->x <<= s;
+ return *this;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec1<T> & tvec1<T>::operator<<=
+ (
+ tvec1<T> const & v
+ )
+ {
+ this->x <<= v.x;
+ return *this;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec1<T> & tvec1<T>::operator>>=
+ (
+ value_type const & s
+ )
+ {
+ this->x >>= s;
+ return *this;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec1<T> & tvec1<T>::operator>>=
+ (
+ tvec1<T> const & v
+ )
+ {
+ this->x >>= v.x;
+ return *this;
+ }
+
+ //////////////////////////////////////
+ // Swizzle operators
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER T
+ tvec1<T>::swizzle(comp x) const
+ {
+ return (*this)[x];
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec2<T>
+ tvec1<T>::swizzle
+ (
+ comp x,
+ comp y
+ ) const
+ {
+ return tvec2<T>(
+ (*this)[x],
+ (*this)[y]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec3<T>
+ tvec1<T>::swizzle
+ (
+ comp x,
+ comp y,
+ comp z
+ ) const
+ {
+ return tvec3<T>(
+ (*this)[x],
+ (*this)[y],
+ (*this)[z]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec4<T>
+ tvec1<T>::swizzle
+ (
+ comp x,
+ comp y,
+ comp z,
+ comp w
+ ) const
+ {
+ return tvec4<T>(
+ (*this)[x],
+ (*this)[y],
+ (*this)[z],
+ (*this)[w]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tref1<T>
+ tvec1<T>::swizzle
+ (
+ comp x
+ )
+ {
+ return tref1<T>(
+ (*this)[x]);
+ }
+
+ //////////////////////////////////////
+ // Binary arithmetic operators
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec1<T> operator+
+ (
+ tvec1<T> const & v,
+ typename tvec1<T>::value_type const & s
+ )
+ {
+ return tvec1<T>(
+ v.x + s);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec1<T> operator+
+ (
+ typename tvec1<T>::value_type const & s,
+ tvec1<T> const & v
+ )
+ {
+ return tvec1<T>(
+ s + v.x);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec1<T> operator+
+ (
+ tvec1<T> const & v1,
+ tvec1<T> const & v2
+ )
+ {
+ return tvec1<T>(
+ v1.x + v2.x);
+ }
+
+ //operator-
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec1<T> operator-
+ (
+ tvec1<T> const & v,
+ typename tvec1<T>::value_type const & s
+ )
+ {
+ return tvec1<T>(
+ v.x - s);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec1<T> operator-
+ (
+ typename tvec1<T>::value_type const & s,
+ tvec1<T> const & v
+ )
+ {
+ return tvec1<T>(
+ s - v.x);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec1<T> operator-
+ (
+ tvec1<T> const & v1,
+ tvec1<T> const & v2
+ )
+ {
+ return tvec1<T>(
+ v1.x - v2.x);
+ }
+
+ //operator*
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec1<T> operator*
+ (
+ tvec1<T> const & v,
+ typename tvec1<T>::value_type const & s
+ )
+ {
+ return tvec1<T>(
+ v.x * s);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec1<T> operator*
+ (
+ typename tvec1<T>::value_type const & s,
+ tvec1<T> const & v
+ )
+ {
+ return tvec1<T>(
+ s * v.x);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec1<T> operator*
+ (
+ tvec1<T> const & v1,
+ tvec1<T> const & v2
+ )
+ {
+ return tvec1<T>(
+ v1.x * v2.x);
+ }
+
+ //operator/
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec1<T> operator/
+ (
+ tvec1<T> const & v,
+ typename tvec1<T>::value_type const & s
+ )
+ {
+ return tvec1<T>(
+ v.x / s);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec1<T> operator/
+ (
+ typename tvec1<T>::value_type const & s,
+ tvec1<T> const & v
+ )
+ {
+ return tvec1<T>(
+ s / v.x);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec1<T> operator/
+ (
+ tvec1<T> const & v1,
+ tvec1<T> const & v2
+ )
+ {
+ return tvec1<T>(
+ v1.x / v2.x);
+ }
+
+ // Unary constant operators
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec1<T> operator-
+ (
+ tvec1<T> const & v
+ )
+ {
+ return tvec1<T>(
+ -v.x);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec1<T> operator++
+ (
+ tvec1<T> const & v,
+ int
+ )
+ {
+ return tvec1<T>(
+ v.x + T(1));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec1<T> operator--
+ (
+ tvec1<T> const & v,
+ int
+ )
+ {
+ return tvec1<T>(
+ v.x - T(1));
+ }
+
+ //////////////////////////////////////
+ // Binary bit operators
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec1<T> operator%
+ (
+ tvec1<T> const & v,
+ typename tvec1<T>::value_type const & s
+ )
+ {
+ return tvec1<T>(
+ v.x % s);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec1<T> operator%
+ (
+ typename tvec1<T>::value_type const & s,
+ tvec1<T> const & v
+ )
+ {
+ return tvec1<T>(
+ s % v.x);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec1<T> operator%
+ (
+ tvec1<T> const & v1,
+ tvec1<T> const & v2
+ )
+ {
+ return tvec1<T>(
+ v1.x % v2.x);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec1<T> operator&
+ (
+ tvec1<T> const & v,
+ typename tvec1<T>::value_type const & s
+ )
+ {
+ return tvec1<T>(
+ v.x & s);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec1<T> operator&
+ (
+ typename tvec1<T>::value_type const & s,
+ tvec1<T> const & v
+ )
+ {
+ return tvec1<T>(
+ s & v.x);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec1<T> operator&
+ (
+ tvec1<T> const & v1,
+ tvec1<T> const & v2
+ )
+ {
+ return tvec1<T>(
+ v1.x & v2.x);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec1<T> operator|
+ (
+ tvec1<T> const & v,
+ typename tvec1<T>::value_type const & s
+ )
+ {
+ return tvec1<T>(
+ v.x | s);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec1<T> operator|
+ (
+ typename tvec1<T>::value_type const & s,
+ tvec1<T> const & v
+ )
+ {
+ return tvec1<T>(
+ s | v.x);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec1<T> operator|
+ (
+ tvec1<T> const & v1,
+ tvec1<T> const & v2
+ )
+ {
+ return tvec1<T>(
+ v1.x | v2.x);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec1<T> operator^
+ (
+ tvec1<T> const & v,
+ typename tvec1<T>::value_type const & s
+ )
+ {
+ return tvec1<T>(
+ v.x ^ s);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec1<T> operator^
+ (
+ typename tvec1<T>::value_type const & s,
+ tvec1<T> const & v
+ )
+ {
+ return tvec1<T>(
+ s ^ v.x);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec1<T> operator^
+ (
+ tvec1<T> const & v1,
+ tvec1<T> const & v2
+ )
+ {
+ return tvec1<T>(
+ v1.x ^ v2.x);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec1<T> operator<<
+ (
+ tvec1<T> const & v,
+ typename tvec1<T>::value_type const & s
+ )
+ {
+ return tvec1<T>(
+ v.x << s);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec1<T> operator<<
+ (
+ typename tvec1<T>::value_type const & s,
+ tvec1<T> const & v
+ )
+ {
+ return tvec1<T>(
+ s << v.x);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec1<T> operator<<
+ (
+ tvec1<T> const & v1,
+ tvec1<T> const & v2
+ )
+ {
+ return tvec1<T>(
+ v1.x << v2.x);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec1<T> operator>>
+ (
+ tvec1<T> const & v,
+ typename tvec1<T>::value_type const & s
+ )
+ {
+ return tvec1<T>(
+ v.x >> s);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec1<T> operator>>
+ (
+ typename tvec1<T>::value_type const & s,
+ tvec1<T> const & v
+ )
+ {
+ return tvec1<T>(
+ s >> v.x);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec1<T> operator>>
+ (
+ tvec1<T> const & v1,
+ tvec1<T> const & v2
+ )
+ {
+ return tvec1<T>(
+ v1.x >> v2.x);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec1<T> operator~
+ (
+ tvec1<T> const & v
+ )
+ {
+ return tvec1<T>(
+ ~v.x);
+ }
+
+ //////////////////////////////////////
+ // tref definition
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tref1<T>::tref1
+ (
+ T & x
+ ) :
+ x(x)
+ {}
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tref1<T>::tref1
+ (
+ tref1<T> const & r
+ ) :
+ x(r.x)
+ {}
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tref1<T>::tref1
+ (
+ tvec1<T> const & v
+ ) :
+ x(v.x)
+ {}
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tref1<T> & tref1<T>::operator=
+ (
+ tref1<T> const & r
+ )
+ {
+ x = r.x;
+ return *this;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tref1<T> & tref1<T>::operator=
+ (
+ tvec1<T> const & v
+ )
+ {
+ x = v.x;
+ return *this;
+ }
+
+}//namespace detail
+}//namespace glm
diff --git a/src/glm/core/type_vec2.hpp b/src/glm/core/type_vec2.hpp
new file mode 100644
index 0000000..703e2f2
--- /dev/null
+++ b/src/glm/core/type_vec2.hpp
@@ -0,0 +1,263 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2008-08-18
+// Updated : 2010-02-04
+// Licence : This source is under MIT License
+// File : glm/core/type_tvec2.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_core_type_gentype2
+#define glm_core_type_gentype2
+
+#include "type_vec.hpp"
+#include "type_float.hpp"
+#include "type_int.hpp"
+#include "type_size.hpp"
+#include "_swizzle.hpp"
+
+namespace glm{
+namespace detail
+{
+ template <typename T> struct tref2;
+ template <typename T> struct tref3;
+ template <typename T> struct tref4;
+ template <typename T> struct tvec3;
+ template <typename T> struct tvec4;
+
+ //! The basic 2D vector type.
+ //! \ingroup core_template
+ template <typename T>
+ struct tvec2
+ {
+ enum ctor{null};
+
+ typedef T value_type;
+ typedef std::size_t size_type;
+ GLM_FUNC_DECL size_type length() const;
+ static GLM_FUNC_DECL size_type value_size();
+
+ typedef tvec2<T> type;
+ typedef tvec2<bool> bool_type;
+
+ //////////////////////////////////////
+ // Data
+
+# if(GLM_COMPONENT == GLM_COMPONENT_ONLY_XYZW)
+ value_type x, y;
+# elif(GLM_COMPONENT == GLM_COMPONENT_MS_EXT)
+ union
+ {
+ struct{value_type x, y;};
+ struct{value_type r, g;};
+ struct{value_type s, t;};
+ };
+# else//(GLM_COMPONENT == GLM_COMPONENT_GLSL_NAMES)
+ union {value_type x, r, s;};
+ union {value_type y, g, t;};
+# endif//GLM_COMPONENT
+
+ //////////////////////////////////////
+ // Accesses
+
+ GLM_FUNC_DECL value_type & operator[](size_type i);
+ GLM_FUNC_DECL value_type const & operator[](size_type i) const;
+
+ //////////////////////////////////////
+ // Implicit basic constructors
+
+ GLM_FUNC_DECL tvec2();
+ GLM_FUNC_DECL tvec2(tvec2<T> const & v);
+
+ //////////////////////////////////////
+ // Explicit basic constructors
+
+ GLM_FUNC_DECL explicit tvec2(
+ ctor);
+ GLM_FUNC_DECL explicit tvec2(
+ value_type const & s);
+ GLM_FUNC_DECL explicit tvec2(
+ value_type const & s1,
+ value_type const & s2);
+
+ //////////////////////////////////////
+ // Swizzle constructors
+
+ tvec2(tref2<T> const & r);
+
+ //////////////////////////////////////
+ // Convertion constructors
+
+ //! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
+// template <typename U>
+// GLM_FUNC_DECL explicit tvec2(
+// U const & x);
+ //! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
+ template <typename U, typename V>
+ GLM_FUNC_DECL explicit tvec2(
+ U const & x,
+ V const & y);
+
+ //////////////////////////////////////
+ // Convertion vector constructors
+
+ //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
+ template <typename U>
+ GLM_FUNC_DECL explicit tvec2(tvec2<U> const & v);
+ //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
+ template <typename U>
+ GLM_FUNC_DECL explicit tvec2(tvec3<U> const & v);
+ //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
+ template <typename U>
+ GLM_FUNC_DECL explicit tvec2(tvec4<U> const & v);
+
+ //////////////////////////////////////
+ // Unary arithmetic operators
+
+ GLM_FUNC_DECL tvec2<T> & operator= (tvec2<T> const & v);
+ template <typename U>
+ GLM_FUNC_DECL tvec2<T> & operator= (tvec2<U> const & v);
+
+ template <typename U>
+ GLM_FUNC_DECL tvec2<T> & operator+=(U const & s);
+ template <typename U>
+ GLM_FUNC_DECL tvec2<T> & operator+=(tvec2<U> const & v);
+ template <typename U>
+ GLM_FUNC_DECL tvec2<T> & operator-=(U const & s);
+ template <typename U>
+ GLM_FUNC_DECL tvec2<T> & operator-=(tvec2<U> const & v);
+ template <typename U>
+ GLM_FUNC_DECL tvec2<T> & operator*=(U const & s);
+ template <typename U>
+ GLM_FUNC_DECL tvec2<T> & operator*=(tvec2<U> const & v);
+ template <typename U>
+ GLM_FUNC_DECL tvec2<T> & operator/=(U const & s);
+ template <typename U>
+ GLM_FUNC_DECL tvec2<T> & operator/=(tvec2<U> const & v);
+ GLM_FUNC_DECL tvec2<T> & operator++();
+ GLM_FUNC_DECL tvec2<T> & operator--();
+
+ //////////////////////////////////////
+ // Unary bit operators
+
+ template <typename U>
+ GLM_FUNC_DECL tvec2<T> & operator%= (U const & s);
+ template <typename U>
+ GLM_FUNC_DECL tvec2<T> & operator%= (tvec2<U> const & v);
+ template <typename U>
+ GLM_FUNC_DECL tvec2<T> & operator&= (U const & s);
+ template <typename U>
+ GLM_FUNC_DECL tvec2<T> & operator&= (tvec2<U> const & v);
+ template <typename U>
+ GLM_FUNC_DECL tvec2<T> & operator|= (U const & s);
+ template <typename U>
+ GLM_FUNC_DECL tvec2<T> & operator|= (tvec2<U> const & v);
+ template <typename U>
+ GLM_FUNC_DECL tvec2<T> & operator^= (U const & s);
+ template <typename U>
+ GLM_FUNC_DECL tvec2<T> & operator^= (tvec2<U> const & v);
+ template <typename U>
+ GLM_FUNC_DECL tvec2<T> & operator<<=(U const & s);
+ template <typename U>
+ GLM_FUNC_DECL tvec2<T> & operator<<=(tvec2<U> const & v);
+ template <typename U>
+ GLM_FUNC_DECL tvec2<T> & operator>>=(U const & s);
+ template <typename U>
+ GLM_FUNC_DECL tvec2<T> & operator>>=(tvec2<U> const & v);
+
+ //////////////////////////////////////
+ // Swizzle operators
+
+ GLM_FUNC_DECL value_type swizzle(comp X) const;
+ GLM_FUNC_DECL tvec2<T> swizzle(comp X, comp Y) const;
+ GLM_FUNC_DECL tvec3<T> swizzle(comp X, comp Y, comp Z) const;
+ GLM_FUNC_DECL tvec4<T> swizzle(comp X, comp Y, comp Z, comp W) const;
+ GLM_FUNC_DECL tref2<T> swizzle(comp X, comp Y);
+ };
+
+ template <typename T>
+ struct tref2
+ {
+ GLM_FUNC_DECL tref2(T & x, T & y);
+ GLM_FUNC_DECL tref2(tref2<T> const & r);
+ GLM_FUNC_DECL tref2(tvec2<T> const & v);
+
+ GLM_FUNC_DECL tref2<T> & operator= (tref2<T> const & r);
+ GLM_FUNC_DECL tref2<T> & operator= (tvec2<T> const & v);
+
+ T& x;
+ T& y;
+ };
+
+ GLM_DETAIL_IS_VECTOR(tvec2);
+
+} //namespace detail
+
+namespace core{
+namespace type{
+namespace precision
+{
+ //! 2 components vector of high precision floating-point numbers.
+ //! There is no guarantee on the actual precision.
+ //! From GLSL 1.30.8 specification, section 4.5.2 Precision Qualifiers.
+ //! \ingroup core_precision
+ typedef detail::tvec2<highp_float> highp_vec2;
+
+ //! 2 components vector of medium precision floating-point numbers.
+ //! There is no guarantee on the actual precision.
+ //! From GLSL 1.30.8 specification, section 4.5.2 Precision Qualifiers.
+ //! \ingroup core_precision
+ typedef detail::tvec2<mediump_float> mediump_vec2;
+
+ //! 2 components vector of low precision floating-point numbers.
+ //! There is no guarantee on the actual precision.
+ //! From GLSL 1.30.8 specification, section 4.5.2 Precision Qualifiers.
+ //! \ingroup core_precision
+ typedef detail::tvec2<lowp_float> lowp_vec2;
+
+ //! 2 components vector of high precision signed integer numbers.
+ //! There is no guarantee on the actual precision.
+ //! From GLSL 1.30.8 specification, section 4.1.5 Precision Qualifiers.
+ //! \ingroup core_precision
+ typedef detail::tvec2<highp_int> highp_ivec2;
+
+ //! 2 components vector of medium precision signed integer numbers.
+ //! There is no guarantee on the actual precision.
+ //! From GLSL 1.30.8 specification, section 4.1.5 Precision Qualifiers.
+ //! \ingroup core_precision
+ typedef detail::tvec2<mediump_int> mediump_ivec2;
+
+ //! 2 components vector of low precision signed integer numbers.
+ //! There is no guarantee on the actual precision.
+ //! From GLSL 1.30.8 specification, section 4.1.5 Precision Qualifiers.
+ //! \ingroup core_precision
+ typedef detail::tvec2<lowp_int> lowp_ivec2;
+
+ //! 2 components vector of high precision unsigned integer numbers.
+ //! There is no guarantee on the actual precision.
+ //! From GLSL 1.30.8 specification, section 4.1.5 Precision Qualifiers.
+ //! \ingroup core_precision
+ typedef detail::tvec2<highp_uint> highp_uvec2;
+
+ //! 2 components vector of medium precision unsigned integer numbers.
+ //! There is no guarantee on the actual precision.
+ //! From GLSL 1.30.8 specification, section 4.1.5 Precision Qualifiers.
+ //! \ingroup core_precision
+ typedef detail::tvec2<mediump_uint> mediump_uvec2;
+
+ //! 2 components vector of low precision unsigned integer numbers.
+ //! There is no guarantee on the actual precision.
+ //! From GLSL 1.30.8 specification, section 4.1.5 Precision Qualifiers.
+ //! \ingroup core_precision
+ typedef detail::tvec2<lowp_uint> lowp_uvec2;
+
+}//namespace precision
+}//namespace type
+}//namespace core
+}//namespace glm
+
+#ifndef GLM_EXTERNAL_TEMPLATE
+#include "type_vec2.inl"
+#endif//GLM_EXTERNAL_TEMPLATE
+
+#endif//glm_core_type_gentype2
diff --git a/src/glm/core/type_vec2.inl b/src/glm/core/type_vec2.inl
new file mode 100644
index 0000000..5d4594b
--- /dev/null
+++ b/src/glm/core/type_vec2.inl
@@ -0,0 +1,1010 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2008-08-18
+// Updated : 2010-10-26
+// Licence : This source is under MIT License
+// File : glm/core/type_tvec2.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm{
+namespace detail
+{
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tvec2<T>::size_type tvec2<T>::length() const
+ {
+ return 2;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tvec2<T>::size_type tvec2<T>::value_size()
+ {
+ return 2;
+ }
+
+ //////////////////////////////////////
+ // Accesses
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tvec2<T>::value_type &
+ tvec2<T>::operator[]
+ (
+ size_type i
+ )
+ {
+ assert(i < value_size());
+ return (&x)[i];
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tvec2<T>::value_type const &
+ tvec2<T>::operator[]
+ (
+ size_type i
+ ) const
+ {
+ assert(i < value_size());
+ return (&x)[i];
+ }
+
+ //////////////////////////////////////
+ // Implicit basic constructors
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec2<T>::tvec2() :
+ x(value_type(0)),
+ y(value_type(0))
+ {}
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec2<T>::tvec2
+ (
+ ctor
+ )
+ {}
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec2<T>::tvec2
+ (
+ tvec2<T> const & v
+ ) :
+ x(v.x),
+ y(v.y)
+ {}
+
+ //////////////////////////////////////
+ // Explicit basic constructors
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec2<T>::tvec2
+ (
+ value_type const & s
+ ) :
+ x(s),
+ y(s)
+ {}
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec2<T>::tvec2
+ (
+ value_type const & s1,
+ value_type const & s2
+ ) :
+ x(s1),
+ y(s2)
+ {}
+
+ //////////////////////////////////////
+ // Swizzle constructors
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec2<T>::tvec2
+ (
+ tref2<T> const & r
+ ) :
+ x(r.x),
+ y(r.y)
+ {}
+
+ //////////////////////////////////////
+ // Convertion scalar constructors
+/*
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec2<T>::tvec2
+ (
+ U const & x
+ ) :
+ x(value_type(x)),
+ y(value_type(x))
+ {}
+*/
+ template <typename T>
+ template <typename U, typename V>
+ GLM_FUNC_QUALIFIER tvec2<T>::tvec2
+ (
+ U const & x,
+ V const & y
+ ) :
+ x(value_type(x)),
+ y(value_type(y))
+ {}
+
+ //////////////////////////////////////
+ // Convertion vector constructors
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec2<T>::tvec2
+ (
+ tvec2<U> const & v
+ ) :
+ x(value_type(v.x)),
+ y(value_type(v.y))
+ {}
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec2<T>::tvec2
+ (
+ tvec3<U> const & v
+ ) :
+ x(value_type(v.x)),
+ y(value_type(v.y))
+ {}
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec2<T>::tvec2
+ (
+ tvec4<U> const & v
+ ) :
+ x(value_type(v.x)),
+ y(value_type(v.y))
+ {}
+
+ //////////////////////////////////////
+ // Unary arithmetic operators
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec2<T> & tvec2<T>::operator=
+ (
+ tvec2<T> const & v
+ )
+ {
+ this->x = v.x;
+ this->y = v.y;
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec2<T> & tvec2<T>::operator=
+ (
+ tvec2<U> const & v
+ )
+ {
+ this->x = T(v.x);
+ this->y = T(v.y);
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec2<T> & tvec2<T>::operator+=
+ (
+ U const & s
+ )
+ {
+ this->x += T(s);
+ this->y += T(s);
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec2<T> & tvec2<T>::operator+=
+ (
+ tvec2<U> const & v
+ )
+ {
+ this->x += T(v.x);
+ this->y += T(v.y);
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec2<T> & tvec2<T>::operator-=
+ (
+ U const & s
+ )
+ {
+ this->x -= T(s);
+ this->y -= T(s);
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec2<T> & tvec2<T>::operator-=
+ (
+ tvec2<U> const & v
+ )
+ {
+ this->x -= T(v.x);
+ this->y -= T(v.y);
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec2<T> & tvec2<T>::operator*=
+ (
+ U const & s
+ )
+ {
+ this->x *= T(s);
+ this->y *= T(s);
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec2<T> & tvec2<T>::operator*=
+ (
+ tvec2<U> const & v
+ )
+ {
+ this->x *= T(v.x);
+ this->y *= T(v.y);
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec2<T> & tvec2<T>::operator/=
+ (
+ U const & s
+ )
+ {
+ this->x /= T(s);
+ this->y /= T(s);
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec2<T> & tvec2<T>::operator/=
+ (
+ tvec2<U> const & v
+ )
+ {
+ this->x /= T(v.x);
+ this->y /= T(v.y);
+ return *this;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec2<T> & tvec2<T>::operator++()
+ {
+ ++this->x;
+ ++this->y;
+ return *this;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec2<T> & tvec2<T>::operator--()
+ {
+ --this->x;
+ --this->y;
+ return *this;
+ }
+
+ //////////////////////////////////////
+ // Boolean operators
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER bool operator==
+ (
+ tvec2<T> const & v1,
+ tvec2<T> const & v2
+ )
+ {
+ return (v1.x == v2.x) && (v1.y == v2.y);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER bool operator!=
+ (
+ tvec2<T> const & v1,
+ tvec2<T> const & v2
+ )
+ {
+ return (v1.x != v2.x) || (v1.y != v2.y);
+ }
+
+ //////////////////////////////////////
+ // Unary bit operators
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec2<T> & tvec2<T>::operator%=
+ (
+ U const & s
+ )
+ {
+ this->x %= T(s);
+ this->y %= T(s);
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec2<T> & tvec2<T>::operator%=
+ (
+ tvec2<U> const & v
+ )
+ {
+ this->x %= T(v.x);
+ this->y %= T(v.y);
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec2<T> & tvec2<T>::operator&=
+ (
+ U const & s
+ )
+ {
+ this->x &= T(s);
+ this->y &= T(s);
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec2<T> & tvec2<T>::operator&=
+ (
+ tvec2<U> const & v
+ )
+ {
+ this->x &= T(v.x);
+ this->y &= T(v.y);
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec2<T> & tvec2<T>::operator|=
+ (
+ U const & s
+ )
+ {
+ this->x |= T(s);
+ this->y |= T(s);
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec2<T> & tvec2<T>::operator|=
+ (
+ tvec2<U> const & v
+ )
+ {
+ this->x |= T(v.x);
+ this->y |= T(v.y);
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec2<T> & tvec2<T>::operator^=
+ (
+ U const & s
+ )
+ {
+ this->x ^= T(s);
+ this->y ^= T(s);
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec2<T> & tvec2<T>::operator^=
+ (
+ tvec2<U> const & v
+ )
+ {
+ this->x ^= T(v.x);
+ this->y ^= T(v.y);
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec2<T> & tvec2<T>::operator<<=
+ (
+ U const & s
+ )
+ {
+ this->x <<= T(s);
+ this->y <<= T(s);
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec2<T> & tvec2<T>::operator<<=
+ (
+ tvec2<U> const & v
+ )
+ {
+ this->x <<= T(v.x);
+ this->y <<= T(v.y);
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec2<T> & tvec2<T>::operator>>=
+ (
+ U const & s
+ )
+ {
+ this->x >>= T(s);
+ this->y >>= T(s);
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec2<T> & tvec2<T>::operator>>=
+ (
+ tvec2<U> const & v
+ )
+ {
+ this->x >>= T(v.x);
+ this->y >>= T(v.y);
+ return *this;
+ }
+
+ //////////////////////////////////////
+ // Swizzle operators
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tvec2<T>::value_type tvec2<T>::swizzle
+ (
+ comp x
+ ) const
+ {
+ return (*this)[x];
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec2<T> tvec2<T>::swizzle
+ (
+ comp x,
+ comp y
+ ) const
+ {
+ return tvec2<T>(
+ (*this)[x],
+ (*this)[y]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec3<T> tvec2<T>::swizzle
+ (
+ comp x,
+ comp y,
+ comp z
+ ) const
+ {
+ return tvec3<T>(
+ (*this)[x],
+ (*this)[y],
+ (*this)[z]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec4<T> tvec2<T>::swizzle
+ (
+ comp x,
+ comp y,
+ comp z,
+ comp w
+ ) const
+ {
+ return tvec4<T>(
+ (*this)[x],
+ (*this)[y],
+ (*this)[z],
+ (*this)[w]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tref2<T> tvec2<T>::swizzle
+ (
+ comp x,
+ comp y
+ )
+ {
+ return tref2<T>(
+ (*this)[x],
+ (*this)[y]);
+ }
+
+ //////////////////////////////////////
+ // Binary arithmetic operators
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec2<T> operator+
+ (
+ tvec2<T> const & v,
+ T const & s
+ )
+ {
+ return tvec2<T>(
+ v.x + T(s),
+ v.y + T(s));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec2<T> operator+
+ (
+ T const & s,
+ tvec2<T> const & v
+ )
+ {
+ return tvec2<T>(
+ T(s) + v.x,
+ T(s) + v.y);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec2<T> operator+
+ (
+ tvec2<T> const & v1,
+ tvec2<T> const & v2
+ )
+ {
+ return tvec2<T>(
+ v1.x + T(v2.x),
+ v1.y + T(v2.y));
+ }
+
+ //operator-
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec2<T> operator-
+ (
+ tvec2<T> const & v,
+ T const & s
+ )
+ {
+ return tvec2<T>(
+ v.x - T(s),
+ v.y - T(s));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec2<T> operator-
+ (
+ T const & s,
+ tvec2<T> const & v
+ )
+ {
+ return tvec2<T>(
+ T(s) - v.x,
+ T(s) - v.y);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec2<T> operator-
+ (
+ tvec2<T> const & v1,
+ tvec2<T> const & v2
+ )
+ {
+ return tvec2<T>(
+ v1.x - T(v2.x),
+ v1.y - T(v2.y));
+ }
+
+ //operator*
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec2<T> operator*
+ (
+ tvec2<T> const & v,
+ T const & s
+ )
+ {
+ return tvec2<T>(
+ v.x * T(s),
+ v.y * T(s));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec2<T> operator*
+ (
+ T const & s,
+ tvec2<T> const & v
+ )
+ {
+ return tvec2<T>(
+ T(s) * v.x,
+ T(s) * v.y);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec2<T> operator*
+ (
+ tvec2<T> const & v1,
+ tvec2<T> const & v2
+ )
+ {
+ return tvec2<T>(
+ v1.x * T(v2.x),
+ v1.y * T(v2.y));
+ }
+
+ //operator/
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec2<T> operator/
+ (
+ tvec2<T> const & v,
+ T const & s
+ )
+ {
+ return tvec2<T>(
+ v.x / T(s),
+ v.y / T(s));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec2<T> operator/
+ (
+ T const & s,
+ tvec2<T> const & v
+ )
+ {
+ return tvec2<T>(
+ T(s) / v.x,
+ T(s) / v.y);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec2<T> operator/
+ (
+ tvec2<T> const & v1,
+ tvec2<T> const & v2
+ )
+ {
+ return tvec2<T>(
+ v1.x / T(v2.x),
+ v1.y / T(v2.y));
+ }
+
+ // Unary constant operators
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec2<T> operator-
+ (
+ tvec2<T> const & v
+ )
+ {
+ return tvec2<T>(
+ -v.x,
+ -v.y);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec2<T> operator++
+ (
+ tvec2<T> const & v,
+ int
+ )
+ {
+ return tvec2<T>(
+ v.x + T(1),
+ v.y + T(1));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec2<T> operator--
+ (
+ tvec2<T> const & v,
+ int
+ )
+ {
+ return tvec2<T>(
+ v.x - T(1),
+ v.y - T(1));
+ }
+
+ //////////////////////////////////////
+ // Binary bit operators
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec2<T> operator%
+ (
+ tvec2<T> const & v,
+ T const & s
+ )
+ {
+ return tvec2<T>(
+ v.x % T(s),
+ v.y % T(s));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec2<T> operator%
+ (
+ T const & s,
+ tvec2<T> const & v
+ )
+ {
+ return tvec2<T>(
+ T(s) % v.x,
+ T(s) % v.y);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec2<T> operator%
+ (
+ tvec2<T> const & v1,
+ tvec2<T> const & v2
+ )
+ {
+ return tvec2<T>(
+ v1.x % T(v2.x),
+ v1.y % T(v2.y));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec2<T> operator&
+ (
+ tvec2<T> const & v,
+ T const & s
+ )
+ {
+ return tvec2<T>(
+ v.x & T(s),
+ v.y & T(s));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec2<T> operator&
+ (
+ T const & s,
+ tvec2<T> const & v
+ )
+ {
+ return tvec2<T>(
+ T(s) & v.x,
+ T(s) & v.y);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec2<T> operator&
+ (
+ tvec2<T> const & v1,
+ tvec2<T> const & v2
+ )
+ {
+ return tvec2<T>(
+ v1.x & T(v2.x),
+ v1.y & T(v2.y));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec2<T> operator|
+ (
+ tvec2<T> const & v,
+ T const & s
+ )
+ {
+ return tvec2<T>(
+ v.x | T(s),
+ v.y | T(s));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec2<T> operator|
+ (
+ T const & s,
+ tvec2<T> const & v
+ )
+ {
+ return tvec2<T>(
+ T(s) | v.x,
+ T(s) | v.y);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec2<T> operator|
+ (
+ tvec2<T> const & v1,
+ tvec2<T> const & v2
+ )
+ {
+ return tvec2<T>(
+ v1.x | T(v2.x),
+ v1.y | T(v2.y));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec2<T> operator^
+ (
+ tvec2<T> const & v,
+ T const & s
+ )
+ {
+ return tvec2<T>(
+ v.x ^ T(s),
+ v.y ^ T(s));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec2<T> operator^
+ (
+ T const & s,
+ tvec2<T> const & v
+ )
+ {
+ return tvec2<T>(
+ T(s) ^ v.x,
+ T(s) ^ v.y);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec2<T> operator^
+ (
+ tvec2<T> const & v1,
+ tvec2<T> const & v2
+ )
+ {
+ return tvec2<T>(
+ v1.x ^ T(v2.x),
+ v1.y ^ T(v2.y));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec2<T> operator<<
+ (
+ tvec2<T> const & v,
+ T const & s
+ )
+ {
+ return tvec2<T>(
+ v.x << T(s),
+ v.y << T(s));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec2<T> operator<<
+ (
+ T const & s,
+ tvec2<T> const & v
+ )
+ {
+ return tvec2<T>(
+ s << T(v.x),
+ s << T(v.y));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec2<T> operator<<
+ (
+ tvec2<T> const & v1,
+ tvec2<T> const & v2
+ )
+ {
+ return tvec2<T>(
+ v1.x << T(v2.x),
+ v1.y << T(v2.y));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec2<T> operator>>
+ (
+ tvec2<T> const & v,
+ T const & s
+ )
+ {
+ return tvec2<T>(
+ v.x >> T(s),
+ v.y >> T(s));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec2<T> operator>>
+ (
+ T const & s,
+ tvec2<T> const & v
+ )
+ {
+ return tvec2<T>(
+ T(s) >> v.x,
+ T(s) >> v.y);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec2<T> operator>>
+ (
+ tvec2<T> const & v1,
+ tvec2<T> const & v2
+ )
+ {
+ return tvec2<T>(
+ v1.x >> T(v2.x),
+ v1.y >> T(v2.y));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec2<T> operator~
+ (
+ tvec2<T> const & v
+ )
+ {
+ return tvec2<T>(
+ ~v.x,
+ ~v.y);
+ }
+
+ //////////////////////////////////////
+ // tref definition
+
+ template <typename T>
+ tref2<T>::tref2
+ (
+ T & x,
+ T & y
+ ) :
+ x(x),
+ y(y)
+ {}
+
+ template <typename T>
+ tref2<T>::tref2
+ (
+ tref2<T> const & r
+ ) :
+ x(r.x),
+ y(r.y)
+ {}
+
+ template <typename T>
+ tref2<T>::tref2
+ (
+ tvec2<T> const & v
+ ) :
+ x(v.x),
+ y(v.y)
+ {}
+
+ template <typename T>
+ tref2<T>& tref2<T>::operator=
+ (
+ tref2<T> const & r
+ )
+ {
+ x = r.x;
+ y = r.y;
+ return *this;
+ }
+
+ template <typename T>
+ tref2<T>& tref2<T>::operator=
+ (
+ tvec2<T> const & v
+ )
+ {
+ x = v.x;
+ y = v.y;
+ return *this;
+ }
+
+}//namespace detail
+}//namespace glm
diff --git a/src/glm/core/type_vec3.hpp b/src/glm/core/type_vec3.hpp
new file mode 100644
index 0000000..8864d7d
--- /dev/null
+++ b/src/glm/core/type_vec3.hpp
@@ -0,0 +1,269 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2008-08-22
+// Updated : 2010-02-03
+// Licence : This source is under MIT License
+// File : glm/core/type_tvec3.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_core_type_gentype3
+#define glm_core_type_gentype3
+
+#include "type_vec.hpp"
+#include "type_float.hpp"
+#include "type_int.hpp"
+#include "type_size.hpp"
+#include "_swizzle.hpp"
+
+namespace glm{
+namespace detail
+{
+ template <typename T> struct tref2;
+ template <typename T> struct tref3;
+ template <typename T> struct tref4;
+ template <typename T> struct tvec2;
+ template <typename T> struct tvec4;
+
+ //! Basic 3D vector type.
+ //! \ingroup core_template
+ template <typename T>
+ struct tvec3
+ {
+ enum ctor{null};
+
+ typedef T value_type;
+ typedef std::size_t size_type;
+ GLM_FUNC_DECL size_type length() const;
+ static GLM_FUNC_DECL size_type value_size();
+
+ typedef tvec3<T> type;
+ typedef tvec3<bool> bool_type;
+
+ //////////////////////////////////////
+ // Data
+
+# if(GLM_COMPONENT == GLM_COMPONENT_ONLY_XYZW)
+ value_type x, y, z;
+# elif(GLM_COMPONENT == GLM_COMPONENT_MS_EXT)
+ union
+ {
+ struct{value_type x, y, z;};
+ struct{value_type r, g, b;};
+ struct{value_type s, t, p;};
+ };
+# else//(GLM_COMPONENT == GLM_COMPONENT_GLSL_NAMES)
+ union {value_type x, r, s;};
+ union {value_type y, g, t;};
+ union {value_type z, b, p;};
+# endif//GLM_COMPONENT
+
+ //////////////////////////////////////
+ // Accesses
+
+ GLM_FUNC_DECL value_type & operator[](size_type i);
+ GLM_FUNC_DECL value_type const & operator[](size_type i) const;
+
+ //////////////////////////////////////
+ // Implicit basic constructors
+
+ GLM_FUNC_DECL tvec3();
+ GLM_FUNC_DECL tvec3(tvec3<T> const & v);
+
+ //////////////////////////////////////
+ // Explicit basic constructors
+
+ GLM_FUNC_DECL explicit tvec3(
+ ctor);
+ GLM_FUNC_DECL explicit tvec3(
+ value_type const & s);
+ GLM_FUNC_DECL explicit tvec3(
+ value_type const & s1,
+ value_type const & s2,
+ value_type const & s3);
+
+ //////////////////////////////////////
+ // Swizzle constructors
+
+ GLM_FUNC_DECL tvec3(tref3<T> const & r);
+
+ //////////////////////////////////////
+ // Convertion scalar constructors
+
+ //! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
+ template <typename U>
+ GLM_FUNC_DECL explicit tvec3(
+ U const & x);
+ //! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
+ template <typename U, typename V, typename W>
+ GLM_FUNC_DECL explicit tvec3(
+ U const & x,
+ V const & y,
+ W const & z);
+
+ //////////////////////////////////////
+ // Convertion vector constructors
+
+ //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
+ template <typename A, typename B>
+ GLM_FUNC_DECL explicit tvec3(tvec2<A> const & v, B const & s);
+ //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
+ template <typename A, typename B>
+ GLM_FUNC_DECL explicit tvec3(A const & s, tvec2<B> const & v);
+ //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
+ template <typename U>
+ GLM_FUNC_DECL explicit tvec3(tvec3<U> const & v);
+ //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
+ template <typename U>
+ GLM_FUNC_DECL explicit tvec3(tvec4<U> const & v);
+
+ //////////////////////////////////////
+ // Unary arithmetic operators
+
+ GLM_FUNC_DECL tvec3<T> & operator= (tvec3<T> const & v);
+ template <typename U>
+ GLM_FUNC_DECL tvec3<T> & operator= (tvec3<U> const & v);
+
+ template <typename U>
+ GLM_FUNC_DECL tvec3<T> & operator+=(U const & s);
+ template <typename U>
+ GLM_FUNC_DECL tvec3<T> & operator+=(tvec3<U> const & v);
+ template <typename U>
+ GLM_FUNC_DECL tvec3<T> & operator-=(U const & s);
+ template <typename U>
+ GLM_FUNC_DECL tvec3<T> & operator-=(tvec3<U> const & v);
+ template <typename U>
+ GLM_FUNC_DECL tvec3<T> & operator*=(U const & s);
+ template <typename U>
+ GLM_FUNC_DECL tvec3<T> & operator*=(tvec3<U> const & v);
+ template <typename U>
+ GLM_FUNC_DECL tvec3<T> & operator/=(U const & s);
+ template <typename U>
+ GLM_FUNC_DECL tvec3<T> & operator/=(tvec3<U> const & v);
+ GLM_FUNC_DECL tvec3<T> & operator++();
+ GLM_FUNC_DECL tvec3<T> & operator--();
+
+ //////////////////////////////////////
+ // Unary bit operators
+
+ template <typename U>
+ GLM_FUNC_DECL tvec3<T> & operator%= (U const & s);
+ template <typename U>
+ GLM_FUNC_DECL tvec3<T> & operator%= (tvec3<U> const & v);
+ template <typename U>
+ GLM_FUNC_DECL tvec3<T> & operator&= (U const & s);
+ template <typename U>
+ GLM_FUNC_DECL tvec3<T> & operator&= (tvec3<U> const & v);
+ template <typename U>
+ GLM_FUNC_DECL tvec3<T> & operator|= (U const & s);
+ template <typename U>
+ GLM_FUNC_DECL tvec3<T> & operator|= (tvec3<U> const & v);
+ template <typename U>
+ GLM_FUNC_DECL tvec3<T> & operator^= (U const & s);
+ template <typename U>
+ GLM_FUNC_DECL tvec3<T> & operator^= (tvec3<U> const & v);
+ template <typename U>
+ GLM_FUNC_DECL tvec3<T> & operator<<=(U const & s);
+ template <typename U>
+ GLM_FUNC_DECL tvec3<T> & operator<<=(tvec3<U> const & v);
+ template <typename U>
+ GLM_FUNC_DECL tvec3<T> & operator>>=(U const & s);
+ template <typename U>
+ GLM_FUNC_DECL tvec3<T> & operator>>=(tvec3<U> const & v);
+
+ //////////////////////////////////////
+ // Swizzle operators
+
+ GLM_FUNC_DECL value_type swizzle(comp X) const;
+ GLM_FUNC_DECL tvec2<T> swizzle(comp X, comp Y) const;
+ GLM_FUNC_DECL tvec3<T> swizzle(comp X, comp Y, comp Z) const;
+ GLM_FUNC_DECL tvec4<T> swizzle(comp X, comp Y, comp Z, comp W) const;
+ GLM_FUNC_DECL tref3<T> swizzle(comp X, comp Y, comp Z);
+ };
+
+ template <typename T>
+ struct tref3
+ {
+ GLM_FUNC_DECL tref3(T & x, T & y, T & z);
+ GLM_FUNC_DECL tref3(tref3<T> const & r);
+ GLM_FUNC_DECL tref3(tvec3<T> const & v);
+
+ GLM_FUNC_DECL tref3<T> & operator= (tref3<T> const & r);
+ GLM_FUNC_DECL tref3<T> & operator= (tvec3<T> const & v);
+
+ T & x;
+ T & y;
+ T & z;
+ };
+
+ GLM_DETAIL_IS_VECTOR(tvec3);
+} //namespace detail
+
+namespace core{
+namespace type{
+namespace precision
+{
+ //! 3 components vector of high precision floating-point numbers.
+ //! There is no guarantee on the actual precision.
+ //! From GLSL 1.30.8 specification, section 4.5.2 Precision Qualifiers.
+ //! \ingroup core_precision
+ typedef detail::tvec3<highp_float> highp_vec3;
+
+ //! 3 components vector of medium precision floating-point numbers.
+ //! There is no guarantee on the actual precision.
+ //! From GLSL 1.30.8 specification, section 4.5.2 Precision Qualifiers.
+ //! \ingroup core_precision
+ typedef detail::tvec3<mediump_float> mediump_vec3;
+
+ //! 3 components vector of low precision floating-point numbers.
+ //! There is no guarantee on the actual precision.
+ //! From GLSL 1.30.8 specification, section 4.5.2 Precision Qualifiers.
+ //! \ingroup core_precision
+ typedef detail::tvec3<lowp_float> lowp_vec3;
+
+ //! 3 components vector of high precision signed integer numbers.
+ //! There is no guarantee on the actual precision.
+ //! From GLSL 1.30.8 specification, section 4.1.5 Precision Qualifiers.
+ //! \ingroup core_precision
+ typedef detail::tvec3<highp_int> highp_ivec3;
+
+ //! 3 components vector of medium precision signed integer numbers.
+ //! There is no guarantee on the actual precision.
+ //! From GLSL 1.30.8 specification, section 4.1.5 Precision Qualifiers.
+ //! \ingroup core_precision
+ typedef detail::tvec3<mediump_int> mediump_ivec3;
+
+ //! 3 components vector of low precision signed integer numbers.
+ //! There is no guarantee on the actual precision.
+ //! From GLSL 1.30.8 specification, section 4.1.5 Precision Qualifiers.
+ //! \ingroup core_precision
+ typedef detail::tvec3<lowp_int> lowp_ivec3;
+
+ //! 3 components vector of high precision unsigned integer numbers.
+ //! There is no guarantee on the actual precision.
+ //! From GLSL 1.30.8 specification, section 4.1.5 Precision Qualifiers.
+ //! \ingroup core_precision
+ typedef detail::tvec3<highp_uint> highp_uvec3;
+
+ //! 3 components vector of medium precision unsigned integer numbers.
+ //! There is no guarantee on the actual precision.
+ //! From GLSL 1.30.8 specification, section 4.1.5 Precision Qualifiers.
+ //! \ingroup core_precision
+ typedef detail::tvec3<mediump_uint> mediump_uvec3;
+
+ //! 3 components vector of low precision unsigned integer numbers.
+ //! There is no guarantee on the actual precision.
+ //! From GLSL 1.30.8 specification, section 4.1.5 Precision Qualifiers.
+ //! \ingroup core_precision
+ typedef detail::tvec3<lowp_uint> lowp_uvec3;
+
+}//namespace precision
+}//namespace type
+}//namespace core
+}//namespace glm
+
+#ifndef GLM_EXTERNAL_TEMPLATE
+#include "type_vec3.inl"
+#endif//GLM_EXTERNAL_TEMPLATE
+
+#endif//glm_core_type_gentype3
diff --git a/src/glm/core/type_vec3.inl b/src/glm/core/type_vec3.inl
new file mode 100644
index 0000000..f7a3542
--- /dev/null
+++ b/src/glm/core/type_vec3.inl
@@ -0,0 +1,1097 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2008-08-22
+// Updated : 2010-02-04
+// Licence : This source is under MIT License
+// File : glm/core/type_tvec3.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm{
+namespace detail
+{
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tvec3<T>::size_type tvec3<T>::length() const
+ {
+ return 3;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tvec3<T>::size_type tvec3<T>::value_size()
+ {
+ return 3;
+ }
+
+ //////////////////////////////////////
+ // Accesses
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tvec3<T>::value_type &
+ tvec3<T>::operator[]
+ (
+ size_type i
+ )
+ {
+ assert(i < value_size());
+ return (&x)[i];
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tvec3<T>::value_type const &
+ tvec3<T>::operator[]
+ (
+ size_type i
+ ) const
+ {
+ assert(i < value_size());
+ return (&x)[i];
+ }
+
+ //////////////////////////////////////
+ // Implicit basic constructors
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec3<T>::tvec3() :
+ x(value_type(0)),
+ y(value_type(0)),
+ z(value_type(0))
+ {}
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec3<T>::tvec3
+ (
+ ctor
+ )
+ {}
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec3<T>::tvec3
+ (
+ tvec3<T> const & v
+ ) :
+ x(v.x),
+ y(v.y),
+ z(v.z)
+ {}
+
+ //////////////////////////////////////
+ // Explicit basic constructors
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec3<T>::tvec3
+ (
+ value_type const & s
+ ) :
+ x(s),
+ y(s),
+ z(s)
+ {}
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec3<T>::tvec3
+ (
+ value_type const & s0,
+ value_type const & s1,
+ value_type const & s2
+ ) :
+ x(s0),
+ y(s1),
+ z(s2)
+ {}
+
+ //////////////////////////////////////
+ // Swizzle constructors
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec3<T>::tvec3
+ (
+ tref3<T> const & r
+ ) :
+ x(r.x),
+ y(r.y),
+ z(r.z)
+ {}
+
+ //////////////////////////////////////
+ // Convertion scalar constructors
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec3<T>::tvec3
+ (
+ U const & s
+ ) :
+ x(value_type(s)),
+ y(value_type(s)),
+ z(value_type(s))
+ {}
+
+ template <typename T>
+ template <typename A, typename B, typename C>
+ GLM_FUNC_QUALIFIER tvec3<T>::tvec3
+ (
+ A const & x,
+ B const & y,
+ C const & z
+ ) :
+ x(value_type(x)),
+ y(value_type(y)),
+ z(value_type(z))
+ {}
+
+ //////////////////////////////////////
+ // Convertion vector constructors
+
+ template <typename T>
+ template <typename A, typename B>
+ GLM_FUNC_QUALIFIER tvec3<T>::tvec3
+ (
+ tvec2<A> const & v,
+ B const & s
+ ) :
+ x(value_type(v.x)),
+ y(value_type(v.y)),
+ z(value_type(s))
+ {}
+
+ template <typename T>
+ template <typename A, typename B>
+ GLM_FUNC_QUALIFIER tvec3<T>::tvec3
+ (
+ A const & s,
+ tvec2<B> const & v
+ ) :
+ x(value_type(s)),
+ y(value_type(v.x)),
+ z(value_type(v.y))
+ {}
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec3<T>::tvec3
+ (
+ tvec3<U> const & v
+ ) :
+ x(value_type(v.x)),
+ y(value_type(v.y)),
+ z(value_type(v.z))
+ {}
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec3<T>::tvec3
+ (
+ tvec4<U> const & v
+ ) :
+ x(value_type(v.x)),
+ y(value_type(v.y)),
+ z(value_type(v.z))
+ {}
+
+ //////////////////////////////////////
+ // Unary arithmetic operators
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec3<T>& tvec3<T>::operator=
+ (
+ tvec3<T> const & v
+ )
+ {
+ this->x = v.x;
+ this->y = v.y;
+ this->z = v.z;
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec3<T>& tvec3<T>::operator=
+ (
+ tvec3<U> const & v
+ )
+ {
+ this->x = T(v.x);
+ this->y = T(v.y);
+ this->z = T(v.z);
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec3<T> & tvec3<T>::operator+=
+ (
+ U const & s
+ )
+ {
+ this->x += T(s);
+ this->y += T(s);
+ this->z += T(s);
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec3<T> & tvec3<T>::operator+=
+ (
+ tvec3<U> const & v
+ )
+ {
+ this->x += T(v.x);
+ this->y += T(v.y);
+ this->z += T(v.z);
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec3<T> & tvec3<T>::operator-=
+ (
+ U const & s
+ )
+ {
+ this->x -= T(s);
+ this->y -= T(s);
+ this->z -= T(s);
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec3<T> & tvec3<T>::operator-=
+ (
+ tvec3<U> const & v
+ )
+ {
+ this->x -= T(v.x);
+ this->y -= T(v.y);
+ this->z -= T(v.z);
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec3<T> & tvec3<T>::operator*=
+ (
+ U const & s
+ )
+ {
+ this->x *= T(s);
+ this->y *= T(s);
+ this->z *= T(s);
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec3<T> & tvec3<T>::operator*=
+ (
+ tvec3<U> const & v
+ )
+ {
+ this->x *= T(v.x);
+ this->y *= T(v.y);
+ this->z *= T(v.z);
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec3<T> & tvec3<T>::operator/=
+ (
+ U const & s
+ )
+ {
+ this->x /= T(s);
+ this->y /= T(s);
+ this->z /= T(s);
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec3<T> & tvec3<T>::operator/=
+ (
+ tvec3<U> const & v
+ )
+ {
+ this->x /= T(v.x);
+ this->y /= T(v.y);
+ this->z /= T(v.z);
+ return *this;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec3<T> & tvec3<T>::operator++()
+ {
+ ++this->x;
+ ++this->y;
+ ++this->z;
+ return *this;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec3<T> & tvec3<T>::operator--()
+ {
+ --this->x;
+ --this->y;
+ --this->z;
+ return *this;
+ }
+
+ //////////////////////////////////////
+ // Boolean operators
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER bool operator==
+ (
+ tvec3<T> const & v1,
+ tvec3<T> const & v2
+ )
+ {
+ return (v1.x == v2.x) && (v1.y == v2.y) && (v1.z == v2.z);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER bool operator!=
+ (
+ tvec3<T> const & v1,
+ tvec3<T> const & v2
+ )
+ {
+ return (v1.x != v2.x) || (v1.y != v2.y) || (v1.z != v2.z);
+ }
+
+ //////////////////////////////////////
+ // Unary bit operators
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec3<T> & tvec3<T>::operator%=
+ (
+ U const & s
+ )
+ {
+ this->x %= s;
+ this->y %= s;
+ this->z %= s;
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec3<T> & tvec3<T>::operator%=
+ (
+ tvec3<U> const & v
+ )
+ {
+ this->x %= v.x;
+ this->y %= v.y;
+ this->z %= v.z;
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec3<T> & tvec3<T>::operator&=
+ (
+ U const & s
+ )
+ {
+ this->x &= s;
+ this->y &= s;
+ this->z &= s;
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec3<T> & tvec3<T>::operator&=
+ (
+ tvec3<U> const & v
+ )
+ {
+ this->x &= v.x;
+ this->y &= v.y;
+ this->z &= v.z;
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec3<T> & tvec3<T>::operator|=
+ (
+ U const & s
+ )
+ {
+ this->x |= s;
+ this->y |= s;
+ this->z |= s;
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec3<T> & tvec3<T>::operator|=
+ (
+ tvec3<U> const & v
+ )
+ {
+ this->x |= v.x;
+ this->y |= v.y;
+ this->z |= v.z;
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec3<T> & tvec3<T>::operator^=
+ (
+ U const & s
+ )
+ {
+ this->x ^= s;
+ this->y ^= s;
+ this->z ^= s;
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec3<T> & tvec3<T>::operator^=
+ (
+ tvec3<U> const & v
+ )
+ {
+ this->x ^= v.x;
+ this->y ^= v.y;
+ this->z ^= v.z;
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec3<T> & tvec3<T>::operator<<=
+ (
+ U const & s
+ )
+ {
+ this->x <<= s;
+ this->y <<= s;
+ this->z <<= s;
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec3<T> & tvec3<T>::operator<<=
+ (
+ tvec3<U> const & v
+ )
+ {
+ this->x <<= T(v.x);
+ this->y <<= T(v.y);
+ this->z <<= T(v.z);
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec3<T> & tvec3<T>::operator>>=
+ (
+ U const & s
+ )
+ {
+ this->x >>= T(s);
+ this->y >>= T(s);
+ this->z >>= T(s);
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec3<T> & tvec3<T>::operator>>=
+ (
+ tvec3<U> const & v
+ )
+ {
+ this->x >>= T(v.x);
+ this->y >>= T(v.y);
+ this->z >>= T(v.z);
+ return *this;
+ }
+
+ //////////////////////////////////////
+ // Swizzle operators
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tvec3<T>::value_type
+ tvec3<T>::swizzle
+ (
+ comp x
+ ) const
+ {
+ return (*this)[x];
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec2<T> tvec3<T>::swizzle
+ (
+ comp x,
+ comp y
+ ) const
+ {
+ return tvec2<T>(
+ (*this)[x],
+ (*this)[y]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec3<T> tvec3<T>::swizzle
+ (
+ comp x,
+ comp y,
+ comp z
+ ) const
+ {
+ return tvec3<T>(
+ (*this)[x],
+ (*this)[y],
+ (*this)[z]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec4<T> tvec3<T>::swizzle
+ (
+ comp x,
+ comp y,
+ comp z,
+ comp w
+ ) const
+ {
+ return tvec4<T>(
+ (*this)[x],
+ (*this)[y],
+ (*this)[z],
+ (*this)[w]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tref3<T> tvec3<T>::swizzle
+ (
+ comp x,
+ comp y,
+ comp z
+ )
+ {
+ return tref3<T>(
+ (*this)[x],
+ (*this)[y],
+ (*this)[z]);
+ }
+
+ //////////////////////////////////////
+ // Binary arithmetic operators
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec3<T> operator+
+ (
+ tvec3<T> const & v,
+ T const & s
+ )
+ {
+ return tvec3<T>(
+ v.x + T(s),
+ v.y + T(s),
+ v.z + T(s));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec3<T> operator+
+ (
+ T const & s,
+ tvec3<T> const & v
+ )
+ {
+ return tvec3<T>(
+ T(s) + v.x,
+ T(s) + v.y,
+ T(s) + v.z);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec3<T> operator+
+ (
+ tvec3<T> const & v1,
+ tvec3<T> const & v2
+ )
+ {
+ return tvec3<T>(
+ v1.x + T(v2.x),
+ v1.y + T(v2.y),
+ v1.z + T(v2.z));
+ }
+
+ //operator-
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec3<T> operator-
+ (
+ tvec3<T> const & v,
+ T const & s
+ )
+ {
+ return tvec3<T>(
+ v.x - T(s),
+ v.y - T(s),
+ v.z - T(s));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec3<T> operator-
+ (
+ T const & s,
+ tvec3<T> const & v
+ )
+ {
+ return tvec3<T>(
+ T(s) - v.x,
+ T(s) - v.y,
+ T(s) - v.z);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec3<T> operator-
+ (
+ tvec3<T> const & v1,
+ tvec3<T> const & v2
+ )
+ {
+ return tvec3<T>(
+ v1.x - T(v2.x),
+ v1.y - T(v2.y),
+ v1.z - T(v2.z));
+ }
+
+ //operator*
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec3<T> operator*
+ (
+ tvec3<T> const & v,
+ T const & s
+ )
+ {
+ return tvec3<T>(
+ v.x * T(s),
+ v.y * T(s),
+ v.z * T(s));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec3<T> operator*
+ (
+ T const & s,
+ tvec3<T> const & v
+ )
+ {
+ return tvec3<T>(
+ T(s) * v.x,
+ T(s) * v.y,
+ T(s) * v.z);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec3<T> operator*
+ (
+ tvec3<T> const & v1,
+ tvec3<T> const & v2
+ )
+ {
+ return tvec3<T>(
+ v1.x * T(v2.x),
+ v1.y * T(v2.y),
+ v1.z * T(v2.z));
+ }
+
+ //operator/
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec3<T> operator/
+ (
+ tvec3<T> const & v,
+ T const & s
+ )
+ {
+ return tvec3<T>(
+ v.x / T(s),
+ v.y / T(s),
+ v.z / T(s));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec3<T> operator/
+ (
+ T const & s,
+ tvec3<T> const & v
+ )
+ {
+ return tvec3<T>(
+ T(s) / v.x,
+ T(s) / v.y,
+ T(s) / v.z);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec3<T> operator/
+ (
+ tvec3<T> const & v1,
+ tvec3<T> const & v2
+ )
+ {
+ return tvec3<T>(
+ v1.x / T(v2.x),
+ v1.y / T(v2.y),
+ v1.z / T(v2.z));
+ }
+
+ // Unary constant operators
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec3<T> operator-
+ (
+ tvec3<T> const & v
+ )
+ {
+ return tvec3<T>(
+ -v.x,
+ -v.y,
+ -v.z);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec3<T> operator++
+ (
+ tvec3<T> const & v,
+ int
+ )
+ {
+ return tvec3<T>(
+ v.x + T(1),
+ v.y + T(1),
+ v.z + T(1));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec3<T> operator--
+ (
+ tvec3<T> const & v,
+ int
+ )
+ {
+ return tvec3<T>(
+ v.x - T(1),
+ v.y - T(1),
+ v.z - T(1));
+ }
+
+ //////////////////////////////////////
+ // Binary bit operators
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec3<T> operator%
+ (
+ tvec3<T> const & v,
+ T const & s
+ )
+ {
+ return tvec3<T>(
+ v.x % T(s),
+ v.y % T(s),
+ v.z % T(s));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec3<T> operator%
+ (
+ T const & s,
+ tvec3<T> const & v
+ )
+ {
+ return tvec3<T>(
+ T(s) % v.x,
+ T(s) % v.y,
+ T(s) % v.z);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec3<T> operator%
+ (
+ tvec3<T> const & v1,
+ tvec3<T> const & v2
+ )
+ {
+ return tvec3<T>(
+ v1.x % T(v2.x),
+ v1.y % T(v2.y),
+ v1.z % T(v2.z));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec3<T> operator&
+ (
+ tvec3<T> const & v,
+ T const & s
+ )
+ {
+ return tvec3<T>(
+ v.x & T(s),
+ v.y & T(s),
+ v.z & T(s));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec3<T> operator&
+ (
+ T const & s,
+ tvec3<T> const & v
+ )
+ {
+ return tvec3<T>(
+ T(s) & v.x,
+ T(s) & v.y,
+ T(s) & v.z);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec3<T> operator&
+ (
+ tvec3<T> const & v1,
+ tvec3<T> const & v2
+ )
+ {
+ return tvec3<T>(
+ v1.x & T(v2.x),
+ v1.y & T(v2.y),
+ v1.z & T(v2.z));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec3<T> operator|
+ (
+ tvec3<T> const & v,
+ T const & s
+ )
+ {
+ return tvec3<T>(
+ v.x | T(s),
+ v.y | T(s),
+ v.z | T(s));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec3<T> operator|
+ (
+ T const & s,
+ tvec3<T> const & v
+ )
+ {
+ return tvec3<T>(
+ T(s) | v.x,
+ T(s) | v.y,
+ T(s) | v.z);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec3<T> operator|
+ (
+ tvec3<T> const & v1,
+ tvec3<T> const & v2
+ )
+ {
+ return tvec3<T>(
+ v1.x | T(v2.x),
+ v1.y | T(v2.y),
+ v1.z | T(v2.z));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec3<T> operator^
+ (
+ tvec3<T> const & v,
+ T const & s
+ )
+ {
+ return tvec3<T>(
+ v.x ^ T(s),
+ v.y ^ T(s),
+ v.z ^ T(s));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec3<T> operator^
+ (
+ T const & s,
+ tvec3<T> const & v
+ )
+ {
+ return tvec3<T>(
+ T(s) ^ v.x,
+ T(s) ^ v.y,
+ T(s) ^ v.z);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec3<T> operator^
+ (
+ tvec3<T> const & v1,
+ tvec3<T> const & v2
+ )
+ {
+ return tvec3<T>(
+ v1.x ^ T(v2.x),
+ v1.y ^ T(v2.y),
+ v1.z ^ T(v2.z));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec3<T> operator<<
+ (
+ tvec3<T> const & v,
+ T const & s
+ )
+ {
+ return tvec3<T>(
+ v.x << T(s),
+ v.y << T(s),
+ v.z << T(s));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec3<T> operator<<
+ (
+ T const & s,
+ tvec3<T> const & v
+ )
+ {
+ return tvec3<T>(
+ T(s) << v.x,
+ T(s) << v.y,
+ T(s) << v.z);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec3<T> operator<<
+ (
+ tvec3<T> const & v1,
+ tvec3<T> const & v2
+ )
+ {
+ return tvec3<T>(
+ v1.x << T(v2.x),
+ v1.y << T(v2.y),
+ v1.z << T(v2.z));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec3<T> operator>>
+ (
+ tvec3<T> const & v,
+ T const & s
+ )
+ {
+ return tvec3<T>(
+ v.x >> T(s),
+ v.y >> T(s),
+ v.z >> T(s));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec3<T> operator>>
+ (
+ T const & s,
+ tvec3<T> const & v
+ )
+ {
+ return tvec3<T>(
+ s >> T(v.x),
+ s >> T(v.y),
+ s >> T(v.z));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec3<T> operator>>
+ (
+ tvec3<T> const & v1,
+ tvec3<T> const & v2
+ )
+ {
+ return tvec3<T>(
+ v1.x >> T(v2.x),
+ v1.y >> T(v2.y),
+ v1.z >> T(v2.z));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec3<T> operator~
+ (
+ tvec3<T> const & v
+ )
+ {
+ return tvec3<T>(
+ ~v.x,
+ ~v.y,
+ ~v.z);
+ }
+
+ //////////////////////////////////////
+ // tref definition
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tref3<T>::tref3(T & x, T & y, T & z) :
+ x(x),
+ y(y),
+ z(z)
+ {}
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tref3<T>::tref3
+ (
+ tref3<T> const & r
+ ) :
+ x(r.x),
+ y(r.y),
+ z(r.z)
+ {}
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tref3<T>::tref3
+ (
+ tvec3<T> const & v
+ ) :
+ x(v.x),
+ y(v.y),
+ z(v.z)
+ {}
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tref3<T> & tref3<T>::operator=
+ (
+ tref3<T> const & r
+ )
+ {
+ x = r.x;
+ y = r.y;
+ z = r.z;
+ return *this;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tref3<T> & tref3<T>::operator=
+ (
+ tvec3<T> const & v
+ )
+ {
+ x = v.x;
+ y = v.y;
+ z = v.z;
+ return *this;
+ }
+
+}//namespace detail
+}//namespace glm
diff --git a/src/glm/core/type_vec4.hpp b/src/glm/core/type_vec4.hpp
new file mode 100644
index 0000000..df74e79
--- /dev/null
+++ b/src/glm/core/type_vec4.hpp
@@ -0,0 +1,282 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2008-08-22
+// Updated : 2010-02-03
+// Licence : This source is under MIT License
+// File : glm/core/type_tvec4.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_core_type_gentype4
+#define glm_core_type_gentype4
+
+#include "type_vec.hpp"
+#include "type_float.hpp"
+#include "type_int.hpp"
+#include "type_size.hpp"
+#include "_swizzle.hpp"
+
+namespace glm{
+namespace detail
+{
+ template <typename T> struct tref2;
+ template <typename T> struct tref3;
+ template <typename T> struct tref4;
+ template <typename T> struct tvec2;
+ template <typename T> struct tvec3;
+
+ ///Basic 4D vector type.
+ //! \ingroup core_template
+ template <typename T>
+ struct tvec4
+ {
+ enum ctor{null};
+
+ typedef T value_type;
+ typedef std::size_t size_type;
+ GLM_FUNC_DECL size_type length() const;
+ static GLM_FUNC_DECL size_type value_size();
+
+ typedef tvec4<T> type;
+ typedef tvec4<bool> bool_type;
+
+ //////////////////////////////////////
+ // Data
+
+# if(GLM_COMPONENT == GLM_COMPONENT_ONLY_XYZW)
+ value_type x, y, z, w;
+# elif(GLM_COMPONENT == GLM_COMPONENT_MS_EXT)
+ union
+ {
+ struct{value_type x, y, z, w;};
+ struct{value_type r, g, b, a;};
+ struct{value_type s, t, p, q;};
+ };
+# else//(GLM_COMPONENT == GLM_COMPONENT_GLSL_NAMES)
+ union {value_type x, r, s;};
+ union {value_type y, g, t;};
+ union {value_type z, b, p;};
+ union {value_type w, a, q;};
+# endif//GLM_COMPONENT
+
+ //////////////////////////////////////
+ // Accesses
+
+ GLM_FUNC_DECL value_type & operator[](size_type i);
+ GLM_FUNC_DECL value_type const & operator[](size_type i) const;
+
+ //////////////////////////////////////
+ // Implicit basic constructors
+
+ GLM_FUNC_DECL tvec4();
+ GLM_FUNC_DECL tvec4(type const & v);
+
+ //////////////////////////////////////
+ // Explicit basic constructors
+
+ GLM_FUNC_DECL explicit tvec4(
+ ctor);
+ GLM_FUNC_DECL explicit tvec4(
+ value_type const & s);
+ GLM_FUNC_DECL explicit tvec4(
+ value_type const & s0,
+ value_type const & s1,
+ value_type const & s2,
+ value_type const & s3);
+
+ //////////////////////////////////////
+ // Swizzle constructors
+
+ GLM_FUNC_DECL tvec4(tref4<T> const & r);
+
+ //////////////////////////////////////
+ // Convertion scalar constructors
+
+ //! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
+ template <typename U>
+ GLM_FUNC_DECL explicit tvec4(
+ U const & x);
+ //! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
+ template <typename A, typename B, typename C, typename D>
+ GLM_FUNC_DECL explicit tvec4(
+ A const & x,
+ B const & y,
+ C const & z,
+ D const & w);
+
+ //////////////////////////////////////
+ // Convertion vector constructors
+
+ //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
+ template <typename A, typename B, typename C>
+ GLM_FUNC_DECL explicit tvec4(tvec2<A> const & v, B const & s1, C const & s2);
+ //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
+ template <typename A, typename B, typename C>
+ GLM_FUNC_DECL explicit tvec4(A const & s1, tvec2<B> const & v, C const & s2);
+ //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
+ template <typename A, typename B, typename C>
+ GLM_FUNC_DECL explicit tvec4(A const & s1, B const & s2, tvec2<C> const & v);
+ //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
+ template <typename A, typename B>
+ GLM_FUNC_DECL explicit tvec4(tvec3<A> const & v, B const & s);
+ //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
+ template <typename A, typename B>
+ GLM_FUNC_DECL explicit tvec4(A const & s, tvec3<B> const & v);
+ //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
+ template <typename A, typename B>
+ GLM_FUNC_DECL explicit tvec4(tvec2<A> const & v1, tvec2<B> const & v2);
+ //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
+ template <typename U>
+ GLM_FUNC_DECL explicit tvec4(tvec4<U> const & v);
+
+ //////////////////////////////////////
+ // Unary arithmetic operators
+
+ GLM_FUNC_DECL tvec4<T> & operator= (tvec4<T> const & v);
+ template <typename U>
+ GLM_FUNC_DECL tvec4<T> & operator= (tvec4<U> const & v);
+
+ template <typename U>
+ GLM_FUNC_DECL tvec4<T> & operator+=(U const & s);
+ template <typename U>
+ GLM_FUNC_DECL tvec4<T> & operator+=(tvec4<U> const & v);
+ template <typename U>
+ GLM_FUNC_DECL tvec4<T> & operator-=(U const & s);
+ template <typename U>
+ GLM_FUNC_DECL tvec4<T> & operator-=(tvec4<U> const & v);
+ template <typename U>
+ GLM_FUNC_DECL tvec4<T> & operator*=(U const & s);
+ template <typename U>
+ GLM_FUNC_DECL tvec4<T> & operator*=(tvec4<U> const & v);
+ template <typename U>
+ GLM_FUNC_DECL tvec4<T> & operator/=(U const & s);
+ template <typename U>
+ GLM_FUNC_DECL tvec4<T> & operator/=(tvec4<U> const & v);
+ GLM_FUNC_DECL tvec4<T> & operator++();
+ GLM_FUNC_DECL tvec4<T> & operator--();
+
+ //////////////////////////////////////
+ // Unary bit operators
+
+ template <typename U>
+ GLM_FUNC_DECL tvec4<T> & operator%= (U const & s);
+ template <typename U>
+ GLM_FUNC_DECL tvec4<T> & operator%= (tvec4<U> const & v);
+ template <typename U>
+ GLM_FUNC_DECL tvec4<T> & operator&= (U const & s);
+ template <typename U>
+ GLM_FUNC_DECL tvec4<T> & operator&= (tvec4<U> const & v);
+ template <typename U>
+ GLM_FUNC_DECL tvec4<T> & operator|= (U const & s);
+ template <typename U>
+ GLM_FUNC_DECL tvec4<T> & operator|= (tvec4<U> const & v);
+ template <typename U>
+ GLM_FUNC_DECL tvec4<T> & operator^= (U const & s);
+ template <typename U>
+ GLM_FUNC_DECL tvec4<T> & operator^= (tvec4<U> const & v);
+ template <typename U>
+ GLM_FUNC_DECL tvec4<T> & operator<<=(U const & s);
+ template <typename U>
+ GLM_FUNC_DECL tvec4<T> & operator<<=(tvec4<U> const & v);
+ template <typename U>
+ GLM_FUNC_DECL tvec4<T> & operator>>=(U const & s);
+ template <typename U>
+ GLM_FUNC_DECL tvec4<T> & operator>>=(tvec4<U> const & v);
+
+ //////////////////////////////////////
+ // Swizzle operators
+
+ GLM_FUNC_DECL value_type swizzle(comp X) const;
+ GLM_FUNC_DECL tvec2<T> swizzle(comp X, comp Y) const;
+ GLM_FUNC_DECL tvec3<T> swizzle(comp X, comp Y, comp Z) const;
+ GLM_FUNC_DECL tvec4<T> swizzle(comp X, comp Y, comp Z, comp W) const;
+ GLM_FUNC_DECL tref4<T> swizzle(comp X, comp Y, comp Z, comp W);
+ };
+
+ template <typename T>
+ struct tref4
+ {
+ GLM_FUNC_DECL tref4(T & x, T & y, T & z, T & w);
+ GLM_FUNC_DECL tref4(tref4<T> const & r);
+ GLM_FUNC_DECL tref4(tvec4<T> const & v);
+
+ GLM_FUNC_DECL tref4<T> & operator= (tref4<T> const & r);
+ GLM_FUNC_DECL tref4<T> & operator= (tvec4<T> const & v);
+
+ T & x;
+ T & y;
+ T & z;
+ T & w;
+ };
+
+ GLM_DETAIL_IS_VECTOR(tvec4);
+}//namespace detail
+
+namespace core{
+namespace type{
+namespace precision
+{
+ //! 4 components vector of high precision floating-point numbers.
+ //! There is no guarantee on the actual precision.
+ //! From GLSL 1.30.8 specification, section 4.5.2 Precision Qualifiers.
+ //! \ingroup core_precision
+ typedef detail::tvec4<highp_float> highp_vec4;
+
+ //! 4 components vector of medium precision floating-point numbers.
+ //! There is no guarantee on the actual precision.
+ //! From GLSL 1.30.8 specification, section 4.5.2 Precision Qualifiers.
+ //! \ingroup core_precision
+ typedef detail::tvec4<mediump_float> mediump_vec4;
+
+ //! 4 components vector of low precision floating-point numbers.
+ //! There is no guarantee on the actual precision.
+ //! From GLSL 1.30.8 specification, section 4.5.2 Precision Qualifiers.
+ //! \ingroup core_precision
+ typedef detail::tvec4<lowp_float> lowp_vec4;
+
+ //! 4 components vector of high precision signed integer numbers.
+ //! There is no guarantee on the actual precision.
+ //! From GLSL 1.30.8 specification, section 4.1.5 Precision Qualifiers.
+ //! \ingroup core_precision
+ typedef detail::tvec4<highp_int> highp_ivec4;
+
+ //! 4 components vector of medium precision signed integer numbers.
+ //! There is no guarantee on the actual precision.
+ //! From GLSL 1.30.8 specification, section 4.1.5 Precision Qualifiers.
+ //! \ingroup core_precision
+ typedef detail::tvec4<mediump_int> mediump_ivec4;
+
+ //! 4 components vector of low precision signed integer numbers.
+ //! There is no guarantee on the actual precision.
+ //! From GLSL 1.30.8 specification, section 4.1.5 Precision Qualifiers.
+ //! \ingroup core_precision
+ typedef detail::tvec4<lowp_int> lowp_ivec4;
+
+ //! 4 components vector of high precision unsigned integer numbers.
+ //! There is no guarantee on the actual precision.
+ //! From GLSL 1.30.8 specification, section 4.1.5 Precision Qualifiers.
+ //! \ingroup core_precision
+ typedef detail::tvec4<highp_uint> highp_uvec4;
+
+ //! 4 components vector of medium precision unsigned integer numbers.
+ //! There is no guarantee on the actual precision.
+ //! From GLSL 1.30.8 specification, section 4.1.5 Precision Qualifiers.
+ //! \ingroup core_precision
+ typedef detail::tvec4<mediump_uint> mediump_uvec4;
+
+ //! 4 components vector of low precision unsigned integer numbers.
+ //! There is no guarantee on the actual precision.
+ //! From GLSL 1.30.8 specification, section 4.1.5 Precision Qualifiers.
+ //! \ingroup core_precision
+ typedef detail::tvec4<lowp_uint> lowp_uvec4;
+
+}//namespace precision
+}//namespace type
+}//namespace core
+}//namespace glm
+
+#ifndef GLM_EXTERNAL_TEMPLATE
+#include "type_vec4.inl"
+#endif//GLM_EXTERNAL_TEMPLATE
+
+#endif//glm_core_type_gentype4
diff --git a/src/glm/core/type_vec4.inl b/src/glm/core/type_vec4.inl
new file mode 100644
index 0000000..6d96ab8
--- /dev/null
+++ b/src/glm/core/type_vec4.inl
@@ -0,0 +1,1226 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2008-08-23
+// Updated : 2010-02-05
+// Licence : This source is under MIT License
+// File : glm/core/type_tvec4.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm{
+namespace detail
+{
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tvec4<T>::size_type tvec4<T>::length() const
+ {
+ return 4;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tvec4<T>::size_type tvec4<T>::value_size()
+ {
+ return 4;
+ }
+
+ //////////////////////////////////////
+ // Accesses
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tvec4<T>::value_type &
+ tvec4<T>::operator[]
+ (
+ size_type i
+ )
+ {
+ assert(i < value_size());
+ return (&x)[i];
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tvec4<T>::value_type const &
+ tvec4<T>::operator[]
+ (
+ size_type i
+ ) const
+ {
+ assert(i < value_size());
+ return (&x)[i];
+ }
+
+ //////////////////////////////////////
+ // Implicit basic constructors
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec4<T>::tvec4() :
+ x(value_type(0)),
+ y(value_type(0)),
+ z(value_type(0)),
+ w(value_type(0))
+ {}
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec4<T>::tvec4
+ (
+ ctor
+ )
+ {}
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec4<T>::tvec4
+ (
+ type const & v
+ ) :
+ x(v.x),
+ y(v.y),
+ z(v.z),
+ w(v.w)
+ {}
+
+ //////////////////////////////////////
+ // Explicit basic constructors
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec4<T>::tvec4
+ (
+ value_type const & s
+ ) :
+ x(s),
+ y(s),
+ z(s),
+ w(s)
+ {}
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec4<T>::tvec4
+ (
+ value_type const & s1,
+ value_type const & s2,
+ value_type const & s3,
+ value_type const & s4
+ ) :
+ x(s1),
+ y(s2),
+ z(s3),
+ w(s4)
+ {}
+
+ //////////////////////////////////////
+ // Swizzle constructors
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec4<T>::tvec4
+ (
+ tref4<T> const & r
+ ) :
+ x(r.x),
+ y(r.y),
+ z(r.z),
+ w(r.w)
+ {}
+
+ //////////////////////////////////////
+ // Convertion scalar constructors
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec4<T>::tvec4
+ (
+ U const & x
+ ) :
+ x(value_type(x)),
+ y(value_type(x)),
+ z(value_type(x)),
+ w(value_type(x))
+ {}
+
+ template <typename T>
+ template <typename A, typename B, typename C, typename D>
+ GLM_FUNC_QUALIFIER tvec4<T>::tvec4
+ (
+ A const & x,
+ B const & y,
+ C const & z,
+ D const & w
+ ) :
+ x(value_type(x)),
+ y(value_type(y)),
+ z(value_type(z)),
+ w(value_type(w))
+ {}
+
+ //////////////////////////////////////
+ // Convertion vector constructors
+
+ template <typename T>
+ template <typename A, typename B, typename C>
+ GLM_FUNC_QUALIFIER tvec4<T>::tvec4
+ (
+ tvec2<A> const & v,
+ B const & s1,
+ C const & s2
+ ) :
+ x(value_type(v.x)),
+ y(value_type(v.y)),
+ z(value_type(s1)),
+ w(value_type(s2))
+ {}
+
+ template <typename T>
+ template <typename A, typename B, typename C>
+ GLM_FUNC_QUALIFIER tvec4<T>::tvec4
+ (
+ A const & s1,
+ tvec2<B> const & v,
+ C const & s2
+ ) :
+ x(value_type(s1)),
+ y(value_type(v.x)),
+ z(value_type(v.y)),
+ w(value_type(s2))
+ {}
+
+ template <typename T>
+ template <typename A, typename B, typename C>
+ GLM_FUNC_QUALIFIER tvec4<T>::tvec4
+ (
+ A const & s1,
+ B const & s2,
+ tvec2<C> const & v
+ ) :
+ x(value_type(s1)),
+ y(value_type(s2)),
+ z(value_type(v.x)),
+ w(value_type(v.y))
+ {}
+
+ template <typename T>
+ template <typename A, typename B>
+ GLM_FUNC_QUALIFIER tvec4<T>::tvec4
+ (
+ tvec3<A> const & v,
+ B const & s
+ ) :
+ x(value_type(v.x)),
+ y(value_type(v.y)),
+ z(value_type(v.z)),
+ w(value_type(s))
+ {}
+
+ template <typename T>
+ template <typename A, typename B>
+ GLM_FUNC_QUALIFIER tvec4<T>::tvec4
+ (
+ A const & s,
+ tvec3<B> const & v
+ ) :
+ x(value_type(s)),
+ y(value_type(v.x)),
+ z(value_type(v.y)),
+ w(value_type(v.z))
+ {}
+
+ template <typename T>
+ template <typename A, typename B>
+ GLM_FUNC_QUALIFIER tvec4<T>::tvec4
+ (
+ tvec2<A> const & v1,
+ tvec2<B> const & v2
+ ) :
+ x(value_type(v1.x)),
+ y(value_type(v1.y)),
+ z(value_type(v2.x)),
+ w(value_type(v2.y))
+ {}
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec4<T>::tvec4
+ (
+ tvec4<U> const & v
+ ) :
+ x(value_type(v.x)),
+ y(value_type(v.y)),
+ z(value_type(v.z)),
+ w(value_type(v.w))
+ {}
+
+ //////////////////////////////////////
+ // Unary arithmetic operators
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec4<T> & tvec4<T>::operator=
+ (
+ tvec4<T> const & v
+ )
+ {
+ this->x = v.x;
+ this->y = v.y;
+ this->z = v.z;
+ this->w = v.w;
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec4<T> & tvec4<T>::operator=
+ (
+ tvec4<U> const & v
+ )
+ {
+ this->x = T(v.x);
+ this->y = T(v.y);
+ this->z = T(v.z);
+ this->w = T(v.w);
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec4<T> & tvec4<T>::operator+=
+ (
+ U const & s
+ )
+ {
+ this->x += T(s);
+ this->y += T(s);
+ this->z += T(s);
+ this->w += T(s);
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec4<T> & tvec4<T>::operator+=
+ (
+ tvec4<U> const & v
+ )
+ {
+ this->x += T(v.x);
+ this->y += T(v.y);
+ this->z += T(v.z);
+ this->w += T(v.w);
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec4<T> & tvec4<T>::operator-=
+ (
+ U const & s
+ )
+ {
+ this->x -= T(s);
+ this->y -= T(s);
+ this->z -= T(s);
+ this->w -= T(s);
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec4<T> & tvec4<T>::operator-=
+ (
+ tvec4<U> const & v
+ )
+ {
+ this->x -= T(v.x);
+ this->y -= T(v.y);
+ this->z -= T(v.z);
+ this->w -= T(v.w);
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec4<T> & tvec4<T>::operator*=
+ (
+ U const & s
+ )
+ {
+ this->x *= T(s);
+ this->y *= T(s);
+ this->z *= T(s);
+ this->w *= T(s);
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec4<T> & tvec4<T>::operator*=
+ (
+ tvec4<U> const & v
+ )
+ {
+ this->x *= T(v.x);
+ this->y *= T(v.y);
+ this->z *= T(v.z);
+ this->w *= T(v.w);
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec4<T> & tvec4<T>::operator/=
+ (
+ U const & s
+ )
+ {
+ this->x /= T(s);
+ this->y /= T(s);
+ this->z /= T(s);
+ this->w /= T(s);
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec4<T> & tvec4<T>::operator/=
+ (
+ tvec4<U> const & v
+ )
+ {
+ this->x /= T(v.x);
+ this->y /= T(v.y);
+ this->z /= T(v.z);
+ this->w /= T(v.w);
+ return *this;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec4<T> & tvec4<T>::operator++()
+ {
+ ++this->x;
+ ++this->y;
+ ++this->z;
+ ++this->w;
+ return *this;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec4<T> & tvec4<T>::operator--()
+ {
+ --this->x;
+ --this->y;
+ --this->z;
+ --this->w;
+ return *this;
+ }
+
+ //////////////////////////////////////
+ // Unary bit operators
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec4<T> & tvec4<T>::operator%=
+ (
+ U const & s
+ )
+ {
+ this->x %= T(s);
+ this->y %= T(s);
+ this->z %= T(s);
+ this->w %= T(s);
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec4<T> & tvec4<T>::operator%=
+ (
+ tvec4<U> const & v
+ )
+ {
+ this->x %= T(v.x);
+ this->y %= T(v.y);
+ this->z %= T(v.z);
+ this->w %= T(v.w);
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec4<T> & tvec4<T>::operator&=
+ (
+ U const & s
+ )
+ {
+ this->x &= T(s);
+ this->y &= T(s);
+ this->z &= T(s);
+ this->w &= T(s);
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec4<T> & tvec4<T>::operator&=
+ (
+ tvec4<U> const & v
+ )
+ {
+ this->x &= T(v.x);
+ this->y &= T(v.y);
+ this->z &= T(v.z);
+ this->w &= T(v.w);
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec4<T> & tvec4<T>::operator|=
+ (
+ U const & s
+ )
+ {
+ this->x |= T(s);
+ this->y |= T(s);
+ this->z |= T(s);
+ this->w |= T(s);
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec4<T> & tvec4<T>::operator|=
+ (
+ tvec4<U> const & v
+ )
+ {
+ this->x |= T(v.x);
+ this->y |= T(v.y);
+ this->z |= T(v.z);
+ this->w |= T(v.w);
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec4<T> & tvec4<T>::operator^=
+ (
+ U const & s
+ )
+ {
+ this->x ^= T(s);
+ this->y ^= T(s);
+ this->z ^= T(s);
+ this->w ^= T(s);
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec4<T> & tvec4<T>::operator^=
+ (
+ tvec4<U> const & v
+ )
+ {
+ this->x ^= T(v.x);
+ this->y ^= T(v.y);
+ this->z ^= T(v.z);
+ this->w ^= T(v.w);
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec4<T> & tvec4<T>::operator<<=
+ (
+ U const & s
+ )
+ {
+ this->x <<= T(s);
+ this->y <<= T(s);
+ this->z <<= T(s);
+ this->w <<= T(s);
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec4<T> & tvec4<T>::operator<<=
+ (
+ tvec4<U> const & v
+ )
+ {
+ this->x <<= T(v.x);
+ this->y <<= T(v.y);
+ this->z <<= T(v.z);
+ this->w <<= T(v.w);
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec4<T> & tvec4<T>::operator>>=
+ (
+ U const & s
+ )
+ {
+ this->x >>= T(s);
+ this->y >>= T(s);
+ this->z >>= T(s);
+ this->w >>= T(s);
+ return *this;
+ }
+
+ template <typename T>
+ template <typename U>
+ GLM_FUNC_QUALIFIER tvec4<T> & tvec4<T>::operator>>=
+ (
+ tvec4<U> const & v
+ )
+ {
+ this->x >>= T(v.x);
+ this->y >>= T(v.y);
+ this->z >>= T(v.z);
+ this->w >>= T(v.w);
+ return *this;
+ }
+
+ //////////////////////////////////////
+ // Swizzle operators
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tvec4<T>::value_type
+ tvec4<T>::swizzle
+ (
+ comp x
+ ) const
+ {
+ return (*this)[x];
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec2<T> tvec4<T>::swizzle
+ (
+ comp x,
+ comp y
+ ) const
+ {
+ return tvec2<T>(
+ (*this)[x],
+ (*this)[y]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec3<T> tvec4<T>::swizzle
+ (
+ comp x,
+ comp y,
+ comp z
+ ) const
+ {
+ return tvec3<T>(
+ (*this)[x],
+ (*this)[y],
+ (*this)[z]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec4<T> tvec4<T>::swizzle
+ (
+ comp x,
+ comp y,
+ comp z,
+ comp w
+ ) const
+ {
+ return tvec4<T>(
+ (*this)[x],
+ (*this)[y],
+ (*this)[z],
+ (*this)[w]);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tref4<T> tvec4<T>::swizzle
+ (
+ comp x,
+ comp y,
+ comp z,
+ comp w
+ )
+ {
+ return tref4<T>(
+ (*this)[x],
+ (*this)[y],
+ (*this)[z],
+ (*this)[w]);
+ }
+
+ //////////////////////////////////////
+ // Binary arithmetic operators
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec4<T> operator+
+ (
+ tvec4<T> const & v,
+ typename tvec4<T>::value_type const & s
+ )
+ {
+ return tvec4<T>(
+ v.x + s,
+ v.y + s,
+ v.z + s,
+ v.w + s);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec4<T> operator+
+ (
+ typename tvec4<T>::value_type const & s,
+ tvec4<T> const & v
+ )
+ {
+ return tvec4<T>(
+ s + v.x,
+ s + v.y,
+ s + v.z,
+ s + v.w);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec4<T> operator+
+ (
+ tvec4<T> const & v1,
+ tvec4<T> const & v2
+ )
+ {
+ return tvec4<T>(
+ v1.x + v2.x,
+ v1.y + v2.y,
+ v1.z + v2.z,
+ v1.w + v2.w);
+ }
+
+ //operator-
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec4<T> operator-
+ (
+ tvec4<T> const & v,
+ typename tvec4<T>::value_type const & s
+ )
+ {
+ return tvec4<T>(
+ v.x - s,
+ v.y - s,
+ v.z - s,
+ v.w - s);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec4<T> operator-
+ (
+ typename tvec4<T>::value_type const & s,
+ tvec4<T> const & v
+ )
+ {
+ return tvec4<T>(
+ s - v.x,
+ s - v.y,
+ s - v.z,
+ s - v.w);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec4<T> operator-
+ (
+ tvec4<T> const & v1,
+ tvec4<T> const & v2
+ )
+ {
+ return tvec4<T>(
+ v1.x - v2.x,
+ v1.y - v2.y,
+ v1.z - v2.z,
+ v1.w - v2.w);
+ }
+
+ //operator*
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec4<T> operator*
+ (
+ tvec4<T> const & v,
+ typename tvec4<T>::value_type const & s
+ )
+ {
+ return tvec4<T>(
+ v.x * s,
+ v.y * s,
+ v.z * s,
+ v.w * s);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec4<T> operator*
+ (
+ typename tvec4<T>::value_type const & s,
+ tvec4<T> const & v
+ )
+ {
+ return tvec4<T>(
+ s * v.x,
+ s * v.y,
+ s * v.z,
+ s * v.w);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec4<T> operator*
+ (
+ tvec4<T> const & v1,
+ tvec4<T> const & v2
+ )
+ {
+ return tvec4<T>(
+ v1.x * v2.x,
+ v1.y * v2.y,
+ v1.z * v2.z,
+ v1.w * v2.w);
+ }
+
+ //operator/
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec4<T> operator/
+ (
+ tvec4<T> const & v,
+ typename tvec4<T>::value_type const & s
+ )
+ {
+ return tvec4<T>(
+ v.x / s,
+ v.y / s,
+ v.z / s,
+ v.w / s);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec4<T> operator/
+ (
+ typename tvec4<T>::value_type const & s,
+ tvec4<T> const & v
+ )
+ {
+ return tvec4<T>(
+ s / v.x,
+ s / v.y,
+ s / v.z,
+ s / v.w);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec4<T> operator/
+ (
+ tvec4<T> const & v1,
+ tvec4<T> const & v2
+ )
+ {
+ return tvec4<T>(
+ v1.x / v2.x,
+ v1.y / v2.y,
+ v1.z / v2.z,
+ v1.w / v2.w);
+ }
+
+ // Unary constant operators
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec4<T> operator-
+ (
+ tvec4<T> const & v
+ )
+ {
+ return tvec4<T>(
+ -v.x,
+ -v.y,
+ -v.z,
+ -v.w);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec4<T> operator++
+ (
+ tvec4<T> const & v,
+ int
+ )
+ {
+ typename tvec4<T>::value_type One(1);
+ return tvec4<T>(
+ v.x + One,
+ v.y + One,
+ v.z + One,
+ v.w + One);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec4<T> operator--
+ (
+ tvec4<T> const & v,
+ int
+ )
+ {
+ typename tvec4<T>::value_type One(1);
+ return tvec4<T>(
+ v.x - One,
+ v.y - One,
+ v.z - One,
+ v.w - One);
+ }
+
+ //////////////////////////////////////
+ // Boolean operators
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER bool operator==
+ (
+ tvec4<T> const & v1,
+ tvec4<T> const & v2
+ )
+ {
+ return (v1.x == v2.x) && (v1.y == v2.y) && (v1.z == v2.z) && (v1.w == v2.w);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER bool operator!=
+ (
+ tvec4<T> const & v1,
+ tvec4<T> const & v2
+ )
+ {
+ return (v1.x != v2.x) || (v1.y != v2.y) || (v1.z != v2.z) || (v1.w != v2.w);
+ }
+
+ //////////////////////////////////////
+ // Binary bit operators
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec4<T> operator%
+ (
+ tvec4<T> const & v,
+ typename tvec4<T>::value_type const & s
+ )
+ {
+ return tvec4<T>(
+ v.x % s,
+ v.y % s,
+ v.z % s,
+ v.w % s);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec4<T> operator%
+ (
+ typename tvec4<T>::value_type const & s,
+ tvec4<T> const & v
+ )
+ {
+ return tvec4<T>(
+ s % v.x,
+ s % v.y,
+ s % v.z,
+ s % v.w);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec4<T> operator%
+ (
+ tvec4<T> const & v1,
+ tvec4<T> const & v2
+ )
+ {
+ return tvec4<T>(
+ v1.x % v2.x,
+ v1.y % v2.y,
+ v1.z % v2.z,
+ v1.w % v2.w);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec4<T> operator&
+ (
+ tvec4<T> const & v,
+ typename tvec4<T>::value_type const & s
+ )
+ {
+ return tvec4<T>(
+ v.x & s,
+ v.y & s,
+ v.z & s,
+ v.w & s);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec4<T> operator&
+ (
+ typename tvec4<T>::value_type const & s,
+ tvec4<T> const & v
+ )
+ {
+ return tvec4<T>(
+ s & v.x,
+ s & v.y,
+ s & v.z,
+ s & v.w);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec4<T> operator&
+ (
+ tvec4<T> const & v1,
+ tvec4<T> const & v2
+ )
+ {
+ return tvec4<T>(
+ v1.x & v2.x,
+ v1.y & v2.y,
+ v1.z & v2.z,
+ v1.w & v2.w);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec4<T> operator|
+ (
+ tvec4<T> const & v,
+ typename tvec4<T>::value_type const & s
+ )
+ {
+ return tvec4<T>(
+ v.x | s,
+ v.y | s,
+ v.z | s,
+ v.w | s);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec4<T> operator|
+ (
+ typename tvec4<T>::value_type const & s,
+ tvec4<T> const & v
+ )
+ {
+ return tvec4<T>(
+ s | v.x,
+ s | v.y,
+ s | v.z,
+ s | v.w);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec4<T> operator|
+ (
+ tvec4<T> const & v1,
+ tvec4<T> const & v2
+ )
+ {
+ return tvec4<T>(
+ v1.x | v2.x,
+ v1.y | v2.y,
+ v1.z | v2.z,
+ v1.w | v2.w);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec4<T> operator^
+ (
+ tvec4<T> const & v,
+ typename tvec4<T>::value_type const & s
+ )
+ {
+ return tvec4<T>(
+ v.x ^ s,
+ v.y ^ s,
+ v.z ^ s,
+ v.w ^ s);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec4<T> operator^
+ (
+ typename tvec4<T>::value_type const & s,
+ tvec4<T> const & v
+ )
+ {
+ return tvec4<T>(
+ s ^ v.x,
+ s ^ v.y,
+ s ^ v.z,
+ s ^ v.w);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec4<T> operator^
+ (
+ tvec4<T> const & v1,
+ tvec4<T> const & v2
+ )
+ {
+ return tvec4<T>(
+ v1.x ^ v2.x,
+ v1.y ^ v2.y,
+ v1.z ^ v2.z,
+ v1.w ^ v2.w);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec4<T> operator<<
+ (
+ tvec4<T> const & v,
+ typename tvec4<T>::value_type const & s
+ )
+ {
+ return tvec4<T>(
+ v.x << s,
+ v.y << s,
+ v.z << s,
+ v.w << s);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec4<T> operator<<
+ (
+ typename tvec4<T>::value_type const & s,
+ tvec4<T> const & v
+ )
+ {
+ return tvec4<T>(
+ s << v.x,
+ s << v.y,
+ s << v.z,
+ s << v.w);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec4<T> operator<<
+ (
+ tvec4<T> const & v1,
+ tvec4<T> const & v2
+ )
+ {
+ return tvec4<T>(
+ v1.x << v2.x,
+ v1.y << v2.y,
+ v1.z << v2.z,
+ v1.w << v2.w);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec4<T> operator>>
+ (
+ tvec4<T> const & v,
+ typename tvec4<T>::value_type const & s
+ )
+ {
+ return tvec4<T>(
+ v.x >> s,
+ v.y >> s,
+ v.z >> s,
+ v.w >> s);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec4<T> operator>>
+ (
+ typename tvec4<T>::value_type const & s,
+ tvec4<T> const & v
+ )
+ {
+ return tvec4<T>(
+ s >> v.x,
+ s >> v.y,
+ s >> v.z,
+ s >> v.w);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec4<T> operator>>
+ (
+ tvec4<T> const & v1,
+ tvec4<T> const & v2
+ )
+ {
+ return tvec4<T>(
+ v1.x >> v2.x,
+ v1.y >> v2.y,
+ v1.z >> v2.z,
+ v1.w >> v2.w);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tvec4<T> operator~
+ (
+ tvec4<T> const & v
+ )
+ {
+ return tvec4<T>(
+ ~v.x,
+ ~v.y,
+ ~v.z,
+ ~v.w);
+ }
+
+ //////////////////////////////////////
+ // tref definition
+
+ template <typename T>
+ tref4<T>::tref4
+ (
+ T & x,
+ T & y,
+ T & z,
+ T & w
+ ) :
+ x(x),
+ y(y),
+ z(z),
+ w(w)
+ {}
+
+ template <typename T>
+ tref4<T>::tref4
+ (
+ tref4<T> const & r
+ ) :
+ x(r.x),
+ y(r.y),
+ z(r.z),
+ w(r.w)
+ {}
+
+ template <typename T>
+ tref4<T>::tref4
+ (
+ tvec4<T> const & v
+ ) :
+ x(v.x),
+ y(v.y),
+ z(v.z),
+ w(v.w)
+ {}
+
+ template <typename T>
+ tref4<T>& tref4<T>::operator=
+ (
+ tref4<T> const & r
+ )
+ {
+ x = r.x;
+ y = r.y;
+ z = r.z;
+ w = r.w;
+ return *this;
+ }
+
+ template <typename T>
+ tref4<T>& tref4<T>::operator=
+ (
+ tvec4<T> const & v
+ )
+ {
+ x = v.x;
+ y = v.y;
+ z = v.z;
+ w = v.w;
+ return *this;
+ }
+
+}//namespace detail
+}//namespace glm
diff --git a/src/glm/ext.hpp b/src/glm/ext.hpp
new file mode 100644
index 0000000..8dd89fa
--- /dev/null
+++ b/src/glm/ext.hpp
@@ -0,0 +1,97 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2009-05-01
+// Updated : 2010-12-13
+// Licence : This source is under MIT License
+// File : glm/ext.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_ext
+#define glm_ext
+
+#if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_EXT_INCLUDED_DISPLAYED))
+# define GLM_MESSAGE_EXT_INCLUDED_DISPLAYED
+# pragma message("GLM: All extensions included (not recommanded)")
+#endif//GLM_MESSAGES
+
+#include "./gtc/half_float.hpp"
+#include "./gtc/matrix_access.hpp"
+#include "./gtc/matrix_integer.hpp"
+#include "./gtc/matrix_inverse.hpp"
+#include "./gtc/matrix_transform.hpp"
+#include "./gtc/quaternion.hpp"
+#include "./gtc/swizzle.hpp"
+#include "./gtc/type_precision.hpp"
+#include "./gtc/type_ptr.hpp"
+
+#include "./gtx/associated_min_max.hpp"
+#include "./gtx/bit.hpp"
+#include "./gtx/closest_point.hpp"
+#include "./gtx/color_cast.hpp"
+#include "./gtx/color_space.hpp"
+#include "./gtx/color_space_YCoCg.hpp"
+#include "./gtx/compatibility.hpp"
+#include "./gtx/component_wise.hpp"
+#include "./gtx/epsilon.hpp"
+#include "./gtx/euler_angles.hpp"
+#include "./gtx/extend.hpp"
+#include "./gtx/extented_min_max.hpp"
+#include "./gtx/fast_exponential.hpp"
+#include "./gtx/fast_square_root.hpp"
+#include "./gtx/fast_trigonometry.hpp"
+#include "./gtx/gradient_paint.hpp"
+#include "./gtx/handed_coordinate_space.hpp"
+#include "./gtx/inertia.hpp"
+#include "./gtx/int_10_10_10_2.hpp"
+#include "./gtx/integer.hpp"
+#include "./gtx/intersect.hpp"
+#include "./gtx/log_base.hpp"
+#include "./gtx/matrix_cross_product.hpp"
+#include "./gtx/matrix_interpolation.hpp"
+#include "./gtx/matrix_major_storage.hpp"
+#include "./gtx/matrix_operation.hpp"
+#include "./gtx/matrix_query.hpp"
+#include "./gtx/mixed_product.hpp"
+#include "./gtx/multiple.hpp"
+#include "./gtx/noise.hpp"
+#include "./gtx/norm.hpp"
+#include "./gtx/normal.hpp"
+#include "./gtx/normalize_dot.hpp"
+#include "./gtx/number_precision.hpp"
+#include "./gtx/ocl_type.hpp"
+#include "./gtx/optimum_pow.hpp"
+#include "./gtx/orthonormalize.hpp"
+#include "./gtx/perpendicular.hpp"
+#include "./gtx/polar_coordinates.hpp"
+#include "./gtx/projection.hpp"
+#include "./gtx/quaternion.hpp"
+#include "./gtx/random.hpp"
+#include "./gtx/raw_data.hpp"
+#include "./gtx/reciprocal.hpp"
+#include "./gtx/rotate_vector.hpp"
+#include "./gtx/spline.hpp"
+#include "./gtx/std_based_type.hpp"
+#include "./gtx/string_cast.hpp"
+#include "./gtx/transform.hpp"
+#include "./gtx/transform2.hpp"
+#include "./gtx/ulp.hpp"
+#include "./gtx/unsigned_int.hpp"
+#include "./gtx/vec1.hpp"
+#include "./gtx/vector_access.hpp"
+#include "./gtx/vector_angle.hpp"
+#include "./gtx/vector_query.hpp"
+#include "./gtx/verbose_operator.hpp"
+#include "./gtx/wrap.hpp"
+
+#if(GLM_ARCH & GLM_ARCH_SSE2)
+# include "./gtx/simd_vec4.hpp"
+# include "./gtx/simd_mat4.hpp"
+#endif
+
+#include "./virtrev/xstream.hpp"
+
+//const float goldenRatio = 1.618033988749894848f;
+//const float pi = 3.141592653589793238f;
+
+#endif //glm_ext
diff --git a/src/glm/glm.hpp b/src/glm/glm.hpp
new file mode 100644
index 0000000..5fb8cce
--- /dev/null
+++ b/src/glm/glm.hpp
@@ -0,0 +1,93 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2005-01-14
+// Updated : 2011-01-19
+// Licence : This source is under MIT License
+// File : glm/glm.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include "core/_fixes.hpp"
+
+#ifndef glm_glm
+#define glm_glm
+
+#include <cmath>
+#include <climits>
+#include <cfloat>
+#include <limits>
+#include "core/setup.hpp"
+
+#if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_CORE_INCLUDED_DISPLAYED))
+# define GLM_MESSAGE_CORE_INCLUDED_DISPLAYED
+# pragma message("GLM: Core library included")
+#endif//GLM_MESSAGE
+
+//! GLM namespace, it contains all GLSL based features.
+namespace glm
+{
+ //! GLM core. Namespace that includes all the feature define by GLSL 4.10.6 specification. This namespace is included in glm namespace.
+ namespace core
+ {
+ //! Scalar, vectors and matrices
+ //! from section 4.1.2 Booleans, 4.1.3 Integers section, 4.1.4 Floats section,
+ //! 4.1.5 Vectors and section 4.1.6 Matrices of GLSL 1.30.8 specification.
+ //! This namespace resolves precision qualifier define in section 4.5 of GLSL 1.30.8 specification.
+ namespace type
+ {
+ namespace precision{}
+ }
+
+ //! Some of the functions defined in section 8 Built-in Functions of GLSL 1.30.8 specification.
+ //! Angle and trigonometry, exponential, common, geometric, matrix and vector relational functions.
+ namespace function{}
+ }//namespace core
+
+ //! G-Truc Creation stable extensions.
+ namespace gtc{}
+
+ //! G-Truc Creation experimental extensions.
+ //! The interface could change between releases.
+ namespace gtx{}
+
+ //! VIRTREV extensions.
+ namespace virtrev{}
+
+ using namespace core::type;
+ using namespace core::type::precision;
+ using namespace core::function;
+}//namespace glm
+
+#include "./core/_detail.hpp"
+#include "./core/type.hpp"
+
+#include "./core/func_trigonometric.hpp"
+#include "./core/func_exponential.hpp"
+#include "./core/func_common.hpp"
+#include "./core/func_packing.hpp"
+#include "./core/func_geometric.hpp"
+#include "./core/func_matrix.hpp"
+#include "./core/func_vector_relational.hpp"
+#include "./core/func_integer.hpp"
+#include "./core/func_noise.hpp"
+#include "./core/_swizzle.hpp"
+
+////////////////////
+// check type sizes
+#ifndef GLM_STATIC_ASSERT_NULL
+ GLM_STATIC_ASSERT(sizeof(glm::detail::int8) == 1, "int8 size isn't 1 byte on this platform");
+ GLM_STATIC_ASSERT(sizeof(glm::detail::int16) == 2, "int16 size isn't 2 bytes on this platform");
+ GLM_STATIC_ASSERT(sizeof(glm::detail::int32) == 4, "int32 size isn't 4 bytes on this platform");
+ GLM_STATIC_ASSERT(sizeof(glm::detail::int64) == 8, "int64 size isn't 8 bytes on this platform");
+
+ GLM_STATIC_ASSERT(sizeof(glm::detail::uint8) == 1, "uint8 size isn't 1 byte on this platform");
+ GLM_STATIC_ASSERT(sizeof(glm::detail::uint16) == 2, "uint16 size isn't 2 bytes on this platform");
+ GLM_STATIC_ASSERT(sizeof(glm::detail::uint32) == 4, "uint32 size isn't 4 bytes on this platform");
+ GLM_STATIC_ASSERT(sizeof(glm::detail::uint64) == 8, "uint64 size isn't 8 bytes on this platform");
+
+ GLM_STATIC_ASSERT(sizeof(glm::detail::float16) == 2, "float16 size isn't 2 bytes on this platform");
+ GLM_STATIC_ASSERT(sizeof(glm::detail::float32) == 4, "float32 size isn't 4 bytes on this platform");
+ GLM_STATIC_ASSERT(sizeof(glm::detail::float64) == 8, "float64 size isn't 8 bytes on this platform");
+#endif//GLM_STATIC_ASSERT_NULL
+
+#endif//glm_glm
diff --git a/src/glm/gtc/half_float.hpp b/src/glm/gtc/half_float.hpp
new file mode 100644
index 0000000..32f6d4b
--- /dev/null
+++ b/src/glm/gtc/half_float.hpp
@@ -0,0 +1,401 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2009-04-29
+// Updated : 2010-02-07
+// Licence : This source is under MIT License
+// File : glm/gtc/half_float.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_gtc_half_float
+#define glm_gtc_half_float
+
+// Dependency:
+#include "../glm.hpp"
+
+#if(defined(GLM_MESSAGES) && !defined(glm_ext))
+# pragma message("GLM: GLM_GTC_half_float extension included")
+#endif
+
+namespace glm{
+namespace detail
+{
+#ifndef _MSC_EXTENSIONS
+ template <>
+ struct tvec2<thalf>
+ {
+ enum ctor{null};
+ typedef thalf value_type;
+ typedef std::size_t size_type;
+ static size_type value_size();
+
+ typedef tvec2<thalf> type;
+ typedef tvec2<bool> bool_type;
+
+ //////////////////////////////////////
+ // Data
+
+ thalf x, y;
+
+ //////////////////////////////////////
+ // Accesses
+
+ thalf & operator[](size_type i);
+ thalf const & operator[](size_type i) const;
+
+ //////////////////////////////////////
+ // Implicit basic constructors
+
+ tvec2();
+ tvec2(tvec2<thalf> const & v);
+
+ //////////////////////////////////////
+ // Explicit basic constructors
+
+ explicit tvec2(ctor);
+ explicit tvec2(
+ thalf const & s);
+ explicit tvec2(
+ thalf const & s1,
+ thalf const & s2);
+
+ //////////////////////////////////////
+ // Swizzle constructors
+
+ tvec2(tref2<thalf> const & r);
+
+ //////////////////////////////////////
+ // Convertion scalar constructors
+
+ //! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
+ template <typename U>
+ explicit tvec2(U const & x);
+ //! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
+ template <typename U, typename V>
+ explicit tvec2(U const & x, V const & y);
+
+ //////////////////////////////////////
+ // Convertion vector constructors
+
+ //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
+ template <typename U>
+ explicit tvec2(tvec2<U> const & v);
+ //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
+ template <typename U>
+ explicit tvec2(tvec3<U> const & v);
+ //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
+ template <typename U>
+ explicit tvec2(tvec4<U> const & v);
+
+ //////////////////////////////////////
+ // Unary arithmetic operators
+
+ tvec2<thalf>& operator= (tvec2<thalf> const & v);
+
+ tvec2<thalf>& operator+=(thalf const & s);
+ tvec2<thalf>& operator+=(tvec2<thalf> const & v);
+ tvec2<thalf>& operator-=(thalf const & s);
+ tvec2<thalf>& operator-=(tvec2<thalf> const & v);
+ tvec2<thalf>& operator*=(thalf const & s);
+ tvec2<thalf>& operator*=(tvec2<thalf> const & v);
+ tvec2<thalf>& operator/=(thalf const & s);
+ tvec2<thalf>& operator/=(tvec2<thalf> const & v);
+ tvec2<thalf>& operator++();
+ tvec2<thalf>& operator--();
+
+ //////////////////////////////////////
+ // Swizzle operators
+
+ thalf swizzle(comp X) const;
+ tvec2<thalf> swizzle(comp X, comp Y) const;
+ tvec3<thalf> swizzle(comp X, comp Y, comp Z) const;
+ tvec4<thalf> swizzle(comp X, comp Y, comp Z, comp W) const;
+ tref2<thalf> swizzle(comp X, comp Y);
+ };
+
+ template <>
+ struct tvec3<thalf>
+ {
+ enum ctor{null};
+ typedef thalf value_type;
+ typedef std::size_t size_type;
+ static size_type value_size();
+
+ typedef tvec3<thalf> type;
+ typedef tvec3<bool> bool_type;
+
+ //////////////////////////////////////
+ // Data
+
+ thalf x, y, z;
+
+ //////////////////////////////////////
+ // Accesses
+
+ thalf & operator[](size_type i);
+ thalf const & operator[](size_type i) const;
+
+ //////////////////////////////////////
+ // Implicit basic constructors
+
+ tvec3();
+ tvec3(tvec3<thalf> const & v);
+
+ //////////////////////////////////////
+ // Explicit basic constructors
+
+ explicit tvec3(ctor);
+ explicit tvec3(
+ thalf const & s);
+ explicit tvec3(
+ thalf const & s1,
+ thalf const & s2,
+ thalf const & s3);
+
+ //////////////////////////////////////
+ // Swizzle constructors
+
+ tvec3(tref3<thalf> const & r);
+
+ //////////////////////////////////////
+ // Convertion scalar constructors
+
+ //! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
+ template <typename U>
+ explicit tvec3(U const & x);
+ //! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
+ template <typename U, typename V, typename W>
+ explicit tvec3(U const & x, V const & y, W const & z);
+
+ //////////////////////////////////////
+ // Convertion vector constructors
+
+ //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
+ template <typename A, typename B>
+ explicit tvec3(tvec2<A> const & v, B const & s);
+ //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
+ template <typename A, typename B>
+ explicit tvec3(A const & s, tvec2<B> const & v);
+ //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
+ template <typename U>
+ explicit tvec3(tvec3<U> const & v);
+ //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
+ template <typename U>
+ explicit tvec3(tvec4<U> const & v);
+
+ //////////////////////////////////////
+ // Unary arithmetic operators
+
+ tvec3<thalf>& operator= (tvec3<thalf> const & v);
+
+ tvec3<thalf>& operator+=(thalf const & s);
+ tvec3<thalf>& operator+=(tvec3<thalf> const & v);
+ tvec3<thalf>& operator-=(thalf const & s);
+ tvec3<thalf>& operator-=(tvec3<thalf> const & v);
+ tvec3<thalf>& operator*=(thalf const & s);
+ tvec3<thalf>& operator*=(tvec3<thalf> const & v);
+ tvec3<thalf>& operator/=(thalf const & s);
+ tvec3<thalf>& operator/=(tvec3<thalf> const & v);
+ tvec3<thalf>& operator++();
+ tvec3<thalf>& operator--();
+
+ //////////////////////////////////////
+ // Swizzle operators
+
+ thalf swizzle(comp X) const;
+ tvec2<thalf> swizzle(comp X, comp Y) const;
+ tvec3<thalf> swizzle(comp X, comp Y, comp Z) const;
+ tvec4<thalf> swizzle(comp X, comp Y, comp Z, comp W) const;
+ tref3<thalf> swizzle(comp X, comp Y, comp Z);
+ };
+
+ template <>
+ struct tvec4<thalf>
+ {
+ enum ctor{null};
+ typedef thalf value_type;
+ typedef std::size_t size_type;
+ static size_type value_size();
+
+ typedef tvec4<thalf> type;
+ typedef tvec4<bool> bool_type;
+
+ //////////////////////////////////////
+ // Data
+
+ thalf x, y, z, w;
+
+ //////////////////////////////////////
+ // Accesses
+
+ thalf & operator[](size_type i);
+ thalf const & operator[](size_type i) const;
+
+ //////////////////////////////////////
+ // Implicit basic constructors
+
+ tvec4();
+ tvec4(tvec4<thalf> const & v);
+
+ //////////////////////////////////////
+ // Explicit basic constructors
+
+ explicit tvec4(ctor);
+ explicit tvec4(
+ thalf const & s);
+ explicit tvec4(
+ thalf const & s0,
+ thalf const & s1,
+ thalf const & s2,
+ thalf const & s3);
+
+ //////////////////////////////////////
+ // Swizzle constructors
+
+ tvec4(tref4<thalf> const & r);
+
+ //////////////////////////////////////
+ // Convertion scalar constructors
+
+ //! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
+ template <typename U>
+ explicit tvec4(U const & x);
+ //! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
+ template <typename A, typename B, typename C, typename D>
+ explicit tvec4(A const & x, B const & y, C const & z, D const & w);
+
+ //////////////////////////////////////
+ // Convertion vector constructors
+
+ //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
+ template <typename A, typename B, typename C>
+ explicit tvec4(tvec2<A> const & v, B const & s1, C const & s2);
+ //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
+ template <typename A, typename B, typename C>
+ explicit tvec4(A const & s1, tvec2<B> const & v, C const & s2);
+ //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
+ template <typename A, typename B, typename C>
+ explicit tvec4(A const & s1, B const & s2, tvec2<C> const & v);
+ //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
+ template <typename A, typename B>
+ explicit tvec4(tvec3<A> const & v, B const & s);
+ //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
+ template <typename A, typename B>
+ explicit tvec4(A const & s, tvec3<B> const & v);
+ //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
+ template <typename A, typename B>
+ explicit tvec4(tvec2<A> const & v1, tvec2<B> const & v2);
+ //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
+ template <typename U>
+ explicit tvec4(tvec4<U> const & v);
+
+ //////////////////////////////////////
+ // Unary arithmetic operators
+
+ tvec4<thalf>& operator= (tvec4<thalf> const & v);
+
+ tvec4<thalf>& operator+=(thalf const & s);
+ tvec4<thalf>& operator+=(tvec4<thalf> const & v);
+ tvec4<thalf>& operator-=(thalf const & s);
+ tvec4<thalf>& operator-=(tvec4<thalf> const & v);
+ tvec4<thalf>& operator*=(thalf const & s);
+ tvec4<thalf>& operator*=(tvec4<thalf> const & v);
+ tvec4<thalf>& operator/=(thalf const & s);
+ tvec4<thalf>& operator/=(tvec4<thalf> const & v);
+ tvec4<thalf>& operator++();
+ tvec4<thalf>& operator--();
+
+ //////////////////////////////////////
+ // Swizzle operators
+
+ thalf swizzle(comp X) const;
+ tvec2<thalf> swizzle(comp X, comp Y) const;
+ tvec3<thalf> swizzle(comp X, comp Y, comp Z) const;
+ tvec4<thalf> swizzle(comp X, comp Y, comp Z, comp W) const;
+ tref4<thalf> swizzle(comp X, comp Y, comp Z, comp W);
+ };
+#endif//_MSC_EXTENSIONS
+}
+//namespace detail
+
+namespace gtc{
+namespace half_float ///< GLM_GTC_half_float extension: Add support for half precision floating-point types
+{
+ /// \addtogroup gtc_half_float
+ ///@{
+
+ /// Type for half-precision floating-point numbers.
+ /// From GLM_GTC_half_float extension.
+ typedef detail::thalf half;
+
+ /// Vector of 2 half-precision floating-point numbers.
+ /// From GLM_GTC_half_float extension.
+ typedef detail::tvec2<detail::thalf> hvec2;
+
+ /// Vector of 3 half-precision floating-point numbers.
+ /// From GLM_GTC_half_float extension.
+ typedef detail::tvec3<detail::thalf> hvec3;
+
+ /// Vector of 4 half-precision floating-point numbers.
+ /// From GLM_GTC_half_float extension.
+ typedef detail::tvec4<detail::thalf> hvec4;
+
+ /// 2 * 2 matrix of half-precision floating-point numbers.
+ /// From GLM_GTC_half_float extension.
+ typedef detail::tmat2x2<detail::thalf> hmat2;
+
+ /// 3 * 3 matrix of half-precision floating-point numbers.
+ /// From GLM_GTC_half_float extension.
+ typedef detail::tmat3x3<detail::thalf> hmat3;
+
+ /// 4 * 4 matrix of half-precision floating-point numbers.
+ /// From GLM_GTC_half_float extension.
+ typedef detail::tmat4x4<detail::thalf> hmat4;
+
+ /// 2 * 2 matrix of half-precision floating-point numbers.
+ /// From GLM_GTC_half_float extension.
+ typedef detail::tmat2x2<detail::thalf> hmat2x2;
+
+ /// 2 * 3 matrix of half-precision floating-point numbers.
+ /// From GLM_GTC_half_float extension.
+ typedef detail::tmat2x3<detail::thalf> hmat2x3;
+
+ /// 2 * 4 matrix of half-precision floating-point numbers.
+ /// From GLM_GTC_half_float extension.
+ typedef detail::tmat2x4<detail::thalf> hmat2x4;
+
+ /// 3 * 2 matrix of half-precision floating-point numbers.
+ /// From GLM_GTC_half_float extension.
+ typedef detail::tmat3x2<detail::thalf> hmat3x2;
+
+ /// 3 * 3 matrix of half-precision floating-point numbers.
+ /// From GLM_GTC_half_float extension.
+ typedef detail::tmat3x3<detail::thalf> hmat3x3;
+
+ /// 3 * 4 matrix of half-precision floating-point numbers.
+ /// From GLM_GTC_half_float extension.
+ typedef detail::tmat3x4<detail::thalf> hmat3x4;
+
+ /// 4 * 2 matrix of half-precision floating-point numbers.
+ /// From GLM_GTC_half_float extension.
+ typedef detail::tmat4x2<detail::thalf> hmat4x2;
+
+ /// 4 * 3 matrix of half-precision floating-point numbers.
+ /// From GLM_GTC_half_float extension.
+ typedef detail::tmat4x3<detail::thalf> hmat4x3;
+
+ /// 4 * 4 matrix of half-precision floating-point numbers.
+ /// From GLM_GTC_half_float extension.
+ typedef detail::tmat4x4<detail::thalf> hmat4x4;
+
+ /// @}
+
+}// namespace half_float
+}// namespace gtc
+}// namespace glm
+
+#include "half_float.inl"
+
+namespace glm{using namespace gtc::half_float;}
+
+#endif//glm_gtc_half_float
diff --git a/src/glm/gtc/half_float.inl b/src/glm/gtc/half_float.inl
new file mode 100644
index 0000000..46171d0
--- /dev/null
+++ b/src/glm/gtc/half_float.inl
@@ -0,0 +1,975 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2005-12-21
+// Updated : 2010-02-07
+// Licence : This source is under MIT licence
+// File : glm/gtc/half_float.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm{
+namespace detail{
+
+#ifndef _MSC_EXTENSIONS
+
+//////////////////////////////////////
+// hvec2
+
+GLM_FUNC_QUALIFIER tvec2<thalf>::size_type tvec2<thalf>::value_size()
+{
+ return 2;
+}
+
+//////////////////////////////////////
+// Accesses
+
+GLM_FUNC_QUALIFIER thalf & tvec2<thalf>::operator[](tvec2<thalf>::size_type i)
+{
+ assert(/*i >= tvec2<thalf>::size_type(0) && */i < tvec2<thalf>::value_size());
+ return (&x)[i];
+}
+
+GLM_FUNC_QUALIFIER thalf const & tvec2<thalf>::operator[](tvec2<thalf>::size_type i) const
+{
+ assert(/*i >= tvec2<thalf>::size_type(0) && */i < tvec2<thalf>::value_size());
+ return (&x)[i];
+}
+
+//////////////////////////////////////
+// Implicit basic constructors
+
+GLM_FUNC_QUALIFIER tvec2<thalf>::tvec2() :
+ x(thalf(0.f)),
+ y(thalf(0.f))
+{}
+
+GLM_FUNC_QUALIFIER tvec2<thalf>::tvec2
+(
+ tvec2<thalf> const & v
+) :
+ x(v.x),
+ y(v.y)
+{}
+
+//////////////////////////////////////
+// Explicit basic constructors
+
+GLM_FUNC_QUALIFIER tvec2<thalf>::tvec2
+(
+ thalf const & s
+) :
+ x(s),
+ y(s)
+{}
+
+GLM_FUNC_QUALIFIER tvec2<thalf>::tvec2
+(
+ thalf const & s1,
+ thalf const & s2
+) :
+ x(s1),
+ y(s2)
+{}
+
+//////////////////////////////////////
+// Swizzle constructors
+
+GLM_FUNC_QUALIFIER tvec2<thalf>::tvec2
+(
+ tref2<thalf> const & r
+) :
+ x(r.x),
+ y(r.y)
+{}
+
+//////////////////////////////////////
+// Convertion scalar constructors
+
+template <typename U>
+GLM_FUNC_QUALIFIER tvec2<thalf>::tvec2
+(
+ U const & x
+) :
+ x(thalf(x)),
+ y(thalf(x))
+{}
+
+template <typename U, typename V>
+GLM_FUNC_QUALIFIER tvec2<thalf>::tvec2
+(
+ U const & x,
+ V const & y
+) :
+ x(thalf(x)),
+ y(thalf(y))
+{}
+
+//////////////////////////////////////
+// Convertion vector constructors
+
+template <typename U>
+GLM_FUNC_QUALIFIER tvec2<thalf>::tvec2
+(
+ tvec2<U> const & v
+) :
+ x(thalf(v.x)),
+ y(thalf(v.y))
+{}
+
+template <typename U>
+GLM_FUNC_QUALIFIER tvec2<thalf>::tvec2
+(
+ tvec3<U> const & v
+) :
+ x(thalf(v.x)),
+ y(thalf(v.y))
+{}
+
+template <typename U>
+GLM_FUNC_QUALIFIER tvec2<thalf>::tvec2
+(
+ tvec4<U> const & v
+) :
+ x(thalf(v.x)),
+ y(thalf(v.y))
+{}
+
+//////////////////////////////////////
+// Unary arithmetic operators
+
+GLM_FUNC_QUALIFIER tvec2<thalf> & tvec2<thalf>::operator=
+(
+ tvec2<thalf> const & v
+)
+{
+ this->x = v.x;
+ this->y = v.y;
+ return *this;
+}
+
+GLM_FUNC_QUALIFIER tvec2<thalf> & tvec2<thalf>::operator+=
+(
+ thalf const & s
+)
+{
+ this->x += s;
+ this->y += s;
+ return *this;
+}
+
+GLM_FUNC_QUALIFIER tvec2<thalf> & tvec2<thalf>::operator+=
+(
+ tvec2<thalf> const & v
+)
+{
+ this->x += v.x;
+ this->y += v.y;
+ return *this;
+}
+
+GLM_FUNC_QUALIFIER tvec2<thalf> & tvec2<thalf>::operator-=
+(
+ thalf const & s
+)
+{
+ this->x -= s;
+ this->y -= s;
+ return *this;
+}
+
+GLM_FUNC_QUALIFIER tvec2<thalf> & tvec2<thalf>::operator-=
+(
+ tvec2<thalf> const & v
+)
+{
+ this->x -= v.x;
+ this->y -= v.y;
+ return *this;
+}
+
+GLM_FUNC_QUALIFIER tvec2<thalf>& tvec2<thalf>::operator*=
+(
+ thalf const & s
+)
+{
+ this->x *= s;
+ this->y *= s;
+ return *this;
+}
+
+GLM_FUNC_QUALIFIER tvec2<thalf> & tvec2<thalf>::operator*=
+(
+ tvec2<thalf> const & v
+)
+{
+ this->x *= v.x;
+ this->y *= v.y;
+ return *this;
+}
+
+GLM_FUNC_QUALIFIER tvec2<thalf> & tvec2<thalf>::operator/=
+(
+ thalf const & s
+)
+{
+ this->x /= s;
+ this->y /= s;
+ return *this;
+}
+
+GLM_FUNC_QUALIFIER tvec2<thalf> & tvec2<thalf>::operator/=
+(
+ tvec2<thalf> const & v
+)
+{
+ this->x /= v.x;
+ this->y /= v.y;
+ return *this;
+}
+
+GLM_FUNC_QUALIFIER tvec2<thalf> & tvec2<thalf>::operator++()
+{
+ ++this->x;
+ ++this->y;
+ return *this;
+}
+
+GLM_FUNC_QUALIFIER tvec2<thalf>& tvec2<thalf>::operator--()
+{
+ --this->x;
+ --this->y;
+ return *this;
+}
+
+//////////////////////////////////////
+// Swizzle operators
+
+GLM_FUNC_QUALIFIER thalf tvec2<thalf>::swizzle(comp x) const
+{
+ return (*this)[x];
+}
+
+GLM_FUNC_QUALIFIER tvec2<thalf> tvec2<thalf>::swizzle(comp x, comp y) const
+{
+ return tvec2<thalf>(
+ (*this)[x],
+ (*this)[y]);
+}
+
+GLM_FUNC_QUALIFIER tvec3<thalf> tvec2<thalf>::swizzle(comp x, comp y, comp z) const
+{
+ return tvec3<thalf>(
+ (*this)[x],
+ (*this)[y],
+ (*this)[z]);
+}
+
+GLM_FUNC_QUALIFIER tvec4<thalf> tvec2<thalf>::swizzle(comp x, comp y, comp z, comp w) const
+{
+ return tvec4<thalf>(
+ (*this)[x],
+ (*this)[y],
+ (*this)[z],
+ (*this)[w]);
+}
+
+GLM_FUNC_QUALIFIER tref2<thalf> tvec2<thalf>::swizzle(comp x, comp y)
+{
+ return tref2<thalf>(
+ (*this)[x],
+ (*this)[y]);
+}
+
+//////////////////////////////////////
+// hvec3
+
+GLM_FUNC_QUALIFIER tvec3<thalf>::size_type tvec3<thalf>::value_size()
+{
+ return 3;
+}
+
+//////////////////////////////////////
+// Accesses
+
+GLM_FUNC_QUALIFIER thalf & tvec3<thalf>::operator[]
+(
+ tvec3<thalf>::size_type i
+)
+{
+ assert(/*i >= tvec3<thalf>::size_type(0) &&*/ i < tvec3<thalf>::value_size());
+
+ return (&x)[i];
+}
+
+GLM_FUNC_QUALIFIER thalf const & tvec3<thalf>::operator[]
+(
+ tvec3<thalf>::size_type i
+) const
+{
+ assert(/*i >= tvec3<thalf>::size_type(0) &&*/ i < tvec3<thalf>::value_size());
+
+ return (&x)[i];
+}
+
+//////////////////////////////////////
+// Implicit basic constructors
+
+GLM_FUNC_QUALIFIER tvec3<thalf>::tvec3() :
+ x(thalf(0)),
+ y(thalf(0)),
+ z(thalf(0))
+{}
+
+GLM_FUNC_QUALIFIER tvec3<thalf>::tvec3
+(
+ tvec3<thalf> const & v
+) :
+ x(v.x),
+ y(v.y),
+ z(v.z)
+{}
+
+//////////////////////////////////////
+// Explicit basic constructors
+
+GLM_FUNC_QUALIFIER tvec3<thalf>::tvec3
+(
+ thalf const & s
+) :
+ x(s),
+ y(s),
+ z(s)
+{}
+
+GLM_FUNC_QUALIFIER tvec3<thalf>::tvec3
+(
+ thalf const & s0,
+ thalf const & s1,
+ thalf const & s2
+) :
+ x(s0),
+ y(s1),
+ z(s2)
+{}
+
+//////////////////////////////////////
+// Swizzle constructors
+
+GLM_FUNC_QUALIFIER tvec3<thalf>::tvec3
+(
+ tref3<thalf> const & r
+) :
+ x(r.x),
+ y(r.y),
+ z(r.z)
+{}
+
+//////////////////////////////////////
+// Convertion scalar constructors
+
+template <typename U>
+GLM_FUNC_QUALIFIER tvec3<thalf>::tvec3
+(
+ U const & x
+) :
+ x(thalf(x)),
+ y(thalf(x)),
+ z(thalf(x))
+{}
+
+template <typename A, typename B, typename C>
+GLM_FUNC_QUALIFIER tvec3<thalf>::tvec3
+(
+ A const & x,
+ B const & y,
+ C const & z
+) :
+ x(thalf(x)),
+ y(thalf(y)),
+ z(thalf(z))
+{}
+
+//////////////////////////////////////
+// Convertion vector constructors
+
+template <typename A, typename B>
+GLM_FUNC_QUALIFIER tvec3<thalf>::tvec3
+(
+ tvec2<A> const & v,
+ B const & s
+) :
+ x(thalf(v.x)),
+ y(thalf(v.y)),
+ z(thalf(s))
+{}
+
+template <typename A, typename B>
+GLM_FUNC_QUALIFIER tvec3<thalf>::tvec3
+(
+ A const & s,
+ tvec2<B> const & v
+) :
+ x(thalf(s)),
+ y(thalf(v.x)),
+ z(thalf(v.y))
+{}
+
+template <typename U>
+GLM_FUNC_QUALIFIER tvec3<thalf>::tvec3
+(
+ tvec3<U> const & v
+) :
+ x(thalf(v.x)),
+ y(thalf(v.y)),
+ z(thalf(v.z))
+{}
+
+template <typename U>
+GLM_FUNC_QUALIFIER tvec3<thalf>::tvec3
+(
+ tvec4<U> const & v
+) :
+ x(thalf(v.x)),
+ y(thalf(v.y)),
+ z(thalf(v.z))
+{}
+
+//////////////////////////////////////
+// Unary arithmetic operators
+
+GLM_FUNC_QUALIFIER tvec3<thalf> & tvec3<thalf>::operator=
+(
+ tvec3<thalf> const & v
+)
+{
+ this->x = v.x;
+ this->y = v.y;
+ this->z = v.z;
+ return *this;
+}
+
+GLM_FUNC_QUALIFIER tvec3<thalf> & tvec3<thalf>::operator+=
+(
+ thalf const & s
+)
+{
+ this->x += s;
+ this->y += s;
+ this->z += s;
+ return *this;
+}
+
+GLM_FUNC_QUALIFIER tvec3<thalf> & tvec3<thalf>::operator+=
+(
+ tvec3<thalf> const & v
+)
+{
+ this->x += v.x;
+ this->y += v.y;
+ this->z += v.z;
+ return *this;
+}
+
+GLM_FUNC_QUALIFIER tvec3<thalf> & tvec3<thalf>::operator-=
+(
+ thalf const & s
+)
+{
+ this->x -= s;
+ this->y -= s;
+ this->z -= s;
+ return *this;
+}
+
+GLM_FUNC_QUALIFIER tvec3<thalf> & tvec3<thalf>::operator-=
+(
+ tvec3<thalf> const & v
+)
+{
+ this->x -= v.x;
+ this->y -= v.y;
+ this->z -= v.z;
+ return *this;
+}
+
+GLM_FUNC_QUALIFIER tvec3<thalf> & tvec3<thalf>::operator*=
+(
+ thalf const & s
+)
+{
+ this->x *= s;
+ this->y *= s;
+ this->z *= s;
+ return *this;
+}
+
+GLM_FUNC_QUALIFIER tvec3<thalf> & tvec3<thalf>::operator*=
+(
+ tvec3<thalf> const & v
+)
+{
+ this->x *= v.x;
+ this->y *= v.y;
+ this->z *= v.z;
+ return *this;
+}
+
+GLM_FUNC_QUALIFIER tvec3<thalf> & tvec3<thalf>::operator/=
+(
+ thalf const & s
+)
+{
+ this->x /= s;
+ this->y /= s;
+ this->z /= s;
+ return *this;
+}
+
+GLM_FUNC_QUALIFIER tvec3<thalf> & tvec3<thalf>::operator/=
+(
+ tvec3<thalf> const & v
+)
+{
+ this->x /= v.x;
+ this->y /= v.y;
+ this->z /= v.z;
+ return *this;
+}
+
+GLM_FUNC_QUALIFIER tvec3<thalf> & tvec3<thalf>::operator++()
+{
+ ++this->x;
+ ++this->y;
+ ++this->z;
+ return *this;
+}
+
+GLM_FUNC_QUALIFIER tvec3<thalf> & tvec3<thalf>::operator--()
+{
+ --this->x;
+ --this->y;
+ --this->z;
+ return *this;
+}
+
+//////////////////////////////////////
+// Swizzle operators
+
+GLM_FUNC_QUALIFIER thalf tvec3<thalf>::swizzle(comp x) const
+{
+ return (*this)[x];
+}
+
+GLM_FUNC_QUALIFIER tvec2<thalf> tvec3<thalf>::swizzle(comp x, comp y) const
+{
+ return tvec2<thalf>(
+ (*this)[x],
+ (*this)[y]);
+}
+
+GLM_FUNC_QUALIFIER tvec3<thalf> tvec3<thalf>::swizzle(comp x, comp y, comp z) const
+{
+ return tvec3<thalf>(
+ (*this)[x],
+ (*this)[y],
+ (*this)[z]);
+}
+
+GLM_FUNC_QUALIFIER tvec4<thalf> tvec3<thalf>::swizzle(comp x, comp y, comp z, comp w) const
+{
+ return tvec4<thalf>(
+ (*this)[x],
+ (*this)[y],
+ (*this)[z],
+ (*this)[w]);
+}
+
+GLM_FUNC_QUALIFIER tref3<thalf> tvec3<thalf>::swizzle(comp x, comp y, comp z)
+{
+ return tref3<thalf>(
+ (*this)[x],
+ (*this)[y],
+ (*this)[z]);
+}
+
+//////////////////////////////////////
+// hvec4
+
+GLM_FUNC_QUALIFIER tvec4<thalf>::size_type tvec4<thalf>::value_size()
+{
+ return 4;
+}
+
+//////////////////////////////////////
+// Accesses
+
+GLM_FUNC_QUALIFIER thalf & tvec4<thalf>::operator[]
+(
+ tvec4<thalf>::size_type i
+)
+{
+ assert(/*i >= tvec4<thalf>::size_type(0) && */i < tvec4<thalf>::value_size());
+
+ return (&x)[i];
+}
+
+GLM_FUNC_QUALIFIER thalf const & tvec4<thalf>::operator[]
+(
+ tvec4<thalf>::size_type i
+) const
+{
+ assert(/*i >= tvec4<thalf>::size_type(0) && */i < tvec4<thalf>::value_size());
+
+ return (&x)[i];
+}
+
+//////////////////////////////////////
+// Implicit basic constructors
+
+GLM_FUNC_QUALIFIER tvec4<thalf>::tvec4() :
+ x(thalf(0)),
+ y(thalf(0)),
+ z(thalf(0)),
+ w(thalf(0))
+{}
+
+GLM_FUNC_QUALIFIER tvec4<thalf>::tvec4
+(
+ tvec4<thalf> const & v
+) :
+ x(v.x),
+ y(v.y),
+ z(v.z),
+ w(v.w)
+{}
+
+//////////////////////////////////////
+// Explicit basic constructors
+
+GLM_FUNC_QUALIFIER tvec4<thalf>::tvec4
+(
+ thalf const & s
+) :
+ x(s),
+ y(s),
+ z(s),
+ w(s)
+{}
+
+GLM_FUNC_QUALIFIER tvec4<thalf>::tvec4
+(
+ thalf const & s1,
+ thalf const & s2,
+ thalf const & s3,
+ thalf const & s4
+) :
+ x(s1),
+ y(s2),
+ z(s3),
+ w(s4)
+{}
+
+//////////////////////////////////////
+// Swizzle constructors
+
+GLM_FUNC_QUALIFIER tvec4<thalf>::tvec4
+(
+ tref4<thalf> const & r
+) :
+ x(r.x),
+ y(r.y),
+ z(r.z),
+ w(r.w)
+{}
+
+//////////////////////////////////////
+// Convertion scalar constructors
+
+template <typename U>
+GLM_FUNC_QUALIFIER tvec4<thalf>::tvec4
+(
+ U const & x
+) :
+ x(thalf(x)),
+ y(thalf(x)),
+ z(thalf(x)),
+ w(thalf(x))
+{}
+
+template <typename A, typename B, typename C, typename D>
+GLM_FUNC_QUALIFIER tvec4<thalf>::tvec4
+(
+ A const & x,
+ B const & y,
+ C const & z,
+ D const & w
+) :
+ x(thalf(x)),
+ y(thalf(y)),
+ z(thalf(z)),
+ w(thalf(w))
+{}
+
+//////////////////////////////////////
+// Convertion vector constructors
+
+template <typename A, typename B, typename C>
+GLM_FUNC_QUALIFIER tvec4<thalf>::tvec4
+(
+ tvec2<A> const & v,
+ B const & s1,
+ C const & s2
+) :
+ x(thalf(v.x)),
+ y(thalf(v.y)),
+ z(thalf(s1)),
+ w(thalf(s2))
+{}
+
+template <typename A, typename B, typename C>
+GLM_FUNC_QUALIFIER tvec4<thalf>::tvec4
+(
+ A const & s1,
+ tvec2<B> const & v,
+ C const & s2
+) :
+ x(thalf(s1)),
+ y(thalf(v.x)),
+ z(thalf(v.y)),
+ w(thalf(s2))
+{}
+
+template <typename A, typename B, typename C>
+GLM_FUNC_QUALIFIER tvec4<thalf>::tvec4
+(
+ A const & s1,
+ B const & s2,
+ tvec2<C> const & v
+) :
+ x(thalf(s1)),
+ y(thalf(s2)),
+ z(thalf(v.x)),
+ w(thalf(v.y))
+{}
+
+template <typename A, typename B>
+GLM_FUNC_QUALIFIER tvec4<thalf>::tvec4
+(
+ tvec3<A> const & v,
+ B const & s
+) :
+ x(thalf(v.x)),
+ y(thalf(v.y)),
+ z(thalf(v.z)),
+ w(thalf(s))
+{}
+
+template <typename A, typename B>
+GLM_FUNC_QUALIFIER tvec4<thalf>::tvec4
+(
+ A const & s,
+ tvec3<B> const & v
+) :
+ x(thalf(s)),
+ y(thalf(v.x)),
+ z(thalf(v.y)),
+ w(thalf(v.z))
+{}
+
+template <typename A, typename B>
+GLM_FUNC_QUALIFIER tvec4<thalf>::tvec4
+(
+ tvec2<A> const & v1,
+ tvec2<B> const & v2
+) :
+ x(thalf(v1.x)),
+ y(thalf(v1.y)),
+ z(thalf(v2.x)),
+ w(thalf(v2.y))
+{}
+
+template <typename U>
+GLM_FUNC_QUALIFIER tvec4<thalf>::tvec4
+(
+ tvec4<U> const & v
+) :
+ x(thalf(v.x)),
+ y(thalf(v.y)),
+ z(thalf(v.z)),
+ w(thalf(v.w))
+{}
+
+//////////////////////////////////////
+// Unary arithmetic operators
+
+GLM_FUNC_QUALIFIER tvec4<thalf>& tvec4<thalf>::operator=
+(
+ tvec4<thalf> const & v
+)
+{
+ this->x = v.x;
+ this->y = v.y;
+ this->z = v.z;
+ this->w = v.w;
+ return *this;
+}
+
+GLM_FUNC_QUALIFIER tvec4<thalf>& tvec4<thalf>::operator+=
+(
+ thalf const & s
+)
+{
+ this->x += s;
+ this->y += s;
+ this->z += s;
+ this->w += s;
+ return *this;
+}
+
+GLM_FUNC_QUALIFIER tvec4<thalf>& tvec4<thalf>::operator+=
+(
+ tvec4<thalf> const & v
+)
+{
+ this->x += v.x;
+ this->y += v.y;
+ this->z += v.z;
+ this->w += v.w;
+ return *this;
+}
+
+GLM_FUNC_QUALIFIER tvec4<thalf>& tvec4<thalf>::operator-=
+(
+ thalf const & s
+)
+{
+ this->x -= s;
+ this->y -= s;
+ this->z -= s;
+ this->w -= s;
+ return *this;
+}
+
+GLM_FUNC_QUALIFIER tvec4<thalf>& tvec4<thalf>::operator-=
+(
+ tvec4<thalf> const & v
+)
+{
+ this->x -= v.x;
+ this->y -= v.y;
+ this->z -= v.z;
+ this->w -= v.w;
+ return *this;
+}
+
+GLM_FUNC_QUALIFIER tvec4<thalf>& tvec4<thalf>::operator*=
+(
+ thalf const & s
+)
+{
+ this->x *= s;
+ this->y *= s;
+ this->z *= s;
+ this->w *= s;
+ return *this;
+}
+
+GLM_FUNC_QUALIFIER tvec4<thalf>& tvec4<thalf>::operator*=
+(
+ tvec4<thalf> const & v
+)
+{
+ this->x *= v.x;
+ this->y *= v.y;
+ this->z *= v.z;
+ this->w *= v.w;
+ return *this;
+}
+
+GLM_FUNC_QUALIFIER tvec4<thalf>& tvec4<thalf>::operator/=
+(
+ thalf const & s
+)
+{
+ this->x /= s;
+ this->y /= s;
+ this->z /= s;
+ this->w /= s;
+ return *this;
+}
+
+GLM_FUNC_QUALIFIER tvec4<thalf>& tvec4<thalf>::operator/=
+(
+ tvec4<thalf> const & v
+)
+{
+ this->x /= v.x;
+ this->y /= v.y;
+ this->z /= v.z;
+ this->w /= v.w;
+ return *this;
+}
+
+GLM_FUNC_QUALIFIER tvec4<thalf>& tvec4<thalf>::operator++()
+{
+ ++this->x;
+ ++this->y;
+ ++this->z;
+ ++this->w;
+ return *this;
+}
+
+GLM_FUNC_QUALIFIER tvec4<thalf>& tvec4<thalf>::operator--()
+{
+ --this->x;
+ --this->y;
+ --this->z;
+ --this->w;
+ return *this;
+}
+
+//////////////////////////////////////
+// Swizzle operators
+
+GLM_FUNC_QUALIFIER thalf tvec4<thalf>::swizzle(comp x) const
+{
+ return (*this)[x];
+}
+
+GLM_FUNC_QUALIFIER tvec2<thalf> tvec4<thalf>::swizzle(comp x, comp y) const
+{
+ return tvec2<thalf>(
+ (*this)[x],
+ (*this)[y]);
+}
+
+GLM_FUNC_QUALIFIER tvec3<thalf> tvec4<thalf>::swizzle(comp x, comp y, comp z) const
+{
+ return tvec3<thalf>(
+ (*this)[x],
+ (*this)[y],
+ (*this)[z]);
+}
+
+GLM_FUNC_QUALIFIER tvec4<thalf> tvec4<thalf>::swizzle(comp x, comp y, comp z, comp w) const
+{
+ return tvec4<thalf>(
+ (*this)[x],
+ (*this)[y],
+ (*this)[z],
+ (*this)[w]);
+}
+
+GLM_FUNC_QUALIFIER tref4<thalf> tvec4<thalf>::swizzle(comp x, comp y, comp z, comp w)
+{
+ return tref4<thalf>(
+ (*this)[x],
+ (*this)[y],
+ (*this)[z],
+ (*this)[w]);
+}
+
+#endif//_MSC_EXTENSIONS
+
+}//namespace detail
+}//namespace glm
diff --git a/src/glm/gtc/matrix_access.hpp b/src/glm/gtc/matrix_access.hpp
new file mode 100644
index 0000000..d01e5e1
--- /dev/null
+++ b/src/glm/gtc/matrix_access.hpp
@@ -0,0 +1,70 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2005-12-27
+// Updated : 2010-11-12
+// Licence : This source is under MIT License
+// File : glm/gtc/matrix_access.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_gtc_matrix_access
+#define glm_gtc_matrix_access
+
+// Dependency:
+#include "../glm.hpp"
+
+#if(defined(GLM_MESSAGES) && !defined(glm_ext))
+# pragma message("GLM: GLM_GTC_matrix_access extension included")
+#endif
+
+namespace glm{
+namespace gtc{
+namespace matrix_access ///< GLM_GTC_matrix_access extension: Set a column or a row of a matrix
+{
+ /// \addtogroup gtc_matrix_access
+ ///@{
+
+ //! Get a specific row of a matrix.
+ //! From GLM_GTC_matrix_access extension.
+ template <typename genType>
+ typename genType::row_type row(
+ genType const & m,
+ int index);
+
+ //! Set a specific row to a matrix.
+ //! From GLM_GTC_matrix_access extension.
+ template <typename genType>
+ genType row(
+ genType const & m,
+ int index,
+ typename genType::row_type const & x);
+
+ //! Get a specific column of a matrix.
+ //! From GLM_GTC_matrix_access extension.
+ template <typename genType>
+ typename genType::col_type column(
+ genType const & m,
+ int index);
+
+ //! Set a specific column to a matrix.
+ //! From GLM_GTC_matrix_access extension.
+ template <typename genType>
+ genType column(
+ genType const & m,
+ int index,
+ typename genType::col_type const & x);
+
+ ///@}
+
+}//namespace matrix_access
+}//namespace gtc
+}//namespace glm
+
+#include "matrix_access.inl"
+
+namespace glm{using namespace gtc::matrix_access;}
+
+#endif//glm_gtc_matrix_access
diff --git a/src/glm/gtc/matrix_access.inl b/src/glm/gtc/matrix_access.inl
new file mode 100644
index 0000000..a53ef91
--- /dev/null
+++ b/src/glm/gtc/matrix_access.inl
@@ -0,0 +1,59 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2005-12-27
+// Updated : 2010-11-12
+// Licence : This source is under MIT License
+// File : glm/gtc/matrix_access.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm{
+namespace gtc{
+namespace matrix_access
+{
+ template <typename genType>
+ GLM_FUNC_QUALIFIER genType row(
+ genType const & m,
+ int index,
+ typename genType::row_type const & x)
+ {
+ genType Result = m;
+ for(typename genType::size_type i = 0; i < genType::row_size(); ++i)
+ Result[i][index] = x[i];
+ return Result;
+ }
+
+ template <typename genType>
+ GLM_FUNC_QUALIFIER typename genType::row_type row(
+ genType const & m,
+ int index)
+ {
+ typename genType::row_type Result;
+ for(typename genType::size_type i = 0; i < genType::row_size(); ++i)
+ Result[i] = m[i][index];
+ return Result;
+ }
+
+ template <typename genType>
+ GLM_FUNC_QUALIFIER genType column(
+ genType const & m,
+ int index,
+ typename genType::col_type const & x)
+ {
+ genType Result = m;
+ Result[index] = x;
+ return Result;
+ }
+
+ template <typename genType>
+ GLM_FUNC_QUALIFIER typename genType::col_type column(
+ genType const & m,
+ int index)
+ {
+ return m[index];
+ }
+
+}//namespace matrix_access
+}//namespace gtc
+}//namespace glm
+
diff --git a/src/glm/gtc/matrix_integer.hpp b/src/glm/gtc/matrix_integer.hpp
new file mode 100644
index 0000000..0e52b8f
--- /dev/null
+++ b/src/glm/gtc/matrix_integer.hpp
@@ -0,0 +1,204 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2011-01-20
+// Updated : 2011-01-20
+// Licence : This source is under MIT License
+// File : glm/gtc/matrix_integer.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_gtc_matrix_integer
+#define glm_gtc_matrix_integer
+
+// Dependency:
+#include "../glm.hpp"
+
+#if(defined(GLM_MESSAGES) && !defined(glm_ext))
+# pragma message("GLM: GLM_GTC_matrix_integer extension included")
+#endif
+
+namespace glm{
+namespace gtc{
+namespace matrix_integer ///< GLM_GTC_matrix_integer extension: Add integer matrices
+{
+ /// \addtogroup gtc_matrix_integer
+ ///@{
+
+ typedef detail::tmat2x2<highp_int> highp_imat2; //!< \brief High-precision signed integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef detail::tmat3x3<highp_int> highp_imat3; //!< \brief High-precision signed integer 3x3 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef detail::tmat4x4<highp_int> highp_imat4; //!< \brief High-precision signed integer 4x4 matrix. (from GLM_GTC_matrix_integer extension)
+
+ typedef detail::tmat2x2<highp_int> highp_imat2x2; //!< \brief High-precision signed integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef detail::tmat2x3<highp_int> highp_imat2x3; //!< \brief High-precision signed integer 2x3 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef detail::tmat2x4<highp_int> highp_imat2x4; //!< \brief High-precision signed integer 2x4 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef detail::tmat3x2<highp_int> highp_imat3x2; //!< \brief High-precision signed integer 3x2 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef detail::tmat3x3<highp_int> highp_imat3x3; //!< \brief High-precision signed integer 3x3 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef detail::tmat3x4<highp_int> highp_imat3x4; //!< \brief High-precision signed integer 3x4 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef detail::tmat4x2<highp_int> highp_imat4x2; //!< \brief High-precision signed integer 4x2 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef detail::tmat4x3<highp_int> highp_imat4x3; //!< \brief High-precision signed integer 4x3 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef detail::tmat4x4<highp_int> highp_imat4x4; //!< \brief High-precision signed integer 4x4 matrix. (from GLM_GTC_matrix_integer extension)
+
+ typedef detail::tmat2x2<mediump_int> mediump_imat2; //!< \brief Medium-precision signed integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef detail::tmat3x3<mediump_int> mediump_imat3; //!< \brief Medium-precision signed integer 3x3 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef detail::tmat4x4<mediump_int> mediump_imat4; //!< \brief Medium-precision signed integer 4x4 matrix. (from GLM_GTC_matrix_integer extension)
+
+ typedef detail::tmat2x2<mediump_int> mediump_imat2x2; //!< \brief Medium-precision signed integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef detail::tmat2x3<mediump_int> mediump_imat2x3; //!< \brief Medium-precision signed integer 2x3 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef detail::tmat2x4<mediump_int> mediump_imat2x4; //!< \brief Medium-precision signed integer 2x4 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef detail::tmat3x2<mediump_int> mediump_imat3x2; //!< \brief Medium-precision signed integer 3x2 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef detail::tmat3x3<mediump_int> mediump_imat3x3; //!< \brief Medium-precision signed integer 3x3 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef detail::tmat3x4<mediump_int> mediump_imat3x4; //!< \brief Medium-precision signed integer 3x4 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef detail::tmat4x2<mediump_int> mediump_imat4x2; //!< \brief Medium-precision signed integer 4x2 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef detail::tmat4x3<mediump_int> mediump_imat4x3; //!< \brief Medium-precision signed integer 4x3 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef detail::tmat4x4<mediump_int> mediump_imat4x4; //!< \brief Medium-precision signed integer 4x4 matrix. (from GLM_GTC_matrix_integer extension)
+
+ typedef detail::tmat2x2<lowp_int> lowp_imat2; //!< \brief Low-precision signed integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef detail::tmat3x3<lowp_int> lowp_imat3; //!< \brief Low-precision signed integer 3x3 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef detail::tmat4x4<lowp_int> lowp_imat4; //!< \brief Low-precision signed integer 4x4 matrix. (from GLM_GTC_matrix_integer extension)
+
+ typedef detail::tmat2x2<lowp_int> lowp_imat2x2; //!< \brief Low-precision signed integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef detail::tmat2x3<lowp_int> lowp_imat2x3; //!< \brief Low-precision signed integer 2x3 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef detail::tmat2x4<lowp_int> lowp_imat2x4; //!< \brief Low-precision signed integer 2x4 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef detail::tmat3x2<lowp_int> lowp_imat3x2; //!< \brief Low-precision signed integer 3x2 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef detail::tmat3x3<lowp_int> lowp_imat3x3; //!< \brief Low-precision signed integer 3x3 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef detail::tmat3x4<lowp_int> lowp_imat3x4; //!< \brief Low-precision signed integer 3x4 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef detail::tmat4x2<lowp_int> lowp_imat4x2; //!< \brief Low-precision signed integer 4x2 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef detail::tmat4x3<lowp_int> lowp_imat4x3; //!< \brief Low-precision signed integer 4x3 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef detail::tmat4x4<lowp_int> lowp_imat4x4; //!< \brief Low-precision signed integer 4x4 matrix. (from GLM_GTC_matrix_integer extension)
+
+ typedef detail::tmat2x2<highp_uint> highp_umat2; //!< \brief High-precision signed integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef detail::tmat3x3<highp_uint> highp_umat3; //!< \brief High-precision signed integer 3x3 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef detail::tmat4x4<highp_uint> highp_umat4; //!< \brief High-precision signed integer 4x4 matrix. (from GLM_GTC_matrix_integer extension)
+
+ typedef detail::tmat2x2<highp_uint> highp_umat2x2; //!< \brief High-precision signed integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef detail::tmat2x3<highp_uint> highp_umat2x3; //!< \brief High-precision signed integer 2x3 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef detail::tmat2x4<highp_uint> highp_umat2x4; //!< \brief High-precision signed integer 2x4 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef detail::tmat3x2<highp_uint> highp_umat3x2; //!< \brief High-precision signed integer 3x2 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef detail::tmat3x3<highp_uint> highp_umat3x3; //!< \brief High-precision signed integer 3x3 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef detail::tmat3x4<highp_uint> highp_umat3x4; //!< \brief High-precision signed integer 3x4 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef detail::tmat4x2<highp_uint> highp_umat4x2; //!< \brief High-precision signed integer 4x2 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef detail::tmat4x3<highp_uint> highp_umat4x3; //!< \brief High-precision signed integer 4x3 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef detail::tmat4x4<highp_uint> highp_umat4x4; //!< \brief High-precision signed integer 4x4 matrix. (from GLM_GTC_matrix_integer extension)
+
+ typedef detail::tmat2x2<mediump_uint> mediump_umat2; //!< \brief Medium-precision signed integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef detail::tmat3x3<mediump_uint> mediump_umat3; //!< \brief Medium-precision signed integer 3x3 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef detail::tmat4x4<mediump_uint> mediump_umat4; //!< \brief Medium-precision signed integer 4x4 matrix. (from GLM_GTC_matrix_integer extension)
+
+ typedef detail::tmat2x2<mediump_uint> mediump_umat2x2; //!< \brief Medium-precision signed integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef detail::tmat2x3<mediump_uint> mediump_umat2x3; //!< \brief Medium-precision signed integer 2x3 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef detail::tmat2x4<mediump_uint> mediump_umat2x4; //!< \brief Medium-precision signed integer 2x4 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef detail::tmat3x2<mediump_uint> mediump_umat3x2; //!< \brief Medium-precision signed integer 3x2 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef detail::tmat3x3<mediump_uint> mediump_umat3x3; //!< \brief Medium-precision signed integer 3x3 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef detail::tmat3x4<mediump_uint> mediump_umat3x4; //!< \brief Medium-precision signed integer 3x4 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef detail::tmat4x2<mediump_uint> mediump_umat4x2; //!< \brief Medium-precision signed integer 4x2 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef detail::tmat4x3<mediump_uint> mediump_umat4x3; //!< \brief Medium-precision signed integer 4x3 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef detail::tmat4x4<mediump_uint> mediump_umat4x4; //!< \brief Medium-precision signed integer 4x4 matrix. (from GLM_GTC_matrix_integer extension)
+
+ typedef detail::tmat2x2<lowp_uint> lowp_umat2; //!< \brief Low-precision signed integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef detail::tmat3x3<lowp_uint> lowp_umat3; //!< \brief Low-precision signed integer 3x3 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef detail::tmat4x4<lowp_uint> lowp_umat4; //!< \brief Low-precision signed integer 4x4 matrix. (from GLM_GTC_matrix_integer extension)
+
+ typedef detail::tmat2x2<lowp_uint> lowp_umat2x2; //!< \brief Low-precision signed integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef detail::tmat2x3<lowp_uint> lowp_umat2x3; //!< \brief Low-precision signed integer 2x3 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef detail::tmat2x4<lowp_uint> lowp_umat2x4; //!< \brief Low-precision signed integer 2x4 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef detail::tmat3x2<lowp_uint> lowp_umat3x2; //!< \brief Low-precision signed integer 3x2 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef detail::tmat3x3<lowp_uint> lowp_umat3x3; //!< \brief Low-precision signed integer 3x3 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef detail::tmat3x4<lowp_uint> lowp_umat3x4; //!< \brief Low-precision signed integer 3x4 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef detail::tmat4x2<lowp_uint> lowp_umat4x2; //!< \brief Low-precision signed integer 4x2 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef detail::tmat4x3<lowp_uint> lowp_umat4x3; //!< \brief Low-precision signed integer 4x3 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef detail::tmat4x4<lowp_uint> lowp_umat4x4; //!< \brief Low-precision signed integer 4x4 matrix. (from GLM_GTC_matrix_integer extension)
+
+#if(defined(GLM_PRECISION_HIGHP_INT))
+ typedef highp_imat2 imat2; //!< \brief Signed integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef highp_imat3 imat3; //!< \brief Signed integer 3x3 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef highp_imat4 imat4; //!< \brief Signed integer 4x4 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef highp_imat2x2 imat2x2; //!< \brief Signed integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef highp_imat2x3 imat2x3; //!< \brief Signed integer 2x3 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef highp_imat2x4 imat2x4; //!< \brief Signed integer 2x4 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef highp_imat3x2 imat3x2; //!< \brief Signed integer 3x2 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef highp_imat3x3 imat3x3; //!< \brief Signed integer 3x3 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef highp_imat3x4 imat3x4; //!< \brief Signed integer 3x4 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef highp_imat4x2 imat4x2; //!< \brief Signed integer 4x2 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef highp_imat4x3 imat4x3; //!< \brief Signed integer 4x3 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef highp_imat4x4 imat4x4; //!< \brief Signed integer 4x4 matrix. (from GLM_GTC_matrix_integer extension)
+#elif(defined(GLM_PRECISION_LOWP_INT))
+ typedef lowp_imat2 imat2; //!< \brief Signed integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef lowp_imat3 imat3; //!< \brief Signed integer 3x3 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef lowp_imat4 imat4; //!< \brief Signed integer 4x4 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef lowp_imat2x2 imat2x2; //!< \brief Signed integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef lowp_imat2x3 imat2x3; //!< \brief Signed integer 2x3 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef lowp_imat2x4 imat2x4; //!< \brief Signed integer 2x4 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef lowp_imat3x2 imat3x2; //!< \brief Signed integer 3x2 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef lowp_imat3x3 imat3x3; //!< \brief Signed integer 3x3 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef lowp_imat3x4 imat3x4; //!< \brief Signed integer 3x4 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef lowp_imat4x2 imat4x2; //!< \brief Signed integer 4x2 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef lowp_imat4x3 imat4x3; //!< \brief Signed integer 4x3 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef lowp_imat4x4 imat4x4; //!< \brief Signed integer 4x4 matrix. (from GLM_GTC_matrix_integer extension)
+#else //if(defined(GLM_PRECISION_MEDIUMP_INT))
+ typedef mediump_imat2 imat2; //!< \brief Signed integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef mediump_imat3 imat3; //!< \brief Signed integer 3x3 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef mediump_imat4 imat4; //!< \brief Signed integer 4x4 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef mediump_imat2x2 imat2x2; //!< \brief Signed integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef mediump_imat2x3 imat2x3; //!< \brief Signed integer 2x3 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef mediump_imat2x4 imat2x4; //!< \brief Signed integer 2x4 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef mediump_imat3x2 imat3x2; //!< \brief Signed integer 3x2 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef mediump_imat3x3 imat3x3; //!< \brief Signed integer 3x3 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef mediump_imat3x4 imat3x4; //!< \brief Signed integer 3x4 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef mediump_imat4x2 imat4x2; //!< \brief Signed integer 4x2 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef mediump_imat4x3 imat4x3; //!< \brief Signed integer 4x3 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef mediump_imat4x4 imat4x4; //!< \brief Signed integer 4x4 matrix. (from GLM_GTC_matrix_integer extension)
+#endif//GLM_PRECISION
+
+#if(defined(GLM_PRECISION_HIGHP_UINT))
+ typedef highp_umat2 umat2; //!< \brief Unsigned integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef highp_umat3 umat3; //!< \brief Unsigned integer 3x3 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef highp_umat4 umat4; //!< \brief Unsigned integer 4x4 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef highp_umat2x2 umat2x2; //!< \brief Unsigned integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef highp_umat2x3 umat2x3; //!< \brief Unsigned integer 2x3 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef highp_umat2x4 umat2x4; //!< \brief Unsigned integer 2x4 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef highp_umat3x2 umat3x2; //!< \brief Unsigned integer 3x2 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef highp_umat3x3 umat3x3; //!< \brief Unsigned integer 3x3 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef highp_umat3x4 umat3x4; //!< \brief Unsigned integer 3x4 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef highp_umat4x2 umat4x2; //!< \brief Unsigned integer 4x2 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef highp_umat4x3 umat4x3; //!< \brief Unsigned integer 4x3 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef highp_umat4x4 umat4x4; //!< \brief Unsigned integer 4x4 matrix. (from GLM_GTC_matrix_integer extension)
+#elif(defined(GLM_PRECISION_LOWP_UINT))
+ typedef lowp_umat2 umat2; //!< \brief Unsigned integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef lowp_umat3 umat3; //!< \brief Unsigned integer 3x3 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef lowp_umat4 umat4; //!< \brief Unsigned integer 4x4 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef lowp_umat2x2 umat2x2; //!< \brief Unsigned integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef lowp_umat2x3 umat2x3; //!< \brief Unsigned integer 2x3 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef lowp_umat2x4 umat2x4; //!< \brief Unsigned integer 2x4 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef lowp_umat3x2 umat3x2; //!< \brief Unsigned integer 3x2 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef lowp_umat3x3 umat3x3; //!< \brief Unsigned integer 3x3 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef lowp_umat3x4 umat3x4; //!< \brief Unsigned integer 3x4 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef lowp_umat4x2 umat4x2; //!< \brief Unsigned integer 4x2 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef lowp_umat4x3 umat4x3; //!< \brief Unsigned integer 4x3 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef lowp_umat4x4 umat4x4; //!< \brief Unsigned integer 4x4 matrix. (from GLM_GTC_matrix_integer extension)
+#else //if(defined(GLM_PRECISION_MEDIUMP_UINT))
+ typedef mediump_umat2 umat2; //!< \brief Unsigned integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef mediump_umat3 umat3; //!< \brief Unsigned integer 3x3 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef mediump_umat4 umat4; //!< \brief Unsigned integer 4x4 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef mediump_umat2x2 umat2x2; //!< \brief Unsigned integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef mediump_umat2x3 umat2x3; //!< \brief Unsigned integer 2x3 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef mediump_umat2x4 umat2x4; //!< \brief Unsigned integer 2x4 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef mediump_umat3x2 umat3x2; //!< \brief Unsigned integer 3x2 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef mediump_umat3x3 umat3x3; //!< \brief Unsigned integer 3x3 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef mediump_umat3x4 umat3x4; //!< \brief Unsigned integer 3x4 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef mediump_umat4x2 umat4x2; //!< \brief Unsigned integer 4x2 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef mediump_umat4x3 umat4x3; //!< \brief Unsigned integer 4x3 matrix. (from GLM_GTC_matrix_integer extension)
+ typedef mediump_umat4x4 umat4x4; //!< \brief Unsigned integer 4x4 matrix. (from GLM_GTC_matrix_integer extension)
+#endif//GLM_PRECISION
+
+ ///@}
+
+}//namespace matrix_integer
+}//namespace gtc
+}//namespace glm
+
+namespace glm{using namespace gtc::matrix_integer;}
+
+#endif//glm_gtc_matrix_integer
diff --git a/src/glm/gtc/matrix_inverse.hpp b/src/glm/gtc/matrix_inverse.hpp
new file mode 100644
index 0000000..4968128
--- /dev/null
+++ b/src/glm/gtc/matrix_inverse.hpp
@@ -0,0 +1,51 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2005-12-21
+// Updated : 2010-12-13
+// Licence : This source is under MIT License
+// File : glm/gtc/matrix_inverse.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_gtc_matrix_inverse
+#define glm_gtc_matrix_inverse
+
+// Dependency:
+#include "../glm.hpp"
+
+#if(defined(GLM_MESSAGES) && !defined(glm_ext))
+# pragma message("GLM: GLM_GTC_matrix_inverse extension included")
+#endif
+
+namespace glm{
+namespace gtc{
+namespace matrix_inverse ///< GLM_GTC_matrix_inverse extension: Inverse matrix functions
+{
+ /// \addtogroup gtc_matrix_inverse
+ ///@{
+
+ //! Fast matrix inverse for affine matrix.
+ //! From GLM_GTC_matrix_inverse extension.
+ template <typename genType>
+ genType affineInverse(genType const & m);
+
+ //! Compute the inverse transpose of a matrix.
+ //! From GLM_GTC_matrix_inverse extension.
+ template <typename genType>
+ GLM_FUNC_QUALIFIER typename genType::value_type inverseTranspose(
+ genType const & m);
+
+ ///@}
+
+}//namespace matrix_inverse
+}//namespace gtc
+}//namespace glm
+
+#include "matrix_inverse.inl"
+
+namespace glm{using namespace gtc::matrix_inverse;}
+
+#endif//glm_gtc_matrix_inverse
diff --git a/src/glm/gtc/matrix_inverse.inl b/src/glm/gtc/matrix_inverse.inl
new file mode 100644
index 0000000..50e10ec
--- /dev/null
+++ b/src/glm/gtc/matrix_inverse.inl
@@ -0,0 +1,139 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2005-12-21
+// Updated : 2010-12-13
+// Licence : This source is under MIT License
+// File : glm/gtc/matrix_inverse.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm{
+namespace gtc{
+namespace matrix_inverse
+{
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat3x3<T> affineInverse
+ (
+ detail::tmat3x3<T> const & m
+ )
+ {
+ detail::tmat3x3<T> Result(m);
+ Result[2] = detail::tvec3<T>(0, 0, 1);
+ Result = transpose(Result);
+ detail::tvec3<T> Translation = Result * detail::tvec3<T>(-detail::tvec2<T>(m[2]), m[2][2]);
+ Result[2] = Translation;
+ return Result;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat4x4<T> affineInverse
+ (
+ detail::tmat4x4<T> const & m
+ )
+ {
+ detail::tmat4x4<T> Result(m);
+ Result[3] = detail::tvec4<T>(0, 0, 0, 1);
+ Result = transpose(Result);
+ detail::tvec4<T> Translation = Result * detail::tvec4<T>(-detail::tvec3<T>(m[3]), m[3][3]);
+ Result[3] = Translation;
+ return Result;
+ }
+
+ template <typename valType>
+ GLM_FUNC_QUALIFIER detail::tmat2x2<valType> inverseTranspose(
+ detail::tmat2x2<valType> const & m)
+ {
+ valType Determinant = m[0][0] * m[1][1] - m[1][0] * m[0][1];
+
+ detail::tmat2x2<valType> Inverse(
+ + m[1][1] / Determinant,
+ - m[0][1] / Determinant,
+ - m[1][0] / Determinant,
+ + m[0][0] / Determinant);
+
+ return Inverse;
+ }
+
+ template <typename valType>
+ GLM_FUNC_QUALIFIER detail::tmat3x3<valType> inverseTranspose(
+ detail::tmat3x3<valType> const & m)
+ {
+ valType Determinant =
+ + m[0][0] * (m[1][1] * m[2][2] - m[1][2] * m[2][1])
+ - m[0][1] * (m[1][0] * m[2][2] - m[1][2] * m[2][0])
+ + m[0][2] * (m[1][0] * m[2][1] - m[1][1] * m[2][0]);
+
+ detail::tmat3x3<valType> Inverse;
+ Inverse[0][0] = + (m[1][1] * m[2][2] - m[2][1] * m[1][2]);
+ Inverse[0][1] = - (m[1][0] * m[2][2] - m[2][0] * m[1][2]);
+ Inverse[0][2] = + (m[1][0] * m[2][1] - m[2][0] * m[1][1]);
+ Inverse[1][0] = - (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[1][2] = - (m[0][0] * m[2][1] - m[2][0] * m[0][1]);
+ Inverse[2][0] = + (m[0][1] * m[1][2] - m[1][1] * m[0][2]);
+ Inverse[2][1] = - (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 <typename valType>
+ GLM_FUNC_QUALIFIER detail::tmat4x4<valType> inverseTranspose(
+ detail::tmat4x4<valType> const & m)
+ {
+ valType SubFactor00 = m[2][2] * m[3][3] - m[3][2] * m[2][3];
+ valType SubFactor01 = m[2][1] * m[3][3] - m[3][1] * m[2][3];
+ valType SubFactor02 = m[2][1] * m[3][2] - m[3][1] * m[2][2];
+ valType SubFactor03 = m[2][0] * m[3][3] - m[3][0] * m[2][3];
+ valType SubFactor04 = m[2][0] * m[3][2] - m[3][0] * m[2][2];
+ valType SubFactor05 = m[2][0] * m[3][1] - m[3][0] * m[2][1];
+ valType SubFactor06 = m[1][2] * m[3][3] - m[3][2] * m[1][3];
+ valType SubFactor07 = m[1][1] * m[3][3] - m[3][1] * m[1][3];
+ valType SubFactor08 = m[1][1] * m[3][2] - m[3][1] * m[1][2];
+ valType SubFactor09 = m[1][0] * m[3][3] - m[3][0] * m[1][3];
+ valType SubFactor10 = m[1][0] * m[3][2] - m[3][0] * m[1][2];
+ valType SubFactor11 = m[1][1] * m[3][3] - m[3][1] * m[1][3];
+ valType SubFactor12 = m[1][0] * m[3][1] - m[3][0] * m[1][1];
+ valType SubFactor13 = m[1][2] * m[2][3] - m[2][2] * m[1][3];
+ valType SubFactor14 = m[1][1] * m[2][3] - m[2][1] * m[1][3];
+ valType SubFactor15 = m[1][1] * m[2][2] - m[2][1] * m[1][2];
+ valType SubFactor16 = m[1][0] * m[2][3] - m[2][0] * m[1][3];
+ valType SubFactor17 = m[1][0] * m[2][2] - m[2][0] * m[1][2];
+ valType SubFactor18 = m[1][0] * m[2][1] - m[2][0] * m[1][1];
+
+ detail::tmat4x4<valType> Inverse;
+ Inverse[0][0] = + (m[1][1] * SubFactor00 - m[1][2] * SubFactor01 + m[1][3] * SubFactor02);
+ Inverse[0][1] = - (m[1][0] * SubFactor00 - m[1][2] * SubFactor03 + m[1][3] * SubFactor04);
+ Inverse[0][2] = + (m[1][0] * SubFactor01 - m[1][1] * SubFactor03 + m[1][3] * SubFactor05);
+ Inverse[0][3] = - (m[1][0] * SubFactor02 - m[1][1] * SubFactor04 + m[1][2] * SubFactor05);
+
+ Inverse[1][0] = - (m[0][1] * SubFactor00 - m[0][2] * SubFactor01 + m[0][3] * SubFactor02);
+ Inverse[1][1] = + (m[0][0] * SubFactor00 - m[0][2] * SubFactor03 + m[0][3] * SubFactor04);
+ Inverse[1][2] = - (m[0][0] * SubFactor01 - m[0][1] * SubFactor03 + m[0][3] * SubFactor05);
+ Inverse[1][3] = + (m[0][0] * SubFactor02 - m[0][1] * SubFactor04 + m[0][2] * SubFactor05);
+
+ Inverse[2][0] = + (m[0][1] * SubFactor06 - m[0][2] * SubFactor07 + m[0][3] * SubFactor08);
+ Inverse[2][1] = - (m[0][0] * SubFactor06 - m[0][2] * SubFactor09 + m[0][3] * SubFactor10);
+ Inverse[2][2] = + (m[0][0] * SubFactor11 - m[0][1] * SubFactor09 + m[0][3] * SubFactor12);
+ Inverse[2][3] = - (m[0][0] * SubFactor08 - m[0][1] * SubFactor10 + m[0][2] * SubFactor12);
+
+ Inverse[3][0] = - (m[0][1] * SubFactor13 - m[0][2] * SubFactor14 + m[0][3] * SubFactor15);
+ Inverse[3][1] = + (m[0][0] * SubFactor13 - m[0][2] * SubFactor16 + m[0][3] * SubFactor17);
+ Inverse[3][2] = - (m[0][0] * SubFactor14 - m[0][1] * SubFactor16 + m[0][3] * SubFactor18);
+ Inverse[3][3] = + (m[0][0] * SubFactor15 - m[0][1] * SubFactor17 + m[0][2] * SubFactor18);
+
+ valType Determinant =
+ + m[0][0] * Inverse[0][0]
+ + m[0][1] * Inverse[0][1]
+ + m[0][2] * Inverse[0][2]
+ + m[0][3] * Inverse[0][3];
+
+ Inverse /= Determinant;
+
+ return Inverse;
+ }
+
+}//namespace matrix_inverse
+}//namespace gtc
+}//namespace glm
diff --git a/src/glm/gtc/matrix_transform.hpp b/src/glm/gtc/matrix_transform.hpp
new file mode 100644
index 0000000..ab1ce7f
--- /dev/null
+++ b/src/glm/gtc/matrix_transform.hpp
@@ -0,0 +1,158 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2009-04-29
+// Updated : 2009-04-29
+// Licence : This source is under MIT License
+// File : glm/gtc/matrix_transform.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+// - GLM_GTC_matrix_operation
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_gtc_matrix_transform
+#define glm_gtc_matrix_transform
+
+// Dependency:
+#include "../glm.hpp"
+
+#if(defined(GLM_MESSAGES) && !defined(glm_ext))
+# pragma message("GLM: GLM_GTC_matrix_transform extension included")
+#endif
+
+namespace glm{
+namespace gtc{
+namespace matrix_transform ///< GLM_GTC_matrix_transform extension: Add transformation matrices
+{
+ /// \addtogroup gtc_matrix_transform
+ ///@{
+
+ //! Builds a translation 4 * 4 matrix created from a vector of 3 components.
+ //! From GLM_GTC_matrix_transform extension.
+ template <typename T>
+ detail::tmat4x4<T> translate(
+ detail::tmat4x4<T> const & m,
+ detail::tvec3<T> const & v);
+
+ //! Builds a rotation 4 * 4 matrix created from an axis vector and an angle expressed in degrees.
+ //! From GLM_GTC_matrix_transform extension.
+ template <typename T>
+ detail::tmat4x4<T> rotate(
+ detail::tmat4x4<T> const & m,
+ T const & angle,
+ detail::tvec3<T> const & v);
+
+ //! Builds a scale 4 * 4 matrix created from 3 scalars.
+ //! From GLM_GTC_matrix_transform extension.
+ template <typename T>
+ detail::tmat4x4<T> scale(
+ detail::tmat4x4<T> const & m,
+ detail::tvec3<T> const & v);
+
+ //! Creates a matrix for an orthographic parallel viewing volume.
+ //! From GLM_GTC_matrix_transform extension.
+ template <typename T>
+ detail::tmat4x4<T> ortho(
+ T const & left,
+ T const & right,
+ T const & bottom,
+ T const & top,
+ T const & zNear,
+ T const & zFar);
+
+ //! Creates a matrix for projecting two-dimensional coordinates onto the screen.
+ //! From GLM_GTC_matrix_transform extension.
+ template <typename T>
+ detail::tmat4x4<T> ortho(
+ T const & left,
+ T const & right,
+ T const & bottom,
+ T const & top);
+
+ //! Creates a frustum matrix.
+ //! From GLM_GTC_matrix_transform extension.
+ template <typename T>
+ detail::tmat4x4<T> frustum(
+ T const & left,
+ T const & right,
+ T const & bottom,
+ T const & top,
+ T const & nearVal,
+ T const & farVal);
+
+ //! Creates a matrix for a symetric perspective-view frustum.
+ //! From GLM_GTC_matrix_transform extension.
+ template <typename T>
+ detail::tmat4x4<T> perspective(
+ T const & fovy,
+ T const & aspect,
+ T const & zNear,
+ T const & zFar);
+
+ //! Builds a perspective projection matrix based on a field of view
+ //! From GLM_GTC_matrix_transform extension.
+ template <typename valType>
+ detail::tmat4x4<valType> perspectiveFov(
+ valType const & fov,
+ valType const & width,
+ valType const & height,
+ valType const & zNear,
+ valType const & zFar);
+
+ //! Creates a matrix for a symmetric perspective-view frustum with far plane at infinite .
+ //! From GLM_GTC_matrix_transform extension.
+ template <typename T>
+ detail::tmat4x4<T> infinitePerspective(
+ T fovy, T aspect, T zNear);
+
+ //! Creates a matrix for a symmetric perspective-view frustum with far plane at infinite for graphics hardware that doesn't support depth clamping.
+ //! From GLM_GTC_matrix_transform extension.
+ template <typename T>
+ detail::tmat4x4<T> tweakedInfinitePerspective(
+ T fovy, T aspect, T zNear);
+
+ //! Map the specified object coordinates (obj.x, obj.y, obj.z) into window coordinates.
+ //! From GLM_GTC_matrix_transform extension.
+ template <typename T, typename U>
+ detail::tvec3<T> project(
+ detail::tvec3<T> const & obj,
+ detail::tmat4x4<T> const & model,
+ detail::tmat4x4<T> const & proj,
+ detail::tvec4<U> const & viewport);
+
+ //! Map the specified window coordinates (win.x, win.y, win.z) into object coordinates.
+ //! From GLM_GTC_matrix_transform extension.
+ template <typename T, typename U>
+ detail::tvec3<T> unProject(
+ detail::tvec3<T> const & win,
+ detail::tmat4x4<T> const & model,
+ detail::tmat4x4<T> const & proj,
+ detail::tvec4<U> const & viewport);
+
+ //! Define a picking region
+ //! From GLM_GTC_matrix_transform extension.
+ template <typename T, typename U>
+ detail::tmat4x4<T> pickMatrix(
+ detail::tvec2<T> const & center,
+ detail::tvec2<T> const & delta,
+ detail::tvec4<U> const & viewport);
+
+ //! Build a look at view matrix.
+ //! From GLM_GTC_matrix_transform extension.
+ template <typename T>
+ detail::tmat4x4<T> lookAt(
+ detail::tvec3<T> const & eye,
+ detail::tvec3<T> const & center,
+ detail::tvec3<T> const & up);
+
+ ///@}
+}//namespace matrix_transform
+}//namespace gtc
+}//namespace glm
+
+#include "matrix_transform.inl"
+
+namespace glm{using namespace gtc::matrix_transform;}
+
+#endif//glm_gtc_matrix_transform
diff --git a/src/glm/gtc/matrix_transform.inl b/src/glm/gtc/matrix_transform.inl
new file mode 100644
index 0000000..2b84faf
--- /dev/null
+++ b/src/glm/gtc/matrix_transform.inl
@@ -0,0 +1,397 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2009-04-29
+// Updated : 2009-04-29
+// Licence : This source is under MIT License
+// File : glm/gtc/matrix_transform.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm{
+namespace gtc{
+namespace matrix_transform
+{
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat4x4<T> translate
+ (
+ detail::tmat4x4<T> const & m,
+ detail::tvec3<T> const & v
+ )
+ {
+ detail::tmat4x4<T> Result(m);
+ Result[3] = m[0] * v[0] + m[1] * v[1] + m[2] * v[2] + m[3];
+ return Result;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat4x4<T> rotate
+ (
+ detail::tmat4x4<T> const & m,
+ T const & angle,
+ detail::tvec3<T> const & v
+ )
+ {
+ T a = radians(angle);
+ T c = cos(a);
+ T s = sin(a);
+
+ detail::tvec3<T> axis = normalize(v);
+
+ detail::tvec3<T> temp = (T(1) - c) * axis;
+
+ detail::tmat4x4<T> Rotate(detail::tmat4x4<T>::null);
+ Rotate[0][0] = c + temp[0] * axis[0];
+ Rotate[0][1] = 0 + temp[0] * axis[1] + s * axis[2];
+ Rotate[0][2] = 0 + temp[0] * axis[2] - s * axis[1];
+
+ Rotate[1][0] = 0 + temp[1] * axis[0] - s * axis[2];
+ Rotate[1][1] = c + temp[1] * axis[1];
+ Rotate[1][2] = 0 + temp[1] * axis[2] + s * axis[0];
+
+ Rotate[2][0] = 0 + temp[2] * axis[0] + s * axis[1];
+ Rotate[2][1] = 0 + temp[2] * axis[1] - s * axis[0];
+ Rotate[2][2] = c + temp[2] * axis[2];
+
+ detail::tmat4x4<T> Result(detail::tmat4x4<T>::null);
+ Result[0] = m[0] * Rotate[0][0] + m[1] * Rotate[0][1] + m[2] * Rotate[0][2];
+ Result[1] = m[0] * Rotate[1][0] + m[1] * Rotate[1][1] + m[2] * Rotate[1][2];
+ Result[2] = m[0] * Rotate[2][0] + m[1] * Rotate[2][1] + m[2] * Rotate[2][2];
+ Result[3] = m[3];
+ return Result;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat4x4<T> scale
+ (
+ detail::tmat4x4<T> const & m,
+ detail::tvec3<T> const & v
+ )
+ {
+ detail::tmat4x4<T> Result(detail::tmat4x4<T>::null);
+ Result[0] = m[0] * v[0];
+ Result[1] = m[1] * v[1];
+ Result[2] = m[2] * v[2];
+ Result[3] = m[3];
+ return Result;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat4x4<T> translate_slow
+ (
+ detail::tmat4x4<T> const & m,
+ detail::tvec3<T> const & v
+ )
+ {
+ detail::tmat4x4<T> Result(T(1));
+ Result[3] = detail::tvec4<T>(v, T(1));
+ return m * Result;
+
+ //detail::tmat4x4<valType> Result(m);
+ Result[3] = m[0] * v[0] + m[1] * v[1] + m[2] * v[2] + m[3];
+ //Result[3][0] = m[0][0] * v[0] + m[1][0] * v[1] + m[2][0] * v[2] + m[3][0];
+ //Result[3][1] = m[0][1] * v[0] + m[1][1] * v[1] + m[2][1] * v[2] + m[3][1];
+ //Result[3][2] = m[0][2] * v[0] + m[1][2] * v[1] + m[2][2] * v[2] + m[3][2];
+ //Result[3][3] = m[0][3] * v[0] + m[1][3] * v[1] + m[2][3] * v[2] + m[3][3];
+ //return Result;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat4x4<T> rotate_slow
+ (
+ detail::tmat4x4<T> const & m,
+ T const & angle,
+ detail::tvec3<T> const & v
+ )
+ {
+ T a = radians(angle);
+ T c = cos(a);
+ T s = sin(a);
+ detail::tmat4x4<T> Result;
+
+ detail::tvec3<T> axis = normalize(v);
+
+ Result[0][0] = c + (1 - c) * axis.x * axis.x;
+ Result[0][1] = (1 - c) * axis.x * axis.y + s * axis.z;
+ Result[0][2] = (1 - c) * axis.x * axis.z - s * axis.y;
+ Result[0][3] = 0;
+
+ Result[1][0] = (1 - c) * axis.y * axis.x - s * axis.z;
+ Result[1][1] = c + (1 - c) * axis.y * axis.y;
+ Result[1][2] = (1 - c) * axis.y * axis.z + s * axis.x;
+ Result[1][3] = 0;
+
+ Result[2][0] = (1 - c) * axis.z * axis.x + s * axis.y;
+ Result[2][1] = (1 - c) * axis.z * axis.y - s * axis.x;
+ Result[2][2] = c + (1 - c) * axis.z * axis.z;
+ Result[2][3] = 0;
+
+ Result[3] = detail::tvec4<T>(0, 0, 0, 1);
+ return m * Result;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat4x4<T> scale_slow
+ (
+ detail::tmat4x4<T> const & m,
+ detail::tvec3<T> const & v
+ )
+ {
+ detail::tmat4x4<T> Result(T(1));
+ Result[0][0] = v.x;
+ Result[1][1] = v.y;
+ Result[2][2] = v.z;
+ return m * Result;
+ }
+
+ template <typename valType>
+ GLM_FUNC_QUALIFIER detail::tmat4x4<valType> ortho
+ (
+ valType const & left,
+ valType const & right,
+ valType const & bottom,
+ valType const & top,
+ valType const & zNear,
+ valType const & zFar
+ )
+ {
+ detail::tmat4x4<valType> Result(1);
+ Result[0][0] = valType(2) / (right - left);
+ Result[1][1] = valType(2) / (top - bottom);
+ Result[2][2] = - valType(2) / (zFar - zNear);
+ Result[3][0] = - (right + left) / (right - left);
+ Result[3][1] = - (top + bottom) / (top - bottom);
+ Result[3][2] = - (zFar + zNear) / (zFar - zNear);
+ return Result;
+ }
+
+ template <typename valType>
+ GLM_FUNC_QUALIFIER detail::tmat4x4<valType> ortho(
+ valType const & left,
+ valType const & right,
+ valType const & bottom,
+ valType const & top)
+ {
+ detail::tmat4x4<valType> Result(1);
+ Result[0][0] = valType(2) / (right - left);
+ Result[1][1] = valType(2) / (top - bottom);
+ Result[2][2] = - valType(1);
+ Result[3][0] = - (right + left) / (right - left);
+ Result[3][1] = - (top + bottom) / (top - bottom);
+ return Result;
+ }
+
+ template <typename valType>
+ GLM_FUNC_QUALIFIER detail::tmat4x4<valType> frustum
+ (
+ valType const & left,
+ valType const & right,
+ valType const & bottom,
+ valType const & top,
+ valType const & nearVal,
+ valType const & farVal
+ )
+ {
+ detail::tmat4x4<valType> Result(0);
+ Result[0][0] = (valType(2) * nearVal) / (right - left);
+ Result[1][1] = (valType(2) * nearVal) / (top - bottom);
+ Result[2][0] = (right + left) / (right - left);
+ Result[2][1] = (top + bottom) / (top - bottom);
+ Result[2][2] = -(farVal + nearVal) / (farVal - nearVal);
+ Result[2][3] = valType(-1);
+ Result[3][2] = -(valType(2) * farVal * nearVal) / (farVal - nearVal);
+ return Result;
+ }
+
+ template <typename valType>
+ GLM_FUNC_QUALIFIER detail::tmat4x4<valType> perspective
+ (
+ valType const & fovy,
+ valType const & aspect,
+ valType const & zNear,
+ valType const & zFar
+ )
+ {
+ valType range = tan(radians(fovy / valType(2))) * zNear;
+ valType left = -range * aspect;
+ valType right = range * aspect;
+ valType bottom = -range;
+ valType top = range;
+
+ detail::tmat4x4<valType> Result(valType(0));
+ Result[0][0] = (valType(2) * zNear) / (right - left);
+ Result[1][1] = (valType(2) * zNear) / (top - bottom);
+ Result[2][2] = - (zFar + zNear) / (zFar - zNear);
+ Result[2][3] = - valType(1);
+ Result[3][2] = - (valType(2) * zFar * zNear) / (zFar - zNear);
+ return Result;
+ }
+
+ template <typename valType>
+ GLM_FUNC_QUALIFIER detail::tmat4x4<valType> perspectiveFov
+ (
+ valType const & fov,
+ valType const & width,
+ valType const & height,
+ valType const & zNear,
+ valType const & zFar
+ )
+ {
+ valType rad = glm::radians(fov);
+ valType h = glm::cos(valType(0.5) * rad) / glm::sin(valType(0.5) * rad);
+ valType w = h * height / width;
+
+ detail::tmat4x4<valType> Result(valType(0));
+ Result[0][0] = w;
+ Result[1][1] = h;
+ Result[2][2] = (zFar + zNear) / (zFar - zNear);
+ Result[2][3] = valType(1);
+ Result[3][2] = -(valType(2) * zFar * zNear) / (zFar - zNear);
+ return Result;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat4x4<T> infinitePerspective
+ (
+ T fovy,
+ T aspect,
+ T zNear
+ )
+ {
+ T range = tan(radians(fovy / T(2))) * zNear;
+ T left = -range * aspect;
+ T right = range * aspect;
+ T bottom = -range;
+ T top = range;
+
+ detail::tmat4x4<T> Result(T(0));
+ Result[0][0] = (T(2) * zNear) / (right - left);
+ Result[1][1] = (T(2) * zNear) / (top - bottom);
+ Result[2][2] = - T(1);
+ Result[2][3] = - T(1);
+ Result[3][2] = - T(2) * zNear;
+ return Result;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat4x4<T> tweakedInfinitePerspective
+ (
+ T fovy,
+ T aspect,
+ T zNear
+ )
+ {
+ T range = tan(radians(fovy / T(2))) * zNear;
+ T left = -range * aspect;
+ T right = range * aspect;
+ T bottom = -range;
+ T top = range;
+
+ detail::tmat4x4<T> Result(T(0));
+ Result[0][0] = (T(2) * zNear) / (right - left);
+ Result[1][1] = (T(2) * zNear) / (top - bottom);
+ Result[2][2] = T(0.0001) - T(1);
+ Result[2][3] = T(-1);
+ Result[3][2] = - (T(0.0001) - T(2)) * zNear;
+ return Result;
+ }
+
+ template <typename T, typename U>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> project
+ (
+ detail::tvec3<T> const & obj,
+ detail::tmat4x4<T> const & model,
+ detail::tmat4x4<T> const & proj,
+ detail::tvec4<U> const & viewport
+ )
+ {
+ detail::tvec4<T> tmp = detail::tvec4<T>(obj, T(1));
+ tmp = model * tmp;
+ tmp = proj * tmp;
+
+ tmp /= tmp.w;
+ tmp = tmp * T(0.5) + T(0.5);
+ tmp[0] = tmp[0] * T(viewport[2]) + T(viewport[0]);
+ tmp[1] = tmp[1] * T(viewport[3]) + T(viewport[1]);
+
+ return detail::tvec3<T>(tmp);
+ }
+
+ template <typename T, typename U>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> unProject
+ (
+ detail::tvec3<T> const & win,
+ detail::tmat4x4<T> const & model,
+ detail::tmat4x4<T> const & proj,
+ detail::tvec4<U> const & viewport
+ )
+ {
+ detail::tmat4x4<T> inverse = glm::inverse(proj * model);
+
+ detail::tvec4<T> tmp = detail::tvec4<T>(win, T(1));
+ tmp.x = (tmp.x - T(viewport[0])) / T(viewport[2]);
+ tmp.y = (tmp.y - T(viewport[1])) / T(viewport[3]);
+ tmp = tmp * T(2) - T(1);
+
+ detail::tvec4<T> obj = inverse * tmp;
+ obj /= obj.w;
+
+ return detail::tvec3<T>(obj);
+ }
+
+ template <typename T, typename U>
+ detail::tmat4x4<T> pickMatrix
+ (
+ detail::tvec2<T> const & center,
+ detail::tvec2<T> const & delta,
+ detail::tvec4<U> const & viewport
+ )
+ {
+ assert(delta.x > T(0) && delta.y > T(0));
+ detail::tmat4x4<T> Result(1.0f);
+
+ if(!(delta.x > T(0) && delta.y > T(0)))
+ return Result; // Error
+
+ detail::tvec3<T> Temp(
+ (T(viewport[2]) - T(2) * (center.x - T(viewport[0]))) / delta.x,
+ (T(viewport[3]) - T(2) * (center.y - T(viewport[1]))) / delta.y,
+ T(0));
+
+ // Translate and scale the picked region to the entire window
+ Result = translate(Result, Temp);
+ return scale(Result, detail::tvec3<T>(T(viewport[2]) / delta.x, T(viewport[3]) / delta.y, T(1)));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat4x4<T> lookAt
+ (
+ detail::tvec3<T> const & eye,
+ detail::tvec3<T> const & center,
+ detail::tvec3<T> const & up
+ )
+ {
+ detail::tvec3<T> f = normalize(center - eye);
+ detail::tvec3<T> u = normalize(up);
+ detail::tvec3<T> s = normalize(cross(f, u));
+ u = cross(s, f);
+
+ detail::tmat4x4<T> Result(1);
+ Result[0][0] = s.x;
+ Result[1][0] = s.y;
+ Result[2][0] = s.z;
+ Result[0][1] = u.x;
+ Result[1][1] = u.y;
+ Result[2][1] = u.z;
+ Result[0][2] =-f.x;
+ Result[1][2] =-f.y;
+ Result[2][2] =-f.z;
+ /* Test this instead of translate3D
+ Result[3][0] =-dot(s, eye);
+ Result[3][1] =-dot(y, eye);
+ Result[3][2] = dot(f, eye);
+ */
+ return gtc::matrix_transform::translate(Result, -eye);
+ }
+}//namespace matrix_transform
+}//namespace gtc
+}//namespace glm
diff --git a/src/glm/gtc/quaternion.hpp b/src/glm/gtc/quaternion.hpp
new file mode 100644
index 0000000..4fc8ca3
--- /dev/null
+++ b/src/glm/gtc/quaternion.hpp
@@ -0,0 +1,245 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2009-05-21
+// Updated : 2010-02-04
+// Licence : This source is under MIT License
+// File : glm/gtc/quaternion.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+// - GLM_GTC_half_float
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// ToDo:
+// - Study constructors with angles and axis
+// - Study constructors with vec3 that are the imaginary component of quaternion
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_gtc_quaternion
+#define glm_gtc_quaternion
+
+// Dependency:
+#include "../glm.hpp"
+#include "../gtc/half_float.hpp"
+
+#if(defined(GLM_MESSAGES) && !defined(glm_ext))
+# pragma message("GLM: GLM_GTC_quaternion extension included")
+#endif
+
+namespace glm{
+namespace detail
+{
+ //! \brief Template for quaternion.
+ //! From GLM_GTC_quaternion extension.
+ /// \ingroup gtc_quaternion
+ template <typename T>
+ struct tquat// : public genType<T, tquat>
+ {
+ typedef T value_type;
+
+ public:
+ value_type x, y, z, w;
+
+ // Constructors
+ tquat();
+ explicit tquat(
+ value_type const & s,
+ tvec3<T> const & v);
+ explicit tquat(
+ value_type const & w,
+ value_type const & x,
+ value_type const & y,
+ value_type const & z);
+
+ // Convertions
+ //explicit tquat(valType const & pitch, valType const & yaw, valType const & roll);
+ //! pitch, yaw, roll
+ explicit tquat(
+ tvec3<T> const & eulerAngles);
+ explicit tquat(
+ tmat3x3<T> const & m);
+ explicit tquat(
+ tmat4x4<T> const & m);
+
+ // Accesses
+ value_type & operator[](int i);
+ value_type const & operator[](int i) const;
+
+ // Operators
+ tquat<T> & operator*=(value_type const & s);
+ tquat<T> & operator/=(value_type const & s);
+ };
+
+ template <typename T>
+ detail::tquat<T> operator- (
+ detail::tquat<T> const & q);
+
+ template <typename T>
+ detail::tquat<T> operator+ (
+ detail::tquat<T> const & q,
+ detail::tquat<T> const & p);
+
+ template <typename T>
+ detail::tquat<T> operator* (
+ detail::tquat<T> const & q,
+ detail::tquat<T> const & p);
+
+ template <typename T>
+ detail::tvec3<T> operator* (
+ detail::tquat<T> const & q,
+ detail::tvec3<T> const & v);
+
+ template <typename T>
+ detail::tvec3<T> operator* (
+ detail::tvec3<T> const & v,
+ detail::tquat<T> const & q);
+
+ template <typename T>
+ detail::tvec4<T> operator* (
+ detail::tquat<T> const & q,
+ detail::tvec4<T> const & v);
+
+ template <typename T>
+ detail::tvec4<T> operator* (
+ detail::tvec4<T> const & v,
+ detail::tquat<T> const & q);
+
+ template <typename T>
+ detail::tquat<T> operator* (
+ detail::tquat<T> const & q,
+ typename detail::tquat<T>::value_type const & s);
+
+ template <typename T>
+ detail::tquat<T> operator* (
+ typename detail::tquat<T>::value_type const & s,
+ detail::tquat<T> const & q);
+
+ template <typename T>
+ detail::tquat<T> operator/ (
+ detail::tquat<T> const & q,
+ typename detail::tquat<T>::value_type const & s);
+
+} //namespace detail
+
+namespace gtc{
+namespace quaternion ///< GLM_GTC_quaternion extension: Quaternion types and functions
+{
+ /// \addtogroup gtc_quaternion
+ ///@{
+
+ //! Returns the length of the quaternion.
+ //! From GLM_GTC_quaternion extension.
+ template <typename T>
+ typename detail::tquat<T>::value_type length(
+ detail::tquat<T> const & q);
+
+ //! Returns the normalized quaternion.
+ //! From GLM_GTC_quaternion extension.
+ template <typename T>
+ detail::tquat<T> normalize(
+ detail::tquat<T> const & q);
+
+ //! Returns dot product of q1 and q2, i.e., q1[0] * q2[0] + q1[1] * q2[1] + ...
+ //! From GLM_GTC_quaternion extension.
+ template <typename T>
+ typename detail::tquat<T>::value_type dot(
+ detail::tquat<T> const & q1,
+ detail::tquat<T> const & q2);
+
+ //! Returns the cross product of q1 and q2.
+ //! From GLM_GTC_quaternion extension.
+ template <typename T>
+ GLM_DEPRECATED detail::tquat<T> cross(
+ detail::tquat<T> const & q1,
+ detail::tquat<T> const & q2);
+
+ //! Returns a SLERP interpolated quaternion of x and y according a.
+ //! From GLM_GTC_quaternion extension.
+ template <typename T>
+ detail::tquat<T> mix(
+ detail::tquat<T> const & x,
+ detail::tquat<T> const & y,
+ T const & a);
+
+ //! Returns the q conjugate.
+ //! From GLM_GTC_quaternion extension.
+ template <typename T>
+ detail::tquat<T> conjugate(
+ detail::tquat<T> const & q);
+
+ //! Returns the q inverse.
+ //! From GLM_GTC_quaternion extension.
+ template <typename T>
+ detail::tquat<T> inverse(
+ detail::tquat<T> const & q);
+
+ //! Rotates a quaternion from an vector of 3 components axis and an angle expressed in degrees.
+ //! From GLM_GTC_quaternion extension.
+ template <typename T>
+ detail::tquat<T> rotate(
+ detail::tquat<T> const & q,
+ typename detail::tquat<T>::value_type const & angle,
+ detail::tvec3<T> const & v);
+
+ //! Converts a quaternion to a 3 * 3 matrix.
+ //! From GLM_GTC_quaternion extension.
+ template <typename T>
+ detail::tmat3x3<T> mat3_cast(
+ detail::tquat<T> const & x);
+
+ //! Converts a quaternion to a 4 * 4 matrix.
+ //! From GLM_GTC_quaternion extension.
+ template <typename T>
+ detail::tmat4x4<T> mat4_cast(
+ detail::tquat<T> const & x);
+
+ //! Converts a 3 * 3 matrix to a quaternion.
+ //! From GLM_GTC_quaternion extension.
+ template <typename T>
+ detail::tquat<T> quat_cast(
+ detail::tmat3x3<T> const & x);
+
+ //! Converts a 4 * 4 matrix to a quaternion.
+ //! From GLM_GTC_quaternion extension.
+ template <typename T>
+ detail::tquat<T> quat_cast(
+ detail::tmat4x4<T> const & x);
+
+ //! Quaternion of floating-point numbers.
+ //! From GLM_GTC_quaternion extension.
+ typedef detail::tquat<float> quat;
+
+ //! Quaternion of half-precision floating-point numbers.
+ //! From GLM_GTC_quaternion extension.
+ typedef detail::tquat<detail::thalf> hquat;
+
+ //! Quaternion of single-precision floating-point numbers.
+ //! From GLM_GTC_quaternion extension.
+ typedef detail::tquat<float> fquat;
+
+ //! Quaternion of double-precision floating-point numbers.
+ //! From GLM_GTC_quaternion extension.
+ typedef detail::tquat<double> dquat;
+
+ //! Quaternion of low precision floating-point numbers.
+ //! From GLM_GTC_quaternion extension.
+ typedef detail::tquat<lowp_float> lowp_quat;
+
+ //! Quaternion of medium precision floating-point numbers.
+ //! From GLM_GTC_quaternion extension.
+ typedef detail::tquat<mediump_float> mediump_quat;
+
+ //! Quaternion of high precision floating-point numbers.
+ //! From GLM_GTC_quaternion extension.
+ typedef detail::tquat<highp_float> highp_quat;
+ ///@}
+
+} //namespace quaternion
+} //namespace gtc
+} //namespace glm
+
+#include "quaternion.inl"
+
+namespace glm{using namespace gtc::quaternion;}
+
+#endif//glm_gtc_quaternion
diff --git a/src/glm/gtc/quaternion.inl b/src/glm/gtc/quaternion.inl
new file mode 100644
index 0000000..3090527
--- /dev/null
+++ b/src/glm/gtc/quaternion.inl
@@ -0,0 +1,584 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2009-05-21
+// Updated : 2010-02-04
+// Licence : This source is under MIT License
+// File : glm/gtc/quaternion.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <limits>
+
+namespace glm{
+namespace detail{
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tquat<T>::tquat() :
+ x(0),
+ y(0),
+ z(0),
+ w(1)
+ {}
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tquat<T>::tquat
+ (
+ value_type const & s,
+ tvec3<T> const & v
+ ) :
+ x(v.x),
+ y(v.y),
+ z(v.z),
+ w(s)
+ {}
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tquat<T>::tquat
+ (
+ value_type const & w,
+ value_type const & x,
+ value_type const & y,
+ value_type const & z
+ ) :
+ x(x),
+ y(y),
+ z(z),
+ w(w)
+ {}
+
+ //////////////////////////////////////////////////////////////
+ // tquat conversions
+
+ //template <typename valType>
+ //GLM_FUNC_QUALIFIER tquat<valType>::tquat
+ //(
+ // valType const & pitch,
+ // valType const & yaw,
+ // valType const & roll
+ //)
+ //{
+ // tvec3<valType> eulerAngle(pitch * valType(0.5), yaw * valType(0.5), roll * valType(0.5));
+ // tvec3<valType> c = glm::cos(eulerAngle * valType(0.5));
+ // tvec3<valType> s = glm::sin(eulerAngle * valType(0.5));
+ //
+ // this->w = c.x * c.y * c.z + s.x * s.y * s.z;
+ // this->x = s.x * c.y * c.z - c.x * s.y * s.z;
+ // this->y = c.x * s.y * c.z + s.x * c.y * s.z;
+ // this->z = c.x * c.y * s.z - s.x * s.y * c.z;
+ //}
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tquat<T>::tquat
+ (
+ tvec3<T> const & eulerAngle
+ )
+ {
+ tvec3<T> c = glm::cos(eulerAngle * value_type(0.5));
+ tvec3<T> s = glm::sin(eulerAngle * value_type(0.5));
+
+ this->w = c.x * c.y * c.z + s.x * s.y * s.z;
+ this->x = s.x * c.y * c.z - c.x * s.y * s.z;
+ this->y = c.x * s.y * c.z + s.x * c.y * s.z;
+ this->z = c.x * c.y * s.z - s.x * s.y * c.z;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tquat<T>::tquat
+ (
+ tmat3x3<T> const & m
+ )
+ {
+ *this = toQuat(m);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tquat<T>::tquat
+ (
+ tmat4x4<T> const & m
+ )
+ {
+ *this = toQuat(m);
+ }
+
+ //////////////////////////////////////////////////////////////
+ // tquat<T> accesses
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tquat<T>::value_type & tquat<T>::operator [] (int i)
+ {
+ return (&x)[i];
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename tquat<T>::value_type const & tquat<T>::operator [] (int i) const
+ {
+ return (&x)[i];
+ }
+
+ //////////////////////////////////////////////////////////////
+ // tquat<valType> operators
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tquat<T> & tquat<T>::operator *=
+ (
+ value_type const & s
+ )
+ {
+ this->w *= s;
+ this->x *= s;
+ this->y *= s;
+ this->z *= s;
+ return *this;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER tquat<T> & tquat<T>::operator /=
+ (
+ value_type const & s
+ )
+ {
+ this->w /= s;
+ this->x /= s;
+ this->y /= s;
+ this->z /= s;
+ return *this;
+ }
+
+ //////////////////////////////////////////////////////////////
+ // tquat<valType> external operators
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tquat<T> operator-
+ (
+ detail::tquat<T> const & q
+ )
+ {
+ return detail::tquat<T>(-q.w, -q.x, -q.y, -q.z);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tquat<T> operator+
+ (
+ detail::tquat<T> const & q,
+ detail::tquat<T> const & p
+ )
+ {
+ return detail::tquat<T>(
+ q.w + p.w,
+ q.x + p.x,
+ q.y + p.y,
+ q.z + p.z);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tquat<T> operator*
+ (
+ detail::tquat<T> const & q,
+ detail::tquat<T> const & p
+ )
+ {
+ return detail::tquat<T>(
+ q.w * p.w - q.x * p.x - q.y * p.y - q.z * p.z,
+ q.w * p.x + q.x * p.w + q.y * p.z - q.z * p.y,
+ q.w * p.y + q.y * p.w + q.z * p.x - q.x * p.z,
+ q.w * p.z + q.z * p.w + q.x * p.y - q.y * p.x);
+ }
+
+ // Transformation
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> operator*
+ (
+ detail::tquat<T> const & q,
+ detail::tvec3<T> const & v
+ )
+ {
+ typename detail::tquat<T>::value_type Two(2);
+
+ detail::tvec3<T> uv, uuv;
+ detail::tvec3<T> QuatVector(q.x, q.y, q.z);
+ uv = glm::cross(QuatVector, v);
+ uuv = glm::cross(QuatVector, uv);
+ uv *= (Two * q.w);
+ uuv *= Two;
+
+ return v + uv + uuv;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> operator*
+ (
+ detail::tvec3<T> const & v,
+ detail::tquat<T> const & q
+ )
+ {
+ return gtc::quaternion::inverse(q) * v;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> operator*
+ (
+ detail::tquat<T> const & q,
+ detail::tvec4<T> const & v
+ )
+ {
+ return detail::tvec4<T>(q * detail::tvec3<T>(v), v.w);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> operator*
+ (
+ detail::tvec4<T> const & v,
+ detail::tquat<T> const & q
+ )
+ {
+ return gtc::quaternion::inverse(q) * v;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tquat<T> operator*
+ (
+ detail::tquat<T> const & q,
+ typename detail::tquat<T>::value_type const & s
+ )
+ {
+ return detail::tquat<T>(
+ q.w * s, q.x * s, q.y * s, q.z * s);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tquat<T> operator*
+ (
+ typename detail::tquat<T>::value_type const & s,
+ detail::tquat<T> const & q
+ )
+ {
+ return q * s;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tquat<T> operator/
+ (
+ detail::tquat<T> const & q,
+ typename detail::tquat<T>::value_type const & s
+ )
+ {
+ return detail::tquat<T>(
+ q.w / s, q.x / s, q.y / s, q.z / s);
+ }
+
+ //////////////////////////////////////
+ // Boolean operators
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER bool operator==
+ (
+ detail::tquat<T> const & q1,
+ detail::tquat<T> const & q2
+ )
+ {
+ return (q1.x == q2.x) && (q1.y == q2.y) && (q1.z == q2.z) && (q1.w == q2.w);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER bool operator!=
+ (
+ detail::tquat<T> const & q1,
+ detail::tquat<T> const & q2
+ )
+ {
+ return (q1.x != q2.x) || (q1.y != q2.y) || (q1.z != q2.z) || (q1.w != q2.w);
+ }
+
+}//namespace detail
+
+namespace gtc{
+namespace quaternion{
+
+ ////////////////////////////////////////////////////////
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename detail::tquat<T>::value_type length
+ (
+ detail::tquat<T> const & q
+ )
+ {
+ return glm::sqrt(dot(q, q));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tquat<T> normalize
+ (
+ detail::tquat<T> const & q
+ )
+ {
+ typename detail::tquat<T>::value_type len = length(q);
+ if(len <= typename detail::tquat<T>::value_type(0)) // Problem
+ return detail::tquat<T>(1, 0, 0, 0);
+ typename detail::tquat<T>::value_type oneOverLen = typename detail::tquat<T>::value_type(1) / len;
+ return detail::tquat<T>(q.w * oneOverLen, q.x * oneOverLen, q.y * oneOverLen, q.z * oneOverLen);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER typename detail::tquat<T>::value_type dot
+ (
+ detail::tquat<T> const & q1,
+ detail::tquat<T> const & q2
+ )
+ {
+ return q1.x * q2.x + q1.y * q2.y + q1.z * q2.z + q1.w * q2.w;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tquat<T> cross
+ (
+ detail::tquat<T> const & q1,
+ detail::tquat<T> const & q2
+ )
+ {
+ return detail::tquat<T>(
+ q1.w * q2.w - q1.x * q2.x - q1.y * q2.y - q1.z * q2.z,
+ q1.w * q2.x + q1.x * q2.w + q1.y * q2.z - q1.z * q2.y,
+ q1.w * q2.y + q1.y * q2.w + q1.z * q2.x - q1.x * q2.z,
+ q1.w * q2.z + q1.z * q2.w + q1.x * q2.y - q1.y * q2.x);
+ }
+/*
+ // (x * sin(1 - a) * angle / sin(angle)) + (y * sin(a) * angle / sin(angle))
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tquat<T> mix
+ (
+ detail::tquat<T> const & x,
+ detail::tquat<T> const & y,
+ typename detail::tquat<T>::value_type const & a
+ )
+ {
+ if(a <= typename detail::tquat<T>::value_type(0)) return x;
+ if(a >= typename detail::tquat<T>::value_type(1)) return y;
+
+ float fCos = dot(x, y);
+ detail::tquat<T> y2(y); //BUG!!! tquat<T> y2;
+ if(fCos < typename detail::tquat<T>::value_type(0))
+ {
+ y2 = -y;
+ fCos = -fCos;
+ }
+
+ //if(fCos > 1.0f) // problem
+ float k0, k1;
+ if(fCos > typename detail::tquat<T>::value_type(0.9999))
+ {
+ k0 = typename detail::tquat<T>::value_type(1) - a;
+ k1 = typename detail::tquat<T>::value_type(0) + a; //BUG!!! 1.0f + a;
+ }
+ else
+ {
+ typename detail::tquat<T>::value_type fSin = sqrt(T(1) - fCos * fCos);
+ typename detail::tquat<T>::value_type fAngle = atan(fSin, fCos);
+ typename detail::tquat<T>::value_type fOneOverSin = T(1) / fSin;
+ k0 = sin((typename detail::tquat<T>::value_type(1) - a) * fAngle) * fOneOverSin;
+ k1 = sin((typename detail::tquat<T>::value_type(0) + a) * fAngle) * fOneOverSin;
+ }
+
+ return detail::tquat<T>(
+ k0 * x.w + k1 * y2.w,
+ k0 * x.x + k1 * y2.x,
+ k0 * x.y + k1 * y2.y,
+ k0 * x.z + k1 * y2.z);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tquat<T> mix2
+ (
+ detail::tquat<T> const & x,
+ detail::tquat<T> const & y,
+ T const & a
+ )
+ {
+ bool flip = false;
+ if(a <= T(0)) return x;
+ if(a >= T(1)) return y;
+
+ T cos_t = dot(x, y);
+ if(cos_t < T(0))
+ {
+ cos_t = -cos_t;
+ flip = true;
+ }
+
+ T alpha(0), beta(0);
+
+ if(T(1) - cos_t < 1e-7)
+ beta = T(1) - alpha;
+ else
+ {
+ T theta = acos(cos_t);
+ T sin_t = sin(theta);
+ beta = sin(theta * (T(1) - alpha)) / sin_t;
+ alpha = sin(alpha * theta) / sin_t;
+ }
+
+ if(flip)
+ alpha = -alpha;
+
+ return normalize(beta * x + alpha * y);
+ }
+*/
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tquat<T> mix
+ (
+ detail::tquat<T> const & x,
+ detail::tquat<T> const & y,
+ T const & a
+ )
+ {
+ T angle = acos(dot(x, y));
+ return (glm::sin((T(1) - a) * angle) * x + glm::sin(a * angle) * y) / glm::sin(angle);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tquat<T> conjugate
+ (
+ detail::tquat<T> const & q
+ )
+ {
+ return detail::tquat<T>(q.w, -q.x, -q.y, -q.z);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tquat<T> inverse
+ (
+ detail::tquat<T> const & q
+ )
+ {
+ return gtc::quaternion::conjugate(q) / gtc::quaternion::dot(q, q);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tquat<T> rotate
+ (
+ detail::tquat<T> const & q,
+ typename detail::tquat<T>::value_type const & angle,
+ detail::tvec3<T> const & v
+ )
+ {
+ detail::tvec3<T> Tmp = v;
+
+ // Axis of rotation must be normalised
+ typename detail::tquat<T>::value_type len = glm::core::function::geometric::length(Tmp);
+ if(abs(len - typename detail::tquat<T>::value_type(1)) > typename detail::tquat<T>::value_type(0.001))
+ {
+ T oneOverLen = T(1) / len;
+ Tmp.x *= oneOverLen;
+ Tmp.y *= oneOverLen;
+ Tmp.z *= oneOverLen;
+ }
+
+ typename detail::tquat<T>::value_type AngleRad = radians(angle);
+ typename detail::tquat<T>::value_type fSin = sin(AngleRad * T(0.5));
+
+ return gtc::quaternion::cross(q, detail::tquat<T>(cos(AngleRad * T(0.5)), Tmp.x * fSin, Tmp.y * fSin, Tmp.z * fSin));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat3x3<T> mat3_cast
+ (
+ detail::tquat<T> const & q
+ )
+ {
+ detail::tmat3x3<T> Result(typename detail::tquat<T>::value_type(1));
+ Result[0][0] = 1 - 2 * q.y * q.y - 2 * q.z * q.z;
+ Result[0][1] = 2 * q.x * q.y + 2 * q.w * q.z;
+ Result[0][2] = 2 * q.x * q.z - 2 * q.w * q.y;
+
+ Result[1][0] = 2 * q.x * q.y - 2 * q.w * q.z;
+ Result[1][1] = 1 - 2 * q.x * q.x - 2 * q.z * q.z;
+ Result[1][2] = 2 * q.y * q.z + 2 * q.w * q.x;
+
+ Result[2][0] = 2 * q.x * q.z + 2 * q.w * q.y;
+ Result[2][1] = 2 * q.y * q.z - 2 * q.w * q.x;
+ Result[2][2] = 1 - 2 * q.x * q.x - 2 * q.y * q.y;
+ return Result;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat4x4<T> mat4_cast
+ (
+ detail::tquat<T> const & q
+ )
+ {
+ return detail::tmat4x4<T>(mat3_cast(q));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tquat<T> quat_cast
+ (
+ detail::tmat3x3<T> const & m
+ )
+ {
+ typename detail::tquat<T>::value_type fourXSquaredMinus1 = m[0][0] - m[1][1] - m[2][2];
+ typename detail::tquat<T>::value_type fourYSquaredMinus1 = m[1][1] - m[0][0] - m[2][2];
+ typename detail::tquat<T>::value_type fourZSquaredMinus1 = m[2][2] - m[0][0] - m[1][1];
+ typename detail::tquat<T>::value_type fourWSquaredMinus1 = m[0][0] + m[1][1] + m[2][2];
+
+ int biggestIndex = 0;
+ typename detail::tquat<T>::value_type fourBiggestSquaredMinus1 = fourWSquaredMinus1;
+ if(fourXSquaredMinus1 > fourBiggestSquaredMinus1)
+ {
+ fourBiggestSquaredMinus1 = fourXSquaredMinus1;
+ biggestIndex = 1;
+ }
+ if(fourYSquaredMinus1 > fourBiggestSquaredMinus1)
+ {
+ fourBiggestSquaredMinus1 = fourYSquaredMinus1;
+ biggestIndex = 2;
+ }
+ if(fourZSquaredMinus1 > fourBiggestSquaredMinus1)
+ {
+ fourBiggestSquaredMinus1 = fourZSquaredMinus1;
+ biggestIndex = 3;
+ }
+
+ typename detail::tquat<T>::value_type biggestVal = sqrt(fourBiggestSquaredMinus1 + typename detail::tquat<T>::value_type(1)) * typename detail::tquat<T>::value_type(0.5);
+ typename detail::tquat<T>::value_type mult = typename detail::tquat<T>::value_type(0.25) / biggestVal;
+
+ detail::tquat<T> Result;
+ switch(biggestIndex)
+ {
+ case 0:
+ Result.w = biggestVal;
+ Result.x = (m[1][2] - m[2][1]) * mult;
+ Result.y = (m[2][0] - m[0][2]) * mult;
+ Result.z = (m[0][1] - m[1][0]) * mult;
+ break;
+ case 1:
+ Result.w = (m[1][2] - m[2][1]) * mult;
+ Result.x = biggestVal;
+ Result.y = (m[0][1] + m[1][0]) * mult;
+ Result.z = (m[2][0] + m[0][2]) * mult;
+ break;
+ case 2:
+ Result.w = (m[2][0] - m[0][2]) * mult;
+ Result.x = (m[0][1] + m[1][0]) * mult;
+ Result.y = biggestVal;
+ Result.z = (m[1][2] + m[2][1]) * mult;
+ break;
+ case 3:
+ Result.w = (m[0][1] - m[1][0]) * mult;
+ Result.x = (m[2][0] + m[0][2]) * mult;
+ Result.y = (m[1][2] + m[2][1]) * mult;
+ Result.z = biggestVal;
+ break;
+ }
+ return Result;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tquat<T> quat_cast
+ (
+ detail::tmat4x4<T> const & m4
+ )
+ {
+ return quat_cast(detail::tmat3x3<T>(m4));
+ }
+
+}//namespace quaternion
+}//namespace gtc
+}//namespace glm
diff --git a/src/glm/gtc/swizzle.hpp b/src/glm/gtc/swizzle.hpp
new file mode 100644
index 0000000..10c0836
--- /dev/null
+++ b/src/glm/gtc/swizzle.hpp
@@ -0,0 +1,354 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2010-02-20
+// Updated : 2010-02-20
+// Licence : This source is under MIT License
+// File : glm/gtc/swizzle.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_gtc_swizzle
+#define glm_gtc_swizzle
+
+// Dependency:
+#include "../glm.hpp"
+#include "../gtc/type_precision.hpp"
+
+#if(defined(GLM_MESSAGES) && !defined(glm_ext))
+# pragma message("GLM: GLM_GTC_swizzle extension included")
+#endif
+
+namespace glm{
+namespace gtc{
+namespace swizzle ///< GLM_GTC_swizzle extension
+{
+ using namespace gtc::half_float;
+
+ template <typename T, template <typename> class vecType>
+ T const & swizzle(
+ vecType<T> const & v,
+ comp x);
+
+ template <typename T, template <typename> class vecType>
+ detail::tvec2<T> const & swizzle(
+ vecType<T> const & v,
+ comp x, comp y);
+
+ template <typename T, template <typename> class vecType>
+ detail::tvec3<T> const & swizzle(
+ vecType<T> const & v,
+ comp x, comp y, comp z);
+
+ template <typename T, template <typename> class vecType>
+ detail::tvec4<T> const & swizzle(
+ vecType<T> const & v,
+ comp x, comp y, comp z, comp w);
+
+ template <typename T, template <typename> class vecType>
+ T & swizzle(
+ vecType<T> & v,
+ comp x);
+
+ template <typename T, template <typename> class vecType>
+ detail::tref2<T> swizzle(
+ vecType<T> & v,
+ comp x, comp y);
+
+ template <typename T, template <typename> class vecType>
+ detail::tref3<T> swizzle(
+ vecType<T> & v,
+ comp x, comp y, comp z);
+
+ template <typename T, template <typename> class vecType>
+ detail::tref4<T> swizzle(
+ vecType<T> & v,
+ comp x, comp y, comp z, comp w);
+
+# define static_swizzle1_const(TYPE, SIZE) \
+ template <comp x> \
+ GLM_FUNC_QUALIFIER TYPE swizzle(detail::tvec##SIZE<TYPE> const & v) \
+ {return v[x];}
+
+# define static_swizzle1_ref(TYPE, SIZE) \
+ template <comp x> \
+ GLM_FUNC_QUALIFIER TYPE& swizzle(detail::tvec##SIZE<TYPE> & v) \
+ {return v[x];}
+
+ static_swizzle1_ref(detail::float16, 2)
+ static_swizzle1_ref(detail::float16, 3)
+ static_swizzle1_ref(detail::float16, 4)
+ static_swizzle1_ref(detail::float32, 2)
+ static_swizzle1_ref(detail::float32, 3)
+ static_swizzle1_ref(detail::float32, 4)
+ static_swizzle1_ref(detail::float64, 2)
+ static_swizzle1_ref(detail::float64, 3)
+ static_swizzle1_ref(detail::float64, 4)
+
+ static_swizzle1_ref(detail::int8, 2)
+ static_swizzle1_ref(detail::int8, 3)
+ static_swizzle1_ref(detail::int8, 4)
+ static_swizzle1_ref(detail::int16, 2)
+ static_swizzle1_ref(detail::int16, 3)
+ static_swizzle1_ref(detail::int16, 4)
+ static_swizzle1_ref(detail::int32, 2)
+ static_swizzle1_ref(detail::int32, 3)
+ static_swizzle1_ref(detail::int32, 4)
+ static_swizzle1_ref(detail::int64, 2)
+ static_swizzle1_ref(detail::int64, 3)
+ static_swizzle1_ref(detail::int64, 4)
+
+ static_swizzle1_ref(detail::uint8, 2)
+ static_swizzle1_ref(detail::uint8, 3)
+ static_swizzle1_ref(detail::uint8, 4)
+ static_swizzle1_ref(detail::uint16, 2)
+ static_swizzle1_ref(detail::uint16, 3)
+ static_swizzle1_ref(detail::uint16, 4)
+ static_swizzle1_ref(detail::uint32, 2)
+ static_swizzle1_ref(detail::uint32, 3)
+ static_swizzle1_ref(detail::uint32, 4)
+ static_swizzle1_ref(detail::uint64, 2)
+ static_swizzle1_ref(detail::uint64, 3)
+ static_swizzle1_ref(detail::uint64, 4)
+/*
+# define static_swizzle2_const(TYPE) \
+ template <comp x, comp y> \
+ GLM_FUNC_QUALIFIER TYPE swizzle(TYPE const & v) \
+ {return TYPE(v[x], v[y]);}
+
+# define static_swizzle3_const(TYPE) \
+ template <comp x, comp y, comp z> \
+ GLM_FUNC_QUALIFIER TYPE swizzle(TYPE const & v) \
+ {return TYPE(v[x], v[y], v[z]);}
+
+# define static_swizzle4_const(TYPE) \
+ template <comp x, comp y, comp z, comp w> \
+ GLM_FUNC_QUALIFIER TYPE swizzle(TYPE const & v) \
+ {return TYPE(v[x], v[y], v[z], v[w]);}
+*/
+
+# define static_swizzle2_const(TYPE, SIZE) \
+ template <comp x, comp y> \
+ GLM_FUNC_QUALIFIER detail::tvec2<TYPE> swizzle(detail::tvec##SIZE<TYPE> const & v) \
+ {return detail::tvec2<TYPE>(v[x], v[y]);}
+
+# define static_swizzle3_const(TYPE, SIZE) \
+ template <comp x, comp y, comp z> \
+ GLM_FUNC_QUALIFIER detail::tvec3<TYPE> swizzle(detail::tvec##SIZE<TYPE> const & v) \
+ {return detail::tvec3<TYPE>(v[x], v[y], v[z]);}
+
+# define static_swizzle4_const(TYPE, SIZE) \
+ template <comp x, comp y, comp z, comp w> \
+ GLM_FUNC_QUALIFIER detail::tvec4<TYPE> swizzle(detail::tvec##SIZE<TYPE> const & v) \
+ {return detail::tvec4<TYPE>(v[x], v[y], v[z], v[w]);}
+
+
+ static_swizzle2_const(glm::f16, 2)
+ static_swizzle2_const(glm::f16, 3)
+ static_swizzle2_const(glm::f16, 4)
+ static_swizzle2_const(glm::f32, 2)
+ static_swizzle2_const(glm::f32, 3)
+ static_swizzle2_const(glm::f32, 4)
+ static_swizzle2_const(glm::f64, 2)
+ static_swizzle2_const(glm::f64, 3)
+ static_swizzle2_const(glm::f64, 4)
+
+ static_swizzle2_const(glm::i8, 2)
+ static_swizzle2_const(glm::i8, 3)
+ static_swizzle2_const(glm::i8, 4)
+ static_swizzle2_const(glm::i16, 2)
+ static_swizzle2_const(glm::i16, 3)
+ static_swizzle2_const(glm::i16, 4)
+ static_swizzle2_const(glm::i32, 2)
+ static_swizzle2_const(glm::i32, 3)
+ static_swizzle2_const(glm::i32, 4)
+ static_swizzle2_const(glm::i64, 2)
+ static_swizzle2_const(glm::i64, 3)
+ static_swizzle2_const(glm::i64, 4)
+
+ static_swizzle2_const(glm::u8, 2)
+ static_swizzle2_const(glm::u8, 3)
+ static_swizzle2_const(glm::u8, 4)
+ static_swizzle2_const(glm::u16, 2)
+ static_swizzle2_const(glm::u16, 3)
+ static_swizzle2_const(glm::u16, 4)
+ static_swizzle2_const(glm::u32, 2)
+ static_swizzle2_const(glm::u32, 3)
+ static_swizzle2_const(glm::u32, 4)
+ static_swizzle2_const(glm::u64, 2)
+ static_swizzle2_const(glm::u64, 3)
+ static_swizzle2_const(glm::u64, 4)
+
+ static_swizzle3_const(glm::f16, 2)
+ static_swizzle3_const(glm::f16, 3)
+ static_swizzle3_const(glm::f16, 4)
+ static_swizzle3_const(glm::f32, 2)
+ static_swizzle3_const(glm::f32, 3)
+ static_swizzle3_const(glm::f32, 4)
+ static_swizzle3_const(glm::f64, 2)
+ static_swizzle3_const(glm::f64, 3)
+ static_swizzle3_const(glm::f64, 4)
+
+ static_swizzle3_const(glm::i8, 2)
+ static_swizzle3_const(glm::i8, 3)
+ static_swizzle3_const(glm::i8, 4)
+ static_swizzle3_const(glm::i16, 2)
+ static_swizzle3_const(glm::i16, 3)
+ static_swizzle3_const(glm::i16, 4)
+ static_swizzle3_const(glm::i32, 2)
+ static_swizzle3_const(glm::i32, 3)
+ static_swizzle3_const(glm::i32, 4)
+ static_swizzle3_const(glm::i64, 2)
+ static_swizzle3_const(glm::i64, 3)
+ static_swizzle3_const(glm::i64, 4)
+
+ static_swizzle3_const(glm::u8, 2)
+ static_swizzle3_const(glm::u8, 3)
+ static_swizzle3_const(glm::u8, 4)
+ static_swizzle3_const(glm::u16, 2)
+ static_swizzle3_const(glm::u16, 3)
+ static_swizzle3_const(glm::u16, 4)
+ static_swizzle3_const(glm::u32, 2)
+ static_swizzle3_const(glm::u32, 3)
+ static_swizzle3_const(glm::u32, 4)
+ static_swizzle3_const(glm::u64, 2)
+ static_swizzle3_const(glm::u64, 3)
+ static_swizzle3_const(glm::u64, 4)
+
+ static_swizzle4_const(glm::f16, 2)
+ static_swizzle4_const(glm::f16, 3)
+ static_swizzle4_const(glm::f16, 4)
+ static_swizzle4_const(glm::f32, 2)
+ static_swizzle4_const(glm::f32, 3)
+ static_swizzle4_const(glm::f32, 4)
+ static_swizzle4_const(glm::f64, 2)
+ static_swizzle4_const(glm::f64, 3)
+ static_swizzle4_const(glm::f64, 4)
+
+ static_swizzle4_const(glm::i8, 2)
+ static_swizzle4_const(glm::i8, 3)
+ static_swizzle4_const(glm::i8, 4)
+ static_swizzle4_const(glm::i16, 2)
+ static_swizzle4_const(glm::i16, 3)
+ static_swizzle4_const(glm::i16, 4)
+ static_swizzle4_const(glm::i32, 2)
+ static_swizzle4_const(glm::i32, 3)
+ static_swizzle4_const(glm::i32, 4)
+ static_swizzle4_const(glm::i64, 2)
+ static_swizzle4_const(glm::i64, 3)
+ static_swizzle4_const(glm::i64, 4)
+
+ static_swizzle4_const(glm::u8, 2)
+ static_swizzle4_const(glm::u8, 3)
+ static_swizzle4_const(glm::u8, 4)
+ static_swizzle4_const(glm::u16, 2)
+ static_swizzle4_const(glm::u16, 3)
+ static_swizzle4_const(glm::u16, 4)
+ static_swizzle4_const(glm::u32, 2)
+ static_swizzle4_const(glm::u32, 3)
+ static_swizzle4_const(glm::u32, 4)
+ static_swizzle4_const(glm::u64, 2)
+ static_swizzle4_const(glm::u64, 3)
+ static_swizzle4_const(glm::u64, 4)
+
+# define static_swizzle2_ref(TYPE, SIZE) \
+ template <glm::comp x, glm::comp y> \
+ GLM_FUNC_QUALIFIER glm::detail::tref2<TYPE> swizzle(detail::tvec##SIZE<TYPE> & v) \
+ {return glm::detail::tref2<TYPE>(v[x], v[y]);}
+
+# define static_swizzle3_ref(TYPE, SIZE) \
+ template <glm::comp x, glm::comp y, glm::comp z> \
+ GLM_FUNC_QUALIFIER glm::detail::tref3<TYPE> swizzle(detail::tvec##SIZE<TYPE> & v) \
+ {return glm::detail::tref3<TYPE>(v[x], v[y], v[z]);}
+
+# define static_swizzle4_ref(TYPE, SIZE) \
+ template <glm::comp x, glm::comp y, glm::comp z, glm::comp w> \
+ GLM_FUNC_QUALIFIER glm::detail::tref4<TYPE> swizzle(detail::tvec##SIZE<TYPE> & v) \
+ {return glm::detail::tref4<TYPE>(v[x], v[y], v[z], v[w]);}
+
+ static_swizzle2_ref(glm::f16, 2)
+ static_swizzle2_ref(glm::f16, 3)
+ static_swizzle2_ref(glm::f16, 4)
+ static_swizzle2_ref(glm::f32, 2)
+ static_swizzle2_ref(glm::f32, 3)
+ static_swizzle2_ref(glm::f32, 4)
+ static_swizzle2_ref(glm::f64, 2)
+ static_swizzle2_ref(glm::f64, 3)
+ static_swizzle2_ref(glm::f64, 4)
+
+ static_swizzle2_ref(glm::i8, 2)
+ static_swizzle2_ref(glm::i8, 3)
+ static_swizzle2_ref(glm::i8, 4)
+ static_swizzle2_ref(glm::i16, 2)
+ static_swizzle2_ref(glm::i16, 3)
+ static_swizzle2_ref(glm::i16, 4)
+ static_swizzle2_ref(glm::i32, 2)
+ static_swizzle2_ref(glm::i32, 3)
+ static_swizzle2_ref(glm::i32, 4)
+ static_swizzle2_ref(glm::i64, 2)
+ static_swizzle2_ref(glm::i64, 3)
+ static_swizzle2_ref(glm::i64, 4)
+
+ static_swizzle2_ref(glm::u8, 2)
+ static_swizzle2_ref(glm::u8, 3)
+ static_swizzle2_ref(glm::u8, 4)
+ static_swizzle2_ref(glm::u16, 2)
+ static_swizzle2_ref(glm::u16, 3)
+ static_swizzle2_ref(glm::u16, 4)
+ static_swizzle2_ref(glm::u32, 2)
+ static_swizzle2_ref(glm::u32, 3)
+ static_swizzle2_ref(glm::u32, 4)
+ static_swizzle2_ref(glm::u64, 2)
+ static_swizzle2_ref(glm::u64, 3)
+ static_swizzle2_ref(glm::u64, 4)
+
+ static_swizzle3_ref(glm::f16, 3)
+ static_swizzle3_ref(glm::f16, 4)
+ static_swizzle3_ref(glm::f32, 3)
+ static_swizzle3_ref(glm::f32, 4)
+ static_swizzle3_ref(glm::f64, 3)
+ static_swizzle3_ref(glm::f64, 4)
+
+ static_swizzle3_ref(glm::i8, 3)
+ static_swizzle3_ref(glm::i8, 4)
+ static_swizzle3_ref(glm::i16, 3)
+ static_swizzle3_ref(glm::i16, 4)
+ static_swizzle3_ref(glm::i32, 3)
+ static_swizzle3_ref(glm::i32, 4)
+ static_swizzle3_ref(glm::i64, 3)
+ static_swizzle3_ref(glm::i64, 4)
+
+ static_swizzle3_ref(glm::u8, 3)
+ static_swizzle3_ref(glm::u8, 4)
+ static_swizzle3_ref(glm::u16, 3)
+ static_swizzle3_ref(glm::u16, 4)
+ static_swizzle3_ref(glm::u32, 3)
+ static_swizzle3_ref(glm::u32, 4)
+ static_swizzle3_ref(glm::u64, 3)
+ static_swizzle3_ref(glm::u64, 4)
+
+ static_swizzle4_ref(glm::f16, 4)
+ static_swizzle4_ref(glm::f32, 4)
+ static_swizzle4_ref(glm::f64, 4)
+
+ static_swizzle4_ref(glm::i8, 4)
+ static_swizzle4_ref(glm::i16, 4)
+ static_swizzle4_ref(glm::i32, 4)
+ static_swizzle4_ref(glm::i64, 4)
+
+ static_swizzle4_ref(glm::u8, 4)
+ static_swizzle4_ref(glm::u16, 4)
+ static_swizzle4_ref(glm::u32, 4)
+ static_swizzle4_ref(glm::u64, 4)
+
+}//namespace swizzle
+}//namespace gtc
+}//namespace glm
+
+#include "swizzle.inl"
+
+namespace glm{using namespace gtc::swizzle;}
+
+#endif//glm_gtc_swizzle
diff --git a/src/glm/gtc/swizzle.inl b/src/glm/gtc/swizzle.inl
new file mode 100644
index 0000000..77f1a50
--- /dev/null
+++ b/src/glm/gtc/swizzle.inl
@@ -0,0 +1,177 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2011-01-15
+// Updated : 2011-01-15
+// Licence : This source is under MIT License
+// File : glm/gtc/swizzle.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm{
+namespace gtc{
+namespace swizzle{
+
+template <typename T, template <typename> class vecType>
+GLM_FUNC_QUALIFIER T swizzle
+(
+ vecType<T> const & v,
+ comp x
+)
+{
+ assert(int(x) < int(vecType<T>::value_size));
+ return v[x];
+}
+
+template <typename T, template <typename> class vecType>
+GLM_FUNC_QUALIFIER detail::tvec2<T> swizzle
+(
+ vecType<T> const & v,
+ comp x, comp y
+)
+{
+ return detail::tvec2<T>(
+ v[x],
+ v[y]);
+}
+
+template <typename T, template <typename> class vecType>
+GLM_FUNC_QUALIFIER detail::tvec3<T> swizzle
+(
+ vecType<T> const & v,
+ comp x, comp y, comp z
+)
+{
+ return detail::tvec3<T>(
+ v[x],
+ v[y],
+ v[z]);
+}
+
+template <typename T, template <typename> class vecType>
+GLM_FUNC_QUALIFIER detail::tvec4<T> swizzle
+(
+ vecType<T> const & v,
+ comp x, comp y, comp z, comp w
+)
+{
+ return detail::tvec4<T>(v[x], v[y], v[z], v[w]);
+}
+
+template <typename T>
+GLM_FUNC_QUALIFIER T& swizzle
+(
+ detail::tvec4<T> & v,
+ comp x
+)
+{
+ return v[x];
+}
+
+template <typename T>
+GLM_FUNC_QUALIFIER detail::tref2<T> swizzle
+(
+ detail::tvec4<T> & v,
+ comp x, comp y
+)
+{
+ return detail::tref2<T>(v[x], v[y]);
+}
+
+template <typename T>
+GLM_FUNC_QUALIFIER detail::tref3<T> swizzle
+(
+ detail::tvec4<T> & v,
+ comp x, comp y, comp z
+)
+{
+ return detail::tref3<T>(v[x], v[y], v[z]);
+}
+
+template <typename T>
+GLM_FUNC_QUALIFIER detail::tref4<T> swizzle
+(
+ detail::tvec4<T> & v,
+ comp x, comp y, comp z, comp w
+)
+{
+ return detail::tref4<T>(v[x], v[y], v[z], v[w]);
+}
+/*
+template <comp x>
+GLM_FUNC_QUALIFIER float& swizzle
+(
+ detail::tvec4<float> & v
+)
+{
+ return v[x];
+}
+
+template <comp x>
+GLM_FUNC_QUALIFIER int& swizzle
+(
+ detail::tvec4<int> & v
+)
+{
+ return v[x];
+}
+
+template <comp x, comp y>
+GLM_FUNC_QUALIFIER detail::tref2<float> swizzle
+(
+ detail::tvec4<float> & v
+)
+{
+ return detail::tref2<float>(v[x], v[y]);
+}
+
+template <comp x, comp y>
+GLM_FUNC_QUALIFIER detail::tref2<int> swizzle
+(
+ detail::tvec4<int> & v
+)
+{
+ return detail::tref2<int>(v[x], v[y]);
+}
+
+template <comp x, comp y, comp z>
+GLM_FUNC_QUALIFIER detail::tref3<float> swizzle
+(
+ detail::tvec4<float> & v
+)
+{
+ return detail::tref3<float>(v[x], v[y], v[z]);
+}
+
+template <comp x, comp y, comp z>
+GLM_FUNC_QUALIFIER detail::tref3<int> swizzle
+(
+ detail::tvec4<int> & v
+)
+{
+ return detail::tref3<int>(v[x], v[y], v[z]);
+}
+
+template <comp x, comp y, comp z, comp w>
+GLM_FUNC_QUALIFIER detail::tref4<float> swizzle
+(
+ detail::tvec4<float> & v
+)
+{
+ return detail::tref4<float>(v[x], v[y], v[z], v[w]);
+}
+
+template <comp x, comp y, comp z, comp w>
+GLM_FUNC_QUALIFIER detail::tref4<int> swizzle
+(
+ detail::tvec4<int> & v
+)
+{
+ return detail::tref4<int>(v[x], v[y], v[z], v[w]);
+}
+*/
+}//namespace swizzle
+}//namespace gtc
+}//namespace glm
diff --git a/src/glm/gtc/type_precision.hpp b/src/glm/gtc/type_precision.hpp
new file mode 100644
index 0000000..41e411b
--- /dev/null
+++ b/src/glm/gtc/type_precision.hpp
@@ -0,0 +1,220 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2009-06-04
+// Updated : 2009-06-04
+// Licence : This source is under MIT License
+// File : glm/gtc/type_precision.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+// - GLM_GTC_half
+// - GLM_GTC_quaternion
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_gtc_type_precision
+#define glm_gtc_type_precision
+
+// Dependency:
+#include "../glm.hpp"
+#include "../gtc/half_float.hpp"
+#include "../gtc/quaternion.hpp"
+
+#if(defined(GLM_MESSAGES) && !defined(glm_ext))
+# pragma message("GLM: GLM_GTC_type_precision extension included")
+#endif
+
+namespace glm{
+namespace gtc{
+namespace type_precision ///< GLM_GTC_type_precision extension: Defined types with specific size.
+{
+ ///////////////////////////
+ // Dependences
+
+ using namespace gtc::half_float;
+ using namespace gtc::quaternion;
+
+ ///////////////////////////
+ // Signed int vector types
+
+ /// \addtogroup gtc_type_precision
+ ///@{
+
+ typedef detail::int8 int8; //!< \brief 8bit signed integer. (from GLM_GTC_type_precision extension)
+ typedef detail::int16 int16; //!< \brief 16bit signed integer. (from GLM_GTC_type_precision extension)
+ typedef detail::int32 int32; //!< \brief 32bit signed integer. (from GLM_GTC_type_precision extension)
+ typedef detail::int64 int64; //!< \brief 64bit signed integer. (from GLM_GTC_type_precision extension)
+
+ typedef int8 i8; //!< \brief 8bit signed integer. (from GLM_GTC_type_precision extension)
+ typedef int16 i16; //!< \brief 16bit signed integer. (from GLM_GTC_type_precision extension)
+ typedef int32 i32; //!< \brief 32bit signed integer. (from GLM_GTC_type_precision extension)
+ typedef int64 i64; //!< \brief 64bit signed integer. (from GLM_GTC_type_precision extension)
+
+ //typedef i8 i8vec1; //!< \brief 8bit signed integer scalar. (from GLM_GTC_type_precision extension)
+ typedef detail::tvec2<i8> i8vec2; //!< \brief 8bit signed integer vector of 2 components. (from GLM_GTC_type_precision extension)
+ typedef detail::tvec3<i8> i8vec3; //!< \brief 8bit signed integer vector of 3 components. (from GLM_GTC_type_precision extension)
+ typedef detail::tvec4<i8> i8vec4; //!< \brief 8bit signed integer vector of 4 components. (from GLM_GTC_type_precision extension)
+
+ //typedef i16 i16vec1; //!< \brief 16bit signed integer scalar. (from GLM_GTC_type_precision extension)
+ typedef detail::tvec2<i16> i16vec2; //!< \brief 16bit signed integer vector of 2 components. (from GLM_GTC_type_precision extension)
+ typedef detail::tvec3<i16> i16vec3; //!< \brief 16bit signed integer vector of 3 components. (from GLM_GTC_type_precision extension)
+ typedef detail::tvec4<i16> i16vec4; //!< \brief 16bit signed integer vector of 4 components. (from GLM_GTC_type_precision extension)
+
+ //typedef i32 i32vec1; //!< \brief 32bit signed integer scalar. (from GLM_GTC_type_precision extension)
+ typedef detail::tvec2<i32> i32vec2; //!< \brief 32bit signed integer vector of 2 components. (from GLM_GTC_type_precision extension)
+ typedef detail::tvec3<i32> i32vec3; //!< \brief 32bit signed integer vector of 3 components. (from GLM_GTC_type_precision extension)
+ typedef detail::tvec4<i32> i32vec4; //!< \brief 32bit signed integer vector of 4 components. (from GLM_GTC_type_precision extension)
+
+ //typedef i64 i64vec1; //!< \brief 32bit signed integer scalar. (from GLM_GTC_type_precision extension)
+ typedef detail::tvec2<i64> i64vec2; //!< \brief 64bit signed integer vector of 2 components. (from GLM_GTC_type_precision extension)
+ typedef detail::tvec3<i64> i64vec3; //!< \brief 64bit signed integer vector of 3 components. (from GLM_GTC_type_precision extension)
+ typedef detail::tvec4<i64> i64vec4; //!< \brief 64bit signed integer vector of 4 components. (from GLM_GTC_type_precision extension)
+
+ /////////////////////////////
+ // Unsigned int vector types
+
+ typedef detail::uint8 uint8; //!< \brief 8bit unsigned integer. (from GLM_GTC_type_precision extension)
+ typedef detail::uint16 uint16; //!< \brief 16bit unsigned integer. (from GLM_GTC_type_precision extension)
+ typedef detail::uint32 uint32; //!< \brief 32bit unsigned integer. (from GLM_GTC_type_precision extension)
+ typedef detail::uint64 uint64; //!< \brief 64bit unsigned integer. (from GLM_GTC_type_precision extension)
+
+ typedef uint8 u8; //!< \brief 8bit unsigned integer. (from GLM_GTC_type_precision extension)
+ typedef uint16 u16; //!< \brief 16bit unsigned integer. (from GLM_GTC_type_precision extension)
+ typedef uint32 u32; //!< \brief 32bit unsigned integer. (from GLM_GTC_type_precision extension)
+ typedef uint64 u64; //!< \brief 64bit unsigned integer. (from GLM_GTC_type_precision extension)
+
+ //typedef u8 u8vec1; //!< \brief 8bit unsigned integer scalar. (from GLM_GTC_type_precision extension)
+ typedef detail::tvec2<u8> u8vec2; //!< \brief 8bit unsigned integer vector of 2 components. (from GLM_GTC_type_precision extension)
+ typedef detail::tvec3<u8> u8vec3; //!< \brief 8bit unsigned integer vector of 3 components. (from GLM_GTC_type_precision extension)
+ typedef detail::tvec4<u8> u8vec4; //!< \brief 8bit unsigned integer vector of 4 components. (from GLM_GTC_type_precision extension)
+
+ //typedef u16 u16vec1; //!< \brief 16bit unsigned integer scalar. (from GLM_GTC_type_precision extension)
+ typedef detail::tvec2<u16> u16vec2; //!< \brief 16bit unsigned integer vector of 2 components. (from GLM_GTC_type_precision extension)
+ typedef detail::tvec3<u16> u16vec3; //!< \brief 16bit unsigned integer vector of 3 components. (from GLM_GTC_type_precision extension)
+ typedef detail::tvec4<u16> u16vec4; //!< \brief 16bit unsigned integer vector of 4 components. (from GLM_GTC_type_precision extension)
+
+ //typedef u32 u32vec1; //!< \brief 32bit unsigned integer scalar. (from GLM_GTC_type_precision extension)
+ typedef detail::tvec2<u32> u32vec2; //!< \brief 32bit unsigned integer vector of 2 components. (from GLM_GTC_type_precision extension)
+ typedef detail::tvec3<u32> u32vec3; //!< \brief 32bit unsigned integer vector of 3 components. (from GLM_GTC_type_precision extension)
+ typedef detail::tvec4<u32> u32vec4; //!< \brief 32bit unsigned integer vector of 4 components. (from GLM_GTC_type_precision extension)
+
+ //typedef u64 u64vec1; //!< \brief 64bit unsigned integer scalar. (from GLM_GTC_type_precision extension)
+ typedef detail::tvec2<u64> u64vec2; //!< \brief 64bit unsigned integer vector of 2 components. (from GLM_GTC_type_precision extension)
+ typedef detail::tvec3<u64> u64vec3; //!< \brief 64bit unsigned integer vector of 3 components. (from GLM_GTC_type_precision extension)
+ typedef detail::tvec4<u64> u64vec4; //!< \brief 64bit unsigned integer vector of 4 components. (from GLM_GTC_type_precision extension)
+
+ //////////////////////
+ // Float vector types
+
+ typedef detail::float16 float16; //!< \brief Half-precision floating-point scalar. (from GLM_GTC_type_precision extension)
+ typedef detail::float32 float32; //!< \brief Single-precision floating-point scalar. (from GLM_GTC_type_precision extension)
+ typedef detail::float64 float64; //!< \brief Double-precision floating-point scalar. (from GLM_GTC_type_precision extension)
+
+ typedef float16 f16; //!< \brief Half-precision floating-point scalar. (from GLM_GTC_type_precision extension)
+ typedef float32 f32; //!< \brief Single-precision floating-point scalar. (from GLM_GTC_type_precision extension)
+ typedef float64 f64; //!< \brief Double-precision floating-point scalar. (from GLM_GTC_type_precision extension)
+
+ typedef detail::tvec2<float> fvec2; //!< Vector of 2 single-precision floating-point numbers. (from GLM_GTC_type_precision extension)
+ typedef detail::tvec3<float> fvec3; //!< Vector of 3 single-precision floating-point numbers. (from GLM_GTC_type_precision extension)
+ typedef detail::tvec4<float> fvec4; //!< Vector of 4 single-precision floating-point numbers. (from GLM_GTC_type_precision extension)
+
+ //typedef f16 f16vec1; //!< \brief Half-precision floating-point scalar. (from GLM_GTC_type_precision extension)
+ typedef detail::tvec2<f16> f16vec2; //!< \brief Half-precision floating-point vector of 2 components. (from GLM_GTC_type_precision extension)
+ typedef detail::tvec3<f16> f16vec3; //!< \brief Half-precision floating-point vector of 3 components. (from GLM_GTC_type_precision extension)
+ typedef detail::tvec4<f16> f16vec4; //!< \brief Half-precision floating-point vector of 4 components. (from GLM_GTC_type_precision extension)
+
+ //typedef f32 f32vec1; //!< \brief Single-precision floating-point scalar. (from GLM_GTC_type_precision extension)
+ typedef detail::tvec2<f32> f32vec2; //!< \brief Single-precision floating-point vector of 2 components. (from GLM_GTC_type_precision extension)
+ typedef detail::tvec3<f32> f32vec3; //!< \brief Single-precision floating-point vector of 3 components. (from GLM_GTC_type_precision extension)
+ typedef detail::tvec4<f32> f32vec4; //!< \brief Single-precision floating-point vector of 4 components. (from GLM_GTC_type_precision extension)
+
+ //typedef f64 f64vec1; //!< \brief Single-precision floating-point scalar. (from GLM_GTC_type_precision extension)
+ typedef detail::tvec2<f64> f64vec2; //!< \brief Double-precision floating-point vector of 2 components. (from GLM_GTC_type_precision extension)
+ typedef detail::tvec3<f64> f64vec3; //!< \brief Double-precision floating-point vector of 3 components. (from GLM_GTC_type_precision extension)
+ typedef detail::tvec4<f64> f64vec4; //!< \brief Double-precision floating-point vector of 4 components. (from GLM_GTC_type_precision extension)
+
+ //////////////////////
+ // Float matrix types
+
+ //typedef f32 fmat1; //!< \brief Single-precision floating-point scalar. (from GLM_GTC_type_precision extension)
+ typedef detail::tmat2x2<f32> fmat2; //!< \brief Single-precision floating-point 2x2 matrix. (from GLM_GTC_type_precision extension)
+ typedef detail::tmat3x3<f32> fmat3; //!< \brief Single-precision floating-point 3x3 matrix. (from GLM_GTC_type_precision extension)
+ typedef detail::tmat4x4<f32> fmat4; //!< \brief Single-precision floating-point 4x4 matrix. (from GLM_GTC_type_precision extension)
+
+ //typedef f32 fmat1x1; //!< \brief Single-precision floating-point scalar. (from GLM_GTC_type_precision extension)
+ typedef detail::tmat2x2<f32> fmat2x2; //!< \brief Single-precision floating-point 2x2 matrix. (from GLM_GTC_type_precision extension)
+ typedef detail::tmat2x3<f32> fmat2x3; //!< \brief Single-precision floating-point 2x3 matrix. (from GLM_GTC_type_precision extension)
+ typedef detail::tmat2x4<f32> fmat2x4; //!< \brief Single-precision floating-point 2x4 matrix. (from GLM_GTC_type_precision extension)
+ typedef detail::tmat3x2<f32> fmat3x2; //!< \brief Single-precision floating-point 3x2 matrix. (from GLM_GTC_type_precision extension)
+ typedef detail::tmat3x3<f32> fmat3x3; //!< \brief Single-precision floating-point 3x3 matrix. (from GLM_GTC_type_precision extension)
+ typedef detail::tmat3x4<f32> fmat3x4; //!< \brief Single-precision floating-point 3x4 matrix. (from GLM_GTC_type_precision extension)
+ typedef detail::tmat4x2<f32> fmat4x2; //!< \brief Single-precision floating-point 4x2 matrix. (from GLM_GTC_type_precision extension)
+ typedef detail::tmat4x3<f32> fmat4x3; //!< \brief Single-precision floating-point 4x3 matrix. (from GLM_GTC_type_precision extension)
+ typedef detail::tmat4x4<f32> fmat4x4; //!< \brief Single-precision floating-point 4x4 matrix. (from GLM_GTC_type_precision extension)
+
+ //typedef f16 f16mat1; //!< \brief Half-precision floating-point scalar. (from GLM_GTC_type_precision extension)
+ typedef detail::tmat2x2<f16> f16mat2; //!< \brief Half-precision floating-point 2x2 matrix. (from GLM_GTC_type_precision extension)
+ typedef detail::tmat3x3<f16> f16mat3; //!< \brief Half-precision floating-point 3x3 matrix. (from GLM_GTC_type_precision extension)
+ typedef detail::tmat4x4<f16> f16mat4; //!< \brief Half-precision floating-point 4x4 matrix. (from GLM_GTC_type_precision extension)
+
+ //typedef f16 f16mat1x1; //!< \brief Half-precision floating-point scalar. (from GLM_GTC_type_precision extension)
+ typedef detail::tmat2x2<f16> f16mat2x2; //!< \brief Half-precision floating-point 2x2 matrix. (from GLM_GTC_type_precision extension)
+ typedef detail::tmat2x3<f16> f16mat2x3; //!< \brief Half-precision floating-point 2x3 matrix. (from GLM_GTC_type_precision extension)
+ typedef detail::tmat2x4<f16> f16mat2x4; //!< \brief Half-precision floating-point 2x4 matrix. (from GLM_GTC_type_precision extension)
+ typedef detail::tmat3x2<f16> f16mat3x2; //!< \brief Half-precision floating-point 3x2 matrix. (from GLM_GTC_type_precision extension)
+ typedef detail::tmat3x3<f16> f16mat3x3; //!< \brief Half-precision floating-point 3x3 matrix. (from GLM_GTC_type_precision extension)
+ typedef detail::tmat3x4<f16> f16mat3x4; //!< \brief Half-precision floating-point 3x4 matrix. (from GLM_GTC_type_precision extension)
+ typedef detail::tmat4x2<f16> f16mat4x2; //!< \brief Half-precision floating-point 4x2 matrix. (from GLM_GTC_type_precision extension)
+ typedef detail::tmat4x3<f16> f16mat4x3; //!< \brief Half-precision floating-point 4x3 matrix. (from GLM_GTC_type_precision extension)
+ typedef detail::tmat4x4<f16> f16mat4x4; //!< \brief Half-precision floating-point 4x4 matrix. (from GLM_GTC_type_precision extension)
+
+ //typedef f32 f32mat1; //!< \brief Single-precision floating-point scalar. (from GLM_GTC_type_precision extension)
+ typedef detail::tmat2x2<f32> f32mat2; //!< \brief Single-precision floating-point 2x2 matrix. (from GLM_GTC_type_precision extension)
+ typedef detail::tmat3x3<f32> f32mat3; //!< \brief Single-precision floating-point 3x3 matrix. (from GLM_GTC_type_precision extension)
+ typedef detail::tmat4x4<f32> f32mat4; //!< \brief Single-precision floating-point 4x4 matrix. (from GLM_GTC_type_precision extension)
+
+ //typedef f32 f32mat1x1; //!< \brief Single-precision floating-point scalar. (from GLM_GTC_type_precision extension)
+ typedef detail::tmat2x2<f32> f32mat2x2; //!< \brief Single-precision floating-point 2x2 matrix. (from GLM_GTC_type_precision extension)
+ typedef detail::tmat2x3<f32> f32mat2x3; //!< \brief Single-precision floating-point 2x3 matrix. (from GLM_GTC_type_precision extension)
+ typedef detail::tmat2x4<f32> f32mat2x4; //!< \brief Single-precision floating-point 2x4 matrix. (from GLM_GTC_type_precision extension)
+ typedef detail::tmat3x2<f32> f32mat3x2; //!< \brief Single-precision floating-point 3x2 matrix. (from GLM_GTC_type_precision extension)
+ typedef detail::tmat3x3<f32> f32mat3x3; //!< \brief Single-precision floating-point 3x3 matrix. (from GLM_GTC_type_precision extension)
+ typedef detail::tmat3x4<f32> f32mat3x4; //!< \brief Single-precision floating-point 3x4 matrix. (from GLM_GTC_type_precision extension)
+ typedef detail::tmat4x2<f32> f32mat4x2; //!< \brief Single-precision floating-point 4x2 matrix. (from GLM_GTC_type_precision extension)
+ typedef detail::tmat4x3<f32> f32mat4x3; //!< \brief Single-precision floating-point 4x3 matrix. (from GLM_GTC_type_precision extension)
+ typedef detail::tmat4x4<f32> f32mat4x4; //!< \brief Single-precision floating-point 4x4 matrix. (from GLM_GTC_type_precision extension)
+
+ //typedef f64 f64mat1; //!< \brief Double-precision floating-point scalar. (from GLM_GTC_type_precision extension)
+ typedef detail::tmat2x2<f64> f64mat2; //!< \brief Double-precision floating-point 2x2 matrix. (from GLM_GTC_type_precision extension)
+ typedef detail::tmat3x3<f64> f64mat3; //!< \brief Double-precision floating-point 3x3 matrix. (from GLM_GTC_type_precision extension)
+ typedef detail::tmat4x4<f64> f64mat4; //!< \brief Double-precision floating-point 4x4 matrix. (from GLM_GTC_type_precision extension)
+
+ //typedef f64 f64mat1x1; //!< \brief Double-precision floating-point scalar. (from GLM_GTC_type_precision extension)
+ typedef detail::tmat2x2<f64> f64mat2x2; //!< \brief Double-precision floating-point 2x2 matrix. (from GLM_GTC_type_precision extension)
+ typedef detail::tmat2x3<f64> f64mat2x3; //!< \brief Double-precision floating-point 2x3 matrix. (from GLM_GTC_type_precision extension)
+ typedef detail::tmat2x4<f64> f64mat2x4; //!< \brief Double-precision floating-point 2x4 matrix. (from GLM_GTC_type_precision extension)
+ typedef detail::tmat3x2<f64> f64mat3x2; //!< \brief Double-precision floating-point 3x2 matrix. (from GLM_GTC_type_precision extension)
+ typedef detail::tmat3x3<f64> f64mat3x3; //!< \brief Double-precision floating-point 3x3 matrix. (from GLM_GTC_type_precision extension)
+ typedef detail::tmat3x4<f64> f64mat3x4; //!< \brief Double-precision floating-point 3x4 matrix. (from GLM_GTC_type_precision extension)
+ typedef detail::tmat4x2<f64> f64mat4x2; //!< \brief Double-precision floating-point 4x2 matrix. (from GLM_GTC_type_precision extension)
+ typedef detail::tmat4x3<f64> f64mat4x3; //!< \brief Double-precision floating-point 4x3 matrix. (from GLM_GTC_type_precision extension)
+ typedef detail::tmat4x4<f64> f64mat4x4; //!< \brief Double-precision floating-point 4x4 matrix. (from GLM_GTC_type_precision extension)
+
+ //////////////////////////
+ // Float quaternion types
+
+ typedef detail::tquat<f16> f16quat; //!< \brief Half-precision floating-point quaternion. (from GLM_GTC_type_precision extension)
+ typedef detail::tquat<f32> f32quat; //!< \brief Single-precision floating-point quaternion. (from GLM_GTC_type_precision extension)
+ typedef detail::tquat<f64> f64quat; //!< \brief Double-precision floating-point quaternion. (from GLM_GTC_type_precision extension)
+
+ ///@}
+
+}//namespace type_precision
+}//namespace gtc
+}//namespace glm
+
+#include "type_precision.inl"
+
+namespace glm{using namespace gtc::type_precision;}
+
+#endif//glm_gtc_type_precision
diff --git a/src/glm/gtc/type_precision.inl b/src/glm/gtc/type_precision.inl
new file mode 100644
index 0000000..b0ec53b
--- /dev/null
+++ b/src/glm/gtc/type_precision.inl
@@ -0,0 +1,13 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2009-06-14
+// Updated : 2009-06-14
+// Licence : This source is under MIT License
+// File : glm/gtc/type_precision.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm
+{
+
+}
diff --git a/src/glm/gtc/type_ptr.hpp b/src/glm/gtc/type_ptr.hpp
new file mode 100644
index 0000000..15ef009
--- /dev/null
+++ b/src/glm/gtc/type_ptr.hpp
@@ -0,0 +1,449 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2009-05-06
+// Updated : 2010-04-30
+// Licence : This source is under MIT License
+// File : glm/gtc/type_ptr.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_gtc_type_ptr
+#define glm_gtc_type_ptr
+
+// Dependency:
+#include "../glm.hpp"
+#include <cstring>
+
+#if(defined(GLM_MESSAGES) && !defined(glm_ext))
+# pragma message("GLM: GLM_GTC_type_ptr extension included")
+#endif
+
+namespace glm{
+namespace gtc{
+namespace type_ptr ///< GLM_GTC_type_ptr extension: Get access to vectors & matrices value type address.
+{
+
+ /// \addtogroup gtc_type_ptr
+ ///@{
+
+ //! Get the const address of the vector content.
+ //! From GLM_GTC_type_ptr extension.
+ template<typename T>
+ GLM_FUNC_QUALIFIER T const * value_ptr
+ (
+ detail::tvec2<T> const & vec
+ )
+ {
+ return &(vec.x);
+ }
+
+ //! Get the address of the vector content.
+ //! From GLM_GTC_type_ptr extension.
+ template<typename T>
+ GLM_FUNC_QUALIFIER T * value_ptr
+ (
+ detail::tvec2<T> & vec
+ )
+ {
+ return &(vec.x);
+ }
+
+ //! Get the const address of the vector content.
+ //! From GLM_GTC_type_ptr extension.
+ template<typename T>
+ GLM_FUNC_QUALIFIER T const * value_ptr
+ (
+ detail::tvec3<T> const & vec
+ )
+ {
+ return &(vec.x);
+ }
+
+ //! Get the address of the vector content.
+ //! From GLM_GTC_type_ptr extension.
+ template<typename T>
+ GLM_FUNC_QUALIFIER T * value_ptr
+ (
+ detail::tvec3<T> & vec
+ )
+ {
+ return &(vec.x);
+ }
+
+ //! Get the const address of the vector content.
+ //! From GLM_GTC_type_ptr extension.
+ template<typename T>
+ GLM_FUNC_QUALIFIER T const * value_ptr
+ (
+ detail::tvec4<T> const & vec
+ )
+ {
+ return &(vec.x);
+ }
+
+ //! Get the address of the vector content.
+ //! From GLM_GTC_type_ptr extension.
+ template<typename T>
+ GLM_FUNC_QUALIFIER T * value_ptr
+ (
+ detail::tvec4<T> & vec
+ )
+ {
+ return &(vec.x);
+ }
+
+ //! Get the const address of the matrix content.
+ //! From GLM_GTC_type_ptr extension.
+ template<typename T>
+ GLM_FUNC_QUALIFIER T const * value_ptr
+ (
+ detail::tmat2x2<T> const & mat
+ )
+ {
+ return &(mat[0].x);
+ }
+
+ //! Get the address of the matrix content.
+ //! From GLM_GTC_type_ptr extension.
+ template<typename T>
+ GLM_FUNC_QUALIFIER T * value_ptr
+ (
+ detail::tmat2x2<T> & mat
+ )
+ {
+ return &(mat[0].x);
+ }
+
+ //! Get the const address of the matrix content.
+ //! From GLM_GTC_type_ptr extension.
+ template<typename T>
+ GLM_FUNC_QUALIFIER T const * value_ptr
+ (
+ detail::tmat3x3<T> const & mat
+ )
+ {
+ return &(mat[0].x);
+ }
+
+ //! Get the address of the matrix content.
+ //! From GLM_GTC_type_ptr extension.
+ template<typename T>
+ GLM_FUNC_QUALIFIER T * value_ptr
+ (
+ detail::tmat3x3<T> & mat
+ )
+ {
+ return &(mat[0].x);
+ }
+
+ //! Get the const address of the matrix content.
+ //! From GLM_GTC_type_ptr extension.
+ template<typename T>
+ GLM_FUNC_QUALIFIER T const * value_ptr
+ (
+ detail::tmat4x4<T> const & mat
+ )
+ {
+ return &(mat[0].x);
+ }
+
+ //! Get the address of the matrix content.
+ //! From GLM_GTC_type_ptr extension.
+ template<typename T>
+ GLM_FUNC_QUALIFIER T * value_ptr
+ (
+ detail::tmat4x4<T> & mat
+ )
+ {
+ return &(mat[0].x);
+ }
+
+ //! Get the const address of the matrix content.
+ //! From GLM_GTC_type_ptr extension.
+ template<typename T>
+ GLM_FUNC_QUALIFIER T const * value_ptr
+ (
+ detail::tmat2x3<T> const & mat
+ )
+ {
+ return &(mat[0].x);
+ }
+
+ //! Get the address of the matrix content.
+ //! From GLM_GTC_type_ptr extension.
+ template<typename T>
+ GLM_FUNC_QUALIFIER T * value_ptr
+ (
+ detail::tmat2x3<T> & mat
+ )
+ {
+ return &(mat[0].x);
+ }
+
+ //! Get the const address of the matrix content.
+ //! From GLM_GTC_type_ptr extension.
+ template<typename T>
+ GLM_FUNC_QUALIFIER T const * value_ptr
+ (
+ detail::tmat3x2<T> const & mat
+ )
+ {
+ return &(mat[0].x);
+ }
+
+ //! Get the address of the matrix content.
+ //! From GLM_GTC_type_ptr extension.
+ template<typename T>
+ GLM_FUNC_QUALIFIER T * value_ptr
+ (
+ detail::tmat3x2<T> & mat
+ )
+ {
+ return &(mat[0].x);
+ }
+
+ //! Get the const address of the matrix content.
+ //! From GLM_GTC_type_ptr extension.
+ template<typename T>
+ GLM_FUNC_QUALIFIER T const * value_ptr
+ (
+ detail::tmat2x4<T> const & mat
+ )
+ {
+ return &(mat[0].x);
+ }
+
+ //! Get the address of the matrix content.
+ //! From GLM_GTC_type_ptr extension.
+ template<typename T>
+ GLM_FUNC_QUALIFIER T * value_ptr
+ (
+ detail::tmat2x4<T> & mat
+ )
+ {
+ return &(mat[0].x);
+ }
+
+ //! Get the const address of the matrix content.
+ //! From GLM_GTC_type_ptr extension.
+ template<typename T>
+ GLM_FUNC_QUALIFIER T const * value_ptr
+ (
+ detail::tmat4x2<T> const & mat
+ )
+ {
+ return &(mat[0].x);
+ }
+
+ //! Get the address of the matrix content.
+ //! From GLM_GTC_type_ptr extension.
+ template<typename T>
+ GLM_FUNC_QUALIFIER T * value_ptr
+ (
+ detail::tmat4x2<T> & mat
+ )
+ {
+ return &(mat[0].x);
+ }
+
+ //! Get the const address of the matrix content.
+ //! From GLM_GTC_type_ptr extension.
+ template<typename T>
+ GLM_FUNC_QUALIFIER T const * value_ptr
+ (
+ detail::tmat3x4<T> const & mat
+ )
+ {
+ return &(mat[0].x);
+ }
+
+ //! Get the address of the matrix content.
+ //! From GLM_GTC_type_ptr extension.
+ template<typename T>
+ GLM_FUNC_QUALIFIER T * value_ptr
+ (
+ detail::tmat3x4<T> & mat
+ )
+ {
+ return &(mat[0].x);
+ }
+
+ //! Get the const address of the matrix content.
+ //! From GLM_GTC_type_ptr extension.
+ template<typename T>
+ GLM_FUNC_QUALIFIER T const * value_ptr
+ (
+ detail::tmat4x3<T> const & mat
+ )
+ {
+ return &(mat[0].x);
+ }
+
+ //! Get the address of the matrix content.
+ //! From GLM_GTC_type_ptr extension.
+ template<typename T>
+ GLM_FUNC_QUALIFIER T * value_ptr(detail::tmat4x3<T> & mat)
+ {
+ return &(mat[0].x);
+ }
+
+ //! Build a vector from a pointer.
+ //! From GLM_GTC_type_ptr extension.
+ template<typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> make_vec2(T const * const ptr)
+ {
+ detail::tvec2<T> Result;
+ memcpy(value_ptr(Result), ptr, sizeof(detail::tvec2<T>));
+ return Result;
+ }
+
+ //! Build a vector from a pointer.
+ //! From GLM_GTC_type_ptr extension.
+ template<typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> make_vec3(T const * const ptr)
+ {
+ detail::tvec3<T> Result;
+ memcpy(value_ptr(Result), ptr, sizeof(detail::tvec3<T>));
+ return Result;
+ }
+
+ //! Build a vector from a pointer.
+ //! From GLM_GTC_type_ptr extension.
+ template<typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> make_vec4(T const * const ptr)
+ {
+ detail::tvec4<T> Result;
+ memcpy(value_ptr(Result), ptr, sizeof(detail::tvec4<T>));
+ return Result;
+ }
+
+ //! Build a matrix from a pointer.
+ //! From GLM_GTC_type_ptr extension.
+ template<typename T>
+ GLM_FUNC_QUALIFIER detail::tmat2x2<T> make_mat2x2(T const * const ptr)
+ {
+ detail::tmat2x2<T> Result;
+ memcpy(value_ptr(Result), ptr, sizeof(detail::tmat2x2<T>));
+ return Result;
+ }
+
+ //! Build a matrix from a pointer.
+ //! From GLM_GTC_type_ptr extension.
+ template<typename T>
+ GLM_FUNC_QUALIFIER detail::tmat2x3<T> make_mat2x3(T const * const ptr)
+ {
+ detail::tmat2x3<T> Result;
+ memcpy(value_ptr(Result), ptr, sizeof(detail::tmat2x3<T>));
+ return Result;
+ }
+
+ //! Build a matrix from a pointer.
+ //! From GLM_GTC_type_ptr extension.
+ template<typename T>
+ GLM_FUNC_QUALIFIER detail::tmat2x4<T> make_mat2x4(T const * const ptr)
+ {
+ detail::tmat2x4<T> Result;
+ memcpy(value_ptr(Result), ptr, sizeof(detail::tmat2x4<T>));
+ return Result;
+ }
+
+ //! Build a matrix from a pointer.
+ //! From GLM_GTC_type_ptr extension.
+ template<typename T>
+ GLM_FUNC_QUALIFIER detail::tmat3x2<T> make_mat3x2(T const * const ptr)
+ {
+ detail::tmat3x2<T> Result;
+ memcpy(value_ptr(Result), ptr, sizeof(detail::tmat3x2<T>));
+ return Result;
+ }
+
+ //! Build a matrix from a pointer.
+ //! From GLM_GTC_type_ptr extension.
+ template<typename T>
+ GLM_FUNC_QUALIFIER detail::tmat3x3<T> make_mat3x3(T const * const ptr)
+ {
+ detail::tmat3x3<T> Result;
+ memcpy(value_ptr(Result), ptr, sizeof(detail::tmat3x3<T>));
+ return Result;
+ }
+
+ //! Build a matrix from a pointer.
+ //! From GLM_GTC_type_ptr extension.
+ template<typename T>
+ GLM_FUNC_QUALIFIER detail::tmat3x4<T> make_mat3x4(T const * const ptr)
+ {
+ detail::tmat3x4<T> Result;
+ memcpy(value_ptr(Result), ptr, sizeof(detail::tmat3x4<T>));
+ return Result;
+ }
+
+
+ //! Build a matrix from a pointer.
+ //! From GLM_GTC_type_ptr extension.
+ template<typename T>
+ GLM_FUNC_QUALIFIER detail::tmat4x2<T> make_mat4x2(T const * const ptr)
+ {
+ detail::tmat4x2<T> Result;
+ memcpy(value_ptr(Result), ptr, sizeof(detail::tmat4x2<T>));
+ return Result;
+ }
+
+ //! Build a matrix from a pointer.
+ //! From GLM_GTC_type_ptr extension.
+ template<typename T>
+ GLM_FUNC_QUALIFIER detail::tmat4x3<T> make_mat4x3(T const * const ptr)
+ {
+ detail::tmat4x3<T> Result;
+ memcpy(value_ptr(Result), ptr, sizeof(detail::tmat4x3<T>));
+ return Result;
+ }
+
+ //! Build a matrix from a pointer.
+ //! From GLM_GTC_type_ptr extension.
+ template<typename T>
+ GLM_FUNC_QUALIFIER detail::tmat4x4<T> make_mat4x4(T const * const ptr)
+ {
+ detail::tmat4x4<T> Result;
+ memcpy(value_ptr(Result), ptr, sizeof(detail::tmat4x4<T>));
+ return Result;
+ }
+
+ //! Build a matrix from a pointer.
+ //! From GLM_GTC_type_ptr extension.
+ template<typename T>
+ GLM_FUNC_QUALIFIER detail::tmat2x2<T> make_mat2(T const * const ptr)
+ {
+ return make_mat2x2(ptr);
+ }
+
+ //! Build a matrix from a pointer.
+ //! From GLM_GTC_type_ptr extension.
+ template<typename T>
+ GLM_FUNC_QUALIFIER detail::tmat3x3<T> make_mat3(T const * const ptr)
+ {
+ return make_mat3x3(ptr);
+ }
+
+ //! Build a matrix from a pointer.
+ //! From GLM_GTC_type_ptr extension.
+ template<typename T>
+ GLM_FUNC_QUALIFIER detail::tmat4x4<T> make_mat4(T const * const ptr)
+ {
+ return make_mat4x4(ptr);
+ }
+
+ ///@}
+
+}//namespace type_ptr
+}//namespace gtc
+}//namespace glm
+
+#include "type_ptr.inl"
+
+namespace glm{using namespace gtc::type_ptr;}
+
+#endif//glm_gtx_type_ptr
+
diff --git a/src/glm/gtc/type_ptr.inl b/src/glm/gtc/type_ptr.inl
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/glm/gtc/type_ptr.inl
diff --git a/src/glm/gtx/associated_min_max.hpp b/src/glm/gtx/associated_min_max.hpp
new file mode 100644
index 0000000..fe3e714
--- /dev/null
+++ b/src/glm/gtx/associated_min_max.hpp
@@ -0,0 +1,82 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2008-03-10
+// Updated : 2008-03-15
+// Licence : This source is under MIT License
+// File : gtx_associated_min_max.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+// - GLM_GTX_extented_min_max
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_gtx_associated_min_max
+#define glm_gtx_associated_min_max
+
+// Dependency:
+#include "../glm.hpp"
+
+#if(defined(GLM_MESSAGES) && !defined(glm_ext))
+# pragma message("GLM: GLM_GTX_associated_min_max extension included")
+#endif
+
+namespace glm{
+namespace gtx{
+namespace associated_min_max ///< GLM_GTX_associated_min_max extension: Min and max functions that return associated values not the compared onces.
+{
+ /// \addtogroup gtx_associated_min_max
+ ///@{
+
+ //! \brief Min comparison between 2 variables
+ template<typename genTypeT, typename genTypeU>
+ genTypeU associatedMin(
+ const genTypeT& x, const genTypeU& a,
+ const genTypeT& y, const genTypeU& b);
+
+ //! \brief Min comparison between 3 variables
+ template<typename genTypeT, typename genTypeU>
+ genTypeU associatedMin(
+ const genTypeT& x, const genTypeU& a,
+ const genTypeT& y, const genTypeU& b,
+ const genTypeT& z, const genTypeU& c);
+
+ //! \brief Min comparison between 4 variables
+ template<typename genTypeT, typename genTypeU>
+ genTypeU associatedMin(
+ const genTypeT& x, const genTypeU& a,
+ const genTypeT& y, const genTypeU& b,
+ const genTypeT& z, const genTypeU& c,
+ const genTypeT& w, const genTypeU& d);
+
+ //! \brief Max comparison between 2 variables
+ template<typename genTypeT, typename genTypeU>
+ genTypeU associatedMax(
+ const genTypeT& x, const genTypeU& a,
+ const genTypeT& y, const genTypeU& b);
+
+ //! \brief Max comparison between 3 variables
+ template<typename genTypeT, typename genTypeU>
+ genTypeU associatedMax(
+ const genTypeT& x, const genTypeU& a,
+ const genTypeT& y, const genTypeU& b,
+ const genTypeT& z, const genTypeU& c);
+
+ //! \brief Max comparison between 4 variables
+ template<typename genTypeT, typename genTypeU>
+ genTypeU associatedMax(
+ const genTypeT& x, const genTypeU& a,
+ const genTypeT& y, const genTypeU& b,
+ const genTypeT& z, const genTypeU& c,
+ const genTypeT& w, const genTypeU& d);
+
+ ///@}
+} //namespace associated_min_max
+} //namespace gtx
+} //namespace glm
+
+#include "associated_min_max.inl"
+
+namespace glm{using namespace gtx::associated_min_max;}
+
+#endif//glm_gtx_associated_min_max
diff --git a/src/glm/gtx/associated_min_max.inl b/src/glm/gtx/associated_min_max.inl
new file mode 100644
index 0000000..8b6daa1
--- /dev/null
+++ b/src/glm/gtx/associated_min_max.inl
@@ -0,0 +1,916 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2008-03-10
+// Updated : 2008-03-15
+// Licence : This source is under MIT License
+// File : gtx_associated_min_max.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm{
+namespace gtx{
+namespace associated_min_max{
+
+ // Min comparison between 2 variables
+ template<typename T, typename U>
+ GLM_FUNC_QUALIFIER U associatedMin(T x, U a, T y, U b)
+ {
+ return x < y ? a : b;
+ }
+
+ template<typename T, typename U>
+ GLM_FUNC_QUALIFIER detail::tvec2<U> associatedMin
+ (
+ const detail::tvec2<T>& x, const detail::tvec2<U>& a,
+ const detail::tvec2<T>& y, const detail::tvec2<U>& b
+ )
+ {
+ detail::tvec2<U> Result;
+ //Result.x = x[0] < y[0] ? a[0] : b[0];
+ //Result.y = x[1] < y[1] ? a[1] : b[1];
+ for(typename detail::tvec2<U>::size_type i = 0; i < detail::tvec2<U>::value_size; ++i)
+ Result[i] = x[i] < y[i] ? a[i] : b[i];
+ return Result;
+ }
+
+ template<typename T, typename U>
+ GLM_FUNC_QUALIFIER detail::tvec3<U> associatedMin
+ (
+ const detail::tvec3<T>& x, const detail::tvec3<U>& a,
+ const detail::tvec3<T>& y, const detail::tvec3<U>& b
+ )
+ {
+ detail::tvec3<U> Result;
+ for(typename detail::tvec3<U>::size_type i = 0; i < detail::tvec3<U>::value_size; ++i)
+ Result[i] = x[i] < y[i] ? a[i] : b[i];
+ return Result;
+ }
+
+ template<typename T, typename U>
+ GLM_FUNC_QUALIFIER detail::tvec4<U> associatedMin
+ (
+ const detail::tvec4<T>& x, const detail::tvec4<U>& a,
+ const detail::tvec4<T>& y, const detail::tvec4<U>& b
+ )
+ {
+ detail::tvec4<U> Result;
+ for(typename detail::tvec4<U>::size_type i = 0; i < detail::tvec4<U>::value_size; ++i)
+ Result[i] = x[i] < y[i] ? a[i] : b[i];
+ return Result;
+ }
+
+ template<typename T, typename U>
+ GLM_FUNC_QUALIFIER detail::tvec2<U> associatedMin
+ (
+ T x, const detail::tvec2<U>& a,
+ T y, const detail::tvec2<U>& b
+ )
+ {
+ detail::tvec2<U> Result;
+ for(typename detail::tvec2<U>::size_type i = 0; i < detail::tvec2<U>::value_size; ++i)
+ Result[i] = x < y ? a[i] : b[i];
+ return Result;
+ }
+
+ template<typename T, typename U>
+ GLM_FUNC_QUALIFIER detail::tvec3<U> associatedMin
+ (
+ T x, const detail::tvec3<U>& a,
+ T y, const detail::tvec3<U>& b
+ )
+ {
+ detail::tvec3<U> Result;
+ for(typename detail::tvec3<U>::size_type i = 0; i < detail::tvec3<U>::value_size; ++i)
+ Result[i] = x < y ? a[i] : b[i];
+ return Result;
+ }
+
+ template<typename T, typename U>
+ GLM_FUNC_QUALIFIER detail::tvec4<U> associatedMin
+ (
+ T x, const detail::tvec4<U>& a,
+ T y, const detail::tvec4<U>& b
+ )
+ {
+ detail::tvec4<U> Result;
+ for(typename detail::tvec4<U>::size_type i = 0; i < detail::tvec4<U>::value_size; ++i)
+ Result[i] = x < y ? a[i] : b[i];
+ return Result;
+ }
+
+ template<typename T, typename U>
+ GLM_FUNC_QUALIFIER detail::tvec2<U> associatedMin
+ (
+ const detail::tvec2<T>& x, U a,
+ const detail::tvec2<T>& y, U b
+ )
+ {
+ detail::tvec2<U> Result;
+ for(typename detail::tvec2<U>::size_type i = 0; i < detail::tvec2<T>::value_size(); ++i)
+ Result[i] = x[i] < y[i] ? a : b;
+ return Result;
+ }
+
+ template<typename T, typename U>
+ GLM_FUNC_QUALIFIER detail::tvec3<U> associatedMin
+ (
+ const detail::tvec3<T>& x, U a,
+ const detail::tvec3<T>& y, U b
+ )
+ {
+ detail::tvec3<U> Result;
+ for(typename detail::tvec3<U>::size_type i = 0; i < detail::tvec3<T>::value_size(); ++i)
+ Result[i] = x[i] < y[i] ? a : b;
+ return Result;
+ }
+
+ template<typename T, typename U>
+ GLM_FUNC_QUALIFIER detail::tvec4<U> associatedMin
+ (
+ const detail::tvec4<T>& x, U a,
+ const detail::tvec4<T>& y, U b
+ )
+ {
+ detail::tvec4<U> Result;
+ for(typename detail::tvec4<U>::size_type i = 0; i < detail::tvec4<T>::value_size(); ++i)
+ Result[i] = x[i] < y[i] ? a : b;
+ return Result;
+ }
+
+ // Min comparison between 3 variables
+ template<typename T, typename U>
+ GLM_FUNC_QUALIFIER U associatedMin
+ (
+ T x, U a,
+ T y, U b,
+ T z, U c
+ )
+ {
+ U Result = x < y ? (x < z ? a : c) : (y < z ? b : c);
+ return Result;
+ }
+
+ template<typename T, typename U>
+ GLM_FUNC_QUALIFIER detail::tvec2<U> associatedMin
+ (
+ const detail::tvec2<T>& x, const detail::tvec2<U>& a,
+ const detail::tvec2<T>& y, const detail::tvec2<U>& b,
+ const detail::tvec2<T>& z, const detail::tvec2<U>& c
+ )
+ {
+ detail::tvec2<U> Result;
+ for(typename detail::tvec2<U>::size_type i = 0; i < detail::tvec2<U>::value_size; ++i)
+ Result[i] = x[i] < y[i] ? (x[i] < z[i] ? a[i] : c[i]) : (y[i] < z[i] ? b[i] : c[i]);
+ return Result;
+ }
+
+ template<typename T, typename U>
+ GLM_FUNC_QUALIFIER detail::tvec3<U> associatedMin
+ (
+ const detail::tvec3<T>& x, const detail::tvec3<U>& a,
+ const detail::tvec3<T>& y, const detail::tvec3<U>& b,
+ const detail::tvec3<T>& z, const detail::tvec3<U>& c
+ )
+ {
+ detail::tvec3<U> Result;
+ for(typename detail::tvec3<U>::size_type i = 0; i < detail::tvec3<U>::value_size; ++i)
+ Result[i] = x[i] < y[i] ? (x[i] < z[i] ? a[i] : c[i]) : (y[i] < z[i] ? b[i] : c[i]);
+ return Result;
+ }
+
+ template<typename T, typename U>
+ GLM_FUNC_QUALIFIER detail::tvec4<U> associatedMin
+ (
+ const detail::tvec4<T>& x, const detail::tvec4<U>& a,
+ const detail::tvec4<T>& y, const detail::tvec4<U>& b,
+ const detail::tvec4<T>& z, const detail::tvec4<U>& c
+ )
+ {
+ detail::tvec4<U> Result;
+ for(typename detail::tvec4<U>::size_type i = 0; i < detail::tvec4<U>::value_size; ++i)
+ Result[i] = x[i] < y[i] ? (x[i] < z[i] ? a[i] : c[i]) : (y[i] < z[i] ? b[i] : c[i]);
+ return Result;
+ }
+
+ // Min comparison between 4 variables
+ template<typename T, typename U>
+ GLM_FUNC_QUALIFIER U associatedMin
+ (
+ T x, U a,
+ T y, U b,
+ T z, U c,
+ T w, U d
+ )
+ {
+ T Test1 = min(x, y);
+ T Test2 = min(z, w);;
+ U Result1 = x < y ? a : b;
+ U Result2 = z < w ? c : d;
+ U Result = Test1 < Test2 ? Result1 : Result2;
+ return Result;
+ }
+
+ // Min comparison between 4 variables
+ template<typename T, typename U>
+ GLM_FUNC_QUALIFIER detail::tvec2<U> associatedMin
+ (
+ const detail::tvec2<T>& x, const detail::tvec2<U>& a,
+ const detail::tvec2<T>& y, const detail::tvec2<U>& b,
+ const detail::tvec2<T>& z, const detail::tvec2<U>& c,
+ const detail::tvec2<T>& w, const detail::tvec2<U>& d
+ )
+ {
+ detail::tvec2<U> Result;
+ for(typename detail::tvec2<U>::size_type i = 0; i < detail::tvec2<U>::value_size; ++i)
+ {
+ T Test1 = min(x[i], y[i]);
+ T Test2 = min(z[i], w[i]);
+ U Result1 = x[i] < y[i] ? a[i] : b[i];
+ U Result2 = z[i] < w[i] ? c[i] : d[i];
+ Result[i] = Test1 < Test2 ? Result1 : Result2;
+ }
+ return Result;
+ }
+
+ // Min comparison between 4 variables
+ template<typename T, typename U>
+ GLM_FUNC_QUALIFIER detail::tvec3<U> associatedMin
+ (
+ const detail::tvec3<T>& x, const detail::tvec3<U>& a,
+ const detail::tvec3<T>& y, const detail::tvec3<U>& b,
+ const detail::tvec3<T>& z, const detail::tvec3<U>& c,
+ const detail::tvec3<T>& w, const detail::tvec3<U>& d
+ )
+ {
+ detail::tvec3<U> Result;
+ for(typename detail::tvec3<U>::size_type i = 0; i < detail::tvec3<U>::value_size; ++i)
+ {
+ T Test1 = min(x[i], y[i]);
+ T Test2 = min(z[i], w[i]);
+ U Result1 = x[i] < y[i] ? a[i] : b[i];
+ U Result2 = z[i] < w[i] ? c[i] : d[i];
+ Result[i] = Test1 < Test2 ? Result1 : Result2;
+ }
+ return Result;
+ }
+
+ // Min comparison between 4 variables
+ template<typename T, typename U>
+ GLM_FUNC_QUALIFIER detail::tvec4<U> associatedMin
+ (
+ const detail::tvec4<T>& x, const detail::tvec4<U>& a,
+ const detail::tvec4<T>& y, const detail::tvec4<U>& b,
+ const detail::tvec4<T>& z, const detail::tvec4<U>& c,
+ const detail::tvec4<T>& w, const detail::tvec4<U>& d
+ )
+ {
+ detail::tvec4<U> Result;
+ for(typename detail::tvec4<U>::size_type i = 0; i < detail::tvec4<U>::value_size; ++i)
+ {
+ T Test1 = min(x[i], y[i]);
+ T Test2 = min(z[i], w[i]);
+ U Result1 = x[i] < y[i] ? a[i] : b[i];
+ U Result2 = z[i] < w[i] ? c[i] : d[i];
+ Result[i] = Test1 < Test2 ? Result1 : Result2;
+ }
+ return Result;
+ }
+
+ // Min comparison between 4 variables
+ template<typename T, typename U>
+ GLM_FUNC_QUALIFIER detail::tvec2<U> associatedMin
+ (
+ T x, const detail::tvec2<U>& a,
+ T y, const detail::tvec2<U>& b,
+ T z, const detail::tvec2<U>& c,
+ T w, const detail::tvec2<U>& d
+ )
+ {
+ T Test1 = min(x, y);
+ T Test2 = min(z, w);
+
+ detail::tvec2<U> Result;
+ for(typename detail::tvec2<U>::size_type i = 0; i < detail::tvec2<U>::value_size; ++i)
+ {
+ U Result1 = x < y ? a[i] : b[i];
+ U Result2 = z < w ? c[i] : d[i];
+ Result[i] = Test1 < Test2 ? Result1 : Result2;
+ }
+ return Result;
+ }
+
+ // Min comparison between 4 variables
+ template<typename T, typename U>
+ GLM_FUNC_QUALIFIER detail::tvec3<U> associatedMin
+ (
+ T x, const detail::tvec3<U>& a,
+ T y, const detail::tvec3<U>& b,
+ T z, const detail::tvec3<U>& c,
+ T w, const detail::tvec3<U>& d
+ )
+ {
+ T Test1 = min(x, y);
+ T Test2 = min(z, w);
+
+ detail::tvec3<U> Result;
+ for(typename detail::tvec3<U>::size_type i = 0; i < detail::tvec3<U>::value_size; ++i)
+ {
+ U Result1 = x < y ? a[i] : b[i];
+ U Result2 = z < w ? c[i] : d[i];
+ Result[i] = Test1 < Test2 ? Result1 : Result2;
+ }
+ return Result;
+ }
+
+ // Min comparison between 4 variables
+ template<typename T, typename U>
+ GLM_FUNC_QUALIFIER detail::tvec4<U> associatedMin
+ (
+ T x, const detail::tvec4<U>& a,
+ T y, const detail::tvec4<U>& b,
+ T z, const detail::tvec4<U>& c,
+ T w, const detail::tvec4<U>& d
+ )
+ {
+ T Test1 = min(x, y);
+ T Test2 = min(z, w);
+
+ detail::tvec4<U> Result;
+ for(typename detail::tvec4<U>::size_type i = 0; i < detail::tvec4<U>::value_size; ++i)
+ {
+ U Result1 = x < y ? a[i] : b[i];
+ U Result2 = z < w ? c[i] : d[i];
+ Result[i] = Test1 < Test2 ? Result1 : Result2;
+ }
+ return Result;
+ }
+
+ // Min comparison between 4 variables
+ template<typename T, typename U>
+ GLM_FUNC_QUALIFIER detail::tvec2<U> associatedMin
+ (
+ const detail::tvec2<T>& x, U a,
+ const detail::tvec2<T>& y, U b,
+ const detail::tvec2<T>& z, U c,
+ const detail::tvec2<T>& w, U d
+ )
+ {
+ detail::tvec2<U> Result;
+ for(typename detail::tvec2<T>::size_type i = 0; i < detail::tvec2<T>::value_size(); ++i)
+ {
+ T Test1 = min(x[i], y[i]);
+ T Test2 = min(z[i], w[i]);;
+ U Result1 = x[i] < y[i] ? a : b;
+ U Result2 = z[i] < w[i] ? c : d;
+ Result[i] = Test1 < Test2 ? Result1 : Result2;
+ }
+ return Result;
+ }
+
+ // Min comparison between 4 variables
+ template<typename T, typename U>
+ GLM_FUNC_QUALIFIER detail::tvec3<U> associatedMin
+ (
+ const detail::tvec3<T>& x, U a,
+ const detail::tvec3<T>& y, U b,
+ const detail::tvec3<T>& z, U c,
+ const detail::tvec3<T>& w, U d
+ )
+ {
+ detail::tvec3<U> Result;
+ for(typename detail::tvec3<T>::size_type i = 0; i < detail::tvec3<T>::value_size(); ++i)
+ {
+ T Test1 = min(x[i], y[i]);
+ T Test2 = min(z[i], w[i]);;
+ U Result1 = x[i] < y[i] ? a : b;
+ U Result2 = z[i] < w[i] ? c : d;
+ Result[i] = Test1 < Test2 ? Result1 : Result2;
+ }
+ return Result;
+ }
+
+ // Min comparison between 4 variables
+ template<typename T, typename U>
+ GLM_FUNC_QUALIFIER detail::tvec4<U> associatedMin
+ (
+ const detail::tvec4<T>& x, U a,
+ const detail::tvec4<T>& y, U b,
+ const detail::tvec4<T>& z, U c,
+ const detail::tvec4<T>& w, U d
+ )
+ {
+ detail::tvec4<U> Result;
+ for(typename detail::tvec4<T>::size_type i = 0; i < detail::tvec4<T>::value_size(); ++i)
+ {
+ T Test1 = min(x[i], y[i]);
+ T Test2 = min(z[i], w[i]);;
+ U Result1 = x[i] < y[i] ? a : b;
+ U Result2 = z[i] < w[i] ? c : d;
+ Result[i] = Test1 < Test2 ? Result1 : Result2;
+ }
+ return Result;
+ }
+
+ // Max comparison between 2 variables
+ template<typename T, typename U>
+ GLM_FUNC_QUALIFIER U associatedMax(T x, U a, T y, U b)
+ {
+ return x > y ? a : b;
+ }
+
+ // Max comparison between 2 variables
+ template<typename T, typename U>
+ GLM_FUNC_QUALIFIER detail::tvec2<U> associatedMax
+ (
+ const detail::tvec2<T>& x, const detail::tvec2<U>& a,
+ const detail::tvec2<T>& y, const detail::tvec2<U>& b
+ )
+ {
+ detail::tvec2<U> Result;
+ for(typename detail::tvec2<U>::size_type i = 0; i < detail::tvec2<U>::value_size; ++i)
+ Result[i] = x[i] > y[i] ? a[i] : b[i];
+ return Result;
+ }
+
+ // Max comparison between 2 variables
+ template<typename T, typename U>
+ GLM_FUNC_QUALIFIER detail::tvec3<U> associatedMax
+ (
+ const detail::tvec3<T>& x, const detail::tvec3<U>& a,
+ const detail::tvec3<T>& y, const detail::tvec3<U>& b
+ )
+ {
+ detail::tvec3<U> Result;
+ for(typename detail::tvec3<U>::size_type i = 0; i < detail::tvec3<U>::value_size; ++i)
+ Result[i] = x[i] > y[i] ? a[i] : b[i];
+ return Result;
+ }
+
+ // Max comparison between 2 variables
+ template<typename T, typename U>
+ GLM_FUNC_QUALIFIER detail::tvec4<U> associatedMax
+ (
+ const detail::tvec4<T>& x, const detail::tvec4<U>& a,
+ const detail::tvec4<T>& y, const detail::tvec4<U>& b
+ )
+ {
+ detail::tvec4<U> Result;
+ for(typename detail::tvec4<U>::size_type i = 0; i < detail::tvec4<U>::value_size; ++i)
+ Result[i] = x[i] > y[i] ? a[i] : b[i];
+ return Result;
+ }
+
+ // Max comparison between 2 variables
+ template<typename T, typename U>
+ GLM_FUNC_QUALIFIER detail::tvec2<U> associatedMax
+ (
+ T x, const detail::tvec2<U>& a,
+ T y, const detail::tvec2<U>& b
+ )
+ {
+ detail::tvec2<U> Result;
+ for(typename detail::tvec2<U>::size_type i = 0; i < detail::tvec2<U>::value_size; ++i)
+ Result[i] = x > y ? a[i] : b[i];
+ return Result;
+ }
+
+ // Max comparison between 2 variables
+ template<typename T, typename U>
+ GLM_FUNC_QUALIFIER detail::tvec3<U> associatedMax
+ (
+ T x, const detail::tvec3<U>& a,
+ T y, const detail::tvec3<U>& b
+ )
+ {
+ detail::tvec3<U> Result;
+ for(typename detail::tvec3<U>::size_type i = 0; i < detail::tvec3<U>::value_size; ++i)
+ Result[i] = x > y ? a[i] : b[i];
+ return Result;
+ }
+
+ // Max comparison between 2 variables
+ template<typename T, typename U>
+ GLM_FUNC_QUALIFIER detail::tvec4<U> associatedMax
+ (
+ T x, const detail::tvec4<U>& a,
+ T y, const detail::tvec4<U>& b
+ )
+ {
+ detail::tvec4<U> Result;
+ for(typename detail::tvec4<U>::size_type i = 0; i < detail::tvec4<U>::value_size; ++i)
+ Result[i] = x > y ? a[i] : b[i];
+ return Result;
+ }
+
+ // Max comparison between 2 variables
+ template<typename T, typename U>
+ GLM_FUNC_QUALIFIER detail::tvec2<U> associatedMax
+ (
+ const detail::tvec2<T>& x, U a,
+ const detail::tvec2<T>& y, U b
+ )
+ {
+ detail::tvec2<U> Result;
+ for(typename detail::tvec2<T>::size_type i = 0; i < detail::tvec2<T>::value_size(); ++i)
+ Result[i] = x[i] > y[i] ? a : b;
+ return Result;
+ }
+
+ // Max comparison between 2 variables
+ template<typename T, typename U>
+ GLM_FUNC_QUALIFIER detail::tvec3<U> associatedMax
+ (
+ const detail::tvec3<T>& x, U a,
+ const detail::tvec3<T>& y, U b
+ )
+ {
+ detail::tvec3<U> Result;
+ for(typename detail::tvec3<T>::size_type i = 0; i < detail::tvec3<T>::value_size(); ++i)
+ Result[i] = x[i] > y[i] ? a : b;
+ return Result;
+ }
+
+ // Max comparison between 2 variables
+ template<typename T, typename U>
+ GLM_FUNC_QUALIFIER detail::tvec4<U> associatedMax
+ (
+ const detail::tvec4<T>& x, U a,
+ const detail::tvec4<T>& y, U b
+ )
+ {
+ detail::tvec4<U> Result;
+ for(typename detail::tvec4<T>::size_type i = 0; i < detail::tvec4<T>::value_size(); ++i)
+ Result[i] = x[i] > y[i] ? a : b;
+ return Result;
+ }
+
+ // Max comparison between 3 variables
+ template<typename T, typename U>
+ GLM_FUNC_QUALIFIER U associatedMax
+ (
+ T x, U a,
+ T y, U b,
+ T z, U c
+ )
+ {
+ U Result = x > y ? (x > z ? a : c) : (y > z ? b : c);
+ return Result;
+ }
+
+ // Max comparison between 3 variables
+ template<typename T, typename U>
+ GLM_FUNC_QUALIFIER detail::tvec2<U> associatedMax
+ (
+ const detail::tvec2<T>& x, const detail::tvec2<U>& a,
+ const detail::tvec2<T>& y, const detail::tvec2<U>& b,
+ const detail::tvec2<T>& z, const detail::tvec2<U>& c
+ )
+ {
+ detail::tvec2<U> Result;
+ for(typename detail::tvec2<U>::size_type i = 0; i < detail::tvec2<U>::value_size; ++i)
+ Result[i] = x[i] > y[i] ? (x[i] > z[i] ? a[i] : c[i]) : (y[i] > z[i] ? b[i] : c[i]);
+ return Result;
+ }
+
+ // Max comparison between 3 variables
+ template<typename T, typename U>
+ GLM_FUNC_QUALIFIER detail::tvec3<U> associatedMax
+ (
+ const detail::tvec3<T>& x, const detail::tvec3<U>& a,
+ const detail::tvec3<T>& y, const detail::tvec3<U>& b,
+ const detail::tvec3<T>& z, const detail::tvec3<U>& c
+ )
+ {
+ detail::tvec3<U> Result;
+ for(typename detail::tvec3<U>::size_type i = 0; i < detail::tvec3<U>::value_size; ++i)
+ Result[i] = x[i] > y[i] ? (x[i] > z[i] ? a[i] : c[i]) : (y[i] > z[i] ? b[i] : c[i]);
+ return Result;
+ }
+
+ // Max comparison between 3 variables
+ template<typename T, typename U>
+ GLM_FUNC_QUALIFIER detail::tvec4<U> associatedMax
+ (
+ const detail::tvec4<T>& x, const detail::tvec4<U>& a,
+ const detail::tvec4<T>& y, const detail::tvec4<U>& b,
+ const detail::tvec4<T>& z, const detail::tvec4<U>& c
+ )
+ {
+ detail::tvec4<U> Result;
+ for(typename detail::tvec4<U>::size_type i = 0; i < detail::tvec4<U>::value_size; ++i)
+ Result[i] = x[i] > y[i] ? (x[i] > z[i] ? a[i] : c[i]) : (y[i] > z[i] ? b[i] : c[i]);
+ return Result;
+ }
+
+ // Max comparison between 3 variables
+ template<typename T, typename U>
+ GLM_FUNC_QUALIFIER detail::tvec2<U> associatedMax
+ (
+ T x, const detail::tvec2<U>& a,
+ T y, const detail::tvec2<U>& b,
+ T z, const detail::tvec2<U>& c
+ )
+ {
+ detail::tvec2<U> Result;
+ for(typename detail::tvec2<U>::size_type i = 0; i < detail::tvec2<U>::value_size; ++i)
+ Result[i] = x > y ? (x > z ? a[i] : c[i]) : (y > z ? b[i] : c[i]);
+ return Result;
+ }
+
+ // Max comparison between 3 variables
+ template<typename T, typename U>
+ GLM_FUNC_QUALIFIER detail::tvec3<U> associatedMax
+ (
+ T x, const detail::tvec3<U>& a,
+ T y, const detail::tvec3<U>& b,
+ T z, const detail::tvec3<U>& c
+ )
+ {
+ detail::tvec3<U> Result;
+ for(typename detail::tvec3<U>::size_type i = 0; i < detail::tvec3<U>::value_size; ++i)
+ Result[i] = x > y ? (x > z ? a[i] : c[i]) : (y > z ? b[i] : c[i]);
+ return Result;
+ }
+
+ // Max comparison between 3 variables
+ template<typename T, typename U>
+ GLM_FUNC_QUALIFIER detail::tvec4<U> associatedMax
+ (
+ T x, const detail::tvec4<U>& a,
+ T y, const detail::tvec4<U>& b,
+ T z, const detail::tvec4<U>& c
+ )
+ {
+ detail::tvec4<U> Result;
+ for(typename detail::tvec4<U>::size_type i = 0; i < detail::tvec4<U>::value_size; ++i)
+ Result[i] = x > y ? (x > z ? a[i] : c[i]) : (y > z ? b[i] : c[i]);
+ return Result;
+ }
+
+ // Max comparison between 3 variables
+ template<typename T, typename U>
+ GLM_FUNC_QUALIFIER detail::tvec2<U> associatedMax
+ (
+ const detail::tvec2<T>& x, U a,
+ const detail::tvec2<T>& y, U b,
+ const detail::tvec2<T>& z, U c
+ )
+ {
+ detail::tvec2<U> Result;
+ for(typename detail::tvec2<T>::size_type i = 0; i < detail::tvec2<T>::value_size(); ++i)
+ Result[i] = x[i] > y[i] ? (x[i] > z[i] ? a : c) : (y[i] > z[i] ? b : c);
+ return Result;
+ }
+
+ // Max comparison between 3 variables
+ template<typename T, typename U>
+ GLM_FUNC_QUALIFIER detail::tvec3<U> associatedMax
+ (
+ const detail::tvec3<T>& x, U a,
+ const detail::tvec3<T>& y, U b,
+ const detail::tvec3<T>& z, U c
+ )
+ {
+ detail::tvec3<U> Result;
+ for(typename detail::tvec3<T>::size_type i = 0; i < detail::tvec3<T>::value_size(); ++i)
+ Result[i] = x[i] > y[i] ? (x[i] > z[i] ? a : c) : (y[i] > z[i] ? b : c);
+ return Result;
+ }
+
+ // Max comparison between 3 variables
+ template<typename T, typename U>
+ GLM_FUNC_QUALIFIER detail::tvec4<U> associatedMax
+ (
+ const detail::tvec4<T>& x, U a,
+ const detail::tvec4<T>& y, U b,
+ const detail::tvec4<T>& z, U c
+ )
+ {
+ detail::tvec4<U> Result;
+ for(typename detail::tvec4<T>::size_type i = 0; i < detail::tvec4<T>::value_size(); ++i)
+ Result[i] = x[i] > y[i] ? (x[i] > z[i] ? a : c) : (y[i] > z[i] ? b : c);
+ return Result;
+ }
+
+ // Max comparison between 4 variables
+ template<typename T, typename U>
+ GLM_FUNC_QUALIFIER U associatedMax
+ (
+ T x, U a,
+ T y, U b,
+ T z, U c,
+ T w, U d
+ )
+ {
+ T Test1 = max(x, y);
+ T Test2 = max(z, w);;
+ U Result1 = x > y ? a : b;
+ U Result2 = z > w ? c : d;
+ U Result = Test1 > Test2 ? Result1 : Result2;
+ return Result;
+ }
+
+ // Max comparison between 4 variables
+ template<typename T, typename U>
+ GLM_FUNC_QUALIFIER detail::tvec2<U> associatedMax
+ (
+ const detail::tvec2<T>& x, const detail::tvec2<U>& a,
+ const detail::tvec2<T>& y, const detail::tvec2<U>& b,
+ const detail::tvec2<T>& z, const detail::tvec2<U>& c,
+ const detail::tvec2<T>& w, const detail::tvec2<U>& d
+ )
+ {
+ detail::tvec2<U> Result;
+ for(typename detail::tvec2<U>::size_type i = 0; i < detail::tvec2<U>::value_size; ++i)
+ {
+ T Test1 = max(x[i], y[i]);
+ T Test2 = max(z[i], w[i]);
+ U Result1 = x[i] > y[i] ? a[i] : b[i];
+ U Result2 = z[i] > w[i] ? c[i] : d[i];
+ Result[i] = Test1 > Test2 ? Result1 : Result2;
+ }
+ return Result;
+ }
+
+ // Max comparison between 4 variables
+ template<typename T, typename U>
+ GLM_FUNC_QUALIFIER detail::tvec3<U> associatedMax
+ (
+ const detail::tvec3<T>& x, const detail::tvec3<U>& a,
+ const detail::tvec3<T>& y, const detail::tvec3<U>& b,
+ const detail::tvec3<T>& z, const detail::tvec3<U>& c,
+ const detail::tvec3<T>& w, const detail::tvec3<U>& d
+ )
+ {
+ detail::tvec3<U> Result;
+ for(typename detail::tvec3<U>::size_type i = 0; i < detail::tvec3<U>::value_size; ++i)
+ {
+ T Test1 = max(x[i], y[i]);
+ T Test2 = max(z[i], w[i]);
+ U Result1 = x[i] > y[i] ? a[i] : b[i];
+ U Result2 = z[i] > w[i] ? c[i] : d[i];
+ Result[i] = Test1 > Test2 ? Result1 : Result2;
+ }
+ return Result;
+ }
+
+ // Max comparison between 4 variables
+ template<typename T, typename U>
+ GLM_FUNC_QUALIFIER detail::tvec4<U> associatedMax
+ (
+ const detail::tvec4<T>& x, const detail::tvec4<U>& a,
+ const detail::tvec4<T>& y, const detail::tvec4<U>& b,
+ const detail::tvec4<T>& z, const detail::tvec4<U>& c,
+ const detail::tvec4<T>& w, const detail::tvec4<U>& d
+ )
+ {
+ detail::tvec4<U> Result;
+ for(typename detail::tvec4<U>::size_type i = 0; i < detail::tvec4<U>::value_size; ++i)
+ {
+ T Test1 = max(x[i], y[i]);
+ T Test2 = max(z[i], w[i]);
+ U Result1 = x[i] > y[i] ? a[i] : b[i];
+ U Result2 = z[i] > w[i] ? c[i] : d[i];
+ Result[i] = Test1 > Test2 ? Result1 : Result2;
+ }
+ return Result;
+ }
+
+ // Max comparison between 4 variables
+ template<typename T, typename U>
+ GLM_FUNC_QUALIFIER detail::tvec2<U> associatedMax
+ (
+ T x, const detail::tvec2<U>& a,
+ T y, const detail::tvec2<U>& b,
+ T z, const detail::tvec2<U>& c,
+ T w, const detail::tvec2<U>& d
+ )
+ {
+ T Test1 = max(x, y);
+ T Test2 = max(z, w);
+
+ detail::tvec2<U> Result;
+ for(typename detail::tvec2<U>::size_type i = 0; i < detail::tvec2<U>::value_size; ++i)
+ {
+ U Result1 = x > y ? a[i] : b[i];
+ U Result2 = z > w ? c[i] : d[i];
+ Result[i] = Test1 > Test2 ? Result1 : Result2;
+ }
+ return Result;
+ }
+
+ // Max comparison between 4 variables
+ template<typename T, typename U>
+ GLM_FUNC_QUALIFIER detail::tvec3<U> associatedMax
+ (
+ T x, const detail::tvec3<U>& a,
+ T y, const detail::tvec3<U>& b,
+ T z, const detail::tvec3<U>& c,
+ T w, const detail::tvec3<U>& d
+ )
+ {
+ T Test1 = max(x, y);
+ T Test2 = max(z, w);
+
+ detail::tvec3<U> Result;
+ for(typename detail::tvec3<U>::size_type i = 0; i < detail::tvec3<U>::value_size; ++i)
+ {
+ U Result1 = x > y ? a[i] : b[i];
+ U Result2 = z > w ? c[i] : d[i];
+ Result[i] = Test1 > Test2 ? Result1 : Result2;
+ }
+ return Result;
+ }
+
+ // Max comparison between 4 variables
+ template<typename T, typename U>
+ GLM_FUNC_QUALIFIER detail::tvec4<U> associatedMax
+ (
+ T x, const detail::tvec4<U>& a,
+ T y, const detail::tvec4<U>& b,
+ T z, const detail::tvec4<U>& c,
+ T w, const detail::tvec4<U>& d
+ )
+ {
+ T Test1 = max(x, y);
+ T Test2 = max(z, w);
+
+ detail::tvec4<U> Result;
+ for(typename detail::tvec4<U>::size_type i = 0; i < detail::tvec4<U>::value_size; ++i)
+ {
+ U Result1 = x > y ? a[i] : b[i];
+ U Result2 = z > w ? c[i] : d[i];
+ Result[i] = Test1 > Test2 ? Result1 : Result2;
+ }
+ return Result;
+ }
+
+ // Max comparison between 4 variables
+ template<typename T, typename U>
+ GLM_FUNC_QUALIFIER detail::tvec2<U> associatedMax
+ (
+ const detail::tvec2<T>& x, U a,
+ const detail::tvec2<T>& y, U b,
+ const detail::tvec2<T>& z, U c,
+ const detail::tvec2<T>& w, U d
+ )
+ {
+ detail::tvec2<U> Result;
+ for(typename detail::tvec2<T>::size_type i = 0; i < detail::tvec2<T>::value_size(); ++i)
+ {
+ T Test1 = max(x[i], y[i]);
+ T Test2 = max(z[i], w[i]);;
+ U Result1 = x[i] > y[i] ? a : b;
+ U Result2 = z[i] > w[i] ? c : d;
+ Result[i] = Test1 > Test2 ? Result1 : Result2;
+ }
+ return Result;
+ }
+
+ // Max comparison between 4 variables
+ template<typename T, typename U>
+ GLM_FUNC_QUALIFIER detail::tvec3<U> associatedMax
+ (
+ const detail::tvec3<T>& x, U a,
+ const detail::tvec3<T>& y, U b,
+ const detail::tvec3<T>& z, U c,
+ const detail::tvec3<T>& w, U d
+ )
+ {
+ detail::tvec3<U> Result;
+ for(typename detail::tvec3<T>::size_type i = 0; i < detail::tvec3<T>::value_size(); ++i)
+ {
+ T Test1 = max(x[i], y[i]);
+ T Test2 = max(z[i], w[i]);;
+ U Result1 = x[i] > y[i] ? a : b;
+ U Result2 = z[i] > w[i] ? c : d;
+ Result[i] = Test1 > Test2 ? Result1 : Result2;
+ }
+ return Result;
+ }
+
+ // Max comparison between 4 variables
+ template<typename T, typename U>
+ GLM_FUNC_QUALIFIER detail::tvec4<U> associatedMax
+ (
+ const detail::tvec4<T>& x, U a,
+ const detail::tvec4<T>& y, U b,
+ const detail::tvec4<T>& z, U c,
+ const detail::tvec4<T>& w, U d
+ )
+ {
+ detail::tvec4<U> Result;
+ for(typename detail::tvec4<T>::size_type i = 0; i < detail::tvec4<T>::value_size(); ++i)
+ {
+ T Test1 = max(x[i], y[i]);
+ T Test2 = max(z[i], w[i]);;
+ U Result1 = x[i] > y[i] ? a : b;
+ U Result2 = z[i] > w[i] ? c : d;
+ Result[i] = Test1 > Test2 ? Result1 : Result2;
+ }
+ return Result;
+ }
+
+}//namespace associated_min_max
+}//namespace gtx
+}//namespace glm
diff --git a/src/glm/gtx/bit.hpp b/src/glm/gtx/bit.hpp
new file mode 100644
index 0000000..6cf49d4
--- /dev/null
+++ b/src/glm/gtx/bit.hpp
@@ -0,0 +1,107 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2007-03-14
+// Updated : 2008-11-14
+// Licence : This source is under MIT License
+// File : glm/gtx/bit.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+// - GLM_GTC_half_float
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_gtx_bit
+#define glm_gtx_bit
+
+// Dependency:
+#include "../glm.hpp"
+#include "../gtc/half_float.hpp"
+
+#if(defined(GLM_MESSAGES) && !defined(glm_ext))
+# pragma message("GLM: GLM_GTX_bit extension included")
+#endif
+
+namespace glm{
+namespace gtx{
+namespace bit ///< GLM_GTX_bit extension: Allow to perform bit operations on integer values
+{
+ using namespace gtc::half_float;
+
+ /// \addtogroup gtx_bit
+ ///@{
+
+ //! Build a mask of 'count' bits
+ //! From GLM_GTX_bit extension.
+ template <typename genIType>
+ genIType mask(genIType const & count);
+
+ //! Component wise extraction of bit fields.
+ //! genType and genIType could be a scalar or a vector.
+ //! From GLM_GTX_bit extension.
+ template <typename genIUType, typename sizeType>
+ genIUType extractField(
+ genIUType const & v,
+ sizeType const & first,
+ sizeType const & count);
+
+ //! Find the lowest bit set to 1 in a integer variable.
+ //! From GLM_GTX_bit extension.
+ template <typename genType>
+ int lowestBit(genType const & value);
+
+ //! Find the highest bit set to 1 in a integer variable.
+ //! From GLM_GTX_bit extension.
+ template <typename genType>
+ int highestBit(genType const & value);
+
+ //! Find the highest bit set to 1 in a integer variable and return its value.
+ //! From GLM_GTX_bit extension.
+ template <typename genType>
+ genType highestBitValue(genType const & value);
+
+ //! Return true if the value is a power of two number.
+ //! From GLM_GTX_bit extension.
+ template <typename genType>
+ bool isPowerOfTwo(genType const & value);
+
+ //! Return the power of two number which value is just higher the input value.
+ //! From GLM_GTX_bit extension.
+ template <typename genType>
+ genType powerOfTwoAbove(genType const & value);
+
+ //! Return the power of two number which value is just lower the input value.
+ //! From GLM_GTX_bit extension.
+ template <typename genType>
+ genType powerOfTwoBelow(genType const & value);
+
+ //! Return the power of two number which value is the closet to the input value.
+ //! From GLM_GTX_bit extension.
+ template <typename genType>
+ genType powerOfTwoNearest(genType const & value);
+
+ //! Revert all bits of any integer based type.
+ //! From GLM_GTX_bit extension.
+ template <typename genType>
+ genType bitRevert(genType const & value);
+
+ //! Rotate all bits to the right.
+ //! From GLM_GTX_bit extension.
+ template <typename genType>
+ genType bitRotateRight(genType const & In, std::size_t Shift);
+
+ //! Rotate all bits to the left.
+ //! From GLM_GTX_bit extension.
+ template <typename genType>
+ genType bitRotateLeft(genType const & In, std::size_t Shift);
+
+ ///@}
+}//namespace bit
+}//namespace gtx
+}//namespace glm
+
+#include "bit.inl"
+
+namespace glm{using namespace gtx::bit;}
+
+#endif//glm_gtx_bit
diff --git a/src/glm/gtx/bit.inl b/src/glm/gtx/bit.inl
new file mode 100644
index 0000000..72d3c7a
--- /dev/null
+++ b/src/glm/gtx/bit.inl
@@ -0,0 +1,743 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2007-03-14
+// Updated : 2008-11-14
+// Licence : This source is under MIT License
+// File : glm/gtx/bit.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include "../core/_detail.hpp"
+
+namespace glm{
+namespace gtx{
+namespace bit{
+
+template <typename genIType>
+GLM_FUNC_QUALIFIER genIType mask
+(
+ genIType const & count
+)
+{
+ return ((genIType(1) << (count)) - genIType(1));
+}
+
+template <typename valIType>
+GLM_FUNC_QUALIFIER detail::tvec2<valIType> mask
+(
+ detail::tvec2<valIType> const & count
+)
+{
+ return detail::tvec2<valIType>(
+ mask(count[0]),
+ mask(count[1]));
+}
+
+template <typename valIType>
+GLM_FUNC_QUALIFIER detail::tvec3<valIType> mask
+(
+ detail::tvec3<valIType> const & count
+)
+{
+ return detail::tvec3<valIType>(
+ mask(count[0]),
+ mask(count[1]),
+ mask(count[2]));
+}
+
+template <typename valIType>
+GLM_FUNC_QUALIFIER detail::tvec4<valIType> mask
+(
+ detail::tvec4<valIType> const & count
+)
+{
+ return detail::tvec4<valIType>(
+ mask(count[0]),
+ mask(count[1]),
+ mask(count[2]),
+ mask(count[3]));
+}
+
+// extractField
+template <typename genIType>
+GLM_FUNC_QUALIFIER genIType extractField
+(
+ gtc::half_float::half const & value,
+ genIType const & first,
+ genIType const & count
+)
+{
+ assert(first + count < sizeof(gtc::half_float::half));
+ return (value._data() << first) >> ((sizeof(gtc::half_float::half) << 3) - count);
+}
+
+template <typename genIType>
+GLM_FUNC_QUALIFIER genIType extractField
+(
+ float const & value,
+ genIType const & first,
+ genIType const & count
+)
+{
+ assert(first + count < sizeof(float));
+ return (detail::uif32(value).i << first) >> ((sizeof(float) << 3) - count);
+}
+
+template <typename genIType>
+GLM_FUNC_QUALIFIER genIType extractField
+(
+ double const & value,
+ genIType const & first,
+ genIType const & count
+)
+{
+ assert(first + count < sizeof(double));
+ return (detail::uif64(value).i << first) >> ((sizeof(double) << genIType(3)) - count);
+}
+
+template <typename genIUType, typename sizeType>
+GLM_FUNC_QUALIFIER genIUType extractField
+(
+ genIUType const & Value,
+ sizeType const & First,
+ sizeType const & Count
+)
+{
+ sizeType GenSize = sizeof(genIUType) << 3;
+
+ assert(First + Count <= GenSize);
+
+ genIUType ShiftLeft = Count ? Value << (GenSize - (Count + First)) : 0;
+ genIUType ShiftBack = ShiftLeft >> genIUType(GenSize - Count);
+
+ return ShiftBack;
+}
+
+template <typename genIUType, typename sizeType>
+GLM_FUNC_QUALIFIER detail::tvec2<genIUType> extractField
+(
+ detail::tvec2<genIUType> const & value,
+ sizeType const & first,
+ sizeType const & count
+)
+{
+ return detail::tvec2<genIUType>(
+ extractField(value[0], first, count),
+ extractField(value[1], first, count));
+}
+
+template <typename genIUType, typename sizeType>
+GLM_FUNC_QUALIFIER detail::tvec3<genIUType> extractField
+(
+ detail::tvec3<genIUType> const & value,
+ sizeType const & first,
+ sizeType const & count
+)
+{
+ return detail::tvec3<genIUType>(
+ extractField(value[0], first, count),
+ extractField(value[1], first, count),
+ extractField(value[2], first, count));
+}
+
+template <typename genIUType, typename sizeType>
+GLM_FUNC_QUALIFIER detail::tvec4<genIUType> extractField
+(
+ detail::tvec4<genIUType> const & value,
+ sizeType const & first,
+ sizeType const & count
+)
+{
+ return detail::tvec4<genIUType>(
+ extractField(value[0], first, count),
+ extractField(value[1], first, count),
+ extractField(value[2], first, count),
+ extractField(value[3], first, count));
+}
+
+template <typename genIUType, typename sizeType>
+GLM_FUNC_QUALIFIER detail::tvec2<genIUType> extractField
+(
+ detail::tvec2<genIUType> const & value,
+ detail::tvec2<sizeType> const & first,
+ detail::tvec2<sizeType> const & count
+)
+{
+ return detail::tvec2<genIUType>(
+ extractField(value[0], first[0], count[0]),
+ extractField(value[1], first[1], count[1]));
+}
+
+template <typename genIUType, typename sizeType>
+GLM_FUNC_QUALIFIER detail::tvec3<genIUType> extractField
+(
+ detail::tvec3<genIUType> const & value,
+ detail::tvec3<sizeType> const & first,
+ detail::tvec3<sizeType> const & count
+)
+{
+ return detail::tvec3<genIUType>(
+ extractField(value[0], first[0], count[0]),
+ extractField(value[1], first[1], count[1]),
+ extractField(value[2], first[2], count[2]));
+}
+
+template <typename genIUType, typename sizeType>
+GLM_FUNC_QUALIFIER detail::tvec4<genIUType> extractField
+(
+ detail::tvec4<genIUType> const & value,
+ detail::tvec4<sizeType> const & first,
+ detail::tvec4<sizeType> const & count
+)
+{
+ return detail::tvec4<genIUType>(
+ extractField(value[0], first[0], count[0]),
+ extractField(value[1], first[1], count[1]),
+ extractField(value[2], first[2], count[2]),
+ extractField(value[3], first[3], count[3]));
+}
+
+template <typename genIUType, typename sizeType>
+GLM_FUNC_QUALIFIER detail::tvec2<genIUType> extractField
+(
+ genIUType const & value,
+ detail::tvec2<sizeType> const & first,
+ detail::tvec2<sizeType> const & count
+)
+{
+ return detail::tvec2<genIUType>(
+ extractField(value, first[0], count[0]),
+ extractField(value, first[1], count[1]));
+}
+
+template <typename genIUType, typename sizeType>
+GLM_FUNC_QUALIFIER detail::tvec3<genIUType> extractField
+(
+ genIUType const & value,
+ detail::tvec3<sizeType> const & first,
+ detail::tvec3<sizeType> const & count
+)
+{
+ return detail::tvec3<genIUType>(
+ extractField(value, first[0], count[0]),
+ extractField(value, first[1], count[1]),
+ extractField(value, first[2], count[2]));
+}
+
+template <typename genIUType, typename sizeType>
+GLM_FUNC_QUALIFIER detail::tvec4<genIUType> extractField
+(
+ genIUType const & value,
+ detail::tvec4<sizeType> const & first,
+ detail::tvec4<sizeType> const & count
+)
+{
+ return detail::tvec4<genIUType>(
+ extractField(value, first[0], count[0]),
+ extractField(value, first[1], count[1]),
+ extractField(value, first[2], count[2]),
+ extractField(value, first[3], count[3]));
+}
+
+// lowestBit
+template <typename genType>
+GLM_FUNC_QUALIFIER int lowestBit
+(
+ genType const & Value
+)
+{
+ assert(Value != genType(0)); // not valid call
+
+ genType Bit;
+ for(Bit = genType(0); !(Value & (1 << Bit)); ++Bit){}
+ return Bit;
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec2<int> lowestBit
+(
+ detail::tvec2<valType> const & value
+)
+{
+ return detail::tvec2<int>(
+ lowestBit(value[0]),
+ lowestBit(value[1]));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec3<int> lowestBit
+(
+ detail::tvec3<valType> const & value
+)
+{
+ return detail::tvec3<int>(
+ lowestBit(value[0]),
+ lowestBit(value[1]),
+ lowestBit(value[2]));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec4<int> lowestBit
+(
+ detail::tvec4<valType> const & value
+)
+{
+ return detail::tvec4<int>(
+ lowestBit(value[0]),
+ lowestBit(value[1]),
+ lowestBit(value[2]),
+ lowestBit(value[3]));
+}
+
+// highestBit
+template <typename genType>
+GLM_FUNC_QUALIFIER int highestBit
+(
+ genType const & value
+)
+{
+ assert(value != genType(0)); // not valid call
+
+ genType bit = genType(-1);
+ for(genType tmp = value; tmp; tmp >>= 1, ++bit){}
+ return bit;
+}
+
+//template <>
+//GLM_FUNC_QUALIFIER int highestBit<int>
+//(
+// int value
+//)
+//{
+// int bit = -1;
+// for(int tmp = value; tmp; tmp >>= 1, ++bit);
+// return bit;
+//}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec2<int> highestBit
+(
+ detail::tvec2<valType> const & value
+)
+{
+ return detail::tvec2<int>(
+ highestBit(value[0]),
+ highestBit(value[1]));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec3<int> highestBit
+(
+ detail::tvec3<valType> const & value
+)
+{
+ return detail::tvec3<int>(
+ highestBit(value[0]),
+ highestBit(value[1]),
+ highestBit(value[2]));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec4<int> highestBit
+(
+ detail::tvec4<valType> const & value
+)
+{
+ return detail::tvec4<int>(
+ highestBit(value[0]),
+ highestBit(value[1]),
+ highestBit(value[2]),
+ highestBit(value[3]));
+}
+
+// highestBitValue
+template <typename genType>
+GLM_FUNC_QUALIFIER genType highestBitValue
+(
+ genType const & value
+)
+{
+ genType tmp = value;
+ genType result = genType(0);
+ while(tmp)
+ {
+ result = (tmp & (~tmp + 1)); // grab lowest bit
+ tmp &= ~result; // clear lowest bit
+ }
+ return result;
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec2<int> highestBitValue
+(
+ detail::tvec2<valType> const & value
+)
+{
+ return detail::tvec2<int>(
+ highestBitValue(value[0]),
+ highestBitValue(value[1]));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec3<int> highestBitValue
+(
+ detail::tvec3<valType> const & value
+)
+{
+ return detail::tvec3<int>(
+ highestBitValue(value[0]),
+ highestBitValue(value[1]),
+ highestBitValue(value[2]));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec4<int> highestBitValue
+(
+ detail::tvec4<valType> const & value
+)
+{
+ return detail::tvec4<int>(
+ highestBitValue(value[0]),
+ highestBitValue(value[1]),
+ highestBitValue(value[2]),
+ highestBitValue(value[3]));
+}
+
+// isPowerOfTwo
+template <typename genType>
+GLM_FUNC_QUALIFIER bool isPowerOfTwo(genType const & Value)
+{
+ //detail::If<std::numeric_limits<genType>::is_signed>::apply(abs, Value);
+ //return !(Value & (Value - 1));
+
+ // For old complier?
+ genType Result = Value;
+ if(std::numeric_limits<genType>::is_signed)
+ Result = abs(Result);
+ return !(Result & (Result - 1));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec2<bool> isPowerOfTwo
+(
+ detail::tvec2<valType> const & value
+)
+{
+ return detail::tvec2<bool>(
+ isPowerOfTwo(value[0]),
+ isPowerOfTwo(value[1]));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec3<bool> isPowerOfTwo
+(
+ detail::tvec3<valType> const & value
+)
+{
+ return detail::tvec3<bool>(
+ isPowerOfTwo(value[0]),
+ isPowerOfTwo(value[1]),
+ isPowerOfTwo(value[2]));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec4<bool> isPowerOfTwo
+(
+ detail::tvec4<valType> const & value
+)
+{
+ return detail::tvec4<bool>(
+ isPowerOfTwo(value[0]),
+ isPowerOfTwo(value[1]),
+ isPowerOfTwo(value[2]),
+ isPowerOfTwo(value[3]));
+}
+
+// powerOfTwoAbove
+template <typename genType>
+GLM_FUNC_QUALIFIER genType powerOfTwoAbove(genType const & value)
+{
+ return isPowerOfTwo(value) ? value : highestBitValue(value) << 1;
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec2<valType> powerOfTwoAbove
+(
+ detail::tvec2<valType> const & value
+)
+{
+ return detail::tvec2<valType>(
+ powerOfTwoAbove(value[0]),
+ powerOfTwoAbove(value[1]));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec3<valType> powerOfTwoAbove
+(
+ detail::tvec3<valType> const & value
+)
+{
+ return detail::tvec3<valType>(
+ powerOfTwoAbove(value[0]),
+ powerOfTwoAbove(value[1]),
+ powerOfTwoAbove(value[2]));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec4<valType> powerOfTwoAbove
+(
+ detail::tvec4<valType> const & value
+)
+{
+ return detail::tvec4<valType>(
+ powerOfTwoAbove(value[0]),
+ powerOfTwoAbove(value[1]),
+ powerOfTwoAbove(value[2]),
+ powerOfTwoAbove(value[3]));
+}
+
+// powerOfTwoBelow
+template <typename genType>
+GLM_FUNC_QUALIFIER genType powerOfTwoBelow
+(
+ genType const & value
+)
+{
+ return isPowerOfTwo(value) ? value : highestBitValue(value);
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec2<valType> powerOfTwoBelow
+(
+ detail::tvec2<valType> const & value
+)
+{
+ return detail::tvec2<valType>(
+ powerOfTwoBelow(value[0]),
+ powerOfTwoBelow(value[1]));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec3<valType> powerOfTwoBelow
+(
+ detail::tvec3<valType> const & value
+)
+{
+ return detail::tvec3<valType>(
+ powerOfTwoBelow(value[0]),
+ powerOfTwoBelow(value[1]),
+ powerOfTwoBelow(value[2]));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec4<valType> powerOfTwoBelow
+(
+ detail::tvec4<valType> const & value
+)
+{
+ return detail::tvec4<valType>(
+ powerOfTwoBelow(value[0]),
+ powerOfTwoBelow(value[1]),
+ powerOfTwoBelow(value[2]),
+ powerOfTwoBelow(value[3]));
+}
+
+// powerOfTwoNearest
+template <typename genType>
+GLM_FUNC_QUALIFIER genType powerOfTwoNearest
+(
+ genType const & value
+)
+{
+ if(isPowerOfTwo(value))
+ return value;
+
+ genType prev = highestBitValue(value);
+ genType next = prev << 1;
+ return (next - value) < (value - prev) ? next : prev;
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec2<valType> powerOfTwoNearest
+(
+ detail::tvec2<valType> const & value
+)
+{
+ return detail::tvec2<valType>(
+ powerOfTwoNearest(value[0]),
+ powerOfTwoNearest(value[1]));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec3<valType> powerOfTwoNearest
+(
+ detail::tvec3<valType> const & value
+)
+{
+ return detail::tvec3<valType>(
+ powerOfTwoNearest(value[0]),
+ powerOfTwoNearest(value[1]),
+ powerOfTwoNearest(value[2]));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec4<valType> powerOfTwoNearest
+(
+ detail::tvec4<valType> const & value
+)
+{
+ return detail::tvec4<valType>(
+ powerOfTwoNearest(value[0]),
+ powerOfTwoNearest(value[1]),
+ powerOfTwoNearest(value[2]),
+ powerOfTwoNearest(value[3]));
+}
+
+template <typename genType>
+GLM_FUNC_QUALIFIER genType bitRevert(genType const & In)
+{
+ GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_integer, "'bitRevert' only accept integer values");
+
+ genType Out = 0;
+ std::size_t BitSize = sizeof(genType) * 8;
+ for(std::size_t i = 0; i < BitSize; ++i)
+ if(In & (genType(1) << i))
+ Out |= genType(1) << (BitSize - 1 - i);
+ return Out;
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec2<valType> bitRevert
+(
+ detail::tvec2<valType> const & Value
+)
+{
+ return detail::tvec2<valType>(
+ bitRevert(Value[0]),
+ bitRevert(Value[1]));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec3<valType> bitRevert
+(
+ detail::tvec3<valType> const & Value
+)
+{
+ return detail::tvec3<valType>(
+ bitRevert(Value[0]),
+ bitRevert(Value[1]),
+ bitRevert(Value[2]));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec4<valType> bitRevert
+(
+ detail::tvec4<valType> const & Value
+)
+{
+ return detail::tvec4<valType>(
+ bitRevert(Value[0]),
+ bitRevert(Value[1]),
+ bitRevert(Value[2]),
+ bitRevert(Value[3]));
+}
+
+template <typename genType>
+GLM_FUNC_QUALIFIER genType bitRotateRight(genType const & In, std::size_t Shift)
+{
+ GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_integer, "'bitRotateRight' only accept integer values");
+
+ std::size_t BitSize = sizeof(genType) * 8;
+ return (In << Shift) | (In >> (BitSize - Shift));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec2<valType> bitRotateRight
+(
+ detail::tvec2<valType> const & Value,
+ std::size_t Shift
+)
+{
+ return detail::tvec2<valType>(
+ bitRotateRight(Value[0], Shift),
+ bitRotateRight(Value[1], Shift));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec3<valType> bitRotateRight
+(
+ detail::tvec3<valType> const & Value,
+ std::size_t Shift
+)
+{
+ return detail::tvec3<valType>(
+ bitRotateRight(Value[0], Shift),
+ bitRotateRight(Value[1], Shift),
+ bitRotateRight(Value[2], Shift));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec4<valType> bitRotateRight
+(
+ detail::tvec4<valType> const & Value,
+ std::size_t Shift
+)
+{
+ return detail::tvec4<valType>(
+ bitRotateRight(Value[0], Shift),
+ bitRotateRight(Value[1], Shift),
+ bitRotateRight(Value[2], Shift),
+ bitRotateRight(Value[3], Shift));
+}
+
+template <typename genType>
+GLM_FUNC_QUALIFIER genType bitRotateLeft(genType const & In, std::size_t Shift)
+{
+ GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_integer, "'bitRotateLeft' only accept integer values");
+
+ std::size_t BitSize = sizeof(genType) * 8;
+ return (In >> Shift) | (In << (BitSize - Shift));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec2<valType> bitRotateLeft
+(
+ detail::tvec2<valType> const & Value,
+ std::size_t Shift
+)
+{
+ return detail::tvec2<valType>(
+ bitRotateLeft(Value[0], Shift),
+ bitRotateLeft(Value[1], Shift));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec3<valType> bitRotateLeft
+(
+ detail::tvec3<valType> const & Value,
+ std::size_t Shift
+)
+{
+ return detail::tvec3<valType>(
+ bitRotateLeft(Value[0], Shift),
+ bitRotateLeft(Value[1], Shift),
+ bitRotateLeft(Value[2], Shift));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec4<valType> bitRotateLeft
+(
+ detail::tvec4<valType> const & Value,
+ std::size_t Shift
+)
+{
+ return detail::tvec4<valType>(
+ bitRotateLeft(Value[0], Shift),
+ bitRotateLeft(Value[1], Shift),
+ bitRotateLeft(Value[2], Shift),
+ bitRotateLeft(Value[3], Shift));
+}
+
+}//namespace bit
+}//namespace gtx
+}//namespace glm
diff --git a/src/glm/gtx/closest_point.hpp b/src/glm/gtx/closest_point.hpp
new file mode 100644
index 0000000..e70d561
--- /dev/null
+++ b/src/glm/gtx/closest_point.hpp
@@ -0,0 +1,47 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2005-12-30
+// Updated : 2008-10-05
+// Licence : This source is under MIT License
+// File : glm/gtx/closest_point.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_gtx_closest_point
+#define glm_gtx_closest_point
+
+// Dependency:
+#include "../glm.hpp"
+
+#if(defined(GLM_MESSAGES) && !defined(glm_ext))
+# pragma message("GLM: GLM_GTX_closest_point extension included")
+#endif
+
+namespace glm{
+namespace gtx{
+namespace closest_point ///< GLM_GTX_closest_point extension: Find the point on a straight line which is the closet of a point.
+{
+ /// \addtogroup gtx_closest_point
+ /// @{
+
+ /// Find the point on a straight line which is the closet of a point.
+ /// From GLM_GTX_closest_point extension.
+ template <typename T>
+ detail::tvec3<T> closestPointOnLine(
+ detail::tvec3<T> const & point,
+ detail::tvec3<T> const & a,
+ detail::tvec3<T> const & b);
+
+ /// @}
+}// namespace closest_point
+}// namespace gtx
+}// namespace glm
+
+#include "closest_point.inl"
+
+namespace glm{using namespace gtx::closest_point;}
+
+#endif//glm_gtx_closest_point
diff --git a/src/glm/gtx/closest_point.inl b/src/glm/gtx/closest_point.inl
new file mode 100644
index 0000000..efd110c
--- /dev/null
+++ b/src/glm/gtx/closest_point.inl
@@ -0,0 +1,41 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2005-12-30
+// Updated : 2008-10-05
+// Licence : This source is under MIT License
+// File : glm/gtx/closest_point.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_gtx_closest_point
+#define glm_gtx_closest_point
+
+namespace glm{
+namespace gtx{
+namespace closest_point{
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec3<valType> closestPointOnLine
+(
+ detail::tvec3<valType> const & point,
+ detail::tvec3<valType> const & a,
+ detail::tvec3<valType> const & b
+)
+{
+ valType LineLength = distance(a, b);
+ detail::tvec3<valType> Vector = point - a;
+ detail::tvec3<valType> LineDirection = (b - a) / LineLength;
+
+ // Project Vector to LineDirection to get the distance of point from a
+ valType Distance = dot(Vector, LineDirection);
+
+ if(Distance <= valType(0)) return a;
+ if(Distance >= LineLength) return b;
+ return a + LineDirection * Distance;
+}
+
+}//namespace closest_point
+}//namespace gtx
+}//namespace glm
+
+#endif//glm_gtx_closest_point
diff --git a/src/glm/gtx/color_cast.hpp b/src/glm/gtx/color_cast.hpp
new file mode 100644
index 0000000..165181f
--- /dev/null
+++ b/src/glm/gtx/color_cast.hpp
@@ -0,0 +1,107 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2007-06-21
+// Updated : 2009-06-05
+// Licence : This source is under MIT License
+// File : glm/gtx/color_cast.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+// - GLM_GTX_number_precision
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_gtx_color_cast
+#define glm_gtx_color_cast
+
+// Dependency:
+#include "../glm.hpp"
+#include "../gtx/number_precision.hpp"
+
+#if(defined(GLM_MESSAGES) && !defined(glm_ext))
+# pragma message("GLM: GLM_GTX_color_cast extension included")
+#endif
+
+namespace glm{
+namespace gtx{
+namespace color_cast ///< GLM_GTX_color_cast extension: Conversion between two color types
+{
+ using namespace gtx::number_precision;
+
+ /// \addtogroup gtx_color_cast
+ ///@{
+
+ //! Conversion of a floating value into a 8bit unsigned int value.
+ //! From GLM_GTX_color_cast extension.
+ template <typename valType> gtc::type_precision::uint8 u8channel_cast(valType a);
+
+ //! Conversion of a floating value into a 16bit unsigned int value.
+ //! From GLM_GTX_color_cast extension.
+ template <typename valType> gtc::type_precision::uint16 u16channel_cast(valType a);
+
+ template <typename T> gtc::type_precision::uint32 u32_rgbx_cast(const detail::tvec3<T>& c); //!< \brief Conversion of a 3 components color into an 32bit unsigned int value. (From GLM_GTX_color_cast extension)
+ template <typename T> gtc::type_precision::uint32 u32_xrgb_cast(const detail::tvec3<T>& c); //!< \brief Conversion of a 3 components color into an 32bit unsigned int value. (From GLM_GTX_color_cast extension)
+ template <typename T> gtc::type_precision::uint32 u32_bgrx_cast(const detail::tvec3<T>& c); //!< \brief Conversion of a 3 components color into an 32bit unsigned int value. (From GLM_GTX_color_cast extension)
+ template <typename T> gtc::type_precision::uint32 u32_xbgr_cast(const detail::tvec3<T>& c); //!< \brief Conversion of a 3 components color into an 32bit unsigned int value. (From GLM_GTX_color_cast extension)
+
+ template <typename T> gtc::type_precision::uint32 u32_rgba_cast(const detail::tvec4<T>& c); //!< \brief Conversion of a 4 components color into an 32bit unsigned int value. (From GLM_GTX_color_cast extension)
+ template <typename T> gtc::type_precision::uint32 u32_argb_cast(const detail::tvec4<T>& c); //!< \brief Conversion of a 4 components color into an 32bit unsigned int value. (From GLM_GTX_color_cast extension)
+ template <typename T> gtc::type_precision::uint32 u32_bgra_cast(const detail::tvec4<T>& c); //!< \brief Conversion of a 4 components color into an 32bit unsigned int value. (From GLM_GTX_color_cast extension)
+ template <typename T> gtc::type_precision::uint32 u32_abgr_cast(const detail::tvec4<T>& c); //!< \brief Conversion of a 4 components color into an 32bit unsigned int value. (From GLM_GTX_color_cast extension)
+
+ template <typename T> gtc::type_precision::uint64 u64_rgbx_cast(const detail::tvec3<T>& c); //!< \brief Conversion of a 3 components color into an 64bit unsigned int value. (From GLM_GTX_color_cast extension)
+ template <typename T> gtc::type_precision::uint64 u64_xrgb_cast(const detail::tvec3<T>& c); //!< \brief Conversion of a 3 components color into an 64bit unsigned int value. (From GLM_GTX_color_cast extension)
+ template <typename T> gtc::type_precision::uint64 u64_bgrx_cast(const detail::tvec3<T>& c); //!< \brief Conversion of a 3 components color into an 64bit unsigned int value. (From GLM_GTX_color_cast extension)
+ template <typename T> gtc::type_precision::uint64 u64_xbgr_cast(const detail::tvec3<T>& c); //!< \brief Conversion of a 3 components color into an 64bit unsigned int value. (From GLM_GTX_color_cast extension)
+
+ template <typename T> gtc::type_precision::uint64 u64_rgba_cast(const detail::tvec4<T>& c); //!< \brief Conversion of a 4 components color into an 64bit unsigned int value. (From GLM_GTX_color_cast extension)
+ template <typename T> gtc::type_precision::uint64 u64_argb_cast(const detail::tvec4<T>& c); //!< \brief Conversion of a 4 components color into an 64bit unsigned int value. (From GLM_GTX_color_cast extension)
+ template <typename T> gtc::type_precision::uint64 u64_bgra_cast(const detail::tvec4<T>& c); //!< \brief Conversion of a 4 components color into an 64bit unsigned int value. (From GLM_GTX_color_cast extension)
+ template <typename T> gtc::type_precision::uint64 u64_abgr_cast(const detail::tvec4<T>& c); //!< \brief Conversion of a 4 components color into an 64bit unsigned int value. (From GLM_GTX_color_cast extension)
+
+ template <typename T> gtx::number_precision::f16vec1 f16_channel_cast(T a); //!< \brief Conversion of a u8 or u16 value to a single channel floating value. (From GLM_GTX_color_cast extension)
+
+ template <typename T> gtc::type_precision::f16vec3 f16_rgbx_cast(T c); //!< \brief Conversion of a u32 or u64 color into 3 components floating color. (From GLM_GTX_color_cast extension)
+ template <typename T> gtc::type_precision::f16vec3 f16_xrgb_cast(T c); //!< \brief Conversion of a u32 or u64 color into 3 components floating color. (From GLM_GTX_color_cast extension)
+ template <typename T> gtc::type_precision::f16vec3 f16_bgrx_cast(T c); //!< \brief Conversion of a u32 or u64 color into 3 components floating color. (From GLM_GTX_color_cast extension)
+ template <typename T> gtc::type_precision::f16vec3 f16_xbgr_cast(T c); //!< \brief Conversion of a u32 or u64 color into 3 components floating color. (From GLM_GTX_color_cast extension)
+
+ template <typename T> gtc::type_precision::f16vec4 f16_rgba_cast(T c); //!< \brief Conversion of a u32 or u64 color into 4 components floating color. (From GLM_GTX_color_cast extension)
+ template <typename T> gtc::type_precision::f16vec4 f16_argb_cast(T c); //!< \brief Conversion of a u32 or u64 color into 4 components floating color. (From GLM_GTX_color_cast extension)
+ template <typename T> gtc::type_precision::f16vec4 f16_bgra_cast(T c); //!< \brief Conversion of a u32 or u64 color into 4 components floating color. (From GLM_GTX_color_cast extension)
+ template <typename T> gtc::type_precision::f16vec4 f16_abgr_cast(T c); //!< \brief Conversion of a u32 or u64 color into 4 components floating color. (From GLM_GTX_color_cast extension)
+
+ template <typename T> gtx::number_precision::f32vec1 f32_channel_cast(T a); //!< \brief Conversion of a u8 or u16 value to a single channel floating value. (From GLM_GTX_color_cast extension)
+
+ template <typename T> gtc::type_precision::f32vec3 f32_rgbx_cast(T c); //!< \brief Conversion of a u32 or u64 color into 3 components floating color. (From GLM_GTX_color_cast extension)
+ template <typename T> gtc::type_precision::f32vec3 f32_xrgb_cast(T c); //!< \brief Conversion of a u32 or u64 color into 3 components floating color. (From GLM_GTX_color_cast extension)
+ template <typename T> gtc::type_precision::f32vec3 f32_bgrx_cast(T c); //!< \brief Conversion of a u32 or u64 color into 3 components floating color. (From GLM_GTX_color_cast extension)
+ template <typename T> gtc::type_precision::f32vec3 f32_xbgr_cast(T c); //!< \brief Conversion of a u32 or u64 color into 3 components floating color. (From GLM_GTX_color_cast extension)
+
+ template <typename T> gtc::type_precision::f32vec4 f32_rgba_cast(T c); //!< \brief Conversion of a u32 or u64 color into 4 components floating color. (From GLM_GTX_color_cast extension)
+ template <typename T> gtc::type_precision::f32vec4 f32_argb_cast(T c); //!< \brief Conversion of a u32 or u64 color into 4 components floating color. (From GLM_GTX_color_cast extension)
+ template <typename T> gtc::type_precision::f32vec4 f32_bgra_cast(T c); //!< \brief Conversion of a u32 or u64 color into 4 components floating color. (From GLM_GTX_color_cast extension)
+ template <typename T> gtc::type_precision::f32vec4 f32_abgr_cast(T c); //!< \brief Conversion of a u32 or u64 color into 4 components floating color. (From GLM_GTX_color_cast extension)
+
+ template <typename T> gtx::number_precision::f64vec1 f64_channel_cast(T a); //!< \brief Conversion of a u8 or u16 value to a single channel floating value. (From GLM_GTX_color_cast extension)
+
+ template <typename T> gtc::type_precision::f64vec3 f64_rgbx_cast(T c); //!< \brief Conversion of a u32 or u64 color into 3 components floating color. (From GLM_GTX_color_cast extension)
+ template <typename T> gtc::type_precision::f64vec3 f64_xrgb_cast(T c); //!< \brief Conversion of a u32 or u64 color into 3 components floating color. (From GLM_GTX_color_cast extension)
+ template <typename T> gtc::type_precision::f64vec3 f64_bgrx_cast(T c); //!< \brief Conversion of a u32 or u64 color into 3 components floating color. (From GLM_GTX_color_cast extension)
+ template <typename T> gtc::type_precision::f64vec3 f64_xbgr_cast(T c); //!< \brief Conversion of a u32 or u64 color into 3 components floating color. (From GLM_GTX_color_cast extension)
+
+ template <typename T> gtc::type_precision::f64vec4 f64_rgba_cast(T c); //!< \brief Conversion of a u32 or u64 color into 4 components floating color. (From GLM_GTX_color_cast extension)
+ template <typename T> gtc::type_precision::f64vec4 f64_argb_cast(T c); //!< \brief Conversion of a u32 or u64 color into 4 components floating color. (From GLM_GTX_color_cast extension)
+ template <typename T> gtc::type_precision::f64vec4 f64_bgra_cast(T c); //!< \brief Conversion of a u32 or u64 color into 4 components floating color. (From GLM_GTX_color_cast extension)
+ template <typename T> gtc::type_precision::f64vec4 f64_abgr_cast(T c); //!< \brief Conversion of a u32 or u64 color into 4 components floating color. (From GLM_GTX_color_cast extension)
+
+ ///@}
+}//namespace color_space
+}//namespace gtx
+}//namespace glm
+
+#include "color_cast.inl"
+
+namespace glm{using namespace gtx::color_cast;}
+
+#endif//glm_gtx_color_cast
diff --git a/src/glm/gtx/color_cast.inl b/src/glm/gtx/color_cast.inl
new file mode 100644
index 0000000..e1dc171
--- /dev/null
+++ b/src/glm/gtx/color_cast.inl
@@ -0,0 +1,739 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2007-06-21
+// Updated : 2007-08-03
+// Licence : This source is under MIT License
+// File : glm/gtx/color_cast.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm{
+namespace gtx{
+//! GLM_GTX_color_cast extension: Conversion between two color types
+namespace color_cast{
+
+template <typename T>
+GLM_FUNC_QUALIFIER gtc::type_precision::uint8 u8channel_cast(T a)
+{
+ return static_cast<gtc::type_precision::uint8>(a * T(255));
+}
+
+template <typename T>
+GLM_FUNC_QUALIFIER gtc::type_precision::uint16 u16channel_cast(T a)
+{
+ return static_cast<gtc::type_precision::uint16>(a * T(65535));
+}
+
+template <typename T>
+GLM_FUNC_QUALIFIER gtc::type_precision::uint32 u32_rgbx_cast(const detail::tvec3<T>& c)
+{
+ gtc::type_precision::uint32 result = 0;
+ result += static_cast<gtc::type_precision::uint32>(c.x * detail::tvec3<T>::value_type(255)) << 0;
+ result += static_cast<gtc::type_precision::uint32>(c.y * detail::tvec3<T>::value_type(255)) << 8;
+ result += static_cast<gtc::type_precision::uint32>(c.z * detail::tvec3<T>::value_type(255)) << 16;
+ return result;
+}
+
+template <typename T>
+GLM_FUNC_QUALIFIER gtc::type_precision::uint32 u32_xrgb_cast(const detail::tvec3<T>& c)
+{
+ gtc::type_precision::uint32 result = 0;
+ result += static_cast<gtc::type_precision::uint32>(c.x * detail::tvec3<T>::value_type(255)) << 8;
+ result += static_cast<gtc::type_precision::uint32>(c.y * detail::tvec3<T>::value_type(255)) << 16;
+ result += static_cast<gtc::type_precision::uint32>(c.z * detail::tvec3<T>::value_type(255)) << 24;
+ return result;
+}
+
+template <typename T>
+GLM_FUNC_QUALIFIER gtc::type_precision::uint32 u32_bgrx_cast(const detail::tvec3<T>& c)
+{
+ gtc::type_precision::uint32 result = 0;
+ result += static_cast<gtc::type_precision::uint32>(c.x * detail::tvec3<T>::value_type(255)) << 16;
+ result += static_cast<gtc::type_precision::uint32>(c.y * detail::tvec3<T>::value_type(255)) << 8;
+ result += static_cast<gtc::type_precision::uint32>(c.z * detail::tvec3<T>::value_type(255)) << 0;
+ return result;
+}
+
+template <typename T>
+GLM_FUNC_QUALIFIER gtc::type_precision::uint32 u32_xbgr_cast(const detail::tvec3<T>& c)
+{
+ gtc::type_precision::uint32 result = 0;
+ result += static_cast<gtc::type_precision::uint32>(c.x * detail::tvec3<T>::value_type(255)) << 24;
+ result += static_cast<gtc::type_precision::uint32>(c.y * detail::tvec3<T>::value_type(255)) << 16;
+ result += static_cast<gtc::type_precision::uint32>(c.z * detail::tvec3<T>::value_type(255)) << 8;
+ result += static_cast<gtc::type_precision::uint32>(c.w * detail::tvec3<T>::value_type(255)) << 0;
+ return result;
+}
+
+template <typename T>
+GLM_FUNC_QUALIFIER gtc::type_precision::uint32 u32_rgba_cast(const detail::tvec4<T>& c)
+{
+ gtc::type_precision::uint32 result = 0;
+ result += static_cast<gtc::type_precision::uint32>(c.x * detail::tvec4<T>::value_type(255)) << 0;
+ result += static_cast<gtc::type_precision::uint32>(c.y * detail::tvec4<T>::value_type(255)) << 8;
+ result += static_cast<gtc::type_precision::uint32>(c.z * detail::tvec4<T>::value_type(255)) << 16;
+ result += static_cast<gtc::type_precision::uint32>(c.w * detail::tvec4<T>::value_type(255)) << 24;
+ return result;
+}
+
+template <typename T>
+GLM_FUNC_QUALIFIER gtc::type_precision::uint32 u32_argb_cast(const detail::tvec4<T>& c)
+{
+ gtc::type_precision::uint32 result = 0;
+ result += static_cast<gtc::type_precision::uint32>(c.x * detail::tvec4<T>::value_type(255)) << 8;
+ result += static_cast<gtc::type_precision::uint32>(c.y * detail::tvec4<T>::value_type(255)) << 16;
+ result += static_cast<gtc::type_precision::uint32>(c.z * detail::tvec4<T>::value_type(255)) << 24;
+ result += static_cast<gtc::type_precision::uint32>(c.w * detail::tvec4<T>::value_type(255)) << 0;
+ return result;
+}
+
+template <typename T>
+GLM_FUNC_QUALIFIER gtc::type_precision::uint32 u32_bgra_cast(const detail::tvec4<T>& c)
+{
+ gtc::type_precision::uint32 result = 0;
+ result += static_cast<gtc::type_precision::uint32>(c.x * detail::tvec4<T>::value_type(255)) << 16;
+ result += static_cast<gtc::type_precision::uint32>(c.y * detail::tvec4<T>::value_type(255)) << 8;
+ result += static_cast<gtc::type_precision::uint32>(c.z * detail::tvec4<T>::value_type(255)) << 0;
+ result += static_cast<gtc::type_precision::uint32>(c.w * detail::tvec4<T>::value_type(255)) << 24;
+ return result;
+}
+
+template <typename T>
+GLM_FUNC_QUALIFIER gtc::type_precision::uint32 u32_abgr_cast(const detail::tvec4<T>& c)
+{
+ gtc::type_precision::uint32 result = 0;
+ result += static_cast<gtc::type_precision::uint32>(c.x * detail::tvec4<T>::value_type(255)) << 24;
+ result += static_cast<gtc::type_precision::uint32>(c.y * detail::tvec4<T>::value_type(255)) << 16;
+ result += static_cast<gtc::type_precision::uint32>(c.z * detail::tvec4<T>::value_type(255)) << 8;
+ result += static_cast<gtc::type_precision::uint32>(c.w * detail::tvec4<T>::value_type(255)) << 0;
+ return result;
+}
+
+template <typename T>
+GLM_FUNC_QUALIFIER gtc::type_precision::uint64 u64_rgbx_cast(const detail::tvec3<T>& c)
+{
+ gtc::type_precision::uint64 result = 0;
+ result += static_cast<gtc::type_precision::uint64>(c.x * detail::tvec3<T>::value_type(65535)) << 0;
+ result += static_cast<gtc::type_precision::uint64>(c.y * detail::tvec3<T>::value_type(65535)) << 16;
+ result += static_cast<gtc::type_precision::uint64>(c.z * detail::tvec3<T>::value_type(65535)) << 32;
+ return result;
+}
+
+template <typename T>
+GLM_FUNC_QUALIFIER gtc::type_precision::uint64 u32_xrgb_cast(const detail::tvec3<T>& c)
+{
+ gtc::type_precision::uint64 result = 0;
+ result += static_cast<gtc::type_precision::uint64>(c.x * detail::tvec3<T>::value_type(65535)) << 16;
+ result += static_cast<gtc::type_precision::uint64>(c.y * detail::tvec3<T>::value_type(65535)) << 32;
+ result += static_cast<gtc::type_precision::uint64>(c.z * detail::tvec3<T>::value_type(65535)) << 48;
+ return result;
+}
+
+template <typename T>
+GLM_FUNC_QUALIFIER gtc::type_precision::uint64 u32_bgrx_cast(const detail::tvec3<T>& c)
+{
+ gtc::type_precision::uint64 result = 0;
+ result += static_cast<gtc::type_precision::uint64>(c.x * detail::tvec3<T>::value_type(65535)) << 32;
+ result += static_cast<gtc::type_precision::uint64>(c.y * detail::tvec3<T>::value_type(65535)) << 16;
+ result += static_cast<gtc::type_precision::uint64>(c.z * detail::tvec3<T>::value_type(65535)) << 0;
+ return result;
+}
+
+template <typename T>
+GLM_FUNC_QUALIFIER gtc::type_precision::uint64 u32_xbgr_cast(const detail::tvec3<T>& c)
+{
+ gtc::type_precision::uint64 result = 0;
+ result += static_cast<gtc::type_precision::uint64>(c.x * detail::tvec3<T>::value_type(65535)) << 48;
+ result += static_cast<gtc::type_precision::uint64>(c.y * detail::tvec3<T>::value_type(65535)) << 32;
+ result += static_cast<gtc::type_precision::uint64>(c.z * detail::tvec3<T>::value_type(65535)) << 16;
+ result += static_cast<gtc::type_precision::uint64>(c.w * detail::tvec3<T>::value_type(65535)) << 0;
+ return result;
+}
+
+template <typename T>
+GLM_FUNC_QUALIFIER gtc::type_precision::uint64 u64_rgba_cast(const detail::tvec4<T>& c)
+{
+ gtc::type_precision::uint64 result = 0;
+ result += static_cast<gtc::type_precision::uint64>(c.x * detail::tvec4<T>::value_type(65535)) << 0;
+ result += static_cast<gtc::type_precision::uint64>(c.y * detail::tvec4<T>::value_type(65535)) << 16;
+ result += static_cast<gtc::type_precision::uint64>(c.z * detail::tvec4<T>::value_type(65535)) << 32;
+ result += static_cast<gtc::type_precision::uint64>(c.w * detail::tvec4<T>::value_type(65535)) << 48;
+ return result;
+}
+
+template <typename T>
+GLM_FUNC_QUALIFIER gtc::type_precision::uint64 u64_argb_cast(const detail::tvec4<T>& c)
+{
+ gtc::type_precision::uint64 result = 0;
+ result += static_cast<gtc::type_precision::uint64>(c.x * detail::tvec4<T>::value_type(65535)) << 16;
+ result += static_cast<gtc::type_precision::uint64>(c.y * detail::tvec4<T>::value_type(65535)) << 32;
+ result += static_cast<gtc::type_precision::uint64>(c.z * detail::tvec4<T>::value_type(65535)) << 48;
+ result += static_cast<gtc::type_precision::uint64>(c.w * detail::tvec4<T>::value_type(65535)) << 0;
+ return result;
+}
+
+template <typename T>
+GLM_FUNC_QUALIFIER gtc::type_precision::uint64 u64_bgra_cast(const detail::tvec4<T>& c)
+{
+ gtc::type_precision::uint64 result = 0;
+ result += static_cast<gtc::type_precision::uint64>(c.x * detail::tvec4<T>::value_type(65535)) << 32;
+ result += static_cast<gtc::type_precision::uint64>(c.y * detail::tvec4<T>::value_type(65535)) << 16;
+ result += static_cast<gtc::type_precision::uint64>(c.z * detail::tvec4<T>::value_type(65535)) << 0;
+ result += static_cast<gtc::type_precision::uint64>(c.w * detail::tvec4<T>::value_type(65535)) << 48;
+ return result;
+}
+
+template <typename T>
+GLM_FUNC_QUALIFIER gtc::type_precision::uint64 u64_abgr_cast(const detail::tvec4<T>& c)
+{
+ gtc::type_precision::uint64 result = 0;
+ result += static_cast<gtc::type_precision::uint64>(c.x * detail::tvec4<T>::value_type(65535)) << 48;
+ result += static_cast<gtc::type_precision::uint64>(c.y * detail::tvec4<T>::value_type(65535)) << 32;
+ result += static_cast<gtc::type_precision::uint64>(c.z * detail::tvec4<T>::value_type(65535)) << 16;
+ result += static_cast<gtc::type_precision::uint64>(c.w * detail::tvec4<T>::value_type(65535)) << 0;
+ return result;
+}
+
+template <>
+GLM_FUNC_QUALIFIER f16vec1 f16_channel_cast<gtc::type_precision::uint32>(gtc::type_precision::uint32 color)
+{
+ return gtc::type_precision::f16(static_cast<float>(color >> 0) / static_cast<float>(255));
+}
+
+template <>
+GLM_FUNC_QUALIFIER gtc::type_precision::f16vec3 f16_rgbx_cast<gtc::type_precision::uint32>(gtc::type_precision::uint32 color)
+{
+ gtc::type_precision::f16vec3 result;
+ result.x = gtc::type_precision::f16(static_cast<float>(color >> 0) / static_cast<float>(255));
+ result.y = gtc::type_precision::f16(static_cast<float>(color >> 8) / static_cast<float>(255));
+ result.z = gtc::type_precision::f16(static_cast<float>(color >> 16) / static_cast<float>(255));
+ return result;
+}
+
+template <>
+GLM_FUNC_QUALIFIER gtc::type_precision::f16vec3 f16_xrgb_cast<gtc::type_precision::uint32>(gtc::type_precision::uint32 color)
+{
+ gtc::type_precision::f16vec3 result;
+ result.x = gtc::type_precision::f16(static_cast<float>(color >> 8) / static_cast<float>(255));
+ result.y = gtc::type_precision::f16(static_cast<float>(color >> 16) / static_cast<float>(255));
+ result.z = gtc::type_precision::f16(static_cast<float>(color >> 24) / static_cast<float>(255));
+ return result;
+}
+
+template <>
+GLM_FUNC_QUALIFIER f16vec3 f16_bgrx_cast<uint32>(uint32 color)
+{
+ f16vec3 result;
+ result.x = f16(static_cast<float>(color >> 16) / static_cast<float>(255));
+ result.y = f16(static_cast<float>(color >> 8) / static_cast<float>(255));
+ result.z = f16(static_cast<float>(color >> 0) / static_cast<float>(255));
+ return result;
+}
+
+template <>
+GLM_FUNC_QUALIFIER f16vec3 f16_xbgr_cast<uint32>(uint32 color)
+{
+ f16vec3 result;
+ result.x = f16(static_cast<float>(color >> 24) / static_cast<float>(255));
+ result.y = f16(static_cast<float>(color >> 16) / static_cast<float>(255));
+ result.z = f16(static_cast<float>(color >> 8) / static_cast<float>(255));
+ return result;
+}
+
+template <>
+GLM_FUNC_QUALIFIER f16vec4 f16_rgba_cast<uint32>(uint32 color)
+{
+ f16vec4 result;
+ result.x = f16(static_cast<float>(color >> 0) / static_cast<float>(255));
+ result.y = f16(static_cast<float>(color >> 8) / static_cast<float>(255));
+ result.z = f16(static_cast<float>(color >> 16) / static_cast<float>(255));
+ result.w = f16(static_cast<float>(color >> 24) / static_cast<float>(255));
+ return result;
+}
+
+template <>
+GLM_FUNC_QUALIFIER f16vec4 f16_argb_cast<uint32>(uint32 color)
+{
+ f16vec4 result;
+ result.x = f16(static_cast<float>(color >> 8) / static_cast<float>(255));
+ result.y = f16(static_cast<float>(color >> 16) / static_cast<float>(255));
+ result.z = f16(static_cast<float>(color >> 24) / static_cast<float>(255));
+ result.w = f16(static_cast<float>(color >> 0) / static_cast<float>(255));
+ return result;
+}
+
+template <>
+GLM_FUNC_QUALIFIER f16vec4 f16_bgra_cast<uint32>(uint32 color)
+{
+ f16vec4 result;
+ result.x = f16(static_cast<float>(color >> 16) / static_cast<float>(255));
+ result.y = f16(static_cast<float>(color >> 8) / static_cast<float>(255));
+ result.z = f16(static_cast<float>(color >> 0) / static_cast<float>(255));
+ result.w = f16(static_cast<float>(color >> 24) / static_cast<float>(255));
+ return result;
+}
+
+template <>
+GLM_FUNC_QUALIFIER f16vec4 f16_abgr_cast<uint32>(uint32 color)
+{
+ f16vec4 result;
+ result.x = f16(static_cast<float>(color >> 24) / static_cast<float>(255));
+ result.y = f16(static_cast<float>(color >> 16) / static_cast<float>(255));
+ result.z = f16(static_cast<float>(color >> 8) / static_cast<float>(255));
+ result.w = f16(static_cast<float>(color >> 0) / static_cast<float>(255));
+ return result;
+}
+
+template <>
+GLM_FUNC_QUALIFIER float f32_channel_cast<uint8>(uint8 color)
+{
+ return static_cast<float>(color >> 0) / static_cast<float>(255);
+}
+
+template <>
+GLM_FUNC_QUALIFIER detail::tvec3<float> f32_rgbx_cast<uint32>(uint32 color)
+{
+ detail::tvec3<float> result;
+ result.x = static_cast<float>(color >> 0) / static_cast<float>(255);
+ result.y = static_cast<float>(color >> 8) / static_cast<float>(255);
+ result.z = static_cast<float>(color >> 16) / static_cast<float>(255);
+ return result;
+}
+
+template <>
+GLM_FUNC_QUALIFIER detail::tvec3<float> f32_xrgb_cast<uint32>(uint32 color)
+{
+ detail::tvec3<float> result;
+ result.x = static_cast<float>(color >> 8) / static_cast<float>(255);
+ result.y = static_cast<float>(color >> 16) / static_cast<float>(255);
+ result.z = static_cast<float>(color >> 24) / static_cast<float>(255);
+ return result;
+}
+
+template <>
+GLM_FUNC_QUALIFIER detail::tvec3<float> f32_bgrx_cast<uint32>(uint32 color)
+{
+ detail::tvec3<float> result;
+ result.x = static_cast<float>(color >> 16) / static_cast<float>(255);
+ result.y = static_cast<float>(color >> 8) / static_cast<float>(255);
+ result.z = static_cast<float>(color >> 0) / static_cast<float>(255);
+ return result;
+}
+
+template <>
+GLM_FUNC_QUALIFIER detail::tvec3<float> f32_xbgr_cast<uint32>(uint32 color)
+{
+ detail::tvec3<float> result;
+ result.x = static_cast<float>(color >> 24) / static_cast<float>(255);
+ result.y = static_cast<float>(color >> 16) / static_cast<float>(255);
+ result.z = static_cast<float>(color >> 8) / static_cast<float>(255);
+ return result;
+}
+
+template <>
+GLM_FUNC_QUALIFIER detail::tvec4<float> f32_rgba_cast<uint32>(uint32 color)
+{
+ detail::tvec4<float> result;
+ result.x = static_cast<float>(color >> 0) / static_cast<float>(255);
+ result.y = static_cast<float>(color >> 8) / static_cast<float>(255);
+ result.z = static_cast<float>(color >> 16) / static_cast<float>(255);
+ result.w = static_cast<float>(color >> 24) / static_cast<float>(255);
+ return result;
+}
+
+template <>
+GLM_FUNC_QUALIFIER detail::tvec4<float> f32_argb_cast<uint32>(uint32 color)
+{
+ detail::tvec4<float> result;
+ result.x = static_cast<float>(color >> 8) / static_cast<float>(255);
+ result.y = static_cast<float>(color >> 16) / static_cast<float>(255);
+ result.z = static_cast<float>(color >> 24) / static_cast<float>(255);
+ result.w = static_cast<float>(color >> 0) / static_cast<float>(255);
+ return result;
+}
+
+template <>
+GLM_FUNC_QUALIFIER detail::tvec4<float> f32_bgra_cast<uint32>(uint32 color)
+{
+ detail::tvec4<float> result;
+ result.x = static_cast<float>(color >> 16) / static_cast<float>(255);
+ result.y = static_cast<float>(color >> 8) / static_cast<float>(255);
+ result.z = static_cast<float>(color >> 0) / static_cast<float>(255);
+ result.w = static_cast<float>(color >> 24) / static_cast<float>(255);
+ return result;
+}
+
+template <>
+GLM_FUNC_QUALIFIER detail::tvec4<float> f32_abgr_cast<uint32>(uint32 color)
+{
+ detail::tvec4<float> result;
+ result.x = static_cast<float>(color >> 24) / static_cast<float>(255);
+ result.y = static_cast<float>(color >> 16) / static_cast<float>(255);
+ result.z = static_cast<float>(color >> 8) / static_cast<float>(255);
+ result.w = static_cast<float>(color >> 0) / static_cast<float>(255);
+ return result;
+}
+
+template <>
+GLM_FUNC_QUALIFIER double f64_channel_cast<uint8>(uint8 color)
+{
+ return static_cast<double>(color >> 0) / static_cast<double>(255);
+}
+
+template <>
+GLM_FUNC_QUALIFIER detail::tvec3<double> f64_rgbx_cast<uint32>(uint32 color)
+{
+ detail::tvec3<double> result;
+ result.x = static_cast<double>(color >> 0) / static_cast<double>(255);
+ result.y = static_cast<double>(color >> 8) / static_cast<double>(255);
+ result.z = static_cast<double>(color >> 16) / static_cast<double>(255);
+ return result;
+}
+
+template <>
+GLM_FUNC_QUALIFIER detail::tvec3<double> f64_xrgb_cast<uint32>(uint32 color)
+{
+ detail::tvec3<double> result;
+ result.x = static_cast<double>(color >> 8) / static_cast<double>(255);
+ result.y = static_cast<double>(color >> 16) / static_cast<double>(255);
+ result.z = static_cast<double>(color >> 24) / static_cast<double>(255);
+ return result;
+}
+
+template <>
+GLM_FUNC_QUALIFIER detail::tvec3<double> f64_bgrx_cast<uint32>(uint32 color)
+{
+ detail::tvec3<double> result;
+ result.x = static_cast<double>(color >> 16) / static_cast<double>(255);
+ result.y = static_cast<double>(color >> 8) / static_cast<double>(255);
+ result.z = static_cast<double>(color >> 0) / static_cast<double>(255);
+ return result;
+}
+
+template <>
+GLM_FUNC_QUALIFIER detail::tvec3<double> f64_xbgr_cast<uint32>(uint32 color)
+{
+ detail::tvec3<double> result;
+ result.x = static_cast<double>(color >> 24) / static_cast<double>(255);
+ result.y = static_cast<double>(color >> 16) / static_cast<double>(255);
+ result.z = static_cast<double>(color >> 8) / static_cast<double>(255);
+ return result;
+}
+
+template <>
+GLM_FUNC_QUALIFIER detail::tvec4<double> f64_rgba_cast<uint32>(uint32 color)
+{
+ detail::tvec4<double> result;
+ result.x = static_cast<double>(color >> 0) / static_cast<double>(255);
+ result.y = static_cast<double>(color >> 8) / static_cast<double>(255);
+ result.z = static_cast<double>(color >> 16) / static_cast<double>(255);
+ result.w = static_cast<double>(color >> 24) / static_cast<double>(255);
+ return result;
+}
+
+template <>
+GLM_FUNC_QUALIFIER detail::tvec4<double> f64_argb_cast<uint32>(uint32 color)
+{
+ detail::tvec4<double> result;
+ result.x = static_cast<double>(color >> 8) / static_cast<double>(255);
+ result.y = static_cast<double>(color >> 16) / static_cast<double>(255);
+ result.z = static_cast<double>(color >> 24) / static_cast<double>(255);
+ result.w = static_cast<double>(color >> 0) / static_cast<double>(255);
+ return result;
+}
+
+template <>
+GLM_FUNC_QUALIFIER detail::tvec4<double> f64_bgra_cast<uint32>(uint32 color)
+{
+ detail::tvec4<double> result;
+ result.x = static_cast<double>(color >> 16) / static_cast<double>(255);
+ result.y = static_cast<double>(color >> 8) / static_cast<double>(255);
+ result.z = static_cast<double>(color >> 0) / static_cast<double>(255);
+ result.w = static_cast<double>(color >> 24) / static_cast<double>(255);
+ return result;
+}
+
+template <>
+GLM_FUNC_QUALIFIER detail::tvec4<double> f64_abgr_cast<uint32>(uint32 color)
+{
+ detail::tvec4<double> result;
+ result.x = static_cast<double>(color >> 24) / static_cast<double>(255);
+ result.y = static_cast<double>(color >> 16) / static_cast<double>(255);
+ result.z = static_cast<double>(color >> 8) / static_cast<double>(255);
+ result.w = static_cast<double>(color >> 0) / static_cast<double>(255);
+ return result;
+}
+
+template <>
+GLM_FUNC_QUALIFIER detail::thalf f16_channel_cast<uint16>(uint16 color)
+{
+ return detail::thalf(static_cast<float>(color >> 0) / static_cast<float>(65535));
+}
+
+template <>
+GLM_FUNC_QUALIFIER detail::tvec3<detail::thalf> f16_rgbx_cast<uint64>(uint64 color)
+{
+ detail::tvec3<detail::thalf> result;
+ result.x = detail::thalf(static_cast<float>(color >> 0) / static_cast<float>(65535));
+ result.y = detail::thalf(static_cast<float>(color >> 16) / static_cast<float>(65535));
+ result.z = detail::thalf(static_cast<float>(color >> 32) / static_cast<float>(65535));
+ return result;
+}
+
+template <>
+GLM_FUNC_QUALIFIER detail::tvec3<detail::thalf> f16_xrgb_cast<uint64>(uint64 color)
+{
+ detail::tvec3<detail::thalf> result;
+ result.x = detail::thalf(static_cast<float>(color >> 16) / static_cast<float>(65535));
+ result.y = detail::thalf(static_cast<float>(color >> 32) / static_cast<float>(65535));
+ result.z = detail::thalf(static_cast<float>(color >> 48) / static_cast<float>(65535));
+ return result;
+}
+
+template <>
+GLM_FUNC_QUALIFIER detail::tvec3<detail::thalf> f16_bgrx_cast<uint64>(uint64 color)
+{
+ detail::tvec3<detail::thalf> result;
+ result.x = detail::thalf(static_cast<float>(color >> 32) / static_cast<float>(65535));
+ result.y = detail::thalf(static_cast<float>(color >> 16) / static_cast<float>(65535));
+ result.z = detail::thalf(static_cast<float>(color >> 0) / static_cast<float>(65535));
+ return result;
+}
+
+template <>
+GLM_FUNC_QUALIFIER detail::tvec3<detail::thalf> f16_xbgr_cast<uint64>(uint64 color)
+{
+ detail::tvec3<detail::thalf> result;
+ result.x = detail::thalf(static_cast<float>(color >> 48) / static_cast<float>(65535));
+ result.y = detail::thalf(static_cast<float>(color >> 32) / static_cast<float>(65535));
+ result.z = detail::thalf(static_cast<float>(color >> 16) / static_cast<float>(65535));
+ return result;
+}
+
+template <>
+GLM_FUNC_QUALIFIER detail::tvec4<detail::thalf> f16_rgba_cast<uint64>(uint64 color)
+{
+ detail::tvec4<detail::thalf> result;
+ result.x = detail::thalf(static_cast<float>(color >> 0) / static_cast<float>(65535));
+ result.y = detail::thalf(static_cast<float>(color >> 16) / static_cast<float>(65535));
+ result.z = detail::thalf(static_cast<float>(color >> 32) / static_cast<float>(65535));
+ result.w = detail::thalf(static_cast<float>(color >> 48) / static_cast<float>(65535));
+ return result;
+}
+
+template <>
+GLM_FUNC_QUALIFIER detail::tvec4<detail::thalf> f16_argb_cast<uint64>(uint64 color)
+{
+ detail::tvec4<detail::thalf> result;
+ result.x = detail::thalf(static_cast<float>(color >> 16) / static_cast<float>(65535));
+ result.y = detail::thalf(static_cast<float>(color >> 32) / static_cast<float>(65535));
+ result.z = detail::thalf(static_cast<float>(color >> 48) / static_cast<float>(65535));
+ result.w = detail::thalf(static_cast<float>(color >> 0) / static_cast<float>(65535));
+ return result;
+}
+
+template <>
+GLM_FUNC_QUALIFIER detail::tvec4<detail::thalf> f16_bgra_cast<uint64>(uint64 color)
+{
+ detail::tvec4<detail::thalf> result;
+ result.x = detail::thalf(static_cast<float>(color >> 32) / static_cast<float>(65535));
+ result.y = detail::thalf(static_cast<float>(color >> 16) / static_cast<float>(65535));
+ result.z = detail::thalf(static_cast<float>(color >> 0) / static_cast<float>(65535));
+ result.w = detail::thalf(static_cast<float>(color >> 48) / static_cast<float>(65535));
+ return result;
+}
+
+template <>
+GLM_FUNC_QUALIFIER detail::tvec4<detail::thalf> f16_abgr_cast<uint64>(uint64 color)
+{
+ detail::tvec4<detail::thalf> result;
+ result.x = detail::thalf(static_cast<float>(color >> 48) / static_cast<float>(65535));
+ result.y = detail::thalf(static_cast<float>(color >> 32) / static_cast<float>(65535));
+ result.z = detail::thalf(static_cast<float>(color >> 16) / static_cast<float>(65535));
+ result.w = detail::thalf(static_cast<float>(color >> 0) / static_cast<float>(65535));
+ return result;
+}
+
+template <>
+GLM_FUNC_QUALIFIER float f32_channel_cast<uint16>(uint16 color)
+{
+ return static_cast<float>(color >> 0) / static_cast<float>(65535);
+}
+
+template <>
+GLM_FUNC_QUALIFIER detail::tvec3<float> f32_rgbx_cast<uint64>(uint64 color)
+{
+ detail::tvec3<float> result;
+ result.x = static_cast<float>(color >> 0) / static_cast<float>(65535);
+ result.y = static_cast<float>(color >> 16) / static_cast<float>(65535);
+ result.z = static_cast<float>(color >> 32) / static_cast<float>(65535);
+ return result;
+}
+
+template <>
+GLM_FUNC_QUALIFIER detail::tvec3<float> f32_xrgb_cast<uint64>(uint64 color)
+{
+ detail::tvec3<float> result;
+ result.x = static_cast<float>(color >> 16) / static_cast<float>(65535);
+ result.y = static_cast<float>(color >> 32) / static_cast<float>(65535);
+ result.z = static_cast<float>(color >> 48) / static_cast<float>(65535);
+ return result;
+}
+
+template <>
+GLM_FUNC_QUALIFIER detail::tvec3<float> f32_bgrx_cast<uint64>(uint64 color)
+{
+ detail::tvec3<float> result;
+ result.x = static_cast<float>(color >> 32) / static_cast<float>(65535);
+ result.y = static_cast<float>(color >> 16) / static_cast<float>(65535);
+ result.z = static_cast<float>(color >> 0) / static_cast<float>(65535);
+ return result;
+}
+
+template <>
+GLM_FUNC_QUALIFIER detail::tvec3<float> f32_xbgr_cast<uint64>(uint64 color)
+{
+ detail::tvec3<float> result;
+ result.x = static_cast<float>(color >> 48) / static_cast<float>(65535);
+ result.y = static_cast<float>(color >> 32) / static_cast<float>(65535);
+ result.z = static_cast<float>(color >> 16) / static_cast<float>(65535);
+ return result;
+}
+
+template <>
+GLM_FUNC_QUALIFIER detail::tvec4<float> f32_rgba_cast<uint64>(uint64 color)
+{
+ detail::tvec4<float> result;
+ result.x = static_cast<float>(color >> 0) / static_cast<float>(65535);
+ result.y = static_cast<float>(color >> 16) / static_cast<float>(65535);
+ result.z = static_cast<float>(color >> 32) / static_cast<float>(65535);
+ result.w = static_cast<float>(color >> 48) / static_cast<float>(65535);
+ return result;
+}
+
+template <>
+GLM_FUNC_QUALIFIER detail::tvec4<float> f32_argb_cast<uint64>(uint64 color)
+{
+ detail::tvec4<float> result;
+ result.x = static_cast<float>(color >> 16) / static_cast<float>(65535);
+ result.y = static_cast<float>(color >> 32) / static_cast<float>(65535);
+ result.z = static_cast<float>(color >> 48) / static_cast<float>(65535);
+ result.w = static_cast<float>(color >> 0) / static_cast<float>(65535);
+ return result;
+}
+
+template <>
+GLM_FUNC_QUALIFIER detail::tvec4<float> f32_bgra_cast<uint64>(uint64 color)
+{
+ detail::tvec4<float> result;
+ result.x = static_cast<float>(color >> 32) / static_cast<float>(65535);
+ result.y = static_cast<float>(color >> 16) / static_cast<float>(65535);
+ result.z = static_cast<float>(color >> 0) / static_cast<float>(65535);
+ result.w = static_cast<float>(color >> 48) / static_cast<float>(65535);
+ return result;
+}
+
+template <>
+GLM_FUNC_QUALIFIER detail::tvec4<float> f32_abgr_cast<uint64>(uint64 color)
+{
+ detail::tvec4<float> result;
+ result.x = static_cast<float>(color >> 48) / static_cast<float>(65535);
+ result.y = static_cast<float>(color >> 32) / static_cast<float>(65535);
+ result.z = static_cast<float>(color >> 16) / static_cast<float>(65535);
+ result.w = static_cast<float>(color >> 0) / static_cast<float>(65535);
+ return result;
+}
+
+template <>
+GLM_FUNC_QUALIFIER double f64_channel_cast<uint16>(uint16 color)
+{
+ return static_cast<double>(color >> 0) / static_cast<double>(65535);
+}
+
+template <>
+GLM_FUNC_QUALIFIER detail::tvec3<double> f64_rgbx_cast<uint64>(uint64 color)
+{
+ detail::tvec3<double> result;
+ result.x = static_cast<double>(color >> 0) / static_cast<double>(65535);
+ result.y = static_cast<double>(color >> 16) / static_cast<double>(65535);
+ result.z = static_cast<double>(color >> 32) / static_cast<double>(65535);
+ return result;
+}
+
+template <>
+GLM_FUNC_QUALIFIER detail::tvec3<double> f64_xrgb_cast<uint64>(uint64 color)
+{
+ detail::tvec3<double> result;
+ result.x = static_cast<double>(color >> 16) / static_cast<double>(65535);
+ result.y = static_cast<double>(color >> 32) / static_cast<double>(65535);
+ result.z = static_cast<double>(color >> 48) / static_cast<double>(65535);
+ return result;
+}
+
+template <>
+GLM_FUNC_QUALIFIER detail::tvec3<double> f64_bgrx_cast<uint64>(uint64 color)
+{
+ detail::tvec3<double> result;
+ result.x = static_cast<double>(color >> 32) / static_cast<double>(65535);
+ result.y = static_cast<double>(color >> 16) / static_cast<double>(65535);
+ result.z = static_cast<double>(color >> 0) / static_cast<double>(65535);
+ return result;
+}
+
+template <>
+GLM_FUNC_QUALIFIER detail::tvec3<double> f64_xbgr_cast<uint64>(uint64 color)
+{
+ detail::tvec3<double> result;
+ result.x = static_cast<double>(color >> 48) / static_cast<double>(65535);
+ result.y = static_cast<double>(color >> 32) / static_cast<double>(65535);
+ result.z = static_cast<double>(color >> 16) / static_cast<double>(65535);
+ return result;
+}
+
+template <>
+GLM_FUNC_QUALIFIER detail::tvec4<double> f64_rgba_cast<uint64>(uint64 color)
+{
+ detail::tvec4<double> result;
+ result.x = static_cast<double>(color >> 0) / static_cast<double>(65535);
+ result.y = static_cast<double>(color >> 16) / static_cast<double>(65535);
+ result.z = static_cast<double>(color >> 32) / static_cast<double>(65535);
+ result.w = static_cast<double>(color >> 48) / static_cast<double>(65535);
+ return result;
+}
+
+template <>
+GLM_FUNC_QUALIFIER detail::tvec4<double> f64_argb_cast<uint64>(uint64 color)
+{
+ detail::tvec4<double> result;
+ result.x = static_cast<double>(color >> 16) / static_cast<double>(65535);
+ result.y = static_cast<double>(color >> 32) / static_cast<double>(65535);
+ result.z = static_cast<double>(color >> 48) / static_cast<double>(65535);
+ result.w = static_cast<double>(color >> 0) / static_cast<double>(65535);
+ return result;
+}
+
+template <>
+GLM_FUNC_QUALIFIER detail::tvec4<double> f64_bgra_cast<uint64>(uint64 color)
+{
+ detail::tvec4<double> result;
+ result.x = static_cast<double>(color >> 32) / static_cast<double>(65535);
+ result.y = static_cast<double>(color >> 16) / static_cast<double>(65535);
+ result.z = static_cast<double>(color >> 0) / static_cast<double>(65535);
+ result.w = static_cast<double>(color >> 48) / static_cast<double>(65535);
+ return result;
+}
+
+template <>
+GLM_FUNC_QUALIFIER detail::tvec4<double> f64_abgr_cast<uint64>(uint64 color)
+{
+ detail::tvec4<double> result;
+ result.x = static_cast<double>(color >> 48) / static_cast<double>(65535);
+ result.y = static_cast<double>(color >> 32) / static_cast<double>(65535);
+ result.z = static_cast<double>(color >> 16) / static_cast<double>(65535);
+ result.w = static_cast<double>(color >> 0) / static_cast<double>(65535);
+ return result;
+}
+
+}//namespace color_space
+}//namespace gtx
+}//namespace glm
diff --git a/src/glm/gtx/color_space.hpp b/src/glm/gtx/color_space.hpp
new file mode 100644
index 0000000..03052f5
--- /dev/null
+++ b/src/glm/gtx/color_space.hpp
@@ -0,0 +1,77 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2005-12-21
+// Updated : 2007-02-22
+// Licence : This source is under MIT License
+// File : glm/gtx/color_space.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_gtx_color_space
+#define glm_gtx_color_space
+
+// Dependency:
+#include "../glm.hpp"
+
+#if(defined(GLM_MESSAGES) && !defined(glm_ext))
+# pragma message("GLM: GLM_GTX_color_space extension included")
+#endif
+
+namespace glm{
+namespace gtx{
+namespace color_space ///< GLM_GTX_color_space extension: Related to RGB to HSV conversions and operations
+{
+ /// \addtogroup gtx_color_space
+ /// @{
+
+ //! Converts a color from HSV color space to its color in RGB color space.
+ //! From GLM_GTX_color_space extension.
+ template <typename valType>
+ detail::tvec3<valType> rgbColor(
+ detail::tvec3<valType> const & hsvValue);
+
+ //! Converts a color from RGB color space to its color in HSV color space.
+ //! From GLM_GTX_color_space extension.
+ template <typename valType>
+ detail::tvec3<valType> hsvColor(
+ detail::tvec3<valType> const & rgbValue);
+
+ //! Build a saturation matrix.
+ //! From GLM_GTX_color_space extension
+ template <typename valType>
+ detail::tmat4x4<valType> saturation(
+ valType const s);
+
+ //! Modify the saturation of a color.
+ //! From GLM_GTX_color_space extension.
+ template <typename valType>
+ detail::tvec3<valType> saturation(
+ valType const s,
+ detail::tvec3<valType> const & color);
+
+ //! Modify the saturation of a color.
+ //! From GLM_GTX_color_space extension.
+ template <typename valType>
+ detail::tvec4<valType> saturation(
+ valType const s,
+ detail::tvec4<valType> const & color);
+
+ //! Compute color luminosity associating ratios (0.33, 0.59, 0.11) to RGB canals.
+ //! From GLM_GTX_color_space extension.
+ template <typename valType>
+ valType luminosity(
+ detail::tvec3<valType> const & color);
+
+ /// @}
+}//namespace color_space
+}//namespace gtx
+}//namespace glm
+
+#include "color_space.inl"
+
+namespace glm{using namespace gtx::color_space;}
+
+#endif//glm_gtx_color_space
diff --git a/src/glm/gtx/color_space.inl b/src/glm/gtx/color_space.inl
new file mode 100644
index 0000000..d885cd8
--- /dev/null
+++ b/src/glm/gtx/color_space.inl
@@ -0,0 +1,154 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2005-12-21
+// Updated : 2007-02-22
+// Licence : This source is under MIT License
+// File : glm/gtx/color_space.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm{
+namespace gtx{
+namespace color_space
+{
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> rgbColor(const detail::tvec3<T>& hsvColor)
+ {
+ detail::tvec3<T> hsv = hsvColor;
+ detail::tvec3<T> rgbColor;
+
+ if(hsv.y == T(0))
+ // achromatic (grey)
+ rgbColor = detail::tvec3<T>(hsv.z);
+ else
+ {
+ T sector = floor(hsv.x / T(60));
+ T frac = (hsv.x / T(60)) - sector;
+ // factorial part of h
+ T o = hsv.z * (T(1) - hsv.y);
+ T p = hsv.z * (T(1) - hsv.y * frac);
+ T q = hsv.z * (T(1) - hsv.y * (T(1) - frac));
+
+ switch(int(sector))
+ {
+ default:
+ case 0:
+ rgbColor.r = hsv.z;
+ rgbColor.g = q;
+ rgbColor.b = o;
+ break;
+ case 1:
+ rgbColor.r = p;
+ rgbColor.g = hsv.z;
+ rgbColor.b = o;
+ break;
+ case 2:
+ rgbColor.r = o;
+ rgbColor.g = hsv.z;
+ rgbColor.b = q;
+ break;
+ case 3:
+ rgbColor.r = o;
+ rgbColor.g = p;
+ rgbColor.b = hsv.z;
+ break;
+ case 4:
+ rgbColor.r = q;
+ rgbColor.g = o;
+ rgbColor.b = hsv.z;
+ break;
+ case 5:
+ rgbColor.r = hsv.z;
+ rgbColor.g = o;
+ rgbColor.b = p;
+ break;
+ }
+ }
+
+ return rgbColor;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> hsvColor(const detail::tvec3<T>& rgbColor)
+ {
+ detail::tvec3<T> hsv = rgbColor;
+ float Min = min(min(rgbColor.r, rgbColor.g), rgbColor.b);
+ float Max = max(max(rgbColor.r, rgbColor.g), rgbColor.b);
+ float Delta = Max - Min;
+
+ hsv.z = Max;
+
+ if(Max != T(0))
+ {
+ hsv.y = Delta / hsv.z;
+ T h = T(0);
+
+ if(rgbColor.r == Max)
+ // between yellow & magenta
+ h = T(0) + T(60) * (rgbColor.g - rgbColor.b) / Delta;
+ else if(rgbColor.g == Max)
+ // between cyan & yellow
+ h = T(120) + T(60) * (rgbColor.b - rgbColor.r) / Delta;
+ else
+ // between magenta & cyan
+ h = T(240) + T(60) * (rgbColor.r - rgbColor.g) / Delta;
+
+ if(h < T(0))
+ hsv.x = h + T(360);
+ else
+ hsv.x = h;
+ }
+ else
+ {
+ // If r = g = b = 0 then s = 0, h is undefined
+ hsv.y = T(0);
+ hsv.x = T(0);
+ }
+
+ return hsv;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat4x4<T> saturation(const T s)
+ {
+ detail::tvec3<T> rgbw = detail::tvec3<T>(T(0.2126), T(0.7152), T(0.0722));
+
+ T col0 = (T(1) - s) * rgbw.r;
+ T col1 = (T(1) - s) * rgbw.g;
+ T col2 = (T(1) - s) * rgbw.b;
+
+ detail::tmat4x4<T> result(T(1));
+ result[0][0] = col0 + s;
+ result[0][1] = col0;
+ result[0][2] = col0;
+ result[1][0] = col1;
+ result[1][1] = col1 + s;
+ result[1][2] = col1;
+ result[2][0] = col2;
+ result[2][1] = col2;
+ result[2][2] = col2 + s;
+ return result;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> saturation(const T s, const detail::tvec3<T>& color)
+ {
+ return detail::tvec3<T>(saturation(s) * detail::tvec4<T>(color, T(0)));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> saturation(const T s, const detail::tvec4<T>& color)
+ {
+ return saturation(s) * color;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER T luminosity(const detail::tvec3<T>& color)
+ {
+ const detail::tvec3<T> tmp = detail::tvec3<T>(0.33, 0.59, 0.11);
+ return dot(color, tmp);
+ }
+
+}//namespace color_space
+}//namespace gtx
+}//namespace glm
diff --git a/src/glm/gtx/color_space_YCoCg.hpp b/src/glm/gtx/color_space_YCoCg.hpp
new file mode 100644
index 0000000..d97d19c
--- /dev/null
+++ b/src/glm/gtx/color_space_YCoCg.hpp
@@ -0,0 +1,65 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2008-10-28
+// Updated : 2008-10-28
+// Licence : This source is under MIT License
+// File : glm/gtx/color_space_YCoCg.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_gtx_color_space_YCoCg
+#define glm_gtx_color_space_YCoCg
+
+// Dependency:
+#include "../glm.hpp"
+
+#if(defined(GLM_MESSAGES) && !defined(glm_ext))
+# pragma message("GLM: GLM_GTX_color_space_YCoCg extension included")
+#endif
+
+namespace glm{
+namespace gtx{
+namespace color_space_YCoCg ///< GLM_GTX_color_space_YCoCg extension: RGB to YCoCg conversions and operations
+{
+ /// \addtogroup gtx_color_space_YCoCg
+ ///@{
+
+ //! Convert a color from RGB color space to YCoCg color space.
+ //! From GLM_GTX_color_space_YCoCg extension.
+ template <typename valType>
+ detail::tvec3<valType> rgb2YCoCg(
+ detail::tvec3<valType> const & rgbColor);
+
+ //! Convert a color from YCoCg color space to RGB color space.
+ //! From GLM_GTX_color_space_YCoCg extension.
+ template <typename valType>
+ detail::tvec3<valType> YCoCg2rgb(
+ detail::tvec3<valType> const & YCoCgColor);
+
+ //! Convert a color from RGB color space to YCoCgR color space.
+ //! \see "YCoCg-R: A Color Space with RGB Reversibility and Low Dynamic Range"
+ //! From GLM_GTX_color_space_YCoCg extension.
+ template <typename valType>
+ detail::tvec3<valType> rgb2YCoCgR(
+ detail::tvec3<valType> const & rgbColor);
+
+ //! Convert a color from YCoCgR color space to RGB color space.
+ //! \see "YCoCg-R: A Color Space with RGB Reversibility and Low Dynamic Range"
+ //! From GLM_GTX_color_space_YCoCg extension.
+ template <typename valType>
+ detail::tvec3<valType> YCoCgR2rgb(
+ detail::tvec3<valType> const & YCoCgColor);
+
+ /// @}
+}//namespace color_space_YCoCg
+}//namespace gtx
+}//namespace glm
+
+#include "color_space_YCoCg.inl"
+
+namespace glm{using namespace gtx::color_space_YCoCg;}
+
+#endif//glm_gtx_color_space_YCoCg
diff --git a/src/glm/gtx/color_space_YCoCg.inl b/src/glm/gtx/color_space_YCoCg.inl
new file mode 100644
index 0000000..54a048c
--- /dev/null
+++ b/src/glm/gtx/color_space_YCoCg.inl
@@ -0,0 +1,69 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2008-10-28
+// Updated : 2008-10-28
+// Licence : This source is under MIT License
+// File : glm/gtx/color_space_YCoCg.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm{
+namespace gtx{
+namespace color_space_YCoCg{
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec3<valType> rgb2YCoCg
+(
+ detail::tvec3<valType> const & rgbColor
+)
+{
+ detail::tvec3<valType> result;
+ result.x/*Y */ = rgbColor.r / valType(4) + rgbColor.g / valType(2) + rgbColor.b / valType(4);
+ result.y/*Co*/ = rgbColor.r / valType(2) + rgbColor.g * valType(0) - rgbColor.b / valType(2);
+ result.z/*Cg*/ = - rgbColor.r / valType(4) + rgbColor.g / valType(2) - rgbColor.b / valType(4);
+ return result;
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec3<valType> rgb2YCoCgR
+(
+ detail::tvec3<valType> const & rgbColor
+)
+{
+ detail::tvec3<valType> result;
+ result.x/*Y */ = rgbColor.g / valType(2) + (rgbColor.r + rgbColor.b) / valType(4);
+ result.y/*Co*/ = rgbColor.r - rgbColor.b;
+ result.z/*Cg*/ = rgbColor.g - (rgbColor.r + rgbColor.b) / valType(2);
+ return result;
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec3<valType> YCoCg2rgb
+(
+ detail::tvec3<valType> const & YCoCgColor
+)
+{
+ detail::tvec3<valType> result;
+ result.r = YCoCgColor.x + YCoCgColor.y - YCoCgColor.z;
+ result.g = YCoCgColor.x + YCoCgColor.z;
+ result.b = YCoCgColor.x - YCoCgColor.y - YCoCgColor.z;
+ return result;
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec3<valType> YCoCgR2rgb
+(
+ detail::tvec3<valType> const & YCoCgRColor
+)
+{
+ detail::tvec3<valType> result;
+ valType tmp = YCoCgRColor.x - (YCoCgRColor.z / valType(2));
+ result.g = YCoCgRColor.z + tmp;
+ result.b = tmp - (YCoCgRColor.y / valType(2));
+ result.r = result.b + YCoCgRColor.y;
+ return result;
+}
+
+}//namespace color_space_YCoCg
+}//namespace gtx
+}//namespace glm
diff --git a/src/glm/gtx/compatibility.hpp b/src/glm/gtx/compatibility.hpp
new file mode 100644
index 0000000..a62a9e1
--- /dev/null
+++ b/src/glm/gtx/compatibility.hpp
@@ -0,0 +1,170 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2007-01-24
+// Updated : 2008-10-24
+// Licence : This source is under MIT License
+// File : glm/gtx/compatibility.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+// - GLM_GTC_half_float
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_gtx_compatibility
+#define glm_gtx_compatibility
+
+// Dependency:
+#include "../glm.hpp"
+#include "../gtc/half_float.hpp"
+
+#if(defined(GLM_MESSAGES) && !defined(glm_ext))
+# pragma message("GLM: GLM_GTX_compatibility extension included")
+#endif
+
+#if(GLM_COMPILER & GLM_COMPILER_VC)
+#include <cfloat>
+#elif(GLM_COMPILER & GLM_COMPILER_GCC)
+#include <cmath>
+#endif//GLM_COMPILER
+
+namespace glm{
+namespace gtx{
+namespace compatibility ///< GLM_GTX_compatibility extension: Provide functions to increase the compatibility with Cg and HLSL languages
+{
+ /// \addtogroup gtx_compatibility
+ ///@{
+
+ template <typename T> GLM_FUNC_QUALIFIER T lerp(T x, T y, T a){return mix(x, y, a);} //!< \brief 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]. (From GLM_GTX_compatibility)
+ template <typename T> GLM_FUNC_QUALIFIER detail::tvec2<T> lerp(const detail::tvec2<T>& x, const detail::tvec2<T>& y, T a){return mix(x, y, a);} //!< \brief 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]. (From GLM_GTX_compatibility)
+ template <typename T> GLM_FUNC_QUALIFIER detail::tvec3<T> lerp(const detail::tvec3<T>& x, const detail::tvec3<T>& y, T a){return mix(x, y, a);} //!< \brief 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]. (From GLM_GTX_compatibility)
+ template <typename T> GLM_FUNC_QUALIFIER detail::tvec4<T> lerp(const detail::tvec4<T>& x, const detail::tvec4<T>& y, T a){return mix(x, y, a);} //!< \brief 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]. (From GLM_GTX_compatibility)
+ template <typename T> GLM_FUNC_QUALIFIER detail::tvec2<T> lerp(const detail::tvec2<T>& x, const detail::tvec2<T>& y, const detail::tvec2<T>& a){return mix(x, y, a);} //!< \brief Returns the component-wise result of x * (1.0 - a) + y * a, i.e., the linear blend of x and y using vector a. The value for a is not restricted to the range [0, 1]. (From GLM_GTX_compatibility)
+ template <typename T> GLM_FUNC_QUALIFIER detail::tvec3<T> lerp(const detail::tvec3<T>& x, const detail::tvec3<T>& y, const detail::tvec3<T>& a){return mix(x, y, a);} //!< \brief Returns the component-wise result of x * (1.0 - a) + y * a, i.e., the linear blend of x and y using vector a. The value for a is not restricted to the range [0, 1]. (From GLM_GTX_compatibility)
+ template <typename T> GLM_FUNC_QUALIFIER detail::tvec4<T> lerp(const detail::tvec4<T>& x, const detail::tvec4<T>& y, const detail::tvec4<T>& a){return mix(x, y, a);} //!< \brief Returns the component-wise result of x * (1.0 - a) + y * a, i.e., the linear blend of x and y using vector a. The value for a is not restricted to the range [0, 1]. (From GLM_GTX_compatibility)
+
+ template <typename T> GLM_FUNC_QUALIFIER T saturate(T x){return clamp(x, T(0), T(1));} //!< \brief Returns clamp(x, 0, 1) for each component in x. (From GLM_GTX_compatibility)
+ template <typename T> GLM_FUNC_QUALIFIER detail::tvec2<T> saturate(const detail::tvec2<T>& x){return clamp(x, T(0), T(1));} //!< \brief Returns clamp(x, 0, 1) for each component in x. (From GLM_GTX_compatibility)
+ template <typename T> GLM_FUNC_QUALIFIER detail::tvec3<T> saturate(const detail::tvec3<T>& x){return clamp(x, T(0), T(1));} //!< \brief Returns clamp(x, 0, 1) for each component in x. (From GLM_GTX_compatibility)
+ template <typename T> GLM_FUNC_QUALIFIER detail::tvec4<T> saturate(const detail::tvec4<T>& x){return clamp(x, T(0), T(1));} //!< \brief Returns clamp(x, 0, 1) for each component in x. (From GLM_GTX_compatibility)
+
+ template <typename T> GLM_FUNC_QUALIFIER T atan2(T x, T y){return atan(x, y);} //!< \brief 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. (From GLM_GTX_compatibility)
+ template <typename T> GLM_FUNC_QUALIFIER detail::tvec2<T> atan2(const detail::tvec2<T>& x, const detail::tvec2<T>& y){return atan(x, y);} //!< \brief 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. (From GLM_GTX_compatibility)
+ template <typename T> GLM_FUNC_QUALIFIER detail::tvec3<T> atan2(const detail::tvec3<T>& x, const detail::tvec3<T>& y){return atan(x, y);} //!< \brief 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. (From GLM_GTX_compatibility)
+ template <typename T> GLM_FUNC_QUALIFIER detail::tvec4<T> atan2(const detail::tvec4<T>& x, const detail::tvec4<T>& y){return atan(x, y);} //!< \brief 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. (From GLM_GTX_compatibility)
+
+ template <typename genType> bool isfinite(genType const & x); //!< \brief Test whether or not a scalar or each vector component is a finite value. (From GLM_GTX_compatibility)
+ template <typename valType> detail::tvec2<bool> isfinite(const detail::tvec2<valType>& x); //!< \brief Test whether or not a scalar or each vector component is a finite value. (From GLM_GTX_compatibility)
+ template <typename valType> detail::tvec3<bool> isfinite(const detail::tvec3<valType>& x); //!< \brief Test whether or not a scalar or each vector component is a finite value. (From GLM_GTX_compatibility)
+ template <typename valType> detail::tvec4<bool> isfinite(const detail::tvec4<valType>& x); //!< \brief Test whether or not a scalar or each vector component is a finite value. (From GLM_GTX_compatibility)
+
+ template <typename genType> bool isinf(genType const & x); //!< \brief Determines whether the given floating-point value is infinite. (From GLM_GTX_compatibility extension)
+ template <typename genType> detail::tvec2<bool> isinf(const detail::tvec2<genType>& x); //!< \brief Determines whether the given floating-point value is infinite. (From GLM_GTX_compatibility extension)
+ template <typename genType> detail::tvec3<bool> isinf(const detail::tvec3<genType>& x); //!< \brief Determines whether the given floating-point value is infinite. (From GLM_GTX_compatibility extension)
+ template <typename genType> detail::tvec4<bool> isinf(const detail::tvec4<genType>& x); //!< \brief Determines whether the given floating-point value is infinite. (From GLM_GTX_compatibility extension)
+
+ template <typename genType> bool isnan(genType const & x); //!< \brief Checks given floating-point value for not a number (NAN) (From GLM_GTX_compatibility extension)
+ template <typename genType> detail::tvec2<bool> isnan(const detail::tvec2<genType>& x); //!< \brief Checks given floating-point value for not a number (NAN) (From GLM_GTX_compatibility extension)
+ template <typename genType> detail::tvec3<bool> isnan(const detail::tvec3<genType>& x); //!< \brief Checks given floating-point value for not a number (NAN) (From GLM_GTX_compatibility extension)
+ template <typename genType> detail::tvec4<bool> isnan(const detail::tvec4<genType>& x); //!< \brief Checks given floating-point value for not a number (NAN) (From GLM_GTX_compatibility extension)
+
+ typedef bool bool1; //!< \brief boolean type with 1 component. (From GLM_GTX_compatibility extension)
+ typedef detail::tvec2<bool> bool2; //!< \brief boolean type with 2 components. (From GLM_GTX_compatibility extension)
+ typedef detail::tvec3<bool> bool3; //!< \brief boolean type with 3 components. (From GLM_GTX_compatibility extension)
+ typedef detail::tvec4<bool> bool4; //!< \brief boolean type with 4 components. (From GLM_GTX_compatibility extension)
+
+ typedef bool bool1x1; //!< \brief boolean matrix with 1 x 1 component. (From GLM_GTX_compatibility extension)
+ typedef detail::tmat2x2<bool> bool2x2; //!< \brief boolean matrix with 2 x 2 components. (From GLM_GTX_compatibility extension)
+ typedef detail::tmat2x3<bool> bool2x3; //!< \brief boolean matrix with 2 x 3 components. (From GLM_GTX_compatibility extension)
+ typedef detail::tmat2x4<bool> bool2x4; //!< \brief boolean matrix with 2 x 4 components. (From GLM_GTX_compatibility extension)
+ typedef detail::tmat3x2<bool> bool3x2; //!< \brief boolean matrix with 3 x 2 components. (From GLM_GTX_compatibility extension)
+ typedef detail::tmat3x3<bool> bool3x3; //!< \brief boolean matrix with 3 x 3 components. (From GLM_GTX_compatibility extension)
+ typedef detail::tmat3x4<bool> bool3x4; //!< \brief boolean matrix with 3 x 4 components. (From GLM_GTX_compatibility extension)
+ typedef detail::tmat4x2<bool> bool4x2; //!< \brief boolean matrix with 4 x 2 components. (From GLM_GTX_compatibility extension)
+ typedef detail::tmat4x3<bool> bool4x3; //!< \brief boolean matrix with 4 x 3 components. (From GLM_GTX_compatibility extension)
+ typedef detail::tmat4x4<bool> bool4x4; //!< \brief boolean matrix with 4 x 4 components. (From GLM_GTX_compatibility extension)
+
+ typedef int int1; //!< \brief integer vector with 1 component. (From GLM_GTX_compatibility extension)
+ typedef detail::tvec2<int> int2; //!< \brief integer vector with 2 components. (From GLM_GTX_compatibility extension)
+ typedef detail::tvec3<int> int3; //!< \brief integer vector with 3 components. (From GLM_GTX_compatibility extension)
+ typedef detail::tvec4<int> int4; //!< \brief integer vector with 4 components. (From GLM_GTX_compatibility extension)
+
+ typedef int int1x1; //!< \brief integer matrix with 1 component. (From GLM_GTX_compatibility extension)
+ typedef detail::tmat2x2<int> int2x2; //!< \brief integer matrix with 2 x 2 components. (From GLM_GTX_compatibility extension)
+ typedef detail::tmat2x3<int> int2x3; //!< \brief integer matrix with 2 x 3 components. (From GLM_GTX_compatibility extension)
+ typedef detail::tmat2x4<int> int2x4; //!< \brief integer matrix with 2 x 4 components. (From GLM_GTX_compatibility extension)
+ typedef detail::tmat3x2<int> int3x2; //!< \brief integer matrix with 3 x 2 components. (From GLM_GTX_compatibility extension)
+ typedef detail::tmat3x3<int> int3x3; //!< \brief integer matrix with 3 x 3 components. (From GLM_GTX_compatibility extension)
+ typedef detail::tmat3x4<int> int3x4; //!< \brief integer matrix with 3 x 4 components. (From GLM_GTX_compatibility extension)
+ typedef detail::tmat4x2<int> int4x2; //!< \brief integer matrix with 4 x 2 components. (From GLM_GTX_compatibility extension)
+ typedef detail::tmat4x3<int> int4x3; //!< \brief integer matrix with 4 x 3 components. (From GLM_GTX_compatibility extension)
+ typedef detail::tmat4x4<int> int4x4; //!< \brief integer matrix with 4 x 4 components. (From GLM_GTX_compatibility extension)
+
+ typedef gtc::half_float::half half1; //!< \brief half-precision floating-point vector with 1 component. (From GLM_GTX_compatibility extension)
+ typedef detail::tvec2<gtc::half_float::half> half2; //!< \brief half-precision floating-point vector with 2 components. (From GLM_GTX_compatibility extension)
+ typedef detail::tvec3<gtc::half_float::half> half3; //!< \brief half-precision floating-point vector with 2 components. (From GLM_GTX_compatibility extension)
+ typedef detail::tvec4<gtc::half_float::half> half4; //!< \brief half-precision floating-point vector with 2 components. (From GLM_GTX_compatibility extension)
+
+ typedef gtc::half_float::half half1x1; //!< \brief half-precision floating-point matrix with 1 component. (From GLM_GTX_compatibility extension)
+ typedef detail::tmat2x2<gtc::half_float::half> half2x2; //!< \brief half-precision floating-point matrix with 2 x 2 components. (From GLM_GTX_compatibility extension)
+ typedef detail::tmat2x3<gtc::half_float::half> half2x3; //!< \brief half-precision floating-point matrix with 2 x 3 components. (From GLM_GTX_compatibility extension)
+ typedef detail::tmat2x4<gtc::half_float::half> half2x4; //!< \brief half-precision floating-point matrix with 2 x 4 components. (From GLM_GTX_compatibility extension)
+ typedef detail::tmat3x2<gtc::half_float::half> half3x2; //!< \brief half-precision floating-point matrix with 3 x 2 components. (From GLM_GTX_compatibility extension)
+ typedef detail::tmat3x3<gtc::half_float::half> half3x3; //!< \brief half-precision floating-point matrix with 3 x 3 components. (From GLM_GTX_compatibility extension)
+ typedef detail::tmat3x4<gtc::half_float::half> half3x4; //!< \brief half-precision floating-point matrix with 3 x 3 components. (From GLM_GTX_compatibility extension)
+ typedef detail::tmat4x2<gtc::half_float::half> half4x2; //!< \brief half-precision floating-point matrix with 4 x 2 components. (From GLM_GTX_compatibility extension)
+ typedef detail::tmat4x3<gtc::half_float::half> half4x3; //!< \brief half-precision floating-point matrix with 4 x 3 components. (From GLM_GTX_compatibility extension)
+ typedef detail::tmat4x4<gtc::half_float::half> half4x4; //!< \brief half-precision floating-point matrix with 4 x 4 components. (From GLM_GTX_compatibility extension)
+
+ typedef float float1; //!< \brief single-precision floating-point vector with 1 component. (From GLM_GTX_compatibility extension)
+ typedef detail::tvec2<float> float2; //!< \brief single-precision floating-point vector with 2 components. (From GLM_GTX_compatibility extension)
+ typedef detail::tvec3<float> float3; //!< \brief single-precision floating-point vector with 3 components. (From GLM_GTX_compatibility extension)
+ typedef detail::tvec4<float> float4; //!< \brief single-precision floating-point vector with 4 components. (From GLM_GTX_compatibility extension)
+
+ typedef float float1x1; //!< \brief single-precision floating-point matrix with 1 component. (From GLM_GTX_compatibility extension)
+ typedef detail::tmat2x2<float> float2x2; //!< \brief single-precision floating-point matrix with 2 x 2 components. (From GLM_GTX_compatibility extension)
+ typedef detail::tmat2x3<float> float2x3; //!< \brief single-precision floating-point matrix with 2 x 3 components. (From GLM_GTX_compatibility extension)
+ typedef detail::tmat2x4<float> float2x4; //!< \brief single-precision floating-point matrix with 2 x 4 components. (From GLM_GTX_compatibility extension)
+ typedef detail::tmat3x2<float> float3x2; //!< \brief single-precision floating-point matrix with 3 x 2 components. (From GLM_GTX_compatibility extension)
+ typedef detail::tmat3x3<float> float3x3; //!< \brief single-precision floating-point matrix with 3 x 3 components. (From GLM_GTX_compatibility extension)
+ typedef detail::tmat3x4<float> float3x4; //!< \brief single-precision floating-point matrix with 3 x 4 components. (From GLM_GTX_compatibility extension)
+ typedef detail::tmat4x2<float> float4x2; //!< \brief single-precision floating-point matrix with 4 x 2 components. (From GLM_GTX_compatibility extension)
+ typedef detail::tmat4x3<float> float4x3; //!< \brief single-precision floating-point matrix with 4 x 3 components. (From GLM_GTX_compatibility extension)
+ typedef detail::tmat4x4<float> float4x4; //!< \brief single-precision floating-point matrix with 4 x 4 components. (From GLM_GTX_compatibility extension)
+
+ typedef double double1; //!< \brief double-precision floating-point vector with 1 component. (From GLM_GTX_compatibility extension)
+ typedef detail::tvec2<double> double2; //!< \brief double-precision floating-point vector with 2 components. (From GLM_GTX_compatibility extension)
+ typedef detail::tvec3<double> double3; //!< \brief double-precision floating-point vector with 3 components. (From GLM_GTX_compatibility extension)
+ typedef detail::tvec4<double> double4; //!< \brief double-precision floating-point vector with 4 components. (From GLM_GTX_compatibility extension)
+
+ typedef double double1x1; //!< \brief double-precision floating-point matrix with 1 component. (From GLM_GTX_compatibility extension)
+ typedef detail::tmat2x2<double> double2x2; //!< \brief double-precision floating-point matrix with 2 x 2 components. (From GLM_GTX_compatibility extension)
+ typedef detail::tmat2x3<double> double2x3; //!< \brief double-precision floating-point matrix with 2 x 3 components. (From GLM_GTX_compatibility extension)
+ typedef detail::tmat2x4<double> double2x4; //!< \brief double-precision floating-point matrix with 2 x 4 components. (From GLM_GTX_compatibility extension)
+ typedef detail::tmat3x2<double> double3x2; //!< \brief double-precision floating-point matrix with 3 x 2 components. (From GLM_GTX_compatibility extension)
+ typedef detail::tmat3x3<double> double3x3; //!< \brief double-precision floating-point matrix with 3 x 3 components. (From GLM_GTX_compatibility extension)
+ typedef detail::tmat3x4<double> double3x4; //!< \brief double-precision floating-point matrix with 3 x 4 components. (From GLM_GTX_compatibility extension)
+ typedef detail::tmat4x2<double> double4x2; //!< \brief double-precision floating-point matrix with 4 x 2 components. (From GLM_GTX_compatibility extension)
+ typedef detail::tmat4x3<double> double4x3; //!< \brief double-precision floating-point matrix with 4 x 3 components. (From GLM_GTX_compatibility extension)
+ typedef detail::tmat4x4<double> double4x4; //!< \brief double-precision floating-point matrix with 4 x 4 components. (From GLM_GTX_compatibility extension)
+
+ /// @}
+}//namespace compatibility
+}//namespace gtx
+}//namespace glm
+
+#include "compatibility.inl"
+
+namespace glm{using namespace gtx::compatibility;}
+
+#endif//glm_gtx_compatibility
+
+
+
+
+
+
+
+
+
+
diff --git a/src/glm/gtx/compatibility.inl b/src/glm/gtx/compatibility.inl
new file mode 100644
index 0000000..4cdef01
--- /dev/null
+++ b/src/glm/gtx/compatibility.inl
@@ -0,0 +1,141 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2007-03-16
+// Updated : 2008-10-24
+// Licence : This source is under MIT License
+// File : glm/gtx/compatibility.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm{
+namespace gtx{
+namespace compatibility{
+
+// isfinite
+template <typename genType>
+GLM_FUNC_QUALIFIER bool isfinite(
+ genType const & x)
+{
+#if(GLM_COMPILER & GLM_COMPILER_VC)
+ return _finite(x);
+#else//(GLM_COMPILER & GLM_COMPILER_GCC)
+ return std::isfinite(x) != 0;
+#endif
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec2<bool> isfinite(
+ detail::tvec2<valType> const & x)
+{
+ return detail::tvec2<bool>(
+ isfinite(x.x),
+ isfinite(x.y));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec3<bool> isfinite(
+ detail::tvec3<valType> const & x)
+{
+ return detail::tvec3<bool>(
+ isfinite(x.x),
+ isfinite(x.y),
+ isfinite(x.z));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec4<bool> isfinite(
+ detail::tvec4<valType> const & x)
+{
+ return detail::tvec4<bool>(
+ isfinite(x.x),
+ isfinite(x.y),
+ isfinite(x.z),
+ isfinite(x.w));
+}
+
+// isinf
+template <typename genType>
+GLM_FUNC_QUALIFIER bool isinf(
+ genType const & x)
+{
+#if(GLM_COMPILER & GLM_COMPILER_VC)
+ return _fpclass(x) == _FPCLASS_NINF || _fpclass(x) == _FPCLASS_PINF;
+#else
+ return std::isinf(x) != 0;
+#endif
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec2<bool> isinf(
+ detail::tvec2<valType> const & x)
+{
+ return detail::tvec2<bool>(
+ isinf(x.x),
+ isinf(x.y));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec3<bool> isinf(
+ detail::tvec3<valType> const & x)
+{
+ return detail::tvec3<bool>(
+ isinf(x.x),
+ isinf(x.y),
+ isinf(x.z));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec4<bool> isinf(
+ detail::tvec4<valType> const & x)
+{
+ return detail::tvec4<bool>(
+ isinf(x.x),
+ isinf(x.y),
+ isinf(x.z),
+ isinf(x.w));
+}
+
+// isnan
+template <typename genType>
+GLM_FUNC_QUALIFIER bool isnan(genType const & x)
+{
+#if(GLM_COMPILER & GLM_COMPILER_VC)
+ return _isnan(x);
+#else
+ return std::isnan(x) != 0;
+#endif
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec2<bool> isnan(
+ detail::tvec2<valType> const & x)
+{
+ return detail::tvec2<bool>(
+ isnan(x.x),
+ isnan(x.y));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec3<bool> isnan(
+ detail::tvec3<valType> const & x)
+{
+ return detail::tvec3<bool>(
+ isnan(x.x),
+ isnan(x.y),
+ isnan(x.z));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec4<bool> isnan(
+ detail::tvec4<valType> const & x)
+{
+ return detail::tvec4<bool>(
+ isnan(x.x),
+ isnan(x.y),
+ isnan(x.z),
+ isnan(x.w));
+}
+
+}//namespace compatibility
+}//namespace gtx
+}//namespace glm
diff --git a/src/glm/gtx/component_wise.hpp b/src/glm/gtx/component_wise.hpp
new file mode 100644
index 0000000..e22a2a5
--- /dev/null
+++ b/src/glm/gtx/component_wise.hpp
@@ -0,0 +1,63 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2007-05-21
+// Updated : 2007-05-21
+// Licence : This source is under MIT License
+// File : glm/gtx/component_wise.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_gtx_component_wise
+#define glm_gtx_component_wise
+
+// Dependency:
+#include "../glm.hpp"
+
+#if(defined(GLM_MESSAGES) && !defined(glm_ext))
+# pragma message("GLM: GLM_GTX_component_wise extension included")
+#endif
+
+namespace glm{
+namespace gtx{
+namespace component_wise ///< GLM_GTX_component_wise extension: Operations between components of a type
+{
+ /// \addtogroup gtx_component_wise
+ /// @{
+
+ //! Add all vector components together.
+ //! From GLM_GTX_component_wise extension.
+ template <typename genType>
+ typename genType::value_type compAdd(
+ genType const & v);
+
+ //! Multiply all vector components together.
+ //! From GLM_GTX_component_wise extension.
+ template <typename genType>
+ typename genType::value_type compMul(
+ genType const & v);
+
+ //! Find the minimum value between single vector components.
+ //! From GLM_GTX_component_wise extension.
+ template <typename genType>
+ typename genType::value_type compMin(
+ genType const & v);
+
+ //! Find the maximum value between single vector components.
+ //! From GLM_GTX_component_wise extension.
+ template <typename genType>
+ typename genType::value_type compMax(
+ genType const & v);
+
+ /// @}
+}//namespace component_wise
+}//namespace gtx
+}//namespace glm
+
+#include "component_wise.inl"
+
+namespace glm{using namespace gtx::component_wise;}
+
+#endif//glm_gtx_component_wise
diff --git a/src/glm/gtx/component_wise.inl b/src/glm/gtx/component_wise.inl
new file mode 100644
index 0000000..b3d2517
--- /dev/null
+++ b/src/glm/gtx/component_wise.inl
@@ -0,0 +1,52 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2007-05-21
+// Updated : 2010-02-12
+// Licence : This source is under MIT License
+// File : gtx_component_wise.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm{
+namespace gtx{
+namespace component_wise
+{
+ template <typename genType>
+ GLM_FUNC_QUALIFIER typename genType::value_type compAdd(genType const & v)
+ {
+ typename genType::size_type result = typename genType::value_type(0);
+ for(typename genType::size_type i = 0; i < genType::value_size(); ++i)
+ result += v[i];
+ return result;
+ }
+
+ template <typename genType>
+ GLM_FUNC_QUALIFIER typename genType::value_type compMul(genType const & v)
+ {
+ typename genType::value_type result = typename genType::value_type(1);
+ for(typename genType::size_type i = 0; i < genType::value_size(); ++i)
+ result *= v[i];
+ return result;
+ }
+
+ template <typename genType>
+ GLM_FUNC_QUALIFIER typename genType::value_type compMin(genType const & v)
+ {
+ typename genType::value_type result = typename genType::value_type(v[0]);
+ for(typename genType::size_type i = 1; i < genType::value_size(); ++i)
+ result = min(result, v[i]);
+ return result;
+ }
+
+ template <typename genType>
+ GLM_FUNC_QUALIFIER typename genType::value_type compMax(genType const & v)
+ {
+ typename genType::value_type result = typename genType::value_type(v[0]);
+ for(typename genType::size_type i = 1; i < genType::value_size(); ++i)
+ result = max(result, v[i]);
+ return result;
+ }
+
+}//namespace component_wise
+}//namespace gtx
+}//namespace glm
diff --git a/src/glm/gtx/epsilon.hpp b/src/glm/gtx/epsilon.hpp
new file mode 100644
index 0000000..4f0fdd5
--- /dev/null
+++ b/src/glm/gtx/epsilon.hpp
@@ -0,0 +1,59 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2005-12-21
+// Updated : 2006-11-13
+// Licence : This source is under MIT License
+// File : glm/gtx/epsilon.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+// - GLM_GTC_half_float
+// - GLM_GTC_quaternion
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_gtx_epsilon
+#define glm_gtx_epsilon
+
+// Dependency:
+#include "../glm.hpp"
+#include "../gtc/half_float.hpp"
+#include "../gtc/quaternion.hpp"
+
+#if(defined(GLM_MESSAGES) && !defined(glm_ext))
+# pragma message("GLM: GLM_GTX_epsilon extension included")
+#endif
+
+namespace glm{
+namespace gtx{
+namespace epsilon ///< GLM_GTX_epsilon extension: Comparison functions for a user defined epsilon values.
+{
+ /// \addtogroup gtx_epsilon
+ ///@{
+
+ //! Returns the component-wise compare of |x - y| < epsilon.
+ //! From GLM_GTX_epsilon extension.
+ template <typename genTypeT, typename genTypeU>
+ bool equalEpsilon(
+ genTypeT const & x,
+ genTypeT const & y,
+ genTypeU const & epsilon);
+
+ //! Returns the component-wise compare of |x - y| >= epsilon.
+ //! From GLM_GTX_epsilon extension.
+ template <typename genTypeT, typename genTypeU>
+ bool notEqualEpsilon(
+ genTypeT const & x,
+ genTypeT const & y,
+ genTypeU const & epsilon);
+
+ ///@}
+}//namespace epsilon
+}//namespace gtx
+}//namespace glm
+
+#include "epsilon.inl"
+
+namespace glm{using namespace gtx::epsilon;}
+
+#endif//glm_gtx_epsilon
diff --git a/src/glm/gtx/epsilon.inl b/src/glm/gtx/epsilon.inl
new file mode 100644
index 0000000..e81d0ed
--- /dev/null
+++ b/src/glm/gtx/epsilon.inl
@@ -0,0 +1,234 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2005-12-21
+// Updated : 2006-01-16
+// Licence : This source is under MIT License
+// File : glm/gtx/epsilon.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm{
+namespace gtx{
+namespace epsilon{
+
+template <typename genType>
+GLM_FUNC_QUALIFIER bool equalEpsilon
+(
+ genType const & x,
+ genType const & y,
+ genType const & epsilon
+)
+{
+ return abs(x - y) < epsilon;
+}
+
+template <typename genType>
+GLM_FUNC_QUALIFIER bool notEqualEpsilon
+(
+ genType const & x,
+ genType const & y,
+ genType const & epsilon
+)
+{
+ return abs(x - y) >= epsilon;
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec2<bool> equalEpsilon
+(
+ detail::tvec2<valType> const & x,
+ detail::tvec2<valType> const & y,
+ valType const & epsilon)
+{
+ return detail::tvec2<bool>(
+ abs(x.x - y.x) < epsilon,
+ abs(x.y - y.y) < epsilon);
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec3<bool> equalEpsilon
+(
+ detail::tvec3<valType> const & x,
+ detail::tvec3<valType> const & y,
+ valType const & epsilon)
+{
+ return detail::tvec3<bool>(
+ abs(x.x - y.x) < epsilon,
+ abs(x.y - y.y) < epsilon,
+ abs(x.z - y.z) < epsilon);
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec4<bool> equalEpsilon
+(
+ detail::tvec4<valType> const & x,
+ detail::tvec4<valType> const & y,
+ valType const & epsilon
+)
+{
+ return detail::tvec4<bool>(
+ abs(x.x - y.x) < epsilon,
+ abs(x.y - y.y) < epsilon,
+ abs(x.z - y.z) < epsilon,
+ abs(x.w - y.w) < epsilon);
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec2<bool> notEqualEpsilon
+(
+ detail::tvec2<valType> const & x,
+ detail::tvec2<valType> const & y,
+ valType const & epsilon
+)
+{
+ return detail::tvec2<bool>(
+ abs(x.x - y.x) >= epsilon,
+ abs(x.y - y.y) >= epsilon);
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec3<bool> notEqualEpsilon
+(
+ detail::tvec3<valType> const & x,
+ detail::tvec3<valType> const & y,
+ valType const & epsilon
+)
+{
+ return detail::tvec3<bool>(
+ abs(x.x - y.x) >= epsilon,
+ abs(x.y - y.y) >= epsilon,
+ abs(x.z - y.z) >= epsilon);
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec4<bool> notEqualEpsilon
+(
+ detail::tvec4<valType> const & x,
+ detail::tvec4<valType> const & y,
+ valType const & epsilon
+)
+{
+ return detail::tvec4<bool>(
+ abs(x.x - y.x) >= epsilon,
+ abs(x.y - y.y) >= epsilon,
+ abs(x.z - y.z) >= epsilon,
+ abs(x.w - y.w) >= epsilon);
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec2<bool> equalEpsilon
+(
+ detail::tvec2<valType> const & x,
+ detail::tvec2<valType> const & y,
+ detail::tvec2<valType> const & epsilon
+)
+{
+ return detail::tvec2<bool>(
+ abs(x.x - y.x) < epsilon.x,
+ abs(x.y - y.y) < epsilon.y);
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec3<bool> equalEpsilon
+(
+ detail::tvec3<valType> const & x,
+ detail::tvec3<valType> const & y,
+ detail::tvec3<valType> const & epsilon
+)
+{
+ return detail::tvec3<bool>(
+ abs(x.x - y.x) < epsilon.x,
+ abs(x.y - y.y) < epsilon.y,
+ abs(x.z - y.z) < epsilon.z);
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec4<bool> equalEpsilon
+(
+ detail::tvec4<valType> const & x,
+ detail::tvec4<valType> const & y,
+ detail::tvec4<valType> const & epsilon
+)
+{
+ return detail::tvec4<bool>(
+ abs(x.x - y.x) < epsilon.x,
+ abs(x.y - y.y) < epsilon.y,
+ abs(x.z - y.z) < epsilon.z,
+ abs(x.w - y.w) < epsilon.w);
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec4<bool> equalEpsilon
+(
+ detail::tquat<valType> const & x,
+ detail::tquat<valType> const & y,
+ detail::tquat<valType> const & epsilon
+)
+{
+ return detail::tvec4<bool>(
+ abs(x.x - y.x) < epsilon.x,
+ abs(x.y - y.y) < epsilon.y,
+ abs(x.z - y.z) < epsilon.z,
+ abs(x.w - y.w) < epsilon.w);
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec2<bool> notEqualEpsilon
+(
+ detail::tvec2<valType> const & x,
+ detail::tvec2<valType> const & y,
+ detail::tvec2<valType> const & epsilon
+)
+{
+ return detail::tvec2<bool>(
+ abs(x.x - y.x) >= epsilon.x,
+ abs(x.y - y.y) >= epsilon.y);
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec3<bool> notEqualEpsilon
+(
+ detail::tvec3<valType> const & x,
+ detail::tvec3<valType> const & y,
+ detail::tvec3<valType> const & epsilon
+)
+{
+ return detail::tvec3<bool>(
+ abs(x.x - y.x) >= epsilon.x,
+ abs(x.y - y.y) >= epsilon.y,
+ abs(x.z - y.z) >= epsilon.z);
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec4<bool> notEqualEpsilon
+(
+ detail::tvec4<valType> const & x,
+ detail::tvec4<valType> const & y,
+ detail::tvec4<valType> const & epsilon
+)
+{
+ return detail::tvec4<bool>(
+ abs(x.x - y.x) >= epsilon.x,
+ abs(x.y - y.y) >= epsilon.y,
+ abs(x.z - y.z) >= epsilon.z,
+ abs(x.w - y.w) >= epsilon.w);
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec4<bool> notEqualEpsilon
+(
+ detail::tquat<valType> const & x,
+ detail::tquat<valType> const & y,
+ detail::tquat<valType> const & epsilon
+)
+{
+ return detail::tvec4<bool>(
+ abs(x.x - y.x) >= epsilon.x,
+ abs(x.y - y.y) >= epsilon.y,
+ abs(x.z - y.z) >= epsilon.z,
+ abs(x.w - y.w) >= epsilon.w);
+}
+
+}//namespace epsilon
+}//namespace gtx
+}//namespace glm
diff --git a/src/glm/gtx/euler_angles.hpp b/src/glm/gtx/euler_angles.hpp
new file mode 100644
index 0000000..0c4abba
--- /dev/null
+++ b/src/glm/gtx/euler_angles.hpp
@@ -0,0 +1,141 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2005-12-21
+// Updated : 2007-08-14
+// Licence : This source is under MIT License
+// File : glm/gtx/euler_angles.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+// - GLM_GTC_half_float
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// ToDo:
+// - mat2 mat2GTX(const vec2& angles) undefined
+// - mat3 mat3GTX(const vec2& angles) undefined
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_gtx_euler_angles
+#define glm_gtx_euler_angles
+
+// Dependency:
+#include "../glm.hpp"
+#include "../gtc/half_float.hpp"
+
+#if(defined(GLM_MESSAGES) && !defined(glm_ext))
+# pragma message("GLM: GLM_GTX_euler_angles extension included")
+#endif
+
+namespace glm{
+namespace gtx{
+namespace euler_angles ///< GLM_GTX_euler_angles extension: Build matrices from Euler angles.
+{
+ /// \addtogroup gtx_euler_angles
+ /// @{
+
+ //! Creates a 3D 4 * 4 homogeneous rotation matrix from an euler angle X.
+ //! From GLM_GTX_euler_angles extension.
+ template <typename valType>
+ detail::tmat4x4<valType> eulerAngleX(
+ valType const & angleX);
+
+ //! Creates a 3D 4 * 4 homogeneous rotation matrix from an euler angle Y.
+ //! From GLM_GTX_euler_angles extension.
+ template <typename valType>
+ detail::tmat4x4<valType> eulerAngleY(
+ valType const & angleY);
+
+ //! Creates a 3D 4 * 4 homogeneous rotation matrix from an euler angle Z.
+ //! From GLM_GTX_euler_angles extension.
+ template <typename valType>
+ detail::tmat4x4<valType> eulerAngleZ(
+ valType const & angleZ);
+
+ //! Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (X * Y).
+ //! From GLM_GTX_euler_angles extension.
+ template <typename valType>
+ detail::tmat4x4<valType> eulerAngleXY(
+ valType const & angleX,
+ valType const & angleY);
+
+ //! Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (Y * X).
+ //! From GLM_GTX_euler_angles extension.
+ template <typename valType>
+ detail::tmat4x4<valType> eulerAngleYX(
+ valType const & angleY,
+ valType const & angleX);
+
+ //! Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (X * Z).
+ //! From GLM_GTX_euler_angles extension.
+ template <typename valType>
+ detail::tmat4x4<valType> eulerAngleXZ(
+ valType const & angleX,
+ valType const & angleZ);
+
+ //! Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (Z * X).
+ //! From GLM_GTX_euler_angles extension.
+ template <typename valType>
+ detail::tmat4x4<valType> eulerAngleZX(
+ valType const & angleZ,
+ valType const & angleX);
+
+ //! Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (Y * Z).
+ //! From GLM_GTX_euler_angles extension.
+ template <typename valType>
+ detail::tmat4x4<valType> eulerAngleYZ(
+ valType const & angleY,
+ valType const & angleZ);
+
+ //! Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (Z * Y).
+ //! From GLM_GTX_euler_angles extension.
+ template <typename valType>
+ detail::tmat4x4<valType> eulerAngleZY(
+ valType const & angleZ,
+ valType const & angleY);
+
+ //! Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (Y * X * Z).
+ //! From GLM_GTX_euler_angles extension.
+ template <typename valType>
+ detail::tmat4x4<valType> eulerAngleYXZ(
+ valType const & yaw,
+ valType const & pitch,
+ valType const & roll);
+
+ //! Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (Y * X * Z).
+ //! From GLM_GTX_euler_angles extension.
+ template <typename valType>
+ detail::tmat4x4<valType> yawPitchRoll(
+ valType const & yaw,
+ valType const & pitch,
+ valType const & roll);
+
+ //! Creates a 2D 2 * 2 rotation matrix from an euler angle.
+ //! From GLM_GTX_euler_angles extension.
+ template <typename T>
+ detail::tmat2x2<T> orientate2(T const & angle);
+
+ //! Creates a 2D 4 * 4 homogeneous rotation matrix from an euler angle.
+ //! From GLM_GTX_euler_angles extension.
+ template <typename T>
+ detail::tmat3x3<T> orientate3(T const & angle);
+
+ //! Creates a 3D 3 * 3 rotation matrix from euler angles (Y * X * Z).
+ //! From GLM_GTX_euler_angles extension.
+ template <typename T>
+ detail::tmat3x3<T> orientate3(detail::tvec3<T> const & angles);
+
+ //! Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (Y * X * Z).
+ //! From GLM_GTX_euler_angles extension.
+ template <typename T>
+ detail::tmat4x4<T> orientate4(detail::tvec3<T> const & angles);
+
+ /// @}
+}//namespace euler_angles
+}//namespace gtx
+}//namespace glm
+
+#include "euler_angles.inl"
+
+namespace glm{using namespace gtx::euler_angles;}
+
+#endif//glm_gtx_euler_angles
diff --git a/src/glm/gtx/euler_angles.inl b/src/glm/gtx/euler_angles.inl
new file mode 100644
index 0000000..6748ae1
--- /dev/null
+++ b/src/glm/gtx/euler_angles.inl
@@ -0,0 +1,249 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2005-12-21
+// Updated : 2007-08-14
+// Licence : This source is under MIT License
+// File : glm/gtx/euler_angles.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm{
+namespace gtx{
+namespace euler_angles{
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tmat4x4<valType> eulerAngleX
+(
+ valType const & angleX
+)
+{
+ valType cosX = glm::cos(angleX);
+ valType sinX = glm::sin(angleX);
+
+ return detail::tmat4x4<valType>(
+ valType(1), valType(0), valType(0), valType(0),
+ valType(0), cosX, sinX, valType(0),
+ valType(0),-sinX, cosX, valType(0),
+ valType(0), valType(0), valType(0), valType(1));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tmat4x4<valType> eulerAngleY
+(
+ valType const & angleY
+)
+{
+ valType cosY = glm::cos(angleY);
+ valType sinY = glm::sin(angleY);
+
+ return detail::tmat4x4<valType>(
+ cosY, valType(0), sinY, valType(0),
+ valType(0), valType(1), valType(0), valType(0),
+ -sinY, valType(0), cosY, valType(0),
+ valType(0), valType(0), valType(0), valType(1));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tmat4x4<valType> eulerAngleZ
+(
+ valType const & angleZ
+)
+{
+ valType cosZ = glm::cos(angleZ);
+ valType sinZ = glm::sin(angleZ);
+
+ return detail::tmat4x4<valType>(
+ cosZ, sinZ, valType(0), valType(0),
+ -sinZ, cosZ, valType(0), valType(0),
+ valType(0), valType(0), valType(1), valType(0),
+ valType(0), valType(0), valType(0), valType(1));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tmat4x4<valType> eulerAngleXY
+(
+ valType const & angleX,
+ valType const & angleY
+)
+{
+ valType cosX = glm::cos(angleX);
+ valType sinX = glm::sin(angleX);
+ valType cosY = glm::cos(angleY);
+ valType sinY = glm::sin(angleY);
+
+ return detail::tmat4x4<valType>(
+ cosY, -sinX * sinY, cosX * sinY, valType(0),
+ valType(0), cosX, sinX, valType(0),
+ -sinY , -sinX * cosY, cosX * cosY, valType(0),
+ valType(0), valType(0), valType(0), valType(1));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tmat4x4<valType> eulerAngleYX
+(
+ valType const & angleY,
+ valType const & angleX
+)
+{
+ valType cosX = glm::cos(angleX);
+ valType sinX = glm::sin(angleX);
+ valType cosY = glm::cos(angleY);
+ valType sinY = glm::sin(angleY);
+
+ return detail::tmat4x4<valType>(
+ cosY, valType(0), sinY, valType(0),
+ -sinX * sinY, cosX, sinX * cosY, valType(0),
+ -cosX * sinY, -sinX, cosX * cosY, valType(0),
+ valType(0), valType(0), valType(0), valType(1));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tmat4x4<valType> eulerAngleXZ
+(
+ valType const & angleX,
+ valType const & angleZ
+)
+{
+ return eulerAngleX(angleX) * eulerAngleZ(angleZ);
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tmat4x4<valType> eulerAngleZX
+(
+ valType const & angleZ,
+ valType const & angleX
+)
+{
+ return eulerAngleZ(angleZ) * eulerAngleX(angleX);
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tmat4x4<valType> eulerAngleYXZ
+(
+ valType const & yaw,
+ valType const & pitch,
+ valType const & roll
+)
+{
+ valType tmp_ch = glm::cos(yaw);
+ valType tmp_sh = glm::sin(yaw);
+ valType tmp_cp = glm::cos(pitch);
+ valType tmp_sp = glm::sin(pitch);
+ valType tmp_cb = glm::cos(roll);
+ valType tmp_sb = glm::sin(roll);
+
+ detail::tmat4x4<valType> Result;
+ Result[0][0] = tmp_ch * tmp_cb + tmp_sh * tmp_sp * tmp_sb;
+ Result[0][1] = tmp_sb * tmp_cp;
+ Result[0][2] = -tmp_sh * tmp_cb + tmp_ch * tmp_sp * tmp_sb;
+ Result[0][3] = valType(0);
+ Result[1][0] = -tmp_ch * tmp_sb + tmp_sh * tmp_sp * tmp_cb;
+ Result[1][1] = tmp_cb * tmp_cp;
+ Result[1][2] = tmp_sb * tmp_sh + tmp_ch * tmp_sp * tmp_cb;
+ Result[1][3] = valType(0);
+ Result[2][0] = tmp_sh * tmp_cp;
+ Result[2][1] = -tmp_sp;
+ Result[2][2] = tmp_ch * tmp_cp;
+ Result[2][3] = valType(0);
+ Result[3][0] = valType(0);
+ Result[3][1] = valType(0);
+ Result[3][2] = valType(0);
+ Result[3][3] = valType(1);
+ return Result;
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tmat4x4<valType> yawPitchRoll
+(
+ valType const & yaw,
+ valType const & pitch,
+ valType const & roll
+)
+{
+ valType tmp_ch = glm::cos(yaw);
+ valType tmp_sh = glm::sin(yaw);
+ valType tmp_cp = glm::cos(pitch);
+ valType tmp_sp = glm::sin(pitch);
+ valType tmp_cb = glm::cos(roll);
+ valType tmp_sb = glm::sin(roll);
+
+ detail::tmat4x4<valType> Result;
+ Result[0][0] = tmp_ch * tmp_cb + tmp_sh * tmp_sp * tmp_sb;
+ Result[0][1] = tmp_sb * tmp_cp;
+ Result[0][2] = -tmp_sh * tmp_cb + tmp_ch * tmp_sp * tmp_sb;
+ Result[0][3] = valType(0);
+ Result[1][0] = -tmp_ch * tmp_sb + tmp_sh * tmp_sp * tmp_cb;
+ Result[1][1] = tmp_cb * tmp_cp;
+ Result[1][2] = tmp_sb * tmp_sh + tmp_ch * tmp_sp * tmp_cb;
+ Result[1][3] = valType(0);
+ Result[2][0] = tmp_sh * tmp_cp;
+ Result[2][1] = -tmp_sp;
+ Result[2][2] = tmp_ch * tmp_cp;
+ Result[2][3] = valType(0);
+ Result[3][0] = valType(0);
+ Result[3][1] = valType(0);
+ Result[3][2] = valType(0);
+ Result[3][3] = valType(1);
+ return Result;
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tmat2x2<valType> orientate2
+(
+ valType const & angle
+)
+{
+ valType c = glm::cos(angle);
+ valType s = glm::sin(angle);
+
+ detail::tmat2x2<valType> Result;
+ Result[0][0] = c;
+ Result[0][1] = s;
+ Result[1][0] = -s;
+ Result[1][1] = c;
+ return Result;
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tmat3x3<valType> orientate3
+(
+ valType const & angle
+)
+{
+ valType c = glm::cos(angle);
+ valType s = glm::sin(angle);
+
+ detail::tmat3x3<valType> Result;
+ Result[0][0] = c;
+ Result[0][1] = s;
+ Result[0][2] = 0.0f;
+ Result[1][0] = -s;
+ Result[1][1] = c;
+ Result[1][2] = 0.0f;
+ Result[2][0] = 0.0f;
+ Result[2][1] = 0.0f;
+ Result[2][2] = 1.0f;
+ return Result;
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tmat3x3<valType> orientate3
+(
+ detail::tvec3<valType> const & angles
+)
+{
+ return detail::tmat3x3<valType>(yawPitchRoll(angles.x, angles.y, angles.z));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tmat4x4<valType> orientate4
+(
+ detail::tvec3<valType> const & angles
+)
+{
+ return yawPitchRoll(angles.z, angles.x, angles.y);
+}
+
+}//namespace euler_angles
+}//namespace gtx
+}//namespace glm
diff --git a/src/glm/gtx/extend.hpp b/src/glm/gtx/extend.hpp
new file mode 100644
index 0000000..2b9ebf8
--- /dev/null
+++ b/src/glm/gtx/extend.hpp
@@ -0,0 +1,47 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2006-01-07
+// Updated : 2006-11-13
+// Licence : This source is under MIT License
+// File : glm/gtx/extend.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_gtx_extend
+#define glm_gtx_extend
+
+// Dependency:
+#include "../glm.hpp"
+
+#if(defined(GLM_MESSAGES) && !defined(glm_ext))
+# pragma message("GLM: GLM_GTX_extend extension included")
+#endif
+
+namespace glm{
+namespace gtx{
+namespace extend ///< GLM_GTX_extend extension: Extend a position from a source to a position at a defined length.
+{
+ /// \addtogroup gtx_extend
+ /// @{
+
+ //! Extends of Length the Origin position using the (Source - Origin) direction.
+ //! From GLM_GTX_extend extension.
+ template <typename genType>
+ genType extend(
+ genType const & Origin,
+ genType const & Source,
+ typename genType::value_type const Length);
+
+ /// @}
+}//namespace extend
+}//namespace gtx
+}//namespace glm
+
+#include "extend.inl"
+
+namespace glm{using namespace gtx::extend;}
+
+#endif//glm_gtx_extend
diff --git a/src/glm/gtx/extend.inl b/src/glm/gtx/extend.inl
new file mode 100644
index 0000000..8a193c0
--- /dev/null
+++ b/src/glm/gtx/extend.inl
@@ -0,0 +1,60 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2006-01-07
+// Updated : 2008-10-05
+// Licence : This source is under MIT License
+// File : glm/gtx/extend.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm{
+namespace gtx{
+namespace extend{
+
+template <typename genType>
+genType extend
+(
+ genType const & Origin,
+ genType const & Source,
+ genType const & Distance
+)
+{
+ return Origin + (Source - Origin) * Distance;
+}
+
+template <typename valType>
+detail::tvec2<valType> extend
+(
+ detail::tvec2<valType> const & Origin,
+ detail::tvec2<valType> const & Source,
+ valType const & Distance
+)
+{
+ return Origin + (Source - Origin) * Distance;
+}
+
+template <typename valType>
+detail::tvec3<valType> extend
+(
+ detail::tvec3<valType> const & Origin,
+ detail::tvec3<valType> const & Source,
+ valType const & Distance
+)
+{
+ return Origin + (Source - Origin) * Distance;
+}
+
+template <typename valType>
+detail::tvec4<valType> extend
+(
+ detail::tvec4<valType> const & Origin,
+ detail::tvec4<valType> const & Source,
+ valType const & Distance
+)
+{
+ return Origin + (Source - Origin) * Distance;
+}
+
+}//namespace extend
+}//namespace gtx
+}//namespace glm
diff --git a/src/glm/gtx/extented_min_max.hpp b/src/glm/gtx/extented_min_max.hpp
new file mode 100644
index 0000000..857c1f5
--- /dev/null
+++ b/src/glm/gtx/extented_min_max.hpp
@@ -0,0 +1,175 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2007-03-14
+// Updated : 2010-02-19
+// Licence : This source is under MIT License
+// File : gtx_extented_min_max.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+// - GLM_GTX_half_float
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_gtx_extented_min_max
+#define glm_gtx_extented_min_max
+
+// Dependency:
+#include "../glm.hpp"
+#include "../gtc/half_float.hpp"
+
+#if(defined(GLM_MESSAGES) && !defined(glm_ext))
+# pragma message("GLM: GLM_GTX_extented_min_max extension included")
+#endif
+
+namespace glm{
+namespace gtx{
+namespace extented_min_max ///< GLM_GTX_extented_min_max extension: Min and max functions for 3 to 4 parameters.
+{
+ /// \addtogroup gtx_extented_min_max
+ ///@{
+
+ //< Return the minimum component-wise values of 3 inputs
+ //< From GLM_GTX_extented_min_max extension
+ template <typename T>
+ T min(
+ T const & x,
+ T const & y,
+ T const & z);
+
+ //< Return the minimum component-wise values of 3 inputs
+ //< From GLM_GTX_extented_min_max extension
+ template
+ <
+ typename T,
+ template <typename> class C
+ >
+ C<T> min(
+ C<T> const & x,
+ typename C<T>::value_type const & y,
+ typename C<T>::value_type const & z);
+
+ //< Return the minimum component-wise values of 3 inputs
+ //< From GLM_GTX_extented_min_max extension
+ template
+ <
+ typename T,
+ template <typename> class C
+ >
+ C<T> min(
+ C<T> const & x,
+ C<T> const & y,
+ C<T> const & z);
+
+ //< Return the minimum component-wise values of 4 inputs
+ //< From GLM_GTX_extented_min_max extension
+ template <typename T>
+ T min(
+ T const & x,
+ T const & y,
+ T const & z,
+ T const & w);
+
+ //< Return the minimum component-wise values of 4 inputs
+ //< From GLM_GTX_extented_min_max extension
+ template
+ <
+ typename T,
+ template <typename> class C
+ >
+ C<T> min(
+ C<T> const & x,
+ typename C<T>::value_type const & y,
+ typename C<T>::value_type const & z,
+ typename C<T>::value_type const & w);
+
+ //< Return the minimum component-wise values of 4 inputs
+ //< From GLM_GTX_extented_min_max extension
+ template
+ <
+ typename T,
+ template <typename> class C
+ >
+ C<T> min(
+ C<T> const & x,
+ C<T> const & y,
+ C<T> const & z,
+ C<T> const & w);
+
+ //< Return the maximum component-wise values of 3 inputs
+ //< From GLM_GTX_extented_min_max extension
+ template <typename T>
+ T max(
+ T const & x,
+ T const & y,
+ T const & z);
+
+ //< Return the maximum component-wise values of 3 inputs
+ //< From GLM_GTX_extented_min_max extension
+ template
+ <
+ typename T,
+ template <typename> class C
+ >
+ C<T> max(
+ C<T> const & x,
+ typename C<T>::value_type const & y,
+ typename C<T>::value_type const & z);
+
+ //< Return the maximum component-wise values of 3 inputs
+ //< From GLM_GTX_extented_min_max extension
+ template
+ <
+ typename T,
+ template <typename> class C
+ >
+ C<T> max(
+ C<T> const & x,
+ C<T> const & y,
+ C<T> const & z);
+
+ //< Return the maximum component-wise values of 4 inputs
+ //< From GLM_GTX_extented_min_max extension
+ template <typename T>
+ T max(
+ T const & x,
+ T const & y,
+ T const & z,
+ T const & w);
+
+ //< Return the maximum component-wise values of 4 inputs
+ //< From GLM_GTX_extented_min_max extension
+ template
+ <
+ typename T,
+ template <typename> class C
+ >
+ C<T> max(
+ C<T> const & x,
+ typename C<T>::value_type const & y,
+ typename C<T>::value_type const & z,
+ typename C<T>::value_type const & w);
+
+ //< Return the maximum component-wise values of 4 inputs
+ //< From GLM_GTX_extented_min_max extension
+ template
+ <
+ typename T,
+ template <typename> class C
+ >
+ C<T> max(
+ C<T> const & x,
+ C<T> const & y,
+ C<T> const & z,
+ C<T> const & w);
+
+ /// @}
+}//namespace extented_min_max
+}//namespace gtx
+}//namespace glm
+
+#include "extented_min_max.inl"
+
+namespace glm{using namespace gtx::extented_min_max;}
+
+#endif//glm_gtx_extented_min_max
diff --git a/src/glm/gtx/extented_min_max.inl b/src/glm/gtx/extented_min_max.inl
new file mode 100644
index 0000000..caaf0c5
--- /dev/null
+++ b/src/glm/gtx/extented_min_max.inl
@@ -0,0 +1,182 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2007-03-14
+// Updated : 2010-02-19
+// Licence : This source is under MIT License
+// File : gtx_extented_min_max.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm{
+namespace gtx{
+namespace extented_min_max
+{
+ template <typename T>
+ GLM_FUNC_QUALIFIER T min(
+ T const & x,
+ T const & y,
+ T const & z)
+ {
+ return glm::min(glm::min(x, y), z);
+ }
+
+ template
+ <
+ typename T,
+ template <typename> class C
+ >
+ GLM_FUNC_QUALIFIER C<T> min
+ (
+ C<T> const & x,
+ typename C<T>::value_type const & y,
+ typename C<T>::value_type const & z
+ )
+ {
+ return glm::min(glm::min(x, y), z);
+ }
+
+ template
+ <
+ typename T,
+ template <typename> class C
+ >
+ GLM_FUNC_QUALIFIER C<T> min
+ (
+ C<T> const & x,
+ C<T> const & y,
+ C<T> const & z
+ )
+ {
+ return glm::min(glm::min(x, y), z);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER T min
+ (
+ T const & x,
+ T const & y,
+ T const & z,
+ T const & w
+ )
+ {
+ return glm::min(glm::min(x, y), glm::min(z, w));
+ }
+
+ template
+ <
+ typename T,
+ template <typename> class C
+ >
+ GLM_FUNC_QUALIFIER C<T> min
+ (
+ C<T> const & x,
+ typename C<T>::value_type const & y,
+ typename C<T>::value_type const & z,
+ typename C<T>::value_type const & w
+ )
+ {
+ return glm::min(glm::min(x, y), glm::min(z, w));
+ }
+
+ template
+ <
+ typename T,
+ template <typename> class C
+ >
+ GLM_FUNC_QUALIFIER C<T> min
+ (
+ C<T> const & x,
+ C<T> const & y,
+ C<T> const & z,
+ C<T> const & w
+ )
+ {
+ return glm::min(glm::min(x, y), glm::min(z, w));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER T max(
+ T const & x,
+ T const & y,
+ T const & z)
+ {
+ return glm::max(glm::max(x, y), z);
+ }
+
+ template
+ <
+ typename T,
+ template <typename> class C
+ >
+ GLM_FUNC_QUALIFIER C<T> max
+ (
+ C<T> const & x,
+ typename C<T>::value_type const & y,
+ typename C<T>::value_type const & z
+ )
+ {
+ return glm::max(glm::max(x, y), z);
+ }
+
+ template
+ <
+ typename T,
+ template <typename> class C
+ >
+ GLM_FUNC_QUALIFIER C<T> max
+ (
+ C<T> const & x,
+ C<T> const & y,
+ C<T> const & z
+ )
+ {
+ return glm::max(glm::max(x, y), z);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER T max
+ (
+ T const & x,
+ T const & y,
+ T const & z,
+ T const & w
+ )
+ {
+ return glm::max(glm::max(x, y), glm::max(z, w));
+ }
+
+ template
+ <
+ typename T,
+ template <typename> class C
+ >
+ GLM_FUNC_QUALIFIER C<T> max
+ (
+ C<T> const & x,
+ typename C<T>::value_type const & y,
+ typename C<T>::value_type const & z,
+ typename C<T>::value_type const & w
+ )
+ {
+ return glm::max(glm::max(x, y), glm::max(z, w));
+ }
+
+ template
+ <
+ typename T,
+ template <typename> class C
+ >
+ GLM_FUNC_QUALIFIER C<T> max
+ (
+ C<T> const & x,
+ C<T> const & y,
+ C<T> const & z,
+ C<T> const & w
+ )
+ {
+ return glm::max(glm::max(x, y), glm::max(z, w));
+ }
+
+}//namespace extented_min_max
+}//namespace gtx
+}//namespace glm
diff --git a/src/glm/gtx/fast_exponential.hpp b/src/glm/gtx/fast_exponential.hpp
new file mode 100644
index 0000000..c7ec5bd
--- /dev/null
+++ b/src/glm/gtx/fast_exponential.hpp
@@ -0,0 +1,81 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2006-01-09
+// Updated : 2006-11-13
+// Licence : This source is under MIT License
+// File : glm/gtx/fast_exponential.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+// - GLM_GTC_half_float
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_gtx_fast_exponential
+#define glm_gtx_fast_exponential
+
+// Dependency:
+#include "../glm.hpp"
+#include "../gtc/half_float.hpp"
+
+#if(defined(GLM_MESSAGES) && !defined(glm_ext))
+# pragma message("GLM: GLM_GTX_fast_exponential extension included")
+#endif
+
+namespace glm{
+namespace gtx{
+namespace fast_exponential ///< GLM_GTX_fast_exponential extension: Fast but less accurate implementations of exponential based functions.
+{
+ using namespace gtc::half_float;
+ /// \addtogroup gtx_fast_exponential
+ /// @{
+
+ //! Faster than the common pow function but less accurate.
+ //! From GLM_GTX_fast_exponential extension.
+ template <typename valType>
+ valType fastPow(
+ valType const & x,
+ valType const & y);
+
+ //! Faster than the common pow function but less accurate.
+ //! From GLM_GTX_fast_exponential extension.
+ template <typename T, typename U>
+ T fastPow(
+ const T& x,
+ const U& y);
+
+ //! Faster than the common exp function but less accurate.
+ //! From GLM_GTX_fast_exponential extension.
+ template <typename T>
+ T fastExp(const T& x);
+
+ //! Faster than the common log function but less accurate.
+ //! From GLM_GTX_fast_exponential extension.
+ template <typename T>
+ T fastLog(const T& x);
+
+ //! Faster than the common exp2 function but less accurate.
+ //! From GLM_GTX_fast_exponential extension.
+ template <typename T>
+ T fastExp2(const T& x);
+
+ //! Faster than the common log2 function but less accurate.
+ //! From GLM_GTX_fast_exponential extension.
+ template <typename T>
+ T fastLog2(const T& x);
+
+ //! Faster than the common ln function but less accurate.
+ //! From GLM_GTX_fast_exponential extension.
+ template <typename T>
+ T fastLn(const T& x);
+
+ /// @}
+}//namespace fast_exponential
+}//namespace gtx
+}//namespace glm
+
+#include "fast_exponential.inl"
+
+namespace glm{using namespace gtx::fast_exponential;}
+
+#endif//glm_gtx_fast_exponential
diff --git a/src/glm/gtx/fast_exponential.inl b/src/glm/gtx/fast_exponential.inl
new file mode 100644
index 0000000..59c0397
--- /dev/null
+++ b/src/glm/gtx/fast_exponential.inl
@@ -0,0 +1,294 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2006-01-09
+// Updated : 2006-01-09
+// Licence : This source is under MIT License
+// File : glm/gtx/fast_exponential.h
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm{
+namespace gtx{
+namespace fast_exponential
+{
+ // fastPow:
+ template <typename T>
+ GLM_FUNC_QUALIFIER T fastPow(const T x, const T y)
+ {
+ return exp(y * log(x));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> fastPow(
+ const detail::tvec2<T>& x,
+ const detail::tvec2<T>& y)
+ {
+ return detail::tvec2<T>(
+ fastPow(x.x, y.x),
+ fastPow(x.y, y.y));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> fastPow(
+ const detail::tvec3<T>& x,
+ const detail::tvec3<T>& y)
+ {
+ return detail::tvec3<T>(
+ fastPow(x.x, y.x),
+ fastPow(x.y, y.y),
+ fastPow(x.z, y.z));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> fastPow(
+ const detail::tvec4<T>& x,
+ const detail::tvec4<T>& y)
+ {
+ return detail::tvec4<T>(
+ fastPow(x.x, y.x),
+ fastPow(x.y, y.y),
+ fastPow(x.z, y.z),
+ fastPow(x.w, y.w));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER T fastPow(const T x, int y)
+ {
+ T f = T(1);
+ for(int i = 0; i < y; ++i)
+ f *= x;
+ return f;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> fastPow(
+ const detail::tvec2<T>& x,
+ const detail::tvec2<int>& y)
+ {
+ return detail::tvec2<T>(
+ fastPow(x.x, y.x),
+ fastPow(x.y, y.y));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> fastPow(
+ const detail::tvec3<T>& x,
+ const detail::tvec3<int>& y)
+ {
+ return detail::tvec3<T>(
+ fastPow(x.x, y.x),
+ fastPow(x.y, y.y),
+ fastPow(x.z, y.z));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> fastPow(
+ const detail::tvec4<T>& x,
+ const detail::tvec4<int>& y)
+ {
+ return detail::tvec4<T>(
+ fastPow(x.x, y.x),
+ fastPow(x.y, y.y),
+ fastPow(x.z, y.z),
+ fastPow(x.w, y.w));
+ }
+
+ // fastExp
+ // Note: This function provides accurate results only for value between -1 and 1, else avoid it.
+ template <typename T>
+ GLM_FUNC_QUALIFIER T fastExp(const T x)
+ {
+ // This has a better looking and same performance in release mode than the following code. However, in debug mode it's slower.
+ // return 1.0f + x * (1.0f + x * 0.5f * (1.0f + x * 0.3333333333f * (1.0f + x * 0.25 * (1.0f + x * 0.2f))));
+ T x2 = x * x;
+ T x3 = x2 * x;
+ T x4 = x3 * x;
+ T x5 = x4 * x;
+ return T(1) + x + (x2 * T(0.5)) + (x3 * T(0.1666666667)) + (x4 * T(0.041666667)) + (x5 * T(0.008333333333));
+ }
+/* // Try to handle all values of float... but often shower than std::exp, glm::floor and the loop kill the performance
+ GLM_FUNC_QUALIFIER float fastExp(float x)
+ {
+ const float e = 2.718281828f;
+ const float IntegerPart = floor(x);
+ const float FloatPart = x - IntegerPart;
+ float z = 1.f;
+
+ for(int i = 0; i < int(IntegerPart); ++i)
+ z *= e;
+
+ const float x2 = FloatPart * FloatPart;
+ const float x3 = x2 * FloatPart;
+ const float x4 = x3 * FloatPart;
+ const float x5 = x4 * FloatPart;
+ return z * (1.0f + FloatPart + (x2 * 0.5f) + (x3 * 0.1666666667f) + (x4 * 0.041666667f) + (x5 * 0.008333333333f));
+ }
+
+ // Increase accuracy on number bigger that 1 and smaller than -1 but it's not enough for high and negative numbers
+ GLM_FUNC_QUALIFIER float fastExp(float x)
+ {
+ // This has a better looking and same performance in release mode than the following code. However, in debug mode it's slower.
+ // return 1.0f + x * (1.0f + x * 0.5f * (1.0f + x * 0.3333333333f * (1.0f + x * 0.25 * (1.0f + x * 0.2f))));
+ float x2 = x * x;
+ float x3 = x2 * x;
+ float x4 = x3 * x;
+ float x5 = x4 * x;
+ float x6 = x5 * x;
+ float x7 = x6 * x;
+ float x8 = x7 * x;
+ return 1.0f + x + (x2 * 0.5f) + (x3 * 0.1666666667f) + (x4 * 0.041666667f) + (x5 * 0.008333333333f)+ (x6 * 0.00138888888888f) + (x7 * 0.000198412698f) + (x8 * 0.0000248015873f);;
+ }
+*/
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> fastExp(
+ const detail::tvec2<T>& x)
+ {
+ return detail::tvec2<T>(
+ fastExp(x.x),
+ fastExp(x.y));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> fastExp(
+ const detail::tvec3<T>& x)
+ {
+ return detail::tvec3<T>(
+ fastExp(x.x),
+ fastExp(x.y),
+ fastExp(x.z));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> fastExp(
+ const detail::tvec4<T>& x)
+ {
+ return detail::tvec4<T>(
+ fastExp(x.x),
+ fastExp(x.y),
+ fastExp(x.z),
+ fastExp(x.w));
+ }
+
+ // fastLog
+ template <typename T>
+ GLM_FUNC_QUALIFIER T fastLog(const T x)
+ {
+ return std::log(x);
+ }
+
+ /* Slower than the VC7.1 function...
+ GLM_FUNC_QUALIFIER float fastLog(float x)
+ {
+ float y1 = (x - 1.0f) / (x + 1.0f);
+ float y2 = y1 * y1;
+ return 2.0f * y1 * (1.0f + y2 * (0.3333333333f + y2 * (0.2f + y2 * 0.1428571429f)));
+ }
+ */
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> fastLog(
+ const detail::tvec2<T>& x)
+ {
+ return detail::tvec2<T>(
+ fastLog(x.x),
+ fastLog(x.y));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> fastLog(
+ const detail::tvec3<T>& x)
+ {
+ return detail::tvec3<T>(
+ fastLog(x.x),
+ fastLog(x.y),
+ fastLog(x.z));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> fastLog(
+ const detail::tvec4<T>& x)
+ {
+ return detail::tvec4<T>(
+ fastLog(x.x),
+ fastLog(x.y),
+ fastLog(x.z),
+ fastLog(x.w));
+ }
+
+ //fastExp2, ln2 = 0.69314718055994530941723212145818f
+ template <typename T>
+ GLM_FUNC_QUALIFIER T fastExp2(const T x)
+ {
+ return fastExp(0.69314718055994530941723212145818f * x);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> fastExp2(
+ const detail::tvec2<T>& x)
+ {
+ return detail::tvec2<T>(
+ fastExp2(x.x),
+ fastExp2(x.y));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> fastExp2(
+ const detail::tvec3<T>& x)
+ {
+ return detail::tvec3<T>(
+ fastExp2(x.x),
+ fastExp2(x.y),
+ fastExp2(x.z));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> fastExp2(
+ const detail::tvec4<T>& x)
+ {
+ return detail::tvec4<T>(
+ fastExp2(x.x),
+ fastExp2(x.y),
+ fastExp2(x.z),
+ fastExp2(x.w));
+ }
+
+ // fastLog2, ln2 = 0.69314718055994530941723212145818f
+ template <typename T>
+ GLM_FUNC_QUALIFIER T fastLog2(const T x)
+ {
+ return fastLog(x) / 0.69314718055994530941723212145818f;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> fastLog2(
+ const detail::tvec2<T>& x)
+ {
+ return detail::tvec2<T>(
+ fastLog2(x.x),
+ fastLog2(x.y));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> fastLog2(
+ const detail::tvec3<T>& x)
+ {
+ return detail::tvec3<T>(
+ fastLog2(x.x),
+ fastLog2(x.y),
+ fastLog2(x.z));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> fastLog2(
+ const detail::tvec4<T>& x)
+ {
+ return detail::tvec4<T>(
+ fastLog2(x.x),
+ fastLog2(x.y),
+ fastLog2(x.z),
+ fastLog2(x.w));
+ }
+
+}//namespace fast_exponential
+}//namespace gtx
+}//namespace glm
diff --git a/src/glm/gtx/fast_square_root.hpp b/src/glm/gtx/fast_square_root.hpp
new file mode 100644
index 0000000..c9ded29
--- /dev/null
+++ b/src/glm/gtx/fast_square_root.hpp
@@ -0,0 +1,68 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2006-01-04
+// Updated : 2008-10-07
+// Licence : This source is under MIT License
+// File : glm/gtx/fast_square_root.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Note:
+// - Sqrt optimisation based on Newton's method,
+// www.gamedev.net/community/forums/topic.asp?topic id=139956
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_gtx_fast_square_root
+#define glm_gtx_fast_square_root
+
+// Dependency:
+#include "../glm.hpp"
+
+#if(defined(GLM_MESSAGES) && !defined(glm_ext))
+# pragma message("GLM: GLM_GTX_fast_square_root extension included")
+#endif
+
+namespace glm{
+namespace gtx{
+namespace fast_square_root ///< GLM_GTX_fast_square_root extension: Fast but less accurate implementations of square root based functions.
+{
+ /// \addtogroup gtx_fast_square_root
+ /// @{
+
+ //! Faster than the common sqrt function but less accurate.
+ //! From GLM_GTX_fast_square_root extension.
+ template <typename genType>
+ genType fastSqrt(genType const & x);
+
+ //! Faster than the common inversesqrt function but less accurate.
+ //! From GLM_GTX_fast_square_root extension.
+ template <typename genType>
+ genType fastInverseSqrt(genType const & x);
+
+ //! Faster than the common length function but less accurate.
+ //! From GLM_GTX_fast_square_root extension.
+ template <typename genType>
+ typename genType::value_type fastLength(genType const & x);
+
+ //! Faster than the common distance function but less accurate.
+ //! From GLM_GTX_fast_square_root extension.
+ template <typename genType>
+ typename genType::value_type fastDistance(genType const & x, genType const & y);
+
+ //! Faster than the common normalize function but less accurate.
+ //! From GLM_GTX_fast_square_root extension.
+ template <typename genType>
+ genType fastNormalize(genType const & x);
+
+ /// @}
+}// namespace fast_square_root
+}// namespace gtx
+}// namespace glm
+
+#include "fast_square_root.inl"
+
+namespace glm{using namespace gtx::fast_square_root;}
+
+#endif//glm_gtx_fast_square_root
diff --git a/src/glm/gtx/fast_square_root.inl b/src/glm/gtx/fast_square_root.inl
new file mode 100644
index 0000000..76d0e15
--- /dev/null
+++ b/src/glm/gtx/fast_square_root.inl
@@ -0,0 +1,237 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2006-01-04
+// Updated : 2008-10-07
+// Licence : This source is under MIT License
+// File : glm/gtx/fast_square_root.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm{
+namespace gtx{
+namespace fast_square_root{
+
+// fastSqrt
+template <typename genType>
+GLM_FUNC_QUALIFIER genType fastSqrt
+(
+ genType const & x
+)
+{
+ return genType(1) / fastInverseSqrt(x);
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec2<valType> fastSqrt
+(
+ detail::tvec2<valType> const & x
+)
+{
+ return detail::tvec2<valType>(
+ fastSqrt(x.x),
+ fastSqrt(x.y));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec3<valType> fastSqrt
+(
+ detail::tvec3<valType> const & x
+)
+{
+ return detail::tvec3<valType>(
+ fastSqrt(x.x),
+ fastSqrt(x.y),
+ fastSqrt(x.z));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec4<valType> fastSqrt
+(
+ detail::tvec4<valType> const & x
+)
+{
+ return detail::tvec4<valType>(
+ fastSqrt(x.x),
+ fastSqrt(x.y),
+ fastSqrt(x.z),
+ fastSqrt(x.w));
+}
+
+// fastInversesqrt
+template <typename genType>
+GLM_FUNC_QUALIFIER genType fastInverseSqrt
+(
+ genType const & x
+)
+{
+ genType tmp = x;
+ float xhalf = 0.5f * float(tmp);
+ uint i = *(uint*)&x;
+ i = 0x5f375a86 - (i >> 1);
+ //x = *(float*)&i;
+ //x = *((float*)(char*)&i);
+ tmp = detail::uif(i).f;
+ tmp = tmp * (1.5f - xhalf * tmp * tmp);
+ return genType(tmp);
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec2<valType> fastInverseSqrt
+(
+ detail::tvec2<valType> const & x
+)
+{
+ return detail::tvec2<valType>(
+ fastInverseSqrt(x.x),
+ fastInverseSqrt(x.y));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec3<valType> fastInverseSqrt
+(
+ detail::tvec3<valType> const & x
+)
+{
+ return detail::tvec3<valType>(
+ fastInverseSqrt(x.x),
+ fastInverseSqrt(x.y),
+ fastInverseSqrt(x.z));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec4<valType> fastInverseSqrt
+(
+ detail::tvec4<valType> const & x
+)
+{
+ return detail::tvec4<valType>(
+ fastInverseSqrt(x.x),
+ fastInverseSqrt(x.y),
+ fastInverseSqrt(x.z),
+ fastInverseSqrt(x.w));
+}
+
+// fastLength
+template <typename genType>
+GLM_FUNC_QUALIFIER genType fastLength
+(
+ genType const & x
+)
+{
+ return abs(x);
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER valType fastLength
+(
+ detail::tvec2<valType> const & x
+)
+{
+ valType sqr = x.x * x.x + x.y * x.y;
+ return fastSqrt(sqr);
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER valType fastLength
+(
+ detail::tvec3<valType> const & x
+)
+{
+ valType sqr = x.x * x.x + x.y * x.y + x.z * x.z;
+ return fastSqrt(sqr);
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER valType fastLength
+(
+ detail::tvec4<valType> const & x
+)
+{
+ valType sqr = x.x * x.x + x.y * x.y + x.z * x.z + x.w * x.w;
+ return fastSqrt(sqr);
+}
+
+// fastDistance
+template <typename genType>
+GLM_FUNC_QUALIFIER genType fastDistance
+(
+ genType const & x,
+ genType const & y
+)
+{
+ return fastLength(y - x);
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER valType fastDistance
+(
+ detail::tvec2<valType> const & x,
+ detail::tvec2<valType> const & y
+)
+{
+ return fastLength(y - x);
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER valType fastDistance
+(
+ detail::tvec3<valType> const & x,
+ detail::tvec3<valType> const & y
+)
+{
+ return fastLength(y - x);
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER valType fastDistance
+(
+ detail::tvec4<valType> const & x,
+ detail::tvec4<valType> const & y
+)
+{
+ return fastLength(y - x);
+}
+
+// fastNormalize
+template <typename genType>
+GLM_FUNC_QUALIFIER genType fastNormalize
+(
+ genType const & x
+)
+{
+ return x > genType(0) ? genType(1) : -genType(1);
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec2<valType> fastNormalize
+(
+ detail::tvec2<valType> const & x
+)
+{
+ valType sqr = x.x * x.x + x.y * x.y;
+ return x * fastInverseSqrt(sqr);
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec3<valType> fastNormalize
+(
+ detail::tvec3<valType> const & x
+)
+{
+ valType sqr = x.x * x.x + x.y * x.y + x.z * x.z;
+ return x * fastInverseSqrt(sqr);
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec4<valType> fastNormalize
+(
+ detail::tvec4<valType> const & x
+)
+{
+ valType sqr = x.x * x.x + x.y * x.y + x.z * x.z + x.w * x.w;
+ return x * fastInverseSqrt(sqr);
+}
+
+}//namespace fast_square_root
+}//namespace gtx
+}//namespace glm
diff --git a/src/glm/gtx/fast_trigonometry.hpp b/src/glm/gtx/fast_trigonometry.hpp
new file mode 100644
index 0000000..d597df2
--- /dev/null
+++ b/src/glm/gtx/fast_trigonometry.hpp
@@ -0,0 +1,81 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2006-01-08
+// Updated : 2006-11-13
+// Licence : This source is under MIT License
+// File : glm/gtx/fast_trigonometry.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_gtx_fast_trigonometry
+#define glm_gtx_fast_trigonometry
+
+// Dependency:
+#include "../glm.hpp"
+
+#if(defined(GLM_MESSAGES) && !defined(glm_ext))
+# pragma message("GLM: GLM_GTX_fast_trigonometry extension included")
+#endif
+
+namespace glm{
+namespace gtx{
+namespace fast_trigonometry ///< GLM_GTX_fast_trigonometry extension: Fast but less accurate implementations of trigonometric functions.
+{
+ /// \addtogroup gtx_fast_trigonometry
+ /// @{
+
+ //! Faster than the common sin function but less accurate.
+ //! Defined between -2pi and 2pi.
+ //! From GLM_GTX_fast_trigonometry extension.
+ template <typename T>
+ T fastSin(const T& angle);
+
+ //! Faster than the common cos function but less accurate.
+ //! Defined between -2pi and 2pi.
+ //! From GLM_GTX_fast_trigonometry extension.
+ template <typename T>
+ T fastCos(const T& angle);
+
+ //! Faster than the common tan function but less accurate.
+ //! Defined between -2pi and 2pi.
+ //! From GLM_GTX_fast_trigonometry extension.
+ template <typename T>
+ T fastTan(const T& angle);
+
+ //! Faster than the common asin function but less accurate.
+ //! Defined between -2pi and 2pi.
+ //! From GLM_GTX_fast_trigonometry extension.
+ template <typename T>
+ T fastAsin(const T& angle);
+
+ //! Faster than the common acos function but less accurate.
+ //! Defined between -2pi and 2pi.
+ //! From GLM_GTX_fast_trigonometry extension.
+ template <typename T>
+ T fastAcos(const T& angle);
+
+ //! Faster than the common atan function but less accurate.
+ //! Defined between -2pi and 2pi.
+ //! From GLM_GTX_fast_trigonometry extension.
+ template <typename T>
+ T fastAtan(const T& y, const T& x);
+
+ //! Faster than the common atan function but less accurate.
+ //! Defined between -2pi and 2pi.
+ //! From GLM_GTX_fast_trigonometry extension.
+ template <typename T>
+ T fastAtan(const T& angle);
+
+ /// @}
+}//namespace fast_trigonometry
+}//namespace gtx
+}//namespace glm
+
+#include "fast_trigonometry.inl"
+
+namespace glm{using namespace gtx::fast_trigonometry;}
+
+#endif//glm_gtx_fast_trigonometry
diff --git a/src/glm/gtx/fast_trigonometry.inl b/src/glm/gtx/fast_trigonometry.inl
new file mode 100644
index 0000000..3f3750f
--- /dev/null
+++ b/src/glm/gtx/fast_trigonometry.inl
@@ -0,0 +1,272 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2006-01-08
+// Updated : 2006-01-08
+// Licence : This source is under MIT License
+// File : glm/gtx/fast_trigonometry.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm{
+namespace gtx{
+namespace fast_trigonometry
+{
+ // sin
+ template <typename T>
+ GLM_FUNC_QUALIFIER T fastSin(const T x)
+ {
+ return x - ((x * x * x) / T(6)) + ((x * x * x * x * x) / T(120)) - ((x * x * x * x * x * x * x) / T(5040));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> fastSin(
+ const detail::tvec2<T>& x)
+ {
+ return detail::tvec2<T>(
+ fastSin(x.x),
+ fastSin(x.y));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> fastSin(
+ const detail::tvec3<T>& x)
+ {
+ return detail::tvec3<T>(
+ fastSin(x.x),
+ fastSin(x.y),
+ fastSin(x.z));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> fastSin(
+ const detail::tvec4<T>& x)
+ {
+ return detail::tvec4<T>(
+ fastSin(x.x),
+ fastSin(x.y),
+ fastSin(x.z),
+ fastSin(x.w));
+ }
+
+ // cos
+ template <typename T>
+ GLM_FUNC_QUALIFIER T fastCos(const T x)
+ {
+ return T(1) - (x * x * T(0.5)) + (x * x * x * x * T(0.041666666666)) - (x * x * x * x * x * x * T(0.00138888888888));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> fastCos(
+ const detail::tvec2<T>& x)
+ {
+ return detail::tvec2<T>(
+ fastCos(x.x),
+ fastCos(x.y));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> fastCos(
+ const detail::tvec3<T>& x)
+ {
+ return detail::tvec3<T>(
+ fastCos(x.x),
+ fastCos(x.y),
+ fastCos(x.z));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> fastCos(
+ const detail::tvec4<T>& x)
+ {
+ return detail::tvec4<T>(
+ fastCos(x.x),
+ fastCos(x.y),
+ fastCos(x.z),
+ fastCos(x.w));
+ }
+
+ // tan
+ template <typename T>
+ GLM_FUNC_QUALIFIER T fastTan(const T x)
+ {
+ return x + (x * x * x * T(0.3333333333)) + (x * x * x * x * x * T(0.1333333333333)) + (x * x * x * x * x * x * x * T(0.0539682539));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> fastTan(
+ const detail::tvec2<T>& x)
+ {
+ return detail::tvec2<T>(
+ fastTan(x.x),
+ fastTan(x.y));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> fastTan(
+ const detail::tvec3<T>& x)
+ {
+ return detail::tvec3<T>(
+ fastTan(x.x),
+ fastTan(x.y),
+ fastTan(x.z));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> fastTan(
+ const detail::tvec4<T>& x)
+ {
+ return detail::tvec4<T>(
+ fastTan(x.x),
+ fastTan(x.y),
+ fastTan(x.z),
+ fastTan(x.w));
+ }
+
+ // asin
+ template <typename T>
+ GLM_FUNC_QUALIFIER T fastAsin(const T x)
+ {
+ return x + (x * x * x * T(0.166666667)) + (x * x * x * x * x * T(0.075)) + (x * x * x * x * x * x * x * T(0.0446428571)) + (x * x * x * x * x * x * x * x * x * T(0.0303819444));// + (x * x * x * x * x * x * x * x * x * x * x * T(0.022372159));
+ }
+
+ template <typename T> detail::tvec2<T> fastAsin(
+ const detail::tvec2<T>& x)
+ {
+ return detail::tvec2<T>(
+ fastAsin(x.x),
+ fastAsin(x.y));
+ }
+
+ template <typename T> detail::tvec3<T> fastAsin(
+ const detail::tvec3<T>& x)
+ {
+ return detail::tvec3<T>(
+ fastAsin(x.x),
+ fastAsin(x.y),
+ fastAsin(x.z));
+ }
+
+ template <typename T> detail::tvec4<T> fastAsin(
+ const detail::tvec4<T>& x)
+ {
+ return detail::tvec4<T>(
+ fastAsin(x.x),
+ fastAsin(x.y),
+ fastAsin(x.z),
+ fastAsin(x.w));
+ }
+
+ // acos
+ template <typename T>
+ GLM_FUNC_QUALIFIER T fastAcos(const T x)
+ {
+ return T(1.5707963267948966192313216916398) - fastAsin(x); //(PI / 2)
+ }
+
+ template <typename T> detail::tvec2<T> fastAcos(
+ const detail::tvec2<T>& x)
+ {
+ return detail::tvec2<T>(
+ fastAcos(x.x),
+ fastAcos(x.y));
+ }
+
+ template <typename T> detail::tvec3<T> fastAcos(
+ const detail::tvec3<T>& x)
+ {
+ return detail::tvec3<T>(
+ fastAcos(x.x),
+ fastAcos(x.y),
+ fastAcos(x.z));
+ }
+
+ template <typename T> detail::tvec4<T> fastAcos(
+ const detail::tvec4<T>& x)
+ {
+ return detail::tvec4<T>(
+ fastAcos(x.x),
+ fastAcos(x.y),
+ fastAcos(x.z),
+ fastAcos(x.w));
+ }
+
+ // atan
+ template <typename T>
+ GLM_FUNC_QUALIFIER T fastAtan(const T y, const T x)
+ {
+ T sgn = sign(y) * sign(x);
+ return abs(fastAtan(y / x)) * sgn;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> fastAtan(
+ const detail::tvec2<T>& y,
+ const detail::tvec2<T>& x)
+ {
+ return detail::tvec2<T>(
+ fastAtan(y.x, x.x),
+ fastAtan(y.y, x.y));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> fastAtan(
+ const detail::tvec3<T>& y,
+ const detail::tvec3<T>& x)
+ {
+ return detail::tvec3<T>(
+ fastAtan(y.x, x.x),
+ fastAtan(y.y, x.y),
+ fastAtan(y.z, x.z));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> fastAtan(
+ const detail::tvec4<T>& y,
+ const detail::tvec4<T>& x)
+ {
+ return detail::tvec4<T>(
+ fastAtan(y.x, x.x),
+ fastAtan(y.y, x.y),
+ fastAtan(y.z, x.z),
+ fastAtan(y.w, x.w));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER T fastAtan(const T x)
+ {
+ return x - (x * x * x * T(0.333333333333)) + (x * x * x * x * x * T(0.2)) - (x * x * x * x * x * x * x * T(0.1428571429)) + (x * x * x * x * x * x * x * x * x * T(0.111111111111)) - (x * x * x * x * x * x * x * x * x * x * x * T(0.0909090909));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> fastAtan(
+ const detail::tvec2<T>& x)
+ {
+ return detail::tvec2<T>(
+ fastAtan(x.x),
+ fastAtan(x.y));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> fastAtan(
+ const detail::tvec3<T>& x)
+ {
+ return detail::tvec3<T>(
+ fastAtan(x.x),
+ fastAtan(x.y),
+ fastAtan(x.z));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> fastAtan(
+ const detail::tvec4<T>& x)
+ {
+ return detail::tvec4<T>(
+ fastAtan(x.x),
+ fastAtan(x.y),
+ fastAtan(x.z),
+ fastAtan(x.w));
+ }
+
+}//namespace fast_trigonometry
+}//namespace gtx
+}//namespace glm
diff --git a/src/glm/gtx/gradient_paint.hpp b/src/glm/gtx/gradient_paint.hpp
new file mode 100644
index 0000000..389600a
--- /dev/null
+++ b/src/glm/gtx/gradient_paint.hpp
@@ -0,0 +1,55 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2009-03-06
+// Updated : 2009-03-09
+// Licence : This source is under MIT License
+// File : glm/gtx/gradient_paint.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_gtx_gradient_paint
+#define glm_gtx_gradient_paint
+
+// Dependency:
+#include "../glm.hpp"
+#include "../gtx/optimum_pow.hpp"
+
+#if(defined(GLM_MESSAGES) && !defined(glm_ext))
+# pragma message("GLM: GLM_GTX_gradient_paint extension included")
+#endif
+
+namespace glm{
+namespace gtx{
+namespace gradient_paint ///< GLM_GTX_gradient_paint extension: Compute a radient gradient according section OpenVG 1.1 specifications, 9.3.2 Radial Gradients
+{
+ using namespace gtx::optimum_pow;
+
+ /// \addtogroup gtx_gradient_paint
+ /// @{
+
+ template <typename valType>
+ valType radialGradient(
+ glm::detail::tvec2<valType> const & Center,
+ valType const & Radius,
+ glm::detail::tvec2<valType> const & Focal,
+ glm::detail::tvec2<valType> const & Position);
+
+ template <typename valType>
+ valType linearGradient(
+ glm::detail::tvec2<valType> const & Point0,
+ glm::detail::tvec2<valType> const & Point1,
+ glm::detail::tvec2<valType> const & Position);
+
+ /// @}
+}// namespace gradient_paint
+}// namespace gtx
+}// namespace glm
+
+#include "gradient_paint.inl"
+
+namespace glm{using namespace gtx::gradient_paint;}
+
+#endif//glm_gtx_gradient_paint
diff --git a/src/glm/gtx/gradient_paint.inl b/src/glm/gtx/gradient_paint.inl
new file mode 100644
index 0000000..6967ff4
--- /dev/null
+++ b/src/glm/gtx/gradient_paint.inl
@@ -0,0 +1,44 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2009-03-06
+// Updated : 2009-03-09
+// Licence : This source is under MIT License
+// File : glm/gtx/gradient_paint.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm{
+namespace gtx{
+namespace gradient_paint{
+
+ template <typename valType>
+ valType radialGradient(
+ glm::detail::tvec2<valType> const & Center,
+ valType const & Radius,
+ glm::detail::tvec2<valType> const & Focal,
+ glm::detail::tvec2<valType> const & Position)
+ {
+ glm::detail::tvec2<valType> F = Focal - Center;
+ glm::detail::tvec2<valType> D = Position - Focal;
+ valType Radius2 = gtx::optimum_pow::pow2(Radius);
+ valType Fx2 = gtx::optimum_pow::pow2(F.x);
+ valType Fy2 = gtx::optimum_pow::pow2(F.y);
+
+ valType Numerator = (D.x * F.x + D.y * F.y) + glm::sqrt(Radius2 * (gtx::optimum_pow::pow2(D.x) + gtx::optimum_pow::pow2(D.y)) - gtx::optimum_pow::pow2(D.x * F.y - D.y * F.x));
+ valType Denominator = Radius2 - (Fx2 + Fy2);
+ return Numerator / Denominator;
+ }
+
+ template <typename valType>
+ valType linearGradient(
+ glm::detail::tvec2<valType> const & Point0,
+ glm::detail::tvec2<valType> const & Point1,
+ glm::detail::tvec2<valType> const & Position)
+ {
+ glm::detail::tvec2<valType> Dist = Point1 - Point0;
+ return (Dist.x * (Position.x - Point0.x) + Dist.y * (Position.y - Point0.y)) / glm::dot(Dist, Dist);
+ }
+
+}//namespace gradient_paint
+}//namespace gtx
+}//namespace glm
diff --git a/src/glm/gtx/handed_coordinate_space.hpp b/src/glm/gtx/handed_coordinate_space.hpp
new file mode 100644
index 0000000..05d5f89
--- /dev/null
+++ b/src/glm/gtx/handed_coordinate_space.hpp
@@ -0,0 +1,55 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2005-12-21
+// Updated : 2009-02-19
+// Licence : This source is under MIT License
+// File : glm/gtx/handed_coordinate_space.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_gtx_handed_coordinate_space
+#define glm_gtx_handed_coordinate_space
+
+// Dependency:
+#include "../glm.hpp"
+
+#if(defined(GLM_MESSAGES) && !defined(glm_ext))
+# pragma message("GLM: GLM_GTX_handed_coordinate_space extension included")
+#endif
+
+namespace glm{
+namespace gtx{
+namespace handed_coordinate_space ///< GLM_GTX_handed_coordinate_space extension: To know if a set of three basis vectors defines a right or left-handed coordinate system.
+{
+ /// \addtogroup gtx_handed_coordinate_space
+ /// @{
+
+ //! Return if a trihedron right handed or not.
+ //! From GLM_GTX_handed_coordinate_space extension.
+ template <typename T>
+ bool rightHanded(
+ detail::tvec3<T> const & tangent,
+ detail::tvec3<T> const & binormal,
+ detail::tvec3<T> const & normal);
+
+ //! Return if a trihedron left handed or not.
+ //! From GLM_GTX_handed_coordinate_space extension.
+ template <typename T>
+ bool leftHanded(
+ detail::tvec3<T> const & tangent,
+ detail::tvec3<T> const & binormal,
+ detail::tvec3<T> const & normal);
+
+ /// @}
+}// namespace handed_coordinate_space
+}// namespace gtx
+}// namespace glm
+
+#include "handed_coordinate_space.inl"
+
+namespace glm{using namespace gtx::handed_coordinate_space;}
+
+#endif//glm_gtx_handed_coordinate_space
diff --git a/src/glm/gtx/handed_coordinate_space.inl b/src/glm/gtx/handed_coordinate_space.inl
new file mode 100644
index 0000000..fb7bae7
--- /dev/null
+++ b/src/glm/gtx/handed_coordinate_space.inl
@@ -0,0 +1,34 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2005-12-21
+// Updated : 2009-02-19
+// Licence : This source is under MIT License
+// File : glm/gtx/handed_coordinate_space.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm{
+namespace gtx{
+namespace handed_coordinate_space
+{
+ template <typename T>
+ GLM_FUNC_QUALIFIER bool rightHanded(
+ detail::tvec3<T> const & tangent,
+ detail::tvec3<T> const & binormal,
+ detail::tvec3<T> const & normal)
+ {
+ return dot(cross(normal, tangent), binormal) > T(0);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER bool leftHanded(
+ detail::tvec3<T> const & tangent,
+ detail::tvec3<T> const & binormal,
+ detail::tvec3<T> const & normal)
+ {
+ return dot(cross(normal, tangent), binormal) < T(0);
+ }
+
+}//namespace handed_coordinate_space
+}//namespace gtx
+}//namespace glm
diff --git a/src/glm/gtx/inertia.hpp b/src/glm/gtx/inertia.hpp
new file mode 100644
index 0000000..602de82
--- /dev/null
+++ b/src/glm/gtx/inertia.hpp
@@ -0,0 +1,95 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2006-04-21
+// Updated : 2006-11-13
+// Licence : This source is under MIT License
+// File : glm/gtx/inertia.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_gtx_inertia
+#define glm_gtx_inertia
+
+// Dependency:
+#include "../glm.hpp"
+
+#if(defined(GLM_MESSAGES) && !defined(glm_ext))
+# pragma message("GLM: GLM_GTX_inertia extension included")
+#endif
+
+namespace glm{
+namespace gtx{
+namespace inertia ///< GLM_GTX_inertia extension: Create inertia matrices
+{
+ /// \addtogroup gtx_inertia
+ /// @{
+
+ //! Build an inertia matrix for a box.
+ //! From GLM_GTX_inertia extension.
+ template <typename T>
+ detail::tmat3x3<T> boxInertia3(
+ const T Mass,
+ const detail::tvec3<T>& Scale);
+
+ //! Build an inertia matrix for a box.
+ //! From GLM_GTX_inertia extension.
+ template <typename T>
+ detail::tmat4x4<T> boxInertia4(
+ const T Mass,
+ const detail::tvec3<T>& Scale);
+
+ //! Build an inertia matrix for a disk.
+ //! From GLM_GTX_inertia extension.
+ template <typename T>
+ detail::tmat3x3<T> diskInertia3(
+ const T Mass,
+ const T Radius);
+
+ //! Build an inertia matrix for a disk.
+ //! From GLM_GTX_inertia extension.
+ template <typename T>
+ detail::tmat4x4<T> diskInertia4(
+ const T Mass,
+ const T Radius);
+
+ //! Build an inertia matrix for a ball.
+ //! From GLM_GTX_inertia extension.
+ template <typename T>
+ detail::tmat3x3<T> ballInertia3(
+ const T Mass,
+ const T Radius);
+
+ //! Build an inertia matrix for a ball.
+ //! From GLM_GTX_inertia extension.
+ template <typename T>
+ detail::tmat4x4<T> ballInertia4(
+ const T Mass,
+ const T Radius);
+
+ //! Build an inertia matrix for a sphere.
+ //! From GLM_GTX_inertia extension.
+ template <typename T>
+ detail::tmat3x3<T> sphereInertia3(
+ const T Mass,
+ const T Radius);
+
+ //! Build an inertia matrix for a sphere.
+ //! From GLM_GTX_inertia extension.
+ template <typename T>
+ detail::tmat4x4<T> sphereInertia4(
+ const T Mass,
+ const T Radius);
+
+ /// @}
+}// namespace inertia
+}// namespace gtx
+}// namespace glm
+
+#include "inertia.inl"
+
+namespace glm{using namespace gtx::inertia;}
+
+#endif//glm_gtx_inertia
diff --git a/src/glm/gtx/inertia.inl b/src/glm/gtx/inertia.inl
new file mode 100644
index 0000000..6e4be3d
--- /dev/null
+++ b/src/glm/gtx/inertia.inl
@@ -0,0 +1,103 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2006-04-21
+// Updated : 2006-12-06
+// Licence : This source is under MIT License
+// File : glm/gtx/inertia.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm{
+namespace gtx{
+namespace inertia{
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat3x3<T> boxInertia3(
+ const T Mass,
+ const detail::tvec3<T>& Scale)
+ {
+ detail::tmat3x3<T> Result(T(1));
+ Result[0][0] = (Scale.y * Scale.y + Scale.z * Scale.z) * Mass / T(12);
+ Result[1][1] = (Scale.x * Scale.x + Scale.z * Scale.z) * Mass / T(12);
+ Result[2][2] = (Scale.x * Scale.x + Scale.y * Scale.y) * Mass / T(12);
+ return Result;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat4x4<T> boxInertia4(
+ const T Mass,
+ const detail::tvec3<T>& Scale)
+ {
+ detail::tmat4x4<T> Result(T(1));
+ Result[0][0] = (Scale.y * Scale.y + Scale.z * Scale.z) * Mass / T(12);
+ Result[1][1] = (Scale.x * Scale.x + Scale.z * Scale.z) * Mass / T(12);
+ Result[2][2] = (Scale.x * Scale.x + Scale.y * Scale.y) * Mass / T(12);
+ return Result;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat3x3<T> diskInertia3(
+ const T Mass,
+ const T Radius)
+ {
+ T a = Mass * Radius * Radius / T(2);
+ detail::tmat3x3<T> Result(a);
+ Result[2][2] *= T(2);
+ return Result;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat4x4<T> diskInertia4(
+ const T Mass,
+ const T Radius)
+ {
+ T a = Mass * Radius * Radius / T(2);
+ detail::tmat4x4<T> Result(a);
+ Result[2][2] *= T(2);
+ Result[3][3] = T(1);
+ return Result;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat3x3<T> ballInertia3(
+ const T Mass,
+ const T Radius)
+ {
+ T a = T(2) * Mass * Radius * Radius / T(5);
+ return detail::tmat3x3<T>(a);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat4x4<T> ballInertia4(
+ const T Mass,
+ const T Radius)
+ {
+ T a = T(2) * Mass * Radius * Radius / T(5);
+ detail::tmat4x4<T> Result(a);
+ Result[3][3] = T(1);
+ return Result;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat3x3<T> sphereInertia3(
+ const T Mass,
+ const T Radius)
+ {
+ T a = T(2) * Mass * Radius * Radius / T(3);
+ return detail::tmat3x3<T>(a);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat4x4<T> sphereInertia4(
+ const T Mass,
+ const T Radius)
+ {
+ T a = T(2) * Mass * Radius * Radius / T(3);
+ detail::tmat4x4<T> Result(a);
+ Result[3][3] = T(1);
+ return Result;
+ }
+
+}//namespace inertia
+}//namespace gtx
+}//namespace glm
diff --git a/src/glm/gtx/int_10_10_10_2.hpp b/src/glm/gtx/int_10_10_10_2.hpp
new file mode 100644
index 0000000..8fa697b
--- /dev/null
+++ b/src/glm/gtx/int_10_10_10_2.hpp
@@ -0,0 +1,47 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2010-07-07
+// Updated : 2010-07-07
+// Licence : This source is under MIT License
+// File : glm/gtx/int_10_10_10_2.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_gtx_int_10_10_10_2
+#define glm_gtx_int_10_10_10_2
+
+// Dependency:
+#include "../glm.hpp"
+#include "../gtx/raw_data.hpp"
+
+#if(defined(GLM_MESSAGES) && !defined(glm_ext))
+# pragma message("GLM: GLM_GTX_int_10_10_10_2 extension included")
+#endif
+
+namespace glm{
+namespace gtx{
+namespace int_10_10_10_2 ///< GLM_GTX_int_10_10_10_2 extension: Add support for integer for core functions
+{
+ using namespace gtx::raw_data;
+
+ /// \addtogroup gtx_int_10_10_10_2
+ ///@{
+
+ //! From GLM_GTX_int_10_10_10_2 extension.
+ //! Cast a vec4 to an u_10_10_10_2.
+ dword uint10_10_10_2_cast(glm::vec4 const & v);
+
+ ///@}
+
+}//namespace integer
+}//namespace gtx
+}//namespace glm
+
+#include "int_10_10_10_2.inl"
+
+namespace glm{using namespace gtx::int_10_10_10_2;}
+
+#endif//glm_gtx_int_10_10_10_2
diff --git a/src/glm/gtx/int_10_10_10_2.inl b/src/glm/gtx/int_10_10_10_2.inl
new file mode 100644
index 0000000..68efc55
--- /dev/null
+++ b/src/glm/gtx/int_10_10_10_2.inl
@@ -0,0 +1,21 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2010-07-07
+// Updated : 2010-07-07
+// Licence : This source is under MIT License
+// File : glm/gtx/int_10_10_10_2.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm{
+namespace gtx{
+namespace int_10_10_10_2
+{
+ GLM_FUNC_QUALIFIER dword uint10_10_10_2_cast(glm::vec4 const & v)
+ {
+ return dword(uint(v.x * 2047.f) << 0 | uint(v.y * 2047.f) << 10 | uint(v.z * 2047.f) << 20 | uint(v.w * 3.f) << 30);
+ }
+
+}//namespace int_10_10_10_2
+}//namespace gtx
+}//namespace glm
diff --git a/src/glm/gtx/integer.hpp b/src/glm/gtx/integer.hpp
new file mode 100644
index 0000000..fe05b8f
--- /dev/null
+++ b/src/glm/gtx/integer.hpp
@@ -0,0 +1,56 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2005-12-24
+// Updated : 2006-11-14
+// Licence : This source is under MIT License
+// File : glm/gtx/integer.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_gtx_integer
+#define glm_gtx_integer
+
+// Dependency:
+#include "../glm.hpp"
+
+#if(defined(GLM_MESSAGES) && !defined(glm_ext))
+# pragma message("GLM: GLM_GTX_integer extension included")
+#endif
+
+namespace glm{
+namespace gtx{
+namespace integer ///< GLM_GTX_integer extension: Add support for integer for core functions
+{
+ /// \addtogroup gtx_integer
+ /// @{
+
+ //! Returns x raised to the y power.
+ //! From GLM_GTX_integer extension.
+ int pow(int x, int y);
+
+ //! Returns the positive square root of x.
+ //! From GLM_GTX_integer extension.
+ int sqrt(int x);
+
+ //! Modulus. Returns x - y * floor(x / y) for each component in x using the floating point value y.
+ //! From GLM_GTX_integer extension.
+ int mod(int x, int y);
+
+ //! Return the factorial value of a number (!12 max, integer only)
+ //! From GLM_GTX_integer extension.
+ template <typename genType>
+ genType factorial(genType const & x);
+
+ /// @}
+}//namespace integer
+}//namespace gtx
+}//namespace glm
+
+#include "integer.inl"
+
+namespace glm{using namespace gtx::integer;}
+
+#endif//glm_gtx_integer
diff --git a/src/glm/gtx/integer.inl b/src/glm/gtx/integer.inl
new file mode 100644
index 0000000..7bf5011
--- /dev/null
+++ b/src/glm/gtx/integer.inl
@@ -0,0 +1,91 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2005-12-24
+// Updated : 2006-12-06
+// Licence : This source is under MIT License
+// File : glm/gtx/integer.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm{
+namespace gtx{
+namespace integer
+{
+ // pow
+ GLM_FUNC_QUALIFIER int pow(int x, int y)
+ {
+ if(y == 0)
+ return 1;
+ int result = x;
+ for(int i = 1; i < y; ++i)
+ result *= x;
+ return result;
+ }
+
+ // sqrt: From Christopher J. Musial, An integer square root, Graphics Gems, 1990, page 387
+ GLM_FUNC_QUALIFIER int sqrt(int x)
+ {
+ if(x <= 1) return x;
+
+ int NextTrial = x >> 1;
+ int CurrentAnswer;
+
+ do
+ {
+ CurrentAnswer = NextTrial;
+ NextTrial = (NextTrial + x / NextTrial) >> 1;
+ } while(NextTrial < CurrentAnswer);
+
+ return CurrentAnswer;
+ }
+
+ // mod
+ GLM_FUNC_QUALIFIER int mod(int x, int y)
+ {
+ return x - y * (x / y);
+ }
+
+ // factorial (!12 max, integer only)
+ template <typename genType>
+ GLM_FUNC_QUALIFIER genType factorial(genType const & x)
+ {
+ genType Temp = x;
+ genType Result;
+ for(Result = 1; Temp > 1; --Temp)
+ Result *= Temp;
+ return Result;
+ }
+
+ template <typename valType>
+ GLM_FUNC_QUALIFIER detail::tvec2<valType> factorial(
+ detail::tvec2<valType> const & x)
+ {
+ return detail::tvec2<valType>(
+ factorial(x.x),
+ factorial(x.y));
+ }
+
+ template <typename valType>
+ GLM_FUNC_QUALIFIER detail::tvec3<valType> factorial(
+ detail::tvec3<valType> const & x)
+ {
+ return detail::tvec3<valType>(
+ factorial(x.x),
+ factorial(x.y),
+ factorial(x.z));
+ }
+
+ template <typename valType>
+ GLM_FUNC_QUALIFIER detail::tvec4<valType> factorial(
+ detail::tvec4<valType> const & x)
+ {
+ return detail::tvec4<valType>(
+ factorial(x.x),
+ factorial(x.y),
+ factorial(x.z),
+ factorial(x.w));
+ }
+
+}//namespace integer
+}//namespace gtx
+}//namespace glm
diff --git a/src/glm/gtx/intersect.hpp b/src/glm/gtx/intersect.hpp
new file mode 100644
index 0000000..df5e083
--- /dev/null
+++ b/src/glm/gtx/intersect.hpp
@@ -0,0 +1,73 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2007-04-03
+// Updated : 2009-01-20
+// Licence : This source is under MIT License
+// File : glm/gtx/intersect.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+// - GLM_GTX_closest_point
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_gtx_intersect
+#define glm_gtx_intersect
+
+// Dependency:
+#include "../glm.hpp"
+#include "../gtx/closest_point.hpp"
+
+#if(defined(GLM_MESSAGES) && !defined(glm_ext))
+# pragma message("GLM: GLM_GTX_closest_point extension included")
+#endif
+
+namespace glm{
+namespace gtx{
+namespace intersect ///< GLM_GTX_intersect extension: Add intersection functions
+{
+ /// \addtogroup gtx_intersect
+ /// @{
+
+ //! Compute the intersection of a ray and a triangle.
+ //! From GLM_GTX_intersect extension.
+ template <typename genType>
+ bool intersectRayTriangle(
+ genType const & orig, genType const & dir,
+ genType const & vert0, genType const & vert1, genType const & vert2,
+ genType & baryPosition);
+
+ //! Compute the intersection of a line and a triangle.
+ //! From GLM_GTX_intersect extension.
+ template <typename genType>
+ bool intersectLineTriangle(
+ genType const & orig, genType const & dir,
+ genType const & vert0, genType const & vert1, genType const & vert2,
+ genType & position);
+
+ //! Compute the intersection of a ray and a sphere.
+ //! From GLM_GTX_intersect extension.
+ template <typename genType>
+ bool intersectRaySphere(
+ genType const & orig, genType const & dir,
+ genType const & center, typename genType::value_type radius,
+ genType & position, genType & normal);
+
+ //! Compute the intersection of a line and a sphere.
+ //! From GLM_GTX_intersect extension
+ template <typename genType>
+ bool intersectLineSphere(
+ genType const & point0, genType const & point1,
+ genType const & center, typename genType::value_type radius,
+ genType & position, genType & normal);
+
+ /// @}
+}//namespace intersect
+}//namespace gtx
+}//namespace glm
+
+#include "intersect.inl"
+
+namespace glm{using namespace gtx::intersect;}
+
+#endif//glm_gtx_intersect
diff --git a/src/glm/gtx/intersect.inl b/src/glm/gtx/intersect.inl
new file mode 100644
index 0000000..b9f318a
--- /dev/null
+++ b/src/glm/gtx/intersect.inl
@@ -0,0 +1,201 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2007-04-03
+// Updated : 2009-01-20
+// Licence : This source is under MIT licence
+// File : glm/gtx/intersect.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <cfloat>
+#include <limits>
+
+namespace glm{
+namespace gtx{
+namespace intersect{
+
+template <typename genType>
+GLM_FUNC_QUALIFIER bool intersectRayTriangle
+(
+ genType const & orig, genType const & dir,
+ genType const & v0, genType const & v1, genType const & v2,
+ genType & baryPosition
+)
+{
+ genType e1 = v1 - v0;
+ genType e2 = v2 - v0;
+
+ genType p = glm::cross(dir, e2);
+
+ typename genType::value_type a = glm::dot(e1, p);
+
+ typename genType::value_type Epsilon = std::numeric_limits<typename genType::value_type>::epsilon();
+ if(a < Epsilon)
+ return false;
+
+ typename genType::value_type f = typename genType::value_type(1.0f) / a;
+
+ genType s = orig - v0;
+ baryPosition.x = f * glm::dot(s, p);
+ if(baryPosition.x < typename genType::value_type(0.0f))
+ return false;
+ if(baryPosition.x > typename genType::value_type(1.0f))
+ return false;
+
+ genType q = glm::cross(s, e1);
+ baryPosition.y = f * glm::dot(dir, q);
+ if(baryPosition.y < typename genType::value_type(0.0f))
+ return false;
+ if(baryPosition.y + baryPosition.x > typename genType::value_type(1.0f))
+ return false;
+
+ baryPosition.z = f * glm::dot(e2, q);
+
+ return baryPosition.z >= typename genType::value_type(0.0f);
+}
+
+//template <typename genType>
+//GLM_FUNC_QUALIFIER bool intersectRayTriangle
+//(
+// genType const & orig, genType const & dir,
+// genType const & vert0, genType const & vert1, genType const & vert2,
+// genType & position
+//)
+//{
+// typename genType::value_type Epsilon = std::numeric_limits<typename genType::value_type>::epsilon();
+//
+// genType edge1 = vert1 - vert0;
+// genType edge2 = vert2 - vert0;
+//
+// genType pvec = cross(dir, edge2);
+//
+// float det = dot(edge1, pvec);
+// if(det < Epsilon)
+// return false;
+//
+// genType tvec = orig - vert0;
+//
+// position.y = dot(tvec, pvec);
+// if (position.y < typename genType::value_type(0) || position.y > det)
+// return typename genType::value_type(0);
+//
+// genType qvec = cross(tvec, edge1);
+//
+// position.z = dot(dir, qvec);
+// if (position.z < typename genType::value_type(0) || position.y + position.z > det)
+// return typename genType::value_type(0);
+//
+// position.x = dot(edge2, qvec);
+// position *= typename genType::value_type(1) / det;
+//
+// return typename genType::value_type(1);
+//}
+
+template <typename genType>
+GLM_FUNC_QUALIFIER bool intersectLineTriangle
+(
+ genType const & orig, genType const & dir,
+ genType const & vert0, genType const & vert1, genType const & vert2,
+ genType & position
+)
+{
+ typename genType::value_type Epsilon = std::numeric_limits<typename genType::value_type>::epsilon();
+
+ genType edge1 = vert1 - vert0;
+ genType edge2 = vert2 - vert0;
+
+ genType pvec = cross(dir, edge2);
+
+ float det = dot(edge1, pvec);
+
+ if (det > -Epsilon && det < Epsilon)
+ return false;
+ float inv_det = typename genType::value_type(1) / det;
+
+ genType tvec = orig - vert0;
+
+ position.y = dot(tvec, pvec) * inv_det;
+ if (position.y < typename genType::value_type(0) || position.y > typename genType::value_type(1))
+ return false;
+
+ genType qvec = cross(tvec, edge1);
+
+ position.z = dot(dir, qvec) * inv_det;
+ if (position.z < typename genType::value_type(0) || position.y + position.z > typename genType::value_type(1))
+ return false;
+
+ position.x = dot(edge2, qvec) * inv_det;
+
+ return true;
+}
+
+template <typename genType>
+GLM_FUNC_QUALIFIER bool intersectRaySphere
+(
+ genType const & rayStarting, genType const & rayDirection,
+ genType const & sphereCenter, typename genType::value_type sphereRadius,
+ genType & position, genType & normal
+)
+{
+ typename genType::value_type Epsilon = std::numeric_limits<typename genType::value_type>::epsilon();
+
+ typename genType::value_type a = dot(rayDirection, rayDirection);
+ typename genType::value_type b = typename genType::value_type(2) * dot(rayStarting, rayDirection);
+ typename genType::value_type c = dot(rayStarting, rayStarting) - sphereRadius * sphereRadius;
+ typename genType::value_type d = b * b - typename genType::value_type(4) * a * c;
+ typename genType::value_type e = sqrt(d);
+ typename genType::value_type x1 = (-b - e) / (typename genType::value_type(2) * a);
+ typename genType::value_type x2 = (-b + e) / (typename genType::value_type(2) * a);
+
+ if(x1 > Epsilon)
+ {
+ position = rayStarting + rayDirection * sphereRadius;
+ normal = (position - sphereCenter) / sphereRadius;
+ return true;
+ }
+ else if(x2 > Epsilon)
+ {
+ position = rayStarting + rayDirection * sphereRadius;
+ normal = (position - sphereCenter) / sphereRadius;
+ return true;
+ }
+ return false;
+}
+
+template <typename genType>
+GLM_FUNC_QUALIFIER bool intersectLineSphere
+(
+ genType const & point0, genType const & point1,
+ genType const & center, typename genType::value_type radius,
+ genType & position, genType & normal
+)
+{
+ typename genType::value_type Epsilon = std::numeric_limits<typename genType::value_type>::epsilon();
+
+ genType dir = point1 - point0;
+ typename genType::value_type a = dot(dir, dir);
+ typename genType::value_type b = typename genType::value_type(2) * dot(center, dir);
+ typename genType::value_type c = dot(center, center) - radius * radius;
+ typename genType::value_type d = b * b - typename genType::value_type(4) * a * c;
+ typename genType::value_type e = sqrt(d);
+ typename genType::value_type x1 = (-b - e) / (typename genType::value_type(2) * a);
+ typename genType::value_type x2 = (-b + e) / (typename genType::value_type(2) * a);
+
+ if(x1 > Epsilon)
+ {
+ position = center + dir * radius;
+ normal = (position - center) / radius;
+ return true;
+ }
+ else if(x2 > Epsilon)
+ {
+ position = center + dir * radius;
+ normal = (position - center) / radius;
+ return true;
+ }
+ return false;
+}
+
+}//namespace intersect
+}//namespace gtx
+}//namespace glm
diff --git a/src/glm/gtx/log_base.hpp b/src/glm/gtx/log_base.hpp
new file mode 100644
index 0000000..d30d822
--- /dev/null
+++ b/src/glm/gtx/log_base.hpp
@@ -0,0 +1,47 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2008-10-24
+// Updated : 2008-10-24
+// Licence : This source is under MIT License
+// File : glm/gtx/log_base.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_gtx_log_base
+#define glm_gtx_log_base
+
+// Dependency:
+#include "../glm.hpp"
+
+#if(defined(GLM_MESSAGES) && !defined(glm_ext))
+# pragma message("GLM: GLM_GTX_log_base extension included")
+#endif
+
+namespace glm{
+namespace gtx{
+namespace log_base ///< GLM_GTX_log_base extension: Logarithm for any base. base can be a vector or a scalar.
+{
+ /// \addtogroup gtx_log_base
+ /// @{
+
+ //! Logarithm for any base.
+ //! From GLM_GTX_log_base.
+ template <typename genType>
+ genType log(
+ genType const & x,
+ genType const & base);
+
+ /// @}
+
+}//namespace extend
+}//namespace gtx
+}//namespace glm
+
+#include "log_base.inl"
+
+namespace glm{using namespace gtx::log_base;}
+
+#endif//glm_gtx_log_base
diff --git a/src/glm/gtx/log_base.inl b/src/glm/gtx/log_base.inl
new file mode 100644
index 0000000..b76d2f3
--- /dev/null
+++ b/src/glm/gtx/log_base.inl
@@ -0,0 +1,92 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2008-10-24
+// Updated : 2008-10-24
+// Licence : This source is under MIT License
+// File : glm/gtx/log_base.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm{
+namespace gtx{
+namespace log_base{
+
+template <typename genType>
+GLM_FUNC_QUALIFIER genType log(
+ genType const & x,
+ genType const & base)
+{
+ assert(x != genType(0));
+
+ return glm::log(x) / glm::log(base);
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec2<valType> log(
+ detail::tvec2<valType> const & v,
+ valType const & base)
+{
+ return detail::tvec2<valType>(
+ log(v.x, base),
+ log(v.y, base));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec3<valType> log(
+ detail::tvec3<valType> const & v,
+ valType const & base)
+{
+ return detail::tvec3<valType>(
+ log(v.x, base),
+ log(v.y, base),
+ log(v.z, base));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec4<valType> log(
+ detail::tvec4<valType> const & v,
+ valType const & base)
+{
+ return detail::tvec4<valType>(
+ log(v.x, base),
+ log(v.y, base),
+ log(v.z, base),
+ log(v.w, base));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec2<valType> log(
+ detail::tvec2<valType> const & v,
+ detail::tvec2<valType> const & base)
+{
+ return detail::tvec2<valType>(
+ log(v.x, base.x),
+ log(v.y, base.y));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec3<valType> log(
+ detail::tvec3<valType> const & v,
+ detail::tvec3<valType> const & base)
+{
+ return detail::tvec3<valType>(
+ log(v.x, base.x),
+ log(v.y, base.y),
+ log(v.z, base.z));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec4<valType> log(
+ detail::tvec4<valType> const & v,
+ detail::tvec4<valType> const & base)
+{
+ return detail::tvec4<valType>(
+ log(v.x, base.x),
+ log(v.y, base.y),
+ log(v.z, base.z),
+ log(v.w, base.w));
+}
+
+}//namespace log_base
+}//namespace gtx
+}//namespace glm
diff --git a/src/glm/gtx/matrix_cross_product.hpp b/src/glm/gtx/matrix_cross_product.hpp
new file mode 100644
index 0000000..1039bdb
--- /dev/null
+++ b/src/glm/gtx/matrix_cross_product.hpp
@@ -0,0 +1,51 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2005-12-21
+// Updated : 2006-11-13
+// Licence : This source is under MIT License
+// File : glm/gtx/matrix_cross_product.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_gtx_matrix_cross_product
+#define glm_gtx_matrix_cross_product
+
+// Dependency:
+#include "../glm.hpp"
+
+#if(defined(GLM_MESSAGES) && !defined(glm_ext))
+# pragma message("GLM: GLM_GTX_matrix_cross_product extension included")
+#endif
+
+namespace glm{
+namespace gtx{
+namespace matrix_cross_product ///< GLM_GTX_matrix_cross_product: Build cross product matrices
+{
+ /// \addtogroup gtx_matrix_cross_product
+ /// @{
+
+ //! Build a cross product matrix.
+ //! From GLM_GTX_matrix_cross_product extension.
+ template <typename T>
+ detail::tmat3x3<T> matrixCross3(
+ detail::tvec3<T> const & x);
+
+ //! Build a cross product matrix.
+ //! From GLM_GTX_matrix_cross_product extension.
+ template <typename T>
+ detail::tmat4x4<T> matrixCross4(
+ detail::tvec3<T> const & x);
+
+ /// @}
+}//namespace matrix_cross_product
+}//namespace gtx
+}//namespace glm
+
+#include "matrix_cross_product.inl"
+
+namespace glm{using namespace gtx::matrix_cross_product;}
+
+#endif//glm_gtx_matrix_cross_product
diff --git a/src/glm/gtx/matrix_cross_product.inl b/src/glm/gtx/matrix_cross_product.inl
new file mode 100644
index 0000000..174b968
--- /dev/null
+++ b/src/glm/gtx/matrix_cross_product.inl
@@ -0,0 +1,44 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2005-12-21
+// Updated : 2005-12-21
+// Licence : This source is under MIT License
+// File : glm/gtx/matrix_cross_product.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm{
+namespace gtx{
+namespace matrix_cross_product
+{
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat3x3<T> matrixCross3(
+ detail::tvec3<T> const & x)
+ {
+ detail::tmat3x3<T> Result(T(0));
+ Result[0][1] = x.z;
+ Result[1][0] = -x.z;
+ Result[0][2] = -x.y;
+ Result[2][0] = x.y;
+ Result[1][2] = x.x;
+ Result[2][1] = -x.x;
+ return Result;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat4x4<T> matrixCross4(
+ detail::tvec3<T> const & x)
+ {
+ detail::tmat4x4<T> Result(T(0));
+ Result[0][1] = x.z;
+ Result[1][0] = -x.z;
+ Result[0][2] = -x.y;
+ Result[2][0] = x.y;
+ Result[1][2] = x.x;
+ Result[2][1] = -x.x;
+ return Result;
+ }
+
+}//namespace matrix_cross_product
+}//namespace gtx
+}//namespace glm
diff --git a/src/glm/gtx/matrix_interpolation.hpp b/src/glm/gtx/matrix_interpolation.hpp
new file mode 100644
index 0000000..bf7910c
--- /dev/null
+++ b/src/glm/gtx/matrix_interpolation.hpp
@@ -0,0 +1,66 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2011-03-05
+// Updated : 2011-03-05
+// Licence : This source is under MIT License
+// File : glm/gtx/matrix_interpolation.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+// - GLM_GTX_matric_interpolation
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// This extension has been written by Ghenadii Ursachi (the.asteroth@gmail.com)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_gtx_matrix_interpolation
+#define glm_gtx_matrix_interpolation
+
+// Dependency:
+//#include "../glm.hpp"
+
+#if(defined(GLM_MESSAGES) && !defined(glm_ext))
+# pragma message("GLM: GLM_GTX_matrix_interpolation extension included")
+#endif
+
+namespace glm{
+namespace gtx{
+namespace matrix_interpolation ///< GLM_GTX_matrix_interpolation extension: Add transformation matrices
+{
+ /// \addtogroup gtx_matrix_interpolation
+ /// @{
+
+ //! Get the axis and angle of the rotation from a matrix.
+ //! From GLM_GTX_matrix_interpolation extension.
+ template <typename T>
+ void axisAngle(
+ detail::tmat4x4<T> const & mat,
+ detail::tvec3<T> & axis,
+ T & angle);
+
+ //! Build a matrix from axis and angle.
+ //! From GLM_GTX_matrix_interpolation extension.
+ template <typename T>
+ detail::tmat4x4<T> axisAngleMatrix(
+ detail::tvec3<T> const & axis,
+ T const angle);
+
+ //! Build a interpolation of 4 * 4 matrixes.
+ //! From GLM_GTX_matrix_interpolation extension.
+ //! Warning! works only with rotation and/or translation matrixes, scale will generate unexpected results.
+ template <typename T>
+ detail::tmat4x4<T> interpolate(
+ detail::tmat4x4<T> const & m1,
+ detail::tmat4x4<T> const & m2,
+ T const delta);
+
+ /// @}
+}//namespace matrix_interpolation
+}//namespace gtx
+}//namespace glm
+
+#include "matrix_interpolation.inl"
+
+namespace glm{using namespace gtx::matrix_interpolation;}
+
+#endif//glm_gtx_transform
diff --git a/src/glm/gtx/matrix_interpolation.inl b/src/glm/gtx/matrix_interpolation.inl
new file mode 100644
index 0000000..a6a237b
--- /dev/null
+++ b/src/glm/gtx/matrix_interpolation.inl
@@ -0,0 +1,117 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2011-03-05
+// Updated : 2011-03-05
+// Licence : This source is under MIT License
+// File : glm/gtx/matrix_interpolation.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm{
+namespace gtx{
+namespace matrix_interpolation
+{
+ template <typename T>
+ GLM_FUNC_QUALIFIER void axisAngle(
+ detail::tmat4x4<T> const & mat,
+ detail::tvec3<T> & axis,
+ T & angle)
+ {
+ T epsilon = (T)0.01;
+ T epsilon2 = (T)0.1;
+
+ if ((fabs(mat[1][0] - mat[0][1]) < epsilon) && (fabs(mat[2][0] - mat[0][2]) < epsilon) && (fabs(mat[2][1] - mat[1][2]) < epsilon)) {
+ if ((fabs(mat[1][0] + mat[0][1]) < epsilon2) && (fabs(mat[2][0] + mat[0][2]) < epsilon2) && (fabs(mat[2][1] + mat[1][2]) < epsilon2) && (fabs(mat[0][0] + mat[1][1] + mat[2][2] - (T)3.0) < epsilon2)) {
+ angle = (T)0.0;
+ axis.x = (T)1.0;
+ axis.y = (T)0.0;
+ axis.z = (T)0.0;
+ return;
+ }
+ angle = M_1_PI;
+ T xx = (mat[0][0] + (T)1.0) / (T)2.0;
+ T yy = (mat[1][1] + (T)1.0) / (T)2.0;
+ T zz = (mat[2][2] + (T)1.0) / (T)2.0;
+ T xy = (mat[1][0] + mat[0][1]) / (T)4.0;
+ T xz = (mat[2][0] + mat[0][2]) / (T)4.0;
+ T yz = (mat[2][1] + mat[1][2]) / (T)4.0;
+ if ((xx > yy) && (xx > zz)) {
+ if (xx < epsilon) {
+ axis.x = (T)0.0;
+ axis.y = (T)0.7071;
+ axis.z = (T)0.7071;
+ } else {
+ axis.x = sqrt(xx);
+ axis.y = xy / axis.x;
+ axis.z = xz / axis.x;
+ }
+ } else if (yy > zz) {
+ if (yy < epsilon) {
+ axis.x = (T)0.7071;
+ axis.y = (T)0.0;
+ axis.z = (T)0.7071;
+ } else {
+ axis.y = sqrt(yy);
+ axis.x = xy / axis.y;
+ axis.z = yz / axis.y;
+ }
+ } else {
+ if (zz < epsilon) {
+ axis.x = (T)0.7071;
+ axis.y = (T)0.7071;
+ axis.z = (T)0.0;
+ } else {
+ axis.z = sqrt(zz);
+ axis.x = xz / axis.z;
+ axis.y = yz / axis.z;
+ }
+ }
+ return;
+ }
+ T s = sqrt((mat[2][1] - mat[1][2]) * (mat[2][1] - mat[1][2]) + (mat[2][0] - mat[0][2]) * (mat[2][0] - mat[0][2]) + (mat[1][0] - mat[0][1]) * (mat[1][0] - mat[0][1]));
+ if (glm::abs(s) < T(0.001))
+ s = (T)1.0;
+ angle = acos((mat[0][0] + mat[1][1] + mat[2][2] - (T)1.0) / (T)2.0);
+ axis.x = (mat[1][2] - mat[2][1]) / s;
+ axis.y = (mat[2][0] - mat[0][2]) / s;
+ axis.z = (mat[0][1] - mat[1][0]) / s;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat4x4<T> axisAngleMatrix(
+ detail::tvec3<T> const & axis,
+ T const angle)
+ {
+ T c = cos(angle);
+ T s = sin(angle);
+ T t = T(1) - c;
+ detail::tvec3<T> n = normalize(axis);
+
+ return detail::tmat4x4<T>(
+ t * n.x * n.x + c, t * n.x * n.y + n.z * s, t * n.x * n.z - n.y * s, T(0),
+ t * n.x * n.y - n.z * s, t * n.y * n.y + c, t * n.y * n.z + n.x * s, T(0),
+ t * n.x * n.z + n.y * s, t * n.y * n.z - n.x * s, t * n.z * n.z + c, T(0),
+ T(0), T(0), T(0), T(1)
+ );
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat4x4<T> interpolate(
+ detail::tmat4x4<T> const & m1,
+ detail::tmat4x4<T> const & m2,
+ T const delta)
+ {
+ detail::tmat4x4<T> dltRotation = m2 * transpose(m1);
+ detail::tvec3<T> dltAxis;
+ T dltAngle;
+ axisAngle(dltRotation, dltAxis, dltAngle);
+ detail::tmat4x4<T> out = axisAngleMatrix(dltAxis, dltAngle * delta) * rotationMatrix(m1);
+ out[3][0] = m1[3][0] + delta * (m2[3][0] - m1[3][0]);
+ out[3][1] = m1[3][1] + delta * (m2[3][1] - m1[3][1]);
+ out[3][2] = m1[3][2] + delta * (m2[3][2] - m1[3][2]);
+ return out;
+ }
+
+}//namespace transform
+}//namespace gtx
+}//namespace glm
diff --git a/src/glm/gtx/matrix_major_storage.hpp b/src/glm/gtx/matrix_major_storage.hpp
new file mode 100644
index 0000000..73db97f
--- /dev/null
+++ b/src/glm/gtx/matrix_major_storage.hpp
@@ -0,0 +1,123 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2006-04-19
+// Updated : 2009-02-19
+// Licence : This source is under MIT License
+// File : glm/gtx/matrix_major_storage.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_gtx_matrix_major_storage
+#define glm_gtx_matrix_major_storage
+
+// Dependency:
+#include "../glm.hpp"
+
+#if(defined(GLM_MESSAGES) && !defined(glm_ext))
+# pragma message("GLM: GLM_GTX_matrix_major_storage extension included")
+#endif
+
+namespace glm{
+namespace gtx{
+namespace matrix_major_storage ///< GLM_GTX_matrix_major_storage: Build matrices with specific matrix order, row or column
+{
+ /// \addtogroup gtx_matrix_major_storage
+ /// @{
+
+ //! Build a row major matrix from row vectors.
+ //! From GLM_GTX_matrix_major_storage extension.
+ template <typename T>
+ detail::tmat2x2<T> rowMajor2(
+ const detail::tvec2<T>& v1,
+ const detail::tvec2<T>& v2);
+
+ //! Build a row major matrix from other matrix.
+ //! From GLM_GTX_matrix_major_storage extension.
+ template <typename T>
+ detail::tmat2x2<T> rowMajor2(
+ const detail::tmat2x2<T>& m);
+
+ //! Build a row major matrix from row vectors.
+ //! From GLM_GTX_matrix_major_storage extension.
+ template <typename T>
+ detail::tmat3x3<T> rowMajor3(
+ const detail::tvec3<T>& v1,
+ const detail::tvec3<T>& v2,
+ const detail::tvec3<T>& v3);
+
+ //! Build a row major matrix from other matrix.
+ //! From GLM_GTX_matrix_major_storage extension.
+ template <typename T>
+ detail::tmat3x3<T> rowMajor3(
+ const detail::tmat3x3<T>& m);
+
+ //! Build a row major matrix from row vectors.
+ //! From GLM_GTX_matrix_major_storage extension.
+ template <typename T>
+ detail::tmat4x4<T> rowMajor4(
+ const detail::tvec4<T>& v1,
+ const detail::tvec4<T>& v2,
+ const detail::tvec4<T>& v3,
+ const detail::tvec4<T>& v4);
+
+ //! Build a row major matrix from other matrix.
+ //! From GLM_GTX_matrix_major_storage extension.
+ template <typename T>
+ detail::tmat4x4<T> rowMajor4(
+ const detail::tmat4x4<T>& m);
+
+ //! Build a column major matrix from column vectors.
+ //! From GLM_GTX_matrix_major_storage extension.
+ template <typename T>
+ detail::tmat2x2<T> colMajor2(
+ const detail::tvec2<T>& v1,
+ const detail::tvec2<T>& v2);
+
+ //! Build a column major matrix from other matrix.
+ //! From GLM_GTX_matrix_major_storage extension.
+ template <typename T>
+ detail::tmat2x2<T> colMajor2(
+ const detail::tmat2x2<T>& m);
+
+ //! Build a column major matrix from column vectors.
+ //! From GLM_GTX_matrix_major_storage extension.
+ template <typename T>
+ detail::tmat3x3<T> colMajor3(
+ const detail::tvec3<T>& v1,
+ const detail::tvec3<T>& v2,
+ const detail::tvec3<T>& v3);
+
+ //! Build a column major matrix from other matrix.
+ //! From GLM_GTX_matrix_major_storage extension.
+ template <typename T>
+ detail::tmat3x3<T> colMajor3(
+ const detail::tmat3x3<T>& m);
+
+ //! Build a column major matrix from column vectors.
+ //! From GLM_GTX_matrix_major_storage extension.
+ template <typename T>
+ detail::tmat4x4<T> colMajor4(
+ const detail::tvec4<T>& v1,
+ const detail::tvec4<T>& v2,
+ const detail::tvec4<T>& v3,
+ const detail::tvec4<T>& v4);
+
+ //! Build a column major matrix from other matrix.
+ //! From GLM_GTX_matrix_major_storage extension.
+ template <typename T>
+ detail::tmat4x4<T> colMajor4(
+ const detail::tmat4x4<T>& m);
+
+ /// @}
+}//namespace matrix_major_storage
+}//namespace gtx
+}//namespace glm
+
+#include "matrix_major_storage.inl"
+
+namespace glm{using namespace gtx::matrix_major_storage;}
+
+#endif//glm_gtx_matrix_major_storage
diff --git a/src/glm/gtx/matrix_major_storage.inl b/src/glm/gtx/matrix_major_storage.inl
new file mode 100644
index 0000000..e33efdc
--- /dev/null
+++ b/src/glm/gtx/matrix_major_storage.inl
@@ -0,0 +1,176 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2006-04-19
+// Updated : 2009-02-19
+// Licence : This source is under MIT License
+// File : glm/gtx/matrix_major_storage.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm{
+namespace gtx{
+namespace matrix_major_storage
+{
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat2x2<T> rowMajor2(
+ const detail::tvec2<T>& v1,
+ const detail::tvec2<T>& v2)
+ {
+ detail::tmat2x2<T> Result;
+ Result[0][0] = v1.x;
+ Result[1][0] = v1.y;
+ Result[0][1] = v2.x;
+ Result[1][1] = v2.y;
+ return Result;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat2x2<T> rowMajor2(
+ const detail::tmat2x2<T>& m)
+ {
+ detail::tmat2x2<T> Result;
+ 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 <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat3x3<T> rowMajor3(
+ const detail::tvec3<T>& v1,
+ const detail::tvec3<T>& v2,
+ const detail::tvec3<T>& v3)
+ {
+ detail::tmat3x3<T> Result;
+ Result[0][0] = v1.x;
+ Result[1][0] = v1.y;
+ Result[2][0] = v1.z;
+ Result[0][1] = v2.x;
+ Result[1][1] = v2.y;
+ Result[2][1] = v2.z;
+ Result[0][2] = v3.x;
+ Result[1][2] = v3.y;
+ Result[2][2] = v3.z;
+ return Result;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat3x3<T> rowMajor3(
+ const detail::tmat3x3<T>& m)
+ {
+ detail::tmat3x3<T> Result;
+ 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 <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat4x4<T> rowMajor4(
+ const detail::tvec4<T>& v1,
+ const detail::tvec4<T>& v2,
+ const detail::tvec4<T>& v3,
+ const detail::tvec4<T>& v4)
+ {
+ detail::tmat4x4<T> Result;
+ Result[0][0] = v1.x;
+ Result[1][0] = v1.y;
+ Result[2][0] = v1.z;
+ Result[3][0] = v1.w;
+ Result[0][1] = v2.x;
+ Result[1][1] = v2.y;
+ Result[2][1] = v2.z;
+ Result[3][1] = v2.w;
+ Result[0][2] = v3.x;
+ Result[1][2] = v3.y;
+ Result[2][2] = v3.z;
+ Result[3][2] = v3.w;
+ Result[0][3] = v4.x;
+ Result[1][3] = v4.y;
+ Result[2][3] = v4.z;
+ Result[3][3] = v4.w;
+ return Result;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat4x4<T> rowMajor4(
+ const detail::tmat4x4<T>& m)
+ {
+ detail::tmat4x4<T> Result;
+ 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 <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat2x2<T> colMajor2(
+ const detail::tvec2<T>& v1,
+ const detail::tvec2<T>& v2)
+ {
+ return detail::tmat2x2<T>(v1, v2);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat2x2<T> colMajor2(
+ const detail::tmat2x2<T>& m)
+ {
+ return detail::tmat2x2<T>(m);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat3x3<T> colMajor3(
+ const detail::tvec3<T>& v1,
+ const detail::tvec3<T>& v2,
+ const detail::tvec3<T>& v3)
+ {
+ return detail::tmat3x3<T>(v1, v2, v3);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat3x3<T> colMajor3(
+ const detail::tmat3x3<T>& m)
+ {
+ return detail::tmat3x3<T>(m);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat4x4<T> colMajor4(
+ const detail::tvec4<T>& v1,
+ const detail::tvec4<T>& v2,
+ const detail::tvec4<T>& v3,
+ const detail::tvec4<T>& v4)
+ {
+ return detail::tmat4x4<T>(v1, v2, v3, v4);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat4x4<T> colMajor4(
+ const detail::tmat4x4<T>& m)
+ {
+ return detail::tmat4x4<T>(m);
+ }
+
+}//namespace matrix_major_storage
+}//namespace gtx
+}//namespace glm
diff --git a/src/glm/gtx/matrix_operation.hpp b/src/glm/gtx/matrix_operation.hpp
new file mode 100644
index 0000000..0962743
--- /dev/null
+++ b/src/glm/gtx/matrix_operation.hpp
@@ -0,0 +1,93 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2009-08-29
+// Updated : 2009-08-29
+// Licence : This source is under MIT License
+// File : glm/gtx/matrix_operation.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_gtx_matrix_operation
+#define glm_gtx_matrix_operation
+
+// Dependency:
+#include "../glm.hpp"
+
+#if(defined(GLM_MESSAGES) && !defined(glm_ext))
+# pragma message("GLM: GLM_GTX_matrix_operation extension included")
+#endif
+
+namespace glm{
+namespace gtx{
+namespace matrix_operation ///< GLM_GTX_matrix_operation: Build diagonal matrices
+{
+ /// \addtogroup gtx_matrix_operation
+ /// @{
+
+ //! Build a diagonal matrix.
+ //! From GLM_GTX_matrix_operation extension.
+ template <typename valType>
+ detail::tmat2x2<valType> diagonal2x2(
+ detail::tvec2<valType> const & v);
+
+ //! Build a diagonal matrix.
+ //! From GLM_GTX_matrix_operation extension.
+ template <typename valType>
+ detail::tmat2x3<valType> diagonal2x3(
+ detail::tvec2<valType> const & v);
+
+ //! Build a diagonal matrix.
+ //! From GLM_GTX_matrix_operation extension.
+ template <typename valType>
+ detail::tmat2x4<valType> diagonal2x4(
+ detail::tvec2<valType> const & v);
+
+ //! Build a diagonal matrix.
+ //! From GLM_GTX_matrix_operation extension.
+ template <typename valType>
+ detail::tmat3x2<valType> diagonal3x2(
+ detail::tvec2<valType> const & v);
+
+ //! Build a diagonal matrix.
+ //! From GLM_GTX_matrix_operation extension.
+ template <typename valType>
+ detail::tmat3x3<valType> diagonal3x3(
+ detail::tvec3<valType> const & v);
+
+ //! Build a diagonal matrix.
+ //! From GLM_GTX_matrix_operation extension.
+ template <typename valType>
+ detail::tmat3x4<valType> diagonal3x4(
+ detail::tvec3<valType> const & v);
+
+ //! Build a diagonal matrix.
+ //! From GLM_GTX_matrix_operation extension.
+ template <typename valType>
+ detail::tmat4x2<valType> diagonal4x2(
+ detail::tvec2<valType> const & v);
+
+ //! Build a diagonal matrix.
+ //! From GLM_GTX_matrix_operation extension.
+ template <typename valType>
+ detail::tmat4x3<valType> diagonal4x3(
+ detail::tvec3<valType> const & v);
+
+ //! Build a diagonal matrix.
+ //! From GLM_GTX_matrix_operation extension.
+ template <typename valType>
+ detail::tmat4x4<valType> diagonal4x4(
+ detail::tvec4<valType> const & v);
+
+ /// @}
+}//namespace matrix_operation
+}//namespace gtx
+}//namespace glm
+
+#include "matrix_operation.inl"
+
+namespace glm{using namespace gtx::matrix_operation;}
+
+#endif//glm_gtx_matrix_operation
diff --git a/src/glm/gtx/matrix_operation.inl b/src/glm/gtx/matrix_operation.inl
new file mode 100644
index 0000000..250a42e
--- /dev/null
+++ b/src/glm/gtx/matrix_operation.inl
@@ -0,0 +1,129 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2009-08-29
+// Updated : 2009-08-29
+// Licence : This source is under MIT License
+// File : glm/gtx/matrix_operation.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm{
+namespace gtx{
+namespace matrix_operation
+{
+ template <typename valType>
+ GLM_FUNC_QUALIFIER detail::tmat2x2<valType> diagonal2x2
+ (
+ detail::tvec2<valType> const & v
+ )
+ {
+ detail::tmat2x2<valType> Result(valType(1));
+ Result[0][0] = v[0];
+ Result[1][1] = v[1];
+ return Result;
+ }
+
+ template <typename valType>
+ GLM_FUNC_QUALIFIER detail::tmat2x3<valType> diagonal2x3
+ (
+ detail::tvec2<valType> const & v
+ )
+ {
+ detail::tmat2x3<valType> Result(valType(1));
+ Result[0][0] = v[0];
+ Result[1][1] = v[1];
+ return Result;
+ }
+
+ template <typename valType>
+ GLM_FUNC_QUALIFIER detail::tmat2x4<valType> diagonal2x4
+ (
+ detail::tvec2<valType> const & v
+ )
+ {
+ detail::tmat2x4<valType> Result(valType(1));
+ Result[0][0] = v[0];
+ Result[1][1] = v[1];
+ return Result;
+ }
+
+ template <typename valType>
+ GLM_FUNC_QUALIFIER detail::tmat3x2<valType> diagonal3x2
+ (
+ detail::tvec2<valType> const & v
+ )
+ {
+ detail::tmat3x2<valType> Result(valType(1));
+ Result[0][0] = v[0];
+ Result[1][1] = v[1];
+ return Result;
+ }
+
+ template <typename valType>
+ GLM_FUNC_QUALIFIER detail::tmat3x3<valType> diagonal3x3
+ (
+ detail::tvec3<valType> const & v
+ )
+ {
+ detail::tmat3x3<valType> Result(valType(1));
+ Result[0][0] = v[0];
+ Result[1][1] = v[1];
+ Result[2][2] = v[2];
+ return Result;
+ }
+
+ template <typename valType>
+ GLM_FUNC_QUALIFIER detail::tmat3x4<valType> diagonal3x4
+ (
+ detail::tvec3<valType> const & v
+ )
+ {
+ detail::tmat3x4<valType> Result(valType(1));
+ Result[0][0] = v[0];
+ Result[1][1] = v[1];
+ Result[2][2] = v[2];
+ return Result;
+ }
+
+ template <typename valType>
+ GLM_FUNC_QUALIFIER detail::tmat4x4<valType> diagonal4x4
+ (
+ detail::tvec4<valType> const & v
+ )
+ {
+ detail::tmat4x4<valType> Result(valType(1));
+ Result[0][0] = v[0];
+ Result[1][1] = v[1];
+ Result[2][2] = v[2];
+ Result[3][3] = v[3];
+ return Result;
+ }
+
+ template <typename valType>
+ GLM_FUNC_QUALIFIER detail::tmat4x3<valType> diagonal4x3
+ (
+ detail::tvec3<valType> const & v
+ )
+ {
+ detail::tmat4x3<valType> Result(valType(1));
+ Result[0][0] = v[0];
+ Result[1][1] = v[1];
+ Result[2][2] = v[2];
+ return Result;
+ }
+
+ template <typename valType>
+ GLM_FUNC_QUALIFIER detail::tmat4x2<valType> diagonal4x2
+ (
+ detail::tvec2<valType> const & v
+ )
+ {
+ detail::tmat4x2<valType> Result(valType(1));
+ Result[0][0] = v[0];
+ Result[1][1] = v[1];
+ return Result;
+ }
+
+}//namespace matrix_operation
+}//namespace gtx
+}//namespace glm
diff --git a/src/glm/gtx/matrix_query.hpp b/src/glm/gtx/matrix_query.hpp
new file mode 100644
index 0000000..d19a535
--- /dev/null
+++ b/src/glm/gtx/matrix_query.hpp
@@ -0,0 +1,95 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2007-03-05
+// Updated : 2007-03-05
+// Licence : This source is under MIT License
+// File : glm/gtx/matrix_query.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_gtx_matrix_query
+#define glm_gtx_matrix_query
+
+// Dependency:
+#include "../glm.hpp"
+
+#if(defined(GLM_MESSAGES) && !defined(glm_ext))
+# pragma message("GLM: GLM_GTX_matrix_query extension included")
+#endif
+
+namespace glm{
+namespace gtx{
+namespace matrix_query ///< GLM_GTX_matrix_query: Query to evaluate matrix properties
+{
+ /// \addtogroup gtx_matrix_query
+ /// @{
+
+ //! Return if a matrix a null matrix.
+ //! From GLM_GTX_matrix_query extension.
+ template<typename T>
+ bool isNull(
+ const detail::tmat2x2<T>& m,
+ const T epsilon = std::numeric_limits<T>::epsilon());
+
+ //! Return if a matrix a null matrix.
+ //! From GLM_GTX_matrix_query extension.
+ template<typename T>
+ bool isNull(
+ const detail::tmat3x3<T>& m,
+ const T epsilon = std::numeric_limits<T>::epsilon());
+
+ //! Return if a matrix a null matrix.
+ //! From GLM_GTX_matrix_query extension.
+ template<typename T>
+ bool isNull(
+ const detail::tmat4x4<T>& m,
+ const T epsilon = std::numeric_limits<T>::epsilon());
+
+ //! Return if a matrix an identity matrix.
+ //! From GLM_GTX_matrix_query extension.
+ template<typename genType>
+ bool isIdentity(
+ const genType& m,
+ const typename genType::value_type epsilon = std::numeric_limits<typename genType::value_type>::epsilon());
+
+ //! Return if a matrix a normalized matrix.
+ //! From GLM_GTX_matrix_query extension.
+ template<typename T>
+ bool isNormalized(
+ const detail::tmat2x2<T>& m,
+ const T epsilon = std::numeric_limits<T>::epsilon());
+
+ //! Return if a matrix a normalized matrix.
+ //! From GLM_GTX_matrix_query extension.
+ template<typename T>
+ bool isNormalized(
+ const detail::tmat3x3<T>& m,
+ const T epsilon = std::numeric_limits<T>::epsilon());
+
+ //! Return if a matrix a normalized matrix.
+ //! From GLM_GTX_matrix_query extension.
+ template<typename T>
+ bool isNormalized(
+ const detail::tmat4x4<T>& m,
+ const T epsilon = std::numeric_limits<T>::epsilon());
+
+ //! Return if a matrix an orthonormalized matrix.
+ //! From GLM_GTX_matrix_query extension.
+ template<typename genType>
+ bool isOrthogonal(
+ const genType& m,
+ const typename genType::value_type epsilon = std::numeric_limits<typename genType::value_type>::epsilon());
+
+ /// @}
+}//namespace matrix_query
+}//namespace gtx
+}//namespace glm
+
+#include "matrix_query.inl"
+
+namespace glm{using namespace gtx::matrix_query;}
+
+#endif//glm_gtx_matrix_query
diff --git a/src/glm/gtx/matrix_query.inl b/src/glm/gtx/matrix_query.inl
new file mode 100644
index 0000000..deae669
--- /dev/null
+++ b/src/glm/gtx/matrix_query.inl
@@ -0,0 +1,144 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2007-03-05
+// Updated : 2007-03-05
+// Licence : This source is under MIT License
+// File : glm/gtx/matrix_query.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm{
+namespace gtx{
+namespace matrix_query
+{
+ template<typename T>
+ GLM_FUNC_QUALIFIER bool isNull(
+ const detail::tmat2x2<T>& m,
+ const T epsilon)
+ {
+ bool result = true;
+ for(int i = 0; result && i < 2 ; ++i)
+ result = isNull(m[i], epsilon);
+ return result;
+ }
+
+ template<typename T>
+ GLM_FUNC_QUALIFIER bool isNull(
+ const detail::tmat3x3<T>& m,
+ const T epsilon)
+ {
+ bool result = true;
+ for(int i = 0; result && i < 3 ; ++i)
+ result = isNull(m[i], epsilon);
+ return result;
+ }
+
+ template<typename T>
+ GLM_FUNC_QUALIFIER bool isNull(
+ const detail::tmat4x4<T>& m,
+ const T epsilon)
+ {
+ bool result = true;
+ for(int i = 0; result && i < 4 ; ++i)
+ result = isNull(m[i], epsilon);
+ return result;
+ }
+
+ template<typename genType>
+ GLM_FUNC_QUALIFIER bool isIdentity(
+ const genType& m,
+ const typename genType::value_type epsilon)
+ {
+ bool result = true;
+ for(typename genType::value_type i = typename genType::value_type(0); result && i < genType::col_size(); ++i)
+ {
+ for(typename genType::value_type j = typename genType::value_type(0); result && j < i ; ++j)
+ result = abs(m[i][j]) <= epsilon;
+ if(result)
+ result = abs(m[i][i] - typename genType::value_type(1)) <= epsilon;
+ for(typename genType::value_type j = i + typename genType::value_type(1); result && j < genType::row_size(); ++j)
+ result = abs(m[i][j]) <= epsilon;
+ }
+ return result;
+ }
+
+ template<typename T>
+ GLM_FUNC_QUALIFIER bool isNormalized(
+ const detail::tmat2x2<T>& m,
+ const T epsilon)
+ {
+ bool result = true;
+ for(int i = 0; result && i < 2; ++i)
+ result = isNormalized(m[i], epsilon);
+ for(int i = 0; result && i < 2; ++i)
+ {
+ detail::tvec2<T> v;
+ for(int j = 0; j < 2; ++j)
+ v[j] = m[j][i];
+ result = isNormalized(v, epsilon);
+ }
+ return result;
+ }
+
+ template<typename T>
+ GLM_FUNC_QUALIFIER bool isNormalized(
+ const detail::tmat3x3<T>& m,
+ const T epsilon)
+ {
+ bool result = true;
+ for(int i = 0; result && i < 3; ++i)
+ result = isNormalized(m[i], epsilon);
+ for(int i = 0; result && i < 3; ++i)
+ {
+ detail::tvec3<T> v;
+ for(int j = 0; j < 3; ++j)
+ v[j] = m[j][i];
+ result = isNormalized(v, epsilon);
+ }
+ return result;
+ }
+
+ template<typename T>
+ GLM_FUNC_QUALIFIER bool isNormalized(
+ const detail::tmat4x4<T>& m,
+ const T epsilon)
+ {
+ bool result = true;
+ for(int i = 0; result && i < 4; ++i)
+ result = isNormalized(m[i], epsilon);
+ for(int i = 0; result && i < 4; ++i)
+ {
+ detail::tvec4<T> v;
+ for(int j = 0; j < 4; ++j)
+ v[j] = m[j][i];
+ result = isNormalized(v, epsilon);
+ }
+ return result;
+ }
+
+ template<typename genType>
+ GLM_FUNC_QUALIFIER bool isOrthogonal(
+ const genType& m,
+ const typename genType::value_type epsilon)
+ {
+ bool result = true;
+ for(int i = 0; result && i < genType::col_size() - 1; ++i)
+ for(int j= i + 1; result && j < genType::col_size(); ++j)
+ result = areOrthogonal(m[i], m[j], epsilon);
+
+ if(result)
+ {
+ genType tmp = transpose(m);
+ for(int i = 0; result && i < genType::col_size() - 1 ; ++i)
+ for(int j = i + 1; result && j < genType::col_size(); ++j)
+ result = areOrthogonal(tmp[i], tmp[j], epsilon);
+ }
+ return result;
+ }
+
+}//namespace matrix_query
+}//namespace gtx
+}//namespace glm
diff --git a/src/glm/gtx/mixed_product.hpp b/src/glm/gtx/mixed_product.hpp
new file mode 100644
index 0000000..b4ebebd
--- /dev/null
+++ b/src/glm/gtx/mixed_product.hpp
@@ -0,0 +1,46 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2007-04-03
+// Updated : 2008-09-17
+// Licence : This source is under MIT License
+// File : glm/gtx/mixed_product.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_gtx_mixed_product
+#define glm_gtx_mixed_product
+
+// Dependency:
+#include "../glm.hpp"
+
+#if(defined(GLM_MESSAGES) && !defined(glm_ext))
+# pragma message("GLM: GLM_GTX_mixed_product extension included")
+#endif
+
+namespace glm{
+namespace gtx{
+namespace mixed_product ///< GLM_GTX_mixed_product extension: Mixed product of 3 vectors.
+{
+ /// \addtogroup gtx_mixed_product
+ /// @{
+
+ //! \brief Mixed product of 3 vectors (from GLM_GTX_mixed_product extension)
+ template <typename valType>
+ valType mixedProduct(
+ detail::tvec3<valType> const & v1,
+ detail::tvec3<valType> const & v2,
+ detail::tvec3<valType> const & v3);
+
+ /// @}
+}// namespace mixed_product
+}// namespace gtx
+}// namespace glm
+
+#include "mixed_product.inl"
+
+namespace glm{using namespace gtx::mixed_product;}
+
+#endif//glm_gtx_mixed_product
diff --git a/src/glm/gtx/mixed_product.inl b/src/glm/gtx/mixed_product.inl
new file mode 100644
index 0000000..a813606
--- /dev/null
+++ b/src/glm/gtx/mixed_product.inl
@@ -0,0 +1,36 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2007-04-03
+// Updated : 2008-09-17
+// Licence : This source is under MIT License
+// File : glm/gtx/mixed_product.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm{
+namespace gtx{
+
+namespace mixed_product
+{
+ template <typename valType>
+ GLM_FUNC_QUALIFIER valType mixedProduct(
+ detail::tvec3<valType> const & v1,
+ detail::tvec3<valType> const & v2,
+ detail::tvec3<valType> const & v3)
+ {
+ return dot(cross(v1, v2), v3);
+ }
+}
+//namespace mixed_product
+
+}//namespace gtx
+}//namespace glm
+
+
+
+
+
+
+
+
+
diff --git a/src/glm/gtx/multiple.hpp b/src/glm/gtx/multiple.hpp
new file mode 100644
index 0000000..cf7f858
--- /dev/null
+++ b/src/glm/gtx/multiple.hpp
@@ -0,0 +1,53 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2009-10-26
+// Updated : 2009-10-26
+// Licence : This source is under MIT License
+// File : glm/gtx/multiple.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_gtx_multiple
+#define glm_gtx_multiple
+
+// Dependency:
+#include "../glm.hpp"
+
+#if(defined(GLM_MESSAGES) && !defined(glm_ext))
+# pragma message("GLM: GLM_GTX_multiple extension included")
+#endif
+
+namespace glm{
+namespace gtx{
+namespace multiple ///< GLM_GTX_multiple: Find the closest number of a number multiple of other number.
+{
+ /// \addtogroup gtx_multiple
+ /// @{
+
+ //! Higher Multiple number of Source.
+ //! From GLM_GTX_multiple extension.
+ template <typename genType>
+ genType higherMultiple(
+ genType const & Source,
+ genType const & Multiple);
+
+ //! Lower Multiple number of Source.
+ //! From GLM_GTX_multiple extension.
+ template <typename genType>
+ genType lowerMultiple(
+ genType const & Source,
+ genType const & Multiple);
+
+ /// @}
+}//namespace multiple
+}//namespace gtx
+}//namespace glm
+
+#include "multiple.inl"
+
+namespace glm{using namespace gtx::multiple;}
+
+#endif//glm_gtx_multiple
diff --git a/src/glm/gtx/multiple.inl b/src/glm/gtx/multiple.inl
new file mode 100644
index 0000000..6ccf1ad
--- /dev/null
+++ b/src/glm/gtx/multiple.inl
@@ -0,0 +1,191 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2009-10-26
+// Updated : 2009-10-26
+// Licence : This source is under MIT License
+// File : glm/gtx/multiple.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm{
+namespace gtx{
+namespace multiple
+{
+ //////////////////////
+ // higherMultiple
+
+ template <typename genType>
+ GLM_FUNC_QUALIFIER genType higherMultiple
+ (
+ genType const & Source,
+ genType const & Multiple
+ )
+ {
+ genType Tmp = Source % Multiple;
+ return Tmp ? Source + Multiple - Tmp : Source;
+ }
+
+ template <>
+ GLM_FUNC_QUALIFIER detail::thalf higherMultiple
+ (
+ detail::thalf const & Source,
+ detail::thalf const & Multiple
+ )
+ {
+ int Tmp = int(float(Source)) % int(float(Multiple));
+ return Tmp ? Source + Multiple - detail::thalf(float(Tmp)) : Source;
+ }
+
+ template <>
+ GLM_FUNC_QUALIFIER float higherMultiple
+ (
+ float const & Source,
+ float const & Multiple
+ )
+ {
+ int Tmp = int(Source) % int(Multiple);
+ return Tmp ? Source + Multiple - float(Tmp) : Source;
+ }
+
+ template <>
+ GLM_FUNC_QUALIFIER double higherMultiple
+ (
+ double const & Source,
+ double const & Multiple
+ )
+ {
+ long Tmp = long(Source) % long(Multiple);
+ return Tmp ? Source + Multiple - double(Tmp) : Source;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> higherMultiple
+ (
+ detail::tvec2<T> const & Source,
+ detail::tvec2<T> const & Multiple
+ )
+ {
+ detail::tvec2<T> Result;
+ for(typename detail::tvec2<T>::size_type i = 0; i < detail::tvec2<T>::value_size(); ++i)
+ Result[i] = higherMultiple(Source[i], Multiple[i]);
+ return Result;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> higherMultiple
+ (
+ detail::tvec3<T> const & Source,
+ detail::tvec3<T> const & Multiple
+ )
+ {
+ detail::tvec3<T> Result;
+ for(typename detail::tvec3<T>::size_type i = 0; i < detail::tvec3<T>::value_size(); ++i)
+ Result[i] = higherMultiple(Source[i], Multiple[i]);
+ return Result;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> higherMultiple
+ (
+ detail::tvec4<T> const & Source,
+ detail::tvec4<T> const & Multiple
+ )
+ {
+ detail::tvec4<T> Result;
+ for(typename detail::tvec4<T>::size_type i = 0; i < detail::tvec4<T>::value_size(); ++i)
+ Result[i] = higherMultiple(Source[i], Multiple[i]);
+ return Result;
+ }
+
+ //////////////////////
+ // lowerMultiple
+
+ template <typename genType>
+ GLM_FUNC_QUALIFIER genType lowerMultiple
+ (
+ genType const & Source,
+ genType const & Multiple
+ )
+ {
+ genType Tmp = Source % Multiple;
+ return Tmp ? Source - Tmp : Source;
+ }
+
+ template <>
+ GLM_FUNC_QUALIFIER detail::thalf lowerMultiple
+ (
+ detail::thalf const & Source,
+ detail::thalf const & Multiple
+ )
+ {
+ int Tmp = int(float(Source)) % int(float(Multiple));
+ return Tmp ? Source - detail::thalf(float(Tmp)) : Source;
+ }
+
+ template <>
+ GLM_FUNC_QUALIFIER float lowerMultiple
+ (
+ float const & Source,
+ float const & Multiple
+ )
+ {
+ int Tmp = int(Source) % int(Multiple);
+ return Tmp ? Source - float(Tmp) : Source;
+ }
+
+ template <>
+ GLM_FUNC_QUALIFIER double lowerMultiple
+ (
+ double const & Source,
+ double const & Multiple
+ )
+ {
+ long Tmp = long(Source) % long(Multiple);
+ return Tmp ? Source - double(Tmp) : Source;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> lowerMultiple
+ (
+ detail::tvec2<T> const & Source,
+ detail::tvec2<T> const & Multiple
+ )
+ {
+ detail::tvec2<T> Result;
+ for(typename detail::tvec2<T>::size_type i = 0; i < detail::tvec2<T>::value_size(); ++i)
+ Result[i] = lowerMultiple(Source[i], Multiple[i]);
+ return Result;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> lowerMultiple
+ (
+ detail::tvec3<T> const & Source,
+ detail::tvec3<T> const & Multiple
+ )
+ {
+ detail::tvec3<T> Result;
+ for(typename detail::tvec3<T>::size_type i = 0; i < detail::tvec3<T>::value_size(); ++i)
+ Result[i] = lowerMultiple(Source[i], Multiple[i]);
+ return Result;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> lowerMultiple
+ (
+ detail::tvec4<T> const & Source,
+ detail::tvec4<T> const & Multiple
+ )
+ {
+ detail::tvec4<T> Result;
+ for(typename detail::tvec4<T>::size_type i = 0; i < detail::tvec4<T>::value_size(); ++i)
+ Result[i] = lowerMultiple(Source[i], Multiple[i]);
+ return Result;
+ }
+
+}//namespace multiple
+}//namespace gtx
+}//namespace glm
diff --git a/src/glm/gtx/noise.hpp b/src/glm/gtx/noise.hpp
new file mode 100644
index 0000000..bef412f
--- /dev/null
+++ b/src/glm/gtx/noise.hpp
@@ -0,0 +1,63 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Based on the work of Stefan Gustavson and Ashima Arts on "webgl-noise":
+// https://github.com/ashima/webgl-noise
+// Following Stefan Gustavson's paper "Simplex noise demystified":
+// http://www.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2011-04-21
+// Updated : 2011-04-21
+// Licence : This source is under MIT License
+// File : glm/gtx/noise.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_gtx_noise
+#define glm_gtx_noise
+
+// Dependency:
+#include "../glm.hpp"
+
+#if(defined(GLM_MESSAGES) && !defined(glm_ext))
+# pragma message("GLM: GLM_GTX_noise extension included")
+#endif
+
+namespace glm{
+namespace gtx{
+namespace noise ///< GLM_GTX_noise extension: Comparison functions for a user defined epsilon values.
+{
+ /// \addtogroup gtx_noise
+ /// @{
+
+ //! Classic perlin noise.
+ //! From GLM_GTX_noise extension.
+ template <typename T, template<typename> class vecType>
+ T perlin(
+ vecType<T> const & p);
+
+ //! Periodic perlin noise.
+ //! From GLM_GTX_noise extension.
+ template <typename T, template<typename> class vecType>
+ T perlin(
+ vecType<T> const & p,
+ vecType<T> const & rep);
+
+ //! Simplex noise.
+ //! From GLM_GTX_noise extension.
+ template <typename T, template<typename> class vecType>
+ T simplex(
+ vecType<T> const & p);
+
+ /// @}
+}//namespace noise
+}//namespace gtx
+}//namespace glm
+
+#include "noise.inl"
+
+namespace glm{using namespace gtx::noise;}
+
+#endif//glm_gtx_noise
diff --git a/src/glm/gtx/noise.inl b/src/glm/gtx/noise.inl
new file mode 100644
index 0000000..566074d
--- /dev/null
+++ b/src/glm/gtx/noise.inl
@@ -0,0 +1,792 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Based on the work of Stefan Gustavson and Ashima Arts on "webgl-noise":
+// https://github.com/ashima/webgl-noise
+// Following Stefan Gustavson's paper "Simplex noise demystified":
+// http://www.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2011-04-21
+// Updated : 2011-04-21
+// Licence : This source is under MIT License
+// File : glm/gtx/noise.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm
+{
+ template <typename T>
+ GLM_FUNC_QUALIFIER T permute(T const & x)
+ {
+ return mod(((x * T(34)) + T(1)) * x, T(289));
+ }
+
+ template <typename T, template<typename> class vecType>
+ GLM_FUNC_QUALIFIER vecType<T> permute(vecType<T> const & x)
+ {
+ return mod(((x * T(34)) + T(1)) * x, T(289));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER T taylorInvSqrt(T const & r)
+ {
+ return T(1.79284291400159) - T(0.85373472095314) * r;
+ }
+
+ template <typename T, template<typename> class vecType>
+ GLM_FUNC_QUALIFIER vecType<T> taylorInvSqrt(vecType<T> const & r)
+ {
+ return T(1.79284291400159) - T(0.85373472095314) * r;
+ }
+
+ template <typename T, template <typename> class vecType>
+ GLM_FUNC_QUALIFIER vecType<T> fade(vecType<T> const & t)
+ {
+ return t * t * t * (t * (t * T(6) - T(15)) + T(10));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> grad4(T const & j, detail::tvec4<T> const & ip)
+ {
+ detail::tvec3<T> pXYZ = floor(fract(detail::tvec3<T>(j) * detail::tvec3<T>(ip)) * T(7)) * ip[2] - T(1);
+ T pW = T(1.5) - dot(abs(pXYZ), detail::tvec3<T>(1));
+ detail::tvec4<T> s = detail::tvec4<T>(lessThan(detail::tvec4<T>(pXYZ, pW), detail::tvec4<T>(0.0)));
+ pXYZ = pXYZ + (detail::tvec3<T>(s) * T(2) - T(1)) * s.w;
+ return detail::tvec4<T>(pXYZ, pW);
+ }
+
+namespace gtx{
+namespace noise
+{
+ // Classic Perlin noise
+ template <typename T>
+ GLM_FUNC_QUALIFIER T perlin(detail::tvec2<T> const & P)
+ {
+ detail::tvec4<T> Pi = floor(detail::tvec4<T>(P.x, P.y, P.x, P.y)) + detail::tvec4<T>(0.0, 0.0, 1.0, 1.0);
+ detail::tvec4<T> Pf = fract(detail::tvec4<T>(P.x, P.y, P.x, P.y)) - detail::tvec4<T>(0.0, 0.0, 1.0, 1.0);
+ Pi = mod(Pi, T(289)); // To avoid truncation effects in permutation
+ detail::tvec4<T> ix(Pi.x, Pi.z, Pi.x, Pi.z);
+ detail::tvec4<T> iy(Pi.y, Pi.y, Pi.w, Pi.w);
+ detail::tvec4<T> fx(Pf.x, Pf.z, Pf.x, Pf.z);
+ detail::tvec4<T> fy(Pf.y, Pf.y, Pf.w, Pf.w);
+
+ detail::tvec4<T> i = permute(permute(ix) + iy);
+
+ detail::tvec4<T> gx = T(2) * fract(i / T(41)) - T(1);
+ detail::tvec4<T> gy = abs(gx) - T(0.5);
+ detail::tvec4<T> tx = floor(gx + T(0.5));
+ gx = gx - tx;
+
+ detail::tvec2<T> g00(gx.x, gy.x);
+ detail::tvec2<T> g10(gx.y, gy.y);
+ detail::tvec2<T> g01(gx.z, gy.z);
+ detail::tvec2<T> g11(gx.w, gy.w);
+
+ detail::tvec4<T> norm = taylorInvSqrt(detail::tvec4<T>(dot(g00, g00), dot(g01, g01), dot(g10, g10), dot(g11, g11)));
+ g00 *= norm.x;
+ g01 *= norm.y;
+ g10 *= norm.z;
+ g11 *= norm.w;
+
+ T n00 = dot(g00, detail::tvec2<T>(fx.x, fy.x));
+ T n10 = dot(g10, detail::tvec2<T>(fx.y, fy.y));
+ T n01 = dot(g01, detail::tvec2<T>(fx.z, fy.z));
+ T n11 = dot(g11, detail::tvec2<T>(fx.w, fy.w));
+
+ detail::tvec2<T> fade_xy = fade(detail::tvec2<T>(Pf.x, Pf.y));
+ detail::tvec2<T> n_x = mix(detail::tvec2<T>(n00, n01), detail::tvec2<T>(n10, n11), fade_xy.x);
+ T n_xy = mix(n_x.x, n_x.y, fade_xy.y);
+ return T(2.3) * n_xy;
+ }
+
+ // Classic Perlin noise
+ template <typename T>
+ GLM_FUNC_QUALIFIER T perlin(detail::tvec3<T> const & P)
+ {
+ detail::tvec3<T> Pi0 = floor(P); // Integer part for indexing
+ detail::tvec3<T> Pi1 = Pi0 + T(1); // Integer part + 1
+ Pi0 = mod(Pi0, T(289));
+ Pi1 = mod(Pi1, T(289));
+ detail::tvec3<T> Pf0 = fract(P); // Fractional part for interpolation
+ detail::tvec3<T> Pf1 = Pf0 - T(1); // Fractional part - 1.0
+ detail::tvec4<T> ix(Pi0.x, Pi1.x, Pi0.x, Pi1.x);
+ detail::tvec4<T> iy(Pi0.y, Pi0.y, Pi1.y, Pi1.y);
+ detail::tvec4<T> iz0(Pi0.z);
+ detail::tvec4<T> iz1(Pi1.z);
+
+ detail::tvec4<T> ixy = permute(permute(ix) + iy);
+ detail::tvec4<T> ixy0 = permute(ixy + iz0);
+ detail::tvec4<T> ixy1 = permute(ixy + iz1);
+
+ detail::tvec4<T> gx0 = ixy0 / T(7);
+ detail::tvec4<T> gy0 = fract(floor(gx0) / T(7)) - T(0.5);
+ gx0 = fract(gx0);
+ detail::tvec4<T> gz0 = detail::tvec4<T>(0.5) - abs(gx0) - abs(gy0);
+ detail::tvec4<T> sz0 = step(gz0, detail::tvec4<T>(0.0));
+ gx0 -= sz0 * (step(0.0, gx0) - T(0.5));
+ gy0 -= sz0 * (step(0.0, gy0) - T(0.5));
+
+ detail::tvec4<T> gx1 = ixy1 / T(7);
+ detail::tvec4<T> gy1 = fract(floor(gx1) / T(7)) - T(0.5);
+ gx1 = fract(gx1);
+ detail::tvec4<T> gz1 = detail::tvec4<T>(0.5) - abs(gx1) - abs(gy1);
+ detail::tvec4<T> sz1 = step(gz1, detail::tvec4<T>(0.0));
+ gx1 -= sz1 * (step(T(0), gx1) - T(0.5));
+ gy1 -= sz1 * (step(T(0), gy1) - T(0.5));
+
+ detail::tvec3<T> g000(gx0.x, gy0.x, gz0.x);
+ detail::tvec3<T> g100(gx0.y, gy0.y, gz0.y);
+ detail::tvec3<T> g010(gx0.z, gy0.z, gz0.z);
+ detail::tvec3<T> g110(gx0.w, gy0.w, gz0.w);
+ detail::tvec3<T> g001(gx1.x, gy1.x, gz1.x);
+ detail::tvec3<T> g101(gx1.y, gy1.y, gz1.y);
+ detail::tvec3<T> g011(gx1.z, gy1.z, gz1.z);
+ detail::tvec3<T> g111(gx1.w, gy1.w, gz1.w);
+
+ detail::tvec4<T> norm0 = taylorInvSqrt(detail::tvec4<T>(dot(g000, g000), dot(g010, g010), dot(g100, g100), dot(g110, g110)));
+ g000 *= norm0.x;
+ g010 *= norm0.y;
+ g100 *= norm0.z;
+ g110 *= norm0.w;
+ detail::tvec4<T> norm1 = taylorInvSqrt(detail::tvec4<T>(dot(g001, g001), dot(g011, g011), dot(g101, g101), dot(g111, g111)));
+ g001 *= norm1.x;
+ g011 *= norm1.y;
+ g101 *= norm1.z;
+ g111 *= norm1.w;
+
+ T n000 = dot(g000, Pf0);
+ T n100 = dot(g100, detail::tvec3<T>(Pf1.x, Pf0.y, Pf0.z));
+ T n010 = dot(g010, detail::tvec3<T>(Pf0.x, Pf1.y, Pf0.z));
+ T n110 = dot(g110, detail::tvec3<T>(Pf1.x, Pf1.y, Pf0.z));
+ T n001 = dot(g001, detail::tvec3<T>(Pf0.x, Pf0.y, Pf1.z));
+ T n101 = dot(g101, detail::tvec3<T>(Pf1.x, Pf0.y, Pf1.z));
+ T n011 = dot(g011, detail::tvec3<T>(Pf0.x, Pf1.y, Pf1.z));
+ T n111 = dot(g111, Pf1);
+
+ detail::tvec3<T> fade_xyz = fade(Pf0);
+ detail::tvec4<T> n_z = mix(detail::tvec4<T>(n000, n100, n010, n110), detail::tvec4<T>(n001, n101, n011, n111), fade_xyz.z);
+ detail::tvec2<T> n_yz = mix(
+ detail::tvec2<T>(n_z.x, n_z.y),
+ detail::tvec2<T>(n_z.z, n_z.w), fade_xyz.y);
+ T n_xyz = mix(n_yz.x, n_yz.y, fade_xyz.x);
+ return T(2.2) * n_xyz;
+ }
+
+ // Classic Perlin noise
+ template <typename T>
+ GLM_FUNC_QUALIFIER T perlin(detail::tvec4<T> const & P)
+ {
+ detail::tvec4<T> Pi0 = floor(P); // Integer part for indexing
+ detail::tvec4<T> Pi1 = Pi0 + T(1); // Integer part + 1
+ Pi0 = mod(Pi0, T(289));
+ Pi1 = mod(Pi1, T(289));
+ detail::tvec4<T> Pf0 = fract(P); // Fractional part for interpolation
+ detail::tvec4<T> Pf1 = Pf0 - T(1); // Fractional part - 1.0
+ detail::tvec4<T> ix(Pi0.x, Pi1.x, Pi0.x, Pi1.x);
+ detail::tvec4<T> iy(Pi0.y, Pi0.y, Pi1.y, Pi1.y);
+ detail::tvec4<T> iz0(Pi0.z);
+ detail::tvec4<T> iz1(Pi1.z);
+ detail::tvec4<T> iw0(Pi0.w);
+ detail::tvec4<T> iw1(Pi1.w);
+
+ detail::tvec4<T> ixy = permute(permute(ix) + iy);
+ detail::tvec4<T> ixy0 = permute(ixy + iz0);
+ detail::tvec4<T> ixy1 = permute(ixy + iz1);
+ detail::tvec4<T> ixy00 = permute(ixy0 + iw0);
+ detail::tvec4<T> ixy01 = permute(ixy0 + iw1);
+ detail::tvec4<T> ixy10 = permute(ixy1 + iw0);
+ detail::tvec4<T> ixy11 = permute(ixy1 + iw1);
+
+ detail::tvec4<T> gx00 = ixy00 / T(7);
+ detail::tvec4<T> gy00 = floor(gx00) / T(7);
+ detail::tvec4<T> gz00 = floor(gy00) / T(6);
+ gx00 = fract(gx00) - T(0.5);
+ gy00 = fract(gy00) - T(0.5);
+ gz00 = fract(gz00) - T(0.5);
+ detail::tvec4<T> gw00 = detail::tvec4<T>(0.75) - abs(gx00) - abs(gy00) - abs(gz00);
+ detail::tvec4<T> sw00 = step(gw00, detail::tvec4<T>(0.0));
+ gx00 -= sw00 * (step(T(0), gx00) - T(0.5));
+ gy00 -= sw00 * (step(T(0), gy00) - T(0.5));
+
+ detail::tvec4<T> gx01 = ixy01 / T(7);
+ detail::tvec4<T> gy01 = floor(gx01) / T(7);
+ detail::tvec4<T> gz01 = floor(gy01) / T(6);
+ gx01 = fract(gx01) - T(0.5);
+ gy01 = fract(gy01) - T(0.5);
+ gz01 = fract(gz01) - T(0.5);
+ detail::tvec4<T> gw01 = detail::tvec4<T>(0.75) - abs(gx01) - abs(gy01) - abs(gz01);
+ detail::tvec4<T> sw01 = step(gw01, detail::tvec4<T>(0.0));
+ gx01 -= sw01 * (step(T(0), gx01) - T(0.5));
+ gy01 -= sw01 * (step(T(0), gy01) - T(0.5));
+
+ detail::tvec4<T> gx10 = ixy10 / T(7);
+ detail::tvec4<T> gy10 = floor(gx10) / T(7);
+ detail::tvec4<T> gz10 = floor(gy10) / T(6);
+ gx10 = fract(gx10) - T(0.5);
+ gy10 = fract(gy10) - T(0.5);
+ gz10 = fract(gz10) - T(0.5);
+ detail::tvec4<T> gw10 = detail::tvec4<T>(0.75) - abs(gx10) - abs(gy10) - abs(gz10);
+ detail::tvec4<T> sw10 = step(gw10, detail::tvec4<T>(0));
+ gx10 -= sw10 * (step(T(0), gx10) - T(0.5));
+ gy10 -= sw10 * (step(T(0), gy10) - T(0.5));
+
+ detail::tvec4<T> gx11 = ixy11 / T(7);
+ detail::tvec4<T> gy11 = floor(gx11) / T(7);
+ detail::tvec4<T> gz11 = floor(gy11) / T(6);
+ gx11 = fract(gx11) - T(0.5);
+ gy11 = fract(gy11) - T(0.5);
+ gz11 = fract(gz11) - T(0.5);
+ detail::tvec4<T> gw11 = detail::tvec4<T>(0.75) - abs(gx11) - abs(gy11) - abs(gz11);
+ detail::tvec4<T> sw11 = step(gw11, detail::tvec4<T>(0.0));
+ gx11 -= sw11 * (step(T(0), gx11) - T(0.5));
+ gy11 -= sw11 * (step(T(0), gy11) - T(0.5));
+
+ detail::tvec4<T> g0000(gx00.x, gy00.x, gz00.x, gw00.x);
+ detail::tvec4<T> g1000(gx00.y, gy00.y, gz00.y, gw00.y);
+ detail::tvec4<T> g0100(gx00.z, gy00.z, gz00.z, gw00.z);
+ detail::tvec4<T> g1100(gx00.w, gy00.w, gz00.w, gw00.w);
+ detail::tvec4<T> g0010(gx10.x, gy10.x, gz10.x, gw10.x);
+ detail::tvec4<T> g1010(gx10.y, gy10.y, gz10.y, gw10.y);
+ detail::tvec4<T> g0110(gx10.z, gy10.z, gz10.z, gw10.z);
+ detail::tvec4<T> g1110(gx10.w, gy10.w, gz10.w, gw10.w);
+ detail::tvec4<T> g0001(gx01.x, gy01.x, gz01.x, gw01.x);
+ detail::tvec4<T> g1001(gx01.y, gy01.y, gz01.y, gw01.y);
+ detail::tvec4<T> g0101(gx01.z, gy01.z, gz01.z, gw01.z);
+ detail::tvec4<T> g1101(gx01.w, gy01.w, gz01.w, gw01.w);
+ detail::tvec4<T> g0011(gx11.x, gy11.x, gz11.x, gw11.x);
+ detail::tvec4<T> g1011(gx11.y, gy11.y, gz11.y, gw11.y);
+ detail::tvec4<T> g0111(gx11.z, gy11.z, gz11.z, gw11.z);
+ detail::tvec4<T> g1111(gx11.w, gy11.w, gz11.w, gw11.w);
+
+ detail::tvec4<T> norm00 = taylorInvSqrt(detail::tvec4<T>(dot(g0000, g0000), dot(g0100, g0100), dot(g1000, g1000), dot(g1100, g1100)));
+ g0000 *= norm00.x;
+ g0100 *= norm00.y;
+ g1000 *= norm00.z;
+ g1100 *= norm00.w;
+
+ detail::tvec4<T> norm01 = taylorInvSqrt(detail::tvec4<T>(dot(g0001, g0001), dot(g0101, g0101), dot(g1001, g1001), dot(g1101, g1101)));
+ g0001 *= norm01.x;
+ g0101 *= norm01.y;
+ g1001 *= norm01.z;
+ g1101 *= norm01.w;
+
+ detail::tvec4<T> norm10 = taylorInvSqrt(detail::tvec4<T>(dot(g0010, g0010), dot(g0110, g0110), dot(g1010, g1010), dot(g1110, g1110)));
+ g0010 *= norm10.x;
+ g0110 *= norm10.y;
+ g1010 *= norm10.z;
+ g1110 *= norm10.w;
+
+ detail::tvec4<T> norm11 = taylorInvSqrt(detail::tvec4<T>(dot(g0011, g0011), dot(g0111, g0111), dot(g1011, g1011), dot(g1111, g1111)));
+ g0011 *= norm11.x;
+ g0111 *= norm11.y;
+ g1011 *= norm11.z;
+ g1111 *= norm11.w;
+
+ T n0000 = dot(g0000, Pf0);
+ T n1000 = dot(g1000, detail::tvec4<T>(Pf1.x, Pf0.y, Pf0.z, Pf0.w));
+ T n0100 = dot(g0100, detail::tvec4<T>(Pf0.x, Pf1.y, Pf0.z, Pf0.w));
+ T n1100 = dot(g1100, detail::tvec4<T>(Pf1.x, Pf1.y, Pf0.z, Pf0.w));
+ T n0010 = dot(g0010, detail::tvec4<T>(Pf0.x, Pf0.y, Pf1.z, Pf0.w));
+ T n1010 = dot(g1010, detail::tvec4<T>(Pf1.x, Pf0.y, Pf1.z, Pf0.w));
+ T n0110 = dot(g0110, detail::tvec4<T>(Pf0.x, Pf1.y, Pf1.z, Pf0.w));
+ T n1110 = dot(g1110, detail::tvec4<T>(Pf1.x, Pf1.y, Pf1.z, Pf0.w));
+ T n0001 = dot(g0001, detail::tvec4<T>(Pf0.x, Pf0.y, Pf0.z, Pf1.w));
+ T n1001 = dot(g1001, detail::tvec4<T>(Pf1.x, Pf0.y, Pf0.z, Pf1.w));
+ T n0101 = dot(g0101, detail::tvec4<T>(Pf0.x, Pf1.y, Pf0.z, Pf1.w));
+ T n1101 = dot(g1101, detail::tvec4<T>(Pf1.x, Pf1.y, Pf0.z, Pf1.w));
+ T n0011 = dot(g0011, detail::tvec4<T>(Pf0.x, Pf0.y, Pf1.z, Pf1.w));
+ T n1011 = dot(g1011, detail::tvec4<T>(Pf1.x, Pf0.y, Pf1.z, Pf1.w));
+ T n0111 = dot(g0111, detail::tvec4<T>(Pf0.x, Pf1.y, Pf1.z, Pf1.w));
+ T n1111 = dot(g1111, Pf1);
+
+ detail::tvec4<T> fade_xyzw = fade(Pf0);
+ detail::tvec4<T> n_0w = mix(detail::tvec4<T>(n0000, n1000, n0100, n1100), detail::tvec4<T>(n0001, n1001, n0101, n1101), fade_xyzw.w);
+ detail::tvec4<T> n_1w = mix(detail::tvec4<T>(n0010, n1010, n0110, n1110), detail::tvec4<T>(n0011, n1011, n0111, n1111), fade_xyzw.w);
+ detail::tvec4<T> n_zw = mix(n_0w, n_1w, fade_xyzw.z);
+ detail::tvec2<T> n_yzw = mix(detail::tvec2<T>(n_zw.x, n_zw.y), detail::tvec2<T>(n_zw.z, n_zw.w), fade_xyzw.y);
+ T n_xyzw = mix(n_yzw.x, n_yzw.y, fade_xyzw.x);
+ return T(2.2) * n_xyzw;
+ }
+
+ // Classic Perlin noise, periodic variant
+ template <typename T>
+ GLM_FUNC_QUALIFIER T perlin(detail::tvec2<T> const & P, detail::tvec2<T> const & rep)
+ {
+ detail::tvec4<T> Pi = floor(detail::tvec4<T>(P.x, P.y, P.x, P.y)) + detail::tvec4<T>(0.0, 0.0, 1.0, 1.0);
+ detail::tvec4<T> Pf = fract(detail::tvec4<T>(P.x, P.y, P.x, P.y)) - detail::tvec4<T>(0.0, 0.0, 1.0, 1.0);
+ Pi = mod(Pi, detail::tvec4<T>(rep.x, rep.y, rep.x, rep.y)); // To create noise with explicit period
+ Pi = mod(Pi, T(289)); // To avoid truncation effects in permutation
+ detail::tvec4<T> ix(Pi.x, Pi.z, Pi.x, Pi.z);
+ detail::tvec4<T> iy(Pi.y, Pi.y, Pi.w, Pi.w);
+ detail::tvec4<T> fx(Pf.x, Pf.z, Pf.x, Pf.z);
+ detail::tvec4<T> fy(Pf.y, Pf.y, Pf.w, Pf.w);
+
+ detail::tvec4<T> i = permute(permute(ix) + iy);
+
+ detail::tvec4<T> gx = T(2) * fract(i / T(41)) - T(1);
+ detail::tvec4<T> gy = abs(gx) - T(0.5);
+ detail::tvec4<T> tx = floor(gx + T(0.5));
+ gx = gx - tx;
+
+ detail::tvec2<T> g00(gx.x, gy.x);
+ detail::tvec2<T> g10(gx.y, gy.y);
+ detail::tvec2<T> g01(gx.z, gy.z);
+ detail::tvec2<T> g11(gx.w, gy.w);
+
+ detail::tvec4<T> norm = taylorInvSqrt(detail::tvec4<T>(dot(g00, g00), dot(g01, g01), dot(g10, g10), dot(g11, g11)));
+ g00 *= norm.x;
+ g01 *= norm.y;
+ g10 *= norm.z;
+ g11 *= norm.w;
+
+ T n00 = dot(g00, detail::tvec2<T>(fx.x, fy.x));
+ T n10 = dot(g10, detail::tvec2<T>(fx.y, fy.y));
+ T n01 = dot(g01, detail::tvec2<T>(fx.z, fy.z));
+ T n11 = dot(g11, detail::tvec2<T>(fx.w, fy.w));
+
+ detail::tvec2<T> fade_xy = fade(detail::tvec2<T>(Pf.x, Pf.y));
+ detail::tvec2<T> n_x = mix(detail::tvec2<T>(n00, n01), detail::tvec2<T>(n10, n11), fade_xy.x);
+ T n_xy = mix(n_x.x, n_x.y, fade_xy.y);
+ return T(2.3) * n_xy;
+ }
+
+ // Classic Perlin noise, periodic variant
+ template <typename T>
+ GLM_FUNC_QUALIFIER T perlin(detail::tvec3<T> const & P, detail::tvec3<T> const & rep)
+ {
+ detail::tvec3<T> Pi0 = mod(floor(P), rep); // Integer part, modulo period
+ detail::tvec3<T> Pi1 = mod(Pi0 + detail::tvec3<T>(1.0), rep); // Integer part + 1, mod period
+ Pi0 = mod(Pi0, T(289));
+ Pi1 = mod(Pi1, T(289));
+ detail::tvec3<T> Pf0 = fract(P); // Fractional part for interpolation
+ detail::tvec3<T> Pf1 = Pf0 - detail::tvec3<T>(1.0); // Fractional part - 1.0
+ detail::tvec4<T> ix = detail::tvec4<T>(Pi0.x, Pi1.x, Pi0.x, Pi1.x);
+ detail::tvec4<T> iy = detail::tvec4<T>(Pi0.y, Pi0.y, Pi1.y, Pi1.y);
+ detail::tvec4<T> iz0(Pi0.z);
+ detail::tvec4<T> iz1(Pi1.z);
+
+ detail::tvec4<T> ixy = permute(permute(ix) + iy);
+ detail::tvec4<T> ixy0 = permute(ixy + iz0);
+ detail::tvec4<T> ixy1 = permute(ixy + iz1);
+
+ detail::tvec4<T> gx0 = ixy0 / T(7);
+ detail::tvec4<T> gy0 = fract(floor(gx0) / T(7)) - T(0.5);
+ gx0 = fract(gx0);
+ detail::tvec4<T> gz0 = detail::tvec4<T>(0.5) - abs(gx0) - abs(gy0);
+ detail::tvec4<T> sz0 = step(gz0, detail::tvec4<T>(0));
+ gx0 -= sz0 * (step(0.0, gx0) - T(0.5));
+ gy0 -= sz0 * (step(0.0, gy0) - T(0.5));
+
+ detail::tvec4<T> gx1 = ixy1 / T(7);
+ detail::tvec4<T> gy1 = fract(floor(gx1) / T(7)) - T(0.5);
+ gx1 = fract(gx1);
+ detail::tvec4<T> gz1 = detail::tvec4<T>(0.5) - abs(gx1) - abs(gy1);
+ detail::tvec4<T> sz1 = step(gz1, detail::tvec4<T>(0.0));
+ gx1 -= sz1 * (step(0.0, gx1) - T(0.5));
+ gy1 -= sz1 * (step(0.0, gy1) - T(0.5));
+
+ detail::tvec3<T> g000 = detail::tvec3<T>(gx0.x, gy0.x, gz0.x);
+ detail::tvec3<T> g100 = detail::tvec3<T>(gx0.y, gy0.y, gz0.y);
+ detail::tvec3<T> g010 = detail::tvec3<T>(gx0.z, gy0.z, gz0.z);
+ detail::tvec3<T> g110 = detail::tvec3<T>(gx0.w, gy0.w, gz0.w);
+ detail::tvec3<T> g001 = detail::tvec3<T>(gx1.x, gy1.x, gz1.x);
+ detail::tvec3<T> g101 = detail::tvec3<T>(gx1.y, gy1.y, gz1.y);
+ detail::tvec3<T> g011 = detail::tvec3<T>(gx1.z, gy1.z, gz1.z);
+ detail::tvec3<T> g111 = detail::tvec3<T>(gx1.w, gy1.w, gz1.w);
+
+ detail::tvec4<T> norm0 = taylorInvSqrt(detail::tvec4<T>(dot(g000, g000), dot(g010, g010), dot(g100, g100), dot(g110, g110)));
+ g000 *= norm0.x;
+ g010 *= norm0.y;
+ g100 *= norm0.z;
+ g110 *= norm0.w;
+ detail::tvec4<T> norm1 = taylorInvSqrt(detail::tvec4<T>(dot(g001, g001), dot(g011, g011), dot(g101, g101), dot(g111, g111)));
+ g001 *= norm1.x;
+ g011 *= norm1.y;
+ g101 *= norm1.z;
+ g111 *= norm1.w;
+
+ T n000 = dot(g000, Pf0);
+ T n100 = dot(g100, detail::tvec3<T>(Pf1.x, Pf0.y, Pf0.z));
+ T n010 = dot(g010, detail::tvec3<T>(Pf0.x, Pf1.y, Pf0.z));
+ T n110 = dot(g110, detail::tvec3<T>(Pf1.x, Pf1.y, Pf0.z));
+ T n001 = dot(g001, detail::tvec3<T>(Pf0.x, Pf0.y, Pf1.z));
+ T n101 = dot(g101, detail::tvec3<T>(Pf1.x, Pf0.y, Pf1.z));
+ T n011 = dot(g011, detail::tvec3<T>(Pf0.x, Pf1.y, Pf1.z));
+ T n111 = dot(g111, Pf1);
+
+ detail::tvec3<T> fade_xyz = fade(Pf0);
+ detail::tvec4<T> n_z = mix(detail::tvec4<T>(n000, n100, n010, n110), detail::tvec4<T>(n001, n101, n011, n111), fade_xyz.z);
+ detail::tvec2<T> n_yz = mix(detail::tvec2<T>(n_z.x, n_z.y), detail::tvec2<T>(n_z.z, n_z.w), fade_xyz.y);
+ T n_xyz = mix(n_yz.x, n_yz.y, fade_xyz.x);
+ return T(2.2) * n_xyz;
+ }
+
+ // Classic Perlin noise, periodic version
+ template <typename T>
+ GLM_FUNC_QUALIFIER T perlin(detail::tvec4<T> const & P, detail::tvec4<T> const & rep)
+ {
+ detail::tvec4<T> Pi0 = mod(floor(P), rep); // Integer part modulo rep
+ detail::tvec4<T> Pi1 = mod(Pi0 + T(1), rep); // Integer part + 1 mod rep
+ detail::tvec4<T> Pf0 = fract(P); // Fractional part for interpolation
+ detail::tvec4<T> Pf1 = Pf0 - T(1); // Fractional part - 1.0
+ detail::tvec4<T> ix = detail::tvec4<T>(Pi0.x, Pi1.x, Pi0.x, Pi1.x);
+ detail::tvec4<T> iy = detail::tvec4<T>(Pi0.y, Pi0.y, Pi1.y, Pi1.y);
+ detail::tvec4<T> iz0(Pi0.z);
+ detail::tvec4<T> iz1(Pi1.z);
+ detail::tvec4<T> iw0(Pi0.w);
+ detail::tvec4<T> iw1(Pi1.w);
+
+ detail::tvec4<T> ixy = permute(permute(ix) + iy);
+ detail::tvec4<T> ixy0 = permute(ixy + iz0);
+ detail::tvec4<T> ixy1 = permute(ixy + iz1);
+ detail::tvec4<T> ixy00 = permute(ixy0 + iw0);
+ detail::tvec4<T> ixy01 = permute(ixy0 + iw1);
+ detail::tvec4<T> ixy10 = permute(ixy1 + iw0);
+ detail::tvec4<T> ixy11 = permute(ixy1 + iw1);
+
+ detail::tvec4<T> gx00 = ixy00 / T(7);
+ detail::tvec4<T> gy00 = floor(gx00) / T(7);
+ detail::tvec4<T> gz00 = floor(gy00) / T(6);
+ gx00 = fract(gx00) - T(0.5);
+ gy00 = fract(gy00) - T(0.5);
+ gz00 = fract(gz00) - T(0.5);
+ detail::tvec4<T> gw00 = detail::tvec4<T>(0.75) - abs(gx00) - abs(gy00) - abs(gz00);
+ detail::tvec4<T> sw00 = step(gw00, detail::tvec4<T>(0));
+ gx00 -= sw00 * (step(0.0, gx00) - T(0.5));
+ gy00 -= sw00 * (step(0.0, gy00) - T(0.5));
+
+ detail::tvec4<T> gx01 = ixy01 / T(7);
+ detail::tvec4<T> gy01 = floor(gx01) / T(7);
+ detail::tvec4<T> gz01 = floor(gy01) / T(6);
+ gx01 = fract(gx01) - T(0.5);
+ gy01 = fract(gy01) - T(0.5);
+ gz01 = fract(gz01) - T(0.5);
+ detail::tvec4<T> gw01 = detail::tvec4<T>(0.75) - abs(gx01) - abs(gy01) - abs(gz01);
+ detail::tvec4<T> sw01 = step(gw01, detail::tvec4<T>(0.0));
+ gx01 -= sw01 * (step(0.0, gx01) - T(0.5));
+ gy01 -= sw01 * (step(0.0, gy01) - T(0.5));
+
+ detail::tvec4<T> gx10 = ixy10 / T(7);
+ detail::tvec4<T> gy10 = floor(gx10) / T(7);
+ detail::tvec4<T> gz10 = floor(gy10) / T(6);
+ gx10 = fract(gx10) - T(0.5);
+ gy10 = fract(gy10) - T(0.5);
+ gz10 = fract(gz10) - T(0.5);
+ detail::tvec4<T> gw10 = detail::tvec4<T>(0.75) - abs(gx10) - abs(gy10) - abs(gz10);
+ detail::tvec4<T> sw10 = step(gw10, detail::tvec4<T>(0.0));
+ gx10 -= sw10 * (step(0.0, gx10) - T(0.5));
+ gy10 -= sw10 * (step(0.0, gy10) - T(0.5));
+
+ detail::tvec4<T> gx11 = ixy11 / T(7);
+ detail::tvec4<T> gy11 = floor(gx11) / T(7);
+ detail::tvec4<T> gz11 = floor(gy11) / T(6);
+ gx11 = fract(gx11) - T(0.5);
+ gy11 = fract(gy11) - T(0.5);
+ gz11 = fract(gz11) - T(0.5);
+ detail::tvec4<T> gw11 = detail::tvec4<T>(0.75) - abs(gx11) - abs(gy11) - abs(gz11);
+ detail::tvec4<T> sw11 = step(gw11, detail::tvec4<T>(0.0));
+ gx11 -= sw11 * (step(0.0, gx11) - T(0.5));
+ gy11 -= sw11 * (step(0.0, gy11) - T(0.5));
+
+ detail::tvec4<T> g0000(gx00.x, gy00.x, gz00.x, gw00.x);
+ detail::tvec4<T> g1000(gx00.y, gy00.y, gz00.y, gw00.y);
+ detail::tvec4<T> g0100(gx00.z, gy00.z, gz00.z, gw00.z);
+ detail::tvec4<T> g1100(gx00.w, gy00.w, gz00.w, gw00.w);
+ detail::tvec4<T> g0010(gx10.x, gy10.x, gz10.x, gw10.x);
+ detail::tvec4<T> g1010(gx10.y, gy10.y, gz10.y, gw10.y);
+ detail::tvec4<T> g0110(gx10.z, gy10.z, gz10.z, gw10.z);
+ detail::tvec4<T> g1110(gx10.w, gy10.w, gz10.w, gw10.w);
+ detail::tvec4<T> g0001(gx01.x, gy01.x, gz01.x, gw01.x);
+ detail::tvec4<T> g1001(gx01.y, gy01.y, gz01.y, gw01.y);
+ detail::tvec4<T> g0101(gx01.z, gy01.z, gz01.z, gw01.z);
+ detail::tvec4<T> g1101(gx01.w, gy01.w, gz01.w, gw01.w);
+ detail::tvec4<T> g0011(gx11.x, gy11.x, gz11.x, gw11.x);
+ detail::tvec4<T> g1011(gx11.y, gy11.y, gz11.y, gw11.y);
+ detail::tvec4<T> g0111(gx11.z, gy11.z, gz11.z, gw11.z);
+ detail::tvec4<T> g1111(gx11.w, gy11.w, gz11.w, gw11.w);
+
+ detail::tvec4<T> norm00 = taylorInvSqrt(detail::tvec4<T>(dot(g0000, g0000), dot(g0100, g0100), dot(g1000, g1000), dot(g1100, g1100)));
+ g0000 *= norm00.x;
+ g0100 *= norm00.y;
+ g1000 *= norm00.z;
+ g1100 *= norm00.w;
+
+ detail::tvec4<T> norm01 = taylorInvSqrt(detail::tvec4<T>(dot(g0001, g0001), dot(g0101, g0101), dot(g1001, g1001), dot(g1101, g1101)));
+ g0001 *= norm01.x;
+ g0101 *= norm01.y;
+ g1001 *= norm01.z;
+ g1101 *= norm01.w;
+
+ detail::tvec4<T> norm10 = taylorInvSqrt(detail::tvec4<T>(dot(g0010, g0010), dot(g0110, g0110), dot(g1010, g1010), dot(g1110, g1110)));
+ g0010 *= norm10.x;
+ g0110 *= norm10.y;
+ g1010 *= norm10.z;
+ g1110 *= norm10.w;
+
+ detail::tvec4<T> norm11 = taylorInvSqrt(detail::tvec4<T>(dot(g0011, g0011), dot(g0111, g0111), dot(g1011, g1011), dot(g1111, g1111)));
+ g0011 *= norm11.x;
+ g0111 *= norm11.y;
+ g1011 *= norm11.z;
+ g1111 *= norm11.w;
+
+ T n0000 = dot(g0000, Pf0);
+ T n1000 = dot(g1000, detail::tvec4<T>(Pf1.x, Pf0.y, Pf0.z, Pf0.w));
+ T n0100 = dot(g0100, detail::tvec4<T>(Pf0.x, Pf1.y, Pf0.z, Pf0.w));
+ T n1100 = dot(g1100, detail::tvec4<T>(Pf1.x, Pf1.y, Pf0.z, Pf0.w));
+ T n0010 = dot(g0010, detail::tvec4<T>(Pf0.x, Pf0.y, Pf1.z, Pf0.w));
+ T n1010 = dot(g1010, detail::tvec4<T>(Pf1.x, Pf0.y, Pf1.z, Pf0.w));
+ T n0110 = dot(g0110, detail::tvec4<T>(Pf0.x, Pf1.y, Pf1.z, Pf0.w));
+ T n1110 = dot(g1110, detail::tvec4<T>(Pf1.x, Pf1.y, Pf1.z, Pf0.w));
+ T n0001 = dot(g0001, detail::tvec4<T>(Pf0.x, Pf0.y, Pf0.z, Pf1.w));
+ T n1001 = dot(g1001, detail::tvec4<T>(Pf1.x, Pf0.y, Pf0.z, Pf1.w));
+ T n0101 = dot(g0101, detail::tvec4<T>(Pf0.x, Pf1.y, Pf0.z, Pf1.w));
+ T n1101 = dot(g1101, detail::tvec4<T>(Pf1.x, Pf1.y, Pf0.z, Pf1.w));
+ T n0011 = dot(g0011, detail::tvec4<T>(Pf0.x, Pf0.y, Pf1.z, Pf1.w));
+ T n1011 = dot(g1011, detail::tvec4<T>(Pf1.x, Pf0.y, Pf1.z, Pf1.w));
+ T n0111 = dot(g0111, detail::tvec4<T>(Pf0.x, Pf1.y, Pf1.z, Pf1.w));
+ T n1111 = dot(g1111, Pf1);
+
+ detail::tvec4<T> fade_xyzw = fade(Pf0);
+ detail::tvec4<T> n_0w = mix(detail::tvec4<T>(n0000, n1000, n0100, n1100), detail::tvec4<T>(n0001, n1001, n0101, n1101), fade_xyzw.w);
+ detail::tvec4<T> n_1w = mix(detail::tvec4<T>(n0010, n1010, n0110, n1110), detail::tvec4<T>(n0011, n1011, n0111, n1111), fade_xyzw.w);
+ detail::tvec4<T> n_zw = mix(n_0w, n_1w, fade_xyzw.z);
+ detail::tvec2<T> n_yzw = mix(detail::tvec2<T>(n_zw.x, n_zw.y), detail::tvec2<T>(n_zw.z, n_zw.w), fade_xyzw.y);
+ T n_xyzw = mix(n_yzw.x, n_yzw.y, fade_xyzw.x);
+ return T(2.2) * n_xyzw;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER T simplex(glm::detail::tvec2<T> const & v)
+ {
+ detail::tvec4<T> const C = detail::tvec4<T>(
+ T( 0.211324865405187), // (3.0 - sqrt(3.0)) / 6.0
+ T( 0.366025403784439), // 0.5 * (sqrt(3.0) - 1.0)
+ T(-0.577350269189626), // -1.0 + 2.0 * C.x
+ T( 0.024390243902439)); // 1.0 / 41.0
+
+ // First corner
+ detail::tvec2<T> i = floor(v + dot(v, detail::tvec2<T>(C[1])));
+ detail::tvec2<T> x0 = v - i + dot(i, detail::tvec2<T>(C[0]));
+
+ // Other corners
+ //i1.x = step( x0.y, x0.x ); // x0.x > x0.y ? 1.0 : 0.0
+ //i1.y = 1.0 - i1.x;
+ detail::tvec2<T> i1 = (x0.x > x0.y) ? detail::tvec2<T>(1, 0) : detail::tvec2<T>(0, 1);
+ // x0 = x0 - 0.0 + 0.0 * C.xx ;
+ // x1 = x0 - i1 + 1.0 * C.xx ;
+ // x2 = x0 - 1.0 + 2.0 * C.xx ;
+ detail::tvec4<T> x12 = detail::tvec4<T>(x0.x, x0.y, x0.x, x0.y) + detail::tvec4<T>(C.x, C.x, C.z, C.z);
+ x12 = detail::tvec4<T>(detail::tvec2<T>(x12) - i1, x12.z, x12.w);
+
+ // Permutations
+ i = mod(i, T(289)); // Avoid truncation effects in permutation
+ detail::tvec3<T> p = permute(
+ permute(i.y + detail::tvec3<T>(T(0), i1.y, T(1)))
+ + i.x + detail::tvec3<T>(T(0), i1.x, T(1)));
+
+ detail::tvec3<T> m = max(T(0.5) - detail::tvec3<T>(
+ dot(x0, x0),
+ dot(detail::tvec2<T>(x12.x, x12.y), detail::tvec2<T>(x12.x, x12.y)),
+ dot(detail::tvec2<T>(x12.z, x12.w), detail::tvec2<T>(x12.z, x12.w))), T(0));
+ m = m * m ;
+ m = m * m ;
+
+ // Gradients: 41 points uniformly over a line, mapped onto a diamond.
+ // The ring size 17*17 = 289 is close to a multiple of 41 (41*7 = 287)
+
+ detail::tvec3<T> x = T(2) * fract(p * C.w) - T(1);
+ detail::tvec3<T> h = abs(x) - T(0.5);
+ detail::tvec3<T> ox = floor(x + T(0.5));
+ detail::tvec3<T> a0 = x - ox;
+
+ // Normalise gradients implicitly by scaling m
+ // Inlined for speed: m *= taylorInvSqrt( a0*a0 + h*h );
+ m *= T(1.79284291400159) - T(0.85373472095314) * (a0 * a0 + h * h);
+
+ // Compute final noise value at P
+ detail::tvec3<T> g;
+ g.x = a0.x * x0.x + h.x * x0.y;
+ //g.yz = a0.yz * x12.xz + h.yz * x12.yw;
+ g.y = a0.y * x12.x + h.y * x12.y;
+ g.z = a0.z * x12.z + h.z * x12.w;
+ return T(130) * dot(m, g);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER T simplex(detail::tvec3<T> const & v)
+ {
+ detail::tvec2<T> const C = detail::tvec2<T>(1.0 / 6.0, 1.0 / 3.0);
+ detail::tvec4<T> const D = detail::tvec4<T>(0.0, 0.5, 1.0, 2.0);
+
+ // First corner
+ detail::tvec3<T> i = floor(v + dot(v, detail::tvec3<T>(C.y)));
+ detail::tvec3<T> x0 = v - i + dot(i, detail::tvec3<T>(C.x));
+
+ // Other corners
+ detail::tvec3<T> g = step(detail::tvec3<T>(x0.y, x0.z, x0.x), detail::tvec3<T>(x0.x, x0.y, x0.z));
+ detail::tvec3<T> l = T(1) - g;
+ detail::tvec3<T> i1 = min(detail::tvec3<T>(g.x, g.y, g.z), detail::tvec3<T>(l.z, l.x, l.y));
+ detail::tvec3<T> i2 = max(detail::tvec3<T>(g.x, g.y, g.z), detail::tvec3<T>(l.z, l.x, l.y));
+
+ // x0 = x0 - 0.0 + 0.0 * C.xxx;
+ // x1 = x0 - i1 + 1.0 * C.xxx;
+ // x2 = x0 - i2 + 2.0 * C.xxx;
+ // x3 = x0 - 1.0 + 3.0 * C.xxx;
+ detail::tvec3<T> x1 = x0 - i1 + C.x;
+ detail::tvec3<T> x2 = x0 - i2 + C.y; // 2.0*C.x = 1/3 = C.y
+ detail::tvec3<T> x3 = x0 - D.y; // -1.0+3.0*C.x = -0.5 = -D.y
+
+ // Permutations
+ i = mod(i, T(289));
+ detail::tvec4<T> p = permute(permute(permute(
+ i.z + detail::tvec4<T>(0.0, i1.z, i2.z, 1.0)) +
+ i.y + detail::tvec4<T>(0.0, i1.y, i2.y, 1.0)) +
+ i.x + detail::tvec4<T>(0.0, i1.x, i2.x, 1.0));
+
+ // Gradients: 7x7 points over a square, mapped onto an octahedron.
+ // The ring size 17*17 = 289 is close to a multiple of 49 (49*6 = 294)
+ T n_ = T(0.142857142857); // 1.0/7.0
+ detail::tvec3<T> ns = n_ * detail::tvec3<T>(D.w, D.y, D.z) - detail::tvec3<T>(D.x, D.z, D.x);
+
+ detail::tvec4<T> j = p - T(49) * floor(p * ns.z * ns.z); // mod(p,7*7)
+
+ detail::tvec4<T> x_ = floor(j * ns.z);
+ detail::tvec4<T> y_ = floor(j - T(7) * x_); // mod(j,N)
+
+ detail::tvec4<T> x = x_ * ns.x + ns.y;
+ detail::tvec4<T> y = y_ * ns.x + ns.y;
+ detail::tvec4<T> h = T(1) - abs(x) - abs(y);
+
+ detail::tvec4<T> b0 = detail::tvec4<T>(x.x, x.y, y.x, y.y);
+ detail::tvec4<T> b1 = detail::tvec4<T>(x.z, x.w, y.z, y.w);
+
+ //vec4 s0 = vec4(lessThan(b0,0.0))*2.0 - 1.0;
+ //vec4 s1 = vec4(lessThan(b1,0.0))*2.0 - 1.0;
+ detail::tvec4<T> s0 = floor(b0) * T(2) + T(1);
+ detail::tvec4<T> s1 = floor(b1) * T(2) + T(1);
+ detail::tvec4<T> sh = -step(h, detail::tvec4<T>(0));
+
+ detail::tvec4<T> a0 = b0 + s0 * detail::tvec4<T>(sh.x, sh.x, sh.y, sh.y);
+ detail::tvec4<T> a1 = b1 + s1 * detail::tvec4<T>(sh.z, sh.z, sh.w, sh.w);
+
+ detail::tvec3<T> p0 = vec3(a0.x, a0.y, h.x);
+ detail::tvec3<T> p1 = vec3(a0.z, a0.w, h.y);
+ detail::tvec3<T> p2 = vec3(a1.x, a1.y, h.z);
+ detail::tvec3<T> p3 = vec3(a1.z, a1.w, h.w);
+
+ //Normalise gradients
+ detail::tvec4<T> norm = taylorInvSqrt(detail::tvec4<T>(
+ dot(p0, p0),
+ dot(p1, p1),
+ dot(p2, p2),
+ dot(p3, p3)));
+ p0 *= norm.x;
+ p1 *= norm.y;
+ p2 *= norm.z;
+ p3 *= norm.w;
+
+ // Mix final noise value
+ vec4 m = max(T(0.6) - detail::tvec4<T>(
+ dot(x0, x0),
+ dot(x1, x1),
+ dot(x2, x2),
+ dot(x3, x3)), T(0));
+ m = m * m;
+ return T(42) * dot(m * m, detail::tvec4<T>(
+ dot(p0, x0),
+ dot(p1, x1),
+ dot(p2, x2),
+ dot(p3, x3)));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER T simplex(detail::tvec4<T> const & v)
+ {
+ detail::tvec4<T> const C(
+ 0.138196601125011, // (5 - sqrt(5))/20 G4
+ 0.276393202250021, // 2 * G4
+ 0.414589803375032, // 3 * G4
+ -0.447213595499958); // -1 + 4 * G4
+
+ // (sqrt(5) - 1)/4 = F4, used once below
+ T const F4 = T(0.309016994374947451);
+
+ // First corner
+ detail::tvec4<T> i = floor(v + dot(v, vec4(F4)));
+ detail::tvec4<T> x0 = v - i + dot(i, vec4(C.x));
+
+ // Other corners
+
+ // Rank sorting originally contributed by Bill Licea-Kane, AMD (formerly ATI)
+ detail::tvec4<T> i0;
+ detail::tvec3<T> isX = step(detail::tvec3<T>(x0.y, x0.z, x0.w), detail::tvec3<T>(x0.x));
+ detail::tvec3<T> isYZ = step(detail::tvec3<T>(x0.z, x0.w, x0.w), detail::tvec3<T>(x0.y, x0.y, x0.z));
+ // i0.x = dot(isX, vec3(1.0));
+ //i0.x = isX.x + isX.y + isX.z;
+ //i0.yzw = T(1) - isX;
+ i0 = detail::tvec4<T>(isX.x + isX.y + isX.z, T(1) - isX);
+ // i0.y += dot(isYZ.xy, vec2(1.0));
+ i0.y += isYZ.x + isYZ.y;
+ //i0.zw += 1.0 - detail::tvec2<T>(isYZ.x, isYZ.y);
+ i0.z += T(1) - isYZ.x;
+ i0.w += T(1) - isYZ.y;
+ i0.z += isYZ.z;
+ i0.w += T(1) - isYZ.z;
+
+ // i0 now contains the unique values 0,1,2,3 in each channel
+ detail::tvec4<T> i3 = clamp(i0, 0.0, 1.0);
+ detail::tvec4<T> i2 = clamp(i0 - 1.0, 0.0, 1.0);
+ detail::tvec4<T> i1 = clamp(i0 - 2.0, 0.0, 1.0);
+
+ // x0 = x0 - 0.0 + 0.0 * C.xxxx
+ // x1 = x0 - i1 + 0.0 * C.xxxx
+ // x2 = x0 - i2 + 0.0 * C.xxxx
+ // x3 = x0 - i3 + 0.0 * C.xxxx
+ // x4 = x0 - 1.0 + 4.0 * C.xxxx
+ detail::tvec4<T> x1 = x0 - i1 + C.x;
+ detail::tvec4<T> x2 = x0 - i2 + C.y;
+ detail::tvec4<T> x3 = x0 - i3 + C.z;
+ detail::tvec4<T> x4 = x0 + C.w;
+
+ // Permutations
+ i = mod(i, T(289));
+ T j0 = permute(permute(permute(permute(i.w) + i.z) + i.y) + i.x);
+ detail::tvec4<T> j1 = permute(permute(permute(permute(
+ i.w + detail::tvec4<T>(i1.w, i2.w, i3.w, T(1)))
+ + i.z + detail::tvec4<T>(i1.z, i2.z, i3.z, T(1)))
+ + i.y + detail::tvec4<T>(i1.y, i2.y, i3.y, T(1)))
+ + i.x + detail::tvec4<T>(i1.x, i2.x, i3.x, T(1)));
+
+ // Gradients: 7x7x6 points over a cube, mapped onto a 4-cross polytope
+ // 7*7*6 = 294, which is close to the ring size 17*17 = 289.
+ detail::tvec4<T> ip = detail::tvec4<T>(T(1) / T(294), T(1) / T(49), T(1) / T(7), T(0));
+
+ detail::tvec4<T> p0 = grad4(j0, ip);
+ detail::tvec4<T> p1 = grad4(j1.x, ip);
+ detail::tvec4<T> p2 = grad4(j1.y, ip);
+ detail::tvec4<T> p3 = grad4(j1.z, ip);
+ detail::tvec4<T> p4 = grad4(j1.w, ip);
+
+ // Normalise gradients
+ detail::tvec4<T> norm = taylorInvSqrt(detail::tvec4<T>(dot(p0, p0), dot(p1, p1), dot(p2, p2), dot(p3, p3)));
+ p0 *= norm.x;
+ p1 *= norm.y;
+ p2 *= norm.z;
+ p3 *= norm.w;
+ p4 *= taylorInvSqrt(dot(p4, p4));
+
+ // Mix contributions from the five corners
+ detail::tvec3<T> m0 = max(T(0.6) - detail::tvec3<T>(dot(x0, x0), dot(x1, x1), dot(x2, x2)), T(0));
+ detail::tvec2<T> m1 = max(T(0.6) - detail::tvec2<T>(dot(x3, x3), dot(x4, x4) ), T(0));
+ m0 = m0 * m0;
+ m1 = m1 * m1;
+ return T(49) *
+ (dot(m0 * m0, detail::tvec3<T>(dot(p0, x0), dot(p1, x1), dot(p2, x2))) +
+ dot(m1 * m1, detail::tvec2<T>(dot(p3, x3), dot(p4, x4))));
+ }
+
+}//namespace noise
+}//namespace gtx
+}//namespace glm
diff --git a/src/glm/gtx/norm.hpp b/src/glm/gtx/norm.hpp
new file mode 100644
index 0000000..af0d630
--- /dev/null
+++ b/src/glm/gtx/norm.hpp
@@ -0,0 +1,143 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2005-12-21
+// Updated : 2008-07-24
+// Licence : This source is under MIT License
+// File : glm/gtx/norm.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+// - GLM_GTX_quaternion
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// ToDo:
+// - Study the validity of the notion of length2 to quaternion
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_gtx_norm
+#define glm_gtx_norm
+
+// Dependency:
+#include "../glm.hpp"
+#include "../gtx/quaternion.hpp"
+
+#if(defined(GLM_MESSAGES) && !defined(glm_ext))
+# pragma message("GLM: GLM_GTX_norm extension included")
+#endif
+
+namespace glm{
+namespace gtx{
+namespace norm ///< GLM_GTX_norm extension: Various way to compute vector norms.
+{
+ /// \addtogroup gtx_norm
+ /// @{
+
+ //! Returns the squared length of x.
+ //! From GLM_GTX_norm extension.
+ template <typename T>
+ T length2(
+ const T x);
+
+ //! Returns the squared length of x.
+ //! From GLM_GTX_norm extension.
+ template <typename T>
+ T length2(
+ const detail::tvec2<T> & x);
+
+ //! Returns the squared length of x.
+ //! From GLM_GTX_norm extension.
+ template <typename T>
+ T length2(
+ const detail::tvec3<T>& x);
+
+ //! Returns the squared length of x.
+ //! From GLM_GTX_norm extension.
+ template <typename T>
+ T length2(
+ const detail::tvec4<T>& x);
+
+ //! Returns the squared length of x.
+ //! From GLM_GTX_norm extension.
+ template <typename T>
+ T length2(
+ const detail::tquat<T>& q);
+
+ //! Returns the squared distance between p0 and p1, i.e., length(p0 - p1).
+ //! From GLM_GTX_norm extension.
+ template <typename T>
+ T distance2(
+ const T p0,
+ const T p1);
+
+ //! Returns the squared distance between p0 and p1, i.e., length(p0 - p1).
+ //! From GLM_GTX_norm extension.
+ template <typename T>
+ T distance2(
+ const detail::tvec2<T>& p0,
+ const detail::tvec2<T>& p1);
+
+ //! Returns the squared distance between p0 and p1, i.e., length(p0 - p1).
+ //! From GLM_GTX_norm extension.
+ template <typename T>
+ T distance2(
+ const detail::tvec3<T>& p0,
+ const detail::tvec3<T>& p1);
+
+ //! Returns the squared distance between p0 and p1, i.e., length(p0 - p1).
+ //! From GLM_GTX_norm extension.
+ template <typename T>
+ T distance2(
+ const detail::tvec4<T>& p0,
+ const detail::tvec4<T>& p1);
+
+ //! Returns the L1 norm between x and y.
+ //! From GLM_GTX_norm extension.
+ template <typename T>
+ T l1Norm(
+ const detail::tvec3<T>& x,
+ const detail::tvec3<T>& y);
+
+ //! Returns the L1 norm of v.
+ //! From GLM_GTX_norm extension.
+ template <typename T>
+ T l1Norm(
+ const detail::tvec3<T>& v);
+
+ //! Returns the L2 norm between x and y.
+ //! From GLM_GTX_norm extension.
+ template <typename T>
+ T l2Norm(
+ const detail::tvec3<T>& x,
+ const detail::tvec3<T>& y);
+
+ //! Returns the L2 norm of v.
+ //! From GLM_GTX_norm extension.
+ template <typename T>
+ T l2Norm(
+ const detail::tvec3<T>& x);
+
+ //! Returns the L norm between x and y.
+ //! From GLM_GTX_norm extension.
+ template <typename T>
+ T lxNorm(
+ const detail::tvec3<T>& x,
+ const detail::tvec3<T>& y,
+ unsigned int Depth);
+
+ //! Returns the L norm of v.
+ //! From GLM_GTX_norm extension.
+ template <typename T>
+ T lxNorm(
+ const detail::tvec3<T>& x,
+ unsigned int Depth);
+
+ /// @}
+}//namespace norm
+}//namespace gtx
+}//namespace glm
+
+#include "norm.inl"
+
+namespace glm{using namespace gtx::norm;}
+
+#endif//glm_gtx_norm
diff --git a/src/glm/gtx/norm.inl b/src/glm/gtx/norm.inl
new file mode 100644
index 0000000..c0713a3
--- /dev/null
+++ b/src/glm/gtx/norm.inl
@@ -0,0 +1,130 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2005-12-21
+// Updated : 2008-07-24
+// Licence : This source is under MIT License
+// File : glm/gtx/norm.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm{
+namespace gtx{
+namespace norm
+{
+ template <typename T>
+ GLM_FUNC_QUALIFIER T length2(
+ const T x)
+ {
+ return x * x;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER T length2(
+ const detail::tvec2<T>& x)
+ {
+ return dot(x, x);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER T length2(
+ const detail::tvec3<T>& x)
+ {
+ return dot(x, x);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER T length2(
+ const detail::tvec4<T>& x)
+ {
+ return dot(x, x);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER T length2(
+ const detail::tquat<T>& q)
+ {
+ return q.x * q.x + q.y * q.y + q.z * q.z + q.w * q.w;
+ }
+
+ template <typename T>
+ T distance2(
+ const T p0,
+ const T p1)
+ {
+ return length2(p1 - p0);
+ }
+
+ template <typename T>
+ T distance2(
+ const detail::tvec2<T>& p0,
+ const detail::tvec2<T>& p1)
+ {
+ return length2(p1 - p0);
+ }
+
+ template <typename T>
+ T distance2(
+ const detail::tvec3<T>& p0,
+ const detail::tvec3<T>& p1)
+ {
+ return length2(p1 - p0);
+ }
+
+ template <typename T>
+ T distance2(
+ const detail::tvec4<T>& p0,
+ const detail::tvec4<T>& p1)
+ {
+ return length2(p1 - p0);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER T l1Norm(
+ const detail::tvec3<T>& a,
+ const detail::tvec3<T>& b)
+ {
+ return abs(b.x - a.x) + abs(b.y - a.y) + abs(b.z - a.z);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER T l1Norm(
+ const detail::tvec3<T>& v)
+ {
+ return abs(v.x) + abs(v.y) + abs(v.z);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER T l2Norm(
+ const detail::tvec3<T>& a,
+ const detail::tvec3<T>& b)
+ {
+ return length(b - a);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER T l2Norm(
+ const detail::tvec3<T>& v)
+ {
+ return length(v);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER T lxNorm(
+ const detail::tvec3<T>& x,
+ const detail::tvec3<T>& y,
+ unsigned int Depth)
+ {
+ return pow(pow(y.x - x.x, T(Depth)) + pow(y.y - x.y, T(Depth)) + pow(y.z - x.z, T(Depth)), T(1) / T(Depth));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER T lxNorm(
+ const detail::tvec3<T>& v,
+ unsigned int Depth)
+ {
+ return pow(pow(v.x, T(Depth)) + pow(v.y, T(Depth)) + pow(v.z, T(Depth)), T(1) / T(Depth));
+ }
+
+}//namespace norm
+}//namespace gtx
+}//namespace glm
diff --git a/src/glm/gtx/normal.hpp b/src/glm/gtx/normal.hpp
new file mode 100644
index 0000000..49ca4c4
--- /dev/null
+++ b/src/glm/gtx/normal.hpp
@@ -0,0 +1,47 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2005-12-21
+// Updated : 2006-11-13
+// Licence : This source is under MIT License
+// File : glm/gtx/normal.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_gtx_normal
+#define glm_gtx_normal
+
+// Dependency:
+#include "../glm.hpp"
+
+#if(defined(GLM_MESSAGES) && !defined(glm_ext))
+# pragma message("GLM: GLM_GTX_normal extension included")
+#endif
+
+namespace glm{
+namespace gtx{
+namespace normal ///< GLM_GTX_normal extension: Compute the normal of a triangle.
+{
+ /// \addtogroup gtx_normal
+ /// @{
+
+ //! Computes triangle normal from triangle points.
+ //! From GLM_GTX_normal extension.
+ template <typename T>
+ detail::tvec3<T> triangleNormal(
+ detail::tvec3<T> const & p1,
+ detail::tvec3<T> const & p2,
+ detail::tvec3<T> const & p3);
+
+ /// @}
+}//namespace normal
+}//namespace gtx
+}//namespace glm
+
+#include "normal.inl"
+
+namespace glm{using namespace gtx::normal;}
+
+#endif//glm_gtx_normal
diff --git a/src/glm/gtx/normal.inl b/src/glm/gtx/normal.inl
new file mode 100644
index 0000000..8414f51
--- /dev/null
+++ b/src/glm/gtx/normal.inl
@@ -0,0 +1,27 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2005-12-21
+// Updated : 2005-12-21
+// Licence : This source is under MIT License
+// File : glm/gtx/normal.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm{
+namespace gtx{
+namespace normal{
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> triangleNormal
+ (
+ detail::tvec3<T> const & p1,
+ detail::tvec3<T> const & p2,
+ detail::tvec3<T> const & p3
+ )
+ {
+ return normalize(cross(p1 - p2, p1 - p3));
+ }
+
+}//namespace normal
+}//namespace gtx
+}//namespace glm
diff --git a/src/glm/gtx/normalize_dot.hpp b/src/glm/gtx/normalize_dot.hpp
new file mode 100644
index 0000000..444fd95
--- /dev/null
+++ b/src/glm/gtx/normalize_dot.hpp
@@ -0,0 +1,59 @@
+//////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+//////////////////////////////////////////////////////////////////////////////////
+// Created : 2007-09-28
+// Updated : 2008-10-07
+// Licence : This source is under MIT License
+// File : glm/gtx/normalize_dot.hpp
+//////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+// - GLM_GTX_fast_square_root
+//////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_gtx_normalize_dot
+#define glm_gtx_normalize_dot
+
+// Dependency:
+#include "../glm.hpp"
+#include "../gtx/fast_square_root.hpp"
+
+#if(defined(GLM_MESSAGES) && !defined(glm_ext))
+# pragma message("GLM: GLM_GTX_normalize_dot extension included")
+#endif
+
+namespace glm{
+namespace gtx{
+namespace normalize_dot ///< GLM_GTX_normalize_dot extension: Dot product of vectors that need to be normalize with a single square root.
+{
+ using namespace gtx::fast_square_root;
+
+ /// \addtogroup gtx_normalize_dot
+ /// @{
+
+ //! Normalize parameters and returns the dot product of x and y.
+ //! It's faster that dot(normalize(x), normalize(y)).
+ //! From GLM_GTX_normalize_dot extension.
+ template <typename genType>
+ typename genType::value_type normalizeDot(
+ genType const & x,
+ genType const & y);
+
+ //! Normalize parameters and returns the dot product of x and y.
+ //! Faster that dot(fastNormalize(x), fastNormalize(y)).
+ //! From GLM_GTX_normalize_dot extension.
+ template <typename genType>
+ typename genType::value_type fastNormalizeDot(
+ genType const & x,
+ genType const & y);
+
+ /// @}
+}//namespace normalize_dot
+}//namespace gtx
+}//namespace glm
+
+#include "normalize_dot.inl"
+
+namespace glm{using namespace gtx::normalize_dot;}
+
+#endif//glm_gtx_normalize_dot
diff --git a/src/glm/gtx/normalize_dot.inl b/src/glm/gtx/normalize_dot.inl
new file mode 100644
index 0000000..206f734
--- /dev/null
+++ b/src/glm/gtx/normalize_dot.inl
@@ -0,0 +1,120 @@
+//////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+//////////////////////////////////////////////////////////////////////////////////
+// Created : 2007-09-28
+// Updated : 2008-10-07
+// Licence : This source is under MIT License
+// File : glm/gtx/normalize_dot.inl
+//////////////////////////////////////////////////////////////////////////////////
+
+namespace glm{
+namespace gtx{
+namespace normalize_dot{
+
+template <typename genType>
+GLM_FUNC_QUALIFIER genType normalizeDot
+(
+ genType const & x,
+ genType const & y
+)
+{
+ return
+ glm::dot(x, y) *
+ glm::inversesqrt(glm::dot(x, x) *
+ glm::dot(y, y));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER valType normalizeDot
+(
+ detail::tvec2<valType> const & x,
+ detail::tvec2<valType> const & y
+)
+{
+ return
+ glm::dot(x, y) *
+ glm::inversesqrt(glm::dot(x, x) *
+ glm::dot(y, y));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER valType normalizeDot
+(
+ detail::tvec3<valType> const & x,
+ detail::tvec3<valType> const & y
+)
+{
+ return
+ glm::dot(x, y) *
+ glm::inversesqrt(glm::dot(x, x) *
+ glm::dot(y, y));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER valType normalizeDot
+(
+ detail::tvec4<valType> const & x,
+ detail::tvec4<valType> const & y
+)
+{
+ return
+ glm::dot(x, y) *
+ glm::inversesqrt(glm::dot(x, x) *
+ glm::dot(y, y));
+}
+
+template <typename genType>
+GLM_FUNC_QUALIFIER genType fastNormalizeDot
+(
+ genType const & x,
+ genType const & y
+)
+{
+ return
+ glm::dot(x, y) *
+ glm::gtx::fast_square_root::fastInverseSqrt(glm::dot(x, x) *
+ glm::dot(y, y));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER valType fastNormalizeDot
+(
+ detail::tvec2<valType> const & x,
+ detail::tvec2<valType> const & y
+)
+{
+ return
+ glm::dot(x, y) *
+ glm::gtx::fast_square_root::fastInverseSqrt(glm::dot(x, x) *
+ glm::dot(y, y));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER valType fastNormalizeDot
+(
+ detail::tvec3<valType> const & x,
+ detail::tvec3<valType> const & y
+)
+{
+ return
+ glm::dot(x, y) *
+ glm::gtx::fast_square_root::fastInverseSqrt(glm::dot(x, x) *
+ glm::dot(y, y));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER valType fastNormalizeDot
+(
+ detail::tvec4<valType> const & x,
+ detail::tvec4<valType> const & y
+)
+{
+ return
+ glm::dot(x, y) *
+ glm::gtx::fast_square_root::fastInverseSqrt(glm::dot(x, x) *
+ glm::dot(y, y));
+}
+
+}//namespace normalize_dot
+}//namespace gtx
+}//namespace glm
diff --git a/src/glm/gtx/number_precision.hpp b/src/glm/gtx/number_precision.hpp
new file mode 100644
index 0000000..ed86bc3
--- /dev/null
+++ b/src/glm/gtx/number_precision.hpp
@@ -0,0 +1,69 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2007-05-10
+// Updated : 2009-06-04
+// Licence : This source is under MIT License
+// File : glm/gtx/number_precision.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+// - GLM_GTC_type_precision
+// - GLM_GTC_quaternion
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_gtx_number_precision
+#define glm_gtx_number_precision
+
+// Dependency:
+#include "../glm.hpp"
+#include "../gtc/type_precision.hpp"
+
+#if(defined(GLM_MESSAGES) && !defined(glm_ext))
+# pragma message("GLM: GLM_GTX_number_precision extension included")
+#endif
+
+namespace glm{
+namespace gtx{
+namespace number_precision ///< GLM_GTX_number_precision extension: Defined size types.
+{
+ using namespace gtc::type_precision;
+
+ /////////////////////////////
+ // Unsigned int vector types
+
+ /// \addtogroup gtx_number_precision
+ /// @{
+
+ typedef u8 u8vec1; //!< \brief 8bit unsigned integer scalar. (from GLM_GTX_number_precision extension)
+ typedef u16 u16vec1; //!< \brief 16bit unsigned integer scalar. (from GLM_GTX_number_precision extension)
+ typedef u32 u32vec1; //!< \brief 32bit unsigned integer scalar. (from GLM_GTX_number_precision extension)
+ typedef u64 u64vec1; //!< \brief 64bit unsigned integer scalar. (from GLM_GTX_number_precision extension)
+
+ //////////////////////
+ // Float vector types
+
+ typedef f16 f16vec1; //!< \brief Half-precision floating-point scalar. (from GLM_GTX_number_precision extension)
+ typedef f32 f32vec1; //!< \brief Single-precision floating-point scalar. (from GLM_GTX_number_precision extension)
+ typedef f64 f64vec1; //!< \brief Single-precision floating-point scalar. (from GLM_GTX_number_precision extension)
+
+ //////////////////////
+ // Float matrix types
+
+ typedef f16 f16mat1; //!< \brief Half-precision floating-point scalar. (from GLM_GTX_number_precision extension)
+ typedef f16 f16mat1x1; //!< \brief Half-precision floating-point scalar. (from GLM_GTX_number_precision extension)
+ typedef f32 f32mat1; //!< \brief Single-precision floating-point scalar. (from GLM_GTX_number_precision extension)
+ typedef f32 f32mat1x1; //!< \brief Single-precision floating-point scalar. (from GLM_GTX_number_precision extension)
+ typedef f64 f64mat1; //!< \brief Double-precision floating-point scalar. (from GLM_GTX_number_precision extension)
+ typedef f64 f64mat1x1; //!< \brief Double-precision floating-point scalar. (from GLM_GTX_number_precision extension)
+
+ /// @}
+}//namespace number_precision
+}//namespace gtx
+}//namespace glm
+
+#include "number_precision.inl"
+
+namespace glm{using namespace gtx::number_precision;}
+
+#endif//glm_gtx_number_precision
diff --git a/src/glm/gtx/number_precision.inl b/src/glm/gtx/number_precision.inl
new file mode 100644
index 0000000..9cac138
--- /dev/null
+++ b/src/glm/gtx/number_precision.inl
@@ -0,0 +1,13 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2007-05-10
+// Updated : 2007-05-10
+// Licence : This source is under MIT License
+// File : glm/gtx/number_precision.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm
+{
+
+}
diff --git a/src/glm/gtx/ocl_type.hpp b/src/glm/gtx/ocl_type.hpp
new file mode 100644
index 0000000..3ec31c1
--- /dev/null
+++ b/src/glm/gtx/ocl_type.hpp
@@ -0,0 +1,110 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2009-05-07
+// Updated : 2009-05-07
+// Licence : This source is under MIT License
+// File : glm/gtx/number_precision.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_gtx_ocl_type
+#define glm_gtx_ocl_type
+
+// Dependency:
+#include "../glm.hpp"
+
+#if(defined(GLM_MESSAGES) && !defined(glm_ext))
+# pragma message("GLM: GLM_GTX_ocl_type extension included")
+#endif
+
+namespace glm{
+namespace gtx{
+namespace ocl_type ///< GLM_GTX_ocl_type extension: OpenCL types.
+{
+ ///////////////////////////
+ // Scalar types
+
+ /// \addtogroup gtx_ocl_type
+ /// @{
+
+ typedef detail::int8 cl_char; //!< \brief 8bit signed integer. (from GLM_GTX_ocl_type extension)
+ typedef detail::int16 cl_short; //!< \brief 16bit signed integer. (from GLM_GTX_ocl_type extension)
+ typedef detail::int32 cl_int; //!< \brief 32bit signed integer. (from GLM_GTX_ocl_type extension)
+ typedef detail::int64 cl_long; //!< \brief 64bit signed integer. (from GLM_GTX_ocl_type extension)
+
+ typedef detail::uint8 cl_uchar; //!< \brief 8bit signed integer. (from GLM_GTX_ocl_type extension)
+ typedef detail::uint16 cl_ushort; //!< \brief 16bit signed integer. (from GLM_GTX_ocl_type extension)
+ typedef detail::uint32 cl_uint; //!< \brief 32bit signed integer. (from GLM_GTX_ocl_type extension)
+ typedef detail::uint64 cl_ulong; //!< \brief 64bit signed integer. (from GLM_GTX_ocl_type extension)
+
+ typedef detail::float16 cl_half; //!< \brief Half-precision floating-point scalar. (from GLM_GTX_ocl_type extension)
+ typedef detail::float32 cl_float; //!< \brief Single-precision floating-point scalar. (from GLM_GTX_ocl_type extension)
+
+
+ typedef detail::int8 cl_char1; //!< \brief 8bit signed integer. (from GLM_GTX_ocl_type extension)
+ typedef detail::int16 cl_short1; //!< \brief 16bit signed integer. (from GLM_GTX_ocl_type extension)
+ typedef detail::int32 cl_int1; //!< \brief 32bit signed integer. (from GLM_GTX_ocl_type extension)
+ typedef detail::int64 cl_long1; //!< \brief 64bit signed integer. (from GLM_GTX_ocl_type extension)
+
+ typedef detail::uint8 cl_uchar1; //!< \brief 8bit signed integer. (from GLM_GTX_ocl_type extension)
+ typedef detail::uint16 cl_ushort1; //!< \brief 16bit signed integer. (from GLM_GTX_ocl_type extension)
+ typedef detail::uint32 cl_uint1; //!< \brief 32bit signed integer. (from GLM_GTX_ocl_type extension)
+ typedef detail::uint64 cl_ulong1; //!< \brief 64bit signed integer. (from GLM_GTX_ocl_type extension)
+
+ //typedef detail::float16 cl_half1; //!< \brief Half-precision floating-point scalar. (from GLM_GTX_ocl_type extension)
+ typedef detail::float32 cl_float1; //!< \brief Single-precision floating-point scalar. (from GLM_GTX_ocl_type extension)
+
+
+ typedef detail::tvec2<detail::int8> cl_char2; //!< \brief 8bit signed integer. (from GLM_GTX_ocl_type extension)
+ typedef detail::tvec2<detail::int16> cl_short2; //!< \brief 16bit signed integer. (from GLM_GTX_ocl_type extension)
+ typedef detail::tvec2<detail::int32> cl_int2; //!< \brief 32bit signed integer. (from GLM_GTX_ocl_type extension)
+ typedef detail::tvec2<detail::int64> cl_long2; //!< \brief 64bit signed integer. (from GLM_GTX_ocl_type extension)
+
+ typedef detail::tvec2<detail::uint8> cl_uchar2; //!< \brief 8bit signed integer. (from GLM_GTX_ocl_type extension)
+ typedef detail::tvec2<detail::uint16> cl_ushort2; //!< \brief 16bit signed integer. (from GLM_GTX_ocl_type extension)
+ typedef detail::tvec2<detail::uint32> cl_uint2; //!< \brief 32bit signed integer. (from GLM_GTX_ocl_type extension)
+ typedef detail::tvec2<detail::uint64> cl_ulong2; //!< \brief 64bit signed integer. (from GLM_GTX_ocl_type extension)
+
+ //typedef detail::tvec2<detail::float16> cl_half2; //!< \brief Half-precision floating-point scalar. (from GLM_GTX_ocl_type extension)
+ typedef detail::tvec2<detail::float32> cl_float2; //!< \brief Single-precision floating-point scalar. (from GLM_GTX_ocl_type extension)
+
+
+ typedef detail::tvec3<detail::int8> cl_char3; //!< \brief 8bit signed integer. (from GLM_GTX_ocl_type extension)
+ typedef detail::tvec3<detail::int16> cl_short3; //!< \brief 16bit signed integer. (from GLM_GTX_ocl_type extension)
+ typedef detail::tvec3<detail::int32> cl_int3; //!< \brief 32bit signed integer. (from GLM_GTX_ocl_type extension)
+ typedef detail::tvec3<detail::int64> cl_long3; //!< \brief 64bit signed integer. (from GLM_GTX_ocl_type extension)
+
+ typedef detail::tvec3<detail::uint8> cl_uchar3; //!< \brief 8bit signed integer. (from GLM_GTX_ocl_type extension)
+ typedef detail::tvec3<detail::uint16> cl_ushort3; //!< \brief 16bit signed integer. (from GLM_GTX_ocl_type extension)
+ typedef detail::tvec3<detail::uint32> cl_uint3; //!< \brief 32bit signed integer. (from GLM_GTX_ocl_type extension)
+ typedef detail::tvec3<detail::uint64> cl_ulong3; //!< \brief 64bit signed integer. (from GLM_GTX_ocl_type extension)
+
+ //typedef detail::tvec3<detail::float16> cl_half3; //!< \brief Half-precision floating-point scalar. (from GLM_GTX_ocl_type extension)
+ typedef detail::tvec3<detail::float32> cl_float3; //!< \brief Single-precision floating-point scalar. (from GLM_GTX_ocl_type extension)
+
+
+ typedef detail::tvec4<detail::int8> cl_char4; //!< \brief 8bit signed integer. (from GLM_GTX_ocl_type extension)
+ typedef detail::tvec4<detail::int16> cl_short4; //!< \brief 16bit signed integer. (from GLM_GTX_ocl_type extension)
+ typedef detail::tvec4<detail::int32> cl_int4; //!< \brief 32bit signed integer. (from GLM_GTX_ocl_type extension)
+ typedef detail::tvec4<detail::int64> cl_long4; //!< \brief 64bit signed integer. (from GLM_GTX_ocl_type extension)
+ typedef detail::tvec4<detail::uint8> cl_uchar4; //!< \brief 8bit signed integer. (from GLM_GTX_ocl_type extension)
+ typedef detail::tvec4<detail::uint16> cl_ushort4; //!< \brief 16bit signed integer. (from GLM_GTX_ocl_type extension)
+ typedef detail::tvec4<detail::uint32> cl_uint4; //!< \brief 32bit signed integer. (from GLM_GTX_ocl_type extension)
+ typedef detail::tvec4<detail::uint64> cl_ulong4; //!< \brief 64bit signed integer. (from GLM_GTX_ocl_type extension)
+
+ //typedef detail::tvec4<detail::float16> cl_half4; //!< \brief Half-precision floating-point scalar. (from GLM_GTX_ocl_type extension)
+ typedef detail::tvec4<detail::float32> cl_float4; //!< \brief Single-precision floating-point scalar. (from GLM_GTX_ocl_type extension)
+
+ /// @}
+}//namespace ocl_type
+}//namespace gtx
+}//namespace glm
+
+#include "ocl_type.inl"
+
+namespace glm{using namespace gtx::ocl_type;}
+
+#endif//glm_gtx_ocl_type
diff --git a/src/glm/gtx/ocl_type.inl b/src/glm/gtx/ocl_type.inl
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/glm/gtx/ocl_type.inl
diff --git a/src/glm/gtx/optimum_pow.hpp b/src/glm/gtx/optimum_pow.hpp
new file mode 100644
index 0000000..fd1542f
--- /dev/null
+++ b/src/glm/gtx/optimum_pow.hpp
@@ -0,0 +1,70 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2005-12-21
+// Updated : 2006-11-13
+// Licence : This source is under MIT License
+// File : glm/gtx/optimum_pow.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_gtx_optimum_pow
+#define glm_gtx_optimum_pow
+
+// Dependency:
+#include "../glm.hpp"
+
+#if(defined(GLM_MESSAGES) && !defined(glm_ext))
+# pragma message("GLM: GLM_GTX_optimum_pow extension included")
+#endif
+
+namespace glm{
+namespace gtx{
+namespace optimum_pow ///< GLM_GTX_optimum_pow extension: Integer exponentiation of power functions.
+{
+ /// \addtogroup gtx_optimum_pow
+ /// @{
+
+ //! Returns x raised to the power of 2.
+ //! From GLM_GTX_optimum_pow extension.
+ template <typename genType>
+ genType pow2(const genType& x);
+
+ //! Returns x raised to the power of 3.
+ //! From GLM_GTX_optimum_pow extension.
+ template <typename genType>
+ genType pow3(const genType& x);
+
+ //! Returns x raised to the power of 4.
+ //! From GLM_GTX_optimum_pow extension.
+ template <typename genType>
+ genType pow4(const genType& x);
+
+ //! Checks if the parameter is a power of 2 number.
+ //! From GLM_GTX_optimum_pow extension.
+ bool powOfTwo(int num);
+
+ //! Checks to determine if the parameter component are power of 2 numbers.
+ //! From GLM_GTX_optimum_pow extension.
+ detail::tvec2<bool> powOfTwo(const detail::tvec2<int>& x);
+
+ //! Checks to determine if the parameter component are power of 2 numbers.
+ //! From GLM_GTX_optimum_pow extension.
+ detail::tvec3<bool> powOfTwo(const detail::tvec3<int>& x);
+
+ //! Checks to determine if the parameter component are power of 2 numbers.
+ //! From GLM_GTX_optimum_pow extension.
+ detail::tvec4<bool> powOfTwo(const detail::tvec4<int>& x);
+
+ /// @}
+}//namespace optimum_pow
+}//namespace gtx
+}//namespace glm
+
+#include "optimum_pow.inl"
+
+namespace glm{using namespace gtx::optimum_pow;}
+
+#endif//glm_gtx_optimum_pow
diff --git a/src/glm/gtx/optimum_pow.inl b/src/glm/gtx/optimum_pow.inl
new file mode 100644
index 0000000..a941ec3
--- /dev/null
+++ b/src/glm/gtx/optimum_pow.inl
@@ -0,0 +1,63 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2005-12-21
+// Updated : 2005-12-27
+// Licence : This source is under MIT License
+// File : glm/gtx/optimum_pow.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm{
+namespace gtx{
+namespace optimum_pow{
+
+ template <typename genType>
+ GLM_FUNC_QUALIFIER genType pow2(const genType& x)
+ {
+ return x * x;
+ }
+
+ template <typename genType>
+ GLM_FUNC_QUALIFIER genType pow3(const genType& x)
+ {
+ return x * x * x;
+ }
+
+ template <typename genType>
+ GLM_FUNC_QUALIFIER genType pow4(const genType& x)
+ {
+ return x * x * x * x;
+ }
+
+ GLM_FUNC_QUALIFIER bool powOfTwo(int x)
+ {
+ return !(x & (x - 1));
+ }
+
+ GLM_FUNC_QUALIFIER detail::tvec2<bool> powOfTwo(const detail::tvec2<int>& x)
+ {
+ return detail::tvec2<bool>(
+ powOfTwo(x.x),
+ powOfTwo(x.y));
+ }
+
+ GLM_FUNC_QUALIFIER detail::tvec3<bool> powOfTwo(const detail::tvec3<int>& x)
+ {
+ return detail::tvec3<bool>(
+ powOfTwo(x.x),
+ powOfTwo(x.y),
+ powOfTwo(x.z));
+ }
+
+ GLM_FUNC_QUALIFIER detail::tvec4<bool> powOfTwo(const detail::tvec4<int>& x)
+ {
+ return detail::tvec4<bool>(
+ powOfTwo(x.x),
+ powOfTwo(x.y),
+ powOfTwo(x.z),
+ powOfTwo(x.w));
+ }
+
+}//namespace optimum_pow
+}//namespace gtx
+}//namespace glm
diff --git a/src/glm/gtx/orthonormalize.hpp b/src/glm/gtx/orthonormalize.hpp
new file mode 100644
index 0000000..c7890c9
--- /dev/null
+++ b/src/glm/gtx/orthonormalize.hpp
@@ -0,0 +1,52 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2005-12-21
+// Updated : 2006-11-13
+// Licence : This source is under MIT License
+// File : glm/gtx/orthonormalize.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_gtx_orthonormalize
+#define glm_gtx_orthonormalize
+
+// Dependency:
+#include "../glm.hpp"
+
+#if(defined(GLM_MESSAGES) && !defined(glm_ext))
+# pragma message("GLM: GLM_GTX_orthonormalize extension included")
+#endif
+
+namespace glm{
+namespace gtx{
+namespace orthonormalize ///< GLM_GTX_orthonormalize extension: Orthonormalize matrices.
+{
+ /// \addtogroup gtx_orthonormalize
+ /// @{
+
+ //! Returns the orthonormalized matrix of m.
+ //! From GLM_GTX_orthonormalize extension.
+ template <typename T>
+ detail::tmat3x3<T> orthonormalize(
+ const detail::tmat3x3<T>& m);
+
+ //! Orthonormalizes x according y.
+ //! From GLM_GTX_orthonormalize extension.
+ template <typename T>
+ detail::tvec3<T> orthonormalize(
+ const detail::tvec3<T>& x,
+ const detail::tvec3<T>& y);
+
+ /// @}
+}//namespace orthonormalize
+}//namespace gtx
+}//namespace glm
+
+#include "orthonormalize.inl"
+
+namespace glm{using namespace gtx::orthonormalize;}
+
+#endif//glm_gtx_orthonormalize
diff --git a/src/glm/gtx/orthonormalize.inl b/src/glm/gtx/orthonormalize.inl
new file mode 100644
index 0000000..9293606
--- /dev/null
+++ b/src/glm/gtx/orthonormalize.inl
@@ -0,0 +1,49 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2005-12-21
+// Updated : 2005-12-21
+// Licence : This source is under MIT License
+// File : glm/gtx/orthonormalize.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm{
+namespace gtx{
+namespace orthonormalize{
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat3x3<T> orthonormalize
+ (
+ const detail::tmat3x3<T>& m
+ )
+ {
+ detail::tmat3x3<T> r = m;
+
+ r[0] = normalize(r[0]);
+
+ float d0 = dot(r[0], r[1]);
+ r[1] -= r[0] * d0;
+ r[1] = normalize(r[1]);
+
+ float d1 = dot(r[1], r[2]);
+ d0 = dot(r[0], r[2]);
+ r[2] -= r[0] * d0 + r[1] * d1;
+ r[2] = normalize(r[2]);
+
+ return r;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> orthonormalize
+ (
+ const detail::tvec3<T>& x,
+ const detail::tvec3<T>& y
+ )
+ {
+ return normalize(x - y * dot(y, x));
+ }
+
+}//namespace orthonormalize
+}//namespace gtx
+}//namespace glm
+
diff --git a/src/glm/gtx/perpendicular.hpp b/src/glm/gtx/perpendicular.hpp
new file mode 100644
index 0000000..86dcef7
--- /dev/null
+++ b/src/glm/gtx/perpendicular.hpp
@@ -0,0 +1,62 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2005-12-21
+// Updated : 2009-03-06
+// Licence : This source is under MIT License
+// File : glm/gtx/perpendicular.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+// - GLM_GTX_projection
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_gtx_perpendicular
+#define glm_gtx_perpendicular
+
+// Dependency:
+#include "../glm.hpp"
+#include "../gtx/projection.hpp"
+
+#if(defined(GLM_MESSAGES) && !defined(glm_ext))
+# pragma message("GLM: GLM_GTX_perpendicular extension included")
+#endif
+
+namespace glm{
+namespace gtx{
+namespace perpendicular ///< GLM_GTX_perpendicular extension: Perpendicular of a vector from other one
+{
+ /// \addtogroup gtx_perpendicular
+ /// @{
+
+ //! Projects x a perpendicular axis of Normal.
+ //! From GLM_GTX_perpendicular extension.
+ template <typename T>
+ detail::tvec2<T> perp(
+ detail::tvec2<T> const & x,
+ detail::tvec2<T> const & Normal);
+
+ //! Projects x a perpendicular axis of Normal.
+ //! From GLM_GTX_perpendicular extension.
+ template <typename T>
+ detail::tvec3<T> perp(
+ detail::tvec3<T> const & x,
+ detail::tvec3<T> const & Normal);
+
+ //! Projects x a perpendicular axis of Normal.
+ //! From GLM_GTX_perpendicular extension.
+ template <typename T>
+ detail::tvec4<T> perp(
+ detail::tvec4<T> const & x,
+ detail::tvec4<T> const & Normal);
+
+ /// @}
+}//namespace perpendicular
+}//namespace gtx
+}//namespace glm
+
+#include "perpendicular.inl"
+
+namespace glm{using namespace gtx::perpendicular;}
+
+#endif//glm_gtx_perpendicular
diff --git a/src/glm/gtx/perpendicular.inl b/src/glm/gtx/perpendicular.inl
new file mode 100644
index 0000000..2b49371
--- /dev/null
+++ b/src/glm/gtx/perpendicular.inl
@@ -0,0 +1,40 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2005-12-21
+// Updated : 2009-03-06
+// Licence : This source is under MIT License
+// File : glm/gtx/perpendicular.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm{
+namespace gtx{
+namespace perpendicular{
+
+template <typename T>
+GLM_FUNC_QUALIFIER detail::tvec2<T> perp(
+ detail::tvec2<T> const & x,
+ detail::tvec2<T> const & Normal)
+{
+ return x - projection::proj(x, Normal);
+}
+
+template <typename T>
+GLM_FUNC_QUALIFIER detail::tvec3<T> perp(
+ detail::tvec3<T> const & x,
+ detail::tvec3<T> const & Normal)
+{
+ return x - projection::proj(x, Normal);
+}
+
+template <typename T>
+GLM_FUNC_QUALIFIER detail::tvec4<T> perp(
+ detail::tvec4<T> const & x,
+ detail::tvec4<T> const & Normal)
+{
+ return x - projection::proj(x, Normal);
+}
+
+}//namespace perpendicular
+}//namespace gtx
+}//namespace glm
diff --git a/src/glm/gtx/polar_coordinates.hpp b/src/glm/gtx/polar_coordinates.hpp
new file mode 100644
index 0000000..3bf6582
--- /dev/null
+++ b/src/glm/gtx/polar_coordinates.hpp
@@ -0,0 +1,49 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2007-03-06
+// Updated : 2009-05-01
+// Licence : This source is under MIT License
+// File : glm/gtx/polar_coordinates.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_gtx_polar_coordinates
+#define glm_gtx_polar_coordinates
+
+// Dependency:
+#include "../glm.hpp"
+
+#if(defined(GLM_MESSAGES) && !defined(glm_ext))
+# pragma message("GLM: GLM_GTX_polar_coordinates extension included")
+#endif
+
+namespace glm{
+namespace gtx{
+namespace polar_coordinates ///< GLM_GTX_polar_coordinates extension: Conversion from Euclidean space to polar space and revert.
+{
+ /// \addtogroup gtx_polar_coordinates
+ /// @{
+
+ //! Convert Euclidean to Polar coordinates, x is the xz distance, y, the latitude and z the longitude.
+ //! From GLM_GTX_polar_coordinates extension.
+ template <typename T>
+ detail::tvec3<T> polar(const detail::tvec3<T>& euclidean);
+
+ //! Convert Polar to Euclidean coordinates.
+ //! From GLM_GTX_polar_coordinates extension.
+ template <typename T>
+ detail::tvec3<T> euclidean(const detail::tvec3<T>& polar);
+
+ /// @}
+}//namespace polar_coordinates
+}//namespace gtx
+}//namespace glm
+
+#include "polar_coordinates.inl"
+
+namespace glm{using namespace gtx::polar_coordinates;}
+
+#endif//glm_gtx_polar_coordinates
diff --git a/src/glm/gtx/polar_coordinates.inl b/src/glm/gtx/polar_coordinates.inl
new file mode 100644
index 0000000..8f2d327
--- /dev/null
+++ b/src/glm/gtx/polar_coordinates.inl
@@ -0,0 +1,42 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2007-03-06
+// Updated : 2009-05-01
+// Licence : This source is under MIT License
+// File : glm/gtx/polar_coordinates.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm{
+namespace gtx{
+namespace polar_coordinates
+{
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> polar(
+ const detail::tvec3<T>& euclidean)
+ {
+ T length = length(euclidean);
+ detail::tvec3<T> tmp = euclidean / length;
+ T xz_dist = sqrt(tmp.x * tmp.x + tmp.z * tmp.z);
+
+ return detail::tvec3<T>(
+ degrees(atan(xz_dist, tmp.y)), // latitude
+ degrees(atan(tmp.x, tmp.z)), // longitude
+ xz_dist); // xz distance
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> euclidean(
+ const detail::tvec3<T>& polar)
+ {
+ T latitude = radians(polar.x);
+ T longitude = radians(polar.y);
+ return detail::tvec3<T>(
+ cos(latitude) * sin(longitude),
+ sin(latitude),
+ cos(latitude) * cos(longitude));
+ }
+
+}//namespace polar_coordinates
+}//namespace gtx
+}//namespace glm
diff --git a/src/glm/gtx/projection.hpp b/src/glm/gtx/projection.hpp
new file mode 100644
index 0000000..fa8e072
--- /dev/null
+++ b/src/glm/gtx/projection.hpp
@@ -0,0 +1,60 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2005-12-21
+// Updated : 2009-03-06
+// Licence : This source is under MIT License
+// File : glm/gtx/projection.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_gtx_projection
+#define glm_gtx_projection
+
+// Dependency:
+#include "../glm.hpp"
+
+#if(defined(GLM_MESSAGES) && !defined(glm_ext))
+# pragma message("GLM: GLM_GTX_projection extension included")
+#endif
+
+namespace glm{
+namespace gtx{
+namespace projection ///< GLM_GTX_projection extension: Projection of a vector to other one
+{
+ /// \addtogroup gtx_projection
+ /// @{
+
+ //! Projects x on Normal.
+ //! From GLM_GTX_projection extension.
+ template <typename T>
+ detail::tvec2<T> proj(
+ detail::tvec2<T> const & x,
+ detail::tvec2<T> const & Normal);
+
+ //! Projects x on Normal.
+ //! From GLM_GTX_projection extension.
+ template <typename T>
+ detail::tvec3<T> proj(
+ detail::tvec3<T> const & x,
+ detail::tvec3<T> const & Normal);
+
+ //! Projects x on Normal.
+ //! From GLM_GTX_projection extension.
+ template <typename T>
+ detail::tvec4<T> proj(
+ detail::tvec4<T> const & x,
+ detail::tvec4<T> const & Normal);
+
+ /// @}
+}//namespace projection
+}//namespace gtx
+}//namespace glm
+
+#include "projection.inl"
+
+namespace glm{using namespace gtx::projection;}
+
+#endif//glm_gtx_projection
diff --git a/src/glm/gtx/projection.inl b/src/glm/gtx/projection.inl
new file mode 100644
index 0000000..51eb4c5
--- /dev/null
+++ b/src/glm/gtx/projection.inl
@@ -0,0 +1,40 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2005-12-21
+// Updated : 2009-03-06
+// Licence : This source is under MIT License
+// File : glm/gtx/projection.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm{
+namespace gtx{
+namespace projection{
+
+template <typename T>
+GLM_FUNC_QUALIFIER detail::tvec2<T> proj(
+ detail::tvec2<T> const & x,
+ detail::tvec2<T> const & Normal)
+{
+ return glm::dot(x, Normal) / glm::dot(Normal, Normal) * Normal;
+}
+
+template <typename T>
+GLM_FUNC_QUALIFIER detail::tvec3<T> proj(
+ detail::tvec3<T> const & x,
+ detail::tvec3<T> const & Normal)
+{
+ return dot(x, Normal) / glm::dot(Normal, Normal) * Normal;
+}
+
+template <typename T>
+GLM_FUNC_QUALIFIER detail::tvec4<T> proj(
+ detail::tvec4<T> const & x,
+ detail::tvec4<T> const & Normal)
+{
+ return glm::dot(x, Normal) / glm::dot(Normal, Normal) * Normal;
+}
+
+}//namespace projection
+}//namespace gtx
+}//namespace glm
diff --git a/src/glm/gtx/quaternion.hpp b/src/glm/gtx/quaternion.hpp
new file mode 100644
index 0000000..97271e0
--- /dev/null
+++ b/src/glm/gtx/quaternion.hpp
@@ -0,0 +1,217 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2005-12-21
+// Updated : 2009-05-21
+// Licence : This source is under MIT License
+// File : glm/gtx/quaternion.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// ToDo:
+// - Study constructors with angles and axis
+// - Study constructors with vec3 that are the imaginary component of quaternion
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_gtx_quaternion
+#define glm_gtx_quaternion
+
+// Dependency:
+#include "../glm.hpp"
+#include "../gtc/quaternion.hpp"
+
+#if(defined(GLM_MESSAGES) && !defined(glm_ext))
+# pragma message("GLM: GLM_GTX_quaternion extension included")
+#endif
+
+namespace glm{
+namespace gtx{
+namespace quaternion ///< GLM_GTX_quaternion extension: Quaternion types and functions
+{
+ using namespace gtc::quaternion;
+
+ /// \addtogroup gtx_quaternion
+ ///@{
+
+ //! Compute a cross product between a quaternion and a vector.
+ //! From GLM_GTX_quaternion extension.
+ template <typename valType>
+ detail::tvec3<valType> cross(
+ detail::tquat<valType> const & q,
+ detail::tvec3<valType> const & v);
+
+ //! Compute a cross product between a vector and a quaternion.
+ //! From GLM_GTX_quaternion extension.
+ template <typename valType>
+ detail::tvec3<valType> cross(
+ detail::tvec3<valType> const & v,
+ detail::tquat<valType> const & q);
+
+ //! Compute a point on a path according squad equation.
+ //! q1 and q2 are control points; s1 and s2 are intermediate control points.
+ //! From GLM_GTX_quaternion extension.
+ template <typename valType>
+ detail::tquat<valType> squad(
+ detail::tquat<valType> const & q1,
+ detail::tquat<valType> const & q2,
+ detail::tquat<valType> const & s1,
+ detail::tquat<valType> const & s2,
+ valType const & h);
+
+ //! Returns an intermediate control point for squad interpolation.
+ //! From GLM_GTX_quaternion extension.
+ template <typename valType>
+ detail::tquat<valType> intermediate(
+ detail::tquat<valType> const & prev,
+ detail::tquat<valType> const & curr,
+ detail::tquat<valType> const & next);
+
+ //! Returns a exp of a quaternion.
+ //! From GLM_GTX_quaternion extension.
+ template <typename valType>
+ detail::tquat<valType> exp(
+ detail::tquat<valType> const & q,
+ valType const & exponent);
+
+ //! Returns a log of a quaternion.
+ //! From GLM_GTX_quaternion extension.
+ template <typename valType>
+ detail::tquat<valType> log(
+ detail::tquat<valType> const & q);
+
+ //! Returns x raised to the y power.
+ //! From GLM_GTX_quaternion extension.
+ template <typename valType>
+ detail::tquat<valType> pow(
+ detail::tquat<valType> const & x,
+ valType const & y);
+
+ //! Returns quarternion square root.
+ //! From GLM_GTX_quaternion extension.
+ //template <typename valType>
+ //detail::tquat<valType> sqrt(
+ // detail::tquat<valType> const & q);
+
+ //! Rotates a 3 components vector by a quaternion.
+ //! From GLM_GTX_transform extension.
+ template <typename valType>
+ detail::tvec3<valType> rotate(
+ detail::tquat<valType> const & q,
+ detail::tvec3<valType> const & v);
+
+ //! Rotates a 4 components vector by a quaternion.
+ //! From GLM_GTX_transform extension.
+ template <typename valType>
+ detail::tvec4<valType> rotate(
+ detail::tquat<valType> const & q,
+ detail::tvec4<valType> const & v);
+
+ //! Returns the quaternion rotation angle.
+ //! From GLM_GTX_quaternion extension.
+ template <typename valType>
+ valType angle(
+ detail::tquat<valType> const & x);
+
+ //! Returns the q rotation axis.
+ //! From GLM_GTX_quaternion extension.
+ template <typename valType>
+ detail::tvec3<valType> axis(
+ detail::tquat<valType> const & x);
+
+ //! Build a quaternion from an angle and a normalized axis.
+ //! From GLM_GTX_quaternion extension.
+ template <typename valType>
+ detail::tquat<valType> angleAxis(
+ valType const & angle,
+ valType const & x,
+ valType const & y,
+ valType const & z);
+
+ //! Build a quaternion from an angle and a normalized axis.
+ //! From GLM_GTX_quaternion extension.
+ template <typename valType>
+ detail::tquat<valType> angleAxis(
+ valType const & angle,
+ detail::tvec3<valType> const & axis);
+
+ //! Extract the real component of a quaternion.
+ //! From GLM_GTX_quaternion extension.
+ template <typename valType>
+ valType extractRealComponent(
+ detail::tquat<valType> const & q);
+
+ //! Returns roll value of euler angles.
+ //! From GLM_GTX_quaternion extension.
+ template <typename valType>
+ valType roll(
+ detail::tquat<valType> const & x);
+
+ //! Returns pitch value of euler angles.
+ //! From GLM_GTX_quaternion extension.
+ template <typename valType>
+ valType pitch(
+ detail::tquat<valType> const & x);
+
+ //! Returns yaw value of euler angles.
+ //! From GLM_GTX_quaternion extension.
+ template <typename valType>
+ valType yaw(
+ detail::tquat<valType> const & x);
+
+ //! Returns euler angles, yitch as x, yaw as y, roll as z.
+ //! From GLM_GTX_quaternion extension.
+ template <typename valType>
+ detail::tvec3<valType> eularAngles(
+ detail::tquat<valType> const & x);
+
+ //! Converts a quaternion to a 3 * 3 matrix.
+ //! From GLM_GTX_quaternion extension.
+ template <typename valType>
+ detail::tmat3x3<valType> toMat3(
+ detail::tquat<valType> const & x){return gtc::quaternion::mat3_cast(x);}
+
+ //! Converts a quaternion to a 4 * 4 matrix.
+ //! From GLM_GTX_quaternion extension.
+ template <typename valType>
+ detail::tmat4x4<valType> toMat4(
+ detail::tquat<valType> const & x){return gtc::quaternion::mat4_cast(x);}
+
+ //! Converts a 3 * 3 matrix to a quaternion.
+ //! From GLM_GTX_quaternion extension.
+ template <typename valType>
+ detail::tquat<valType> toQuat(
+ detail::tmat3x3<valType> const & x){return gtc::quaternion::quat_cast(x);}
+
+ //! Converts a 4 * 4 matrix to a quaternion.
+ //! From GLM_GTX_quaternion extension.
+ template <typename valType>
+ detail::tquat<valType> toQuat(
+ detail::tmat4x4<valType> const & x){return gtc::quaternion::quat_cast(x);}
+
+ //! Quaternion interpolation using the rotation short path.
+ //! From GLM_GTX_quaternion extension.
+ template <typename T>
+ detail::tquat<T> shortMix(
+ detail::tquat<T> const & x,
+ detail::tquat<T> const & y,
+ T const & a);
+
+ //! Quaternion normalized linear interpolation.
+ //! From GLM_GTX_quaternion extension.
+ template <typename T>
+ detail::tquat<T> fastMix(
+ detail::tquat<T> const & x,
+ detail::tquat<T> const & y,
+ T const & a);
+
+ /// @}
+}//namespace quaternion
+}//namespace gtx
+} //namespace glm
+
+#include "quaternion.inl"
+
+namespace glm{using namespace gtx::quaternion;}
+
+#endif//glm_gtx_quaternion
diff --git a/src/glm/gtx/quaternion.inl b/src/glm/gtx/quaternion.inl
new file mode 100644
index 0000000..a65b2c0
--- /dev/null
+++ b/src/glm/gtx/quaternion.inl
@@ -0,0 +1,303 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2005-12-21
+// Updated : 2008-11-27
+// Licence : This source is under MIT License
+// File : glm/gtx/quaternion.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <limits>
+
+namespace glm{
+namespace gtx{
+namespace quaternion
+{
+ template <typename valType>
+ GLM_FUNC_QUALIFIER detail::tvec3<valType> cross
+ (
+ detail::tvec3<valType> const & v,
+ detail::tquat<valType> const & q
+ )
+ {
+ return gtc::quaternion::inverse(q) * v;
+ }
+
+ template <typename valType>
+ GLM_FUNC_QUALIFIER detail::tvec3<valType> cross
+ (
+ detail::tquat<valType> const & q,
+ detail::tvec3<valType> const & v
+ )
+ {
+ return q * v;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tquat<T> squad
+ (
+ detail::tquat<T> const & q1,
+ detail::tquat<T> const & q2,
+ detail::tquat<T> const & s1,
+ detail::tquat<T> const & s2,
+ T const & h)
+ {
+ return mix(mix(q1, q2, h), mix(s1, s2, h), T(2) * h (T(1) - h));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tquat<T> intermediate
+ (
+ detail::tquat<T> const & prev,
+ detail::tquat<T> const & curr,
+ detail::tquat<T> const & next
+ )
+ {
+ detail::tquat<T> invQuat = gtc::quaternion::inverse(curr);
+ return ext((log(next + invQuat) + log(prev + invQuat)) / T(-4)) * curr;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tquat<T> exp
+ (
+ detail::tquat<T> const & q,
+ T const & exponent
+ )
+ {
+ detail::tvec3<T> u(q.x, q.y, q.z);
+ float a = glm::length(u);
+ detail::tvec3<T> v(u / a);
+ return detail::tquat<T>(cos(a), sin(a) * v);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tquat<T> log
+ (
+ detail::tquat<T> const & q
+ )
+ {
+ if((q.x == T(0)) && (q.y == T(0)) && (q.z == T(0)))
+ {
+ if(q.w > T(0))
+ return detail::tquat<T>(log(q.w), T(0), T(0), T(0));
+ else if(q.w < T(0))
+ return detail::tquat<T>(log(-q.w), T(3.1415926535897932384626433832795), T(0),T(0));
+ else
+ return detail::tquat<T>(std::numeric_limits<T>::infinity(), std::numeric_limits<T>::infinity(), std::numeric_limits<T>::infinity(), std::numeric_limits<T>::infinity());
+ }
+ else
+ {
+ T Vec3Len = sqrt(q.x * q.x + q.y * q.y + q.z * q.z);
+ T QuatLen = sqrt(Vec3Len * Vec3Len + q.w * q.w);
+ T t = atan(Vec3Len, T(q.w)) / Vec3Len;
+ return detail::tquat<T>(t * q.x, t * q.y, t * q.z, log(QuatLen));
+ }
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tquat<T> pow
+ (
+ detail::tquat<T> const & x,
+ T const & y
+ )
+ {
+ if(abs(x.w) > T(0.9999))
+ return x;
+ float Angle = acos(y);
+ float NewAngle = Angle * y;
+ float Div = sin(NewAngle) / sin(Angle);
+ return detail::tquat<T>(
+ cos(NewAngle),
+ x.x * Div,
+ x.y * Div,
+ x.z * Div);
+ }
+
+ //template <typename T>
+ //GLM_FUNC_QUALIFIER detail::tquat<T> sqrt
+ //(
+ // detail::tquat<T> const & q
+ //)
+ //{
+ // T q0 = T(1) - dot(q, q);
+ // return T(2) * (T(1) + q0) * q;
+ //}
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> rotate
+ (
+ detail::tquat<T> const & q,
+ detail::tvec3<T> const & v
+ )
+ {
+ return q * v;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> rotate
+ (
+ detail::tquat<T> const & q,
+ detail::tvec4<T> const & v
+ )
+ {
+ return q * v;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER T angle
+ (
+ detail::tquat<T> const & x
+ )
+ {
+ return glm::degrees(acos(x.w) * T(2));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> axis
+ (
+ detail::tquat<T> const & x
+ )
+ {
+ T tmp1 = T(1) - x.w * x.w;
+ if(tmp1 <= T(0))
+ return detail::tvec3<T>(0, 0, 1);
+ T tmp2 = T(1) / sqrt(tmp1);
+ return detail::tvec3<T>(x.x * tmp2, x.y * tmp2, x.z * tmp2);
+ }
+
+ template <typename valType>
+ GLM_FUNC_QUALIFIER detail::tquat<valType> angleAxis
+ (
+ valType const & angle,
+ valType const & x,
+ valType const & y,
+ valType const & z
+ )
+ {
+ return angleAxis(angle, detail::tvec3<valType>(x, y, z));
+ }
+
+ template <typename valType>
+ GLM_FUNC_QUALIFIER detail::tquat<valType> angleAxis
+ (
+ valType const & angle,
+ detail::tvec3<valType> const & v
+ )
+ {
+ detail::tquat<valType> result;
+
+ valType a = glm::radians(angle);
+ valType s = glm::sin(a * valType(0.5));
+
+ result.w = glm::cos(a * valType(0.5));
+ result.x = v.x * s;
+ result.y = v.y * s;
+ result.z = v.z * s;
+ return result;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER T extractRealComponent
+ (
+ detail::tquat<T> const & q
+ )
+ {
+ T w = T(1.0) - q.x * q.x - q.y * q.y - q.z * q.z;
+ if(w < T(0))
+ return T(0);
+ else
+ return -sqrt(w);
+ }
+
+ template <typename valType>
+ GLM_FUNC_QUALIFIER valType roll
+ (
+ detail::tquat<valType> const & q
+ )
+ {
+ return atan2(valType(2) * (q.x * q.y + q.w * q.z), q.w * q.w + q.x * q.x - q.y * q.y - q.z * q.z);
+ }
+
+ template <typename valType>
+ GLM_FUNC_QUALIFIER valType pitch
+ (
+ detail::tquat<valType> const & q
+ )
+ {
+ return atan2(valType(2) * (q.y * q.z + q.w * q.x), q.w * q.w - q.x * q.x - q.y * q.y + q.z * q.z);
+ }
+
+ template <typename valType>
+ GLM_FUNC_QUALIFIER valType yaw
+ (
+ detail::tquat<valType> const & q
+ )
+ {
+ return asin(valType(-2) * (q.x * q.z - q.w * q.y));
+ }
+
+ template <typename valType>
+ GLM_FUNC_QUALIFIER detail::tvec3<valType> eularAngles
+ (
+ detail::tquat<valType> const & x
+ )
+ {
+ return detail::tvec3<valType>(pitch(x), yaw(x), roll(x));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tquat<T> shortMix
+ (
+ detail::tquat<T> const & x,
+ detail::tquat<T> const & y,
+ T const & a
+ )
+ {
+ if(a <= typename detail::tquat<T>::value_type(0)) return x;
+ if(a >= typename detail::tquat<T>::value_type(1)) return y;
+
+ T fCos = dot(x, y);
+ detail::tquat<T> y2(y); //BUG!!! tquat<T> y2;
+ if(fCos < T(0))
+ {
+ y2 = -y;
+ fCos = -fCos;
+ }
+
+ //if(fCos > 1.0f) // problem
+ T k0, k1;
+ if(fCos > T(0.9999))
+ {
+ k0 = T(1) - a;
+ k1 = T(0) + a; //BUG!!! 1.0f + a;
+ }
+ else
+ {
+ T fSin = sqrt(T(1) - fCos * fCos);
+ T fAngle = atan(fSin, fCos);
+ T fOneOverSin = T(1) / fSin;
+ k0 = sin((T(1) - a) * fAngle) * fOneOverSin;
+ k1 = sin((T(0) + a) * fAngle) * fOneOverSin;
+ }
+
+ return detail::tquat<T>(
+ k0 * x.w + k1 * y2.w,
+ k0 * x.x + k1 * y2.x,
+ k0 * x.y + k1 * y2.y,
+ k0 * x.z + k1 * y2.z);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tquat<T> fastMix
+ (
+ detail::tquat<T> const & x,
+ detail::tquat<T> const & y,
+ T const & a
+ )
+ {
+ return glm::normalize(x * (T(1) - a) + (y * a));
+ }
+
+}//namespace quaternion
+}//namespace gtx
+}//namespace glm
diff --git a/src/glm/gtx/random.hpp b/src/glm/gtx/random.hpp
new file mode 100644
index 0000000..00c1a23
--- /dev/null
+++ b/src/glm/gtx/random.hpp
@@ -0,0 +1,89 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2006-01-16
+// Updated : 2007-08-30
+// Licence : This source is under MIT License
+// File : glm/gtx/random.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+// - GLM_GTX_vecx
+// - GLM_GTX_half_float
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_gtx_random
+#define glm_gtx_random
+
+// Dependency:
+#include "../glm.hpp"
+#include "../gtc/half_float.hpp"
+
+#if(defined(GLM_MESSAGES) && !defined(glm_ext))
+# pragma message("GLM: GLM_GTX_random extension included")
+#endif
+
+namespace glm{
+namespace gtx{
+namespace random ///< GLM_GTX_random extension: Generate random number from various distribution methods
+{
+ /// \addtogroup gtx_random
+ /// @{
+
+ //! Generate a random number in the interval [-1, 1], according a linear distribution.
+ //! From GLM_GTX_random extension.
+ template <typename T> T signedRand1();
+
+ template <> float signedRand1(); //!< \brief Generate a random number in the interval [-1, 1], according a linear distribution (From GLM_GTX_random extension)
+ template <> double signedRand1(); //!< \brief Generate a random number in the interval [-1, 1], according a linear distribution (From GLM_GTX_random extension)
+ template <typename T> detail::tvec2<T> signedRand2(); //!< \brief Generate 2 random numbers in the interval [-1, 1], according a linear distribution (From GLM_GTX_random extension)
+ template <typename T> detail::tvec3<T> signedRand3(); //!< \brief Generate 3 random numbers in the interval [-1, 1], according a linear distribution (From GLM_GTX_random extension)
+ template <typename T> detail::tvec4<T> signedRand4(); //!< \brief Generate 4 random numbers in the interval [-1, 1], according a linear distribution (From GLM_GTX_random extension)
+
+ template <typename T> detail::tvec2<T> normalizedRand2(); //!< \brief Generate a normalized 2D vector regulary distribute on a circle (From GLM_GTX_random extension)
+ template <typename T> detail::tvec2<T> normalizedRand2(T Min, T Max); //!< \brief Generate a scaled and normalized 2D vector regulary distribute on a circle (From GLM_GTX_random extension)
+ template <typename T> detail::tvec3<T> normalizedRand3(); //!< \brief Generate a normalized 3D vector regulary distribute on a sphere (From GLM_GTX_random extension)
+ template <typename T> detail::tvec3<T> normalizedRand3(T Min, T Max); //!< \brief Generate a scaled and normalized 3D vector regulary distribute on a sphere (From GLM_GTX_random extension)
+
+ template <typename T> T compRand1(); //!< \brief Generate a random number in the interval [0, 1], according a linear distribution (From GLM_GTX_random extension)
+ template <> float compRand1(); //!< \brief Generate a random number in the interval [0, 1], according a linear distribution (From GLM_GTX_random extension)
+ template <> double compRand1(); //!< \brief Generate a random number in the interval [0, 1], according a linear distribution (From GLM_GTX_random extension)
+ template <typename T> T compRand1(T Min, T Max); //!< \brief Generate a random number in the interval [Min, Max], according a linear distribution (From GLM_GTX_random extension)
+ template <typename T> detail::tvec2<T> compRand2(T Min, T Max); //!< \brief Generate 2 random numbers in the interval [Min, Max], according a linear distribution (From GLM_GTX_random extension)
+ template <typename T> detail::tvec3<T> compRand3(T Min, T Max); //!< \brief Generate 3 random numbers in the interval [Min, Max], according a linear distribution (From GLM_GTX_random extension)
+ template <typename T> detail::tvec4<T> compRand4(T Min, T Max); //!< \brief Generate 4 random numbers in the interval [Min, Max], according a linear distribution (From GLM_GTX_random extension)
+ template <typename T> detail::tvec2<T> compRand2(const detail::tvec2<T>& Min, const detail::tvec2<T>& Max); //!< \brief Generate 2 random numbers in the interval [Min, Max], according a linear distribution (From GLM_GTX_random extension)
+ template <typename T> detail::tvec3<T> compRand3(const detail::tvec3<T>& Min, const detail::tvec3<T>& Max); //!< \brief Generate 3 random numbers in the interval [Min, Max], according a linear distribution (From GLM_GTX_random extension)
+ template <typename T> detail::tvec3<T> compRand4(const detail::tvec4<T>& Min, const detail::tvec4<T>& Max); //!< \brief Generate 4 random numbers in the interval [Min, Max], according a linear distribution (From GLM_GTX_random extension)
+
+ template <typename T> detail::tvec2<T> vecRand2(); //!< \brief Generate a random normalized 2 component vector. It's a spherical uniform distribution. (From GLM_GTX_random extension)
+ template <typename T> detail::tvec2<T> vecRand2(T MinRadius, T MaxRadius); //!< \brief Generate a random normalized 2 component vector. It's a spherical uniform distribution. (From GLM_GTX_random extension)
+ template <typename T> detail::tvec3<T> vecRand3(); //!< \brief Generate a random normalized 3 component vector. It's a spherical uniform distribution. (From GLM_GTX_random extension)
+ template <typename T> detail::tvec3<T> vecRand3(T MinRadius, T MaxRadius); //!< \brief Generate a random normalized 3 component vector. It's a spherical uniform distribution. (From GLM_GTX_random extension)
+ template <typename T> detail::tvec4<T> vecRand4(); //!< \brief Generate a random normalized 4 component vector. It's a spherical uniform distribution. (From GLM_GTX_random extension)
+ template <typename T> detail::tvec4<T> vecRand4(T MinRadius, T MaxRadius); //!< \brief Generate a random normalized 4 component vector. It's a spherical uniform distribution. (From GLM_GTX_random extension)
+
+ template <typename T> T gaussRand1(T mean, T std_deviation); //!< \brief Gererate a random floating number according a Gauss distribution. (From GLM_GTX_random extension)
+ template <typename T> detail::tvec2<T> gaussRand2(T mean, T std_deviation); //!< \brief Gererate 2 random floating numbers according a Gauss distribution. (From GLM_GTX_random extension)
+ template <typename T> detail::tvec3<T> gaussRand3(T mean, T std_deviation); //!< \brief Gererate 3 random floating numbers according a Gauss distribution. (From GLM_GTX_random extension)
+ template <typename T> detail::tvec4<T> gaussRand4(T mean, T std_deviation); //!< \brief Gererate 4 random floating numbers according a Gauss distribution. (From GLM_GTX_random extension)
+ template <typename T> detail::tvec2<T> gaussRand2(const detail::tvec2<T>& mean, T std_deviation); //!< \brief Gererate 2 random floating numbers according a Gauss distribution. (From GLM_GTX_random extension)
+ template <typename T> detail::tvec3<T> gaussRand3(const detail::tvec3<T>& mean, T std_deviation); //!< \brief Gererate 3 random floating numbers according a Gauss distribution. (From GLM_GTX_random extension)
+ template <typename T> detail::tvec4<T> gaussRand4(const detail::tvec4<T>& mean, T std_deviation); //!< \brief Gererate 4 random floating numbers according a Gauss distribution. (From GLM_GTX_random extension)
+ template <typename T> detail::tvec2<T> gaussRand2(T mean, const detail::tvec2<T>& std_deviation); //!< \brief Gererate 2 random floating numbers according a Gauss distribution. (From GLM_GTX_random extension)
+ template <typename T> detail::tvec3<T> gaussRand3(T mean, const detail::tvec3<T>& std_deviation); //!< \brief Gererate 3 random floating numbers according a Gauss distribution. (From GLM_GTX_random extension)
+ template <typename T> detail::tvec4<T> gaussRand4(T mean, const detail::tvec4<T>& std_deviation); //!< \brief Gererate 4 random floating numbers according a Gauss distribution. (From GLM_GTX_random extension)
+ template <typename T> detail::tvec2<T> gaussRand2(const detail::tvec2<T>& mean, const detail::tvec2<T>& std_deviation); //!< \brief Gererate 2 random floating numbers according a Gauss distribution. (From GLM_GTX_random extension)
+ template <typename T> detail::tvec3<T> gaussRand3(const detail::tvec3<T>& mean, const detail::tvec3<T>& std_deviation); //!< \brief Gererate 3 random floating numbers according a Gauss distribution. (From GLM_GTX_random extension)
+ template <typename T> detail::tvec4<T> gaussRand4(const detail::tvec4<T>& mean, const detail::tvec4<T>& std_deviation); //!< \brief Gererate 4 random floating numbers according a Gauss distribution. (From GLM_GTX_random extension)
+
+ ///@}
+}//namespace random
+}//namespace gtx
+}//namespace glm
+
+#include "random.inl"
+
+namespace glm{using namespace gtx::random;}
+
+#endif//glm_gtx_random
diff --git a/src/glm/gtx/random.inl b/src/glm/gtx/random.inl
new file mode 100644
index 0000000..5cd0095
--- /dev/null
+++ b/src/glm/gtx/random.inl
@@ -0,0 +1,536 @@
+//////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+//////////////////////////////////////////////////////////////////////////////////
+// Created : 2006-01-16
+// Updated : 2006-01-16
+// Licence : This source is under MIT License
+// File : glm/gtx/random.inl
+//////////////////////////////////////////////////////////////////////////////////
+
+#include <ctime>
+#include <cassert>
+
+namespace glm{
+namespace gtx{
+namespace random
+{
+ template <>
+ GLM_FUNC_QUALIFIER float signedRand1()
+ {
+ #if(GLM_COMPILER & GLM_COMPILER_VC)// && (GLM_COMPILER < GLM_COMPILER_VC2010)
+ #define RAND_SHIFT_NUM 5
+ #else
+ #define RAND_SHIFT_NUM 0
+ #endif
+ return float((std::rand() - (RAND_MAX >> 1) - 1) << 1) / float(RAND_MAX - RAND_SHIFT_NUM);
+ }
+
+ template <>
+ GLM_FUNC_QUALIFIER double signedRand1()
+ {
+ return double(signedRand1<float>());
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> signedRand2()
+ {
+ return detail::tvec2<T>(
+ signedRand1<float>(),
+ signedRand1<float>());
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> signedRand3()
+ {
+ return detail::tvec3<T>(
+ signedRand1<float>(),
+ signedRand1<float>(),
+ signedRand1<float>());
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> signedRand4()
+ {
+ return detail::tvec4<T>(
+ signedRand1<float>(),
+ signedRand1<float>(),
+ signedRand1<float>(),
+ signedRand1<float>());
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> normalizedRand2()
+ {
+ T a = compRand1<T>(T(0), T(6.283185307179586476925286766559f));
+ return detail::tvec2<T>(cos(a), sin(a));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> normalizedRand3()
+ {
+ T z = compRand1(T(-1), T(1));
+ T a = compRand1(T(0), T(6.283185307179586476925286766559f));
+
+ T r = sqrt(T(1) - z * z);
+
+ T x = r * cos(a);
+ T y = r * sin(a);
+
+ return detail::tvec3<T>(x, y, z);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> normalizedRand3(
+ T Min,
+ T Max)
+ {
+ return normalizedRand3<T>() * compRand1(Min, Max);
+ }
+
+ template <>
+ GLM_FUNC_QUALIFIER float compRand1()
+ {
+ return float(std::rand()) / float(RAND_MAX);
+ }
+
+ template <>
+ GLM_FUNC_QUALIFIER double compRand1()
+ {
+ return double(std::rand()) / double(RAND_MAX);
+ }
+
+ GLM_FUNC_QUALIFIER glm::half compRand1(
+ glm::half Min,
+ glm::half Max)
+ {
+ return compRand1<glm::half>() * (Max - Min) + Min;
+ }
+
+ GLM_FUNC_QUALIFIER float compRand1(
+ float Min,
+ float Max)
+ {
+ return compRand1<float>() * (Max - Min) + Min;
+ }
+
+ GLM_FUNC_QUALIFIER double compRand1(
+ double Min,
+ double Max)
+ {
+ return compRand1<double>() * (Max - Min) + Min;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER T compRand1(
+ T Min,
+ T Max)
+ {
+ return T(compRand1<double>() * double(Max - Min) + double(Min));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> compRand2(
+ T Min,
+ T Max)
+ {
+ return detail::tvec2<T>(
+ compRand1(Min, Max),
+ compRand1(Min, Max));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> compRand3(
+ T Min,
+ T Max)
+ {
+ return detail::tvec3<T>(
+ compRand1(Min, Max),
+ compRand1(Min, Max),
+ compRand1(Min, Max));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> compRand4(
+ T Min,
+ T Max)
+ {
+ return detail::tvec4<T>(
+ compRand1(Min, Max),
+ compRand1(Min, Max),
+ compRand1(Min, Max),
+ compRand1(Min, Max));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> compRand2(
+ T Min,
+ const detail::tvec2<T>& Max)
+ {
+ return detail::tvec2<T>(
+ compRand1(Min.x, Max.x),
+ compRand1(Min.y, Max.y));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> compRand3(
+ T Min,
+ const detail::tvec3<T>& Max)
+ {
+ return detail::tvec3<T>(
+ compRand1(Min.x, Max.x),
+ compRand1(Min.y, Max.y),
+ compRand1(Min.z, Max.z));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> compRand4(
+ T Min,
+ const detail::tvec4<T>& Max)
+ {
+ return detail::tvec4<T>(
+ compRand1(Min.x, Max.x),
+ compRand1(Min.y, Max.y),
+ compRand1(Min.z, Max.z),
+ compRand1(Min.w, Max.w));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> compRand2(
+ const detail::tvec2<T>& Min,
+ T Max)
+ {
+ return detail::tvec2<T>(
+ compRand1(Min.x, Max.x),
+ compRand1(Min.y, Max.y));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> compRand3(
+ const detail::tvec3<T>& Min,
+ T Max)
+ {
+ return detail::tvec3<T>(
+ compRand1(Min.x, Max.x),
+ compRand1(Min.y, Max.y),
+ compRand1(Min.z, Max.z));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> compRand4(
+ const detail::tvec4<T>& Min,
+ T Max)
+ {
+ return detail::tvec4<T>(
+ compRand1(Min.x, Max.x),
+ compRand1(Min.y, Max.y),
+ compRand1(Min.z, Max.z),
+ compRand1(Min.w, Max.w));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> compRand2(
+ const detail::tvec2<T>& Min,
+ const detail::tvec2<T>& Max)
+ {
+ return detail::tvec2<T>(
+ compRand1(Min.x, Max.x),
+ compRand1(Min.y, Max.y));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> compRand3(
+ const detail::tvec3<T>& Min,
+ const detail::tvec3<T>& Max)
+ {
+ return detail::tvec3<T>(
+ compRand1(Min.x, Max.x),
+ compRand1(Min.y, Max.y),
+ compRand1(Min.z, Max.z));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> compRand4(
+ const detail::tvec4<T>& Min,
+ const detail::tvec4<T>& Max)
+ {
+ return detail::tvec4<T>(
+ compRand1(Min.x, Max.x),
+ compRand1(Min.y, Max.y),
+ compRand1(Min.z, Max.z),
+ compRand1(Min.w, Max.w));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<float> vecRand2()
+ {
+ detail::tvec2<float> result(float(0));
+ do
+ {
+ result = compRand2(float(-1), float(1));
+ } while (length(result) > float(1));
+
+ return result;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<double> vecRand2()
+ {
+ detail::tvec2<double> result(double(0));
+ do
+ {
+ result = compRand2(double(-1), double(1));
+ } while (length(result) > double(1));
+
+ return result;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> vecRand2(
+ T MinRadius,
+ T MaxRadius)
+ {
+ assert(MinRadius <= MaxRadius);
+
+ detail::tvec2<T> Result(T(0));
+ T LenRadius(0);
+
+ do
+ {
+ Result = compRand2(-MaxRadius, MaxRadius);
+ LenRadius = length(Result);
+ }
+ while(LenRadius > MaxRadius || LenRadius < MinRadius);
+
+ return Result;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> vecRand3()
+ {
+ detail::tvec3<T> Result(T(0));
+ do
+ {
+ Result = compRand3(T(-1), T(1));
+ }
+ while(length(Result) > T(1));
+
+ return Result;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> vecRand3(
+ T MinRadius,
+ T MaxRadius)
+ {
+ assert(MinRadius <= MaxRadius);
+
+ detail::tvec3<T> Result(0);
+ T LenRadius(0);
+
+ do
+ {
+ Result = compRand3(-MaxRadius, MaxRadius);
+ LenRadius = length(Result);
+ }
+ while(LenRadius > MaxRadius || LenRadius < MinRadius);
+
+ return Result;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<float> vecRand4()
+ {
+ detail::tvec4<float> result(float(0));
+ do
+ {
+ result = compRand4(float(-1), float(1));
+ } while (length(result) > float(1));
+
+ return result;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<double> vecRand4()
+ {
+ detail::tvec4<double> result(double(0));
+ do
+ {
+ result = compRand4(double(-1), double(1));
+ } while (length(result) > double(1));
+
+ return result;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> vecRand4(
+ T MinRadius,
+ T MaxRadius)
+ {
+ assert(MinRadius <= MaxRadius);
+
+ detail::tvec4<T> Result(T(0));
+ T LenRadius(T(0));
+
+ do
+ {
+ Result = compRand4(-MaxRadius, MaxRadius);
+ LenRadius = length(Result);
+ }
+ while(LenRadius > MaxRadius || LenRadius < MinRadius);
+
+ return Result;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER T gaussRand1(
+ T mean,
+ T std_deviation)
+ {
+ T w, x1, x2;
+
+ do
+ {
+ x1 = compRand1(T(-1), T(1));
+ x2 = compRand1(T(-1), T(1));
+
+ w = x1 * x1 + x2 * x2;
+ } while(w > T(1));
+
+ return x2 * std_deviation * std_deviation * sqrt((T(-2) * log(w)) / w) + mean;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> gaussRand2(
+ T mean,
+ T std_deviation)
+ {
+ return detail::tvec2<T>(
+ gaussRand1(mean, std_deviation),
+ gaussRand1(mean, std_deviation));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> gaussRand3(
+ T mean,
+ T std_deviation)
+ {
+ return detail::tvec3<T>(
+ gaussRand1(mean, std_deviation),
+ gaussRand1(mean, std_deviation),
+ gaussRand1(mean, std_deviation));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> gaussRand4(
+ T mean,
+ T std_deviation)
+ {
+ return detail::tvec4<T>(
+ gaussRand1(mean, std_deviation),
+ gaussRand1(mean, std_deviation),
+ gaussRand1(mean, std_deviation),
+ gaussRand1(mean, std_deviation));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> gaussRand2(
+ T mean,
+ const detail::tvec2<T>& std_deviation)
+ {
+ return detail::tvec2<T>(
+ gaussRand1(mean, std_deviation.x),
+ gaussRand1(mean, std_deviation.y));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> gaussRand3(
+ T mean,
+ const detail::tvec3<T>& std_deviation)
+ {
+ return detail::tvec3<T>(
+ gaussRand1(mean, std_deviation.x),
+ gaussRand1(mean, std_deviation.y),
+ gaussRand1(mean, std_deviation.z));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> gaussRand4(
+ T mean,
+ const detail::tvec4<T>& std_deviation)
+ {
+ return detail::tvec4<T>(
+ gaussRand1(mean, std_deviation.x),
+ gaussRand1(mean, std_deviation.y),
+ gaussRand1(mean, std_deviation.z),
+ gaussRand1(mean, std_deviation.w));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> gaussRand2(
+ const detail::tvec2<T>& mean,
+ T std_deviation)
+ {
+ return detail::tvec2<T>(
+ gaussRand1(mean.x, std_deviation),
+ gaussRand1(mean.y, std_deviation));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> gaussRand3(
+ const detail::tvec3<T>& mean,
+ T std_deviation)
+ {
+ return detail::tvec3<T>(
+ gaussRand1(mean.x, std_deviation),
+ gaussRand1(mean.y, std_deviation),
+ gaussRand1(mean.z, std_deviation));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> gaussRand4(
+ const detail::tvec4<T>& mean,
+ T std_deviation)
+ {
+ return detail::tvec4<T>(
+ gaussRand1(mean.x, std_deviation),
+ gaussRand1(mean.y, std_deviation),
+ gaussRand1(mean.z, std_deviation),
+ gaussRand1(mean.w, std_deviation));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> gaussRand2(
+ const detail::tvec2<T>& mean,
+ const detail::tvec2<T>& std_deviation)
+ {
+ return detail::tvec2<T>(
+ gaussRand1(mean.x, std_deviation.x),
+ gaussRand1(mean.y, std_deviation.y));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> gaussRand3(
+ const detail::tvec3<T>& mean,
+ const detail::tvec3<T>& std_deviation)
+ {
+ return detail::tvec3<T>(
+ gaussRand1(mean.x, std_deviation.x),
+ gaussRand1(mean.y, std_deviation.y),
+ gaussRand1(mean.z, std_deviation.z));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> gaussRand4(
+ const detail::tvec4<T>& mean,
+ const detail::tvec4<T>& std_deviation)
+ {
+ return detail::tvec4<T>(
+ gaussRand1(mean.x, std_deviation.x),
+ gaussRand1(mean.y, std_deviation.y),
+ gaussRand1(mean.z, std_deviation.z),
+ gaussRand1(mean.w, std_deviation.w));
+ }
+
+}//namespace random
+}//namespace gtx
+}//namespace glm
diff --git a/src/glm/gtx/raw_data.hpp b/src/glm/gtx/raw_data.hpp
new file mode 100644
index 0000000..9479bb2
--- /dev/null
+++ b/src/glm/gtx/raw_data.hpp
@@ -0,0 +1,58 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2008-11-19
+// Updated : 2010-01-28
+// Licence : This source is under MIT License
+// File : glm/gtx/raw_data.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_gtx_raw_data
+#define glm_gtx_raw_data
+
+// Dependency:
+#include "../glm.hpp"
+#include "../gtc/type_precision.hpp"
+
+#if(defined(GLM_MESSAGES) && !defined(glm_ext))
+# pragma message("GLM: GLM_GTX_raw_data extension included")
+#endif
+
+namespace glm{
+namespace gtx{
+namespace raw_data ///< GLM_GTX_raw_data extension: Projection of a vector to other one
+{
+ using namespace gtc::type_precision;
+
+ /// \addtogroup gtx_raw_data
+ ///@{
+
+ //! Type for byte numbers.
+ //! From GLM_GTX_raw_data extension.
+ typedef uint8 byte;
+
+ //! Type for word numbers.
+ //! From GLM_GTX_raw_data extension.
+ typedef uint16 word;
+
+ //! Type for dword numbers.
+ //! From GLM_GTX_raw_data extension.
+ typedef uint32 dword;
+
+ //! Type for qword numbers.
+ //! From GLM_GTX_raw_data extension.
+ typedef uint64 qword;
+
+ ///@}
+}// namespace raw_data
+}// namespace gtx
+}// namespace glm
+
+#include "raw_data.inl"
+
+namespace glm{using namespace gtx::raw_data;}
+
+#endif//glm_gtx_raw_data
diff --git a/src/glm/gtx/raw_data.inl b/src/glm/gtx/raw_data.inl
new file mode 100644
index 0000000..893d550
--- /dev/null
+++ b/src/glm/gtx/raw_data.inl
@@ -0,0 +1,11 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2008-11-19
+// Updated : 2008-11-19
+// Licence : This source is under MIT License
+// File : glm/gtx/raw_data.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+///////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/glm/gtx/reciprocal.hpp b/src/glm/gtx/reciprocal.hpp
new file mode 100644
index 0000000..af9b288
--- /dev/null
+++ b/src/glm/gtx/reciprocal.hpp
@@ -0,0 +1,99 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2008-10-09
+// Updated : 2008-10-09
+// Licence : This source is under MIT License
+// File : glm/gtx/reciprocal.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_gtx_reciprocal
+#define glm_gtx_reciprocal
+
+// Dependency:
+#include "../glm.hpp"
+
+#if(defined(GLM_MESSAGES) && !defined(glm_ext))
+# pragma message("GLM: GLM_GTX_reciprocal extension included")
+#endif
+
+namespace glm{
+namespace gtx{
+namespace reciprocal ///< GLM_GTX_reciprocal extension: Define secant, cosecant and cotangent functions.
+{
+ /// \addtogroup gtx_reciprocal
+ /// @{
+
+ //! Secant function.
+ //! hypotenuse / adjacent or 1 / cos(x)
+ //! From GLM_GTX_reciprocal extension.
+ template <typename genType>
+ genType sec(genType const & angle);
+
+ //! Cosecant function.
+ //! hypotenuse / opposite or 1 / sin(x)
+ //! From GLM_GTX_reciprocal extension.
+ template <typename genType>
+ genType csc(genType const & angle);
+
+ //! Cotangent function.
+ //! adjacent / opposite or 1 / tan(x)
+ //! From GLM_GTX_reciprocal extension.
+ template <typename genType>
+ genType cot(genType const & angle);
+
+ //! Inverse secant function.
+ //! From GLM_GTX_reciprocal extension.
+ template <typename genType>
+ genType asec(genType const & x);
+
+ //! Inverse cosecant function.
+ //! From GLM_GTX_reciprocal extension.
+ template <typename genType>
+ genType acsc(genType const & x);
+
+ //! Inverse cotangent function.
+ //! From GLM_GTX_reciprocal extension.
+ template <typename genType>
+ genType acot(genType const & x);
+
+ //! Secant hyperbolic function.
+ //! From GLM_GTX_reciprocal extension.
+ template <typename genType>
+ genType sech(genType const & angle);
+
+ //! Cosecant hyperbolic function.
+ //! From GLM_GTX_reciprocal extension.
+ template <typename genType>
+ genType csch(genType const & angle);
+
+ //! Cotangent hyperbolic function.
+ //! From GLM_GTX_reciprocal extension.
+ template <typename genType>
+ genType coth(genType const & angle);
+
+ //! Inverse secant hyperbolic function.
+ //! From GLM_GTX_reciprocal extension.
+ template <typename genType>
+ genType asech(genType const & x);
+
+ //! Inverse cosecant hyperbolic function.
+ //! From GLM_GTX_reciprocal extension.
+ template <typename genType>
+ genType acsch(genType const & x);
+
+ //! Inverse cotangent hyperbolic function.
+ //! From GLM_GTX_reciprocal extension.
+ template <typename genType>
+ genType acoth(genType const & x);
+
+ /// @}
+}//namespace reciprocal
+}//namespace gtx
+}//namespace glm
+
+#include "reciprocal.inl"
+
+namespace glm{using namespace gtx::reciprocal;}
+
+#endif//glm_gtx_reciprocal
diff --git a/src/glm/gtx/reciprocal.inl b/src/glm/gtx/reciprocal.inl
new file mode 100644
index 0000000..27ecd1e
--- /dev/null
+++ b/src/glm/gtx/reciprocal.inl
@@ -0,0 +1,593 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2008-10-09
+// Updated : 2008-10-09
+// Licence : This source is under MIT License
+// File : glm/gtx/reciprocal.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm{
+namespace gtx{
+namespace reciprocal{
+
+// sec
+template <typename genType>
+GLM_FUNC_QUALIFIER genType sec
+(
+ genType const & angle
+)
+{
+ GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'sec' only accept floating-point values");
+
+ return genType(1) / glm::cos(angle);
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec2<valType> sec
+(
+ detail::tvec2<valType> const & angle
+)
+{
+ return detail::tvec2<valType>(
+ sec(angle.x),
+ sec(angle.y));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec3<valType> sec
+(
+ detail::tvec3<valType> const & angle
+)
+{
+ return detail::tvec3<valType>(
+ sec(angle.x),
+ sec(angle.y),
+ sec(angle.z));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec4<valType> sec
+(
+ detail::tvec4<valType> const & angle
+)
+{
+ return detail::tvec4<valType>(
+ sec(angle.x),
+ sec(angle.y),
+ sec(angle.z),
+ sec(angle.w));
+}
+
+// csc
+template <typename genType>
+GLM_FUNC_QUALIFIER genType csc
+(
+ genType const & angle
+)
+{
+ GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'csc' only accept floating-point values");
+
+ return genType(1) / glm::sin(angle);
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec2<valType> csc
+(
+ detail::tvec2<valType> const & angle
+)
+{
+ return detail::tvec2<valType>(
+ csc(angle.x),
+ csc(angle.y));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec3<valType> csc
+(
+ detail::tvec3<valType> const & angle
+)
+{
+ return detail::tvec3<valType>(
+ csc(angle.x),
+ csc(angle.y),
+ csc(angle.z));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec4<valType> csc
+(
+ detail::tvec4<valType> const & angle
+)
+{
+ return detail::tvec4<valType>(
+ csc(angle.x),
+ csc(angle.y),
+ csc(angle.z),
+ csc(angle.w));
+}
+
+// cot
+template <typename genType>
+GLM_FUNC_QUALIFIER genType cot
+(
+ genType const & angle
+)
+{
+ GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'cot' only accept floating-point values");
+
+ return genType(1) / glm::tan(angle);
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec2<valType> cot
+(
+ detail::tvec2<valType> const & angle
+)
+{
+ return detail::tvec2<valType>(
+ cot(angle.x),
+ cot(angle.y));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec3<valType> cot
+(
+ detail::tvec3<valType> const & angle
+)
+{
+ return detail::tvec3<valType>(
+ cot(angle.x),
+ cot(angle.y),
+ cot(angle.z));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec4<valType> cot
+(
+ detail::tvec4<valType> const & angle
+)
+{
+ return detail::tvec4<valType>(
+ cot(angle.x),
+ cot(angle.y),
+ cot(angle.z),
+ cot(angle.w));
+}
+
+// asec
+template <typename genType>
+GLM_FUNC_QUALIFIER genType asec
+(
+ genType const & x
+)
+{
+ GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'asec' only accept floating-point values");
+
+ return acos(genType(1) / x);
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec2<valType> asec
+(
+ detail::tvec2<valType> const & x
+)
+{
+ return detail::tvec2<valType>(
+ asec(x.x),
+ asec(x.y));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec3<valType> asec
+(
+ detail::tvec3<valType> const & x
+)
+{
+ return detail::tvec3<valType>(
+ asec(x.x),
+ asec(x.y),
+ asec(x.z));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec4<valType> asec
+(
+ detail::tvec4<valType> const & x
+)
+{
+ return detail::tvec4<valType>(
+ asec(x.x),
+ asec(x.y),
+ asec(x.z),
+ asec(x.w));
+}
+
+// acsc
+template <typename genType>
+GLM_FUNC_QUALIFIER genType acsc
+(
+ genType const & x
+)
+{
+ GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'acsc' only accept floating-point values");
+
+ return asin(genType(1) / x);
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec2<valType> acsc
+(
+ detail::tvec2<valType> const & x
+)
+{
+ return detail::tvec2<valType>(
+ acsc(x.x),
+ acsc(x.y));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec3<valType> acsc
+(
+ detail::tvec3<valType> const & x
+)
+{
+ return detail::tvec3<valType>(
+ acsc(x.x),
+ acsc(x.y),
+ acsc(x.z));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec4<valType> acsc
+(
+ detail::tvec4<valType> const & x
+)
+{
+ return detail::tvec4<valType>(
+ acsc(x.x),
+ acsc(x.y),
+ acsc(x.z),
+ acsc(x.w));
+}
+
+// acot
+template <typename genType>
+GLM_FUNC_QUALIFIER genType acot
+(
+ genType const & x
+)
+{
+ GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'acot' only accept floating-point values");
+
+ genType const pi_over_2 = genType(3.1415926535897932384626433832795 / 2.0);
+ return pi_over_2 - atan(x);
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec2<valType> acot
+(
+ detail::tvec2<valType> const & x
+)
+{
+ return detail::tvec2<valType>(
+ acot(x.x),
+ acot(x.y));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec3<valType> acot
+(
+ detail::tvec3<valType> const & x
+)
+{
+ return detail::tvec3<valType>(
+ acot(x.x),
+ acot(x.y),
+ acot(x.z));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec4<valType> acot
+(
+ detail::tvec4<valType> const & x
+)
+{
+ return detail::tvec4<valType>(
+ acot(x.x),
+ acot(x.y),
+ acot(x.z),
+ acot(x.w));
+}
+
+// sech
+template <typename genType>
+GLM_FUNC_QUALIFIER genType sech
+(
+ genType const & angle
+)
+{
+ GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'sech' only accept floating-point values");
+
+ return genType(1) / glm::cosh(angle);
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec2<valType> sech
+(
+ detail::tvec2<valType> const & angle
+)
+{
+ return detail::tvec2<valType>(
+ sech(angle.x),
+ sech(angle.y));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec3<valType> sech
+(
+ detail::tvec3<valType> const & angle
+)
+{
+ return detail::tvec3<valType>(
+ sech(angle.x),
+ sech(angle.y),
+ sech(angle.z));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec4<valType> sech
+(
+ detail::tvec4<valType> const & angle
+)
+{
+ return detail::tvec4<valType>(
+ sech(angle.x),
+ sech(angle.y),
+ sech(angle.z),
+ sech(angle.w));
+}
+
+// csch
+template <typename genType>
+GLM_FUNC_QUALIFIER genType csch
+(
+ genType const & angle
+)
+{
+ GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'csch' only accept floating-point values");
+
+ return genType(1) / glm::sinh(angle);
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec2<valType> csch
+(
+ detail::tvec2<valType> const & angle
+)
+{
+ return detail::tvec2<valType>(
+ csch(angle.x),
+ csch(angle.y));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec3<valType> csch
+(
+ detail::tvec3<valType> const & angle
+)
+{
+ return detail::tvec3<valType>(
+ csch(angle.x),
+ csch(angle.y),
+ csch(angle.z));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec4<valType> csch
+(
+ detail::tvec4<valType> const & angle
+)
+{
+ return detail::tvec4<valType>(
+ csch(angle.x),
+ csch(angle.y),
+ csch(angle.z),
+ csch(angle.w));
+}
+
+// coth
+template <typename genType>
+GLM_FUNC_QUALIFIER genType coth
+(
+ genType const & angle
+)
+{
+ GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'coth' only accept floating-point values");
+
+ return glm::cosh(angle) / glm::sinh(angle);
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec2<valType> coth
+(
+ detail::tvec2<valType> const & angle
+)
+{
+ return detail::tvec2<valType>(
+ coth(angle.x),
+ coth(angle.y));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec3<valType> coth
+(
+ detail::tvec3<valType> const & angle
+)
+{
+ return detail::tvec3<valType>(
+ coth(angle.x),
+ coth(angle.y),
+ coth(angle.z));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec4<valType> coth
+(
+ detail::tvec4<valType> const & angle
+)
+{
+ return detail::tvec4<valType>(
+ coth(angle.x),
+ coth(angle.y),
+ coth(angle.z),
+ coth(angle.w));
+}
+
+// asech
+template <typename genType>
+GLM_FUNC_QUALIFIER genType asech
+(
+ genType const & x
+)
+{
+ GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'asech' only accept floating-point values");
+
+ return acosh(genType(1) / x);
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec2<valType> asech
+(
+ detail::tvec2<valType> const & x
+)
+{
+ return detail::tvec2<valType>(
+ asech(x.x),
+ asech(x.y));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec3<valType> asech
+(
+ detail::tvec3<valType> const & x
+)
+{
+ return detail::tvec3<valType>(
+ asech(x.x),
+ asech(x.y),
+ asech(x.z));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec4<valType> asech
+(
+ detail::tvec4<valType> const & x
+)
+{
+ return detail::tvec4<valType>(
+ asech(x.x),
+ asech(x.y),
+ asech(x.z),
+ asech(x.w));
+}
+
+// acsch
+template <typename genType>
+GLM_FUNC_QUALIFIER genType acsch
+(
+ genType const & x
+)
+{
+ GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'acsch' only accept floating-point values");
+
+ return asinh(genType(1) / x);
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec2<valType> acsch
+(
+ detail::tvec2<valType> const & x
+)
+{
+ return detail::tvec2<valType>(
+ acsch(x.x),
+ acsch(x.y));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec3<valType> acsch
+(
+ detail::tvec3<valType> const & x
+)
+{
+ return detail::tvec3<valType>(
+ acsch(x.x),
+ acsch(x.y),
+ acsch(x.z));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec4<valType> acsch
+(
+ detail::tvec4<valType> const & x
+)
+{
+ return detail::tvec4<valType>(
+ acsch(x.x),
+ acsch(x.y),
+ acsch(x.z),
+ acsch(x.w));
+}
+
+// acoth
+template <typename genType>
+GLM_FUNC_QUALIFIER genType acoth
+(
+ genType const & x
+)
+{
+ GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'acoth' only accept floating-point values");
+
+ return atanh(genType(1) / x);
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec2<valType> acoth
+(
+ detail::tvec2<valType> const & x
+)
+{
+ return detail::tvec2<valType>(
+ acoth(x.x),
+ acoth(x.y));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec3<valType> acoth
+(
+ detail::tvec3<valType> const & x
+)
+{
+ return detail::tvec3<valType>(
+ acoth(x.x),
+ acoth(x.y),
+ acoth(x.z));
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec4<valType> acoth
+(
+ detail::tvec4<valType> const & x
+)
+{
+ return detail::tvec4<valType>(
+ acoth(x.x),
+ acoth(x.y),
+ acoth(x.z),
+ acoth(x.w));
+}
+
+}//namespace reciprocal
+}//namespace gtx
+}//namespace glm
diff --git a/src/glm/gtx/rotate_vector.hpp b/src/glm/gtx/rotate_vector.hpp
new file mode 100644
index 0000000..bb9148f
--- /dev/null
+++ b/src/glm/gtx/rotate_vector.hpp
@@ -0,0 +1,114 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2006-11-02
+// Updated : 2009-02-19
+// Licence : This source is under MIT License
+// File : glm/gtx/rotate_vector.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_gtx_rotate_vector
+#define glm_gtx_rotate_vector
+
+// Dependency:
+#include "../glm.hpp"
+#include "../gtx/transform.hpp"
+
+#if(defined(GLM_MESSAGES) && !defined(glm_ext))
+# pragma message("GLM: GLM_GTX_rotate_vector extension included")
+#endif
+
+namespace glm{
+namespace gtx{
+namespace rotate_vector ///< GLM_GTX_rotate_vector extension: Function to directly rotate a vector
+{
+ using namespace transform;
+
+ /// \addtogroup gtx_rotate_vector
+ /// @{
+
+ //! Rotate a two dimensional vector.
+ //! From GLM_GTX_rotate_vector extension.
+ template <typename T>
+ detail::tvec2<T> rotate(
+ detail::tvec2<T> const & v,
+ T const & angle);
+
+ //! Rotate a three dimensional vector around an axis.
+ //! From GLM_GTX_rotate_vector extension.
+ template <typename T>
+ detail::tvec3<T> rotate(
+ detail::tvec3<T> const & v,
+ T const & angle,
+ detail::tvec3<T> const & normal);
+
+ //! Rotate a four dimensional vector around an axis.
+ //! From GLM_GTX_rotate_vector extension.
+ template <typename T>
+ detail::tvec4<T> rotate(
+ detail::tvec4<T> const & v,
+ T const & angle,
+ detail::tvec3<T> const & normal);
+
+ //! Rotate a three dimensional vector around the X axis.
+ //! From GLM_GTX_rotate_vector extension.
+ template <typename T>
+ detail::tvec3<T> rotateX(
+ detail::tvec3<T> const & v,
+ T const & angle);
+
+ //! Rotate a three dimensional vector around the Y axis.
+ //! From GLM_GTX_rotate_vector extension.
+ template <typename T>
+ detail::tvec3<T> rotateY(
+ detail::tvec3<T> const & v,
+ T const & angle);
+
+ //! Rotate a three dimensional vector around the Z axis.
+ //! From GLM_GTX_rotate_vector extension.
+ template <typename T>
+ detail::tvec3<T> rotateZ(
+ detail::tvec3<T> const & v,
+ T const & angle);
+
+ //! Rotate a four dimentionnals vector around the X axis.
+ //! From GLM_GTX_rotate_vector extension.
+ template <typename T>
+ detail::tvec4<T> rotateX(
+ detail::tvec4<T> const & v,
+ T const & angle);
+
+ //! Rotate a four dimensional vector around the X axis.
+ //! From GLM_GTX_rotate_vector extension.
+ template <typename T>
+ detail::tvec4<T> rotateY(
+ detail::tvec4<T> const & v,
+ T const & angle);
+
+ //! Rotate a four dimensional vector around the X axis.
+ //! From GLM_GTX_rotate_vector extension.
+ template <typename T>
+ detail::tvec4<T> rotateZ(
+ detail::tvec4<T> const & v,
+ T const & angle);
+
+ //! Build a rotation matrix from a normal and a up vector.
+ //! From GLM_GTX_rotate_vector extension.
+ template <typename T>
+ detail::tmat4x4<T> orientation(
+ detail::tvec3<T> const & Normal,
+ detail::tvec3<T> const & Up);
+
+ /// @}
+}//namespace rotate_vector
+}//namespace gtx
+}//namespace glm
+
+#include "rotate_vector.inl"
+
+namespace glm{using namespace gtx::rotate_vector;}
+
+#endif//glm_gtx_rotate_vector
diff --git a/src/glm/gtx/rotate_vector.inl b/src/glm/gtx/rotate_vector.inl
new file mode 100644
index 0000000..0db2308
--- /dev/null
+++ b/src/glm/gtx/rotate_vector.inl
@@ -0,0 +1,149 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2006-11-02
+// Updated : 2009-02-19
+// Licence : This source is under MIT License
+// File : glm/gtx/rotate_vector.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm{
+namespace gtx{
+namespace rotate_vector
+{
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> rotate(
+ detail::tvec2<T> const & v,
+ T const & angle)
+ {
+ detail::tvec2<T> Result;
+ const T Cos = cos(radians(angle));
+ const T Sin = sin(radians(angle));
+ Result.x = v.x * Cos - v.y * Sin;
+ Result.y = v.x * Sin + v.y * Cos;
+ return Result;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> rotate(
+ const detail::tvec3<T> & v,
+ T const & angle,
+ const detail::tvec3<T> & normal)
+ {
+ return detail::tmat3x3<T>(glm::gtx::transform::rotate(angle, normal)) * v;
+ }
+/*
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> rotateGTX(
+ const detail::tvec3<T>& x,
+ T angle,
+ const detail::tvec3<T>& normal)
+ {
+ const T Cos = cos(radians(angle));
+ const T Sin = sin(radians(angle));
+ return x * Cos + ((x * normal) * (T(1) - Cos)) * normal + cross(x, normal) * Sin;
+ }
+*/
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> rotate(
+ detail::tvec4<T> const & v,
+ T const & angle,
+ detail::tvec3<T> const & normal)
+ {
+ return glm::gtx::transform::rotate(angle, normal) * v;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> rotateX(
+ detail::tvec3<T> const & v,
+ T const & angle)
+ {
+ detail::tvec3<T> Result = v;
+ const T Cos = cos(radians(angle));
+ const T Sin = sin(radians(angle));
+ Result.y = v.y * Cos - v.z * Sin;
+ Result.z = v.y * Sin + v.z * Cos;
+ return Result;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> rotateY(
+ detail::tvec3<T> const & v,
+ T const & angle)
+ {
+ detail::tvec3<T> Result = v;
+ const T Cos = cos(radians(angle));
+ const T Sin = sin(radians(angle));
+ Result.x = v.x * Cos + v.z * Sin;
+ Result.z = -v.x * Sin + v.z * Cos;
+ return Result;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> rotateZ(
+ detail::tvec3<T> const & v,
+ T const & angle)
+ {
+ detail::tvec3<T> Result = v;
+ const T Cos = cos(radians(angle));
+ const T Sin = sin(radians(angle));
+ Result.x = v.x * Cos - v.y * Sin;
+ Result.y = v.x * Sin + v.y * Cos;
+ return Result;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> rotateX(
+ detail::tvec4<T> const & v,
+ T const & angle)
+ {
+ detail::tvec4<T> Result = v;
+ const T Cos = cos(radians(angle));
+ const T Sin = sin(radians(angle));
+ Result.y = v.y * Cos - v.z * Sin;
+ Result.z = v.y * Sin + v.z * Cos;
+ return Result;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> rotateY(
+ detail::tvec4<T> const & v,
+ T const & angle)
+ {
+ detail::tvec4<T> Result = v;
+ const T Cos = cos(radians(angle));
+ const T Sin = sin(radians(angle));
+ Result.x = v.x * Cos + v.z * Sin;
+ Result.z = -v.x * Sin + v.z * Cos;
+ return Result;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> rotateZ(
+ detail::tvec4<T> const & v,
+ T const & angle)
+ {
+ detail::tvec4<T> Result = v;
+ const T Cos = cos(radians(angle));
+ const T Sin = sin(radians(angle));
+ Result.x = v.x * Cos - v.y * Sin;
+ Result.y = v.x * Sin + v.y * Cos;
+ return Result;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat4x4<T> orientation(
+ detail::tvec3<T> const & Normal,
+ detail::tvec3<T> const & Up)
+ {
+ if(all(equal(Normal, Up)))
+ return detail::tmat4x4<T>(T(1));
+
+ detail::tvec3<T> RotationAxis = cross(Up, Normal);
+ T Angle = degrees(acos(dot(Normal, Up)));
+ return glm::gtx::transform::rotate(Angle, RotationAxis);
+ }
+
+}//namespace rotate_vector
+}//namespace gtx
+}//namespace glm
diff --git a/src/glm/gtx/simd_mat4.hpp b/src/glm/gtx/simd_mat4.hpp
new file mode 100644
index 0000000..5c822cc
--- /dev/null
+++ b/src/glm/gtx/simd_mat4.hpp
@@ -0,0 +1,183 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2009-05-07
+// Updated : 2009-05-07
+// Licence : This source is under MIT License
+// File : glm/gtx/simd_vec4.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+// - intrinsic
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_gtx_simd_mat4
+#define glm_gtx_simd_mat4
+
+// Dependency:
+#include "../glm.hpp"
+
+#if(GLM_ARCH & GLM_ARCH_SSE2)
+# include "../core/intrinsic_matrix.hpp"
+# include "../gtx/simd_vec4.hpp"
+#else
+# error "GLM: GLM_GTX_simd_mat4 requires compiler support of SSE2 through intrinsics"
+#endif
+
+#if(defined(GLM_MESSAGES) && !defined(glm_ext))
+# pragma message("GLM: GLM_GTX_simd_mat4 extension included")
+#endif
+
+namespace glm{
+namespace detail
+{
+ /// 4x4 Matrix implemented using SIMD SEE intrinsics.
+ /// \ingroup gtx_simd_mat4
+ GLM_ALIGNED_STRUCT(16) fmat4x4SIMD
+ {
+ enum ctor{null};
+
+ typedef float value_type;
+ typedef fvec4SIMD col_type;
+ typedef fvec4SIMD row_type;
+ typedef std::size_t size_type;
+ static size_type value_size();
+ static size_type col_size();
+ static size_type row_size();
+ static bool is_matrix();
+
+ fvec4SIMD Data[4];
+
+ //////////////////////////////////////
+ // Constructors
+
+ fmat4x4SIMD();
+ explicit fmat4x4SIMD(float const & s);
+ explicit fmat4x4SIMD(
+ float const & x0, float const & y0, float const & z0, float const & w0,
+ float const & x1, float const & y1, float const & z1, float const & w1,
+ float const & x2, float const & y2, float const & z2, float const & w2,
+ float const & x3, float const & y3, float const & z3, float const & w3);
+ explicit fmat4x4SIMD(
+ fvec4SIMD const & v0,
+ fvec4SIMD const & v1,
+ fvec4SIMD const & v2,
+ fvec4SIMD const & v3);
+ explicit fmat4x4SIMD(
+ tmat4x4<float> const & m);
+
+ // Conversions
+ //template <typename U>
+ //explicit tmat4x4(tmat4x4<U> const & m);
+
+ //explicit tmat4x4(tmat2x2<T> const & x);
+ //explicit tmat4x4(tmat3x3<T> const & x);
+ //explicit tmat4x4(tmat2x3<T> const & x);
+ //explicit tmat4x4(tmat3x2<T> const & x);
+ //explicit tmat4x4(tmat2x4<T> const & x);
+ //explicit tmat4x4(tmat4x2<T> const & x);
+ //explicit tmat4x4(tmat3x4<T> const & x);
+ //explicit tmat4x4(tmat4x3<T> const & x);
+
+ // Accesses
+ fvec4SIMD & operator[](size_type i);
+ fvec4SIMD const & operator[](size_type i) const;
+
+ // Unary updatable operators
+ fmat4x4SIMD & operator= (fmat4x4SIMD const & m);
+ fmat4x4SIMD & operator+= (float const & s);
+ fmat4x4SIMD & operator+= (fmat4x4SIMD const & m);
+ fmat4x4SIMD & operator-= (float const & s);
+ fmat4x4SIMD & operator-= (fmat4x4SIMD const & m);
+ fmat4x4SIMD & operator*= (float const & s);
+ fmat4x4SIMD & operator*= (fmat4x4SIMD const & m);
+ fmat4x4SIMD & operator/= (float const & s);
+ fmat4x4SIMD & operator/= (fmat4x4SIMD const & m);
+ fmat4x4SIMD & operator++ ();
+ fmat4x4SIMD & operator-- ();
+ };
+
+ // Binary operators
+ fmat4x4SIMD operator+ (fmat4x4SIMD const & m, float const & s);
+ fmat4x4SIMD operator+ (float const & s, fmat4x4SIMD const & m);
+ fmat4x4SIMD operator+ (fmat4x4SIMD const & m1, fmat4x4SIMD const & m2);
+
+ fmat4x4SIMD operator- (fmat4x4SIMD const & m, float const & s);
+ fmat4x4SIMD operator- (float const & s, fmat4x4SIMD const & m);
+ fmat4x4SIMD operator- (fmat4x4SIMD const & m1, fmat4x4SIMD const & m2);
+
+ fmat4x4SIMD operator* (fmat4x4SIMD const & m, float const & s);
+ fmat4x4SIMD operator* (float const & s, fmat4x4SIMD const & m);
+
+ fvec4SIMD operator* (fmat4x4SIMD const & m, fvec4SIMD const & v);
+ fvec4SIMD operator* (fvec4SIMD const & v, fmat4x4SIMD const & m);
+
+ fmat4x4SIMD operator* (fmat4x4SIMD const & m1, fmat4x4SIMD const & m2);
+
+ fmat4x4SIMD operator/ (fmat4x4SIMD const & m, float const & s);
+ fmat4x4SIMD operator/ (float const & s, fmat4x4SIMD const & m);
+
+ fvec4SIMD operator/ (fmat4x4SIMD const & m, fvec4SIMD const & v);
+ fvec4SIMD operator/ (fvec4SIMD const & v, fmat4x4SIMD const & m);
+
+ fmat4x4SIMD operator/ (fmat4x4SIMD const & m1, fmat4x4SIMD const & m2);
+
+ // Unary constant operators
+ fmat4x4SIMD const operator- (fmat4x4SIMD const & m);
+ fmat4x4SIMD const operator-- (fmat4x4SIMD const & m, int);
+ fmat4x4SIMD const operator++ (fmat4x4SIMD const & m, int);
+}//namespace detail
+
+namespace gtx{
+namespace simd_mat4 ///< GLM_GTX_simd_mat4 extension: SIMD implementation of mat4 type.
+{
+ typedef detail::fmat4x4SIMD simdMat4;
+
+ /// \addtogroup gtx_simd_mat4
+ ///@{
+
+ //! Convert a simdMat4 to a mat4.
+ //! (From GLM_GTX_simd_mat4 extension)
+ detail::tmat4x4<float> mat4_cast(
+ detail::fmat4x4SIMD const & x);
+
+ //! 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].
+ //! (From GLM_GTX_simd_mat4 extension).
+ detail::fmat4x4SIMD matrixCompMult(
+ detail::fmat4x4SIMD const & x,
+ detail::fmat4x4SIMD 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.
+ //! (From GLM_GTX_simd_mat4 extension).
+ detail::fmat4x4SIMD outerProduct(
+ detail::fvec4SIMD const & c,
+ detail::fvec4SIMD const & r);
+
+ //! Returns the transposed matrix of x
+ //! (From GLM_GTX_simd_mat4 extension).
+ detail::fmat4x4SIMD transpose(
+ detail::fmat4x4SIMD const & x);
+
+ //! Return the determinant of a mat4 matrix.
+ //! (From GLM_GTX_simd_mat4 extension).
+ float determinant(
+ detail::fmat4x4SIMD const & m);
+
+ //! Return the inverse of a mat4 matrix.
+ //! (From GLM_GTX_simd_mat4 extension).
+ detail::fmat4x4SIMD inverse(
+ detail::fmat4x4SIMD const & m);
+
+ /// @}
+}// namespace simd_mat4
+}// namespace gtx
+}// namespace glm
+
+#include "simd_mat4.inl"
+
+namespace glm{using namespace gtx::simd_mat4;}
+
+#endif//glm_gtx_simd_mat4
diff --git a/src/glm/gtx/simd_mat4.inl b/src/glm/gtx/simd_mat4.inl
new file mode 100644
index 0000000..6f4b918
--- /dev/null
+++ b/src/glm/gtx/simd_mat4.inl
@@ -0,0 +1,309 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2009-05-19
+// Updated : 2009-05-19
+// Licence : This source is under MIT License
+// File : glm/gtx/simd_mat4.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm{
+namespace detail
+{
+ GLM_FUNC_QUALIFIER fmat4x4SIMD::size_type fmat4x4SIMD::value_size()
+ {
+ return sizeof(value_type);
+ }
+
+ GLM_FUNC_QUALIFIER fmat4x4SIMD::size_type fmat4x4SIMD::col_size()
+ {
+ return 4;
+ }
+
+ GLM_FUNC_QUALIFIER fmat4x4SIMD::size_type fmat4x4SIMD::row_size()
+ {
+ return 4;
+ }
+
+ GLM_FUNC_QUALIFIER fmat4x4SIMD::fmat4x4SIMD()
+ {}
+
+ GLM_FUNC_QUALIFIER fmat4x4SIMD::fmat4x4SIMD(float const & s)
+ {
+ this->Data[0] = fvec4SIMD(s, 0, 0, 0);
+ this->Data[1] = fvec4SIMD(0, s, 0, 0);
+ this->Data[2] = fvec4SIMD(0, 0, s, 0);
+ this->Data[3] = fvec4SIMD(0, 0, 0, s);
+ }
+
+ GLM_FUNC_QUALIFIER fmat4x4SIMD::fmat4x4SIMD
+ (
+ float const & x0, float const & y0, float const & z0, float const & w0,
+ float const & x1, float const & y1, float const & z1, float const & w1,
+ float const & x2, float const & y2, float const & z2, float const & w2,
+ float const & x3, float const & y3, float const & z3, float const & w3
+ )
+ {
+ this->Data[0] = fvec4SIMD(x0, y0, z0, w0);
+ this->Data[1] = fvec4SIMD(x1, y1, z1, w1);
+ this->Data[2] = fvec4SIMD(x2, y2, z2, w2);
+ this->Data[3] = fvec4SIMD(x3, y3, z3, w3);
+ }
+
+ GLM_FUNC_QUALIFIER fmat4x4SIMD::fmat4x4SIMD
+ (
+ fvec4SIMD const & v0,
+ fvec4SIMD const & v1,
+ fvec4SIMD const & v2,
+ fvec4SIMD const & v3
+ )
+ {
+ this->Data[0] = v0;
+ this->Data[1] = v1;
+ this->Data[2] = v2;
+ this->Data[3] = v3;
+ }
+
+ GLM_FUNC_QUALIFIER fmat4x4SIMD::fmat4x4SIMD
+ (
+ tmat4x4<float> const & m
+ )
+ {
+ this->Data[0] = fvec4SIMD(m[0]);
+ this->Data[1] = fvec4SIMD(m[1]);
+ this->Data[2] = fvec4SIMD(m[2]);
+ this->Data[3] = fvec4SIMD(m[3]);
+ }
+
+ //////////////////////////////////////
+ // Accesses
+
+ GLM_FUNC_QUALIFIER fvec4SIMD & fmat4x4SIMD::operator[]
+ (
+ fmat4x4SIMD::size_type i
+ )
+ {
+ assert(
+ i >= fmat4x4SIMD::size_type(0) &&
+ i < fmat4x4SIMD::col_size());
+
+ return this->Data[i];
+ }
+
+ GLM_FUNC_QUALIFIER fvec4SIMD const & fmat4x4SIMD::operator[]
+ (
+ fmat4x4SIMD::size_type i
+ ) const
+ {
+ assert(
+ i >= fmat4x4SIMD::size_type(0) &&
+ i < fmat4x4SIMD::col_size());
+
+ return this->Data[i];
+ }
+
+ //////////////////////////////////////////////////////////////
+ // mat4 operators
+
+ GLM_FUNC_QUALIFIER fmat4x4SIMD& fmat4x4SIMD::operator=
+ (
+ fmat4x4SIMD const & m
+ )
+ {
+ this->Data[0] = m[0];
+ this->Data[1] = m[1];
+ this->Data[2] = m[2];
+ this->Data[3] = m[3];
+ return *this;
+ }
+
+ GLM_FUNC_QUALIFIER fmat4x4SIMD & fmat4x4SIMD::operator+=
+ (
+ fmat4x4SIMD const & m
+ )
+ {
+ this->Data[0].Data = _mm_add_ps(this->Data[0].Data, m[0].Data);
+ this->Data[1].Data = _mm_add_ps(this->Data[1].Data, m[1].Data);
+ this->Data[2].Data = _mm_add_ps(this->Data[2].Data, m[2].Data);
+ this->Data[3].Data = _mm_add_ps(this->Data[3].Data, m[3].Data);
+ return *this;
+ }
+
+ GLM_FUNC_QUALIFIER fmat4x4SIMD & fmat4x4SIMD::operator-=
+ (
+ fmat4x4SIMD const & m
+ )
+ {
+ this->Data[0].Data = _mm_sub_ps(this->Data[0].Data, m[0].Data);
+ this->Data[1].Data = _mm_sub_ps(this->Data[1].Data, m[1].Data);
+ this->Data[2].Data = _mm_sub_ps(this->Data[2].Data, m[2].Data);
+ this->Data[3].Data = _mm_sub_ps(this->Data[3].Data, m[3].Data);
+
+ return *this;
+ }
+
+ GLM_FUNC_QUALIFIER fmat4x4SIMD & fmat4x4SIMD::operator*=
+ (
+ fmat4x4SIMD const & m
+ )
+ {
+ sse_mul_ps(&this->Data[0].Data, &m.Data[0].Data, &this->Data[0].Data);
+ return *this;
+ }
+
+ GLM_FUNC_QUALIFIER fmat4x4SIMD & fmat4x4SIMD::operator/=
+ (
+ fmat4x4SIMD const & m
+ )
+ {
+ __m128 Inv[4];
+ sse_inverse_ps(&this->Data[0].Data, Inv);
+ sse_mul_ps(&this->Data[0].Data, Inv, &this->Data[0].Data);
+ return *this;
+ }
+
+ GLM_FUNC_QUALIFIER fmat4x4SIMD & fmat4x4SIMD::operator+=
+ (
+ float const & s
+ )
+ {
+ __m128 Operand = _mm_set_ps1(s);
+ this->Data[0].Data = _mm_add_ps(this->Data[0].Data, Operand);
+ this->Data[1].Data = _mm_add_ps(this->Data[1].Data, Operand);
+ this->Data[2].Data = _mm_add_ps(this->Data[2].Data, Operand);
+ this->Data[3].Data = _mm_add_ps(this->Data[3].Data, Operand);
+ return *this;
+ }
+
+ GLM_FUNC_QUALIFIER fmat4x4SIMD & fmat4x4SIMD::operator-=
+ (
+ float const & s
+ )
+ {
+ __m128 Operand = _mm_set_ps1(s);
+ this->Data[0].Data = _mm_sub_ps(this->Data[0].Data, Operand);
+ this->Data[1].Data = _mm_sub_ps(this->Data[1].Data, Operand);
+ this->Data[2].Data = _mm_sub_ps(this->Data[2].Data, Operand);
+ this->Data[3].Data = _mm_sub_ps(this->Data[3].Data, Operand);
+ return *this;
+ }
+
+ GLM_FUNC_QUALIFIER fmat4x4SIMD & fmat4x4SIMD::operator*=
+ (
+ float const & s
+ )
+ {
+ __m128 Operand = _mm_set_ps1(s);
+ this->Data[0].Data = _mm_mul_ps(this->Data[0].Data, Operand);
+ this->Data[1].Data = _mm_mul_ps(this->Data[1].Data, Operand);
+ this->Data[2].Data = _mm_mul_ps(this->Data[2].Data, Operand);
+ this->Data[3].Data = _mm_mul_ps(this->Data[3].Data, Operand);
+ return *this;
+ }
+
+ GLM_FUNC_QUALIFIER fmat4x4SIMD & fmat4x4SIMD::operator/=
+ (
+ float const & s
+ )
+ {
+ __m128 Operand = _mm_div_ps(one, _mm_set_ps1(s));
+ this->Data[0].Data = _mm_mul_ps(this->Data[0].Data, Operand);
+ this->Data[1].Data = _mm_mul_ps(this->Data[1].Data, Operand);
+ this->Data[2].Data = _mm_mul_ps(this->Data[2].Data, Operand);
+ this->Data[3].Data = _mm_mul_ps(this->Data[3].Data, Operand);
+ return *this;
+ }
+
+ GLM_FUNC_QUALIFIER fmat4x4SIMD & fmat4x4SIMD::operator++ ()
+ {
+ this->Data[0].Data = _mm_add_ps(this->Data[0].Data, one);
+ this->Data[1].Data = _mm_add_ps(this->Data[1].Data, one);
+ this->Data[2].Data = _mm_add_ps(this->Data[2].Data, one);
+ this->Data[3].Data = _mm_add_ps(this->Data[3].Data, one);
+ return *this;
+ }
+
+ GLM_FUNC_QUALIFIER fmat4x4SIMD & fmat4x4SIMD::operator-- ()
+ {
+ this->Data[0].Data = _mm_sub_ps(this->Data[0].Data, one);
+ this->Data[1].Data = _mm_sub_ps(this->Data[1].Data, one);
+ this->Data[2].Data = _mm_sub_ps(this->Data[2].Data, one);
+ this->Data[3].Data = _mm_sub_ps(this->Data[3].Data, one);
+ return *this;
+ }
+
+}//namespace detail
+
+namespace gtx{
+namespace simd_mat4
+{
+ GLM_FUNC_QUALIFIER detail::tmat4x4<float> mat4_cast
+ (
+ detail::fmat4x4SIMD const & x
+ )
+ {
+ GLM_ALIGN(16) detail::tmat4x4<float> Result;
+ _mm_store_ps(&Result[0][0], x.Data[0].Data);
+ _mm_store_ps(&Result[1][0], x.Data[1].Data);
+ _mm_store_ps(&Result[2][0], x.Data[2].Data);
+ _mm_store_ps(&Result[3][0], x.Data[3].Data);
+ return Result;
+ }
+
+ GLM_FUNC_QUALIFIER detail::fmat4x4SIMD matrixCompMult
+ (
+ detail::fmat4x4SIMD const & x,
+ detail::fmat4x4SIMD const & y
+ )
+ {
+ detail::fmat4x4SIMD result;
+ result[0] = x[0] * y[0];
+ result[1] = x[1] * y[1];
+ result[2] = x[2] * y[2];
+ result[3] = x[3] * y[3];
+ return result;
+ }
+
+ GLM_FUNC_QUALIFIER detail::fmat4x4SIMD outerProduct
+ (
+ detail::fvec4SIMD const & c,
+ detail::fvec4SIMD const & r
+ )
+ {
+ __m128 Shu0 = _mm_shuffle_ps(r.Data, r.Data, _MM_SHUFFLE(0, 0, 0, 0));
+ __m128 Shu1 = _mm_shuffle_ps(r.Data, r.Data, _MM_SHUFFLE(1, 1, 1, 1));
+ __m128 Shu2 = _mm_shuffle_ps(r.Data, r.Data, _MM_SHUFFLE(2, 2, 2, 2));
+ __m128 Shu3 = _mm_shuffle_ps(r.Data, r.Data, _MM_SHUFFLE(3, 3, 3, 3));
+
+ detail::fmat4x4SIMD result(detail::fmat4x4SIMD::null);
+ result[0].Data = _mm_mul_ps(c.Data, Shu0);
+ result[1].Data = _mm_mul_ps(c.Data, Shu1);
+ result[2].Data = _mm_mul_ps(c.Data, Shu2);
+ result[3].Data = _mm_mul_ps(c.Data, Shu3);
+ return result;
+ }
+
+ GLM_FUNC_QUALIFIER detail::fmat4x4SIMD transpose(detail::fmat4x4SIMD const & m)
+ {
+ detail::fmat4x4SIMD result;
+ detail::sse_transpose_ps(&m[0].Data, &result[0].Data);
+ return result;
+ }
+
+ GLM_FUNC_QUALIFIER float determinant(detail::fmat4x4SIMD const & m)
+ {
+ float Result;
+ _mm_store_ss(&Result, detail::sse_det_ps(&m[0].Data));
+ return Result;
+ }
+
+ GLM_FUNC_QUALIFIER detail::fmat4x4SIMD inverse(detail::fmat4x4SIMD const & m)
+ {
+ detail::fmat4x4SIMD result;
+ detail::sse_inverse_ps(&m[0].Data, &result[0].Data);
+ return result;
+ }
+}//namespace simd_mat4
+}//namespace gtx
+
+}//namespace glm
diff --git a/src/glm/gtx/simd_vec4.hpp b/src/glm/gtx/simd_vec4.hpp
new file mode 100644
index 0000000..f801437
--- /dev/null
+++ b/src/glm/gtx/simd_vec4.hpp
@@ -0,0 +1,474 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2009-05-07
+// Updated : 2009-05-07
+// Licence : This source is under MIT License
+// File : glm/gtx/simd_vec4.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+// - intrinsic
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_gtx_simd_vec4
+#define glm_gtx_simd_vec4
+
+// Dependency:
+#include "../glm.hpp"
+
+#if(GLM_ARCH & GLM_ARCH_SSE2)
+# include "../core/intrinsic_common.hpp"
+# include "../core/intrinsic_geometric.hpp"
+#else
+# error "GLM: GLM_GTX_simd_vec4 requires compiler support of SSE2 through intrinsics"
+#endif
+
+#if(defined(GLM_MESSAGES) && !defined(glm_ext))
+# pragma message("GLM: GLM_GTX_simd_vec4 extension included")
+#endif
+
+namespace glm{
+namespace detail
+{
+ /// 4-dimensional vector implemented using SIMD SEE intrinsics.
+ /// \ingroup gtx_simd_vec4
+ GLM_ALIGNED_STRUCT(16) fvec4SIMD
+ {
+ enum ctor{null};
+ typedef __m128 value_type;
+ typedef std::size_t size_type;
+ static size_type value_size();
+
+ typedef fvec4SIMD type;
+ typedef tvec4<bool> bool_type;
+
+ __m128 Data;
+
+ //////////////////////////////////////
+ // Implicit basic constructors
+
+ fvec4SIMD();
+ fvec4SIMD(__m128 const & Data);
+ fvec4SIMD(fvec4SIMD const & v);
+
+ //////////////////////////////////////
+ // Explicit basic constructors
+
+ explicit fvec4SIMD(
+ ctor);
+ explicit fvec4SIMD(
+ float const & s);
+ explicit fvec4SIMD(
+ float const & x,
+ float const & y,
+ float const & z,
+ float const & w);
+ explicit fvec4SIMD(
+ tvec4<float> const & v);
+
+ ////////////////////////////////////////
+ //// Convertion vector constructors
+
+ fvec4SIMD(vec2 const & v, float const & s1, float const & s2);
+ fvec4SIMD(float const & s1, vec2 const & v, float const & s2);
+ fvec4SIMD(float const & s1, float const & s2, vec2 const & v);
+ fvec4SIMD(vec3 const & v, float const & s);
+ fvec4SIMD(float const & s, vec3 const & v);
+ fvec4SIMD(vec2 const & v1, vec2 const & v2);
+ //fvec4SIMD(ivec4SIMD const & v);
+
+ //////////////////////////////////////
+ // Unary arithmetic operators
+
+ fvec4SIMD& operator= (fvec4SIMD const & v);
+ fvec4SIMD& operator+=(fvec4SIMD const & v);
+ fvec4SIMD& operator-=(fvec4SIMD const & v);
+ fvec4SIMD& operator*=(fvec4SIMD const & v);
+ fvec4SIMD& operator/=(fvec4SIMD const & v);
+
+ fvec4SIMD& operator+=(float const & s);
+ fvec4SIMD& operator-=(float const & s);
+ fvec4SIMD& operator*=(float const & s);
+ fvec4SIMD& operator/=(float const & s);
+
+ fvec4SIMD& operator++();
+ fvec4SIMD& operator--();
+
+ //////////////////////////////////////
+ // Swizzle operators
+
+ template <comp X, comp Y, comp Z, comp W>
+ fvec4SIMD& swizzle();
+ template <comp X, comp Y, comp Z, comp W>
+ fvec4SIMD swizzle() const;
+ template <comp X, comp Y, comp Z>
+ fvec4SIMD swizzle() const;
+ template <comp X, comp Y>
+ fvec4SIMD swizzle() const;
+ template <comp X>
+ fvec4SIMD swizzle() const;
+ };
+}//namespace detail
+
+namespace gtx{
+namespace simd_vec4 ///< GLM_GTX_simd_vec4 extension: SIMD implementation of vec4 type.
+{
+ typedef glm::detail::fvec4SIMD simdVec4;
+
+ /// \addtogroup gtx_simd_vec4
+ ///@{
+
+ //! Convert a simdVec4 to a vec4.
+ //! (From GLM_GTX_simd_vec4 extension)
+ detail::tvec4<float> vec4_cast(
+ detail::fvec4SIMD const & x);
+
+ //! Returns x if x >= 0; otherwise, it returns -x.
+ //! (From GLM_GTX_simd_vec4 extension, common function)
+ detail::fvec4SIMD abs(detail::fvec4SIMD const & x);
+
+ //! Returns 1.0 if x > 0, 0.0 if x = 0, or -1.0 if x < 0.
+ //! (From GLM_GTX_simd_vec4 extension, common function)
+ detail::fvec4SIMD sign(detail::fvec4SIMD const & x);
+
+ //! Returns a value equal to the nearest integer that is less then or equal to x.
+ //! (From GLM_GTX_simd_vec4 extension, common function)
+ detail::fvec4SIMD floor(detail::fvec4SIMD const & x);
+
+ //! Returns a value equal to the nearest integer to x
+ //! whose absolute value is not larger than the absolute value of x.
+ //! (From GLM_GTX_simd_vec4 extension, common function)
+ detail::fvec4SIMD trunc(detail::fvec4SIMD 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.
+ //! (From GLM_GTX_simd_vec4 extension, common function)
+ detail::fvec4SIMD round(detail::fvec4SIMD 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.)
+ //! (From GLM_GTX_simd_vec4 extension, common function)
+ //detail::fvec4SIMD roundEven(detail::fvec4SIMD const & x);
+
+ //! Returns a value equal to the nearest integer
+ //! that is greater than or equal to x.
+ //! (From GLM_GTX_simd_vec4 extension, common function)
+ detail::fvec4SIMD ceil(detail::fvec4SIMD const & x);
+
+ //! Return x - floor(x).
+ //! (From GLM_GTX_simd_vec4 extension, common function)
+ detail::fvec4SIMD fract(detail::fvec4SIMD const & x);
+
+ //! Modulus. Returns x - y * floor(x / y)
+ //! for each component in x using the floating point value y.
+ //! (From GLM_GTX_simd_vec4 extension, common function)
+ detail::fvec4SIMD mod(
+ detail::fvec4SIMD const & x,
+ detail::fvec4SIMD const & y);
+
+ //! Modulus. Returns x - y * floor(x / y)
+ //! for each component in x using the floating point value y.
+ //! (From GLM_GTX_simd_vec4 extension, common function)
+ detail::fvec4SIMD mod(
+ detail::fvec4SIMD const & x,
+ float 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.
+ //! (From GLM_GTX_simd_vec4 extension, common function)
+ //detail::fvec4SIMD modf(
+ // detail::fvec4SIMD const & x,
+ // detail::fvec4SIMD & i);
+
+ //! Returns y if y < x; otherwise, it returns x.
+ //! (From GLM_GTX_simd_vec4 extension, common function)
+ detail::fvec4SIMD min(
+ detail::fvec4SIMD const & x,
+ detail::fvec4SIMD const & y);
+
+ detail::fvec4SIMD min(
+ detail::fvec4SIMD const & x,
+ float const & y);
+
+ //! Returns y if x < y; otherwise, it returns x.
+ //! (From GLM_GTX_simd_vec4 extension, common function)
+ detail::fvec4SIMD max(
+ detail::fvec4SIMD const & x,
+ detail::fvec4SIMD const & y);
+
+ detail::fvec4SIMD max(
+ detail::fvec4SIMD const & x,
+ float const & y);
+
+ //! Returns min(max(x, minVal), maxVal) for each component in x
+ //! using the floating-point values minVal and maxVal.
+ //! (From GLM_GTX_simd_vec4 extension, common function)
+ detail::fvec4SIMD clamp(
+ detail::fvec4SIMD const & x,
+ detail::fvec4SIMD const & minVal,
+ detail::fvec4SIMD const & maxVal);
+
+ detail::fvec4SIMD clamp(
+ detail::fvec4SIMD const & x,
+ float const & minVal,
+ float 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.
+ //!
+ //! From 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.
+ //! (From GLM_GTX_simd_vec4 extension, common function)
+ detail::fvec4SIMD mix(
+ detail::fvec4SIMD const & x,
+ detail::fvec4SIMD const & y,
+ detail::fvec4SIMD const & a);
+
+ //! Returns 0.0 if x < edge, otherwise it returns 1.0.
+ //! (From GLM_GTX_simd_vec4 extension, common function)
+ detail::fvec4SIMD step(
+ detail::fvec4SIMD const & edge,
+ detail::fvec4SIMD const & x);
+
+ detail::fvec4SIMD step(
+ float const & edge,
+ detail::fvec4SIMD 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.
+ //! (From GLM_GTX_simd_vec4 extension, common function)
+ detail::fvec4SIMD smoothstep(
+ detail::fvec4SIMD const & edge0,
+ detail::fvec4SIMD const & edge1,
+ detail::fvec4SIMD const & x);
+
+ detail::fvec4SIMD smoothstep(
+ float const & edge0,
+ float const & edge1,
+ detail::fvec4SIMD 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.
+ //! (From GLM_GTX_simd_vec4 extension, common function)
+ //bvec4 isnan(detail::fvec4SIMD 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.
+ //! (From GLM_GTX_simd_vec4 extension, common function)
+ //bvec4 isinf(detail::fvec4SIMD const & x);
+
+ //! Returns a signed or unsigned integer value representing
+ //! the encoding of a floating-point value. The floatingpoint
+ //! value's bit-level representation is preserved.
+ //! (From GLM_GTX_simd_vec4 extension, common function)
+ //detail::ivec4SIMD floatBitsToInt(detail::fvec4SIMD const & value);
+
+ //! Returns a floating-point value corresponding to a signed
+ //! or 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.
+ //! (From GLM_GTX_simd_vec4 extension, common function)
+ //detail::fvec4SIMD intBitsToFloat(detail::ivec4SIMD const & value);
+
+ //! Computes and returns a * b + c.
+ //! (From GLM_GTX_simd_vec4 extension, common function)
+ detail::fvec4SIMD fma(
+ detail::fvec4SIMD const & a,
+ detail::fvec4SIMD const & b,
+ detail::fvec4SIMD 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.
+ //! (From GLM_GTX_simd_vec4 extension, common function)
+ //detail::fvec4SIMD frexp(detail::fvec4SIMD const & x, detail::ivec4SIMD & 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.
+ //! (From GLM_GTX_simd_vec4 extension, common function)
+ //detail::fvec4SIMD ldexp(detail::fvec4SIMD const & x, detail::ivec4SIMD const & exp);
+
+ //! Returns the length of x, i.e., sqrt(x * x).
+ //! (From GLM_GTX_simd_vec4 extension, geometry functions)
+ float length(
+ detail::fvec4SIMD const & x);
+
+ //! Returns the length of x, i.e., sqrt(x * x).
+ //! Less accurate but much faster than simdLength.
+ //! (From GLM_GTX_simd_vec4 extension, geometry functions)
+ float fastLength(
+ detail::fvec4SIMD const & x);
+
+ //! Returns the length of x, i.e., sqrt(x * x).
+ //! Slightly more accurate but much slower than simdLength.
+ //! (From GLM_GTX_simd_vec4 extension, geometry functions)
+ float niceLength(
+ detail::fvec4SIMD const & x);
+
+ //! Returns the length of x, i.e., sqrt(x * x).
+ //! (From GLM_GTX_simd_vec4 extension, geometry functions)
+ detail::fvec4SIMD length4(
+ detail::fvec4SIMD const & x);
+
+ //! Returns the length of x, i.e., sqrt(x * x).
+ //! Less accurate but much faster than simdLength4.
+ //! (From GLM_GTX_simd_vec4 extension, geometry functions)
+ detail::fvec4SIMD fastLength4(
+ detail::fvec4SIMD const & x);
+
+ //! Returns the length of x, i.e., sqrt(x * x).
+ //! Slightly more accurate but much slower than simdLength4.
+ //! (From GLM_GTX_simd_vec4 extension, geometry functions)
+ detail::fvec4SIMD niceLength4(
+ detail::fvec4SIMD const & x);
+
+ //! Returns the distance betwwen p0 and p1, i.e., length(p0 - p1).
+ //! (From GLM_GTX_simd_vec4 extension, geometry functions)
+ float distance(
+ detail::fvec4SIMD const & p0,
+ detail::fvec4SIMD const & p1);
+
+ //! Returns the distance betwwen p0 and p1, i.e., length(p0 - p1).
+ //! (From GLM_GTX_simd_vec4 extension, geometry functions)
+ detail::fvec4SIMD distance4(
+ detail::fvec4SIMD const & p0,
+ detail::fvec4SIMD const & p1);
+
+ //! Returns the dot product of x and y, i.e., result = x * y.
+ //! (From GLM_GTX_simd_vec4 extension, geometry functions)
+ float simdDot(
+ detail::fvec4SIMD const & x,
+ detail::fvec4SIMD const & y);
+
+ //! Returns the dot product of x and y, i.e., result = x * y.
+ //! (From GLM_GTX_simd_vec4 extension, geometry functions)
+ detail::fvec4SIMD dot4(
+ detail::fvec4SIMD const & x,
+ detail::fvec4SIMD const & y);
+
+ //! Returns the cross product of x and y.
+ //! (From GLM_GTX_simd_vec4 extension, geometry functions)
+ detail::fvec4SIMD cross(
+ detail::fvec4SIMD const & x,
+ detail::fvec4SIMD const & y);
+
+ //! Returns a vector in the same direction as x but with length of 1.
+ //! (From GLM_GTX_simd_vec4 extension, geometry functions)
+ detail::fvec4SIMD normalize(
+ detail::fvec4SIMD const & x);
+
+ //! Returns a vector in the same direction as x but with length of 1.
+ //! Less accurate but much faster than simdNormalize.
+ //! (From GLM_GTX_simd_vec4 extension, geometry functions)
+ detail::fvec4SIMD fastNormalize(
+ detail::fvec4SIMD const & x);
+
+ //! If dot(Nref, I) < 0.0, return N, otherwise, return -N.
+ //! (From GLM_GTX_simd_vec4 extension, geometry functions)
+ detail::fvec4SIMD simdFaceforward(
+ detail::fvec4SIMD const & N,
+ detail::fvec4SIMD const & I,
+ detail::fvec4SIMD const & Nref);
+
+ //! For the incident vector I and surface orientation N,
+ //! returns the reflection direction : result = I - 2.0 * dot(N, I) * N.
+ //! (From GLM_GTX_simd_vec4 extension, geometry functions)
+ detail::fvec4SIMD reflect(
+ detail::fvec4SIMD const & I,
+ detail::fvec4SIMD const & N);
+
+ //! For the incident vector I and surface normal N,
+ //! and the ratio of indices of refraction eta,
+ //! return the refraction vector.
+ //! (From GLM_GTX_simd_vec4 extension, geometry functions)
+ detail::fvec4SIMD refract(
+ detail::fvec4SIMD const & I,
+ detail::fvec4SIMD const & N,
+ float const & eta);
+
+ //! Returns the positive square root of x.
+ //! (From GLM_GTX_simd_vec4 extension, exponential function)
+ detail::fvec4SIMD sqrt(
+ detail::fvec4SIMD const & x);
+
+ //! Returns the positive square root of x with the nicest quality but very slow.
+ //! Slightly more accurate but much slower than simdSqrt.
+ //! (From GLM_GTX_simd_vec4 extension, exponential function)
+ detail::fvec4SIMD niceSqrt(
+ detail::fvec4SIMD const & x);
+
+ //! Returns the positive square root of x
+ //! Less accurate but much faster than sqrt.
+ //! (From GLM_GTX_simd_vec4 extension, exponential function)
+ detail::fvec4SIMD fastSqrt(
+ detail::fvec4SIMD const & x);
+
+ //! Returns the reciprocal of the positive square root of x.
+ //! (From GLM_GTX_simd_vec4 extension, exponential function)
+ detail::fvec4SIMD inversesqrt(
+ detail::fvec4SIMD const & x);
+
+ //! Returns the reciprocal of the positive square root of x.
+ //! Faster than inversesqrt but less accurate.
+ //! (From GLM_GTX_simd_vec4 extension, exponential function)
+ detail::fvec4SIMD fastInversesqrt(
+ detail::fvec4SIMD const & x);
+
+ /// @}
+}//namespace simd_vec4
+}//namespace gtx
+}//namespace glm
+
+#include "simd_vec4.inl"
+
+namespace glm{using namespace gtx::simd_vec4;}
+
+#endif//glm_gtx_simd_vec4
diff --git a/src/glm/gtx/simd_vec4.inl b/src/glm/gtx/simd_vec4.inl
new file mode 100644
index 0000000..2f8397f
--- /dev/null
+++ b/src/glm/gtx/simd_vec4.inl
@@ -0,0 +1,730 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2009-05-07
+// Updated : 2009-05-07
+// Licence : This source is under MIT License
+// File : glm/gtx/simd_vec4.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm
+{
+ namespace detail
+ {
+ template <int Value>
+ struct mask
+ {
+ enum{value = Value};
+ };
+
+ //////////////////////////////////////
+ // Implicit basic constructors
+
+ GLM_FUNC_QUALIFIER fvec4SIMD::fvec4SIMD()
+ {}
+
+ GLM_FUNC_QUALIFIER fvec4SIMD::fvec4SIMD(__m128 const & Data) :
+ Data(Data)
+ {}
+
+ GLM_FUNC_QUALIFIER fvec4SIMD::fvec4SIMD(fvec4SIMD const & v) :
+ Data(v.Data)
+ {}
+
+ GLM_FUNC_QUALIFIER fvec4SIMD::fvec4SIMD(tvec4<float> const & v) :
+ Data(_mm_set_ps(v.w, v.z, v.y, v.x))
+ {}
+
+ //////////////////////////////////////
+ // Explicit basic constructors
+
+ GLM_FUNC_QUALIFIER fvec4SIMD::fvec4SIMD(float const & s) :
+ Data(_mm_set1_ps(s))
+ {}
+
+ GLM_FUNC_QUALIFIER fvec4SIMD::fvec4SIMD(float const & x, float const & y, float const & z, float const & w) :
+ // Data(_mm_setr_ps(x, y, z, w))
+ Data(_mm_set_ps(w, z, y, x))
+ {}
+/*
+ GLM_FUNC_QUALIFIER fvec4SIMD::fvec4SIMD(float const v[4]) :
+ Data(_mm_load_ps(v))
+ {}
+*/
+ //////////////////////////////////////
+ // Swizzle constructors
+
+ //fvec4SIMD(ref4<float> const & r);
+
+ //////////////////////////////////////
+ // Convertion vector constructors
+
+ GLM_FUNC_QUALIFIER fvec4SIMD::fvec4SIMD(vec2 const & v, float const & s1, float const & s2) :
+ Data(_mm_set_ps(s2, s1, v.y, v.x))
+ {}
+
+ GLM_FUNC_QUALIFIER fvec4SIMD::fvec4SIMD(float const & s1, vec2 const & v, float const & s2) :
+ Data(_mm_set_ps(s2, v.y, v.x, s1))
+ {}
+
+ GLM_FUNC_QUALIFIER fvec4SIMD::fvec4SIMD(float const & s1, float const & s2, vec2 const & v) :
+ Data(_mm_set_ps(v.y, v.x, s2, s1))
+ {}
+
+ GLM_FUNC_QUALIFIER fvec4SIMD::fvec4SIMD(vec3 const & v, float const & s) :
+ Data(_mm_set_ps(s, v.z, v.y, v.x))
+ {}
+
+ GLM_FUNC_QUALIFIER fvec4SIMD::fvec4SIMD(float const & s, vec3 const & v) :
+ Data(_mm_set_ps(v.z, v.y, v.x, s))
+ {}
+
+ GLM_FUNC_QUALIFIER fvec4SIMD::fvec4SIMD(vec2 const & v1, vec2 const & v2) :
+ Data(_mm_set_ps(v2.y, v2.x, v1.y, v1.x))
+ {}
+
+ //GLM_FUNC_QUALIFIER fvec4SIMD::fvec4SIMD(ivec4SIMD const & v) :
+ // Data(_mm_cvtepi32_ps(v.Data))
+ //{}
+
+ //////////////////////////////////////
+ // Unary arithmetic operators
+
+ GLM_FUNC_QUALIFIER fvec4SIMD& fvec4SIMD::operator=(fvec4SIMD const & v)
+ {
+ this->Data = v.Data;
+ return *this;
+ }
+
+ GLM_FUNC_QUALIFIER fvec4SIMD& fvec4SIMD::operator+=(float const & s)
+ {
+ this->Data = _mm_add_ps(Data, _mm_set_ps1(s));
+ return *this;
+ }
+
+ GLM_FUNC_QUALIFIER fvec4SIMD& fvec4SIMD::operator+=(fvec4SIMD const & v)
+ {
+ this->Data = _mm_add_ps(this->Data , v.Data);
+ return *this;
+ }
+
+ GLM_FUNC_QUALIFIER fvec4SIMD& fvec4SIMD::operator-=(float const & s)
+ {
+ this->Data = _mm_sub_ps(Data, _mm_set_ps1(s));
+ return *this;
+ }
+
+ GLM_FUNC_QUALIFIER fvec4SIMD& fvec4SIMD::operator-=(fvec4SIMD const & v)
+ {
+ this->Data = _mm_sub_ps(this->Data , v.Data);
+ return *this;
+ }
+
+ GLM_FUNC_QUALIFIER fvec4SIMD& fvec4SIMD::operator*=(float const & s)
+ {
+ this->Data = _mm_mul_ps(this->Data, _mm_set_ps1(s));
+ return *this;
+ }
+
+ GLM_FUNC_QUALIFIER fvec4SIMD& fvec4SIMD::operator*=(fvec4SIMD const & v)
+ {
+ this->Data = _mm_mul_ps(this->Data , v.Data);
+ return *this;
+ }
+
+ GLM_FUNC_QUALIFIER fvec4SIMD& fvec4SIMD::operator/=(float const & s)
+ {
+ this->Data = _mm_div_ps(Data, _mm_set1_ps(s));
+ return *this;
+ }
+
+ GLM_FUNC_QUALIFIER fvec4SIMD& fvec4SIMD::operator/=(fvec4SIMD const & v)
+ {
+ this->Data = _mm_div_ps(this->Data , v.Data);
+ return *this;
+ }
+
+ GLM_FUNC_QUALIFIER fvec4SIMD& fvec4SIMD::operator++()
+ {
+ this->Data = _mm_add_ps(this->Data , glm::detail::one);
+ return *this;
+ }
+
+ GLM_FUNC_QUALIFIER fvec4SIMD& fvec4SIMD::operator--()
+ {
+ this->Data = _mm_sub_ps(this->Data, glm::detail::one);
+ return *this;
+ }
+
+ //////////////////////////////////////
+ // Swizzle operators
+
+ template <comp X, comp Y, comp Z, comp W>
+ GLM_FUNC_QUALIFIER fvec4SIMD fvec4SIMD::swizzle() const
+ {
+ __m128 Data = _mm_shuffle_ps(
+ this->Data, this->Data,
+ mask<(W << 6) | (Z << 4) | (Y << 2) | (X << 0)>::value);
+ return fvec4SIMD(Data);
+ }
+
+ template <comp X, comp Y, comp Z, comp W>
+ GLM_FUNC_QUALIFIER fvec4SIMD& fvec4SIMD::swizzle()
+ {
+ this->Data = _mm_shuffle_ps(
+ this->Data, this->Data,
+ mask<(W << 6) | (Z << 4) | (Y << 2) | (X << 0)>::value);
+ return *this;
+ }
+
+ // operator+
+ GLM_FUNC_QUALIFIER fvec4SIMD operator+ (fvec4SIMD const & v, float s)
+ {
+ return fvec4SIMD(_mm_add_ps(v.Data, _mm_set1_ps(s)));
+ }
+
+ GLM_FUNC_QUALIFIER fvec4SIMD operator+ (float s, fvec4SIMD const & v)
+ {
+ return fvec4SIMD(_mm_add_ps(_mm_set1_ps(s), v.Data));
+ }
+
+ GLM_FUNC_QUALIFIER fvec4SIMD operator+ (fvec4SIMD const & v1, fvec4SIMD const & v2)
+ {
+ return fvec4SIMD(_mm_add_ps(v1.Data, v2.Data));
+ }
+
+ //operator-
+ GLM_FUNC_QUALIFIER fvec4SIMD operator- (fvec4SIMD const & v, float s)
+ {
+ return fvec4SIMD(_mm_sub_ps(v.Data, _mm_set1_ps(s)));
+ }
+
+ GLM_FUNC_QUALIFIER fvec4SIMD operator- (float s, fvec4SIMD const & v)
+ {
+ return fvec4SIMD(_mm_sub_ps(_mm_set1_ps(s), v.Data));
+ }
+
+ GLM_FUNC_QUALIFIER fvec4SIMD operator- (fvec4SIMD const & v1, fvec4SIMD const & v2)
+ {
+ return fvec4SIMD(_mm_sub_ps(v1.Data, v2.Data));
+ }
+
+ //operator*
+ GLM_FUNC_QUALIFIER fvec4SIMD operator* (fvec4SIMD const & v, float s)
+ {
+ __m128 par0 = v.Data;
+ __m128 par1 = _mm_set1_ps(s);
+ return fvec4SIMD(_mm_mul_ps(par0, par1));
+ }
+
+ GLM_FUNC_QUALIFIER fvec4SIMD operator* (float s, fvec4SIMD const & v)
+ {
+ __m128 par0 = _mm_set1_ps(s);
+ __m128 par1 = v.Data;
+ return fvec4SIMD(_mm_mul_ps(par0, par1));
+ }
+
+ GLM_FUNC_QUALIFIER fvec4SIMD operator* (fvec4SIMD const & v1, fvec4SIMD const & v2)
+ {
+ return fvec4SIMD(_mm_mul_ps(v1.Data, v2.Data));
+ }
+
+ //operator/
+ GLM_FUNC_QUALIFIER fvec4SIMD operator/ (fvec4SIMD const & v, float s)
+ {
+ __m128 par0 = v.Data;
+ __m128 par1 = _mm_set1_ps(s);
+ return fvec4SIMD(_mm_div_ps(par0, par1));
+ }
+
+ GLM_FUNC_QUALIFIER fvec4SIMD operator/ (float s, fvec4SIMD const & v)
+ {
+ __m128 par0 = _mm_set1_ps(s);
+ __m128 par1 = v.Data;
+ return fvec4SIMD(_mm_div_ps(par0, par1));
+ }
+
+ GLM_FUNC_QUALIFIER fvec4SIMD operator/ (fvec4SIMD const & v1, fvec4SIMD const & v2)
+ {
+ return fvec4SIMD(_mm_div_ps(v1.Data, v2.Data));
+ }
+
+ // Unary constant operators
+ GLM_FUNC_QUALIFIER fvec4SIMD operator- (fvec4SIMD const & v)
+ {
+ return fvec4SIMD(_mm_sub_ps(_mm_setzero_ps(), v.Data));
+ }
+
+ GLM_FUNC_QUALIFIER fvec4SIMD operator++ (fvec4SIMD const & v, int)
+ {
+ return fvec4SIMD(_mm_add_ps(v.Data, glm::detail::one));
+ }
+
+ GLM_FUNC_QUALIFIER fvec4SIMD operator-- (fvec4SIMD const & v, int)
+ {
+ return fvec4SIMD(_mm_sub_ps(v.Data, glm::detail::one));
+ }
+
+ }//namespace detail
+
+ namespace gtx{
+ namespace simd_vec4
+ {
+ GLM_FUNC_QUALIFIER detail::tvec4<float> vec4_cast
+ (
+ detail::fvec4SIMD const & x
+ )
+ {
+ GLM_ALIGN(16) detail::tvec4<float> Result;
+ _mm_store_ps(&Result[0], x.Data);
+ return Result;
+ }
+
+ // Other possible implementation
+ //float abs(float a)
+ //{
+ // return max(-a, a);
+ //}
+ GLM_FUNC_QUALIFIER detail::fvec4SIMD abs
+ (
+ detail::fvec4SIMD const & x
+ )
+ {
+ return detail::sse_abs_ps(x.Data);
+ }
+
+ GLM_FUNC_QUALIFIER detail::fvec4SIMD sign
+ (
+ detail::fvec4SIMD const & x
+ )
+ {
+ return detail::sse_sgn_ps(x.Data);
+ }
+
+ GLM_FUNC_QUALIFIER detail::fvec4SIMD floor
+ (
+ detail::fvec4SIMD const & x
+ )
+ {
+ return detail::sse_flr_ps(x.Data);
+ }
+
+ GLM_FUNC_QUALIFIER detail::fvec4SIMD trunc
+ (
+ detail::fvec4SIMD const & x
+ )
+ {
+ //return x < 0 ? -floor(-x) : floor(x);
+
+ __m128 Flr0 = detail::sse_flr_ps(_mm_sub_ps(_mm_setzero_ps(), x.Data));
+ __m128 Sub0 = _mm_sub_ps(Flr0, x.Data);
+ __m128 Flr1 = detail::sse_flr_ps(x.Data);
+
+ __m128 Cmp0 = _mm_cmplt_ps(x.Data, glm::detail::zero);
+ __m128 Cmp1 = _mm_cmpnlt_ps(x.Data, glm::detail::zero);
+
+ __m128 And0 = _mm_and_ps(Sub0, Cmp0);
+ __m128 And1 = _mm_and_ps(Flr1, Cmp1);
+
+ return _mm_or_ps(And0, And1);
+ }
+
+ GLM_FUNC_QUALIFIER detail::fvec4SIMD round
+ (
+ detail::fvec4SIMD const & x
+ )
+ {
+ return detail::sse_rnd_ps(x.Data);
+ }
+
+ //GLM_FUNC_QUALIFIER detail::fvec4SIMD roundEven
+ //(
+ // detail::fvec4SIMD const & x
+ //)
+ //{
+
+ //}
+
+ GLM_FUNC_QUALIFIER detail::fvec4SIMD ceil
+ (
+ detail::fvec4SIMD const & x
+ )
+ {
+ return detail::sse_ceil_ps(x.Data);
+ }
+
+ GLM_FUNC_QUALIFIER detail::fvec4SIMD fract
+ (
+ detail::fvec4SIMD const & x
+ )
+ {
+ return detail::sse_frc_ps(x.Data);
+ }
+
+ GLM_FUNC_QUALIFIER detail::fvec4SIMD mod
+ (
+ detail::fvec4SIMD const & x,
+ detail::fvec4SIMD const & y
+ )
+ {
+ return detail::sse_mod_ps(x.Data, y.Data);
+ }
+
+ GLM_FUNC_QUALIFIER detail::fvec4SIMD mod
+ (
+ detail::fvec4SIMD const & x,
+ float const & y
+ )
+ {
+ return detail::sse_mod_ps(x.Data, _mm_set1_ps(y));
+ }
+
+ //GLM_FUNC_QUALIFIER detail::fvec4SIMD modf
+ //(
+ // detail::fvec4SIMD const & x,
+ // detail::fvec4SIMD & i
+ //)
+ //{
+
+ //}
+
+ GLM_FUNC_QUALIFIER detail::fvec4SIMD min
+ (
+ detail::fvec4SIMD const & x,
+ detail::fvec4SIMD const & y
+ )
+ {
+ return _mm_min_ps(x.Data, y.Data);
+ }
+
+ GLM_FUNC_QUALIFIER detail::fvec4SIMD min
+ (
+ detail::fvec4SIMD const & x,
+ float const & y
+ )
+ {
+ return _mm_min_ps(x.Data, _mm_set1_ps(y));
+ }
+
+ GLM_FUNC_QUALIFIER detail::fvec4SIMD max
+ (
+ detail::fvec4SIMD const & x,
+ detail::fvec4SIMD const & y
+ )
+ {
+ return _mm_max_ps(x.Data, y.Data);
+ }
+
+ GLM_FUNC_QUALIFIER detail::fvec4SIMD max
+ (
+ detail::fvec4SIMD const & x,
+ float const & y
+ )
+ {
+ return _mm_max_ps(x.Data, _mm_set1_ps(y));
+ }
+
+ GLM_FUNC_QUALIFIER detail::fvec4SIMD clamp
+ (
+ detail::fvec4SIMD const & x,
+ detail::fvec4SIMD const & minVal,
+ detail::fvec4SIMD const & maxVal
+ )
+ {
+ return detail::sse_clp_ps(x.Data, minVal.Data, maxVal.Data);
+ }
+
+ GLM_FUNC_QUALIFIER detail::fvec4SIMD clamp
+ (
+ detail::fvec4SIMD const & x,
+ float const & minVal,
+ float const & maxVal
+ )
+ {
+ return detail::sse_clp_ps(x.Data, _mm_set1_ps(minVal), _mm_set1_ps(maxVal));
+ }
+
+ GLM_FUNC_QUALIFIER detail::fvec4SIMD mix
+ (
+ detail::fvec4SIMD const & x,
+ detail::fvec4SIMD const & y,
+ detail::fvec4SIMD const & a
+ )
+ {
+ __m128 Sub0 = _mm_sub_ps(y.Data, x.Data);
+ __m128 Mul0 = _mm_mul_ps(a.Data, Sub0);
+ return _mm_mul_ps(x.Data, Mul0);
+ }
+
+ GLM_FUNC_QUALIFIER detail::fvec4SIMD step
+ (
+ detail::fvec4SIMD const & edge,
+ detail::fvec4SIMD const & x
+ )
+ {
+ __m128 cmp0 = _mm_cmpngt_ps(x.Data, edge.Data);
+ return _mm_max_ps(_mm_min_ps(cmp0, _mm_setzero_ps()), detail::one);
+ }
+
+ GLM_FUNC_QUALIFIER detail::fvec4SIMD step
+ (
+ float const & edge,
+ detail::fvec4SIMD const & x
+ )
+ {
+ __m128 cmp0 = _mm_cmpngt_ps(x.Data, _mm_set1_ps(edge));
+ return _mm_max_ps(_mm_min_ps(cmp0, _mm_setzero_ps()), detail::one);
+ }
+
+ GLM_FUNC_QUALIFIER detail::fvec4SIMD smoothstep
+ (
+ detail::fvec4SIMD const & edge0,
+ detail::fvec4SIMD const & edge1,
+ detail::fvec4SIMD const & x
+ )
+ {
+ return detail::sse_ssp_ps(edge0.Data, edge1.Data, x.Data);
+ }
+
+ GLM_FUNC_QUALIFIER detail::fvec4SIMD smoothstep
+ (
+ float const & edge0,
+ float const & edge1,
+ detail::fvec4SIMD const & x
+ )
+ {
+ return detail::sse_ssp_ps(_mm_set1_ps(edge0), _mm_set1_ps(edge1), x.Data);
+ }
+
+ //GLM_FUNC_QUALIFIER bvec4 isnan(detail::fvec4SIMD const & x)
+ //{
+
+ //}
+
+ //GLM_FUNC_QUALIFIER bvec4 isinf(detail::fvec4SIMD const & x)
+ //{
+
+ //}
+
+ //GLM_FUNC_QUALIFIER detail::ivec4SIMD floatBitsToInt
+ //(
+ // detail::fvec4SIMD const & value
+ //)
+ //{
+
+ //}
+
+ //GLM_FUNC_QUALIFIER detail::fvec4SIMD intBitsToFloat
+ //(
+ // detail::ivec4SIMD const & value
+ //)
+ //{
+
+ //}
+
+ GLM_FUNC_QUALIFIER detail::fvec4SIMD fma
+ (
+ detail::fvec4SIMD const & a,
+ detail::fvec4SIMD const & b,
+ detail::fvec4SIMD const & c
+ )
+ {
+ return _mm_add_ps(_mm_mul_ps(a.Data, b.Data), c.Data);
+ }
+
+ GLM_FUNC_QUALIFIER float length
+ (
+ detail::fvec4SIMD const & x
+ )
+ {
+ detail::fvec4SIMD dot0 = detail::sse_dot_ss(x.Data, x.Data);
+ detail::fvec4SIMD sqt0 = sqrt(dot0);
+ float Result = 0;
+ _mm_store_ss(&Result, sqt0.Data);
+ return Result;
+ }
+
+ GLM_FUNC_QUALIFIER float fastLength
+ (
+ detail::fvec4SIMD const & x
+ )
+ {
+ detail::fvec4SIMD dot0 = detail::sse_dot_ss(x.Data, x.Data);
+ detail::fvec4SIMD sqt0 = fastSqrt(dot0);
+ float Result = 0;
+ _mm_store_ss(&Result, sqt0.Data);
+ return Result;
+ }
+
+ GLM_FUNC_QUALIFIER float niceLength
+ (
+ detail::fvec4SIMD const & x
+ )
+ {
+ detail::fvec4SIMD dot0 = detail::sse_dot_ss(x.Data, x.Data);
+ detail::fvec4SIMD sqt0 = niceSqrt(dot0);
+ float Result = 0;
+ _mm_store_ss(&Result, sqt0.Data);
+ return Result;
+ }
+
+ GLM_FUNC_QUALIFIER detail::fvec4SIMD length4
+ (
+ detail::fvec4SIMD const & x
+ )
+ {
+ return sqrt(dot4(x, x));
+ }
+
+ GLM_FUNC_QUALIFIER detail::fvec4SIMD fastLength4
+ (
+ detail::fvec4SIMD const & x
+ )
+ {
+ return fastSqrt(dot4(x, x));
+ }
+
+ GLM_FUNC_QUALIFIER detail::fvec4SIMD niceLength4
+ (
+ detail::fvec4SIMD const & x
+ )
+ {
+ return niceSqrt(dot4(x, x));
+ }
+
+ GLM_FUNC_QUALIFIER float distance
+ (
+ detail::fvec4SIMD const & p0,
+ detail::fvec4SIMD const & p1
+ )
+ {
+ float Result = 0;
+ _mm_store_ss(&Result, detail::sse_dst_ps(p0.Data, p1.Data));
+ return Result;
+ }
+
+ GLM_FUNC_QUALIFIER detail::fvec4SIMD distance4
+ (
+ detail::fvec4SIMD const & p0,
+ detail::fvec4SIMD const & p1
+ )
+ {
+ return detail::sse_dst_ps(p0.Data, p1.Data);
+ }
+
+ GLM_FUNC_QUALIFIER float dot
+ (
+ detail::fvec4SIMD const & x,
+ detail::fvec4SIMD const & y
+ )
+ {
+ float Result = 0;
+ _mm_store_ss(&Result, detail::sse_dot_ss(x.Data, y.Data));
+ return Result;
+ }
+
+ GLM_FUNC_QUALIFIER detail::fvec4SIMD dot4
+ (
+ detail::fvec4SIMD const & x,
+ detail::fvec4SIMD const & y
+ )
+ {
+ return detail::sse_dot_ps(x.Data, y.Data);
+ }
+
+ GLM_FUNC_QUALIFIER detail::fvec4SIMD cross
+ (
+ detail::fvec4SIMD const & x,
+ detail::fvec4SIMD const & y
+ )
+ {
+ return detail::sse_xpd_ps(x.Data, y.Data);
+ }
+
+ GLM_FUNC_QUALIFIER detail::fvec4SIMD normalize
+ (
+ detail::fvec4SIMD const & x
+ )
+ {
+ __m128 dot0 = detail::sse_dot_ps(x.Data, x.Data);
+ __m128 isr0 = inversesqrt(dot0).Data;
+ __m128 mul0 = _mm_mul_ps(x.Data, isr0);
+ return mul0;
+ }
+
+ GLM_FUNC_QUALIFIER detail::fvec4SIMD fastNormalize
+ (
+ detail::fvec4SIMD const & x
+ )
+ {
+ __m128 dot0 = detail::sse_dot_ps(x.Data, x.Data);
+ __m128 isr0 = fastInversesqrt(dot0).Data;
+ __m128 mul0 = _mm_mul_ps(x.Data, isr0);
+ return mul0;
+ }
+
+ GLM_FUNC_QUALIFIER detail::fvec4SIMD faceforward
+ (
+ detail::fvec4SIMD const & N,
+ detail::fvec4SIMD const & I,
+ detail::fvec4SIMD const & Nref
+ )
+ {
+ return detail::sse_ffd_ps(N.Data, I.Data, Nref.Data);
+ }
+
+ GLM_FUNC_QUALIFIER detail::fvec4SIMD reflect
+ (
+ detail::fvec4SIMD const & I,
+ detail::fvec4SIMD const & N
+ )
+ {
+ return detail::sse_rfe_ps(I.Data, N.Data);
+ }
+
+ GLM_FUNC_QUALIFIER detail::fvec4SIMD refract
+ (
+ detail::fvec4SIMD const & I,
+ detail::fvec4SIMD const & N,
+ float const & eta
+ )
+ {
+ return detail::sse_rfa_ps(I.Data, N.Data, _mm_set1_ps(eta));
+ }
+
+ GLM_FUNC_QUALIFIER detail::fvec4SIMD sqrt(detail::fvec4SIMD const & x)
+ {
+ return _mm_mul_ps(inversesqrt(x.Data).Data, x.Data);
+ }
+
+ GLM_FUNC_QUALIFIER detail::fvec4SIMD niceSqrt(detail::fvec4SIMD const & x)
+ {
+ return _mm_sqrt_ps(x.Data);
+ }
+
+ GLM_FUNC_QUALIFIER detail::fvec4SIMD fastSqrt(detail::fvec4SIMD const & x)
+ {
+ return _mm_mul_ps(fastInversesqrt(x.Data).Data, x.Data);
+ }
+
+ // SSE scalar reciprocal sqrt using rsqrt op, plus one Newton-Rhaphson iteration
+ // By Elan Ruskin, http://assemblyrequired.crashworks.org/
+ GLM_FUNC_QUALIFIER detail::fvec4SIMD inversesqrt(detail::fvec4SIMD const & x)
+ {
+ GLM_ALIGN(4) static const __m128 three = {3, 3, 3, 3}; // aligned consts for fast load
+ GLM_ALIGN(4) static const __m128 half = {0.5,0.5,0.5,0.5};
+
+ __m128 recip = _mm_rsqrt_ps(x.Data); // "estimate" opcode
+ __m128 halfrecip = _mm_mul_ps(half, recip);
+ __m128 threeminus_xrr = _mm_sub_ps(three, _mm_mul_ps(x.Data, _mm_mul_ps(recip, recip)));
+ return _mm_mul_ps(halfrecip, threeminus_xrr);
+ }
+
+ GLM_FUNC_QUALIFIER detail::fvec4SIMD fastInversesqrt(detail::fvec4SIMD const & x)
+ {
+ return _mm_rsqrt_ps(x.Data);
+ }
+
+ }//namespace simd_vec4
+ }//namespace gtx
+}//namespace glm
diff --git a/src/glm/gtx/simplex.hpp b/src/glm/gtx/simplex.hpp
new file mode 100644
index 0000000..b05a450
--- /dev/null
+++ b/src/glm/gtx/simplex.hpp
@@ -0,0 +1,70 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2011-04-09
+// Updated : 2011-04-09
+// Licence : This source is under MIT License
+// File : glm/gtx/simplex.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_gtx_simplex
+#define glm_gtx_simplex
+
+// Dependency:
+#include "../glm.hpp"
+
+#if(defined(GLM_MESSAGES) && !defined(glm_ext))
+# pragma message("GLM: GLM_GTX_simplex extension included")
+#endif
+
+namespace glm{
+namespace gtx{
+namespace spline ///< GLM_GTX_simplex extension: Spline functions
+{
+ /// \addtogroup gtx_spline
+ ///@{
+
+ //! Return a point from a catmull rom curve.
+ //! From GLM_GTX_spline extension.
+ template <typename genType>
+ genType catmullRom(
+ genType const & v1,
+ genType const & v2,
+ genType const & v3,
+ genType const & v4,
+ typename genType::value_type const & s);
+
+ //! Return a point from a hermite curve.
+ //! From GLM_GTX_spline extension.
+ template <typename genType>
+ genType hermite(
+ genType const & v1,
+ genType const & t1,
+ genType const & v2,
+ genType const & t2,
+ typename genType::value_type const & s);
+
+ //! Return a point from a cubic curve.
+ //! From GLM_GTX_spline extension.
+ template <typename genType>
+ genType cubic(
+ genType const & v1,
+ genType const & v2,
+ genType const & v3,
+ genType const & v4,
+ typename genType::value_type const & s);
+
+ /// @}
+}// namespace simplex
+}// namespace gtx
+}// namespace glm
+
+#include "simplex.inl"
+
+namespace glm{using namespace gtx::simplex;}
+
+#endif//glm_gtx_spline
+
diff --git a/src/glm/gtx/simplex.inl b/src/glm/gtx/simplex.inl
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/glm/gtx/simplex.inl
diff --git a/src/glm/gtx/spline.hpp b/src/glm/gtx/spline.hpp
new file mode 100644
index 0000000..e6da3dc
--- /dev/null
+++ b/src/glm/gtx/spline.hpp
@@ -0,0 +1,73 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2007-01-25
+// Updated : 2009-02-19
+// Licence : This source is under MIT License
+// File : glm/gtx/spline.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_gtx_spline
+#define glm_gtx_spline
+
+// Dependency:
+#include "../glm.hpp"
+#include "../gtx/optimum_pow.hpp"
+
+#if(defined(GLM_MESSAGES) && !defined(glm_ext))
+# pragma message("GLM: GLM_GTX_spline extension included")
+#endif
+
+namespace glm{
+namespace gtx{
+namespace spline ///< GLM_GTX_spline extension: Spline functions
+{
+ using namespace gtx::optimum_pow;
+
+ /// \addtogroup gtx_spline
+ /// @{
+
+ //! Return a point from a catmull rom curve.
+ //! From GLM_GTX_spline extension.
+ template <typename genType>
+ genType catmullRom(
+ genType const & v1,
+ genType const & v2,
+ genType const & v3,
+ genType const & v4,
+ typename genType::value_type const & s);
+
+ //! Return a point from a hermite curve.
+ //! From GLM_GTX_spline extension.
+ template <typename genType>
+ genType hermite(
+ genType const & v1,
+ genType const & t1,
+ genType const & v2,
+ genType const & t2,
+ typename genType::value_type const & s);
+
+ //! Return a point from a cubic curve.
+ //! From GLM_GTX_spline extension.
+ template <typename genType>
+ genType cubic(
+ genType const & v1,
+ genType const & v2,
+ genType const & v3,
+ genType const & v4,
+ typename genType::value_type const & s);
+
+ /// @}
+}//namespace spline
+}//namespace gtx
+}//namespace glm
+
+#include "spline.inl"
+
+namespace glm{using namespace gtx::spline;}
+
+#endif//glm_gtx_spline
+
diff --git a/src/glm/gtx/spline.inl b/src/glm/gtx/spline.inl
new file mode 100644
index 0000000..c85f4ef
--- /dev/null
+++ b/src/glm/gtx/spline.inl
@@ -0,0 +1,74 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2007-01-25
+// Updated : 2009-02-19
+// Licence : This source is under MIT License
+// File : glm/gtx/spline.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm{
+namespace gtx{
+namespace spline
+{
+ template <typename genType>
+ GLM_FUNC_QUALIFIER genType catmullRom
+ (
+ genType const & v1,
+ genType const & v2,
+ genType const & v3,
+ genType const & v4,
+ typename genType::value_type const & s
+ )
+ {
+ typename genType::value_type s1 = s;
+ typename genType::value_type s2 = optimum_pow::pow2(s);
+ typename genType::value_type s3 = optimum_pow::pow3(s);
+
+ typename genType::value_type f1 = -s3 + typename genType::value_type(2) * s2 - s;
+ typename genType::value_type f2 = typename genType::value_type(3) * s3 - typename genType::value_type(5) * s2 + typename genType::value_type(2);
+ typename genType::value_type f3 = typename genType::value_type(-3) * s3 + typename genType::value_type(4) * s2 + s;
+ typename genType::value_type f4 = s3 - s2;
+
+ return (f1 * v1 + f2 * v2 + f3 * v3 + f4 * v4) / typename genType::value_type(2);
+
+ }
+
+ template <typename genType>
+ GLM_FUNC_QUALIFIER genType hermite
+ (
+ genType const & v1,
+ genType const & t1,
+ genType const & v2,
+ genType const & t2,
+ typename genType::value_type const & s
+ )
+ {
+ typename genType::value_type s1 = s;
+ typename genType::value_type s2 = optimum_pow::pow2(s);
+ typename genType::value_type s3 = optimum_pow::pow3(s);
+
+ typename genType::value_type f1 = typename genType::value_type(2) * s3 - typename genType::value_type(3) * s2 + typename genType::value_type(1);
+ typename genType::value_type f2 = typename genType::value_type(-2) * s3 + typename genType::value_type(3) * s2;
+ typename genType::value_type f3 = s3 - typename genType::value_type(2) * s2 + s;
+ typename genType::value_type f4 = s3 - s2;
+
+ return f1 * v1 + f2 * v2 + f3 * t1 + f4 * t2;
+ }
+
+ template <typename genType>
+ GLM_FUNC_QUALIFIER genType cubic
+ (
+ genType const & v1,
+ genType const & v2,
+ genType const & v3,
+ genType const & v4,
+ typename genType::value_type const & s
+ )
+ {
+ return ((v1 * s + v2) * s + v3) * s + v4;
+ }
+
+}//namespace spline
+}//namespace gtx
+}//namespace glm
diff --git a/src/glm/gtx/std_based_type.hpp b/src/glm/gtx/std_based_type.hpp
new file mode 100644
index 0000000..2d2ca31
--- /dev/null
+++ b/src/glm/gtx/std_based_type.hpp
@@ -0,0 +1,72 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2008-06-08
+// Updated : 2008-06-08
+// Licence : This source is under MIT License
+// File : glm/gtx/std_based_type.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_gtx_std_based_type
+#define glm_gtx_std_based_type
+
+// Dependency:
+#include "../glm.hpp"
+#include <cstdlib>
+
+#if(defined(GLM_MESSAGES) && !defined(glm_ext))
+# pragma message("GLM: GLM_GTX_std_based_type extension included")
+#endif
+
+namespace glm{
+namespace gtx{
+namespace std_based_type ///< GLM_GTX_std_based_type extension: Add support vector types based on C++ standard type
+{
+ typedef detail::tvec2<std::size_t> size2;
+ typedef detail::tvec3<std::size_t> size3;
+ typedef detail::tvec4<std::size_t> size4;
+
+ typedef detail::tvec2<signed char> scvec2;
+ typedef detail::tvec3<signed char> scvec3;
+ typedef detail::tvec4<signed char> scvec4;
+
+ typedef detail::tvec2<unsigned char> ucvec2;
+ typedef detail::tvec3<unsigned char> ucvec3;
+ typedef detail::tvec4<unsigned char> ucvec4;
+
+ typedef detail::tvec2<signed short> ssvec2;
+ typedef detail::tvec3<signed short> ssvec3;
+ typedef detail::tvec4<signed short> ssvec4;
+
+ typedef detail::tvec2<unsigned short> usvec2;
+ typedef detail::tvec3<unsigned short> usvec3;
+ typedef detail::tvec4<unsigned short> usvec4;
+
+ typedef detail::tvec2<signed int> sivec2;
+ typedef detail::tvec3<signed int> sivec3;
+ typedef detail::tvec4<signed int> sivec4;
+
+ typedef detail::tvec2<unsigned int> uivec2;
+ typedef detail::tvec3<unsigned int> uivec3;
+ typedef detail::tvec4<unsigned int> uivec4;
+
+ typedef detail::tvec2<signed long> slvec2;
+ typedef detail::tvec3<signed long> slvec3;
+ typedef detail::tvec4<signed long> slvec4;
+
+ typedef detail::tvec2<unsigned long> ulvec2;
+ typedef detail::tvec3<unsigned long> ulvec3;
+ typedef detail::tvec4<unsigned long> ulvec4;
+
+}//namespace std_based_type
+}//namespace gtx
+}//namespace glm
+
+#include "std_based_type.inl"
+
+namespace glm{using namespace gtx::std_based_type;}
+
+#endif//glm_gtx_std_based_type
diff --git a/src/glm/gtx/std_based_type.inl b/src/glm/gtx/std_based_type.inl
new file mode 100644
index 0000000..6562a67
--- /dev/null
+++ b/src/glm/gtx/std_based_type.inl
@@ -0,0 +1,13 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2008-06-08
+// Updated : 2008-06-08
+// Licence : This source is under MIT License
+// File : glm/gtx/std_based_type.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm
+{
+
+}
diff --git a/src/glm/gtx/string_cast.hpp b/src/glm/gtx/string_cast.hpp
new file mode 100644
index 0000000..0d93487
--- /dev/null
+++ b/src/glm/gtx/string_cast.hpp
@@ -0,0 +1,57 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2008-04-26
+// Updated : 2010-01-28
+// Licence : This source is under MIT License
+// File : glm/gtx/string_cast.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+// - GLM_GTC_half_float
+// - GLM_GTX_integer
+// - GLM_GTX_quaternion
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_gtx_string_cast
+#define glm_gtx_string_cast
+
+// Dependency:
+#include "../glm.hpp"
+#include "../gtc/half_float.hpp"
+#include "../gtx/integer.hpp"
+#include "../gtx/unsigned_int.hpp"
+#include "../gtx/quaternion.hpp"
+#include <string>
+
+#if(defined(GLM_MESSAGES) && !defined(glm_ext))
+# pragma message("GLM: GLM_GTX_string_cast extension included")
+#endif
+
+namespace glm{
+namespace gtx{
+namespace string_cast ///< GLM_GTX_string_cast extension: Setup strings for GLM type values
+{
+ using namespace gtc::half_float;
+ using namespace gtx::integer;
+ using namespace gtx::unsigned_int;
+ using namespace gtx::quaternion;
+
+ /// \addtogroup gtx_string_cast
+ /// @{
+
+ //! Create a string from a GLM type value.
+ //! From GLM_GTX_string_cast extension.
+ template <typename genType>
+ std::string to_string(genType const & x);
+
+ /// @}
+}//namespace string_cast
+}//namespace gtx
+}//namespace glm
+
+#include "string_cast.inl"
+
+namespace glm{using namespace gtx::string_cast;}
+
+#endif//glm_gtx_string_cast
diff --git a/src/glm/gtx/string_cast.inl b/src/glm/gtx/string_cast.inl
new file mode 100644
index 0000000..7881d19
--- /dev/null
+++ b/src/glm/gtx/string_cast.inl
@@ -0,0 +1,597 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2006 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2008-04-27
+// Updated : 2008-05-24
+// Licence : This source is under MIT License
+// File : glm/gtx/string_cast.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <cstdarg>
+#include <cstdio>
+
+namespace glm{
+namespace detail
+{
+ GLM_FUNC_QUALIFIER std::string format(const char* msg, ...)
+ {
+ const int STRING_BUFFER = 4096;
+ char text[STRING_BUFFER];
+ va_list list;
+
+ if(msg == 0)
+ return std::string();
+
+ va_start(list, msg);
+ vsprintf(text, msg, list);
+ va_end(list);
+
+ return std::string(text);
+ }
+
+ static const char* True = "true";
+ static const char* False = "false";
+}//namespace detail
+
+namespace gtx{
+namespace string_cast
+{
+ ////////////////////////////////
+ // Scalars
+
+ GLM_FUNC_QUALIFIER std::string to_string(detail::thalf const & x)
+ {
+ return detail::format("half(%f)", float(x));
+ }
+
+ GLM_FUNC_QUALIFIER std::string to_string(float x)
+ {
+ return detail::format("float(%f)", x);
+ }
+
+ GLM_FUNC_QUALIFIER std::string to_string(double x)
+ {
+ return detail::format("double(%f)", x);
+ }
+
+ GLM_FUNC_QUALIFIER std::string to_string(int x)
+ {
+ return detail::format("int(%d)", x);
+ }
+
+ GLM_FUNC_QUALIFIER std::string to_string(unsigned int x)
+ {
+ return detail::format("uint(%d)", x);
+ }
+
+ ////////////////////////////////
+ // Bool vectors
+
+ GLM_FUNC_QUALIFIER std::string to_string
+ (
+ detail::tvec2<bool> const & v
+ )
+ {
+ return detail::format("bvec2(%s, %s)",
+ v.x ? detail::True : detail::False,
+ v.y ? detail::True : detail::False);
+ }
+
+ GLM_FUNC_QUALIFIER std::string to_string
+ (
+ detail::tvec3<bool> const & v
+ )
+ {
+ return detail::format("bvec3(%s, %s, %s)",
+ v.x ? detail::True : detail::False,
+ v.y ? detail::True : detail::False,
+ v.z ? detail::True : detail::False);
+ }
+
+ GLM_FUNC_QUALIFIER std::string to_string
+ (
+ detail::tvec4<bool> const & v
+ )
+ {
+ return detail::format("bvec4(%s, %s, %s, %s)",
+ v.x ? detail::True : detail::False,
+ v.y ? detail::True : detail::False,
+ v.z ? detail::True : detail::False,
+ v.w ? detail::True : detail::False);
+ }
+
+ ////////////////////////////////
+ // Half vectors
+
+ template <>
+ GLM_FUNC_QUALIFIER std::string to_string
+ (
+ detail::tvec2<detail::thalf> const & v
+ )
+ {
+ return detail::format("hvec2(%f, %f)", float(v.x), float(v.y));
+ }
+
+ template <>
+ GLM_FUNC_QUALIFIER std::string to_string
+ (
+ detail::tvec3<detail::thalf> const & v
+ )
+ {
+ return detail::format("hvec3(%f, %f, %f)", float(v.x), float(v.y), float(v.z));
+ }
+
+ template <>
+ GLM_FUNC_QUALIFIER std::string to_string
+ (
+ detail::tvec4<detail::thalf> const & v
+ )
+ {
+ return detail::format("hvec4(%f, %f, %f, %f)", float(v.x), float(v.y), float(v.z), float(v.w));
+ }
+
+ ////////////////////////////////
+ // Float vectors
+
+ template <>
+ GLM_FUNC_QUALIFIER std::string to_string
+ (
+ detail::tvec2<float> const & v
+ )
+ {
+ return detail::format("fvec2(%f, %f)", v.x, v.y);
+ }
+
+ template <>
+ GLM_FUNC_QUALIFIER std::string to_string
+ (
+ detail::tvec3<float> const & v
+ )
+ {
+ return detail::format("fvec3(%f, %f, %f)", v.x, v.y, v.z);
+ }
+
+ template <>
+ GLM_FUNC_QUALIFIER std::string to_string
+ (
+ detail::tvec4<float> const & v
+ )
+ {
+ return detail::format("fvec4(%f, %f, %f, %f)", v.x, v.y, v.z, v.w);
+ }
+
+ ////////////////////////////////
+ // Double vectors
+
+ template <>
+ GLM_FUNC_QUALIFIER std::string to_string
+ (
+ detail::tvec2<double> const & v
+ )
+ {
+ return detail::format("dvec2(%f, %f)", v.x, v.y);
+ }
+
+ template <>
+ GLM_FUNC_QUALIFIER std::string to_string
+ (
+ detail::tvec3<double> const & v
+ )
+ {
+ return detail::format("dvec3(%f, %f, %f)", v.x, v.y, v.z);
+ }
+
+ template <>
+ GLM_FUNC_QUALIFIER std::string to_string
+ (
+ detail::tvec4<double> const & v
+ )
+ {
+ return detail::format("dvec4(%f, %f, %f, %f)", v.x, v.y, v.z, v.w);
+ }
+
+ ////////////////////////////////
+ // Int vectors
+
+ template <>
+ GLM_FUNC_QUALIFIER std::string to_string
+ (
+ detail::tvec2<int> const & v
+ )
+ {
+ return detail::format("ivec2(%d, %d)", v.x, v.y);
+ }
+
+ template <>
+ GLM_FUNC_QUALIFIER std::string to_string
+ (
+ detail::tvec3<int> const & v
+ )
+ {
+ return detail::format("ivec3(%d, %d, %d)", v.x, v.y, v.z);
+ }
+
+ template <>
+ GLM_FUNC_QUALIFIER std::string to_string
+ (
+ detail::tvec4<int> const & v
+ )
+ {
+ return detail::format("ivec4(%d, %d, %d, %d)", v.x, v.y, v.z, v.w);
+ }
+
+ ////////////////////////////////
+ // Unsigned int vectors
+
+ template <>
+ GLM_FUNC_QUALIFIER std::string to_string
+ (
+ detail::tvec2<unsigned int> const & v
+ )
+ {
+ return detail::format("uvec2(%d, %d)", v.x, v.y);
+ }
+
+ template <>
+ GLM_FUNC_QUALIFIER std::string to_string
+ (
+ detail::tvec3<unsigned int> const & v
+ )
+ {
+ return detail::format("uvec3(%d, %d, %d)", v.x, v.y, v.z);
+ }
+
+ template <>
+ GLM_FUNC_QUALIFIER std::string to_string
+ (
+ detail::tvec4<unsigned int> const & v
+ )
+ {
+ return detail::format("uvec4(%d, %d, %d, %d)", v.x, v.y, v.z, v.w);
+ }
+
+ ////////////////////////////////
+ // Half matrices
+
+ template <>
+ GLM_FUNC_QUALIFIER std::string to_string
+ (
+ detail::tmat2x2<detail::thalf> const & m
+ )
+ {
+ detail::tmat2x2<float> x(m);
+ return detail::format("hmat2x2((%f, %f), (%f, %f))",
+ x[0][0], x[0][1],
+ x[1][0], x[1][1]);
+ }
+
+ template <>
+ GLM_FUNC_QUALIFIER std::string to_string
+ (
+ detail::tmat2x3<detail::thalf> const & m
+ )
+ {
+ detail::tmat2x3<float> x(m);
+ return detail::format("hmat2x3((%f, %f, %f), (%f, %f, %f))",
+ x[0][0], x[0][1], x[0][2],
+ x[1][0], x[1][1], x[1][2]);
+ }
+
+ template <>
+ GLM_FUNC_QUALIFIER std::string to_string
+ (
+ detail::tmat2x4<detail::thalf> const & m
+ )
+ {
+ detail::tmat2x4<float> x(m);
+ return detail::format("hmat2x4((%f, %f, %f, %f), (%f, %f, %f, %f))",
+ x[0][0], x[0][1], x[0][2], x[0][3],
+ x[1][0], x[1][1], x[1][2], x[1][3]);
+ }
+
+ template <>
+ GLM_FUNC_QUALIFIER std::string to_string
+ (
+ detail::tmat3x2<detail::thalf> const & m
+ )
+ {
+ detail::tmat3x2<float> x(m);
+ return detail::format("hmat3x2((%f, %f), (%f, %f), (%f, %f))",
+ x[0][0], x[0][1],
+ x[1][0], x[1][1],
+ x[2][0], x[2][1]);
+ }
+
+ template <>
+ GLM_FUNC_QUALIFIER std::string to_string
+ (
+ detail::tmat3x3<detail::thalf> const & m
+ )
+ {
+ detail::tmat3x3<float> x(m);
+ return detail::format("hmat3x3((%f, %f, %f), (%f, %f, %f), (%f, %f, %f))",
+ x[0][0], x[0][1], x[0][2],
+ x[1][0], x[1][1], x[1][2],
+ x[2][0], x[2][1], x[2][2]);
+ }
+
+ template <>
+ GLM_FUNC_QUALIFIER std::string to_string
+ (
+ detail::tmat3x4<detail::thalf> const & m
+ )
+ {
+ detail::tmat3x4<float> x(m);
+ return detail::format("hmat3x4((%f, %f, %f, %f), (%f, %f, %f, %f), (%f, %f, %f, %f))",
+ x[0][0], x[0][1], x[0][2], x[0][3],
+ x[1][0], x[1][1], x[1][2], x[1][3],
+ x[2][0], x[2][1], x[2][2], x[2][3]);
+ }
+
+ template <>
+ GLM_FUNC_QUALIFIER std::string to_string
+ (
+ detail::tmat4x2<detail::thalf> const & m
+ )
+ {
+ detail::tmat4x2<float> x(m);
+ return detail::format("hmat4x2((%f, %f), (%f, %f), (%f, %f), (%f, %f))",
+ x[0][0], x[0][1],
+ x[1][0], x[1][1],
+ x[2][0], x[2][1],
+ x[3][0], x[3][1]);
+ }
+
+ template <>
+ GLM_FUNC_QUALIFIER std::string to_string
+ (
+ detail::tmat4x3<detail::thalf> const & m
+ )
+ {
+ detail::tmat4x3<float> x(m);
+ return detail::format("hmat4x3((%f, %f, %f), (%f, %f, %f), (%f, %f, %f), (%f, %f, %f))",
+ x[0][0], x[0][1], x[0][2],
+ x[1][0], x[1][1], x[1][2],
+ x[2][0], x[2][1], x[2][2],
+ x[3][0], x[3][1], x[3][2]);
+ }
+
+ template <>
+ GLM_FUNC_QUALIFIER std::string to_string
+ (
+ detail::tmat4x4<detail::thalf> const & m
+ )
+ {
+ detail::tmat4x4<float> x(m);
+ return detail::format("hmat4x4((%f, %f, %f, %f), (%f, %f, %f, %f), (%f, %f, %f, %f), (%f, %f, %f, %f))",
+ x[0][0], x[0][1], x[0][2], x[0][3],
+ x[1][0], x[1][1], x[1][2], x[1][3],
+ x[2][0], x[2][1], x[2][2], x[2][3],
+ x[3][0], x[3][1], x[3][2], x[3][3]);
+ }
+
+ ////////////////////////////////
+ // Float matrices
+
+ template <>
+ GLM_FUNC_QUALIFIER std::string to_string
+ (
+ detail::tmat2x2<float> const & x
+ )
+ {
+ return detail::format("mat2x2((%f, %f), (%f, %f))",
+ x[0][0], x[0][1],
+ x[1][0], x[1][1]);
+ }
+
+ template <>
+ GLM_FUNC_QUALIFIER std::string to_string
+ (
+ detail::tmat2x3<float> const & x
+ )
+ {
+ return detail::format("mat2x3((%f, %f, %f), (%f, %f, %f))",
+ x[0][0], x[0][1], x[0][2],
+ x[1][0], x[1][1], x[1][2]);
+ }
+
+ template <>
+ GLM_FUNC_QUALIFIER std::string to_string
+ (
+ detail::tmat2x4<float> const & x
+ )
+ {
+ return detail::format("mat2x4((%f, %f, %f, %f), (%f, %f, %f, %f))",
+ x[0][0], x[0][1], x[0][2], x[0][3],
+ x[1][0], x[1][1], x[1][2], x[1][3]);
+ }
+
+ template <>
+ GLM_FUNC_QUALIFIER std::string to_string
+ (
+ detail::tmat3x2<float> const & x
+ )
+ {
+ return detail::format("mat3x2((%f, %f), (%f, %f), (%f, %f))",
+ x[0][0], x[0][1],
+ x[1][0], x[1][1],
+ x[2][0], x[2][1]);
+ }
+
+ template <>
+ GLM_FUNC_QUALIFIER std::string to_string
+ (
+ detail::tmat3x3<float> const & x
+ )
+ {
+ return detail::format("mat3x3((%f, %f, %f), (%f, %f, %f), (%f, %f, %f))",
+ x[0][0], x[0][1], x[0][2],
+ x[1][0], x[1][1], x[1][2],
+ x[2][0], x[2][1], x[2][2]);
+ }
+
+ template <>
+ GLM_FUNC_QUALIFIER std::string to_string
+ (
+ detail::tmat3x4<float> const & x
+ )
+ {
+ return detail::format("mat3x4((%f, %f, %f, %f), (%f, %f, %f, %f), (%f, %f, %f, %f))",
+ x[0][0], x[0][1], x[0][2], x[0][3],
+ x[1][0], x[1][1], x[1][2], x[1][3],
+ x[2][0], x[2][1], x[2][2], x[2][3]);
+ }
+
+ template <>
+ GLM_FUNC_QUALIFIER std::string to_string
+ (
+ detail::tmat4x2<float> const & x
+ )
+ {
+ return detail::format("mat4x2((%f, %f), (%f, %f), (%f, %f), (%f, %f))",
+ x[0][0], x[0][1],
+ x[1][0], x[1][1],
+ x[2][0], x[2][1],
+ x[3][0], x[3][1]);
+ }
+
+ template <>
+ GLM_FUNC_QUALIFIER std::string to_string
+ (
+ detail::tmat4x3<float> const & x
+ )
+ {
+ return detail::format("mat4x3((%f, %f, %f), (%f, %f, %f), (%f, %f, %f), (%f, %f, %f))",
+ x[0][0], x[0][1], x[0][2],
+ x[1][0], x[1][1], x[1][2],
+ x[2][0], x[2][1], x[2][2],
+ x[3][0], x[3][1], x[3][2]);
+ }
+
+ template <>
+ GLM_FUNC_QUALIFIER std::string to_string
+ (
+ detail::tmat4x4<float> const & x
+ )
+ {
+ return detail::format("mat4x4((%f, %f, %f, %f), (%f, %f, %f, %f), (%f, %f, %f, %f), (%f, %f, %f, %f))",
+ x[0][0], x[0][1], x[0][2], x[0][3],
+ x[1][0], x[1][1], x[1][2], x[1][3],
+ x[2][0], x[2][1], x[2][2], x[2][3],
+ x[3][0], x[3][1], x[3][2], x[3][3]);
+ }
+
+ ////////////////////////////////
+ // Double matrices
+
+ template <>
+ GLM_FUNC_QUALIFIER std::string to_string
+ (
+ detail::tmat2x2<double> const & x
+ )
+ {
+ return detail::format("dmat2x2((%f, %f), (%f, %f))",
+ x[0][0], x[0][1],
+ x[1][0], x[1][1]);
+ }
+
+ template <>
+ GLM_FUNC_QUALIFIER std::string to_string
+ (
+ detail::tmat2x3<double> const & x
+ )
+ {
+ return detail::format("dmat2x3((%f, %f, %f), (%f, %f, %f))",
+ x[0][0], x[0][1], x[0][2],
+ x[1][0], x[1][1], x[1][2]);
+ }
+
+ template <>
+ GLM_FUNC_QUALIFIER std::string to_string
+ (
+ detail::tmat2x4<double> const & x
+ )
+ {
+ return detail::format("dmat2x4((%f, %f, %f, %f), (%f, %f, %f, %f))",
+ x[0][0], x[0][1], x[0][2], x[0][3],
+ x[1][0], x[1][1], x[1][2], x[1][3]);
+ }
+
+ template <>
+ GLM_FUNC_QUALIFIER std::string to_string
+ (
+ detail::tmat3x2<double> const & x
+ )
+ {
+ return detail::format("dmat3x2((%f, %f), (%f, %f), (%f, %f))",
+ x[0][0], x[0][1],
+ x[1][0], x[1][1],
+ x[2][0], x[2][1]);
+ }
+
+ template <>
+ GLM_FUNC_QUALIFIER std::string to_string
+ (
+ detail::tmat3x3<double> const & x
+ )
+ {
+ return detail::format("dmat3x3((%f, %f, %f), (%f, %f, %f), (%f, %f, %f))",
+ x[0][0], x[0][1], x[0][2],
+ x[1][0], x[1][1], x[1][2],
+ x[2][0], x[2][1], x[2][2]);
+ }
+
+ template <>
+ GLM_FUNC_QUALIFIER std::string to_string
+ (
+ detail::tmat3x4<double> const & x
+ )
+ {
+ return detail::format("dmat3x4((%f, %f, %f, %f), (%f, %f, %f, %f), (%f, %f, %f, %f))",
+ x[0][0], x[0][1], x[0][2], x[0][3],
+ x[1][0], x[1][1], x[1][2], x[1][3],
+ x[2][0], x[2][1], x[2][2], x[2][3]);
+ }
+
+ template <>
+ GLM_FUNC_QUALIFIER std::string to_string
+ (
+ detail::tmat4x2<double> const & x
+ )
+ {
+ return detail::format("dmat4x2((%f, %f), (%f, %f), (%f, %f), (%f, %f))",
+ x[0][0], x[0][1],
+ x[1][0], x[1][1],
+ x[2][0], x[2][1],
+ x[3][0], x[3][1]);
+ }
+
+ template <>
+ GLM_FUNC_QUALIFIER std::string to_string
+ (
+ detail::tmat4x3<double> const & x
+ )
+ {
+ return detail::format("dmat4x3((%f, %f, %f), (%f, %f, %f), (%f, %f, %f), (%f, %f, %f))",
+ x[0][0], x[0][1], x[0][2],
+ x[1][0], x[1][1], x[1][2],
+ x[2][0], x[2][1], x[2][2],
+ x[3][0], x[3][1], x[3][2]);
+ }
+
+ template <>
+ GLM_FUNC_QUALIFIER std::string to_string
+ (
+ detail::tmat4x4<double> const & x
+ )
+ {
+ return detail::format("dmat4x4((%f, %f, %f, %f), (%f, %f, %f, %f), (%f, %f, %f, %f), (%f, %f, %f, %f))",
+ x[0][0], x[0][1], x[0][2], x[0][3],
+ x[1][0], x[1][1], x[1][2], x[1][3],
+ x[2][0], x[2][1], x[2][2], x[2][3],
+ x[3][0], x[3][1], x[3][2], x[3][3]);
+ }
+
+ }//namespace string_cast
+ }//namespace gtx
+}//namespace glm
diff --git a/src/glm/gtx/transform.hpp b/src/glm/gtx/transform.hpp
new file mode 100644
index 0000000..1a38544
--- /dev/null
+++ b/src/glm/gtx/transform.hpp
@@ -0,0 +1,103 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2005-12-21
+// Updated : 2009-04-29
+// Licence : This source is under MIT License
+// File : glm/gtx/transform.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+// - GLM_GTC_matric_transform
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_gtx_transform
+#define glm_gtx_transform
+
+// Dependency:
+#include "../glm.hpp"
+#include "../gtc/matrix_transform.hpp"
+
+#if(defined(GLM_MESSAGES) && !defined(glm_ext))
+# pragma message("GLM: GLM_GTX_transform extension included")
+#endif
+
+namespace glm{
+namespace gtx{
+namespace transform ///< GLM_GTX_transform extension: Add transformation matrices
+{
+ using namespace gtc::matrix_transform;
+
+ /// \addtogroup gtx_transform
+ /// @{
+
+ //! Builds a translation 4 * 4 matrix created from 3 scalars.
+ //! From GLM_GTX_transform extension.
+ template <typename T>
+ detail::tmat4x4<T> translate(
+ T x, T y, T z);
+
+ //! Transforms a matrix with a translation 4 * 4 matrix created from 3 scalars.
+ //! From GLM_GTX_transform extension.
+ template <typename T>
+ detail::tmat4x4<T> translate(
+ detail::tmat4x4<T> const & m,
+ T x, T y, T z);
+
+ //! Transforms a matrix with a translation 4 * 4 matrix created from 3 scalars.
+ //! From GLM_GTX_transform extension.
+ template <typename T>
+ detail::tmat4x4<T> translate(
+ detail::tvec3<T> const & v);
+
+ //! Builds a rotation 4 * 4 matrix created from an axis of 3 scalars and an angle expressed in degrees.
+ //! From GLM_GTX_transform extension.
+ template <typename T>
+ detail::tmat4x4<T> rotate(
+ T angle,
+ T x, T y, T z);
+
+ //! Builds a rotation 4 * 4 matrix created from an axis of 3 scalars and an angle expressed in degrees.
+ //! From GLM_GTX_transform extension.
+ template <typename T>
+ detail::tmat4x4<T> rotate(
+ T angle,
+ detail::tvec3<T> const & v);
+
+ //! Transforms a matrix with a rotation 4 * 4 matrix created from an axis of 3 scalars and an angle expressed in degrees.
+ //! From GLM_GTX_transform extension.
+ template <typename T>
+ detail::tmat4x4<T> rotate(
+ detail::tmat4x4<T> const & m,
+ T angle,
+ T x, T y, T z);
+
+ //! Builds a scale 4 * 4 matrix created from 3 scalars.
+ //! From GLM_GTX_transform extension.
+ template <typename T>
+ detail::tmat4x4<T> scale(
+ T x, T y, T z);
+
+ //! Transforms a matrix with a scale 4 * 4 matrix created from 3 scalars.
+ //! From GLM_GTX_transform extension.
+ template <typename T>
+ detail::tmat4x4<T> scale(
+ detail::tmat4x4<T> const & m,
+ T x, T y, T z);
+
+ //! Transforms a matrix with a scale 4 * 4 matrix created from a vector of 3 components.
+ //! From GLM_GTX_transform extension.
+ template <typename T>
+ detail::tmat4x4<T> scale(
+ detail::tvec3<T> const & v);
+
+ /// @}
+}//namespace transform
+}//namespace gtx
+}//namespace glm
+
+#include "transform.inl"
+
+namespace glm{using namespace gtx::transform;}
+
+#endif//glm_gtx_transform
diff --git a/src/glm/gtx/transform.inl b/src/glm/gtx/transform.inl
new file mode 100644
index 0000000..740c1ec
--- /dev/null
+++ b/src/glm/gtx/transform.inl
@@ -0,0 +1,94 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2005-12-21
+// Updated : 2009-04-29
+// Licence : This source is under MIT License
+// File : glm/gtx/transform.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm{
+namespace gtx{
+namespace transform
+{
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat4x4<T> translate(
+ T x, T y, T z)
+ {
+ return gtc::matrix_transform::translate(
+ detail::tmat4x4<T>(1.0f),
+ detail::tvec3<T>(x, y , z));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat4x4<T> translate(
+ detail::tmat4x4<T> const & m,
+ T x, T y, T z)
+ {
+ return gtc::matrix_transform::translate(
+ m, detail::tvec3<T>(x, y , z));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat4x4<T> translate(
+ detail::tvec3<T> const & v)
+ {
+ return gtc::matrix_transform::translate(
+ detail::tmat4x4<T>(1.0f), v);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat4x4<T> rotate(
+ T angle,
+ T x, T y, T z)
+ {
+ return gtc::matrix_transform::rotate(
+ detail::tmat4x4<T>(1), angle, detail::tvec3<T>(x, y, z));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat4x4<T> rotate(
+ T angle,
+ detail::tvec3<T> const & v)
+ {
+ return gtc::matrix_transform::rotate(
+ detail::tmat4x4<T>(1), angle, v);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat4x4<T> rotate(
+ detail::tmat4x4<T> const & m,
+ T angle,
+ T x, T y, T z)
+ {
+ return gtc::matrix_transform::rotate(
+ m, angle, detail::tvec3<T>(x, y, z));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat4x4<T> scale(T x, T y, T z)
+ {
+ return gtc::matrix_transform::scale(
+ detail::tmat4x4<T>(1), detail::tvec3<T>(x, y, z));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat4x4<T> scale(
+ detail::tmat4x4<T> const & m,
+ T x, T y, T z)
+ {
+ return gtc::matrix_transform::scale(
+ m, detail::tvec3<T>(x, y, z));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat4x4<T> scale(
+ detail::tvec3<T> const & v)
+ {
+ return gtc::matrix_transform::scale(
+ detail::tmat4x4<T>(1.0f), v);
+ }
+
+}//namespace transform
+}//namespace gtx
+}//namespace glm
diff --git a/src/glm/gtx/transform2.hpp b/src/glm/gtx/transform2.hpp
new file mode 100644
index 0000000..b0278a3
--- /dev/null
+++ b/src/glm/gtx/transform2.hpp
@@ -0,0 +1,118 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2005-12-21
+// Updated : 2006-11-13
+// Licence : This source is under MIT License
+// File : glm/gtx/transform2.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+// - GLM_GTX_transform
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_gtx_transform2
+#define glm_gtx_transform2
+
+// Dependency:
+#include "../glm.hpp"
+#include "../gtx/transform.hpp"
+
+#if(defined(GLM_MESSAGES) && !defined(glm_ext))
+# pragma message("GLM: GLM_GTX_transform2 extension included")
+#endif
+
+namespace glm{
+namespace gtx{
+namespace transform2 ///< GLM_GTX_transform2 extension: Add extra transformation matrices
+{
+ using namespace gtx::transform;
+
+ /// \addtogroup gtx_transform2
+ /// @{
+
+ //! Transforms a matrix with a shearing on X axis.
+ //! From GLM_GTX_transform2 extension.
+ template <typename T>
+ detail::tmat3x3<T> shearX2D(
+ detail::tmat3x3<T> const & m,
+ T y);
+
+ //! Transforms a matrix with a shearing on Y axis.
+ //! From GLM_GTX_transform2 extension.
+ template <typename T>
+ detail::tmat3x3<T> shearY2D(
+ detail::tmat3x3<T> const & m,
+ T x);
+
+ //! Transforms a matrix with a shearing on X axis
+ //! From GLM_GTX_transform2 extension.
+ template <typename T>
+ detail::tmat4x4<T> shearX3D(
+ const detail::tmat4x4<T> & m,
+ T y,
+ T z);
+
+ //! Transforms a matrix with a shearing on Y axis.
+ //! From GLM_GTX_transform2 extension.
+ template <typename T>
+ detail::tmat4x4<T> shearY3D(
+ const detail::tmat4x4<T> & m,
+ T x,
+ T z);
+
+ //! Transforms a matrix with a shearing on Z axis.
+ //! From GLM_GTX_transform2 extension.
+ template <typename T>
+ detail::tmat4x4<T> shearZ3D(
+ const detail::tmat4x4<T> & m,
+ T x,
+ T y);
+
+ //template <typename T> GLM_FUNC_QUALIFIER detail::tmat4x4<T> shear(const detail::tmat4x4<T> & m, shearPlane, planePoint, angle)
+ // Identity + tan(angle) * cross(Normal, OnPlaneVector) 0
+ // - dot(PointOnPlane, normal) * OnPlaneVector 1
+
+ // Reflect functions seem to don't work
+ //template <typename T> detail::tmat3x3<T> reflect2D(const detail::tmat3x3<T> & m, const detail::tvec3<T>& normal){return reflect2DGTX(m, normal);} //!< \brief Build a reflection matrix (from GLM_GTX_transform2 extension)
+ //template <typename T> detail::tmat4x4<T> reflect3D(const detail::tmat4x4<T> & m, const detail::tvec3<T>& normal){return reflect3DGTX(m, normal);} //!< \brief Build a reflection matrix (from GLM_GTX_transform2 extension)
+
+ //! Build planar projection matrix along normal axis.
+ //! From GLM_GTX_transform2 extension.
+ template <typename T>
+ detail::tmat3x3<T> proj2D(
+ const detail::tmat3x3<T> & m,
+ const detail::tvec3<T>& normal);
+
+ //! Build planar projection matrix along normal axis.
+ //! From GLM_GTX_transform2 extension.
+ template <typename T>
+ detail::tmat4x4<T> proj3D(
+ const detail::tmat4x4<T> & m,
+ const detail::tvec3<T>& normal);
+
+ //! Build a scale bias matrix.
+ //! From GLM_GTX_transform2 extension.
+ template <typename valType>
+ detail::tmat4x4<valType> scaleBias(
+ valType scale,
+ valType bias);
+
+ //! Build a scale bias matrix.
+ //! From GLM_GTX_transform2 extension.
+ template <typename valType>
+ detail::tmat4x4<valType> scaleBias(
+ detail::tmat4x4<valType> const & m,
+ valType scale,
+ valType bias);
+
+ /// @}
+}// namespace transform2
+}// namespace gtx
+}// namespace glm
+
+#include "transform2.inl"
+
+namespace glm{using namespace gtx::transform2;}
+
+#endif//glm_gtx_transform2
diff --git a/src/glm/gtx/transform2.inl b/src/glm/gtx/transform2.inl
new file mode 100644
index 0000000..8b7e4d6
--- /dev/null
+++ b/src/glm/gtx/transform2.inl
@@ -0,0 +1,159 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2005-02-28
+// Updated : 2005-04-23
+// Licence : This source is under MIT License
+// File : glm/gtx/transform2.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm{
+namespace gtx{
+namespace transform2
+{
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat3x3<T> shearX2D(
+ const detail::tmat3x3<T>& m,
+ T s)
+ {
+ detail::tmat3x3<T> r(1);
+ r[0][1] = s;
+ return m * r;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat3x3<T> shearY2D(
+ const detail::tmat3x3<T>& m,
+ T s)
+ {
+ detail::tmat3x3<T> r(1);
+ r[1][0] = s;
+ return m * r;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat4x4<T> shearX3D(
+ const detail::tmat4x4<T>& m,
+ T s,
+ T t)
+ {
+ detail::tmat4x4<T> r(1);
+ r[1][0] = s;
+ r[2][0] = t;
+ return m * r;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat4x4<T> shearY3D(
+ const detail::tmat4x4<T>& m,
+ T s,
+ T t)
+ {
+ detail::tmat4x4<T> r(1);
+ r[0][1] = s;
+ r[2][1] = t;
+ return m * r;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat4x4<T> shearZ3D(
+ const detail::tmat4x4<T>& m,
+ T s,
+ T t)
+ {
+ detail::tmat4x4<T> r(1);
+ r[0][2] = s;
+ r[1][2] = t;
+ return m * r;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat3x3<T> reflect2D(
+ const detail::tmat3x3<T>& m,
+ const detail::tvec3<T>& normal)
+ {
+ detail::tmat3x3<T> r(1);
+ r[0][0] = 1 - 2 * normal.x * normal.x;
+ r[0][1] = -2 * normal.x * normal.y;
+ r[1][0] = -2 * normal.x * normal.y;
+ r[1][1] = 1 - 2 * normal.y * normal.y;
+ return m * r;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat4x4<T> reflect3D(
+ const detail::tmat4x4<T>& m,
+ const detail::tvec3<T>& normal)
+ {
+ detail::tmat4x4<T> r(1);
+ r[0][0] = 1 - 2 * normal.x * normal.x;
+ r[0][1] = -2 * normal.x * normal.y;
+ r[0][2] = -2 * normal.x * normal.z;
+
+ r[1][0] = -2 * normal.x * normal.y;
+ r[1][1] = 1 - 2 * normal.y * normal.y;
+ r[1][2] = -2 * normal.y * normal.z;
+
+ r[2][0] = -2 * normal.x * normal.z;
+ r[2][1] = -2 * normal.y * normal.z;
+ r[2][2] = 1 - 2 * normal.z * normal.z;
+ return m * r;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat3x3<T> proj2D(
+ const detail::tmat3x3<T>& m,
+ const detail::tvec3<T>& normal)
+ {
+ detail::tmat3x3<T> r(1);
+ r[0][0] = 1 - normal.x * normal.x;
+ r[0][1] = - normal.x * normal.y;
+ r[1][0] = - normal.x * normal.y;
+ r[1][1] = 1 - normal.y * normal.y;
+ return m * r;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat4x4<T> proj3D(
+ const detail::tmat4x4<T>& m,
+ const detail::tvec3<T>& normal)
+ {
+ detail::tmat4x4<T> r(1);
+ r[0][0] = 1 - normal.x * normal.x;
+ r[0][1] = - normal.x * normal.y;
+ r[0][2] = - normal.x * normal.z;
+ r[1][0] = - normal.x * normal.y;
+ r[1][1] = 1 - normal.y * normal.y;
+ r[1][2] = - normal.y * normal.z;
+ r[2][0] = - normal.x * normal.z;
+ r[2][1] = - normal.y * normal.z;
+ r[2][2] = 1 - normal.z * normal.z;
+ return m * r;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat4x4<T> scaleBias(
+ T scale,
+ T bias)
+ {
+ detail::tmat4x4<T> result;
+ result[3] = detail::tvec4<T>(detail::tvec3<T>(bias), T(1));
+ result[0][0] = scale;
+ result[1][1] = scale;
+ result[2][2] = scale;
+ return result;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tmat4x4<T> scaleBias(
+ const detail::tmat4x4<T>& m,
+ T scale,
+ T bias)
+ {
+ return m * scaleBias(scale, bias);
+ }
+
+}//namespace transform2
+}//namespace gtx
+}//namespace glm
+
diff --git a/src/glm/gtx/ulp.hpp b/src/glm/gtx/ulp.hpp
new file mode 100644
index 0000000..0c60718
--- /dev/null
+++ b/src/glm/gtx/ulp.hpp
@@ -0,0 +1,70 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2011-02-21
+// Updated : 2009-02-21
+// Licence : This source is under MIT License
+// File : glm/gtx/ulp.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_gtx_ulp
+#define glm_gtx_ulp
+
+// Dependency:
+#include "../glm.hpp"
+
+#if(defined(GLM_MESSAGES) && !defined(glm_ext))
+# pragma message("GLM: GLM_GTX_ulp extension included")
+#endif
+
+namespace glm{
+namespace gtx{
+namespace ulp ///< GLM_GTX_ulp extension: Precision calculation functions
+{
+ /// \addtogroup gtx_ulp
+ /// @{
+
+ //! Return the next ULP value(s) after the input value(s).
+ //! From GLM_GTX_ulp extension.
+ template <typename genType>
+ genType next_float(genType const & x);
+
+ //! Return the previous ULP value(s) before the input value(s).
+ //! From GLM_GTX_ulp extension.
+ template <typename genType>
+ genType prev_float(genType const & x);
+
+ //! Return the value(s) ULP distance after the input value(s).
+ //! From GLM_GTX_ulp extension.
+ template <typename genType>
+ genType next_float(genType const & x, uint const & Distance);
+
+ //! Return the value(s) ULP distance before the input value(s).
+ //! From GLM_GTX_ulp extension.
+ template <typename genType>
+ genType prev_float(genType const & x, uint const & Distance);
+
+ //! Return the distance in the number of ULP between 2 scalars.
+ //! From GLM_GTX_ulp extension.
+ template <typename T>
+ uint float_distance(T const & x, T const & y);
+
+ //! Return the distance in the number of ULP between 2 vectors.
+ //! From GLM_GTX_ulp extension.
+ template<typename T, template<typename> class vecType>
+ vecType<uint> float_distance(vecType<T> const & x, vecType<T> const & y);
+
+ ///@}
+}// namespace ulp
+}// namespace gtx
+}// namespace glm
+
+#include "ulp.inl"
+
+namespace glm{using namespace gtx::ulp;}
+
+#endif//glm_gtx_ulp
+
diff --git a/src/glm/gtx/ulp.inl b/src/glm/gtx/ulp.inl
new file mode 100644
index 0000000..7a5b2a7
--- /dev/null
+++ b/src/glm/gtx/ulp.inl
@@ -0,0 +1,396 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2011-03-07
+// Updated : 2011-04-26
+// Licence : This source is under MIT License
+// File : glm/gtx/ulp.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <cmath>
+#include <cfloat>
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+typedef union
+{
+ float value;
+ /* FIXME: Assumes 32 bit int. */
+ unsigned int word;
+} ieee_float_shape_type;
+
+typedef union
+{
+ double value;
+ struct
+ {
+ glm::detail::int32 lsw;
+ glm::detail::int32 msw;
+ } parts;
+} ieee_double_shape_type;
+
+#define GLM_EXTRACT_WORDS(ix0,ix1,d) \
+do { \
+ ieee_double_shape_type ew_u; \
+ ew_u.value = (d); \
+ (ix0) = ew_u.parts.msw; \
+ (ix1) = ew_u.parts.lsw; \
+} while (0)
+
+#define GLM_GET_FLOAT_WORD(i,d) \
+do { \
+ ieee_float_shape_type gf_u; \
+ gf_u.value = (d); \
+ (i) = gf_u.word; \
+} while (0)
+
+#define GLM_SET_FLOAT_WORD(d,i) \
+do { \
+ ieee_float_shape_type sf_u; \
+ sf_u.word = (i); \
+ (d) = sf_u.value; \
+} while (0)
+
+#define GLM_INSERT_WORDS(d,ix0,ix1) \
+do { \
+ ieee_double_shape_type iw_u; \
+ iw_u.parts.msw = (ix0); \
+ iw_u.parts.lsw = (ix1); \
+ (d) = iw_u.value; \
+} while (0)
+
+namespace glm{
+namespace detail
+{
+ GLM_FUNC_QUALIFIER float nextafterf(float x, float y)
+ {
+ volatile float t;
+ glm::detail::int32 hx, hy, ix, iy;
+
+ GLM_GET_FLOAT_WORD(hx,x);
+ GLM_GET_FLOAT_WORD(hy,y);
+ ix = hx&0x7fffffff; // |x|
+ iy = hy&0x7fffffff; // |y|
+
+ if((ix>0x7f800000) || // x is nan
+ (iy>0x7f800000)) // y is nan
+ return x+y;
+ if(x==y) return y; // x=y, return y
+ if(ix==0) { // x == 0
+ GLM_SET_FLOAT_WORD(x,(hy&0x80000000)|1);// return +-minsubnormal
+ t = x*x;
+ if(t==x) return t; else return x; // raise underflow flag
+ }
+ if(hx>=0) { // x > 0
+ if(hx>hy) { // x > y, x -= ulp
+ hx -= 1;
+ } else { // x < y, x += ulp
+ hx += 1;
+ }
+ } else { // x < 0
+ if(hy>=0||hx>hy){ // x < y, x -= ulp
+ hx -= 1;
+ } else { // x > y, x += ulp
+ hx += 1;
+ }
+ }
+ hy = hx&0x7f800000;
+ if(hy>=0x7f800000) return x+x; // overflow
+ if(hy<0x00800000) { // underflow
+ t = x*x;
+ if(t!=x) { // raise underflow flag
+ GLM_SET_FLOAT_WORD(y,hx);
+ return y;
+ }
+ }
+ GLM_SET_FLOAT_WORD(x,hx);
+ return x;
+ }
+
+ GLM_FUNC_QUALIFIER double nextafter(double x, double y)
+ {
+ volatile double t;
+ glm::detail::int32 hx, hy, ix, iy;
+ glm::detail::uint32 lx, ly;
+
+ GLM_EXTRACT_WORDS(hx, lx, x);
+ GLM_EXTRACT_WORDS(hy, ly, y);
+ ix = hx & 0x7fffffff; // |x|
+ iy = hy & 0x7fffffff; // |y|
+
+ if(((ix>=0x7ff00000)&&((ix-0x7ff00000)|lx)!=0) || // x is nan
+ ((iy>=0x7ff00000)&&((iy-0x7ff00000)|ly)!=0)) // y is nan
+ return x+y;
+ if(x==y) return y; // x=y, return y
+ if((ix|lx)==0) { // x == 0
+ GLM_INSERT_WORDS(x, hy & 0x80000000, 1); // return +-minsubnormal
+ t = x*x;
+ if(t==x) return t; else return x; // raise underflow flag
+ }
+ if(hx>=0) { // x > 0
+ if(hx>hy||((hx==hy)&&(lx>ly))) { // x > y, x -= ulp
+ if(lx==0) hx -= 1;
+ lx -= 1;
+ } else { // x < y, x += ulp
+ lx += 1;
+ if(lx==0) hx += 1;
+ }
+ } else { // x < 0
+ if(hy>=0||hx>hy||((hx==hy)&&(lx>ly))){// x < y, x -= ulp
+ if(lx==0) hx -= 1;
+ lx -= 1;
+ } else { // x > y, x += ulp
+ lx += 1;
+ if(lx==0) hx += 1;
+ }
+ }
+ hy = hx&0x7ff00000;
+ if(hy>=0x7ff00000) return x+x; // overflow
+ if(hy<0x00100000) { // underflow
+ t = x*x;
+ if(t!=x) { // raise underflow flag
+ GLM_INSERT_WORDS(y,hx,lx);
+ return y;
+ }
+ }
+ GLM_INSERT_WORDS(x,hx,lx);
+ return x;
+ }
+}//namespace detail
+}//namespace glm
+
+#if(GLM_COMPILER & GLM_COMPILER_VC)
+# define GLM_NEXT_AFTER_FLT(x, toward) glm::detail::nextafterf((x), (toward))
+# define GLM_NEXT_AFTER_DBL(x, toward) _nextafter((x), (toward))
+#else
+# define GLM_NEXT_AFTER_FLT(x, toward) nextafterf((x), (toward))
+# define GLM_NEXT_AFTER_DBL(x, toward) nextafter((x), (toward))
+#endif
+
+namespace glm{
+namespace gtx{
+namespace ulp
+{
+ GLM_FUNC_QUALIFIER float next_float(float const & x)
+ {
+ return GLM_NEXT_AFTER_FLT(x, std::numeric_limits<float>::max());
+ }
+
+ GLM_FUNC_QUALIFIER double next_float(double const & x)
+ {
+ return GLM_NEXT_AFTER_DBL(x, std::numeric_limits<double>::max());
+ }
+
+ template<typename T, template<typename> class vecType>
+ GLM_FUNC_QUALIFIER vecType<T> next_float(vecType<T> const & x)
+ {
+ vecType<T> Result;
+ for(std::size_t i = 0; i < Result.length(); ++i)
+ Result[i] = next_float(x[i]);
+ return Result;
+ }
+
+ GLM_FUNC_QUALIFIER float prev_float(float const & x)
+ {
+ return GLM_NEXT_AFTER_FLT(x, std::numeric_limits<float>::min());
+ }
+
+ GLM_FUNC_QUALIFIER double prev_float(double const & x)
+ {
+ return GLM_NEXT_AFTER_DBL(x, std::numeric_limits<double>::min());
+ }
+
+ template<typename T, template<typename> class vecType>
+ GLM_FUNC_QUALIFIER vecType<T> prev_float(vecType<T> const & x)
+ {
+ vecType<T> Result;
+ for(std::size_t i = 0; i < Result.length(); ++i)
+ Result[i] = prev_float(x[i]);
+ return Result;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER T next_float(T const & x, uint const & ulps)
+ {
+ T temp = x;
+ for(std::size_t i = 0; i < ulps; ++i)
+ temp = next_float(temp);
+ return temp;
+ }
+
+ template<typename T, template<typename> class vecType>
+ GLM_FUNC_QUALIFIER vecType<T> next_float(vecType<T> const & x, vecType<uint> const & ulps)
+ {
+ vecType<T> Result;
+ for(std::size_t i = 0; i < Result.length(); ++i)
+ Result[i] = next_float(x[i], ulps[i]);
+ return Result;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER T prev_float(T const & x, uint const & ulps)
+ {
+ T temp = x;
+ for(std::size_t i = 0; i < ulps; ++i)
+ temp = prev_float(temp);
+ return temp;
+ }
+
+ template<typename T, template<typename> class vecType>
+ GLM_FUNC_QUALIFIER vecType<T> prev_float(vecType<T> const & x, vecType<uint> const & ulps)
+ {
+ vecType<T> Result;
+ for(std::size_t i = 0; i < Result.length(); ++i)
+ Result[i] = prev_float(x[i], ulps[i]);
+ return Result;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER uint float_distance(T const & x, T const & y)
+ {
+ uint ulp = 0;
+
+ if(x < y)
+ {
+ T temp = x;
+ while(temp != y && ulp < std::numeric_limits<std::size_t>::max())
+ {
+ ++ulp;
+ temp = next_float(temp);
+ }
+ }
+ else if(y < x)
+ {
+ T temp = y;
+ while(temp != x && ulp < std::numeric_limits<std::size_t>::max())
+ {
+ ++ulp;
+ temp = next_float(temp);
+ }
+ }
+ else // ==
+ {
+
+ }
+
+ return ulp;
+ }
+
+ template<typename T, template<typename> class vecType>
+ GLM_FUNC_QUALIFIER vecType<uint> float_distance(vecType<T> const & x, vecType<T> const & y)
+ {
+ vecType<uint> Result;
+ for(std::size_t i = 0; i < Result.length(); ++i)
+ Result[i] = float_distance(x[i], y[i]);
+ return Result;
+ }
+/*
+ inline std::size_t ulp
+ (
+ detail::thalf const & a,
+ detail::thalf const & b
+ )
+ {
+ std::size_t Count = 0;
+ float TempA(a);
+ float TempB(b);
+ //while((TempA = _nextafterf(TempA, TempB)) != TempB)
+ ++Count;
+ return Count;
+ }
+
+ inline std::size_t ulp
+ (
+ float const & a,
+ float const & b
+ )
+ {
+ std::size_t Count = 0;
+ float Temp = a;
+ //while((Temp = _nextafterf(Temp, b)) != b)
+ {
+ std::cout << Temp << " " << b << std::endl;
+ ++Count;
+ }
+ return Count;
+ }
+
+ inline std::size_t ulp
+ (
+ double const & a,
+ double const & b
+ )
+ {
+ std::size_t Count = 0;
+ double Temp = a;
+ //while((Temp = _nextafter(Temp, b)) != b)
+ {
+ std::cout << Temp << " " << b << std::endl;
+ ++Count;
+ }
+ return Count;
+ }
+
+ template <typename T>
+ inline std::size_t ulp
+ (
+ detail::tvec2<T> const & a,
+ detail::tvec2<T> const & b
+ )
+ {
+ std::size_t ulps[] =
+ {
+ ulp(a[0], b[0]),
+ ulp(a[1], b[1])
+ };
+
+ return glm::max(ulps[0], ulps[1]);
+ }
+
+ template <typename T>
+ inline std::size_t ulp
+ (
+ detail::tvec3<T> const & a,
+ detail::tvec3<T> const & b
+ )
+ {
+ std::size_t ulps[] =
+ {
+ ulp(a[0], b[0]),
+ ulp(a[1], b[1]),
+ ulp(a[2], b[2])
+ };
+
+ return glm::max(glm::max(ulps[0], ulps[1]), ulps[2]);
+ }
+
+ template <typename T>
+ inline std::size_t ulp
+ (
+ detail::tvec4<T> const & a,
+ detail::tvec4<T> const & b
+ )
+ {
+ std::size_t ulps[] =
+ {
+ ulp(a[0], b[0]),
+ ulp(a[1], b[1]),
+ ulp(a[2], b[2]),
+ ulp(a[3], b[3])
+ };
+
+ return glm::max(glm::max(ulps[0], ulps[1]), glm::max(ulps[2], ulps[3]));
+ }
+*/
+}//namespace ulp
+}//namespace gtx
+}//namespace glm
diff --git a/src/glm/gtx/unsigned_int.hpp b/src/glm/gtx/unsigned_int.hpp
new file mode 100644
index 0000000..84a858c
--- /dev/null
+++ b/src/glm/gtx/unsigned_int.hpp
@@ -0,0 +1,59 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2005-12-24
+// Updated : 2008-10-07
+// Licence : This source is under MIT License
+// File : glm/gtx/unsigned_int.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+// - GLM_GTX_integer
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_gtx_unsigned_int
+#define glm_gtx_unsigned_int
+
+// Dependency:
+#include "../glm.hpp"
+#include "../gtx/integer.hpp"
+
+#if(defined(GLM_MESSAGES) && !defined(glm_ext))
+# pragma message("GLM: GLM_GTX_unsigned_int extension included")
+#endif
+
+namespace glm{
+namespace gtx{
+namespace unsigned_int ///< GLM_GTX_unsigned_int extension: Add support for unsigned integer for core functions
+{
+ using namespace gtx::integer;
+
+ /// \addtogroup gtx_unsigned_int
+ /// @{
+
+ //! 32bit signed integer.
+ //! From GLM_GTX_unsigned_int extension.
+ typedef signed int sint;
+
+ //! Returns x raised to the y power.
+ //! From GLM_GTX_unsigned_int extension.
+ uint pow(uint x, uint y);
+
+ //! Returns the positive square root of x.
+ //! From GLM_GTX_unsigned_int extension.
+ uint sqrt(uint x);
+
+ //! Modulus. Returns x - y * floor(x / y) for each component in x using the floating point value y.
+ //! From GLM_GTX_unsigned_int extension.
+ uint mod(uint x, uint y);
+
+ /// @}
+}//namespace unsigned_int
+}//namespace gtx
+}//namespace glm
+
+#include "unsigned_int.inl"
+
+namespace glm{using namespace gtx::unsigned_int;}
+
+#endif//glm_gtx_unsigned_int
diff --git a/src/glm/gtx/unsigned_int.inl b/src/glm/gtx/unsigned_int.inl
new file mode 100644
index 0000000..21aece7
--- /dev/null
+++ b/src/glm/gtx/unsigned_int.inl
@@ -0,0 +1,45 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2005-12-24
+// Updated : 2008-10-07
+// Licence : This source is under MIT License
+// File : glm/gtx/unsigned_int.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm{
+namespace gtx{
+namespace unsigned_int{
+
+GLM_FUNC_QUALIFIER uint pow(uint x, uint y)
+{
+ uint result = x;
+ for(uint i = 1; i < y; ++i)
+ result *= x;
+ return result;
+}
+
+GLM_FUNC_QUALIFIER uint sqrt(uint x)
+{
+ if(x <= 1) return x;
+
+ uint NextTrial = x >> 1;
+ uint CurrentAnswer;
+
+ do
+ {
+ CurrentAnswer = NextTrial;
+ NextTrial = (NextTrial + x / NextTrial) >> 1;
+ } while(NextTrial < CurrentAnswer);
+
+ return CurrentAnswer;
+}
+
+GLM_FUNC_QUALIFIER uint mod(uint x, uint y)
+{
+ return x - y * (x / y);
+}
+
+}//namespace unsigned_int
+}//namespace gtx
+}//namespace glm
diff --git a/src/glm/gtx/vec1.hpp b/src/glm/gtx/vec1.hpp
new file mode 100644
index 0000000..4eee090
--- /dev/null
+++ b/src/glm/gtx/vec1.hpp
@@ -0,0 +1,121 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2010-02-08
+// Updated : 2010-02-08
+// Licence : This source is under MIT License
+// File : glm/gtx/vec1.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_gtx_vec1
+#define glm_gtx_vec1
+
+// Dependency:
+#include "../glm.hpp"
+#include "../core/type_vec1.hpp"
+
+#if(defined(GLM_MESSAGES) && !defined(glm_ext))
+# pragma message("GLM: GLM_GTX_vec1 extension included")
+#endif
+
+namespace glm{
+namespace gtx{
+namespace vector1{ ///< GLM_GTX_vec1 extension: 1 component vector.
+namespace precision
+{
+ //! 1 component vector of high precision floating-point numbers.
+ //! There is no guarantee on the actual precision.
+ //! From GLM_GTX_vec1 extension.
+ typedef detail::highp_vec1_t highp_vec1;
+ //! 1 component vector of medium precision floating-point numbers.
+ //! There is no guarantee on the actual precision.
+ //! From GLM_GTX_vec1 extension.
+ typedef detail::mediump_vec1_t mediump_vec1;
+ //! 1 component vector of low precision floating-point numbers.
+ //! There is no guarantee on the actual precision.
+ //! From GLM_GTX_vec1 extension.
+ typedef detail::lowp_vec1_t lowp_vec1;
+
+ //! 1 component vector of high precision signed integer numbers.
+ //! There is no guarantee on the actual precision.
+ //! From GLM_GTX_vec1 extension.
+ typedef detail::highp_ivec1_t highp_ivec1;
+ //! 1 component vector of medium precision signed integer numbers.
+ //! There is no guarantee on the actual precision.
+ //! From GLM_GTX_vec1 extension.
+ typedef detail::mediump_ivec1_t mediump_ivec1;
+ //! 1 component vector of low precision signed integer numbers.
+ //! There is no guarantee on the actual precision.
+ //! From GLM_GTX_vec1 extension.
+ typedef detail::lowp_ivec1_t lowp_ivec1;
+
+ //! 1 component vector of high precision unsigned integer numbers.
+ //! There is no guarantee on the actual precision.
+ //! From GLM_GTX_vec1 extension.
+ typedef detail::highp_uvec1_t highp_uvec1;
+ //! 1 component vector of medium precision unsigned integer numbers.
+ //! There is no guarantee on the actual precision.
+ //! From GLM_GTX_vec1 extension.
+ typedef detail::mediump_uvec1_t mediump_uvec1;
+ //! 1 component vector of low precision unsigned integer numbers.
+ //! There is no guarantee on the actual precision.
+ //! From GLM_GTX_vec1 extension.
+ typedef detail::lowp_uvec1_t lowp_uvec1;
+}//namespace precision
+
+ //////////////////////////
+ // vec1 definition
+
+ //! 1 component vector of boolean.
+ //! From GLM_GTX_vec1 extension.
+ typedef detail::tvec1<bool> bvec1;
+
+#if(defined(GLM_PRECISION_HIGHP_FLOAT))
+ typedef precision::highp_vec1 vec1;
+#elif(defined(GLM_PRECISION_MEDIUMP_FLOAT))
+ typedef precision::mediump_vec1 vec1;
+#elif(defined(GLM_PRECISION_LOWP_FLOAT))
+ typedef precision::lowp_vec1 vec1;
+#else
+ //! 1 component vector of floating-point numbers.
+ //! From GLM_GTX_vec1 extension.
+ typedef precision::mediump_vec1 vec1;
+#endif//GLM_PRECISION
+
+#if(defined(GLM_PRECISION_HIGHP_INT))
+ typedef precision::highp_ivec1 ivec1;
+#elif(defined(GLM_PRECISION_MEDIUMP_INT))
+ typedef precision::mediump_ivec1 ivec1;
+#elif(defined(GLM_PRECISION_LOWP_INT))
+ typedef precision::lowp_ivec1 ivec1;
+#else
+ //! 1 component vector of signed integer numbers.
+ //! From GLM_GTX_vec1 extension.
+ typedef precision::mediump_ivec1 ivec1;
+#endif//GLM_PRECISION
+
+#if(defined(GLM_PRECISION_HIGHP_UINT))
+ typedef precision::highp_uvec1 uvec1;
+#elif(defined(GLM_PRECISION_MEDIUMP_UINT))
+ typedef precision::mediump_uvec1 uvec1;
+#elif(defined(GLM_PRECISION_LOWP_UINT))
+ typedef precision::lowp_uvec1 uvec1;
+#else
+ //! 1 component vector of unsigned integer numbers.
+ //! From GLM_GTX_vec1 extension.
+ typedef precision::mediump_uvec1 uvec1;
+#endif//GLM_PRECISION
+
+}// namespace vec1
+}// namespace gtx
+}// namespace glm
+
+#include "vec1.inl"
+
+namespace glm{using namespace gtx::vector1;}
+
+#endif//glm_gtx_vec1
+
diff --git a/src/glm/gtx/vec1.inl b/src/glm/gtx/vec1.inl
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/glm/gtx/vec1.inl
diff --git a/src/glm/gtx/vector_access.hpp b/src/glm/gtx/vector_access.hpp
new file mode 100644
index 0000000..d66cc3f
--- /dev/null
+++ b/src/glm/gtx/vector_access.hpp
@@ -0,0 +1,66 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2006-01-16
+// Updated : 2008-10-07
+// Licence : This source is under MIT License
+// File : glm/gtx/vector_access.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_gtx_vector_access
+#define glm_gtx_vector_access
+
+// Dependency:
+#include "../glm.hpp"
+
+#if(defined(GLM_MESSAGES) && !defined(glm_ext))
+# pragma message("GLM: GLM_GTX_vector_access extension included")
+#endif
+
+namespace glm{
+namespace gtx{
+namespace vector_access ///< GLM_GTX_vector_access extension: Function to set values to vectors
+{
+ /// \addtogroup gtx_vector_access
+ /// @{
+
+ //! Set values to a 2 components vector.
+ //! From GLM_GTX_vector_access extension.
+ template <typename valType>
+ void set(
+ detail::tvec2<valType> & v,
+ valType const & x,
+ valType const & y);
+
+ //! Set values to a 3 components vector.
+ //! From GLM_GTX_vector_access extension.
+ template <typename valType>
+ void set(
+ detail::tvec3<valType> & v,
+ valType const & x,
+ valType const & y,
+ valType const & z);
+
+ //! Set values to a 4 components vector.
+ //! From GLM_GTX_vector_access extension.
+ template <typename valType>
+ void set(
+ detail::tvec4<valType> & v,
+ valType const & x,
+ valType const & y,
+ valType const & z,
+ valType const & w);
+
+ /// @}
+}//namespace vector_access
+}//namespace gtx
+}//namespace glm
+
+#include "vector_access.inl"
+
+namespace glm{using namespace gtx::vector_access;}
+
+#endif//glm_gtx_vector_access
diff --git a/src/glm/gtx/vector_access.inl b/src/glm/gtx/vector_access.inl
new file mode 100644
index 0000000..e375400
--- /dev/null
+++ b/src/glm/gtx/vector_access.inl
@@ -0,0 +1,58 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2006-01-16
+// Updated : 2008-10-07
+// Licence : This source is under MIT License
+// File : glm/gtx/vector_access.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm{
+namespace gtx{
+namespace vector_access{
+
+template <typename valType>
+GLM_FUNC_QUALIFIER void set
+(
+ detail::tvec2<valType>& v,
+ valType const & x,
+ valType const & y
+)
+{
+ v.x = x;
+ v.y = y;
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER void set
+(
+ detail::tvec3<valType>& v,
+ valType const & x,
+ valType const & y,
+ valType const & z
+)
+{
+ v.x = x;
+ v.y = y;
+ v.z = z;
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER void set
+(
+ detail::tvec4<valType>& v,
+ valType const & x,
+ valType const & y,
+ valType const & z,
+ valType const & w
+)
+{
+ v.x = x;
+ v.y = y;
+ v.z = z;
+ v.w = w;
+}
+
+}//namespace vector_access
+}//namespace gtx
+}//namespace glm
diff --git a/src/glm/gtx/vector_angle.hpp b/src/glm/gtx/vector_angle.hpp
new file mode 100644
index 0000000..f244c57
--- /dev/null
+++ b/src/glm/gtx/vector_angle.hpp
@@ -0,0 +1,72 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2005-12-30
+// Updated : 2006-11-13
+// Licence : This source is under MIT License
+// File : glm/gtx/vector_angle.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+// - GLM_GTX_quaternion
+// - GLM_GTX_epsilon
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_gtx_vector_angle
+#define glm_gtx_vector_angle
+
+// Dependency:
+#include "../glm.hpp"
+#include "../gtx/epsilon.hpp"
+#include "../gtx/quaternion.hpp"
+#include "../gtx/rotate_vector.hpp"
+
+#if(defined(GLM_MESSAGES) && !defined(glm_ext))
+# pragma message("GLM: GLM_GTX_vector_angle extension included")
+#endif
+
+namespace glm{
+namespace gtx{
+namespace vector_angle ///< GLM_GTX_vector_angle extension: Compute angle between vectors
+{
+ using namespace quaternion;
+ using namespace epsilon;
+
+ /// \addtogroup gtx_vector_angle
+ ///@{
+
+ //! Returns the absolute angle between two vectors
+ //! Parameters need to be normalized.
+ //! From GLM_GTX_vector_angle extension
+ template <typename vecType>
+ GLM_FUNC_QUALIFIER typename vecType::value_type angle(
+ vecType const & x,
+ vecType const & y);
+
+ //! Returns the oriented angle between two 2d vectors
+ //! Parameters need to be normalized.
+ //! From GLM_GTX_vector_angle extension.
+ template <typename T>
+ GLM_FUNC_QUALIFIER T orientedAngle(
+ detail::tvec2<T> const & x,
+ detail::tvec2<T> const & y);
+
+ //! Returns the oriented angle between two 3d vectors based from a reference axis.
+ //! Parameters need to be normalized.
+ //! From GLM_GTX_vector_angle extension.
+ template <typename T>
+ GLM_FUNC_QUALIFIER T orientedAngle(
+ detail::tvec3<T> const & x,
+ detail::tvec3<T> const & y,
+ detail::tvec3<T> const & ref);
+
+ /// @}
+}// namespace vector_angle
+}// namespace gtx
+}// namespace glm
+
+#include "vector_angle.inl"
+
+namespace glm{using namespace gtx::vector_angle;}
+
+#endif//glm_gtx_vector_angle
diff --git a/src/glm/gtx/vector_angle.inl b/src/glm/gtx/vector_angle.inl
new file mode 100644
index 0000000..658d185
--- /dev/null
+++ b/src/glm/gtx/vector_angle.inl
@@ -0,0 +1,58 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2005-12-30
+// Updated : 2008-09-29
+// Licence : This source is under MIT License
+// File : glm/gtx/vector_angle.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm{
+namespace gtx{
+namespace vector_angle{
+
+template <typename genType>
+GLM_FUNC_QUALIFIER typename genType::value_type angle
+(
+ genType const & x,
+ genType const & y
+)
+{
+ return degrees(acos(dot(x, y)));
+}
+
+//! \todo epsilon is hard coded to 0.01
+template <typename valType>
+GLM_FUNC_QUALIFIER valType orientedAngle
+(
+ detail::tvec2<valType> const & x,
+ detail::tvec2<valType> const & y
+)
+{
+ valType Angle = glm::degrees(acos(dot(x, y)));
+ detail::tvec2<valType> TransformedVector = glm::gtx::rotate_vector::rotate(x, Angle);
+ if(all(equalEpsilon(y, TransformedVector, valType(0.01))))
+ return Angle;
+ else
+ return -Angle;
+}
+
+template <typename valType>
+GLM_FUNC_QUALIFIER valType orientedAngle
+(
+ detail::tvec3<valType> const & x,
+ detail::tvec3<valType> const & y,
+ detail::tvec3<valType> const & ref
+)
+{
+ valType Angle = glm::degrees(glm::acos(glm::dot(x, y)));
+
+ if(glm::dot(ref, glm::cross(x, y)) < valType(0))
+ return -Angle;
+ else
+ return Angle;
+}
+
+}//namespace vector_angle
+}//namespace gtx
+}//namespace glm
diff --git a/src/glm/gtx/vector_query.hpp b/src/glm/gtx/vector_query.hpp
new file mode 100644
index 0000000..f1e6d22
--- /dev/null
+++ b/src/glm/gtx/vector_query.hpp
@@ -0,0 +1,95 @@
+ ///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2007-03-05
+// Updated : 2007-03-05
+// Licence : This source is under MIT License
+// File : glm/gtx/vector_query.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_gtx_vector_query
+#define glm_gtx_vector_query
+
+// Dependency:
+#include "../glm.hpp"
+#include <cfloat>
+#include <limits>
+
+#if(defined(GLM_MESSAGES) && !defined(glm_ext))
+# pragma message("GLM: GLM_GTX_vector_query extension included")
+#endif
+
+namespace glm{
+namespace gtx{
+namespace vector_query ///< GLM_GTX_vector_query extension: Query informations of vector types
+{
+ /// \addtogroup gtx_vector_query
+ /// @{
+
+ //! Check if two vectors are collinears.
+ //! From GLM_GTX_vector_query extensions.
+ template <typename genType>
+ bool areCollinear(
+ genType const & v0,
+ genType const & v1,
+ typename genType::value_type const & epsilon = std::numeric_limits<typename genType::value_type>::epsilon());
+
+ //! Check if two vectors are opposites.
+ //! From GLM_GTX_vector_query extensions.
+ template <typename genType>
+ bool areOpposite(
+ genType const & v0,
+ genType const & v1,
+ typename genType::value_type const & epsilon = std::numeric_limits<typename genType::value_type>::epsilon());
+
+ //! Check if two vectors are orthogonals.
+ //! From GLM_GTX_vector_query extensions.
+ template <typename genType>
+ bool areOrthogonal(
+ genType const & v0,
+ genType const & v1,
+ typename genType::value_type const & epsilon = std::numeric_limits<typename genType::value_type>::epsilon());
+
+ //! Check if a vector is normalized.
+ //! From GLM_GTX_vector_query extensions.
+ template <typename genType>
+ bool isNormalized(
+ genType const & v,
+ typename genType::value_type const & epsilon = std::numeric_limits<typename genType::value_type>::epsilon());
+
+ //! Check if a vector is null.
+ //! From GLM_GTX_vector_query extensions.
+ template <typename genType>
+ bool isNull(
+ genType const & v,
+ typename genType::value_type const & epsilon = std::numeric_limits<typename genType::value_type>::epsilon());
+
+ //! Check if two vectors are orthonormal.
+ //! From GLM_GTX_vector_query extensions.
+ template <typename genType>
+ bool areOrthonormal(
+ genType const & v0,
+ genType const & v1,
+ typename genType::value_type const & epsilon = std::numeric_limits<typename genType::value_type>::epsilon());
+
+ //! Check if two vectors are similar.
+ //! From GLM_GTX_vector_query extensions.
+ template <typename genType>
+ bool areSimilar(
+ genType const & v0,
+ genType const & v1,
+ typename genType::value_type const & epsilon = std::numeric_limits<typename genType::value_type>::epsilon());
+
+ /// @}
+}// namespace vector_query
+}// namespace gtx
+}// namespace glm
+
+#include "vector_query.inl"
+
+namespace glm{using namespace gtx::vector_query;}
+
+#endif//glm_gtx_vector_query
diff --git a/src/glm/gtx/vector_query.inl b/src/glm/gtx/vector_query.inl
new file mode 100644
index 0000000..da96556
--- /dev/null
+++ b/src/glm/gtx/vector_query.inl
@@ -0,0 +1,174 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2007-03-05
+// Updated : 2010-02-16
+// Licence : This source is under MIT License
+// File : glm/gtx/vector_query.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <cassert>
+
+namespace glm{
+namespace gtx{
+namespace vector_query
+{
+ template <typename T>
+ GLM_FUNC_QUALIFIER bool areCollinear
+ (
+ detail::tvec2<T> const & v0,
+ detail::tvec2<T> const & v1,
+ T const & epsilon
+ )
+ {
+ return length(cross(detail::tvec3<T>(v0, T(0)), detail::tvec3<T>(v1, T(0)))) < epsilon;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER bool areCollinear
+ (
+ detail::tvec3<T> const & v0,
+ detail::tvec3<T> const & v1,
+ T const & epsilon
+ )
+ {
+ return length(cross(v0, v1)) < epsilon;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER bool areCollinear
+ (
+ detail::tvec4<T> const & v0,
+ detail::tvec4<T> const & v1,
+ T const & epsilon
+ )
+ {
+ return length(cross(detail::tvec3<T>(v0), detail::tvec3<T>(v1))) < epsilon;
+ }
+
+ template <typename genType>
+ GLM_FUNC_QUALIFIER bool areOpposite
+ (
+ genType const & v0,
+ genType const & v1,
+ typename genType::value_type const & epsilon
+ )
+ {
+ assert(isNormalized(v0) && isNormalized(v1));
+ return((typename genType::value_type(1) + dot(v0, v1)) <= epsilon);
+ }
+
+ template <typename genType>
+ GLM_FUNC_QUALIFIER bool areOrthogonal
+ (
+ genType const & v0,
+ genType const & v1,
+ typename genType::value_type const & epsilon
+ )
+ {
+ return abs(dot(v0, v1)) <= max(
+ typename genType::value_type(1),
+ length(v0)) * max(
+ typename genType::value_type(1),
+ length(v1)) * epsilon;
+ }
+
+ template <typename genType>
+ GLM_FUNC_QUALIFIER bool isNormalized
+ (
+ genType const & v,
+ typename genType::value_type const & epsilon
+ )
+ {
+ return abs(length(v) - typename genType::value_type(1)) <= typename genType::value_type(2) * epsilon;
+ }
+
+ template <typename genType>
+ GLM_FUNC_QUALIFIER bool isNull
+ (
+ genType const & v,
+ typename genType::value_type const & epsilon
+ )
+ {
+ return length(v) <= epsilon;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER bool isCompNull
+ (
+ T const & s,
+ T const & epsilon
+ )
+ {
+ return abs(s) < epsilon;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<bool> isCompNull
+ (
+ detail::tvec2<T> const & v,
+ T const & epsilon)
+ {
+ return detail::tvec2<bool>(
+ (abs(v.x) < epsilon),
+ (abs(v.y) < epsilon));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<bool> isCompNull
+ (
+ detail::tvec3<T> const & v,
+ T const & epsilon
+ )
+ {
+ return detail::tvec3<bool>(
+ abs(v.x) < epsilon,
+ abs(v.y) < epsilon,
+ abs(v.z) < epsilon);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<bool> isCompNull
+ (
+ detail::tvec4<T> const & v,
+ T const & epsilon
+ )
+ {
+ return detail::tvec4<bool>(
+ abs(v.x) < epsilon,
+ abs(v.y) < epsilon,
+ abs(v.z) < epsilon,
+ abs(v.w) < epsilon);
+ }
+
+ template <typename genType>
+ GLM_FUNC_QUALIFIER bool areOrthonormal
+ (
+ genType const & v0,
+ genType const & v1,
+ typename genType::value_type const & epsilon
+ )
+ {
+ return isNormalized(v0, epsilon) && isNormalized(v1, epsilon) && (abs(dot(v0, v1)) <= epsilon);
+ }
+
+ template <typename genType>
+ GLM_FUNC_QUALIFIER bool areSimilar
+ (
+ genType const & v0,
+ genType const & v1,
+ typename genType::value_type const & epsilon
+ )
+ {
+ bool similar = true;
+ for(typename genType::size_type i = 0; similar && i < genType::value_size(); i++)
+ similar = (abs(v0[i] - v1[i]) <= epsilon);
+ return similar;
+ }
+
+}//namespace vector_query
+}//namespace gtx
+}//namespace glm
diff --git a/src/glm/gtx/verbose_operator.hpp b/src/glm/gtx/verbose_operator.hpp
new file mode 100644
index 0000000..7411aeb
--- /dev/null
+++ b/src/glm/gtx/verbose_operator.hpp
@@ -0,0 +1,64 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2007-05-21
+// Updated : 2007-05-21
+// Licence : This source is under MIT License
+// File : glm/gtx/verbose_operator.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_gtx_verbose_operator
+#define glm_gtx_verbose_operator
+
+// Dependency:
+#include "../glm.hpp"
+
+#if(defined(GLM_MESSAGES) && !defined(glm_ext))
+# pragma message("GLM: GLM_GTX_verbose_operator extension included")
+#endif
+
+namespace glm{
+namespace gtx{
+namespace verbose_operator ///< GLM_GTX_verbose_operator extension: Use words to replace operators
+{
+ /// \addtogroup gtx_verbose_operator
+ /// @{
+
+ //! Addition of two values
+ //! From GLM_GTX_verbose_operator extension.
+ template <typename genTypeT, typename genTypeU>
+ genTypeT add(genTypeT const & a, genTypeU const & b);
+
+ //! Substration of two values
+ //! From GLM_GTX_verbose_operator extension.
+ template <typename genTypeT, typename genTypeU>
+ genTypeT sub(genTypeT const & a, genTypeU const & b);
+
+ //! Multiplication of two values
+ //! From GLM_GTX_verbose_operator extension.
+ template <typename genTypeT, typename genTypeU>
+ genTypeT mul(genTypeT const & a, genTypeU const & b);
+
+ //! Division of two values
+ //! From GLM_GTX_verbose_operator extension.
+ template <typename genTypeT, typename genTypeU>
+ genTypeT div(genTypeT const & a, genTypeU const & b);
+
+ //! Multiplication and addition of three values
+ //! From GLM_GTX_verbose_operator extension.
+ template <typename genTypeT, typename genTypeU, typename genTypeV>
+ genTypeT mad(genTypeT const & a, genTypeU const & b, genTypeV const & c);
+
+ /// @}
+}// namespace verbose_operator
+}// namespace gtx
+}// namespace glm
+
+#include "verbose_operator.inl"
+
+namespace glm{using namespace gtx::verbose_operator;}
+
+#endif//glm_gtx_verbose_operator
diff --git a/src/glm/gtx/verbose_operator.inl b/src/glm/gtx/verbose_operator.inl
new file mode 100644
index 0000000..205932b
--- /dev/null
+++ b/src/glm/gtx/verbose_operator.inl
@@ -0,0 +1,129 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2006-04-20
+// Updated : 2008-09-29
+// Licence : This source is under MIT License
+// File : glm/gtx/verbose_operator.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm{
+namespace gtx{
+namespace verbose_operator{
+
+template <typename genType>
+GLM_FUNC_QUALIFIER genType add(genType const & a, genType const & b)
+{
+ return a + b;
+}
+
+template <typename genType>
+GLM_FUNC_QUALIFIER genType sub(genType const & a, genType const & b)
+{
+ return a - b;
+}
+
+template <typename T>
+GLM_FUNC_QUALIFIER detail::tmat2x2<T> mul
+(
+ detail::tmat2x2<T> const & a,
+ detail::tmat2x2<T> const & b
+)
+{
+ return a * b;
+}
+
+template <typename T>
+GLM_FUNC_QUALIFIER detail::tmat3x3<T> mul
+(
+ detail::tmat3x3<T> const & a,
+ detail::tmat3x3<T> const & b
+)
+{
+ return a * b;
+}
+
+template <typename T>
+GLM_FUNC_QUALIFIER detail::tmat4x4<T> mul
+(
+ detail::tmat4x4<T> const & a,
+ detail::tmat4x4<T> const & b
+)
+{
+ return a * b;
+}
+
+template <typename T>
+GLM_FUNC_QUALIFIER detail::tvec2<T> mul
+(
+ detail::tmat2x2<T> const & m,
+ detail::tvec2<T> const & v
+)
+{
+ return m * v;
+}
+
+template <typename T>
+GLM_FUNC_QUALIFIER detail::tvec3<T> mul
+(
+ detail::tmat3x3<T> const & m,
+ detail::tvec3<T> const & v)
+{
+ return m * v;
+}
+
+template <typename T>
+GLM_FUNC_QUALIFIER detail::tvec4<T> mul
+(
+ detail::tmat4x4<T> const & m,
+ detail::tvec4<T> const & v
+)
+{
+ return m * v;
+}
+
+template <typename T>
+GLM_FUNC_QUALIFIER detail::tvec2<T> mul
+(
+ detail::tvec2<T> const & v,
+ detail::tmat2x2<T> const & m
+)
+{
+ return v * m;
+}
+
+template <typename T>
+GLM_FUNC_QUALIFIER detail::tvec3<T> mul
+(
+ detail::tvec3<T> const & v,
+ detail::tmat3x3<T> const & m
+)
+{
+ return v * m;
+}
+
+template <typename T>
+GLM_FUNC_QUALIFIER detail::tvec4<T> mul
+(
+ detail::tvec4<T> const & v,
+ detail::tmat4x4<T> const & m
+)
+{
+ return v * m;
+}
+
+template <typename genType>
+GLM_FUNC_QUALIFIER genType div(genType const & a, genType const & b)
+{
+ return a / b;
+}
+
+template <typename genTypeT, typename genTypeU, typename genTypeV>
+GLM_FUNC_QUALIFIER genTypeT mad(genTypeT const & a, genTypeU const & b, genTypeV const & c)
+{
+ return a * b + c;
+}
+
+}//namespace verbose_operator
+}//namespace gtx
+}//namespace glm
diff --git a/src/glm/gtx/wrap.hpp b/src/glm/gtx/wrap.hpp
new file mode 100644
index 0000000..1ca3a0a
--- /dev/null
+++ b/src/glm/gtx/wrap.hpp
@@ -0,0 +1,54 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2009-11-25
+// Updated : 2009-11-25
+// Licence : This source is under MIT License
+// File : glm/gtx/wrap.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_gtx_wrap
+#define glm_gtx_wrap
+
+// Dependency:
+#include "../glm.hpp"
+
+#if(defined(GLM_MESSAGES) && !defined(glm_ext))
+# pragma message("GLM: GLM_GTX_wrap extension included")
+#endif
+
+namespace glm{
+namespace gtx{
+namespace wrap ///< GLM_GTX_wrap: Wrapping mode using my texture samping.
+{
+ /// \addtogroup gtx_wrap
+ /// @{
+
+ //! Simulate GL_CLAMP OpenGL wrap mode
+ //! From GLM_GTX_wrap extension.
+ template <typename genType>
+ genType clamp(genType const & Texcoord);
+
+ //! Simulate GL_REPEAT OpenGL wrap mode
+ //! From GLM_GTX_wrap extension.
+ template <typename genType>
+ genType repeat(genType const & Texcoord);
+
+ //! Simulate GL_MIRROR_REPEAT OpenGL wrap mode
+ //! From GLM_GTX_wrap extension.
+ template <typename genType>
+ genType mirrorRepeat(genType const & Texcoord);
+
+ /// @}
+}// namespace wrap
+}// namespace gtx
+}// namespace glm
+
+#include "wrap.inl"
+
+namespace glm{using namespace gtx::wrap;}
+
+#endif//glm_img_wrap
diff --git a/src/glm/gtx/wrap.inl b/src/glm/gtx/wrap.inl
new file mode 100644
index 0000000..a687ded
--- /dev/null
+++ b/src/glm/gtx/wrap.inl
@@ -0,0 +1,173 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2009-11-25
+// Updated : 2010-02-13
+// Licence : This source is under MIT License
+// File : glm/gtx/wrap.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm{
+namespace gtx{
+namespace wrap
+{
+ ////////////////////////
+ // clamp
+
+ template <typename genType>
+ GLM_FUNC_QUALIFIER genType clamp
+ (
+ genType const & Texcoord
+ )
+ {
+ return glm::clamp(Texcoord, genType(0), genType(1));
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> clamp
+ (
+ detail::tvec2<T> const & Texcoord
+ )
+ {
+ detail::tvec2<T> Result;
+ for(typename detail::tvec2<T>::size_type i = 0; i < detail::tvec2<T>::value_size(); ++i)
+ Result[i] = clamp(Texcoord[i]);
+ return Result;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> clamp
+ (
+ detail::tvec3<T> const & Texcoord
+ )
+ {
+ detail::tvec3<T> Result;
+ for(typename detail::tvec3<T>::size_type i = 0; i < detail::tvec3<T>::value_size(); ++i)
+ Result[i] = clamp(Texcoord[i]);
+ return Result;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> clamp
+ (
+ detail::tvec4<T> const & Texcoord
+ )
+ {
+ detail::tvec4<T> Result;
+ for(typename detail::tvec4<T>::size_type i = 0; i < detail::tvec4<T>::value_size(); ++i)
+ Result[i] = clamp(Texcoord[i]);
+ return Result;
+ }
+
+ ////////////////////////
+ // repeat
+
+ template <typename genType>
+ GLM_FUNC_QUALIFIER genType repeat
+ (
+ genType const & Texcoord
+ )
+ {
+ return glm::fract(Texcoord);
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> repeat
+ (
+ detail::tvec2<T> const & Texcoord
+ )
+ {
+ detail::tvec2<T> Result;
+ for(typename detail::tvec2<T>::size_type i = 0; i < detail::tvec2<T>::value_size(); ++i)
+ Result[i] = repeat(Texcoord[i]);
+ return Result;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> repeat
+ (
+ detail::tvec3<T> const & Texcoord
+ )
+ {
+ detail::tvec3<T> Result;
+ for(typename detail::tvec3<T>::size_type i = 0; i < detail::tvec3<T>::value_size(); ++i)
+ Result[i] = repeat(Texcoord[i]);
+ return Result;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> repeat
+ (
+ detail::tvec4<T> const & Texcoord
+ )
+ {
+ detail::tvec4<T> Result;
+ for(typename detail::tvec4<T>::size_type i = 0; i < detail::tvec4<T>::value_size(); ++i)
+ Result[i] = repeat(Texcoord[i]);
+ return Result;
+ }
+
+ ////////////////////////
+ // mirrorRepeat
+
+ template <typename genType>
+ GLM_FUNC_QUALIFIER genType mirrorRepeat
+ (
+ genType const & Texcoord
+ )
+ {
+ genType const Clamp = genType(int(glm::floor(Texcoord)) % 2);
+ genType const Floor = glm::floor(Texcoord);
+ genType const Rest = Texcoord - Floor;
+ genType const Mirror = Clamp + Rest;
+
+ genType Out;
+ if(Mirror >= genType(1))
+ Out = genType(1) - Rest;
+ else
+ Out = Rest;
+ return Out;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec2<T> mirrorRepeat
+ (
+ detail::tvec2<T> const & Texcoord
+ )
+ {
+ detail::tvec2<T> Result;
+ for(typename detail::tvec2<T>::size_type i = 0; i < detail::tvec2<T>::value_size(); ++i)
+ Result[i] = mirrorRepeat(Texcoord[i]);
+ return Result;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec3<T> mirrorRepeat
+ (
+ detail::tvec3<T> const & Texcoord
+ )
+ {
+ detail::tvec3<T> Result;
+ for(typename detail::tvec3<T>::size_type i = 0; i < detail::tvec3<T>::value_size(); ++i)
+ Result[i] = mirrorRepeat(Texcoord[i]);
+ return Result;
+ }
+
+ template <typename T>
+ GLM_FUNC_QUALIFIER detail::tvec4<T> mirrorRepeat
+ (
+ detail::tvec4<T> const & Texcoord
+ )
+ {
+ detail::tvec4<T> Result;
+ for(typename detail::tvec4<T>::size_type i = 0; i < detail::tvec4<T>::value_size(); ++i)
+ Result[i] = mirrorRepeat(Texcoord[i]);
+ return Result;
+ }
+
+}//namespace wrap
+}//namespace gtx
+}//namespace glm
diff --git a/src/glm/virtrev/xstream.hpp b/src/glm/virtrev/xstream.hpp
new file mode 100644
index 0000000..2b8b95a
--- /dev/null
+++ b/src/glm/virtrev/xstream.hpp
@@ -0,0 +1,148 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+// Virtrev SDK copyright matrem (matrem84.free.fr)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2008-05-24
+// Updated : 2008-05-26
+// Licence : This source is under MIT License
+// File : glm/ext/virtrev/xstream.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+// - GLM_GTX_matrix_selection
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef GLM_EXT_VIRTREV_XSTREAM_HPP
+#define GLM_EXT_VIRTREV_XSTREAM_HPP
+
+#include "../glm.hpp"
+#include "../gtc/matrix_access.hpp"
+#include <iostream>
+
+#if(defined(GLM_MESSAGES) && !defined(glm_ext))
+# pragma message("GLM: GLM_VIRTREV_xstream extension included")
+#endif
+
+namespace glm
+{
+ namespace virtrev_glmext
+ {
+ //! GLM_VIRTREV_xstream extension: Streaming vector and matrix in a xml way
+ namespace xstream
+ {
+ template<typename T>
+ std::ostream & operator << (std::ostream & stream, glm::detail::tvec2<T> const & vec)
+ {
+ stream << "<glm_vec2 ";
+ stream << "x=\"" << vec.x << "\" ";
+ stream << "y=\"" << vec.y << "\" ";
+ stream << "/>";
+
+ return stream;
+ }
+
+ template<typename T>
+ std::ostream & operator << (std::ostream & stream, glm::detail::tvec3<T> const & vec)
+ {
+ stream << "<glm_vec3 ";
+ stream << "x=\"" << vec.x << "\" ";
+ stream << "y=\"" << vec.y << "\" ";
+ stream << "z=\"" << vec.z << "\" ";
+ stream << "/>";
+
+ return stream;
+ }
+
+ template<typename T>
+ std::ostream & operator << (std::ostream & stream, glm::detail::tvec4<T> const & vec)
+ {
+ stream << "<glm_vec4 ";
+ stream << "x=\"" << vec.x << "\" ";
+ stream << "y=\"" << vec.y << "\" ";
+ stream << "z=\"" << vec.z << "\" ";
+ stream << "w=\"" << vec.w << "\" ";
+ stream << "/>";
+
+ return stream;
+ }
+
+ template<typename T>
+ std::ostream & operator << (std::ostream & stream, glm::detail::tmat2x2<T> const & mat)
+ {
+ stream << "<glm_mat2>" << std::endl;
+ stream << "<row ";
+ stream << "x=\"" << glm::row(mat, 0)[0] << "\" ";
+ stream << "y=\"" << glm::row(mat, 0)[1] << "\" ";
+ stream << "/>" << std::endl;
+ stream << "<row ";
+ stream << "x=\"" << glm::row(mat, 1)[0] << "\" ";
+ stream << "y=\"" << glm::row(mat, 1)[1] << "\" ";
+ stream << "/>" << std::endl;
+ stream << "</glm_mat2>";
+
+ return stream;
+ }
+
+ template<typename T>
+ std::ostream & operator << (std::ostream & stream, glm::detail::tmat3x3<T> const & mat)
+ {
+ stream << "<glm_mat3>" << std::endl;
+ stream << "<row ";
+ stream << "x=\"" << glm::row(mat, 0)[0] << "\" ";
+ stream << "y=\"" << glm::row(mat, 0)[1] << "\" ";
+ stream << "z=\"" << glm::row(mat, 0)[2] << "\" ";
+ stream << "/>" << std::endl;
+ stream << "<row ";
+ stream << "x=\"" << glm::row(mat, 1)[0] << "\" ";
+ stream << "y=\"" << glm::row(mat, 1)[1] << "\" ";
+ stream << "z=\"" << glm::row(mat, 1)[2] << "\" ";
+ stream << "/>" << std::endl;
+ stream << "<row ";
+ stream << "x=\"" << glm::row(mat, 2)[0] << "\" ";
+ stream << "y=\"" << glm::row(mat, 2)[1] << "\" ";
+ stream << "z=\"" << glm::row(mat, 2)[2] << "\" ";
+ stream << "/>" << std::endl;
+ stream << "</glm_mat3>";
+
+ return stream;
+ }
+
+ template<typename T>
+ std::ostream & operator << (std::ostream & stream, glm::detail::tmat4x4<T> const & mat)
+ {
+ stream << "<glm_mat4>" << std::endl;
+ stream << "<row ";
+ stream << "x=\"" << glm::row(mat, 0)[0] << "\" ";
+ stream << "y=\"" << glm::row(mat, 0)[1] << "\" ";
+ stream << "z=\"" << glm::row(mat, 0)[2] << "\" ";
+ stream << "w=\"" << glm::row(mat, 0)[3] << "\" ";
+ stream << "/>" << std::endl;
+ stream << "<row ";
+ stream << "x=\"" << glm::row(mat, 1)[0] << "\" ";
+ stream << "y=\"" << glm::row(mat, 1)[1] << "\" ";
+ stream << "z=\"" << glm::row(mat, 1)[2] << "\" ";
+ stream << "w=\"" << glm::row(mat, 1)[3] << "\" ";
+ stream << "/>" << std::endl;
+ stream << "<row ";
+ stream << "x=\"" << glm::row(mat, 2)[0] << "\" ";
+ stream << "y=\"" << glm::row(mat, 2)[1] << "\" ";
+ stream << "z=\"" << glm::row(mat, 2)[2] << "\" ";
+ stream << "w=\"" << glm::row(mat, 2)[3] << "\" ";
+ stream << "/>" << std::endl;
+ stream << "<row ";
+ stream << "x=\"" << glm::row(mat, 3)[0] << "\" ";
+ stream << "y=\"" << glm::row(mat, 3)[1] << "\" ";
+ stream << "z=\"" << glm::row(mat, 3)[2] << "\" ";
+ stream << "w=\"" << glm::row(mat, 3)[3] << "\" ";
+ stream << "/>" << std::endl;
+ stream << "</glm_mat4>";
+
+ return stream;
+ }
+ }
+ }
+}
+
+namespace glm{using namespace glm::virtrev_glmext::xstream;}
+
+#endif//GLM_EXT_VIRTREV_XSTREAM_HPP
diff --git a/src/graphics/AppleDisplay.cpp b/src/graphics/AppleDisplay.cpp
new file mode 100644
index 0000000..eb8ab0c
--- /dev/null
+++ b/src/graphics/AppleDisplay.cpp
@@ -0,0 +1,75 @@
+//
+// 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 "AppleDisplay.h"
+#include "../base/Logger.h"
+
+#include <ApplicationServices/ApplicationServices.h>
+
+#include <iostream>
+
+using namespace std;
+
+namespace avg {
+
+AppleDisplay::AppleDisplay()
+{
+}
+
+AppleDisplay::~AppleDisplay()
+{
+}
+
+float AppleDisplay::queryPPMM()
+{
+ CGSize size = CGDisplayScreenSize(CGMainDisplayID());
+ return getScreenResolution().x/size.width;
+}
+
+float AppleDisplay::queryRefreshRate()
+{
+ float refreshRate;
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6
+ CGDisplayModeRef mode = CGDisplayCopyDisplayMode(CGMainDisplayID());
+ refreshRate = CGDisplayModeGetRefreshRate(mode);
+ if (refreshRate < 1.0) {
+ AVG_TRACE(Logger::category::CONFIG, Logger::severity::INFO,
+ "This seems to be a TFT screen, assuming 60 Hz refresh rate.");
+ refreshRate = 60;
+ }
+ CGDisplayModeRelease(mode);
+#else
+ CFDictionaryRef modeInfo = CGDisplayCurrentMode(CGMainDisplayID());
+ AVG_ASSERT(modeInfo);
+ CFNumberRef value = (CFNumberRef) CFDictionaryGetValue(modeInfo,
+ kCGDisplayRefreshRate);
+ AVG_ASSERT(value);
+ CFNumberGetValue(value, kCFNumberIntType, &refreshRate);
+ if (refreshRate < 1.0) {
+ AVG_TRACE(Logger::category::CONFIG, Logger::severity::INFO,
+ "This seems to be a TFT screen, assuming 60 Hz refresh rate.");
+ refreshRate = 60;
+ }
+#endif
+ return refreshRate;
+}
+
+}
diff --git a/src/graphics/AppleDisplay.h b/src/graphics/AppleDisplay.h
new file mode 100644
index 0000000..dcae299
--- /dev/null
+++ b/src/graphics/AppleDisplay.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 _AppleDisplay_H_
+#define _AppleDisplay_H_
+
+#include "../api.h"
+#include "../avgconfigwrapper.h"
+
+#include "Display.h"
+
+namespace avg {
+
+class AVG_API AppleDisplay: public Display
+{
+public:
+ AppleDisplay();
+ virtual ~AppleDisplay();
+
+protected:
+ virtual float queryPPMM();
+ virtual float queryRefreshRate();
+
+};
+
+}
+
+#endif
diff --git a/src/graphics/BCMDisplay.cpp b/src/graphics/BCMDisplay.cpp
new file mode 100644
index 0000000..917e0e6
--- /dev/null
+++ b/src/graphics/BCMDisplay.cpp
@@ -0,0 +1,142 @@
+//
+// 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 "BCMDisplay.h"
+
+#include "../base/Exception.h"
+
+#include <SDL/SDL.h>
+#include <SDL/SDL_syswm.h>
+
+#include <EGL/eglext_brcm.h>
+
+#include <iostream>
+
+using namespace std;
+
+namespace avg {
+
+IntPoint getX11WindowPosition(const SDL_SysWMinfo* pSDLWMInfo)
+{
+ int x, y;
+ Window dummy;
+ XWindowAttributes wAttribs;
+ pSDLWMInfo->info.x11.lock_func();
+ XGetWindowAttributes(pSDLWMInfo->info.x11.display, pSDLWMInfo->info.x11.window,
+ &wAttribs);
+ XTranslateCoordinates(pSDLWMInfo->info.x11.display, pSDLWMInfo->info.x11.window,
+ wAttribs.root, 0, 0, &x, &y, &dummy);
+ pSDLWMInfo->info.x11.unlock_func();
+ return IntPoint(x, y);
+}
+
+DISPMANX_DISPLAY_HANDLE_T getBCMDisplay(const SDL_SysWMinfo* pSDLWMInfo)
+{
+ bcm_host_init();
+
+ DISPMANX_DISPLAY_HANDLE_T display = vc_dispmanx_display_open(DISPMANX_ID_MAIN_LCD);
+ if (display == DISPMANX_NO_HANDLE) {
+ throw Exception(AVG_ERR_VIDEO_GENERAL, "No BCM display available.");
+ }
+ return display;
+}
+
+EGL_DISPMANX_WINDOW_T* createChildWindow(const SDL_SysWMinfo* pSDLWMInfo,
+ EGLNativeDisplayType bcmDisplay, const IntPoint& windowSize)
+{
+ // Create a child (yet toplevel) window with the required attributes to render into.
+ IntPoint windowPos = getX11WindowPosition(pSDLWMInfo);
+ VC_RECT_T dstRect;
+ dstRect.x = windowPos.x;
+ dstRect.y = windowPos.y;
+ dstRect.width = windowSize.x;
+ dstRect.height = windowSize.y;
+ VC_RECT_T srcRect;
+ srcRect.x = 0;
+ srcRect.y = 0;
+ srcRect.width = windowSize.x << 16;
+ srcRect.height = windowSize.y << 16;
+ // start display update
+ DISPMANX_UPDATE_HANDLE_T update = vc_dispmanx_update_start(0);
+ if (update == DISPMANX_NO_HANDLE) {
+ throw Exception(AVG_ERR_VIDEO_GENERAL, "Failed to start BCM display update.");
+ }
+ // add element to display
+ DISPMANX_ELEMENT_HANDLE_T element = vc_dispmanx_element_add(update,
+ (DISPMANX_DISPLAY_HANDLE_T)bcmDisplay,
+ 0 /* layer */, &dstRect, DISPMANX_NO_HANDLE /* src */, &srcRect,
+ (DISPMANX_PROTECTION_T) DISPMANX_PROTECTION_NONE,
+ 0 /* alpha */, 0 /* clamp */, DISPMANX_NO_ROTATE);
+ if (element == DISPMANX_NO_HANDLE) {
+ throw Exception(AVG_ERR_VIDEO_GENERAL, "Failed to add element to BCM display.");
+ }
+ // finish display update
+ if (vc_dispmanx_update_submit_sync(update)) {
+ throw Exception(AVG_ERR_VIDEO_GENERAL, "Failed to finish BCM display update.");
+ }
+
+ EGL_DISPMANX_WINDOW_T* pWin = new EGL_DISPMANX_WINDOW_T; // XXX: destroy
+ pWin->element = element;
+ pWin->width = windowSize.x;
+ pWin->height = windowSize.y;
+ return pWin;
+}
+
+EGLSurface createBCMPixmapSurface(EGLDisplay display, EGLConfig config)
+{
+ EGLint pixel_format = EGL_PIXEL_FORMAT_ARGB_8888_BRCM;
+ EGLint rt;
+ eglGetConfigAttrib(display, config, EGL_RENDERABLE_TYPE, &rt);
+
+ if (rt & EGL_OPENGL_ES_BIT) {
+ pixel_format |= EGL_PIXEL_FORMAT_RENDER_GLES_BRCM;
+ pixel_format |= EGL_PIXEL_FORMAT_GLES_TEXTURE_BRCM;
+ }
+ if (rt & EGL_OPENGL_ES2_BIT) {
+ pixel_format |= EGL_PIXEL_FORMAT_RENDER_GLES2_BRCM;
+ pixel_format |= EGL_PIXEL_FORMAT_GLES2_TEXTURE_BRCM;
+ }
+ if (rt & EGL_OPENVG_BIT) {
+ pixel_format |= EGL_PIXEL_FORMAT_RENDER_VG_BRCM;
+ pixel_format |= EGL_PIXEL_FORMAT_VG_IMAGE_BRCM;
+ }
+ if (rt & EGL_OPENGL_BIT) {
+ pixel_format |= EGL_PIXEL_FORMAT_RENDER_GL_BRCM;
+ }
+
+ EGLint pixmap[5];
+ pixmap[0] = 0;
+ pixmap[1] = 0;
+ pixmap[2] = 8;
+ pixmap[3] = 8;
+ pixmap[4] = pixel_format;
+
+ eglCreateGlobalImageBRCM(8, 8, pixel_format, 0, 8*4, pixmap);
+
+ EGLSurface surface = eglCreatePixmapSurface(display, config, pixmap, 0);
+ if ( surface == EGL_NO_SURFACE ) {
+ cerr << "Unable to create EGL surface (eglError: " << eglGetError() << ")" << endl;
+ }
+ return surface;
+
+}
+
+}
diff --git a/src/graphics/OGLImagingContext.h b/src/graphics/BCMDisplay.h
index 8a5f962..4c750dd 100644
--- a/src/graphics/OGLImagingContext.h
+++ b/src/graphics/BCMDisplay.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -18,41 +18,28 @@
//
// Current versions can be found at www.libavg.de
//
-#ifndef _OGLImagingContext_H_
-#define _OGLImagingContext_H_
+#ifndef _BCMDisplay_H_
+#define _BCMDisplay_H_
+
+#include <bcm_host.h>
+
#include "../api.h"
-#include "../base/Point.h"
+
+#include "../base/GLMHelper.h"
#include "OGLHelper.h"
-#include "GLContext.h"
-
-#ifdef __APPLE__
-#include <AGL/agl.h>
-#else
-#ifdef linux
-#include <GL/glx.h>
-#else
-#ifdef _WIN32
-#include <gl/gl.h>
-#include <gl/glu.h>
-#endif
-#endif
-#endif
-namespace avg {
+struct SDL_SysWMinfo;
-class AVG_API OGLImagingContext: public GLContext {
-public:
- OGLImagingContext();
- virtual ~OGLImagingContext();
+namespace avg {
- bool isSupported();
+DISPMANX_DISPLAY_HANDLE_T getBCMDisplay(const SDL_SysWMinfo* pSDLWMInfo);
-private:
- void setStandardState();
+EGL_DISPMANX_WINDOW_T* createChildWindow(const SDL_SysWMinfo* pSDLWMInfo,
+ EGLNativeDisplayType bcmDisplay, const IntPoint& windowSize);
+EGLSurface createBCMPixmapSurface(EGLDisplay display, EGLConfig config);
-};
}
-#endif
+#endif
diff --git a/src/graphics/Bitmap.cpp b/src/graphics/Bitmap.cpp
index 1755fd0..63b4115 100644
--- a/src/graphics/Bitmap.cpp
+++ b/src/graphics/Bitmap.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -47,9 +47,7 @@ namespace avg {
template<class Pixel>
void createTrueColorCopy(Bitmap& destBmp, const Bitmap & srcBmp);
-bool Bitmap::s_bGTKInitialized = false;
-
-Bitmap::Bitmap(DPoint size, PixelFormat pf, const UTF8String& sName, int stride)
+Bitmap::Bitmap(glm::vec2 size, PixelFormat pf, const UTF8String& sName, int stride)
: m_Size(size),
m_PF(pf),
m_pBits(0),
@@ -118,73 +116,17 @@ Bitmap::Bitmap(Bitmap& origBmp, const IntRect& rect)
AVG_ASSERT(rect.br.x <= origBmp.getSize().x);
AVG_ASSERT(rect.br.y <= origBmp.getSize().y);
AVG_ASSERT(rect.tl.x >= 0 && rect.tl.y >= 0);
+ AVG_ASSERT(rect.width() > 0 && rect.height() > 0);
if (!origBmp.getName().empty()) {
m_sName = origBmp.getName()+" part";
} else {
m_sName = "";
}
- unsigned char * pRegionStart = origBmp.getPixels()+rect.tl.y*origBmp.getStride()+
- rect.tl.x*getBytesPerPixel();
+ unsigned char * pRegionStart = origBmp.getPixels()
+ + size_t(rect.tl.y)*origBmp.getStride() + rect.tl.x*getBytesPerPixel();
initWithData(pRegionStart, origBmp.getStride(), false);
}
-Bitmap::Bitmap(const UTF8String& sName)
- : m_pBits(0),
- m_sName(sName)
-{
- if (!s_bGTKInitialized) {
- g_type_init();
- s_bGTKInitialized = true;
- }
-
- GError* pError = 0;
- GdkPixbuf* pPixBuf = gdk_pixbuf_new_from_file(sName.c_str(), &pError);
- if (!pPixBuf) {
- string sErr = pError->message;
- g_error_free(pError);
- throw Exception(AVG_ERR_FILEIO, sErr);
- }
- m_Size = IntPoint(gdk_pixbuf_get_width(pPixBuf), gdk_pixbuf_get_height(pPixBuf));
- if (gdk_pixbuf_get_has_alpha(pPixBuf)) {
- m_PF = B8G8R8A8;
- } else {
- m_PF = B8G8R8X8;
- }
- int stride = gdk_pixbuf_get_rowstride(pPixBuf);
- allocBits();
- guchar* pSrc = gdk_pixbuf_get_pixels(pPixBuf);
- for (int y = 0; y < m_Size.y; ++y) {
- unsigned char* pDestLine = m_pBits+m_Stride*y;
- guchar* pSrcLine = pSrc + y*stride;
- if (m_PF == B8G8R8A8) {
- unsigned char* pDestPixel = pDestLine;
- guchar* pSrcPixel = pSrcLine;
- for (int x = 0; x < m_Size.x; ++x) {
- pDestPixel[0] = pSrcPixel[2];
- pDestPixel[1] = pSrcPixel[1];
- pDestPixel[2] = pSrcPixel[0];
- pDestPixel[3] = pSrcPixel[3];
- pDestPixel += 4;
- pSrcPixel += 4;
- }
- } else {
- unsigned char* pDestPixel = pDestLine;
- guchar* pSrcPixel = pSrcLine;
- for (int x = 0; x < m_Size.x; ++x) {
- pDestPixel[0] = pSrcPixel[2];
- pDestPixel[1] = pSrcPixel[1];
- pDestPixel[2] = pSrcPixel[0];
- pDestPixel[3] = 255;
- pDestPixel += 4;
- pSrcPixel += 3;
- }
- }
- }
- m_bOwnsBits = true;
- g_object_unref(pPixBuf);
- ObjectCounter::get()->incRef(&typeid(*this));
-}
-
Bitmap::~Bitmap()
{
ObjectCounter::get()->decRef(&typeid(*this));
@@ -222,10 +164,10 @@ void Bitmap::copyPixels(const Bitmap& origBmp)
const unsigned char * pSrc = origBmp.getPixels();
unsigned char * pDest = m_pBits;
int height = min(origBmp.getSize().y, m_Size.y);
- int LineLen = min(origBmp.getLineLen(), getLineLen());
+ int lineLen = min(origBmp.getLineLen(), getLineLen());
int srcStride = origBmp.getStride();
for (int y = 0; y < height; ++y) {
- memcpy(pDest, pSrc, LineLen);
+ memcpy(pDest, pSrc, lineLen);
pDest += m_Stride;
pSrc += srcStride;
}
@@ -239,6 +181,7 @@ void Bitmap::copyPixels(const Bitmap& origBmp)
YCbCrtoBGR(origBmp);
break;
case I8:
+ case A8:
YCbCrtoI8(origBmp);
default: {
Bitmap TempBmp(getSize(), B8G8R8X8, "TempColorConversion");
@@ -249,7 +192,7 @@ void Bitmap::copyPixels(const Bitmap& origBmp)
}
break;
case I16:
- if (m_PF == I8) {
+ if (m_PF == I8 || m_PF == A8) {
I16toI8(origBmp);
} else {
Bitmap TempBmp(getSize(), I8, "TempColorConversion");
@@ -258,6 +201,7 @@ void Bitmap::copyPixels(const Bitmap& origBmp)
}
break;
case I8:
+ case A8:
switch(m_PF) {
case I16:
I8toI16(origBmp);
@@ -281,6 +225,7 @@ void Bitmap::copyPixels(const Bitmap& origBmp)
case BAYER8_BGGR:
switch(m_PF) {
case I8:
+ case A8:
{
// Bayer patterns are saved as I8 bitmaps.
// So simply copy that.
@@ -346,6 +291,7 @@ void Bitmap::copyPixels(const Bitmap& origBmp)
createTrueColorCopy<Pixel16>(*this, origBmp);
break;
case I8:
+ case A8:
createTrueColorCopy<Pixel8>(*this, origBmp);
break;
default:
@@ -570,19 +516,15 @@ void Bitmap::copyYUVPixels(const Bitmap& yBmp, const Bitmap& uBmp, const Bitmap&
void Bitmap::save(const UTF8String& sFilename)
{
- if (!s_bGTKInitialized) {
- g_type_init();
- s_bGTKInitialized = true;
- }
Bitmap* pTempBmp;
switch (m_PF) {
case B8G8R8X8:
pTempBmp = new Bitmap(m_Size, R8G8B8);
- for (int y = 0; y < m_Size.y; y++) {
- unsigned char * pSrcLine = m_pBits+y * m_Stride;
+ for (size_t y = 0; y < size_t(m_Size.y); y++) {
+ unsigned char * pSrcLine = m_pBits + y*m_Stride;
unsigned char * pDestLine = pTempBmp->getPixels() +
y*pTempBmp->getStride();
- for (int x = 0; x < m_Size.x; x++) {
+ for (size_t x = 0; x < size_t(m_Size.x); x++) {
pDestLine[x*3] = pSrcLine[x*4 + 2];
pDestLine[x*3 + 1] = pSrcLine[x*4 + 1];
pDestLine[x*3 + 2] = pSrcLine[x*4];
@@ -591,11 +533,11 @@ void Bitmap::save(const UTF8String& sFilename)
break;
case B8G8R8A8:
pTempBmp = new Bitmap(m_Size, R8G8B8A8);
- for (int y = 0; y < m_Size.y; y++) {
+ for (size_t y = 0; y < size_t(m_Size.y); y++) {
unsigned char * pSrcLine = m_pBits+y * m_Stride;
unsigned char * pDestLine = pTempBmp->getPixels() +
y*pTempBmp->getStride();
- for (int x = 0; x < m_Size.x; x++) {
+ for (size_t x = 0; x < size_t(m_Size.x); x++) {
pDestLine[x*4] = pSrcLine[x*4 + 2];
pDestLine[x*4 + 1] = pSrcLine[x*4 + 1];
pDestLine[x*4 + 2] = pSrcLine[x*4];
@@ -603,6 +545,19 @@ void Bitmap::save(const UTF8String& sFilename)
}
}
break;
+ case B8G8R8:
+ pTempBmp = new Bitmap(m_Size, R8G8B8);
+ for (size_t y = 0; y < size_t(m_Size.y); y++) {
+ unsigned char * pSrcLine = m_pBits+y * m_Stride;
+ unsigned char * pDestLine = pTempBmp->getPixels() +
+ y*pTempBmp->getStride();
+ for (size_t x = 0; x < size_t(m_Size.x); x++) {
+ pDestLine[x*3] = pSrcLine[x*3 + 2];
+ pDestLine[x*3 + 1] = pSrcLine[x*3 + 1];
+ pDestLine[x*3 + 2] = pSrcLine[x*3];
+ }
+ }
+ break;
default:
if (hasAlpha()) {
pTempBmp = new Bitmap(m_Size, R8G8B8A8);
@@ -616,9 +571,14 @@ void Bitmap::save(const UTF8String& sFilename)
pTempBmp->getStride(), 0, 0);
string sExt = getExtension(sFilename);
+ if (sExt == "jpg") {
+ sExt = "jpeg";
+ }
GError* pError = 0;
- gboolean bOk = gdk_pixbuf_save(pPixBuf, sFilename.c_str(), sExt.c_str(), &pError, NULL);
+ gboolean bOk = gdk_pixbuf_save(pPixBuf, sFilename.c_str(), sExt.c_str(), &pError,
+ NULL);
+ g_object_unref(pPixBuf);
if (!bOk) {
string sErr = pError->message;
g_error_free(pError);
@@ -711,7 +671,7 @@ bool Bitmap::hasAlpha() const
HistogramPtr Bitmap::getHistogram(int stride) const
{
- AVG_ASSERT (m_PF == I8);
+ AVG_ASSERT (getBytesPerPixel() == 1);
HistogramPtr pHist(new Histogram(256,0));
const unsigned char * pSrcLine = m_pBits;
for (int y = 0; y < m_Size.y; y += stride) {
@@ -727,7 +687,7 @@ HistogramPtr Bitmap::getHistogram(int stride) const
void Bitmap::getMinMax(int stride, int& min, int& max) const
{
- AVG_ASSERT (m_PF == I8);
+ AVG_ASSERT (getBytesPerPixel() == 1);
const unsigned char * pSrcLine = m_pBits;
min = 255;
max = 0;
@@ -749,7 +709,7 @@ void Bitmap::getMinMax(int stride, int& min, int& max) const
void Bitmap::setAlpha(const Bitmap& alphaBmp)
{
AVG_ASSERT(hasAlpha());
- AVG_ASSERT(alphaBmp.getPixelFormat() == I8);
+ AVG_ASSERT(alphaBmp.getBytesPerPixel() == 1);
unsigned char * pLine = m_pBits;
const unsigned char * pAlphaLine = alphaBmp.getPixels();
for (int y = 0; y < m_Size.y; y++) {
@@ -765,7 +725,7 @@ void Bitmap::setAlpha(const Bitmap& alphaBmp)
}
}
-Pixel32 Bitmap::getPythonPixel(const DPoint& pos)
+Pixel32 Bitmap::getPythonPixel(const glm::vec2& pos)
{
IntPoint intPos(pos);
if (intPos.x < 0 || intPos.y < 0 || intPos.x >= m_Size.x || intPos.y >= m_Size.y) {
@@ -776,6 +736,12 @@ Pixel32 Bitmap::getPythonPixel(const DPoint& pos)
}
const unsigned char * pPixel = m_pBits+intPos.y*m_Stride+intPos.x*getBytesPerPixel();
switch(getPixelFormat()) {
+ case R8G8B8A8:
+ return Pixel32(pPixel[0], pPixel[1], pPixel[2], pPixel[3]);
+ case R8G8B8X8:
+ return Pixel32(pPixel[0], pPixel[1], pPixel[2], 255);
+ case R8G8B8:
+ return Pixel32(pPixel[0], pPixel[1], pPixel[2]);
case B8G8R8A8:
return Pixel32(pPixel[2], pPixel[1], pPixel[0], pPixel[3]);
case B8G8R8X8:
@@ -783,6 +749,7 @@ Pixel32 Bitmap::getPythonPixel(const DPoint& pos)
case B8G8R8:
return Pixel32(pPixel[2], pPixel[1], pPixel[0]);
case I8:
+ case A8:
return Pixel32(pPixel[0], pPixel[0], pPixel[0]);
default:
cerr << getPixelFormat() << endl;
@@ -795,14 +762,13 @@ bool Bitmap::operator ==(const Bitmap& otherBmp)
{
// We allow Name, Stride and bOwnsBits to be different here, since we're looking for
// equal value only.
- if (m_Size != otherBmp.m_Size || m_PF != otherBmp.m_PF)
- {
+ if (m_Size != otherBmp.m_Size || m_PF != otherBmp.m_PF) {
return false;
}
const unsigned char * pSrc = otherBmp.getPixels();
unsigned char * pDest = m_pBits;
- int LineLen = getLineLen();
+ int lineLen = getLineLen();
for (int y = 0; y < getSize().y; ++y) {
switch(m_PF) {
case R8G8B8X8:
@@ -816,7 +782,7 @@ bool Bitmap::operator ==(const Bitmap& otherBmp)
}
break;
default:
- if (memcmp(pDest, pSrc, LineLen) != 0) {
+ if (memcmp(pDest, pSrc, lineLen) != 0) {
return false;
}
}
@@ -828,15 +794,17 @@ bool Bitmap::operator ==(const Bitmap& otherBmp)
BitmapPtr Bitmap::subtract(const Bitmap& otherBmp)
{
- if (m_PF != otherBmp.getPixelFormat())
+ if (m_PF != otherBmp.getPixelFormat()) {
throw Exception(AVG_ERR_UNSUPPORTED,
string("Bitmap::subtract: pixel formats differ(")
+ getPixelFormatString(m_PF)+", "
+ getPixelFormatString(otherBmp.getPixelFormat())+")");
- if (m_Size != otherBmp.getSize())
+ }
+ if (m_Size != otherBmp.getSize()) {
throw Exception(AVG_ERR_UNSUPPORTED,
string("Bitmap::subtract: bitmap sizes differ (this=")
+ toString(m_Size) + ", other=" + toString(otherBmp.getSize()) + ")");
+ }
BitmapPtr pResultBmp = BitmapPtr(new Bitmap(m_Size, m_PF));
const unsigned char * pSrcLine1 = otherBmp.getPixels();
const unsigned char * pSrcLine2 = m_pBits;
@@ -881,41 +849,64 @@ BitmapPtr Bitmap::subtract(const Bitmap& otherBmp)
void Bitmap::blt(const Bitmap& otherBmp, const IntPoint& pos)
{
- AVG_ASSERT(getBytesPerPixel() == 4);
-
+ AVG_ASSERT(getBytesPerPixel() == 4 || getBytesPerPixel() == 3);
+ AVG_ASSERT(otherBmp.getBytesPerPixel() == 4 || otherBmp.getBytesPerPixel() == 3);
+ if (pos.x < 0 || pos.y < 0) {
+ throw Exception(AVG_ERR_UNSUPPORTED,
+ string("Bitmap::blt: pos < 0 is not supported."));
+ }
+
IntRect destRect(pos.x, pos.y, pos.x+otherBmp.getSize().x,
pos.y+otherBmp.getSize().y);
destRect.intersect(IntRect(IntPoint(0,0), getSize()));
for (int y = 0; y < destRect.height(); y++) {
- unsigned char * pSrcPixel = getPixels()+(pos.y+y)*getStride()+pos.x*4;
+ unsigned char * pSrcPixel = getPixels()+size_t(pos.y+y)*getStride()
+ +size_t(pos.x*getBytesPerPixel());
const unsigned char * pOtherPixel = otherBmp.getPixels()+
- y*otherBmp.getStride();
- if (otherBmp.hasAlpha()) {
- for (int x = 0; x < destRect.width(); x++) {
- int srcAlpha = 255-pOtherPixel[3];
- pSrcPixel[0] =
- (srcAlpha*pSrcPixel[0]+int(pOtherPixel[3])*pOtherPixel[0])/255;
- pSrcPixel[1] =
- (srcAlpha*pSrcPixel[1]+int(pOtherPixel[3])*pOtherPixel[1])/255;
- pSrcPixel[2] =
- (srcAlpha*pSrcPixel[2]+int(pOtherPixel[3])*pOtherPixel[2])/255;
- pSrcPixel += 4;
- pOtherPixel += 4;
+ size_t(y*otherBmp.getStride());
+ if (getBytesPerPixel() == 4) {
+ if (otherBmp.hasAlpha()) {
+ for (int x = 0; x < destRect.width(); x++) {
+ int srcAlpha = 255-pOtherPixel[3];
+ pSrcPixel[0] =
+ (srcAlpha*pSrcPixel[0]+int(pOtherPixel[3])*pOtherPixel[0])/255;
+ pSrcPixel[1] =
+ (srcAlpha*pSrcPixel[1]+int(pOtherPixel[3])*pOtherPixel[1])/255;
+ pSrcPixel[2] =
+ (srcAlpha*pSrcPixel[2]+int(pOtherPixel[3])*pOtherPixel[2])/255;
+ pSrcPixel += 4;
+ pOtherPixel += 4;
+ }
+ } else {
+ for (int x = 0; x < destRect.width(); x++) {
+ *(Pixel32*)pSrcPixel = *(Pixel32*)pOtherPixel;
+ pSrcPixel[3] = 255;
+ pSrcPixel += 4;
+ pOtherPixel += 4;
+ }
}
} else {
- for (int x = 0; x < destRect.width(); x++) {
- *(Pixel32*)pSrcPixel = *(Pixel32*)pOtherPixel;
- pSrcPixel[3] = 255;
- pSrcPixel += 4;
- pOtherPixel += 4;
+ if (otherBmp.getBytesPerPixel() == 4) {
+ // Incomplete: Missing alpha support.
+ for (int x = 0; x < destRect.width(); x++) {
+ *(Pixel24*)pSrcPixel = *(Pixel24*)pOtherPixel;
+ pSrcPixel += 3;
+ pOtherPixel += 4;
+ }
+ } else {
+ for (int x = 0; x < destRect.width(); x++) {
+ *(Pixel24*)pSrcPixel = *(Pixel24*)pOtherPixel;
+ pSrcPixel += 3;
+ pOtherPixel += 3;
+ }
}
}
}
}
-double Bitmap::getAvg() const
+float Bitmap::getAvg() const
{
- double sum = 0;
+ float sum = 0;
unsigned char * pSrc = m_pBits;
int componentsPerPixel = getBytesPerPixel();
for (int y = 0; y < getSize().y; ++y) {
@@ -971,12 +962,12 @@ double Bitmap::getAvg() const
return sum/(getSize().x*getSize().y);
}
-double Bitmap::getChannelAvg(int channel) const
+float Bitmap::getChannelAvg(int channel) const
{
AVG_ASSERT(!pixelFormatIsPlanar(m_PF) && !pixelFormatIsBayer(m_PF) && !(m_PF == I16));
int bytesPerPixel = getBytesPerPixel();
AVG_ASSERT(channel < bytesPerPixel);
- double sum = 0;
+ float sum = 0;
unsigned char * pSrcLine = m_pBits;
for (int y = 0; y < getSize().y; ++y) {
unsigned char * pSrcPixel = pSrcLine;
@@ -989,10 +980,10 @@ double Bitmap::getChannelAvg(int channel) const
return sum/(getSize().x*getSize().y);
}
-double Bitmap::getStdDev() const
+float Bitmap::getStdDev() const
{
- double average = getAvg();
- double sum = 0;
+ float average = getAvg();
+ float sum = 0;
unsigned char * pSrc = m_pBits;
int componentsPerPixel = getBytesPerPixel();
@@ -1094,23 +1085,25 @@ void Bitmap::dump(bool bDumpPixels) const
cerr << dec;
}
+int Bitmap::getPreferredStride(int width, PixelFormat pf)
+{
+ return (((width*avg::getBytesPerPixel(pf))-1)/4+1)*4;
+}
+
void Bitmap::initWithData(unsigned char * pBits, int stride, bool bCopyBits)
{
// cerr << "Bitmap::initWithData()" << endl;
- if (m_PF == A8) {
- m_PF = I8;
- }
if (m_PF == YCbCr422) {
if (m_Size.x%2 == 1) {
- AVG_TRACE(Logger::WARNING, "Odd size for YCbCr bitmap.");
+ AVG_LOG_WARNING("Odd size for YCbCr bitmap.");
m_Size.x++;
}
if (m_Size.y%2 == 1) {
- AVG_TRACE(Logger::WARNING, "Odd size for YCbCr bitmap.");
+ AVG_LOG_WARNING("Odd size for YCbCr bitmap.");
m_Size.y++;
}
if (m_Size.x%2 == 1 || m_Size.y%2 == 1) {
- AVG_TRACE(Logger::ERROR, "Odd size for YCbCr bitmap.");
+ AVG_LOG_ERROR("Odd size for YCbCr bitmap.");
}
}
if (bCopyBits) {
@@ -1137,28 +1130,25 @@ void Bitmap::allocBits(int stride)
AVG_ASSERT(m_Size.x > 0 && m_Size.y > 0);
// cerr << "Bitmap::allocBits():" << m_Size << endl;
if (stride == 0) {
- m_Stride = getLineLen();
+ m_Stride = getPreferredStride(m_Size.x, m_PF);
} else {
m_Stride = stride;
}
- if (m_PF == A8) {
- m_PF = I8;
- }
if (m_PF == YCbCr422) {
if (m_Size.x%2 == 1) {
- AVG_TRACE(Logger::WARNING, "Odd width for YCbCr bitmap.");
+ AVG_LOG_WARNING("Odd width for YCbCr bitmap.");
m_Size.x++;
}
if (m_Size.y%2 == 1) {
- AVG_TRACE(Logger::WARNING, "Odd height for YCbCr bitmap.");
+ AVG_LOG_WARNING("Odd height for YCbCr bitmap.");
m_Size.y++;
}
//XXX: We allocate more than nessesary here because ffmpeg seems to
// overwrite memory after the bits - probably during yuv conversion.
// Yuck.
- m_pBits = new unsigned char[(m_Stride+1)*(m_Size.y+1)];
+ m_pBits = new unsigned char[size_t(m_Stride+1)*(m_Size.y+1)];
} else {
- m_pBits = new unsigned char[m_Stride*m_Size.y];
+ m_pBits = new unsigned char[size_t(m_Stride)*m_Size.y];
}
}
@@ -1328,7 +1318,7 @@ void YUV411toI8Line(const unsigned char* pSrcLine, unsigned char* pDestLine, int
void Bitmap::YCbCrtoI8(const Bitmap& origBmp)
{
- AVG_ASSERT(m_PF==I8);
+ AVG_ASSERT(origBmp.getBytesPerPixel() == 1);
const unsigned char * pSrc = origBmp.getPixels();
unsigned char * pDest = m_pBits;
int height = min(origBmp.getSize().y, m_Size.y);
@@ -1365,7 +1355,7 @@ void Bitmap::YCbCrtoI8(const Bitmap& origBmp)
void Bitmap::I16toI8(const Bitmap& origBmp)
{
- AVG_ASSERT(m_PF == I8);
+ AVG_ASSERT(getBytesPerPixel() == 1);
AVG_ASSERT(origBmp.getPixelFormat() == I16);
const unsigned short * pSrc = (const unsigned short *)origBmp.getPixels();
unsigned char * pDest = m_pBits;
@@ -1386,7 +1376,7 @@ void Bitmap::I16toI8(const Bitmap& origBmp)
void Bitmap::I8toI16(const Bitmap& origBmp)
{
AVG_ASSERT(m_PF == I16);
- AVG_ASSERT(origBmp.getPixelFormat() == I8);
+ AVG_ASSERT(origBmp.getBytesPerPixel() == 1);
const unsigned char * pSrc = origBmp.getPixels();
unsigned short * pDest = (unsigned short *)m_pBits;
int height = min(origBmp.getSize().y, m_Size.y);
@@ -1406,7 +1396,7 @@ void Bitmap::I8toI16(const Bitmap& origBmp)
void Bitmap::I8toRGB(const Bitmap& origBmp)
{
AVG_ASSERT(getBytesPerPixel() == 4 || getBytesPerPixel() == 3);
- AVG_ASSERT(origBmp.getPixelFormat() == I8);
+ AVG_ASSERT(origBmp.getBytesPerPixel() == 1);
const unsigned char * pSrc = origBmp.getPixels();
int height = min(origBmp.getSize().y, m_Size.y);
int width = min(origBmp.getSize().x, m_Size.x);
@@ -1808,6 +1798,7 @@ void createTrueColorCopy(Bitmap& destBmp, const Bitmap& srcBmp)
createTrueColorCopy<PIXEL, Pixel16>(destBmp, srcBmp);
break;
case I8:
+ case A8:
case BAYER8_RGGB:
case BAYER8_GBRG:
case BAYER8_GRBG:
diff --git a/src/graphics/Bitmap.h b/src/graphics/Bitmap.h
index cd6e318..8a46a99 100644
--- a/src/graphics/Bitmap.h
+++ b/src/graphics/Bitmap.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -26,8 +26,8 @@
#include "Pixel32.h"
#include "PixelFormat.h"
-#include "../base/Point.h"
#include "../base/Rect.h"
+#include "../base/GLMHelper.h"
#include "../base/UTF8String.h"
#include <boost/shared_ptr.hpp>
@@ -53,14 +53,13 @@ typedef boost::shared_ptr<Bitmap> BitmapPtr;
class AVG_API Bitmap
{
public:
- Bitmap(DPoint size, PixelFormat pf, const UTF8String& sName="", int stride=0);
+ Bitmap(glm::vec2 size, PixelFormat pf, const UTF8String& sName="", int stride=0);
Bitmap(IntPoint size, PixelFormat pf, const UTF8String& sName="", int stride=0);
Bitmap(IntPoint size, PixelFormat pf, unsigned char * pBits,
int stride, bool bCopyBits, const UTF8String& sName="");
Bitmap(const Bitmap& origBmp);
Bitmap(const Bitmap& origBmp, bool bOwnsBits);
Bitmap(Bitmap& origBmp, const IntRect& rect);
- Bitmap(const UTF8String& sName);
virtual ~Bitmap();
Bitmap &operator =(const Bitmap & origBmp);
@@ -90,7 +89,7 @@ public:
void getMinMax(int stride, int& min, int& max) const;
void setAlpha(const Bitmap& alphaBmp);
- Pixel32 getPythonPixel(const DPoint& pos);
+ Pixel32 getPythonPixel(const glm::vec2& pos);
template<class PIXEL>
void setPixel(const IntPoint& p, PIXEL color);
template<class PIXEL>
@@ -98,13 +97,15 @@ public:
BitmapPtr subtract(const Bitmap& pOtherBmp);
void blt(const Bitmap& otherBmp, const IntPoint& pos);
- double getAvg() const;
- double getChannelAvg(int channel) const;
- double getStdDev() const;
+ float getAvg() const;
+ float getChannelAvg(int channel) const;
+ float getStdDev() const;
bool operator ==(const Bitmap& otherBmp);
void dump(bool bDumpPixels=false) const;
+ static int getPreferredStride(int width, PixelFormat pf);
+
private:
void initWithData(unsigned char* pBits, int stride, bool bCopyBits);
void allocBits(int stride=0);
diff --git a/src/graphics/BitmapLoader.cpp b/src/graphics/BitmapLoader.cpp
new file mode 100644
index 0000000..eeaa5a4
--- /dev/null
+++ b/src/graphics/BitmapLoader.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 "BitmapLoader.h"
+
+#include "PixelFormat.h"
+#include "Filterfliprgb.h"
+
+#include "../base/Exception.h"
+#include "../base/ScopeTimer.h"
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+#include <iostream>
+
+using namespace std;
+using namespace boost;
+
+namespace avg {
+
+BitmapLoader * BitmapLoader::s_pBitmapLoader = 0;
+
+void BitmapLoader::init(bool bBlueFirst)
+{
+#if (GLIB_MAJOR_VERSION <= 2 && GLIB_MINOR_VERSION < 36)
+ g_type_init();
+#endif
+// cerr << "BitmapLoader::init(" << bBlueFirst << ")" << endl;
+ if (s_pBitmapLoader != 0) {
+ delete s_pBitmapLoader;
+ }
+ s_pBitmapLoader = new BitmapLoader(bBlueFirst);
+}
+
+BitmapLoader* BitmapLoader::get()
+{
+ AVG_ASSERT(s_pBitmapLoader != 0);
+ return s_pBitmapLoader;
+}
+
+BitmapLoader::BitmapLoader(bool bBlueFirst)
+ : m_bBlueFirst(bBlueFirst)
+{
+}
+
+BitmapLoader::~BitmapLoader()
+{
+}
+
+bool BitmapLoader::isBlueFirst() const
+{
+ return m_bBlueFirst;
+}
+
+PixelFormat BitmapLoader::getDefaultPixelFormat(bool bAlpha)
+{
+ if (bAlpha) {
+ if (m_bBlueFirst) {
+ return B8G8R8A8;
+ } else {
+ return R8G8B8A8;
+ }
+ } else {
+ if (m_bBlueFirst) {
+ return B8G8R8X8;
+ } else {
+ return R8G8B8X8;
+ }
+ }
+}
+
+static ProfilingZoneID GDKPixbufProfilingZone("gdk_pixbuf load", true);
+static ProfilingZoneID ConvertProfilingZone("Format conversion", true);
+static ProfilingZoneID RGBFlipProfilingZone("RGB<->BGR flip", true);
+
+BitmapPtr BitmapLoader::load(const UTF8String& sFName, PixelFormat pf) const
+{
+ AVG_ASSERT(s_pBitmapLoader != 0);
+ GError* pError = 0;
+ GdkPixbuf* pPixBuf;
+ {
+ ScopeTimer timer(GDKPixbufProfilingZone);
+ pPixBuf = gdk_pixbuf_new_from_file(sFName.c_str(), &pError);
+ }
+ if (!pPixBuf) {
+ string sErr = pError->message;
+ g_error_free(pError);
+ throw Exception(AVG_ERR_FILEIO, sErr);
+ }
+ IntPoint size = IntPoint(gdk_pixbuf_get_width(pPixBuf),
+ gdk_pixbuf_get_height(pPixBuf));
+
+ PixelFormat srcPF;
+ if (gdk_pixbuf_get_has_alpha(pPixBuf)) {
+ srcPF = R8G8B8A8;
+ } else {
+ srcPF = R8G8B8;
+ }
+ if (pf == NO_PIXELFORMAT) {
+ if (m_bBlueFirst) {
+ if (srcPF == R8G8B8A8) {
+ pf = B8G8R8A8;
+ } else if (srcPF == R8G8B8) {
+ pf = B8G8R8X8;
+ }
+ } else {
+ if (srcPF == R8G8B8A8) {
+ pf = R8G8B8A8;
+ } else if (srcPF == R8G8B8) {
+ pf = R8G8B8X8;
+ }
+ }
+ }
+ BitmapPtr pBmp(new Bitmap(size, pf, sFName));
+ {
+ ScopeTimer timer(ConvertProfilingZone);
+
+ int stride = gdk_pixbuf_get_rowstride(pPixBuf);
+ guchar* pSrc = gdk_pixbuf_get_pixels(pPixBuf);
+ BitmapPtr pSrcBmp(new Bitmap(size, srcPF, pSrc, stride, false));
+ {
+ ScopeTimer timer(RGBFlipProfilingZone);
+ if (pixelFormatIsBlueFirst(pf) != pixelFormatIsBlueFirst(srcPF)) {
+ FilterFlipRGB().applyInPlace(pSrcBmp);
+ }
+ }
+ pBmp->copyPixels(*pSrcBmp);
+ }
+ g_object_unref(pPixBuf);
+ return pBmp;
+}
+
+BitmapPtr loadBitmap(const UTF8String& sFName, PixelFormat pf)
+{
+ return BitmapLoader::get()->load(sFName, pf);
+}
+
+}
+
diff --git a/src/graphics/BitmapLoader.h b/src/graphics/BitmapLoader.h
new file mode 100644
index 0000000..f834c9f
--- /dev/null
+++ b/src/graphics/BitmapLoader.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 _BitmapLoader_H_
+#define _BitmapLoader_H_
+
+#include "../api.h"
+#include "../avgconfigwrapper.h"
+
+#include "Bitmap.h"
+#include "PixelFormat.h"
+
+#include <string>
+
+namespace avg {
+
+class AVG_API BitmapLoader {
+public:
+ static void init(bool bBlueFirst);
+ static BitmapLoader* get();
+ bool isBlueFirst() const;
+ PixelFormat getDefaultPixelFormat(bool bAlpha);
+ BitmapPtr load(const UTF8String& sFName, PixelFormat pf=NO_PIXELFORMAT) const;
+
+private:
+ BitmapLoader(bool bBlueFirst);
+ virtual ~BitmapLoader();
+
+ bool m_bBlueFirst;
+ static BitmapLoader * s_pBitmapLoader;
+};
+
+BitmapPtr AVG_API loadBitmap(const UTF8String& sFName, PixelFormat pf=NO_PIXELFORMAT);
+
+}
+
+#endif
diff --git a/src/graphics/BmpTextureMover.cpp b/src/graphics/BmpTextureMover.cpp
index 6a2cd9b..dfb4f27 100644
--- a/src/graphics/BmpTextureMover.cpp
+++ b/src/graphics/BmpTextureMover.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -23,10 +23,14 @@
#include "Bitmap.h"
#include "GLTexture.h"
+#include "FBO.h"
+#include "Filterfliprgb.h"
#include "../base/Logger.h"
#include "../base/Exception.h"
+#include "GLContext.h"
+
#include <iostream>
#include <cstring>
@@ -56,38 +60,38 @@ void BmpTextureMover::moveBmpToTexture(BitmapPtr pBmp, GLTexture& tex)
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, size.x, size.y,
tex.getGLFormat(getPF()), tex.getGLType(getPF()),
pStartPos);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL,
- "BmpTextureMover::moveBmpToTexture: glTexSubImage2D()");
+ tex.setDirty();
+ tex.generateMipmaps();
+ GLContext::checkError("BmpTextureMover::moveBmpToTexture: glTexSubImage2D()");
}
BitmapPtr BmpTextureMover::moveTextureToBmp(GLTexture& tex, int mipmapLevel)
{
- AVG_ASSERT(getSize() == tex.getGLSize());
- BitmapPtr pBmp;
- IntPoint activeSize;
- if (mipmapLevel == 0) {
- activeSize = tex.getSize();
- pBmp = BitmapPtr(new Bitmap(tex.getGLSize(), getPF()));
+ GLContext* pContext = GLContext::getCurrent();
+ unsigned fbo = pContext->genFBO();
+ glproc::BindFramebuffer(GL_FRAMEBUFFER, fbo);
+ glproc::FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
+ tex.getID(), mipmapLevel);
+ FBO::checkError("BmpTextureMover::moveTextureToBmp");
+ IntPoint size = tex.getMipmapSize(mipmapLevel);
+ BitmapPtr pBmp(new Bitmap(size, getPF()));
+ if (GLContext::getMain()->isGLES() && getPF() == B5G6R5) {
+ BitmapPtr pTmpBmp(new Bitmap(size, R8G8B8A8));
+ glReadPixels(0, 0, size.x, size.y, GL_RGBA, GL_UNSIGNED_BYTE, pTmpBmp->getPixels());
+ FilterFlipRGB().applyInPlace(pTmpBmp);
+ pBmp->copyPixels(*pTmpBmp);
} else {
- activeSize = tex.getMipmapSize(mipmapLevel);
- pBmp = BitmapPtr(new Bitmap(activeSize, getPF()));
- }
-
- tex.activate(GL_TEXTURE0);
-
- unsigned char * pStartPos = pBmp->getPixels();
- glGetTexImage(GL_TEXTURE_2D, mipmapLevel, GLTexture::getGLFormat(getPF()),
- GLTexture::getGLType(getPF()), pStartPos);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL,
- "BmpTextureMover::moveTextureToBmp: glGetTexImage()");
-
- if (activeSize != tex.getGLSize()) {
- BitmapPtr pTempBmp = pBmp;
- pBmp = BitmapPtr(new Bitmap(activeSize, getPF(), pStartPos,
- pTempBmp->getStride(), true));
+ int glPixelFormat = tex.getGLFormat(getPF());
+ glReadPixels(0, 0, size.x, size.y, glPixelFormat, tex.getGLType(getPF()),
+ pBmp->getPixels());
}
-
+ GLContext::checkError("BmpTextureMover::moveTextureToBmp: glReadPixels()");
+ glproc::FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
+ 0, 0);
+ pContext->returnFBOToCache(fbo);
+ glproc::BindFramebuffer(GL_FRAMEBUFFER, 0);
return pBmp;
+
}
BitmapPtr BmpTextureMover::lock()
diff --git a/src/graphics/BmpTextureMover.h b/src/graphics/BmpTextureMover.h
index 1c16513..f3d61e2 100644
--- a/src/graphics/BmpTextureMover.h
+++ b/src/graphics/BmpTextureMover.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/graphics/CGLContext.cpp b/src/graphics/CGLContext.cpp
new file mode 100644
index 0000000..f9f0471
--- /dev/null
+++ b/src/graphics/CGLContext.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 "CGLContext.h"
+
+#include "../base/Exception.h"
+#include "../base/Logger.h"
+
+#ifdef __APPLE__
+#include <ApplicationServices/ApplicationServices.h>
+#endif
+
+#include <SDL/SDL.h>
+#include <SDL/SDL_syswm.h>
+
+
+#include <iostream>
+
+
+namespace avg {
+
+using namespace std;
+using namespace boost;
+
+CGLContext::CGLContext(const GLConfig& glConfig, const IntPoint& windowSize,
+ const SDL_SysWMinfo* pSDLWMInfo)
+ : GLContext(windowSize, pSDLWMInfo)
+{
+ if (pSDLWMInfo) {
+ m_Context = CGLGetCurrentContext();
+ setCurrent();
+ } else {
+ CGLPixelFormatObj pixelFormatObj;
+ GLint numPixelFormats;
+
+ CGLPixelFormatAttribute attribs[] = {(CGLPixelFormatAttribute)NULL};
+ CGLChoosePixelFormat(attribs, &pixelFormatObj, &numPixelFormats);
+
+ CGLError err = CGLCreateContext(pixelFormatObj, 0, &m_Context);
+ if (err) {
+ cerr << CGLErrorString(err) << endl;
+ AVG_ASSERT(false);
+ }
+ CGLDestroyPixelFormat(pixelFormatObj);
+ }
+ init(glConfig, !pSDLWMInfo);
+}
+
+CGLContext::~CGLContext()
+{
+ deleteObjects();
+ if (m_Context && ownsContext()) {
+ CGLSetCurrentContext(0);
+ CGLDestroyContext(m_Context);
+ m_Context = 0;
+ }
+}
+
+void CGLContext::activate()
+{
+ CGLError err = CGLSetCurrentContext(m_Context);
+ AVG_ASSERT(err == kCGLNoError);
+ setCurrent();
+}
+
+bool CGLContext::initVBlank(int rate)
+{
+ if (rate > 0) {
+ initMacVBlank(rate);
+ return true;
+ } else {
+ initMacVBlank(0);
+ return false;
+ }
+}
+
+void CGLContext::initMacVBlank(int rate)
+{
+ CGLContextObj context = CGLGetCurrentContext();
+ AVG_ASSERT (context);
+#if MAC_OS_X_VERSION_10_5
+ GLint l = rate;
+#else
+ long l = rate;
+#endif
+ if (rate > 1) {
+ AVG_TRACE(Logger::category::CONFIG, Logger::severity::WARNING,
+ "VBlank rate set to " << rate
+ << " but Mac OS X only supports 1. Assuming 1.");
+ l = 1;
+ }
+ CGLError err = CGLSetParameter(context, kCGLCPSwapInterval, &l);
+ AVG_ASSERT(!err);
+}
+
+}
diff --git a/src/graphics/CGLContext.h b/src/graphics/CGLContext.h
new file mode 100644
index 0000000..951b481
--- /dev/null
+++ b/src/graphics/CGLContext.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 _CGLContext_H_
+#define _CGLContext_H_
+#include "../api.h"
+
+#include "GLContext.h"
+
+#include <OpenGL/OpenGL.h>
+#undef check // Conflicts with Boost
+
+#include <boost/shared_ptr.hpp>
+
+struct SDL_SysWMinfo;
+
+namespace avg {
+
+class AVG_API CGLContext: public GLContext
+{
+public:
+ CGLContext(const GLConfig& glConfig, const IntPoint& windowSize=IntPoint(0,0),
+ const SDL_SysWMinfo* pSDLWMInfo=0);
+ virtual ~CGLContext();
+
+ void activate();
+
+ bool initVBlank(int rate);
+
+private:
+ void initMacVBlank(int rate);
+
+ CGLContextObj m_Context;
+};
+
+}
+#endif
+
+
diff --git a/src/graphics/ContribDefs.h b/src/graphics/ContribDefs.h
index 4e9e808..8032aef 100644
--- a/src/graphics/ContribDefs.h
+++ b/src/graphics/ContribDefs.h
@@ -13,60 +13,60 @@ namespace avg {
class ContribDef
{
public:
- ContribDef(double dWidth)
+ ContribDef(float dWidth)
: m_dWidth (dWidth)
{}
virtual ~ContribDef() {}
- double GetWidth() const
+ float GetWidth() const
{
return m_dWidth;
}
- void SetWidth(double dWidth)
+ void SetWidth(float dWidth)
{
m_dWidth = dWidth;
}
- virtual double Filter(double dVal) const = 0;
+ virtual float Filter(float dVal) const = 0;
protected:
- double m_dWidth;
+ float m_dWidth;
};
class BilinearContribDef : public ContribDef
{
public:
- BilinearContribDef(double dWidth = 1.0)
+ BilinearContribDef(float dWidth = 1.0)
: ContribDef(dWidth)
{}
virtual ~BilinearContribDef() {}
- virtual double Filter(double dVal) const
+ virtual float Filter(float dVal) const
{
dVal = fabs(dVal);
- return (dVal < m_dWidth ? m_dWidth - dVal : 0.0);
+ return (dVal < m_dWidth ? m_dWidth - dVal : 0.0f);
}
};
class GaussianContribDef : public ContribDef
{
public:
- GaussianContribDef(double dWidth = 3.0)
+ GaussianContribDef(float dWidth = 3.0)
: ContribDef(dWidth)
{}
virtual ~GaussianContribDef() {}
- virtual double Filter(double dVal) const
+ virtual float Filter(float dVal) const
{
if (fabs (dVal) > m_dWidth)
{
return 0.0;
}
- return exp (-dVal * dVal / m_dWidth-1) / sqrt (2*M_PI);
+ return float(exp(-dVal * dVal/m_dWidth-1) / sqrt(2*PI));
}
};
diff --git a/src/graphics/Display.cpp b/src/graphics/Display.cpp
new file mode 100644
index 0000000..22d2c62
--- /dev/null
+++ b/src/graphics/Display.cpp
@@ -0,0 +1,136 @@
+//
+// 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 "Display.h"
+#ifdef __linux__
+#include "X11Display.h"
+#endif
+#ifdef __APPLE__
+#include "AppleDisplay.h"
+#endif
+#ifdef _WIN32
+#include "WinDisplay.h"
+#endif
+#include "Bitmap.h"
+
+#include "../base/Logger.h"
+
+#include <SDL/SDL.h>
+#include <SDL/SDL_syswm.h>
+
+#include <iostream>
+
+using namespace std;
+
+namespace avg {
+
+DisplayPtr Display::s_pInstance = DisplayPtr();
+
+DisplayPtr Display::get()
+{
+ if (!s_pInstance) {
+#ifdef __linux__
+ s_pInstance = DisplayPtr(new X11Display());
+#elif defined __APPLE__
+ s_pInstance = DisplayPtr(new AppleDisplay());
+#elif defined _WIN32
+ s_pInstance = DisplayPtr(new WinDisplay());
+#else
+ AVG_ASSERT(false);
+#endif
+ s_pInstance->init();
+ }
+ return s_pInstance;
+}
+
+bool Display::isInitialized()
+{
+ return s_pInstance;
+}
+
+Display::Display()
+ : m_bAutoPPMM(true),
+ m_RefreshRate(0.0f)
+{
+}
+
+Display::~Display()
+{
+}
+
+void Display::init()
+{
+ m_ScreenResolution = queryScreenResolution();
+ m_PPMM = queryPPMM();
+}
+
+void Display::rereadScreenResolution()
+{
+ m_ScreenResolution = queryScreenResolution();
+ if (m_bAutoPPMM) {
+ m_PPMM = queryPPMM();
+ }
+}
+
+IntPoint Display::getScreenResolution()
+{
+ return m_ScreenResolution;
+}
+
+float Display::getPixelsPerMM()
+{
+ return m_PPMM;
+}
+
+void Display::assumePixelsPerMM(float ppmm)
+{
+ if (ppmm != 0) {
+ m_PPMM = ppmm;
+ m_bAutoPPMM = false;
+ }
+}
+
+glm::vec2 Display::getPhysicalScreenDimensions()
+{
+ glm::vec2 size;
+ glm::vec2 screenRes = glm::vec2(getScreenResolution());
+ size.x = screenRes.x/m_PPMM;
+ size.y = screenRes.y/m_PPMM;
+ return size;
+}
+
+IntPoint Display::queryScreenResolution()
+{
+ const SDL_VideoInfo* pInfo = SDL_GetVideoInfo();
+ return IntPoint(pInfo->current_w, pInfo->current_h);
+}
+
+float Display::getRefreshRate()
+{
+ if (m_RefreshRate == 0.0) {
+ m_RefreshRate = queryRefreshRate();
+ AVG_TRACE(Logger::category::CONFIG, Logger::severity::INFO,
+ "Vertical Refresh Rate: " << m_RefreshRate);
+ }
+ return m_RefreshRate;
+}
+
+}
diff --git a/src/graphics/Display.h b/src/graphics/Display.h
new file mode 100644
index 0000000..e680936
--- /dev/null
+++ b/src/graphics/Display.h
@@ -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
+//
+
+#ifndef _Display_H_
+#define _Display_H_
+
+#include "../api.h"
+#include "../avgconfigwrapper.h"
+
+#include "../base/GLMHelper.h"
+
+#include <boost/shared_ptr.hpp>
+
+namespace avg {
+
+class Display;
+typedef boost::shared_ptr<Display> DisplayPtr;
+
+class AVG_API Display
+{
+public:
+ static DisplayPtr get();
+ static bool isInitialized();
+ virtual ~Display();
+ void init();
+ void rereadScreenResolution();
+
+ IntPoint getScreenResolution();
+ float getPixelsPerMM();
+ void assumePixelsPerMM(float ppmm);
+ glm::vec2 getPhysicalScreenDimensions();
+ float getRefreshRate();
+
+protected:
+ Display();
+
+ virtual float queryPPMM()=0;
+ virtual IntPoint queryScreenResolution();
+ virtual float queryRefreshRate()=0;
+
+private:
+ IntPoint m_ScreenResolution;
+ float m_PPMM;
+ bool m_bAutoPPMM; // true if assumePixelsPerMM hasn't been called.
+
+ float m_RefreshRate;
+
+ static DisplayPtr s_pInstance;
+};
+
+}
+
+#endif
diff --git a/src/graphics/EGLContext.cpp b/src/graphics/EGLContext.cpp
new file mode 100644
index 0000000..dce62d9
--- /dev/null
+++ b/src/graphics/EGLContext.cpp
@@ -0,0 +1,202 @@
+//
+// 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 "EGLContext.h"
+#include "GLContextAttribs.h"
+#ifdef AVG_ENABLE_RPI
+ #include "BCMDisplay.h"
+#else
+ #include "X11Display.h"
+#endif
+
+#include "../base/Exception.h"
+#include "../base/StringHelper.h"
+
+#include <SDL/SDL_syswm.h>
+#include <EGL/egl.h>
+
+#include <iostream>
+
+namespace avg{
+
+using namespace std;
+
+EGLContext::EGLContext(const GLConfig& glConfig, const IntPoint& windowSize,
+ const SDL_SysWMinfo* pSDLWMInfo)
+ : GLContext(windowSize, pSDLWMInfo)
+{
+ createEGLContext(glConfig, windowSize, pSDLWMInfo);
+ init(glConfig, true);
+}
+
+EGLContext::~EGLContext()
+{
+ getVertexBufferCache().deleteBuffers();
+ getIndexBufferCache().deleteBuffers();
+ getPBOCache().deleteBuffers();
+ deleteObjects();
+ eglMakeCurrent(m_Display, EGL_NO_SURFACE, EGL_NO_SURFACE, 0);
+ eglDestroyContext(m_Display, m_Context);
+ eglDestroySurface(m_Display, m_Surface);
+ eglTerminate(m_Display);
+}
+
+void EGLContext::createEGLContext(const GLConfig& glConfig, const IntPoint& windowSize,
+ const SDL_SysWMinfo* pSDLWMInfo)
+{
+ bool bOk;
+
+#ifdef AVG_ENABLE_RPI
+ m_xDisplay = (EGLNativeDisplayType)getBCMDisplay(pSDLWMInfo);
+ m_Display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
+#else
+ m_xDisplay = (EGLNativeDisplayType)getX11Display(pSDLWMInfo);
+ m_Display = eglGetDisplay(m_xDisplay);
+#endif
+ checkEGLError(m_Display == EGL_NO_DISPLAY, "No EGL display available");
+
+ bOk = eglInitialize(m_Display, NULL, NULL);
+ checkEGLError(!bOk, "eglInitialize failed");
+
+ GLContextAttribs fbAttrs;
+ fbAttrs.append(EGL_RED_SIZE, 1);
+ fbAttrs.append(EGL_GREEN_SIZE, 1);
+ fbAttrs.append(EGL_BLUE_SIZE, 1);
+ fbAttrs.append(EGL_DEPTH_SIZE, 0);
+ fbAttrs.append(EGL_STENCIL_SIZE, 1);
+ int alphaSize = 0;
+#ifdef AVG_ENABLE_RPI
+ if (!pSDLWMInfo) {
+ alphaSize = 1;
+ }
+#endif
+ fbAttrs.append(EGL_ALPHA_SIZE, alphaSize);
+ fbAttrs.append(EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT);
+ EGLint numFBConfig;
+ bOk = eglChooseConfig(m_Display, fbAttrs.get(), &m_Config, 1, &numFBConfig);
+ checkEGLError(!bOk, "Failed to choose EGL config");
+
+ EGLint vid;
+ bOk = eglGetConfigAttrib(m_Display, m_Config, EGL_NATIVE_VISUAL_ID, &vid);
+ AVG_ASSERT(bOk);
+
+#ifndef AVG_ENABLE_RPI
+ XVisualInfo visTemplate;
+ visTemplate.visualid = vid;
+ int num_visuals;
+ XVisualInfo* pVisualInfo = XGetVisualInfo((_XDisplay*)m_xDisplay, VisualIDMask, &visTemplate,
+ &num_visuals);
+ AVG_ASSERT(pVisualInfo);
+#endif
+
+ EGLNativeWindowType xWindow = 0;
+ if (pSDLWMInfo) {
+#ifdef AVG_ENABLE_RPI
+ xWindow = createChildWindow(pSDLWMInfo, m_xDisplay, windowSize);
+#else
+ Colormap colormap;
+ xWindow = (EGLNativeWindowType)createChildWindow(pSDLWMInfo, pVisualInfo, windowSize, colormap);
+#endif
+ }
+
+ if (!eglBindAPI(EGL_OPENGL_ES_API)) {
+ cerr << "Failed to bind GLES API to EGL\n";
+ return;
+ }
+
+ if (numFBConfig != 1) {
+ cerr << "Didn't get exactly one config, but " << numFBConfig << endl;
+ return;
+ }
+ if (xWindow) {
+ m_Surface = eglCreateWindowSurface(m_Display, m_Config, xWindow, NULL);
+ } else {
+#ifdef AVG_ENABLE_RPI
+ m_Surface = createBCMPixmapSurface(m_Display, m_Config);
+#else
+ XVisualInfo visTemplate, *results;
+ visTemplate.screen = 0;
+ int numVisuals;
+ results = XGetVisualInfo((_XDisplay*)m_xDisplay, VisualScreenMask,
+ &visTemplate, & numVisuals);
+
+ Pixmap pmp = XCreatePixmap((_XDisplay*)m_xDisplay,
+ RootWindow((_XDisplay*)m_xDisplay, results[0].screen), 8, 8, results[0].depth);
+ m_Surface = eglCreatePixmapSurface(m_Display, m_Config, (EGLNativePixmapType)pmp, NULL);
+#endif
+ }
+ AVG_ASSERT(m_Surface);
+
+ GLContextAttribs attrs;
+ attrs.append(EGL_CONTEXT_CLIENT_VERSION, 2);
+ m_Context = eglCreateContext(m_Display, m_Config, NULL, attrs.get());
+ checkEGLError(!m_Context, "Unable to create EGL context");
+// dumpEGLConfig();
+}
+
+bool EGLContext::initVBlank(int rate)
+{
+ return false;
+}
+
+void EGLContext::activate()
+{
+ eglMakeCurrent(m_Display, m_Surface, m_Surface, m_Context);
+ setCurrent();
+}
+
+void EGLContext::swapBuffers()
+{
+ eglSwapBuffers(m_Display, m_Surface);
+}
+
+void EGLContext::checkEGLError(bool bError, const std::string& sMsg)
+{
+ if (bError) {
+ throw Exception(AVG_ERR_VIDEO_INIT_FAILED, sMsg + " (EGL error: " +
+ toString(eglGetError()) + ")");
+ }
+}
+
+void EGLContext::dumpEGLConfig() const
+{
+ cout << "EGL configuration:" << endl;
+ dumpEGLConfigAttrib(EGL_RED_SIZE, "RED_SIZE");
+ dumpEGLConfigAttrib(EGL_GREEN_SIZE, "GREEN_SIZE");
+ dumpEGLConfigAttrib(EGL_BLUE_SIZE, "BLUE_SIZE");
+ dumpEGLConfigAttrib(EGL_ALPHA_SIZE, "ALPHA_SIZE");
+ dumpEGLConfigAttrib(EGL_BUFFER_SIZE, "BUFFER_SIZE");
+ dumpEGLConfigAttrib(EGL_DEPTH_SIZE, "DEPTH_SIZE");
+ dumpEGLConfigAttrib(EGL_STENCIL_SIZE, "STENCIL_SIZE");
+}
+
+void EGLContext::dumpEGLConfigAttrib(EGLint attrib, const string& name) const
+{
+ EGLint value;
+ if (eglGetConfigAttrib(m_Display, m_Config, attrib, &value)) {
+ cout << " " << name << ": " << value << endl;
+ }
+ else {
+ cerr << " Failed to get EGL config attribute " << name << endl;
+ }
+}
+
+}
diff --git a/src/base/Matrix3x4.h b/src/graphics/EGLContext.h
index 62a0222..d6a2af4 100644
--- a/src/base/Matrix3x4.h
+++ b/src/graphics/EGLContext.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -18,39 +18,44 @@
//
// Current versions can be found at www.libavg.de
//
-
-#ifndef _Matrix3x4_H_
-#define _Matrix3x4_H_
+#ifndef _EGLContext_H_
+#define _EGLContext_H_
#include "../api.h"
-#include "Triple.h"
+#include <EGL/egl.h>
+#include "GLContext.h"
-#include <iostream>
+struct SDL_SysWMinfo;
namespace avg {
-
-class AVG_API Matrix3x4 {
+
+class AVG_API EGLContext: public GLContext
+{
public:
- float val[3][4];
+ EGLContext(const GLConfig& glConfig, const IntPoint& windowSize=IntPoint(0,0),
+ const SDL_SysWMinfo* pSDLWMInfo=0);
+ virtual ~EGLContext();
- Matrix3x4();
- Matrix3x4(const float *);
- static Matrix3x4 createTranslate(float x, float y, float z);
- static Matrix3x4 createTranslate(const DTriple& tr);
- static Matrix3x4 createScale(float x, float y, float z);
- static Matrix3x4 createScale(const DTriple& tr);
-
- const Matrix3x4& operator *=(const Matrix3x4& mat);
+ void activate();
+ bool initVBlank(int rate);
+ void swapBuffers();
private:
- void setIdent();
+ void createEGLContext(const GLConfig& glConfig, const IntPoint& windowSize,
+ const SDL_SysWMinfo* pSDLWMInfo);
+ void checkEGLError(bool bError, const std::string& sMsg);
+
+ void dumpEGLConfig() const;
+ void dumpEGLConfigAttrib(EGLint attrib, const std::string& name) const;
+
+ EGLNativeDisplayType m_xDisplay;
+ EGLDisplay m_Display;
+ EGLConfig m_Config;
+ ::EGLContext m_Context;
+ EGLSurface m_Surface;
};
-bool almostEqual(const Matrix3x4& mat1, const Matrix3x4& mat2);
-
-std::ostream& operator<<(std::ostream& os, const Matrix3x4& mat);
-
}
#endif
diff --git a/src/graphics/FBO.cpp b/src/graphics/FBO.cpp
index de3eb6a..e7837b5 100644
--- a/src/graphics/FBO.cpp
+++ b/src/graphics/FBO.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -23,6 +23,7 @@
#include "OGLHelper.h"
#include "GLContext.h"
+#include "Filterfliprgb.h"
#include "../base/Exception.h"
#include "../base/StringHelper.h"
@@ -35,12 +36,22 @@ using namespace boost;
namespace avg {
+#ifndef GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS
+#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT
+#endif
+
+#ifdef AVG_ENABLE_EGL
+#define GL_DEPTH_STENCIL_EXT GL_DEPTH24_STENCIL8_OES
+#endif
+
FBO::FBO(const IntPoint& size, PixelFormat pf, unsigned numTextures,
- unsigned multisampleSamples, bool bUsePackedDepthStencil, bool bMipmap)
+ unsigned multisampleSamples, bool bUsePackedDepthStencil, bool bUseStencil,
+ bool bMipmap)
: m_Size(size),
m_PF(pf),
m_MultisampleSamples(multisampleSamples),
m_bUsePackedDepthStencil(bUsePackedDepthStencil),
+ m_bUseStencil(bUseStencil),
m_bMipmap(bMipmap)
{
ObjectCounter::get()->incRef(&typeid(*this));
@@ -49,12 +60,13 @@ FBO::FBO(const IntPoint& size, PixelFormat pf, unsigned numTextures,
throw Exception(AVG_ERR_UNSUPPORTED,
"Multisample offscreen rendering is not supported by this OpenGL driver/card combination.");
}
-
+ if (multisampleSamples < 1) {
+ throwMultisampleError();
+ }
for (unsigned i=0; i<numTextures; ++i) {
GLTexturePtr pTex = GLTexturePtr(new GLTexture(size, pf, bMipmap));
- // Workaround for NVidia driver bug - GL_TEX_MIN_FILTER without
- // glGenerateMipmaps causes FBO creation to fail(?!).
pTex->generateMipmaps();
+ GLContext::checkError("FBO::FBO: generateMipmaps");
m_pTextures.push_back(pTex);
}
init();
@@ -65,11 +77,11 @@ FBO::~FBO()
ObjectCounter::get()->decRef(&typeid(*this));
unsigned oldFBOID;
- glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, (GLint*)&oldFBOID);
- glproc::BindFramebuffer(GL_FRAMEBUFFER_EXT, m_FBO);
+ glGetIntegerv(GL_FRAMEBUFFER_BINDING, (GLint*)&oldFBOID);
+ glproc::BindFramebuffer(GL_FRAMEBUFFER, m_FBO);
for (unsigned i=0; i<m_pTextures.size(); ++i) {
- glproc::FramebufferTexture2D(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT+i,
+ glproc::FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0+i,
GL_TEXTURE_2D, 0, 0);
}
@@ -82,25 +94,29 @@ FBO::~FBO()
}
if (m_bUsePackedDepthStencil && isPackedDepthStencilSupported()) {
glproc::DeleteRenderbuffers(1, &m_StencilBuffer);
- glproc::FramebufferRenderbuffer(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT,
- GL_RENDERBUFFER_EXT, 0);
- glproc::FramebufferRenderbuffer(GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT,
- GL_RENDERBUFFER_EXT, 0);
+ glproc::FramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
+ GL_RENDERBUFFER, 0);
+ glproc::FramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT,
+ GL_RENDERBUFFER, 0);
if (m_MultisampleSamples > 1) {
- glproc::BindFramebuffer(GL_FRAMEBUFFER_EXT, m_OutputFBO);
- glproc::FramebufferTexture2D(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
+ glproc::BindFramebuffer(GL_FRAMEBUFFER, m_OutputFBO);
+ glproc::FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
GL_TEXTURE_2D, 0, 0);
}
+ } else if (m_bUseStencil) {
+ glproc::DeleteRenderbuffers(1, &m_StencilBuffer);
+ glproc::FramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT,
+ GL_RENDERBUFFER, 0);
}
- glproc::BindFramebuffer(GL_FRAMEBUFFER_EXT, oldFBOID);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "~FBO");
+ glproc::BindFramebuffer(GL_FRAMEBUFFER, oldFBOID);
+ GLContext::checkError("~FBO");
}
}
void FBO::activate() const
{
- glproc::BindFramebuffer(GL_FRAMEBUFFER_EXT, m_FBO);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "FBO::activate: BindFramebuffer()");
+ glproc::BindFramebuffer(GL_FRAMEBUFFER, m_FBO);
+ GLContext::checkError("FBO::activate: BindFramebuffer()");
checkError("activate");
}
@@ -116,14 +132,16 @@ unsigned FBO::getNumTextures() const
void FBO::copyToDestTexture() const
{
+#ifndef AVG_ENABLE_EGL
if (m_MultisampleSamples != 1) {
// Copy Multisample FBO to destination fbo
glproc::BindFramebuffer(GL_READ_FRAMEBUFFER_EXT, m_FBO);
glproc::BindFramebuffer(GL_DRAW_FRAMEBUFFER_EXT, m_OutputFBO);
glproc::BlitFramebuffer(0, 0, m_Size.x, m_Size.y, 0, 0, m_Size.x, m_Size.y,
GL_COLOR_BUFFER_BIT, GL_LINEAR);
- glproc::BindFramebuffer(GL_FRAMEBUFFER_EXT, 0);
+ glproc::BindFramebuffer(GL_FRAMEBUFFER, 0);
}
+#endif
if (m_bMipmap) {
for (unsigned i=0; i< m_pTextures.size(); ++i) {
m_pTextures[i]->generateMipmaps();
@@ -133,48 +151,60 @@ void FBO::copyToDestTexture() const
BitmapPtr FBO::getImage(int i) const
{
- moveToPBO(i);
- return getImageFromPBO();
+ GLContext* pContext = GLContext::getCurrent();
+ if (pContext->getMemoryMode() == MM_PBO) {
+ moveToPBO(i);
+ return getImageFromPBO();
+ } else {
+ BitmapPtr pBmp(new Bitmap(m_Size, m_PF));
+ glproc::BindFramebuffer(GL_FRAMEBUFFER, m_OutputFBO);
+ glReadPixels(0, 0, m_Size.x, m_Size.y, GLTexture::getGLFormat(m_PF),
+ GLTexture::getGLType(m_PF), pBmp->getPixels());
+ GLContext::checkError("FBO::getImage ReadPixels()");
+ return pBmp;
+ }
}
void FBO::moveToPBO(int i) const
{
+ AVG_ASSERT(GLContext::getCurrent()->getMemoryMode() == MM_PBO);
+#ifndef AVG_ENABLE_EGL
// Get data directly from the FBO using glReadBuffer. At least on NVidia/Linux, this
// is faster than reading stuff from the texture.
copyToDestTexture();
- if (m_MultisampleSamples != 1) {
- glproc::BindFramebuffer(GL_FRAMEBUFFER_EXT, m_OutputFBO);
- } else {
- glproc::BindFramebuffer(GL_FRAMEBUFFER_EXT, m_FBO);
- }
- PixelFormat pf = m_pOutputPBO->getPF();
- IntPoint size = m_pOutputPBO->getSize();
+ glproc::BindFramebuffer(GL_FRAMEBUFFER, m_OutputFBO);
m_pOutputPBO->activate();
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "FBO::moveToPBO BindBuffer()");
- glReadBuffer(GL_COLOR_ATTACHMENT0_EXT+i);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "FBO::moveToPBO ReadBuffer()");
+ GLContext::checkError("FBO::moveToPBO BindBuffer()");
+ glReadBuffer(GL_COLOR_ATTACHMENT0+i);
+ GLContext::checkError("FBO::moveToPBO ReadBuffer()");
- glReadPixels(0, 0, size.x, size.y, GLTexture::getGLFormat(pf),
- GLTexture::getGLType(pf), 0);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "FBO::moveToPBO ReadPixels()");
+ glReadPixels(0, 0, m_Size.x, m_Size.y, GLTexture::getGLFormat(m_PF),
+ GLTexture::getGLType(m_PF), 0);
+ GLContext::checkError("FBO::moveToPBO ReadPixels()");
+#endif
}
BitmapPtr FBO::getImageFromPBO() const
{
+#ifdef AVG_ENABLE_EGL
+ AVG_ASSERT(false);
+ return BitmapPtr();
+#else
+ AVG_ASSERT(GLContext::getCurrent()->getMemoryMode() == MM_PBO);
m_pOutputPBO->activate();
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "FBO::getImageFromPBO BindBuffer()");
- PixelFormat pf = m_pOutputPBO->getPF();
- IntPoint size = m_pOutputPBO->getSize();
- BitmapPtr pBmp(new Bitmap(size, pf));
+ GLContext::checkError("FBO::getImageFromPBO BindBuffer()");
+
+ BitmapPtr pBmp(new Bitmap(m_Size, m_PF));
void * pPBOPixels = glproc::MapBuffer(GL_PIXEL_PACK_BUFFER_EXT, GL_READ_ONLY);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "FBO::getImageFromPBO MapBuffer()");
- Bitmap PBOBitmap(size, pf, (unsigned char *)pPBOPixels,
- size.x*getBytesPerPixel(pf), false);
+ GLContext::checkError("FBO::getImageFromPBO MapBuffer()");
+ Bitmap PBOBitmap(m_Size, m_PF, (unsigned char *)pPBOPixels,
+ m_Size.x*getBytesPerPixel(m_PF), false);
pBmp->copyPixels(PBOBitmap);
glproc::UnmapBuffer(GL_PIXEL_PACK_BUFFER_EXT);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "FBO::getImageFromPBO UnmapBuffer()");
+ GLContext::checkError("FBO::getImageFromPBO UnmapBuffer()");
return pBmp;
+#endif
}
GLTexturePtr FBO::getTex(int i) const
@@ -187,6 +217,11 @@ const IntPoint& FBO::getSize() const
return m_Size;
}
+unsigned FBO::getID() const
+{
+ return m_FBO;
+}
+
void FBO::init()
{
GLContext* pContext = GLContext::getCurrent();
@@ -196,129 +231,159 @@ void FBO::init()
if (m_MultisampleSamples > 1 && !isMultisampleFBOSupported()) {
throw Exception(AVG_ERR_UNSUPPORTED, "OpenGL implementation does not support multisample offscreen rendering (GL_EXT_framebuffer_multisample).");
}
- m_pOutputPBO = PBOPtr(new PBO(m_Size, m_PF, GL_STREAM_READ));
+#ifndef AVG_ENABLE_EGL
+ if (GLContext::getCurrent()->getMemoryMode() == MM_PBO) {
+ m_pOutputPBO = PBOPtr(new PBO(m_Size, m_PF, GL_STREAM_READ));
+ }
+#endif
m_FBO = pContext->genFBO();
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "FBO::init: GenFramebuffers()");
+ GLContext::checkError("FBO::init: GenFramebuffers()");
- glproc::BindFramebuffer(GL_FRAMEBUFFER_EXT, m_FBO);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "FBO::init: BindFramebuffer()");
+ glproc::BindFramebuffer(GL_FRAMEBUFFER, m_FBO);
+ GLContext::checkError("FBO::init: BindFramebuffer()");
+ IntPoint glSize = m_pTextures[0]->getGLSize();
if (m_MultisampleSamples == 1) {
- glDisable(GL_MULTISAMPLE);
for (unsigned i=0; i<m_pTextures.size(); ++i) {
- glproc::FramebufferTexture2D(GL_FRAMEBUFFER_EXT,
- GL_COLOR_ATTACHMENT0_EXT+i, GL_TEXTURE_2D,
- m_pTextures[i]->getID(), 0);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "FBO: glFramebufferTexture2D()");
+ glproc::FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0+i,
+ GL_TEXTURE_2D, m_pTextures[i]->getID(), 0);
+ GLContext::checkError("FBO: glFramebufferTexture2D()");
}
if (m_bUsePackedDepthStencil) {
glproc::GenRenderbuffers(1, &m_StencilBuffer);
- glproc::BindRenderbuffer(GL_RENDERBUFFER_EXT, m_StencilBuffer);
- glproc::RenderbufferStorage(GL_RENDERBUFFER_EXT, GL_DEPTH_STENCIL_EXT,
- m_Size.x, m_Size.y);
- glproc::FramebufferRenderbuffer(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT,
- GL_RENDERBUFFER_EXT, m_StencilBuffer);
- glproc::FramebufferRenderbuffer(GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT,
- GL_RENDERBUFFER_EXT, m_StencilBuffer);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL,
- "FBO::init: FramebufferRenderbuffer(STENCIL)");
+ glproc::BindRenderbuffer(GL_RENDERBUFFER, m_StencilBuffer);
+ glproc::RenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_STENCIL_EXT,
+ glSize.x, glSize.y);
+ glproc::FramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
+ GL_RENDERBUFFER, m_StencilBuffer);
+ glproc::FramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT,
+ GL_RENDERBUFFER, m_StencilBuffer);
+ GLContext::checkError("FBO::init: FramebufferRenderbuffer(DEPTH_STENCIL)");
+ } else if (m_bUseStencil) {
+ glproc::GenRenderbuffers(1, &m_StencilBuffer);
+ glproc::BindRenderbuffer(GL_RENDERBUFFER, m_StencilBuffer);
+ glproc::RenderbufferStorage(GL_RENDERBUFFER, GL_STENCIL_INDEX8,
+ glSize.x, glSize.y);
+ glproc::FramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT,
+ GL_RENDERBUFFER, m_StencilBuffer);
+ GLContext::checkError("FBO::init: FramebufferRenderbuffer(STENCIL)");
}
+ m_OutputFBO = m_FBO;
} else {
- glEnable(GL_MULTISAMPLE);
+#ifdef AVG_ENABLE_EGL
+ AVG_ASSERT(false);
+#else
glproc::GenRenderbuffers(1, &m_ColorBuffer);
- glproc::BindRenderbuffer(GL_RENDERBUFFER_EXT, m_ColorBuffer);
- glproc::RenderbufferStorageMultisample(GL_RENDERBUFFER_EXT, m_MultisampleSamples,
- GL_RGBA8, m_Size.x, m_Size.y);
+ glproc::BindRenderbuffer(GL_RENDERBUFFER, m_ColorBuffer);
+ GLContext::enableErrorLog(false);
+ glproc::RenderbufferStorageMultisample(GL_RENDERBUFFER, m_MultisampleSamples,
+ GL_RGBA8, glSize.x, glSize.y);
+ GLContext::enableErrorLog(true);
GLenum err = glGetError();
if (err == GL_INVALID_VALUE) {
- glproc::BindFramebuffer(GL_FRAMEBUFFER_EXT, 0);
+ glproc::BindFramebuffer(GL_FRAMEBUFFER, 0);
glproc::DeleteFramebuffers(1, &m_FBO);
glproc::DeleteRenderbuffers(1, &m_ColorBuffer);
m_pOutputPBO = PBOPtr();
- throw(Exception(AVG_ERR_UNSUPPORTED,
- string("Unsupported value for number of multisample samples (")
- + toString(m_MultisampleSamples) + ")."));
+ throwMultisampleError();
}
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "FBO::init: RenderbufferStorageMultisample");
- glproc::FramebufferRenderbuffer(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
- GL_RENDERBUFFER_EXT, m_ColorBuffer);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "FBO::init: FramebufferRenderbuffer");
+ GLContext::checkError("FBO::init: RenderbufferStorageMultisample");
+ glproc::FramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
+ GL_RENDERBUFFER, m_ColorBuffer);
+ GLContext::checkError("FBO::init: FramebufferRenderbuffer");
if (m_bUsePackedDepthStencil) {
glproc::GenRenderbuffers(1, &m_StencilBuffer);
- glproc::BindRenderbuffer(GL_RENDERBUFFER_EXT, m_StencilBuffer);
- glproc::RenderbufferStorageMultisample(GL_RENDERBUFFER_EXT,
- m_MultisampleSamples, GL_DEPTH_STENCIL_EXT, m_Size.x, m_Size.y);
- glproc::FramebufferRenderbuffer(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT,
- GL_RENDERBUFFER_EXT, m_StencilBuffer);
- glproc::FramebufferRenderbuffer(GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT,
- GL_RENDERBUFFER_EXT, m_StencilBuffer);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL,
- "FBO::init: FramebufferRenderbuffer(STENCIL)");
+ glproc::BindRenderbuffer(GL_RENDERBUFFER, m_StencilBuffer);
+ glproc::RenderbufferStorageMultisample(GL_RENDERBUFFER,
+ m_MultisampleSamples, GL_DEPTH_STENCIL_EXT, glSize.x, glSize.y);
+ GLenum err = glGetError();
+ if (err == GL_INVALID_OPERATION) {
+ glproc::BindFramebuffer(GL_FRAMEBUFFER, 0);
+ glproc::DeleteFramebuffers(1, &m_FBO);
+ glproc::DeleteRenderbuffers(1, &m_ColorBuffer);
+ m_pOutputPBO = PBOPtr();
+ throwMultisampleError();
+ }
+ glproc::FramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
+ GL_RENDERBUFFER, m_StencilBuffer);
+ glproc::FramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT,
+ GL_RENDERBUFFER, m_StencilBuffer);
+ GLContext::checkError("FBO::init: FramebufferRenderbuffer(STENCIL)");
+ } else {
+ AVG_ASSERT_MSG(!m_bUseStencil,
+ "Multisample FBO with stencil & not depth buffers not implemented yet.");
}
checkError("init multisample");
m_OutputFBO = pContext->genFBO();
- glproc::BindFramebuffer(GL_FRAMEBUFFER_EXT, m_OutputFBO);
- glproc::FramebufferTexture2D(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
+ glproc::BindFramebuffer(GL_FRAMEBUFFER, m_OutputFBO);
+ glproc::FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
GL_TEXTURE_2D, m_pTextures[0]->getID(), 0);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "FBO::init: Multisample init");
+ GLContext::checkError("FBO::init: Multisample init");
+#endif
}
checkError("init");
- glproc::BindFramebuffer(GL_FRAMEBUFFER_EXT, 0);
+ glproc::BindFramebuffer(GL_FRAMEBUFFER, 0);
+}
+
+void FBO::throwMultisampleError()
+{
+ throw(Exception(AVG_ERR_UNSUPPORTED,
+ string("Unsupported value for number of multisample samples (")
+ + toString(m_MultisampleSamples) + ")."));
}
bool FBO::isFBOSupported()
{
- return queryOGLExtension("GL_EXT_framebuffer_object");
+ return GLContext::getCurrent()->isGLES() ||
+ queryOGLExtension("GL_EXT_framebuffer_object");
}
bool FBO::isMultisampleFBOSupported()
{
+#ifdef AVG_ENABLE_EGL
+ return false;
+#else
int maxSamples;
glGetIntegerv(GL_MAX_SAMPLES_EXT, &maxSamples);
- // For some reason, this fails on Linux/i945 and similar setups. Multisample
- // FBO is broken anyway on these machines, so we just return false...
GLenum err = glGetError();
if (err != GL_NO_ERROR) {
return false;
}
return queryOGLExtension("GL_EXT_framebuffer_multisample") &&
queryOGLExtension("GL_EXT_framebuffer_blit") && maxSamples > 1;
+#endif
}
-
+
bool FBO::isPackedDepthStencilSupported()
{
- return queryOGLExtension("GL_EXT_packed_depth_stencil");
+ return queryOGLExtension("GL_EXT_packed_depth_stencil") ||
+ queryOGLExtension("GL_OES_packed_depth_stencil");
}
-void FBO::checkError(const string& sContext) const
+void FBO::checkError(const string& sContext)
{
- GLenum status = glproc::CheckFramebufferStatus(GL_FRAMEBUFFER_EXT);
+ GLenum status = glproc::CheckFramebufferStatus(GL_FRAMEBUFFER);
string sErr;
switch (status) {
- case GL_FRAMEBUFFER_COMPLETE_EXT:
+ case GL_FRAMEBUFFER_COMPLETE:
return;
- case GL_FRAMEBUFFER_UNSUPPORTED_EXT:
- sErr = "GL_FRAMEBUFFER_UNSUPPORTED_EXT";
+ case GL_FRAMEBUFFER_UNSUPPORTED:
+ sErr = "GL_FRAMEBUFFER_UNSUPPORTED";
throw Exception(AVG_ERR_UNSUPPORTED, string("Framebuffer error: ")+sErr);
break;
- case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT:
+ case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT:
sErr = "GL_INCOMPLETE_ATTACHMENT";
break;
- case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT:
- sErr = "GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT";
- break;
- case GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT:
- sErr = "GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT";
+ case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:
+ sErr = "GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT";
break;
-#ifdef GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT
- // Missing in some versions of glext.h
- case GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT:
- sErr = "GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT";
+ case GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS:
+ sErr = "GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS";
break;
-#endif
+#ifndef AVG_ENABLE_EGL
case GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT:
sErr = "GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT";
break;
@@ -331,6 +396,7 @@ void FBO::checkError(const string& sContext) const
case GL_FRAMEBUFFER_BINDING_EXT:
sErr = "GL_FRAMEBUFFER_BINDING_EXT";
break;
+#endif
default:
sErr = "Unknown error";
break;
diff --git a/src/graphics/FBO.h b/src/graphics/FBO.h
index 680adf0..5872beb 100644
--- a/src/graphics/FBO.h
+++ b/src/graphics/FBO.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -25,10 +25,12 @@
#include "../api.h"
#include "GLTexture.h"
-#include "PBO.h"
+#ifndef AVG_ENABLE_EGL
+ #include "PBO.h"
+#endif
#include "VertexArray.h"
-#include "../base/Point.h"
+#include "../base/GLMHelper.h"
#include <boost/shared_ptr.hpp>
@@ -40,8 +42,8 @@ class AVG_API FBO
{
public:
FBO(const IntPoint& size, PixelFormat pf, unsigned numTextures=1,
- unsigned multisampleSamples=1, bool bUsePackedDepthStencil=false,
- bool bMipmap=false);
+ unsigned multisampleSamples=1, bool bUsePackedDepthStencil=false,
+ bool bUseStencil=false, bool bMipmap=false);
virtual ~FBO();
void activate() const;
@@ -54,6 +56,7 @@ public:
BitmapPtr getImageFromPBO() const;
GLTexturePtr getTex(int i=0) const;
const IntPoint& getSize() const;
+ unsigned getID() const;
static bool isFBOSupported();
static bool isMultisampleFBOSupported();
@@ -61,18 +64,22 @@ public:
void initCache();
static void deleteCache();
+ static void checkError(const std::string& sContext);
private:
void init();
- void checkError(const std::string& sContext) const;
+ void throwMultisampleError();
IntPoint m_Size;
PixelFormat m_PF;
unsigned m_MultisampleSamples;
bool m_bUsePackedDepthStencil;
+ bool m_bUseStencil;
bool m_bMipmap;
+#ifndef AVG_ENABLE_EGL
PBOPtr m_pOutputPBO;
+#endif
unsigned m_FBO;
std::vector<GLTexturePtr> m_pTextures;
unsigned m_StencilBuffer;
diff --git a/src/graphics/Filter.cpp b/src/graphics/Filter.cpp
index bdb4e8d..ab9e9b3 100644
--- a/src/graphics/Filter.cpp
+++ b/src/graphics/Filter.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/graphics/Filter.h b/src/graphics/Filter.h
index eb04e53..3fb5b00 100644
--- a/src/graphics/Filter.h
+++ b/src/graphics/Filter.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/graphics/Filter3x3.cpp b/src/graphics/Filter3x3.cpp
index b58c80a..592c19e 100644
--- a/src/graphics/Filter3x3.cpp
+++ b/src/graphics/Filter3x3.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -27,7 +27,7 @@
namespace avg {
-Filter3x3::Filter3x3(double Mat[3][3])
+Filter3x3::Filter3x3(float Mat[3][3])
: Filter()
{
for (int y = 0; y < 3; y++) {
diff --git a/src/graphics/Filter3x3.h b/src/graphics/Filter3x3.h
index 5d00070..0ec3881 100644
--- a/src/graphics/Filter3x3.h
+++ b/src/graphics/Filter3x3.h
@@ -1,6 +1,6 @@
//
-// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -37,40 +37,40 @@ namespace avg {
class AVG_API Filter3x3 : public Filter
{
public:
- Filter3x3(double Mat[3][3]);
+ Filter3x3(float Mat[3][3]);
virtual ~Filter3x3();
virtual BitmapPtr apply(BitmapPtr pBmpSource);
private:
template<class PIXEL>
- void convolveLine(const unsigned char * pSrc, unsigned char * pDest,
+ void convolveLine(const unsigned char * pSrc, unsigned char * pDest,
int lineLen, int stride) const;
- double m_Mat[3][3];
+ float m_Mat[3][3];
};
template<class PIXEL>
-void Filter3x3::convolveLine(const unsigned char * pSrc, unsigned char * pDest,
- int lineLen, int stride) const
+void Filter3x3::convolveLine(const unsigned char * pSrc, unsigned char * pDest,
+ int lineLen, int stride) const
{
PIXEL * pSrcPixel = (PIXEL *)pSrc;
PIXEL * pDestPixel = (PIXEL *)pDest;
for (int x = 0; x < lineLen; ++x) {
- double newR = 0;
- double newG = 0;
- double newB = 0;
+ float newR = 0;
+ float newG = 0;
+ float newB = 0;
for (int i = 0; i < 3; i++) {
+ unsigned char * pLineStart = (unsigned char *)pSrcPixel+i*stride;
for (int j = 0; j < 3; j++) {
- unsigned char * pLineStart = (unsigned char *)pSrcPixel+i*stride;
PIXEL SrcPixel = *((PIXEL *)pLineStart+j);
newR += SrcPixel.getR()*m_Mat[i][j];
newG += SrcPixel.getG()*m_Mat[i][j];
newB += SrcPixel.getB()*m_Mat[i][j];
}
}
- *pDestPixel = PIXEL((unsigned char)newR, (unsigned char)newG,
+ *pDestPixel = PIXEL((unsigned char)newR, (unsigned char)newG,
(unsigned char)newB);
-
+
pSrcPixel++;
pDestPixel++;
}
diff --git a/src/graphics/FilterBandpass.cpp b/src/graphics/FilterBandpass.cpp
index 393b03b..f4a3546 100644
--- a/src/graphics/FilterBandpass.cpp
+++ b/src/graphics/FilterBandpass.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -31,7 +31,7 @@ using namespace std;
namespace avg {
-FilterBandpass::FilterBandpass(double lowWidth, double highWidth)
+FilterBandpass::FilterBandpass(float lowWidth, float highWidth)
: m_HighpassFilter(highWidth),
m_LowpassFilter(lowWidth)
{
diff --git a/src/graphics/FilterBandpass.h b/src/graphics/FilterBandpass.h
index a6d24f3..c36a159 100644
--- a/src/graphics/FilterBandpass.h
+++ b/src/graphics/FilterBandpass.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -34,7 +34,7 @@ namespace avg {
// XXX: Warning, possibly buggy.
class AVG_API FilterBandpass: public Filter {
public:
- FilterBandpass(double lowWidth, double highWidth);
+ FilterBandpass(float lowWidth, float highWidth);
virtual ~FilterBandpass();
virtual BitmapPtr apply(BitmapPtr pBmpSrc);
diff --git a/src/graphics/FilterBlur.cpp b/src/graphics/FilterBlur.cpp
index 98f9307..99f48e7 100644
--- a/src/graphics/FilterBlur.cpp
+++ b/src/graphics/FilterBlur.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/graphics/FilterBlur.h b/src/graphics/FilterBlur.h
index a558897..f83e51a 100644
--- a/src/graphics/FilterBlur.h
+++ b/src/graphics/FilterBlur.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/graphics/FilterConvol.h b/src/graphics/FilterConvol.h
index f6f3efd..18ebbd6 100644
--- a/src/graphics/FilterConvol.h
+++ b/src/graphics/FilterConvol.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -38,7 +38,7 @@ template<class Pixel>
class AVG_API FilterConvol : public Filter
{
public:
- FilterConvol(double *Mat,int n,int m, int offset=0);
+ FilterConvol(float *Mat,int n,int m, int offset=0);
virtual ~FilterConvol();
virtual BitmapPtr apply(BitmapPtr pBmpSource);
@@ -48,7 +48,7 @@ private:
int m_N;
int m_M;
int m_Offset;
- double *m_Mat;
+ float *m_Mat;
};
template <class Pixel>
void FilterConvol<Pixel>::convolveLine(const unsigned char* pSrc, unsigned char* pDest,
@@ -57,9 +57,9 @@ void FilterConvol<Pixel>::convolveLine(const unsigned char* pSrc, unsigned char*
Pixel * pSrcPixel = (Pixel *)pSrc;
Pixel * pDestPixel = (Pixel *)pDest;
for (int x=0; x<lineLen; ++x) {
- double NewR = 0;
- double NewG = 0;
- double NewB = 0;
+ float NewR = 0;
+ float NewG = 0;
+ float NewB = 0;
for (int i=0; i<m_N; i++) {
for (int j=0; j<m_N; j++) {
@@ -84,7 +84,7 @@ void FilterConvol<Pixel8>::convolveLine(const unsigned char* pSrc, unsigned char
Pixel8 * pSrcPixel = (Pixel8 *)pSrc;
Pixel8 * pDestPixel = (Pixel8 *)pDest;
for (int x=0; x<lineLen; ++x) {
- double New = 0;
+ float New = 0;
for (int i=0; i<m_N; i++) {
for (int j=0; j<m_N; j++) {
@@ -100,13 +100,13 @@ void FilterConvol<Pixel8>::convolveLine(const unsigned char* pSrc, unsigned char
}
}
template <class Pixel>
-FilterConvol<Pixel>::FilterConvol(double *Mat, int n, int m, int offset)
+FilterConvol<Pixel>::FilterConvol(float *Mat, int n, int m, int offset)
: Filter(),
m_N(n),
m_M(m),
m_Offset(offset)
{
- m_Mat = new double[n*m];
+ m_Mat = new float[n*m];
for (int y=0; y<n; y++) {
for (int x=0; x<m; x++) {
m_Mat[m_N*y+x] = Mat[m_N*y+x];
diff --git a/src/graphics/FilterDilation.cpp b/src/graphics/FilterDilation.cpp
index 44fbc6e..11adaa2 100644
--- a/src/graphics/FilterDilation.cpp
+++ b/src/graphics/FilterDilation.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/graphics/FilterDilation.h b/src/graphics/FilterDilation.h
index fecd0f6..6ccb556 100644
--- a/src/graphics/FilterDilation.h
+++ b/src/graphics/FilterDilation.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/graphics/FilterErosion.cpp b/src/graphics/FilterErosion.cpp
index 3f44ade..72818f6 100644
--- a/src/graphics/FilterErosion.cpp
+++ b/src/graphics/FilterErosion.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/graphics/FilterErosion.h b/src/graphics/FilterErosion.h
index 539fd75..e3da478 100644
--- a/src/graphics/FilterErosion.h
+++ b/src/graphics/FilterErosion.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/graphics/FilterFastBandpass.cpp b/src/graphics/FilterFastBandpass.cpp
index 83c4634..0cf6fd2 100644
--- a/src/graphics/FilterFastBandpass.cpp
+++ b/src/graphics/FilterFastBandpass.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/graphics/FilterFastBandpass.h b/src/graphics/FilterFastBandpass.h
index f75e336..c3ec10e 100644
--- a/src/graphics/FilterFastBandpass.h
+++ b/src/graphics/FilterFastBandpass.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/graphics/FilterFastDownscale.cpp b/src/graphics/FilterFastDownscale.cpp
index 95f7378..9ed9900 100644
--- a/src/graphics/FilterFastDownscale.cpp
+++ b/src/graphics/FilterFastDownscale.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/graphics/FilterFastDownscale.h b/src/graphics/FilterFastDownscale.h
index 6ca6826..dc4ada8 100644
--- a/src/graphics/FilterFastDownscale.h
+++ b/src/graphics/FilterFastDownscale.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/graphics/FilterFloodfill.h b/src/graphics/FilterFloodfill.h
index 41fb18f..f4a7ebf 100644
--- a/src/graphics/FilterFloodfill.h
+++ b/src/graphics/FilterFloodfill.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -26,7 +26,7 @@
#include "../api.h"
#include "Filter.h"
-#include "../base/Point.h"
+#include "../base/GLMHelper.h"
#include <stack>
diff --git a/src/graphics/FilterGauss.cpp b/src/graphics/FilterGauss.cpp
index 370c4f4..ddfe086 100644
--- a/src/graphics/FilterGauss.cpp
+++ b/src/graphics/FilterGauss.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -34,7 +34,7 @@ using namespace std;
namespace avg {
-FilterGauss::FilterGauss(double radius)
+FilterGauss::FilterGauss(float radius)
: m_Radius(radius)
{
calcKernel();
@@ -183,12 +183,12 @@ void FilterGauss::dumpKernel()
void FilterGauss::calcKernel()
{
- double FloatKernel[15];
- double Sum = 0;
+ float FloatKernel[15];
+ float Sum = 0;
int intRadius = int(ceil(m_Radius));
m_KernelWidth = intRadius*2+1;
for (int i = 0; i <= intRadius; ++i) {
- FloatKernel[intRadius+i] = exp(-i*i/m_Radius-1)/sqrt(2*M_PI);
+ FloatKernel[intRadius+i] = float(exp(-i*i/m_Radius-1)/sqrt(2*PI));
FloatKernel[intRadius-i] = FloatKernel[intRadius+i];
Sum += FloatKernel[intRadius+i];
if (i != 0) {
diff --git a/src/graphics/FilterGauss.h b/src/graphics/FilterGauss.h
index 9577cc5..e06c96a 100644
--- a/src/graphics/FilterGauss.h
+++ b/src/graphics/FilterGauss.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -32,7 +32,7 @@ namespace avg {
class AVG_API FilterGauss: public Filter{
public:
- FilterGauss(double Radius);
+ FilterGauss(float Radius);
virtual ~FilterGauss();
virtual BitmapPtr apply(BitmapPtr pBmpSrc);
@@ -42,7 +42,7 @@ class AVG_API FilterGauss: public Filter{
private:
void calcKernel();
- double m_Radius;
+ float m_Radius;
int m_KernelWidth;
int m_Kernel[15];
};
diff --git a/src/graphics/FilterGetAlpha.cpp b/src/graphics/FilterGetAlpha.cpp
index efc1126..764c47d 100644
--- a/src/graphics/FilterGetAlpha.cpp
+++ b/src/graphics/FilterGetAlpha.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/graphics/FilterGetAlpha.h b/src/graphics/FilterGetAlpha.h
index 6a3afd6..4782036 100644
--- a/src/graphics/FilterGetAlpha.h
+++ b/src/graphics/FilterGetAlpha.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/graphics/FilterHighpass.cpp b/src/graphics/FilterHighpass.cpp
index eee48f5..d2c2679 100644
--- a/src/graphics/FilterHighpass.cpp
+++ b/src/graphics/FilterHighpass.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/graphics/FilterHighpass.h b/src/graphics/FilterHighpass.h
index cdb41b2..5392e1c 100644
--- a/src/graphics/FilterHighpass.h
+++ b/src/graphics/FilterHighpass.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/graphics/FilterIntensity.cpp b/src/graphics/FilterIntensity.cpp
index bbeb7a2..3ffdd30 100644
--- a/src/graphics/FilterIntensity.cpp
+++ b/src/graphics/FilterIntensity.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -27,7 +27,7 @@
namespace avg {
-FilterIntensity::FilterIntensity(int offset, double factor)
+FilterIntensity::FilterIntensity(int offset, float factor)
: m_Offset(offset),
m_Factor(factor)
{
diff --git a/src/graphics/FilterIntensity.h b/src/graphics/FilterIntensity.h
index 27dfd9d..2428435 100644
--- a/src/graphics/FilterIntensity.h
+++ b/src/graphics/FilterIntensity.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -30,13 +30,13 @@ namespace avg {
class AVG_API FilterIntensity : public Filter
{
public:
- FilterIntensity(int offset, double factor);
+ FilterIntensity(int offset, float factor);
virtual ~FilterIntensity();
virtual void applyInPlace(BitmapPtr pBmp) ;
private:
int m_Offset;
- double m_Factor;
+ float m_Factor;
};
} // namespace
diff --git a/src/graphics/FilterMask.cpp b/src/graphics/FilterMask.cpp
index b843f26..d5fa6d0 100644
--- a/src/graphics/FilterMask.cpp
+++ b/src/graphics/FilterMask.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/graphics/FilterMask.h b/src/graphics/FilterMask.h
index 761b0ce..226409f 100644
--- a/src/graphics/FilterMask.h
+++ b/src/graphics/FilterMask.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/graphics/FilterNormalize.cpp b/src/graphics/FilterNormalize.cpp
index 985cb82..7a27684 100644
--- a/src/graphics/FilterNormalize.cpp
+++ b/src/graphics/FilterNormalize.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -44,7 +44,7 @@ void FilterNormalize::applyInPlace(BitmapPtr pBmp)
min -= 2;
max += 2;
}
- double factor = 255./(max-min);
+ float factor = 255.f/(max-min);
if (factor > 10) {
factor = 10;
}
diff --git a/src/graphics/FilterNormalize.h b/src/graphics/FilterNormalize.h
index ad51cf2..1947215 100644
--- a/src/graphics/FilterNormalize.h
+++ b/src/graphics/FilterNormalize.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/graphics/FilterResizeBilinear.cpp b/src/graphics/FilterResizeBilinear.cpp
index cfc96e7..750e07a 100644
--- a/src/graphics/FilterResizeBilinear.cpp
+++ b/src/graphics/FilterResizeBilinear.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/graphics/FilterResizeBilinear.h b/src/graphics/FilterResizeBilinear.h
index 8bbddf0..11069d8 100644
--- a/src/graphics/FilterResizeBilinear.h
+++ b/src/graphics/FilterResizeBilinear.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/graphics/FilterResizeGaussian.cpp b/src/graphics/FilterResizeGaussian.cpp
index 13e2b96..aae6416 100644
--- a/src/graphics/FilterResizeGaussian.cpp
+++ b/src/graphics/FilterResizeGaussian.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -25,7 +25,7 @@
namespace avg {
-FilterResizeGaussian::FilterResizeGaussian(const IntPoint& newSize, double radius)
+FilterResizeGaussian::FilterResizeGaussian(const IntPoint& newSize, float radius)
: m_NewSize(newSize),
m_Radius(radius)
{
diff --git a/src/graphics/FilterResizeGaussian.h b/src/graphics/FilterResizeGaussian.h
index 0afd926..274aa30 100644
--- a/src/graphics/FilterResizeGaussian.h
+++ b/src/graphics/FilterResizeGaussian.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -28,12 +28,12 @@ namespace avg {
class AVG_API FilterResizeGaussian : public Filter
{
public:
- FilterResizeGaussian(const IntPoint& newSize, double radius);
+ FilterResizeGaussian(const IntPoint& newSize, float radius);
virtual BitmapPtr apply(BitmapPtr pBmpSrc);
private:
IntPoint m_NewSize;
- double m_Radius;
+ float m_Radius;
};
}
diff --git a/src/graphics/FilterThreshold.cpp b/src/graphics/FilterThreshold.cpp
index 0c5d1c6..a6fddde 100644
--- a/src/graphics/FilterThreshold.cpp
+++ b/src/graphics/FilterThreshold.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/graphics/FilterThreshold.h b/src/graphics/FilterThreshold.h
index 2dec300..274fc94 100644
--- a/src/graphics/FilterThreshold.h
+++ b/src/graphics/FilterThreshold.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/graphics/FilterUnmultiplyAlpha.cpp b/src/graphics/FilterUnmultiplyAlpha.cpp
index 568be00..09bf2ff 100644
--- a/src/graphics/FilterUnmultiplyAlpha.cpp
+++ b/src/graphics/FilterUnmultiplyAlpha.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -23,6 +23,7 @@
#include "Pixeldefs.h"
#include "../base/Exception.h"
+#include "../base/ScopeTimer.h"
namespace avg {
@@ -36,12 +37,15 @@ FilterUnmultiplyAlpha::~FilterUnmultiplyAlpha()
}
+static ProfilingZoneID ProfilingZone("FilterUnmultiplyAlpha");
+
void FilterUnmultiplyAlpha::applyInPlace(BitmapPtr pBmp)
{
+ ScopeTimer Timer(ProfilingZone);
AVG_ASSERT(pBmp->getBytesPerPixel() == 4);
IntPoint size = pBmp->getSize();
for (int y = 0; y < size.y; y++) {
- unsigned char * pPixel = pBmp->getPixels()+y*pBmp->getStride();
+ unsigned char * pPixel = pBmp->getPixels() + y*pBmp->getStride();
for (int x = 0; x < size.x; x++) {
int alpha = *(pPixel+ALPHAPOS);
if (alpha != 0) {
@@ -52,6 +56,41 @@ void FilterUnmultiplyAlpha::applyInPlace(BitmapPtr pBmp)
pPixel += 4;
}
}
+ // The color values of transparent pixels are used in bilinear texture
+ // filtering in certain conditions. To avoid artifacts, we transfer the
+ // color from a neighboring non-transparent pixel.
+ for (int y = 1; y < size.y-1; y++) {
+ int stride = pBmp->getStride();
+ unsigned char * pPixel = pBmp->getPixels() + y*stride;
+ for (int x = 1; x < size.x-1; x++) {
+ int alpha = *(pPixel+ALPHAPOS);
+ if (alpha == 0) {
+ unsigned char * pSrcPixel = pPixel;
+ if (*(pPixel+4+ALPHAPOS) != 0) {
+ pSrcPixel = pPixel+4;
+ } else if (*(pPixel+stride+4+ALPHAPOS) != 0) {
+ pSrcPixel = pPixel+stride+4;
+ } else if (*(pPixel+stride+ALPHAPOS) != 0) {
+ pSrcPixel = pPixel+stride;
+ } else if (*(pPixel+stride-4+ALPHAPOS) != 0) {
+ pSrcPixel = pPixel+stride-4;
+ } else if (*(pPixel-4+ALPHAPOS) != 0) {
+ pSrcPixel = pPixel-4;
+ } else if (*(pPixel-stride-4+ALPHAPOS) != 0) {
+ pSrcPixel = pPixel-stride-4;
+ } else if (*(pPixel-stride+ALPHAPOS) != 0) {
+ pSrcPixel = pPixel-stride;
+ } else if (*(pPixel-stride+4+ALPHAPOS) != 0) {
+ pSrcPixel = pPixel-stride+4;
+ }
+
+ *(pPixel+REDPOS) = *(pSrcPixel+REDPOS);
+ *(pPixel+GREENPOS) = *(pSrcPixel+GREENPOS);
+ *(pPixel+BLUEPOS) = *(pSrcPixel+BLUEPOS);
+ }
+ pPixel += 4;
+ }
+ }
}
}
diff --git a/src/graphics/FilterUnmultiplyAlpha.h b/src/graphics/FilterUnmultiplyAlpha.h
index 628e27c..110785b 100644
--- a/src/graphics/FilterUnmultiplyAlpha.h
+++ b/src/graphics/FilterUnmultiplyAlpha.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -19,8 +19,8 @@
// Current versions can be found at www.libavg.de
//
-#ifndef _Filterfliprgba_H
-#define _Filterfliprgba_H
+#ifndef _FilterUnmultiplyAlpha_H
+#define _FilterUnmultiplyAlpha_H
#include "../api.h"
#include "Filter.h"
diff --git a/src/graphics/Filtercolorize.cpp b/src/graphics/Filtercolorize.cpp
index 867def3..c549f2d 100644
--- a/src/graphics/Filtercolorize.cpp
+++ b/src/graphics/Filtercolorize.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -28,45 +28,45 @@
namespace avg {
// From Foley, van Dam p. 596 incl. addendum fixes.
-unsigned char hls_value(double n1, double n2, double hue)
+unsigned char hls_value(float n1, float n2, float hue)
{
if (hue>360)
hue-=360;
if (hue<0)
hue+=360;
- double rv;
+ float rv;
if (hue<60)
- rv = n1+(n2-n1)*hue/60.0;
+ rv = n1+(n2-n1)*hue/60;
else if (hue<180)
rv = n2;
else if (hue<240)
- rv = n1+(n2-n1)*(240.0-hue)/60.0;
+ rv = n1+(n2-n1)*(240-hue)/60;
else
rv = n1;
return (unsigned char)(rv*255);
}
-Pixel24 hls2rgb (double h, double l, double s)
+Pixel24 hls2rgb (float h, float l, float s)
{
- double m1, m2;
+ float m1, m2;
l /= 255;
s /= 100;
// Warning: Foley, van Dam has a typo on the next line!
- m2 = (l<=0.5)?(l*(1.0+s)):(l+s-l*s);
- m1 = 2.0*l-m2;
- if (s<0.001) {
+ m2 = (l<=0.5f)?(l*(1.0f+s)):(l+s-l*s);
+ m1 = 2.0f*l-m2;
+ if (s<0.001f) {
return Pixel24((unsigned char)(l*255), (unsigned char)(l*255),
(unsigned char)(l*255));
} else {
- return Pixel24(hls_value(m1,m2,h+120.0),
+ return Pixel24(hls_value(m1,m2,h+120),
hls_value(m1,m2,h),
- hls_value(m1,m2,h-120.0));
+ hls_value(m1,m2,h-120));
}
}
-FilterColorize::FilterColorize(double hue, double saturation)
+FilterColorize::FilterColorize(float hue, float saturation)
: m_Hue(hue),
m_Saturation(saturation)
{
@@ -80,9 +80,9 @@ FilterColorize::~FilterColorize()
void FilterColorize::applyInPlace(BitmapPtr pBmp)
{
BitmapPtr pTempBmp (FilterGrayscale().apply(pBmp));
- Pixel24 colorTable[256];
+ Pixel32 colorTable[256];
for (int i=0; i<256; i++) {
- colorTable[i] = hls2rgb(m_Hue, i, m_Saturation);
+ colorTable[i] = hls2rgb(m_Hue, float(i), m_Saturation);
}
unsigned char * pSrcLine = pTempBmp->getPixels();
diff --git a/src/graphics/Filtercolorize.h b/src/graphics/Filtercolorize.h
index 0ef8448..6689dce 100644
--- a/src/graphics/Filtercolorize.h
+++ b/src/graphics/Filtercolorize.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -33,13 +33,13 @@ namespace avg {
class AVG_API FilterColorize : public Filter
{
public:
- FilterColorize(double hue, double saturation);
+ FilterColorize(float hue, float saturation);
virtual ~FilterColorize();
virtual void applyInPlace(BitmapPtr pBmp) ;
private:
- double m_Hue;
- double m_Saturation;
+ float m_Hue;
+ float m_Saturation;
};
} // namespace
diff --git a/src/graphics/Filterfill.h b/src/graphics/Filterfill.h
index aa81219..5e9fdbe 100644
--- a/src/graphics/Filterfill.h
+++ b/src/graphics/Filterfill.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/graphics/Filterfillrect.h b/src/graphics/Filterfillrect.h
index 5493fa2..c4614e8 100644
--- a/src/graphics/Filterfillrect.h
+++ b/src/graphics/Filterfillrect.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/graphics/Filterflip.cpp b/src/graphics/Filterflip.cpp
index eae54c5..d677270 100644
--- a/src/graphics/Filterflip.cpp
+++ b/src/graphics/Filterflip.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/graphics/Filterflip.h b/src/graphics/Filterflip.h
index 7c4f3b9..775afa2 100644
--- a/src/graphics/Filterflip.h
+++ b/src/graphics/Filterflip.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/graphics/FilterflipX.cpp b/src/graphics/FilterflipX.cpp
index 11d16e6..f67b462 100644
--- a/src/graphics/FilterflipX.cpp
+++ b/src/graphics/FilterflipX.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/graphics/FilterflipX.h b/src/graphics/FilterflipX.h
index 2952c26..9e62023 100644
--- a/src/graphics/FilterflipX.h
+++ b/src/graphics/FilterflipX.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/graphics/Filterfliprgb.cpp b/src/graphics/Filterfliprgb.cpp
index d06dfaf..8a0e8c3 100644
--- a/src/graphics/Filterfliprgb.cpp
+++ b/src/graphics/Filterfliprgb.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -24,10 +24,15 @@
#include "../base/Exception.h"
+#include <iostream>
+
+using namespace std;
+
namespace avg {
-FilterFlipRGB::FilterFlipRGB()
- : Filter()
+FilterFlipRGB::FilterFlipRGB(bool bChangePF)
+ : Filter(),
+ m_bChangePF(bChangePF)
{
}
@@ -38,29 +43,32 @@ FilterFlipRGB::~FilterFlipRGB()
void FilterFlipRGB::applyInPlace(BitmapPtr pBmp)
{
+ AVG_ASSERT(pBmp->getBytesPerPixel() >= 3);
PixelFormat PF = pBmp->getPixelFormat();
- switch(PF) {
- case B8G8R8A8:
- pBmp->setPixelFormat(R8G8B8A8);
- break;
- case B8G8R8X8:
- pBmp->setPixelFormat(R8G8B8X8);
- break;
- case R8G8B8A8:
- pBmp->setPixelFormat(B8G8R8A8);
- break;
- case R8G8B8X8:
- pBmp->setPixelFormat(B8G8R8X8);
- break;
- case R8G8B8:
- pBmp->setPixelFormat(B8G8R8);
- break;
- case B8G8R8:
- pBmp->setPixelFormat(R8G8B8);
- break;
- default:
- // Only 24 and 32 bpp supported.
- AVG_ASSERT(false);
+ if (m_bChangePF) {
+ switch(PF) {
+ case B8G8R8A8:
+ pBmp->setPixelFormat(R8G8B8A8);
+ break;
+ case B8G8R8X8:
+ pBmp->setPixelFormat(R8G8B8X8);
+ break;
+ case R8G8B8A8:
+ pBmp->setPixelFormat(B8G8R8A8);
+ break;
+ case R8G8B8X8:
+ pBmp->setPixelFormat(B8G8R8X8);
+ break;
+ case R8G8B8:
+ pBmp->setPixelFormat(B8G8R8);
+ break;
+ case B8G8R8:
+ pBmp->setPixelFormat(R8G8B8);
+ break;
+ default:
+ // Only 24 and 32 bpp supported.
+ AVG_ASSERT(false);
+ }
}
IntPoint size = pBmp->getSize();
for (int y = 0; y < size.y; y++) {
diff --git a/src/graphics/Filterfliprgb.h b/src/graphics/Filterfliprgb.h
index 1705f9a..11e6640 100644
--- a/src/graphics/Filterfliprgb.h
+++ b/src/graphics/Filterfliprgb.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -31,11 +31,12 @@ namespace avg {
class AVG_API FilterFlipRGB : public Filter
{
public:
- FilterFlipRGB();
- virtual ~FilterFlipRGB();
- virtual void applyInPlace(BitmapPtr pBmp) ;
+ FilterFlipRGB(bool bChangePF = true);
+ virtual ~FilterFlipRGB();
+ virtual void applyInPlace(BitmapPtr pBmp) ;
private:
+ bool m_bChangePF;
};
}
diff --git a/src/graphics/Filterfliprgba.cpp b/src/graphics/Filterfliprgba.cpp
index dc1bf90..6a92ec9 100644
--- a/src/graphics/Filterfliprgba.cpp
+++ b/src/graphics/Filterfliprgba.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/graphics/Filterfliprgba.h b/src/graphics/Filterfliprgba.h
index 6654c74..9722eec 100644
--- a/src/graphics/Filterfliprgba.h
+++ b/src/graphics/Filterfliprgba.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/graphics/Filterflipuv.cpp b/src/graphics/Filterflipuv.cpp
index acd4f31..29aab89 100644
--- a/src/graphics/Filterflipuv.cpp
+++ b/src/graphics/Filterflipuv.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/graphics/Filterflipuv.h b/src/graphics/Filterflipuv.h
index c0733a1..2dcfa88 100644
--- a/src/graphics/Filterflipuv.h
+++ b/src/graphics/Filterflipuv.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/graphics/Filtergrayscale.cpp b/src/graphics/Filtergrayscale.cpp
index 883cd6e..58a2336 100644
--- a/src/graphics/Filtergrayscale.cpp
+++ b/src/graphics/Filtergrayscale.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/graphics/Filtergrayscale.h b/src/graphics/Filtergrayscale.h
index ea53a56..79e2ad6 100644
--- a/src/graphics/Filtergrayscale.h
+++ b/src/graphics/Filtergrayscale.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/graphics/GL/glext.h b/src/graphics/GL/glext.h
index b241429..82b9f86 100644
--- a/src/graphics/GL/glext.h
+++ b/src/graphics/GL/glext.h
@@ -1,3 +1,4 @@
+
#ifndef __glext_h_
#define __glext_h_
@@ -6,7 +7,7 @@ extern "C" {
#endif
/*
-** Copyright (c) 2007 The Khronos Group Inc.
+** Copyright (c) 2007-2011 The Khronos Group Inc.
**
** Permission is hereby granted, free of charge, to any person obtaining a
** copy of this software and/or associated documentation files (the
@@ -28,6 +29,12 @@ extern "C" {
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
*/
+/* Header file version number, required by OpenGL ABI for Linux */
+/* glext.h last updated $Date: 2012-09-23 21:41:59 +0200 (Sun, 23 Sep 2012) $ */
+/* Current version at http://www.opengl.org/registry/ */
+#define GL_GLEXT_VERSION 72
+/* Function declaration macros - to move into glplatform.h */
+
#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)
#define WIN32_LEAN_AND_MEAN 1
#include <windows.h>
@@ -45,18 +52,12 @@ extern "C" {
/*************************************************************/
-/* Header file version number, required by OpenGL ABI for Linux */
-/* glext.h last updated 2009/03/19 */
-/* Current version at http://www.opengl.org/registry/ */
-#define GL_GLEXT_VERSION 48
-
#ifndef GL_VERSION_1_2
#define GL_UNSIGNED_BYTE_3_3_2 0x8032
#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033
#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034
#define GL_UNSIGNED_INT_8_8_8_8 0x8035
#define GL_UNSIGNED_INT_10_10_10_2 0x8036
-#define GL_RESCALE_NORMAL 0x803A
#define GL_TEXTURE_BINDING_3D 0x806A
#define GL_PACK_SKIP_IMAGES 0x806B
#define GL_PACK_IMAGE_HEIGHT 0x806C
@@ -83,17 +84,21 @@ extern "C" {
#define GL_TEXTURE_MAX_LOD 0x813B
#define GL_TEXTURE_BASE_LEVEL 0x813C
#define GL_TEXTURE_MAX_LEVEL 0x813D
-#define GL_LIGHT_MODEL_COLOR_CONTROL 0x81F8
-#define GL_SINGLE_COLOR 0x81F9
-#define GL_SEPARATE_SPECULAR_COLOR 0x81FA
#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12
#define GL_SMOOTH_POINT_SIZE_GRANULARITY 0x0B13
#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22
#define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23
-#define GL_ALIASED_POINT_SIZE_RANGE 0x846D
#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E
#endif
+#ifndef GL_VERSION_1_2_DEPRECATED
+#define GL_RESCALE_NORMAL 0x803A
+#define GL_LIGHT_MODEL_COLOR_CONTROL 0x81F8
+#define GL_SINGLE_COLOR 0x81F9
+#define GL_SEPARATE_SPECULAR_COLOR 0x81FA
+#define GL_ALIASED_POINT_SIZE_RANGE 0x846D
+#endif
+
#ifndef GL_ARB_imaging
#define GL_CONSTANT_COLOR 0x8001
#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002
@@ -106,6 +111,9 @@ extern "C" {
#define GL_BLEND_EQUATION 0x8009
#define GL_FUNC_SUBTRACT 0x800A
#define GL_FUNC_REVERSE_SUBTRACT 0x800B
+#endif
+
+#ifndef GL_ARB_imaging_DEPRECATED
#define GL_CONVOLUTION_1D 0x8010
#define GL_CONVOLUTION_2D 0x8011
#define GL_SEPARABLE_2D 0x8012
@@ -206,12 +214,6 @@ extern "C" {
#define GL_TEXTURE30 0x84DE
#define GL_TEXTURE31 0x84DF
#define GL_ACTIVE_TEXTURE 0x84E0
-#define GL_CLIENT_ACTIVE_TEXTURE 0x84E1
-#define GL_MAX_TEXTURE_UNITS 0x84E2
-#define GL_TRANSPOSE_MODELVIEW_MATRIX 0x84E3
-#define GL_TRANSPOSE_PROJECTION_MATRIX 0x84E4
-#define GL_TRANSPOSE_TEXTURE_MATRIX 0x84E5
-#define GL_TRANSPOSE_COLOR_MATRIX 0x84E6
#define GL_MULTISAMPLE 0x809D
#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E
#define GL_SAMPLE_ALPHA_TO_ONE 0x809F
@@ -220,9 +222,6 @@ extern "C" {
#define GL_SAMPLES 0x80A9
#define GL_SAMPLE_COVERAGE_VALUE 0x80AA
#define GL_SAMPLE_COVERAGE_INVERT 0x80AB
-#define GL_MULTISAMPLE_BIT 0x20000000
-#define GL_NORMAL_MAP 0x8511
-#define GL_REFLECTION_MAP 0x8512
#define GL_TEXTURE_CUBE_MAP 0x8513
#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514
#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515
@@ -233,10 +232,6 @@ extern "C" {
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A
#define GL_PROXY_TEXTURE_CUBE_MAP 0x851B
#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C
-#define GL_COMPRESSED_ALPHA 0x84E9
-#define GL_COMPRESSED_LUMINANCE 0x84EA
-#define GL_COMPRESSED_LUMINANCE_ALPHA 0x84EB
-#define GL_COMPRESSED_INTENSITY 0x84EC
#define GL_COMPRESSED_RGB 0x84ED
#define GL_COMPRESSED_RGBA 0x84EE
#define GL_TEXTURE_COMPRESSION_HINT 0x84EF
@@ -245,6 +240,22 @@ extern "C" {
#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3
#define GL_CLAMP_TO_BORDER 0x812D
+#endif
+
+#ifndef GL_VERSION_1_3_DEPRECATED
+#define GL_CLIENT_ACTIVE_TEXTURE 0x84E1
+#define GL_MAX_TEXTURE_UNITS 0x84E2
+#define GL_TRANSPOSE_MODELVIEW_MATRIX 0x84E3
+#define GL_TRANSPOSE_PROJECTION_MATRIX 0x84E4
+#define GL_TRANSPOSE_TEXTURE_MATRIX 0x84E5
+#define GL_TRANSPOSE_COLOR_MATRIX 0x84E6
+#define GL_MULTISAMPLE_BIT 0x20000000
+#define GL_NORMAL_MAP 0x8511
+#define GL_REFLECTION_MAP 0x8512
+#define GL_COMPRESSED_ALPHA 0x84E9
+#define GL_COMPRESSED_LUMINANCE 0x84EA
+#define GL_COMPRESSED_LUMINANCE_ALPHA 0x84EB
+#define GL_COMPRESSED_INTENSITY 0x84EC
#define GL_COMBINE 0x8570
#define GL_COMBINE_RGB 0x8571
#define GL_COMBINE_ALPHA 0x8572
@@ -276,16 +287,26 @@ extern "C" {
#define GL_BLEND_SRC_RGB 0x80C9
#define GL_BLEND_DST_ALPHA 0x80CA
#define GL_BLEND_SRC_ALPHA 0x80CB
-#define GL_POINT_SIZE_MIN 0x8126
-#define GL_POINT_SIZE_MAX 0x8127
#define GL_POINT_FADE_THRESHOLD_SIZE 0x8128
-#define GL_POINT_DISTANCE_ATTENUATION 0x8129
-#define GL_GENERATE_MIPMAP 0x8191
-#define GL_GENERATE_MIPMAP_HINT 0x8192
#define GL_DEPTH_COMPONENT16 0x81A5
#define GL_DEPTH_COMPONENT24 0x81A6
#define GL_DEPTH_COMPONENT32 0x81A7
#define GL_MIRRORED_REPEAT 0x8370
+#define GL_MAX_TEXTURE_LOD_BIAS 0x84FD
+#define GL_TEXTURE_LOD_BIAS 0x8501
+#define GL_INCR_WRAP 0x8507
+#define GL_DECR_WRAP 0x8508
+#define GL_TEXTURE_DEPTH_SIZE 0x884A
+#define GL_TEXTURE_COMPARE_MODE 0x884C
+#define GL_TEXTURE_COMPARE_FUNC 0x884D
+#endif
+
+#ifndef GL_VERSION_1_4_DEPRECATED
+#define GL_POINT_SIZE_MIN 0x8126
+#define GL_POINT_SIZE_MAX 0x8127
+#define GL_POINT_DISTANCE_ATTENUATION 0x8129
+#define GL_GENERATE_MIPMAP 0x8191
+#define GL_GENERATE_MIPMAP_HINT 0x8192
#define GL_FOG_COORDINATE_SOURCE 0x8450
#define GL_FOG_COORDINATE 0x8451
#define GL_FRAGMENT_DEPTH 0x8452
@@ -301,15 +322,8 @@ extern "C" {
#define GL_SECONDARY_COLOR_ARRAY_STRIDE 0x845C
#define GL_SECONDARY_COLOR_ARRAY_POINTER 0x845D
#define GL_SECONDARY_COLOR_ARRAY 0x845E
-#define GL_MAX_TEXTURE_LOD_BIAS 0x84FD
#define GL_TEXTURE_FILTER_CONTROL 0x8500
-#define GL_TEXTURE_LOD_BIAS 0x8501
-#define GL_INCR_WRAP 0x8507
-#define GL_DECR_WRAP 0x8508
-#define GL_TEXTURE_DEPTH_SIZE 0x884A
#define GL_DEPTH_TEXTURE_MODE 0x884B
-#define GL_TEXTURE_COMPARE_MODE 0x884C
-#define GL_TEXTURE_COMPARE_FUNC 0x884D
#define GL_COMPARE_R_TO_TEXTURE 0x884E
#endif
@@ -324,15 +338,6 @@ extern "C" {
#define GL_ELEMENT_ARRAY_BUFFER 0x8893
#define GL_ARRAY_BUFFER_BINDING 0x8894
#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895
-#define GL_VERTEX_ARRAY_BUFFER_BINDING 0x8896
-#define GL_NORMAL_ARRAY_BUFFER_BINDING 0x8897
-#define GL_COLOR_ARRAY_BUFFER_BINDING 0x8898
-#define GL_INDEX_ARRAY_BUFFER_BINDING 0x8899
-#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING 0x889A
-#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING 0x889B
-#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING 0x889C
-#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING 0x889D
-#define GL_WEIGHT_ARRAY_BUFFER_BINDING 0x889E
#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F
#define GL_READ_ONLY 0x88B8
#define GL_WRITE_ONLY 0x88B9
@@ -350,31 +355,42 @@ extern "C" {
#define GL_DYNAMIC_READ 0x88E9
#define GL_DYNAMIC_COPY 0x88EA
#define GL_SAMPLES_PASSED 0x8914
-#define GL_FOG_COORD_SRC GL_FOG_COORDINATE_SOURCE
-#define GL_FOG_COORD GL_FOG_COORDINATE
-#define GL_CURRENT_FOG_COORD GL_CURRENT_FOG_COORDINATE
-#define GL_FOG_COORD_ARRAY_TYPE GL_FOG_COORDINATE_ARRAY_TYPE
-#define GL_FOG_COORD_ARRAY_STRIDE GL_FOG_COORDINATE_ARRAY_STRIDE
-#define GL_FOG_COORD_ARRAY_POINTER GL_FOG_COORDINATE_ARRAY_POINTER
-#define GL_FOG_COORD_ARRAY GL_FOG_COORDINATE_ARRAY
-#define GL_FOG_COORD_ARRAY_BUFFER_BINDING GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING
-#define GL_SRC0_RGB GL_SOURCE0_RGB
-#define GL_SRC1_RGB GL_SOURCE1_RGB
-#define GL_SRC2_RGB GL_SOURCE2_RGB
-#define GL_SRC0_ALPHA GL_SOURCE0_ALPHA
-#define GL_SRC1_ALPHA GL_SOURCE1_ALPHA
-#define GL_SRC2_ALPHA GL_SOURCE2_ALPHA
+#endif
+
+#ifndef GL_VERSION_1_5_DEPRECATED
+#define GL_VERTEX_ARRAY_BUFFER_BINDING 0x8896
+#define GL_NORMAL_ARRAY_BUFFER_BINDING 0x8897
+#define GL_COLOR_ARRAY_BUFFER_BINDING 0x8898
+#define GL_INDEX_ARRAY_BUFFER_BINDING 0x8899
+#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING 0x889A
+#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING 0x889B
+#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING 0x889C
+#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING 0x889D
+#define GL_WEIGHT_ARRAY_BUFFER_BINDING 0x889E
+#define GL_FOG_COORD_SRC 0x8450
+#define GL_FOG_COORD 0x8451
+#define GL_CURRENT_FOG_COORD 0x8453
+#define GL_FOG_COORD_ARRAY_TYPE 0x8454
+#define GL_FOG_COORD_ARRAY_STRIDE 0x8455
+#define GL_FOG_COORD_ARRAY_POINTER 0x8456
+#define GL_FOG_COORD_ARRAY 0x8457
+#define GL_FOG_COORD_ARRAY_BUFFER_BINDING 0x889D
+#define GL_SRC0_RGB 0x8580
+#define GL_SRC1_RGB 0x8581
+#define GL_SRC2_RGB 0x8582
+#define GL_SRC0_ALPHA 0x8588
+#define GL_SRC1_ALPHA 0x8589
+#define GL_SRC2_ALPHA 0x858A
#endif
#ifndef GL_VERSION_2_0
-#define GL_BLEND_EQUATION_RGB GL_BLEND_EQUATION
+#define GL_BLEND_EQUATION_RGB 0x8009
#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622
#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623
#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624
#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625
#define GL_CURRENT_VERTEX_ATTRIB 0x8626
#define GL_VERTEX_PROGRAM_POINT_SIZE 0x8642
-#define GL_VERTEX_PROGRAM_TWO_SIDE 0x8643
#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645
#define GL_STENCIL_BACK_FUNC 0x8800
#define GL_STENCIL_BACK_FAIL 0x8801
@@ -398,11 +414,8 @@ extern "C" {
#define GL_DRAW_BUFFER14 0x8833
#define GL_DRAW_BUFFER15 0x8834
#define GL_BLEND_EQUATION_ALPHA 0x883D
-#define GL_POINT_SPRITE 0x8861
-#define GL_COORD_REPLACE 0x8862
#define GL_MAX_VERTEX_ATTRIBS 0x8869
#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A
-#define GL_MAX_TEXTURE_COORDS 0x8871
#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872
#define GL_FRAGMENT_SHADER 0x8B30
#define GL_VERTEX_SHADER 0x8B31
@@ -453,8 +466,14 @@ extern "C" {
#define GL_STENCIL_BACK_WRITEMASK 0x8CA5
#endif
+#ifndef GL_VERSION_2_0_DEPRECATED
+#define GL_VERTEX_PROGRAM_TWO_SIDE 0x8643
+#define GL_POINT_SPRITE 0x8861
+#define GL_COORD_REPLACE 0x8862
+#define GL_MAX_TEXTURE_COORDS 0x8871
+#endif
+
#ifndef GL_VERSION_2_1
-#define GL_CURRENT_RASTER_SECONDARY_COLOR 0x845F
#define GL_PIXEL_PACK_BUFFER 0x88EB
#define GL_PIXEL_UNPACK_BUFFER 0x88EC
#define GL_PIXEL_PACK_BUFFER_BINDING 0x88ED
@@ -469,25 +488,31 @@ extern "C" {
#define GL_SRGB8 0x8C41
#define GL_SRGB_ALPHA 0x8C42
#define GL_SRGB8_ALPHA8 0x8C43
+#define GL_COMPRESSED_SRGB 0x8C48
+#define GL_COMPRESSED_SRGB_ALPHA 0x8C49
+#endif
+
+#ifndef GL_VERSION_2_1_DEPRECATED
+#define GL_CURRENT_RASTER_SECONDARY_COLOR 0x845F
#define GL_SLUMINANCE_ALPHA 0x8C44
#define GL_SLUMINANCE8_ALPHA8 0x8C45
#define GL_SLUMINANCE 0x8C46
#define GL_SLUMINANCE8 0x8C47
-#define GL_COMPRESSED_SRGB 0x8C48
-#define GL_COMPRESSED_SRGB_ALPHA 0x8C49
#define GL_COMPRESSED_SLUMINANCE 0x8C4A
#define GL_COMPRESSED_SLUMINANCE_ALPHA 0x8C4B
#endif
#ifndef GL_VERSION_3_0
-#define GL_COMPARE_REF_TO_TEXTURE GL_COMPARE_R_TO_TEXTURE_ARB
-#define GL_CLIP_DISTANCE0 GL_CLIP_PLANE0
-#define GL_CLIP_DISTANCE1 GL_CLIP_PLANE1
-#define GL_CLIP_DISTANCE2 GL_CLIP_PLANE2
-#define GL_CLIP_DISTANCE3 GL_CLIP_PLANE3
-#define GL_CLIP_DISTANCE4 GL_CLIP_PLANE4
-#define GL_CLIP_DISTANCE5 GL_CLIP_PLANE5
-#define GL_MAX_CLIP_DISTANCES GL_MAX_CLIP_PLANES
+#define GL_COMPARE_REF_TO_TEXTURE 0x884E
+#define GL_CLIP_DISTANCE0 0x3000
+#define GL_CLIP_DISTANCE1 0x3001
+#define GL_CLIP_DISTANCE2 0x3002
+#define GL_CLIP_DISTANCE3 0x3003
+#define GL_CLIP_DISTANCE4 0x3004
+#define GL_CLIP_DISTANCE5 0x3005
+#define GL_CLIP_DISTANCE6 0x3006
+#define GL_CLIP_DISTANCE7 0x3007
+#define GL_MAX_CLIP_DISTANCES 0x0D32
#define GL_MAJOR_VERSION 0x821B
#define GL_MINOR_VERSION 0x821C
#define GL_NUM_EXTENSIONS 0x821D
@@ -505,19 +530,9 @@ extern "C" {
#define GL_MAX_ARRAY_TEXTURE_LAYERS 0x88FF
#define GL_MIN_PROGRAM_TEXEL_OFFSET 0x8904
#define GL_MAX_PROGRAM_TEXEL_OFFSET 0x8905
-#define GL_CLAMP_VERTEX_COLOR 0x891A
-#define GL_CLAMP_FRAGMENT_COLOR 0x891B
#define GL_CLAMP_READ_COLOR 0x891C
#define GL_FIXED_ONLY 0x891D
-#define GL_MAX_VARYING_COMPONENTS GL_MAX_VARYING_FLOATS
-#define GL_TEXTURE_RED_TYPE 0x8C10
-#define GL_TEXTURE_GREEN_TYPE 0x8C11
-#define GL_TEXTURE_BLUE_TYPE 0x8C12
-#define GL_TEXTURE_ALPHA_TYPE 0x8C13
-#define GL_TEXTURE_LUMINANCE_TYPE 0x8C14
-#define GL_TEXTURE_INTENSITY_TYPE 0x8C15
-#define GL_TEXTURE_DEPTH_TYPE 0x8C16
-#define GL_UNSIGNED_NORMALIZED 0x8C17
+#define GL_MAX_VARYING_COMPONENTS 0x8B4B
#define GL_TEXTURE_1D_ARRAY 0x8C18
#define GL_PROXY_TEXTURE_1D_ARRAY 0x8C19
#define GL_TEXTURE_2D_ARRAY 0x8C1A
@@ -559,7 +574,6 @@ extern "C" {
#define GL_RED_INTEGER 0x8D94
#define GL_GREEN_INTEGER 0x8D95
#define GL_BLUE_INTEGER 0x8D96
-#define GL_ALPHA_INTEGER 0x8D97
#define GL_RGB_INTEGER 0x8D98
#define GL_RGBA_INTEGER 0x8D99
#define GL_BGR_INTEGER 0x8D9A
@@ -588,6 +602,9 @@ extern "C" {
#define GL_QUERY_NO_WAIT 0x8E14
#define GL_QUERY_BY_REGION_WAIT 0x8E15
#define GL_QUERY_BY_REGION_NO_WAIT 0x8E16
+#define GL_BUFFER_ACCESS_FLAGS 0x911F
+#define GL_BUFFER_MAP_LENGTH 0x9120
+#define GL_BUFFER_MAP_OFFSET 0x9121
/* Reuse tokens from ARB_depth_buffer_float */
/* reuse GL_DEPTH_COMPONENT32F */
/* reuse GL_DEPTH32F_STENCIL8 */
@@ -615,8 +632,6 @@ extern "C" {
/* reuse GL_TEXTURE_GREEN_TYPE */
/* reuse GL_TEXTURE_BLUE_TYPE */
/* reuse GL_TEXTURE_ALPHA_TYPE */
-/* reuse GL_TEXTURE_LUMINANCE_TYPE */
-/* reuse GL_TEXTURE_INTENSITY_TYPE */
/* reuse GL_TEXTURE_DEPTH_TYPE */
/* reuse GL_UNSIGNED_NORMALIZED */
/* reuse GL_FRAMEBUFFER_BINDING */
@@ -716,6 +731,441 @@ extern "C" {
/* reuse GL_VERTEX_ARRAY_BINDING */
#endif
+#ifndef GL_VERSION_3_0_DEPRECATED
+#define GL_CLAMP_VERTEX_COLOR 0x891A
+#define GL_CLAMP_FRAGMENT_COLOR 0x891B
+#define GL_ALPHA_INTEGER 0x8D97
+/* Reuse tokens from ARB_framebuffer_object */
+/* reuse GL_TEXTURE_LUMINANCE_TYPE */
+/* reuse GL_TEXTURE_INTENSITY_TYPE */
+#endif
+
+#ifndef GL_VERSION_3_1
+#define GL_SAMPLER_2D_RECT 0x8B63
+#define GL_SAMPLER_2D_RECT_SHADOW 0x8B64
+#define GL_SAMPLER_BUFFER 0x8DC2
+#define GL_INT_SAMPLER_2D_RECT 0x8DCD
+#define GL_INT_SAMPLER_BUFFER 0x8DD0
+#define GL_UNSIGNED_INT_SAMPLER_2D_RECT 0x8DD5
+#define GL_UNSIGNED_INT_SAMPLER_BUFFER 0x8DD8
+#define GL_TEXTURE_BUFFER 0x8C2A
+#define GL_MAX_TEXTURE_BUFFER_SIZE 0x8C2B
+#define GL_TEXTURE_BINDING_BUFFER 0x8C2C
+#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING 0x8C2D
+#define GL_TEXTURE_BUFFER_FORMAT 0x8C2E
+#define GL_TEXTURE_RECTANGLE 0x84F5
+#define GL_TEXTURE_BINDING_RECTANGLE 0x84F6
+#define GL_PROXY_TEXTURE_RECTANGLE 0x84F7
+#define GL_MAX_RECTANGLE_TEXTURE_SIZE 0x84F8
+#define GL_RED_SNORM 0x8F90
+#define GL_RG_SNORM 0x8F91
+#define GL_RGB_SNORM 0x8F92
+#define GL_RGBA_SNORM 0x8F93
+#define GL_R8_SNORM 0x8F94
+#define GL_RG8_SNORM 0x8F95
+#define GL_RGB8_SNORM 0x8F96
+#define GL_RGBA8_SNORM 0x8F97
+#define GL_R16_SNORM 0x8F98
+#define GL_RG16_SNORM 0x8F99
+#define GL_RGB16_SNORM 0x8F9A
+#define GL_RGBA16_SNORM 0x8F9B
+#define GL_SIGNED_NORMALIZED 0x8F9C
+#define GL_PRIMITIVE_RESTART 0x8F9D
+#define GL_PRIMITIVE_RESTART_INDEX 0x8F9E
+/* Reuse tokens from ARB_copy_buffer */
+/* reuse GL_COPY_READ_BUFFER */
+/* reuse GL_COPY_WRITE_BUFFER */
+/* Reuse tokens from ARB_draw_instanced (none) */
+/* Reuse tokens from ARB_uniform_buffer_object */
+/* reuse GL_UNIFORM_BUFFER */
+/* reuse GL_UNIFORM_BUFFER_BINDING */
+/* reuse GL_UNIFORM_BUFFER_START */
+/* reuse GL_UNIFORM_BUFFER_SIZE */
+/* reuse GL_MAX_VERTEX_UNIFORM_BLOCKS */
+/* reuse GL_MAX_FRAGMENT_UNIFORM_BLOCKS */
+/* reuse GL_MAX_COMBINED_UNIFORM_BLOCKS */
+/* reuse GL_MAX_UNIFORM_BUFFER_BINDINGS */
+/* reuse GL_MAX_UNIFORM_BLOCK_SIZE */
+/* reuse GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS */
+/* reuse GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS */
+/* reuse GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT */
+/* reuse GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH */
+/* reuse GL_ACTIVE_UNIFORM_BLOCKS */
+/* reuse GL_UNIFORM_TYPE */
+/* reuse GL_UNIFORM_SIZE */
+/* reuse GL_UNIFORM_NAME_LENGTH */
+/* reuse GL_UNIFORM_BLOCK_INDEX */
+/* reuse GL_UNIFORM_OFFSET */
+/* reuse GL_UNIFORM_ARRAY_STRIDE */
+/* reuse GL_UNIFORM_MATRIX_STRIDE */
+/* reuse GL_UNIFORM_IS_ROW_MAJOR */
+/* reuse GL_UNIFORM_BLOCK_BINDING */
+/* reuse GL_UNIFORM_BLOCK_DATA_SIZE */
+/* reuse GL_UNIFORM_BLOCK_NAME_LENGTH */
+/* reuse GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS */
+/* reuse GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES */
+/* reuse GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER */
+/* reuse GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER */
+/* reuse GL_INVALID_INDEX */
+#endif
+
+#ifndef GL_VERSION_3_2
+#define GL_CONTEXT_CORE_PROFILE_BIT 0x00000001
+#define GL_CONTEXT_COMPATIBILITY_PROFILE_BIT 0x00000002
+#define GL_LINES_ADJACENCY 0x000A
+#define GL_LINE_STRIP_ADJACENCY 0x000B
+#define GL_TRIANGLES_ADJACENCY 0x000C
+#define GL_TRIANGLE_STRIP_ADJACENCY 0x000D
+#define GL_PROGRAM_POINT_SIZE 0x8642
+#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS 0x8C29
+#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED 0x8DA7
+#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS 0x8DA8
+#define GL_GEOMETRY_SHADER 0x8DD9
+#define GL_GEOMETRY_VERTICES_OUT 0x8916
+#define GL_GEOMETRY_INPUT_TYPE 0x8917
+#define GL_GEOMETRY_OUTPUT_TYPE 0x8918
+#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS 0x8DDF
+#define GL_MAX_GEOMETRY_OUTPUT_VERTICES 0x8DE0
+#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS 0x8DE1
+#define GL_MAX_VERTEX_OUTPUT_COMPONENTS 0x9122
+#define GL_MAX_GEOMETRY_INPUT_COMPONENTS 0x9123
+#define GL_MAX_GEOMETRY_OUTPUT_COMPONENTS 0x9124
+#define GL_MAX_FRAGMENT_INPUT_COMPONENTS 0x9125
+#define GL_CONTEXT_PROFILE_MASK 0x9126
+/* reuse GL_MAX_VARYING_COMPONENTS */
+/* reuse GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */
+/* Reuse tokens from ARB_depth_clamp */
+/* reuse GL_DEPTH_CLAMP */
+/* Reuse tokens from ARB_draw_elements_base_vertex (none) */
+/* Reuse tokens from ARB_fragment_coord_conventions (none) */
+/* Reuse tokens from ARB_provoking_vertex */
+/* reuse GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION */
+/* reuse GL_FIRST_VERTEX_CONVENTION */
+/* reuse GL_LAST_VERTEX_CONVENTION */
+/* reuse GL_PROVOKING_VERTEX */
+/* Reuse tokens from ARB_seamless_cube_map */
+/* reuse GL_TEXTURE_CUBE_MAP_SEAMLESS */
+/* Reuse tokens from ARB_sync */
+/* reuse GL_MAX_SERVER_WAIT_TIMEOUT */
+/* reuse GL_OBJECT_TYPE */
+/* reuse GL_SYNC_CONDITION */
+/* reuse GL_SYNC_STATUS */
+/* reuse GL_SYNC_FLAGS */
+/* reuse GL_SYNC_FENCE */
+/* reuse GL_SYNC_GPU_COMMANDS_COMPLETE */
+/* reuse GL_UNSIGNALED */
+/* reuse GL_SIGNALED */
+/* reuse GL_ALREADY_SIGNALED */
+/* reuse GL_TIMEOUT_EXPIRED */
+/* reuse GL_CONDITION_SATISFIED */
+/* reuse GL_WAIT_FAILED */
+/* reuse GL_TIMEOUT_IGNORED */
+/* reuse GL_SYNC_FLUSH_COMMANDS_BIT */
+/* reuse GL_TIMEOUT_IGNORED */
+/* Reuse tokens from ARB_texture_multisample */
+/* reuse GL_SAMPLE_POSITION */
+/* reuse GL_SAMPLE_MASK */
+/* reuse GL_SAMPLE_MASK_VALUE */
+/* reuse GL_MAX_SAMPLE_MASK_WORDS */
+/* reuse GL_TEXTURE_2D_MULTISAMPLE */
+/* reuse GL_PROXY_TEXTURE_2D_MULTISAMPLE */
+/* reuse GL_TEXTURE_2D_MULTISAMPLE_ARRAY */
+/* reuse GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY */
+/* reuse GL_TEXTURE_BINDING_2D_MULTISAMPLE */
+/* reuse GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY */
+/* reuse GL_TEXTURE_SAMPLES */
+/* reuse GL_TEXTURE_FIXED_SAMPLE_LOCATIONS */
+/* reuse GL_SAMPLER_2D_MULTISAMPLE */
+/* reuse GL_INT_SAMPLER_2D_MULTISAMPLE */
+/* reuse GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE */
+/* reuse GL_SAMPLER_2D_MULTISAMPLE_ARRAY */
+/* reuse GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY */
+/* reuse GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY */
+/* reuse GL_MAX_COLOR_TEXTURE_SAMPLES */
+/* reuse GL_MAX_DEPTH_TEXTURE_SAMPLES */
+/* reuse GL_MAX_INTEGER_SAMPLES */
+/* Don't need to reuse tokens from ARB_vertex_array_bgra since they're already in 1.2 core */
+#endif
+
+#ifndef GL_VERSION_3_3
+#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR 0x88FE
+/* Reuse tokens from ARB_blend_func_extended */
+/* reuse GL_SRC1_COLOR */
+/* reuse GL_ONE_MINUS_SRC1_COLOR */
+/* reuse GL_ONE_MINUS_SRC1_ALPHA */
+/* reuse GL_MAX_DUAL_SOURCE_DRAW_BUFFERS */
+/* Reuse tokens from ARB_explicit_attrib_location (none) */
+/* Reuse tokens from ARB_occlusion_query2 */
+/* reuse GL_ANY_SAMPLES_PASSED */
+/* Reuse tokens from ARB_sampler_objects */
+/* reuse GL_SAMPLER_BINDING */
+/* Reuse tokens from ARB_shader_bit_encoding (none) */
+/* Reuse tokens from ARB_texture_rgb10_a2ui */
+/* reuse GL_RGB10_A2UI */
+/* Reuse tokens from ARB_texture_swizzle */
+/* reuse GL_TEXTURE_SWIZZLE_R */
+/* reuse GL_TEXTURE_SWIZZLE_G */
+/* reuse GL_TEXTURE_SWIZZLE_B */
+/* reuse GL_TEXTURE_SWIZZLE_A */
+/* reuse GL_TEXTURE_SWIZZLE_RGBA */
+/* Reuse tokens from ARB_timer_query */
+/* reuse GL_TIME_ELAPSED */
+/* reuse GL_TIMESTAMP */
+/* Reuse tokens from ARB_vertex_type_2_10_10_10_rev */
+/* reuse GL_INT_2_10_10_10_REV */
+#endif
+
+#ifndef GL_VERSION_4_0
+#define GL_SAMPLE_SHADING 0x8C36
+#define GL_MIN_SAMPLE_SHADING_VALUE 0x8C37
+#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5E
+#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5F
+#define GL_TEXTURE_CUBE_MAP_ARRAY 0x9009
+#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY 0x900A
+#define GL_PROXY_TEXTURE_CUBE_MAP_ARRAY 0x900B
+#define GL_SAMPLER_CUBE_MAP_ARRAY 0x900C
+#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW 0x900D
+#define GL_INT_SAMPLER_CUBE_MAP_ARRAY 0x900E
+#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY 0x900F
+/* Reuse tokens from ARB_texture_query_lod (none) */
+/* Reuse tokens from ARB_draw_buffers_blend (none) */
+/* Reuse tokens from ARB_draw_indirect */
+/* reuse GL_DRAW_INDIRECT_BUFFER */
+/* reuse GL_DRAW_INDIRECT_BUFFER_BINDING */
+/* Reuse tokens from ARB_gpu_shader5 */
+/* reuse GL_GEOMETRY_SHADER_INVOCATIONS */
+/* reuse GL_MAX_GEOMETRY_SHADER_INVOCATIONS */
+/* reuse GL_MIN_FRAGMENT_INTERPOLATION_OFFSET */
+/* reuse GL_MAX_FRAGMENT_INTERPOLATION_OFFSET */
+/* reuse GL_FRAGMENT_INTERPOLATION_OFFSET_BITS */
+/* reuse GL_MAX_VERTEX_STREAMS */
+/* Reuse tokens from ARB_gpu_shader_fp64 */
+/* reuse GL_DOUBLE_VEC2 */
+/* reuse GL_DOUBLE_VEC3 */
+/* reuse GL_DOUBLE_VEC4 */
+/* reuse GL_DOUBLE_MAT2 */
+/* reuse GL_DOUBLE_MAT3 */
+/* reuse GL_DOUBLE_MAT4 */
+/* reuse GL_DOUBLE_MAT2x3 */
+/* reuse GL_DOUBLE_MAT2x4 */
+/* reuse GL_DOUBLE_MAT3x2 */
+/* reuse GL_DOUBLE_MAT3x4 */
+/* reuse GL_DOUBLE_MAT4x2 */
+/* reuse GL_DOUBLE_MAT4x3 */
+/* Reuse tokens from ARB_shader_subroutine */
+/* reuse GL_ACTIVE_SUBROUTINES */
+/* reuse GL_ACTIVE_SUBROUTINE_UNIFORMS */
+/* reuse GL_ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS */
+/* reuse GL_ACTIVE_SUBROUTINE_MAX_LENGTH */
+/* reuse GL_ACTIVE_SUBROUTINE_UNIFORM_MAX_LENGTH */
+/* reuse GL_MAX_SUBROUTINES */
+/* reuse GL_MAX_SUBROUTINE_UNIFORM_LOCATIONS */
+/* reuse GL_NUM_COMPATIBLE_SUBROUTINES */
+/* reuse GL_COMPATIBLE_SUBROUTINES */
+/* Reuse tokens from ARB_tessellation_shader */
+/* reuse GL_PATCHES */
+/* reuse GL_PATCH_VERTICES */
+/* reuse GL_PATCH_DEFAULT_INNER_LEVEL */
+/* reuse GL_PATCH_DEFAULT_OUTER_LEVEL */
+/* reuse GL_TESS_CONTROL_OUTPUT_VERTICES */
+/* reuse GL_TESS_GEN_MODE */
+/* reuse GL_TESS_GEN_SPACING */
+/* reuse GL_TESS_GEN_VERTEX_ORDER */
+/* reuse GL_TESS_GEN_POINT_MODE */
+/* reuse GL_ISOLINES */
+/* reuse GL_FRACTIONAL_ODD */
+/* reuse GL_FRACTIONAL_EVEN */
+/* reuse GL_MAX_PATCH_VERTICES */
+/* reuse GL_MAX_TESS_GEN_LEVEL */
+/* reuse GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS */
+/* reuse GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS */
+/* reuse GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS */
+/* reuse GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS */
+/* reuse GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS */
+/* reuse GL_MAX_TESS_PATCH_COMPONENTS */
+/* reuse GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS */
+/* reuse GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS */
+/* reuse GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS */
+/* reuse GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS */
+/* reuse GL_MAX_TESS_CONTROL_INPUT_COMPONENTS */
+/* reuse GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS */
+/* reuse GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS */
+/* reuse GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS */
+/* reuse GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_CONTROL_SHADER */
+/* reuse GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_EVALUATION_SHADER */
+/* reuse GL_TESS_EVALUATION_SHADER */
+/* reuse GL_TESS_CONTROL_SHADER */
+/* Reuse tokens from ARB_texture_buffer_object_rgb32 (none) */
+/* Reuse tokens from ARB_transform_feedback2 */
+/* reuse GL_TRANSFORM_FEEDBACK */
+/* reuse GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED */
+/* reuse GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE */
+/* reuse GL_TRANSFORM_FEEDBACK_BINDING */
+/* Reuse tokens from ARB_transform_feedback3 */
+/* reuse GL_MAX_TRANSFORM_FEEDBACK_BUFFERS */
+/* reuse GL_MAX_VERTEX_STREAMS */
+#endif
+
+#ifndef GL_VERSION_4_1
+/* Reuse tokens from ARB_ES2_compatibility */
+/* reuse GL_FIXED */
+/* reuse GL_IMPLEMENTATION_COLOR_READ_TYPE */
+/* reuse GL_IMPLEMENTATION_COLOR_READ_FORMAT */
+/* reuse GL_LOW_FLOAT */
+/* reuse GL_MEDIUM_FLOAT */
+/* reuse GL_HIGH_FLOAT */
+/* reuse GL_LOW_INT */
+/* reuse GL_MEDIUM_INT */
+/* reuse GL_HIGH_INT */
+/* reuse GL_SHADER_COMPILER */
+/* reuse GL_NUM_SHADER_BINARY_FORMATS */
+/* reuse GL_MAX_VERTEX_UNIFORM_VECTORS */
+/* reuse GL_MAX_VARYING_VECTORS */
+/* reuse GL_MAX_FRAGMENT_UNIFORM_VECTORS */
+/* Reuse tokens from ARB_get_program_binary */
+/* reuse GL_PROGRAM_BINARY_RETRIEVABLE_HINT */
+/* reuse GL_PROGRAM_BINARY_LENGTH */
+/* reuse GL_NUM_PROGRAM_BINARY_FORMATS */
+/* reuse GL_PROGRAM_BINARY_FORMATS */
+/* Reuse tokens from ARB_separate_shader_objects */
+/* reuse GL_VERTEX_SHADER_BIT */
+/* reuse GL_FRAGMENT_SHADER_BIT */
+/* reuse GL_GEOMETRY_SHADER_BIT */
+/* reuse GL_TESS_CONTROL_SHADER_BIT */
+/* reuse GL_TESS_EVALUATION_SHADER_BIT */
+/* reuse GL_ALL_SHADER_BITS */
+/* reuse GL_PROGRAM_SEPARABLE */
+/* reuse GL_ACTIVE_PROGRAM */
+/* reuse GL_PROGRAM_PIPELINE_BINDING */
+/* Reuse tokens from ARB_shader_precision (none) */
+/* Reuse tokens from ARB_vertex_attrib_64bit - all are in GL 3.0 and 4.0 already */
+/* Reuse tokens from ARB_viewport_array - some are in GL 1.1 and ARB_provoking_vertex already */
+/* reuse GL_MAX_VIEWPORTS */
+/* reuse GL_VIEWPORT_SUBPIXEL_BITS */
+/* reuse GL_VIEWPORT_BOUNDS_RANGE */
+/* reuse GL_LAYER_PROVOKING_VERTEX */
+/* reuse GL_VIEWPORT_INDEX_PROVOKING_VERTEX */
+/* reuse GL_UNDEFINED_VERTEX */
+#endif
+
+#ifndef GL_VERSION_4_2
+/* Reuse tokens from ARB_base_instance (none) */
+/* Reuse tokens from ARB_shading_language_420pack (none) */
+/* Reuse tokens from ARB_transform_feedback_instanced (none) */
+/* Reuse tokens from ARB_compressed_texture_pixel_storage */
+/* reuse GL_UNPACK_COMPRESSED_BLOCK_WIDTH */
+/* reuse GL_UNPACK_COMPRESSED_BLOCK_HEIGHT */
+/* reuse GL_UNPACK_COMPRESSED_BLOCK_DEPTH */
+/* reuse GL_UNPACK_COMPRESSED_BLOCK_SIZE */
+/* reuse GL_PACK_COMPRESSED_BLOCK_WIDTH */
+/* reuse GL_PACK_COMPRESSED_BLOCK_HEIGHT */
+/* reuse GL_PACK_COMPRESSED_BLOCK_DEPTH */
+/* reuse GL_PACK_COMPRESSED_BLOCK_SIZE */
+/* Reuse tokens from ARB_conservative_depth (none) */
+/* Reuse tokens from ARB_internalformat_query */
+/* reuse GL_NUM_SAMPLE_COUNTS */
+/* Reuse tokens from ARB_map_buffer_alignment */
+/* reuse GL_MIN_MAP_BUFFER_ALIGNMENT */
+/* Reuse tokens from ARB_shader_atomic_counters */
+/* reuse GL_ATOMIC_COUNTER_BUFFER */
+/* reuse GL_ATOMIC_COUNTER_BUFFER_BINDING */
+/* reuse GL_ATOMIC_COUNTER_BUFFER_START */
+/* reuse GL_ATOMIC_COUNTER_BUFFER_SIZE */
+/* reuse GL_ATOMIC_COUNTER_BUFFER_DATA_SIZE */
+/* reuse GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTERS */
+/* reuse GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTER_INDICES */
+/* reuse GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_VERTEX_SHADER */
+/* reuse GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_CONTROL_SHADER */
+/* reuse GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_EVALUATION_SHADER */
+/* reuse GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_GEOMETRY_SHADER */
+/* reuse GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_FRAGMENT_SHADER */
+/* reuse GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS */
+/* reuse GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS */
+/* reuse GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS */
+/* reuse GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS */
+/* reuse GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS */
+/* reuse GL_MAX_COMBINED_ATOMIC_COUNTER_BUFFERS */
+/* reuse GL_MAX_VERTEX_ATOMIC_COUNTERS */
+/* reuse GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS */
+/* reuse GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS */
+/* reuse GL_MAX_GEOMETRY_ATOMIC_COUNTERS */
+/* reuse GL_MAX_FRAGMENT_ATOMIC_COUNTERS */
+/* reuse GL_MAX_COMBINED_ATOMIC_COUNTERS */
+/* reuse GL_MAX_ATOMIC_COUNTER_BUFFER_SIZE */
+/* reuse GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS */
+/* reuse GL_ACTIVE_ATOMIC_COUNTER_BUFFERS */
+/* reuse GL_UNIFORM_ATOMIC_COUNTER_BUFFER_INDEX */
+/* reuse GL_UNSIGNED_INT_ATOMIC_COUNTER */
+/* Reuse tokens from ARB_shader_image_load_store */
+/* reuse GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT */
+/* reuse GL_ELEMENT_ARRAY_BARRIER_BIT */
+/* reuse GL_UNIFORM_BARRIER_BIT */
+/* reuse GL_TEXTURE_FETCH_BARRIER_BIT */
+/* reuse GL_SHADER_IMAGE_ACCESS_BARRIER_BIT */
+/* reuse GL_COMMAND_BARRIER_BIT */
+/* reuse GL_PIXEL_BUFFER_BARRIER_BIT */
+/* reuse GL_TEXTURE_UPDATE_BARRIER_BIT */
+/* reuse GL_BUFFER_UPDATE_BARRIER_BIT */
+/* reuse GL_FRAMEBUFFER_BARRIER_BIT */
+/* reuse GL_TRANSFORM_FEEDBACK_BARRIER_BIT */
+/* reuse GL_ATOMIC_COUNTER_BARRIER_BIT */
+/* reuse GL_ALL_BARRIER_BITS */
+/* reuse GL_MAX_IMAGE_UNITS */
+/* reuse GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS */
+/* reuse GL_IMAGE_BINDING_NAME */
+/* reuse GL_IMAGE_BINDING_LEVEL */
+/* reuse GL_IMAGE_BINDING_LAYERED */
+/* reuse GL_IMAGE_BINDING_LAYER */
+/* reuse GL_IMAGE_BINDING_ACCESS */
+/* reuse GL_IMAGE_1D */
+/* reuse GL_IMAGE_2D */
+/* reuse GL_IMAGE_3D */
+/* reuse GL_IMAGE_2D_RECT */
+/* reuse GL_IMAGE_CUBE */
+/* reuse GL_IMAGE_BUFFER */
+/* reuse GL_IMAGE_1D_ARRAY */
+/* reuse GL_IMAGE_2D_ARRAY */
+/* reuse GL_IMAGE_CUBE_MAP_ARRAY */
+/* reuse GL_IMAGE_2D_MULTISAMPLE */
+/* reuse GL_IMAGE_2D_MULTISAMPLE_ARRAY */
+/* reuse GL_INT_IMAGE_1D */
+/* reuse GL_INT_IMAGE_2D */
+/* reuse GL_INT_IMAGE_3D */
+/* reuse GL_INT_IMAGE_2D_RECT */
+/* reuse GL_INT_IMAGE_CUBE */
+/* reuse GL_INT_IMAGE_BUFFER */
+/* reuse GL_INT_IMAGE_1D_ARRAY */
+/* reuse GL_INT_IMAGE_2D_ARRAY */
+/* reuse GL_INT_IMAGE_CUBE_MAP_ARRAY */
+/* reuse GL_INT_IMAGE_2D_MULTISAMPLE */
+/* reuse GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY */
+/* reuse GL_UNSIGNED_INT_IMAGE_1D */
+/* reuse GL_UNSIGNED_INT_IMAGE_2D */
+/* reuse GL_UNSIGNED_INT_IMAGE_3D */
+/* reuse GL_UNSIGNED_INT_IMAGE_2D_RECT */
+/* reuse GL_UNSIGNED_INT_IMAGE_CUBE */
+/* reuse GL_UNSIGNED_INT_IMAGE_BUFFER */
+/* reuse GL_UNSIGNED_INT_IMAGE_1D_ARRAY */
+/* reuse GL_UNSIGNED_INT_IMAGE_2D_ARRAY */
+/* reuse GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY */
+/* reuse GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE */
+/* reuse GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY */
+/* reuse GL_MAX_IMAGE_SAMPLES */
+/* reuse GL_IMAGE_BINDING_FORMAT */
+/* reuse GL_IMAGE_FORMAT_COMPATIBILITY_TYPE */
+/* reuse GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE */
+/* reuse GL_IMAGE_FORMAT_COMPATIBILITY_BY_CLASS */
+/* reuse GL_MAX_VERTEX_IMAGE_UNIFORMS */
+/* reuse GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS */
+/* reuse GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS */
+/* reuse GL_MAX_GEOMETRY_IMAGE_UNIFORMS */
+/* reuse GL_MAX_FRAGMENT_IMAGE_UNIFORMS */
+/* reuse GL_MAX_COMBINED_IMAGE_UNIFORMS */
+/* Reuse tokens from ARB_shading_language_packing (none) */
+/* Reuse tokens from ARB_texture_storage */
+/* reuse GL_TEXTURE_IMMUTABLE_FORMAT */
+#endif
+
#ifndef GL_ARB_multitexture
#define GL_TEXTURE0_ARB 0x84C0
#define GL_TEXTURE1_ARB 0x84C1
@@ -1233,12 +1683,17 @@ extern "C" {
#define GL_FRAMEBUFFER_DEFAULT 0x8218
#define GL_FRAMEBUFFER_UNDEFINED 0x8219
#define GL_DEPTH_STENCIL_ATTACHMENT 0x821A
-#define GL_INDEX 0x8222
#define GL_MAX_RENDERBUFFER_SIZE 0x84E8
#define GL_DEPTH_STENCIL 0x84F9
#define GL_UNSIGNED_INT_24_8 0x84FA
#define GL_DEPTH24_STENCIL8 0x88F0
#define GL_TEXTURE_STENCIL_SIZE 0x88F1
+#define GL_TEXTURE_RED_TYPE 0x8C10
+#define GL_TEXTURE_GREEN_TYPE 0x8C11
+#define GL_TEXTURE_BLUE_TYPE 0x8C12
+#define GL_TEXTURE_ALPHA_TYPE 0x8C13
+#define GL_TEXTURE_DEPTH_TYPE 0x8C16
+#define GL_UNSIGNED_NORMALIZED 0x8C17
#define GL_FRAMEBUFFER_BINDING 0x8CA6
#define GL_DRAW_FRAMEBUFFER_BINDING GL_FRAMEBUFFER_BINDING
#define GL_RENDERBUFFER_BINDING 0x8CA7
@@ -1295,6 +1750,12 @@ extern "C" {
#define GL_MAX_SAMPLES 0x8D57
#endif
+#ifndef GL_ARB_framebuffer_object_DEPRECATED
+#define GL_INDEX 0x8222
+#define GL_TEXTURE_LUMINANCE_TYPE 0x8C14
+#define GL_TEXTURE_INTENSITY_TYPE 0x8C15
+#endif
+
#ifndef GL_ARB_framebuffer_sRGB
#define GL_FRAMEBUFFER_SRGB 0x8DB9
#endif
@@ -1327,6 +1788,7 @@ extern "C" {
#endif
#ifndef GL_ARB_instanced_arrays
+#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARB 0x88FE
#endif
#ifndef GL_ARB_map_buffer_range
@@ -1382,6 +1844,558 @@ extern "C" {
#define GL_VERTEX_ARRAY_BINDING 0x85B5
#endif
+#ifndef GL_ARB_uniform_buffer_object
+#define GL_UNIFORM_BUFFER 0x8A11
+#define GL_UNIFORM_BUFFER_BINDING 0x8A28
+#define GL_UNIFORM_BUFFER_START 0x8A29
+#define GL_UNIFORM_BUFFER_SIZE 0x8A2A
+#define GL_MAX_VERTEX_UNIFORM_BLOCKS 0x8A2B
+#define GL_MAX_GEOMETRY_UNIFORM_BLOCKS 0x8A2C
+#define GL_MAX_FRAGMENT_UNIFORM_BLOCKS 0x8A2D
+#define GL_MAX_COMBINED_UNIFORM_BLOCKS 0x8A2E
+#define GL_MAX_UNIFORM_BUFFER_BINDINGS 0x8A2F
+#define GL_MAX_UNIFORM_BLOCK_SIZE 0x8A30
+#define GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS 0x8A31
+#define GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS 0x8A32
+#define GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS 0x8A33
+#define GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT 0x8A34
+#define GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH 0x8A35
+#define GL_ACTIVE_UNIFORM_BLOCKS 0x8A36
+#define GL_UNIFORM_TYPE 0x8A37
+#define GL_UNIFORM_SIZE 0x8A38
+#define GL_UNIFORM_NAME_LENGTH 0x8A39
+#define GL_UNIFORM_BLOCK_INDEX 0x8A3A
+#define GL_UNIFORM_OFFSET 0x8A3B
+#define GL_UNIFORM_ARRAY_STRIDE 0x8A3C
+#define GL_UNIFORM_MATRIX_STRIDE 0x8A3D
+#define GL_UNIFORM_IS_ROW_MAJOR 0x8A3E
+#define GL_UNIFORM_BLOCK_BINDING 0x8A3F
+#define GL_UNIFORM_BLOCK_DATA_SIZE 0x8A40
+#define GL_UNIFORM_BLOCK_NAME_LENGTH 0x8A41
+#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS 0x8A42
+#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES 0x8A43
+#define GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER 0x8A44
+#define GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER 0x8A45
+#define GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER 0x8A46
+#define GL_INVALID_INDEX 0xFFFFFFFFu
+#endif
+
+#ifndef GL_ARB_compatibility
+/* ARB_compatibility just defines tokens from core 3.0 */
+#endif
+
+#ifndef GL_ARB_copy_buffer
+#define GL_COPY_READ_BUFFER 0x8F36
+#define GL_COPY_WRITE_BUFFER 0x8F37
+#endif
+
+#ifndef GL_ARB_shader_texture_lod
+#endif
+
+#ifndef GL_ARB_depth_clamp
+#define GL_DEPTH_CLAMP 0x864F
+#endif
+
+#ifndef GL_ARB_draw_elements_base_vertex
+#endif
+
+#ifndef GL_ARB_fragment_coord_conventions
+#endif
+
+#ifndef GL_ARB_provoking_vertex
+#define GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION 0x8E4C
+#define GL_FIRST_VERTEX_CONVENTION 0x8E4D
+#define GL_LAST_VERTEX_CONVENTION 0x8E4E
+#define GL_PROVOKING_VERTEX 0x8E4F
+#endif
+
+#ifndef GL_ARB_seamless_cube_map
+#define GL_TEXTURE_CUBE_MAP_SEAMLESS 0x884F
+#endif
+
+#ifndef GL_ARB_sync
+#define GL_MAX_SERVER_WAIT_TIMEOUT 0x9111
+#define GL_OBJECT_TYPE 0x9112
+#define GL_SYNC_CONDITION 0x9113
+#define GL_SYNC_STATUS 0x9114
+#define GL_SYNC_FLAGS 0x9115
+#define GL_SYNC_FENCE 0x9116
+#define GL_SYNC_GPU_COMMANDS_COMPLETE 0x9117
+#define GL_UNSIGNALED 0x9118
+#define GL_SIGNALED 0x9119
+#define GL_ALREADY_SIGNALED 0x911A
+#define GL_TIMEOUT_EXPIRED 0x911B
+#define GL_CONDITION_SATISFIED 0x911C
+#define GL_WAIT_FAILED 0x911D
+#define GL_SYNC_FLUSH_COMMANDS_BIT 0x00000001
+#define GL_TIMEOUT_IGNORED 0xFFFFFFFFFFFFFFFFull
+#endif
+
+#ifndef GL_ARB_texture_multisample
+#define GL_SAMPLE_POSITION 0x8E50
+#define GL_SAMPLE_MASK 0x8E51
+#define GL_SAMPLE_MASK_VALUE 0x8E52
+#define GL_MAX_SAMPLE_MASK_WORDS 0x8E59
+#define GL_TEXTURE_2D_MULTISAMPLE 0x9100
+#define GL_PROXY_TEXTURE_2D_MULTISAMPLE 0x9101
+#define GL_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9102
+#define GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9103
+#define GL_TEXTURE_BINDING_2D_MULTISAMPLE 0x9104
+#define GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY 0x9105
+#define GL_TEXTURE_SAMPLES 0x9106
+#define GL_TEXTURE_FIXED_SAMPLE_LOCATIONS 0x9107
+#define GL_SAMPLER_2D_MULTISAMPLE 0x9108
+#define GL_INT_SAMPLER_2D_MULTISAMPLE 0x9109
+#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE 0x910A
+#define GL_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910B
+#define GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910C
+#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910D
+#define GL_MAX_COLOR_TEXTURE_SAMPLES 0x910E
+#define GL_MAX_DEPTH_TEXTURE_SAMPLES 0x910F
+#define GL_MAX_INTEGER_SAMPLES 0x9110
+#endif
+
+#ifndef GL_ARB_vertex_array_bgra
+/* reuse GL_BGRA */
+#endif
+
+#ifndef GL_ARB_draw_buffers_blend
+#endif
+
+#ifndef GL_ARB_sample_shading
+#define GL_SAMPLE_SHADING_ARB 0x8C36
+#define GL_MIN_SAMPLE_SHADING_VALUE_ARB 0x8C37
+#endif
+
+#ifndef GL_ARB_texture_cube_map_array
+#define GL_TEXTURE_CUBE_MAP_ARRAY_ARB 0x9009
+#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY_ARB 0x900A
+#define GL_PROXY_TEXTURE_CUBE_MAP_ARRAY_ARB 0x900B
+#define GL_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900C
+#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW_ARB 0x900D
+#define GL_INT_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900E
+#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900F
+#endif
+
+#ifndef GL_ARB_texture_gather
+#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET_ARB 0x8E5E
+#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET_ARB 0x8E5F
+#endif
+
+#ifndef GL_ARB_texture_query_lod
+#endif
+
+#ifndef GL_ARB_shading_language_include
+#define GL_SHADER_INCLUDE_ARB 0x8DAE
+#define GL_NAMED_STRING_LENGTH_ARB 0x8DE9
+#define GL_NAMED_STRING_TYPE_ARB 0x8DEA
+#endif
+
+#ifndef GL_ARB_texture_compression_bptc
+#define GL_COMPRESSED_RGBA_BPTC_UNORM_ARB 0x8E8C
+#define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB 0x8E8D
+#define GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB 0x8E8E
+#define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB 0x8E8F
+#endif
+
+#ifndef GL_ARB_blend_func_extended
+#define GL_SRC1_COLOR 0x88F9
+/* reuse GL_SRC1_ALPHA */
+#define GL_ONE_MINUS_SRC1_COLOR 0x88FA
+#define GL_ONE_MINUS_SRC1_ALPHA 0x88FB
+#define GL_MAX_DUAL_SOURCE_DRAW_BUFFERS 0x88FC
+#endif
+
+#ifndef GL_ARB_explicit_attrib_location
+#endif
+
+#ifndef GL_ARB_occlusion_query2
+#define GL_ANY_SAMPLES_PASSED 0x8C2F
+#endif
+
+#ifndef GL_ARB_sampler_objects
+#define GL_SAMPLER_BINDING 0x8919
+#endif
+
+#ifndef GL_ARB_shader_bit_encoding
+#endif
+
+#ifndef GL_ARB_texture_rgb10_a2ui
+#define GL_RGB10_A2UI 0x906F
+#endif
+
+#ifndef GL_ARB_texture_swizzle
+#define GL_TEXTURE_SWIZZLE_R 0x8E42
+#define GL_TEXTURE_SWIZZLE_G 0x8E43
+#define GL_TEXTURE_SWIZZLE_B 0x8E44
+#define GL_TEXTURE_SWIZZLE_A 0x8E45
+#define GL_TEXTURE_SWIZZLE_RGBA 0x8E46
+#endif
+
+#ifndef GL_ARB_timer_query
+#define GL_TIME_ELAPSED 0x88BF
+#define GL_TIMESTAMP 0x8E28
+#endif
+
+#ifndef GL_ARB_vertex_type_2_10_10_10_rev
+/* reuse GL_UNSIGNED_INT_2_10_10_10_REV */
+#define GL_INT_2_10_10_10_REV 0x8D9F
+#endif
+
+#ifndef GL_ARB_draw_indirect
+#define GL_DRAW_INDIRECT_BUFFER 0x8F3F
+#define GL_DRAW_INDIRECT_BUFFER_BINDING 0x8F43
+#endif
+
+#ifndef GL_ARB_gpu_shader5
+#define GL_GEOMETRY_SHADER_INVOCATIONS 0x887F
+#define GL_MAX_GEOMETRY_SHADER_INVOCATIONS 0x8E5A
+#define GL_MIN_FRAGMENT_INTERPOLATION_OFFSET 0x8E5B
+#define GL_MAX_FRAGMENT_INTERPOLATION_OFFSET 0x8E5C
+#define GL_FRAGMENT_INTERPOLATION_OFFSET_BITS 0x8E5D
+/* reuse GL_MAX_VERTEX_STREAMS */
+#endif
+
+#ifndef GL_ARB_gpu_shader_fp64
+/* reuse GL_DOUBLE */
+#define GL_DOUBLE_VEC2 0x8FFC
+#define GL_DOUBLE_VEC3 0x8FFD
+#define GL_DOUBLE_VEC4 0x8FFE
+#define GL_DOUBLE_MAT2 0x8F46
+#define GL_DOUBLE_MAT3 0x8F47
+#define GL_DOUBLE_MAT4 0x8F48
+#define GL_DOUBLE_MAT2x3 0x8F49
+#define GL_DOUBLE_MAT2x4 0x8F4A
+#define GL_DOUBLE_MAT3x2 0x8F4B
+#define GL_DOUBLE_MAT3x4 0x8F4C
+#define GL_DOUBLE_MAT4x2 0x8F4D
+#define GL_DOUBLE_MAT4x3 0x8F4E
+#endif
+
+#ifndef GL_ARB_shader_subroutine
+#define GL_ACTIVE_SUBROUTINES 0x8DE5
+#define GL_ACTIVE_SUBROUTINE_UNIFORMS 0x8DE6
+#define GL_ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS 0x8E47
+#define GL_ACTIVE_SUBROUTINE_MAX_LENGTH 0x8E48
+#define GL_ACTIVE_SUBROUTINE_UNIFORM_MAX_LENGTH 0x8E49
+#define GL_MAX_SUBROUTINES 0x8DE7
+#define GL_MAX_SUBROUTINE_UNIFORM_LOCATIONS 0x8DE8
+#define GL_NUM_COMPATIBLE_SUBROUTINES 0x8E4A
+#define GL_COMPATIBLE_SUBROUTINES 0x8E4B
+/* reuse GL_UNIFORM_SIZE */
+/* reuse GL_UNIFORM_NAME_LENGTH */
+#endif
+
+#ifndef GL_ARB_tessellation_shader
+#define GL_PATCHES 0x000E
+#define GL_PATCH_VERTICES 0x8E72
+#define GL_PATCH_DEFAULT_INNER_LEVEL 0x8E73
+#define GL_PATCH_DEFAULT_OUTER_LEVEL 0x8E74
+#define GL_TESS_CONTROL_OUTPUT_VERTICES 0x8E75
+#define GL_TESS_GEN_MODE 0x8E76
+#define GL_TESS_GEN_SPACING 0x8E77
+#define GL_TESS_GEN_VERTEX_ORDER 0x8E78
+#define GL_TESS_GEN_POINT_MODE 0x8E79
+/* reuse GL_TRIANGLES */
+/* reuse GL_QUADS */
+#define GL_ISOLINES 0x8E7A
+/* reuse GL_EQUAL */
+#define GL_FRACTIONAL_ODD 0x8E7B
+#define GL_FRACTIONAL_EVEN 0x8E7C
+/* reuse GL_CCW */
+/* reuse GL_CW */
+#define GL_MAX_PATCH_VERTICES 0x8E7D
+#define GL_MAX_TESS_GEN_LEVEL 0x8E7E
+#define GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS 0x8E7F
+#define GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS 0x8E80
+#define GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS 0x8E81
+#define GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS 0x8E82
+#define GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS 0x8E83
+#define GL_MAX_TESS_PATCH_COMPONENTS 0x8E84
+#define GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS 0x8E85
+#define GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS 0x8E86
+#define GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS 0x8E89
+#define GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS 0x8E8A
+#define GL_MAX_TESS_CONTROL_INPUT_COMPONENTS 0x886C
+#define GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS 0x886D
+#define GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS 0x8E1E
+#define GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS 0x8E1F
+#define GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_CONTROL_SHADER 0x84F0
+#define GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_EVALUATION_SHADER 0x84F1
+#define GL_TESS_EVALUATION_SHADER 0x8E87
+#define GL_TESS_CONTROL_SHADER 0x8E88
+#endif
+
+#ifndef GL_ARB_texture_buffer_object_rgb32
+/* reuse GL_RGB32F */
+/* reuse GL_RGB32UI */
+/* reuse GL_RGB32I */
+#endif
+
+#ifndef GL_ARB_transform_feedback2
+#define GL_TRANSFORM_FEEDBACK 0x8E22
+#define GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED 0x8E23
+#define GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE 0x8E24
+#define GL_TRANSFORM_FEEDBACK_BINDING 0x8E25
+#endif
+
+#ifndef GL_ARB_transform_feedback3
+#define GL_MAX_TRANSFORM_FEEDBACK_BUFFERS 0x8E70
+#define GL_MAX_VERTEX_STREAMS 0x8E71
+#endif
+
+#ifndef GL_ARB_ES2_compatibility
+#define GL_FIXED 0x140C
+#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A
+#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B
+#define GL_LOW_FLOAT 0x8DF0
+#define GL_MEDIUM_FLOAT 0x8DF1
+#define GL_HIGH_FLOAT 0x8DF2
+#define GL_LOW_INT 0x8DF3
+#define GL_MEDIUM_INT 0x8DF4
+#define GL_HIGH_INT 0x8DF5
+#define GL_SHADER_COMPILER 0x8DFA
+#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9
+#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB
+#define GL_MAX_VARYING_VECTORS 0x8DFC
+#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD
+#endif
+
+#ifndef GL_ARB_get_program_binary
+#define GL_PROGRAM_BINARY_RETRIEVABLE_HINT 0x8257
+#define GL_PROGRAM_BINARY_LENGTH 0x8741
+#define GL_NUM_PROGRAM_BINARY_FORMATS 0x87FE
+#define GL_PROGRAM_BINARY_FORMATS 0x87FF
+#endif
+
+#ifndef GL_ARB_separate_shader_objects
+#define GL_VERTEX_SHADER_BIT 0x00000001
+#define GL_FRAGMENT_SHADER_BIT 0x00000002
+#define GL_GEOMETRY_SHADER_BIT 0x00000004
+#define GL_TESS_CONTROL_SHADER_BIT 0x00000008
+#define GL_TESS_EVALUATION_SHADER_BIT 0x00000010
+#define GL_ALL_SHADER_BITS 0xFFFFFFFF
+#define GL_PROGRAM_SEPARABLE 0x8258
+#define GL_ACTIVE_PROGRAM 0x8259
+#define GL_PROGRAM_PIPELINE_BINDING 0x825A
+#endif
+
+#ifndef GL_ARB_shader_precision
+#endif
+
+#ifndef GL_ARB_vertex_attrib_64bit
+/* reuse GL_RGB32I */
+/* reuse GL_DOUBLE_VEC2 */
+/* reuse GL_DOUBLE_VEC3 */
+/* reuse GL_DOUBLE_VEC4 */
+/* reuse GL_DOUBLE_MAT2 */
+/* reuse GL_DOUBLE_MAT3 */
+/* reuse GL_DOUBLE_MAT4 */
+/* reuse GL_DOUBLE_MAT2x3 */
+/* reuse GL_DOUBLE_MAT2x4 */
+/* reuse GL_DOUBLE_MAT3x2 */
+/* reuse GL_DOUBLE_MAT3x4 */
+/* reuse GL_DOUBLE_MAT4x2 */
+/* reuse GL_DOUBLE_MAT4x3 */
+#endif
+
+#ifndef GL_ARB_viewport_array
+/* reuse GL_SCISSOR_BOX */
+/* reuse GL_VIEWPORT */
+/* reuse GL_DEPTH_RANGE */
+/* reuse GL_SCISSOR_TEST */
+#define GL_MAX_VIEWPORTS 0x825B
+#define GL_VIEWPORT_SUBPIXEL_BITS 0x825C
+#define GL_VIEWPORT_BOUNDS_RANGE 0x825D
+#define GL_LAYER_PROVOKING_VERTEX 0x825E
+#define GL_VIEWPORT_INDEX_PROVOKING_VERTEX 0x825F
+#define GL_UNDEFINED_VERTEX 0x8260
+/* reuse GL_FIRST_VERTEX_CONVENTION */
+/* reuse GL_LAST_VERTEX_CONVENTION */
+/* reuse GL_PROVOKING_VERTEX */
+#endif
+
+#ifndef GL_ARB_cl_event
+#define GL_SYNC_CL_EVENT_ARB 0x8240
+#define GL_SYNC_CL_EVENT_COMPLETE_ARB 0x8241
+#endif
+
+#ifndef GL_ARB_debug_output
+#define GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB 0x8242
+#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_ARB 0x8243
+#define GL_DEBUG_CALLBACK_FUNCTION_ARB 0x8244
+#define GL_DEBUG_CALLBACK_USER_PARAM_ARB 0x8245
+#define GL_DEBUG_SOURCE_API_ARB 0x8246
+#define GL_DEBUG_SOURCE_WINDOW_SYSTEM_ARB 0x8247
+#define GL_DEBUG_SOURCE_SHADER_COMPILER_ARB 0x8248
+#define GL_DEBUG_SOURCE_THIRD_PARTY_ARB 0x8249
+#define GL_DEBUG_SOURCE_APPLICATION_ARB 0x824A
+#define GL_DEBUG_SOURCE_OTHER_ARB 0x824B
+#define GL_DEBUG_TYPE_ERROR_ARB 0x824C
+#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB 0x824D
+#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB 0x824E
+#define GL_DEBUG_TYPE_PORTABILITY_ARB 0x824F
+#define GL_DEBUG_TYPE_PERFORMANCE_ARB 0x8250
+#define GL_DEBUG_TYPE_OTHER_ARB 0x8251
+#define GL_MAX_DEBUG_MESSAGE_LENGTH_ARB 0x9143
+#define GL_MAX_DEBUG_LOGGED_MESSAGES_ARB 0x9144
+#define GL_DEBUG_LOGGED_MESSAGES_ARB 0x9145
+#define GL_DEBUG_SEVERITY_HIGH_ARB 0x9146
+#define GL_DEBUG_SEVERITY_MEDIUM_ARB 0x9147
+#define GL_DEBUG_SEVERITY_LOW_ARB 0x9148
+#endif
+
+#ifndef GL_ARB_robustness
+/* reuse GL_NO_ERROR */
+#define GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB 0x00000004
+#define GL_LOSE_CONTEXT_ON_RESET_ARB 0x8252
+#define GL_GUILTY_CONTEXT_RESET_ARB 0x8253
+#define GL_INNOCENT_CONTEXT_RESET_ARB 0x8254
+#define GL_UNKNOWN_CONTEXT_RESET_ARB 0x8255
+#define GL_RESET_NOTIFICATION_STRATEGY_ARB 0x8256
+#define GL_NO_RESET_NOTIFICATION_ARB 0x8261
+#endif
+
+#ifndef GL_ARB_shader_stencil_export
+#endif
+
+#ifndef GL_ARB_base_instance
+#endif
+
+#ifndef GL_ARB_shading_language_420pack
+#endif
+
+#ifndef GL_ARB_transform_feedback_instanced
+#endif
+
+#ifndef GL_ARB_compressed_texture_pixel_storage
+#define GL_UNPACK_COMPRESSED_BLOCK_WIDTH 0x9127
+#define GL_UNPACK_COMPRESSED_BLOCK_HEIGHT 0x9128
+#define GL_UNPACK_COMPRESSED_BLOCK_DEPTH 0x9129
+#define GL_UNPACK_COMPRESSED_BLOCK_SIZE 0x912A
+#define GL_PACK_COMPRESSED_BLOCK_WIDTH 0x912B
+#define GL_PACK_COMPRESSED_BLOCK_HEIGHT 0x912C
+#define GL_PACK_COMPRESSED_BLOCK_DEPTH 0x912D
+#define GL_PACK_COMPRESSED_BLOCK_SIZE 0x912E
+#endif
+
+#ifndef GL_ARB_conservative_depth
+#endif
+
+#ifndef GL_ARB_internalformat_query
+#define GL_NUM_SAMPLE_COUNTS 0x9380
+#endif
+
+#ifndef GL_ARB_map_buffer_alignment
+#define GL_MIN_MAP_BUFFER_ALIGNMENT 0x90BC
+#endif
+
+#ifndef GL_ARB_shader_atomic_counters
+#define GL_ATOMIC_COUNTER_BUFFER 0x92C0
+#define GL_ATOMIC_COUNTER_BUFFER_BINDING 0x92C1
+#define GL_ATOMIC_COUNTER_BUFFER_START 0x92C2
+#define GL_ATOMIC_COUNTER_BUFFER_SIZE 0x92C3
+#define GL_ATOMIC_COUNTER_BUFFER_DATA_SIZE 0x92C4
+#define GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTERS 0x92C5
+#define GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTER_INDICES 0x92C6
+#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_VERTEX_SHADER 0x92C7
+#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_CONTROL_SHADER 0x92C8
+#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_EVALUATION_SHADER 0x92C9
+#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_GEOMETRY_SHADER 0x92CA
+#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_FRAGMENT_SHADER 0x92CB
+#define GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS 0x92CC
+#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS 0x92CD
+#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS 0x92CE
+#define GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS 0x92CF
+#define GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS 0x92D0
+#define GL_MAX_COMBINED_ATOMIC_COUNTER_BUFFERS 0x92D1
+#define GL_MAX_VERTEX_ATOMIC_COUNTERS 0x92D2
+#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS 0x92D3
+#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS 0x92D4
+#define GL_MAX_GEOMETRY_ATOMIC_COUNTERS 0x92D5
+#define GL_MAX_FRAGMENT_ATOMIC_COUNTERS 0x92D6
+#define GL_MAX_COMBINED_ATOMIC_COUNTERS 0x92D7
+#define GL_MAX_ATOMIC_COUNTER_BUFFER_SIZE 0x92D8
+#define GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS 0x92DC
+#define GL_ACTIVE_ATOMIC_COUNTER_BUFFERS 0x92D9
+#define GL_UNIFORM_ATOMIC_COUNTER_BUFFER_INDEX 0x92DA
+#define GL_UNSIGNED_INT_ATOMIC_COUNTER 0x92DB
+#endif
+
+#ifndef GL_ARB_shader_image_load_store
+#define GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT 0x00000001
+#define GL_ELEMENT_ARRAY_BARRIER_BIT 0x00000002
+#define GL_UNIFORM_BARRIER_BIT 0x00000004
+#define GL_TEXTURE_FETCH_BARRIER_BIT 0x00000008
+#define GL_SHADER_IMAGE_ACCESS_BARRIER_BIT 0x00000020
+#define GL_COMMAND_BARRIER_BIT 0x00000040
+#define GL_PIXEL_BUFFER_BARRIER_BIT 0x00000080
+#define GL_TEXTURE_UPDATE_BARRIER_BIT 0x00000100
+#define GL_BUFFER_UPDATE_BARRIER_BIT 0x00000200
+#define GL_FRAMEBUFFER_BARRIER_BIT 0x00000400
+#define GL_TRANSFORM_FEEDBACK_BARRIER_BIT 0x00000800
+#define GL_ATOMIC_COUNTER_BARRIER_BIT 0x00001000
+#define GL_ALL_BARRIER_BITS 0xFFFFFFFF
+#define GL_MAX_IMAGE_UNITS 0x8F38
+#define GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS 0x8F39
+#define GL_IMAGE_BINDING_NAME 0x8F3A
+#define GL_IMAGE_BINDING_LEVEL 0x8F3B
+#define GL_IMAGE_BINDING_LAYERED 0x8F3C
+#define GL_IMAGE_BINDING_LAYER 0x8F3D
+#define GL_IMAGE_BINDING_ACCESS 0x8F3E
+#define GL_IMAGE_1D 0x904C
+#define GL_IMAGE_2D 0x904D
+#define GL_IMAGE_3D 0x904E
+#define GL_IMAGE_2D_RECT 0x904F
+#define GL_IMAGE_CUBE 0x9050
+#define GL_IMAGE_BUFFER 0x9051
+#define GL_IMAGE_1D_ARRAY 0x9052
+#define GL_IMAGE_2D_ARRAY 0x9053
+#define GL_IMAGE_CUBE_MAP_ARRAY 0x9054
+#define GL_IMAGE_2D_MULTISAMPLE 0x9055
+#define GL_IMAGE_2D_MULTISAMPLE_ARRAY 0x9056
+#define GL_INT_IMAGE_1D 0x9057
+#define GL_INT_IMAGE_2D 0x9058
+#define GL_INT_IMAGE_3D 0x9059
+#define GL_INT_IMAGE_2D_RECT 0x905A
+#define GL_INT_IMAGE_CUBE 0x905B
+#define GL_INT_IMAGE_BUFFER 0x905C
+#define GL_INT_IMAGE_1D_ARRAY 0x905D
+#define GL_INT_IMAGE_2D_ARRAY 0x905E
+#define GL_INT_IMAGE_CUBE_MAP_ARRAY 0x905F
+#define GL_INT_IMAGE_2D_MULTISAMPLE 0x9060
+#define GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY 0x9061
+#define GL_UNSIGNED_INT_IMAGE_1D 0x9062
+#define GL_UNSIGNED_INT_IMAGE_2D 0x9063
+#define GL_UNSIGNED_INT_IMAGE_3D 0x9064
+#define GL_UNSIGNED_INT_IMAGE_2D_RECT 0x9065
+#define GL_UNSIGNED_INT_IMAGE_CUBE 0x9066
+#define GL_UNSIGNED_INT_IMAGE_BUFFER 0x9067
+#define GL_UNSIGNED_INT_IMAGE_1D_ARRAY 0x9068
+#define GL_UNSIGNED_INT_IMAGE_2D_ARRAY 0x9069
+#define GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY 0x906A
+#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE 0x906B
+#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY 0x906C
+#define GL_MAX_IMAGE_SAMPLES 0x906D
+#define GL_IMAGE_BINDING_FORMAT 0x906E
+#define GL_IMAGE_FORMAT_COMPATIBILITY_TYPE 0x90C7
+#define GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE 0x90C8
+#define GL_IMAGE_FORMAT_COMPATIBILITY_BY_CLASS 0x90C9
+#define GL_MAX_VERTEX_IMAGE_UNIFORMS 0x90CA
+#define GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS 0x90CB
+#define GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS 0x90CC
+#define GL_MAX_GEOMETRY_IMAGE_UNIFORMS 0x90CD
+#define GL_MAX_FRAGMENT_IMAGE_UNIFORMS 0x90CE
+#define GL_MAX_COMBINED_IMAGE_UNIFORMS 0x90CF
+#endif
+
+#ifndef GL_ARB_shading_language_packing
+#endif
+
+#ifndef GL_ARB_texture_storage
+#define GL_TEXTURE_IMMUTABLE_FORMAT 0x912F
+#endif
+
#ifndef GL_EXT_abgr
#define GL_ABGR_EXT 0x8000
#endif
@@ -3203,9 +4217,9 @@ extern "C" {
#endif
#ifndef GL_APPLE_element_array
-#define GL_ELEMENT_ARRAY_APPLE 0x8768
-#define GL_ELEMENT_ARRAY_TYPE_APPLE 0x8769
-#define GL_ELEMENT_ARRAY_POINTER_APPLE 0x876A
+#define GL_ELEMENT_ARRAY_APPLE 0x8A0C
+#define GL_ELEMENT_ARRAY_TYPE_APPLE 0x8A0D
+#define GL_ELEMENT_ARRAY_POINTER_APPLE 0x8A0E
#endif
#ifndef GL_APPLE_fence
@@ -3222,6 +4236,7 @@ extern "C" {
#define GL_VERTEX_ARRAY_RANGE_LENGTH_APPLE 0x851E
#define GL_VERTEX_ARRAY_STORAGE_HINT_APPLE 0x851F
#define GL_VERTEX_ARRAY_RANGE_POINTER_APPLE 0x8521
+#define GL_STORAGE_CLIENT_APPLE 0x85B4
#define GL_STORAGE_CACHED_APPLE 0x85BE
#define GL_STORAGE_SHARED_APPLE 0x85BF
#endif
@@ -3367,7 +4382,7 @@ extern "C" {
#endif
#ifndef GL_EXT_blend_equation_separate
-#define GL_BLEND_EQUATION_RGB_EXT GL_BLEND_EQUATION
+#define GL_BLEND_EQUATION_RGB_EXT 0x8009
#define GL_BLEND_EQUATION_ALPHA_EXT 0x883D
#endif
@@ -3726,6 +4741,12 @@ extern "C" {
#define GL_SEPARATE_ATTRIBS_NV 0x8C8D
#define GL_TRANSFORM_FEEDBACK_BUFFER_NV 0x8C8E
#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_NV 0x8C8F
+#define GL_LAYER_NV 0x8DAA
+#define GL_NEXT_BUFFER_NV -2
+#define GL_SKIP_COMPONENTS4_NV -3
+#define GL_SKIP_COMPONENTS3_NV -4
+#define GL_SKIP_COMPONENTS2_NV -5
+#define GL_SKIP_COMPONENTS1_NV -6
#endif
#ifndef GL_EXT_bindable_uniform
@@ -3848,11 +4869,11 @@ extern "C" {
#define GL_SAMPLE_MASK_VALUE_NV 0x8E52
#define GL_TEXTURE_BINDING_RENDERBUFFER_NV 0x8E53
#define GL_TEXTURE_RENDERBUFFER_DATA_STORE_BINDING_NV 0x8E54
-#define GL_MAX_SAMPLE_MASK_WORDS_NV 0x8E59
#define GL_TEXTURE_RENDERBUFFER_NV 0x8E55
#define GL_SAMPLER_RENDERBUFFER_NV 0x8E56
#define GL_INT_SAMPLER_RENDERBUFFER_NV 0x8E57
#define GL_UNSIGNED_INT_SAMPLER_RENDERBUFFER_NV 0x8E58
+#define GL_MAX_SAMPLE_MASK_WORDS_NV 0x8E59
#endif
#ifndef GL_NV_transform_feedback2
@@ -3898,13 +4919,408 @@ extern "C" {
#define GL_PROVOKING_VERTEX_EXT 0x8E4F
#endif
+#ifndef GL_EXT_texture_snorm
+#define GL_ALPHA_SNORM 0x9010
+#define GL_LUMINANCE_SNORM 0x9011
+#define GL_LUMINANCE_ALPHA_SNORM 0x9012
+#define GL_INTENSITY_SNORM 0x9013
+#define GL_ALPHA8_SNORM 0x9014
+#define GL_LUMINANCE8_SNORM 0x9015
+#define GL_LUMINANCE8_ALPHA8_SNORM 0x9016
+#define GL_INTENSITY8_SNORM 0x9017
+#define GL_ALPHA16_SNORM 0x9018
+#define GL_LUMINANCE16_SNORM 0x9019
+#define GL_LUMINANCE16_ALPHA16_SNORM 0x901A
+#define GL_INTENSITY16_SNORM 0x901B
+/* reuse GL_RED_SNORM */
+/* reuse GL_RG_SNORM */
+/* reuse GL_RGB_SNORM */
+/* reuse GL_RGBA_SNORM */
+/* reuse GL_R8_SNORM */
+/* reuse GL_RG8_SNORM */
+/* reuse GL_RGB8_SNORM */
+/* reuse GL_RGBA8_SNORM */
+/* reuse GL_R16_SNORM */
+/* reuse GL_RG16_SNORM */
+/* reuse GL_RGB16_SNORM */
+/* reuse GL_RGBA16_SNORM */
+/* reuse GL_SIGNED_NORMALIZED */
+#endif
+
+#ifndef GL_AMD_draw_buffers_blend
+#endif
+
+#ifndef GL_APPLE_texture_range
+#define GL_TEXTURE_RANGE_LENGTH_APPLE 0x85B7
+#define GL_TEXTURE_RANGE_POINTER_APPLE 0x85B8
+#define GL_TEXTURE_STORAGE_HINT_APPLE 0x85BC
+#define GL_STORAGE_PRIVATE_APPLE 0x85BD
+/* reuse GL_STORAGE_CACHED_APPLE */
+/* reuse GL_STORAGE_SHARED_APPLE */
+#endif
+
+#ifndef GL_APPLE_float_pixels
+#define GL_HALF_APPLE 0x140B
+#define GL_RGBA_FLOAT32_APPLE 0x8814
+#define GL_RGB_FLOAT32_APPLE 0x8815
+#define GL_ALPHA_FLOAT32_APPLE 0x8816
+#define GL_INTENSITY_FLOAT32_APPLE 0x8817
+#define GL_LUMINANCE_FLOAT32_APPLE 0x8818
+#define GL_LUMINANCE_ALPHA_FLOAT32_APPLE 0x8819
+#define GL_RGBA_FLOAT16_APPLE 0x881A
+#define GL_RGB_FLOAT16_APPLE 0x881B
+#define GL_ALPHA_FLOAT16_APPLE 0x881C
+#define GL_INTENSITY_FLOAT16_APPLE 0x881D
+#define GL_LUMINANCE_FLOAT16_APPLE 0x881E
+#define GL_LUMINANCE_ALPHA_FLOAT16_APPLE 0x881F
+#define GL_COLOR_FLOAT_APPLE 0x8A0F
+#endif
+
+#ifndef GL_APPLE_vertex_program_evaluators
+#define GL_VERTEX_ATTRIB_MAP1_APPLE 0x8A00
+#define GL_VERTEX_ATTRIB_MAP2_APPLE 0x8A01
+#define GL_VERTEX_ATTRIB_MAP1_SIZE_APPLE 0x8A02
+#define GL_VERTEX_ATTRIB_MAP1_COEFF_APPLE 0x8A03
+#define GL_VERTEX_ATTRIB_MAP1_ORDER_APPLE 0x8A04
+#define GL_VERTEX_ATTRIB_MAP1_DOMAIN_APPLE 0x8A05
+#define GL_VERTEX_ATTRIB_MAP2_SIZE_APPLE 0x8A06
+#define GL_VERTEX_ATTRIB_MAP2_COEFF_APPLE 0x8A07
+#define GL_VERTEX_ATTRIB_MAP2_ORDER_APPLE 0x8A08
+#define GL_VERTEX_ATTRIB_MAP2_DOMAIN_APPLE 0x8A09
+#endif
+
+#ifndef GL_APPLE_aux_depth_stencil
+#define GL_AUX_DEPTH_STENCIL_APPLE 0x8A14
+#endif
+
+#ifndef GL_APPLE_object_purgeable
+#define GL_BUFFER_OBJECT_APPLE 0x85B3
+#define GL_RELEASED_APPLE 0x8A19
+#define GL_VOLATILE_APPLE 0x8A1A
+#define GL_RETAINED_APPLE 0x8A1B
+#define GL_UNDEFINED_APPLE 0x8A1C
+#define GL_PURGEABLE_APPLE 0x8A1D
+#endif
+
+#ifndef GL_APPLE_row_bytes
+#define GL_PACK_ROW_BYTES_APPLE 0x8A15
+#define GL_UNPACK_ROW_BYTES_APPLE 0x8A16
+#endif
+
+#ifndef GL_APPLE_rgb_422
+#define GL_RGB_422_APPLE 0x8A1F
+/* reuse GL_UNSIGNED_SHORT_8_8_APPLE */
+/* reuse GL_UNSIGNED_SHORT_8_8_REV_APPLE */
+#endif
+
+#ifndef GL_NV_video_capture
+#define GL_VIDEO_BUFFER_NV 0x9020
+#define GL_VIDEO_BUFFER_BINDING_NV 0x9021
+#define GL_FIELD_UPPER_NV 0x9022
+#define GL_FIELD_LOWER_NV 0x9023
+#define GL_NUM_VIDEO_CAPTURE_STREAMS_NV 0x9024
+#define GL_NEXT_VIDEO_CAPTURE_BUFFER_STATUS_NV 0x9025
+#define GL_VIDEO_CAPTURE_TO_422_SUPPORTED_NV 0x9026
+#define GL_LAST_VIDEO_CAPTURE_STATUS_NV 0x9027
+#define GL_VIDEO_BUFFER_PITCH_NV 0x9028
+#define GL_VIDEO_COLOR_CONVERSION_MATRIX_NV 0x9029
+#define GL_VIDEO_COLOR_CONVERSION_MAX_NV 0x902A
+#define GL_VIDEO_COLOR_CONVERSION_MIN_NV 0x902B
+#define GL_VIDEO_COLOR_CONVERSION_OFFSET_NV 0x902C
+#define GL_VIDEO_BUFFER_INTERNAL_FORMAT_NV 0x902D
+#define GL_PARTIAL_SUCCESS_NV 0x902E
+#define GL_SUCCESS_NV 0x902F
+#define GL_FAILURE_NV 0x9030
+#define GL_YCBYCR8_422_NV 0x9031
+#define GL_YCBAYCR8A_4224_NV 0x9032
+#define GL_Z6Y10Z6CB10Z6Y10Z6CR10_422_NV 0x9033
+#define GL_Z6Y10Z6CB10Z6A10Z6Y10Z6CR10Z6A10_4224_NV 0x9034
+#define GL_Z4Y12Z4CB12Z4Y12Z4CR12_422_NV 0x9035
+#define GL_Z4Y12Z4CB12Z4A12Z4Y12Z4CR12Z4A12_4224_NV 0x9036
+#define GL_Z4Y12Z4CB12Z4CR12_444_NV 0x9037
+#define GL_VIDEO_CAPTURE_FRAME_WIDTH_NV 0x9038
+#define GL_VIDEO_CAPTURE_FRAME_HEIGHT_NV 0x9039
+#define GL_VIDEO_CAPTURE_FIELD_UPPER_HEIGHT_NV 0x903A
+#define GL_VIDEO_CAPTURE_FIELD_LOWER_HEIGHT_NV 0x903B
+#define GL_VIDEO_CAPTURE_SURFACE_ORIGIN_NV 0x903C
+#endif
+
+#ifndef GL_NV_copy_image
+#endif
+
+#ifndef GL_EXT_separate_shader_objects
+#define GL_ACTIVE_PROGRAM_EXT 0x8B8D
+#endif
+
+#ifndef GL_NV_parameter_buffer_object2
+#endif
+
+#ifndef GL_NV_shader_buffer_load
+#define GL_BUFFER_GPU_ADDRESS_NV 0x8F1D
+#define GL_GPU_ADDRESS_NV 0x8F34
+#define GL_MAX_SHADER_BUFFER_ADDRESS_NV 0x8F35
+#endif
+
+#ifndef GL_NV_vertex_buffer_unified_memory
+#define GL_VERTEX_ATTRIB_ARRAY_UNIFIED_NV 0x8F1E
+#define GL_ELEMENT_ARRAY_UNIFIED_NV 0x8F1F
+#define GL_VERTEX_ATTRIB_ARRAY_ADDRESS_NV 0x8F20
+#define GL_VERTEX_ARRAY_ADDRESS_NV 0x8F21
+#define GL_NORMAL_ARRAY_ADDRESS_NV 0x8F22
+#define GL_COLOR_ARRAY_ADDRESS_NV 0x8F23
+#define GL_INDEX_ARRAY_ADDRESS_NV 0x8F24
+#define GL_TEXTURE_COORD_ARRAY_ADDRESS_NV 0x8F25
+#define GL_EDGE_FLAG_ARRAY_ADDRESS_NV 0x8F26
+#define GL_SECONDARY_COLOR_ARRAY_ADDRESS_NV 0x8F27
+#define GL_FOG_COORD_ARRAY_ADDRESS_NV 0x8F28
+#define GL_ELEMENT_ARRAY_ADDRESS_NV 0x8F29
+#define GL_VERTEX_ATTRIB_ARRAY_LENGTH_NV 0x8F2A
+#define GL_VERTEX_ARRAY_LENGTH_NV 0x8F2B
+#define GL_NORMAL_ARRAY_LENGTH_NV 0x8F2C
+#define GL_COLOR_ARRAY_LENGTH_NV 0x8F2D
+#define GL_INDEX_ARRAY_LENGTH_NV 0x8F2E
+#define GL_TEXTURE_COORD_ARRAY_LENGTH_NV 0x8F2F
+#define GL_EDGE_FLAG_ARRAY_LENGTH_NV 0x8F30
+#define GL_SECONDARY_COLOR_ARRAY_LENGTH_NV 0x8F31
+#define GL_FOG_COORD_ARRAY_LENGTH_NV 0x8F32
+#define GL_ELEMENT_ARRAY_LENGTH_NV 0x8F33
+#define GL_DRAW_INDIRECT_UNIFIED_NV 0x8F40
+#define GL_DRAW_INDIRECT_ADDRESS_NV 0x8F41
+#define GL_DRAW_INDIRECT_LENGTH_NV 0x8F42
+#endif
+
+#ifndef GL_NV_texture_barrier
+#endif
+
+#ifndef GL_AMD_shader_stencil_export
+#endif
+
+#ifndef GL_AMD_seamless_cubemap_per_texture
+/* reuse GL_TEXTURE_CUBE_MAP_SEAMLESS */
+#endif
+
+#ifndef GL_AMD_conservative_depth
+#endif
+
+#ifndef GL_EXT_shader_image_load_store
+#define GL_MAX_IMAGE_UNITS_EXT 0x8F38
+#define GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS_EXT 0x8F39
+#define GL_IMAGE_BINDING_NAME_EXT 0x8F3A
+#define GL_IMAGE_BINDING_LEVEL_EXT 0x8F3B
+#define GL_IMAGE_BINDING_LAYERED_EXT 0x8F3C
+#define GL_IMAGE_BINDING_LAYER_EXT 0x8F3D
+#define GL_IMAGE_BINDING_ACCESS_EXT 0x8F3E
+#define GL_IMAGE_1D_EXT 0x904C
+#define GL_IMAGE_2D_EXT 0x904D
+#define GL_IMAGE_3D_EXT 0x904E
+#define GL_IMAGE_2D_RECT_EXT 0x904F
+#define GL_IMAGE_CUBE_EXT 0x9050
+#define GL_IMAGE_BUFFER_EXT 0x9051
+#define GL_IMAGE_1D_ARRAY_EXT 0x9052
+#define GL_IMAGE_2D_ARRAY_EXT 0x9053
+#define GL_IMAGE_CUBE_MAP_ARRAY_EXT 0x9054
+#define GL_IMAGE_2D_MULTISAMPLE_EXT 0x9055
+#define GL_IMAGE_2D_MULTISAMPLE_ARRAY_EXT 0x9056
+#define GL_INT_IMAGE_1D_EXT 0x9057
+#define GL_INT_IMAGE_2D_EXT 0x9058
+#define GL_INT_IMAGE_3D_EXT 0x9059
+#define GL_INT_IMAGE_2D_RECT_EXT 0x905A
+#define GL_INT_IMAGE_CUBE_EXT 0x905B
+#define GL_INT_IMAGE_BUFFER_EXT 0x905C
+#define GL_INT_IMAGE_1D_ARRAY_EXT 0x905D
+#define GL_INT_IMAGE_2D_ARRAY_EXT 0x905E
+#define GL_INT_IMAGE_CUBE_MAP_ARRAY_EXT 0x905F
+#define GL_INT_IMAGE_2D_MULTISAMPLE_EXT 0x9060
+#define GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY_EXT 0x9061
+#define GL_UNSIGNED_INT_IMAGE_1D_EXT 0x9062
+#define GL_UNSIGNED_INT_IMAGE_2D_EXT 0x9063
+#define GL_UNSIGNED_INT_IMAGE_3D_EXT 0x9064
+#define GL_UNSIGNED_INT_IMAGE_2D_RECT_EXT 0x9065
+#define GL_UNSIGNED_INT_IMAGE_CUBE_EXT 0x9066
+#define GL_UNSIGNED_INT_IMAGE_BUFFER_EXT 0x9067
+#define GL_UNSIGNED_INT_IMAGE_1D_ARRAY_EXT 0x9068
+#define GL_UNSIGNED_INT_IMAGE_2D_ARRAY_EXT 0x9069
+#define GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY_EXT 0x906A
+#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_EXT 0x906B
+#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY_EXT 0x906C
+#define GL_MAX_IMAGE_SAMPLES_EXT 0x906D
+#define GL_IMAGE_BINDING_FORMAT_EXT 0x906E
+#define GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT_EXT 0x00000001
+#define GL_ELEMENT_ARRAY_BARRIER_BIT_EXT 0x00000002
+#define GL_UNIFORM_BARRIER_BIT_EXT 0x00000004
+#define GL_TEXTURE_FETCH_BARRIER_BIT_EXT 0x00000008
+#define GL_SHADER_IMAGE_ACCESS_BARRIER_BIT_EXT 0x00000020
+#define GL_COMMAND_BARRIER_BIT_EXT 0x00000040
+#define GL_PIXEL_BUFFER_BARRIER_BIT_EXT 0x00000080
+#define GL_TEXTURE_UPDATE_BARRIER_BIT_EXT 0x00000100
+#define GL_BUFFER_UPDATE_BARRIER_BIT_EXT 0x00000200
+#define GL_FRAMEBUFFER_BARRIER_BIT_EXT 0x00000400
+#define GL_TRANSFORM_FEEDBACK_BARRIER_BIT_EXT 0x00000800
+#define GL_ATOMIC_COUNTER_BARRIER_BIT_EXT 0x00001000
+#define GL_ALL_BARRIER_BITS_EXT 0xFFFFFFFF
+#endif
+
+#ifndef GL_EXT_vertex_attrib_64bit
+/* reuse GL_DOUBLE */
+#define GL_DOUBLE_VEC2_EXT 0x8FFC
+#define GL_DOUBLE_VEC3_EXT 0x8FFD
+#define GL_DOUBLE_VEC4_EXT 0x8FFE
+#define GL_DOUBLE_MAT2_EXT 0x8F46
+#define GL_DOUBLE_MAT3_EXT 0x8F47
+#define GL_DOUBLE_MAT4_EXT 0x8F48
+#define GL_DOUBLE_MAT2x3_EXT 0x8F49
+#define GL_DOUBLE_MAT2x4_EXT 0x8F4A
+#define GL_DOUBLE_MAT3x2_EXT 0x8F4B
+#define GL_DOUBLE_MAT3x4_EXT 0x8F4C
+#define GL_DOUBLE_MAT4x2_EXT 0x8F4D
+#define GL_DOUBLE_MAT4x3_EXT 0x8F4E
+#endif
+
+#ifndef GL_NV_gpu_program5
+#define GL_MAX_GEOMETRY_PROGRAM_INVOCATIONS_NV 0x8E5A
+#define GL_MIN_FRAGMENT_INTERPOLATION_OFFSET_NV 0x8E5B
+#define GL_MAX_FRAGMENT_INTERPOLATION_OFFSET_NV 0x8E5C
+#define GL_FRAGMENT_PROGRAM_INTERPOLATION_OFFSET_BITS_NV 0x8E5D
+#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET_NV 0x8E5E
+#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET_NV 0x8E5F
+#define GL_MAX_PROGRAM_SUBROUTINE_PARAMETERS_NV 0x8F44
+#define GL_MAX_PROGRAM_SUBROUTINE_NUM_NV 0x8F45
+#endif
+
+#ifndef GL_NV_gpu_shader5
+#define GL_INT64_NV 0x140E
+#define GL_UNSIGNED_INT64_NV 0x140F
+#define GL_INT8_NV 0x8FE0
+#define GL_INT8_VEC2_NV 0x8FE1
+#define GL_INT8_VEC3_NV 0x8FE2
+#define GL_INT8_VEC4_NV 0x8FE3
+#define GL_INT16_NV 0x8FE4
+#define GL_INT16_VEC2_NV 0x8FE5
+#define GL_INT16_VEC3_NV 0x8FE6
+#define GL_INT16_VEC4_NV 0x8FE7
+#define GL_INT64_VEC2_NV 0x8FE9
+#define GL_INT64_VEC3_NV 0x8FEA
+#define GL_INT64_VEC4_NV 0x8FEB
+#define GL_UNSIGNED_INT8_NV 0x8FEC
+#define GL_UNSIGNED_INT8_VEC2_NV 0x8FED
+#define GL_UNSIGNED_INT8_VEC3_NV 0x8FEE
+#define GL_UNSIGNED_INT8_VEC4_NV 0x8FEF
+#define GL_UNSIGNED_INT16_NV 0x8FF0
+#define GL_UNSIGNED_INT16_VEC2_NV 0x8FF1
+#define GL_UNSIGNED_INT16_VEC3_NV 0x8FF2
+#define GL_UNSIGNED_INT16_VEC4_NV 0x8FF3
+#define GL_UNSIGNED_INT64_VEC2_NV 0x8FF5
+#define GL_UNSIGNED_INT64_VEC3_NV 0x8FF6
+#define GL_UNSIGNED_INT64_VEC4_NV 0x8FF7
+#define GL_FLOAT16_NV 0x8FF8
+#define GL_FLOAT16_VEC2_NV 0x8FF9
+#define GL_FLOAT16_VEC3_NV 0x8FFA
+#define GL_FLOAT16_VEC4_NV 0x8FFB
+/* reuse GL_PATCHES */
+#endif
+
+#ifndef GL_NV_shader_buffer_store
+#define GL_SHADER_GLOBAL_ACCESS_BARRIER_BIT_NV 0x00000010
+/* reuse GL_READ_WRITE */
+/* reuse GL_WRITE_ONLY */
+#endif
+
+#ifndef GL_NV_tessellation_program5
+#define GL_MAX_PROGRAM_PATCH_ATTRIBS_NV 0x86D8
+#define GL_TESS_CONTROL_PROGRAM_NV 0x891E
+#define GL_TESS_EVALUATION_PROGRAM_NV 0x891F
+#define GL_TESS_CONTROL_PROGRAM_PARAMETER_BUFFER_NV 0x8C74
+#define GL_TESS_EVALUATION_PROGRAM_PARAMETER_BUFFER_NV 0x8C75
+#endif
+
+#ifndef GL_NV_vertex_attrib_integer_64bit
+/* reuse GL_INT64_NV */
+/* reuse GL_UNSIGNED_INT64_NV */
+#endif
+
+#ifndef GL_NV_multisample_coverage
+#define GL_COVERAGE_SAMPLES_NV 0x80A9
+#define GL_COLOR_SAMPLES_NV 0x8E20
+#endif
+
+#ifndef GL_AMD_name_gen_delete
+#define GL_DATA_BUFFER_AMD 0x9151
+#define GL_PERFORMANCE_MONITOR_AMD 0x9152
+#define GL_QUERY_OBJECT_AMD 0x9153
+#define GL_VERTEX_ARRAY_OBJECT_AMD 0x9154
+#define GL_SAMPLER_OBJECT_AMD 0x9155
+#endif
+
+#ifndef GL_AMD_debug_output
+#define GL_MAX_DEBUG_LOGGED_MESSAGES_AMD 0x9144
+#define GL_DEBUG_LOGGED_MESSAGES_AMD 0x9145
+#define GL_DEBUG_SEVERITY_HIGH_AMD 0x9146
+#define GL_DEBUG_SEVERITY_MEDIUM_AMD 0x9147
+#define GL_DEBUG_SEVERITY_LOW_AMD 0x9148
+#define GL_DEBUG_CATEGORY_API_ERROR_AMD 0x9149
+#define GL_DEBUG_CATEGORY_WINDOW_SYSTEM_AMD 0x914A
+#define GL_DEBUG_CATEGORY_DEPRECATION_AMD 0x914B
+#define GL_DEBUG_CATEGORY_UNDEFINED_BEHAVIOR_AMD 0x914C
+#define GL_DEBUG_CATEGORY_PERFORMANCE_AMD 0x914D
+#define GL_DEBUG_CATEGORY_SHADER_COMPILER_AMD 0x914E
+#define GL_DEBUG_CATEGORY_APPLICATION_AMD 0x914F
+#define GL_DEBUG_CATEGORY_OTHER_AMD 0x9150
+#endif
+
+#ifndef GL_NV_vdpau_interop
+#define GL_SURFACE_STATE_NV 0x86EB
+#define GL_SURFACE_REGISTERED_NV 0x86FD
+#define GL_SURFACE_MAPPED_NV 0x8700
+#define GL_WRITE_DISCARD_NV 0x88BE
+#endif
+
+#ifndef GL_AMD_transform_feedback3_lines_triangles
+#endif
+
+#ifndef GL_AMD_depth_clamp_separate
+#define GL_DEPTH_CLAMP_NEAR_AMD 0x901E
+#define GL_DEPTH_CLAMP_FAR_AMD 0x901F
+#endif
+
+#ifndef GL_EXT_texture_sRGB_decode
+#define GL_TEXTURE_SRGB_DECODE_EXT 0x8A48
+#define GL_DECODE_EXT 0x8A49
+#define GL_SKIP_DECODE_EXT 0x8A4A
+#endif
+
+#ifndef GL_NV_texture_multisample
+#define GL_TEXTURE_COVERAGE_SAMPLES_NV 0x9045
+#define GL_TEXTURE_COLOR_SAMPLES_NV 0x9046
+#endif
+
+#ifndef GL_AMD_blend_minmax_factor
+#define GL_FACTOR_MIN_AMD 0x901C
+#define GL_FACTOR_MAX_AMD 0x901D
+#endif
+
+#ifndef GL_AMD_sample_positions
+#define GL_SUBSAMPLE_DISTANCE_AMD 0x883F
+#endif
+
+#ifndef GL_EXT_x11_sync_object
+#define GL_SYNC_X11_FENCE_EXT 0x90E1
+#endif
+
+#ifndef GL_AMD_multi_draw_indirect
+#endif
+
+#ifndef GL_EXT_framebuffer_multisample_blit_scaled
+#define GL_SCALED_RESOLVE_FASTEST_EXT 0x90BA
+#define GL_SCALED_RESOLVE_NICEST_EXT 0x90BB
+#endif
+
/*************************************************************/
#include <stddef.h>
#ifndef GL_VERSION_2_0
/* GL type for program/shader text */
-typedef char GLchar; /* native character */
+typedef char GLchar;
#endif
#ifndef GL_VERSION_1_5
@@ -3920,12 +5336,12 @@ typedef ptrdiff_t GLsizeiptrARB;
#endif
#ifndef GL_ARB_shader_objects
-/* GL types for handling shader object handles and program/shader text */
-typedef char GLcharARB; /* native character */
-typedef unsigned int GLhandleARB; /* shader object handle */
+/* GL types for program/shader text and shader object handles */
+typedef char GLcharARB;
+typedef unsigned int GLhandleARB;
#endif
-/* GL types for "half" precision (s10e5) float data in host memory */
+/* GL type for "half" precision (s10e5) float data in host memory */
#ifndef GL_ARB_half_float_pixel
typedef unsigned short GLhalfARB;
#endif
@@ -3967,7 +5383,8 @@ typedef __int32 int32_t;
typedef __int64 int64_t;
typedef unsigned __int64 uint64_t;
#else
-#include <inttypes.h> /* Fallback option */
+/* Fallback if nothing above works */
+#include <inttypes.h>
#endif
#endif
@@ -3976,51 +5393,84 @@ typedef int64_t GLint64EXT;
typedef uint64_t GLuint64EXT;
#endif
+#ifndef GL_ARB_sync
+typedef int64_t GLint64;
+typedef uint64_t GLuint64;
+typedef struct __GLsync *GLsync;
+#endif
+
+#ifndef GL_ARB_cl_event
+/* These incomplete types let us declare types compatible with OpenCL's cl_context and cl_event */
+struct _cl_context;
+struct _cl_event;
+#endif
+
+#ifndef GL_ARB_debug_output
+typedef void (APIENTRY *GLDEBUGPROCARB)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,GLvoid *userParam);
+#endif
+
+#ifndef GL_AMD_debug_output
+typedef void (APIENTRY *GLDEBUGPROCAMD)(GLuint id,GLenum category,GLenum severity,GLsizei length,const GLchar *message,GLvoid *userParam);
+#endif
+
+#ifndef GL_NV_vdpau_interop
+typedef GLintptr GLvdpauSurfaceNV;
+#endif
+
#ifndef GL_VERSION_1_2
#define GL_VERSION_1_2 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glBlendColor (GLclampf, GLclampf, GLclampf, GLclampf);
-GLAPI void APIENTRY glBlendEquation (GLenum);
-GLAPI void APIENTRY glDrawRangeElements (GLenum, GLuint, GLuint, GLsizei, GLenum, const GLvoid *);
-GLAPI void APIENTRY glColorTable (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *);
-GLAPI void APIENTRY glColorTableParameterfv (GLenum, GLenum, const GLfloat *);
-GLAPI void APIENTRY glColorTableParameteriv (GLenum, GLenum, const GLint *);
-GLAPI void APIENTRY glCopyColorTable (GLenum, GLenum, GLint, GLint, GLsizei);
-GLAPI void APIENTRY glGetColorTable (GLenum, GLenum, GLenum, GLvoid *);
-GLAPI void APIENTRY glGetColorTableParameterfv (GLenum, GLenum, GLfloat *);
-GLAPI void APIENTRY glGetColorTableParameteriv (GLenum, GLenum, GLint *);
-GLAPI void APIENTRY glColorSubTable (GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
-GLAPI void APIENTRY glCopyColorSubTable (GLenum, GLsizei, GLint, GLint, GLsizei);
-GLAPI void APIENTRY glConvolutionFilter1D (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *);
-GLAPI void APIENTRY glConvolutionFilter2D (GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
-GLAPI void APIENTRY glConvolutionParameterf (GLenum, GLenum, GLfloat);
-GLAPI void APIENTRY glConvolutionParameterfv (GLenum, GLenum, const GLfloat *);
-GLAPI void APIENTRY glConvolutionParameteri (GLenum, GLenum, GLint);
-GLAPI void APIENTRY glConvolutionParameteriv (GLenum, GLenum, const GLint *);
-GLAPI void APIENTRY glCopyConvolutionFilter1D (GLenum, GLenum, GLint, GLint, GLsizei);
-GLAPI void APIENTRY glCopyConvolutionFilter2D (GLenum, GLenum, GLint, GLint, GLsizei, GLsizei);
-GLAPI void APIENTRY glGetConvolutionFilter (GLenum, GLenum, GLenum, GLvoid *);
-GLAPI void APIENTRY glGetConvolutionParameterfv (GLenum, GLenum, GLfloat *);
-GLAPI void APIENTRY glGetConvolutionParameteriv (GLenum, GLenum, GLint *);
-GLAPI void APIENTRY glGetSeparableFilter (GLenum, GLenum, GLenum, GLvoid *, GLvoid *, GLvoid *);
-GLAPI void APIENTRY glSeparableFilter2D (GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *, const GLvoid *);
-GLAPI void APIENTRY glGetHistogram (GLenum, GLboolean, GLenum, GLenum, GLvoid *);
-GLAPI void APIENTRY glGetHistogramParameterfv (GLenum, GLenum, GLfloat *);
-GLAPI void APIENTRY glGetHistogramParameteriv (GLenum, GLenum, GLint *);
-GLAPI void APIENTRY glGetMinmax (GLenum, GLboolean, GLenum, GLenum, GLvoid *);
-GLAPI void APIENTRY glGetMinmaxParameterfv (GLenum, GLenum, GLfloat *);
-GLAPI void APIENTRY glGetMinmaxParameteriv (GLenum, GLenum, GLint *);
-GLAPI void APIENTRY glHistogram (GLenum, GLsizei, GLenum, GLboolean);
-GLAPI void APIENTRY glMinmax (GLenum, GLenum, GLboolean);
-GLAPI void APIENTRY glResetHistogram (GLenum);
-GLAPI void APIENTRY glResetMinmax (GLenum);
-GLAPI void APIENTRY glTexImage3D (GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *);
-GLAPI void APIENTRY glTexSubImage3D (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
-GLAPI void APIENTRY glCopyTexSubImage3D (GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei);
+GLAPI void APIENTRY glBlendColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
+GLAPI void APIENTRY glBlendEquation (GLenum mode);
+GLAPI void APIENTRY glDrawRangeElements (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);
+GLAPI void APIENTRY glTexImage3D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
+GLAPI void APIENTRY glTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);
+GLAPI void APIENTRY glCopyTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLBLENDCOLORPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
typedef void (APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode);
typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);
+typedef void (APIENTRYP PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
+typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);
+typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+#endif
+
+#ifndef GL_VERSION_1_2_DEPRECATED
+#define GL_VERSION_1_2_DEPRECATED 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glColorTable (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table);
+GLAPI void APIENTRY glColorTableParameterfv (GLenum target, GLenum pname, const GLfloat *params);
+GLAPI void APIENTRY glColorTableParameteriv (GLenum target, GLenum pname, const GLint *params);
+GLAPI void APIENTRY glCopyColorTable (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
+GLAPI void APIENTRY glGetColorTable (GLenum target, GLenum format, GLenum type, GLvoid *table);
+GLAPI void APIENTRY glGetColorTableParameterfv (GLenum target, GLenum pname, GLfloat *params);
+GLAPI void APIENTRY glGetColorTableParameteriv (GLenum target, GLenum pname, GLint *params);
+GLAPI void APIENTRY glColorSubTable (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data);
+GLAPI void APIENTRY glCopyColorSubTable (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width);
+GLAPI void APIENTRY glConvolutionFilter1D (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image);
+GLAPI void APIENTRY glConvolutionFilter2D (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image);
+GLAPI void APIENTRY glConvolutionParameterf (GLenum target, GLenum pname, GLfloat params);
+GLAPI void APIENTRY glConvolutionParameterfv (GLenum target, GLenum pname, const GLfloat *params);
+GLAPI void APIENTRY glConvolutionParameteri (GLenum target, GLenum pname, GLint params);
+GLAPI void APIENTRY glConvolutionParameteriv (GLenum target, GLenum pname, const GLint *params);
+GLAPI void APIENTRY glCopyConvolutionFilter1D (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
+GLAPI void APIENTRY glCopyConvolutionFilter2D (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height);
+GLAPI void APIENTRY glGetConvolutionFilter (GLenum target, GLenum format, GLenum type, GLvoid *image);
+GLAPI void APIENTRY glGetConvolutionParameterfv (GLenum target, GLenum pname, GLfloat *params);
+GLAPI void APIENTRY glGetConvolutionParameteriv (GLenum target, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetSeparableFilter (GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span);
+GLAPI void APIENTRY glSeparableFilter2D (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column);
+GLAPI void APIENTRY glGetHistogram (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values);
+GLAPI void APIENTRY glGetHistogramParameterfv (GLenum target, GLenum pname, GLfloat *params);
+GLAPI void APIENTRY glGetHistogramParameteriv (GLenum target, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetMinmax (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values);
+GLAPI void APIENTRY glGetMinmaxParameterfv (GLenum target, GLenum pname, GLfloat *params);
+GLAPI void APIENTRY glGetMinmaxParameteriv (GLenum target, GLenum pname, GLint *params);
+GLAPI void APIENTRY glHistogram (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink);
+GLAPI void APIENTRY glMinmax (GLenum target, GLenum internalformat, GLboolean sink);
+GLAPI void APIENTRY glResetHistogram (GLenum target);
+GLAPI void APIENTRY glResetMinmax (GLenum target);
+#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table);
typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params);
typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params);
@@ -4053,62 +5503,73 @@ typedef void (APIENTRYP PFNGLHISTOGRAMPROC) (GLenum target, GLsizei width, GLenu
typedef void (APIENTRYP PFNGLMINMAXPROC) (GLenum target, GLenum internalformat, GLboolean sink);
typedef void (APIENTRYP PFNGLRESETHISTOGRAMPROC) (GLenum target);
typedef void (APIENTRYP PFNGLRESETMINMAXPROC) (GLenum target);
-typedef void (APIENTRYP PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
-typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);
-typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
#endif
#ifndef GL_VERSION_1_3
#define GL_VERSION_1_3 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glActiveTexture (GLenum);
-GLAPI void APIENTRY glClientActiveTexture (GLenum);
-GLAPI void APIENTRY glMultiTexCoord1d (GLenum, GLdouble);
-GLAPI void APIENTRY glMultiTexCoord1dv (GLenum, const GLdouble *);
-GLAPI void APIENTRY glMultiTexCoord1f (GLenum, GLfloat);
-GLAPI void APIENTRY glMultiTexCoord1fv (GLenum, const GLfloat *);
-GLAPI void APIENTRY glMultiTexCoord1i (GLenum, GLint);
-GLAPI void APIENTRY glMultiTexCoord1iv (GLenum, const GLint *);
-GLAPI void APIENTRY glMultiTexCoord1s (GLenum, GLshort);
-GLAPI void APIENTRY glMultiTexCoord1sv (GLenum, const GLshort *);
-GLAPI void APIENTRY glMultiTexCoord2d (GLenum, GLdouble, GLdouble);
-GLAPI void APIENTRY glMultiTexCoord2dv (GLenum, const GLdouble *);
-GLAPI void APIENTRY glMultiTexCoord2f (GLenum, GLfloat, GLfloat);
-GLAPI void APIENTRY glMultiTexCoord2fv (GLenum, const GLfloat *);
-GLAPI void APIENTRY glMultiTexCoord2i (GLenum, GLint, GLint);
-GLAPI void APIENTRY glMultiTexCoord2iv (GLenum, const GLint *);
-GLAPI void APIENTRY glMultiTexCoord2s (GLenum, GLshort, GLshort);
-GLAPI void APIENTRY glMultiTexCoord2sv (GLenum, const GLshort *);
-GLAPI void APIENTRY glMultiTexCoord3d (GLenum, GLdouble, GLdouble, GLdouble);
-GLAPI void APIENTRY glMultiTexCoord3dv (GLenum, const GLdouble *);
-GLAPI void APIENTRY glMultiTexCoord3f (GLenum, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glMultiTexCoord3fv (GLenum, const GLfloat *);
-GLAPI void APIENTRY glMultiTexCoord3i (GLenum, GLint, GLint, GLint);
-GLAPI void APIENTRY glMultiTexCoord3iv (GLenum, const GLint *);
-GLAPI void APIENTRY glMultiTexCoord3s (GLenum, GLshort, GLshort, GLshort);
-GLAPI void APIENTRY glMultiTexCoord3sv (GLenum, const GLshort *);
-GLAPI void APIENTRY glMultiTexCoord4d (GLenum, GLdouble, GLdouble, GLdouble, GLdouble);
-GLAPI void APIENTRY glMultiTexCoord4dv (GLenum, const GLdouble *);
-GLAPI void APIENTRY glMultiTexCoord4f (GLenum, GLfloat, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glMultiTexCoord4fv (GLenum, const GLfloat *);
-GLAPI void APIENTRY glMultiTexCoord4i (GLenum, GLint, GLint, GLint, GLint);
-GLAPI void APIENTRY glMultiTexCoord4iv (GLenum, const GLint *);
-GLAPI void APIENTRY glMultiTexCoord4s (GLenum, GLshort, GLshort, GLshort, GLshort);
-GLAPI void APIENTRY glMultiTexCoord4sv (GLenum, const GLshort *);
-GLAPI void APIENTRY glLoadTransposeMatrixf (const GLfloat *);
-GLAPI void APIENTRY glLoadTransposeMatrixd (const GLdouble *);
-GLAPI void APIENTRY glMultTransposeMatrixf (const GLfloat *);
-GLAPI void APIENTRY glMultTransposeMatrixd (const GLdouble *);
-GLAPI void APIENTRY glSampleCoverage (GLclampf, GLboolean);
-GLAPI void APIENTRY glCompressedTexImage3D (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *);
-GLAPI void APIENTRY glCompressedTexImage2D (GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *);
-GLAPI void APIENTRY glCompressedTexImage1D (GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const GLvoid *);
-GLAPI void APIENTRY glCompressedTexSubImage3D (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *);
-GLAPI void APIENTRY glCompressedTexSubImage2D (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *);
-GLAPI void APIENTRY glCompressedTexSubImage1D (GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const GLvoid *);
-GLAPI void APIENTRY glGetCompressedTexImage (GLenum, GLint, GLvoid *);
+GLAPI void APIENTRY glActiveTexture (GLenum texture);
+GLAPI void APIENTRY glSampleCoverage (GLclampf value, GLboolean invert);
+GLAPI void APIENTRY glCompressedTexImage3D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data);
+GLAPI void APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
+GLAPI void APIENTRY glCompressedTexImage1D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data);
+GLAPI void APIENTRY glCompressedTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data);
+GLAPI void APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);
+GLAPI void APIENTRY glCompressedTexSubImage1D (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data);
+GLAPI void APIENTRY glGetCompressedTexImage (GLenum target, GLint level, GLvoid *img);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture);
+typedef void (APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLclampf value, GLboolean invert);
+typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data);
+typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
+typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data);
+typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data);
+typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);
+typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data);
+typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint level, GLvoid *img);
+#endif
+
+#ifndef GL_VERSION_1_3_DEPRECATED
+#define GL_VERSION_1_3_DEPRECATED 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glClientActiveTexture (GLenum texture);
+GLAPI void APIENTRY glMultiTexCoord1d (GLenum target, GLdouble s);
+GLAPI void APIENTRY glMultiTexCoord1dv (GLenum target, const GLdouble *v);
+GLAPI void APIENTRY glMultiTexCoord1f (GLenum target, GLfloat s);
+GLAPI void APIENTRY glMultiTexCoord1fv (GLenum target, const GLfloat *v);
+GLAPI void APIENTRY glMultiTexCoord1i (GLenum target, GLint s);
+GLAPI void APIENTRY glMultiTexCoord1iv (GLenum target, const GLint *v);
+GLAPI void APIENTRY glMultiTexCoord1s (GLenum target, GLshort s);
+GLAPI void APIENTRY glMultiTexCoord1sv (GLenum target, const GLshort *v);
+GLAPI void APIENTRY glMultiTexCoord2d (GLenum target, GLdouble s, GLdouble t);
+GLAPI void APIENTRY glMultiTexCoord2dv (GLenum target, const GLdouble *v);
+GLAPI void APIENTRY glMultiTexCoord2f (GLenum target, GLfloat s, GLfloat t);
+GLAPI void APIENTRY glMultiTexCoord2fv (GLenum target, const GLfloat *v);
+GLAPI void APIENTRY glMultiTexCoord2i (GLenum target, GLint s, GLint t);
+GLAPI void APIENTRY glMultiTexCoord2iv (GLenum target, const GLint *v);
+GLAPI void APIENTRY glMultiTexCoord2s (GLenum target, GLshort s, GLshort t);
+GLAPI void APIENTRY glMultiTexCoord2sv (GLenum target, const GLshort *v);
+GLAPI void APIENTRY glMultiTexCoord3d (GLenum target, GLdouble s, GLdouble t, GLdouble r);
+GLAPI void APIENTRY glMultiTexCoord3dv (GLenum target, const GLdouble *v);
+GLAPI void APIENTRY glMultiTexCoord3f (GLenum target, GLfloat s, GLfloat t, GLfloat r);
+GLAPI void APIENTRY glMultiTexCoord3fv (GLenum target, const GLfloat *v);
+GLAPI void APIENTRY glMultiTexCoord3i (GLenum target, GLint s, GLint t, GLint r);
+GLAPI void APIENTRY glMultiTexCoord3iv (GLenum target, const GLint *v);
+GLAPI void APIENTRY glMultiTexCoord3s (GLenum target, GLshort s, GLshort t, GLshort r);
+GLAPI void APIENTRY glMultiTexCoord3sv (GLenum target, const GLshort *v);
+GLAPI void APIENTRY glMultiTexCoord4d (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q);
+GLAPI void APIENTRY glMultiTexCoord4dv (GLenum target, const GLdouble *v);
+GLAPI void APIENTRY glMultiTexCoord4f (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
+GLAPI void APIENTRY glMultiTexCoord4fv (GLenum target, const GLfloat *v);
+GLAPI void APIENTRY glMultiTexCoord4i (GLenum target, GLint s, GLint t, GLint r, GLint q);
+GLAPI void APIENTRY glMultiTexCoord4iv (GLenum target, const GLint *v);
+GLAPI void APIENTRY glMultiTexCoord4s (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);
+GLAPI void APIENTRY glMultiTexCoord4sv (GLenum target, const GLshort *v);
+GLAPI void APIENTRY glLoadTransposeMatrixf (const GLfloat *m);
+GLAPI void APIENTRY glLoadTransposeMatrixd (const GLdouble *m);
+GLAPI void APIENTRY glMultTransposeMatrixf (const GLfloat *m);
+GLAPI void APIENTRY glMultTransposeMatrixd (const GLdouble *m);
+#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREPROC) (GLenum texture);
typedef void (APIENTRYP PFNGLMULTITEXCOORD1DPROC) (GLenum target, GLdouble s);
typedef void (APIENTRYP PFNGLMULTITEXCOORD1DVPROC) (GLenum target, const GLdouble *v);
@@ -4146,77 +5607,75 @@ typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXFPROC) (const GLfloat *m);
typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXDPROC) (const GLdouble *m);
typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXFPROC) (const GLfloat *m);
typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXDPROC) (const GLdouble *m);
-typedef void (APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLclampf value, GLboolean invert);
-typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data);
-typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
-typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data);
-typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data);
-typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);
-typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data);
-typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint level, GLvoid *img);
#endif
#ifndef GL_VERSION_1_4
#define GL_VERSION_1_4 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glBlendFuncSeparate (GLenum, GLenum, GLenum, GLenum);
-GLAPI void APIENTRY glFogCoordf (GLfloat);
-GLAPI void APIENTRY glFogCoordfv (const GLfloat *);
-GLAPI void APIENTRY glFogCoordd (GLdouble);
-GLAPI void APIENTRY glFogCoorddv (const GLdouble *);
-GLAPI void APIENTRY glFogCoordPointer (GLenum, GLsizei, const GLvoid *);
-GLAPI void APIENTRY glMultiDrawArrays (GLenum, GLint *, GLsizei *, GLsizei);
-GLAPI void APIENTRY glMultiDrawElements (GLenum, const GLsizei *, GLenum, const GLvoid* *, GLsizei);
-GLAPI void APIENTRY glPointParameterf (GLenum, GLfloat);
-GLAPI void APIENTRY glPointParameterfv (GLenum, const GLfloat *);
-GLAPI void APIENTRY glPointParameteri (GLenum, GLint);
-GLAPI void APIENTRY glPointParameteriv (GLenum, const GLint *);
-GLAPI void APIENTRY glSecondaryColor3b (GLbyte, GLbyte, GLbyte);
-GLAPI void APIENTRY glSecondaryColor3bv (const GLbyte *);
-GLAPI void APIENTRY glSecondaryColor3d (GLdouble, GLdouble, GLdouble);
-GLAPI void APIENTRY glSecondaryColor3dv (const GLdouble *);
-GLAPI void APIENTRY glSecondaryColor3f (GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glSecondaryColor3fv (const GLfloat *);
-GLAPI void APIENTRY glSecondaryColor3i (GLint, GLint, GLint);
-GLAPI void APIENTRY glSecondaryColor3iv (const GLint *);
-GLAPI void APIENTRY glSecondaryColor3s (GLshort, GLshort, GLshort);
-GLAPI void APIENTRY glSecondaryColor3sv (const GLshort *);
-GLAPI void APIENTRY glSecondaryColor3ub (GLubyte, GLubyte, GLubyte);
-GLAPI void APIENTRY glSecondaryColor3ubv (const GLubyte *);
-GLAPI void APIENTRY glSecondaryColor3ui (GLuint, GLuint, GLuint);
-GLAPI void APIENTRY glSecondaryColor3uiv (const GLuint *);
-GLAPI void APIENTRY glSecondaryColor3us (GLushort, GLushort, GLushort);
-GLAPI void APIENTRY glSecondaryColor3usv (const GLushort *);
-GLAPI void APIENTRY glSecondaryColorPointer (GLint, GLenum, GLsizei, const GLvoid *);
-GLAPI void APIENTRY glWindowPos2d (GLdouble, GLdouble);
-GLAPI void APIENTRY glWindowPos2dv (const GLdouble *);
-GLAPI void APIENTRY glWindowPos2f (GLfloat, GLfloat);
-GLAPI void APIENTRY glWindowPos2fv (const GLfloat *);
-GLAPI void APIENTRY glWindowPos2i (GLint, GLint);
-GLAPI void APIENTRY glWindowPos2iv (const GLint *);
-GLAPI void APIENTRY glWindowPos2s (GLshort, GLshort);
-GLAPI void APIENTRY glWindowPos2sv (const GLshort *);
-GLAPI void APIENTRY glWindowPos3d (GLdouble, GLdouble, GLdouble);
-GLAPI void APIENTRY glWindowPos3dv (const GLdouble *);
-GLAPI void APIENTRY glWindowPos3f (GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glWindowPos3fv (const GLfloat *);
-GLAPI void APIENTRY glWindowPos3i (GLint, GLint, GLint);
-GLAPI void APIENTRY glWindowPos3iv (const GLint *);
-GLAPI void APIENTRY glWindowPos3s (GLshort, GLshort, GLshort);
-GLAPI void APIENTRY glWindowPos3sv (const GLshort *);
+GLAPI void APIENTRY glBlendFuncSeparate (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
+GLAPI void APIENTRY glMultiDrawArrays (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount);
+GLAPI void APIENTRY glMultiDrawElements (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount);
+GLAPI void APIENTRY glPointParameterf (GLenum pname, GLfloat param);
+GLAPI void APIENTRY glPointParameterfv (GLenum pname, const GLfloat *params);
+GLAPI void APIENTRY glPointParameteri (GLenum pname, GLint param);
+GLAPI void APIENTRY glPointParameteriv (GLenum pname, const GLint *params);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
-typedef void (APIENTRYP PFNGLFOGCOORDFPROC) (GLfloat coord);
-typedef void (APIENTRYP PFNGLFOGCOORDFVPROC) (const GLfloat *coord);
-typedef void (APIENTRYP PFNGLFOGCOORDDPROC) (GLdouble coord);
-typedef void (APIENTRYP PFNGLFOGCOORDDVPROC) (const GLdouble *coord);
-typedef void (APIENTRYP PFNGLFOGCOORDPOINTERPROC) (GLenum type, GLsizei stride, const GLvoid *pointer);
-typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSPROC) (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount);
+typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount);
typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount);
typedef void (APIENTRYP PFNGLPOINTPARAMETERFPROC) (GLenum pname, GLfloat param);
typedef void (APIENTRYP PFNGLPOINTPARAMETERFVPROC) (GLenum pname, const GLfloat *params);
typedef void (APIENTRYP PFNGLPOINTPARAMETERIPROC) (GLenum pname, GLint param);
typedef void (APIENTRYP PFNGLPOINTPARAMETERIVPROC) (GLenum pname, const GLint *params);
+#endif
+
+#ifndef GL_VERSION_1_4_DEPRECATED
+#define GL_VERSION_1_4_DEPRECATED 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glFogCoordf (GLfloat coord);
+GLAPI void APIENTRY glFogCoordfv (const GLfloat *coord);
+GLAPI void APIENTRY glFogCoordd (GLdouble coord);
+GLAPI void APIENTRY glFogCoorddv (const GLdouble *coord);
+GLAPI void APIENTRY glFogCoordPointer (GLenum type, GLsizei stride, const GLvoid *pointer);
+GLAPI void APIENTRY glSecondaryColor3b (GLbyte red, GLbyte green, GLbyte blue);
+GLAPI void APIENTRY glSecondaryColor3bv (const GLbyte *v);
+GLAPI void APIENTRY glSecondaryColor3d (GLdouble red, GLdouble green, GLdouble blue);
+GLAPI void APIENTRY glSecondaryColor3dv (const GLdouble *v);
+GLAPI void APIENTRY glSecondaryColor3f (GLfloat red, GLfloat green, GLfloat blue);
+GLAPI void APIENTRY glSecondaryColor3fv (const GLfloat *v);
+GLAPI void APIENTRY glSecondaryColor3i (GLint red, GLint green, GLint blue);
+GLAPI void APIENTRY glSecondaryColor3iv (const GLint *v);
+GLAPI void APIENTRY glSecondaryColor3s (GLshort red, GLshort green, GLshort blue);
+GLAPI void APIENTRY glSecondaryColor3sv (const GLshort *v);
+GLAPI void APIENTRY glSecondaryColor3ub (GLubyte red, GLubyte green, GLubyte blue);
+GLAPI void APIENTRY glSecondaryColor3ubv (const GLubyte *v);
+GLAPI void APIENTRY glSecondaryColor3ui (GLuint red, GLuint green, GLuint blue);
+GLAPI void APIENTRY glSecondaryColor3uiv (const GLuint *v);
+GLAPI void APIENTRY glSecondaryColor3us (GLushort red, GLushort green, GLushort blue);
+GLAPI void APIENTRY glSecondaryColor3usv (const GLushort *v);
+GLAPI void APIENTRY glSecondaryColorPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
+GLAPI void APIENTRY glWindowPos2d (GLdouble x, GLdouble y);
+GLAPI void APIENTRY glWindowPos2dv (const GLdouble *v);
+GLAPI void APIENTRY glWindowPos2f (GLfloat x, GLfloat y);
+GLAPI void APIENTRY glWindowPos2fv (const GLfloat *v);
+GLAPI void APIENTRY glWindowPos2i (GLint x, GLint y);
+GLAPI void APIENTRY glWindowPos2iv (const GLint *v);
+GLAPI void APIENTRY glWindowPos2s (GLshort x, GLshort y);
+GLAPI void APIENTRY glWindowPos2sv (const GLshort *v);
+GLAPI void APIENTRY glWindowPos3d (GLdouble x, GLdouble y, GLdouble z);
+GLAPI void APIENTRY glWindowPos3dv (const GLdouble *v);
+GLAPI void APIENTRY glWindowPos3f (GLfloat x, GLfloat y, GLfloat z);
+GLAPI void APIENTRY glWindowPos3fv (const GLfloat *v);
+GLAPI void APIENTRY glWindowPos3i (GLint x, GLint y, GLint z);
+GLAPI void APIENTRY glWindowPos3iv (const GLint *v);
+GLAPI void APIENTRY glWindowPos3s (GLshort x, GLshort y, GLshort z);
+GLAPI void APIENTRY glWindowPos3sv (const GLshort *v);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLFOGCOORDFPROC) (GLfloat coord);
+typedef void (APIENTRYP PFNGLFOGCOORDFVPROC) (const GLfloat *coord);
+typedef void (APIENTRYP PFNGLFOGCOORDDPROC) (GLdouble coord);
+typedef void (APIENTRYP PFNGLFOGCOORDDVPROC) (const GLdouble *coord);
+typedef void (APIENTRYP PFNGLFOGCOORDPOINTERPROC) (GLenum type, GLsizei stride, const GLvoid *pointer);
typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BPROC) (GLbyte red, GLbyte green, GLbyte blue);
typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BVPROC) (const GLbyte *v);
typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DPROC) (GLdouble red, GLdouble green, GLdouble blue);
@@ -4255,25 +5714,25 @@ typedef void (APIENTRYP PFNGLWINDOWPOS3SVPROC) (const GLshort *v);
#ifndef GL_VERSION_1_5
#define GL_VERSION_1_5 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glGenQueries (GLsizei, GLuint *);
-GLAPI void APIENTRY glDeleteQueries (GLsizei, const GLuint *);
-GLAPI GLboolean APIENTRY glIsQuery (GLuint);
-GLAPI void APIENTRY glBeginQuery (GLenum, GLuint);
-GLAPI void APIENTRY glEndQuery (GLenum);
-GLAPI void APIENTRY glGetQueryiv (GLenum, GLenum, GLint *);
-GLAPI void APIENTRY glGetQueryObjectiv (GLuint, GLenum, GLint *);
-GLAPI void APIENTRY glGetQueryObjectuiv (GLuint, GLenum, GLuint *);
-GLAPI void APIENTRY glBindBuffer (GLenum, GLuint);
-GLAPI void APIENTRY glDeleteBuffers (GLsizei, const GLuint *);
-GLAPI void APIENTRY glGenBuffers (GLsizei, GLuint *);
-GLAPI GLboolean APIENTRY glIsBuffer (GLuint);
-GLAPI void APIENTRY glBufferData (GLenum, GLsizeiptr, const GLvoid *, GLenum);
-GLAPI void APIENTRY glBufferSubData (GLenum, GLintptr, GLsizeiptr, const GLvoid *);
-GLAPI void APIENTRY glGetBufferSubData (GLenum, GLintptr, GLsizeiptr, GLvoid *);
-GLAPI GLvoid* APIENTRY glMapBuffer (GLenum, GLenum);
-GLAPI GLboolean APIENTRY glUnmapBuffer (GLenum);
-GLAPI void APIENTRY glGetBufferParameteriv (GLenum, GLenum, GLint *);
-GLAPI void APIENTRY glGetBufferPointerv (GLenum, GLenum, GLvoid* *);
+GLAPI void APIENTRY glGenQueries (GLsizei n, GLuint *ids);
+GLAPI void APIENTRY glDeleteQueries (GLsizei n, const GLuint *ids);
+GLAPI GLboolean APIENTRY glIsQuery (GLuint id);
+GLAPI void APIENTRY glBeginQuery (GLenum target, GLuint id);
+GLAPI void APIENTRY glEndQuery (GLenum target);
+GLAPI void APIENTRY glGetQueryiv (GLenum target, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetQueryObjectiv (GLuint id, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetQueryObjectuiv (GLuint id, GLenum pname, GLuint *params);
+GLAPI void APIENTRY glBindBuffer (GLenum target, GLuint buffer);
+GLAPI void APIENTRY glDeleteBuffers (GLsizei n, const GLuint *buffers);
+GLAPI void APIENTRY glGenBuffers (GLsizei n, GLuint *buffers);
+GLAPI GLboolean APIENTRY glIsBuffer (GLuint buffer);
+GLAPI void APIENTRY glBufferData (GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage);
+GLAPI void APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data);
+GLAPI void APIENTRY glGetBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data);
+GLAPI GLvoid* APIENTRY glMapBuffer (GLenum target, GLenum access);
+GLAPI GLboolean APIENTRY glUnmapBuffer (GLenum target);
+GLAPI void APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetBufferPointerv (GLenum target, GLenum pname, GLvoid* *params);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLGENQUERIESPROC) (GLsizei n, GLuint *ids);
typedef void (APIENTRYP PFNGLDELETEQUERIESPROC) (GLsizei n, const GLuint *ids);
@@ -4299,104 +5758,104 @@ typedef void (APIENTRYP PFNGLGETBUFFERPOINTERVPROC) (GLenum target, GLenum pname
#ifndef GL_VERSION_2_0
#define GL_VERSION_2_0 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glBlendEquationSeparate (GLenum, GLenum);
-GLAPI void APIENTRY glDrawBuffers (GLsizei, const GLenum *);
-GLAPI void APIENTRY glStencilOpSeparate (GLenum, GLenum, GLenum, GLenum);
-GLAPI void APIENTRY glStencilFuncSeparate (GLenum, GLenum, GLint, GLuint);
-GLAPI void APIENTRY glStencilMaskSeparate (GLenum, GLuint);
-GLAPI void APIENTRY glAttachShader (GLuint, GLuint);
-GLAPI void APIENTRY glBindAttribLocation (GLuint, GLuint, const GLchar *);
-GLAPI void APIENTRY glCompileShader (GLuint);
+GLAPI void APIENTRY glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha);
+GLAPI void APIENTRY glDrawBuffers (GLsizei n, const GLenum *bufs);
+GLAPI void APIENTRY glStencilOpSeparate (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
+GLAPI void APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask);
+GLAPI void APIENTRY glStencilMaskSeparate (GLenum face, GLuint mask);
+GLAPI void APIENTRY glAttachShader (GLuint program, GLuint shader);
+GLAPI void APIENTRY glBindAttribLocation (GLuint program, GLuint index, const GLchar *name);
+GLAPI void APIENTRY glCompileShader (GLuint shader);
GLAPI GLuint APIENTRY glCreateProgram (void);
-GLAPI GLuint APIENTRY glCreateShader (GLenum);
-GLAPI void APIENTRY glDeleteProgram (GLuint);
-GLAPI void APIENTRY glDeleteShader (GLuint);
-GLAPI void APIENTRY glDetachShader (GLuint, GLuint);
-GLAPI void APIENTRY glDisableVertexAttribArray (GLuint);
-GLAPI void APIENTRY glEnableVertexAttribArray (GLuint);
-GLAPI void APIENTRY glGetActiveAttrib (GLuint, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLchar *);
-GLAPI void APIENTRY glGetActiveUniform (GLuint, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLchar *);
-GLAPI void APIENTRY glGetAttachedShaders (GLuint, GLsizei, GLsizei *, GLuint *);
-GLAPI GLint APIENTRY glGetAttribLocation (GLuint, const GLchar *);
-GLAPI void APIENTRY glGetProgramiv (GLuint, GLenum, GLint *);
-GLAPI void APIENTRY glGetProgramInfoLog (GLuint, GLsizei, GLsizei *, GLchar *);
-GLAPI void APIENTRY glGetShaderiv (GLuint, GLenum, GLint *);
-GLAPI void APIENTRY glGetShaderInfoLog (GLuint, GLsizei, GLsizei *, GLchar *);
-GLAPI void APIENTRY glGetShaderSource (GLuint, GLsizei, GLsizei *, GLchar *);
-GLAPI GLint APIENTRY glGetUniformLocation (GLuint, const GLchar *);
-GLAPI void APIENTRY glGetUniformfv (GLuint, GLint, GLfloat *);
-GLAPI void APIENTRY glGetUniformiv (GLuint, GLint, GLint *);
-GLAPI void APIENTRY glGetVertexAttribdv (GLuint, GLenum, GLdouble *);
-GLAPI void APIENTRY glGetVertexAttribfv (GLuint, GLenum, GLfloat *);
-GLAPI void APIENTRY glGetVertexAttribiv (GLuint, GLenum, GLint *);
-GLAPI void APIENTRY glGetVertexAttribPointerv (GLuint, GLenum, GLvoid* *);
-GLAPI GLboolean APIENTRY glIsProgram (GLuint);
-GLAPI GLboolean APIENTRY glIsShader (GLuint);
-GLAPI void APIENTRY glLinkProgram (GLuint);
-GLAPI void APIENTRY glShaderSource (GLuint, GLsizei, const GLchar* *, const GLint *);
-GLAPI void APIENTRY glUseProgram (GLuint);
-GLAPI void APIENTRY glUniform1f (GLint, GLfloat);
-GLAPI void APIENTRY glUniform2f (GLint, GLfloat, GLfloat);
-GLAPI void APIENTRY glUniform3f (GLint, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glUniform4f (GLint, GLfloat, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glUniform1i (GLint, GLint);
-GLAPI void APIENTRY glUniform2i (GLint, GLint, GLint);
-GLAPI void APIENTRY glUniform3i (GLint, GLint, GLint, GLint);
-GLAPI void APIENTRY glUniform4i (GLint, GLint, GLint, GLint, GLint);
-GLAPI void APIENTRY glUniform1fv (GLint, GLsizei, const GLfloat *);
-GLAPI void APIENTRY glUniform2fv (GLint, GLsizei, const GLfloat *);
-GLAPI void APIENTRY glUniform3fv (GLint, GLsizei, const GLfloat *);
-GLAPI void APIENTRY glUniform4fv (GLint, GLsizei, const GLfloat *);
-GLAPI void APIENTRY glUniform1iv (GLint, GLsizei, const GLint *);
-GLAPI void APIENTRY glUniform2iv (GLint, GLsizei, const GLint *);
-GLAPI void APIENTRY glUniform3iv (GLint, GLsizei, const GLint *);
-GLAPI void APIENTRY glUniform4iv (GLint, GLsizei, const GLint *);
-GLAPI void APIENTRY glUniformMatrix2fv (GLint, GLsizei, GLboolean, const GLfloat *);
-GLAPI void APIENTRY glUniformMatrix3fv (GLint, GLsizei, GLboolean, const GLfloat *);
-GLAPI void APIENTRY glUniformMatrix4fv (GLint, GLsizei, GLboolean, const GLfloat *);
-GLAPI void APIENTRY glValidateProgram (GLuint);
-GLAPI void APIENTRY glVertexAttrib1d (GLuint, GLdouble);
-GLAPI void APIENTRY glVertexAttrib1dv (GLuint, const GLdouble *);
-GLAPI void APIENTRY glVertexAttrib1f (GLuint, GLfloat);
-GLAPI void APIENTRY glVertexAttrib1fv (GLuint, const GLfloat *);
-GLAPI void APIENTRY glVertexAttrib1s (GLuint, GLshort);
-GLAPI void APIENTRY glVertexAttrib1sv (GLuint, const GLshort *);
-GLAPI void APIENTRY glVertexAttrib2d (GLuint, GLdouble, GLdouble);
-GLAPI void APIENTRY glVertexAttrib2dv (GLuint, const GLdouble *);
-GLAPI void APIENTRY glVertexAttrib2f (GLuint, GLfloat, GLfloat);
-GLAPI void APIENTRY glVertexAttrib2fv (GLuint, const GLfloat *);
-GLAPI void APIENTRY glVertexAttrib2s (GLuint, GLshort, GLshort);
-GLAPI void APIENTRY glVertexAttrib2sv (GLuint, const GLshort *);
-GLAPI void APIENTRY glVertexAttrib3d (GLuint, GLdouble, GLdouble, GLdouble);
-GLAPI void APIENTRY glVertexAttrib3dv (GLuint, const GLdouble *);
-GLAPI void APIENTRY glVertexAttrib3f (GLuint, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glVertexAttrib3fv (GLuint, const GLfloat *);
-GLAPI void APIENTRY glVertexAttrib3s (GLuint, GLshort, GLshort, GLshort);
-GLAPI void APIENTRY glVertexAttrib3sv (GLuint, const GLshort *);
-GLAPI void APIENTRY glVertexAttrib4Nbv (GLuint, const GLbyte *);
-GLAPI void APIENTRY glVertexAttrib4Niv (GLuint, const GLint *);
-GLAPI void APIENTRY glVertexAttrib4Nsv (GLuint, const GLshort *);
-GLAPI void APIENTRY glVertexAttrib4Nub (GLuint, GLubyte, GLubyte, GLubyte, GLubyte);
-GLAPI void APIENTRY glVertexAttrib4Nubv (GLuint, const GLubyte *);
-GLAPI void APIENTRY glVertexAttrib4Nuiv (GLuint, const GLuint *);
-GLAPI void APIENTRY glVertexAttrib4Nusv (GLuint, const GLushort *);
-GLAPI void APIENTRY glVertexAttrib4bv (GLuint, const GLbyte *);
-GLAPI void APIENTRY glVertexAttrib4d (GLuint, GLdouble, GLdouble, GLdouble, GLdouble);
-GLAPI void APIENTRY glVertexAttrib4dv (GLuint, const GLdouble *);
-GLAPI void APIENTRY glVertexAttrib4f (GLuint, GLfloat, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glVertexAttrib4fv (GLuint, const GLfloat *);
-GLAPI void APIENTRY glVertexAttrib4iv (GLuint, const GLint *);
-GLAPI void APIENTRY glVertexAttrib4s (GLuint, GLshort, GLshort, GLshort, GLshort);
-GLAPI void APIENTRY glVertexAttrib4sv (GLuint, const GLshort *);
-GLAPI void APIENTRY glVertexAttrib4ubv (GLuint, const GLubyte *);
-GLAPI void APIENTRY glVertexAttrib4uiv (GLuint, const GLuint *);
-GLAPI void APIENTRY glVertexAttrib4usv (GLuint, const GLushort *);
-GLAPI void APIENTRY glVertexAttribPointer (GLuint, GLint, GLenum, GLboolean, GLsizei, const GLvoid *);
+GLAPI GLuint APIENTRY glCreateShader (GLenum type);
+GLAPI void APIENTRY glDeleteProgram (GLuint program);
+GLAPI void APIENTRY glDeleteShader (GLuint shader);
+GLAPI void APIENTRY glDetachShader (GLuint program, GLuint shader);
+GLAPI void APIENTRY glDisableVertexAttribArray (GLuint index);
+GLAPI void APIENTRY glEnableVertexAttribArray (GLuint index);
+GLAPI void APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
+GLAPI void APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
+GLAPI void APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj);
+GLAPI GLint APIENTRY glGetAttribLocation (GLuint program, const GLchar *name);
+GLAPI void APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
+GLAPI void APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
+GLAPI void APIENTRY glGetShaderSource (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
+GLAPI GLint APIENTRY glGetUniformLocation (GLuint program, const GLchar *name);
+GLAPI void APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat *params);
+GLAPI void APIENTRY glGetUniformiv (GLuint program, GLint location, GLint *params);
+GLAPI void APIENTRY glGetVertexAttribdv (GLuint index, GLenum pname, GLdouble *params);
+GLAPI void APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat *params);
+GLAPI void APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, GLvoid* *pointer);
+GLAPI GLboolean APIENTRY glIsProgram (GLuint program);
+GLAPI GLboolean APIENTRY glIsShader (GLuint shader);
+GLAPI void APIENTRY glLinkProgram (GLuint program);
+GLAPI void APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar* *string, const GLint *length);
+GLAPI void APIENTRY glUseProgram (GLuint program);
+GLAPI void APIENTRY glUniform1f (GLint location, GLfloat v0);
+GLAPI void APIENTRY glUniform2f (GLint location, GLfloat v0, GLfloat v1);
+GLAPI void APIENTRY glUniform3f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
+GLAPI void APIENTRY glUniform4f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
+GLAPI void APIENTRY glUniform1i (GLint location, GLint v0);
+GLAPI void APIENTRY glUniform2i (GLint location, GLint v0, GLint v1);
+GLAPI void APIENTRY glUniform3i (GLint location, GLint v0, GLint v1, GLint v2);
+GLAPI void APIENTRY glUniform4i (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
+GLAPI void APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat *value);
+GLAPI void APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat *value);
+GLAPI void APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat *value);
+GLAPI void APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat *value);
+GLAPI void APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint *value);
+GLAPI void APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint *value);
+GLAPI void APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint *value);
+GLAPI void APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint *value);
+GLAPI void APIENTRY glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GLAPI void APIENTRY glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GLAPI void APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GLAPI void APIENTRY glValidateProgram (GLuint program);
+GLAPI void APIENTRY glVertexAttrib1d (GLuint index, GLdouble x);
+GLAPI void APIENTRY glVertexAttrib1dv (GLuint index, const GLdouble *v);
+GLAPI void APIENTRY glVertexAttrib1f (GLuint index, GLfloat x);
+GLAPI void APIENTRY glVertexAttrib1fv (GLuint index, const GLfloat *v);
+GLAPI void APIENTRY glVertexAttrib1s (GLuint index, GLshort x);
+GLAPI void APIENTRY glVertexAttrib1sv (GLuint index, const GLshort *v);
+GLAPI void APIENTRY glVertexAttrib2d (GLuint index, GLdouble x, GLdouble y);
+GLAPI void APIENTRY glVertexAttrib2dv (GLuint index, const GLdouble *v);
+GLAPI void APIENTRY glVertexAttrib2f (GLuint index, GLfloat x, GLfloat y);
+GLAPI void APIENTRY glVertexAttrib2fv (GLuint index, const GLfloat *v);
+GLAPI void APIENTRY glVertexAttrib2s (GLuint index, GLshort x, GLshort y);
+GLAPI void APIENTRY glVertexAttrib2sv (GLuint index, const GLshort *v);
+GLAPI void APIENTRY glVertexAttrib3d (GLuint index, GLdouble x, GLdouble y, GLdouble z);
+GLAPI void APIENTRY glVertexAttrib3dv (GLuint index, const GLdouble *v);
+GLAPI void APIENTRY glVertexAttrib3f (GLuint index, GLfloat x, GLfloat y, GLfloat z);
+GLAPI void APIENTRY glVertexAttrib3fv (GLuint index, const GLfloat *v);
+GLAPI void APIENTRY glVertexAttrib3s (GLuint index, GLshort x, GLshort y, GLshort z);
+GLAPI void APIENTRY glVertexAttrib3sv (GLuint index, const GLshort *v);
+GLAPI void APIENTRY glVertexAttrib4Nbv (GLuint index, const GLbyte *v);
+GLAPI void APIENTRY glVertexAttrib4Niv (GLuint index, const GLint *v);
+GLAPI void APIENTRY glVertexAttrib4Nsv (GLuint index, const GLshort *v);
+GLAPI void APIENTRY glVertexAttrib4Nub (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);
+GLAPI void APIENTRY glVertexAttrib4Nubv (GLuint index, const GLubyte *v);
+GLAPI void APIENTRY glVertexAttrib4Nuiv (GLuint index, const GLuint *v);
+GLAPI void APIENTRY glVertexAttrib4Nusv (GLuint index, const GLushort *v);
+GLAPI void APIENTRY glVertexAttrib4bv (GLuint index, const GLbyte *v);
+GLAPI void APIENTRY glVertexAttrib4d (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+GLAPI void APIENTRY glVertexAttrib4dv (GLuint index, const GLdouble *v);
+GLAPI void APIENTRY glVertexAttrib4f (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+GLAPI void APIENTRY glVertexAttrib4fv (GLuint index, const GLfloat *v);
+GLAPI void APIENTRY glVertexAttrib4iv (GLuint index, const GLint *v);
+GLAPI void APIENTRY glVertexAttrib4s (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);
+GLAPI void APIENTRY glVertexAttrib4sv (GLuint index, const GLshort *v);
+GLAPI void APIENTRY glVertexAttrib4ubv (GLuint index, const GLubyte *v);
+GLAPI void APIENTRY glVertexAttrib4uiv (GLuint index, const GLuint *v);
+GLAPI void APIENTRY glVertexAttrib4usv (GLuint index, const GLushort *v);
+GLAPI void APIENTRY glVertexAttribPointer (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEPROC) (GLenum modeRGB, GLenum modeAlpha);
typedef void (APIENTRYP PFNGLDRAWBUFFERSPROC) (GLsizei n, const GLenum *bufs);
typedef void (APIENTRYP PFNGLSTENCILOPSEPARATEPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
-typedef void (APIENTRYP PFNGLSTENCILFUNCSEPARATEPROC) (GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask);
+typedef void (APIENTRYP PFNGLSTENCILFUNCSEPARATEPROC) (GLenum face, GLenum func, GLint ref, GLuint mask);
typedef void (APIENTRYP PFNGLSTENCILMASKSEPARATEPROC) (GLenum face, GLuint mask);
typedef void (APIENTRYP PFNGLATTACHSHADERPROC) (GLuint program, GLuint shader);
typedef void (APIENTRYP PFNGLBINDATTRIBLOCATIONPROC) (GLuint program, GLuint index, const GLchar *name);
@@ -4491,12 +5950,12 @@ typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size,
#ifndef GL_VERSION_2_1
#define GL_VERSION_2_1 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glUniformMatrix2x3fv (GLint, GLsizei, GLboolean, const GLfloat *);
-GLAPI void APIENTRY glUniformMatrix3x2fv (GLint, GLsizei, GLboolean, const GLfloat *);
-GLAPI void APIENTRY glUniformMatrix2x4fv (GLint, GLsizei, GLboolean, const GLfloat *);
-GLAPI void APIENTRY glUniformMatrix4x2fv (GLint, GLsizei, GLboolean, const GLfloat *);
-GLAPI void APIENTRY glUniformMatrix3x4fv (GLint, GLsizei, GLboolean, const GLfloat *);
-GLAPI void APIENTRY glUniformMatrix4x3fv (GLint, GLsizei, GLboolean, const GLfloat *);
+GLAPI void APIENTRY glUniformMatrix2x3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GLAPI void APIENTRY glUniformMatrix3x2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GLAPI void APIENTRY glUniformMatrix2x4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GLAPI void APIENTRY glUniformMatrix4x2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GLAPI void APIENTRY glUniformMatrix3x4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GLAPI void APIENTRY glUniformMatrix4x3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
@@ -4513,64 +5972,64 @@ typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X3FVPROC) (GLint location, GLsizei co
/* ARB_map_buffer_range */
/* ARB_vertex_array_object */
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glColorMaski (GLuint, GLboolean, GLboolean, GLboolean, GLboolean);
-GLAPI void APIENTRY glGetBooleani_v (GLenum, GLuint, GLboolean *);
-GLAPI void APIENTRY glGetIntegeri_v (GLenum, GLuint, GLint *);
-GLAPI void APIENTRY glEnablei (GLenum, GLuint);
-GLAPI void APIENTRY glDisablei (GLenum, GLuint);
-GLAPI GLboolean APIENTRY glIsEnabledi (GLenum, GLuint);
-GLAPI void APIENTRY glBeginTransformFeedback (GLenum);
+GLAPI void APIENTRY glColorMaski (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);
+GLAPI void APIENTRY glGetBooleani_v (GLenum target, GLuint index, GLboolean *data);
+GLAPI void APIENTRY glGetIntegeri_v (GLenum target, GLuint index, GLint *data);
+GLAPI void APIENTRY glEnablei (GLenum target, GLuint index);
+GLAPI void APIENTRY glDisablei (GLenum target, GLuint index);
+GLAPI GLboolean APIENTRY glIsEnabledi (GLenum target, GLuint index);
+GLAPI void APIENTRY glBeginTransformFeedback (GLenum primitiveMode);
GLAPI void APIENTRY glEndTransformFeedback (void);
-GLAPI void APIENTRY glBindBufferRange (GLenum, GLuint, GLuint, GLintptr, GLsizeiptr);
-GLAPI void APIENTRY glBindBufferBase (GLenum, GLuint, GLuint);
-GLAPI void APIENTRY glTransformFeedbackVaryings (GLuint, GLsizei, const GLchar* *, GLenum);
-GLAPI void APIENTRY glGetTransformFeedbackVarying (GLuint, GLuint, GLsizei, GLsizei *, GLsizei *, GLenum *, GLchar *);
-GLAPI void APIENTRY glClampColor (GLenum, GLenum);
-GLAPI void APIENTRY glBeginConditionalRender (GLuint, GLenum);
+GLAPI void APIENTRY glBindBufferRange (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
+GLAPI void APIENTRY glBindBufferBase (GLenum target, GLuint index, GLuint buffer);
+GLAPI void APIENTRY glTransformFeedbackVaryings (GLuint program, GLsizei count, const GLchar* *varyings, GLenum bufferMode);
+GLAPI void APIENTRY glGetTransformFeedbackVarying (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);
+GLAPI void APIENTRY glClampColor (GLenum target, GLenum clamp);
+GLAPI void APIENTRY glBeginConditionalRender (GLuint id, GLenum mode);
GLAPI void APIENTRY glEndConditionalRender (void);
-GLAPI void APIENTRY glVertexAttribI1i (GLuint, GLint);
-GLAPI void APIENTRY glVertexAttribI2i (GLuint, GLint, GLint);
-GLAPI void APIENTRY glVertexAttribI3i (GLuint, GLint, GLint, GLint);
-GLAPI void APIENTRY glVertexAttribI4i (GLuint, GLint, GLint, GLint, GLint);
-GLAPI void APIENTRY glVertexAttribI1ui (GLuint, GLuint);
-GLAPI void APIENTRY glVertexAttribI2ui (GLuint, GLuint, GLuint);
-GLAPI void APIENTRY glVertexAttribI3ui (GLuint, GLuint, GLuint, GLuint);
-GLAPI void APIENTRY glVertexAttribI4ui (GLuint, GLuint, GLuint, GLuint, GLuint);
-GLAPI void APIENTRY glVertexAttribI1iv (GLuint, const GLint *);
-GLAPI void APIENTRY glVertexAttribI2iv (GLuint, const GLint *);
-GLAPI void APIENTRY glVertexAttribI3iv (GLuint, const GLint *);
-GLAPI void APIENTRY glVertexAttribI4iv (GLuint, const GLint *);
-GLAPI void APIENTRY glVertexAttribI1uiv (GLuint, const GLuint *);
-GLAPI void APIENTRY glVertexAttribI2uiv (GLuint, const GLuint *);
-GLAPI void APIENTRY glVertexAttribI3uiv (GLuint, const GLuint *);
-GLAPI void APIENTRY glVertexAttribI4uiv (GLuint, const GLuint *);
-GLAPI void APIENTRY glVertexAttribI4bv (GLuint, const GLbyte *);
-GLAPI void APIENTRY glVertexAttribI4sv (GLuint, const GLshort *);
-GLAPI void APIENTRY glVertexAttribI4ubv (GLuint, const GLubyte *);
-GLAPI void APIENTRY glVertexAttribI4usv (GLuint, const GLushort *);
-GLAPI void APIENTRY glVertexAttribIPointer (GLuint, GLint, GLenum, GLsizei, const GLvoid *);
-GLAPI void APIENTRY glGetVertexAttribIiv (GLuint, GLenum, GLint *);
-GLAPI void APIENTRY glGetVertexAttribIuiv (GLuint, GLenum, GLuint *);
-GLAPI void APIENTRY glGetUniformuiv (GLuint, GLint, GLuint *);
-GLAPI void APIENTRY glBindFragDataLocation (GLuint, GLuint, const GLchar *);
-GLAPI GLint APIENTRY glGetFragDataLocation (GLuint, const GLchar *);
-GLAPI void APIENTRY glUniform1ui (GLint, GLuint);
-GLAPI void APIENTRY glUniform2ui (GLint, GLuint, GLuint);
-GLAPI void APIENTRY glUniform3ui (GLint, GLuint, GLuint, GLuint);
-GLAPI void APIENTRY glUniform4ui (GLint, GLuint, GLuint, GLuint, GLuint);
-GLAPI void APIENTRY glUniform1uiv (GLint, GLsizei, const GLuint *);
-GLAPI void APIENTRY glUniform2uiv (GLint, GLsizei, const GLuint *);
-GLAPI void APIENTRY glUniform3uiv (GLint, GLsizei, const GLuint *);
-GLAPI void APIENTRY glUniform4uiv (GLint, GLsizei, const GLuint *);
-GLAPI void APIENTRY glTexParameterIiv (GLenum, GLenum, const GLint *);
-GLAPI void APIENTRY glTexParameterIuiv (GLenum, GLenum, const GLuint *);
-GLAPI void APIENTRY glGetTexParameterIiv (GLenum, GLenum, GLint *);
-GLAPI void APIENTRY glGetTexParameterIuiv (GLenum, GLenum, GLuint *);
-GLAPI void APIENTRY glClearBufferiv (GLenum, GLint, const GLint *);
-GLAPI void APIENTRY glClearBufferuiv (GLenum, GLint, const GLuint *);
-GLAPI void APIENTRY glClearBufferfv (GLenum, GLint, const GLfloat *);
-GLAPI void APIENTRY glClearBufferfi (GLenum, GLint, GLfloat, GLint);
-GLAPI const GLubyte * APIENTRY glGetStringi (GLenum, GLuint);
+GLAPI void APIENTRY glVertexAttribIPointer (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
+GLAPI void APIENTRY glGetVertexAttribIiv (GLuint index, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetVertexAttribIuiv (GLuint index, GLenum pname, GLuint *params);
+GLAPI void APIENTRY glVertexAttribI1i (GLuint index, GLint x);
+GLAPI void APIENTRY glVertexAttribI2i (GLuint index, GLint x, GLint y);
+GLAPI void APIENTRY glVertexAttribI3i (GLuint index, GLint x, GLint y, GLint z);
+GLAPI void APIENTRY glVertexAttribI4i (GLuint index, GLint x, GLint y, GLint z, GLint w);
+GLAPI void APIENTRY glVertexAttribI1ui (GLuint index, GLuint x);
+GLAPI void APIENTRY glVertexAttribI2ui (GLuint index, GLuint x, GLuint y);
+GLAPI void APIENTRY glVertexAttribI3ui (GLuint index, GLuint x, GLuint y, GLuint z);
+GLAPI void APIENTRY glVertexAttribI4ui (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
+GLAPI void APIENTRY glVertexAttribI1iv (GLuint index, const GLint *v);
+GLAPI void APIENTRY glVertexAttribI2iv (GLuint index, const GLint *v);
+GLAPI void APIENTRY glVertexAttribI3iv (GLuint index, const GLint *v);
+GLAPI void APIENTRY glVertexAttribI4iv (GLuint index, const GLint *v);
+GLAPI void APIENTRY glVertexAttribI1uiv (GLuint index, const GLuint *v);
+GLAPI void APIENTRY glVertexAttribI2uiv (GLuint index, const GLuint *v);
+GLAPI void APIENTRY glVertexAttribI3uiv (GLuint index, const GLuint *v);
+GLAPI void APIENTRY glVertexAttribI4uiv (GLuint index, const GLuint *v);
+GLAPI void APIENTRY glVertexAttribI4bv (GLuint index, const GLbyte *v);
+GLAPI void APIENTRY glVertexAttribI4sv (GLuint index, const GLshort *v);
+GLAPI void APIENTRY glVertexAttribI4ubv (GLuint index, const GLubyte *v);
+GLAPI void APIENTRY glVertexAttribI4usv (GLuint index, const GLushort *v);
+GLAPI void APIENTRY glGetUniformuiv (GLuint program, GLint location, GLuint *params);
+GLAPI void APIENTRY glBindFragDataLocation (GLuint program, GLuint color, const GLchar *name);
+GLAPI GLint APIENTRY glGetFragDataLocation (GLuint program, const GLchar *name);
+GLAPI void APIENTRY glUniform1ui (GLint location, GLuint v0);
+GLAPI void APIENTRY glUniform2ui (GLint location, GLuint v0, GLuint v1);
+GLAPI void APIENTRY glUniform3ui (GLint location, GLuint v0, GLuint v1, GLuint v2);
+GLAPI void APIENTRY glUniform4ui (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+GLAPI void APIENTRY glUniform1uiv (GLint location, GLsizei count, const GLuint *value);
+GLAPI void APIENTRY glUniform2uiv (GLint location, GLsizei count, const GLuint *value);
+GLAPI void APIENTRY glUniform3uiv (GLint location, GLsizei count, const GLuint *value);
+GLAPI void APIENTRY glUniform4uiv (GLint location, GLsizei count, const GLuint *value);
+GLAPI void APIENTRY glTexParameterIiv (GLenum target, GLenum pname, const GLint *params);
+GLAPI void APIENTRY glTexParameterIuiv (GLenum target, GLenum pname, const GLuint *params);
+GLAPI void APIENTRY glGetTexParameterIiv (GLenum target, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetTexParameterIuiv (GLenum target, GLenum pname, GLuint *params);
+GLAPI void APIENTRY glClearBufferiv (GLenum buffer, GLint drawbuffer, const GLint *value);
+GLAPI void APIENTRY glClearBufferuiv (GLenum buffer, GLint drawbuffer, const GLuint *value);
+GLAPI void APIENTRY glClearBufferfv (GLenum buffer, GLint drawbuffer, const GLfloat *value);
+GLAPI void APIENTRY glClearBufferfi (GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
+GLAPI const GLubyte * APIENTRY glGetStringi (GLenum name, GLuint index);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLCOLORMASKIPROC) (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);
typedef void (APIENTRYP PFNGLGETBOOLEANI_VPROC) (GLenum target, GLuint index, GLboolean *data);
@@ -4587,6 +6046,9 @@ typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGPROC) (GLuint program, G
typedef void (APIENTRYP PFNGLCLAMPCOLORPROC) (GLenum target, GLenum clamp);
typedef void (APIENTRYP PFNGLBEGINCONDITIONALRENDERPROC) (GLuint id, GLenum mode);
typedef void (APIENTRYP PFNGLENDCONDITIONALRENDERPROC) (void);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBIPOINTERPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
+typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIIVPROC) (GLuint index, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIUIVPROC) (GLuint index, GLenum pname, GLuint *params);
typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IPROC) (GLuint index, GLint x);
typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IPROC) (GLuint index, GLint x, GLint y);
typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IPROC) (GLuint index, GLint x, GLint y, GLint z);
@@ -4607,9 +6069,6 @@ typedef void (APIENTRYP PFNGLVERTEXATTRIBI4BVPROC) (GLuint index, const GLbyte *
typedef void (APIENTRYP PFNGLVERTEXATTRIBI4SVPROC) (GLuint index, const GLshort *v);
typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UBVPROC) (GLuint index, const GLubyte *v);
typedef void (APIENTRYP PFNGLVERTEXATTRIBI4USVPROC) (GLuint index, const GLushort *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBIPOINTERPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
-typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIIVPROC) (GLuint index, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIUIVPROC) (GLuint index, GLenum pname, GLuint *params);
typedef void (APIENTRYP PFNGLGETUNIFORMUIVPROC) (GLuint program, GLint location, GLuint *params);
typedef void (APIENTRYP PFNGLBINDFRAGDATALOCATIONPROC) (GLuint program, GLuint color, const GLchar *name);
typedef GLint (APIENTRYP PFNGLGETFRAGDATALOCATIONPROC) (GLuint program, const GLchar *name);
@@ -4632,43 +6091,150 @@ typedef void (APIENTRYP PFNGLCLEARBUFFERFIPROC) (GLenum buffer, GLint drawbuffer
typedef const GLubyte * (APIENTRYP PFNGLGETSTRINGIPROC) (GLenum name, GLuint index);
#endif
+#ifndef GL_VERSION_3_1
+#define GL_VERSION_3_1 1
+/* OpenGL 3.1 also reuses entry points from these extensions: */
+/* ARB_copy_buffer */
+/* ARB_uniform_buffer_object */
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glDrawArraysInstanced (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
+GLAPI void APIENTRY glDrawElementsInstanced (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount);
+GLAPI void APIENTRY glTexBuffer (GLenum target, GLenum internalformat, GLuint buffer);
+GLAPI void APIENTRY glPrimitiveRestartIndex (GLuint index);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
+typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount);
+typedef void (APIENTRYP PFNGLTEXBUFFERPROC) (GLenum target, GLenum internalformat, GLuint buffer);
+typedef void (APIENTRYP PFNGLPRIMITIVERESTARTINDEXPROC) (GLuint index);
+#endif
+
+#ifndef GL_VERSION_3_2
+#define GL_VERSION_3_2 1
+/* OpenGL 3.2 also reuses entry points from these extensions: */
+/* ARB_draw_elements_base_vertex */
+/* ARB_provoking_vertex */
+/* ARB_sync */
+/* ARB_texture_multisample */
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glGetInteger64i_v (GLenum target, GLuint index, GLint64 *data);
+GLAPI void APIENTRY glGetBufferParameteri64v (GLenum target, GLenum pname, GLint64 *params);
+GLAPI void APIENTRY glFramebufferTexture (GLenum target, GLenum attachment, GLuint texture, GLint level);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLGETINTEGER64I_VPROC) (GLenum target, GLuint index, GLint64 *data);
+typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERI64VPROC) (GLenum target, GLenum pname, GLint64 *params);
+typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level);
+#endif
+
+#ifndef GL_VERSION_3_3
+#define GL_VERSION_3_3 1
+/* OpenGL 3.3 also reuses entry points from these extensions: */
+/* ARB_blend_func_extended */
+/* ARB_sampler_objects */
+/* ARB_explicit_attrib_location, but it has none */
+/* ARB_occlusion_query2 (no entry points) */
+/* ARB_shader_bit_encoding (no entry points) */
+/* ARB_texture_rgb10_a2ui (no entry points) */
+/* ARB_texture_swizzle (no entry points) */
+/* ARB_timer_query */
+/* ARB_vertex_type_2_10_10_10_rev */
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glVertexAttribDivisor (GLuint index, GLuint divisor);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLVERTEXATTRIBDIVISORPROC) (GLuint index, GLuint divisor);
+#endif
+
+#ifndef GL_VERSION_4_0
+#define GL_VERSION_4_0 1
+/* OpenGL 4.0 also reuses entry points from these extensions: */
+/* ARB_texture_query_lod (no entry points) */
+/* ARB_draw_indirect */
+/* ARB_gpu_shader5 (no entry points) */
+/* ARB_gpu_shader_fp64 */
+/* ARB_shader_subroutine */
+/* ARB_tessellation_shader */
+/* ARB_texture_buffer_object_rgb32 (no entry points) */
+/* ARB_texture_cube_map_array (no entry points) */
+/* ARB_texture_gather (no entry points) */
+/* ARB_transform_feedback2 */
+/* ARB_transform_feedback3 */
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glMinSampleShading (GLclampf value);
+GLAPI void APIENTRY glBlendEquationi (GLuint buf, GLenum mode);
+GLAPI void APIENTRY glBlendEquationSeparatei (GLuint buf, GLenum modeRGB, GLenum modeAlpha);
+GLAPI void APIENTRY glBlendFunci (GLuint buf, GLenum src, GLenum dst);
+GLAPI void APIENTRY glBlendFuncSeparatei (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLMINSAMPLESHADINGPROC) (GLclampf value);
+typedef void (APIENTRYP PFNGLBLENDEQUATIONIPROC) (GLuint buf, GLenum mode);
+typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEIPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha);
+typedef void (APIENTRYP PFNGLBLENDFUNCIPROC) (GLuint buf, GLenum src, GLenum dst);
+typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEIPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
+#endif
+
+#ifndef GL_VERSION_4_1
+#define GL_VERSION_4_1 1
+/* OpenGL 4.1 reuses entry points from these extensions: */
+/* ARB_ES2_compatibility */
+/* ARB_get_program_binary */
+/* ARB_separate_shader_objects */
+/* ARB_shader_precision (no entry points) */
+/* ARB_vertex_attrib_64bit */
+/* ARB_viewport_array */
+#endif
+
+#ifndef GL_VERSION_4_2
+#define GL_VERSION_4_2 1
+/* OpenGL 4.2 reuses entry points from these extensions: */
+/* ARB_base_instance */
+/* ARB_shading_language_420pack (no entry points) */
+/* ARB_transform_feedback_instanced */
+/* ARB_compressed_texture_pixel_storage (no entry points) */
+/* ARB_conservative_depth (no entry points) */
+/* ARB_internalformat_query */
+/* ARB_map_buffer_alignment (no entry points) */
+/* ARB_shader_atomic_counters */
+/* ARB_shader_image_load_store */
+/* ARB_shading_language_packing (no entry points) */
+/* ARB_texture_storage */
+#endif
+
#ifndef GL_ARB_multitexture
#define GL_ARB_multitexture 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glActiveTextureARB (GLenum);
-GLAPI void APIENTRY glClientActiveTextureARB (GLenum);
-GLAPI void APIENTRY glMultiTexCoord1dARB (GLenum, GLdouble);
-GLAPI void APIENTRY glMultiTexCoord1dvARB (GLenum, const GLdouble *);
-GLAPI void APIENTRY glMultiTexCoord1fARB (GLenum, GLfloat);
-GLAPI void APIENTRY glMultiTexCoord1fvARB (GLenum, const GLfloat *);
-GLAPI void APIENTRY glMultiTexCoord1iARB (GLenum, GLint);
-GLAPI void APIENTRY glMultiTexCoord1ivARB (GLenum, const GLint *);
-GLAPI void APIENTRY glMultiTexCoord1sARB (GLenum, GLshort);
-GLAPI void APIENTRY glMultiTexCoord1svARB (GLenum, const GLshort *);
-GLAPI void APIENTRY glMultiTexCoord2dARB (GLenum, GLdouble, GLdouble);
-GLAPI void APIENTRY glMultiTexCoord2dvARB (GLenum, const GLdouble *);
-GLAPI void APIENTRY glMultiTexCoord2fARB (GLenum, GLfloat, GLfloat);
-GLAPI void APIENTRY glMultiTexCoord2fvARB (GLenum, const GLfloat *);
-GLAPI void APIENTRY glMultiTexCoord2iARB (GLenum, GLint, GLint);
-GLAPI void APIENTRY glMultiTexCoord2ivARB (GLenum, const GLint *);
-GLAPI void APIENTRY glMultiTexCoord2sARB (GLenum, GLshort, GLshort);
-GLAPI void APIENTRY glMultiTexCoord2svARB (GLenum, const GLshort *);
-GLAPI void APIENTRY glMultiTexCoord3dARB (GLenum, GLdouble, GLdouble, GLdouble);
-GLAPI void APIENTRY glMultiTexCoord3dvARB (GLenum, const GLdouble *);
-GLAPI void APIENTRY glMultiTexCoord3fARB (GLenum, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glMultiTexCoord3fvARB (GLenum, const GLfloat *);
-GLAPI void APIENTRY glMultiTexCoord3iARB (GLenum, GLint, GLint, GLint);
-GLAPI void APIENTRY glMultiTexCoord3ivARB (GLenum, const GLint *);
-GLAPI void APIENTRY glMultiTexCoord3sARB (GLenum, GLshort, GLshort, GLshort);
-GLAPI void APIENTRY glMultiTexCoord3svARB (GLenum, const GLshort *);
-GLAPI void APIENTRY glMultiTexCoord4dARB (GLenum, GLdouble, GLdouble, GLdouble, GLdouble);
-GLAPI void APIENTRY glMultiTexCoord4dvARB (GLenum, const GLdouble *);
-GLAPI void APIENTRY glMultiTexCoord4fARB (GLenum, GLfloat, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glMultiTexCoord4fvARB (GLenum, const GLfloat *);
-GLAPI void APIENTRY glMultiTexCoord4iARB (GLenum, GLint, GLint, GLint, GLint);
-GLAPI void APIENTRY glMultiTexCoord4ivARB (GLenum, const GLint *);
-GLAPI void APIENTRY glMultiTexCoord4sARB (GLenum, GLshort, GLshort, GLshort, GLshort);
-GLAPI void APIENTRY glMultiTexCoord4svARB (GLenum, const GLshort *);
+GLAPI void APIENTRY glActiveTextureARB (GLenum texture);
+GLAPI void APIENTRY glClientActiveTextureARB (GLenum texture);
+GLAPI void APIENTRY glMultiTexCoord1dARB (GLenum target, GLdouble s);
+GLAPI void APIENTRY glMultiTexCoord1dvARB (GLenum target, const GLdouble *v);
+GLAPI void APIENTRY glMultiTexCoord1fARB (GLenum target, GLfloat s);
+GLAPI void APIENTRY glMultiTexCoord1fvARB (GLenum target, const GLfloat *v);
+GLAPI void APIENTRY glMultiTexCoord1iARB (GLenum target, GLint s);
+GLAPI void APIENTRY glMultiTexCoord1ivARB (GLenum target, const GLint *v);
+GLAPI void APIENTRY glMultiTexCoord1sARB (GLenum target, GLshort s);
+GLAPI void APIENTRY glMultiTexCoord1svARB (GLenum target, const GLshort *v);
+GLAPI void APIENTRY glMultiTexCoord2dARB (GLenum target, GLdouble s, GLdouble t);
+GLAPI void APIENTRY glMultiTexCoord2dvARB (GLenum target, const GLdouble *v);
+GLAPI void APIENTRY glMultiTexCoord2fARB (GLenum target, GLfloat s, GLfloat t);
+GLAPI void APIENTRY glMultiTexCoord2fvARB (GLenum target, const GLfloat *v);
+GLAPI void APIENTRY glMultiTexCoord2iARB (GLenum target, GLint s, GLint t);
+GLAPI void APIENTRY glMultiTexCoord2ivARB (GLenum target, const GLint *v);
+GLAPI void APIENTRY glMultiTexCoord2sARB (GLenum target, GLshort s, GLshort t);
+GLAPI void APIENTRY glMultiTexCoord2svARB (GLenum target, const GLshort *v);
+GLAPI void APIENTRY glMultiTexCoord3dARB (GLenum target, GLdouble s, GLdouble t, GLdouble r);
+GLAPI void APIENTRY glMultiTexCoord3dvARB (GLenum target, const GLdouble *v);
+GLAPI void APIENTRY glMultiTexCoord3fARB (GLenum target, GLfloat s, GLfloat t, GLfloat r);
+GLAPI void APIENTRY glMultiTexCoord3fvARB (GLenum target, const GLfloat *v);
+GLAPI void APIENTRY glMultiTexCoord3iARB (GLenum target, GLint s, GLint t, GLint r);
+GLAPI void APIENTRY glMultiTexCoord3ivARB (GLenum target, const GLint *v);
+GLAPI void APIENTRY glMultiTexCoord3sARB (GLenum target, GLshort s, GLshort t, GLshort r);
+GLAPI void APIENTRY glMultiTexCoord3svARB (GLenum target, const GLshort *v);
+GLAPI void APIENTRY glMultiTexCoord4dARB (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q);
+GLAPI void APIENTRY glMultiTexCoord4dvARB (GLenum target, const GLdouble *v);
+GLAPI void APIENTRY glMultiTexCoord4fARB (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
+GLAPI void APIENTRY glMultiTexCoord4fvARB (GLenum target, const GLfloat *v);
+GLAPI void APIENTRY glMultiTexCoord4iARB (GLenum target, GLint s, GLint t, GLint r, GLint q);
+GLAPI void APIENTRY glMultiTexCoord4ivARB (GLenum target, const GLint *v);
+GLAPI void APIENTRY glMultiTexCoord4sARB (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);
+GLAPI void APIENTRY glMultiTexCoord4svARB (GLenum target, const GLshort *v);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLACTIVETEXTUREARBPROC) (GLenum texture);
typedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREARBPROC) (GLenum texture);
@@ -4709,10 +6275,10 @@ typedef void (APIENTRYP PFNGLMULTITEXCOORD4SVARBPROC) (GLenum target, const GLsh
#ifndef GL_ARB_transpose_matrix
#define GL_ARB_transpose_matrix 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glLoadTransposeMatrixfARB (const GLfloat *);
-GLAPI void APIENTRY glLoadTransposeMatrixdARB (const GLdouble *);
-GLAPI void APIENTRY glMultTransposeMatrixfARB (const GLfloat *);
-GLAPI void APIENTRY glMultTransposeMatrixdARB (const GLdouble *);
+GLAPI void APIENTRY glLoadTransposeMatrixfARB (const GLfloat *m);
+GLAPI void APIENTRY glLoadTransposeMatrixdARB (const GLdouble *m);
+GLAPI void APIENTRY glMultTransposeMatrixfARB (const GLfloat *m);
+GLAPI void APIENTRY glMultTransposeMatrixdARB (const GLdouble *m);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXFARBPROC) (const GLfloat *m);
typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXDARBPROC) (const GLdouble *m);
@@ -4723,7 +6289,7 @@ typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXDARBPROC) (const GLdouble *m);
#ifndef GL_ARB_multisample
#define GL_ARB_multisample 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glSampleCoverageARB (GLclampf, GLboolean);
+GLAPI void APIENTRY glSampleCoverageARB (GLclampf value, GLboolean invert);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLSAMPLECOVERAGEARBPROC) (GLclampf value, GLboolean invert);
#endif
@@ -4739,13 +6305,13 @@ typedef void (APIENTRYP PFNGLSAMPLECOVERAGEARBPROC) (GLclampf value, GLboolean i
#ifndef GL_ARB_texture_compression
#define GL_ARB_texture_compression 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glCompressedTexImage3DARB (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *);
-GLAPI void APIENTRY glCompressedTexImage2DARB (GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *);
-GLAPI void APIENTRY glCompressedTexImage1DARB (GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const GLvoid *);
-GLAPI void APIENTRY glCompressedTexSubImage3DARB (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *);
-GLAPI void APIENTRY glCompressedTexSubImage2DARB (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *);
-GLAPI void APIENTRY glCompressedTexSubImage1DARB (GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const GLvoid *);
-GLAPI void APIENTRY glGetCompressedTexImageARB (GLenum, GLint, GLvoid *);
+GLAPI void APIENTRY glCompressedTexImage3DARB (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data);
+GLAPI void APIENTRY glCompressedTexImage2DARB (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
+GLAPI void APIENTRY glCompressedTexImage1DARB (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data);
+GLAPI void APIENTRY glCompressedTexSubImage3DARB (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data);
+GLAPI void APIENTRY glCompressedTexSubImage2DARB (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);
+GLAPI void APIENTRY glCompressedTexSubImage1DARB (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data);
+GLAPI void APIENTRY glGetCompressedTexImageARB (GLenum target, GLint level, GLvoid *img);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data);
typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
@@ -4763,8 +6329,8 @@ typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEARBPROC) (GLenum target, GLint
#ifndef GL_ARB_point_parameters
#define GL_ARB_point_parameters 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glPointParameterfARB (GLenum, GLfloat);
-GLAPI void APIENTRY glPointParameterfvARB (GLenum, const GLfloat *);
+GLAPI void APIENTRY glPointParameterfARB (GLenum pname, GLfloat param);
+GLAPI void APIENTRY glPointParameterfvARB (GLenum pname, const GLfloat *params);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLPOINTPARAMETERFARBPROC) (GLenum pname, GLfloat param);
typedef void (APIENTRYP PFNGLPOINTPARAMETERFVARBPROC) (GLenum pname, const GLfloat *params);
@@ -4773,16 +6339,16 @@ typedef void (APIENTRYP PFNGLPOINTPARAMETERFVARBPROC) (GLenum pname, const GLflo
#ifndef GL_ARB_vertex_blend
#define GL_ARB_vertex_blend 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glWeightbvARB (GLint, const GLbyte *);
-GLAPI void APIENTRY glWeightsvARB (GLint, const GLshort *);
-GLAPI void APIENTRY glWeightivARB (GLint, const GLint *);
-GLAPI void APIENTRY glWeightfvARB (GLint, const GLfloat *);
-GLAPI void APIENTRY glWeightdvARB (GLint, const GLdouble *);
-GLAPI void APIENTRY glWeightubvARB (GLint, const GLubyte *);
-GLAPI void APIENTRY glWeightusvARB (GLint, const GLushort *);
-GLAPI void APIENTRY glWeightuivARB (GLint, const GLuint *);
-GLAPI void APIENTRY glWeightPointerARB (GLint, GLenum, GLsizei, const GLvoid *);
-GLAPI void APIENTRY glVertexBlendARB (GLint);
+GLAPI void APIENTRY glWeightbvARB (GLint size, const GLbyte *weights);
+GLAPI void APIENTRY glWeightsvARB (GLint size, const GLshort *weights);
+GLAPI void APIENTRY glWeightivARB (GLint size, const GLint *weights);
+GLAPI void APIENTRY glWeightfvARB (GLint size, const GLfloat *weights);
+GLAPI void APIENTRY glWeightdvARB (GLint size, const GLdouble *weights);
+GLAPI void APIENTRY glWeightubvARB (GLint size, const GLubyte *weights);
+GLAPI void APIENTRY glWeightusvARB (GLint size, const GLushort *weights);
+GLAPI void APIENTRY glWeightuivARB (GLint size, const GLuint *weights);
+GLAPI void APIENTRY glWeightPointerARB (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
+GLAPI void APIENTRY glVertexBlendARB (GLint count);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLWEIGHTBVARBPROC) (GLint size, const GLbyte *weights);
typedef void (APIENTRYP PFNGLWEIGHTSVARBPROC) (GLint size, const GLshort *weights);
@@ -4799,11 +6365,11 @@ typedef void (APIENTRYP PFNGLVERTEXBLENDARBPROC) (GLint count);
#ifndef GL_ARB_matrix_palette
#define GL_ARB_matrix_palette 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glCurrentPaletteMatrixARB (GLint);
-GLAPI void APIENTRY glMatrixIndexubvARB (GLint, const GLubyte *);
-GLAPI void APIENTRY glMatrixIndexusvARB (GLint, const GLushort *);
-GLAPI void APIENTRY glMatrixIndexuivARB (GLint, const GLuint *);
-GLAPI void APIENTRY glMatrixIndexPointerARB (GLint, GLenum, GLsizei, const GLvoid *);
+GLAPI void APIENTRY glCurrentPaletteMatrixARB (GLint index);
+GLAPI void APIENTRY glMatrixIndexubvARB (GLint size, const GLubyte *indices);
+GLAPI void APIENTRY glMatrixIndexusvARB (GLint size, const GLushort *indices);
+GLAPI void APIENTRY glMatrixIndexuivARB (GLint size, const GLuint *indices);
+GLAPI void APIENTRY glMatrixIndexPointerARB (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLCURRENTPALETTEMATRIXARBPROC) (GLint index);
typedef void (APIENTRYP PFNGLMATRIXINDEXUBVARBPROC) (GLint size, const GLubyte *indices);
@@ -4843,22 +6409,22 @@ typedef void (APIENTRYP PFNGLMATRIXINDEXPOINTERARBPROC) (GLint size, GLenum type
#ifndef GL_ARB_window_pos
#define GL_ARB_window_pos 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glWindowPos2dARB (GLdouble, GLdouble);
-GLAPI void APIENTRY glWindowPos2dvARB (const GLdouble *);
-GLAPI void APIENTRY glWindowPos2fARB (GLfloat, GLfloat);
-GLAPI void APIENTRY glWindowPos2fvARB (const GLfloat *);
-GLAPI void APIENTRY glWindowPos2iARB (GLint, GLint);
-GLAPI void APIENTRY glWindowPos2ivARB (const GLint *);
-GLAPI void APIENTRY glWindowPos2sARB (GLshort, GLshort);
-GLAPI void APIENTRY glWindowPos2svARB (const GLshort *);
-GLAPI void APIENTRY glWindowPos3dARB (GLdouble, GLdouble, GLdouble);
-GLAPI void APIENTRY glWindowPos3dvARB (const GLdouble *);
-GLAPI void APIENTRY glWindowPos3fARB (GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glWindowPos3fvARB (const GLfloat *);
-GLAPI void APIENTRY glWindowPos3iARB (GLint, GLint, GLint);
-GLAPI void APIENTRY glWindowPos3ivARB (const GLint *);
-GLAPI void APIENTRY glWindowPos3sARB (GLshort, GLshort, GLshort);
-GLAPI void APIENTRY glWindowPos3svARB (const GLshort *);
+GLAPI void APIENTRY glWindowPos2dARB (GLdouble x, GLdouble y);
+GLAPI void APIENTRY glWindowPos2dvARB (const GLdouble *v);
+GLAPI void APIENTRY glWindowPos2fARB (GLfloat x, GLfloat y);
+GLAPI void APIENTRY glWindowPos2fvARB (const GLfloat *v);
+GLAPI void APIENTRY glWindowPos2iARB (GLint x, GLint y);
+GLAPI void APIENTRY glWindowPos2ivARB (const GLint *v);
+GLAPI void APIENTRY glWindowPos2sARB (GLshort x, GLshort y);
+GLAPI void APIENTRY glWindowPos2svARB (const GLshort *v);
+GLAPI void APIENTRY glWindowPos3dARB (GLdouble x, GLdouble y, GLdouble z);
+GLAPI void APIENTRY glWindowPos3dvARB (const GLdouble *v);
+GLAPI void APIENTRY glWindowPos3fARB (GLfloat x, GLfloat y, GLfloat z);
+GLAPI void APIENTRY glWindowPos3fvARB (const GLfloat *v);
+GLAPI void APIENTRY glWindowPos3iARB (GLint x, GLint y, GLint z);
+GLAPI void APIENTRY glWindowPos3ivARB (const GLint *v);
+GLAPI void APIENTRY glWindowPos3sARB (GLshort x, GLshort y, GLshort z);
+GLAPI void APIENTRY glWindowPos3svARB (const GLshort *v);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLWINDOWPOS2DARBPROC) (GLdouble x, GLdouble y);
typedef void (APIENTRYP PFNGLWINDOWPOS2DVARBPROC) (const GLdouble *v);
@@ -4881,68 +6447,68 @@ typedef void (APIENTRYP PFNGLWINDOWPOS3SVARBPROC) (const GLshort *v);
#ifndef GL_ARB_vertex_program
#define GL_ARB_vertex_program 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glVertexAttrib1dARB (GLuint, GLdouble);
-GLAPI void APIENTRY glVertexAttrib1dvARB (GLuint, const GLdouble *);
-GLAPI void APIENTRY glVertexAttrib1fARB (GLuint, GLfloat);
-GLAPI void APIENTRY glVertexAttrib1fvARB (GLuint, const GLfloat *);
-GLAPI void APIENTRY glVertexAttrib1sARB (GLuint, GLshort);
-GLAPI void APIENTRY glVertexAttrib1svARB (GLuint, const GLshort *);
-GLAPI void APIENTRY glVertexAttrib2dARB (GLuint, GLdouble, GLdouble);
-GLAPI void APIENTRY glVertexAttrib2dvARB (GLuint, const GLdouble *);
-GLAPI void APIENTRY glVertexAttrib2fARB (GLuint, GLfloat, GLfloat);
-GLAPI void APIENTRY glVertexAttrib2fvARB (GLuint, const GLfloat *);
-GLAPI void APIENTRY glVertexAttrib2sARB (GLuint, GLshort, GLshort);
-GLAPI void APIENTRY glVertexAttrib2svARB (GLuint, const GLshort *);
-GLAPI void APIENTRY glVertexAttrib3dARB (GLuint, GLdouble, GLdouble, GLdouble);
-GLAPI void APIENTRY glVertexAttrib3dvARB (GLuint, const GLdouble *);
-GLAPI void APIENTRY glVertexAttrib3fARB (GLuint, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glVertexAttrib3fvARB (GLuint, const GLfloat *);
-GLAPI void APIENTRY glVertexAttrib3sARB (GLuint, GLshort, GLshort, GLshort);
-GLAPI void APIENTRY glVertexAttrib3svARB (GLuint, const GLshort *);
-GLAPI void APIENTRY glVertexAttrib4NbvARB (GLuint, const GLbyte *);
-GLAPI void APIENTRY glVertexAttrib4NivARB (GLuint, const GLint *);
-GLAPI void APIENTRY glVertexAttrib4NsvARB (GLuint, const GLshort *);
-GLAPI void APIENTRY glVertexAttrib4NubARB (GLuint, GLubyte, GLubyte, GLubyte, GLubyte);
-GLAPI void APIENTRY glVertexAttrib4NubvARB (GLuint, const GLubyte *);
-GLAPI void APIENTRY glVertexAttrib4NuivARB (GLuint, const GLuint *);
-GLAPI void APIENTRY glVertexAttrib4NusvARB (GLuint, const GLushort *);
-GLAPI void APIENTRY glVertexAttrib4bvARB (GLuint, const GLbyte *);
-GLAPI void APIENTRY glVertexAttrib4dARB (GLuint, GLdouble, GLdouble, GLdouble, GLdouble);
-GLAPI void APIENTRY glVertexAttrib4dvARB (GLuint, const GLdouble *);
-GLAPI void APIENTRY glVertexAttrib4fARB (GLuint, GLfloat, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glVertexAttrib4fvARB (GLuint, const GLfloat *);
-GLAPI void APIENTRY glVertexAttrib4ivARB (GLuint, const GLint *);
-GLAPI void APIENTRY glVertexAttrib4sARB (GLuint, GLshort, GLshort, GLshort, GLshort);
-GLAPI void APIENTRY glVertexAttrib4svARB (GLuint, const GLshort *);
-GLAPI void APIENTRY glVertexAttrib4ubvARB (GLuint, const GLubyte *);
-GLAPI void APIENTRY glVertexAttrib4uivARB (GLuint, const GLuint *);
-GLAPI void APIENTRY glVertexAttrib4usvARB (GLuint, const GLushort *);
-GLAPI void APIENTRY glVertexAttribPointerARB (GLuint, GLint, GLenum, GLboolean, GLsizei, const GLvoid *);
-GLAPI void APIENTRY glEnableVertexAttribArrayARB (GLuint);
-GLAPI void APIENTRY glDisableVertexAttribArrayARB (GLuint);
-GLAPI void APIENTRY glProgramStringARB (GLenum, GLenum, GLsizei, const GLvoid *);
-GLAPI void APIENTRY glBindProgramARB (GLenum, GLuint);
-GLAPI void APIENTRY glDeleteProgramsARB (GLsizei, const GLuint *);
-GLAPI void APIENTRY glGenProgramsARB (GLsizei, GLuint *);
-GLAPI void APIENTRY glProgramEnvParameter4dARB (GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble);
-GLAPI void APIENTRY glProgramEnvParameter4dvARB (GLenum, GLuint, const GLdouble *);
-GLAPI void APIENTRY glProgramEnvParameter4fARB (GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glProgramEnvParameter4fvARB (GLenum, GLuint, const GLfloat *);
-GLAPI void APIENTRY glProgramLocalParameter4dARB (GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble);
-GLAPI void APIENTRY glProgramLocalParameter4dvARB (GLenum, GLuint, const GLdouble *);
-GLAPI void APIENTRY glProgramLocalParameter4fARB (GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glProgramLocalParameter4fvARB (GLenum, GLuint, const GLfloat *);
-GLAPI void APIENTRY glGetProgramEnvParameterdvARB (GLenum, GLuint, GLdouble *);
-GLAPI void APIENTRY glGetProgramEnvParameterfvARB (GLenum, GLuint, GLfloat *);
-GLAPI void APIENTRY glGetProgramLocalParameterdvARB (GLenum, GLuint, GLdouble *);
-GLAPI void APIENTRY glGetProgramLocalParameterfvARB (GLenum, GLuint, GLfloat *);
-GLAPI void APIENTRY glGetProgramivARB (GLenum, GLenum, GLint *);
-GLAPI void APIENTRY glGetProgramStringARB (GLenum, GLenum, GLvoid *);
-GLAPI void APIENTRY glGetVertexAttribdvARB (GLuint, GLenum, GLdouble *);
-GLAPI void APIENTRY glGetVertexAttribfvARB (GLuint, GLenum, GLfloat *);
-GLAPI void APIENTRY glGetVertexAttribivARB (GLuint, GLenum, GLint *);
-GLAPI void APIENTRY glGetVertexAttribPointervARB (GLuint, GLenum, GLvoid* *);
-GLAPI GLboolean APIENTRY glIsProgramARB (GLuint);
+GLAPI void APIENTRY glVertexAttrib1dARB (GLuint index, GLdouble x);
+GLAPI void APIENTRY glVertexAttrib1dvARB (GLuint index, const GLdouble *v);
+GLAPI void APIENTRY glVertexAttrib1fARB (GLuint index, GLfloat x);
+GLAPI void APIENTRY glVertexAttrib1fvARB (GLuint index, const GLfloat *v);
+GLAPI void APIENTRY glVertexAttrib1sARB (GLuint index, GLshort x);
+GLAPI void APIENTRY glVertexAttrib1svARB (GLuint index, const GLshort *v);
+GLAPI void APIENTRY glVertexAttrib2dARB (GLuint index, GLdouble x, GLdouble y);
+GLAPI void APIENTRY glVertexAttrib2dvARB (GLuint index, const GLdouble *v);
+GLAPI void APIENTRY glVertexAttrib2fARB (GLuint index, GLfloat x, GLfloat y);
+GLAPI void APIENTRY glVertexAttrib2fvARB (GLuint index, const GLfloat *v);
+GLAPI void APIENTRY glVertexAttrib2sARB (GLuint index, GLshort x, GLshort y);
+GLAPI void APIENTRY glVertexAttrib2svARB (GLuint index, const GLshort *v);
+GLAPI void APIENTRY glVertexAttrib3dARB (GLuint index, GLdouble x, GLdouble y, GLdouble z);
+GLAPI void APIENTRY glVertexAttrib3dvARB (GLuint index, const GLdouble *v);
+GLAPI void APIENTRY glVertexAttrib3fARB (GLuint index, GLfloat x, GLfloat y, GLfloat z);
+GLAPI void APIENTRY glVertexAttrib3fvARB (GLuint index, const GLfloat *v);
+GLAPI void APIENTRY glVertexAttrib3sARB (GLuint index, GLshort x, GLshort y, GLshort z);
+GLAPI void APIENTRY glVertexAttrib3svARB (GLuint index, const GLshort *v);
+GLAPI void APIENTRY glVertexAttrib4NbvARB (GLuint index, const GLbyte *v);
+GLAPI void APIENTRY glVertexAttrib4NivARB (GLuint index, const GLint *v);
+GLAPI void APIENTRY glVertexAttrib4NsvARB (GLuint index, const GLshort *v);
+GLAPI void APIENTRY glVertexAttrib4NubARB (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);
+GLAPI void APIENTRY glVertexAttrib4NubvARB (GLuint index, const GLubyte *v);
+GLAPI void APIENTRY glVertexAttrib4NuivARB (GLuint index, const GLuint *v);
+GLAPI void APIENTRY glVertexAttrib4NusvARB (GLuint index, const GLushort *v);
+GLAPI void APIENTRY glVertexAttrib4bvARB (GLuint index, const GLbyte *v);
+GLAPI void APIENTRY glVertexAttrib4dARB (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+GLAPI void APIENTRY glVertexAttrib4dvARB (GLuint index, const GLdouble *v);
+GLAPI void APIENTRY glVertexAttrib4fARB (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+GLAPI void APIENTRY glVertexAttrib4fvARB (GLuint index, const GLfloat *v);
+GLAPI void APIENTRY glVertexAttrib4ivARB (GLuint index, const GLint *v);
+GLAPI void APIENTRY glVertexAttrib4sARB (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);
+GLAPI void APIENTRY glVertexAttrib4svARB (GLuint index, const GLshort *v);
+GLAPI void APIENTRY glVertexAttrib4ubvARB (GLuint index, const GLubyte *v);
+GLAPI void APIENTRY glVertexAttrib4uivARB (GLuint index, const GLuint *v);
+GLAPI void APIENTRY glVertexAttrib4usvARB (GLuint index, const GLushort *v);
+GLAPI void APIENTRY glVertexAttribPointerARB (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer);
+GLAPI void APIENTRY glEnableVertexAttribArrayARB (GLuint index);
+GLAPI void APIENTRY glDisableVertexAttribArrayARB (GLuint index);
+GLAPI void APIENTRY glProgramStringARB (GLenum target, GLenum format, GLsizei len, const GLvoid *string);
+GLAPI void APIENTRY glBindProgramARB (GLenum target, GLuint program);
+GLAPI void APIENTRY glDeleteProgramsARB (GLsizei n, const GLuint *programs);
+GLAPI void APIENTRY glGenProgramsARB (GLsizei n, GLuint *programs);
+GLAPI void APIENTRY glProgramEnvParameter4dARB (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+GLAPI void APIENTRY glProgramEnvParameter4dvARB (GLenum target, GLuint index, const GLdouble *params);
+GLAPI void APIENTRY glProgramEnvParameter4fARB (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+GLAPI void APIENTRY glProgramEnvParameter4fvARB (GLenum target, GLuint index, const GLfloat *params);
+GLAPI void APIENTRY glProgramLocalParameter4dARB (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+GLAPI void APIENTRY glProgramLocalParameter4dvARB (GLenum target, GLuint index, const GLdouble *params);
+GLAPI void APIENTRY glProgramLocalParameter4fARB (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+GLAPI void APIENTRY glProgramLocalParameter4fvARB (GLenum target, GLuint index, const GLfloat *params);
+GLAPI void APIENTRY glGetProgramEnvParameterdvARB (GLenum target, GLuint index, GLdouble *params);
+GLAPI void APIENTRY glGetProgramEnvParameterfvARB (GLenum target, GLuint index, GLfloat *params);
+GLAPI void APIENTRY glGetProgramLocalParameterdvARB (GLenum target, GLuint index, GLdouble *params);
+GLAPI void APIENTRY glGetProgramLocalParameterfvARB (GLenum target, GLuint index, GLfloat *params);
+GLAPI void APIENTRY glGetProgramivARB (GLenum target, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetProgramStringARB (GLenum target, GLenum pname, GLvoid *string);
+GLAPI void APIENTRY glGetVertexAttribdvARB (GLuint index, GLenum pname, GLdouble *params);
+GLAPI void APIENTRY glGetVertexAttribfvARB (GLuint index, GLenum pname, GLfloat *params);
+GLAPI void APIENTRY glGetVertexAttribivARB (GLuint index, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetVertexAttribPointervARB (GLuint index, GLenum pname, GLvoid* *pointer);
+GLAPI GLboolean APIENTRY glIsProgramARB (GLuint program);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLVERTEXATTRIB1DARBPROC) (GLuint index, GLdouble x);
typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVARBPROC) (GLuint index, const GLdouble *v);
@@ -5016,17 +6582,17 @@ typedef GLboolean (APIENTRYP PFNGLISPROGRAMARBPROC) (GLuint program);
#ifndef GL_ARB_vertex_buffer_object
#define GL_ARB_vertex_buffer_object 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glBindBufferARB (GLenum, GLuint);
-GLAPI void APIENTRY glDeleteBuffersARB (GLsizei, const GLuint *);
-GLAPI void APIENTRY glGenBuffersARB (GLsizei, GLuint *);
-GLAPI GLboolean APIENTRY glIsBufferARB (GLuint);
-GLAPI void APIENTRY glBufferDataARB (GLenum, GLsizeiptrARB, const GLvoid *, GLenum);
-GLAPI void APIENTRY glBufferSubDataARB (GLenum, GLintptrARB, GLsizeiptrARB, const GLvoid *);
-GLAPI void APIENTRY glGetBufferSubDataARB (GLenum, GLintptrARB, GLsizeiptrARB, GLvoid *);
-GLAPI GLvoid* APIENTRY glMapBufferARB (GLenum, GLenum);
-GLAPI GLboolean APIENTRY glUnmapBufferARB (GLenum);
-GLAPI void APIENTRY glGetBufferParameterivARB (GLenum, GLenum, GLint *);
-GLAPI void APIENTRY glGetBufferPointervARB (GLenum, GLenum, GLvoid* *);
+GLAPI void APIENTRY glBindBufferARB (GLenum target, GLuint buffer);
+GLAPI void APIENTRY glDeleteBuffersARB (GLsizei n, const GLuint *buffers);
+GLAPI void APIENTRY glGenBuffersARB (GLsizei n, GLuint *buffers);
+GLAPI GLboolean APIENTRY glIsBufferARB (GLuint buffer);
+GLAPI void APIENTRY glBufferDataARB (GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage);
+GLAPI void APIENTRY glBufferSubDataARB (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid *data);
+GLAPI void APIENTRY glGetBufferSubDataARB (GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid *data);
+GLAPI GLvoid* APIENTRY glMapBufferARB (GLenum target, GLenum access);
+GLAPI GLboolean APIENTRY glUnmapBufferARB (GLenum target);
+GLAPI void APIENTRY glGetBufferParameterivARB (GLenum target, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetBufferPointervARB (GLenum target, GLenum pname, GLvoid* *params);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLBINDBUFFERARBPROC) (GLenum target, GLuint buffer);
typedef void (APIENTRYP PFNGLDELETEBUFFERSARBPROC) (GLsizei n, const GLuint *buffers);
@@ -5044,14 +6610,14 @@ typedef void (APIENTRYP PFNGLGETBUFFERPOINTERVARBPROC) (GLenum target, GLenum pn
#ifndef GL_ARB_occlusion_query
#define GL_ARB_occlusion_query 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glGenQueriesARB (GLsizei, GLuint *);
-GLAPI void APIENTRY glDeleteQueriesARB (GLsizei, const GLuint *);
-GLAPI GLboolean APIENTRY glIsQueryARB (GLuint);
-GLAPI void APIENTRY glBeginQueryARB (GLenum, GLuint);
-GLAPI void APIENTRY glEndQueryARB (GLenum);
-GLAPI void APIENTRY glGetQueryivARB (GLenum, GLenum, GLint *);
-GLAPI void APIENTRY glGetQueryObjectivARB (GLuint, GLenum, GLint *);
-GLAPI void APIENTRY glGetQueryObjectuivARB (GLuint, GLenum, GLuint *);
+GLAPI void APIENTRY glGenQueriesARB (GLsizei n, GLuint *ids);
+GLAPI void APIENTRY glDeleteQueriesARB (GLsizei n, const GLuint *ids);
+GLAPI GLboolean APIENTRY glIsQueryARB (GLuint id);
+GLAPI void APIENTRY glBeginQueryARB (GLenum target, GLuint id);
+GLAPI void APIENTRY glEndQueryARB (GLenum target);
+GLAPI void APIENTRY glGetQueryivARB (GLenum target, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetQueryObjectivARB (GLuint id, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetQueryObjectuivARB (GLuint id, GLenum pname, GLuint *params);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLGENQUERIESARBPROC) (GLsizei n, GLuint *ids);
typedef void (APIENTRYP PFNGLDELETEQUERIESARBPROC) (GLsizei n, const GLuint *ids);
@@ -5066,45 +6632,45 @@ typedef void (APIENTRYP PFNGLGETQUERYOBJECTUIVARBPROC) (GLuint id, GLenum pname,
#ifndef GL_ARB_shader_objects
#define GL_ARB_shader_objects 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glDeleteObjectARB (GLhandleARB);
-GLAPI GLhandleARB APIENTRY glGetHandleARB (GLenum);
-GLAPI void APIENTRY glDetachObjectARB (GLhandleARB, GLhandleARB);
-GLAPI GLhandleARB APIENTRY glCreateShaderObjectARB (GLenum);
-GLAPI void APIENTRY glShaderSourceARB (GLhandleARB, GLsizei, const GLcharARB* *, const GLint *);
-GLAPI void APIENTRY glCompileShaderARB (GLhandleARB);
+GLAPI void APIENTRY glDeleteObjectARB (GLhandleARB obj);
+GLAPI GLhandleARB APIENTRY glGetHandleARB (GLenum pname);
+GLAPI void APIENTRY glDetachObjectARB (GLhandleARB containerObj, GLhandleARB attachedObj);
+GLAPI GLhandleARB APIENTRY glCreateShaderObjectARB (GLenum shaderType);
+GLAPI void APIENTRY glShaderSourceARB (GLhandleARB shaderObj, GLsizei count, const GLcharARB* *string, const GLint *length);
+GLAPI void APIENTRY glCompileShaderARB (GLhandleARB shaderObj);
GLAPI GLhandleARB APIENTRY glCreateProgramObjectARB (void);
-GLAPI void APIENTRY glAttachObjectARB (GLhandleARB, GLhandleARB);
-GLAPI void APIENTRY glLinkProgramARB (GLhandleARB);
-GLAPI void APIENTRY glUseProgramObjectARB (GLhandleARB);
-GLAPI void APIENTRY glValidateProgramARB (GLhandleARB);
-GLAPI void APIENTRY glUniform1fARB (GLint, GLfloat);
-GLAPI void APIENTRY glUniform2fARB (GLint, GLfloat, GLfloat);
-GLAPI void APIENTRY glUniform3fARB (GLint, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glUniform4fARB (GLint, GLfloat, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glUniform1iARB (GLint, GLint);
-GLAPI void APIENTRY glUniform2iARB (GLint, GLint, GLint);
-GLAPI void APIENTRY glUniform3iARB (GLint, GLint, GLint, GLint);
-GLAPI void APIENTRY glUniform4iARB (GLint, GLint, GLint, GLint, GLint);
-GLAPI void APIENTRY glUniform1fvARB (GLint, GLsizei, const GLfloat *);
-GLAPI void APIENTRY glUniform2fvARB (GLint, GLsizei, const GLfloat *);
-GLAPI void APIENTRY glUniform3fvARB (GLint, GLsizei, const GLfloat *);
-GLAPI void APIENTRY glUniform4fvARB (GLint, GLsizei, const GLfloat *);
-GLAPI void APIENTRY glUniform1ivARB (GLint, GLsizei, const GLint *);
-GLAPI void APIENTRY glUniform2ivARB (GLint, GLsizei, const GLint *);
-GLAPI void APIENTRY glUniform3ivARB (GLint, GLsizei, const GLint *);
-GLAPI void APIENTRY glUniform4ivARB (GLint, GLsizei, const GLint *);
-GLAPI void APIENTRY glUniformMatrix2fvARB (GLint, GLsizei, GLboolean, const GLfloat *);
-GLAPI void APIENTRY glUniformMatrix3fvARB (GLint, GLsizei, GLboolean, const GLfloat *);
-GLAPI void APIENTRY glUniformMatrix4fvARB (GLint, GLsizei, GLboolean, const GLfloat *);
-GLAPI void APIENTRY glGetObjectParameterfvARB (GLhandleARB, GLenum, GLfloat *);
-GLAPI void APIENTRY glGetObjectParameterivARB (GLhandleARB, GLenum, GLint *);
-GLAPI void APIENTRY glGetInfoLogARB (GLhandleARB, GLsizei, GLsizei *, GLcharARB *);
-GLAPI void APIENTRY glGetAttachedObjectsARB (GLhandleARB, GLsizei, GLsizei *, GLhandleARB *);
-GLAPI GLint APIENTRY glGetUniformLocationARB (GLhandleARB, const GLcharARB *);
-GLAPI void APIENTRY glGetActiveUniformARB (GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *);
-GLAPI void APIENTRY glGetUniformfvARB (GLhandleARB, GLint, GLfloat *);
-GLAPI void APIENTRY glGetUniformivARB (GLhandleARB, GLint, GLint *);
-GLAPI void APIENTRY glGetShaderSourceARB (GLhandleARB, GLsizei, GLsizei *, GLcharARB *);
+GLAPI void APIENTRY glAttachObjectARB (GLhandleARB containerObj, GLhandleARB obj);
+GLAPI void APIENTRY glLinkProgramARB (GLhandleARB programObj);
+GLAPI void APIENTRY glUseProgramObjectARB (GLhandleARB programObj);
+GLAPI void APIENTRY glValidateProgramARB (GLhandleARB programObj);
+GLAPI void APIENTRY glUniform1fARB (GLint location, GLfloat v0);
+GLAPI void APIENTRY glUniform2fARB (GLint location, GLfloat v0, GLfloat v1);
+GLAPI void APIENTRY glUniform3fARB (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
+GLAPI void APIENTRY glUniform4fARB (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
+GLAPI void APIENTRY glUniform1iARB (GLint location, GLint v0);
+GLAPI void APIENTRY glUniform2iARB (GLint location, GLint v0, GLint v1);
+GLAPI void APIENTRY glUniform3iARB (GLint location, GLint v0, GLint v1, GLint v2);
+GLAPI void APIENTRY glUniform4iARB (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
+GLAPI void APIENTRY glUniform1fvARB (GLint location, GLsizei count, const GLfloat *value);
+GLAPI void APIENTRY glUniform2fvARB (GLint location, GLsizei count, const GLfloat *value);
+GLAPI void APIENTRY glUniform3fvARB (GLint location, GLsizei count, const GLfloat *value);
+GLAPI void APIENTRY glUniform4fvARB (GLint location, GLsizei count, const GLfloat *value);
+GLAPI void APIENTRY glUniform1ivARB (GLint location, GLsizei count, const GLint *value);
+GLAPI void APIENTRY glUniform2ivARB (GLint location, GLsizei count, const GLint *value);
+GLAPI void APIENTRY glUniform3ivARB (GLint location, GLsizei count, const GLint *value);
+GLAPI void APIENTRY glUniform4ivARB (GLint location, GLsizei count, const GLint *value);
+GLAPI void APIENTRY glUniformMatrix2fvARB (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GLAPI void APIENTRY glUniformMatrix3fvARB (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GLAPI void APIENTRY glUniformMatrix4fvARB (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GLAPI void APIENTRY glGetObjectParameterfvARB (GLhandleARB obj, GLenum pname, GLfloat *params);
+GLAPI void APIENTRY glGetObjectParameterivARB (GLhandleARB obj, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetInfoLogARB (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *infoLog);
+GLAPI void APIENTRY glGetAttachedObjectsARB (GLhandleARB containerObj, GLsizei maxCount, GLsizei *count, GLhandleARB *obj);
+GLAPI GLint APIENTRY glGetUniformLocationARB (GLhandleARB programObj, const GLcharARB *name);
+GLAPI void APIENTRY glGetActiveUniformARB (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name);
+GLAPI void APIENTRY glGetUniformfvARB (GLhandleARB programObj, GLint location, GLfloat *params);
+GLAPI void APIENTRY glGetUniformivARB (GLhandleARB programObj, GLint location, GLint *params);
+GLAPI void APIENTRY glGetShaderSourceARB (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *source);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLDELETEOBJECTARBPROC) (GLhandleARB obj);
typedef GLhandleARB (APIENTRYP PFNGLGETHANDLEARBPROC) (GLenum pname);
@@ -5150,9 +6716,9 @@ typedef void (APIENTRYP PFNGLGETSHADERSOURCEARBPROC) (GLhandleARB obj, GLsizei m
#ifndef GL_ARB_vertex_shader
#define GL_ARB_vertex_shader 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glBindAttribLocationARB (GLhandleARB, GLuint, const GLcharARB *);
-GLAPI void APIENTRY glGetActiveAttribARB (GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *);
-GLAPI GLint APIENTRY glGetAttribLocationARB (GLhandleARB, const GLcharARB *);
+GLAPI void APIENTRY glBindAttribLocationARB (GLhandleARB programObj, GLuint index, const GLcharARB *name);
+GLAPI void APIENTRY glGetActiveAttribARB (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name);
+GLAPI GLint APIENTRY glGetAttribLocationARB (GLhandleARB programObj, const GLcharARB *name);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLBINDATTRIBLOCATIONARBPROC) (GLhandleARB programObj, GLuint index, const GLcharARB *name);
typedef void (APIENTRYP PFNGLGETACTIVEATTRIBARBPROC) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name);
@@ -5182,7 +6748,7 @@ typedef GLint (APIENTRYP PFNGLGETATTRIBLOCATIONARBPROC) (GLhandleARB programObj,
#ifndef GL_ARB_draw_buffers
#define GL_ARB_draw_buffers 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glDrawBuffersARB (GLsizei, const GLenum *);
+GLAPI void APIENTRY glDrawBuffersARB (GLsizei n, const GLenum *bufs);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLDRAWBUFFERSARBPROC) (GLsizei n, const GLenum *bufs);
#endif
@@ -5194,7 +6760,7 @@ typedef void (APIENTRYP PFNGLDRAWBUFFERSARBPROC) (GLsizei n, const GLenum *bufs)
#ifndef GL_ARB_color_buffer_float
#define GL_ARB_color_buffer_float 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glClampColorARB (GLenum, GLenum);
+GLAPI void APIENTRY glClampColorARB (GLenum target, GLenum clamp);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLCLAMPCOLORARBPROC) (GLenum target, GLenum clamp);
#endif
@@ -5218,8 +6784,8 @@ typedef void (APIENTRYP PFNGLCLAMPCOLORARBPROC) (GLenum target, GLenum clamp);
#ifndef GL_ARB_draw_instanced
#define GL_ARB_draw_instanced 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glDrawArraysInstancedARB (GLenum, GLint, GLsizei, GLsizei);
-GLAPI void APIENTRY glDrawElementsInstancedARB (GLenum, GLsizei, GLenum, const GLvoid *, GLsizei);
+GLAPI void APIENTRY glDrawArraysInstancedARB (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
+GLAPI void APIENTRY glDrawElementsInstancedARB (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDARBPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDARBPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount);
@@ -5228,26 +6794,26 @@ typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDARBPROC) (GLenum mode, GLsizei
#ifndef GL_ARB_framebuffer_object
#define GL_ARB_framebuffer_object 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI GLboolean APIENTRY glIsRenderbuffer (GLuint);
-GLAPI void APIENTRY glBindRenderbuffer (GLenum, GLuint);
-GLAPI void APIENTRY glDeleteRenderbuffers (GLsizei, const GLuint *);
-GLAPI void APIENTRY glGenRenderbuffers (GLsizei, GLuint *);
-GLAPI void APIENTRY glRenderbufferStorage (GLenum, GLenum, GLsizei, GLsizei);
-GLAPI void APIENTRY glGetRenderbufferParameteriv (GLenum, GLenum, GLint *);
-GLAPI GLboolean APIENTRY glIsFramebuffer (GLuint);
-GLAPI void APIENTRY glBindFramebuffer (GLenum, GLuint);
-GLAPI void APIENTRY glDeleteFramebuffers (GLsizei, const GLuint *);
-GLAPI void APIENTRY glGenFramebuffers (GLsizei, GLuint *);
-GLAPI GLenum APIENTRY glCheckFramebufferStatus (GLenum);
-GLAPI void APIENTRY glFramebufferTexture1D (GLenum, GLenum, GLenum, GLuint, GLint);
-GLAPI void APIENTRY glFramebufferTexture2D (GLenum, GLenum, GLenum, GLuint, GLint);
-GLAPI void APIENTRY glFramebufferTexture3D (GLenum, GLenum, GLenum, GLuint, GLint, GLint);
-GLAPI void APIENTRY glFramebufferRenderbuffer (GLenum, GLenum, GLenum, GLuint);
-GLAPI void APIENTRY glGetFramebufferAttachmentParameteriv (GLenum, GLenum, GLenum, GLint *);
-GLAPI void APIENTRY glGenerateMipmap (GLenum);
-GLAPI void APIENTRY glBlitFramebuffer (GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLbitfield, GLenum);
-GLAPI void APIENTRY glRenderbufferStorageMultisample (GLenum, GLsizei, GLenum, GLsizei, GLsizei);
-GLAPI void APIENTRY glFramebufferTextureLayer (GLenum, GLenum, GLuint, GLint, GLint);
+GLAPI GLboolean APIENTRY glIsRenderbuffer (GLuint renderbuffer);
+GLAPI void APIENTRY glBindRenderbuffer (GLenum target, GLuint renderbuffer);
+GLAPI void APIENTRY glDeleteRenderbuffers (GLsizei n, const GLuint *renderbuffers);
+GLAPI void APIENTRY glGenRenderbuffers (GLsizei n, GLuint *renderbuffers);
+GLAPI void APIENTRY glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
+GLAPI void APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint *params);
+GLAPI GLboolean APIENTRY glIsFramebuffer (GLuint framebuffer);
+GLAPI void APIENTRY glBindFramebuffer (GLenum target, GLuint framebuffer);
+GLAPI void APIENTRY glDeleteFramebuffers (GLsizei n, const GLuint *framebuffers);
+GLAPI void APIENTRY glGenFramebuffers (GLsizei n, GLuint *framebuffers);
+GLAPI GLenum APIENTRY glCheckFramebufferStatus (GLenum target);
+GLAPI void APIENTRY glFramebufferTexture1D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
+GLAPI void APIENTRY glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
+GLAPI void APIENTRY glFramebufferTexture3D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
+GLAPI void APIENTRY glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
+GLAPI void APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGenerateMipmap (GLenum target);
+GLAPI void APIENTRY glBlitFramebuffer (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+GLAPI void APIENTRY glRenderbufferStorageMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+GLAPI void APIENTRY glFramebufferTextureLayer (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
#endif /* GL_GLEXT_PROTOTYPES */
typedef GLboolean (APIENTRYP PFNGLISRENDERBUFFERPROC) (GLuint renderbuffer);
typedef void (APIENTRYP PFNGLBINDRENDERBUFFERPROC) (GLenum target, GLuint renderbuffer);
@@ -5278,10 +6844,10 @@ typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYERPROC) (GLenum target, GLenum
#ifndef GL_ARB_geometry_shader4
#define GL_ARB_geometry_shader4 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glProgramParameteriARB (GLuint, GLenum, GLint);
-GLAPI void APIENTRY glFramebufferTextureARB (GLenum, GLenum, GLuint, GLint);
-GLAPI void APIENTRY glFramebufferTextureLayerARB (GLenum, GLenum, GLuint, GLint, GLint);
-GLAPI void APIENTRY glFramebufferTextureFaceARB (GLenum, GLenum, GLuint, GLint, GLenum);
+GLAPI void APIENTRY glProgramParameteriARB (GLuint program, GLenum pname, GLint value);
+GLAPI void APIENTRY glFramebufferTextureARB (GLenum target, GLenum attachment, GLuint texture, GLint level);
+GLAPI void APIENTRY glFramebufferTextureLayerARB (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
+GLAPI void APIENTRY glFramebufferTextureFaceARB (GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLPROGRAMPARAMETERIARBPROC) (GLuint program, GLenum pname, GLint value);
typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREARBPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level);
@@ -5296,16 +6862,16 @@ typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREFACEARBPROC) (GLenum target, GLen
#ifndef GL_ARB_instanced_arrays
#define GL_ARB_instanced_arrays 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glVertexAttribDivisor (GLuint, GLuint);
+GLAPI void APIENTRY glVertexAttribDivisorARB (GLuint index, GLuint divisor);
#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLVERTEXATTRIBDIVISORPROC) (GLuint index, GLuint divisor);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBDIVISORARBPROC) (GLuint index, GLuint divisor);
#endif
#ifndef GL_ARB_map_buffer_range
#define GL_ARB_map_buffer_range 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI GLvoid* APIENTRY glMapBufferRange (GLenum, GLintptr, GLsizeiptr, GLbitfield);
-GLAPI void APIENTRY glFlushMappedBufferRange (GLenum, GLintptr, GLsizeiptr);
+GLAPI GLvoid* APIENTRY glMapBufferRange (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
+GLAPI void APIENTRY glFlushMappedBufferRange (GLenum target, GLintptr offset, GLsizeiptr length);
#endif /* GL_GLEXT_PROTOTYPES */
typedef GLvoid* (APIENTRYP PFNGLMAPBUFFERRANGEPROC) (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
typedef void (APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEPROC) (GLenum target, GLintptr offset, GLsizeiptr length);
@@ -5314,7 +6880,7 @@ typedef void (APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEPROC) (GLenum target, GLintpt
#ifndef GL_ARB_texture_buffer_object
#define GL_ARB_texture_buffer_object 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glTexBufferARB (GLenum, GLenum, GLuint);
+GLAPI void APIENTRY glTexBufferARB (GLenum target, GLenum internalformat, GLuint buffer);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLTEXBUFFERARBPROC) (GLenum target, GLenum internalformat, GLuint buffer);
#endif
@@ -5330,10 +6896,10 @@ typedef void (APIENTRYP PFNGLTEXBUFFERARBPROC) (GLenum target, GLenum internalfo
#ifndef GL_ARB_vertex_array_object
#define GL_ARB_vertex_array_object 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glBindVertexArray (GLuint);
-GLAPI void APIENTRY glDeleteVertexArrays (GLsizei, const GLuint *);
-GLAPI void APIENTRY glGenVertexArrays (GLsizei, GLuint *);
-GLAPI GLboolean APIENTRY glIsVertexArray (GLuint);
+GLAPI void APIENTRY glBindVertexArray (GLuint array);
+GLAPI void APIENTRY glDeleteVertexArrays (GLsizei n, const GLuint *arrays);
+GLAPI void APIENTRY glGenVertexArrays (GLsizei n, GLuint *arrays);
+GLAPI GLboolean APIENTRY glIsVertexArray (GLuint array);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLBINDVERTEXARRAYPROC) (GLuint array);
typedef void (APIENTRYP PFNGLDELETEVERTEXARRAYSPROC) (GLsizei n, const GLuint *arrays);
@@ -5341,6 +6907,818 @@ typedef void (APIENTRYP PFNGLGENVERTEXARRAYSPROC) (GLsizei n, GLuint *arrays);
typedef GLboolean (APIENTRYP PFNGLISVERTEXARRAYPROC) (GLuint array);
#endif
+#ifndef GL_ARB_uniform_buffer_object
+#define GL_ARB_uniform_buffer_object 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glGetUniformIndices (GLuint program, GLsizei uniformCount, const GLchar* *uniformNames, GLuint *uniformIndices);
+GLAPI void APIENTRY glGetActiveUniformsiv (GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetActiveUniformName (GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName);
+GLAPI GLuint APIENTRY glGetUniformBlockIndex (GLuint program, const GLchar *uniformBlockName);
+GLAPI void APIENTRY glGetActiveUniformBlockiv (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetActiveUniformBlockName (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName);
+GLAPI void APIENTRY glUniformBlockBinding (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLGETUNIFORMINDICESPROC) (GLuint program, GLsizei uniformCount, const GLchar* *uniformNames, GLuint *uniformIndices);
+typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMSIVPROC) (GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMNAMEPROC) (GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName);
+typedef GLuint (APIENTRYP PFNGLGETUNIFORMBLOCKINDEXPROC) (GLuint program, const GLchar *uniformBlockName);
+typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKIVPROC) (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC) (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName);
+typedef void (APIENTRYP PFNGLUNIFORMBLOCKBINDINGPROC) (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
+#endif
+
+#ifndef GL_ARB_compatibility
+#define GL_ARB_compatibility 1
+#endif
+
+#ifndef GL_ARB_copy_buffer
+#define GL_ARB_copy_buffer 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glCopyBufferSubData (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLCOPYBUFFERSUBDATAPROC) (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
+#endif
+
+#ifndef GL_ARB_shader_texture_lod
+#define GL_ARB_shader_texture_lod 1
+#endif
+
+#ifndef GL_ARB_depth_clamp
+#define GL_ARB_depth_clamp 1
+#endif
+
+#ifndef GL_ARB_draw_elements_base_vertex
+#define GL_ARB_draw_elements_base_vertex 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glDrawElementsBaseVertex (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex);
+GLAPI void APIENTRY glDrawRangeElementsBaseVertex (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex);
+GLAPI void APIENTRY glDrawElementsInstancedBaseVertex (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount, GLint basevertex);
+GLAPI void APIENTRY glMultiDrawElementsBaseVertex (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount, const GLint *basevertex);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLDRAWELEMENTSBASEVERTEXPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex);
+typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex);
+typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount, GLint basevertex);
+typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount, const GLint *basevertex);
+#endif
+
+#ifndef GL_ARB_fragment_coord_conventions
+#define GL_ARB_fragment_coord_conventions 1
+#endif
+
+#ifndef GL_ARB_provoking_vertex
+#define GL_ARB_provoking_vertex 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glProvokingVertex (GLenum mode);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLPROVOKINGVERTEXPROC) (GLenum mode);
+#endif
+
+#ifndef GL_ARB_seamless_cube_map
+#define GL_ARB_seamless_cube_map 1
+#endif
+
+#ifndef GL_ARB_sync
+#define GL_ARB_sync 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI GLsync APIENTRY glFenceSync (GLenum condition, GLbitfield flags);
+GLAPI GLboolean APIENTRY glIsSync (GLsync sync);
+GLAPI void APIENTRY glDeleteSync (GLsync sync);
+GLAPI GLenum APIENTRY glClientWaitSync (GLsync sync, GLbitfield flags, GLuint64 timeout);
+GLAPI void APIENTRY glWaitSync (GLsync sync, GLbitfield flags, GLuint64 timeout);
+GLAPI void APIENTRY glGetInteger64v (GLenum pname, GLint64 *params);
+GLAPI void APIENTRY glGetSynciv (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef GLsync (APIENTRYP PFNGLFENCESYNCPROC) (GLenum condition, GLbitfield flags);
+typedef GLboolean (APIENTRYP PFNGLISSYNCPROC) (GLsync sync);
+typedef void (APIENTRYP PFNGLDELETESYNCPROC) (GLsync sync);
+typedef GLenum (APIENTRYP PFNGLCLIENTWAITSYNCPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout);
+typedef void (APIENTRYP PFNGLWAITSYNCPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout);
+typedef void (APIENTRYP PFNGLGETINTEGER64VPROC) (GLenum pname, GLint64 *params);
+typedef void (APIENTRYP PFNGLGETSYNCIVPROC) (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
+#endif
+
+#ifndef GL_ARB_texture_multisample
+#define GL_ARB_texture_multisample 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glTexImage2DMultisample (GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
+GLAPI void APIENTRY glTexImage3DMultisample (GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
+GLAPI void APIENTRY glGetMultisamplefv (GLenum pname, GLuint index, GLfloat *val);
+GLAPI void APIENTRY glSampleMaski (GLuint index, GLbitfield mask);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLTEXIMAGE2DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
+typedef void (APIENTRYP PFNGLTEXIMAGE3DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
+typedef void (APIENTRYP PFNGLGETMULTISAMPLEFVPROC) (GLenum pname, GLuint index, GLfloat *val);
+typedef void (APIENTRYP PFNGLSAMPLEMASKIPROC) (GLuint index, GLbitfield mask);
+#endif
+
+#ifndef GL_ARB_vertex_array_bgra
+#define GL_ARB_vertex_array_bgra 1
+#endif
+
+#ifndef GL_ARB_draw_buffers_blend
+#define GL_ARB_draw_buffers_blend 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glBlendEquationiARB (GLuint buf, GLenum mode);
+GLAPI void APIENTRY glBlendEquationSeparateiARB (GLuint buf, GLenum modeRGB, GLenum modeAlpha);
+GLAPI void APIENTRY glBlendFunciARB (GLuint buf, GLenum src, GLenum dst);
+GLAPI void APIENTRY glBlendFuncSeparateiARB (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLBLENDEQUATIONIARBPROC) (GLuint buf, GLenum mode);
+typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEIARBPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha);
+typedef void (APIENTRYP PFNGLBLENDFUNCIARBPROC) (GLuint buf, GLenum src, GLenum dst);
+typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEIARBPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
+#endif
+
+#ifndef GL_ARB_sample_shading
+#define GL_ARB_sample_shading 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glMinSampleShadingARB (GLclampf value);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLMINSAMPLESHADINGARBPROC) (GLclampf value);
+#endif
+
+#ifndef GL_ARB_texture_cube_map_array
+#define GL_ARB_texture_cube_map_array 1
+#endif
+
+#ifndef GL_ARB_texture_gather
+#define GL_ARB_texture_gather 1
+#endif
+
+#ifndef GL_ARB_texture_query_lod
+#define GL_ARB_texture_query_lod 1
+#endif
+
+#ifndef GL_ARB_shading_language_include
+#define GL_ARB_shading_language_include 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glNamedStringARB (GLenum type, GLint namelen, const GLchar *name, GLint stringlen, const GLchar *string);
+GLAPI void APIENTRY glDeleteNamedStringARB (GLint namelen, const GLchar *name);
+GLAPI void APIENTRY glCompileShaderIncludeARB (GLuint shader, GLsizei count, const GLchar* *path, const GLint *length);
+GLAPI GLboolean APIENTRY glIsNamedStringARB (GLint namelen, const GLchar *name);
+GLAPI void APIENTRY glGetNamedStringARB (GLint namelen, const GLchar *name, GLsizei bufSize, GLint *stringlen, GLchar *string);
+GLAPI void APIENTRY glGetNamedStringivARB (GLint namelen, const GLchar *name, GLenum pname, GLint *params);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLNAMEDSTRINGARBPROC) (GLenum type, GLint namelen, const GLchar *name, GLint stringlen, const GLchar *string);
+typedef void (APIENTRYP PFNGLDELETENAMEDSTRINGARBPROC) (GLint namelen, const GLchar *name);
+typedef void (APIENTRYP PFNGLCOMPILESHADERINCLUDEARBPROC) (GLuint shader, GLsizei count, const GLchar* *path, const GLint *length);
+typedef GLboolean (APIENTRYP PFNGLISNAMEDSTRINGARBPROC) (GLint namelen, const GLchar *name);
+typedef void (APIENTRYP PFNGLGETNAMEDSTRINGARBPROC) (GLint namelen, const GLchar *name, GLsizei bufSize, GLint *stringlen, GLchar *string);
+typedef void (APIENTRYP PFNGLGETNAMEDSTRINGIVARBPROC) (GLint namelen, const GLchar *name, GLenum pname, GLint *params);
+#endif
+
+#ifndef GL_ARB_texture_compression_bptc
+#define GL_ARB_texture_compression_bptc 1
+#endif
+
+#ifndef GL_ARB_blend_func_extended
+#define GL_ARB_blend_func_extended 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glBindFragDataLocationIndexed (GLuint program, GLuint colorNumber, GLuint index, const GLchar *name);
+GLAPI GLint APIENTRY glGetFragDataIndex (GLuint program, const GLchar *name);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLBINDFRAGDATALOCATIONINDEXEDPROC) (GLuint program, GLuint colorNumber, GLuint index, const GLchar *name);
+typedef GLint (APIENTRYP PFNGLGETFRAGDATAINDEXPROC) (GLuint program, const GLchar *name);
+#endif
+
+#ifndef GL_ARB_explicit_attrib_location
+#define GL_ARB_explicit_attrib_location 1
+#endif
+
+#ifndef GL_ARB_occlusion_query2
+#define GL_ARB_occlusion_query2 1
+#endif
+
+#ifndef GL_ARB_sampler_objects
+#define GL_ARB_sampler_objects 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glGenSamplers (GLsizei count, GLuint *samplers);
+GLAPI void APIENTRY glDeleteSamplers (GLsizei count, const GLuint *samplers);
+GLAPI GLboolean APIENTRY glIsSampler (GLuint sampler);
+GLAPI void APIENTRY glBindSampler (GLuint unit, GLuint sampler);
+GLAPI void APIENTRY glSamplerParameteri (GLuint sampler, GLenum pname, GLint param);
+GLAPI void APIENTRY glSamplerParameteriv (GLuint sampler, GLenum pname, const GLint *param);
+GLAPI void APIENTRY glSamplerParameterf (GLuint sampler, GLenum pname, GLfloat param);
+GLAPI void APIENTRY glSamplerParameterfv (GLuint sampler, GLenum pname, const GLfloat *param);
+GLAPI void APIENTRY glSamplerParameterIiv (GLuint sampler, GLenum pname, const GLint *param);
+GLAPI void APIENTRY glSamplerParameterIuiv (GLuint sampler, GLenum pname, const GLuint *param);
+GLAPI void APIENTRY glGetSamplerParameteriv (GLuint sampler, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetSamplerParameterIiv (GLuint sampler, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetSamplerParameterfv (GLuint sampler, GLenum pname, GLfloat *params);
+GLAPI void APIENTRY glGetSamplerParameterIuiv (GLuint sampler, GLenum pname, GLuint *params);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLGENSAMPLERSPROC) (GLsizei count, GLuint *samplers);
+typedef void (APIENTRYP PFNGLDELETESAMPLERSPROC) (GLsizei count, const GLuint *samplers);
+typedef GLboolean (APIENTRYP PFNGLISSAMPLERPROC) (GLuint sampler);
+typedef void (APIENTRYP PFNGLBINDSAMPLERPROC) (GLuint unit, GLuint sampler);
+typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIPROC) (GLuint sampler, GLenum pname, GLint param);
+typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIVPROC) (GLuint sampler, GLenum pname, const GLint *param);
+typedef void (APIENTRYP PFNGLSAMPLERPARAMETERFPROC) (GLuint sampler, GLenum pname, GLfloat param);
+typedef void (APIENTRYP PFNGLSAMPLERPARAMETERFVPROC) (GLuint sampler, GLenum pname, const GLfloat *param);
+typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIIVPROC) (GLuint sampler, GLenum pname, const GLint *param);
+typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIUIVPROC) (GLuint sampler, GLenum pname, const GLuint *param);
+typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERIVPROC) (GLuint sampler, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERIIVPROC) (GLuint sampler, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERFVPROC) (GLuint sampler, GLenum pname, GLfloat *params);
+typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERIUIVPROC) (GLuint sampler, GLenum pname, GLuint *params);
+#endif
+
+#ifndef GL_ARB_shader_bit_encoding
+#define GL_ARB_shader_bit_encoding 1
+#endif
+
+#ifndef GL_ARB_texture_rgb10_a2ui
+#define GL_ARB_texture_rgb10_a2ui 1
+#endif
+
+#ifndef GL_ARB_texture_swizzle
+#define GL_ARB_texture_swizzle 1
+#endif
+
+#ifndef GL_ARB_timer_query
+#define GL_ARB_timer_query 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glQueryCounter (GLuint id, GLenum target);
+GLAPI void APIENTRY glGetQueryObjecti64v (GLuint id, GLenum pname, GLint64 *params);
+GLAPI void APIENTRY glGetQueryObjectui64v (GLuint id, GLenum pname, GLuint64 *params);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLQUERYCOUNTERPROC) (GLuint id, GLenum target);
+typedef void (APIENTRYP PFNGLGETQUERYOBJECTI64VPROC) (GLuint id, GLenum pname, GLint64 *params);
+typedef void (APIENTRYP PFNGLGETQUERYOBJECTUI64VPROC) (GLuint id, GLenum pname, GLuint64 *params);
+#endif
+
+#ifndef GL_ARB_vertex_type_2_10_10_10_rev
+#define GL_ARB_vertex_type_2_10_10_10_rev 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glVertexP2ui (GLenum type, GLuint value);
+GLAPI void APIENTRY glVertexP2uiv (GLenum type, const GLuint *value);
+GLAPI void APIENTRY glVertexP3ui (GLenum type, GLuint value);
+GLAPI void APIENTRY glVertexP3uiv (GLenum type, const GLuint *value);
+GLAPI void APIENTRY glVertexP4ui (GLenum type, GLuint value);
+GLAPI void APIENTRY glVertexP4uiv (GLenum type, const GLuint *value);
+GLAPI void APIENTRY glTexCoordP1ui (GLenum type, GLuint coords);
+GLAPI void APIENTRY glTexCoordP1uiv (GLenum type, const GLuint *coords);
+GLAPI void APIENTRY glTexCoordP2ui (GLenum type, GLuint coords);
+GLAPI void APIENTRY glTexCoordP2uiv (GLenum type, const GLuint *coords);
+GLAPI void APIENTRY glTexCoordP3ui (GLenum type, GLuint coords);
+GLAPI void APIENTRY glTexCoordP3uiv (GLenum type, const GLuint *coords);
+GLAPI void APIENTRY glTexCoordP4ui (GLenum type, GLuint coords);
+GLAPI void APIENTRY glTexCoordP4uiv (GLenum type, const GLuint *coords);
+GLAPI void APIENTRY glMultiTexCoordP1ui (GLenum texture, GLenum type, GLuint coords);
+GLAPI void APIENTRY glMultiTexCoordP1uiv (GLenum texture, GLenum type, const GLuint *coords);
+GLAPI void APIENTRY glMultiTexCoordP2ui (GLenum texture, GLenum type, GLuint coords);
+GLAPI void APIENTRY glMultiTexCoordP2uiv (GLenum texture, GLenum type, const GLuint *coords);
+GLAPI void APIENTRY glMultiTexCoordP3ui (GLenum texture, GLenum type, GLuint coords);
+GLAPI void APIENTRY glMultiTexCoordP3uiv (GLenum texture, GLenum type, const GLuint *coords);
+GLAPI void APIENTRY glMultiTexCoordP4ui (GLenum texture, GLenum type, GLuint coords);
+GLAPI void APIENTRY glMultiTexCoordP4uiv (GLenum texture, GLenum type, const GLuint *coords);
+GLAPI void APIENTRY glNormalP3ui (GLenum type, GLuint coords);
+GLAPI void APIENTRY glNormalP3uiv (GLenum type, const GLuint *coords);
+GLAPI void APIENTRY glColorP3ui (GLenum type, GLuint color);
+GLAPI void APIENTRY glColorP3uiv (GLenum type, const GLuint *color);
+GLAPI void APIENTRY glColorP4ui (GLenum type, GLuint color);
+GLAPI void APIENTRY glColorP4uiv (GLenum type, const GLuint *color);
+GLAPI void APIENTRY glSecondaryColorP3ui (GLenum type, GLuint color);
+GLAPI void APIENTRY glSecondaryColorP3uiv (GLenum type, const GLuint *color);
+GLAPI void APIENTRY glVertexAttribP1ui (GLuint index, GLenum type, GLboolean normalized, GLuint value);
+GLAPI void APIENTRY glVertexAttribP1uiv (GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
+GLAPI void APIENTRY glVertexAttribP2ui (GLuint index, GLenum type, GLboolean normalized, GLuint value);
+GLAPI void APIENTRY glVertexAttribP2uiv (GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
+GLAPI void APIENTRY glVertexAttribP3ui (GLuint index, GLenum type, GLboolean normalized, GLuint value);
+GLAPI void APIENTRY glVertexAttribP3uiv (GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
+GLAPI void APIENTRY glVertexAttribP4ui (GLuint index, GLenum type, GLboolean normalized, GLuint value);
+GLAPI void APIENTRY glVertexAttribP4uiv (GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLVERTEXP2UIPROC) (GLenum type, GLuint value);
+typedef void (APIENTRYP PFNGLVERTEXP2UIVPROC) (GLenum type, const GLuint *value);
+typedef void (APIENTRYP PFNGLVERTEXP3UIPROC) (GLenum type, GLuint value);
+typedef void (APIENTRYP PFNGLVERTEXP3UIVPROC) (GLenum type, const GLuint *value);
+typedef void (APIENTRYP PFNGLVERTEXP4UIPROC) (GLenum type, GLuint value);
+typedef void (APIENTRYP PFNGLVERTEXP4UIVPROC) (GLenum type, const GLuint *value);
+typedef void (APIENTRYP PFNGLTEXCOORDP1UIPROC) (GLenum type, GLuint coords);
+typedef void (APIENTRYP PFNGLTEXCOORDP1UIVPROC) (GLenum type, const GLuint *coords);
+typedef void (APIENTRYP PFNGLTEXCOORDP2UIPROC) (GLenum type, GLuint coords);
+typedef void (APIENTRYP PFNGLTEXCOORDP2UIVPROC) (GLenum type, const GLuint *coords);
+typedef void (APIENTRYP PFNGLTEXCOORDP3UIPROC) (GLenum type, GLuint coords);
+typedef void (APIENTRYP PFNGLTEXCOORDP3UIVPROC) (GLenum type, const GLuint *coords);
+typedef void (APIENTRYP PFNGLTEXCOORDP4UIPROC) (GLenum type, GLuint coords);
+typedef void (APIENTRYP PFNGLTEXCOORDP4UIVPROC) (GLenum type, const GLuint *coords);
+typedef void (APIENTRYP PFNGLMULTITEXCOORDP1UIPROC) (GLenum texture, GLenum type, GLuint coords);
+typedef void (APIENTRYP PFNGLMULTITEXCOORDP1UIVPROC) (GLenum texture, GLenum type, const GLuint *coords);
+typedef void (APIENTRYP PFNGLMULTITEXCOORDP2UIPROC) (GLenum texture, GLenum type, GLuint coords);
+typedef void (APIENTRYP PFNGLMULTITEXCOORDP2UIVPROC) (GLenum texture, GLenum type, const GLuint *coords);
+typedef void (APIENTRYP PFNGLMULTITEXCOORDP3UIPROC) (GLenum texture, GLenum type, GLuint coords);
+typedef void (APIENTRYP PFNGLMULTITEXCOORDP3UIVPROC) (GLenum texture, GLenum type, const GLuint *coords);
+typedef void (APIENTRYP PFNGLMULTITEXCOORDP4UIPROC) (GLenum texture, GLenum type, GLuint coords);
+typedef void (APIENTRYP PFNGLMULTITEXCOORDP4UIVPROC) (GLenum texture, GLenum type, const GLuint *coords);
+typedef void (APIENTRYP PFNGLNORMALP3UIPROC) (GLenum type, GLuint coords);
+typedef void (APIENTRYP PFNGLNORMALP3UIVPROC) (GLenum type, const GLuint *coords);
+typedef void (APIENTRYP PFNGLCOLORP3UIPROC) (GLenum type, GLuint color);
+typedef void (APIENTRYP PFNGLCOLORP3UIVPROC) (GLenum type, const GLuint *color);
+typedef void (APIENTRYP PFNGLCOLORP4UIPROC) (GLenum type, GLuint color);
+typedef void (APIENTRYP PFNGLCOLORP4UIVPROC) (GLenum type, const GLuint *color);
+typedef void (APIENTRYP PFNGLSECONDARYCOLORP3UIPROC) (GLenum type, GLuint color);
+typedef void (APIENTRYP PFNGLSECONDARYCOLORP3UIVPROC) (GLenum type, const GLuint *color);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBP1UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBP1UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBP2UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBP2UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBP3UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBP3UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBP4UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBP4UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
+#endif
+
+#ifndef GL_ARB_draw_indirect
+#define GL_ARB_draw_indirect 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glDrawArraysIndirect (GLenum mode, const GLvoid *indirect);
+GLAPI void APIENTRY glDrawElementsIndirect (GLenum mode, GLenum type, const GLvoid *indirect);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLDRAWARRAYSINDIRECTPROC) (GLenum mode, const GLvoid *indirect);
+typedef void (APIENTRYP PFNGLDRAWELEMENTSINDIRECTPROC) (GLenum mode, GLenum type, const GLvoid *indirect);
+#endif
+
+#ifndef GL_ARB_gpu_shader5
+#define GL_ARB_gpu_shader5 1
+#endif
+
+#ifndef GL_ARB_gpu_shader_fp64
+#define GL_ARB_gpu_shader_fp64 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glUniform1d (GLint location, GLdouble x);
+GLAPI void APIENTRY glUniform2d (GLint location, GLdouble x, GLdouble y);
+GLAPI void APIENTRY glUniform3d (GLint location, GLdouble x, GLdouble y, GLdouble z);
+GLAPI void APIENTRY glUniform4d (GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+GLAPI void APIENTRY glUniform1dv (GLint location, GLsizei count, const GLdouble *value);
+GLAPI void APIENTRY glUniform2dv (GLint location, GLsizei count, const GLdouble *value);
+GLAPI void APIENTRY glUniform3dv (GLint location, GLsizei count, const GLdouble *value);
+GLAPI void APIENTRY glUniform4dv (GLint location, GLsizei count, const GLdouble *value);
+GLAPI void APIENTRY glUniformMatrix2dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+GLAPI void APIENTRY glUniformMatrix3dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+GLAPI void APIENTRY glUniformMatrix4dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+GLAPI void APIENTRY glUniformMatrix2x3dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+GLAPI void APIENTRY glUniformMatrix2x4dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+GLAPI void APIENTRY glUniformMatrix3x2dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+GLAPI void APIENTRY glUniformMatrix3x4dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+GLAPI void APIENTRY glUniformMatrix4x2dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+GLAPI void APIENTRY glUniformMatrix4x3dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+GLAPI void APIENTRY glGetUniformdv (GLuint program, GLint location, GLdouble *params);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLUNIFORM1DPROC) (GLint location, GLdouble x);
+typedef void (APIENTRYP PFNGLUNIFORM2DPROC) (GLint location, GLdouble x, GLdouble y);
+typedef void (APIENTRYP PFNGLUNIFORM3DPROC) (GLint location, GLdouble x, GLdouble y, GLdouble z);
+typedef void (APIENTRYP PFNGLUNIFORM4DPROC) (GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+typedef void (APIENTRYP PFNGLUNIFORM1DVPROC) (GLint location, GLsizei count, const GLdouble *value);
+typedef void (APIENTRYP PFNGLUNIFORM2DVPROC) (GLint location, GLsizei count, const GLdouble *value);
+typedef void (APIENTRYP PFNGLUNIFORM3DVPROC) (GLint location, GLsizei count, const GLdouble *value);
+typedef void (APIENTRYP PFNGLUNIFORM4DVPROC) (GLint location, GLsizei count, const GLdouble *value);
+typedef void (APIENTRYP PFNGLUNIFORMMATRIX2DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+typedef void (APIENTRYP PFNGLUNIFORMMATRIX3DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+typedef void (APIENTRYP PFNGLUNIFORMMATRIX4DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X3DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X4DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X2DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X4DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X2DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X3DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+typedef void (APIENTRYP PFNGLGETUNIFORMDVPROC) (GLuint program, GLint location, GLdouble *params);
+#endif
+
+#ifndef GL_ARB_shader_subroutine
+#define GL_ARB_shader_subroutine 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI GLint APIENTRY glGetSubroutineUniformLocation (GLuint program, GLenum shadertype, const GLchar *name);
+GLAPI GLuint APIENTRY glGetSubroutineIndex (GLuint program, GLenum shadertype, const GLchar *name);
+GLAPI void APIENTRY glGetActiveSubroutineUniformiv (GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values);
+GLAPI void APIENTRY glGetActiveSubroutineUniformName (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name);
+GLAPI void APIENTRY glGetActiveSubroutineName (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name);
+GLAPI void APIENTRY glUniformSubroutinesuiv (GLenum shadertype, GLsizei count, const GLuint *indices);
+GLAPI void APIENTRY glGetUniformSubroutineuiv (GLenum shadertype, GLint location, GLuint *params);
+GLAPI void APIENTRY glGetProgramStageiv (GLuint program, GLenum shadertype, GLenum pname, GLint *values);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef GLint (APIENTRYP PFNGLGETSUBROUTINEUNIFORMLOCATIONPROC) (GLuint program, GLenum shadertype, const GLchar *name);
+typedef GLuint (APIENTRYP PFNGLGETSUBROUTINEINDEXPROC) (GLuint program, GLenum shadertype, const GLchar *name);
+typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINEUNIFORMIVPROC) (GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values);
+typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINEUNIFORMNAMEPROC) (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name);
+typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINENAMEPROC) (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name);
+typedef void (APIENTRYP PFNGLUNIFORMSUBROUTINESUIVPROC) (GLenum shadertype, GLsizei count, const GLuint *indices);
+typedef void (APIENTRYP PFNGLGETUNIFORMSUBROUTINEUIVPROC) (GLenum shadertype, GLint location, GLuint *params);
+typedef void (APIENTRYP PFNGLGETPROGRAMSTAGEIVPROC) (GLuint program, GLenum shadertype, GLenum pname, GLint *values);
+#endif
+
+#ifndef GL_ARB_tessellation_shader
+#define GL_ARB_tessellation_shader 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glPatchParameteri (GLenum pname, GLint value);
+GLAPI void APIENTRY glPatchParameterfv (GLenum pname, const GLfloat *values);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLPATCHPARAMETERIPROC) (GLenum pname, GLint value);
+typedef void (APIENTRYP PFNGLPATCHPARAMETERFVPROC) (GLenum pname, const GLfloat *values);
+#endif
+
+#ifndef GL_ARB_texture_buffer_object_rgb32
+#define GL_ARB_texture_buffer_object_rgb32 1
+#endif
+
+#ifndef GL_ARB_transform_feedback2
+#define GL_ARB_transform_feedback2 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glBindTransformFeedback (GLenum target, GLuint id);
+GLAPI void APIENTRY glDeleteTransformFeedbacks (GLsizei n, const GLuint *ids);
+GLAPI void APIENTRY glGenTransformFeedbacks (GLsizei n, GLuint *ids);
+GLAPI GLboolean APIENTRY glIsTransformFeedback (GLuint id);
+GLAPI void APIENTRY glPauseTransformFeedback (void);
+GLAPI void APIENTRY glResumeTransformFeedback (void);
+GLAPI void APIENTRY glDrawTransformFeedback (GLenum mode, GLuint id);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLBINDTRANSFORMFEEDBACKPROC) (GLenum target, GLuint id);
+typedef void (APIENTRYP PFNGLDELETETRANSFORMFEEDBACKSPROC) (GLsizei n, const GLuint *ids);
+typedef void (APIENTRYP PFNGLGENTRANSFORMFEEDBACKSPROC) (GLsizei n, GLuint *ids);
+typedef GLboolean (APIENTRYP PFNGLISTRANSFORMFEEDBACKPROC) (GLuint id);
+typedef void (APIENTRYP PFNGLPAUSETRANSFORMFEEDBACKPROC) (void);
+typedef void (APIENTRYP PFNGLRESUMETRANSFORMFEEDBACKPROC) (void);
+typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKPROC) (GLenum mode, GLuint id);
+#endif
+
+#ifndef GL_ARB_transform_feedback3
+#define GL_ARB_transform_feedback3 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glDrawTransformFeedbackStream (GLenum mode, GLuint id, GLuint stream);
+GLAPI void APIENTRY glBeginQueryIndexed (GLenum target, GLuint index, GLuint id);
+GLAPI void APIENTRY glEndQueryIndexed (GLenum target, GLuint index);
+GLAPI void APIENTRY glGetQueryIndexediv (GLenum target, GLuint index, GLenum pname, GLint *params);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKSTREAMPROC) (GLenum mode, GLuint id, GLuint stream);
+typedef void (APIENTRYP PFNGLBEGINQUERYINDEXEDPROC) (GLenum target, GLuint index, GLuint id);
+typedef void (APIENTRYP PFNGLENDQUERYINDEXEDPROC) (GLenum target, GLuint index);
+typedef void (APIENTRYP PFNGLGETQUERYINDEXEDIVPROC) (GLenum target, GLuint index, GLenum pname, GLint *params);
+#endif
+
+#ifndef GL_ARB_ES2_compatibility
+#define GL_ARB_ES2_compatibility 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glReleaseShaderCompiler (void);
+GLAPI void APIENTRY glShaderBinary (GLsizei count, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length);
+GLAPI void APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision);
+GLAPI void APIENTRY glDepthRangef (GLclampf n, GLclampf f);
+GLAPI void APIENTRY glClearDepthf (GLclampf d);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLRELEASESHADERCOMPILERPROC) (void);
+typedef void (APIENTRYP PFNGLSHADERBINARYPROC) (GLsizei count, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length);
+typedef void (APIENTRYP PFNGLGETSHADERPRECISIONFORMATPROC) (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision);
+typedef void (APIENTRYP PFNGLDEPTHRANGEFPROC) (GLclampf n, GLclampf f);
+typedef void (APIENTRYP PFNGLCLEARDEPTHFPROC) (GLclampf d);
+#endif
+
+#ifndef GL_ARB_get_program_binary
+#define GL_ARB_get_program_binary 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glGetProgramBinary (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary);
+GLAPI void APIENTRY glProgramBinary (GLuint program, GLenum binaryFormat, const GLvoid *binary, GLsizei length);
+GLAPI void APIENTRY glProgramParameteri (GLuint program, GLenum pname, GLint value);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLGETPROGRAMBINARYPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary);
+typedef void (APIENTRYP PFNGLPROGRAMBINARYPROC) (GLuint program, GLenum binaryFormat, const GLvoid *binary, GLsizei length);
+typedef void (APIENTRYP PFNGLPROGRAMPARAMETERIPROC) (GLuint program, GLenum pname, GLint value);
+#endif
+
+#ifndef GL_ARB_separate_shader_objects
+#define GL_ARB_separate_shader_objects 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glUseProgramStages (GLuint pipeline, GLbitfield stages, GLuint program);
+GLAPI void APIENTRY glActiveShaderProgram (GLuint pipeline, GLuint program);
+GLAPI GLuint APIENTRY glCreateShaderProgramv (GLenum type, GLsizei count, const GLchar* *strings);
+GLAPI void APIENTRY glBindProgramPipeline (GLuint pipeline);
+GLAPI void APIENTRY glDeleteProgramPipelines (GLsizei n, const GLuint *pipelines);
+GLAPI void APIENTRY glGenProgramPipelines (GLsizei n, GLuint *pipelines);
+GLAPI GLboolean APIENTRY glIsProgramPipeline (GLuint pipeline);
+GLAPI void APIENTRY glGetProgramPipelineiv (GLuint pipeline, GLenum pname, GLint *params);
+GLAPI void APIENTRY glProgramUniform1i (GLuint program, GLint location, GLint v0);
+GLAPI void APIENTRY glProgramUniform1iv (GLuint program, GLint location, GLsizei count, const GLint *value);
+GLAPI void APIENTRY glProgramUniform1f (GLuint program, GLint location, GLfloat v0);
+GLAPI void APIENTRY glProgramUniform1fv (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+GLAPI void APIENTRY glProgramUniform1d (GLuint program, GLint location, GLdouble v0);
+GLAPI void APIENTRY glProgramUniform1dv (GLuint program, GLint location, GLsizei count, const GLdouble *value);
+GLAPI void APIENTRY glProgramUniform1ui (GLuint program, GLint location, GLuint v0);
+GLAPI void APIENTRY glProgramUniform1uiv (GLuint program, GLint location, GLsizei count, const GLuint *value);
+GLAPI void APIENTRY glProgramUniform2i (GLuint program, GLint location, GLint v0, GLint v1);
+GLAPI void APIENTRY glProgramUniform2iv (GLuint program, GLint location, GLsizei count, const GLint *value);
+GLAPI void APIENTRY glProgramUniform2f (GLuint program, GLint location, GLfloat v0, GLfloat v1);
+GLAPI void APIENTRY glProgramUniform2fv (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+GLAPI void APIENTRY glProgramUniform2d (GLuint program, GLint location, GLdouble v0, GLdouble v1);
+GLAPI void APIENTRY glProgramUniform2dv (GLuint program, GLint location, GLsizei count, const GLdouble *value);
+GLAPI void APIENTRY glProgramUniform2ui (GLuint program, GLint location, GLuint v0, GLuint v1);
+GLAPI void APIENTRY glProgramUniform2uiv (GLuint program, GLint location, GLsizei count, const GLuint *value);
+GLAPI void APIENTRY glProgramUniform3i (GLuint program, GLint location, GLint v0, GLint v1, GLint v2);
+GLAPI void APIENTRY glProgramUniform3iv (GLuint program, GLint location, GLsizei count, const GLint *value);
+GLAPI void APIENTRY glProgramUniform3f (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
+GLAPI void APIENTRY glProgramUniform3fv (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+GLAPI void APIENTRY glProgramUniform3d (GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2);
+GLAPI void APIENTRY glProgramUniform3dv (GLuint program, GLint location, GLsizei count, const GLdouble *value);
+GLAPI void APIENTRY glProgramUniform3ui (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);
+GLAPI void APIENTRY glProgramUniform3uiv (GLuint program, GLint location, GLsizei count, const GLuint *value);
+GLAPI void APIENTRY glProgramUniform4i (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
+GLAPI void APIENTRY glProgramUniform4iv (GLuint program, GLint location, GLsizei count, const GLint *value);
+GLAPI void APIENTRY glProgramUniform4f (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
+GLAPI void APIENTRY glProgramUniform4fv (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+GLAPI void APIENTRY glProgramUniform4d (GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3);
+GLAPI void APIENTRY glProgramUniform4dv (GLuint program, GLint location, GLsizei count, const GLdouble *value);
+GLAPI void APIENTRY glProgramUniform4ui (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+GLAPI void APIENTRY glProgramUniform4uiv (GLuint program, GLint location, GLsizei count, const GLuint *value);
+GLAPI void APIENTRY glProgramUniformMatrix2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GLAPI void APIENTRY glProgramUniformMatrix3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GLAPI void APIENTRY glProgramUniformMatrix4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GLAPI void APIENTRY glProgramUniformMatrix2dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+GLAPI void APIENTRY glProgramUniformMatrix3dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+GLAPI void APIENTRY glProgramUniformMatrix4dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+GLAPI void APIENTRY glProgramUniformMatrix2x3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GLAPI void APIENTRY glProgramUniformMatrix3x2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GLAPI void APIENTRY glProgramUniformMatrix2x4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GLAPI void APIENTRY glProgramUniformMatrix4x2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GLAPI void APIENTRY glProgramUniformMatrix3x4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GLAPI void APIENTRY glProgramUniformMatrix4x3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GLAPI void APIENTRY glProgramUniformMatrix2x3dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+GLAPI void APIENTRY glProgramUniformMatrix3x2dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+GLAPI void APIENTRY glProgramUniformMatrix2x4dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+GLAPI void APIENTRY glProgramUniformMatrix4x2dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+GLAPI void APIENTRY glProgramUniformMatrix3x4dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+GLAPI void APIENTRY glProgramUniformMatrix4x3dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+GLAPI void APIENTRY glValidateProgramPipeline (GLuint pipeline);
+GLAPI void APIENTRY glGetProgramPipelineInfoLog (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLUSEPROGRAMSTAGESPROC) (GLuint pipeline, GLbitfield stages, GLuint program);
+typedef void (APIENTRYP PFNGLACTIVESHADERPROGRAMPROC) (GLuint pipeline, GLuint program);
+typedef GLuint (APIENTRYP PFNGLCREATESHADERPROGRAMVPROC) (GLenum type, GLsizei count, const GLchar* *strings);
+typedef void (APIENTRYP PFNGLBINDPROGRAMPIPELINEPROC) (GLuint pipeline);
+typedef void (APIENTRYP PFNGLDELETEPROGRAMPIPELINESPROC) (GLsizei n, const GLuint *pipelines);
+typedef void (APIENTRYP PFNGLGENPROGRAMPIPELINESPROC) (GLsizei n, GLuint *pipelines);
+typedef GLboolean (APIENTRYP PFNGLISPROGRAMPIPELINEPROC) (GLuint pipeline);
+typedef void (APIENTRYP PFNGLGETPROGRAMPIPELINEIVPROC) (GLuint pipeline, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1IPROC) (GLuint program, GLint location, GLint v0);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1FPROC) (GLuint program, GLint location, GLfloat v0);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1DPROC) (GLuint program, GLint location, GLdouble v0);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UIPROC) (GLuint program, GLint location, GLuint v0);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2IPROC) (GLuint program, GLint location, GLint v0, GLint v1);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2FPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2DPROC) (GLuint program, GLint location, GLdouble v0, GLdouble v1);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UIPROC) (GLuint program, GLint location, GLuint v0, GLuint v1);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3IPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3FPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3DPROC) (GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UIPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4IPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4FPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4DPROC) (GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UIPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+typedef void (APIENTRYP PFNGLVALIDATEPROGRAMPIPELINEPROC) (GLuint pipeline);
+typedef void (APIENTRYP PFNGLGETPROGRAMPIPELINEINFOLOGPROC) (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
+#endif
+
+#ifndef GL_ARB_vertex_attrib_64bit
+#define GL_ARB_vertex_attrib_64bit 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glVertexAttribL1d (GLuint index, GLdouble x);
+GLAPI void APIENTRY glVertexAttribL2d (GLuint index, GLdouble x, GLdouble y);
+GLAPI void APIENTRY glVertexAttribL3d (GLuint index, GLdouble x, GLdouble y, GLdouble z);
+GLAPI void APIENTRY glVertexAttribL4d (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+GLAPI void APIENTRY glVertexAttribL1dv (GLuint index, const GLdouble *v);
+GLAPI void APIENTRY glVertexAttribL2dv (GLuint index, const GLdouble *v);
+GLAPI void APIENTRY glVertexAttribL3dv (GLuint index, const GLdouble *v);
+GLAPI void APIENTRY glVertexAttribL4dv (GLuint index, const GLdouble *v);
+GLAPI void APIENTRY glVertexAttribLPointer (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
+GLAPI void APIENTRY glGetVertexAttribLdv (GLuint index, GLenum pname, GLdouble *params);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLVERTEXATTRIBL1DPROC) (GLuint index, GLdouble x);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBL2DPROC) (GLuint index, GLdouble x, GLdouble y);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBL3DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBL4DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBL1DVPROC) (GLuint index, const GLdouble *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBL2DVPROC) (GLuint index, const GLdouble *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBL3DVPROC) (GLuint index, const GLdouble *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBL4DVPROC) (GLuint index, const GLdouble *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBLPOINTERPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
+typedef void (APIENTRYP PFNGLGETVERTEXATTRIBLDVPROC) (GLuint index, GLenum pname, GLdouble *params);
+#endif
+
+#ifndef GL_ARB_viewport_array
+#define GL_ARB_viewport_array 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glViewportArrayv (GLuint first, GLsizei count, const GLfloat *v);
+GLAPI void APIENTRY glViewportIndexedf (GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h);
+GLAPI void APIENTRY glViewportIndexedfv (GLuint index, const GLfloat *v);
+GLAPI void APIENTRY glScissorArrayv (GLuint first, GLsizei count, const GLint *v);
+GLAPI void APIENTRY glScissorIndexed (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height);
+GLAPI void APIENTRY glScissorIndexedv (GLuint index, const GLint *v);
+GLAPI void APIENTRY glDepthRangeArrayv (GLuint first, GLsizei count, const GLclampd *v);
+GLAPI void APIENTRY glDepthRangeIndexed (GLuint index, GLclampd n, GLclampd f);
+GLAPI void APIENTRY glGetFloati_v (GLenum target, GLuint index, GLfloat *data);
+GLAPI void APIENTRY glGetDoublei_v (GLenum target, GLuint index, GLdouble *data);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLVIEWPORTARRAYVPROC) (GLuint first, GLsizei count, const GLfloat *v);
+typedef void (APIENTRYP PFNGLVIEWPORTINDEXEDFPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h);
+typedef void (APIENTRYP PFNGLVIEWPORTINDEXEDFVPROC) (GLuint index, const GLfloat *v);
+typedef void (APIENTRYP PFNGLSCISSORARRAYVPROC) (GLuint first, GLsizei count, const GLint *v);
+typedef void (APIENTRYP PFNGLSCISSORINDEXEDPROC) (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height);
+typedef void (APIENTRYP PFNGLSCISSORINDEXEDVPROC) (GLuint index, const GLint *v);
+typedef void (APIENTRYP PFNGLDEPTHRANGEARRAYVPROC) (GLuint first, GLsizei count, const GLclampd *v);
+typedef void (APIENTRYP PFNGLDEPTHRANGEINDEXEDPROC) (GLuint index, GLclampd n, GLclampd f);
+typedef void (APIENTRYP PFNGLGETFLOATI_VPROC) (GLenum target, GLuint index, GLfloat *data);
+typedef void (APIENTRYP PFNGLGETDOUBLEI_VPROC) (GLenum target, GLuint index, GLdouble *data);
+#endif
+
+#ifndef GL_ARB_cl_event
+#define GL_ARB_cl_event 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI GLsync APIENTRY glCreateSyncFromCLeventARB (struct _cl_context * context, struct _cl_event * event, GLbitfield flags);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef GLsync (APIENTRYP PFNGLCREATESYNCFROMCLEVENTARBPROC) (struct _cl_context * context, struct _cl_event * event, GLbitfield flags);
+#endif
+
+#ifndef GL_ARB_debug_output
+#define GL_ARB_debug_output 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glDebugMessageControlARB (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
+GLAPI void APIENTRY glDebugMessageInsertARB (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf);
+GLAPI void APIENTRY glDebugMessageCallbackARB (GLDEBUGPROCARB callback, const GLvoid *userParam);
+GLAPI GLuint APIENTRY glGetDebugMessageLogARB (GLuint count, GLsizei bufsize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLDEBUGMESSAGECONTROLARBPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
+typedef void (APIENTRYP PFNGLDEBUGMESSAGEINSERTARBPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf);
+typedef void (APIENTRYP PFNGLDEBUGMESSAGECALLBACKARBPROC) (GLDEBUGPROCARB callback, const GLvoid *userParam);
+typedef GLuint (APIENTRYP PFNGLGETDEBUGMESSAGELOGARBPROC) (GLuint count, GLsizei bufsize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog);
+#endif
+
+#ifndef GL_ARB_robustness
+#define GL_ARB_robustness 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI GLenum APIENTRY glGetGraphicsResetStatusARB (void);
+GLAPI void APIENTRY glGetnMapdvARB (GLenum target, GLenum query, GLsizei bufSize, GLdouble *v);
+GLAPI void APIENTRY glGetnMapfvARB (GLenum target, GLenum query, GLsizei bufSize, GLfloat *v);
+GLAPI void APIENTRY glGetnMapivARB (GLenum target, GLenum query, GLsizei bufSize, GLint *v);
+GLAPI void APIENTRY glGetnPixelMapfvARB (GLenum map, GLsizei bufSize, GLfloat *values);
+GLAPI void APIENTRY glGetnPixelMapuivARB (GLenum map, GLsizei bufSize, GLuint *values);
+GLAPI void APIENTRY glGetnPixelMapusvARB (GLenum map, GLsizei bufSize, GLushort *values);
+GLAPI void APIENTRY glGetnPolygonStippleARB (GLsizei bufSize, GLubyte *pattern);
+GLAPI void APIENTRY glGetnColorTableARB (GLenum target, GLenum format, GLenum type, GLsizei bufSize, GLvoid *table);
+GLAPI void APIENTRY glGetnConvolutionFilterARB (GLenum target, GLenum format, GLenum type, GLsizei bufSize, GLvoid *image);
+GLAPI void APIENTRY glGetnSeparableFilterARB (GLenum target, GLenum format, GLenum type, GLsizei rowBufSize, GLvoid *row, GLsizei columnBufSize, GLvoid *column, GLvoid *span);
+GLAPI void APIENTRY glGetnHistogramARB (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, GLvoid *values);
+GLAPI void APIENTRY glGetnMinmaxARB (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, GLvoid *values);
+GLAPI void APIENTRY glGetnTexImageARB (GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, GLvoid *img);
+GLAPI void APIENTRY glReadnPixelsARB (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, GLvoid *data);
+GLAPI void APIENTRY glGetnCompressedTexImageARB (GLenum target, GLint lod, GLsizei bufSize, GLvoid *img);
+GLAPI void APIENTRY glGetnUniformfvARB (GLuint program, GLint location, GLsizei bufSize, GLfloat *params);
+GLAPI void APIENTRY glGetnUniformivARB (GLuint program, GLint location, GLsizei bufSize, GLint *params);
+GLAPI void APIENTRY glGetnUniformuivARB (GLuint program, GLint location, GLsizei bufSize, GLuint *params);
+GLAPI void APIENTRY glGetnUniformdvARB (GLuint program, GLint location, GLsizei bufSize, GLdouble *params);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef GLenum (APIENTRYP PFNGLGETGRAPHICSRESETSTATUSARBPROC) (void);
+typedef void (APIENTRYP PFNGLGETNMAPDVARBPROC) (GLenum target, GLenum query, GLsizei bufSize, GLdouble *v);
+typedef void (APIENTRYP PFNGLGETNMAPFVARBPROC) (GLenum target, GLenum query, GLsizei bufSize, GLfloat *v);
+typedef void (APIENTRYP PFNGLGETNMAPIVARBPROC) (GLenum target, GLenum query, GLsizei bufSize, GLint *v);
+typedef void (APIENTRYP PFNGLGETNPIXELMAPFVARBPROC) (GLenum map, GLsizei bufSize, GLfloat *values);
+typedef void (APIENTRYP PFNGLGETNPIXELMAPUIVARBPROC) (GLenum map, GLsizei bufSize, GLuint *values);
+typedef void (APIENTRYP PFNGLGETNPIXELMAPUSVARBPROC) (GLenum map, GLsizei bufSize, GLushort *values);
+typedef void (APIENTRYP PFNGLGETNPOLYGONSTIPPLEARBPROC) (GLsizei bufSize, GLubyte *pattern);
+typedef void (APIENTRYP PFNGLGETNCOLORTABLEARBPROC) (GLenum target, GLenum format, GLenum type, GLsizei bufSize, GLvoid *table);
+typedef void (APIENTRYP PFNGLGETNCONVOLUTIONFILTERARBPROC) (GLenum target, GLenum format, GLenum type, GLsizei bufSize, GLvoid *image);
+typedef void (APIENTRYP PFNGLGETNSEPARABLEFILTERARBPROC) (GLenum target, GLenum format, GLenum type, GLsizei rowBufSize, GLvoid *row, GLsizei columnBufSize, GLvoid *column, GLvoid *span);
+typedef void (APIENTRYP PFNGLGETNHISTOGRAMARBPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, GLvoid *values);
+typedef void (APIENTRYP PFNGLGETNMINMAXARBPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, GLvoid *values);
+typedef void (APIENTRYP PFNGLGETNTEXIMAGEARBPROC) (GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, GLvoid *img);
+typedef void (APIENTRYP PFNGLREADNPIXELSARBPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, GLvoid *data);
+typedef void (APIENTRYP PFNGLGETNCOMPRESSEDTEXIMAGEARBPROC) (GLenum target, GLint lod, GLsizei bufSize, GLvoid *img);
+typedef void (APIENTRYP PFNGLGETNUNIFORMFVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLfloat *params);
+typedef void (APIENTRYP PFNGLGETNUNIFORMIVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params);
+typedef void (APIENTRYP PFNGLGETNUNIFORMUIVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLuint *params);
+typedef void (APIENTRYP PFNGLGETNUNIFORMDVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLdouble *params);
+#endif
+
+#ifndef GL_ARB_shader_stencil_export
+#define GL_ARB_shader_stencil_export 1
+#endif
+
+#ifndef GL_ARB_base_instance
+#define GL_ARB_base_instance 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glDrawArraysInstancedBaseInstance (GLenum mode, GLint first, GLsizei count, GLsizei primcount, GLuint baseinstance);
+GLAPI void APIENTRY glDrawElementsInstancedBaseInstance (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount, GLuint baseinstance);
+GLAPI void APIENTRY glDrawElementsInstancedBaseVertexBaseInstance (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount, GLint basevertex, GLuint baseinstance);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount, GLuint baseinstance);
+typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount, GLuint baseinstance);
+typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount, GLint basevertex, GLuint baseinstance);
+#endif
+
+#ifndef GL_ARB_shading_language_420pack
+#define GL_ARB_shading_language_420pack 1
+#endif
+
+#ifndef GL_ARB_transform_feedback_instanced
+#define GL_ARB_transform_feedback_instanced 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glDrawTransformFeedbackInstanced (GLenum mode, GLuint id, GLsizei primcount);
+GLAPI void APIENTRY glDrawTransformFeedbackStreamInstanced (GLenum mode, GLuint id, GLuint stream, GLsizei primcount);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKINSTANCEDPROC) (GLenum mode, GLuint id, GLsizei primcount);
+typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKSTREAMINSTANCEDPROC) (GLenum mode, GLuint id, GLuint stream, GLsizei primcount);
+#endif
+
+#ifndef GL_ARB_compressed_texture_pixel_storage
+#define GL_ARB_compressed_texture_pixel_storage 1
+#endif
+
+#ifndef GL_ARB_conservative_depth
+#define GL_ARB_conservative_depth 1
+#endif
+
+#ifndef GL_ARB_internalformat_query
+#define GL_ARB_internalformat_query 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glGetInternalformativ (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLGETINTERNALFORMATIVPROC) (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params);
+#endif
+
+#ifndef GL_ARB_map_buffer_alignment
+#define GL_ARB_map_buffer_alignment 1
+#endif
+
+#ifndef GL_ARB_shader_atomic_counters
+#define GL_ARB_shader_atomic_counters 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glGetActiveAtomicCounterBufferiv (GLuint program, GLuint bufferIndex, GLenum pname, GLint *params);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLGETACTIVEATOMICCOUNTERBUFFERIVPROC) (GLuint program, GLuint bufferIndex, GLenum pname, GLint *params);
+#endif
+
+#ifndef GL_ARB_shader_image_load_store
+#define GL_ARB_shader_image_load_store 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glBindImageTexture (GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format);
+GLAPI void APIENTRY glMemoryBarrier (GLbitfield barriers);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLBINDIMAGETEXTUREPROC) (GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format);
+typedef void (APIENTRYP PFNGLMEMORYBARRIERPROC) (GLbitfield barriers);
+#endif
+
+#ifndef GL_ARB_shading_language_packing
+#define GL_ARB_shading_language_packing 1
+#endif
+
+#ifndef GL_ARB_texture_storage
+#define GL_ARB_texture_storage 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glTexStorage1D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
+GLAPI void APIENTRY glTexStorage2D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
+GLAPI void APIENTRY glTexStorage3D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
+GLAPI void APIENTRY glTextureStorage1DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
+GLAPI void APIENTRY glTextureStorage2DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
+GLAPI void APIENTRY glTextureStorage3DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLTEXSTORAGE1DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
+typedef void (APIENTRYP PFNGLTEXSTORAGE2DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (APIENTRYP PFNGLTEXSTORAGE3DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
+typedef void (APIENTRYP PFNGLTEXTURESTORAGE1DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
+typedef void (APIENTRYP PFNGLTEXTURESTORAGE2DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (APIENTRYP PFNGLTEXTURESTORAGE3DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
+#endif
+
#ifndef GL_EXT_abgr
#define GL_EXT_abgr 1
#endif
@@ -5348,7 +7726,7 @@ typedef GLboolean (APIENTRYP PFNGLISVERTEXARRAYPROC) (GLuint array);
#ifndef GL_EXT_blend_color
#define GL_EXT_blend_color 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glBlendColorEXT (GLclampf, GLclampf, GLclampf, GLclampf);
+GLAPI void APIENTRY glBlendColorEXT (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLBLENDCOLOREXTPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
#endif
@@ -5356,7 +7734,7 @@ typedef void (APIENTRYP PFNGLBLENDCOLOREXTPROC) (GLclampf red, GLclampf green, G
#ifndef GL_EXT_polygon_offset
#define GL_EXT_polygon_offset 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glPolygonOffsetEXT (GLfloat, GLfloat);
+GLAPI void APIENTRY glPolygonOffsetEXT (GLfloat factor, GLfloat bias);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLPOLYGONOFFSETEXTPROC) (GLfloat factor, GLfloat bias);
#endif
@@ -5368,8 +7746,8 @@ typedef void (APIENTRYP PFNGLPOLYGONOFFSETEXTPROC) (GLfloat factor, GLfloat bias
#ifndef GL_EXT_texture3D
#define GL_EXT_texture3D 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glTexImage3DEXT (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *);
-GLAPI void APIENTRY glTexSubImage3DEXT (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
+GLAPI void APIENTRY glTexImage3DEXT (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
+GLAPI void APIENTRY glTexSubImage3DEXT (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLTEXIMAGE3DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);
@@ -5378,8 +7756,8 @@ typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DEXTPROC) (GLenum target, GLint level,
#ifndef GL_SGIS_texture_filter4
#define GL_SGIS_texture_filter4 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glGetTexFilterFuncSGIS (GLenum, GLenum, GLfloat *);
-GLAPI void APIENTRY glTexFilterFuncSGIS (GLenum, GLenum, GLsizei, const GLfloat *);
+GLAPI void APIENTRY glGetTexFilterFuncSGIS (GLenum target, GLenum filter, GLfloat *weights);
+GLAPI void APIENTRY glTexFilterFuncSGIS (GLenum target, GLenum filter, GLsizei n, const GLfloat *weights);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLGETTEXFILTERFUNCSGISPROC) (GLenum target, GLenum filter, GLfloat *weights);
typedef void (APIENTRYP PFNGLTEXFILTERFUNCSGISPROC) (GLenum target, GLenum filter, GLsizei n, const GLfloat *weights);
@@ -5388,8 +7766,8 @@ typedef void (APIENTRYP PFNGLTEXFILTERFUNCSGISPROC) (GLenum target, GLenum filte
#ifndef GL_EXT_subtexture
#define GL_EXT_subtexture 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glTexSubImage1DEXT (GLenum, GLint, GLint, GLsizei, GLenum, GLenum, const GLvoid *);
-GLAPI void APIENTRY glTexSubImage2DEXT (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
+GLAPI void APIENTRY glTexSubImage1DEXT (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels);
+GLAPI void APIENTRY glTexSubImage2DEXT (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLTEXSUBIMAGE1DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels);
typedef void (APIENTRYP PFNGLTEXSUBIMAGE2DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
@@ -5398,11 +7776,11 @@ typedef void (APIENTRYP PFNGLTEXSUBIMAGE2DEXTPROC) (GLenum target, GLint level,
#ifndef GL_EXT_copy_texture
#define GL_EXT_copy_texture 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glCopyTexImage1DEXT (GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLint);
-GLAPI void APIENTRY glCopyTexImage2DEXT (GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint);
-GLAPI void APIENTRY glCopyTexSubImage1DEXT (GLenum, GLint, GLint, GLint, GLint, GLsizei);
-GLAPI void APIENTRY glCopyTexSubImage2DEXT (GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei);
-GLAPI void APIENTRY glCopyTexSubImage3DEXT (GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei);
+GLAPI void APIENTRY glCopyTexImage1DEXT (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);
+GLAPI void APIENTRY glCopyTexImage2DEXT (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
+GLAPI void APIENTRY glCopyTexSubImage1DEXT (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
+GLAPI void APIENTRY glCopyTexSubImage2DEXT (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+GLAPI void APIENTRY glCopyTexSubImage3DEXT (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLCOPYTEXIMAGE1DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);
typedef void (APIENTRYP PFNGLCOPYTEXIMAGE2DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
@@ -5414,16 +7792,16 @@ typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DEXTPROC) (GLenum target, GLint lev
#ifndef GL_EXT_histogram
#define GL_EXT_histogram 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glGetHistogramEXT (GLenum, GLboolean, GLenum, GLenum, GLvoid *);
-GLAPI void APIENTRY glGetHistogramParameterfvEXT (GLenum, GLenum, GLfloat *);
-GLAPI void APIENTRY glGetHistogramParameterivEXT (GLenum, GLenum, GLint *);
-GLAPI void APIENTRY glGetMinmaxEXT (GLenum, GLboolean, GLenum, GLenum, GLvoid *);
-GLAPI void APIENTRY glGetMinmaxParameterfvEXT (GLenum, GLenum, GLfloat *);
-GLAPI void APIENTRY glGetMinmaxParameterivEXT (GLenum, GLenum, GLint *);
-GLAPI void APIENTRY glHistogramEXT (GLenum, GLsizei, GLenum, GLboolean);
-GLAPI void APIENTRY glMinmaxEXT (GLenum, GLenum, GLboolean);
-GLAPI void APIENTRY glResetHistogramEXT (GLenum);
-GLAPI void APIENTRY glResetMinmaxEXT (GLenum);
+GLAPI void APIENTRY glGetHistogramEXT (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values);
+GLAPI void APIENTRY glGetHistogramParameterfvEXT (GLenum target, GLenum pname, GLfloat *params);
+GLAPI void APIENTRY glGetHistogramParameterivEXT (GLenum target, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetMinmaxEXT (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values);
+GLAPI void APIENTRY glGetMinmaxParameterfvEXT (GLenum target, GLenum pname, GLfloat *params);
+GLAPI void APIENTRY glGetMinmaxParameterivEXT (GLenum target, GLenum pname, GLint *params);
+GLAPI void APIENTRY glHistogramEXT (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink);
+GLAPI void APIENTRY glMinmaxEXT (GLenum target, GLenum internalformat, GLboolean sink);
+GLAPI void APIENTRY glResetHistogramEXT (GLenum target);
+GLAPI void APIENTRY glResetMinmaxEXT (GLenum target);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLGETHISTOGRAMEXTPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values);
typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params);
@@ -5440,19 +7818,19 @@ typedef void (APIENTRYP PFNGLRESETMINMAXEXTPROC) (GLenum target);
#ifndef GL_EXT_convolution
#define GL_EXT_convolution 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glConvolutionFilter1DEXT (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *);
-GLAPI void APIENTRY glConvolutionFilter2DEXT (GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
-GLAPI void APIENTRY glConvolutionParameterfEXT (GLenum, GLenum, GLfloat);
-GLAPI void APIENTRY glConvolutionParameterfvEXT (GLenum, GLenum, const GLfloat *);
-GLAPI void APIENTRY glConvolutionParameteriEXT (GLenum, GLenum, GLint);
-GLAPI void APIENTRY glConvolutionParameterivEXT (GLenum, GLenum, const GLint *);
-GLAPI void APIENTRY glCopyConvolutionFilter1DEXT (GLenum, GLenum, GLint, GLint, GLsizei);
-GLAPI void APIENTRY glCopyConvolutionFilter2DEXT (GLenum, GLenum, GLint, GLint, GLsizei, GLsizei);
-GLAPI void APIENTRY glGetConvolutionFilterEXT (GLenum, GLenum, GLenum, GLvoid *);
-GLAPI void APIENTRY glGetConvolutionParameterfvEXT (GLenum, GLenum, GLfloat *);
-GLAPI void APIENTRY glGetConvolutionParameterivEXT (GLenum, GLenum, GLint *);
-GLAPI void APIENTRY glGetSeparableFilterEXT (GLenum, GLenum, GLenum, GLvoid *, GLvoid *, GLvoid *);
-GLAPI void APIENTRY glSeparableFilter2DEXT (GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *, const GLvoid *);
+GLAPI void APIENTRY glConvolutionFilter1DEXT (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image);
+GLAPI void APIENTRY glConvolutionFilter2DEXT (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image);
+GLAPI void APIENTRY glConvolutionParameterfEXT (GLenum target, GLenum pname, GLfloat params);
+GLAPI void APIENTRY glConvolutionParameterfvEXT (GLenum target, GLenum pname, const GLfloat *params);
+GLAPI void APIENTRY glConvolutionParameteriEXT (GLenum target, GLenum pname, GLint params);
+GLAPI void APIENTRY glConvolutionParameterivEXT (GLenum target, GLenum pname, const GLint *params);
+GLAPI void APIENTRY glCopyConvolutionFilter1DEXT (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
+GLAPI void APIENTRY glCopyConvolutionFilter2DEXT (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height);
+GLAPI void APIENTRY glGetConvolutionFilterEXT (GLenum target, GLenum format, GLenum type, GLvoid *image);
+GLAPI void APIENTRY glGetConvolutionParameterfvEXT (GLenum target, GLenum pname, GLfloat *params);
+GLAPI void APIENTRY glGetConvolutionParameterivEXT (GLenum target, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetSeparableFilterEXT (GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span);
+GLAPI void APIENTRY glSeparableFilter2DEXT (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER1DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image);
typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image);
@@ -5476,13 +7854,13 @@ typedef void (APIENTRYP PFNGLSEPARABLEFILTER2DEXTPROC) (GLenum target, GLenum in
#ifndef GL_SGI_color_table
#define GL_SGI_color_table 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glColorTableSGI (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *);
-GLAPI void APIENTRY glColorTableParameterfvSGI (GLenum, GLenum, const GLfloat *);
-GLAPI void APIENTRY glColorTableParameterivSGI (GLenum, GLenum, const GLint *);
-GLAPI void APIENTRY glCopyColorTableSGI (GLenum, GLenum, GLint, GLint, GLsizei);
-GLAPI void APIENTRY glGetColorTableSGI (GLenum, GLenum, GLenum, GLvoid *);
-GLAPI void APIENTRY glGetColorTableParameterfvSGI (GLenum, GLenum, GLfloat *);
-GLAPI void APIENTRY glGetColorTableParameterivSGI (GLenum, GLenum, GLint *);
+GLAPI void APIENTRY glColorTableSGI (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table);
+GLAPI void APIENTRY glColorTableParameterfvSGI (GLenum target, GLenum pname, const GLfloat *params);
+GLAPI void APIENTRY glColorTableParameterivSGI (GLenum target, GLenum pname, const GLint *params);
+GLAPI void APIENTRY glCopyColorTableSGI (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
+GLAPI void APIENTRY glGetColorTableSGI (GLenum target, GLenum format, GLenum type, GLvoid *table);
+GLAPI void APIENTRY glGetColorTableParameterfvSGI (GLenum target, GLenum pname, GLfloat *params);
+GLAPI void APIENTRY glGetColorTableParameterivSGI (GLenum target, GLenum pname, GLint *params);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLCOLORTABLESGIPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table);
typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERFVSGIPROC) (GLenum target, GLenum pname, const GLfloat *params);
@@ -5496,7 +7874,7 @@ typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERIVSGIPROC) (GLenum target, GL
#ifndef GL_SGIX_pixel_texture
#define GL_SGIX_pixel_texture 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glPixelTexGenSGIX (GLenum);
+GLAPI void APIENTRY glPixelTexGenSGIX (GLenum mode);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLPIXELTEXGENSGIXPROC) (GLenum mode);
#endif
@@ -5504,12 +7882,12 @@ typedef void (APIENTRYP PFNGLPIXELTEXGENSGIXPROC) (GLenum mode);
#ifndef GL_SGIS_pixel_texture
#define GL_SGIS_pixel_texture 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glPixelTexGenParameteriSGIS (GLenum, GLint);
-GLAPI void APIENTRY glPixelTexGenParameterivSGIS (GLenum, const GLint *);
-GLAPI void APIENTRY glPixelTexGenParameterfSGIS (GLenum, GLfloat);
-GLAPI void APIENTRY glPixelTexGenParameterfvSGIS (GLenum, const GLfloat *);
-GLAPI void APIENTRY glGetPixelTexGenParameterivSGIS (GLenum, GLint *);
-GLAPI void APIENTRY glGetPixelTexGenParameterfvSGIS (GLenum, GLfloat *);
+GLAPI void APIENTRY glPixelTexGenParameteriSGIS (GLenum pname, GLint param);
+GLAPI void APIENTRY glPixelTexGenParameterivSGIS (GLenum pname, const GLint *params);
+GLAPI void APIENTRY glPixelTexGenParameterfSGIS (GLenum pname, GLfloat param);
+GLAPI void APIENTRY glPixelTexGenParameterfvSGIS (GLenum pname, const GLfloat *params);
+GLAPI void APIENTRY glGetPixelTexGenParameterivSGIS (GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetPixelTexGenParameterfvSGIS (GLenum pname, GLfloat *params);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERISGISPROC) (GLenum pname, GLint param);
typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERIVSGISPROC) (GLenum pname, const GLint *params);
@@ -5522,8 +7900,8 @@ typedef void (APIENTRYP PFNGLGETPIXELTEXGENPARAMETERFVSGISPROC) (GLenum pname, G
#ifndef GL_SGIS_texture4D
#define GL_SGIS_texture4D 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glTexImage4DSGIS (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *);
-GLAPI void APIENTRY glTexSubImage4DSGIS (GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
+GLAPI void APIENTRY glTexImage4DSGIS (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
+GLAPI void APIENTRY glTexSubImage4DSGIS (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint woffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLenum format, GLenum type, const GLvoid *pixels);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLTEXIMAGE4DSGISPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
typedef void (APIENTRYP PFNGLTEXSUBIMAGE4DSGISPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint woffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLenum format, GLenum type, const GLvoid *pixels);
@@ -5540,12 +7918,12 @@ typedef void (APIENTRYP PFNGLTEXSUBIMAGE4DSGISPROC) (GLenum target, GLint level,
#ifndef GL_EXT_texture_object
#define GL_EXT_texture_object 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI GLboolean APIENTRY glAreTexturesResidentEXT (GLsizei, const GLuint *, GLboolean *);
-GLAPI void APIENTRY glBindTextureEXT (GLenum, GLuint);
-GLAPI void APIENTRY glDeleteTexturesEXT (GLsizei, const GLuint *);
-GLAPI void APIENTRY glGenTexturesEXT (GLsizei, GLuint *);
-GLAPI GLboolean APIENTRY glIsTextureEXT (GLuint);
-GLAPI void APIENTRY glPrioritizeTexturesEXT (GLsizei, const GLuint *, const GLclampf *);
+GLAPI GLboolean APIENTRY glAreTexturesResidentEXT (GLsizei n, const GLuint *textures, GLboolean *residences);
+GLAPI void APIENTRY glBindTextureEXT (GLenum target, GLuint texture);
+GLAPI void APIENTRY glDeleteTexturesEXT (GLsizei n, const GLuint *textures);
+GLAPI void APIENTRY glGenTexturesEXT (GLsizei n, GLuint *textures);
+GLAPI GLboolean APIENTRY glIsTextureEXT (GLuint texture);
+GLAPI void APIENTRY glPrioritizeTexturesEXT (GLsizei n, const GLuint *textures, const GLclampf *priorities);
#endif /* GL_GLEXT_PROTOTYPES */
typedef GLboolean (APIENTRYP PFNGLARETEXTURESRESIDENTEXTPROC) (GLsizei n, const GLuint *textures, GLboolean *residences);
typedef void (APIENTRYP PFNGLBINDTEXTUREEXTPROC) (GLenum target, GLuint texture);
@@ -5558,8 +7936,8 @@ typedef void (APIENTRYP PFNGLPRIORITIZETEXTURESEXTPROC) (GLsizei n, const GLuint
#ifndef GL_SGIS_detail_texture
#define GL_SGIS_detail_texture 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glDetailTexFuncSGIS (GLenum, GLsizei, const GLfloat *);
-GLAPI void APIENTRY glGetDetailTexFuncSGIS (GLenum, GLfloat *);
+GLAPI void APIENTRY glDetailTexFuncSGIS (GLenum target, GLsizei n, const GLfloat *points);
+GLAPI void APIENTRY glGetDetailTexFuncSGIS (GLenum target, GLfloat *points);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLDETAILTEXFUNCSGISPROC) (GLenum target, GLsizei n, const GLfloat *points);
typedef void (APIENTRYP PFNGLGETDETAILTEXFUNCSGISPROC) (GLenum target, GLfloat *points);
@@ -5568,8 +7946,8 @@ typedef void (APIENTRYP PFNGLGETDETAILTEXFUNCSGISPROC) (GLenum target, GLfloat *
#ifndef GL_SGIS_sharpen_texture
#define GL_SGIS_sharpen_texture 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glSharpenTexFuncSGIS (GLenum, GLsizei, const GLfloat *);
-GLAPI void APIENTRY glGetSharpenTexFuncSGIS (GLenum, GLfloat *);
+GLAPI void APIENTRY glSharpenTexFuncSGIS (GLenum target, GLsizei n, const GLfloat *points);
+GLAPI void APIENTRY glGetSharpenTexFuncSGIS (GLenum target, GLfloat *points);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLSHARPENTEXFUNCSGISPROC) (GLenum target, GLsizei n, const GLfloat *points);
typedef void (APIENTRYP PFNGLGETSHARPENTEXFUNCSGISPROC) (GLenum target, GLfloat *points);
@@ -5586,8 +7964,8 @@ typedef void (APIENTRYP PFNGLGETSHARPENTEXFUNCSGISPROC) (GLenum target, GLfloat
#ifndef GL_SGIS_multisample
#define GL_SGIS_multisample 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glSampleMaskSGIS (GLclampf, GLboolean);
-GLAPI void APIENTRY glSamplePatternSGIS (GLenum);
+GLAPI void APIENTRY glSampleMaskSGIS (GLclampf value, GLboolean invert);
+GLAPI void APIENTRY glSamplePatternSGIS (GLenum pattern);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLSAMPLEMASKSGISPROC) (GLclampf value, GLboolean invert);
typedef void (APIENTRYP PFNGLSAMPLEPATTERNSGISPROC) (GLenum pattern);
@@ -5600,15 +7978,15 @@ typedef void (APIENTRYP PFNGLSAMPLEPATTERNSGISPROC) (GLenum pattern);
#ifndef GL_EXT_vertex_array
#define GL_EXT_vertex_array 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glArrayElementEXT (GLint);
-GLAPI void APIENTRY glColorPointerEXT (GLint, GLenum, GLsizei, GLsizei, const GLvoid *);
-GLAPI void APIENTRY glDrawArraysEXT (GLenum, GLint, GLsizei);
-GLAPI void APIENTRY glEdgeFlagPointerEXT (GLsizei, GLsizei, const GLboolean *);
-GLAPI void APIENTRY glGetPointervEXT (GLenum, GLvoid* *);
-GLAPI void APIENTRY glIndexPointerEXT (GLenum, GLsizei, GLsizei, const GLvoid *);
-GLAPI void APIENTRY glNormalPointerEXT (GLenum, GLsizei, GLsizei, const GLvoid *);
-GLAPI void APIENTRY glTexCoordPointerEXT (GLint, GLenum, GLsizei, GLsizei, const GLvoid *);
-GLAPI void APIENTRY glVertexPointerEXT (GLint, GLenum, GLsizei, GLsizei, const GLvoid *);
+GLAPI void APIENTRY glArrayElementEXT (GLint i);
+GLAPI void APIENTRY glColorPointerEXT (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);
+GLAPI void APIENTRY glDrawArraysEXT (GLenum mode, GLint first, GLsizei count);
+GLAPI void APIENTRY glEdgeFlagPointerEXT (GLsizei stride, GLsizei count, const GLboolean *pointer);
+GLAPI void APIENTRY glGetPointervEXT (GLenum pname, GLvoid* *params);
+GLAPI void APIENTRY glIndexPointerEXT (GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);
+GLAPI void APIENTRY glNormalPointerEXT (GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);
+GLAPI void APIENTRY glTexCoordPointerEXT (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);
+GLAPI void APIENTRY glVertexPointerEXT (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLARRAYELEMENTEXTPROC) (GLint i);
typedef void (APIENTRYP PFNGLCOLORPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);
@@ -5648,7 +8026,7 @@ typedef void (APIENTRYP PFNGLVERTEXPOINTEREXTPROC) (GLint size, GLenum type, GLs
#ifndef GL_EXT_blend_minmax
#define GL_EXT_blend_minmax 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glBlendEquationEXT (GLenum);
+GLAPI void APIENTRY glBlendEquationEXT (GLenum mode);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLBLENDEQUATIONEXTPROC) (GLenum mode);
#endif
@@ -5676,10 +8054,10 @@ typedef void (APIENTRYP PFNGLBLENDEQUATIONEXTPROC) (GLenum mode);
#ifndef GL_SGIX_sprite
#define GL_SGIX_sprite 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glSpriteParameterfSGIX (GLenum, GLfloat);
-GLAPI void APIENTRY glSpriteParameterfvSGIX (GLenum, const GLfloat *);
-GLAPI void APIENTRY glSpriteParameteriSGIX (GLenum, GLint);
-GLAPI void APIENTRY glSpriteParameterivSGIX (GLenum, const GLint *);
+GLAPI void APIENTRY glSpriteParameterfSGIX (GLenum pname, GLfloat param);
+GLAPI void APIENTRY glSpriteParameterfvSGIX (GLenum pname, const GLfloat *params);
+GLAPI void APIENTRY glSpriteParameteriSGIX (GLenum pname, GLint param);
+GLAPI void APIENTRY glSpriteParameterivSGIX (GLenum pname, const GLint *params);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLSPRITEPARAMETERFSGIXPROC) (GLenum pname, GLfloat param);
typedef void (APIENTRYP PFNGLSPRITEPARAMETERFVSGIXPROC) (GLenum pname, const GLfloat *params);
@@ -5694,8 +8072,8 @@ typedef void (APIENTRYP PFNGLSPRITEPARAMETERIVSGIXPROC) (GLenum pname, const GLi
#ifndef GL_EXT_point_parameters
#define GL_EXT_point_parameters 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glPointParameterfEXT (GLenum, GLfloat);
-GLAPI void APIENTRY glPointParameterfvEXT (GLenum, const GLfloat *);
+GLAPI void APIENTRY glPointParameterfEXT (GLenum pname, GLfloat param);
+GLAPI void APIENTRY glPointParameterfvEXT (GLenum pname, const GLfloat *params);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLPOINTPARAMETERFEXTPROC) (GLenum pname, GLfloat param);
typedef void (APIENTRYP PFNGLPOINTPARAMETERFVEXTPROC) (GLenum pname, const GLfloat *params);
@@ -5704,8 +8082,8 @@ typedef void (APIENTRYP PFNGLPOINTPARAMETERFVEXTPROC) (GLenum pname, const GLflo
#ifndef GL_SGIS_point_parameters
#define GL_SGIS_point_parameters 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glPointParameterfSGIS (GLenum, GLfloat);
-GLAPI void APIENTRY glPointParameterfvSGIS (GLenum, const GLfloat *);
+GLAPI void APIENTRY glPointParameterfSGIS (GLenum pname, GLfloat param);
+GLAPI void APIENTRY glPointParameterfvSGIS (GLenum pname, const GLfloat *params);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLPOINTPARAMETERFSGISPROC) (GLenum pname, GLfloat param);
typedef void (APIENTRYP PFNGLPOINTPARAMETERFVSGISPROC) (GLenum pname, const GLfloat *params);
@@ -5715,11 +8093,11 @@ typedef void (APIENTRYP PFNGLPOINTPARAMETERFVSGISPROC) (GLenum pname, const GLfl
#define GL_SGIX_instruments 1
#ifdef GL_GLEXT_PROTOTYPES
GLAPI GLint APIENTRY glGetInstrumentsSGIX (void);
-GLAPI void APIENTRY glInstrumentsBufferSGIX (GLsizei, GLint *);
-GLAPI GLint APIENTRY glPollInstrumentsSGIX (GLint *);
-GLAPI void APIENTRY glReadInstrumentsSGIX (GLint);
+GLAPI void APIENTRY glInstrumentsBufferSGIX (GLsizei size, GLint *buffer);
+GLAPI GLint APIENTRY glPollInstrumentsSGIX (GLint *marker_p);
+GLAPI void APIENTRY glReadInstrumentsSGIX (GLint marker);
GLAPI void APIENTRY glStartInstrumentsSGIX (void);
-GLAPI void APIENTRY glStopInstrumentsSGIX (GLint);
+GLAPI void APIENTRY glStopInstrumentsSGIX (GLint marker);
#endif /* GL_GLEXT_PROTOTYPES */
typedef GLint (APIENTRYP PFNGLGETINSTRUMENTSSGIXPROC) (void);
typedef void (APIENTRYP PFNGLINSTRUMENTSBUFFERSGIXPROC) (GLsizei size, GLint *buffer);
@@ -5736,7 +8114,7 @@ typedef void (APIENTRYP PFNGLSTOPINSTRUMENTSSGIXPROC) (GLint marker);
#ifndef GL_SGIX_framezoom
#define GL_SGIX_framezoom 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glFrameZoomSGIX (GLint);
+GLAPI void APIENTRY glFrameZoomSGIX (GLint factor);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLFRAMEZOOMSGIXPROC) (GLint factor);
#endif
@@ -5752,10 +8130,10 @@ typedef void (APIENTRYP PFNGLTAGSAMPLEBUFFERSGIXPROC) (void);
#ifndef GL_SGIX_polynomial_ffd
#define GL_SGIX_polynomial_ffd 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glDeformationMap3dSGIX (GLenum, GLdouble, GLdouble, GLint, GLint, GLdouble, GLdouble, GLint, GLint, GLdouble, GLdouble, GLint, GLint, const GLdouble *);
-GLAPI void APIENTRY glDeformationMap3fSGIX (GLenum, GLfloat, GLfloat, GLint, GLint, GLfloat, GLfloat, GLint, GLint, GLfloat, GLfloat, GLint, GLint, const GLfloat *);
-GLAPI void APIENTRY glDeformSGIX (GLbitfield);
-GLAPI void APIENTRY glLoadIdentityDeformationMapSGIX (GLbitfield);
+GLAPI void APIENTRY glDeformationMap3dSGIX (GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, GLdouble w1, GLdouble w2, GLint wstride, GLint worder, const GLdouble *points);
+GLAPI void APIENTRY glDeformationMap3fSGIX (GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, GLfloat w1, GLfloat w2, GLint wstride, GLint worder, const GLfloat *points);
+GLAPI void APIENTRY glDeformSGIX (GLbitfield mask);
+GLAPI void APIENTRY glLoadIdentityDeformationMapSGIX (GLbitfield mask);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLDEFORMATIONMAP3DSGIXPROC) (GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, GLdouble w1, GLdouble w2, GLint wstride, GLint worder, const GLdouble *points);
typedef void (APIENTRYP PFNGLDEFORMATIONMAP3FSGIXPROC) (GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, GLfloat w1, GLfloat w2, GLint wstride, GLint worder, const GLfloat *points);
@@ -5766,7 +8144,7 @@ typedef void (APIENTRYP PFNGLLOADIDENTITYDEFORMATIONMAPSGIXPROC) (GLbitfield mas
#ifndef GL_SGIX_reference_plane
#define GL_SGIX_reference_plane 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glReferencePlaneSGIX (const GLdouble *);
+GLAPI void APIENTRY glReferencePlaneSGIX (const GLdouble *equation);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLREFERENCEPLANESGIXPROC) (const GLdouble *equation);
#endif
@@ -5786,8 +8164,8 @@ typedef void (APIENTRYP PFNGLFLUSHRASTERSGIXPROC) (void);
#ifndef GL_SGIS_fog_function
#define GL_SGIS_fog_function 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glFogFuncSGIS (GLsizei, const GLfloat *);
-GLAPI void APIENTRY glGetFogFuncSGIS (GLfloat *);
+GLAPI void APIENTRY glFogFuncSGIS (GLsizei n, const GLfloat *points);
+GLAPI void APIENTRY glGetFogFuncSGIS (GLfloat *points);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLFOGFUNCSGISPROC) (GLsizei n, const GLfloat *points);
typedef void (APIENTRYP PFNGLGETFOGFUNCSGISPROC) (GLfloat *points);
@@ -5800,12 +8178,12 @@ typedef void (APIENTRYP PFNGLGETFOGFUNCSGISPROC) (GLfloat *points);
#ifndef GL_HP_image_transform
#define GL_HP_image_transform 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glImageTransformParameteriHP (GLenum, GLenum, GLint);
-GLAPI void APIENTRY glImageTransformParameterfHP (GLenum, GLenum, GLfloat);
-GLAPI void APIENTRY glImageTransformParameterivHP (GLenum, GLenum, const GLint *);
-GLAPI void APIENTRY glImageTransformParameterfvHP (GLenum, GLenum, const GLfloat *);
-GLAPI void APIENTRY glGetImageTransformParameterivHP (GLenum, GLenum, GLint *);
-GLAPI void APIENTRY glGetImageTransformParameterfvHP (GLenum, GLenum, GLfloat *);
+GLAPI void APIENTRY glImageTransformParameteriHP (GLenum target, GLenum pname, GLint param);
+GLAPI void APIENTRY glImageTransformParameterfHP (GLenum target, GLenum pname, GLfloat param);
+GLAPI void APIENTRY glImageTransformParameterivHP (GLenum target, GLenum pname, const GLint *params);
+GLAPI void APIENTRY glImageTransformParameterfvHP (GLenum target, GLenum pname, const GLfloat *params);
+GLAPI void APIENTRY glGetImageTransformParameterivHP (GLenum target, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetImageTransformParameterfvHP (GLenum target, GLenum pname, GLfloat *params);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERIHPPROC) (GLenum target, GLenum pname, GLint param);
typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERFHPPROC) (GLenum target, GLenum pname, GLfloat param);
@@ -5826,8 +8204,8 @@ typedef void (APIENTRYP PFNGLGETIMAGETRANSFORMPARAMETERFVHPPROC) (GLenum target,
#ifndef GL_EXT_color_subtable
#define GL_EXT_color_subtable 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glColorSubTableEXT (GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
-GLAPI void APIENTRY glCopyColorSubTableEXT (GLenum, GLsizei, GLint, GLint, GLsizei);
+GLAPI void APIENTRY glColorSubTableEXT (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data);
+GLAPI void APIENTRY glCopyColorSubTableEXT (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLCOLORSUBTABLEEXTPROC) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data);
typedef void (APIENTRYP PFNGLCOPYCOLORSUBTABLEEXTPROC) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width);
@@ -5840,7 +8218,7 @@ typedef void (APIENTRYP PFNGLCOPYCOLORSUBTABLEEXTPROC) (GLenum target, GLsizei s
#ifndef GL_PGI_misc_hints
#define GL_PGI_misc_hints 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glHintPGI (GLenum, GLint);
+GLAPI void APIENTRY glHintPGI (GLenum target, GLint mode);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLHINTPGIPROC) (GLenum target, GLint mode);
#endif
@@ -5848,10 +8226,10 @@ typedef void (APIENTRYP PFNGLHINTPGIPROC) (GLenum target, GLint mode);
#ifndef GL_EXT_paletted_texture
#define GL_EXT_paletted_texture 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glColorTableEXT (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *);
-GLAPI void APIENTRY glGetColorTableEXT (GLenum, GLenum, GLenum, GLvoid *);
-GLAPI void APIENTRY glGetColorTableParameterivEXT (GLenum, GLenum, GLint *);
-GLAPI void APIENTRY glGetColorTableParameterfvEXT (GLenum, GLenum, GLfloat *);
+GLAPI void APIENTRY glColorTableEXT (GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, const GLvoid *table);
+GLAPI void APIENTRY glGetColorTableEXT (GLenum target, GLenum format, GLenum type, GLvoid *data);
+GLAPI void APIENTRY glGetColorTableParameterivEXT (GLenum target, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetColorTableParameterfvEXT (GLenum target, GLenum pname, GLfloat *params);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLCOLORTABLEEXTPROC) (GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, const GLvoid *table);
typedef void (APIENTRYP PFNGLGETCOLORTABLEEXTPROC) (GLenum target, GLenum format, GLenum type, GLvoid *data);
@@ -5866,12 +8244,12 @@ typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERFVEXTPROC) (GLenum target, GL
#ifndef GL_SGIX_list_priority
#define GL_SGIX_list_priority 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glGetListParameterfvSGIX (GLuint, GLenum, GLfloat *);
-GLAPI void APIENTRY glGetListParameterivSGIX (GLuint, GLenum, GLint *);
-GLAPI void APIENTRY glListParameterfSGIX (GLuint, GLenum, GLfloat);
-GLAPI void APIENTRY glListParameterfvSGIX (GLuint, GLenum, const GLfloat *);
-GLAPI void APIENTRY glListParameteriSGIX (GLuint, GLenum, GLint);
-GLAPI void APIENTRY glListParameterivSGIX (GLuint, GLenum, const GLint *);
+GLAPI void APIENTRY glGetListParameterfvSGIX (GLuint list, GLenum pname, GLfloat *params);
+GLAPI void APIENTRY glGetListParameterivSGIX (GLuint list, GLenum pname, GLint *params);
+GLAPI void APIENTRY glListParameterfSGIX (GLuint list, GLenum pname, GLfloat param);
+GLAPI void APIENTRY glListParameterfvSGIX (GLuint list, GLenum pname, const GLfloat *params);
+GLAPI void APIENTRY glListParameteriSGIX (GLuint list, GLenum pname, GLint param);
+GLAPI void APIENTRY glListParameterivSGIX (GLuint list, GLenum pname, const GLint *params);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLGETLISTPARAMETERFVSGIXPROC) (GLuint list, GLenum pname, GLfloat *params);
typedef void (APIENTRYP PFNGLGETLISTPARAMETERIVSGIXPROC) (GLuint list, GLenum pname, GLint *params);
@@ -5904,7 +8282,7 @@ typedef void (APIENTRYP PFNGLLISTPARAMETERIVSGIXPROC) (GLuint list, GLenum pname
#ifndef GL_EXT_index_material
#define GL_EXT_index_material 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glIndexMaterialEXT (GLenum, GLenum);
+GLAPI void APIENTRY glIndexMaterialEXT (GLenum face, GLenum mode);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLINDEXMATERIALEXTPROC) (GLenum face, GLenum mode);
#endif
@@ -5912,7 +8290,7 @@ typedef void (APIENTRYP PFNGLINDEXMATERIALEXTPROC) (GLenum face, GLenum mode);
#ifndef GL_EXT_index_func
#define GL_EXT_index_func 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glIndexFuncEXT (GLenum, GLclampf);
+GLAPI void APIENTRY glIndexFuncEXT (GLenum func, GLclampf ref);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLINDEXFUNCEXTPROC) (GLenum func, GLclampf ref);
#endif
@@ -5924,7 +8302,7 @@ typedef void (APIENTRYP PFNGLINDEXFUNCEXTPROC) (GLenum func, GLclampf ref);
#ifndef GL_EXT_compiled_vertex_array
#define GL_EXT_compiled_vertex_array 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glLockArraysEXT (GLint, GLsizei);
+GLAPI void APIENTRY glLockArraysEXT (GLint first, GLsizei count);
GLAPI void APIENTRY glUnlockArraysEXT (void);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLLOCKARRAYSEXTPROC) (GLint first, GLsizei count);
@@ -5934,8 +8312,8 @@ typedef void (APIENTRYP PFNGLUNLOCKARRAYSEXTPROC) (void);
#ifndef GL_EXT_cull_vertex
#define GL_EXT_cull_vertex 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glCullParameterdvEXT (GLenum, GLdouble *);
-GLAPI void APIENTRY glCullParameterfvEXT (GLenum, GLfloat *);
+GLAPI void APIENTRY glCullParameterdvEXT (GLenum pname, GLdouble *params);
+GLAPI void APIENTRY glCullParameterfvEXT (GLenum pname, GLfloat *params);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLCULLPARAMETERDVEXTPROC) (GLenum pname, GLdouble *params);
typedef void (APIENTRYP PFNGLCULLPARAMETERFVEXTPROC) (GLenum pname, GLfloat *params);
@@ -5948,24 +8326,24 @@ typedef void (APIENTRYP PFNGLCULLPARAMETERFVEXTPROC) (GLenum pname, GLfloat *par
#ifndef GL_SGIX_fragment_lighting
#define GL_SGIX_fragment_lighting 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glFragmentColorMaterialSGIX (GLenum, GLenum);
-GLAPI void APIENTRY glFragmentLightfSGIX (GLenum, GLenum, GLfloat);
-GLAPI void APIENTRY glFragmentLightfvSGIX (GLenum, GLenum, const GLfloat *);
-GLAPI void APIENTRY glFragmentLightiSGIX (GLenum, GLenum, GLint);
-GLAPI void APIENTRY glFragmentLightivSGIX (GLenum, GLenum, const GLint *);
-GLAPI void APIENTRY glFragmentLightModelfSGIX (GLenum, GLfloat);
-GLAPI void APIENTRY glFragmentLightModelfvSGIX (GLenum, const GLfloat *);
-GLAPI void APIENTRY glFragmentLightModeliSGIX (GLenum, GLint);
-GLAPI void APIENTRY glFragmentLightModelivSGIX (GLenum, const GLint *);
-GLAPI void APIENTRY glFragmentMaterialfSGIX (GLenum, GLenum, GLfloat);
-GLAPI void APIENTRY glFragmentMaterialfvSGIX (GLenum, GLenum, const GLfloat *);
-GLAPI void APIENTRY glFragmentMaterialiSGIX (GLenum, GLenum, GLint);
-GLAPI void APIENTRY glFragmentMaterialivSGIX (GLenum, GLenum, const GLint *);
-GLAPI void APIENTRY glGetFragmentLightfvSGIX (GLenum, GLenum, GLfloat *);
-GLAPI void APIENTRY glGetFragmentLightivSGIX (GLenum, GLenum, GLint *);
-GLAPI void APIENTRY glGetFragmentMaterialfvSGIX (GLenum, GLenum, GLfloat *);
-GLAPI void APIENTRY glGetFragmentMaterialivSGIX (GLenum, GLenum, GLint *);
-GLAPI void APIENTRY glLightEnviSGIX (GLenum, GLint);
+GLAPI void APIENTRY glFragmentColorMaterialSGIX (GLenum face, GLenum mode);
+GLAPI void APIENTRY glFragmentLightfSGIX (GLenum light, GLenum pname, GLfloat param);
+GLAPI void APIENTRY glFragmentLightfvSGIX (GLenum light, GLenum pname, const GLfloat *params);
+GLAPI void APIENTRY glFragmentLightiSGIX (GLenum light, GLenum pname, GLint param);
+GLAPI void APIENTRY glFragmentLightivSGIX (GLenum light, GLenum pname, const GLint *params);
+GLAPI void APIENTRY glFragmentLightModelfSGIX (GLenum pname, GLfloat param);
+GLAPI void APIENTRY glFragmentLightModelfvSGIX (GLenum pname, const GLfloat *params);
+GLAPI void APIENTRY glFragmentLightModeliSGIX (GLenum pname, GLint param);
+GLAPI void APIENTRY glFragmentLightModelivSGIX (GLenum pname, const GLint *params);
+GLAPI void APIENTRY glFragmentMaterialfSGIX (GLenum face, GLenum pname, GLfloat param);
+GLAPI void APIENTRY glFragmentMaterialfvSGIX (GLenum face, GLenum pname, const GLfloat *params);
+GLAPI void APIENTRY glFragmentMaterialiSGIX (GLenum face, GLenum pname, GLint param);
+GLAPI void APIENTRY glFragmentMaterialivSGIX (GLenum face, GLenum pname, const GLint *params);
+GLAPI void APIENTRY glGetFragmentLightfvSGIX (GLenum light, GLenum pname, GLfloat *params);
+GLAPI void APIENTRY glGetFragmentLightivSGIX (GLenum light, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetFragmentMaterialfvSGIX (GLenum face, GLenum pname, GLfloat *params);
+GLAPI void APIENTRY glGetFragmentMaterialivSGIX (GLenum face, GLenum pname, GLint *params);
+GLAPI void APIENTRY glLightEnviSGIX (GLenum pname, GLint param);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLFRAGMENTCOLORMATERIALSGIXPROC) (GLenum face, GLenum mode);
typedef void (APIENTRYP PFNGLFRAGMENTLIGHTFSGIXPROC) (GLenum light, GLenum pname, GLfloat param);
@@ -5998,7 +8376,7 @@ typedef void (APIENTRYP PFNGLLIGHTENVISGIXPROC) (GLenum pname, GLint param);
#ifndef GL_EXT_draw_range_elements
#define GL_EXT_draw_range_elements 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glDrawRangeElementsEXT (GLenum, GLuint, GLuint, GLsizei, GLenum, const GLvoid *);
+GLAPI void APIENTRY glDrawRangeElementsEXT (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSEXTPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);
#endif
@@ -6014,9 +8392,9 @@ typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSEXTPROC) (GLenum mode, GLuint star
#ifndef GL_EXT_light_texture
#define GL_EXT_light_texture 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glApplyTextureEXT (GLenum);
-GLAPI void APIENTRY glTextureLightEXT (GLenum);
-GLAPI void APIENTRY glTextureMaterialEXT (GLenum, GLenum);
+GLAPI void APIENTRY glApplyTextureEXT (GLenum mode);
+GLAPI void APIENTRY glTextureLightEXT (GLenum pname);
+GLAPI void APIENTRY glTextureMaterialEXT (GLenum face, GLenum mode);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLAPPLYTEXTUREEXTPROC) (GLenum mode);
typedef void (APIENTRYP PFNGLTEXTURELIGHTEXTPROC) (GLenum pname);
@@ -6034,12 +8412,12 @@ typedef void (APIENTRYP PFNGLTEXTUREMATERIALEXTPROC) (GLenum face, GLenum mode);
#ifndef GL_SGIX_async
#define GL_SGIX_async 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glAsyncMarkerSGIX (GLuint);
-GLAPI GLint APIENTRY glFinishAsyncSGIX (GLuint *);
-GLAPI GLint APIENTRY glPollAsyncSGIX (GLuint *);
-GLAPI GLuint APIENTRY glGenAsyncMarkersSGIX (GLsizei);
-GLAPI void APIENTRY glDeleteAsyncMarkersSGIX (GLuint, GLsizei);
-GLAPI GLboolean APIENTRY glIsAsyncMarkerSGIX (GLuint);
+GLAPI void APIENTRY glAsyncMarkerSGIX (GLuint marker);
+GLAPI GLint APIENTRY glFinishAsyncSGIX (GLuint *markerp);
+GLAPI GLint APIENTRY glPollAsyncSGIX (GLuint *markerp);
+GLAPI GLuint APIENTRY glGenAsyncMarkersSGIX (GLsizei range);
+GLAPI void APIENTRY glDeleteAsyncMarkersSGIX (GLuint marker, GLsizei range);
+GLAPI GLboolean APIENTRY glIsAsyncMarkerSGIX (GLuint marker);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLASYNCMARKERSGIXPROC) (GLuint marker);
typedef GLint (APIENTRYP PFNGLFINISHASYNCSGIXPROC) (GLuint *markerp);
@@ -6060,10 +8438,10 @@ typedef GLboolean (APIENTRYP PFNGLISASYNCMARKERSGIXPROC) (GLuint marker);
#ifndef GL_INTEL_parallel_arrays
#define GL_INTEL_parallel_arrays 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glVertexPointervINTEL (GLint, GLenum, const GLvoid* *);
-GLAPI void APIENTRY glNormalPointervINTEL (GLenum, const GLvoid* *);
-GLAPI void APIENTRY glColorPointervINTEL (GLint, GLenum, const GLvoid* *);
-GLAPI void APIENTRY glTexCoordPointervINTEL (GLint, GLenum, const GLvoid* *);
+GLAPI void APIENTRY glVertexPointervINTEL (GLint size, GLenum type, const GLvoid* *pointer);
+GLAPI void APIENTRY glNormalPointervINTEL (GLenum type, const GLvoid* *pointer);
+GLAPI void APIENTRY glColorPointervINTEL (GLint size, GLenum type, const GLvoid* *pointer);
+GLAPI void APIENTRY glTexCoordPointervINTEL (GLint size, GLenum type, const GLvoid* *pointer);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLVERTEXPOINTERVINTELPROC) (GLint size, GLenum type, const GLvoid* *pointer);
typedef void (APIENTRYP PFNGLNORMALPOINTERVINTELPROC) (GLenum type, const GLvoid* *pointer);
@@ -6078,10 +8456,10 @@ typedef void (APIENTRYP PFNGLTEXCOORDPOINTERVINTELPROC) (GLint size, GLenum type
#ifndef GL_EXT_pixel_transform
#define GL_EXT_pixel_transform 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glPixelTransformParameteriEXT (GLenum, GLenum, GLint);
-GLAPI void APIENTRY glPixelTransformParameterfEXT (GLenum, GLenum, GLfloat);
-GLAPI void APIENTRY glPixelTransformParameterivEXT (GLenum, GLenum, const GLint *);
-GLAPI void APIENTRY glPixelTransformParameterfvEXT (GLenum, GLenum, const GLfloat *);
+GLAPI void APIENTRY glPixelTransformParameteriEXT (GLenum target, GLenum pname, GLint param);
+GLAPI void APIENTRY glPixelTransformParameterfEXT (GLenum target, GLenum pname, GLfloat param);
+GLAPI void APIENTRY glPixelTransformParameterivEXT (GLenum target, GLenum pname, const GLint *params);
+GLAPI void APIENTRY glPixelTransformParameterfvEXT (GLenum target, GLenum pname, const GLfloat *params);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERIEXTPROC) (GLenum target, GLenum pname, GLint param);
typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERFEXTPROC) (GLenum target, GLenum pname, GLfloat param);
@@ -6104,23 +8482,23 @@ typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERFVEXTPROC) (GLenum target, G
#ifndef GL_EXT_secondary_color
#define GL_EXT_secondary_color 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glSecondaryColor3bEXT (GLbyte, GLbyte, GLbyte);
-GLAPI void APIENTRY glSecondaryColor3bvEXT (const GLbyte *);
-GLAPI void APIENTRY glSecondaryColor3dEXT (GLdouble, GLdouble, GLdouble);
-GLAPI void APIENTRY glSecondaryColor3dvEXT (const GLdouble *);
-GLAPI void APIENTRY glSecondaryColor3fEXT (GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glSecondaryColor3fvEXT (const GLfloat *);
-GLAPI void APIENTRY glSecondaryColor3iEXT (GLint, GLint, GLint);
-GLAPI void APIENTRY glSecondaryColor3ivEXT (const GLint *);
-GLAPI void APIENTRY glSecondaryColor3sEXT (GLshort, GLshort, GLshort);
-GLAPI void APIENTRY glSecondaryColor3svEXT (const GLshort *);
-GLAPI void APIENTRY glSecondaryColor3ubEXT (GLubyte, GLubyte, GLubyte);
-GLAPI void APIENTRY glSecondaryColor3ubvEXT (const GLubyte *);
-GLAPI void APIENTRY glSecondaryColor3uiEXT (GLuint, GLuint, GLuint);
-GLAPI void APIENTRY glSecondaryColor3uivEXT (const GLuint *);
-GLAPI void APIENTRY glSecondaryColor3usEXT (GLushort, GLushort, GLushort);
-GLAPI void APIENTRY glSecondaryColor3usvEXT (const GLushort *);
-GLAPI void APIENTRY glSecondaryColorPointerEXT (GLint, GLenum, GLsizei, const GLvoid *);
+GLAPI void APIENTRY glSecondaryColor3bEXT (GLbyte red, GLbyte green, GLbyte blue);
+GLAPI void APIENTRY glSecondaryColor3bvEXT (const GLbyte *v);
+GLAPI void APIENTRY glSecondaryColor3dEXT (GLdouble red, GLdouble green, GLdouble blue);
+GLAPI void APIENTRY glSecondaryColor3dvEXT (const GLdouble *v);
+GLAPI void APIENTRY glSecondaryColor3fEXT (GLfloat red, GLfloat green, GLfloat blue);
+GLAPI void APIENTRY glSecondaryColor3fvEXT (const GLfloat *v);
+GLAPI void APIENTRY glSecondaryColor3iEXT (GLint red, GLint green, GLint blue);
+GLAPI void APIENTRY glSecondaryColor3ivEXT (const GLint *v);
+GLAPI void APIENTRY glSecondaryColor3sEXT (GLshort red, GLshort green, GLshort blue);
+GLAPI void APIENTRY glSecondaryColor3svEXT (const GLshort *v);
+GLAPI void APIENTRY glSecondaryColor3ubEXT (GLubyte red, GLubyte green, GLubyte blue);
+GLAPI void APIENTRY glSecondaryColor3ubvEXT (const GLubyte *v);
+GLAPI void APIENTRY glSecondaryColor3uiEXT (GLuint red, GLuint green, GLuint blue);
+GLAPI void APIENTRY glSecondaryColor3uivEXT (const GLuint *v);
+GLAPI void APIENTRY glSecondaryColor3usEXT (GLushort red, GLushort green, GLushort blue);
+GLAPI void APIENTRY glSecondaryColor3usvEXT (const GLushort *v);
+GLAPI void APIENTRY glSecondaryColorPointerEXT (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BEXTPROC) (GLbyte red, GLbyte green, GLbyte blue);
typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BVEXTPROC) (const GLbyte *v);
@@ -6144,7 +8522,7 @@ typedef void (APIENTRYP PFNGLSECONDARYCOLORPOINTEREXTPROC) (GLint size, GLenum t
#ifndef GL_EXT_texture_perturb_normal
#define GL_EXT_texture_perturb_normal 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glTextureNormalEXT (GLenum);
+GLAPI void APIENTRY glTextureNormalEXT (GLenum mode);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLTEXTURENORMALEXTPROC) (GLenum mode);
#endif
@@ -6152,21 +8530,21 @@ typedef void (APIENTRYP PFNGLTEXTURENORMALEXTPROC) (GLenum mode);
#ifndef GL_EXT_multi_draw_arrays
#define GL_EXT_multi_draw_arrays 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glMultiDrawArraysEXT (GLenum, GLint *, GLsizei *, GLsizei);
-GLAPI void APIENTRY glMultiDrawElementsEXT (GLenum, const GLsizei *, GLenum, const GLvoid* *, GLsizei);
+GLAPI void APIENTRY glMultiDrawArraysEXT (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount);
+GLAPI void APIENTRY glMultiDrawElementsEXT (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount);
#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount);
+typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount);
typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount);
#endif
#ifndef GL_EXT_fog_coord
#define GL_EXT_fog_coord 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glFogCoordfEXT (GLfloat);
-GLAPI void APIENTRY glFogCoordfvEXT (const GLfloat *);
-GLAPI void APIENTRY glFogCoorddEXT (GLdouble);
-GLAPI void APIENTRY glFogCoorddvEXT (const GLdouble *);
-GLAPI void APIENTRY glFogCoordPointerEXT (GLenum, GLsizei, const GLvoid *);
+GLAPI void APIENTRY glFogCoordfEXT (GLfloat coord);
+GLAPI void APIENTRY glFogCoordfvEXT (const GLfloat *coord);
+GLAPI void APIENTRY glFogCoorddEXT (GLdouble coord);
+GLAPI void APIENTRY glFogCoorddvEXT (const GLdouble *coord);
+GLAPI void APIENTRY glFogCoordPointerEXT (GLenum type, GLsizei stride, const GLvoid *pointer);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLFOGCOORDFEXTPROC) (GLfloat coord);
typedef void (APIENTRYP PFNGLFOGCOORDFVEXTPROC) (const GLfloat *coord);
@@ -6182,28 +8560,28 @@ typedef void (APIENTRYP PFNGLFOGCOORDPOINTEREXTPROC) (GLenum type, GLsizei strid
#ifndef GL_EXT_coordinate_frame
#define GL_EXT_coordinate_frame 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glTangent3bEXT (GLbyte, GLbyte, GLbyte);
-GLAPI void APIENTRY glTangent3bvEXT (const GLbyte *);
-GLAPI void APIENTRY glTangent3dEXT (GLdouble, GLdouble, GLdouble);
-GLAPI void APIENTRY glTangent3dvEXT (const GLdouble *);
-GLAPI void APIENTRY glTangent3fEXT (GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glTangent3fvEXT (const GLfloat *);
-GLAPI void APIENTRY glTangent3iEXT (GLint, GLint, GLint);
-GLAPI void APIENTRY glTangent3ivEXT (const GLint *);
-GLAPI void APIENTRY glTangent3sEXT (GLshort, GLshort, GLshort);
-GLAPI void APIENTRY glTangent3svEXT (const GLshort *);
-GLAPI void APIENTRY glBinormal3bEXT (GLbyte, GLbyte, GLbyte);
-GLAPI void APIENTRY glBinormal3bvEXT (const GLbyte *);
-GLAPI void APIENTRY glBinormal3dEXT (GLdouble, GLdouble, GLdouble);
-GLAPI void APIENTRY glBinormal3dvEXT (const GLdouble *);
-GLAPI void APIENTRY glBinormal3fEXT (GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glBinormal3fvEXT (const GLfloat *);
-GLAPI void APIENTRY glBinormal3iEXT (GLint, GLint, GLint);
-GLAPI void APIENTRY glBinormal3ivEXT (const GLint *);
-GLAPI void APIENTRY glBinormal3sEXT (GLshort, GLshort, GLshort);
-GLAPI void APIENTRY glBinormal3svEXT (const GLshort *);
-GLAPI void APIENTRY glTangentPointerEXT (GLenum, GLsizei, const GLvoid *);
-GLAPI void APIENTRY glBinormalPointerEXT (GLenum, GLsizei, const GLvoid *);
+GLAPI void APIENTRY glTangent3bEXT (GLbyte tx, GLbyte ty, GLbyte tz);
+GLAPI void APIENTRY glTangent3bvEXT (const GLbyte *v);
+GLAPI void APIENTRY glTangent3dEXT (GLdouble tx, GLdouble ty, GLdouble tz);
+GLAPI void APIENTRY glTangent3dvEXT (const GLdouble *v);
+GLAPI void APIENTRY glTangent3fEXT (GLfloat tx, GLfloat ty, GLfloat tz);
+GLAPI void APIENTRY glTangent3fvEXT (const GLfloat *v);
+GLAPI void APIENTRY glTangent3iEXT (GLint tx, GLint ty, GLint tz);
+GLAPI void APIENTRY glTangent3ivEXT (const GLint *v);
+GLAPI void APIENTRY glTangent3sEXT (GLshort tx, GLshort ty, GLshort tz);
+GLAPI void APIENTRY glTangent3svEXT (const GLshort *v);
+GLAPI void APIENTRY glBinormal3bEXT (GLbyte bx, GLbyte by, GLbyte bz);
+GLAPI void APIENTRY glBinormal3bvEXT (const GLbyte *v);
+GLAPI void APIENTRY glBinormal3dEXT (GLdouble bx, GLdouble by, GLdouble bz);
+GLAPI void APIENTRY glBinormal3dvEXT (const GLdouble *v);
+GLAPI void APIENTRY glBinormal3fEXT (GLfloat bx, GLfloat by, GLfloat bz);
+GLAPI void APIENTRY glBinormal3fvEXT (const GLfloat *v);
+GLAPI void APIENTRY glBinormal3iEXT (GLint bx, GLint by, GLint bz);
+GLAPI void APIENTRY glBinormal3ivEXT (const GLint *v);
+GLAPI void APIENTRY glBinormal3sEXT (GLshort bx, GLshort by, GLshort bz);
+GLAPI void APIENTRY glBinormal3svEXT (const GLshort *v);
+GLAPI void APIENTRY glTangentPointerEXT (GLenum type, GLsizei stride, const GLvoid *pointer);
+GLAPI void APIENTRY glBinormalPointerEXT (GLenum type, GLsizei stride, const GLvoid *pointer);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLTANGENT3BEXTPROC) (GLbyte tx, GLbyte ty, GLbyte tz);
typedef void (APIENTRYP PFNGLTANGENT3BVEXTPROC) (const GLbyte *v);
@@ -6256,14 +8634,14 @@ typedef void (APIENTRYP PFNGLFINISHTEXTURESUNXPROC) (void);
#ifndef GL_SUN_global_alpha
#define GL_SUN_global_alpha 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glGlobalAlphaFactorbSUN (GLbyte);
-GLAPI void APIENTRY glGlobalAlphaFactorsSUN (GLshort);
-GLAPI void APIENTRY glGlobalAlphaFactoriSUN (GLint);
-GLAPI void APIENTRY glGlobalAlphaFactorfSUN (GLfloat);
-GLAPI void APIENTRY glGlobalAlphaFactordSUN (GLdouble);
-GLAPI void APIENTRY glGlobalAlphaFactorubSUN (GLubyte);
-GLAPI void APIENTRY glGlobalAlphaFactorusSUN (GLushort);
-GLAPI void APIENTRY glGlobalAlphaFactoruiSUN (GLuint);
+GLAPI void APIENTRY glGlobalAlphaFactorbSUN (GLbyte factor);
+GLAPI void APIENTRY glGlobalAlphaFactorsSUN (GLshort factor);
+GLAPI void APIENTRY glGlobalAlphaFactoriSUN (GLint factor);
+GLAPI void APIENTRY glGlobalAlphaFactorfSUN (GLfloat factor);
+GLAPI void APIENTRY glGlobalAlphaFactordSUN (GLdouble factor);
+GLAPI void APIENTRY glGlobalAlphaFactorubSUN (GLubyte factor);
+GLAPI void APIENTRY glGlobalAlphaFactorusSUN (GLushort factor);
+GLAPI void APIENTRY glGlobalAlphaFactoruiSUN (GLuint factor);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORBSUNPROC) (GLbyte factor);
typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORSSUNPROC) (GLshort factor);
@@ -6278,13 +8656,13 @@ typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORUISUNPROC) (GLuint factor);
#ifndef GL_SUN_triangle_list
#define GL_SUN_triangle_list 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glReplacementCodeuiSUN (GLuint);
-GLAPI void APIENTRY glReplacementCodeusSUN (GLushort);
-GLAPI void APIENTRY glReplacementCodeubSUN (GLubyte);
-GLAPI void APIENTRY glReplacementCodeuivSUN (const GLuint *);
-GLAPI void APIENTRY glReplacementCodeusvSUN (const GLushort *);
-GLAPI void APIENTRY glReplacementCodeubvSUN (const GLubyte *);
-GLAPI void APIENTRY glReplacementCodePointerSUN (GLenum, GLsizei, const GLvoid* *);
+GLAPI void APIENTRY glReplacementCodeuiSUN (GLuint code);
+GLAPI void APIENTRY glReplacementCodeusSUN (GLushort code);
+GLAPI void APIENTRY glReplacementCodeubSUN (GLubyte code);
+GLAPI void APIENTRY glReplacementCodeuivSUN (const GLuint *code);
+GLAPI void APIENTRY glReplacementCodeusvSUN (const GLushort *code);
+GLAPI void APIENTRY glReplacementCodeubvSUN (const GLubyte *code);
+GLAPI void APIENTRY glReplacementCodePointerSUN (GLenum type, GLsizei stride, const GLvoid* *pointer);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLREPLACEMENTCODEUISUNPROC) (GLuint code);
typedef void (APIENTRYP PFNGLREPLACEMENTCODEUSSUNPROC) (GLushort code);
@@ -6298,46 +8676,46 @@ typedef void (APIENTRYP PFNGLREPLACEMENTCODEPOINTERSUNPROC) (GLenum type, GLsize
#ifndef GL_SUN_vertex
#define GL_SUN_vertex 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glColor4ubVertex2fSUN (GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat);
-GLAPI void APIENTRY glColor4ubVertex2fvSUN (const GLubyte *, const GLfloat *);
-GLAPI void APIENTRY glColor4ubVertex3fSUN (GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glColor4ubVertex3fvSUN (const GLubyte *, const GLfloat *);
-GLAPI void APIENTRY glColor3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glColor3fVertex3fvSUN (const GLfloat *, const GLfloat *);
-GLAPI void APIENTRY glNormal3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glNormal3fVertex3fvSUN (const GLfloat *, const GLfloat *);
-GLAPI void APIENTRY glColor4fNormal3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glColor4fNormal3fVertex3fvSUN (const GLfloat *, const GLfloat *, const GLfloat *);
-GLAPI void APIENTRY glTexCoord2fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glTexCoord2fVertex3fvSUN (const GLfloat *, const GLfloat *);
-GLAPI void APIENTRY glTexCoord4fVertex4fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glTexCoord4fVertex4fvSUN (const GLfloat *, const GLfloat *);
-GLAPI void APIENTRY glTexCoord2fColor4ubVertex3fSUN (GLfloat, GLfloat, GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glTexCoord2fColor4ubVertex3fvSUN (const GLfloat *, const GLubyte *, const GLfloat *);
-GLAPI void APIENTRY glTexCoord2fColor3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glTexCoord2fColor3fVertex3fvSUN (const GLfloat *, const GLfloat *, const GLfloat *);
-GLAPI void APIENTRY glTexCoord2fNormal3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glTexCoord2fNormal3fVertex3fvSUN (const GLfloat *, const GLfloat *, const GLfloat *);
-GLAPI void APIENTRY glTexCoord2fColor4fNormal3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glTexCoord2fColor4fNormal3fVertex3fvSUN (const GLfloat *, const GLfloat *, const GLfloat *, const GLfloat *);
-GLAPI void APIENTRY glTexCoord4fColor4fNormal3fVertex4fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glTexCoord4fColor4fNormal3fVertex4fvSUN (const GLfloat *, const GLfloat *, const GLfloat *, const GLfloat *);
-GLAPI void APIENTRY glReplacementCodeuiVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glReplacementCodeuiVertex3fvSUN (const GLuint *, const GLfloat *);
-GLAPI void APIENTRY glReplacementCodeuiColor4ubVertex3fSUN (GLuint, GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glReplacementCodeuiColor4ubVertex3fvSUN (const GLuint *, const GLubyte *, const GLfloat *);
-GLAPI void APIENTRY glReplacementCodeuiColor3fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glReplacementCodeuiColor3fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *);
-GLAPI void APIENTRY glReplacementCodeuiNormal3fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glReplacementCodeuiNormal3fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *);
-GLAPI void APIENTRY glReplacementCodeuiColor4fNormal3fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glReplacementCodeuiColor4fNormal3fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *, const GLfloat *);
-GLAPI void APIENTRY glReplacementCodeuiTexCoord2fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glReplacementCodeuiTexCoord2fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *);
-GLAPI void APIENTRY glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *, const GLfloat *);
-GLAPI void APIENTRY glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *, const GLfloat *, const GLfloat *);
+GLAPI void APIENTRY glColor4ubVertex2fSUN (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y);
+GLAPI void APIENTRY glColor4ubVertex2fvSUN (const GLubyte *c, const GLfloat *v);
+GLAPI void APIENTRY glColor4ubVertex3fSUN (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z);
+GLAPI void APIENTRY glColor4ubVertex3fvSUN (const GLubyte *c, const GLfloat *v);
+GLAPI void APIENTRY glColor3fVertex3fSUN (GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z);
+GLAPI void APIENTRY glColor3fVertex3fvSUN (const GLfloat *c, const GLfloat *v);
+GLAPI void APIENTRY glNormal3fVertex3fSUN (GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
+GLAPI void APIENTRY glNormal3fVertex3fvSUN (const GLfloat *n, const GLfloat *v);
+GLAPI void APIENTRY glColor4fNormal3fVertex3fSUN (GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
+GLAPI void APIENTRY glColor4fNormal3fVertex3fvSUN (const GLfloat *c, const GLfloat *n, const GLfloat *v);
+GLAPI void APIENTRY glTexCoord2fVertex3fSUN (GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z);
+GLAPI void APIENTRY glTexCoord2fVertex3fvSUN (const GLfloat *tc, const GLfloat *v);
+GLAPI void APIENTRY glTexCoord4fVertex4fSUN (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+GLAPI void APIENTRY glTexCoord4fVertex4fvSUN (const GLfloat *tc, const GLfloat *v);
+GLAPI void APIENTRY glTexCoord2fColor4ubVertex3fSUN (GLfloat s, GLfloat t, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z);
+GLAPI void APIENTRY glTexCoord2fColor4ubVertex3fvSUN (const GLfloat *tc, const GLubyte *c, const GLfloat *v);
+GLAPI void APIENTRY glTexCoord2fColor3fVertex3fSUN (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z);
+GLAPI void APIENTRY glTexCoord2fColor3fVertex3fvSUN (const GLfloat *tc, const GLfloat *c, const GLfloat *v);
+GLAPI void APIENTRY glTexCoord2fNormal3fVertex3fSUN (GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
+GLAPI void APIENTRY glTexCoord2fNormal3fVertex3fvSUN (const GLfloat *tc, const GLfloat *n, const GLfloat *v);
+GLAPI void APIENTRY glTexCoord2fColor4fNormal3fVertex3fSUN (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
+GLAPI void APIENTRY glTexCoord2fColor4fNormal3fVertex3fvSUN (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v);
+GLAPI void APIENTRY glTexCoord4fColor4fNormal3fVertex4fSUN (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+GLAPI void APIENTRY glTexCoord4fColor4fNormal3fVertex4fvSUN (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v);
+GLAPI void APIENTRY glReplacementCodeuiVertex3fSUN (GLuint rc, GLfloat x, GLfloat y, GLfloat z);
+GLAPI void APIENTRY glReplacementCodeuiVertex3fvSUN (const GLuint *rc, const GLfloat *v);
+GLAPI void APIENTRY glReplacementCodeuiColor4ubVertex3fSUN (GLuint rc, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z);
+GLAPI void APIENTRY glReplacementCodeuiColor4ubVertex3fvSUN (const GLuint *rc, const GLubyte *c, const GLfloat *v);
+GLAPI void APIENTRY glReplacementCodeuiColor3fVertex3fSUN (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z);
+GLAPI void APIENTRY glReplacementCodeuiColor3fVertex3fvSUN (const GLuint *rc, const GLfloat *c, const GLfloat *v);
+GLAPI void APIENTRY glReplacementCodeuiNormal3fVertex3fSUN (GLuint rc, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
+GLAPI void APIENTRY glReplacementCodeuiNormal3fVertex3fvSUN (const GLuint *rc, const GLfloat *n, const GLfloat *v);
+GLAPI void APIENTRY glReplacementCodeuiColor4fNormal3fVertex3fSUN (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
+GLAPI void APIENTRY glReplacementCodeuiColor4fNormal3fVertex3fvSUN (const GLuint *rc, const GLfloat *c, const GLfloat *n, const GLfloat *v);
+GLAPI void APIENTRY glReplacementCodeuiTexCoord2fVertex3fSUN (GLuint rc, GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z);
+GLAPI void APIENTRY glReplacementCodeuiTexCoord2fVertex3fvSUN (const GLuint *rc, const GLfloat *tc, const GLfloat *v);
+GLAPI void APIENTRY glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN (GLuint rc, GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
+GLAPI void APIENTRY glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN (const GLuint *rc, const GLfloat *tc, const GLfloat *n, const GLfloat *v);
+GLAPI void APIENTRY glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN (GLuint rc, GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
+GLAPI void APIENTRY glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN (const GLuint *rc, const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX2FSUNPROC) (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y);
typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX2FVSUNPROC) (const GLubyte *c, const GLfloat *v);
@@ -6384,7 +8762,7 @@ typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FV
#ifndef GL_EXT_blend_func_separate
#define GL_EXT_blend_func_separate 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glBlendFuncSeparateEXT (GLenum, GLenum, GLenum, GLenum);
+GLAPI void APIENTRY glBlendFuncSeparateEXT (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEEXTPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
#endif
@@ -6392,7 +8770,7 @@ typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEEXTPROC) (GLenum sfactorRGB, GLenu
#ifndef GL_INGR_blend_func_separate
#define GL_INGR_blend_func_separate 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glBlendFuncSeparateINGR (GLenum, GLenum, GLenum, GLenum);
+GLAPI void APIENTRY glBlendFuncSeparateINGR (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEINGRPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
#endif
@@ -6436,9 +8814,9 @@ typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEINGRPROC) (GLenum sfactorRGB, GLen
#ifndef GL_EXT_vertex_weighting
#define GL_EXT_vertex_weighting 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glVertexWeightfEXT (GLfloat);
-GLAPI void APIENTRY glVertexWeightfvEXT (const GLfloat *);
-GLAPI void APIENTRY glVertexWeightPointerEXT (GLsizei, GLenum, GLsizei, const GLvoid *);
+GLAPI void APIENTRY glVertexWeightfEXT (GLfloat weight);
+GLAPI void APIENTRY glVertexWeightfvEXT (const GLfloat *weight);
+GLAPI void APIENTRY glVertexWeightPointerEXT (GLsizei size, GLenum type, GLsizei stride, const GLvoid *pointer);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLVERTEXWEIGHTFEXTPROC) (GLfloat weight);
typedef void (APIENTRYP PFNGLVERTEXWEIGHTFVEXTPROC) (const GLfloat *weight);
@@ -6453,7 +8831,7 @@ typedef void (APIENTRYP PFNGLVERTEXWEIGHTPOINTEREXTPROC) (GLsizei size, GLenum t
#define GL_NV_vertex_array_range 1
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glFlushVertexArrayRangeNV (void);
-GLAPI void APIENTRY glVertexArrayRangeNV (GLsizei, const GLvoid *);
+GLAPI void APIENTRY glVertexArrayRangeNV (GLsizei length, const GLvoid *pointer);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLFLUSHVERTEXARRAYRANGENVPROC) (void);
typedef void (APIENTRYP PFNGLVERTEXARRAYRANGENVPROC) (GLsizei length, const GLvoid *pointer);
@@ -6462,19 +8840,19 @@ typedef void (APIENTRYP PFNGLVERTEXARRAYRANGENVPROC) (GLsizei length, const GLvo
#ifndef GL_NV_register_combiners
#define GL_NV_register_combiners 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glCombinerParameterfvNV (GLenum, const GLfloat *);
-GLAPI void APIENTRY glCombinerParameterfNV (GLenum, GLfloat);
-GLAPI void APIENTRY glCombinerParameterivNV (GLenum, const GLint *);
-GLAPI void APIENTRY glCombinerParameteriNV (GLenum, GLint);
-GLAPI void APIENTRY glCombinerInputNV (GLenum, GLenum, GLenum, GLenum, GLenum, GLenum);
-GLAPI void APIENTRY glCombinerOutputNV (GLenum, GLenum, GLenum, GLenum, GLenum, GLenum, GLenum, GLboolean, GLboolean, GLboolean);
-GLAPI void APIENTRY glFinalCombinerInputNV (GLenum, GLenum, GLenum, GLenum);
-GLAPI void APIENTRY glGetCombinerInputParameterfvNV (GLenum, GLenum, GLenum, GLenum, GLfloat *);
-GLAPI void APIENTRY glGetCombinerInputParameterivNV (GLenum, GLenum, GLenum, GLenum, GLint *);
-GLAPI void APIENTRY glGetCombinerOutputParameterfvNV (GLenum, GLenum, GLenum, GLfloat *);
-GLAPI void APIENTRY glGetCombinerOutputParameterivNV (GLenum, GLenum, GLenum, GLint *);
-GLAPI void APIENTRY glGetFinalCombinerInputParameterfvNV (GLenum, GLenum, GLfloat *);
-GLAPI void APIENTRY glGetFinalCombinerInputParameterivNV (GLenum, GLenum, GLint *);
+GLAPI void APIENTRY glCombinerParameterfvNV (GLenum pname, const GLfloat *params);
+GLAPI void APIENTRY glCombinerParameterfNV (GLenum pname, GLfloat param);
+GLAPI void APIENTRY glCombinerParameterivNV (GLenum pname, const GLint *params);
+GLAPI void APIENTRY glCombinerParameteriNV (GLenum pname, GLint param);
+GLAPI void APIENTRY glCombinerInputNV (GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage);
+GLAPI void APIENTRY glCombinerOutputNV (GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum);
+GLAPI void APIENTRY glFinalCombinerInputNV (GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage);
+GLAPI void APIENTRY glGetCombinerInputParameterfvNV (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat *params);
+GLAPI void APIENTRY glGetCombinerInputParameterivNV (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetCombinerOutputParameterfvNV (GLenum stage, GLenum portion, GLenum pname, GLfloat *params);
+GLAPI void APIENTRY glGetCombinerOutputParameterivNV (GLenum stage, GLenum portion, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetFinalCombinerInputParameterfvNV (GLenum variable, GLenum pname, GLfloat *params);
+GLAPI void APIENTRY glGetFinalCombinerInputParameterivNV (GLenum variable, GLenum pname, GLint *params);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLCOMBINERPARAMETERFVNVPROC) (GLenum pname, const GLfloat *params);
typedef void (APIENTRYP PFNGLCOMBINERPARAMETERFNVPROC) (GLenum pname, GLfloat param);
@@ -6518,30 +8896,30 @@ typedef void (APIENTRYP PFNGLRESIZEBUFFERSMESAPROC) (void);
#ifndef GL_MESA_window_pos
#define GL_MESA_window_pos 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glWindowPos2dMESA (GLdouble, GLdouble);
-GLAPI void APIENTRY glWindowPos2dvMESA (const GLdouble *);
-GLAPI void APIENTRY glWindowPos2fMESA (GLfloat, GLfloat);
-GLAPI void APIENTRY glWindowPos2fvMESA (const GLfloat *);
-GLAPI void APIENTRY glWindowPos2iMESA (GLint, GLint);
-GLAPI void APIENTRY glWindowPos2ivMESA (const GLint *);
-GLAPI void APIENTRY glWindowPos2sMESA (GLshort, GLshort);
-GLAPI void APIENTRY glWindowPos2svMESA (const GLshort *);
-GLAPI void APIENTRY glWindowPos3dMESA (GLdouble, GLdouble, GLdouble);
-GLAPI void APIENTRY glWindowPos3dvMESA (const GLdouble *);
-GLAPI void APIENTRY glWindowPos3fMESA (GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glWindowPos3fvMESA (const GLfloat *);
-GLAPI void APIENTRY glWindowPos3iMESA (GLint, GLint, GLint);
-GLAPI void APIENTRY glWindowPos3ivMESA (const GLint *);
-GLAPI void APIENTRY glWindowPos3sMESA (GLshort, GLshort, GLshort);
-GLAPI void APIENTRY glWindowPos3svMESA (const GLshort *);
-GLAPI void APIENTRY glWindowPos4dMESA (GLdouble, GLdouble, GLdouble, GLdouble);
-GLAPI void APIENTRY glWindowPos4dvMESA (const GLdouble *);
-GLAPI void APIENTRY glWindowPos4fMESA (GLfloat, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glWindowPos4fvMESA (const GLfloat *);
-GLAPI void APIENTRY glWindowPos4iMESA (GLint, GLint, GLint, GLint);
-GLAPI void APIENTRY glWindowPos4ivMESA (const GLint *);
-GLAPI void APIENTRY glWindowPos4sMESA (GLshort, GLshort, GLshort, GLshort);
-GLAPI void APIENTRY glWindowPos4svMESA (const GLshort *);
+GLAPI void APIENTRY glWindowPos2dMESA (GLdouble x, GLdouble y);
+GLAPI void APIENTRY glWindowPos2dvMESA (const GLdouble *v);
+GLAPI void APIENTRY glWindowPos2fMESA (GLfloat x, GLfloat y);
+GLAPI void APIENTRY glWindowPos2fvMESA (const GLfloat *v);
+GLAPI void APIENTRY glWindowPos2iMESA (GLint x, GLint y);
+GLAPI void APIENTRY glWindowPos2ivMESA (const GLint *v);
+GLAPI void APIENTRY glWindowPos2sMESA (GLshort x, GLshort y);
+GLAPI void APIENTRY glWindowPos2svMESA (const GLshort *v);
+GLAPI void APIENTRY glWindowPos3dMESA (GLdouble x, GLdouble y, GLdouble z);
+GLAPI void APIENTRY glWindowPos3dvMESA (const GLdouble *v);
+GLAPI void APIENTRY glWindowPos3fMESA (GLfloat x, GLfloat y, GLfloat z);
+GLAPI void APIENTRY glWindowPos3fvMESA (const GLfloat *v);
+GLAPI void APIENTRY glWindowPos3iMESA (GLint x, GLint y, GLint z);
+GLAPI void APIENTRY glWindowPos3ivMESA (const GLint *v);
+GLAPI void APIENTRY glWindowPos3sMESA (GLshort x, GLshort y, GLshort z);
+GLAPI void APIENTRY glWindowPos3svMESA (const GLshort *v);
+GLAPI void APIENTRY glWindowPos4dMESA (GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+GLAPI void APIENTRY glWindowPos4dvMESA (const GLdouble *v);
+GLAPI void APIENTRY glWindowPos4fMESA (GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+GLAPI void APIENTRY glWindowPos4fvMESA (const GLfloat *v);
+GLAPI void APIENTRY glWindowPos4iMESA (GLint x, GLint y, GLint z, GLint w);
+GLAPI void APIENTRY glWindowPos4ivMESA (const GLint *v);
+GLAPI void APIENTRY glWindowPos4sMESA (GLshort x, GLshort y, GLshort z, GLshort w);
+GLAPI void APIENTRY glWindowPos4svMESA (const GLshort *v);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLWINDOWPOS2DMESAPROC) (GLdouble x, GLdouble y);
typedef void (APIENTRYP PFNGLWINDOWPOS2DVMESAPROC) (const GLdouble *v);
@@ -6576,8 +8954,8 @@ typedef void (APIENTRYP PFNGLWINDOWPOS4SVMESAPROC) (const GLshort *v);
#ifndef GL_IBM_multimode_draw_arrays
#define GL_IBM_multimode_draw_arrays 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glMultiModeDrawArraysIBM (const GLenum *, const GLint *, const GLsizei *, GLsizei, GLint);
-GLAPI void APIENTRY glMultiModeDrawElementsIBM (const GLenum *, const GLsizei *, GLenum, const GLvoid* const *, GLsizei, GLint);
+GLAPI void APIENTRY glMultiModeDrawArraysIBM (const GLenum *mode, const GLint *first, const GLsizei *count, GLsizei primcount, GLint modestride);
+GLAPI void APIENTRY glMultiModeDrawElementsIBM (const GLenum *mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei primcount, GLint modestride);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLMULTIMODEDRAWARRAYSIBMPROC) (const GLenum *mode, const GLint *first, const GLsizei *count, GLsizei primcount, GLint modestride);
typedef void (APIENTRYP PFNGLMULTIMODEDRAWELEMENTSIBMPROC) (const GLenum *mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei primcount, GLint modestride);
@@ -6586,14 +8964,14 @@ typedef void (APIENTRYP PFNGLMULTIMODEDRAWELEMENTSIBMPROC) (const GLenum *mode,
#ifndef GL_IBM_vertex_array_lists
#define GL_IBM_vertex_array_lists 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glColorPointerListIBM (GLint, GLenum, GLint, const GLvoid* *, GLint);
-GLAPI void APIENTRY glSecondaryColorPointerListIBM (GLint, GLenum, GLint, const GLvoid* *, GLint);
-GLAPI void APIENTRY glEdgeFlagPointerListIBM (GLint, const GLboolean* *, GLint);
-GLAPI void APIENTRY glFogCoordPointerListIBM (GLenum, GLint, const GLvoid* *, GLint);
-GLAPI void APIENTRY glIndexPointerListIBM (GLenum, GLint, const GLvoid* *, GLint);
-GLAPI void APIENTRY glNormalPointerListIBM (GLenum, GLint, const GLvoid* *, GLint);
-GLAPI void APIENTRY glTexCoordPointerListIBM (GLint, GLenum, GLint, const GLvoid* *, GLint);
-GLAPI void APIENTRY glVertexPointerListIBM (GLint, GLenum, GLint, const GLvoid* *, GLint);
+GLAPI void APIENTRY glColorPointerListIBM (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride);
+GLAPI void APIENTRY glSecondaryColorPointerListIBM (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride);
+GLAPI void APIENTRY glEdgeFlagPointerListIBM (GLint stride, const GLboolean* *pointer, GLint ptrstride);
+GLAPI void APIENTRY glFogCoordPointerListIBM (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride);
+GLAPI void APIENTRY glIndexPointerListIBM (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride);
+GLAPI void APIENTRY glNormalPointerListIBM (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride);
+GLAPI void APIENTRY glTexCoordPointerListIBM (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride);
+GLAPI void APIENTRY glVertexPointerListIBM (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLCOLORPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride);
typedef void (APIENTRYP PFNGLSECONDARYCOLORPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride);
@@ -6632,7 +9010,7 @@ typedef void (APIENTRYP PFNGLVERTEXPOINTERLISTIBMPROC) (GLint size, GLenum type,
#ifndef GL_3DFX_tbuffer
#define GL_3DFX_tbuffer 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glTbufferMask3DFX (GLuint);
+GLAPI void APIENTRY glTbufferMask3DFX (GLuint mask);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLTBUFFERMASK3DFXPROC) (GLuint mask);
#endif
@@ -6640,8 +9018,8 @@ typedef void (APIENTRYP PFNGLTBUFFERMASK3DFXPROC) (GLuint mask);
#ifndef GL_EXT_multisample
#define GL_EXT_multisample 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glSampleMaskEXT (GLclampf, GLboolean);
-GLAPI void APIENTRY glSamplePatternEXT (GLenum);
+GLAPI void APIENTRY glSampleMaskEXT (GLclampf value, GLboolean invert);
+GLAPI void APIENTRY glSamplePatternEXT (GLenum pattern);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLSAMPLEMASKEXTPROC) (GLclampf value, GLboolean invert);
typedef void (APIENTRYP PFNGLSAMPLEPATTERNEXTPROC) (GLenum pattern);
@@ -6666,7 +9044,7 @@ typedef void (APIENTRYP PFNGLSAMPLEPATTERNEXTPROC) (GLenum pattern);
#ifndef GL_SGIS_texture_color_mask
#define GL_SGIS_texture_color_mask 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glTextureColorMaskSGIS (GLboolean, GLboolean, GLboolean, GLboolean);
+GLAPI void APIENTRY glTextureColorMaskSGIS (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLTEXTURECOLORMASKSGISPROC) (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
#endif
@@ -6674,7 +9052,7 @@ typedef void (APIENTRYP PFNGLTEXTURECOLORMASKSGISPROC) (GLboolean red, GLboolean
#ifndef GL_SGIX_igloo_interface
#define GL_SGIX_igloo_interface 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glIglooInterfaceSGIX (GLenum, const GLvoid *);
+GLAPI void APIENTRY glIglooInterfaceSGIX (GLenum pname, const GLvoid *params);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLIGLOOINTERFACESGIXPROC) (GLenum pname, const GLvoid *params);
#endif
@@ -6690,13 +9068,13 @@ typedef void (APIENTRYP PFNGLIGLOOINTERFACESGIXPROC) (GLenum pname, const GLvoid
#ifndef GL_NV_fence
#define GL_NV_fence 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glDeleteFencesNV (GLsizei, const GLuint *);
-GLAPI void APIENTRY glGenFencesNV (GLsizei, GLuint *);
-GLAPI GLboolean APIENTRY glIsFenceNV (GLuint);
-GLAPI GLboolean APIENTRY glTestFenceNV (GLuint);
-GLAPI void APIENTRY glGetFenceivNV (GLuint, GLenum, GLint *);
-GLAPI void APIENTRY glFinishFenceNV (GLuint);
-GLAPI void APIENTRY glSetFenceNV (GLuint, GLenum);
+GLAPI void APIENTRY glDeleteFencesNV (GLsizei n, const GLuint *fences);
+GLAPI void APIENTRY glGenFencesNV (GLsizei n, GLuint *fences);
+GLAPI GLboolean APIENTRY glIsFenceNV (GLuint fence);
+GLAPI GLboolean APIENTRY glTestFenceNV (GLuint fence);
+GLAPI void APIENTRY glGetFenceivNV (GLuint fence, GLenum pname, GLint *params);
+GLAPI void APIENTRY glFinishFenceNV (GLuint fence);
+GLAPI void APIENTRY glSetFenceNV (GLuint fence, GLenum condition);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLDELETEFENCESNVPROC) (GLsizei n, const GLuint *fences);
typedef void (APIENTRYP PFNGLGENFENCESNVPROC) (GLsizei n, GLuint *fences);
@@ -6710,15 +9088,15 @@ typedef void (APIENTRYP PFNGLSETFENCENVPROC) (GLuint fence, GLenum condition);
#ifndef GL_NV_evaluators
#define GL_NV_evaluators 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glMapControlPointsNV (GLenum, GLuint, GLenum, GLsizei, GLsizei, GLint, GLint, GLboolean, const GLvoid *);
-GLAPI void APIENTRY glMapParameterivNV (GLenum, GLenum, const GLint *);
-GLAPI void APIENTRY glMapParameterfvNV (GLenum, GLenum, const GLfloat *);
-GLAPI void APIENTRY glGetMapControlPointsNV (GLenum, GLuint, GLenum, GLsizei, GLsizei, GLboolean, GLvoid *);
-GLAPI void APIENTRY glGetMapParameterivNV (GLenum, GLenum, GLint *);
-GLAPI void APIENTRY glGetMapParameterfvNV (GLenum, GLenum, GLfloat *);
-GLAPI void APIENTRY glGetMapAttribParameterivNV (GLenum, GLuint, GLenum, GLint *);
-GLAPI void APIENTRY glGetMapAttribParameterfvNV (GLenum, GLuint, GLenum, GLfloat *);
-GLAPI void APIENTRY glEvalMapsNV (GLenum, GLenum);
+GLAPI void APIENTRY glMapControlPointsNV (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLint uorder, GLint vorder, GLboolean packed, const GLvoid *points);
+GLAPI void APIENTRY glMapParameterivNV (GLenum target, GLenum pname, const GLint *params);
+GLAPI void APIENTRY glMapParameterfvNV (GLenum target, GLenum pname, const GLfloat *params);
+GLAPI void APIENTRY glGetMapControlPointsNV (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLboolean packed, GLvoid *points);
+GLAPI void APIENTRY glGetMapParameterivNV (GLenum target, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetMapParameterfvNV (GLenum target, GLenum pname, GLfloat *params);
+GLAPI void APIENTRY glGetMapAttribParameterivNV (GLenum target, GLuint index, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetMapAttribParameterfvNV (GLenum target, GLuint index, GLenum pname, GLfloat *params);
+GLAPI void APIENTRY glEvalMapsNV (GLenum target, GLenum mode);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLMAPCONTROLPOINTSNVPROC) (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLint uorder, GLint vorder, GLboolean packed, const GLvoid *points);
typedef void (APIENTRYP PFNGLMAPPARAMETERIVNVPROC) (GLenum target, GLenum pname, const GLint *params);
@@ -6738,8 +9116,8 @@ typedef void (APIENTRYP PFNGLEVALMAPSNVPROC) (GLenum target, GLenum mode);
#ifndef GL_NV_register_combiners2
#define GL_NV_register_combiners2 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glCombinerStageParameterfvNV (GLenum, GLenum, const GLfloat *);
-GLAPI void APIENTRY glGetCombinerStageParameterfvNV (GLenum, GLenum, GLfloat *);
+GLAPI void APIENTRY glCombinerStageParameterfvNV (GLenum stage, GLenum pname, const GLfloat *params);
+GLAPI void APIENTRY glGetCombinerStageParameterfvNV (GLenum stage, GLenum pname, GLfloat *params);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLCOMBINERSTAGEPARAMETERFVNVPROC) (GLenum stage, GLenum pname, const GLfloat *params);
typedef void (APIENTRYP PFNGLGETCOMBINERSTAGEPARAMETERFVNVPROC) (GLenum stage, GLenum pname, GLfloat *params);
@@ -6768,70 +9146,70 @@ typedef void (APIENTRYP PFNGLGETCOMBINERSTAGEPARAMETERFVNVPROC) (GLenum stage, G
#ifndef GL_NV_vertex_program
#define GL_NV_vertex_program 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI GLboolean APIENTRY glAreProgramsResidentNV (GLsizei, const GLuint *, GLboolean *);
-GLAPI void APIENTRY glBindProgramNV (GLenum, GLuint);
-GLAPI void APIENTRY glDeleteProgramsNV (GLsizei, const GLuint *);
-GLAPI void APIENTRY glExecuteProgramNV (GLenum, GLuint, const GLfloat *);
-GLAPI void APIENTRY glGenProgramsNV (GLsizei, GLuint *);
-GLAPI void APIENTRY glGetProgramParameterdvNV (GLenum, GLuint, GLenum, GLdouble *);
-GLAPI void APIENTRY glGetProgramParameterfvNV (GLenum, GLuint, GLenum, GLfloat *);
-GLAPI void APIENTRY glGetProgramivNV (GLuint, GLenum, GLint *);
-GLAPI void APIENTRY glGetProgramStringNV (GLuint, GLenum, GLubyte *);
-GLAPI void APIENTRY glGetTrackMatrixivNV (GLenum, GLuint, GLenum, GLint *);
-GLAPI void APIENTRY glGetVertexAttribdvNV (GLuint, GLenum, GLdouble *);
-GLAPI void APIENTRY glGetVertexAttribfvNV (GLuint, GLenum, GLfloat *);
-GLAPI void APIENTRY glGetVertexAttribivNV (GLuint, GLenum, GLint *);
-GLAPI void APIENTRY glGetVertexAttribPointervNV (GLuint, GLenum, GLvoid* *);
-GLAPI GLboolean APIENTRY glIsProgramNV (GLuint);
-GLAPI void APIENTRY glLoadProgramNV (GLenum, GLuint, GLsizei, const GLubyte *);
-GLAPI void APIENTRY glProgramParameter4dNV (GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble);
-GLAPI void APIENTRY glProgramParameter4dvNV (GLenum, GLuint, const GLdouble *);
-GLAPI void APIENTRY glProgramParameter4fNV (GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glProgramParameter4fvNV (GLenum, GLuint, const GLfloat *);
-GLAPI void APIENTRY glProgramParameters4dvNV (GLenum, GLuint, GLuint, const GLdouble *);
-GLAPI void APIENTRY glProgramParameters4fvNV (GLenum, GLuint, GLuint, const GLfloat *);
-GLAPI void APIENTRY glRequestResidentProgramsNV (GLsizei, const GLuint *);
-GLAPI void APIENTRY glTrackMatrixNV (GLenum, GLuint, GLenum, GLenum);
-GLAPI void APIENTRY glVertexAttribPointerNV (GLuint, GLint, GLenum, GLsizei, const GLvoid *);
-GLAPI void APIENTRY glVertexAttrib1dNV (GLuint, GLdouble);
-GLAPI void APIENTRY glVertexAttrib1dvNV (GLuint, const GLdouble *);
-GLAPI void APIENTRY glVertexAttrib1fNV (GLuint, GLfloat);
-GLAPI void APIENTRY glVertexAttrib1fvNV (GLuint, const GLfloat *);
-GLAPI void APIENTRY glVertexAttrib1sNV (GLuint, GLshort);
-GLAPI void APIENTRY glVertexAttrib1svNV (GLuint, const GLshort *);
-GLAPI void APIENTRY glVertexAttrib2dNV (GLuint, GLdouble, GLdouble);
-GLAPI void APIENTRY glVertexAttrib2dvNV (GLuint, const GLdouble *);
-GLAPI void APIENTRY glVertexAttrib2fNV (GLuint, GLfloat, GLfloat);
-GLAPI void APIENTRY glVertexAttrib2fvNV (GLuint, const GLfloat *);
-GLAPI void APIENTRY glVertexAttrib2sNV (GLuint, GLshort, GLshort);
-GLAPI void APIENTRY glVertexAttrib2svNV (GLuint, const GLshort *);
-GLAPI void APIENTRY glVertexAttrib3dNV (GLuint, GLdouble, GLdouble, GLdouble);
-GLAPI void APIENTRY glVertexAttrib3dvNV (GLuint, const GLdouble *);
-GLAPI void APIENTRY glVertexAttrib3fNV (GLuint, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glVertexAttrib3fvNV (GLuint, const GLfloat *);
-GLAPI void APIENTRY glVertexAttrib3sNV (GLuint, GLshort, GLshort, GLshort);
-GLAPI void APIENTRY glVertexAttrib3svNV (GLuint, const GLshort *);
-GLAPI void APIENTRY glVertexAttrib4dNV (GLuint, GLdouble, GLdouble, GLdouble, GLdouble);
-GLAPI void APIENTRY glVertexAttrib4dvNV (GLuint, const GLdouble *);
-GLAPI void APIENTRY glVertexAttrib4fNV (GLuint, GLfloat, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glVertexAttrib4fvNV (GLuint, const GLfloat *);
-GLAPI void APIENTRY glVertexAttrib4sNV (GLuint, GLshort, GLshort, GLshort, GLshort);
-GLAPI void APIENTRY glVertexAttrib4svNV (GLuint, const GLshort *);
-GLAPI void APIENTRY glVertexAttrib4ubNV (GLuint, GLubyte, GLubyte, GLubyte, GLubyte);
-GLAPI void APIENTRY glVertexAttrib4ubvNV (GLuint, const GLubyte *);
-GLAPI void APIENTRY glVertexAttribs1dvNV (GLuint, GLsizei, const GLdouble *);
-GLAPI void APIENTRY glVertexAttribs1fvNV (GLuint, GLsizei, const GLfloat *);
-GLAPI void APIENTRY glVertexAttribs1svNV (GLuint, GLsizei, const GLshort *);
-GLAPI void APIENTRY glVertexAttribs2dvNV (GLuint, GLsizei, const GLdouble *);
-GLAPI void APIENTRY glVertexAttribs2fvNV (GLuint, GLsizei, const GLfloat *);
-GLAPI void APIENTRY glVertexAttribs2svNV (GLuint, GLsizei, const GLshort *);
-GLAPI void APIENTRY glVertexAttribs3dvNV (GLuint, GLsizei, const GLdouble *);
-GLAPI void APIENTRY glVertexAttribs3fvNV (GLuint, GLsizei, const GLfloat *);
-GLAPI void APIENTRY glVertexAttribs3svNV (GLuint, GLsizei, const GLshort *);
-GLAPI void APIENTRY glVertexAttribs4dvNV (GLuint, GLsizei, const GLdouble *);
-GLAPI void APIENTRY glVertexAttribs4fvNV (GLuint, GLsizei, const GLfloat *);
-GLAPI void APIENTRY glVertexAttribs4svNV (GLuint, GLsizei, const GLshort *);
-GLAPI void APIENTRY glVertexAttribs4ubvNV (GLuint, GLsizei, const GLubyte *);
+GLAPI GLboolean APIENTRY glAreProgramsResidentNV (GLsizei n, const GLuint *programs, GLboolean *residences);
+GLAPI void APIENTRY glBindProgramNV (GLenum target, GLuint id);
+GLAPI void APIENTRY glDeleteProgramsNV (GLsizei n, const GLuint *programs);
+GLAPI void APIENTRY glExecuteProgramNV (GLenum target, GLuint id, const GLfloat *params);
+GLAPI void APIENTRY glGenProgramsNV (GLsizei n, GLuint *programs);
+GLAPI void APIENTRY glGetProgramParameterdvNV (GLenum target, GLuint index, GLenum pname, GLdouble *params);
+GLAPI void APIENTRY glGetProgramParameterfvNV (GLenum target, GLuint index, GLenum pname, GLfloat *params);
+GLAPI void APIENTRY glGetProgramivNV (GLuint id, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetProgramStringNV (GLuint id, GLenum pname, GLubyte *program);
+GLAPI void APIENTRY glGetTrackMatrixivNV (GLenum target, GLuint address, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetVertexAttribdvNV (GLuint index, GLenum pname, GLdouble *params);
+GLAPI void APIENTRY glGetVertexAttribfvNV (GLuint index, GLenum pname, GLfloat *params);
+GLAPI void APIENTRY glGetVertexAttribivNV (GLuint index, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetVertexAttribPointervNV (GLuint index, GLenum pname, GLvoid* *pointer);
+GLAPI GLboolean APIENTRY glIsProgramNV (GLuint id);
+GLAPI void APIENTRY glLoadProgramNV (GLenum target, GLuint id, GLsizei len, const GLubyte *program);
+GLAPI void APIENTRY glProgramParameter4dNV (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+GLAPI void APIENTRY glProgramParameter4dvNV (GLenum target, GLuint index, const GLdouble *v);
+GLAPI void APIENTRY glProgramParameter4fNV (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+GLAPI void APIENTRY glProgramParameter4fvNV (GLenum target, GLuint index, const GLfloat *v);
+GLAPI void APIENTRY glProgramParameters4dvNV (GLenum target, GLuint index, GLsizei count, const GLdouble *v);
+GLAPI void APIENTRY glProgramParameters4fvNV (GLenum target, GLuint index, GLsizei count, const GLfloat *v);
+GLAPI void APIENTRY glRequestResidentProgramsNV (GLsizei n, const GLuint *programs);
+GLAPI void APIENTRY glTrackMatrixNV (GLenum target, GLuint address, GLenum matrix, GLenum transform);
+GLAPI void APIENTRY glVertexAttribPointerNV (GLuint index, GLint fsize, GLenum type, GLsizei stride, const GLvoid *pointer);
+GLAPI void APIENTRY glVertexAttrib1dNV (GLuint index, GLdouble x);
+GLAPI void APIENTRY glVertexAttrib1dvNV (GLuint index, const GLdouble *v);
+GLAPI void APIENTRY glVertexAttrib1fNV (GLuint index, GLfloat x);
+GLAPI void APIENTRY glVertexAttrib1fvNV (GLuint index, const GLfloat *v);
+GLAPI void APIENTRY glVertexAttrib1sNV (GLuint index, GLshort x);
+GLAPI void APIENTRY glVertexAttrib1svNV (GLuint index, const GLshort *v);
+GLAPI void APIENTRY glVertexAttrib2dNV (GLuint index, GLdouble x, GLdouble y);
+GLAPI void APIENTRY glVertexAttrib2dvNV (GLuint index, const GLdouble *v);
+GLAPI void APIENTRY glVertexAttrib2fNV (GLuint index, GLfloat x, GLfloat y);
+GLAPI void APIENTRY glVertexAttrib2fvNV (GLuint index, const GLfloat *v);
+GLAPI void APIENTRY glVertexAttrib2sNV (GLuint index, GLshort x, GLshort y);
+GLAPI void APIENTRY glVertexAttrib2svNV (GLuint index, const GLshort *v);
+GLAPI void APIENTRY glVertexAttrib3dNV (GLuint index, GLdouble x, GLdouble y, GLdouble z);
+GLAPI void APIENTRY glVertexAttrib3dvNV (GLuint index, const GLdouble *v);
+GLAPI void APIENTRY glVertexAttrib3fNV (GLuint index, GLfloat x, GLfloat y, GLfloat z);
+GLAPI void APIENTRY glVertexAttrib3fvNV (GLuint index, const GLfloat *v);
+GLAPI void APIENTRY glVertexAttrib3sNV (GLuint index, GLshort x, GLshort y, GLshort z);
+GLAPI void APIENTRY glVertexAttrib3svNV (GLuint index, const GLshort *v);
+GLAPI void APIENTRY glVertexAttrib4dNV (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+GLAPI void APIENTRY glVertexAttrib4dvNV (GLuint index, const GLdouble *v);
+GLAPI void APIENTRY glVertexAttrib4fNV (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+GLAPI void APIENTRY glVertexAttrib4fvNV (GLuint index, const GLfloat *v);
+GLAPI void APIENTRY glVertexAttrib4sNV (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);
+GLAPI void APIENTRY glVertexAttrib4svNV (GLuint index, const GLshort *v);
+GLAPI void APIENTRY glVertexAttrib4ubNV (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);
+GLAPI void APIENTRY glVertexAttrib4ubvNV (GLuint index, const GLubyte *v);
+GLAPI void APIENTRY glVertexAttribs1dvNV (GLuint index, GLsizei count, const GLdouble *v);
+GLAPI void APIENTRY glVertexAttribs1fvNV (GLuint index, GLsizei count, const GLfloat *v);
+GLAPI void APIENTRY glVertexAttribs1svNV (GLuint index, GLsizei count, const GLshort *v);
+GLAPI void APIENTRY glVertexAttribs2dvNV (GLuint index, GLsizei count, const GLdouble *v);
+GLAPI void APIENTRY glVertexAttribs2fvNV (GLuint index, GLsizei count, const GLfloat *v);
+GLAPI void APIENTRY glVertexAttribs2svNV (GLuint index, GLsizei count, const GLshort *v);
+GLAPI void APIENTRY glVertexAttribs3dvNV (GLuint index, GLsizei count, const GLdouble *v);
+GLAPI void APIENTRY glVertexAttribs3fvNV (GLuint index, GLsizei count, const GLfloat *v);
+GLAPI void APIENTRY glVertexAttribs3svNV (GLuint index, GLsizei count, const GLshort *v);
+GLAPI void APIENTRY glVertexAttribs4dvNV (GLuint index, GLsizei count, const GLdouble *v);
+GLAPI void APIENTRY glVertexAttribs4fvNV (GLuint index, GLsizei count, const GLfloat *v);
+GLAPI void APIENTRY glVertexAttribs4svNV (GLuint index, GLsizei count, const GLshort *v);
+GLAPI void APIENTRY glVertexAttribs4ubvNV (GLuint index, GLsizei count, const GLubyte *v);
#endif /* GL_GLEXT_PROTOTYPES */
typedef GLboolean (APIENTRYP PFNGLAREPROGRAMSRESIDENTNVPROC) (GLsizei n, const GLuint *programs, GLboolean *residences);
typedef void (APIENTRYP PFNGLBINDPROGRAMNVPROC) (GLenum target, GLuint id);
@@ -6853,8 +9231,8 @@ typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4DNVPROC) (GLenum target, GLuint in
typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4DVNVPROC) (GLenum target, GLuint index, const GLdouble *v);
typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4FNVPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4FVNVPROC) (GLenum target, GLuint index, const GLfloat *v);
-typedef void (APIENTRYP PFNGLPROGRAMPARAMETERS4DVNVPROC) (GLenum target, GLuint index, GLuint count, const GLdouble *v);
-typedef void (APIENTRYP PFNGLPROGRAMPARAMETERS4FVNVPROC) (GLenum target, GLuint index, GLuint count, const GLfloat *v);
+typedef void (APIENTRYP PFNGLPROGRAMPARAMETERS4DVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLdouble *v);
+typedef void (APIENTRYP PFNGLPROGRAMPARAMETERS4FVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLfloat *v);
typedef void (APIENTRYP PFNGLREQUESTRESIDENTPROGRAMSNVPROC) (GLsizei n, const GLuint *programs);
typedef void (APIENTRYP PFNGLTRACKMATRIXNVPROC) (GLenum target, GLuint address, GLenum matrix, GLenum transform);
typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERNVPROC) (GLuint index, GLint fsize, GLenum type, GLsizei stride, const GLvoid *pointer);
@@ -6926,10 +9304,10 @@ typedef void (APIENTRYP PFNGLVERTEXATTRIBS4UBVNVPROC) (GLuint index, GLsizei cou
#ifndef GL_ATI_envmap_bumpmap
#define GL_ATI_envmap_bumpmap 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glTexBumpParameterivATI (GLenum, const GLint *);
-GLAPI void APIENTRY glTexBumpParameterfvATI (GLenum, const GLfloat *);
-GLAPI void APIENTRY glGetTexBumpParameterivATI (GLenum, GLint *);
-GLAPI void APIENTRY glGetTexBumpParameterfvATI (GLenum, GLfloat *);
+GLAPI void APIENTRY glTexBumpParameterivATI (GLenum pname, const GLint *param);
+GLAPI void APIENTRY glTexBumpParameterfvATI (GLenum pname, const GLfloat *param);
+GLAPI void APIENTRY glGetTexBumpParameterivATI (GLenum pname, GLint *param);
+GLAPI void APIENTRY glGetTexBumpParameterfvATI (GLenum pname, GLfloat *param);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLTEXBUMPPARAMETERIVATIPROC) (GLenum pname, const GLint *param);
typedef void (APIENTRYP PFNGLTEXBUMPPARAMETERFVATIPROC) (GLenum pname, const GLfloat *param);
@@ -6940,20 +9318,20 @@ typedef void (APIENTRYP PFNGLGETTEXBUMPPARAMETERFVATIPROC) (GLenum pname, GLfloa
#ifndef GL_ATI_fragment_shader
#define GL_ATI_fragment_shader 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI GLuint APIENTRY glGenFragmentShadersATI (GLuint);
-GLAPI void APIENTRY glBindFragmentShaderATI (GLuint);
-GLAPI void APIENTRY glDeleteFragmentShaderATI (GLuint);
+GLAPI GLuint APIENTRY glGenFragmentShadersATI (GLuint range);
+GLAPI void APIENTRY glBindFragmentShaderATI (GLuint id);
+GLAPI void APIENTRY glDeleteFragmentShaderATI (GLuint id);
GLAPI void APIENTRY glBeginFragmentShaderATI (void);
GLAPI void APIENTRY glEndFragmentShaderATI (void);
-GLAPI void APIENTRY glPassTexCoordATI (GLuint, GLuint, GLenum);
-GLAPI void APIENTRY glSampleMapATI (GLuint, GLuint, GLenum);
-GLAPI void APIENTRY glColorFragmentOp1ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint);
-GLAPI void APIENTRY glColorFragmentOp2ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint);
-GLAPI void APIENTRY glColorFragmentOp3ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint);
-GLAPI void APIENTRY glAlphaFragmentOp1ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint);
-GLAPI void APIENTRY glAlphaFragmentOp2ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint);
-GLAPI void APIENTRY glAlphaFragmentOp3ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint);
-GLAPI void APIENTRY glSetFragmentShaderConstantATI (GLuint, const GLfloat *);
+GLAPI void APIENTRY glPassTexCoordATI (GLuint dst, GLuint coord, GLenum swizzle);
+GLAPI void APIENTRY glSampleMapATI (GLuint dst, GLuint interp, GLenum swizzle);
+GLAPI void APIENTRY glColorFragmentOp1ATI (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod);
+GLAPI void APIENTRY glColorFragmentOp2ATI (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod);
+GLAPI void APIENTRY glColorFragmentOp3ATI (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod);
+GLAPI void APIENTRY glAlphaFragmentOp1ATI (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod);
+GLAPI void APIENTRY glAlphaFragmentOp2ATI (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod);
+GLAPI void APIENTRY glAlphaFragmentOp3ATI (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod);
+GLAPI void APIENTRY glSetFragmentShaderConstantATI (GLuint dst, const GLfloat *value);
#endif /* GL_GLEXT_PROTOTYPES */
typedef GLuint (APIENTRYP PFNGLGENFRAGMENTSHADERSATIPROC) (GLuint range);
typedef void (APIENTRYP PFNGLBINDFRAGMENTSHADERATIPROC) (GLuint id);
@@ -6974,8 +9352,8 @@ typedef void (APIENTRYP PFNGLSETFRAGMENTSHADERCONSTANTATIPROC) (GLuint dst, cons
#ifndef GL_ATI_pn_triangles
#define GL_ATI_pn_triangles 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glPNTrianglesiATI (GLenum, GLint);
-GLAPI void APIENTRY glPNTrianglesfATI (GLenum, GLfloat);
+GLAPI void APIENTRY glPNTrianglesiATI (GLenum pname, GLint param);
+GLAPI void APIENTRY glPNTrianglesfATI (GLenum pname, GLfloat param);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLPNTRIANGLESIATIPROC) (GLenum pname, GLint param);
typedef void (APIENTRYP PFNGLPNTRIANGLESFATIPROC) (GLenum pname, GLfloat param);
@@ -6984,18 +9362,18 @@ typedef void (APIENTRYP PFNGLPNTRIANGLESFATIPROC) (GLenum pname, GLfloat param);
#ifndef GL_ATI_vertex_array_object
#define GL_ATI_vertex_array_object 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI GLuint APIENTRY glNewObjectBufferATI (GLsizei, const GLvoid *, GLenum);
-GLAPI GLboolean APIENTRY glIsObjectBufferATI (GLuint);
-GLAPI void APIENTRY glUpdateObjectBufferATI (GLuint, GLuint, GLsizei, const GLvoid *, GLenum);
-GLAPI void APIENTRY glGetObjectBufferfvATI (GLuint, GLenum, GLfloat *);
-GLAPI void APIENTRY glGetObjectBufferivATI (GLuint, GLenum, GLint *);
-GLAPI void APIENTRY glFreeObjectBufferATI (GLuint);
-GLAPI void APIENTRY glArrayObjectATI (GLenum, GLint, GLenum, GLsizei, GLuint, GLuint);
-GLAPI void APIENTRY glGetArrayObjectfvATI (GLenum, GLenum, GLfloat *);
-GLAPI void APIENTRY glGetArrayObjectivATI (GLenum, GLenum, GLint *);
-GLAPI void APIENTRY glVariantArrayObjectATI (GLuint, GLenum, GLsizei, GLuint, GLuint);
-GLAPI void APIENTRY glGetVariantArrayObjectfvATI (GLuint, GLenum, GLfloat *);
-GLAPI void APIENTRY glGetVariantArrayObjectivATI (GLuint, GLenum, GLint *);
+GLAPI GLuint APIENTRY glNewObjectBufferATI (GLsizei size, const GLvoid *pointer, GLenum usage);
+GLAPI GLboolean APIENTRY glIsObjectBufferATI (GLuint buffer);
+GLAPI void APIENTRY glUpdateObjectBufferATI (GLuint buffer, GLuint offset, GLsizei size, const GLvoid *pointer, GLenum preserve);
+GLAPI void APIENTRY glGetObjectBufferfvATI (GLuint buffer, GLenum pname, GLfloat *params);
+GLAPI void APIENTRY glGetObjectBufferivATI (GLuint buffer, GLenum pname, GLint *params);
+GLAPI void APIENTRY glFreeObjectBufferATI (GLuint buffer);
+GLAPI void APIENTRY glArrayObjectATI (GLenum array, GLint size, GLenum type, GLsizei stride, GLuint buffer, GLuint offset);
+GLAPI void APIENTRY glGetArrayObjectfvATI (GLenum array, GLenum pname, GLfloat *params);
+GLAPI void APIENTRY glGetArrayObjectivATI (GLenum array, GLenum pname, GLint *params);
+GLAPI void APIENTRY glVariantArrayObjectATI (GLuint id, GLenum type, GLsizei stride, GLuint buffer, GLuint offset);
+GLAPI void APIENTRY glGetVariantArrayObjectfvATI (GLuint id, GLenum pname, GLfloat *params);
+GLAPI void APIENTRY glGetVariantArrayObjectivATI (GLuint id, GLenum pname, GLint *params);
#endif /* GL_GLEXT_PROTOTYPES */
typedef GLuint (APIENTRYP PFNGLNEWOBJECTBUFFERATIPROC) (GLsizei size, const GLvoid *pointer, GLenum usage);
typedef GLboolean (APIENTRYP PFNGLISOBJECTBUFFERATIPROC) (GLuint buffer);
@@ -7016,46 +9394,46 @@ typedef void (APIENTRYP PFNGLGETVARIANTARRAYOBJECTIVATIPROC) (GLuint id, GLenum
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glBeginVertexShaderEXT (void);
GLAPI void APIENTRY glEndVertexShaderEXT (void);
-GLAPI void APIENTRY glBindVertexShaderEXT (GLuint);
-GLAPI GLuint APIENTRY glGenVertexShadersEXT (GLuint);
-GLAPI void APIENTRY glDeleteVertexShaderEXT (GLuint);
-GLAPI void APIENTRY glShaderOp1EXT (GLenum, GLuint, GLuint);
-GLAPI void APIENTRY glShaderOp2EXT (GLenum, GLuint, GLuint, GLuint);
-GLAPI void APIENTRY glShaderOp3EXT (GLenum, GLuint, GLuint, GLuint, GLuint);
-GLAPI void APIENTRY glSwizzleEXT (GLuint, GLuint, GLenum, GLenum, GLenum, GLenum);
-GLAPI void APIENTRY glWriteMaskEXT (GLuint, GLuint, GLenum, GLenum, GLenum, GLenum);
-GLAPI void APIENTRY glInsertComponentEXT (GLuint, GLuint, GLuint);
-GLAPI void APIENTRY glExtractComponentEXT (GLuint, GLuint, GLuint);
-GLAPI GLuint APIENTRY glGenSymbolsEXT (GLenum, GLenum, GLenum, GLuint);
-GLAPI void APIENTRY glSetInvariantEXT (GLuint, GLenum, const GLvoid *);
-GLAPI void APIENTRY glSetLocalConstantEXT (GLuint, GLenum, const GLvoid *);
-GLAPI void APIENTRY glVariantbvEXT (GLuint, const GLbyte *);
-GLAPI void APIENTRY glVariantsvEXT (GLuint, const GLshort *);
-GLAPI void APIENTRY glVariantivEXT (GLuint, const GLint *);
-GLAPI void APIENTRY glVariantfvEXT (GLuint, const GLfloat *);
-GLAPI void APIENTRY glVariantdvEXT (GLuint, const GLdouble *);
-GLAPI void APIENTRY glVariantubvEXT (GLuint, const GLubyte *);
-GLAPI void APIENTRY glVariantusvEXT (GLuint, const GLushort *);
-GLAPI void APIENTRY glVariantuivEXT (GLuint, const GLuint *);
-GLAPI void APIENTRY glVariantPointerEXT (GLuint, GLenum, GLuint, const GLvoid *);
-GLAPI void APIENTRY glEnableVariantClientStateEXT (GLuint);
-GLAPI void APIENTRY glDisableVariantClientStateEXT (GLuint);
-GLAPI GLuint APIENTRY glBindLightParameterEXT (GLenum, GLenum);
-GLAPI GLuint APIENTRY glBindMaterialParameterEXT (GLenum, GLenum);
-GLAPI GLuint APIENTRY glBindTexGenParameterEXT (GLenum, GLenum, GLenum);
-GLAPI GLuint APIENTRY glBindTextureUnitParameterEXT (GLenum, GLenum);
-GLAPI GLuint APIENTRY glBindParameterEXT (GLenum);
-GLAPI GLboolean APIENTRY glIsVariantEnabledEXT (GLuint, GLenum);
-GLAPI void APIENTRY glGetVariantBooleanvEXT (GLuint, GLenum, GLboolean *);
-GLAPI void APIENTRY glGetVariantIntegervEXT (GLuint, GLenum, GLint *);
-GLAPI void APIENTRY glGetVariantFloatvEXT (GLuint, GLenum, GLfloat *);
-GLAPI void APIENTRY glGetVariantPointervEXT (GLuint, GLenum, GLvoid* *);
-GLAPI void APIENTRY glGetInvariantBooleanvEXT (GLuint, GLenum, GLboolean *);
-GLAPI void APIENTRY glGetInvariantIntegervEXT (GLuint, GLenum, GLint *);
-GLAPI void APIENTRY glGetInvariantFloatvEXT (GLuint, GLenum, GLfloat *);
-GLAPI void APIENTRY glGetLocalConstantBooleanvEXT (GLuint, GLenum, GLboolean *);
-GLAPI void APIENTRY glGetLocalConstantIntegervEXT (GLuint, GLenum, GLint *);
-GLAPI void APIENTRY glGetLocalConstantFloatvEXT (GLuint, GLenum, GLfloat *);
+GLAPI void APIENTRY glBindVertexShaderEXT (GLuint id);
+GLAPI GLuint APIENTRY glGenVertexShadersEXT (GLuint range);
+GLAPI void APIENTRY glDeleteVertexShaderEXT (GLuint id);
+GLAPI void APIENTRY glShaderOp1EXT (GLenum op, GLuint res, GLuint arg1);
+GLAPI void APIENTRY glShaderOp2EXT (GLenum op, GLuint res, GLuint arg1, GLuint arg2);
+GLAPI void APIENTRY glShaderOp3EXT (GLenum op, GLuint res, GLuint arg1, GLuint arg2, GLuint arg3);
+GLAPI void APIENTRY glSwizzleEXT (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW);
+GLAPI void APIENTRY glWriteMaskEXT (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW);
+GLAPI void APIENTRY glInsertComponentEXT (GLuint res, GLuint src, GLuint num);
+GLAPI void APIENTRY glExtractComponentEXT (GLuint res, GLuint src, GLuint num);
+GLAPI GLuint APIENTRY glGenSymbolsEXT (GLenum datatype, GLenum storagetype, GLenum range, GLuint components);
+GLAPI void APIENTRY glSetInvariantEXT (GLuint id, GLenum type, const GLvoid *addr);
+GLAPI void APIENTRY glSetLocalConstantEXT (GLuint id, GLenum type, const GLvoid *addr);
+GLAPI void APIENTRY glVariantbvEXT (GLuint id, const GLbyte *addr);
+GLAPI void APIENTRY glVariantsvEXT (GLuint id, const GLshort *addr);
+GLAPI void APIENTRY glVariantivEXT (GLuint id, const GLint *addr);
+GLAPI void APIENTRY glVariantfvEXT (GLuint id, const GLfloat *addr);
+GLAPI void APIENTRY glVariantdvEXT (GLuint id, const GLdouble *addr);
+GLAPI void APIENTRY glVariantubvEXT (GLuint id, const GLubyte *addr);
+GLAPI void APIENTRY glVariantusvEXT (GLuint id, const GLushort *addr);
+GLAPI void APIENTRY glVariantuivEXT (GLuint id, const GLuint *addr);
+GLAPI void APIENTRY glVariantPointerEXT (GLuint id, GLenum type, GLuint stride, const GLvoid *addr);
+GLAPI void APIENTRY glEnableVariantClientStateEXT (GLuint id);
+GLAPI void APIENTRY glDisableVariantClientStateEXT (GLuint id);
+GLAPI GLuint APIENTRY glBindLightParameterEXT (GLenum light, GLenum value);
+GLAPI GLuint APIENTRY glBindMaterialParameterEXT (GLenum face, GLenum value);
+GLAPI GLuint APIENTRY glBindTexGenParameterEXT (GLenum unit, GLenum coord, GLenum value);
+GLAPI GLuint APIENTRY glBindTextureUnitParameterEXT (GLenum unit, GLenum value);
+GLAPI GLuint APIENTRY glBindParameterEXT (GLenum value);
+GLAPI GLboolean APIENTRY glIsVariantEnabledEXT (GLuint id, GLenum cap);
+GLAPI void APIENTRY glGetVariantBooleanvEXT (GLuint id, GLenum value, GLboolean *data);
+GLAPI void APIENTRY glGetVariantIntegervEXT (GLuint id, GLenum value, GLint *data);
+GLAPI void APIENTRY glGetVariantFloatvEXT (GLuint id, GLenum value, GLfloat *data);
+GLAPI void APIENTRY glGetVariantPointervEXT (GLuint id, GLenum value, GLvoid* *data);
+GLAPI void APIENTRY glGetInvariantBooleanvEXT (GLuint id, GLenum value, GLboolean *data);
+GLAPI void APIENTRY glGetInvariantIntegervEXT (GLuint id, GLenum value, GLint *data);
+GLAPI void APIENTRY glGetInvariantFloatvEXT (GLuint id, GLenum value, GLfloat *data);
+GLAPI void APIENTRY glGetLocalConstantBooleanvEXT (GLuint id, GLenum value, GLboolean *data);
+GLAPI void APIENTRY glGetLocalConstantIntegervEXT (GLuint id, GLenum value, GLint *data);
+GLAPI void APIENTRY glGetLocalConstantFloatvEXT (GLuint id, GLenum value, GLfloat *data);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLBEGINVERTEXSHADEREXTPROC) (void);
typedef void (APIENTRYP PFNGLENDVERTEXSHADEREXTPROC) (void);
@@ -7104,51 +9482,51 @@ typedef void (APIENTRYP PFNGLGETLOCALCONSTANTFLOATVEXTPROC) (GLuint id, GLenum v
#ifndef GL_ATI_vertex_streams
#define GL_ATI_vertex_streams 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glVertexStream1sATI (GLenum, GLshort);
-GLAPI void APIENTRY glVertexStream1svATI (GLenum, const GLshort *);
-GLAPI void APIENTRY glVertexStream1iATI (GLenum, GLint);
-GLAPI void APIENTRY glVertexStream1ivATI (GLenum, const GLint *);
-GLAPI void APIENTRY glVertexStream1fATI (GLenum, GLfloat);
-GLAPI void APIENTRY glVertexStream1fvATI (GLenum, const GLfloat *);
-GLAPI void APIENTRY glVertexStream1dATI (GLenum, GLdouble);
-GLAPI void APIENTRY glVertexStream1dvATI (GLenum, const GLdouble *);
-GLAPI void APIENTRY glVertexStream2sATI (GLenum, GLshort, GLshort);
-GLAPI void APIENTRY glVertexStream2svATI (GLenum, const GLshort *);
-GLAPI void APIENTRY glVertexStream2iATI (GLenum, GLint, GLint);
-GLAPI void APIENTRY glVertexStream2ivATI (GLenum, const GLint *);
-GLAPI void APIENTRY glVertexStream2fATI (GLenum, GLfloat, GLfloat);
-GLAPI void APIENTRY glVertexStream2fvATI (GLenum, const GLfloat *);
-GLAPI void APIENTRY glVertexStream2dATI (GLenum, GLdouble, GLdouble);
-GLAPI void APIENTRY glVertexStream2dvATI (GLenum, const GLdouble *);
-GLAPI void APIENTRY glVertexStream3sATI (GLenum, GLshort, GLshort, GLshort);
-GLAPI void APIENTRY glVertexStream3svATI (GLenum, const GLshort *);
-GLAPI void APIENTRY glVertexStream3iATI (GLenum, GLint, GLint, GLint);
-GLAPI void APIENTRY glVertexStream3ivATI (GLenum, const GLint *);
-GLAPI void APIENTRY glVertexStream3fATI (GLenum, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glVertexStream3fvATI (GLenum, const GLfloat *);
-GLAPI void APIENTRY glVertexStream3dATI (GLenum, GLdouble, GLdouble, GLdouble);
-GLAPI void APIENTRY glVertexStream3dvATI (GLenum, const GLdouble *);
-GLAPI void APIENTRY glVertexStream4sATI (GLenum, GLshort, GLshort, GLshort, GLshort);
-GLAPI void APIENTRY glVertexStream4svATI (GLenum, const GLshort *);
-GLAPI void APIENTRY glVertexStream4iATI (GLenum, GLint, GLint, GLint, GLint);
-GLAPI void APIENTRY glVertexStream4ivATI (GLenum, const GLint *);
-GLAPI void APIENTRY glVertexStream4fATI (GLenum, GLfloat, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glVertexStream4fvATI (GLenum, const GLfloat *);
-GLAPI void APIENTRY glVertexStream4dATI (GLenum, GLdouble, GLdouble, GLdouble, GLdouble);
-GLAPI void APIENTRY glVertexStream4dvATI (GLenum, const GLdouble *);
-GLAPI void APIENTRY glNormalStream3bATI (GLenum, GLbyte, GLbyte, GLbyte);
-GLAPI void APIENTRY glNormalStream3bvATI (GLenum, const GLbyte *);
-GLAPI void APIENTRY glNormalStream3sATI (GLenum, GLshort, GLshort, GLshort);
-GLAPI void APIENTRY glNormalStream3svATI (GLenum, const GLshort *);
-GLAPI void APIENTRY glNormalStream3iATI (GLenum, GLint, GLint, GLint);
-GLAPI void APIENTRY glNormalStream3ivATI (GLenum, const GLint *);
-GLAPI void APIENTRY glNormalStream3fATI (GLenum, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glNormalStream3fvATI (GLenum, const GLfloat *);
-GLAPI void APIENTRY glNormalStream3dATI (GLenum, GLdouble, GLdouble, GLdouble);
-GLAPI void APIENTRY glNormalStream3dvATI (GLenum, const GLdouble *);
-GLAPI void APIENTRY glClientActiveVertexStreamATI (GLenum);
-GLAPI void APIENTRY glVertexBlendEnviATI (GLenum, GLint);
-GLAPI void APIENTRY glVertexBlendEnvfATI (GLenum, GLfloat);
+GLAPI void APIENTRY glVertexStream1sATI (GLenum stream, GLshort x);
+GLAPI void APIENTRY glVertexStream1svATI (GLenum stream, const GLshort *coords);
+GLAPI void APIENTRY glVertexStream1iATI (GLenum stream, GLint x);
+GLAPI void APIENTRY glVertexStream1ivATI (GLenum stream, const GLint *coords);
+GLAPI void APIENTRY glVertexStream1fATI (GLenum stream, GLfloat x);
+GLAPI void APIENTRY glVertexStream1fvATI (GLenum stream, const GLfloat *coords);
+GLAPI void APIENTRY glVertexStream1dATI (GLenum stream, GLdouble x);
+GLAPI void APIENTRY glVertexStream1dvATI (GLenum stream, const GLdouble *coords);
+GLAPI void APIENTRY glVertexStream2sATI (GLenum stream, GLshort x, GLshort y);
+GLAPI void APIENTRY glVertexStream2svATI (GLenum stream, const GLshort *coords);
+GLAPI void APIENTRY glVertexStream2iATI (GLenum stream, GLint x, GLint y);
+GLAPI void APIENTRY glVertexStream2ivATI (GLenum stream, const GLint *coords);
+GLAPI void APIENTRY glVertexStream2fATI (GLenum stream, GLfloat x, GLfloat y);
+GLAPI void APIENTRY glVertexStream2fvATI (GLenum stream, const GLfloat *coords);
+GLAPI void APIENTRY glVertexStream2dATI (GLenum stream, GLdouble x, GLdouble y);
+GLAPI void APIENTRY glVertexStream2dvATI (GLenum stream, const GLdouble *coords);
+GLAPI void APIENTRY glVertexStream3sATI (GLenum stream, GLshort x, GLshort y, GLshort z);
+GLAPI void APIENTRY glVertexStream3svATI (GLenum stream, const GLshort *coords);
+GLAPI void APIENTRY glVertexStream3iATI (GLenum stream, GLint x, GLint y, GLint z);
+GLAPI void APIENTRY glVertexStream3ivATI (GLenum stream, const GLint *coords);
+GLAPI void APIENTRY glVertexStream3fATI (GLenum stream, GLfloat x, GLfloat y, GLfloat z);
+GLAPI void APIENTRY glVertexStream3fvATI (GLenum stream, const GLfloat *coords);
+GLAPI void APIENTRY glVertexStream3dATI (GLenum stream, GLdouble x, GLdouble y, GLdouble z);
+GLAPI void APIENTRY glVertexStream3dvATI (GLenum stream, const GLdouble *coords);
+GLAPI void APIENTRY glVertexStream4sATI (GLenum stream, GLshort x, GLshort y, GLshort z, GLshort w);
+GLAPI void APIENTRY glVertexStream4svATI (GLenum stream, const GLshort *coords);
+GLAPI void APIENTRY glVertexStream4iATI (GLenum stream, GLint x, GLint y, GLint z, GLint w);
+GLAPI void APIENTRY glVertexStream4ivATI (GLenum stream, const GLint *coords);
+GLAPI void APIENTRY glVertexStream4fATI (GLenum stream, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+GLAPI void APIENTRY glVertexStream4fvATI (GLenum stream, const GLfloat *coords);
+GLAPI void APIENTRY glVertexStream4dATI (GLenum stream, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+GLAPI void APIENTRY glVertexStream4dvATI (GLenum stream, const GLdouble *coords);
+GLAPI void APIENTRY glNormalStream3bATI (GLenum stream, GLbyte nx, GLbyte ny, GLbyte nz);
+GLAPI void APIENTRY glNormalStream3bvATI (GLenum stream, const GLbyte *coords);
+GLAPI void APIENTRY glNormalStream3sATI (GLenum stream, GLshort nx, GLshort ny, GLshort nz);
+GLAPI void APIENTRY glNormalStream3svATI (GLenum stream, const GLshort *coords);
+GLAPI void APIENTRY glNormalStream3iATI (GLenum stream, GLint nx, GLint ny, GLint nz);
+GLAPI void APIENTRY glNormalStream3ivATI (GLenum stream, const GLint *coords);
+GLAPI void APIENTRY glNormalStream3fATI (GLenum stream, GLfloat nx, GLfloat ny, GLfloat nz);
+GLAPI void APIENTRY glNormalStream3fvATI (GLenum stream, const GLfloat *coords);
+GLAPI void APIENTRY glNormalStream3dATI (GLenum stream, GLdouble nx, GLdouble ny, GLdouble nz);
+GLAPI void APIENTRY glNormalStream3dvATI (GLenum stream, const GLdouble *coords);
+GLAPI void APIENTRY glClientActiveVertexStreamATI (GLenum stream);
+GLAPI void APIENTRY glVertexBlendEnviATI (GLenum pname, GLint param);
+GLAPI void APIENTRY glVertexBlendEnvfATI (GLenum pname, GLfloat param);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLVERTEXSTREAM1SATIPROC) (GLenum stream, GLshort x);
typedef void (APIENTRYP PFNGLVERTEXSTREAM1SVATIPROC) (GLenum stream, const GLshort *coords);
@@ -7200,9 +9578,9 @@ typedef void (APIENTRYP PFNGLVERTEXBLENDENVFATIPROC) (GLenum pname, GLfloat para
#ifndef GL_ATI_element_array
#define GL_ATI_element_array 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glElementPointerATI (GLenum, const GLvoid *);
-GLAPI void APIENTRY glDrawElementArrayATI (GLenum, GLsizei);
-GLAPI void APIENTRY glDrawRangeElementArrayATI (GLenum, GLuint, GLuint, GLsizei);
+GLAPI void APIENTRY glElementPointerATI (GLenum type, const GLvoid *pointer);
+GLAPI void APIENTRY glDrawElementArrayATI (GLenum mode, GLsizei count);
+GLAPI void APIENTRY glDrawRangeElementArrayATI (GLenum mode, GLuint start, GLuint end, GLsizei count);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLELEMENTPOINTERATIPROC) (GLenum type, const GLvoid *pointer);
typedef void (APIENTRYP PFNGLDRAWELEMENTARRAYATIPROC) (GLenum mode, GLsizei count);
@@ -7212,7 +9590,7 @@ typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTARRAYATIPROC) (GLenum mode, GLuint
#ifndef GL_SUN_mesh_array
#define GL_SUN_mesh_array 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glDrawMeshArraysSUN (GLenum, GLint, GLsizei, GLsizei);
+GLAPI void APIENTRY glDrawMeshArraysSUN (GLenum mode, GLint first, GLsizei count, GLsizei width);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLDRAWMESHARRAYSSUNPROC) (GLenum mode, GLint first, GLsizei count, GLsizei width);
#endif
@@ -7232,13 +9610,13 @@ typedef void (APIENTRYP PFNGLDRAWMESHARRAYSSUNPROC) (GLenum mode, GLint first, G
#ifndef GL_NV_occlusion_query
#define GL_NV_occlusion_query 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glGenOcclusionQueriesNV (GLsizei, GLuint *);
-GLAPI void APIENTRY glDeleteOcclusionQueriesNV (GLsizei, const GLuint *);
-GLAPI GLboolean APIENTRY glIsOcclusionQueryNV (GLuint);
-GLAPI void APIENTRY glBeginOcclusionQueryNV (GLuint);
+GLAPI void APIENTRY glGenOcclusionQueriesNV (GLsizei n, GLuint *ids);
+GLAPI void APIENTRY glDeleteOcclusionQueriesNV (GLsizei n, const GLuint *ids);
+GLAPI GLboolean APIENTRY glIsOcclusionQueryNV (GLuint id);
+GLAPI void APIENTRY glBeginOcclusionQueryNV (GLuint id);
GLAPI void APIENTRY glEndOcclusionQueryNV (void);
-GLAPI void APIENTRY glGetOcclusionQueryivNV (GLuint, GLenum, GLint *);
-GLAPI void APIENTRY glGetOcclusionQueryuivNV (GLuint, GLenum, GLuint *);
+GLAPI void APIENTRY glGetOcclusionQueryivNV (GLuint id, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetOcclusionQueryuivNV (GLuint id, GLenum pname, GLuint *params);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLGENOCCLUSIONQUERIESNVPROC) (GLsizei n, GLuint *ids);
typedef void (APIENTRYP PFNGLDELETEOCCLUSIONQUERIESNVPROC) (GLsizei n, const GLuint *ids);
@@ -7252,8 +9630,8 @@ typedef void (APIENTRYP PFNGLGETOCCLUSIONQUERYUIVNVPROC) (GLuint id, GLenum pnam
#ifndef GL_NV_point_sprite
#define GL_NV_point_sprite 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glPointParameteriNV (GLenum, GLint);
-GLAPI void APIENTRY glPointParameterivNV (GLenum, const GLint *);
+GLAPI void APIENTRY glPointParameteriNV (GLenum pname, GLint param);
+GLAPI void APIENTRY glPointParameterivNV (GLenum pname, const GLint *params);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLPOINTPARAMETERINVPROC) (GLenum pname, GLint param);
typedef void (APIENTRYP PFNGLPOINTPARAMETERIVNVPROC) (GLenum pname, const GLint *params);
@@ -7274,7 +9652,7 @@ typedef void (APIENTRYP PFNGLPOINTPARAMETERIVNVPROC) (GLenum pname, const GLint
#ifndef GL_EXT_stencil_two_side
#define GL_EXT_stencil_two_side 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glActiveStencilFaceEXT (GLenum);
+GLAPI void APIENTRY glActiveStencilFaceEXT (GLenum face);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLACTIVESTENCILFACEEXTPROC) (GLenum face);
#endif
@@ -7290,11 +9668,11 @@ typedef void (APIENTRYP PFNGLACTIVESTENCILFACEEXTPROC) (GLenum face);
#ifndef GL_APPLE_element_array
#define GL_APPLE_element_array 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glElementPointerAPPLE (GLenum, const GLvoid *);
-GLAPI void APIENTRY glDrawElementArrayAPPLE (GLenum, GLint, GLsizei);
-GLAPI void APIENTRY glDrawRangeElementArrayAPPLE (GLenum, GLuint, GLuint, GLint, GLsizei);
-GLAPI void APIENTRY glMultiDrawElementArrayAPPLE (GLenum, const GLint *, const GLsizei *, GLsizei);
-GLAPI void APIENTRY glMultiDrawRangeElementArrayAPPLE (GLenum, GLuint, GLuint, const GLint *, const GLsizei *, GLsizei);
+GLAPI void APIENTRY glElementPointerAPPLE (GLenum type, const GLvoid *pointer);
+GLAPI void APIENTRY glDrawElementArrayAPPLE (GLenum mode, GLint first, GLsizei count);
+GLAPI void APIENTRY glDrawRangeElementArrayAPPLE (GLenum mode, GLuint start, GLuint end, GLint first, GLsizei count);
+GLAPI void APIENTRY glMultiDrawElementArrayAPPLE (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount);
+GLAPI void APIENTRY glMultiDrawRangeElementArrayAPPLE (GLenum mode, GLuint start, GLuint end, const GLint *first, const GLsizei *count, GLsizei primcount);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLELEMENTPOINTERAPPLEPROC) (GLenum type, const GLvoid *pointer);
typedef void (APIENTRYP PFNGLDRAWELEMENTARRAYAPPLEPROC) (GLenum mode, GLint first, GLsizei count);
@@ -7306,14 +9684,14 @@ typedef void (APIENTRYP PFNGLMULTIDRAWRANGEELEMENTARRAYAPPLEPROC) (GLenum mode,
#ifndef GL_APPLE_fence
#define GL_APPLE_fence 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glGenFencesAPPLE (GLsizei, GLuint *);
-GLAPI void APIENTRY glDeleteFencesAPPLE (GLsizei, const GLuint *);
-GLAPI void APIENTRY glSetFenceAPPLE (GLuint);
-GLAPI GLboolean APIENTRY glIsFenceAPPLE (GLuint);
-GLAPI GLboolean APIENTRY glTestFenceAPPLE (GLuint);
-GLAPI void APIENTRY glFinishFenceAPPLE (GLuint);
-GLAPI GLboolean APIENTRY glTestObjectAPPLE (GLenum, GLuint);
-GLAPI void APIENTRY glFinishObjectAPPLE (GLenum, GLint);
+GLAPI void APIENTRY glGenFencesAPPLE (GLsizei n, GLuint *fences);
+GLAPI void APIENTRY glDeleteFencesAPPLE (GLsizei n, const GLuint *fences);
+GLAPI void APIENTRY glSetFenceAPPLE (GLuint fence);
+GLAPI GLboolean APIENTRY glIsFenceAPPLE (GLuint fence);
+GLAPI GLboolean APIENTRY glTestFenceAPPLE (GLuint fence);
+GLAPI void APIENTRY glFinishFenceAPPLE (GLuint fence);
+GLAPI GLboolean APIENTRY glTestObjectAPPLE (GLenum object, GLuint name);
+GLAPI void APIENTRY glFinishObjectAPPLE (GLenum object, GLint name);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLGENFENCESAPPLEPROC) (GLsizei n, GLuint *fences);
typedef void (APIENTRYP PFNGLDELETEFENCESAPPLEPROC) (GLsizei n, const GLuint *fences);
@@ -7328,10 +9706,10 @@ typedef void (APIENTRYP PFNGLFINISHOBJECTAPPLEPROC) (GLenum object, GLint name);
#ifndef GL_APPLE_vertex_array_object
#define GL_APPLE_vertex_array_object 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glBindVertexArrayAPPLE (GLuint);
-GLAPI void APIENTRY glDeleteVertexArraysAPPLE (GLsizei, const GLuint *);
-GLAPI void APIENTRY glGenVertexArraysAPPLE (GLsizei, GLuint *);
-GLAPI GLboolean APIENTRY glIsVertexArrayAPPLE (GLuint);
+GLAPI void APIENTRY glBindVertexArrayAPPLE (GLuint array);
+GLAPI void APIENTRY glDeleteVertexArraysAPPLE (GLsizei n, const GLuint *arrays);
+GLAPI void APIENTRY glGenVertexArraysAPPLE (GLsizei n, GLuint *arrays);
+GLAPI GLboolean APIENTRY glIsVertexArrayAPPLE (GLuint array);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLBINDVERTEXARRAYAPPLEPROC) (GLuint array);
typedef void (APIENTRYP PFNGLDELETEVERTEXARRAYSAPPLEPROC) (GLsizei n, const GLuint *arrays);
@@ -7342,9 +9720,9 @@ typedef GLboolean (APIENTRYP PFNGLISVERTEXARRAYAPPLEPROC) (GLuint array);
#ifndef GL_APPLE_vertex_array_range
#define GL_APPLE_vertex_array_range 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glVertexArrayRangeAPPLE (GLsizei, GLvoid *);
-GLAPI void APIENTRY glFlushVertexArrayRangeAPPLE (GLsizei, GLvoid *);
-GLAPI void APIENTRY glVertexArrayParameteriAPPLE (GLenum, GLint);
+GLAPI void APIENTRY glVertexArrayRangeAPPLE (GLsizei length, GLvoid *pointer);
+GLAPI void APIENTRY glFlushVertexArrayRangeAPPLE (GLsizei length, GLvoid *pointer);
+GLAPI void APIENTRY glVertexArrayParameteriAPPLE (GLenum pname, GLint param);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLVERTEXARRAYRANGEAPPLEPROC) (GLsizei length, GLvoid *pointer);
typedef void (APIENTRYP PFNGLFLUSHVERTEXARRAYRANGEAPPLEPROC) (GLsizei length, GLvoid *pointer);
@@ -7362,7 +9740,7 @@ typedef void (APIENTRYP PFNGLVERTEXARRAYPARAMETERIAPPLEPROC) (GLenum pname, GLin
#ifndef GL_ATI_draw_buffers
#define GL_ATI_draw_buffers 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glDrawBuffersATI (GLsizei, const GLenum *);
+GLAPI void APIENTRY glDrawBuffersATI (GLsizei n, const GLenum *bufs);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLDRAWBUFFERSATIPROC) (GLsizei n, const GLenum *bufs);
#endif
@@ -7390,12 +9768,12 @@ typedef void (APIENTRYP PFNGLDRAWBUFFERSATIPROC) (GLsizei n, const GLenum *bufs)
#define GL_NV_fragment_program 1
/* Some NV_fragment_program entry points are shared with ARB_vertex_program. */
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glProgramNamedParameter4fNV (GLuint, GLsizei, const GLubyte *, GLfloat, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glProgramNamedParameter4dNV (GLuint, GLsizei, const GLubyte *, GLdouble, GLdouble, GLdouble, GLdouble);
-GLAPI void APIENTRY glProgramNamedParameter4fvNV (GLuint, GLsizei, const GLubyte *, const GLfloat *);
-GLAPI void APIENTRY glProgramNamedParameter4dvNV (GLuint, GLsizei, const GLubyte *, const GLdouble *);
-GLAPI void APIENTRY glGetProgramNamedParameterfvNV (GLuint, GLsizei, const GLubyte *, GLfloat *);
-GLAPI void APIENTRY glGetProgramNamedParameterdvNV (GLuint, GLsizei, const GLubyte *, GLdouble *);
+GLAPI void APIENTRY glProgramNamedParameter4fNV (GLuint id, GLsizei len, const GLubyte *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+GLAPI void APIENTRY glProgramNamedParameter4dNV (GLuint id, GLsizei len, const GLubyte *name, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+GLAPI void APIENTRY glProgramNamedParameter4fvNV (GLuint id, GLsizei len, const GLubyte *name, const GLfloat *v);
+GLAPI void APIENTRY glProgramNamedParameter4dvNV (GLuint id, GLsizei len, const GLubyte *name, const GLdouble *v);
+GLAPI void APIENTRY glGetProgramNamedParameterfvNV (GLuint id, GLsizei len, const GLubyte *name, GLfloat *params);
+GLAPI void APIENTRY glGetProgramNamedParameterdvNV (GLuint id, GLsizei len, const GLubyte *name, GLdouble *params);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4FNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4DNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
@@ -7408,52 +9786,52 @@ typedef void (APIENTRYP PFNGLGETPROGRAMNAMEDPARAMETERDVNVPROC) (GLuint id, GLsiz
#ifndef GL_NV_half_float
#define GL_NV_half_float 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glVertex2hNV (GLhalfNV, GLhalfNV);
-GLAPI void APIENTRY glVertex2hvNV (const GLhalfNV *);
-GLAPI void APIENTRY glVertex3hNV (GLhalfNV, GLhalfNV, GLhalfNV);
-GLAPI void APIENTRY glVertex3hvNV (const GLhalfNV *);
-GLAPI void APIENTRY glVertex4hNV (GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV);
-GLAPI void APIENTRY glVertex4hvNV (const GLhalfNV *);
-GLAPI void APIENTRY glNormal3hNV (GLhalfNV, GLhalfNV, GLhalfNV);
-GLAPI void APIENTRY glNormal3hvNV (const GLhalfNV *);
-GLAPI void APIENTRY glColor3hNV (GLhalfNV, GLhalfNV, GLhalfNV);
-GLAPI void APIENTRY glColor3hvNV (const GLhalfNV *);
-GLAPI void APIENTRY glColor4hNV (GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV);
-GLAPI void APIENTRY glColor4hvNV (const GLhalfNV *);
-GLAPI void APIENTRY glTexCoord1hNV (GLhalfNV);
-GLAPI void APIENTRY glTexCoord1hvNV (const GLhalfNV *);
-GLAPI void APIENTRY glTexCoord2hNV (GLhalfNV, GLhalfNV);
-GLAPI void APIENTRY glTexCoord2hvNV (const GLhalfNV *);
-GLAPI void APIENTRY glTexCoord3hNV (GLhalfNV, GLhalfNV, GLhalfNV);
-GLAPI void APIENTRY glTexCoord3hvNV (const GLhalfNV *);
-GLAPI void APIENTRY glTexCoord4hNV (GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV);
-GLAPI void APIENTRY glTexCoord4hvNV (const GLhalfNV *);
-GLAPI void APIENTRY glMultiTexCoord1hNV (GLenum, GLhalfNV);
-GLAPI void APIENTRY glMultiTexCoord1hvNV (GLenum, const GLhalfNV *);
-GLAPI void APIENTRY glMultiTexCoord2hNV (GLenum, GLhalfNV, GLhalfNV);
-GLAPI void APIENTRY glMultiTexCoord2hvNV (GLenum, const GLhalfNV *);
-GLAPI void APIENTRY glMultiTexCoord3hNV (GLenum, GLhalfNV, GLhalfNV, GLhalfNV);
-GLAPI void APIENTRY glMultiTexCoord3hvNV (GLenum, const GLhalfNV *);
-GLAPI void APIENTRY glMultiTexCoord4hNV (GLenum, GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV);
-GLAPI void APIENTRY glMultiTexCoord4hvNV (GLenum, const GLhalfNV *);
-GLAPI void APIENTRY glFogCoordhNV (GLhalfNV);
-GLAPI void APIENTRY glFogCoordhvNV (const GLhalfNV *);
-GLAPI void APIENTRY glSecondaryColor3hNV (GLhalfNV, GLhalfNV, GLhalfNV);
-GLAPI void APIENTRY glSecondaryColor3hvNV (const GLhalfNV *);
-GLAPI void APIENTRY glVertexWeighthNV (GLhalfNV);
-GLAPI void APIENTRY glVertexWeighthvNV (const GLhalfNV *);
-GLAPI void APIENTRY glVertexAttrib1hNV (GLuint, GLhalfNV);
-GLAPI void APIENTRY glVertexAttrib1hvNV (GLuint, const GLhalfNV *);
-GLAPI void APIENTRY glVertexAttrib2hNV (GLuint, GLhalfNV, GLhalfNV);
-GLAPI void APIENTRY glVertexAttrib2hvNV (GLuint, const GLhalfNV *);
-GLAPI void APIENTRY glVertexAttrib3hNV (GLuint, GLhalfNV, GLhalfNV, GLhalfNV);
-GLAPI void APIENTRY glVertexAttrib3hvNV (GLuint, const GLhalfNV *);
-GLAPI void APIENTRY glVertexAttrib4hNV (GLuint, GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV);
-GLAPI void APIENTRY glVertexAttrib4hvNV (GLuint, const GLhalfNV *);
-GLAPI void APIENTRY glVertexAttribs1hvNV (GLuint, GLsizei, const GLhalfNV *);
-GLAPI void APIENTRY glVertexAttribs2hvNV (GLuint, GLsizei, const GLhalfNV *);
-GLAPI void APIENTRY glVertexAttribs3hvNV (GLuint, GLsizei, const GLhalfNV *);
-GLAPI void APIENTRY glVertexAttribs4hvNV (GLuint, GLsizei, const GLhalfNV *);
+GLAPI void APIENTRY glVertex2hNV (GLhalfNV x, GLhalfNV y);
+GLAPI void APIENTRY glVertex2hvNV (const GLhalfNV *v);
+GLAPI void APIENTRY glVertex3hNV (GLhalfNV x, GLhalfNV y, GLhalfNV z);
+GLAPI void APIENTRY glVertex3hvNV (const GLhalfNV *v);
+GLAPI void APIENTRY glVertex4hNV (GLhalfNV x, GLhalfNV y, GLhalfNV z, GLhalfNV w);
+GLAPI void APIENTRY glVertex4hvNV (const GLhalfNV *v);
+GLAPI void APIENTRY glNormal3hNV (GLhalfNV nx, GLhalfNV ny, GLhalfNV nz);
+GLAPI void APIENTRY glNormal3hvNV (const GLhalfNV *v);
+GLAPI void APIENTRY glColor3hNV (GLhalfNV red, GLhalfNV green, GLhalfNV blue);
+GLAPI void APIENTRY glColor3hvNV (const GLhalfNV *v);
+GLAPI void APIENTRY glColor4hNV (GLhalfNV red, GLhalfNV green, GLhalfNV blue, GLhalfNV alpha);
+GLAPI void APIENTRY glColor4hvNV (const GLhalfNV *v);
+GLAPI void APIENTRY glTexCoord1hNV (GLhalfNV s);
+GLAPI void APIENTRY glTexCoord1hvNV (const GLhalfNV *v);
+GLAPI void APIENTRY glTexCoord2hNV (GLhalfNV s, GLhalfNV t);
+GLAPI void APIENTRY glTexCoord2hvNV (const GLhalfNV *v);
+GLAPI void APIENTRY glTexCoord3hNV (GLhalfNV s, GLhalfNV t, GLhalfNV r);
+GLAPI void APIENTRY glTexCoord3hvNV (const GLhalfNV *v);
+GLAPI void APIENTRY glTexCoord4hNV (GLhalfNV s, GLhalfNV t, GLhalfNV r, GLhalfNV q);
+GLAPI void APIENTRY glTexCoord4hvNV (const GLhalfNV *v);
+GLAPI void APIENTRY glMultiTexCoord1hNV (GLenum target, GLhalfNV s);
+GLAPI void APIENTRY glMultiTexCoord1hvNV (GLenum target, const GLhalfNV *v);
+GLAPI void APIENTRY glMultiTexCoord2hNV (GLenum target, GLhalfNV s, GLhalfNV t);
+GLAPI void APIENTRY glMultiTexCoord2hvNV (GLenum target, const GLhalfNV *v);
+GLAPI void APIENTRY glMultiTexCoord3hNV (GLenum target, GLhalfNV s, GLhalfNV t, GLhalfNV r);
+GLAPI void APIENTRY glMultiTexCoord3hvNV (GLenum target, const GLhalfNV *v);
+GLAPI void APIENTRY glMultiTexCoord4hNV (GLenum target, GLhalfNV s, GLhalfNV t, GLhalfNV r, GLhalfNV q);
+GLAPI void APIENTRY glMultiTexCoord4hvNV (GLenum target, const GLhalfNV *v);
+GLAPI void APIENTRY glFogCoordhNV (GLhalfNV fog);
+GLAPI void APIENTRY glFogCoordhvNV (const GLhalfNV *fog);
+GLAPI void APIENTRY glSecondaryColor3hNV (GLhalfNV red, GLhalfNV green, GLhalfNV blue);
+GLAPI void APIENTRY glSecondaryColor3hvNV (const GLhalfNV *v);
+GLAPI void APIENTRY glVertexWeighthNV (GLhalfNV weight);
+GLAPI void APIENTRY glVertexWeighthvNV (const GLhalfNV *weight);
+GLAPI void APIENTRY glVertexAttrib1hNV (GLuint index, GLhalfNV x);
+GLAPI void APIENTRY glVertexAttrib1hvNV (GLuint index, const GLhalfNV *v);
+GLAPI void APIENTRY glVertexAttrib2hNV (GLuint index, GLhalfNV x, GLhalfNV y);
+GLAPI void APIENTRY glVertexAttrib2hvNV (GLuint index, const GLhalfNV *v);
+GLAPI void APIENTRY glVertexAttrib3hNV (GLuint index, GLhalfNV x, GLhalfNV y, GLhalfNV z);
+GLAPI void APIENTRY glVertexAttrib3hvNV (GLuint index, const GLhalfNV *v);
+GLAPI void APIENTRY glVertexAttrib4hNV (GLuint index, GLhalfNV x, GLhalfNV y, GLhalfNV z, GLhalfNV w);
+GLAPI void APIENTRY glVertexAttrib4hvNV (GLuint index, const GLhalfNV *v);
+GLAPI void APIENTRY glVertexAttribs1hvNV (GLuint index, GLsizei n, const GLhalfNV *v);
+GLAPI void APIENTRY glVertexAttribs2hvNV (GLuint index, GLsizei n, const GLhalfNV *v);
+GLAPI void APIENTRY glVertexAttribs3hvNV (GLuint index, GLsizei n, const GLhalfNV *v);
+GLAPI void APIENTRY glVertexAttribs4hvNV (GLuint index, GLsizei n, const GLhalfNV *v);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLVERTEX2HNVPROC) (GLhalfNV x, GLhalfNV y);
typedef void (APIENTRYP PFNGLVERTEX2HVNVPROC) (const GLhalfNV *v);
@@ -7506,8 +9884,8 @@ typedef void (APIENTRYP PFNGLVERTEXATTRIBS4HVNVPROC) (GLuint index, GLsizei n, c
#ifndef GL_NV_pixel_data_range
#define GL_NV_pixel_data_range 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glPixelDataRangeNV (GLenum, GLsizei, GLvoid *);
-GLAPI void APIENTRY glFlushPixelDataRangeNV (GLenum);
+GLAPI void APIENTRY glPixelDataRangeNV (GLenum target, GLsizei length, GLvoid *pointer);
+GLAPI void APIENTRY glFlushPixelDataRangeNV (GLenum target);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLPIXELDATARANGENVPROC) (GLenum target, GLsizei length, GLvoid *pointer);
typedef void (APIENTRYP PFNGLFLUSHPIXELDATARANGENVPROC) (GLenum target);
@@ -7517,7 +9895,7 @@ typedef void (APIENTRYP PFNGLFLUSHPIXELDATARANGENVPROC) (GLenum target);
#define GL_NV_primitive_restart 1
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glPrimitiveRestartNV (void);
-GLAPI void APIENTRY glPrimitiveRestartIndexNV (GLuint);
+GLAPI void APIENTRY glPrimitiveRestartIndexNV (GLuint index);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLPRIMITIVERESTARTNVPROC) (void);
typedef void (APIENTRYP PFNGLPRIMITIVERESTARTINDEXNVPROC) (GLuint index);
@@ -7534,8 +9912,8 @@ typedef void (APIENTRYP PFNGLPRIMITIVERESTARTINDEXNVPROC) (GLuint index);
#ifndef GL_ATI_map_object_buffer
#define GL_ATI_map_object_buffer 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI GLvoid* APIENTRY glMapObjectBufferATI (GLuint);
-GLAPI void APIENTRY glUnmapObjectBufferATI (GLuint);
+GLAPI GLvoid* APIENTRY glMapObjectBufferATI (GLuint buffer);
+GLAPI void APIENTRY glUnmapObjectBufferATI (GLuint buffer);
#endif /* GL_GLEXT_PROTOTYPES */
typedef GLvoid* (APIENTRYP PFNGLMAPOBJECTBUFFERATIPROC) (GLuint buffer);
typedef void (APIENTRYP PFNGLUNMAPOBJECTBUFFERATIPROC) (GLuint buffer);
@@ -7544,8 +9922,8 @@ typedef void (APIENTRYP PFNGLUNMAPOBJECTBUFFERATIPROC) (GLuint buffer);
#ifndef GL_ATI_separate_stencil
#define GL_ATI_separate_stencil 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glStencilOpSeparateATI (GLenum, GLenum, GLenum, GLenum);
-GLAPI void APIENTRY glStencilFuncSeparateATI (GLenum, GLenum, GLint, GLuint);
+GLAPI void APIENTRY glStencilOpSeparateATI (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
+GLAPI void APIENTRY glStencilFuncSeparateATI (GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLSTENCILOPSEPARATEATIPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
typedef void (APIENTRYP PFNGLSTENCILFUNCSEPARATEATIPROC) (GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask);
@@ -7554,9 +9932,9 @@ typedef void (APIENTRYP PFNGLSTENCILFUNCSEPARATEATIPROC) (GLenum frontfunc, GLen
#ifndef GL_ATI_vertex_attrib_array_object
#define GL_ATI_vertex_attrib_array_object 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glVertexAttribArrayObjectATI (GLuint, GLint, GLenum, GLboolean, GLsizei, GLuint, GLuint);
-GLAPI void APIENTRY glGetVertexAttribArrayObjectfvATI (GLuint, GLenum, GLfloat *);
-GLAPI void APIENTRY glGetVertexAttribArrayObjectivATI (GLuint, GLenum, GLint *);
+GLAPI void APIENTRY glVertexAttribArrayObjectATI (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLuint buffer, GLuint offset);
+GLAPI void APIENTRY glGetVertexAttribArrayObjectfvATI (GLuint index, GLenum pname, GLfloat *params);
+GLAPI void APIENTRY glGetVertexAttribArrayObjectivATI (GLuint index, GLenum pname, GLint *params);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLVERTEXATTRIBARRAYOBJECTATIPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLuint buffer, GLuint offset);
typedef void (APIENTRYP PFNGLGETVERTEXATTRIBARRAYOBJECTFVATIPROC) (GLuint index, GLenum pname, GLfloat *params);
@@ -7570,7 +9948,7 @@ typedef void (APIENTRYP PFNGLGETVERTEXATTRIBARRAYOBJECTIVATIPROC) (GLuint index,
#ifndef GL_EXT_depth_bounds_test
#define GL_EXT_depth_bounds_test 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glDepthBoundsEXT (GLclampd, GLclampd);
+GLAPI void APIENTRY glDepthBoundsEXT (GLclampd zmin, GLclampd zmax);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLDEPTHBOUNDSEXTPROC) (GLclampd zmin, GLclampd zmax);
#endif
@@ -7582,7 +9960,7 @@ typedef void (APIENTRYP PFNGLDEPTHBOUNDSEXTPROC) (GLclampd zmin, GLclampd zmax);
#ifndef GL_EXT_blend_equation_separate
#define GL_EXT_blend_equation_separate 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glBlendEquationSeparateEXT (GLenum, GLenum);
+GLAPI void APIENTRY glBlendEquationSeparateEXT (GLenum modeRGB, GLenum modeAlpha);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEEXTPROC) (GLenum modeRGB, GLenum modeAlpha);
#endif
@@ -7618,23 +9996,23 @@ typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEEXTPROC) (GLenum modeRGB, GLen
#ifndef GL_EXT_framebuffer_object
#define GL_EXT_framebuffer_object 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI GLboolean APIENTRY glIsRenderbufferEXT (GLuint);
-GLAPI void APIENTRY glBindRenderbufferEXT (GLenum, GLuint);
-GLAPI void APIENTRY glDeleteRenderbuffersEXT (GLsizei, const GLuint *);
-GLAPI void APIENTRY glGenRenderbuffersEXT (GLsizei, GLuint *);
-GLAPI void APIENTRY glRenderbufferStorageEXT (GLenum, GLenum, GLsizei, GLsizei);
-GLAPI void APIENTRY glGetRenderbufferParameterivEXT (GLenum, GLenum, GLint *);
-GLAPI GLboolean APIENTRY glIsFramebufferEXT (GLuint);
-GLAPI void APIENTRY glBindFramebufferEXT (GLenum, GLuint);
-GLAPI void APIENTRY glDeleteFramebuffersEXT (GLsizei, const GLuint *);
-GLAPI void APIENTRY glGenFramebuffersEXT (GLsizei, GLuint *);
-GLAPI GLenum APIENTRY glCheckFramebufferStatusEXT (GLenum);
-GLAPI void APIENTRY glFramebufferTexture1DEXT (GLenum, GLenum, GLenum, GLuint, GLint);
-GLAPI void APIENTRY glFramebufferTexture2DEXT (GLenum, GLenum, GLenum, GLuint, GLint);
-GLAPI void APIENTRY glFramebufferTexture3DEXT (GLenum, GLenum, GLenum, GLuint, GLint, GLint);
-GLAPI void APIENTRY glFramebufferRenderbufferEXT (GLenum, GLenum, GLenum, GLuint);
-GLAPI void APIENTRY glGetFramebufferAttachmentParameterivEXT (GLenum, GLenum, GLenum, GLint *);
-GLAPI void APIENTRY glGenerateMipmapEXT (GLenum);
+GLAPI GLboolean APIENTRY glIsRenderbufferEXT (GLuint renderbuffer);
+GLAPI void APIENTRY glBindRenderbufferEXT (GLenum target, GLuint renderbuffer);
+GLAPI void APIENTRY glDeleteRenderbuffersEXT (GLsizei n, const GLuint *renderbuffers);
+GLAPI void APIENTRY glGenRenderbuffersEXT (GLsizei n, GLuint *renderbuffers);
+GLAPI void APIENTRY glRenderbufferStorageEXT (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
+GLAPI void APIENTRY glGetRenderbufferParameterivEXT (GLenum target, GLenum pname, GLint *params);
+GLAPI GLboolean APIENTRY glIsFramebufferEXT (GLuint framebuffer);
+GLAPI void APIENTRY glBindFramebufferEXT (GLenum target, GLuint framebuffer);
+GLAPI void APIENTRY glDeleteFramebuffersEXT (GLsizei n, const GLuint *framebuffers);
+GLAPI void APIENTRY glGenFramebuffersEXT (GLsizei n, GLuint *framebuffers);
+GLAPI GLenum APIENTRY glCheckFramebufferStatusEXT (GLenum target);
+GLAPI void APIENTRY glFramebufferTexture1DEXT (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
+GLAPI void APIENTRY glFramebufferTexture2DEXT (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
+GLAPI void APIENTRY glFramebufferTexture3DEXT (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
+GLAPI void APIENTRY glFramebufferRenderbufferEXT (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
+GLAPI void APIENTRY glGetFramebufferAttachmentParameterivEXT (GLenum target, GLenum attachment, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGenerateMipmapEXT (GLenum target);
#endif /* GL_GLEXT_PROTOTYPES */
typedef GLboolean (APIENTRYP PFNGLISRENDERBUFFEREXTPROC) (GLuint renderbuffer);
typedef void (APIENTRYP PFNGLBINDRENDERBUFFEREXTPROC) (GLenum target, GLuint renderbuffer);
@@ -7658,7 +10036,7 @@ typedef void (APIENTRYP PFNGLGENERATEMIPMAPEXTPROC) (GLenum target);
#ifndef GL_GREMEDY_string_marker
#define GL_GREMEDY_string_marker 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glStringMarkerGREMEDY (GLsizei, const GLvoid *);
+GLAPI void APIENTRY glStringMarkerGREMEDY (GLsizei len, const GLvoid *string);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLSTRINGMARKERGREMEDYPROC) (GLsizei len, const GLvoid *string);
#endif
@@ -7670,7 +10048,7 @@ typedef void (APIENTRYP PFNGLSTRINGMARKERGREMEDYPROC) (GLsizei len, const GLvoid
#ifndef GL_EXT_stencil_clear_tag
#define GL_EXT_stencil_clear_tag 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glStencilClearTagEXT (GLsizei, GLuint);
+GLAPI void APIENTRY glStencilClearTagEXT (GLsizei stencilTagBits, GLuint stencilClearTag);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLSTENCILCLEARTAGEXTPROC) (GLsizei stencilTagBits, GLuint stencilClearTag);
#endif
@@ -7682,7 +10060,7 @@ typedef void (APIENTRYP PFNGLSTENCILCLEARTAGEXTPROC) (GLsizei stencilTagBits, GL
#ifndef GL_EXT_framebuffer_blit
#define GL_EXT_framebuffer_blit 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glBlitFramebufferEXT (GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLbitfield, GLenum);
+GLAPI void APIENTRY glBlitFramebufferEXT (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLBLITFRAMEBUFFEREXTPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
#endif
@@ -7690,7 +10068,7 @@ typedef void (APIENTRYP PFNGLBLITFRAMEBUFFEREXTPROC) (GLint srcX0, GLint srcY0,
#ifndef GL_EXT_framebuffer_multisample
#define GL_EXT_framebuffer_multisample 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glRenderbufferStorageMultisampleEXT (GLenum, GLsizei, GLenum, GLsizei, GLsizei);
+GLAPI void APIENTRY glRenderbufferStorageMultisampleEXT (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
#endif
@@ -7702,8 +10080,8 @@ typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLenum targ
#ifndef GL_EXT_timer_query
#define GL_EXT_timer_query 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glGetQueryObjecti64vEXT (GLuint, GLenum, GLint64EXT *);
-GLAPI void APIENTRY glGetQueryObjectui64vEXT (GLuint, GLenum, GLuint64EXT *);
+GLAPI void APIENTRY glGetQueryObjecti64vEXT (GLuint id, GLenum pname, GLint64EXT *params);
+GLAPI void APIENTRY glGetQueryObjectui64vEXT (GLuint id, GLenum pname, GLuint64EXT *params);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLGETQUERYOBJECTI64VEXTPROC) (GLuint id, GLenum pname, GLint64EXT *params);
typedef void (APIENTRYP PFNGLGETQUERYOBJECTUI64VEXTPROC) (GLuint id, GLenum pname, GLuint64EXT *params);
@@ -7712,8 +10090,8 @@ typedef void (APIENTRYP PFNGLGETQUERYOBJECTUI64VEXTPROC) (GLuint id, GLenum pnam
#ifndef GL_EXT_gpu_program_parameters
#define GL_EXT_gpu_program_parameters 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glProgramEnvParameters4fvEXT (GLenum, GLuint, GLsizei, const GLfloat *);
-GLAPI void APIENTRY glProgramLocalParameters4fvEXT (GLenum, GLuint, GLsizei, const GLfloat *);
+GLAPI void APIENTRY glProgramEnvParameters4fvEXT (GLenum target, GLuint index, GLsizei count, const GLfloat *params);
+GLAPI void APIENTRY glProgramLocalParameters4fvEXT (GLenum target, GLuint index, GLsizei count, const GLfloat *params);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERS4FVEXTPROC) (GLenum target, GLuint index, GLsizei count, const GLfloat *params);
typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERS4FVEXTPROC) (GLenum target, GLuint index, GLsizei count, const GLfloat *params);
@@ -7722,8 +10100,8 @@ typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERS4FVEXTPROC) (GLenum target, G
#ifndef GL_APPLE_flush_buffer_range
#define GL_APPLE_flush_buffer_range 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glBufferParameteriAPPLE (GLenum, GLenum, GLint);
-GLAPI void APIENTRY glFlushMappedBufferRangeAPPLE (GLenum, GLintptr, GLsizeiptr);
+GLAPI void APIENTRY glBufferParameteriAPPLE (GLenum target, GLenum pname, GLint param);
+GLAPI void APIENTRY glFlushMappedBufferRangeAPPLE (GLenum target, GLintptr offset, GLsizeiptr size);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLBUFFERPARAMETERIAPPLEPROC) (GLenum target, GLenum pname, GLint param);
typedef void (APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEAPPLEPROC) (GLenum target, GLintptr offset, GLsizeiptr size);
@@ -7732,22 +10110,22 @@ typedef void (APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEAPPLEPROC) (GLenum target, GL
#ifndef GL_NV_gpu_program4
#define GL_NV_gpu_program4 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glProgramLocalParameterI4iNV (GLenum, GLuint, GLint, GLint, GLint, GLint);
-GLAPI void APIENTRY glProgramLocalParameterI4ivNV (GLenum, GLuint, const GLint *);
-GLAPI void APIENTRY glProgramLocalParametersI4ivNV (GLenum, GLuint, GLsizei, const GLint *);
-GLAPI void APIENTRY glProgramLocalParameterI4uiNV (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint);
-GLAPI void APIENTRY glProgramLocalParameterI4uivNV (GLenum, GLuint, const GLuint *);
-GLAPI void APIENTRY glProgramLocalParametersI4uivNV (GLenum, GLuint, GLsizei, const GLuint *);
-GLAPI void APIENTRY glProgramEnvParameterI4iNV (GLenum, GLuint, GLint, GLint, GLint, GLint);
-GLAPI void APIENTRY glProgramEnvParameterI4ivNV (GLenum, GLuint, const GLint *);
-GLAPI void APIENTRY glProgramEnvParametersI4ivNV (GLenum, GLuint, GLsizei, const GLint *);
-GLAPI void APIENTRY glProgramEnvParameterI4uiNV (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint);
-GLAPI void APIENTRY glProgramEnvParameterI4uivNV (GLenum, GLuint, const GLuint *);
-GLAPI void APIENTRY glProgramEnvParametersI4uivNV (GLenum, GLuint, GLsizei, const GLuint *);
-GLAPI void APIENTRY glGetProgramLocalParameterIivNV (GLenum, GLuint, GLint *);
-GLAPI void APIENTRY glGetProgramLocalParameterIuivNV (GLenum, GLuint, GLuint *);
-GLAPI void APIENTRY glGetProgramEnvParameterIivNV (GLenum, GLuint, GLint *);
-GLAPI void APIENTRY glGetProgramEnvParameterIuivNV (GLenum, GLuint, GLuint *);
+GLAPI void APIENTRY glProgramLocalParameterI4iNV (GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w);
+GLAPI void APIENTRY glProgramLocalParameterI4ivNV (GLenum target, GLuint index, const GLint *params);
+GLAPI void APIENTRY glProgramLocalParametersI4ivNV (GLenum target, GLuint index, GLsizei count, const GLint *params);
+GLAPI void APIENTRY glProgramLocalParameterI4uiNV (GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
+GLAPI void APIENTRY glProgramLocalParameterI4uivNV (GLenum target, GLuint index, const GLuint *params);
+GLAPI void APIENTRY glProgramLocalParametersI4uivNV (GLenum target, GLuint index, GLsizei count, const GLuint *params);
+GLAPI void APIENTRY glProgramEnvParameterI4iNV (GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w);
+GLAPI void APIENTRY glProgramEnvParameterI4ivNV (GLenum target, GLuint index, const GLint *params);
+GLAPI void APIENTRY glProgramEnvParametersI4ivNV (GLenum target, GLuint index, GLsizei count, const GLint *params);
+GLAPI void APIENTRY glProgramEnvParameterI4uiNV (GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
+GLAPI void APIENTRY glProgramEnvParameterI4uivNV (GLenum target, GLuint index, const GLuint *params);
+GLAPI void APIENTRY glProgramEnvParametersI4uivNV (GLenum target, GLuint index, GLsizei count, const GLuint *params);
+GLAPI void APIENTRY glGetProgramLocalParameterIivNV (GLenum target, GLuint index, GLint *params);
+GLAPI void APIENTRY glGetProgramLocalParameterIuivNV (GLenum target, GLuint index, GLuint *params);
+GLAPI void APIENTRY glGetProgramEnvParameterIivNV (GLenum target, GLuint index, GLint *params);
+GLAPI void APIENTRY glGetProgramEnvParameterIuivNV (GLenum target, GLuint index, GLuint *params);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERI4INVPROC) (GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w);
typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERI4IVNVPROC) (GLenum target, GLuint index, const GLint *params);
@@ -7770,10 +10148,10 @@ typedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERIUIVNVPROC) (GLenum target, G
#ifndef GL_NV_geometry_program4
#define GL_NV_geometry_program4 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glProgramVertexLimitNV (GLenum, GLint);
-GLAPI void APIENTRY glFramebufferTextureEXT (GLenum, GLenum, GLuint, GLint);
-GLAPI void APIENTRY glFramebufferTextureLayerEXT (GLenum, GLenum, GLuint, GLint, GLint);
-GLAPI void APIENTRY glFramebufferTextureFaceEXT (GLenum, GLenum, GLuint, GLint, GLenum);
+GLAPI void APIENTRY glProgramVertexLimitNV (GLenum target, GLint limit);
+GLAPI void APIENTRY glFramebufferTextureEXT (GLenum target, GLenum attachment, GLuint texture, GLint level);
+GLAPI void APIENTRY glFramebufferTextureLayerEXT (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
+GLAPI void APIENTRY glFramebufferTextureFaceEXT (GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLPROGRAMVERTEXLIMITNVPROC) (GLenum target, GLint limit);
typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREEXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level);
@@ -7784,7 +10162,7 @@ typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREFACEEXTPROC) (GLenum target, GLen
#ifndef GL_EXT_geometry_shader4
#define GL_EXT_geometry_shader4 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glProgramParameteriEXT (GLuint, GLenum, GLint);
+GLAPI void APIENTRY glProgramParameteriEXT (GLuint program, GLenum pname, GLint value);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLPROGRAMPARAMETERIEXTPROC) (GLuint program, GLenum pname, GLint value);
#endif
@@ -7792,29 +10170,29 @@ typedef void (APIENTRYP PFNGLPROGRAMPARAMETERIEXTPROC) (GLuint program, GLenum p
#ifndef GL_NV_vertex_program4
#define GL_NV_vertex_program4 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glVertexAttribI1iEXT (GLuint, GLint);
-GLAPI void APIENTRY glVertexAttribI2iEXT (GLuint, GLint, GLint);
-GLAPI void APIENTRY glVertexAttribI3iEXT (GLuint, GLint, GLint, GLint);
-GLAPI void APIENTRY glVertexAttribI4iEXT (GLuint, GLint, GLint, GLint, GLint);
-GLAPI void APIENTRY glVertexAttribI1uiEXT (GLuint, GLuint);
-GLAPI void APIENTRY glVertexAttribI2uiEXT (GLuint, GLuint, GLuint);
-GLAPI void APIENTRY glVertexAttribI3uiEXT (GLuint, GLuint, GLuint, GLuint);
-GLAPI void APIENTRY glVertexAttribI4uiEXT (GLuint, GLuint, GLuint, GLuint, GLuint);
-GLAPI void APIENTRY glVertexAttribI1ivEXT (GLuint, const GLint *);
-GLAPI void APIENTRY glVertexAttribI2ivEXT (GLuint, const GLint *);
-GLAPI void APIENTRY glVertexAttribI3ivEXT (GLuint, const GLint *);
-GLAPI void APIENTRY glVertexAttribI4ivEXT (GLuint, const GLint *);
-GLAPI void APIENTRY glVertexAttribI1uivEXT (GLuint, const GLuint *);
-GLAPI void APIENTRY glVertexAttribI2uivEXT (GLuint, const GLuint *);
-GLAPI void APIENTRY glVertexAttribI3uivEXT (GLuint, const GLuint *);
-GLAPI void APIENTRY glVertexAttribI4uivEXT (GLuint, const GLuint *);
-GLAPI void APIENTRY glVertexAttribI4bvEXT (GLuint, const GLbyte *);
-GLAPI void APIENTRY glVertexAttribI4svEXT (GLuint, const GLshort *);
-GLAPI void APIENTRY glVertexAttribI4ubvEXT (GLuint, const GLubyte *);
-GLAPI void APIENTRY glVertexAttribI4usvEXT (GLuint, const GLushort *);
-GLAPI void APIENTRY glVertexAttribIPointerEXT (GLuint, GLint, GLenum, GLsizei, const GLvoid *);
-GLAPI void APIENTRY glGetVertexAttribIivEXT (GLuint, GLenum, GLint *);
-GLAPI void APIENTRY glGetVertexAttribIuivEXT (GLuint, GLenum, GLuint *);
+GLAPI void APIENTRY glVertexAttribI1iEXT (GLuint index, GLint x);
+GLAPI void APIENTRY glVertexAttribI2iEXT (GLuint index, GLint x, GLint y);
+GLAPI void APIENTRY glVertexAttribI3iEXT (GLuint index, GLint x, GLint y, GLint z);
+GLAPI void APIENTRY glVertexAttribI4iEXT (GLuint index, GLint x, GLint y, GLint z, GLint w);
+GLAPI void APIENTRY glVertexAttribI1uiEXT (GLuint index, GLuint x);
+GLAPI void APIENTRY glVertexAttribI2uiEXT (GLuint index, GLuint x, GLuint y);
+GLAPI void APIENTRY glVertexAttribI3uiEXT (GLuint index, GLuint x, GLuint y, GLuint z);
+GLAPI void APIENTRY glVertexAttribI4uiEXT (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
+GLAPI void APIENTRY glVertexAttribI1ivEXT (GLuint index, const GLint *v);
+GLAPI void APIENTRY glVertexAttribI2ivEXT (GLuint index, const GLint *v);
+GLAPI void APIENTRY glVertexAttribI3ivEXT (GLuint index, const GLint *v);
+GLAPI void APIENTRY glVertexAttribI4ivEXT (GLuint index, const GLint *v);
+GLAPI void APIENTRY glVertexAttribI1uivEXT (GLuint index, const GLuint *v);
+GLAPI void APIENTRY glVertexAttribI2uivEXT (GLuint index, const GLuint *v);
+GLAPI void APIENTRY glVertexAttribI3uivEXT (GLuint index, const GLuint *v);
+GLAPI void APIENTRY glVertexAttribI4uivEXT (GLuint index, const GLuint *v);
+GLAPI void APIENTRY glVertexAttribI4bvEXT (GLuint index, const GLbyte *v);
+GLAPI void APIENTRY glVertexAttribI4svEXT (GLuint index, const GLshort *v);
+GLAPI void APIENTRY glVertexAttribI4ubvEXT (GLuint index, const GLubyte *v);
+GLAPI void APIENTRY glVertexAttribI4usvEXT (GLuint index, const GLushort *v);
+GLAPI void APIENTRY glVertexAttribIPointerEXT (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
+GLAPI void APIENTRY glGetVertexAttribIivEXT (GLuint index, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetVertexAttribIuivEXT (GLuint index, GLenum pname, GLuint *params);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IEXTPROC) (GLuint index, GLint x);
typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IEXTPROC) (GLuint index, GLint x, GLint y);
@@ -7844,17 +10222,17 @@ typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIUIVEXTPROC) (GLuint index, GLenum p
#ifndef GL_EXT_gpu_shader4
#define GL_EXT_gpu_shader4 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glGetUniformuivEXT (GLuint, GLint, GLuint *);
-GLAPI void APIENTRY glBindFragDataLocationEXT (GLuint, GLuint, const GLchar *);
-GLAPI GLint APIENTRY glGetFragDataLocationEXT (GLuint, const GLchar *);
-GLAPI void APIENTRY glUniform1uiEXT (GLint, GLuint);
-GLAPI void APIENTRY glUniform2uiEXT (GLint, GLuint, GLuint);
-GLAPI void APIENTRY glUniform3uiEXT (GLint, GLuint, GLuint, GLuint);
-GLAPI void APIENTRY glUniform4uiEXT (GLint, GLuint, GLuint, GLuint, GLuint);
-GLAPI void APIENTRY glUniform1uivEXT (GLint, GLsizei, const GLuint *);
-GLAPI void APIENTRY glUniform2uivEXT (GLint, GLsizei, const GLuint *);
-GLAPI void APIENTRY glUniform3uivEXT (GLint, GLsizei, const GLuint *);
-GLAPI void APIENTRY glUniform4uivEXT (GLint, GLsizei, const GLuint *);
+GLAPI void APIENTRY glGetUniformuivEXT (GLuint program, GLint location, GLuint *params);
+GLAPI void APIENTRY glBindFragDataLocationEXT (GLuint program, GLuint color, const GLchar *name);
+GLAPI GLint APIENTRY glGetFragDataLocationEXT (GLuint program, const GLchar *name);
+GLAPI void APIENTRY glUniform1uiEXT (GLint location, GLuint v0);
+GLAPI void APIENTRY glUniform2uiEXT (GLint location, GLuint v0, GLuint v1);
+GLAPI void APIENTRY glUniform3uiEXT (GLint location, GLuint v0, GLuint v1, GLuint v2);
+GLAPI void APIENTRY glUniform4uiEXT (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+GLAPI void APIENTRY glUniform1uivEXT (GLint location, GLsizei count, const GLuint *value);
+GLAPI void APIENTRY glUniform2uivEXT (GLint location, GLsizei count, const GLuint *value);
+GLAPI void APIENTRY glUniform3uivEXT (GLint location, GLsizei count, const GLuint *value);
+GLAPI void APIENTRY glUniform4uivEXT (GLint location, GLsizei count, const GLuint *value);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLGETUNIFORMUIVEXTPROC) (GLuint program, GLint location, GLuint *params);
typedef void (APIENTRYP PFNGLBINDFRAGDATALOCATIONEXTPROC) (GLuint program, GLuint color, const GLchar *name);
@@ -7872,8 +10250,8 @@ typedef void (APIENTRYP PFNGLUNIFORM4UIVEXTPROC) (GLint location, GLsizei count,
#ifndef GL_EXT_draw_instanced
#define GL_EXT_draw_instanced 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glDrawArraysInstancedEXT (GLenum, GLint, GLsizei, GLsizei);
-GLAPI void APIENTRY glDrawElementsInstancedEXT (GLenum, GLsizei, GLenum, const GLvoid *, GLsizei);
+GLAPI void APIENTRY glDrawArraysInstancedEXT (GLenum mode, GLint start, GLsizei count, GLsizei primcount);
+GLAPI void APIENTRY glDrawElementsInstancedEXT (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDEXTPROC) (GLenum mode, GLint start, GLsizei count, GLsizei primcount);
typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDEXTPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount);
@@ -7890,7 +10268,7 @@ typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDEXTPROC) (GLenum mode, GLsizei
#ifndef GL_EXT_texture_buffer_object
#define GL_EXT_texture_buffer_object 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glTexBufferEXT (GLenum, GLenum, GLuint);
+GLAPI void APIENTRY glTexBufferEXT (GLenum target, GLenum internalformat, GLuint buffer);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLTEXBUFFEREXTPROC) (GLenum target, GLenum internalformat, GLuint buffer);
#endif
@@ -7910,9 +10288,9 @@ typedef void (APIENTRYP PFNGLTEXBUFFEREXTPROC) (GLenum target, GLenum internalfo
#ifndef GL_NV_depth_buffer_float
#define GL_NV_depth_buffer_float 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glDepthRangedNV (GLdouble, GLdouble);
-GLAPI void APIENTRY glClearDepthdNV (GLdouble);
-GLAPI void APIENTRY glDepthBoundsdNV (GLdouble, GLdouble);
+GLAPI void APIENTRY glDepthRangedNV (GLdouble zNear, GLdouble zFar);
+GLAPI void APIENTRY glClearDepthdNV (GLdouble depth);
+GLAPI void APIENTRY glDepthBoundsdNV (GLdouble zmin, GLdouble zmax);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLDEPTHRANGEDNVPROC) (GLdouble zNear, GLdouble zFar);
typedef void (APIENTRYP PFNGLCLEARDEPTHDNVPROC) (GLdouble depth);
@@ -7926,7 +10304,7 @@ typedef void (APIENTRYP PFNGLDEPTHBOUNDSDNVPROC) (GLdouble zmin, GLdouble zmax);
#ifndef GL_NV_framebuffer_multisample_coverage
#define GL_NV_framebuffer_multisample_coverage 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glRenderbufferStorageMultisampleCoverageNV (GLenum, GLsizei, GLsizei, GLenum, GLsizei, GLsizei);
+GLAPI void APIENTRY glRenderbufferStorageMultisampleCoverageNV (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLenum internalformat, GLsizei width, GLsizei height);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLECOVERAGENVPROC) (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLenum internalformat, GLsizei width, GLsizei height);
#endif
@@ -7942,9 +10320,9 @@ typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLECOVERAGENVPROC) (GLen
#ifndef GL_NV_parameter_buffer_object
#define GL_NV_parameter_buffer_object 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glProgramBufferParametersfvNV (GLenum, GLuint, GLuint, GLsizei, const GLfloat *);
-GLAPI void APIENTRY glProgramBufferParametersIivNV (GLenum, GLuint, GLuint, GLsizei, const GLint *);
-GLAPI void APIENTRY glProgramBufferParametersIuivNV (GLenum, GLuint, GLuint, GLsizei, const GLuint *);
+GLAPI void APIENTRY glProgramBufferParametersfvNV (GLenum target, GLuint buffer, GLuint index, GLsizei count, const GLfloat *params);
+GLAPI void APIENTRY glProgramBufferParametersIivNV (GLenum target, GLuint buffer, GLuint index, GLsizei count, const GLint *params);
+GLAPI void APIENTRY glProgramBufferParametersIuivNV (GLenum target, GLuint buffer, GLuint index, GLsizei count, const GLuint *params);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLPROGRAMBUFFERPARAMETERSFVNVPROC) (GLenum target, GLuint buffer, GLuint index, GLsizei count, const GLfloat *params);
typedef void (APIENTRYP PFNGLPROGRAMBUFFERPARAMETERSIIVNVPROC) (GLenum target, GLuint buffer, GLuint index, GLsizei count, const GLint *params);
@@ -7954,12 +10332,12 @@ typedef void (APIENTRYP PFNGLPROGRAMBUFFERPARAMETERSIUIVNVPROC) (GLenum target,
#ifndef GL_EXT_draw_buffers2
#define GL_EXT_draw_buffers2 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glColorMaskIndexedEXT (GLuint, GLboolean, GLboolean, GLboolean, GLboolean);
-GLAPI void APIENTRY glGetBooleanIndexedvEXT (GLenum, GLuint, GLboolean *);
-GLAPI void APIENTRY glGetIntegerIndexedvEXT (GLenum, GLuint, GLint *);
-GLAPI void APIENTRY glEnableIndexedEXT (GLenum, GLuint);
-GLAPI void APIENTRY glDisableIndexedEXT (GLenum, GLuint);
-GLAPI GLboolean APIENTRY glIsEnabledIndexedEXT (GLenum, GLuint);
+GLAPI void APIENTRY glColorMaskIndexedEXT (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);
+GLAPI void APIENTRY glGetBooleanIndexedvEXT (GLenum target, GLuint index, GLboolean *data);
+GLAPI void APIENTRY glGetIntegerIndexedvEXT (GLenum target, GLuint index, GLint *data);
+GLAPI void APIENTRY glEnableIndexedEXT (GLenum target, GLuint index);
+GLAPI void APIENTRY glDisableIndexedEXT (GLenum target, GLuint index);
+GLAPI GLboolean APIENTRY glIsEnabledIndexedEXT (GLenum target, GLuint index);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLCOLORMASKINDEXEDEXTPROC) (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);
typedef void (APIENTRYP PFNGLGETBOOLEANINDEXEDVEXTPROC) (GLenum target, GLuint index, GLboolean *data);
@@ -7972,17 +10350,18 @@ typedef GLboolean (APIENTRYP PFNGLISENABLEDINDEXEDEXTPROC) (GLenum target, GLuin
#ifndef GL_NV_transform_feedback
#define GL_NV_transform_feedback 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glBeginTransformFeedbackNV (GLenum);
+GLAPI void APIENTRY glBeginTransformFeedbackNV (GLenum primitiveMode);
GLAPI void APIENTRY glEndTransformFeedbackNV (void);
-GLAPI void APIENTRY glTransformFeedbackAttribsNV (GLuint, const GLint *, GLenum);
-GLAPI void APIENTRY glBindBufferRangeNV (GLenum, GLuint, GLuint, GLintptr, GLsizeiptr);
-GLAPI void APIENTRY glBindBufferOffsetNV (GLenum, GLuint, GLuint, GLintptr);
-GLAPI void APIENTRY glBindBufferBaseNV (GLenum, GLuint, GLuint);
-GLAPI void APIENTRY glTransformFeedbackVaryingsNV (GLuint, GLsizei, const GLint *, GLenum);
-GLAPI void APIENTRY glActiveVaryingNV (GLuint, const GLchar *);
-GLAPI GLint APIENTRY glGetVaryingLocationNV (GLuint, const GLchar *);
-GLAPI void APIENTRY glGetActiveVaryingNV (GLuint, GLuint, GLsizei, GLsizei *, GLsizei *, GLenum *, GLchar *);
-GLAPI void APIENTRY glGetTransformFeedbackVaryingNV (GLuint, GLuint, GLint *);
+GLAPI void APIENTRY glTransformFeedbackAttribsNV (GLuint count, const GLint *attribs, GLenum bufferMode);
+GLAPI void APIENTRY glBindBufferRangeNV (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
+GLAPI void APIENTRY glBindBufferOffsetNV (GLenum target, GLuint index, GLuint buffer, GLintptr offset);
+GLAPI void APIENTRY glBindBufferBaseNV (GLenum target, GLuint index, GLuint buffer);
+GLAPI void APIENTRY glTransformFeedbackVaryingsNV (GLuint program, GLsizei count, const GLint *locations, GLenum bufferMode);
+GLAPI void APIENTRY glActiveVaryingNV (GLuint program, const GLchar *name);
+GLAPI GLint APIENTRY glGetVaryingLocationNV (GLuint program, const GLchar *name);
+GLAPI void APIENTRY glGetActiveVaryingNV (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);
+GLAPI void APIENTRY glGetTransformFeedbackVaryingNV (GLuint program, GLuint index, GLint *location);
+GLAPI void APIENTRY glTransformFeedbackStreamAttribsNV (GLsizei count, const GLint *attribs, GLsizei nbuffers, const GLint *bufstreams, GLenum bufferMode);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLBEGINTRANSFORMFEEDBACKNVPROC) (GLenum primitiveMode);
typedef void (APIENTRYP PFNGLENDTRANSFORMFEEDBACKNVPROC) (void);
@@ -7995,14 +10374,15 @@ typedef void (APIENTRYP PFNGLACTIVEVARYINGNVPROC) (GLuint program, const GLchar
typedef GLint (APIENTRYP PFNGLGETVARYINGLOCATIONNVPROC) (GLuint program, const GLchar *name);
typedef void (APIENTRYP PFNGLGETACTIVEVARYINGNVPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);
typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGNVPROC) (GLuint program, GLuint index, GLint *location);
+typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKSTREAMATTRIBSNVPROC) (GLsizei count, const GLint *attribs, GLsizei nbuffers, const GLint *bufstreams, GLenum bufferMode);
#endif
#ifndef GL_EXT_bindable_uniform
#define GL_EXT_bindable_uniform 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glUniformBufferEXT (GLuint, GLint, GLuint);
-GLAPI GLint APIENTRY glGetUniformBufferSizeEXT (GLuint, GLint);
-GLAPI GLintptr APIENTRY glGetUniformOffsetEXT (GLuint, GLint);
+GLAPI void APIENTRY glUniformBufferEXT (GLuint program, GLint location, GLuint buffer);
+GLAPI GLint APIENTRY glGetUniformBufferSizeEXT (GLuint program, GLint location);
+GLAPI GLintptr APIENTRY glGetUniformOffsetEXT (GLuint program, GLint location);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLUNIFORMBUFFEREXTPROC) (GLuint program, GLint location, GLuint buffer);
typedef GLint (APIENTRYP PFNGLGETUNIFORMBUFFERSIZEEXTPROC) (GLuint program, GLint location);
@@ -8012,12 +10392,12 @@ typedef GLintptr (APIENTRYP PFNGLGETUNIFORMOFFSETEXTPROC) (GLuint program, GLint
#ifndef GL_EXT_texture_integer
#define GL_EXT_texture_integer 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glTexParameterIivEXT (GLenum, GLenum, const GLint *);
-GLAPI void APIENTRY glTexParameterIuivEXT (GLenum, GLenum, const GLuint *);
-GLAPI void APIENTRY glGetTexParameterIivEXT (GLenum, GLenum, GLint *);
-GLAPI void APIENTRY glGetTexParameterIuivEXT (GLenum, GLenum, GLuint *);
-GLAPI void APIENTRY glClearColorIiEXT (GLint, GLint, GLint, GLint);
-GLAPI void APIENTRY glClearColorIuiEXT (GLuint, GLuint, GLuint, GLuint);
+GLAPI void APIENTRY glTexParameterIivEXT (GLenum target, GLenum pname, const GLint *params);
+GLAPI void APIENTRY glTexParameterIuivEXT (GLenum target, GLenum pname, const GLuint *params);
+GLAPI void APIENTRY glGetTexParameterIivEXT (GLenum target, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetTexParameterIuivEXT (GLenum target, GLenum pname, GLuint *params);
+GLAPI void APIENTRY glClearColorIiEXT (GLint red, GLint green, GLint blue, GLint alpha);
+GLAPI void APIENTRY glClearColorIuiEXT (GLuint red, GLuint green, GLuint blue, GLuint alpha);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLTEXPARAMETERIIVEXTPROC) (GLenum target, GLenum pname, const GLint *params);
typedef void (APIENTRYP PFNGLTEXPARAMETERIUIVEXTPROC) (GLenum target, GLenum pname, const GLuint *params);
@@ -8038,7 +10418,7 @@ typedef void (APIENTRYP PFNGLFRAMETERMINATORGREMEDYPROC) (void);
#ifndef GL_NV_conditional_render
#define GL_NV_conditional_render 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glBeginConditionalRenderNV (GLuint, GLenum);
+GLAPI void APIENTRY glBeginConditionalRenderNV (GLuint id, GLenum mode);
GLAPI void APIENTRY glEndConditionalRenderNV (void);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLBEGINCONDITIONALRENDERNVPROC) (GLuint id, GLenum mode);
@@ -8048,13 +10428,12 @@ typedef void (APIENTRYP PFNGLENDCONDITIONALRENDERNVPROC) (void);
#ifndef GL_NV_present_video
#define GL_NV_present_video 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glPresentFrameKeyedNV (GLuint, GLuint64EXT, GLuint, GLuint, GLenum, GLenum, GLuint, GLuint, GLenum, GLuint, GLuint);
-GLAPI void APIENTRY glPresentFrameDualFillNV (GLuint, GLuint64EXT, GLuint, GLuint, GLenum, GLenum, GLuint, GLenum, GLuint, GLenum, GLuint, GLenum, GLuint);
-GLAPI void APIENTRY glGetVideoivNV (GLuint, GLenum, GLint *);
-GLAPI void APIENTRY glGetVideouivNV (GLuint, GLenum, GLuint *);
-GLAPI void APIENTRY glGetVideoi64vNV (GLuint, GLenum, GLint64EXT *);
-GLAPI void APIENTRY glGetVideoui64vNV (GLuint, GLenum, GLuint64EXT *);
-GLAPI void APIENTRY glVideoParameterivNV (GLuint, GLenum, const GLint *);
+GLAPI void APIENTRY glPresentFrameKeyedNV (GLuint video_slot, GLuint64EXT minPresentTime, GLuint beginPresentTimeId, GLuint presentDurationId, GLenum type, GLenum target0, GLuint fill0, GLuint key0, GLenum target1, GLuint fill1, GLuint key1);
+GLAPI void APIENTRY glPresentFrameDualFillNV (GLuint video_slot, GLuint64EXT minPresentTime, GLuint beginPresentTimeId, GLuint presentDurationId, GLenum type, GLenum target0, GLuint fill0, GLenum target1, GLuint fill1, GLenum target2, GLuint fill2, GLenum target3, GLuint fill3);
+GLAPI void APIENTRY glGetVideoivNV (GLuint video_slot, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetVideouivNV (GLuint video_slot, GLenum pname, GLuint *params);
+GLAPI void APIENTRY glGetVideoi64vNV (GLuint video_slot, GLenum pname, GLint64EXT *params);
+GLAPI void APIENTRY glGetVideoui64vNV (GLuint video_slot, GLenum pname, GLuint64EXT *params);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLPRESENTFRAMEKEYEDNVPROC) (GLuint video_slot, GLuint64EXT minPresentTime, GLuint beginPresentTimeId, GLuint presentDurationId, GLenum type, GLenum target0, GLuint fill0, GLuint key0, GLenum target1, GLuint fill1, GLuint key1);
typedef void (APIENTRYP PFNGLPRESENTFRAMEDUALFILLNVPROC) (GLuint video_slot, GLuint64EXT minPresentTime, GLuint beginPresentTimeId, GLuint presentDurationId, GLenum type, GLenum target0, GLuint fill0, GLenum target1, GLuint fill1, GLenum target2, GLuint fill2, GLenum target3, GLuint fill3);
@@ -8062,19 +10441,18 @@ typedef void (APIENTRYP PFNGLGETVIDEOIVNVPROC) (GLuint video_slot, GLenum pname,
typedef void (APIENTRYP PFNGLGETVIDEOUIVNVPROC) (GLuint video_slot, GLenum pname, GLuint *params);
typedef void (APIENTRYP PFNGLGETVIDEOI64VNVPROC) (GLuint video_slot, GLenum pname, GLint64EXT *params);
typedef void (APIENTRYP PFNGLGETVIDEOUI64VNVPROC) (GLuint video_slot, GLenum pname, GLuint64EXT *params);
-typedef void (APIENTRYP PFNGLVIDEOPARAMETERIVNVPROC) (GLuint video_slot, GLenum pname, const GLint *params);
#endif
#ifndef GL_EXT_transform_feedback
#define GL_EXT_transform_feedback 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glBeginTransformFeedbackEXT (GLenum);
+GLAPI void APIENTRY glBeginTransformFeedbackEXT (GLenum primitiveMode);
GLAPI void APIENTRY glEndTransformFeedbackEXT (void);
-GLAPI void APIENTRY glBindBufferRangeEXT (GLenum, GLuint, GLuint, GLintptr, GLsizeiptr);
-GLAPI void APIENTRY glBindBufferOffsetEXT (GLenum, GLuint, GLuint, GLintptr);
-GLAPI void APIENTRY glBindBufferBaseEXT (GLenum, GLuint, GLuint);
-GLAPI void APIENTRY glTransformFeedbackVaryingsEXT (GLuint, GLsizei, const GLchar* *, GLenum);
-GLAPI void APIENTRY glGetTransformFeedbackVaryingEXT (GLuint, GLuint, GLsizei, GLsizei *, GLsizei *, GLenum *, GLchar *);
+GLAPI void APIENTRY glBindBufferRangeEXT (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
+GLAPI void APIENTRY glBindBufferOffsetEXT (GLenum target, GLuint index, GLuint buffer, GLintptr offset);
+GLAPI void APIENTRY glBindBufferBaseEXT (GLenum target, GLuint index, GLuint buffer);
+GLAPI void APIENTRY glTransformFeedbackVaryingsEXT (GLuint program, GLsizei count, const GLchar* *varyings, GLenum bufferMode);
+GLAPI void APIENTRY glGetTransformFeedbackVaryingEXT (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLBEGINTRANSFORMFEEDBACKEXTPROC) (GLenum primitiveMode);
typedef void (APIENTRYP PFNGLENDTRANSFORMFEEDBACKEXTPROC) (void);
@@ -8088,192 +10466,212 @@ typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGEXTPROC) (GLuint program
#ifndef GL_EXT_direct_state_access
#define GL_EXT_direct_state_access 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glClientAttribDefaultEXT (GLbitfield);
-GLAPI void APIENTRY glPushClientAttribDefaultEXT (GLbitfield);
-GLAPI void APIENTRY glMatrixLoadfEXT (GLenum, const GLfloat *);
-GLAPI void APIENTRY glMatrixLoaddEXT (GLenum, const GLdouble *);
-GLAPI void APIENTRY glMatrixMultfEXT (GLenum, const GLfloat *);
-GLAPI void APIENTRY glMatrixMultdEXT (GLenum, const GLdouble *);
-GLAPI void APIENTRY glMatrixLoadIdentityEXT (GLenum);
-GLAPI void APIENTRY glMatrixRotatefEXT (GLenum, GLfloat, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glMatrixRotatedEXT (GLenum, GLdouble, GLdouble, GLdouble, GLdouble);
-GLAPI void APIENTRY glMatrixScalefEXT (GLenum, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glMatrixScaledEXT (GLenum, GLdouble, GLdouble, GLdouble);
-GLAPI void APIENTRY glMatrixTranslatefEXT (GLenum, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glMatrixTranslatedEXT (GLenum, GLdouble, GLdouble, GLdouble);
-GLAPI void APIENTRY glMatrixFrustumEXT (GLenum, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble);
-GLAPI void APIENTRY glMatrixOrthoEXT (GLenum, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble);
-GLAPI void APIENTRY glMatrixPopEXT (GLenum);
-GLAPI void APIENTRY glMatrixPushEXT (GLenum);
-GLAPI void APIENTRY glMatrixLoadTransposefEXT (GLenum, const GLfloat *);
-GLAPI void APIENTRY glMatrixLoadTransposedEXT (GLenum, const GLdouble *);
-GLAPI void APIENTRY glMatrixMultTransposefEXT (GLenum, const GLfloat *);
-GLAPI void APIENTRY glMatrixMultTransposedEXT (GLenum, const GLdouble *);
-GLAPI void APIENTRY glTextureParameterfEXT (GLuint, GLenum, GLenum, GLfloat);
-GLAPI void APIENTRY glTextureParameterfvEXT (GLuint, GLenum, GLenum, const GLfloat *);
-GLAPI void APIENTRY glTextureParameteriEXT (GLuint, GLenum, GLenum, GLint);
-GLAPI void APIENTRY glTextureParameterivEXT (GLuint, GLenum, GLenum, const GLint *);
-GLAPI void APIENTRY glTextureImage1DEXT (GLuint, GLenum, GLint, GLenum, GLsizei, GLint, GLenum, GLenum, const GLvoid *);
-GLAPI void APIENTRY glTextureImage2DEXT (GLuint, GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *);
-GLAPI void APIENTRY glTextureSubImage1DEXT (GLuint, GLenum, GLint, GLint, GLsizei, GLenum, GLenum, const GLvoid *);
-GLAPI void APIENTRY glTextureSubImage2DEXT (GLuint, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
-GLAPI void APIENTRY glCopyTextureImage1DEXT (GLuint, GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLint);
-GLAPI void APIENTRY glCopyTextureImage2DEXT (GLuint, GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint);
-GLAPI void APIENTRY glCopyTextureSubImage1DEXT (GLuint, GLenum, GLint, GLint, GLint, GLint, GLsizei);
-GLAPI void APIENTRY glCopyTextureSubImage2DEXT (GLuint, GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei);
-GLAPI void APIENTRY glGetTextureImageEXT (GLuint, GLenum, GLint, GLenum, GLenum, GLvoid *);
-GLAPI void APIENTRY glGetTextureParameterfvEXT (GLuint, GLenum, GLenum, GLfloat *);
-GLAPI void APIENTRY glGetTextureParameterivEXT (GLuint, GLenum, GLenum, GLint *);
-GLAPI void APIENTRY glGetTextureLevelParameterfvEXT (GLuint, GLenum, GLint, GLenum, GLfloat *);
-GLAPI void APIENTRY glGetTextureLevelParameterivEXT (GLuint, GLenum, GLint, GLenum, GLint *);
-GLAPI void APIENTRY glTextureImage3DEXT (GLuint, GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *);
-GLAPI void APIENTRY glTextureSubImage3DEXT (GLuint, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
-GLAPI void APIENTRY glCopyTextureSubImage3DEXT (GLuint, GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei);
-GLAPI void APIENTRY glMultiTexParameterfEXT (GLenum, GLenum, GLenum, GLfloat);
-GLAPI void APIENTRY glMultiTexParameterfvEXT (GLenum, GLenum, GLenum, const GLfloat *);
-GLAPI void APIENTRY glMultiTexParameteriEXT (GLenum, GLenum, GLenum, GLint);
-GLAPI void APIENTRY glMultiTexParameterivEXT (GLenum, GLenum, GLenum, const GLint *);
-GLAPI void APIENTRY glMultiTexImage1DEXT (GLenum, GLenum, GLint, GLenum, GLsizei, GLint, GLenum, GLenum, const GLvoid *);
-GLAPI void APIENTRY glMultiTexImage2DEXT (GLenum, GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *);
-GLAPI void APIENTRY glMultiTexSubImage1DEXT (GLenum, GLenum, GLint, GLint, GLsizei, GLenum, GLenum, const GLvoid *);
-GLAPI void APIENTRY glMultiTexSubImage2DEXT (GLenum, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
-GLAPI void APIENTRY glCopyMultiTexImage1DEXT (GLenum, GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLint);
-GLAPI void APIENTRY glCopyMultiTexImage2DEXT (GLenum, GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint);
-GLAPI void APIENTRY glCopyMultiTexSubImage1DEXT (GLenum, GLenum, GLint, GLint, GLint, GLint, GLsizei);
-GLAPI void APIENTRY glCopyMultiTexSubImage2DEXT (GLenum, GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei);
-GLAPI void APIENTRY glGetMultiTexImageEXT (GLenum, GLenum, GLint, GLenum, GLenum, GLvoid *);
-GLAPI void APIENTRY glGetMultiTexParameterfvEXT (GLenum, GLenum, GLenum, GLfloat *);
-GLAPI void APIENTRY glGetMultiTexParameterivEXT (GLenum, GLenum, GLenum, GLint *);
-GLAPI void APIENTRY glGetMultiTexLevelParameterfvEXT (GLenum, GLenum, GLint, GLenum, GLfloat *);
-GLAPI void APIENTRY glGetMultiTexLevelParameterivEXT (GLenum, GLenum, GLint, GLenum, GLint *);
-GLAPI void APIENTRY glMultiTexImage3DEXT (GLenum, GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *);
-GLAPI void APIENTRY glMultiTexSubImage3DEXT (GLenum, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
-GLAPI void APIENTRY glCopyMultiTexSubImage3DEXT (GLenum, GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei);
-GLAPI void APIENTRY glBindMultiTextureEXT (GLenum, GLenum, GLuint);
-GLAPI void APIENTRY glEnableClientStateIndexedEXT (GLenum, GLuint);
-GLAPI void APIENTRY glDisableClientStateIndexedEXT (GLenum, GLuint);
-GLAPI void APIENTRY glMultiTexCoordPointerEXT (GLenum, GLint, GLenum, GLsizei, const GLvoid *);
-GLAPI void APIENTRY glMultiTexEnvfEXT (GLenum, GLenum, GLenum, GLfloat);
-GLAPI void APIENTRY glMultiTexEnvfvEXT (GLenum, GLenum, GLenum, const GLfloat *);
-GLAPI void APIENTRY glMultiTexEnviEXT (GLenum, GLenum, GLenum, GLint);
-GLAPI void APIENTRY glMultiTexEnvivEXT (GLenum, GLenum, GLenum, const GLint *);
-GLAPI void APIENTRY glMultiTexGendEXT (GLenum, GLenum, GLenum, GLdouble);
-GLAPI void APIENTRY glMultiTexGendvEXT (GLenum, GLenum, GLenum, const GLdouble *);
-GLAPI void APIENTRY glMultiTexGenfEXT (GLenum, GLenum, GLenum, GLfloat);
-GLAPI void APIENTRY glMultiTexGenfvEXT (GLenum, GLenum, GLenum, const GLfloat *);
-GLAPI void APIENTRY glMultiTexGeniEXT (GLenum, GLenum, GLenum, GLint);
-GLAPI void APIENTRY glMultiTexGenivEXT (GLenum, GLenum, GLenum, const GLint *);
-GLAPI void APIENTRY glGetMultiTexEnvfvEXT (GLenum, GLenum, GLenum, GLfloat *);
-GLAPI void APIENTRY glGetMultiTexEnvivEXT (GLenum, GLenum, GLenum, GLint *);
-GLAPI void APIENTRY glGetMultiTexGendvEXT (GLenum, GLenum, GLenum, GLdouble *);
-GLAPI void APIENTRY glGetMultiTexGenfvEXT (GLenum, GLenum, GLenum, GLfloat *);
-GLAPI void APIENTRY glGetMultiTexGenivEXT (GLenum, GLenum, GLenum, GLint *);
-GLAPI void APIENTRY glGetFloatIndexedvEXT (GLenum, GLuint, GLfloat *);
-GLAPI void APIENTRY glGetDoubleIndexedvEXT (GLenum, GLuint, GLdouble *);
-GLAPI void APIENTRY glGetPointerIndexedvEXT (GLenum, GLuint, GLvoid* *);
-GLAPI void APIENTRY glCompressedTextureImage3DEXT (GLuint, GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *);
-GLAPI void APIENTRY glCompressedTextureImage2DEXT (GLuint, GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *);
-GLAPI void APIENTRY glCompressedTextureImage1DEXT (GLuint, GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const GLvoid *);
-GLAPI void APIENTRY glCompressedTextureSubImage3DEXT (GLuint, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *);
-GLAPI void APIENTRY glCompressedTextureSubImage2DEXT (GLuint, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *);
-GLAPI void APIENTRY glCompressedTextureSubImage1DEXT (GLuint, GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const GLvoid *);
-GLAPI void APIENTRY glGetCompressedTextureImageEXT (GLuint, GLenum, GLint, GLvoid *);
-GLAPI void APIENTRY glCompressedMultiTexImage3DEXT (GLenum, GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *);
-GLAPI void APIENTRY glCompressedMultiTexImage2DEXT (GLenum, GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *);
-GLAPI void APIENTRY glCompressedMultiTexImage1DEXT (GLenum, GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const GLvoid *);
-GLAPI void APIENTRY glCompressedMultiTexSubImage3DEXT (GLenum, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *);
-GLAPI void APIENTRY glCompressedMultiTexSubImage2DEXT (GLenum, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *);
-GLAPI void APIENTRY glCompressedMultiTexSubImage1DEXT (GLenum, GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const GLvoid *);
-GLAPI void APIENTRY glGetCompressedMultiTexImageEXT (GLenum, GLenum, GLint, GLvoid *);
-GLAPI void APIENTRY glNamedProgramStringEXT (GLuint, GLenum, GLenum, GLsizei, const GLvoid *);
-GLAPI void APIENTRY glNamedProgramLocalParameter4dEXT (GLuint, GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble);
-GLAPI void APIENTRY glNamedProgramLocalParameter4dvEXT (GLuint, GLenum, GLuint, const GLdouble *);
-GLAPI void APIENTRY glNamedProgramLocalParameter4fEXT (GLuint, GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glNamedProgramLocalParameter4fvEXT (GLuint, GLenum, GLuint, const GLfloat *);
-GLAPI void APIENTRY glGetNamedProgramLocalParameterdvEXT (GLuint, GLenum, GLuint, GLdouble *);
-GLAPI void APIENTRY glGetNamedProgramLocalParameterfvEXT (GLuint, GLenum, GLuint, GLfloat *);
-GLAPI void APIENTRY glGetNamedProgramivEXT (GLuint, GLenum, GLenum, GLint *);
-GLAPI void APIENTRY glGetNamedProgramStringEXT (GLuint, GLenum, GLenum, GLvoid *);
-GLAPI void APIENTRY glNamedProgramLocalParameters4fvEXT (GLuint, GLenum, GLuint, GLsizei, const GLfloat *);
-GLAPI void APIENTRY glNamedProgramLocalParameterI4iEXT (GLuint, GLenum, GLuint, GLint, GLint, GLint, GLint);
-GLAPI void APIENTRY glNamedProgramLocalParameterI4ivEXT (GLuint, GLenum, GLuint, const GLint *);
-GLAPI void APIENTRY glNamedProgramLocalParametersI4ivEXT (GLuint, GLenum, GLuint, GLsizei, const GLint *);
-GLAPI void APIENTRY glNamedProgramLocalParameterI4uiEXT (GLuint, GLenum, GLuint, GLuint, GLuint, GLuint, GLuint);
-GLAPI void APIENTRY glNamedProgramLocalParameterI4uivEXT (GLuint, GLenum, GLuint, const GLuint *);
-GLAPI void APIENTRY glNamedProgramLocalParametersI4uivEXT (GLuint, GLenum, GLuint, GLsizei, const GLuint *);
-GLAPI void APIENTRY glGetNamedProgramLocalParameterIivEXT (GLuint, GLenum, GLuint, GLint *);
-GLAPI void APIENTRY glGetNamedProgramLocalParameterIuivEXT (GLuint, GLenum, GLuint, GLuint *);
-GLAPI void APIENTRY glTextureParameterIivEXT (GLuint, GLenum, GLenum, const GLint *);
-GLAPI void APIENTRY glTextureParameterIuivEXT (GLuint, GLenum, GLenum, const GLuint *);
-GLAPI void APIENTRY glGetTextureParameterIivEXT (GLuint, GLenum, GLenum, GLint *);
-GLAPI void APIENTRY glGetTextureParameterIuivEXT (GLuint, GLenum, GLenum, GLuint *);
-GLAPI void APIENTRY glMultiTexParameterIivEXT (GLenum, GLenum, GLenum, const GLint *);
-GLAPI void APIENTRY glMultiTexParameterIuivEXT (GLenum, GLenum, GLenum, const GLuint *);
-GLAPI void APIENTRY glGetMultiTexParameterIivEXT (GLenum, GLenum, GLenum, GLint *);
-GLAPI void APIENTRY glGetMultiTexParameterIuivEXT (GLenum, GLenum, GLenum, GLuint *);
-GLAPI void APIENTRY glProgramUniform1fEXT (GLuint, GLint, GLfloat);
-GLAPI void APIENTRY glProgramUniform2fEXT (GLuint, GLint, GLfloat, GLfloat);
-GLAPI void APIENTRY glProgramUniform3fEXT (GLuint, GLint, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glProgramUniform4fEXT (GLuint, GLint, GLfloat, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glProgramUniform1iEXT (GLuint, GLint, GLint);
-GLAPI void APIENTRY glProgramUniform2iEXT (GLuint, GLint, GLint, GLint);
-GLAPI void APIENTRY glProgramUniform3iEXT (GLuint, GLint, GLint, GLint, GLint);
-GLAPI void APIENTRY glProgramUniform4iEXT (GLuint, GLint, GLint, GLint, GLint, GLint);
-GLAPI void APIENTRY glProgramUniform1fvEXT (GLuint, GLint, GLsizei, const GLfloat *);
-GLAPI void APIENTRY glProgramUniform2fvEXT (GLuint, GLint, GLsizei, const GLfloat *);
-GLAPI void APIENTRY glProgramUniform3fvEXT (GLuint, GLint, GLsizei, const GLfloat *);
-GLAPI void APIENTRY glProgramUniform4fvEXT (GLuint, GLint, GLsizei, const GLfloat *);
-GLAPI void APIENTRY glProgramUniform1ivEXT (GLuint, GLint, GLsizei, const GLint *);
-GLAPI void APIENTRY glProgramUniform2ivEXT (GLuint, GLint, GLsizei, const GLint *);
-GLAPI void APIENTRY glProgramUniform3ivEXT (GLuint, GLint, GLsizei, const GLint *);
-GLAPI void APIENTRY glProgramUniform4ivEXT (GLuint, GLint, GLsizei, const GLint *);
-GLAPI void APIENTRY glProgramUniformMatrix2fvEXT (GLuint, GLint, GLsizei, GLboolean, const GLfloat *);
-GLAPI void APIENTRY glProgramUniformMatrix3fvEXT (GLuint, GLint, GLsizei, GLboolean, const GLfloat *);
-GLAPI void APIENTRY glProgramUniformMatrix4fvEXT (GLuint, GLint, GLsizei, GLboolean, const GLfloat *);
-GLAPI void APIENTRY glProgramUniformMatrix2x3fvEXT (GLuint, GLint, GLsizei, GLboolean, const GLfloat *);
-GLAPI void APIENTRY glProgramUniformMatrix3x2fvEXT (GLuint, GLint, GLsizei, GLboolean, const GLfloat *);
-GLAPI void APIENTRY glProgramUniformMatrix2x4fvEXT (GLuint, GLint, GLsizei, GLboolean, const GLfloat *);
-GLAPI void APIENTRY glProgramUniformMatrix4x2fvEXT (GLuint, GLint, GLsizei, GLboolean, const GLfloat *);
-GLAPI void APIENTRY glProgramUniformMatrix3x4fvEXT (GLuint, GLint, GLsizei, GLboolean, const GLfloat *);
-GLAPI void APIENTRY glProgramUniformMatrix4x3fvEXT (GLuint, GLint, GLsizei, GLboolean, const GLfloat *);
-GLAPI void APIENTRY glProgramUniform1uiEXT (GLuint, GLint, GLuint);
-GLAPI void APIENTRY glProgramUniform2uiEXT (GLuint, GLint, GLuint, GLuint);
-GLAPI void APIENTRY glProgramUniform3uiEXT (GLuint, GLint, GLuint, GLuint, GLuint);
-GLAPI void APIENTRY glProgramUniform4uiEXT (GLuint, GLint, GLuint, GLuint, GLuint, GLuint);
-GLAPI void APIENTRY glProgramUniform1uivEXT (GLuint, GLint, GLsizei, const GLuint *);
-GLAPI void APIENTRY glProgramUniform2uivEXT (GLuint, GLint, GLsizei, const GLuint *);
-GLAPI void APIENTRY glProgramUniform3uivEXT (GLuint, GLint, GLsizei, const GLuint *);
-GLAPI void APIENTRY glProgramUniform4uivEXT (GLuint, GLint, GLsizei, const GLuint *);
-GLAPI void APIENTRY glNamedBufferDataEXT (GLuint, GLsizeiptr, const GLvoid *, GLenum);
-GLAPI void APIENTRY glNamedBufferSubDataEXT (GLuint, GLintptr, GLsizeiptr, const GLvoid *);
-GLAPI GLvoid* APIENTRY glMapNamedBufferEXT (GLuint, GLenum);
-GLAPI GLboolean APIENTRY glUnmapNamedBufferEXT (GLuint);
-GLAPI void APIENTRY glGetNamedBufferParameterivEXT (GLuint, GLenum, GLint *);
-GLAPI void APIENTRY glGetNamedBufferPointervEXT (GLuint, GLenum, GLvoid* *);
-GLAPI void APIENTRY glGetNamedBufferSubDataEXT (GLuint, GLintptr, GLsizeiptr, GLvoid *);
-GLAPI void APIENTRY glTextureBufferEXT (GLuint, GLenum, GLenum, GLuint);
-GLAPI void APIENTRY glMultiTexBufferEXT (GLenum, GLenum, GLenum, GLuint);
-GLAPI void APIENTRY glNamedRenderbufferStorageEXT (GLuint, GLenum, GLsizei, GLsizei);
-GLAPI void APIENTRY glGetNamedRenderbufferParameterivEXT (GLuint, GLenum, GLint *);
-GLAPI GLenum APIENTRY glCheckNamedFramebufferStatusEXT (GLuint, GLenum);
-GLAPI void APIENTRY glNamedFramebufferTexture1DEXT (GLuint, GLenum, GLenum, GLuint, GLint);
-GLAPI void APIENTRY glNamedFramebufferTexture2DEXT (GLuint, GLenum, GLenum, GLuint, GLint);
-GLAPI void APIENTRY glNamedFramebufferTexture3DEXT (GLuint, GLenum, GLenum, GLuint, GLint, GLint);
-GLAPI void APIENTRY glNamedFramebufferRenderbufferEXT (GLuint, GLenum, GLenum, GLuint);
-GLAPI void APIENTRY glGetNamedFramebufferAttachmentParameterivEXT (GLuint, GLenum, GLenum, GLint *);
-GLAPI void APIENTRY glGenerateTextureMipmapEXT (GLuint, GLenum);
-GLAPI void APIENTRY glGenerateMultiTexMipmapEXT (GLenum, GLenum);
-GLAPI void APIENTRY glFramebufferDrawBufferEXT (GLuint, GLenum);
-GLAPI void APIENTRY glFramebufferDrawBuffersEXT (GLuint, GLsizei, const GLenum *);
-GLAPI void APIENTRY glFramebufferReadBufferEXT (GLuint, GLenum);
-GLAPI void APIENTRY glGetFramebufferParameterivEXT (GLuint, GLenum, GLint *);
-GLAPI void APIENTRY glNamedRenderbufferStorageMultisampleEXT (GLuint, GLsizei, GLenum, GLsizei, GLsizei);
-GLAPI void APIENTRY glNamedRenderbufferStorageMultisampleCoverageEXT (GLuint, GLsizei, GLsizei, GLenum, GLsizei, GLsizei);
-GLAPI void APIENTRY glNamedFramebufferTextureEXT (GLuint, GLenum, GLuint, GLint);
-GLAPI void APIENTRY glNamedFramebufferTextureLayerEXT (GLuint, GLenum, GLuint, GLint, GLint);
-GLAPI void APIENTRY glNamedFramebufferTextureFaceEXT (GLuint, GLenum, GLuint, GLint, GLenum);
-GLAPI void APIENTRY glTextureRenderbufferEXT (GLuint, GLenum, GLuint);
-GLAPI void APIENTRY glMultiTexRenderbufferEXT (GLenum, GLenum, GLuint);
+GLAPI void APIENTRY glClientAttribDefaultEXT (GLbitfield mask);
+GLAPI void APIENTRY glPushClientAttribDefaultEXT (GLbitfield mask);
+GLAPI void APIENTRY glMatrixLoadfEXT (GLenum mode, const GLfloat *m);
+GLAPI void APIENTRY glMatrixLoaddEXT (GLenum mode, const GLdouble *m);
+GLAPI void APIENTRY glMatrixMultfEXT (GLenum mode, const GLfloat *m);
+GLAPI void APIENTRY glMatrixMultdEXT (GLenum mode, const GLdouble *m);
+GLAPI void APIENTRY glMatrixLoadIdentityEXT (GLenum mode);
+GLAPI void APIENTRY glMatrixRotatefEXT (GLenum mode, GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
+GLAPI void APIENTRY glMatrixRotatedEXT (GLenum mode, GLdouble angle, GLdouble x, GLdouble y, GLdouble z);
+GLAPI void APIENTRY glMatrixScalefEXT (GLenum mode, GLfloat x, GLfloat y, GLfloat z);
+GLAPI void APIENTRY glMatrixScaledEXT (GLenum mode, GLdouble x, GLdouble y, GLdouble z);
+GLAPI void APIENTRY glMatrixTranslatefEXT (GLenum mode, GLfloat x, GLfloat y, GLfloat z);
+GLAPI void APIENTRY glMatrixTranslatedEXT (GLenum mode, GLdouble x, GLdouble y, GLdouble z);
+GLAPI void APIENTRY glMatrixFrustumEXT (GLenum mode, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
+GLAPI void APIENTRY glMatrixOrthoEXT (GLenum mode, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
+GLAPI void APIENTRY glMatrixPopEXT (GLenum mode);
+GLAPI void APIENTRY glMatrixPushEXT (GLenum mode);
+GLAPI void APIENTRY glMatrixLoadTransposefEXT (GLenum mode, const GLfloat *m);
+GLAPI void APIENTRY glMatrixLoadTransposedEXT (GLenum mode, const GLdouble *m);
+GLAPI void APIENTRY glMatrixMultTransposefEXT (GLenum mode, const GLfloat *m);
+GLAPI void APIENTRY glMatrixMultTransposedEXT (GLenum mode, const GLdouble *m);
+GLAPI void APIENTRY glTextureParameterfEXT (GLuint texture, GLenum target, GLenum pname, GLfloat param);
+GLAPI void APIENTRY glTextureParameterfvEXT (GLuint texture, GLenum target, GLenum pname, const GLfloat *params);
+GLAPI void APIENTRY glTextureParameteriEXT (GLuint texture, GLenum target, GLenum pname, GLint param);
+GLAPI void APIENTRY glTextureParameterivEXT (GLuint texture, GLenum target, GLenum pname, const GLint *params);
+GLAPI void APIENTRY glTextureImage1DEXT (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
+GLAPI void APIENTRY glTextureImage2DEXT (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
+GLAPI void APIENTRY glTextureSubImage1DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels);
+GLAPI void APIENTRY glTextureSubImage2DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
+GLAPI void APIENTRY glCopyTextureImage1DEXT (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);
+GLAPI void APIENTRY glCopyTextureImage2DEXT (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
+GLAPI void APIENTRY glCopyTextureSubImage1DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
+GLAPI void APIENTRY glCopyTextureSubImage2DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+GLAPI void APIENTRY glGetTextureImageEXT (GLuint texture, GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels);
+GLAPI void APIENTRY glGetTextureParameterfvEXT (GLuint texture, GLenum target, GLenum pname, GLfloat *params);
+GLAPI void APIENTRY glGetTextureParameterivEXT (GLuint texture, GLenum target, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetTextureLevelParameterfvEXT (GLuint texture, GLenum target, GLint level, GLenum pname, GLfloat *params);
+GLAPI void APIENTRY glGetTextureLevelParameterivEXT (GLuint texture, GLenum target, GLint level, GLenum pname, GLint *params);
+GLAPI void APIENTRY glTextureImage3DEXT (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
+GLAPI void APIENTRY glTextureSubImage3DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);
+GLAPI void APIENTRY glCopyTextureSubImage3DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+GLAPI void APIENTRY glMultiTexParameterfEXT (GLenum texunit, GLenum target, GLenum pname, GLfloat param);
+GLAPI void APIENTRY glMultiTexParameterfvEXT (GLenum texunit, GLenum target, GLenum pname, const GLfloat *params);
+GLAPI void APIENTRY glMultiTexParameteriEXT (GLenum texunit, GLenum target, GLenum pname, GLint param);
+GLAPI void APIENTRY glMultiTexParameterivEXT (GLenum texunit, GLenum target, GLenum pname, const GLint *params);
+GLAPI void APIENTRY glMultiTexImage1DEXT (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
+GLAPI void APIENTRY glMultiTexImage2DEXT (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
+GLAPI void APIENTRY glMultiTexSubImage1DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels);
+GLAPI void APIENTRY glMultiTexSubImage2DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
+GLAPI void APIENTRY glCopyMultiTexImage1DEXT (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);
+GLAPI void APIENTRY glCopyMultiTexImage2DEXT (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
+GLAPI void APIENTRY glCopyMultiTexSubImage1DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
+GLAPI void APIENTRY glCopyMultiTexSubImage2DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+GLAPI void APIENTRY glGetMultiTexImageEXT (GLenum texunit, GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels);
+GLAPI void APIENTRY glGetMultiTexParameterfvEXT (GLenum texunit, GLenum target, GLenum pname, GLfloat *params);
+GLAPI void APIENTRY glGetMultiTexParameterivEXT (GLenum texunit, GLenum target, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetMultiTexLevelParameterfvEXT (GLenum texunit, GLenum target, GLint level, GLenum pname, GLfloat *params);
+GLAPI void APIENTRY glGetMultiTexLevelParameterivEXT (GLenum texunit, GLenum target, GLint level, GLenum pname, GLint *params);
+GLAPI void APIENTRY glMultiTexImage3DEXT (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
+GLAPI void APIENTRY glMultiTexSubImage3DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);
+GLAPI void APIENTRY glCopyMultiTexSubImage3DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+GLAPI void APIENTRY glBindMultiTextureEXT (GLenum texunit, GLenum target, GLuint texture);
+GLAPI void APIENTRY glEnableClientStateIndexedEXT (GLenum array, GLuint index);
+GLAPI void APIENTRY glDisableClientStateIndexedEXT (GLenum array, GLuint index);
+GLAPI void APIENTRY glMultiTexCoordPointerEXT (GLenum texunit, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
+GLAPI void APIENTRY glMultiTexEnvfEXT (GLenum texunit, GLenum target, GLenum pname, GLfloat param);
+GLAPI void APIENTRY glMultiTexEnvfvEXT (GLenum texunit, GLenum target, GLenum pname, const GLfloat *params);
+GLAPI void APIENTRY glMultiTexEnviEXT (GLenum texunit, GLenum target, GLenum pname, GLint param);
+GLAPI void APIENTRY glMultiTexEnvivEXT (GLenum texunit, GLenum target, GLenum pname, const GLint *params);
+GLAPI void APIENTRY glMultiTexGendEXT (GLenum texunit, GLenum coord, GLenum pname, GLdouble param);
+GLAPI void APIENTRY glMultiTexGendvEXT (GLenum texunit, GLenum coord, GLenum pname, const GLdouble *params);
+GLAPI void APIENTRY glMultiTexGenfEXT (GLenum texunit, GLenum coord, GLenum pname, GLfloat param);
+GLAPI void APIENTRY glMultiTexGenfvEXT (GLenum texunit, GLenum coord, GLenum pname, const GLfloat *params);
+GLAPI void APIENTRY glMultiTexGeniEXT (GLenum texunit, GLenum coord, GLenum pname, GLint param);
+GLAPI void APIENTRY glMultiTexGenivEXT (GLenum texunit, GLenum coord, GLenum pname, const GLint *params);
+GLAPI void APIENTRY glGetMultiTexEnvfvEXT (GLenum texunit, GLenum target, GLenum pname, GLfloat *params);
+GLAPI void APIENTRY glGetMultiTexEnvivEXT (GLenum texunit, GLenum target, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetMultiTexGendvEXT (GLenum texunit, GLenum coord, GLenum pname, GLdouble *params);
+GLAPI void APIENTRY glGetMultiTexGenfvEXT (GLenum texunit, GLenum coord, GLenum pname, GLfloat *params);
+GLAPI void APIENTRY glGetMultiTexGenivEXT (GLenum texunit, GLenum coord, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetFloatIndexedvEXT (GLenum target, GLuint index, GLfloat *data);
+GLAPI void APIENTRY glGetDoubleIndexedvEXT (GLenum target, GLuint index, GLdouble *data);
+GLAPI void APIENTRY glGetPointerIndexedvEXT (GLenum target, GLuint index, GLvoid* *data);
+GLAPI void APIENTRY glCompressedTextureImage3DEXT (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *bits);
+GLAPI void APIENTRY glCompressedTextureImage2DEXT (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *bits);
+GLAPI void APIENTRY glCompressedTextureImage1DEXT (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *bits);
+GLAPI void APIENTRY glCompressedTextureSubImage3DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *bits);
+GLAPI void APIENTRY glCompressedTextureSubImage2DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *bits);
+GLAPI void APIENTRY glCompressedTextureSubImage1DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *bits);
+GLAPI void APIENTRY glGetCompressedTextureImageEXT (GLuint texture, GLenum target, GLint lod, GLvoid *img);
+GLAPI void APIENTRY glCompressedMultiTexImage3DEXT (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *bits);
+GLAPI void APIENTRY glCompressedMultiTexImage2DEXT (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *bits);
+GLAPI void APIENTRY glCompressedMultiTexImage1DEXT (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *bits);
+GLAPI void APIENTRY glCompressedMultiTexSubImage3DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *bits);
+GLAPI void APIENTRY glCompressedMultiTexSubImage2DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *bits);
+GLAPI void APIENTRY glCompressedMultiTexSubImage1DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *bits);
+GLAPI void APIENTRY glGetCompressedMultiTexImageEXT (GLenum texunit, GLenum target, GLint lod, GLvoid *img);
+GLAPI void APIENTRY glNamedProgramStringEXT (GLuint program, GLenum target, GLenum format, GLsizei len, const GLvoid *string);
+GLAPI void APIENTRY glNamedProgramLocalParameter4dEXT (GLuint program, GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+GLAPI void APIENTRY glNamedProgramLocalParameter4dvEXT (GLuint program, GLenum target, GLuint index, const GLdouble *params);
+GLAPI void APIENTRY glNamedProgramLocalParameter4fEXT (GLuint program, GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+GLAPI void APIENTRY glNamedProgramLocalParameter4fvEXT (GLuint program, GLenum target, GLuint index, const GLfloat *params);
+GLAPI void APIENTRY glGetNamedProgramLocalParameterdvEXT (GLuint program, GLenum target, GLuint index, GLdouble *params);
+GLAPI void APIENTRY glGetNamedProgramLocalParameterfvEXT (GLuint program, GLenum target, GLuint index, GLfloat *params);
+GLAPI void APIENTRY glGetNamedProgramivEXT (GLuint program, GLenum target, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetNamedProgramStringEXT (GLuint program, GLenum target, GLenum pname, GLvoid *string);
+GLAPI void APIENTRY glNamedProgramLocalParameters4fvEXT (GLuint program, GLenum target, GLuint index, GLsizei count, const GLfloat *params);
+GLAPI void APIENTRY glNamedProgramLocalParameterI4iEXT (GLuint program, GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w);
+GLAPI void APIENTRY glNamedProgramLocalParameterI4ivEXT (GLuint program, GLenum target, GLuint index, const GLint *params);
+GLAPI void APIENTRY glNamedProgramLocalParametersI4ivEXT (GLuint program, GLenum target, GLuint index, GLsizei count, const GLint *params);
+GLAPI void APIENTRY glNamedProgramLocalParameterI4uiEXT (GLuint program, GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
+GLAPI void APIENTRY glNamedProgramLocalParameterI4uivEXT (GLuint program, GLenum target, GLuint index, const GLuint *params);
+GLAPI void APIENTRY glNamedProgramLocalParametersI4uivEXT (GLuint program, GLenum target, GLuint index, GLsizei count, const GLuint *params);
+GLAPI void APIENTRY glGetNamedProgramLocalParameterIivEXT (GLuint program, GLenum target, GLuint index, GLint *params);
+GLAPI void APIENTRY glGetNamedProgramLocalParameterIuivEXT (GLuint program, GLenum target, GLuint index, GLuint *params);
+GLAPI void APIENTRY glTextureParameterIivEXT (GLuint texture, GLenum target, GLenum pname, const GLint *params);
+GLAPI void APIENTRY glTextureParameterIuivEXT (GLuint texture, GLenum target, GLenum pname, const GLuint *params);
+GLAPI void APIENTRY glGetTextureParameterIivEXT (GLuint texture, GLenum target, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetTextureParameterIuivEXT (GLuint texture, GLenum target, GLenum pname, GLuint *params);
+GLAPI void APIENTRY glMultiTexParameterIivEXT (GLenum texunit, GLenum target, GLenum pname, const GLint *params);
+GLAPI void APIENTRY glMultiTexParameterIuivEXT (GLenum texunit, GLenum target, GLenum pname, const GLuint *params);
+GLAPI void APIENTRY glGetMultiTexParameterIivEXT (GLenum texunit, GLenum target, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetMultiTexParameterIuivEXT (GLenum texunit, GLenum target, GLenum pname, GLuint *params);
+GLAPI void APIENTRY glProgramUniform1fEXT (GLuint program, GLint location, GLfloat v0);
+GLAPI void APIENTRY glProgramUniform2fEXT (GLuint program, GLint location, GLfloat v0, GLfloat v1);
+GLAPI void APIENTRY glProgramUniform3fEXT (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
+GLAPI void APIENTRY glProgramUniform4fEXT (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
+GLAPI void APIENTRY glProgramUniform1iEXT (GLuint program, GLint location, GLint v0);
+GLAPI void APIENTRY glProgramUniform2iEXT (GLuint program, GLint location, GLint v0, GLint v1);
+GLAPI void APIENTRY glProgramUniform3iEXT (GLuint program, GLint location, GLint v0, GLint v1, GLint v2);
+GLAPI void APIENTRY glProgramUniform4iEXT (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
+GLAPI void APIENTRY glProgramUniform1fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+GLAPI void APIENTRY glProgramUniform2fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+GLAPI void APIENTRY glProgramUniform3fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+GLAPI void APIENTRY glProgramUniform4fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+GLAPI void APIENTRY glProgramUniform1ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);
+GLAPI void APIENTRY glProgramUniform2ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);
+GLAPI void APIENTRY glProgramUniform3ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);
+GLAPI void APIENTRY glProgramUniform4ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);
+GLAPI void APIENTRY glProgramUniformMatrix2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GLAPI void APIENTRY glProgramUniformMatrix3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GLAPI void APIENTRY glProgramUniformMatrix4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GLAPI void APIENTRY glProgramUniformMatrix2x3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GLAPI void APIENTRY glProgramUniformMatrix3x2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GLAPI void APIENTRY glProgramUniformMatrix2x4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GLAPI void APIENTRY glProgramUniformMatrix4x2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GLAPI void APIENTRY glProgramUniformMatrix3x4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GLAPI void APIENTRY glProgramUniformMatrix4x3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GLAPI void APIENTRY glProgramUniform1uiEXT (GLuint program, GLint location, GLuint v0);
+GLAPI void APIENTRY glProgramUniform2uiEXT (GLuint program, GLint location, GLuint v0, GLuint v1);
+GLAPI void APIENTRY glProgramUniform3uiEXT (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);
+GLAPI void APIENTRY glProgramUniform4uiEXT (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+GLAPI void APIENTRY glProgramUniform1uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value);
+GLAPI void APIENTRY glProgramUniform2uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value);
+GLAPI void APIENTRY glProgramUniform3uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value);
+GLAPI void APIENTRY glProgramUniform4uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value);
+GLAPI void APIENTRY glNamedBufferDataEXT (GLuint buffer, GLsizeiptr size, const GLvoid *data, GLenum usage);
+GLAPI void APIENTRY glNamedBufferSubDataEXT (GLuint buffer, GLintptr offset, GLsizeiptr size, const GLvoid *data);
+GLAPI GLvoid* APIENTRY glMapNamedBufferEXT (GLuint buffer, GLenum access);
+GLAPI GLboolean APIENTRY glUnmapNamedBufferEXT (GLuint buffer);
+GLAPI GLvoid* APIENTRY glMapNamedBufferRangeEXT (GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access);
+GLAPI void APIENTRY glFlushMappedNamedBufferRangeEXT (GLuint buffer, GLintptr offset, GLsizeiptr length);
+GLAPI void APIENTRY glNamedCopyBufferSubDataEXT (GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
+GLAPI void APIENTRY glGetNamedBufferParameterivEXT (GLuint buffer, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetNamedBufferPointervEXT (GLuint buffer, GLenum pname, GLvoid* *params);
+GLAPI void APIENTRY glGetNamedBufferSubDataEXT (GLuint buffer, GLintptr offset, GLsizeiptr size, GLvoid *data);
+GLAPI void APIENTRY glTextureBufferEXT (GLuint texture, GLenum target, GLenum internalformat, GLuint buffer);
+GLAPI void APIENTRY glMultiTexBufferEXT (GLenum texunit, GLenum target, GLenum internalformat, GLuint buffer);
+GLAPI void APIENTRY glNamedRenderbufferStorageEXT (GLuint renderbuffer, GLenum internalformat, GLsizei width, GLsizei height);
+GLAPI void APIENTRY glGetNamedRenderbufferParameterivEXT (GLuint renderbuffer, GLenum pname, GLint *params);
+GLAPI GLenum APIENTRY glCheckNamedFramebufferStatusEXT (GLuint framebuffer, GLenum target);
+GLAPI void APIENTRY glNamedFramebufferTexture1DEXT (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
+GLAPI void APIENTRY glNamedFramebufferTexture2DEXT (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
+GLAPI void APIENTRY glNamedFramebufferTexture3DEXT (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
+GLAPI void APIENTRY glNamedFramebufferRenderbufferEXT (GLuint framebuffer, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
+GLAPI void APIENTRY glGetNamedFramebufferAttachmentParameterivEXT (GLuint framebuffer, GLenum attachment, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGenerateTextureMipmapEXT (GLuint texture, GLenum target);
+GLAPI void APIENTRY glGenerateMultiTexMipmapEXT (GLenum texunit, GLenum target);
+GLAPI void APIENTRY glFramebufferDrawBufferEXT (GLuint framebuffer, GLenum mode);
+GLAPI void APIENTRY glFramebufferDrawBuffersEXT (GLuint framebuffer, GLsizei n, const GLenum *bufs);
+GLAPI void APIENTRY glFramebufferReadBufferEXT (GLuint framebuffer, GLenum mode);
+GLAPI void APIENTRY glGetFramebufferParameterivEXT (GLuint framebuffer, GLenum pname, GLint *params);
+GLAPI void APIENTRY glNamedRenderbufferStorageMultisampleEXT (GLuint renderbuffer, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+GLAPI void APIENTRY glNamedRenderbufferStorageMultisampleCoverageEXT (GLuint renderbuffer, GLsizei coverageSamples, GLsizei colorSamples, GLenum internalformat, GLsizei width, GLsizei height);
+GLAPI void APIENTRY glNamedFramebufferTextureEXT (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level);
+GLAPI void APIENTRY glNamedFramebufferTextureLayerEXT (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLint layer);
+GLAPI void APIENTRY glNamedFramebufferTextureFaceEXT (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLenum face);
+GLAPI void APIENTRY glTextureRenderbufferEXT (GLuint texture, GLenum target, GLuint renderbuffer);
+GLAPI void APIENTRY glMultiTexRenderbufferEXT (GLenum texunit, GLenum target, GLuint renderbuffer);
+GLAPI void APIENTRY glProgramUniform1dEXT (GLuint program, GLint location, GLdouble x);
+GLAPI void APIENTRY glProgramUniform2dEXT (GLuint program, GLint location, GLdouble x, GLdouble y);
+GLAPI void APIENTRY glProgramUniform3dEXT (GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z);
+GLAPI void APIENTRY glProgramUniform4dEXT (GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+GLAPI void APIENTRY glProgramUniform1dvEXT (GLuint program, GLint location, GLsizei count, const GLdouble *value);
+GLAPI void APIENTRY glProgramUniform2dvEXT (GLuint program, GLint location, GLsizei count, const GLdouble *value);
+GLAPI void APIENTRY glProgramUniform3dvEXT (GLuint program, GLint location, GLsizei count, const GLdouble *value);
+GLAPI void APIENTRY glProgramUniform4dvEXT (GLuint program, GLint location, GLsizei count, const GLdouble *value);
+GLAPI void APIENTRY glProgramUniformMatrix2dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+GLAPI void APIENTRY glProgramUniformMatrix3dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+GLAPI void APIENTRY glProgramUniformMatrix4dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+GLAPI void APIENTRY glProgramUniformMatrix2x3dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+GLAPI void APIENTRY glProgramUniformMatrix2x4dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+GLAPI void APIENTRY glProgramUniformMatrix3x2dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+GLAPI void APIENTRY glProgramUniformMatrix3x4dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+GLAPI void APIENTRY glProgramUniformMatrix4x2dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+GLAPI void APIENTRY glProgramUniformMatrix4x3dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLCLIENTATTRIBDEFAULTEXTPROC) (GLbitfield mask);
typedef void (APIENTRYP PFNGLPUSHCLIENTATTRIBDEFAULTEXTPROC) (GLbitfield mask);
@@ -8435,6 +10833,9 @@ typedef void (APIENTRYP PFNGLNAMEDBUFFERDATAEXTPROC) (GLuint buffer, GLsizeiptr
typedef void (APIENTRYP PFNGLNAMEDBUFFERSUBDATAEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, const GLvoid *data);
typedef GLvoid* (APIENTRYP PFNGLMAPNAMEDBUFFEREXTPROC) (GLuint buffer, GLenum access);
typedef GLboolean (APIENTRYP PFNGLUNMAPNAMEDBUFFEREXTPROC) (GLuint buffer);
+typedef GLvoid* (APIENTRYP PFNGLMAPNAMEDBUFFERRANGEEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access);
+typedef void (APIENTRYP PFNGLFLUSHMAPPEDNAMEDBUFFERRANGEEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length);
+typedef void (APIENTRYP PFNGLNAMEDCOPYBUFFERSUBDATAEXTPROC) (GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
typedef void (APIENTRYP PFNGLGETNAMEDBUFFERPARAMETERIVEXTPROC) (GLuint buffer, GLenum pname, GLint *params);
typedef void (APIENTRYP PFNGLGETNAMEDBUFFERPOINTERVEXTPROC) (GLuint buffer, GLenum pname, GLvoid* *params);
typedef void (APIENTRYP PFNGLGETNAMEDBUFFERSUBDATAEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, GLvoid *data);
@@ -8461,6 +10862,23 @@ typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTURELAYEREXTPROC) (GLuint frameb
typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTUREFACEEXTPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLenum face);
typedef void (APIENTRYP PFNGLTEXTURERENDERBUFFEREXTPROC) (GLuint texture, GLenum target, GLuint renderbuffer);
typedef void (APIENTRYP PFNGLMULTITEXRENDERBUFFEREXTPROC) (GLenum texunit, GLenum target, GLuint renderbuffer);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1DEXTPROC) (GLuint program, GLint location, GLdouble x);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2DEXTPROC) (GLuint program, GLint location, GLdouble x, GLdouble y);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3DEXTPROC) (GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4DEXTPROC) (GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1DVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2DVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3DVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4DVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
#endif
#ifndef GL_EXT_vertex_array_bgra
@@ -8474,9 +10892,9 @@ typedef void (APIENTRYP PFNGLMULTITEXRENDERBUFFEREXTPROC) (GLenum texunit, GLenu
#ifndef GL_NV_explicit_multisample
#define GL_NV_explicit_multisample 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glGetMultisamplefvNV (GLenum, GLuint, GLfloat *);
-GLAPI void APIENTRY glSampleMaskIndexedNV (GLuint, GLbitfield);
-GLAPI void APIENTRY glTexRenderbufferNV (GLenum, GLuint);
+GLAPI void APIENTRY glGetMultisamplefvNV (GLenum pname, GLuint index, GLfloat *val);
+GLAPI void APIENTRY glSampleMaskIndexedNV (GLuint index, GLbitfield mask);
+GLAPI void APIENTRY glTexRenderbufferNV (GLenum target, GLuint renderbuffer);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLGETMULTISAMPLEFVNVPROC) (GLenum pname, GLuint index, GLfloat *val);
typedef void (APIENTRYP PFNGLSAMPLEMASKINDEXEDNVPROC) (GLuint index, GLbitfield mask);
@@ -8486,13 +10904,13 @@ typedef void (APIENTRYP PFNGLTEXRENDERBUFFERNVPROC) (GLenum target, GLuint rende
#ifndef GL_NV_transform_feedback2
#define GL_NV_transform_feedback2 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glBindTransformFeedbackNV (GLenum, GLuint);
-GLAPI void APIENTRY glDeleteTransformFeedbacksNV (GLsizei, const GLuint *);
-GLAPI void APIENTRY glGenTransformFeedbacksNV (GLsizei, GLuint *);
-GLAPI GLboolean APIENTRY glIsTransformFeedbackNV (GLuint);
+GLAPI void APIENTRY glBindTransformFeedbackNV (GLenum target, GLuint id);
+GLAPI void APIENTRY glDeleteTransformFeedbacksNV (GLsizei n, const GLuint *ids);
+GLAPI void APIENTRY glGenTransformFeedbacksNV (GLsizei n, GLuint *ids);
+GLAPI GLboolean APIENTRY glIsTransformFeedbackNV (GLuint id);
GLAPI void APIENTRY glPauseTransformFeedbackNV (void);
GLAPI void APIENTRY glResumeTransformFeedbackNV (void);
-GLAPI void APIENTRY glDrawTransformFeedbackNV (GLenum, GLuint);
+GLAPI void APIENTRY glDrawTransformFeedbackNV (GLenum mode, GLuint id);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLBINDTRANSFORMFEEDBACKNVPROC) (GLenum target, GLuint id);
typedef void (APIENTRYP PFNGLDELETETRANSFORMFEEDBACKSNVPROC) (GLsizei n, const GLuint *ids);
@@ -8510,23 +10928,23 @@ typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKNVPROC) (GLenum mode, GLuint i
#ifndef GL_AMD_performance_monitor
#define GL_AMD_performance_monitor 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glGetPerfMonitorGroupsAMD (GLint *, GLsizei, GLuint *);
-GLAPI void APIENTRY glGetPerfMonitorCountersAMD (GLuint, GLint *, GLint *, GLsizei, GLuint *);
-GLAPI void APIENTRY glGetPerfMonitorGroupStringAMD (GLuint, GLsizei, GLsizei *, GLchar *);
-GLAPI void APIENTRY glGetPerfMonitorCounterStringAMD (GLuint, GLuint, GLsizei, GLsizei *, GLchar *);
-GLAPI void APIENTRY glGetPerfMonitorCounterInfoAMD (GLuint, GLuint, GLenum, void *);
-GLAPI void APIENTRY glGenPerfMonitorsAMD (GLsizei, GLuint *);
-GLAPI void APIENTRY glDeletePerfMonitorsAMD (GLsizei, GLuint *);
-GLAPI void APIENTRY glSelectPerfMonitorCountersAMD (GLuint, GLboolean, GLuint, GLint, GLuint *);
-GLAPI void APIENTRY glBeginPerfMonitorAMD (GLuint);
-GLAPI void APIENTRY glEndPerfMonitorAMD (GLuint);
-GLAPI void APIENTRY glGetPerfMonitorCounterDataAMD (GLuint, GLenum, GLsizei, GLuint *, GLint *);
+GLAPI void APIENTRY glGetPerfMonitorGroupsAMD (GLint *numGroups, GLsizei groupsSize, GLuint *groups);
+GLAPI void APIENTRY glGetPerfMonitorCountersAMD (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters);
+GLAPI void APIENTRY glGetPerfMonitorGroupStringAMD (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString);
+GLAPI void APIENTRY glGetPerfMonitorCounterStringAMD (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString);
+GLAPI void APIENTRY glGetPerfMonitorCounterInfoAMD (GLuint group, GLuint counter, GLenum pname, GLvoid *data);
+GLAPI void APIENTRY glGenPerfMonitorsAMD (GLsizei n, GLuint *monitors);
+GLAPI void APIENTRY glDeletePerfMonitorsAMD (GLsizei n, GLuint *monitors);
+GLAPI void APIENTRY glSelectPerfMonitorCountersAMD (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *counterList);
+GLAPI void APIENTRY glBeginPerfMonitorAMD (GLuint monitor);
+GLAPI void APIENTRY glEndPerfMonitorAMD (GLuint monitor);
+GLAPI void APIENTRY glGetPerfMonitorCounterDataAMD (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLGETPERFMONITORGROUPSAMDPROC) (GLint *numGroups, GLsizei groupsSize, GLuint *groups);
typedef void (APIENTRYP PFNGLGETPERFMONITORCOUNTERSAMDPROC) (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters);
typedef void (APIENTRYP PFNGLGETPERFMONITORGROUPSTRINGAMDPROC) (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString);
typedef void (APIENTRYP PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC) (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString);
-typedef void (APIENTRYP PFNGLGETPERFMONITORCOUNTERINFOAMDPROC) (GLuint group, GLuint counter, GLenum pname, void *data);
+typedef void (APIENTRYP PFNGLGETPERFMONITORCOUNTERINFOAMDPROC) (GLuint group, GLuint counter, GLenum pname, GLvoid *data);
typedef void (APIENTRYP PFNGLGENPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors);
typedef void (APIENTRYP PFNGLDELETEPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors);
typedef void (APIENTRYP PFNGLSELECTPERFMONITORCOUNTERSAMDPROC) (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *counterList);
@@ -8542,8 +10960,8 @@ typedef void (APIENTRYP PFNGLGETPERFMONITORCOUNTERDATAAMDPROC) (GLuint monitor,
#ifndef GL_AMD_vertex_shader_tesselator
#define GL_AMD_vertex_shader_tesselator 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glTessellationFactorAMD (GLfloat);
-GLAPI void APIENTRY glTessellationModeAMD (GLenum);
+GLAPI void APIENTRY glTessellationFactorAMD (GLfloat factor);
+GLAPI void APIENTRY glTessellationModeAMD (GLenum mode);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLTESSELLATIONFACTORAMDPROC) (GLfloat factor);
typedef void (APIENTRYP PFNGLTESSELLATIONMODEAMDPROC) (GLenum mode);
@@ -8552,11 +10970,517 @@ typedef void (APIENTRYP PFNGLTESSELLATIONMODEAMDPROC) (GLenum mode);
#ifndef GL_EXT_provoking_vertex
#define GL_EXT_provoking_vertex 1
#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glProvokingVertexEXT (GLenum);
+GLAPI void APIENTRY glProvokingVertexEXT (GLenum mode);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLPROVOKINGVERTEXEXTPROC) (GLenum mode);
#endif
+#ifndef GL_EXT_texture_snorm
+#define GL_EXT_texture_snorm 1
+#endif
+
+#ifndef GL_AMD_draw_buffers_blend
+#define GL_AMD_draw_buffers_blend 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glBlendFuncIndexedAMD (GLuint buf, GLenum src, GLenum dst);
+GLAPI void APIENTRY glBlendFuncSeparateIndexedAMD (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
+GLAPI void APIENTRY glBlendEquationIndexedAMD (GLuint buf, GLenum mode);
+GLAPI void APIENTRY glBlendEquationSeparateIndexedAMD (GLuint buf, GLenum modeRGB, GLenum modeAlpha);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLBLENDFUNCINDEXEDAMDPROC) (GLuint buf, GLenum src, GLenum dst);
+typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEINDEXEDAMDPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
+typedef void (APIENTRYP PFNGLBLENDEQUATIONINDEXEDAMDPROC) (GLuint buf, GLenum mode);
+typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEINDEXEDAMDPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha);
+#endif
+
+#ifndef GL_APPLE_texture_range
+#define GL_APPLE_texture_range 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glTextureRangeAPPLE (GLenum target, GLsizei length, const GLvoid *pointer);
+GLAPI void APIENTRY glGetTexParameterPointervAPPLE (GLenum target, GLenum pname, GLvoid* *params);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLTEXTURERANGEAPPLEPROC) (GLenum target, GLsizei length, const GLvoid *pointer);
+typedef void (APIENTRYP PFNGLGETTEXPARAMETERPOINTERVAPPLEPROC) (GLenum target, GLenum pname, GLvoid* *params);
+#endif
+
+#ifndef GL_APPLE_float_pixels
+#define GL_APPLE_float_pixels 1
+#endif
+
+#ifndef GL_APPLE_vertex_program_evaluators
+#define GL_APPLE_vertex_program_evaluators 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glEnableVertexAttribAPPLE (GLuint index, GLenum pname);
+GLAPI void APIENTRY glDisableVertexAttribAPPLE (GLuint index, GLenum pname);
+GLAPI GLboolean APIENTRY glIsVertexAttribEnabledAPPLE (GLuint index, GLenum pname);
+GLAPI void APIENTRY glMapVertexAttrib1dAPPLE (GLuint index, GLuint size, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points);
+GLAPI void APIENTRY glMapVertexAttrib1fAPPLE (GLuint index, GLuint size, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points);
+GLAPI void APIENTRY glMapVertexAttrib2dAPPLE (GLuint index, GLuint size, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points);
+GLAPI void APIENTRY glMapVertexAttrib2fAPPLE (GLuint index, GLuint size, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBAPPLEPROC) (GLuint index, GLenum pname);
+typedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBAPPLEPROC) (GLuint index, GLenum pname);
+typedef GLboolean (APIENTRYP PFNGLISVERTEXATTRIBENABLEDAPPLEPROC) (GLuint index, GLenum pname);
+typedef void (APIENTRYP PFNGLMAPVERTEXATTRIB1DAPPLEPROC) (GLuint index, GLuint size, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points);
+typedef void (APIENTRYP PFNGLMAPVERTEXATTRIB1FAPPLEPROC) (GLuint index, GLuint size, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points);
+typedef void (APIENTRYP PFNGLMAPVERTEXATTRIB2DAPPLEPROC) (GLuint index, GLuint size, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points);
+typedef void (APIENTRYP PFNGLMAPVERTEXATTRIB2FAPPLEPROC) (GLuint index, GLuint size, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points);
+#endif
+
+#ifndef GL_APPLE_aux_depth_stencil
+#define GL_APPLE_aux_depth_stencil 1
+#endif
+
+#ifndef GL_APPLE_object_purgeable
+#define GL_APPLE_object_purgeable 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI GLenum APIENTRY glObjectPurgeableAPPLE (GLenum objectType, GLuint name, GLenum option);
+GLAPI GLenum APIENTRY glObjectUnpurgeableAPPLE (GLenum objectType, GLuint name, GLenum option);
+GLAPI void APIENTRY glGetObjectParameterivAPPLE (GLenum objectType, GLuint name, GLenum pname, GLint *params);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef GLenum (APIENTRYP PFNGLOBJECTPURGEABLEAPPLEPROC) (GLenum objectType, GLuint name, GLenum option);
+typedef GLenum (APIENTRYP PFNGLOBJECTUNPURGEABLEAPPLEPROC) (GLenum objectType, GLuint name, GLenum option);
+typedef void (APIENTRYP PFNGLGETOBJECTPARAMETERIVAPPLEPROC) (GLenum objectType, GLuint name, GLenum pname, GLint *params);
+#endif
+
+#ifndef GL_APPLE_row_bytes
+#define GL_APPLE_row_bytes 1
+#endif
+
+#ifndef GL_APPLE_rgb_422
+#define GL_APPLE_rgb_422 1
+#endif
+
+#ifndef GL_NV_video_capture
+#define GL_NV_video_capture 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glBeginVideoCaptureNV (GLuint video_capture_slot);
+GLAPI void APIENTRY glBindVideoCaptureStreamBufferNV (GLuint video_capture_slot, GLuint stream, GLenum frame_region, GLintptrARB offset);
+GLAPI void APIENTRY glBindVideoCaptureStreamTextureNV (GLuint video_capture_slot, GLuint stream, GLenum frame_region, GLenum target, GLuint texture);
+GLAPI void APIENTRY glEndVideoCaptureNV (GLuint video_capture_slot);
+GLAPI void APIENTRY glGetVideoCaptureivNV (GLuint video_capture_slot, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetVideoCaptureStreamivNV (GLuint video_capture_slot, GLuint stream, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetVideoCaptureStreamfvNV (GLuint video_capture_slot, GLuint stream, GLenum pname, GLfloat *params);
+GLAPI void APIENTRY glGetVideoCaptureStreamdvNV (GLuint video_capture_slot, GLuint stream, GLenum pname, GLdouble *params);
+GLAPI GLenum APIENTRY glVideoCaptureNV (GLuint video_capture_slot, GLuint *sequence_num, GLuint64EXT *capture_time);
+GLAPI void APIENTRY glVideoCaptureStreamParameterivNV (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLint *params);
+GLAPI void APIENTRY glVideoCaptureStreamParameterfvNV (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLfloat *params);
+GLAPI void APIENTRY glVideoCaptureStreamParameterdvNV (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLdouble *params);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLBEGINVIDEOCAPTURENVPROC) (GLuint video_capture_slot);
+typedef void (APIENTRYP PFNGLBINDVIDEOCAPTURESTREAMBUFFERNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum frame_region, GLintptrARB offset);
+typedef void (APIENTRYP PFNGLBINDVIDEOCAPTURESTREAMTEXTURENVPROC) (GLuint video_capture_slot, GLuint stream, GLenum frame_region, GLenum target, GLuint texture);
+typedef void (APIENTRYP PFNGLENDVIDEOCAPTURENVPROC) (GLuint video_capture_slot);
+typedef void (APIENTRYP PFNGLGETVIDEOCAPTUREIVNVPROC) (GLuint video_capture_slot, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETVIDEOCAPTURESTREAMIVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETVIDEOCAPTURESTREAMFVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, GLfloat *params);
+typedef void (APIENTRYP PFNGLGETVIDEOCAPTURESTREAMDVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, GLdouble *params);
+typedef GLenum (APIENTRYP PFNGLVIDEOCAPTURENVPROC) (GLuint video_capture_slot, GLuint *sequence_num, GLuint64EXT *capture_time);
+typedef void (APIENTRYP PFNGLVIDEOCAPTURESTREAMPARAMETERIVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLint *params);
+typedef void (APIENTRYP PFNGLVIDEOCAPTURESTREAMPARAMETERFVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLfloat *params);
+typedef void (APIENTRYP PFNGLVIDEOCAPTURESTREAMPARAMETERDVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLdouble *params);
+#endif
+
+#ifndef GL_NV_copy_image
+#define GL_NV_copy_image 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glCopyImageSubDataNV (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLCOPYIMAGESUBDATANVPROC) (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
+#endif
+
+#ifndef GL_EXT_separate_shader_objects
+#define GL_EXT_separate_shader_objects 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glUseShaderProgramEXT (GLenum type, GLuint program);
+GLAPI void APIENTRY glActiveProgramEXT (GLuint program);
+GLAPI GLuint APIENTRY glCreateShaderProgramEXT (GLenum type, const GLchar *string);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLUSESHADERPROGRAMEXTPROC) (GLenum type, GLuint program);
+typedef void (APIENTRYP PFNGLACTIVEPROGRAMEXTPROC) (GLuint program);
+typedef GLuint (APIENTRYP PFNGLCREATESHADERPROGRAMEXTPROC) (GLenum type, const GLchar *string);
+#endif
+
+#ifndef GL_NV_parameter_buffer_object2
+#define GL_NV_parameter_buffer_object2 1
+#endif
+
+#ifndef GL_NV_shader_buffer_load
+#define GL_NV_shader_buffer_load 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glMakeBufferResidentNV (GLenum target, GLenum access);
+GLAPI void APIENTRY glMakeBufferNonResidentNV (GLenum target);
+GLAPI GLboolean APIENTRY glIsBufferResidentNV (GLenum target);
+GLAPI void APIENTRY glMakeNamedBufferResidentNV (GLuint buffer, GLenum access);
+GLAPI void APIENTRY glMakeNamedBufferNonResidentNV (GLuint buffer);
+GLAPI GLboolean APIENTRY glIsNamedBufferResidentNV (GLuint buffer);
+GLAPI void APIENTRY glGetBufferParameterui64vNV (GLenum target, GLenum pname, GLuint64EXT *params);
+GLAPI void APIENTRY glGetNamedBufferParameterui64vNV (GLuint buffer, GLenum pname, GLuint64EXT *params);
+GLAPI void APIENTRY glGetIntegerui64vNV (GLenum value, GLuint64EXT *result);
+GLAPI void APIENTRY glUniformui64NV (GLint location, GLuint64EXT value);
+GLAPI void APIENTRY glUniformui64vNV (GLint location, GLsizei count, const GLuint64EXT *value);
+GLAPI void APIENTRY glGetUniformui64vNV (GLuint program, GLint location, GLuint64EXT *params);
+GLAPI void APIENTRY glProgramUniformui64NV (GLuint program, GLint location, GLuint64EXT value);
+GLAPI void APIENTRY glProgramUniformui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLMAKEBUFFERRESIDENTNVPROC) (GLenum target, GLenum access);
+typedef void (APIENTRYP PFNGLMAKEBUFFERNONRESIDENTNVPROC) (GLenum target);
+typedef GLboolean (APIENTRYP PFNGLISBUFFERRESIDENTNVPROC) (GLenum target);
+typedef void (APIENTRYP PFNGLMAKENAMEDBUFFERRESIDENTNVPROC) (GLuint buffer, GLenum access);
+typedef void (APIENTRYP PFNGLMAKENAMEDBUFFERNONRESIDENTNVPROC) (GLuint buffer);
+typedef GLboolean (APIENTRYP PFNGLISNAMEDBUFFERRESIDENTNVPROC) (GLuint buffer);
+typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERUI64VNVPROC) (GLenum target, GLenum pname, GLuint64EXT *params);
+typedef void (APIENTRYP PFNGLGETNAMEDBUFFERPARAMETERUI64VNVPROC) (GLuint buffer, GLenum pname, GLuint64EXT *params);
+typedef void (APIENTRYP PFNGLGETINTEGERUI64VNVPROC) (GLenum value, GLuint64EXT *result);
+typedef void (APIENTRYP PFNGLUNIFORMUI64NVPROC) (GLint location, GLuint64EXT value);
+typedef void (APIENTRYP PFNGLUNIFORMUI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value);
+typedef void (APIENTRYP PFNGLGETUNIFORMUI64VNVPROC) (GLuint program, GLint location, GLuint64EXT *params);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMUI64NVPROC) (GLuint program, GLint location, GLuint64EXT value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMUI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
+#endif
+
+#ifndef GL_NV_vertex_buffer_unified_memory
+#define GL_NV_vertex_buffer_unified_memory 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glBufferAddressRangeNV (GLenum pname, GLuint index, GLuint64EXT address, GLsizeiptr length);
+GLAPI void APIENTRY glVertexFormatNV (GLint size, GLenum type, GLsizei stride);
+GLAPI void APIENTRY glNormalFormatNV (GLenum type, GLsizei stride);
+GLAPI void APIENTRY glColorFormatNV (GLint size, GLenum type, GLsizei stride);
+GLAPI void APIENTRY glIndexFormatNV (GLenum type, GLsizei stride);
+GLAPI void APIENTRY glTexCoordFormatNV (GLint size, GLenum type, GLsizei stride);
+GLAPI void APIENTRY glEdgeFlagFormatNV (GLsizei stride);
+GLAPI void APIENTRY glSecondaryColorFormatNV (GLint size, GLenum type, GLsizei stride);
+GLAPI void APIENTRY glFogCoordFormatNV (GLenum type, GLsizei stride);
+GLAPI void APIENTRY glVertexAttribFormatNV (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride);
+GLAPI void APIENTRY glVertexAttribIFormatNV (GLuint index, GLint size, GLenum type, GLsizei stride);
+GLAPI void APIENTRY glGetIntegerui64i_vNV (GLenum value, GLuint index, GLuint64EXT *result);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLBUFFERADDRESSRANGENVPROC) (GLenum pname, GLuint index, GLuint64EXT address, GLsizeiptr length);
+typedef void (APIENTRYP PFNGLVERTEXFORMATNVPROC) (GLint size, GLenum type, GLsizei stride);
+typedef void (APIENTRYP PFNGLNORMALFORMATNVPROC) (GLenum type, GLsizei stride);
+typedef void (APIENTRYP PFNGLCOLORFORMATNVPROC) (GLint size, GLenum type, GLsizei stride);
+typedef void (APIENTRYP PFNGLINDEXFORMATNVPROC) (GLenum type, GLsizei stride);
+typedef void (APIENTRYP PFNGLTEXCOORDFORMATNVPROC) (GLint size, GLenum type, GLsizei stride);
+typedef void (APIENTRYP PFNGLEDGEFLAGFORMATNVPROC) (GLsizei stride);
+typedef void (APIENTRYP PFNGLSECONDARYCOLORFORMATNVPROC) (GLint size, GLenum type, GLsizei stride);
+typedef void (APIENTRYP PFNGLFOGCOORDFORMATNVPROC) (GLenum type, GLsizei stride);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBFORMATNVPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBIFORMATNVPROC) (GLuint index, GLint size, GLenum type, GLsizei stride);
+typedef void (APIENTRYP PFNGLGETINTEGERUI64I_VNVPROC) (GLenum value, GLuint index, GLuint64EXT *result);
+#endif
+
+#ifndef GL_NV_texture_barrier
+#define GL_NV_texture_barrier 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glTextureBarrierNV (void);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLTEXTUREBARRIERNVPROC) (void);
+#endif
+
+#ifndef GL_AMD_shader_stencil_export
+#define GL_AMD_shader_stencil_export 1
+#endif
+
+#ifndef GL_AMD_seamless_cubemap_per_texture
+#define GL_AMD_seamless_cubemap_per_texture 1
+#endif
+
+#ifndef GL_AMD_conservative_depth
+#define GL_AMD_conservative_depth 1
+#endif
+
+#ifndef GL_EXT_shader_image_load_store
+#define GL_EXT_shader_image_load_store 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glBindImageTextureEXT (GLuint index, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLint format);
+GLAPI void APIENTRY glMemoryBarrierEXT (GLbitfield barriers);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLBINDIMAGETEXTUREEXTPROC) (GLuint index, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLint format);
+typedef void (APIENTRYP PFNGLMEMORYBARRIEREXTPROC) (GLbitfield barriers);
+#endif
+
+#ifndef GL_EXT_vertex_attrib_64bit
+#define GL_EXT_vertex_attrib_64bit 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glVertexAttribL1dEXT (GLuint index, GLdouble x);
+GLAPI void APIENTRY glVertexAttribL2dEXT (GLuint index, GLdouble x, GLdouble y);
+GLAPI void APIENTRY glVertexAttribL3dEXT (GLuint index, GLdouble x, GLdouble y, GLdouble z);
+GLAPI void APIENTRY glVertexAttribL4dEXT (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+GLAPI void APIENTRY glVertexAttribL1dvEXT (GLuint index, const GLdouble *v);
+GLAPI void APIENTRY glVertexAttribL2dvEXT (GLuint index, const GLdouble *v);
+GLAPI void APIENTRY glVertexAttribL3dvEXT (GLuint index, const GLdouble *v);
+GLAPI void APIENTRY glVertexAttribL4dvEXT (GLuint index, const GLdouble *v);
+GLAPI void APIENTRY glVertexAttribLPointerEXT (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
+GLAPI void APIENTRY glGetVertexAttribLdvEXT (GLuint index, GLenum pname, GLdouble *params);
+GLAPI void APIENTRY glVertexArrayVertexAttribLOffsetEXT (GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLsizei stride, GLintptr offset);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLVERTEXATTRIBL1DEXTPROC) (GLuint index, GLdouble x);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBL2DEXTPROC) (GLuint index, GLdouble x, GLdouble y);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBL3DEXTPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBL4DEXTPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBL1DVEXTPROC) (GLuint index, const GLdouble *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBL2DVEXTPROC) (GLuint index, const GLdouble *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBL3DVEXTPROC) (GLuint index, const GLdouble *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBL4DVEXTPROC) (GLuint index, const GLdouble *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBLPOINTEREXTPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
+typedef void (APIENTRYP PFNGLGETVERTEXATTRIBLDVEXTPROC) (GLuint index, GLenum pname, GLdouble *params);
+typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBLOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLsizei stride, GLintptr offset);
+#endif
+
+#ifndef GL_NV_gpu_program5
+#define GL_NV_gpu_program5 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glProgramSubroutineParametersuivNV (GLenum target, GLsizei count, const GLuint *params);
+GLAPI void APIENTRY glGetProgramSubroutineParameteruivNV (GLenum target, GLuint index, GLuint *param);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLPROGRAMSUBROUTINEPARAMETERSUIVNVPROC) (GLenum target, GLsizei count, const GLuint *params);
+typedef void (APIENTRYP PFNGLGETPROGRAMSUBROUTINEPARAMETERUIVNVPROC) (GLenum target, GLuint index, GLuint *param);
+#endif
+
+#ifndef GL_NV_gpu_shader5
+#define GL_NV_gpu_shader5 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glUniform1i64NV (GLint location, GLint64EXT x);
+GLAPI void APIENTRY glUniform2i64NV (GLint location, GLint64EXT x, GLint64EXT y);
+GLAPI void APIENTRY glUniform3i64NV (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z);
+GLAPI void APIENTRY glUniform4i64NV (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w);
+GLAPI void APIENTRY glUniform1i64vNV (GLint location, GLsizei count, const GLint64EXT *value);
+GLAPI void APIENTRY glUniform2i64vNV (GLint location, GLsizei count, const GLint64EXT *value);
+GLAPI void APIENTRY glUniform3i64vNV (GLint location, GLsizei count, const GLint64EXT *value);
+GLAPI void APIENTRY glUniform4i64vNV (GLint location, GLsizei count, const GLint64EXT *value);
+GLAPI void APIENTRY glUniform1ui64NV (GLint location, GLuint64EXT x);
+GLAPI void APIENTRY glUniform2ui64NV (GLint location, GLuint64EXT x, GLuint64EXT y);
+GLAPI void APIENTRY glUniform3ui64NV (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z);
+GLAPI void APIENTRY glUniform4ui64NV (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w);
+GLAPI void APIENTRY glUniform1ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value);
+GLAPI void APIENTRY glUniform2ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value);
+GLAPI void APIENTRY glUniform3ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value);
+GLAPI void APIENTRY glUniform4ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value);
+GLAPI void APIENTRY glGetUniformi64vNV (GLuint program, GLint location, GLint64EXT *params);
+GLAPI void APIENTRY glProgramUniform1i64NV (GLuint program, GLint location, GLint64EXT x);
+GLAPI void APIENTRY glProgramUniform2i64NV (GLuint program, GLint location, GLint64EXT x, GLint64EXT y);
+GLAPI void APIENTRY glProgramUniform3i64NV (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z);
+GLAPI void APIENTRY glProgramUniform4i64NV (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w);
+GLAPI void APIENTRY glProgramUniform1i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);
+GLAPI void APIENTRY glProgramUniform2i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);
+GLAPI void APIENTRY glProgramUniform3i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);
+GLAPI void APIENTRY glProgramUniform4i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);
+GLAPI void APIENTRY glProgramUniform1ui64NV (GLuint program, GLint location, GLuint64EXT x);
+GLAPI void APIENTRY glProgramUniform2ui64NV (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y);
+GLAPI void APIENTRY glProgramUniform3ui64NV (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z);
+GLAPI void APIENTRY glProgramUniform4ui64NV (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w);
+GLAPI void APIENTRY glProgramUniform1ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
+GLAPI void APIENTRY glProgramUniform2ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
+GLAPI void APIENTRY glProgramUniform3ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
+GLAPI void APIENTRY glProgramUniform4ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLUNIFORM1I64NVPROC) (GLint location, GLint64EXT x);
+typedef void (APIENTRYP PFNGLUNIFORM2I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y);
+typedef void (APIENTRYP PFNGLUNIFORM3I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z);
+typedef void (APIENTRYP PFNGLUNIFORM4I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w);
+typedef void (APIENTRYP PFNGLUNIFORM1I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value);
+typedef void (APIENTRYP PFNGLUNIFORM2I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value);
+typedef void (APIENTRYP PFNGLUNIFORM3I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value);
+typedef void (APIENTRYP PFNGLUNIFORM4I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value);
+typedef void (APIENTRYP PFNGLUNIFORM1UI64NVPROC) (GLint location, GLuint64EXT x);
+typedef void (APIENTRYP PFNGLUNIFORM2UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y);
+typedef void (APIENTRYP PFNGLUNIFORM3UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z);
+typedef void (APIENTRYP PFNGLUNIFORM4UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w);
+typedef void (APIENTRYP PFNGLUNIFORM1UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value);
+typedef void (APIENTRYP PFNGLUNIFORM2UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value);
+typedef void (APIENTRYP PFNGLUNIFORM3UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value);
+typedef void (APIENTRYP PFNGLUNIFORM4UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value);
+typedef void (APIENTRYP PFNGLGETUNIFORMI64VNVPROC) (GLuint program, GLint location, GLint64EXT *params);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1I64NVPROC) (GLuint program, GLint location, GLint64EXT x);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
+#endif
+
+#ifndef GL_NV_shader_buffer_store
+#define GL_NV_shader_buffer_store 1
+#endif
+
+#ifndef GL_NV_tessellation_program5
+#define GL_NV_tessellation_program5 1
+#endif
+
+#ifndef GL_NV_vertex_attrib_integer_64bit
+#define GL_NV_vertex_attrib_integer_64bit 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glVertexAttribL1i64NV (GLuint index, GLint64EXT x);
+GLAPI void APIENTRY glVertexAttribL2i64NV (GLuint index, GLint64EXT x, GLint64EXT y);
+GLAPI void APIENTRY glVertexAttribL3i64NV (GLuint index, GLint64EXT x, GLint64EXT y, GLint64EXT z);
+GLAPI void APIENTRY glVertexAttribL4i64NV (GLuint index, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w);
+GLAPI void APIENTRY glVertexAttribL1i64vNV (GLuint index, const GLint64EXT *v);
+GLAPI void APIENTRY glVertexAttribL2i64vNV (GLuint index, const GLint64EXT *v);
+GLAPI void APIENTRY glVertexAttribL3i64vNV (GLuint index, const GLint64EXT *v);
+GLAPI void APIENTRY glVertexAttribL4i64vNV (GLuint index, const GLint64EXT *v);
+GLAPI void APIENTRY glVertexAttribL1ui64NV (GLuint index, GLuint64EXT x);
+GLAPI void APIENTRY glVertexAttribL2ui64NV (GLuint index, GLuint64EXT x, GLuint64EXT y);
+GLAPI void APIENTRY glVertexAttribL3ui64NV (GLuint index, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z);
+GLAPI void APIENTRY glVertexAttribL4ui64NV (GLuint index, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w);
+GLAPI void APIENTRY glVertexAttribL1ui64vNV (GLuint index, const GLuint64EXT *v);
+GLAPI void APIENTRY glVertexAttribL2ui64vNV (GLuint index, const GLuint64EXT *v);
+GLAPI void APIENTRY glVertexAttribL3ui64vNV (GLuint index, const GLuint64EXT *v);
+GLAPI void APIENTRY glVertexAttribL4ui64vNV (GLuint index, const GLuint64EXT *v);
+GLAPI void APIENTRY glGetVertexAttribLi64vNV (GLuint index, GLenum pname, GLint64EXT *params);
+GLAPI void APIENTRY glGetVertexAttribLui64vNV (GLuint index, GLenum pname, GLuint64EXT *params);
+GLAPI void APIENTRY glVertexAttribLFormatNV (GLuint index, GLint size, GLenum type, GLsizei stride);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLVERTEXATTRIBL1I64NVPROC) (GLuint index, GLint64EXT x);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBL2I64NVPROC) (GLuint index, GLint64EXT x, GLint64EXT y);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBL3I64NVPROC) (GLuint index, GLint64EXT x, GLint64EXT y, GLint64EXT z);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBL4I64NVPROC) (GLuint index, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBL1I64VNVPROC) (GLuint index, const GLint64EXT *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBL2I64VNVPROC) (GLuint index, const GLint64EXT *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBL3I64VNVPROC) (GLuint index, const GLint64EXT *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBL4I64VNVPROC) (GLuint index, const GLint64EXT *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBL1UI64NVPROC) (GLuint index, GLuint64EXT x);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBL2UI64NVPROC) (GLuint index, GLuint64EXT x, GLuint64EXT y);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBL3UI64NVPROC) (GLuint index, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBL4UI64NVPROC) (GLuint index, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBL1UI64VNVPROC) (GLuint index, const GLuint64EXT *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBL2UI64VNVPROC) (GLuint index, const GLuint64EXT *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBL3UI64VNVPROC) (GLuint index, const GLuint64EXT *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBL4UI64VNVPROC) (GLuint index, const GLuint64EXT *v);
+typedef void (APIENTRYP PFNGLGETVERTEXATTRIBLI64VNVPROC) (GLuint index, GLenum pname, GLint64EXT *params);
+typedef void (APIENTRYP PFNGLGETVERTEXATTRIBLUI64VNVPROC) (GLuint index, GLenum pname, GLuint64EXT *params);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBLFORMATNVPROC) (GLuint index, GLint size, GLenum type, GLsizei stride);
+#endif
+
+#ifndef GL_NV_multisample_coverage
+#define GL_NV_multisample_coverage 1
+#endif
+
+#ifndef GL_AMD_name_gen_delete
+#define GL_AMD_name_gen_delete 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glGenNamesAMD (GLenum identifier, GLuint num, GLuint *names);
+GLAPI void APIENTRY glDeleteNamesAMD (GLenum identifier, GLuint num, const GLuint *names);
+GLAPI GLboolean APIENTRY glIsNameAMD (GLenum identifier, GLuint name);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLGENNAMESAMDPROC) (GLenum identifier, GLuint num, GLuint *names);
+typedef void (APIENTRYP PFNGLDELETENAMESAMDPROC) (GLenum identifier, GLuint num, const GLuint *names);
+typedef GLboolean (APIENTRYP PFNGLISNAMEAMDPROC) (GLenum identifier, GLuint name);
+#endif
+
+#ifndef GL_AMD_debug_output
+#define GL_AMD_debug_output 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glDebugMessageEnableAMD (GLenum category, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
+GLAPI void APIENTRY glDebugMessageInsertAMD (GLenum category, GLenum severity, GLuint id, GLsizei length, const GLchar *buf);
+GLAPI void APIENTRY glDebugMessageCallbackAMD (GLDEBUGPROCAMD callback, GLvoid *userParam);
+GLAPI GLuint APIENTRY glGetDebugMessageLogAMD (GLuint count, GLsizei bufsize, GLenum *categories, GLuint *severities, GLuint *ids, GLsizei *lengths, GLchar *message);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLDEBUGMESSAGEENABLEAMDPROC) (GLenum category, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
+typedef void (APIENTRYP PFNGLDEBUGMESSAGEINSERTAMDPROC) (GLenum category, GLenum severity, GLuint id, GLsizei length, const GLchar *buf);
+typedef void (APIENTRYP PFNGLDEBUGMESSAGECALLBACKAMDPROC) (GLDEBUGPROCAMD callback, GLvoid *userParam);
+typedef GLuint (APIENTRYP PFNGLGETDEBUGMESSAGELOGAMDPROC) (GLuint count, GLsizei bufsize, GLenum *categories, GLuint *severities, GLuint *ids, GLsizei *lengths, GLchar *message);
+#endif
+
+#ifndef GL_NV_vdpau_interop
+#define GL_NV_vdpau_interop 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glVDPAUInitNV (const GLvoid *vdpDevice, const GLvoid *getProcAddress);
+GLAPI void APIENTRY glVDPAUFiniNV (void);
+GLAPI GLvdpauSurfaceNV APIENTRY glVDPAURegisterVideoSurfaceNV (GLvoid *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames);
+GLAPI GLvdpauSurfaceNV APIENTRY glVDPAURegisterOutputSurfaceNV (GLvoid *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames);
+GLAPI void APIENTRY glVDPAUIsSurfaceNV (GLvdpauSurfaceNV surface);
+GLAPI void APIENTRY glVDPAUUnregisterSurfaceNV (GLvdpauSurfaceNV surface);
+GLAPI void APIENTRY glVDPAUGetSurfaceivNV (GLvdpauSurfaceNV surface, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
+GLAPI void APIENTRY glVDPAUSurfaceAccessNV (GLvdpauSurfaceNV surface, GLenum access);
+GLAPI void APIENTRY glVDPAUMapSurfacesNV (GLsizei numSurfaces, const GLvdpauSurfaceNV *surfaces);
+GLAPI void APIENTRY glVDPAUUnmapSurfacesNV (GLsizei numSurface, const GLvdpauSurfaceNV *surfaces);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLVDPAUINITNVPROC) (const GLvoid *vdpDevice, const GLvoid *getProcAddress);
+typedef void (APIENTRYP PFNGLVDPAUFININVPROC) (void);
+typedef GLvdpauSurfaceNV (APIENTRYP PFNGLVDPAUREGISTERVIDEOSURFACENVPROC) (GLvoid *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames);
+typedef GLvdpauSurfaceNV (APIENTRYP PFNGLVDPAUREGISTEROUTPUTSURFACENVPROC) (GLvoid *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames);
+typedef void (APIENTRYP PFNGLVDPAUISSURFACENVPROC) (GLvdpauSurfaceNV surface);
+typedef void (APIENTRYP PFNGLVDPAUUNREGISTERSURFACENVPROC) (GLvdpauSurfaceNV surface);
+typedef void (APIENTRYP PFNGLVDPAUGETSURFACEIVNVPROC) (GLvdpauSurfaceNV surface, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
+typedef void (APIENTRYP PFNGLVDPAUSURFACEACCESSNVPROC) (GLvdpauSurfaceNV surface, GLenum access);
+typedef void (APIENTRYP PFNGLVDPAUMAPSURFACESNVPROC) (GLsizei numSurfaces, const GLvdpauSurfaceNV *surfaces);
+typedef void (APIENTRYP PFNGLVDPAUUNMAPSURFACESNVPROC) (GLsizei numSurface, const GLvdpauSurfaceNV *surfaces);
+#endif
+
+#ifndef GL_AMD_transform_feedback3_lines_triangles
+#define GL_AMD_transform_feedback3_lines_triangles 1
+#endif
+
+#ifndef GL_AMD_depth_clamp_separate
+#define GL_AMD_depth_clamp_separate 1
+#endif
+
+#ifndef GL_EXT_texture_sRGB_decode
+#define GL_EXT_texture_sRGB_decode 1
+#endif
+
+#ifndef GL_NV_texture_multisample
+#define GL_NV_texture_multisample 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glTexImage2DMultisampleCoverageNV (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations);
+GLAPI void APIENTRY glTexImage3DMultisampleCoverageNV (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations);
+GLAPI void APIENTRY glTextureImage2DMultisampleNV (GLuint texture, GLenum target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations);
+GLAPI void APIENTRY glTextureImage3DMultisampleNV (GLuint texture, GLenum target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations);
+GLAPI void APIENTRY glTextureImage2DMultisampleCoverageNV (GLuint texture, GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations);
+GLAPI void APIENTRY glTextureImage3DMultisampleCoverageNV (GLuint texture, GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLTEXIMAGE2DMULTISAMPLECOVERAGENVPROC) (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations);
+typedef void (APIENTRYP PFNGLTEXIMAGE3DMULTISAMPLECOVERAGENVPROC) (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations);
+typedef void (APIENTRYP PFNGLTEXTUREIMAGE2DMULTISAMPLENVPROC) (GLuint texture, GLenum target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations);
+typedef void (APIENTRYP PFNGLTEXTUREIMAGE3DMULTISAMPLENVPROC) (GLuint texture, GLenum target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations);
+typedef void (APIENTRYP PFNGLTEXTUREIMAGE2DMULTISAMPLECOVERAGENVPROC) (GLuint texture, GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations);
+typedef void (APIENTRYP PFNGLTEXTUREIMAGE3DMULTISAMPLECOVERAGENVPROC) (GLuint texture, GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations);
+#endif
+
+#ifndef GL_AMD_blend_minmax_factor
+#define GL_AMD_blend_minmax_factor 1
+#endif
+
+#ifndef GL_AMD_sample_positions
+#define GL_AMD_sample_positions 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glSetMultisamplefvAMD (GLenum pname, GLuint index, const GLfloat *val);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLSETMULTISAMPLEFVAMDPROC) (GLenum pname, GLuint index, const GLfloat *val);
+#endif
+
+#ifndef GL_EXT_x11_sync_object
+#define GL_EXT_x11_sync_object 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI GLsync APIENTRY glImportSyncEXT (GLenum external_sync_type, GLintptr external_sync, GLbitfield flags);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef GLsync (APIENTRYP PFNGLIMPORTSYNCEXTPROC) (GLenum external_sync_type, GLintptr external_sync, GLbitfield flags);
+#endif
+
+#ifndef GL_AMD_multi_draw_indirect
+#define GL_AMD_multi_draw_indirect 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glMultiDrawArraysIndirectAMD (GLenum mode, const GLvoid *indirect, GLsizei primcount, GLsizei stride);
+GLAPI void APIENTRY glMultiDrawElementsIndirectAMD (GLenum mode, GLenum type, const GLvoid *indirect, GLsizei primcount, GLsizei stride);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSINDIRECTAMDPROC) (GLenum mode, const GLvoid *indirect, GLsizei primcount, GLsizei stride);
+typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSINDIRECTAMDPROC) (GLenum mode, GLenum type, const GLvoid *indirect, GLsizei primcount, GLsizei stride);
+#endif
+
+#ifndef GL_EXT_framebuffer_multisample_blit_scaled
+#define GL_EXT_framebuffer_multisample_blit_scaled 1
+#endif
+
#ifdef __cplusplus
}
diff --git a/src/graphics/GLBufferCache.cpp b/src/graphics/GLBufferCache.cpp
index e88fc4f..5acd1ce 100644
--- a/src/graphics/GLBufferCache.cpp
+++ b/src/graphics/GLBufferCache.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -21,6 +21,8 @@
#include "GLBufferCache.h"
+#include "GLContext.h"
+
#include "../base/Exception.h"
using namespace std;
@@ -42,7 +44,7 @@ unsigned int GLBufferCache::getBuffer()
unsigned int bufferID;
if (m_BufferIDs.empty()) {
glproc::GenBuffers(1, &bufferID);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "PBO: GenBuffers()");
+ GLContext::checkError("PBO: GenBuffers()");
} else {
bufferID = m_BufferIDs.back();
m_BufferIDs.pop_back();
@@ -55,6 +57,11 @@ void GLBufferCache::returnBuffer(unsigned int bufferID)
m_BufferIDs.push_back(bufferID);
}
+unsigned int GLBufferCache::getNumBuffers() const
+{
+ return m_BufferIDs.size();
+}
+
void GLBufferCache::deleteBuffers()
{
for (unsigned i=0; i<m_BufferIDs.size(); ++i) {
diff --git a/src/graphics/GLBufferCache.h b/src/graphics/GLBufferCache.h
index 2fca9d4..d357d07 100644
--- a/src/graphics/GLBufferCache.h
+++ b/src/graphics/GLBufferCache.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -41,9 +41,11 @@ public:
unsigned int getBuffer();
void returnBuffer(unsigned int);
-private:
+ unsigned int getNumBuffers() const;
+
void deleteBuffers();
+private:
std::vector<unsigned int> m_BufferIDs;
};
diff --git a/src/graphics/GLConfig.cpp b/src/graphics/GLConfig.cpp
index abe6aa4..72cc61a 100644
--- a/src/graphics/GLConfig.cpp
+++ b/src/graphics/GLConfig.cpp
@@ -1,5 +1,5 @@
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -21,33 +21,62 @@
#include "GLConfig.h"
#include "../base/Logger.h"
+#include "../base/Exception.h"
+
+#include <string>
namespace avg {
+using namespace std;
+
GLConfig::GLConfig()
{
}
-GLConfig::GLConfig(bool bUsePOTTextures, bool bUseShaders, bool bUsePixelBuffers,
- int multiSampleSamples)
- : m_bUsePOTTextures(bUsePOTTextures),
- m_bUseShaders(bUseShaders),
+GLConfig::GLConfig(bool bGLES, bool bUsePOTTextures, bool bUsePixelBuffers,
+ int multiSampleSamples, ShaderUsage shaderUsage, bool bUseDebugContext)
+ : m_bGLES(bGLES),
+ m_bUsePOTTextures(bUsePOTTextures),
m_bUsePixelBuffers(bUsePixelBuffers),
- m_MultiSampleSamples(multiSampleSamples)
+ m_MultiSampleSamples(multiSampleSamples),
+ m_ShaderUsage(shaderUsage),
+ m_bUseDebugContext(bUseDebugContext)
{
}
void GLConfig::log()
{
- AVG_TRACE(Logger::CONFIG, " Shader support: " << (m_bUseShaders?"true":"false"));
- AVG_TRACE(Logger::CONFIG, " Pixel buffers: " << (m_bUsePixelBuffers?"true":"false"));
- AVG_TRACE(Logger::CONFIG, " Power of 2 textures: " <<
- (m_bUsePOTTextures?"true":"false"));
+ AVG_TRACE(Logger::category::CONFIG, Logger::severity::INFO,
+ " OpenGL flavor: " << (m_bGLES?"Mobile (ES)":"Desktop"));
+ AVG_TRACE(Logger::category::CONFIG, Logger::severity::INFO,
+ " Pixel buffers: " << (m_bUsePixelBuffers?"true":"false"));
+ AVG_TRACE(Logger::category::CONFIG, Logger::severity::INFO,
+ " Power of 2 textures: " << (m_bUsePOTTextures?"true":"false"));
if (m_MultiSampleSamples == 1) {
- AVG_TRACE(Logger::CONFIG, " No multisampling.");
+ AVG_TRACE(Logger::category::CONFIG, Logger::severity::INFO, " No multisampling");
} else {
- AVG_TRACE(Logger::CONFIG, " Multisampling with " << m_MultiSampleSamples
- << " samples");
+ AVG_TRACE(Logger::category::CONFIG, Logger::severity::INFO,
+ " Multisampling with " << m_MultiSampleSamples << " samples");
+ }
+ string sShader = shaderUsageToString(m_ShaderUsage);
+ AVG_TRACE(Logger::category::CONFIG, Logger::severity::INFO,
+ " Shader usage: " << sShader);
+ AVG_TRACE(Logger::category::CONFIG, Logger::severity::INFO,
+ " Debug context: " << (m_bUseDebugContext?"true":"false"));
+}
+
+std::string GLConfig::shaderUsageToString(ShaderUsage su)
+{
+ switch(su) {
+ case FULL:
+ return "full";
+ case MINIMAL:
+ return "minimal";
+ case AUTO:
+ return "auto";
+ default:
+ AVG_ASSERT(false);
+ return "";
}
}
diff --git a/src/graphics/GLConfig.h b/src/graphics/GLConfig.h
index ebf6387..7aaaa64 100644
--- a/src/graphics/GLConfig.h
+++ b/src/graphics/GLConfig.h
@@ -1,5 +1,5 @@
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -23,21 +23,27 @@
#include "../api.h"
+#include <string>
+
namespace avg {
struct AVG_API GLConfig {
+ enum ShaderUsage {FULL, MINIMAL, AUTO};
+
GLConfig();
- GLConfig(bool bUsePOTTextures, bool bUseShaders, bool bUsePixelBuffers,
- int multiSampleSamples);
+ GLConfig(bool bGLES, bool bUsePOTTextures, bool bUsePixelBuffers,
+ int multiSampleSamples, ShaderUsage shaderUsage, bool bUseDebugContext);
void log();
+ static std::string shaderUsageToString(ShaderUsage su);
+
+ bool m_bGLES;
bool m_bUsePOTTextures;
- bool m_bUseShaders;
bool m_bUsePixelBuffers;
int m_MultiSampleSamples;
-
-// OGLMemoryMode m_MemoryMode;
+ ShaderUsage m_ShaderUsage;
+ bool m_bUseDebugContext;
};
}
diff --git a/src/graphics/GLContext.cpp b/src/graphics/GLContext.cpp
index 35af3fa..e5ed1ce 100644
--- a/src/graphics/GLContext.cpp
+++ b/src/graphics/GLContext.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -22,174 +22,148 @@
#include "GLContext.h"
#include "ShaderRegistry.h"
+#include "StandardShader.h"
+#ifdef __APPLE__
+ #include "CGLContext.h"
+#elif defined linux
+ #ifdef AVG_ENABLE_EGL
+ #include "EGLContext.h"
+ #else
+ #include "GLXContext.h"
+ #endif
+#elif defined _WIN32
+ #include "WGLContext.h"
+#endif
+
+#include "../base/Backtrace.h"
#include "../base/Exception.h"
#include "../base/Logger.h"
#include "../base/MathHelper.h"
#include <iostream>
+#include <stdio.h>
namespace avg {
using namespace std;
using namespace boost;
-thread_specific_ptr<GLContext*> GLContext::s_pCurrentContext;
-#ifdef _WIN32
-LONG WINAPI imagingWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- return DefWindowProc(hwnd, msg, wParam, lParam);
-}
-
-void registerWindowClass()
-{
- static char * pClassName;
- if (pClassName) {
- return;
- }
- pClassName = "GL";
-
- HINSTANCE hInstance = GetModuleHandle(NULL);
- WNDCLASS wc;
- memset(&wc, 0, sizeof(WNDCLASS));
- wc.style = CS_OWNDC;
- wc.lpfnWndProc = (WNDPROC)imagingWindowProc;
- wc.hInstance = hInstance;
- wc.hIcon = LoadIcon(NULL, IDI_WINLOGO);
- wc.hCursor = LoadCursor(hInstance, IDC_ARROW);
- wc.hbrBackground = NULL;
- wc.lpszMenuName = NULL;
- wc.lpszClassName = pClassName;
-
- BOOL bOK = RegisterClass(&wc);
- AVG_ASSERT(bOK);
-}
-#endif
+thread_specific_ptr<GLContext*> GLContext::s_pCurrentContext;
+GLContext* GLContext::s_pMainContext = 0; // Optimized access to main context.
+bool GLContext::s_bErrorCheckEnabled = false;
+bool GLContext::s_bErrorLogEnabled = true;
-#ifdef linux
-static bool s_bX11Error;
-static int (*s_DefaultErrorHandler) (Display *, XErrorEvent *);
-int X11ErrorHandler(Display * pDisplay, XErrorEvent * pErrEvent)
+GLContext* GLContext::create(const GLConfig& glConfig, const IntPoint& windowSize,
+ const SDL_SysWMinfo* pSDLWMInfo)
{
- cerr << "X11 error creating offscreen context: " << (int)(pErrEvent->request_code)
- << ", " << (int)(pErrEvent->minor_code) << endl;
- s_bX11Error = true;
- return 0;
-}
+ if (glConfig.m_bGLES) {
+ AVG_ASSERT(isGLESSupported());
+ }
+#ifdef __APPLE__
+ return new CGLContext(glConfig, windowSize, pSDLWMInfo);
+#elif defined linux
+ #ifdef AVG_ENABLE_EGL
+ GLConfig tempConfig = glConfig;
+ tempConfig.m_bGLES = true;
+ return new EGLContext(tempConfig, windowSize, pSDLWMInfo);
+ #else
+ return new GLXContext(glConfig, windowSize, pSDLWMInfo);
+ #endif
+#elif defined _WIN32
+ return new WGLContext(glConfig, windowSize, pSDLWMInfo);
+#else
+ AVG_ASSERT(false);
+ return GLContextPtr();
#endif
+}
-GLContext::GLContext(bool bUseCurrent, const GLConfig& GLConfig,
- GLContext* pSharedContext)
- : m_Context(0),
- m_MaxTexSize(0),
+GLContext::GLContext(const IntPoint& windowSize, const SDL_SysWMinfo* pSDLWMInfo)
+ : m_MaxTexSize(0),
+ m_bCheckedGPUMemInfoExtension(false),
m_bCheckedMemoryMode(false),
- m_bEnableTexture(false),
- m_bEnableGLColorArray(true),
- m_BlendMode(BLEND_ADD)
+ m_BlendColor(0.f, 0.f, 0.f, 0.f),
+ m_BlendMode(BLEND_ADD),
+ m_MajorGLVersion(-1)
{
- if (bUseCurrent) {
- AVG_ASSERT(!pSharedContext);
- }
if (s_pCurrentContext.get() == 0) {
s_pCurrentContext.reset(new (GLContext*));
}
- m_GLConfig = GLConfig;
- m_bOwnsContext = !bUseCurrent;
- if (bUseCurrent) {
-#if defined(__APPLE__)
- m_Context = CGLGetCurrentContext();
-#elif defined(__linux__)
- m_pDisplay = glXGetCurrentDisplay();
- m_Drawable = glXGetCurrentDrawable();
- m_Context = glXGetCurrentContext();
-#elif defined(_WIN32)
- m_hDC = wglGetCurrentDC();
- m_Context = wglGetCurrentContext();
-#endif
- *s_pCurrentContext = this;
+}
+
+GLContext::~GLContext()
+{
+}
+
+void GLContext::init(const GLConfig& glConfig, bool bOwnsContext)
+{
+ m_GLConfig = glConfig;
+ m_bOwnsContext = bOwnsContext;
+ activate();
+ glproc::init();
+ if (m_GLConfig.m_bGLES) {
+ m_MajorGLVersion = 2;
+ m_MinorGLVersion = 0;
} else {
-#ifdef __APPLE__
- CGLPixelFormatObj pixelFormatObj;
- GLint numPixelFormats;
-
- CGLPixelFormatAttribute attribs[] = {(CGLPixelFormatAttribute)NULL};
- CGLContextObj cglSharedContext;
- if (pSharedContext) {
- cglSharedContext = pSharedContext->m_Context;
- pixelFormatObj = CGLGetPixelFormat(cglSharedContext);
- } else {
- cglSharedContext = 0;
- CGLChoosePixelFormat(attribs, &pixelFormatObj, &numPixelFormats);
- }
+ const char* pVersion = (const char*)glGetString(GL_VERSION);
+ sscanf(pVersion, "%d.%d", &m_MajorGLVersion, &m_MinorGLVersion);
+ }
- CGLError err = CGLCreateContext(pixelFormatObj, cglSharedContext, &m_Context);
- if (err) {
- cerr << CGLErrorString(err) << endl;
- AVG_ASSERT(false);
- }
- CGLDestroyPixelFormat(pixelFormatObj);
-#elif defined(__linux__)
- m_pDisplay = XOpenDisplay(0);
- if (!m_pDisplay) {
- throw Exception(AVG_ERR_VIDEO_GENERAL, "No X windows display available.");
+ if (m_GLConfig.m_bUseDebugContext) {
+ if (isDebugContextSupported()) {
+ glproc::DebugMessageCallback(GLContext::debugLogCallback, 0);
+ } else {
+ m_GLConfig.m_bUseDebugContext = false;
}
- XVisualInfo *vi;
- static int attributes[] = {GLX_RGBA,
- GLX_RED_SIZE, 1,
- GLX_GREEN_SIZE, 1,
- GLX_BLUE_SIZE, 1,
- 0};
- vi = glXChooseVisual(m_pDisplay, DefaultScreen(m_pDisplay), attributes);
- m_Context = glXCreateContext(m_pDisplay, vi, 0, GL_TRUE);
- AVG_ASSERT(m_Context);
- Pixmap pmp = XCreatePixmap(m_pDisplay, RootWindow(m_pDisplay, vi->screen),
- 8, 8, vi->depth);
- GLXPixmap pixmap = glXCreateGLXPixmap(m_pDisplay, vi, pmp);
-
- s_bX11Error = false;
- s_DefaultErrorHandler = XSetErrorHandler(X11ErrorHandler);
- glXMakeCurrent(m_pDisplay, pixmap, m_Context);
- XSetErrorHandler(s_DefaultErrorHandler);
-
- if (s_bX11Error) {
- throw Exception(AVG_ERR_VIDEO_GENERAL, "X error creating OpenGL context.");
+ }
+#ifndef AVG_ENABLE_EGL
+ if (m_GLConfig.m_MultiSampleSamples > 1) {
+ glEnable(GL_MULTISAMPLE);
+ checkError("init: glEnable(GL_MULTISAMPLE)");
+ }
+#endif
+ m_pShaderRegistry = ShaderRegistryPtr(new ShaderRegistry());
+ if (useGPUYUVConversion()) {
+ m_pShaderRegistry->setPreprocessorDefine("ENABLE_YUV_CONVERSION", "");
+ }
+ setBlendMode(BLEND_BLEND, false);
+ if (!m_GLConfig.m_bUsePOTTextures) {
+ m_GLConfig.m_bUsePOTTextures =
+ !queryOGLExtension("GL_ARB_texture_non_power_of_two") && !isGLES();
+ }
+ if (m_GLConfig.m_ShaderUsage == GLConfig::AUTO) {
+ if (isGLES()) {
+ m_GLConfig.m_ShaderUsage = GLConfig::MINIMAL;
+ } else {
+ m_GLConfig.m_ShaderUsage = GLConfig::FULL;
}
- m_Drawable = glXGetCurrentDrawable();
-#elif defined(_WIN32)
- registerWindowClass();
- m_hwnd = CreateWindow("GL", "GL",
- WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
- 0, 0, 500, 300, 0, 0, GetModuleHandle(NULL), 0);
- winOGLErrorCheck(m_hDC != 0, "CreateWindow");
-
- m_hDC = GetDC(m_hwnd);
- winOGLErrorCheck(m_hDC != 0, "GetDC");
-
- PIXELFORMATDESCRIPTOR pfd;
- ZeroMemory(&pfd, sizeof(pfd));
- pfd.nSize = sizeof(pfd);
- pfd.nVersion = 1;
- pfd.dwFlags = PFD_SUPPORT_OPENGL | PFD_DRAW_TO_WINDOW;
- pfd.iPixelType = PFD_TYPE_RGBA;
- pfd.cColorBits = 32;
- pfd.cDepthBits = 32;
- pfd.iLayerType = PFD_MAIN_PLANE;
-
- int iFormat = ChoosePixelFormat(m_hDC, &pfd);
- winOGLErrorCheck(iFormat != 0, "ChoosePixelFormat");
- SetPixelFormat(m_hDC, iFormat, &pfd);
- m_Context = wglCreateContext(m_hDC);
- winOGLErrorCheck(m_Context != 0, "wglCreateContext");
+ }
+#ifdef __APPLE__
+ if (GLContext::isVendor("Intel")) {
+ // Bug #434: Some shaders cause hard lockups on Mac Book Air.
+ m_GLConfig.m_ShaderUsage = GLConfig::MINIMAL;
+ }
#endif
+ for (int i=0; i<16; ++i) {
+ m_BoundTextures[i] = 0xFFFFFFFF;
}
-
- init();
+ if (!m_GLConfig.m_bGLES && !queryOGLExtension("GL_ARB_vertex_buffer_object")) {
+ throw Exception(AVG_ERR_UNSUPPORTED,
+ "Graphics driver lacks vertex buffer support, unable to initialize graphics.");
+ }
+ glEnable(GL_BLEND);
+ checkError("init: glEnable(GL_BLEND)");
+ glDisable(GL_DEPTH_TEST);
+ checkError("init: glDisable(GL_DEPTH_TEST)");
+ glEnable(GL_STENCIL_TEST);
+ checkError("init: glEnable(GL_STENCIL_TEST)");
}
-GLContext::~GLContext()
+void GLContext::deleteObjects()
{
+ m_pStandardShader = StandardShaderPtr();
for (unsigned i=0; i<m_FBOIDs.size(); ++i) {
glproc::DeleteFramebuffers(1, &(m_FBOIDs[i]));
}
@@ -197,44 +171,21 @@ GLContext::~GLContext()
if (*s_pCurrentContext == this) {
*s_pCurrentContext = 0;
}
- if (m_bOwnsContext && m_Context) {
-#ifdef __APPLE__
- CGLSetCurrentContext(0);
- CGLDestroyContext(m_Context);
- m_Context = 0;
-#elif defined _WIN32
- wglDeleteContext(m_Context);
- DeleteDC(m_hDC);
- DestroyWindow(m_hwnd);
-#endif
- }
}
-void GLContext::init()
+void GLContext::getVersion(int& major, int& minor) const
{
- activate();
- glproc::init();
- m_pShaderRegistry = ShaderRegistryPtr(new ShaderRegistry());
- enableGLColorArray(false);
- setBlendMode(BLEND_BLEND, false);
- checkShaderSupport();
- if (!m_GLConfig.m_bUsePOTTextures) {
- m_GLConfig.m_bUsePOTTextures =
- !queryOGLExtension("GL_ARB_texture_non_power_of_two");
- }
+ major = m_MajorGLVersion;
+ minor = m_MinorGLVersion;
}
-void GLContext::activate()
+bool GLContext::ownsContext() const
+{
+ return m_bOwnsContext;
+}
+
+void GLContext::setCurrent()
{
-#ifdef __APPLE__
- CGLError err = CGLSetCurrentContext(m_Context);
- AVG_ASSERT(err == kCGLNoError);
-#elif defined linux
- glXMakeCurrent(m_pDisplay, m_Drawable, m_Context);
-#elif defined _WIN32
- BOOL bOk = wglMakeCurrent(m_hDC, m_Context);
- winOGLErrorCheck(bOk, "wglMakeCurrent");
-#endif
*s_pCurrentContext = this;
}
@@ -243,22 +194,22 @@ ShaderRegistryPtr GLContext::getShaderRegistry() const
return m_pShaderRegistry;
}
-void GLContext::pushTransform(const DPoint& translate, double angle, const DPoint& pivot)
+StandardShaderPtr GLContext::getStandardShader()
+{
+ if (m_pStandardShader == StandardShaderPtr()) {
+ m_pStandardShader = StandardShaderPtr(new StandardShader());
+ }
+ return m_pStandardShader;
+}
+
+bool GLContext::useGPUYUVConversion() const
{
- glPushMatrix();
- glTranslated(translate.x, translate.y, 0);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "pushTransform: glTranslated");
- glTranslated(pivot.x, pivot.y, 0);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "pushTransform: glTranslated");
- glRotated(angle*180.0/M_PI, 0, 0, 1);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "pushTransform: glRotated");
- glTranslated(-pivot.x, -pivot.y, 0);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "pushTransform: glTranslated");
+ return (m_MajorGLVersion > 1) || isGLES();
}
-void GLContext::popTransform()
+GLConfig::ShaderUsage GLContext::getShaderUsage() const
{
- glPopMatrix();
+ return m_GLConfig.m_ShaderUsage;
}
GLBufferCache& GLContext::getVertexBufferCache()
@@ -293,45 +244,17 @@ void GLContext::returnFBOToCache(unsigned fboID)
m_FBOIDs.push_back(fboID);
}
-void GLContext::enableTexture(bool bEnable)
+void GLContext::setBlendColor(const glm::vec4& color)
{
- if (bEnable != m_bEnableTexture) {
- if (bEnable) {
- glEnable(GL_TEXTURE_2D);
- } else {
- glDisable(GL_TEXTURE_2D);
- }
- m_bEnableTexture = bEnable;
- }
-}
-
-void GLContext::enableGLColorArray(bool bEnable)
-{
- if (bEnable != m_bEnableGLColorArray) {
- if (bEnable) {
- glEnableClientState(GL_COLOR_ARRAY);
- } else {
- glDisableClientState(GL_COLOR_ARRAY);
- }
- m_bEnableGLColorArray = bEnable;
- }
-}
-
-void checkBlendModeError(const char * sMode)
-{
- GLenum err = glGetError();
- if (err != GL_NO_ERROR) {
- static bool bErrorReported = false;
- if (!bErrorReported) {
- AVG_TRACE(Logger::WARNING, "Blendmode "<< sMode <<
- " not supported by OpenGL implementation.");
- bErrorReported = true;
- }
+ if (m_BlendColor != color) {
+ glproc::BlendColor(color[0], color[1], color[2], color[3]);
+ m_BlendColor = color;
}
}
void GLContext::setBlendMode(BlendMode mode, bool bPremultipliedAlpha)
{
+ AVG_ASSERT(isBlendModeSupported(mode));
GLenum srcFunc;
if (bPremultipliedAlpha) {
srcFunc = GL_CONSTANT_ALPHA;
@@ -344,28 +267,29 @@ void GLContext::setBlendMode(BlendMode mode, bool bPremultipliedAlpha)
glproc::BlendEquation(GL_FUNC_ADD);
glproc::BlendFuncSeparate(srcFunc, GL_ONE_MINUS_SRC_ALPHA,
GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
- checkBlendModeError("blend");
+ checkError("setBlendMode: blend");
break;
case BLEND_ADD:
glproc::BlendEquation(GL_FUNC_ADD);
glproc::BlendFuncSeparate(srcFunc, GL_ONE, GL_ONE, GL_ONE);
- checkBlendModeError("add");
+ checkError("setBlendMode: add");
break;
case BLEND_MIN:
- glproc::BlendEquation(GL_MIN);
+ glproc::BlendEquation(GL_MIN_EXT);
glproc::BlendFuncSeparate(srcFunc, GL_ONE_MINUS_SRC_ALPHA,
GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
- checkBlendModeError("min");
+ checkError("setBlendMode: min");
break;
case BLEND_MAX:
- glproc::BlendEquation(GL_MAX);
+ glproc::BlendEquation(GL_MAX_EXT);
glproc::BlendFuncSeparate(srcFunc, GL_ONE_MINUS_SRC_ALPHA,
GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
- checkBlendModeError("max");
+ checkError("setBlendMode: max");
break;
case BLEND_COPY:
glproc::BlendEquation(GL_FUNC_ADD);
glBlendFunc(GL_ONE, GL_ZERO);
+ checkError("setBlendMode: copy");
break;
default:
AVG_ASSERT(false);
@@ -376,6 +300,26 @@ void GLContext::setBlendMode(BlendMode mode, bool bPremultipliedAlpha)
}
}
+bool GLContext::isBlendModeSupported(BlendMode mode) const
+{
+ if (isGLES() && (mode == BLEND_MIN || mode == BLEND_MAX)) {
+ return queryOGLExtension("GL_EXT_blend_minmax");
+ } else {
+ return true;
+ }
+}
+
+void GLContext::bindTexture(unsigned unit, unsigned texID)
+{
+ if (m_BoundTextures[unit-GL_TEXTURE0] != texID) {
+ glproc::ActiveTexture(unit);
+ checkError("GLContext::bindTexture ActiveTexture()");
+ glBindTexture(GL_TEXTURE_2D, texID);
+ checkError("GLContext::bindTexture BindTexture()");
+ m_BoundTextures[unit-GL_TEXTURE0] = texID;
+ }
+}
+
const GLConfig& GLContext::getConfig()
{
return m_GLConfig;
@@ -383,20 +327,63 @@ const GLConfig& GLContext::getConfig()
void GLContext::logConfig()
{
- AVG_TRACE(Logger::CONFIG, "OpenGL configuration: ");
- AVG_TRACE(Logger::CONFIG, " OpenGL version: " << glGetString(GL_VERSION));
- AVG_TRACE(Logger::CONFIG, " OpenGL vendor: " << glGetString(GL_VENDOR));
- AVG_TRACE(Logger::CONFIG, " OpenGL renderer: " << glGetString(GL_RENDERER));
+ AVG_TRACE(Logger::category::CONFIG, Logger::severity::INFO, "OpenGL configuration: ");
+ AVG_TRACE(Logger::category::CONFIG, Logger::severity::INFO,
+ " OpenGL version: " << glGetString(GL_VERSION));
+ AVG_TRACE(Logger::category::CONFIG, Logger::severity::INFO,
+ " OpenGL vendor: " << glGetString(GL_VENDOR));
+ AVG_TRACE(Logger::category::CONFIG, Logger::severity::INFO,
+ " OpenGL renderer: " << glGetString(GL_RENDERER));
m_GLConfig.log();
- switch (getMemoryModeSupported()) {
+ switch (getMemoryMode()) {
case MM_PBO:
- AVG_TRACE(Logger::CONFIG, " Using pixel buffer objects.");
+ AVG_TRACE(Logger::category::CONFIG, Logger::severity::INFO,
+ " Using pixel buffer objects");
break;
case MM_OGL:
- AVG_TRACE(Logger::CONFIG, " Not using GL memory extensions.");
+ AVG_TRACE(Logger::category::CONFIG, Logger::severity::INFO,
+ " Not using GL memory extensions");
break;
}
- AVG_TRACE(Logger::CONFIG, " Max. texture size is " << getMaxTexSize());
+ AVG_TRACE(Logger::category::CONFIG, Logger::severity::INFO,
+ " Max. texture size: " << getMaxTexSize());
+ string s;
+ if (useGPUYUVConversion()) {
+ s = "yes";
+ } else {
+ s = "no";
+ }
+ AVG_TRACE(Logger::category::CONFIG, Logger::severity::INFO,
+ string(" GPU-based YUV-RGB conversion: ")+s+".");
+ try {
+ AVG_TRACE(Logger::category::CONFIG, Logger::severity::INFO,
+ " Dedicated video memory: " << getVideoMemInstalled()/(1024*1024)
+ << " MB");
+ AVG_TRACE(Logger::category::CONFIG, Logger::severity::INFO,
+ " Video memory used at start: " << getVideoMemUsed()/(1024*1024)
+ << " MB");
+ } catch (Exception) {
+ AVG_TRACE(Logger::category::CONFIG, Logger::severity::ERROR,
+ " Dedicated video memory: Unknown");
+ AVG_TRACE(Logger::category::CONFIG, Logger::severity::ERROR,
+ " Video memory used at start: Unknown");
+ }
+}
+
+size_t GLContext::getVideoMemInstalled()
+{
+ checkGPUMemInfoSupport();
+ int kbMemInstalled;
+ glGetIntegerv(GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX, &kbMemInstalled);
+ return (size_t)kbMemInstalled*1024;
+}
+
+size_t GLContext::getVideoMemUsed()
+{
+ checkGPUMemInfoSupport();
+ int kbMemAvailable;
+ glGetIntegerv(GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX, &kbMemAvailable);
+ return getVideoMemInstalled()-(size_t)kbMemAvailable*1024;
}
bool GLContext::usePOTTextures()
@@ -404,13 +391,20 @@ bool GLContext::usePOTTextures()
return m_GLConfig.m_bUsePOTTextures;
}
-OGLMemoryMode GLContext::getMemoryModeSupported()
+bool GLContext::arePBOsSupported()
+{
+ if (isGLES()) {
+ return false;
+ } else {
+ return (queryOGLExtension("GL_ARB_pixel_buffer_object") ||
+ queryOGLExtension("GL_EXT_pixel_buffer_object"));
+ }
+}
+
+OGLMemoryMode GLContext::getMemoryMode()
{
if (!m_bCheckedMemoryMode) {
- if ((queryOGLExtension("GL_ARB_pixel_buffer_object") ||
- queryOGLExtension("GL_EXT_pixel_buffer_object")) &&
- m_GLConfig.m_bUsePixelBuffers)
- {
+ if (arePBOsSupported() && m_GLConfig.m_bUsePixelBuffers) {
m_MemoryMode = MM_PBO;
} else {
m_MemoryMode = MM_OGL;
@@ -419,10 +413,21 @@ OGLMemoryMode GLContext::getMemoryModeSupported()
}
return m_MemoryMode;
}
+
+bool GLContext::isGLES() const
+{
+ return m_GLConfig.m_bGLES;
+}
+
+bool GLContext::isVendor(const string& sWantedVendor) const
+{
+ string sVendor((const char *)glGetString(GL_VENDOR));
+ return (sVendor.find(sWantedVendor) != string::npos);
+}
-bool GLContext::isUsingShaders() const
+bool GLContext::useDepthBuffer() const
{
- return m_GLConfig.m_bUseShaders;
+ return !isGLES();
}
int GLContext::getMaxTexSize()
@@ -433,6 +438,52 @@ int GLContext::getMaxTexSize()
return m_MaxTexSize;
}
+
+void GLContext::swapBuffers()
+{
+ AVG_ASSERT(false);
+}
+
+void GLContext::enableErrorChecks(bool bEnable)
+{
+ s_bErrorCheckEnabled = bEnable;
+}
+
+void GLContext::checkError(const char* pszWhere)
+{
+ if (s_bErrorCheckEnabled) {
+ mandatoryCheckError(pszWhere);
+ }
+}
+
+void GLContext::mandatoryCheckError(const char* pszWhere)
+{
+ GLenum err = glGetError();
+ if (err != GL_NO_ERROR) {
+ stringstream s;
+#ifndef AVG_ENABLE_EGL
+ s << "OpenGL error in " << pszWhere <<": " << gluErrorString(err)
+ << " (#" << err << ") ";
+#else
+ s << "OpenGL error in " << pszWhere <<": (#" << err << ") ";
+#endif
+ AVG_LOG_ERROR(s.str());
+ if (err != GL_INVALID_OPERATION) {
+ checkError(" --");
+ }
+ AVG_ASSERT(false);
+ }
+}
+
+void GLContext::ensureFullShaders(const string& sContext) const
+{
+ if (getShaderUsage() != GLConfig::FULL) {
+ throw Exception(AVG_ERR_UNSUPPORTED,
+ sContext + " not supported if ShaderUsage==MINIMAL");
+ }
+
+}
+
GLContext::BlendMode GLContext::stringToBlendMode(const string& s)
{
if (s == "blend") {
@@ -453,17 +504,153 @@ GLContext* GLContext::getCurrent()
return *s_pCurrentContext;
}
-void GLContext::checkShaderSupport()
+GLContext* GLContext::getMain()
+{
+ return s_pMainContext;
+}
+
+void GLContext::setMain(GLContext * pMainContext)
+{
+ s_pMainContext = pMainContext;
+}
+
+int GLContext::nextMultiSampleValue(int curSamples)
+{
+ switch (curSamples) {
+ case 1:
+ return 0;
+ case 2:
+ return 1;
+ case 4:
+ return 2;
+ case 8:
+ return 4;
+ default:
+ return 8;
+ }
+}
+
+bool GLContext::isGLESSupported()
+{
+#if defined linux
+ #ifdef AVG_ENABLE_EGL
+ return true;
+ #else
+ return GLXContext::haveARBCreateContext();
+ #endif
+#else
+ return false;
+#endif
+}
+
+void GLContext::enableErrorLog(bool bEnable)
+{
+ s_bErrorLogEnabled = bEnable;
+}
+
+void GLContext::checkGPUMemInfoSupport()
+{
+ if (!m_bCheckedGPUMemInfoExtension) {
+ m_bGPUMemInfoSupported = queryOGLExtension("GL_NVX_gpu_memory_info");
+ m_bCheckedGPUMemInfoExtension = true;
+ }
+ if (!m_bGPUMemInfoSupported) {
+ throw Exception(AVG_ERR_UNSUPPORTED,
+ "Video memory query not supported on this system.");
+ }
+}
+
+bool GLContext::isDebugContextSupported() const
+{
+ if (queryOGLExtension("GL_ARB_debug_output") || queryOGLExtension("GL_KHR_debug")) {
+ return true;
+ }
+ if (isGLES() && isVendor("NVIDIA")) {
+ // There is no extension for debug output in gles 2.0, but Linux NVidia
+ // supports the functionality anyway. So we activate it :-).
+ return true;
+ }
+ return false;
+}
+
+void GLContext::debugLogCallback(GLenum source, GLenum type, GLuint id,
+ GLenum severity, GLsizei length, const GLchar* message, void* userParam)
{
- int glMajorVer;
- int glMinorVer;
- getGLShadingLanguageVersion(glMajorVer, glMinorVer);
- bool bShaderVersionOK = (glMajorVer >= 2 || glMinorVer >= 10);
- m_GLConfig.m_bUseShaders = (queryOGLExtension("GL_ARB_fragment_shader") &&
- getMemoryModeSupported() == MM_PBO &&
- !m_GLConfig.m_bUsePOTTextures &&
- m_GLConfig.m_bUseShaders &&
- bShaderVersionOK);
+/*
+ string sSource;
+ switch (source) {
+ case GL_DEBUG_SOURCE_API_ARB:
+ sSource = "API";
+ break;
+ case GL_DEBUG_SOURCE_WINDOW_SYSTEM_ARB:
+ sSource = "Window System";
+ break;
+ case GL_DEBUG_SOURCE_SHADER_COMPILER_ARB:
+ sSource = "Shader Compiler";
+ break;
+ case GL_DEBUG_SOURCE_THIRD_PARTY_ARB:
+ sSource = "Third Party";
+ break;
+ case GL_DEBUG_SOURCE_APPLICATION_ARB:
+ sSource = "Application";
+ break;
+ case GL_DEBUG_SOURCE_OTHER_ARB:
+ sSource = "Other";
+ break;
+ default:
+ AVG_ASSERT(false);
+ }
+
+ string sSeverity;
+ switch (severity) {
+ case GL_DEBUG_SEVERITY_HIGH_ARB:
+ sSeverity = "High";
+ break;
+ case GL_DEBUG_SEVERITY_MEDIUM_ARB:
+ sSeverity = "Medium";
+ break;
+ case GL_DEBUG_SEVERITY_LOW_ARB:
+ sSeverity = "Low";
+ break;
+ default:
+ AVG_ASSERT(false);
+ }
+
+ string sType;
+ switch (type) {
+ case GL_DEBUG_TYPE_ERROR_ARB:
+ sType = "Error";
+ break;
+ case GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB:
+ sType = "Deprecated Behaviour";
+ break;
+ case GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB:
+ sType = "Undefined Behaviour";
+ break;
+ case GL_DEBUG_TYPE_PORTABILITY_ARB:
+ sType = "Portability Issue";
+ break;
+ case GL_DEBUG_TYPE_PERFORMANCE_ARB:
+ sType = "Performance Issue";
+ break;
+ case GL_DEBUG_TYPE_OTHER_ARB:
+ sType = "Other";
+ break;
+ default:
+ AVG_ASSERT(false);
+ }
+*/
+
+ // XXX Temporary to clean up NVidia message spam.
+#ifndef AVG_ENABLE_EGL
+ if (type != GL_DEBUG_TYPE_PERFORMANCE_ARB && s_bErrorLogEnabled) {
+#endif
+ AVG_LOG_WARNING(message);
+ // dumpBacktrace();
+ // AVG_ASSERT(false);
+#ifndef AVG_ENABLE_EGL
+ }
+#endif
}
}
diff --git a/src/graphics/GLContext.h b/src/graphics/GLContext.h
index b086d78..5043f5f 100644
--- a/src/graphics/GLContext.h
+++ b/src/graphics/GLContext.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -20,48 +20,43 @@
//
#ifndef _GLContext_H_
#define _GLContext_H_
+
#include "../api.h"
#include "OGLHelper.h"
#include "GLBufferCache.h"
#include "GLConfig.h"
-#include "../base/Point.h"
-
-#ifdef __APPLE__
-#include <OpenGL/OpenGL.h>
-#undef check // Conflicts with boost
-#elif defined linux
-#include <GL/glx.h>
-#elif defined _WIN32
-#include <gl/gl.h>
-#include <gl/glu.h>
-#endif
+#include "../base/GLMHelper.h"
#include <boost/shared_ptr.hpp>
#include <boost/thread/tss.hpp>
+struct SDL_SysWMinfo;
+
namespace avg {
class GLContext;
typedef boost::shared_ptr<GLContext> GLContextPtr;
class ShaderRegistry;
typedef boost::shared_ptr<ShaderRegistry> ShaderRegistryPtr;
+class StandardShader;
+typedef boost::shared_ptr<StandardShader> StandardShaderPtr;
-class AVG_API GLContext {
+class AVG_API GLContext
+{
public:
- GLContext(bool bUseCurrent=false,
- const GLConfig& GLConfig=GLConfig(false, true, true, 1),
- GLContext* pSharedContext=0);
+ static GLContext* create(const GLConfig& glConfig,
+ const IntPoint& windowSize=IntPoint(0,0), const SDL_SysWMinfo* pSDLWMInfo=0);
+
+ GLContext(const IntPoint& windowSize, const SDL_SysWMinfo* pSDLWMInfo);
virtual ~GLContext();
- void init();
- void activate();
+ virtual void activate()=0;
ShaderRegistryPtr getShaderRegistry() const;
-
- virtual void pushTransform(const DPoint& translate, double angle,
- const DPoint& pivot);
- virtual void popTransform();
+ StandardShaderPtr getStandardShader();
+ bool useGPUYUVConversion() const;
+ GLConfig::ShaderUsage getShaderUsage() const;
// GL Object caching.
GLBufferCache& getVertexBufferCache();
@@ -71,40 +66,61 @@ public:
void returnFBOToCache(unsigned fboID);
// GL state cache.
- void enableTexture(bool bEnable);
- void enableGLColorArray(bool bEnable);
+ void setBlendColor(const glm::vec4& color);
enum BlendMode {BLEND_BLEND, BLEND_ADD, BLEND_MIN, BLEND_MAX, BLEND_COPY};
void setBlendMode(BlendMode mode, bool bPremultipliedAlpha = false);
+ bool isBlendModeSupported(BlendMode mode) const;
+ void bindTexture(unsigned unit, unsigned texID);
const GLConfig& getConfig();
void logConfig();
+ size_t getVideoMemInstalled();
+ size_t getVideoMemUsed();
int getMaxTexSize();
bool usePOTTextures();
- OGLMemoryMode getMemoryModeSupported();
- bool isUsingShaders() const;
-
+ bool arePBOsSupported();
+ OGLMemoryMode getMemoryMode();
+ bool isGLES() const;
+ bool isVendor(const std::string& sWantedVendor) const;
+ virtual bool useDepthBuffer() const;
+
+ virtual bool initVBlank(int rate)=0;
+ virtual void swapBuffers();
+
+ static void enableErrorChecks(bool bEnable);
+ static void checkError(const char* pszWhere);
+ static void mandatoryCheckError(const char* pszWhere);
+ void ensureFullShaders(const std::string& sContext) const;
+
static BlendMode stringToBlendMode(const std::string& s);
static GLContext* getCurrent();
+ static GLContext* getMain();
+ static void setMain(GLContext * pMainContext);
+
+ static int nextMultiSampleValue(int curSamples);
+ static bool isGLESSupported();
+ static void enableErrorLog(bool bEnable);
+
+protected:
+ void init(const GLConfig& glConfig, bool bOwnsContext);
+ void deleteObjects();
+
+ void getVersion(int& major, int& minor) const;
+ bool ownsContext() const;
+
+ void setCurrent();
private:
- void checkShaderSupport();
-
-#ifdef __APPLE__
- CGLContextObj m_Context;
-#elif defined linux
- Display* m_pDisplay;
- GLXDrawable m_Drawable;
- GLXContext m_Context;
-#elif defined _WIN32
- HWND m_hwnd;
- HDC m_hDC;
- HGLRC m_Context;
-#endif
-
- bool m_bOwnsContext;
+ void checkGPUMemInfoSupport();
+ bool isDebugContextSupported() const;
+ static void APIENTRY debugLogCallback(GLenum source, GLenum type, GLuint id,
+ GLenum severity, GLsizei length, const GLchar* message, void* userParam);
+ bool m_bOwnsContext;
+
ShaderRegistryPtr m_pShaderRegistry;
+ StandardShaderPtr m_pStandardShader;
GLBufferCache m_VertexBufferCache;
GLBufferCache m_IndexBufferCache;
@@ -113,17 +129,25 @@ private:
int m_MaxTexSize;
GLConfig m_GLConfig;
+ bool m_bCheckedGPUMemInfoExtension;
+ bool m_bGPUMemInfoSupported;
bool m_bCheckedMemoryMode;
OGLMemoryMode m_MemoryMode;
// OpenGL state
- bool m_bEnableTexture;
- bool m_bEnableGLColorArray;
+ glm::vec4 m_BlendColor;
BlendMode m_BlendMode;
bool m_bPremultipliedAlpha;
+ unsigned m_BoundTextures[16];
- static boost::thread_specific_ptr<GLContext*> s_pCurrentContext;
+ int m_MajorGLVersion;
+ int m_MinorGLVersion;
+ static bool s_bErrorCheckEnabled;
+ static bool s_bErrorLogEnabled;
+
+ static boost::thread_specific_ptr<GLContext*> s_pCurrentContext;
+ static GLContext* s_pMainContext;
};
}
diff --git a/src/graphics/GLContextAttribs.cpp b/src/graphics/GLContextAttribs.cpp
new file mode 100644
index 0000000..402f574
--- /dev/null
+++ b/src/graphics/GLContextAttribs.cpp
@@ -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
+//
+
+#include "GLContextAttribs.h"
+#include "OGLHelper.h"
+
+#include "../base/Exception.h"
+
+namespace avg {
+
+GLContextAttribs::GLContextAttribs()
+{
+ m_pAttributes = new int[50];
+ m_NumAttributes = 0;
+#ifdef AVG_ENABLE_EGL
+ m_pAttributes[0] = EGL_NONE;
+#else
+ m_pAttributes[0] = 0;
+#endif
+}
+
+GLContextAttribs::~GLContextAttribs()
+{
+ delete[] m_pAttributes;
+}
+
+
+void GLContextAttribs::append(int newAttr, int newAttrVal)
+{
+ AVG_ASSERT(m_NumAttributes < 48);
+
+ m_pAttributes[m_NumAttributes++] = newAttr;
+ if (newAttrVal != -1) {
+ m_pAttributes[m_NumAttributes++] = newAttrVal;
+ }
+#ifdef AVG_ENABLE_EGL
+ m_pAttributes[m_NumAttributes] = EGL_NONE;
+#else
+ m_pAttributes[m_NumAttributes] = 0;
+#endif
+}
+
+const int* GLContextAttribs::get() const
+{
+ return m_pAttributes;
+}
+
+}
+
diff --git a/src/graphics/GLContextAttribs.h b/src/graphics/GLContextAttribs.h
new file mode 100644
index 0000000..5580f91
--- /dev/null
+++ b/src/graphics/GLContextAttribs.h
@@ -0,0 +1,44 @@
+//
+// 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 _GLContextAttribs_H_
+#define _GLContextAttribs_H_
+
+#include "../api.h"
+
+namespace avg {
+
+class AVG_API GLContextAttribs
+{
+public:
+ GLContextAttribs();
+ virtual ~GLContextAttribs();
+
+ void append(int newAttr, int newAttrVal=-1);
+
+ const int* get() const;
+
+private:
+ int * m_pAttributes;
+ int m_NumAttributes;
+};
+
+}
+#endif
diff --git a/src/graphics/GLShaderParam.cpp b/src/graphics/GLShaderParam.cpp
new file mode 100644
index 0000000..7a1b739
--- /dev/null
+++ b/src/graphics/GLShaderParam.cpp
@@ -0,0 +1,87 @@
+//
+// 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 "GLShaderParam.h"
+#include "OGLShader.h"
+#include <iostream>
+
+using namespace std;
+
+namespace avg {
+
+GLShaderParam::GLShaderParam(OGLShader* pShader, const std::string& sName)
+ : m_sName(sName)
+{
+ m_Location = glproc::GetUniformLocation(pShader->getProgram(), sName.c_str());
+ string sErr = std::string("Shader param '") + sName + "' not found in shader '" +
+ pShader->getName() + "'.";
+ AVG_ASSERT_MSG(m_Location != -1, sErr.c_str());
+ GLContext::checkError(sErr.c_str());
+};
+
+int GLShaderParam::getLocation() const
+{
+ return m_Location;
+}
+
+const string& GLShaderParam::getName() const
+{
+ return m_sName;
+}
+
+template<>
+void GLShaderParamTemplate<int>::uniformSet(unsigned location, const int& val)
+{
+ glproc::Uniform1i(location, val);
+}
+
+template<>
+void GLShaderParamTemplate<float>::uniformSet(unsigned location, const float& val)
+{
+ glproc::Uniform1f(location, val);
+}
+
+template<>
+void GLShaderParamTemplate<glm::vec2>::uniformSet(unsigned location, const glm::vec2& val)
+{
+ glproc::Uniform2f(location, val.x, val.y);
+}
+
+template<>
+void GLShaderParamTemplate<Pixel32>::uniformSet(unsigned location, const Pixel32& val)
+{
+ glproc::Uniform4f(location, val.getR()/255.f, val.getG()/255.f, val.getB()/255.f,
+ val.getA()/255.f);
+}
+
+template<>
+void GLShaderParamTemplate<glm::vec4>::uniformSet(unsigned location, const glm::vec4& val)
+{
+ glproc::Uniform4f(location, val[0], val[1], val[2], val[3]);
+}
+
+template<>
+void GLShaderParamTemplate<glm::mat4>::uniformSet(unsigned location, const glm::mat4& val)
+{
+ glproc::UniformMatrix4fv(location, 1, GL_FALSE, glm::value_ptr(val));
+}
+
+}
diff --git a/src/graphics/GLShaderParam.h b/src/graphics/GLShaderParam.h
new file mode 100644
index 0000000..40cec61
--- /dev/null
+++ b/src/graphics/GLShaderParam.h
@@ -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
+//
+
+#ifndef _GLShaderParam_H_
+#define _GLShaderParam_H_
+
+#include "../api.h"
+#include "OGLHelper.h"
+#include "Pixel32.h"
+#include "GLContext.h"
+
+#include "../base/GLMHelper.h"
+#include "../base/Exception.h"
+
+#include <boost/shared_ptr.hpp>
+
+#include <string>
+
+namespace avg {
+
+class OGLShader;
+typedef boost::shared_ptr<OGLShader> OGLShaderPtr;
+
+class AVG_API GLShaderParam
+{
+public:
+ GLShaderParam(OGLShader* pShader, const std::string& sName);
+ virtual ~GLShaderParam() {};
+
+ const std::string& getName() const;
+
+protected:
+ int getLocation() const;
+
+private:
+ std::string m_sName;
+ int m_Location;
+};
+
+
+template<class VAL_TYPE>
+class AVG_TEMPLATE_API GLShaderParamTemplate: public GLShaderParam
+{
+public:
+ GLShaderParamTemplate(OGLShader* pShader, const std::string& sName)
+ : GLShaderParam(pShader, sName),
+ m_bValSet(false)
+ {};
+
+ void set(const VAL_TYPE& val)
+ {
+ if (!m_bValSet || m_Val != val) {
+ uniformSet(getLocation(), val);
+ GLContext::checkError("OGLShaderParam::set");
+ m_Val = val;
+ m_bValSet = true;
+ }
+ };
+
+private:
+ void uniformSet(unsigned location, const VAL_TYPE& val)
+ {
+ AVG_ASSERT_MSG(false,
+ getName()+"GLShaderParam::uniformSet() called for unsupported type.");
+ };
+
+ bool m_bValSet;
+ VAL_TYPE m_Val;
+};
+
+template<>
+void GLShaderParamTemplate<int>::uniformSet(unsigned location, const int& val);
+template<>
+void GLShaderParamTemplate<float>::uniformSet(unsigned location, const float& val);
+template<>
+void GLShaderParamTemplate<glm::vec2>::uniformSet(unsigned location,
+ const glm::vec2& val);
+template<>
+void GLShaderParamTemplate<Pixel32>::uniformSet(unsigned location, const Pixel32& val);
+template<>
+void GLShaderParamTemplate<glm::vec4>::uniformSet(unsigned location,
+ const glm::vec4& val);
+template<>
+void GLShaderParamTemplate<glm::mat4>::uniformSet(unsigned location,
+ const glm::mat4& val);
+
+typedef boost::shared_ptr<GLShaderParam> GLShaderParamPtr;
+
+typedef GLShaderParamTemplate<int> IntGLShaderParam;
+typedef boost::shared_ptr<IntGLShaderParam> IntGLShaderParamPtr;
+
+typedef GLShaderParamTemplate<float> FloatGLShaderParam;
+typedef boost::shared_ptr<FloatGLShaderParam> FloatGLShaderParamPtr;
+
+typedef GLShaderParamTemplate<glm::vec2> Vec2fGLShaderParam;
+typedef boost::shared_ptr<Vec2fGLShaderParam> Vec2fGLShaderParamPtr;
+
+typedef GLShaderParamTemplate<Pixel32> ColorGLShaderParam;
+typedef boost::shared_ptr<ColorGLShaderParam> ColorGLShaderParamPtr;
+
+typedef GLShaderParamTemplate<glm::vec4> Vec4fGLShaderParam;
+typedef boost::shared_ptr<Vec4fGLShaderParam> Vec4fGLShaderParamPtr;
+
+typedef GLShaderParamTemplate<glm::mat4> Mat4fGLShaderParam;
+typedef boost::shared_ptr<Mat4fGLShaderParam> Mat4fGLShaderParamPtr;
+
+}
+
+#endif
+
diff --git a/src/graphics/GLTexture.cpp b/src/graphics/GLTexture.cpp
index d1a998a..e19c0d4 100644
--- a/src/graphics/GLTexture.cpp
+++ b/src/graphics/GLTexture.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -28,6 +28,10 @@
#include "GLContext.h"
#include "TextureMover.h"
+#ifndef AVG_ENABLE_EGL
+ #include "PBO.h"
+#endif
+#include "FBO.h"
#include <string.h>
#include <iostream>
@@ -36,15 +40,27 @@ namespace avg {
using namespace std;
+// We assign our own texture ids and never reuse them instead of using glGenTextures.
+// That works very well, except that other components (e.g. Ogre3d) with shared gl
+// contexts don't know anything about our ids and thus use the same ones.
+// Somewhat hackish solution: Assign ids starting with a very high id, so the id ranges
+// don't overlap.
+unsigned GLTexture::s_LastTexID = 10000000;
+
GLTexture::GLTexture(const IntPoint& size, PixelFormat pf, bool bMipmap,
- unsigned wrapSMode, unsigned wrapTMode, bool bForcePOT)
+ int potBorderColor, unsigned wrapSMode, unsigned wrapTMode, bool bForcePOT)
: m_Size(size),
m_pf(pf),
m_bMipmap(bMipmap),
- m_bDeleteTex(true)
+ m_bDeleteTex(true),
+ m_bIsDirty(true)
{
+ m_pGLContext = GLContext::getCurrent();
ObjectCounter::get()->incRef(&typeid(*this));
- m_bUsePOT = GLContext::getCurrent()->usePOTTextures() || bForcePOT;
+ m_bUsePOT = m_pGLContext->usePOTTextures() || bForcePOT;
+ if (m_pGLContext->isGLES() && bMipmap) {
+ m_bUsePOT = true;
+ }
if (m_bUsePOT) {
m_GLSize.x = nextpow2(m_Size.x);
m_GLSize.y = nextpow2(m_Size.y);
@@ -52,7 +68,7 @@ GLTexture::GLTexture(const IntPoint& size, PixelFormat pf, bool bMipmap,
m_GLSize = m_Size;
}
- int maxTexSize = GLContext::getCurrent()->getMaxTexSize();
+ int maxTexSize = m_pGLContext->getMaxTexSize();
if (m_Size.x > maxTexSize || m_Size.y > maxTexSize) {
throw Exception(AVG_ERR_VIDEO_GENERAL, "Texture too large (" + toString(m_Size)
+ "). Maximum supported by graphics card is "
@@ -63,34 +79,38 @@ GLTexture::GLTexture(const IntPoint& size, PixelFormat pf, bool bMipmap,
"Float textures not supported by OpenGL configuration.");
}
- glGenTextures(1, &m_TexID);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "GLTexture: glGenTextures()");
- glBindTexture(GL_TEXTURE_2D, m_TexID);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "GLTexture: glBindTexture()");
- if (bMipmap) {
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
- } else {
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- }
+ s_LastTexID++;
+ m_TexID = s_LastTexID;
+ m_pGLContext->bindTexture(GL_TEXTURE0, m_TexID);
+
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, wrapSMode);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, wrapTMode);
glTexImage2D(GL_TEXTURE_2D, 0, getGLInternalFormat(), m_GLSize.x, m_GLSize.y, 0,
getGLFormat(m_pf), getGLType(m_pf), 0);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "GLTexture: glTexImage2D()");
+ GLContext::checkError("GLTexture: glTexImage2D()");
+ if (bMipmap) {
+ glproc::GenerateMipmap(GL_TEXTURE_2D);
+ GLContext::checkError("GLTexture::GLTexture generateMipmap()");
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
+ } else {
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ }
if (m_bUsePOT) {
// Make sure the texture is transparent and black before loading stuff
// into it to avoid garbage at the borders.
+ // In the case of UV textures, we set the border color to 128...
int TexMemNeeded = m_GLSize.x*m_GLSize.y*getBytesPerPixel(m_pf);
char * pPixels = new char[TexMemNeeded];
- memset(pPixels, 0, TexMemNeeded);
+ memset(pPixels, potBorderColor, TexMemNeeded);
glTexImage2D(GL_TEXTURE_2D, 0, getGLInternalFormat(), m_GLSize.x,
m_GLSize.y, 0, getGLFormat(m_pf), getGLType(m_pf),
pPixels);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "PBOTexture::createTexture: glTexImage2D()");
+ GLContext::checkError("PBOTexture::createTexture: glTexImage2D()");
delete[] pPixels;
}
+// dump(wrapSMode, wrapTMode);
}
GLTexture::GLTexture(unsigned glTexID, const IntPoint& size, PixelFormat pf, bool bMipmap,
@@ -101,27 +121,25 @@ GLTexture::GLTexture(unsigned glTexID, const IntPoint& size, PixelFormat pf, boo
m_bMipmap(bMipmap),
m_bDeleteTex(bDeleteTex),
m_bUsePOT(false),
- m_TexID(glTexID)
+ m_TexID(glTexID),
+ m_bIsDirty(true)
{
+ m_pGLContext = GLContext::getCurrent();
ObjectCounter::get()->incRef(&typeid(*this));
}
GLTexture::~GLTexture()
{
if (m_bDeleteTex) {
- glBindTexture(GL_TEXTURE_2D, 0);
glDeleteTextures(1, &m_TexID);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "GLTexture: DeleteTextures()");
+ GLContext::checkError("GLTexture: DeleteTextures()");
}
ObjectCounter::get()->decRef(&typeid(*this));
}
void GLTexture::activate(int textureUnit)
{
- glproc::ActiveTexture(textureUnit);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "GLTexture::activate ActiveTexture()");
- glBindTexture(GL_TEXTURE_2D, m_TexID);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "GLTexture::activate BindTexture()");
+ m_pGLContext->bindTexture(textureUnit, m_TexID);
}
void GLTexture::generateMipmaps()
@@ -129,7 +147,7 @@ void GLTexture::generateMipmaps()
if (m_bMipmap) {
activate();
glproc::GenerateMipmap(GL_TEXTURE_2D);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "GLTexture::generateMipmaps()");
+ GLContext::checkError("GLTexture::generateMipmap()");
}
}
@@ -157,6 +175,7 @@ void GLTexture::unlockStreamingBmp(bool bUpdated)
m_pMover->unlock();
if (bUpdated) {
m_pMover->moveToTexture(*this);
+ m_bIsDirty = true;
}
}
@@ -164,12 +183,13 @@ void GLTexture::moveBmpToTexture(BitmapPtr pBmp)
{
TextureMoverPtr pMover = TextureMover::create(m_Size, m_pf, GL_DYNAMIC_DRAW);
pMover->moveBmpToTexture(pBmp, *this);
+ m_bIsDirty = true;
}
-BitmapPtr GLTexture::moveTextureToBmp()
+BitmapPtr GLTexture::moveTextureToBmp(int mipmapLevel)
{
TextureMoverPtr pMover = TextureMover::create(m_GLSize, m_pf, GL_DYNAMIC_READ);
- return pMover->moveTextureToBmp(*this);
+ return pMover->moveTextureToBmp(*this, mipmapLevel);
}
const IntPoint& GLTexture::getSize() const
@@ -194,7 +214,6 @@ unsigned GLTexture::getID() const
IntPoint GLTexture::getMipmapSize(int level) const
{
- AVG_ASSERT(!m_bUsePOT);
IntPoint size = m_Size;
for (int i=0; i<level; ++i) {
size.x = max(1, size.x >> 1);
@@ -221,8 +240,13 @@ int GLTexture::getGLFormat(PixelFormat pf)
return GL_RGBA;
case B8G8R8A8:
case B8G8R8X8:
+ AVG_ASSERT(!GLContext::getMain()->isGLES());
+ return GL_BGRA;
+#ifndef AVG_ENABLE_EGL
case R32G32B32A32F:
return GL_BGRA;
+#endif
+ case R8G8B8:
case B5G6R5:
return GL_RGB;
default:
@@ -249,6 +273,8 @@ int GLTexture::getGLType(PixelFormat pf)
case R32G32B32A32F:
case I32F:
return GL_FLOAT;
+ case R8G8B8:
+ return GL_UNSIGNED_BYTE;
case B5G6R5:
return GL_UNSIGNED_SHORT_5_6_5;
default:
@@ -262,17 +288,22 @@ int GLTexture::getGLInternalFormat() const
switch (m_pf) {
case I8:
return GL_LUMINANCE;
- case I32F:
- return GL_LUMINANCE32F_ARB;
case A8:
return GL_ALPHA;
case R8G8B8A8:
case R8G8B8X8:
+ return GL_RGBA;
case B8G8R8A8:
case B8G8R8X8:
+ AVG_ASSERT(!GLContext::getMain()->isGLES());
return GL_RGBA;
+#ifndef AVG_ENABLE_EGL
case R32G32B32A32F:
return GL_RGBA32F_ARB;
+ case I32F:
+ return GL_LUMINANCE32F_ARB;
+#endif
+ case R8G8B8:
case B5G6R5:
return GL_RGB;
default:
@@ -296,5 +327,44 @@ void GLTexture::resetDirty()
m_bIsDirty = false;
}
+const string wrapModeToStr(unsigned wrapMode)
+{
+ string sWrapMode;
+ switch (wrapMode) {
+ case GL_CLAMP_TO_EDGE:
+ sWrapMode = "CLAMP_TO_EDGE";
+ break;
+#ifndef AVG_ENABLE_EGL
+ case GL_CLAMP:
+ sWrapMode = "CLAMP";
+ break;
+ case GL_CLAMP_TO_BORDER:
+ sWrapMode = "CLAMP_TO_BORDER";
+ break;
+#endif
+ case GL_REPEAT:
+ sWrapMode = "REPEAT";
+ break;
+ case GL_MIRRORED_REPEAT:
+ sWrapMode = "MIRRORED_REPEAT";
+ break;
+ default:
+ sWrapMode = "unknown";
+ }
+ return sWrapMode;
+}
+
+void GLTexture::dump(unsigned wrapSMode, unsigned wrapTMode) const
+{
+ cerr << "GLTexture" << endl;
+ cerr << "m_Size: " << m_Size << endl;
+ cerr << "m_GLSize: " << m_GLSize << endl;
+ cerr << "m_pf: " << m_pf << endl;
+ cerr << "m_bMipmap: " << m_bMipmap << endl;
+ if (wrapSMode != (unsigned)-1) {
+ cerr << "Wrap modes: " << \
+ wrapModeToStr(wrapSMode) << ", " << wrapModeToStr(wrapTMode) << endl;
+ }
+}
}
diff --git a/src/graphics/GLTexture.h b/src/graphics/GLTexture.h
index 084de7f..9f6877f 100644
--- a/src/graphics/GLTexture.h
+++ b/src/graphics/GLTexture.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -26,21 +26,20 @@
#include "Bitmap.h"
#include "OGLHelper.h"
-#include "../base/Point.h"
-
#include <boost/shared_ptr.hpp>
namespace avg {
class TextureMover;
typedef boost::shared_ptr<TextureMover> TextureMoverPtr;
+class GLContext;
class AVG_API GLTexture {
public:
GLTexture(const IntPoint& size, PixelFormat pf, bool bMipmap=false,
- unsigned wrapSMode=GL_CLAMP_TO_EDGE, unsigned wrapTMode=GL_CLAMP_TO_EDGE,
- bool bForcePOT=false);
+ int potBorderColor=0, unsigned wrapSMode=GL_CLAMP_TO_EDGE,
+ unsigned wrapTMode=GL_CLAMP_TO_EDGE, bool bForcePOT=false);
GLTexture(unsigned glTexID, const IntPoint& size, PixelFormat pf, bool bMipmap=false,
bool bDeleteTex=false);
virtual ~GLTexture();
@@ -53,7 +52,7 @@ public:
BitmapPtr lockStreamingBmp();
void unlockStreamingBmp(bool bUpdated);
void moveBmpToTexture(BitmapPtr pBmp);
- BitmapPtr moveTextureToBmp();
+ BitmapPtr moveTextureToBmp(int mipmapLevel=0);
const IntPoint& getSize() const;
const IntPoint& getGLSize() const;
@@ -71,6 +70,8 @@ public:
bool isDirty() const;
void resetDirty();
+ void dump(unsigned wrapSMode=-1, unsigned wrapTMode=-1) const;
+
private:
IntPoint m_Size;
IntPoint m_GLSize;
@@ -79,9 +80,12 @@ private:
bool m_bDeleteTex;
bool m_bUsePOT;
+ static unsigned s_LastTexID;
unsigned m_TexID;
bool m_bIsDirty;
TextureMoverPtr m_pMover;
+
+ GLContext* m_pGLContext;
};
typedef boost::shared_ptr<GLTexture> GLTexturePtr;
diff --git a/src/graphics/GLXContext.cpp b/src/graphics/GLXContext.cpp
new file mode 100644
index 0000000..ff5477a
--- /dev/null
+++ b/src/graphics/GLXContext.cpp
@@ -0,0 +1,265 @@
+//
+// 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 "GLXContext.h"
+#include "GLContextAttribs.h"
+#include "X11Display.h"
+
+#include "../base/Exception.h"
+#include "../base/Logger.h"
+
+#include <SDL/SDL.h>
+#include <SDL/SDL_syswm.h>
+
+#include <X11/extensions/xf86vmode.h>
+
+#include <iostream>
+#include <stdlib.h>
+#include <limits>
+
+
+namespace avg {
+
+using namespace std;
+using namespace boost;
+
+GLXContext::GLXContext(const GLConfig& glConfig, const IntPoint& windowSize,
+ const SDL_SysWMinfo* pSDLWMInfo)
+ : GLContext(windowSize, pSDLWMInfo)
+{
+ GLConfig config = glConfig;
+ try {
+ createGLXContext(config, windowSize, pSDLWMInfo, true);
+ } catch (const Exception &e) {
+ if (e.getCode() == AVG_ERR_DEBUG_CONTEXT_FAILED) {
+ createGLXContext(config, windowSize, pSDLWMInfo, false);
+ } else {
+ exit(EXIT_FAILURE);
+ }
+ }
+ init(config, true);
+}
+
+static bool s_bX11Error;
+static bool s_bDumpX11ErrorMsg;
+static int (*s_DefaultErrorHandler) (::Display *, XErrorEvent *);
+
+int X11ErrorHandler(::Display * pDisplay, XErrorEvent * pErrEvent)
+{
+ if (s_bDumpX11ErrorMsg) {
+ char errorString[128];
+ XGetErrorText(pDisplay, pErrEvent->error_code, errorString, 128);
+ cerr << "X11 error creating GL context: " << errorString <<
+ "\n\tMajor opcode of failed request: " << (int)(pErrEvent->request_code) <<
+ "\n\tMinor opcode of failed request: " << (int)(pErrEvent->minor_code) <<
+ "\n";
+ }
+ s_bX11Error = true;
+ return 0;
+}
+
+void GLXContext::createGLXContext(GLConfig& glConfig, const IntPoint& windowSize,
+ const SDL_SysWMinfo* pSDLWMInfo, bool bUseDebugBit)
+{
+ Window win = 0;
+ s_bX11Error = false;
+ s_bDumpX11ErrorMsg = true;
+ s_DefaultErrorHandler = XSetErrorHandler(X11ErrorHandler);
+
+ m_pDisplay = getX11Display(pSDLWMInfo);
+
+ GLContextAttribs attrs;
+ attrs.append(GLX_X_RENDERABLE, 1);
+ attrs.append(GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT);
+ attrs.append(GLX_RENDER_TYPE, GLX_RGBA_BIT);
+ attrs.append(GLX_X_VISUAL_TYPE, GLX_TRUE_COLOR);
+ attrs.append(GLX_DEPTH_SIZE, 0);
+ attrs.append(GLX_STENCIL_SIZE, 8);
+ attrs.append(GLX_DOUBLEBUFFER, 1);
+ attrs.append(GLX_RED_SIZE, 8);
+ attrs.append(GLX_GREEN_SIZE, 8);
+ attrs.append(GLX_BLUE_SIZE, 8);
+ attrs.append(GLX_ALPHA_SIZE, 0);
+
+ int fbCount;
+ GLXFBConfig* pFBConfig = glXChooseFBConfig(m_pDisplay, DefaultScreen(m_pDisplay),
+ attrs.get(), &fbCount);
+ if (!pFBConfig) {
+ throw Exception(AVG_ERR_UNSUPPORTED, "Creating OpenGL context failed.");
+ }
+
+ // Find the config with the appropriate number of multisample samples.
+ int bestConfig = -1;
+ int bestSamples = -1;
+ int bestCaveat = std::numeric_limits<int>::max();
+ for (int i=0; i<fbCount; ++i) {
+ XVisualInfo* pVisualInfo = glXGetVisualFromFBConfig(m_pDisplay, pFBConfig[i]);
+ if (pVisualInfo && pVisualInfo->depth == 24) {
+ int numBuffers;
+ int numSamples;
+ int caveat;
+ glXGetFBConfigAttrib(m_pDisplay, pFBConfig[i], GLX_SAMPLE_BUFFERS,
+ &numBuffers);
+ glXGetFBConfigAttrib(m_pDisplay, pFBConfig[i], GLX_SAMPLES, &numSamples);
+ glXGetFBConfigAttrib(m_pDisplay, pFBConfig[i], GLX_CONFIG_CAVEAT, &caveat);
+ if (numSamples == 0) {
+ // Configs without multisampling have numBuffers == 0 and numSamples == 0,
+ // but the corresponding libavg config is multisamplesamples == 1.
+ numSamples = 1;
+ }
+ if ((numSamples > bestSamples && numSamples <= glConfig.m_MultiSampleSamples)
+ || (numSamples == bestSamples && caveat < bestCaveat))
+ {
+ // A config is better than the last one in two cases:
+ // 1) it has more samples per pixel (but not more than requested) or
+ // 2) it has the same number of samples per pixel but a better caveat
+ // value.
+ bestCaveat = caveat;
+ bestConfig = i;
+ bestSamples = numSamples;
+ }
+ XFree(pVisualInfo);
+ }
+ }
+
+ GLXFBConfig fbConfig = pFBConfig[bestConfig];
+ XFree(pFBConfig);
+ XVisualInfo* pVisualInfo = glXGetVisualFromFBConfig(m_pDisplay, fbConfig);
+
+ if (pSDLWMInfo) {
+ win = createChildWindow(pSDLWMInfo, pVisualInfo, windowSize, m_Colormap);
+ }
+
+ if (haveARBCreateContext()) {
+ GLContextAttribs attrs;
+ if (glConfig.m_bGLES) {
+ attrs.append(GLX_CONTEXT_PROFILE_MASK_ARB, GLX_CONTEXT_ES2_PROFILE_BIT_EXT);
+ attrs.append(GLX_CONTEXT_MAJOR_VERSION_ARB, 2);
+ attrs.append(GLX_CONTEXT_MINOR_VERSION_ARB, 0);
+ }
+ if (glConfig.m_bUseDebugContext && bUseDebugBit) {
+ attrs.append(GLX_CONTEXT_FLAGS_ARB, GLX_CONTEXT_DEBUG_BIT_ARB);
+ }
+ PFNGLXCREATECONTEXTATTRIBSARBPROC CreateContextAttribsARB =
+ (PFNGLXCREATECONTEXTATTRIBSARBPROC)
+ getglXProcAddress("glXCreateContextAttribsARB");
+
+ s_bDumpX11ErrorMsg = false;
+ m_Context = CreateContextAttribsARB(m_pDisplay, fbConfig, 0, 1, attrs.get());
+ s_bDumpX11ErrorMsg = true;
+ throwOnXError(AVG_ERR_DEBUG_CONTEXT_FAILED);
+ } else {
+ m_Context = glXCreateContext(m_pDisplay, pVisualInfo, 0, GL_TRUE);
+ }
+ AVG_ASSERT(m_Context);
+ if (pSDLWMInfo) {
+ setCurrent();
+ glXMakeCurrent(m_pDisplay, win, m_Context);
+ } else {
+ Pixmap pmp = XCreatePixmap(m_pDisplay,
+ RootWindow(m_pDisplay, pVisualInfo->screen), 8, 8, pVisualInfo->depth);
+ GLXPixmap pixmap = glXCreateGLXPixmap(m_pDisplay, pVisualInfo, pmp);
+
+ glXMakeCurrent(m_pDisplay, pixmap, m_Context);
+ }
+ XSetErrorHandler(s_DefaultErrorHandler);
+
+ throwOnXError();
+ glConfig.m_MultiSampleSamples = bestSamples;
+ m_Drawable = glXGetCurrentDrawable();
+}
+
+GLXContext::~GLXContext()
+{
+ deleteObjects();
+ if (m_Context && ownsContext()) {
+ glXMakeCurrent(m_pDisplay, 0, 0);
+ glXDestroyContext(m_pDisplay, m_Context);
+ m_Context = 0;
+ XDestroyWindow(m_pDisplay, m_Drawable);
+ XFreeColormap(m_pDisplay, m_Colormap);
+ }
+}
+
+void GLXContext::throwOnXError( int code)
+{
+ if (s_bX11Error) {
+ throw Exception(code, "X error creating OpenGL context.");
+ }
+}
+
+void GLXContext::activate()
+{
+ glXMakeCurrent(m_pDisplay, m_Drawable, m_Context);
+ setCurrent();
+}
+
+bool GLXContext::initVBlank(int rate)
+{
+ static bool s_bVBlankActive = false;
+ if (rate > 0) {
+ if (getenv("__GL_SYNC_TO_VBLANK") != 0) {
+ AVG_LOG_WARNING("__GL_SYNC_TO_VBLANK set. This interferes with libavg vblank handling.");
+ s_bVBlankActive = false;
+ return false;
+ }
+ if (!queryGLXExtension("GLX_EXT_swap_control")) {
+ AVG_LOG_WARNING("Linux VBlank setup failed: OpenGL Extension not supported.");
+ s_bVBlankActive = false;
+ return false;
+ }
+
+ glproc::SwapIntervalEXT(m_pDisplay, m_Drawable, rate);
+ s_bVBlankActive = true;
+ return true;
+
+ } else {
+ if (s_bVBlankActive) {
+ glproc::SwapIntervalEXT(m_pDisplay, m_Drawable, 0);
+ s_bVBlankActive = false;
+ }
+ return false;
+ }
+}
+
+bool GLXContext::useDepthBuffer() const
+{
+ // NVidia GLX GLES doesn't allow framebuffer stencil without depth.
+ return true;
+}
+
+void GLXContext::swapBuffers()
+{
+ glXSwapBuffers(m_pDisplay, m_Drawable);
+}
+
+bool GLXContext::haveARBCreateContext()
+{
+ static bool s_bExtensionChecked = false;
+ static bool s_bHaveExtension = false;
+ if (!s_bExtensionChecked) {
+ s_bExtensionChecked = true;
+ s_bHaveExtension = (queryGLXExtension("GLX_ARB_create_context"));
+ }
+ return s_bHaveExtension;
+}
+
+}
diff --git a/src/graphics/GLXContext.h b/src/graphics/GLXContext.h
new file mode 100644
index 0000000..e4f1d95
--- /dev/null
+++ b/src/graphics/GLXContext.h
@@ -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
+//
+#ifndef _GLXContext_H_
+#define _GLXContext_H_
+#include "../api.h"
+
+#include "GLContext.h"
+
+#include "../base/Exception.h"
+
+#include <boost/shared_ptr.hpp>
+
+struct SDL_SysWMinfo;
+
+namespace avg {
+
+class AVG_API GLXContext: public GLContext
+{
+public:
+ GLXContext(const GLConfig& glConfig, const IntPoint& windowSize=IntPoint(0,0),
+ const SDL_SysWMinfo* pSDLWMInfo=0);
+ virtual ~GLXContext();
+
+ void activate();
+ bool initVBlank(int rate);
+ bool useDepthBuffer() const;
+ void swapBuffers();
+
+ static bool haveARBCreateContext();
+
+private:
+ void createGLXContext(GLConfig& glConfig, const IntPoint& windowSize,
+ const SDL_SysWMinfo* pSDLWMInfo, bool bUseDebugBit);
+
+ void throwOnXError(int code=AVG_ERR_VIDEO_GENERAL);
+
+ Display* m_pDisplay;
+ Colormap m_Colormap;
+ GLXDrawable m_Drawable;
+ ::GLXContext m_Context;
+
+};
+
+}
+#endif
+
+
diff --git a/src/graphics/GPUBandpassFilter.cpp b/src/graphics/GPUBandpassFilter.cpp
index 28c7884..23171ec 100644
--- a/src/graphics/GPUBandpassFilter.cpp
+++ b/src/graphics/GPUBandpassFilter.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -22,29 +22,37 @@
#include "GPUBandpassFilter.h"
#include "Bitmap.h"
#include "ShaderRegistry.h"
+#include "OGLShader.h"
#include "../base/ObjectCounter.h"
#include "../base/Exception.h"
#include <iostream>
-#define SHADERID "BANDPASS"
+#define SHADERID "bandpass"
using namespace std;
namespace avg {
GPUBandpassFilter::GPUBandpassFilter(const IntPoint& size, PixelFormat pfSrc,
- double min, double max, double postScale, bool bInvert, bool bStandalone)
- : GPUFilter(pfSrc, B8G8R8A8, bStandalone),
+ float min, float max, float postScale, bool bInvert, bool bStandalone)
+ : GPUFilter(pfSrc, B8G8R8A8, bStandalone, SHADERID),
m_PostScale(postScale),
m_bInvert(bInvert),
- m_MinFilter(size, pfSrc, R32G32B32A32F, min, true, false),
- m_MaxFilter(size, pfSrc, R32G32B32A32F, max, true, false)
+ m_MinFilter(size, pfSrc, R32G32B32A32F, min, true, false, true),
+ m_MaxFilter(size, pfSrc, R32G32B32A32F, max, true, false, true)
{
ObjectCounter::get()->incRef(&typeid(*this));
+
+ GLContext::getCurrent()->ensureFullShaders("GPUBandpassFilter");
+
setDimensions(size);
- initShader();
+ OGLShaderPtr pShader = getShader();
+ m_pMinTexParam = pShader->getParam<int>("u_MinTex");
+ m_pMaxTexParam = pShader->getParam<int>("u_MaxTex");
+ m_pPostScaleParam = pShader->getParam<float>("u_PostScale");
+ m_pInvertParam = pShader->getParam<int>("u_bInvert");
}
GPUBandpassFilter::~GPUBandpassFilter()
@@ -58,39 +66,13 @@ void GPUBandpassFilter::applyOnGPU(GLTexturePtr pSrcTex)
m_MaxFilter.apply(pSrcTex);
getFBO()->activate();
- OGLShaderPtr pShader = getShader(SHADERID);
- pShader->activate();
- pShader->setUniformIntParam("minTex", 0);
- pShader->setUniformIntParam("maxTex", 1);
- pShader->setUniformFloatParam("postScale", float(m_PostScale));
- pShader->setUniformIntParam("bInvert", m_bInvert);
+ getShader()->activate();
+ m_pMinTexParam->set(0);
+ m_pMaxTexParam->set(1);
+ m_pPostScaleParam->set(float(m_PostScale));
+ m_pInvertParam->set(m_bInvert);
m_MaxFilter.getDestTex()->activate(GL_TEXTURE1);
draw(m_MinFilter.getDestTex());
-
- glproc::UseProgramObject(0);
}
-void GPUBandpassFilter::initShader()
-{
- string sProgram =
- "uniform sampler2D minTex;\n"
- "uniform sampler2D maxTex;\n"
- "uniform float postScale;\n"
- "uniform bool bInvert;\n"
-
- "void main(void)\n"
- "{\n"
- " vec4 min = texture2D(minTex, gl_TexCoord[0].st);\n"
- " vec4 max = texture2D(maxTex, gl_TexCoord[0].st);\n"
- " gl_FragColor = vec4(0.502, 0.502, 0.502, 0)+(max-min)*postScale;\n"
- " if (bInvert) {\n"
- " gl_FragColor = vec4(1.004,1.004,1.004,1)-gl_FragColor;\n"
- " }\n"
- " gl_FragColor.a = 1.0;\n"
- "}\n"
- ;
-
- getOrCreateShader(SHADERID, sProgram);
}
-
-} // namespace
diff --git a/src/graphics/GPUBandpassFilter.h b/src/graphics/GPUBandpassFilter.h
index ee3d10e..54f15a2 100644
--- a/src/graphics/GPUBandpassFilter.h
+++ b/src/graphics/GPUBandpassFilter.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -32,22 +32,25 @@ namespace avg {
class AVG_API GPUBandpassFilter: public GPUFilter
{
public:
- GPUBandpassFilter(const IntPoint& size, PixelFormat pfSrc, double min, double max,
- double postScale, bool bInvert, bool bStandalone=true);
+ GPUBandpassFilter(const IntPoint& size, PixelFormat pfSrc, float min, float max,
+ float postScale, bool bInvert, bool bStandalone=true);
virtual ~GPUBandpassFilter();
virtual void applyOnGPU(GLTexturePtr pSrcTex);
private:
- static void initShader();
-
- double m_PostScale;
+ float m_PostScale;
bool m_bInvert;
GPUBlurFilter m_MinFilter;
GPUBlurFilter m_MaxFilter;
+
+ IntGLShaderParamPtr m_pMinTexParam;
+ IntGLShaderParamPtr m_pMaxTexParam;
+ FloatGLShaderParamPtr m_pPostScaleParam;
+ IntGLShaderParamPtr m_pInvertParam;
};
-} // namespace
+}
#endif
diff --git a/src/graphics/GPUBlurFilter.cpp b/src/graphics/GPUBlurFilter.cpp
index 62c49b1..1a6efa1 100644
--- a/src/graphics/GPUBlurFilter.cpp
+++ b/src/graphics/GPUBlurFilter.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -23,6 +23,7 @@
#include "Bitmap.h"
#include "ShaderRegistry.h"
#include "ImagingProjection.h"
+#include "OGLShader.h"
#include "../base/ObjectCounter.h"
#include "../base/MathHelper.h"
@@ -31,23 +32,38 @@
#include <string.h>
#include <iostream>
-#define SHADERID_HORIZ "HORIZBLUR"
-#define SHADERID_VERT "VERTBLUR"
+#define SHADERID_HORIZ "horizblur"
+#define SHADERID_VERT "vertblur"
using namespace std;
namespace avg {
GPUBlurFilter::GPUBlurFilter(const IntPoint& size, PixelFormat pfSrc, PixelFormat pfDest,
- double stdDev, bool bClipBorders, bool bStandalone)
- : GPUFilter(pfSrc, pfDest, bStandalone, 2)
+ float stdDev, bool bClipBorders, bool bStandalone, bool bUseFloatKernel)
+ : GPUFilter(pfSrc, pfDest, bStandalone, SHADERID_HORIZ, 2),
+ m_bClipBorders(bClipBorders),
+ m_bUseFloatKernel(bUseFloatKernel)
{
ObjectCounter::get()->incRef(&typeid(*this));
+ GLContext::getCurrent()->ensureFullShaders("GPUBlurFilter");
+
setDimensions(size, stdDev, bClipBorders);
- initShaders();
- m_bClipBorders = bClipBorders;
+ createShader(SHADERID_VERT);
setStdDev(stdDev);
+
+ OGLShaderPtr pShader = getShader();
+ m_pHorizWidthParam = pShader->getParam<float>("u_Width");
+ m_pHorizRadiusParam = pShader->getParam<int>("u_Radius");
+ m_pHorizTextureParam = pShader->getParam<int>("u_Texture");
+ m_pHorizKernelTexParam = pShader->getParam<int>("u_KernelTex");
+
+ pShader = avg::getShader(SHADERID_VERT);
+ m_pVertWidthParam = pShader->getParam<float>("u_Width");
+ m_pVertRadiusParam = pShader->getParam<int>("u_Radius");
+ m_pVertTextureParam = pShader->getParam<int>("u_Texture");
+ m_pVertKernelTexParam = pShader->getParam<int>("u_KernelTex");
}
GPUBlurFilter::~GPUBlurFilter()
@@ -55,10 +71,10 @@ GPUBlurFilter::~GPUBlurFilter()
ObjectCounter::get()->decRef(&typeid(*this));
}
-void GPUBlurFilter::setStdDev(double stdDev)
+void GPUBlurFilter::setStdDev(float stdDev)
{
m_StdDev = stdDev;
- m_pGaussCurveTex = calcBlurKernelTex(m_StdDev);
+ m_pGaussCurveTex = calcBlurKernelTex(m_StdDev, 1, m_bUseFloatKernel);
setDimensions(getSrcSize(), stdDev, m_bClipBorders);
IntRect destRect2(IntPoint(0,0), getDestRect().size());
m_pProjection2 = ImagingProjectionPtr(new ImagingProjection(
@@ -68,81 +84,39 @@ void GPUBlurFilter::setStdDev(double stdDev)
void GPUBlurFilter::applyOnGPU(GLTexturePtr pSrcTex)
{
int kernelWidth = m_pGaussCurveTex->getSize().x;
- glDrawBuffer(GL_COLOR_ATTACHMENT1_EXT);
- OGLShaderPtr pHShader = getShader(SHADERID_HORIZ);
- pHShader->activate();
- pHShader->setUniformFloatParam("width", float(kernelWidth));
- pHShader->setUniformIntParam("radius", (kernelWidth-1)/2);
- pHShader->setUniformIntParam("texture", 0);
- pHShader->setUniformIntParam("kernelTex", 1);
+ getFBO(1)->activate();
+ getShader()->activate();
+ m_pHorizWidthParam->set(float(kernelWidth));
+ m_pHorizRadiusParam->set((kernelWidth-1)/2);
+ m_pHorizTextureParam->set(0);
+ m_pHorizKernelTexParam->set(1);
m_pGaussCurveTex->activate(GL_TEXTURE1);
draw(pSrcTex);
- m_pProjection2->activate();
- glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT);
- OGLShaderPtr pVShader = getShader(SHADERID_VERT);
+ getFBO(0)->activate();
+ OGLShaderPtr pVShader = avg::getShader(SHADERID_VERT);
pVShader->activate();
- pVShader->setUniformFloatParam("width", float(kernelWidth));
- pVShader->setUniformIntParam("radius", (kernelWidth-1)/2);
- pVShader->setUniformIntParam("texture", 0);
- pVShader->setUniformIntParam("kernelTex", 1);
+ m_pVertWidthParam->set(float(kernelWidth));
+ m_pVertRadiusParam->set((kernelWidth-1)/2);
+ m_pVertTextureParam->set(0);
+ m_pVertKernelTexParam->set(1);
getDestTex(1)->activate(GL_TEXTURE0);
- m_pProjection2->draw();
- glproc::UseProgramObject(0);
-}
-
-void GPUBlurFilter::initShaders()
-{
- string sProgramHead =
- "uniform sampler2D texture;\n"
- "uniform float width;\n"
- "uniform int radius;\n"
- "uniform sampler2D kernelTex;\n"
- ;
-
- string sHorizProgram = sProgramHead +
- "void main(void)\n"
- "{\n"
- " vec4 sum = vec4(0,0,0,0);\n"
- " float dx = dFdx(gl_TexCoord[0].x);\n"
- " for (int i=-radius; i<=radius; ++i) {\n"
- " vec4 tex = texture2D(texture, gl_TexCoord[0].st+vec2(float(i)*dx,0));\n"
- " float coeff = \n"
- " texture2D(kernelTex, vec2((float(i+radius)+0.5)/width,0)).r;\n"
- " sum += tex*coeff;\n"
- " }\n"
- " gl_FragColor = sum;\n"
- "}\n"
- ;
- getOrCreateShader(SHADERID_HORIZ, sHorizProgram);
-
- string sVertProgram = sProgramHead +
- "void main(void)\n"
- "{\n"
- " vec4 sum = vec4(0,0,0,0);\n"
- " float dy = dFdy(gl_TexCoord[0].y);\n"
- " for (int i=-radius; i<=radius; ++i) {\n"
- " vec4 tex = texture2D(texture, gl_TexCoord[0].st+vec2(0,float(i)*dy));\n"
- " float coeff = \n"
- " texture2D(kernelTex, vec2((float(i+radius)+0.5)/width,0)).r;\n"
- " sum += tex*coeff;\n"
- " }\n"
- " gl_FragColor = sum;\n"
- "}\n"
- ;
- getOrCreateShader(SHADERID_VERT, sVertProgram);
+ m_pProjection2->draw(pVShader);
}
-void GPUBlurFilter::setDimensions(IntPoint size, double stdDev, bool bClipBorders)
+void GPUBlurFilter::setDimensions(IntPoint size, float stdDev, bool bClipBorders)
{
+#ifndef AVG_ENABLE_EGL
if (bClipBorders) {
GPUFilter::setDimensions(size);
} else {
int radius = getBlurKernelRadius(stdDev);
IntPoint offset(radius, radius);
+ //TODO: TO_BORDER DOES NOT EXIST IN GLESV2
GPUFilter::setDimensions(size, IntRect(-offset, size+offset), GL_CLAMP_TO_BORDER);
}
+#endif
}
}
diff --git a/src/graphics/GPUBlurFilter.h b/src/graphics/GPUBlurFilter.h
index 090dada..77b8ae7 100644
--- a/src/graphics/GPUBlurFilter.h
+++ b/src/graphics/GPUBlurFilter.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -24,6 +24,7 @@
#include "../api.h"
#include "GPUFilter.h"
+#include "GLShaderParam.h"
#include "GLTexture.h"
namespace avg {
@@ -32,21 +33,32 @@ class AVG_API GPUBlurFilter: public GPUFilter
{
public:
GPUBlurFilter(const IntPoint& size, PixelFormat pfSrc, PixelFormat pfDest,
- double stdDev, bool bClipBorders, bool bStandalone=true);
+ float stdDev, bool bClipBorders, bool bStandalone=true,
+ bool bUseFloatKernel=false);
virtual ~GPUBlurFilter();
- void setStdDev(double stdDev);
+ void setStdDev(float stdDev);
virtual void applyOnGPU(GLTexturePtr pSrcTex);
private:
- void initShaders();
- void setDimensions(IntPoint size, double stdDev, bool bClipBorders);
+ void setDimensions(IntPoint size, float stdDev, bool bClipBorders);
- double m_StdDev;
+ float m_StdDev;
bool m_bClipBorders;
+ bool m_bUseFloatKernel;
GLTexturePtr m_pGaussCurveTex;
ImagingProjectionPtr m_pProjection2;
+
+ FloatGLShaderParamPtr m_pHorizWidthParam;
+ IntGLShaderParamPtr m_pHorizRadiusParam;
+ IntGLShaderParamPtr m_pHorizTextureParam;
+ IntGLShaderParamPtr m_pHorizKernelTexParam;
+
+ FloatGLShaderParamPtr m_pVertWidthParam;
+ IntGLShaderParamPtr m_pVertRadiusParam;
+ IntGLShaderParamPtr m_pVertTextureParam;
+ IntGLShaderParamPtr m_pVertKernelTexParam;
};
typedef boost::shared_ptr<GPUBlurFilter> GPUBlurFilterPtr;
diff --git a/src/graphics/GPUBrightnessFilter.cpp b/src/graphics/GPUBrightnessFilter.cpp
index 235bc25..a508cc1 100644
--- a/src/graphics/GPUBrightnessFilter.cpp
+++ b/src/graphics/GPUBrightnessFilter.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -22,26 +22,30 @@
#include "GPUBrightnessFilter.h"
#include "Bitmap.h"
#include "ShaderRegistry.h"
+#include "OGLShader.h"
#include "../base/ObjectCounter.h"
#include "../base/Exception.h"
#include <iostream>
-#define SHADERID "BRIGHTNESS"
+#define SHADERID "brightness"
using namespace std;
namespace avg {
-GPUBrightnessFilter::GPUBrightnessFilter(const IntPoint& size, PixelFormat pf,
- double alpha, bool bStandalone)
- : GPUFilter(pf, B8G8R8A8, bStandalone),
+GPUBrightnessFilter::GPUBrightnessFilter(const IntPoint& size, bool bUseAlpha,
+ float alpha, bool bStandalone)
+ : GPUFilter(SHADERID, bUseAlpha, bStandalone),
m_Alpha(alpha)
{
ObjectCounter::get()->incRef(&typeid(*this));
setDimensions(size);
- initShader();
+
+ OGLShaderPtr pShader = getShader();
+ m_pTextureParam = pShader->getParam<int>("u_Texture");
+ m_pAlphaParam = pShader->getParam<float>("u_Alpha");
}
GPUBrightnessFilter::~GPUBrightnessFilter()
@@ -51,30 +55,10 @@ GPUBrightnessFilter::~GPUBrightnessFilter()
void GPUBrightnessFilter::applyOnGPU(GLTexturePtr pSrcTex)
{
- OGLShaderPtr pShader = getShader(SHADERID);
- pShader->activate();
- pShader->setUniformIntParam("Texture", 0);
- pShader->setUniformFloatParam("alpha", GLfloat(m_Alpha));
+ getShader()->activate();
+ m_pTextureParam->set(0);
+ m_pAlphaParam->set(m_Alpha);
draw(pSrcTex);
-
- glproc::UseProgramObject(0);
}
-void GPUBrightnessFilter::initShader()
-{
- string sProgram =
- "uniform float alpha;\n"
- "uniform sampler2D Texture;\n"
-
- "void main(void)\n"
- "{\n"
- " vec4 tex =texture2D(Texture, gl_TexCoord[0].st);\n"
- " gl_FragColor.rgb = tex.rgb*alpha;\n"
- " gl_FragColor.a = tex.a;\n"
- "}\n"
- ;
-
- getOrCreateShader(SHADERID, sProgram);
}
-
-} // namespace
diff --git a/src/graphics/GPUBrightnessFilter.h b/src/graphics/GPUBrightnessFilter.h
index 66d0643..87d0c5d 100644
--- a/src/graphics/GPUBrightnessFilter.h
+++ b/src/graphics/GPUBrightnessFilter.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -24,6 +24,7 @@
#include "../api.h"
#include "GPUFilter.h"
+#include "GLShaderParam.h"
#include "Bitmap.h"
namespace avg {
@@ -31,18 +32,19 @@ namespace avg {
class AVG_API GPUBrightnessFilter: public GPUFilter
{
public:
- GPUBrightnessFilter(const IntPoint& size, PixelFormat pf, double alpha,
+ GPUBrightnessFilter(const IntPoint& size, bool bUseAlpha, float alpha,
bool bStandalone=true);
virtual ~GPUBrightnessFilter();
virtual void applyOnGPU(GLTexturePtr pSrcTex);
private:
- static void initShader();
+ float m_Alpha;
- double m_Alpha;
+ IntGLShaderParamPtr m_pTextureParam;
+ FloatGLShaderParamPtr m_pAlphaParam;
};
-} // namespace
+}
#endif
diff --git a/src/graphics/GPUChromaKeyFilter.cpp b/src/graphics/GPUChromaKeyFilter.cpp
index 868763c..a3ae188 100644
--- a/src/graphics/GPUChromaKeyFilter.cpp
+++ b/src/graphics/GPUChromaKeyFilter.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -22,22 +22,23 @@
#include "GPUChromaKeyFilter.h"
#include "Bitmap.h"
#include "ShaderRegistry.h"
+#include "OGLShader.h"
+#include "ImagingProjection.h"
#include "../base/ObjectCounter.h"
#include "../base/Exception.h"
#include <iostream>
-#define SHADERID_CHROMAKEY "CHROMAKEY"
-#define SHADERID_EROSION "CHROMAKEY_EROSION"
+#define SHADERID_CHROMAKEY "chromakey"
+#define SHADERID_EROSION "chromakey_erosion"
using namespace std;
namespace avg {
-GPUChromaKeyFilter::GPUChromaKeyFilter(const IntPoint& size, PixelFormat pf,
- bool bStandalone)
- : GPUFilter(pf, B8G8R8A8, bStandalone, 2),
+GPUChromaKeyFilter::GPUChromaKeyFilter(const IntPoint& size, bool bStandalone)
+ : GPUFilter(SHADERID_CHROMAKEY, true, bStandalone, 2),
m_Color(0, 255, 0),
m_HTolerance(0.0),
m_STolerance(0.0),
@@ -48,8 +49,33 @@ GPUChromaKeyFilter::GPUChromaKeyFilter(const IntPoint& size, PixelFormat pf,
{
ObjectCounter::get()->incRef(&typeid(*this));
+ GLContext::getCurrent()->ensureFullShaders("GPUChromaKeyFilter");
+
setDimensions(size);
- initShader();
+ OGLShaderPtr pShader = getShader();
+ m_pTextureParam = pShader->getParam<int>("u_Texture");
+
+ m_pHKeyParam = pShader->getParam<float>("u_HKey");
+ m_pHToleranceParam = pShader->getParam<float>("u_HTolerance");
+ m_pHSoftToleranceParam = pShader->getParam<float>("u_HSoftTolerance");
+
+ m_pSKeyParam = pShader->getParam<float>("u_SKey");
+ m_pSToleranceParam = pShader->getParam<float>("u_STolerance");
+ m_pSSoftToleranceParam = pShader->getParam<float>("u_SSoftTolerance");
+
+ m_pLKeyParam = pShader->getParam<float>("u_LKey");
+ m_pLToleranceParam = pShader->getParam<float>("u_LTolerance");
+ m_pLSoftToleranceParam = pShader->getParam<float>("u_LSoftTolerance");
+
+ m_pSpillThresholdParam = pShader->getParam<float>("u_SpillThreshold");
+ m_pIsLastParam = pShader->getParam<int>("u_bIsLast");
+
+ createShader(SHADERID_EROSION);
+ pShader = avg::getShader(SHADERID_EROSION);
+ m_pErosionTextureParam= pShader->getParam<int>("u_Texture");
+ m_pErosionIsLastParam = pShader->getParam<int>("u_bIsLast");
+
+ m_pProjection2 = ImagingProjectionPtr(new ImagingProjection(size));
}
GPUChromaKeyFilter::~GPUChromaKeyFilter()
@@ -57,9 +83,9 @@ GPUChromaKeyFilter::~GPUChromaKeyFilter()
ObjectCounter::get()->decRef(&typeid(*this));
}
-void GPUChromaKeyFilter::setParams(const Pixel32& color, double hTolerance,
- double sTolerance, double lTolerance, double softness, int erosion,
- double spillThreshold)
+void GPUChromaKeyFilter::setParams(const Pixel32& color, float hTolerance,
+ float sTolerance, float lTolerance, float softness, int erosion,
+ float spillThreshold)
{
m_Color = color;
m_HTolerance = hTolerance;
@@ -77,177 +103,35 @@ void GPUChromaKeyFilter::applyOnGPU(GLTexturePtr pSrcTex)
{
// Set up double-buffering
int curBufferIndex = m_Erosion%2;
- OGLShaderPtr pShader = getShader(SHADERID_CHROMAKEY);
- glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT+curBufferIndex);
- pShader->activate();
- pShader->setUniformIntParam("texture", 0);
+ getFBO(curBufferIndex)->activate();
+ getShader()->activate();
+ m_pTextureParam->set(0);
- double h, s, l;
+ float h, s, l;
m_Color.toHSL(h, s, l);
- pShader->setUniformFloatParam("hKey", h);
- pShader->setUniformFloatParam("hTolerance", m_HTolerance*360);
- pShader->setUniformFloatParam("hSoftTolerance", (m_HTolerance+m_Softness)*360.0);
- pShader->setUniformFloatParam("sKey", s);
- pShader->setUniformFloatParam("sTolerance", m_STolerance);
- pShader->setUniformFloatParam("sSoftTolerance", m_STolerance+m_Softness);
- pShader->setUniformFloatParam("lKey", l);
- pShader->setUniformFloatParam("lTolerance", m_LTolerance);
- pShader->setUniformFloatParam("lSoftTolerance", m_LTolerance+m_Softness);
- pShader->setUniformFloatParam("spillThreshold", m_SpillThreshold*360);
- pShader->setUniformIntParam("bIsLast", int(m_Erosion==0));
+ m_pHKeyParam->set(h);
+ m_pHToleranceParam->set(m_HTolerance*360);
+ m_pHSoftToleranceParam->set((m_HTolerance+m_Softness)*360.0f);
+ m_pSKeyParam->set(s);
+ m_pSToleranceParam->set(m_STolerance);
+ m_pSSoftToleranceParam->set(m_STolerance+m_Softness);
+ m_pLKeyParam->set(l);
+ m_pLToleranceParam->set(m_LTolerance);
+ m_pLSoftToleranceParam->set(m_LTolerance+m_Softness);
+ m_pSpillThresholdParam->set(m_SpillThreshold*360);
+ m_pIsLastParam->set(int(m_Erosion==0));
draw(pSrcTex);
for (int i = 0; i < m_Erosion; ++i) {
curBufferIndex = (curBufferIndex+1)%2;
- glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT+curBufferIndex);
- pShader = getShader(SHADERID_EROSION);
+ getFBO(curBufferIndex)->activate();
+ OGLShaderPtr pShader = avg::getShader(SHADERID_EROSION);
pShader->activate();
- pShader->setUniformIntParam("texture", 0);
- pShader->setUniformIntParam("bIsLast", int(i==m_Erosion-1));
- draw(getDestTex((curBufferIndex+1)%2));
+ m_pErosionTextureParam->set(0);
+ m_pErosionIsLastParam->set(int(i==m_Erosion-1));
+ getDestTex((curBufferIndex+1)%2)->activate(GL_TEXTURE0);
+ m_pProjection2->draw(avg::getShader(SHADERID_EROSION));
}
- glproc::UseProgramObject(0);
-}
-
-void GPUChromaKeyFilter::initShader()
-{
-
- string sProgramHead =
- "uniform float alpha;\n"
- "uniform sampler2D texture;\n"
- "uniform float hKey;\n"
- "uniform float hTolerance;\n"
- "uniform float hSoftTolerance;\n"
- "uniform float sTolerance;\n"
- "uniform float sSoftTolerance;\n"
- "uniform float sKey;\n"
- "uniform float lTolerance;\n"
- "uniform float lSoftTolerance;\n"
- "uniform float spillThreshold;\n"
- "uniform float lKey;\n"
- "uniform bool bIsLast;\n"
- + getStdShaderCode()
- ;
-
- string sProgram = sProgramHead +
- "vec4 alphaMin(vec4 v1, vec4 v2)\n"
- "{\n"
- " if (v1.a < v2.a) {\n"
- " return v1;\n"
- " } else {\n"
- " return v2;\n"
- " }\n"
- "}\n"
-
- "vec4 alphaMax(vec4 v1, vec4 v2)\n"
- "{\n"
- " if (v1.a < v2.a) {\n"
- " return v2;\n"
- " } else {\n"
- " return v1;\n"
- " }\n"
- "}\n"
-
- "#define s2(a, b) temp = a; a = alphaMin(a, b); b = alphaMax(temp, b);\n"
- "#define mn3(a, b, c) s2(a, b); s2(a, c);\n"
- "#define mx3(a, b, c) s2(b, c); s2(a, c);\n"
-
- "#define mnmx3(a, b, c) mx3(a, b, c); s2(a, b);\n"
- "#define mnmx4(a, b, c, d) s2(a, b); s2(c, d); s2(a, c); s2(b, d); \n"
-
- "// Based on McGuire, A fast, small-radius GPU median filter, in ShaderX6,\n"
- "// February 2008. http://graphics.cs.williams.edu/papers/MedianShaderX6/ \n"
- "vec4 getMedian(vec2 texCoord)\n"
- "{\n"
- " vec4 v[5];\n"
- " float dx = dFdx(texCoord.x);\n"
- " float dy = dFdy(texCoord.y);\n"
- " v[0] = texture2D(texture, texCoord);\n"
- " v[1] = texture2D(texture, texCoord+vec2(0,-dy));\n"
- " v[2] = texture2D(texture, texCoord+vec2(0,dy));\n"
- " v[3] = texture2D(texture, texCoord+vec2(-dx,0));\n"
- " v[4] = texture2D(texture, texCoord+vec2(dx,0));\n"
- " for (int i = 0; i < 5; ++i) {\n"
- " v[i].a = (v[i].r+v[i].g+v[i].b)/3.0;\n"
- " }\n"
-
- " vec4 temp;\n"
- " mnmx4(v[0], v[1], v[2], v[3]);\n"
- " mnmx3(v[1], v[2], v[4]);\n"
- " return v[2];\n"
- "}\n"
-
- "void main(void)\n"
- "{\n"
- " vec4 tex = getMedian(gl_TexCoord[0].st);\n"
- " float h;\n"
- " float s;\n"
- " float l;\n"
- " float alpha;\n"
- " rgb2hsl(tex, h, s, l);\n"
- " float hDiff = abs(h-hKey);\n"
- " float sDiff = abs(s-sKey);\n"
- " float lDiff = abs(l-lKey);\n"
- " if (hDiff < hSoftTolerance && sDiff < sSoftTolerance \n"
- " && lDiff < lSoftTolerance)\n"
- " {\n"
- " alpha = 0.0;\n"
- " if (hDiff > hTolerance) {\n"
- " alpha = (hDiff-hTolerance)/(hSoftTolerance-hTolerance);\n"
- " }\n"
- " if (sDiff > sTolerance) {\n"
- " alpha = max(alpha,\n"
- " (sDiff-sTolerance)/(sSoftTolerance-sTolerance));\n"
- " }\n"
- " if (lDiff > lTolerance) {\n"
- " alpha = max(alpha,\n"
- " (lDiff-lTolerance)/(lSoftTolerance-lTolerance));\n"
- " }\n"
- " } else {\n"
- " alpha = 1.0;\n"
- " }\n"
- " if (alpha > 0.0 && hDiff < spillThreshold) {\n"
- " if (spillThreshold > hTolerance) {\n"
- " float factor = max(0.0, 1.0-(spillThreshold-hDiff)\n"
- " /(spillThreshold-hTolerance));\n"
- " s = s*factor;\n"
- " }\n"
- " tex.rgb = hsl2rgb(h, s, l);\n"
- " }\n"
- " if (bIsLast) {\n"
- " gl_FragColor = vec4(tex.rgb*alpha, alpha);\n"
- " } else {\n"
- " gl_FragColor = vec4(tex.rgb, alpha);\n"
- " }\n"
- "}\n"
- ;
- getOrCreateShader(SHADERID_CHROMAKEY, sProgram);
-
- string sErosionProgram =
- "uniform sampler2D texture;\n"
- "uniform bool bIsLast;\n"
-
- "void main(void)\n"
- "{\n"
- " float minAlpha = 1.0;\n"
- " float dx = dFdx(gl_TexCoord[0].x);\n"
- " float dy = dFdy(gl_TexCoord[0].y);\n"
- " for (float y = -1.0; y <= 1.0; ++y) {\n"
- " for (float x = -1.0; x <= 1.0; ++x) {\n"
- " float a = texture2D(texture, gl_TexCoord[0].st+vec2(x*dx,y*dy)).a;\n"
- " minAlpha = min(minAlpha, a);\n"
- " }\n"
- " }\n"
- " vec4 tex = texture2D(texture, gl_TexCoord[0].st);\n"
- " if (bIsLast) {\n"
- " gl_FragColor = vec4(tex.rgb*minAlpha, minAlpha);\n"
- " } else {\n"
- " gl_FragColor = vec4(tex.rgb, minAlpha);\n"
- " }\n"
- "}\n"
- ;
- getOrCreateShader(SHADERID_EROSION, sErosionProgram);
-
}
}
diff --git a/src/graphics/GPUChromaKeyFilter.h b/src/graphics/GPUChromaKeyFilter.h
index 5e734df..00024ee 100644
--- a/src/graphics/GPUChromaKeyFilter.h
+++ b/src/graphics/GPUChromaKeyFilter.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -24,6 +24,7 @@
#include "../api.h"
#include "GPUFilter.h"
+#include "GLShaderParam.h"
#include "Bitmap.h"
namespace avg {
@@ -31,24 +32,39 @@ namespace avg {
class AVG_API GPUChromaKeyFilter: public GPUFilter
{
public:
- GPUChromaKeyFilter(const IntPoint& size, PixelFormat pf, bool bStandalone=true);
+ GPUChromaKeyFilter(const IntPoint& size, bool bStandalone=true);
virtual ~GPUChromaKeyFilter();
- void setParams(const Pixel32& color, double hTolerance, double sTolerance,
- double lTolerance, double softness, int erosion, double spillThreshold);
+ void setParams(const Pixel32& color, float hTolerance, float sTolerance,
+ float lTolerance, float softness, int erosion, float spillThreshold);
virtual void applyOnGPU(GLTexturePtr pSrcTex);
private:
- void initShader();
-
Pixel32 m_Color;
- double m_HTolerance;
- double m_STolerance;
- double m_LTolerance;
- double m_Softness;
+ float m_HTolerance;
+ float m_STolerance;
+ float m_LTolerance;
+ float m_Softness;
int m_Erosion;
- double m_SpillThreshold;
+ float m_SpillThreshold;
+ ImagingProjectionPtr m_pProjection2;
+
+ IntGLShaderParamPtr m_pTextureParam;
+ FloatGLShaderParamPtr m_pHKeyParam;
+ FloatGLShaderParamPtr m_pHToleranceParam;
+ FloatGLShaderParamPtr m_pHSoftToleranceParam;
+ FloatGLShaderParamPtr m_pSKeyParam;
+ FloatGLShaderParamPtr m_pSToleranceParam;
+ FloatGLShaderParamPtr m_pSSoftToleranceParam;
+ FloatGLShaderParamPtr m_pLKeyParam;
+ FloatGLShaderParamPtr m_pLToleranceParam;
+ FloatGLShaderParamPtr m_pLSoftToleranceParam;
+ FloatGLShaderParamPtr m_pSpillThresholdParam;
+ IntGLShaderParamPtr m_pIsLastParam;
+
+ IntGLShaderParamPtr m_pErosionTextureParam;
+ IntGLShaderParamPtr m_pErosionIsLastParam;
};
typedef boost::shared_ptr<GPUChromaKeyFilter> GPUChromaKeyFilterPtr;
diff --git a/src/graphics/GPUFilter.cpp b/src/graphics/GPUFilter.cpp
index 4c31791..36fe811 100644
--- a/src/graphics/GPUFilter.cpp
+++ b/src/graphics/GPUFilter.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -24,6 +24,11 @@
#include "VertexArray.h"
#include "ImagingProjection.h"
+#include "GLContext.h"
+#include "ShaderRegistry.h"
+#include "Filterfliprgb.h"
+#include "BitmapLoader.h"
+
#include "../base/ObjectCounter.h"
#include "../base/Exception.h"
#include "../base/MathHelper.h"
@@ -36,8 +41,24 @@ using namespace boost;
namespace avg {
+GPUFilter::GPUFilter(const string& sShaderID, bool bUseAlpha,
+ bool bStandalone, unsigned numTextures, bool bMipmap)
+ : m_bStandalone(bStandalone),
+ m_NumTextures(numTextures),
+ m_bMipmap(bMipmap),
+ m_SrcSize(0,0),
+ m_DestRect(0,0,0,0)
+{
+ m_PFSrc = BitmapLoader::get()->getDefaultPixelFormat(bUseAlpha);
+ m_PFDest = m_PFSrc;
+ createShader(sShaderID);
+
+ m_pShader = avg::getShader(sShaderID);
+ ObjectCounter::get()->incRef(&typeid(*this));
+}
+
GPUFilter::GPUFilter(PixelFormat pfSrc, PixelFormat pfDest, bool bStandalone,
- unsigned numTextures, bool bMipmap)
+ const string& sShaderID, unsigned numTextures, bool bMipmap)
: m_PFSrc(pfSrc),
m_PFDest(pfDest),
m_bStandalone(bStandalone),
@@ -46,6 +67,8 @@ GPUFilter::GPUFilter(PixelFormat pfSrc, PixelFormat pfDest, bool bStandalone,
m_SrcSize(0,0),
m_DestRect(0,0,0,0)
{
+ createShader(sShaderID);
+ m_pShader = avg::getShader(sShaderID);
ObjectCounter::get()->incRef(&typeid(*this));
}
@@ -54,72 +77,55 @@ GPUFilter::~GPUFilter()
ObjectCounter::get()->decRef(&typeid(*this));
}
-void GPUFilter::setDimensions(const IntPoint& srcSize)
-{
- setDimensions(srcSize, IntRect(IntPoint(0,0), srcSize), GL_CLAMP_TO_EDGE);
-}
-
-void GPUFilter::setDimensions(const IntPoint& srcSize, const IntRect& destRect,
- unsigned texMode)
-{
- bool bProjectionChanged = false;
- if (destRect != m_DestRect) {
- m_pFBO = FBOPtr(new FBO(destRect.size(), m_PFDest, m_NumTextures, 1, false,
- m_bMipmap));
- m_DestRect = destRect;
- bProjectionChanged = true;
- }
- if (m_bStandalone && srcSize != m_SrcSize) {
- m_pSrcTex = GLTexturePtr(new GLTexture(srcSize, m_PFSrc, false, texMode,
- texMode));
- m_pSrcPBO = PBOPtr(new PBO(srcSize, m_PFSrc, GL_STREAM_DRAW));
- bProjectionChanged = true;
- }
- m_SrcSize = srcSize;
- if (bProjectionChanged) {
- m_pProjection = ImagingProjectionPtr(new ImagingProjection(srcSize, destRect));
- }
-}
-
BitmapPtr GPUFilter::apply(BitmapPtr pBmpSource)
{
AVG_ASSERT(m_pSrcTex);
- AVG_ASSERT(m_pFBO);
- m_pSrcPBO->moveBmpToTexture(pBmpSource, *m_pSrcTex);
+ AVG_ASSERT(!(m_pFBOs.empty()));
+ m_pSrcMover->moveBmpToTexture(pBmpSource, *m_pSrcTex);
apply(m_pSrcTex);
- BitmapPtr pFilteredBmp = m_pFBO->getImage();
+ BitmapPtr pFilteredBmp = m_pFBOs[0]->getImage();
+
+ BitmapPtr pTmpBmp;
+ if (pixelFormatIsBlueFirst(pFilteredBmp->getPixelFormat()) !=
+ pixelFormatIsBlueFirst(pBmpSource->getPixelFormat()) &&
+ pFilteredBmp->getBytesPerPixel() <= 4)
+ {
+ pTmpBmp = FilterFlipRGB().apply(pFilteredBmp);
+ } else {
+ pTmpBmp = pFilteredBmp;
+ }
+
BitmapPtr pDestBmp;
- if (pFilteredBmp->getPixelFormat() != pBmpSource->getPixelFormat()) {
+ if (pTmpBmp->getPixelFormat() != pBmpSource->getPixelFormat()) {
pDestBmp = BitmapPtr(new Bitmap(m_DestRect.size(),
pBmpSource->getPixelFormat()));
- pDestBmp->copyPixels(*pFilteredBmp);
+ pDestBmp->copyPixels(*pTmpBmp);
} else {
- pDestBmp = pFilteredBmp;
+ pDestBmp = pTmpBmp;
}
return pDestBmp;
}
void GPUFilter::apply(GLTexturePtr pSrcTex)
{
- m_pFBO->activate();
- m_pProjection->activate();
+ m_pFBOs[0]->activate();
applyOnGPU(pSrcTex);
- m_pFBO->copyToDestTexture();
+ m_pFBOs[0]->copyToDestTexture();
}
GLTexturePtr GPUFilter::getDestTex(int i) const
{
- return m_pFBO->getTex(i);
+ return m_pFBOs[i]->getTex();
}
BitmapPtr GPUFilter::getImage() const
{
- return m_pFBO->getImage();
+ return m_pFBOs[0]->getImage();
}
-FBOPtr GPUFilter::getFBO()
+FBOPtr GPUFilter::getFBO(int i)
{
- return m_pFBO;
+ return m_pFBOs[i];
}
const IntRect& GPUFilter::getDestRect() const
@@ -132,110 +138,53 @@ const IntPoint& GPUFilter::getSrcSize() const
return m_SrcSize;
}
-DRect GPUFilter::getRelDestRect() const
+FRect GPUFilter::getRelDestRect() const
{
- DPoint srcSize(m_SrcSize);
- return DRect(m_DestRect.tl.x/srcSize.x, m_DestRect.tl.y/srcSize.y,
+ glm::vec2 srcSize(m_SrcSize);
+ return FRect(m_DestRect.tl.x/srcSize.x, m_DestRect.tl.y/srcSize.y,
m_DestRect.br.x/srcSize.x, m_DestRect.br.y/srcSize.y);
}
-void GPUFilter::draw(GLTexturePtr pTex)
+void GPUFilter::setDimensions(const IntPoint& srcSize)
{
- pTex->activate(GL_TEXTURE0);
- m_pProjection->draw();
+ setDimensions(srcSize, IntRect(IntPoint(0,0), srcSize), GL_CLAMP_TO_EDGE);
}
-const string& GPUFilter::getStdShaderCode() const
+void GPUFilter::setDimensions(const IntPoint& srcSize, const IntRect& destRect,
+ unsigned texMode)
{
- static string sCode =
- "void unPreMultiplyAlpha(inout vec4 color)\n"
- "{\n"
- " if (color.a > 0.0) {\n"
- " color.rgb /= color.a;\n"
- " }\n"
- "}\n"
- "\n"
- "void preMultiplyAlpha(inout vec4 color)\n"
- "{\n"
- " color.rgb *= color.a;\n"
- "}\n"
- "\n"
- "void rgb2hsl(vec4 rgba, out float h, out float s, out float l)\n"
- "{\n"
- " float maxComp = max(rgba.r, max(rgba.g, rgba.b));\n"
- " float minComp = min(rgba.r, min(rgba.g, rgba.b));\n"
- " l = (maxComp+minComp)/2.0;\n"
- " if (maxComp == minComp) {\n"
- " s = 0.0;\n"
- " h = 0.0;\n"
- " } else {\n"
- " float delta = maxComp-minComp;\n"
- " if (l < 0.5) {\n"
- " s = delta/(maxComp+minComp);\n"
- " } else {\n"
- " s = delta/(2.0-(maxComp+minComp));\n"
- " }\n"
- " if (rgba.r == maxComp) {\n"
- " h = (rgba.g-rgba.b)/delta;\n"
- " if (h < 0.0) {\n"
- " h += 6.0;\n"
- " }\n"
- " } else if (rgba.g == maxComp) {\n"
- " h = 2.0+(rgba.b-rgba.r)/delta;\n"
- " } else {\n"
- " h = 4.0+(rgba.r-rgba.g)/delta;\n"
- " }\n"
- " h *= 60.0;\n"
- " }\n"
- "}\n"
- "vec3 hsl2rgb(float h, float s, float l)\n"
- "{\n"
- " vec3 rgb = vec3(0.0, 0.0, 0.0);\n"
- " float v;\n"
- " if (l <= 0.5) {\n"
- " v = l*(1.0+s);\n"
- " } else {\n"
- " v = l+s-l*s;\n"
- " }\n"
- " if (v > 0.0) {\n"
- " float m = 2.0*l-v;\n"
- " float sv = (v-m)/v;\n"
- " h /= 60.0;\n"
- " int sextant = int(h);\n"
- " float fract = h-float(sextant);\n"
- " float vsf = v * sv * fract;\n"
- " float mid1 = m + vsf;\n"
- " float mid2 = v - vsf;\n"
- " if (sextant == 0) {\n"
- " rgb.r = v;\n"
- " rgb.g = mid1;\n"
- " rgb.b = m;\n"
- " } else if (sextant == 1) {\n"
- " rgb.r = mid2;\n"
- " rgb.g = v;\n"
- " rgb.b = m;\n"
- " } else if (sextant == 2) {\n"
- " rgb.r = m;\n"
- " rgb.g = v;\n"
- " rgb.b = mid1;\n"
- " } else if (sextant == 3) {\n"
- " rgb.r = m;\n"
- " rgb.g = mid2;\n"
- " rgb.b = v;\n"
- " } else if (sextant == 4) {\n"
- " rgb.r = mid1;\n"
- " rgb.g = m;\n"
- " rgb.b = v;\n"
- " } else if (sextant == 5) {\n"
- " rgb.r = v;\n"
- " rgb.g = m;\n"
- " rgb.b = mid2;\n"
- " }\n"
- " }\n"
- " return rgb;\n"
- "}\n";
+ bool bProjectionChanged = false;
+ if (destRect != m_DestRect) {
+ m_pFBOs.clear();
+ for (unsigned i=0; i<m_NumTextures; ++i) {
+ FBOPtr pFBO = FBOPtr(new FBO(destRect.size(), m_PFDest, 1, 1, false,
+ m_bMipmap));
+ m_pFBOs.push_back(pFBO);
+ }
+ m_DestRect = destRect;
+ bProjectionChanged = true;
+ }
+ if (m_bStandalone && srcSize != m_SrcSize) {
+ m_pSrcTex = GLTexturePtr(new GLTexture(srcSize, m_PFSrc, false, 0, texMode,
+ texMode));
+ m_pSrcMover = TextureMover::create(srcSize, m_PFSrc, GL_STREAM_DRAW);
+ bProjectionChanged = true;
+ }
+ m_SrcSize = srcSize;
+ if (bProjectionChanged) {
+ m_pProjection = ImagingProjectionPtr(new ImagingProjection(srcSize, destRect));
+ }
+}
+
+const OGLShaderPtr& GPUFilter::getShader() const
+{
+ return m_pShader;
+}
- return sCode;
+void GPUFilter::draw(GLTexturePtr pTex)
+{
+ pTex->activate(GL_TEXTURE0);
+ m_pProjection->draw(m_pShader);
}
void dumpKernel(int width, float* pKernel)
@@ -249,12 +198,13 @@ void dumpKernel(int width, float* pKernel)
cerr << "Sum of coefficients: " << sum << endl;
}
-int GPUFilter::getBlurKernelRadius(double stdDev) const
+int GPUFilter::getBlurKernelRadius(float stdDev) const
{
return int(ceil(stdDev*3));
}
-GLTexturePtr GPUFilter::calcBlurKernelTex(double stdDev, double opacity) const
+GLTexturePtr GPUFilter::calcBlurKernelTex(float stdDev, float opacity, bool bUseFloat)
+ const
{
AVG_ASSERT(opacity != -1);
int kernelWidth;
@@ -268,48 +218,67 @@ GLTexturePtr GPUFilter::calcBlurKernelTex(double stdDev, double opacity) const
int i=0;
float coeff;
do {
- coeff = float(exp(-i*i/(2*stdDev*stdDev))/sqrt(2*M_PI*stdDev*stdDev))
+ coeff = float(exp(-i*i/(2*stdDev*stdDev))/sqrt(2*PI*stdDev*stdDev))
*float(opacity);
tempCoeffs[i] = coeff;
i++;
- } while (coeff > 0.005 && i < 1024);
- int kernelCenter = i - 2;
- kernelWidth = kernelCenter*2+1;
- pKernel = new float[kernelWidth];
- float sum = 0;
- for (int i = 0; i <= kernelCenter; ++i) {
- pKernel[kernelCenter+i] = tempCoeffs[i];
- sum += tempCoeffs[i];
- if (i != 0) {
- pKernel[kernelCenter-i] = tempCoeffs[i];
+ } while (coeff > 0.003 && i < 1024);
+ if (i > 1) {
+ int kernelCenter = i - 2;
+ kernelWidth = kernelCenter*2+1;
+ pKernel = new float[kernelWidth];
+ float sum = 0;
+ for (int i = 0; i <= kernelCenter; ++i) {
+ pKernel[kernelCenter+i] = tempCoeffs[i];
sum += tempCoeffs[i];
+ if (i != 0) {
+ pKernel[kernelCenter-i] = tempCoeffs[i];
+ sum += tempCoeffs[i];
+ }
}
- }
- // Make sure the sum of coefficients is opacity despite the inaccuracies
- // introduced by using a kernel of finite size.
- for (int i = 0; i < kernelWidth; ++i) {
- pKernel[i] *= float(opacity)/sum;
+ // Make sure the sum of coefficients is opacity despite the inaccuracies
+ // introduced by using a kernel of finite size.
+ for (int i = 0; i < kernelWidth; ++i) {
+ pKernel[i] *= float(opacity)/sum;
+ }
+ } else {
+ // Blur is so wide that all pixels would be black at 8-bit precision
+ kernelWidth = 1;
+ pKernel = new float[1];
+ pKernel[0] = 0.;
}
}
// dumpKernel(kernelWidth, pKernel);
IntPoint size(kernelWidth, 1);
- GLTexturePtr pTex(new GLTexture(size, R32G32B32A32F));
- PBOPtr pFilterKernelPBO(new PBO(IntPoint(1024, 1), R32G32B32A32F, GL_STREAM_DRAW));
- pFilterKernelPBO->activate();
- void * pPBOPixels = glproc::MapBuffer(GL_PIXEL_UNPACK_BUFFER_EXT, GL_WRITE_ONLY);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "GPUFilter::calcBlurKernelTex MapBuffer()");
- float * pCurFloat = (float*)pPBOPixels;
- for (int i = 0; i < kernelWidth; ++i) {
- for (int j = 0; j < 4; ++j) {
- *pCurFloat = pKernel[i];
- ++pCurFloat;
+ PixelFormat pf;
+ if (bUseFloat) {
+ pf = R32G32B32A32F;
+ } else {
+ pf = I8;
+ }
+ GLTexturePtr pTex(new GLTexture(size, pf));
+ TextureMoverPtr pKernelMover = TextureMover::create(size, pf, GL_STREAM_DRAW);
+ BitmapPtr pBmp = pKernelMover->lock();
+ void * pPixels = pBmp->getPixels();
+ GLContext::checkError("GPUFilter::calcBlurKernelTex MapBuffer()");
+ if (bUseFloat) {
+ float * pCurFloat = (float*)pPixels;
+ for (int i = 0; i < kernelWidth; ++i) {
+ for (int j = 0; j < 4; ++j) {
+ *pCurFloat = pKernel[i];
+ ++pCurFloat;
+ }
+ }
+ } else {
+ unsigned char * pCurPixel = (unsigned char *)pPixels;
+ for (int i = 0; i < kernelWidth; ++i) {
+ *pCurPixel = (unsigned char)(pKernel[i]*255+0.5);
+ ++pCurPixel;
}
}
- glproc::UnmapBuffer(GL_PIXEL_UNPACK_BUFFER_EXT);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "GPUFilter::calcBlurKernelTex UnmapBuffer()");
-
- pFilterKernelPBO->moveToTexture(*pTex);
+ pKernelMover->unlock();
+ pKernelMover->moveToTexture(*pTex);
delete[] pKernel;
return pTex;
diff --git a/src/graphics/GPUFilter.h b/src/graphics/GPUFilter.h
index 82d3f9c..bcaa114 100644
--- a/src/graphics/GPUFilter.h
+++ b/src/graphics/GPUFilter.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -26,42 +26,45 @@
#include "Filter.h"
#include "VertexArray.h"
#include "Bitmap.h"
-#include "PBO.h"
+#include "TextureMover.h"
#include "FBO.h"
-#include <boost/thread/tss.hpp>
-
namespace avg {
class ImagingProjection;
typedef boost::shared_ptr<ImagingProjection> ImagingProjectionPtr;
+class OGLShader;
+typedef boost::shared_ptr<OGLShader> OGLShaderPtr;
class AVG_API GPUFilter: public Filter
{
public:
- GPUFilter(PixelFormat pfSrc, PixelFormat pfDest, bool bStandalone,
+ GPUFilter(const std::string& sShaderID, bool bUseAlpha, bool bStandalone=false,
unsigned numTextures=1, bool bMipmap=false);
+ GPUFilter(PixelFormat pfSrc, PixelFormat pfDest, bool bStandalone,
+ const std::string& sShaderID, unsigned numTextures=1, bool bMipmap=false);
virtual ~GPUFilter();
- void setDimensions(const IntPoint& srcSize);
- void setDimensions(const IntPoint& srcSize, const IntRect& destRect,
- unsigned texMode);
virtual BitmapPtr apply(BitmapPtr pBmpSource);
virtual void apply(GLTexturePtr pSrcTex);
virtual void applyOnGPU(GLTexturePtr pSrcTex) = 0;
GLTexturePtr getDestTex(int i=0) const;
BitmapPtr getImage() const;
- FBOPtr getFBO();
+ FBOPtr getFBO(int i=0);
const IntRect& getDestRect() const;
const IntPoint& getSrcSize() const;
- DRect getRelDestRect() const;
+ FRect getRelDestRect() const;
protected:
+ void setDimensions(const IntPoint& srcSize);
+ void setDimensions(const IntPoint& srcSize, const IntRect& destRect,
+ unsigned texMode);
+ const OGLShaderPtr& getShader() const;
+
void draw(GLTexturePtr pTex);
- const std::string& getStdShaderCode() const;
- int getBlurKernelRadius(double stdDev) const;
- GLTexturePtr calcBlurKernelTex(double stdDev, double opacity=1) const;
+ int getBlurKernelRadius(float stdDev) const;
+ GLTexturePtr calcBlurKernelTex(float stdDev, float opacity, bool bUseFloat) const;
private:
PixelFormat m_PFSrc;
@@ -71,15 +74,16 @@ private:
bool m_bMipmap;
GLTexturePtr m_pSrcTex;
- PBOPtr m_pSrcPBO;
- FBOPtr m_pFBO;
+ TextureMoverPtr m_pSrcMover;
+ std::vector<FBOPtr> m_pFBOs;
IntPoint m_SrcSize;
IntRect m_DestRect;
+ OGLShaderPtr m_pShader;
ImagingProjectionPtr m_pProjection;
};
typedef boost::shared_ptr<GPUFilter> GPUFilterPtr;
-} // namespace
+}
#endif
diff --git a/src/graphics/GPUHueSatFilter.cpp b/src/graphics/GPUHueSatFilter.cpp
index b58b4db..4f1b46b 100644
--- a/src/graphics/GPUHueSatFilter.cpp
+++ b/src/graphics/GPUHueSatFilter.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -21,26 +21,31 @@
#include "GPUHueSatFilter.h"
#include "ShaderRegistry.h"
+#include "OGLShader.h"
#include "../base/ObjectCounter.h"
#include "../base/Logger.h"
-#define SHADERID_HSL_COLOR "HSL_COLOR"
+#define SHADERID_HSL_COLOR "huesat"
using namespace std;
namespace avg {
-GPUHueSatFilter::GPUHueSatFilter(const IntPoint& size, PixelFormat pf,
- bool bStandalone) :
- GPUFilter(pf, B8G8R8A8, bStandalone, 2),
- m_LightnessOffset(0.0),
- m_Hue(0.0),
- m_Saturation(0.0)
+GPUHueSatFilter::GPUHueSatFilter(const IntPoint& size, bool bUseAlpha, bool bStandalone)
+ : GPUFilter(SHADERID_HSL_COLOR, bUseAlpha, bStandalone),
+ m_LightnessOffset(0.0),
+ m_Hue(0.0),
+ m_Saturation(0.0)
{
ObjectCounter::get()->incRef(&typeid(*this));
setDimensions(size);
- initShader();
+ OGLShaderPtr pShader = getShader();
+ m_pHueParam = pShader->getParam<float>("u_Hue");
+ m_pSatParam = pShader->getParam<float>("u_Sat");
+ m_pLightnessParam = pShader->getParam<float>("u_LightnessOffset");
+ m_pColorizeParam = pShader->getParam<int>("u_bColorize");
+ m_pTextureParam = pShader->getParam<int>("u_Texture");
}
GPUHueSatFilter::~GPUHueSatFilter()
@@ -59,66 +64,14 @@ void GPUHueSatFilter::setParams(int hue, int saturation,
void GPUHueSatFilter::applyOnGPU(GLTexturePtr pSrcTex)
{
- OGLShaderPtr pShader = getShader(SHADERID_HSL_COLOR);
- glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT);
- pShader->activate();
- pShader->setUniformFloatParam("hue", m_Hue);
- pShader->setUniformFloatParam("sat", m_Saturation);
- pShader->setUniformFloatParam("l_offset", m_LightnessOffset);
- pShader->setUniformIntParam("b_colorize", (int)m_bColorize);
- pShader->setUniformIntParam("texture", 0);
+ getShader()->activate();
+ m_pHueParam->set(m_Hue);
+ m_pSatParam->set(m_Saturation);
+ m_pLightnessParam->set(m_LightnessOffset);
+ m_pColorizeParam->set((int)(m_bColorize));
+ m_pTextureParam->set(0);
draw(pSrcTex);
- glproc::UseProgramObject(0);
}
-void GPUHueSatFilter::initShader()
-{
- string sProgramHead =
- "const vec3 lumCoeff = vec3(0.2125, 0.7154, 0.0721);\n"
- "const vec3 white = vec3(1.0, 1.0, 1.0);\n"
- "const vec3 black = vec3(0.0, 0.0, 0.0);\n"
- "uniform sampler2D texture;\n"
- "uniform float hue;\n"
- "uniform float sat;\n"
- "uniform float l_offset;\n"
- "uniform bool b_colorize;\n"
- + getStdShaderCode()
- ;
- string sProgram = sProgramHead +
- "void main(void)\n"
- "{\n"
- " float tmp;\n"
- " float s;\n"
- " float l;\n"
- " float h;\n"
- " vec4 tex = texture2D(texture, gl_TexCoord[0].st);\n"
- " unPreMultiplyAlpha(tex);\n"
- " rgb2hsl(tex, tmp, s, l);\n"
- " if(b_colorize){\n"
- " h = hue;\n"
- " s = sat;\n"
- " }\n"
- " else{\n"
- " h = hue+tmp;\n"
- " }\n"
- " vec4 rgbTex = vec4(hsl2rgb(mod(h, 360.0), s, l), tex.a);\n"
- //Saturate in rgb - space to imitate photoshop filter
- " if(!b_colorize){ \n"
- " s = clamp(sat+s, 0.0, 2.0);\n"
- " vec3 intensity = vec3(dot(rgbTex.rgb, lumCoeff));\n"
- " rgbTex.rgb = mix(intensity, rgbTex.rgb, s);\n"
- " }; \n"
- //Brightness with black/white pixels to imitate photoshop lightness-offset
- " if(l_offset >= 0.0){ \n"
- " rgbTex = vec4(mix(rgbTex.rgb, white, l_offset), tex.a);\n"
- " }\n"
- " else if(l_offset < 0.0){ \n"
- " rgbTex = vec4(mix(rgbTex.rgb, black, -l_offset), tex.a);\n"
- " } \n"
- " preMultiplyAlpha(rgbTex);\n"
- " gl_FragColor = rgbTex;\n"
- "}\n";
- getOrCreateShader(SHADERID_HSL_COLOR, sProgram);
}
-}//End namespace avg
diff --git a/src/graphics/GPUHueSatFilter.h b/src/graphics/GPUHueSatFilter.h
index cc27c03..b712ce1 100644
--- a/src/graphics/GPUHueSatFilter.h
+++ b/src/graphics/GPUHueSatFilter.h
@@ -26,18 +26,17 @@
#include "../api.h"
#include "GPUFilter.h"
+#include "GLShaderParam.h"
namespace avg {
-class AVG_API GPUHueSatFilter : public GPUFilter
+class AVG_API GPUHueSatFilter: public GPUFilter
{
public:
- GPUHueSatFilter(const IntPoint& size, PixelFormat pf,
- bool bStandalone=true);
+ GPUHueSatFilter(const IntPoint& size, bool bUseAlpha, bool bStandalone=true);
virtual ~GPUHueSatFilter();
virtual void applyOnGPU(GLTexturePtr pSrcTex);
- void initShader();
void setParams(int hue, int saturation=1, int lightness_offset=0,
bool colorize=false);
@@ -46,9 +45,15 @@ private:
float m_Hue;
float m_Saturation;
bool m_bColorize;
+
+ FloatGLShaderParamPtr m_pHueParam;
+ FloatGLShaderParamPtr m_pSatParam;
+ FloatGLShaderParamPtr m_pLightnessParam;
+ IntGLShaderParamPtr m_pColorizeParam;
+ IntGLShaderParamPtr m_pTextureParam;
};
typedef boost::shared_ptr<GPUHueSatFilter> GPUHueSatFilterPtr;
-} //end namespace avg
+}
#endif
diff --git a/src/graphics/GPUInvertFilter.cpp b/src/graphics/GPUInvertFilter.cpp
index ae6af1e..4f98050 100644
--- a/src/graphics/GPUInvertFilter.cpp
+++ b/src/graphics/GPUInvertFilter.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -21,23 +21,23 @@
#include "GPUInvertFilter.h"
#include "ShaderRegistry.h"
+#include "OGLShader.h"
#include "../base/ObjectCounter.h"
#include "../base/Logger.h"
-#define SHADERID_INVERT_COLOR "INVERT_COLOR"
+#define SHADERID_INVERT_COLOR "invert"
using namespace std;
namespace avg {
-GPUInvertFilter::GPUInvertFilter(const IntPoint& size, PixelFormat pf,
- bool bStandalone) :
- GPUFilter(pf, B8G8R8A8, bStandalone, 2)
+GPUInvertFilter::GPUInvertFilter(const IntPoint& size, bool bUseAlpha, bool bStandalone)
+ : GPUFilter(SHADERID_INVERT_COLOR, bUseAlpha, bStandalone)
{
ObjectCounter::get()->incRef(&typeid(*this));
setDimensions(size);
- initShader();
+ m_pTextureParam = getShader()->getParam<int>("u_Texture");
}
GPUInvertFilter::~GPUInvertFilter()
@@ -47,32 +47,10 @@ GPUInvertFilter::~GPUInvertFilter()
void GPUInvertFilter::applyOnGPU(GLTexturePtr pSrcTex)
{
- OGLShaderPtr pShader = getShader(SHADERID_INVERT_COLOR);
- glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT);
- pShader->activate();
- pShader->setUniformIntParam("texture", 0);
+ getShader()->activate();
+ m_pTextureParam->set(0);
draw(pSrcTex);
- glproc::UseProgramObject(0);
}
-void GPUInvertFilter::initShader()
-{
- string sProgramHead =
- "uniform sampler2D texture;\n"
- +getStdShaderCode()
- ;
- string sProgram = sProgramHead +
- "void main(void)\n"
- "{\n"
- " float hue, s, l;\n"
- " vec4 tex = texture2D(texture, gl_TexCoord[0].st);\n"
- " unPreMultiplyAlpha(tex);\n"
- " rgb2hsl(tex, hue, s, l);\n"
- " vec4 result = vec4(hsl2rgb(hue, s, 1.0-l), tex.a);\n"
- " preMultiplyAlpha(result);\n"
- " gl_FragColor = result;\n"
- "}\n";
- getOrCreateShader(SHADERID_INVERT_COLOR, sProgram);
}
-}//End namespace avg
diff --git a/src/graphics/GPUInvertFilter.h b/src/graphics/GPUInvertFilter.h
index 1997639..eb5f6f4 100644
--- a/src/graphics/GPUInvertFilter.h
+++ b/src/graphics/GPUInvertFilter.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -26,22 +26,24 @@
#include "../api.h"
#include "GPUFilter.h"
+#include "GLShaderParam.h"
namespace avg {
class AVG_API GPUInvertFilter : public GPUFilter
{
public:
- GPUInvertFilter(const IntPoint& size, PixelFormat pf,
- bool bStandalone=true);
+ GPUInvertFilter(const IntPoint& size, bool bUseAlpha, bool bStandalone=true);
virtual ~GPUInvertFilter();
virtual void applyOnGPU(GLTexturePtr pSrcTex);
void initShader();
+private:
+ IntGLShaderParamPtr m_pTextureParam;
};
typedef boost::shared_ptr<GPUInvertFilter> GPUInvertFilterPtr;
-} //end namespace avg
+}
#endif
diff --git a/src/graphics/GPUNullFilter.cpp b/src/graphics/GPUNullFilter.cpp
index 1d7066d..4a87c28 100644
--- a/src/graphics/GPUNullFilter.cpp
+++ b/src/graphics/GPUNullFilter.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -22,25 +22,27 @@
#include "GPUNullFilter.h"
#include "Bitmap.h"
#include "ShaderRegistry.h"
+#include "OGLShader.h"
+#include "BitmapLoader.h"
#include "../base/ObjectCounter.h"
#include "../base/Exception.h"
#include <iostream>
-#define SHADERID "NULL"
+#define SHADERID "null"
using namespace std;
namespace avg {
GPUNullFilter::GPUNullFilter(const IntPoint& size, bool bStandalone)
- : GPUFilter(B8G8R8A8, B8G8R8A8, bStandalone)
+ : GPUFilter(SHADERID, true, bStandalone)
{
ObjectCounter::get()->incRef(&typeid(*this));
setDimensions(size);
- initShader();
+ m_pTextureParam = getShader()->getParam<int>("u_Texture");
}
GPUNullFilter::~GPUNullFilter()
@@ -50,27 +52,10 @@ GPUNullFilter::~GPUNullFilter()
void GPUNullFilter::applyOnGPU(GLTexturePtr pSrcTex)
{
- OGLShaderPtr pShader = getShader(SHADERID);
- pShader->activate();
- pShader->setUniformIntParam("Texture", 0);
+ getShader()->activate();
+ m_pTextureParam->set(0);
draw(pSrcTex);
- glproc::UseProgramObject(0);
}
-void GPUNullFilter::initShader()
-{
- string sProgram =
- "uniform sampler2D Texture;\n"
-
- "void main(void)\n"
- "{\n"
- " vec4 tex = texture2D(Texture, gl_TexCoord[0].st);\n"
- " gl_FragColor = tex;\n"
- "}\n"
- ;
-
- getOrCreateShader(SHADERID, sProgram);
}
-
-} // namespace
diff --git a/src/graphics/GPUNullFilter.h b/src/graphics/GPUNullFilter.h
index 27a6be1..f120c0d 100644
--- a/src/graphics/GPUNullFilter.h
+++ b/src/graphics/GPUNullFilter.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -24,6 +24,7 @@
#include "../api.h"
#include "GPUFilter.h"
+#include "GLShaderParam.h"
#include "Bitmap.h"
namespace avg {
@@ -37,7 +38,7 @@ public:
virtual void applyOnGPU(GLTexturePtr pSrcTex);
private:
- void initShader();
+ IntGLShaderParamPtr m_pTextureParam;
};
typedef boost::shared_ptr<GPUNullFilter> GPUNullFilterPtr;
diff --git a/src/graphics/GPURGB2YUVFilter.cpp b/src/graphics/GPURGB2YUVFilter.cpp
index 2a2500a..c40de13 100644
--- a/src/graphics/GPURGB2YUVFilter.cpp
+++ b/src/graphics/GPURGB2YUVFilter.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -22,6 +22,7 @@
#include "GPURGB2YUVFilter.h"
#include "Bitmap.h"
#include "ShaderRegistry.h"
+#include "OGLShader.h"
#include "ImagingProjection.h"
#include "../base/ObjectCounter.h"
@@ -31,19 +32,18 @@
#include <string.h>
#include <iostream>
-#define SHADERID "RGB2YUV"
+#define SHADERID "rgb2yuv"
using namespace std;
namespace avg {
GPURGB2YUVFilter::GPURGB2YUVFilter(const IntPoint& size)
- : GPUFilter(B8G8R8X8, B8G8R8X8, false)
+ : GPUFilter(SHADERID, false, false)
{
ObjectCounter::get()->incRef(&typeid(*this));
setDimensions(size);
- initShader();
}
GPURGB2YUVFilter::~GPURGB2YUVFilter()
@@ -53,11 +53,9 @@ GPURGB2YUVFilter::~GPURGB2YUVFilter()
void GPURGB2YUVFilter::applyOnGPU(GLTexturePtr pSrcTex)
{
- OGLShaderPtr pShader = getShader(SHADERID);
- pShader->activate();
+ getShader()->activate();
draw(pSrcTex);
- glproc::UseProgramObject(0);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "GPURGB2YUVFilter::applyOnGPU()");
+ GLContext::checkError("GPURGB2YUVFilter::applyOnGPU()");
}
BitmapPtr GPURGB2YUVFilter::getResults()
@@ -67,22 +65,4 @@ BitmapPtr GPURGB2YUVFilter::getResults()
return pBmp;
}
-void GPURGB2YUVFilter::initShader()
-{
- // Uses jpeg coefficients.
- string sProgram =
- "uniform sampler2D texture;\n"
- "\n"
- "void main(void)\n"
- "{\n"
- " vec4 tex = texture2D(texture, gl_TexCoord[0].st);\n"
- " float y = 0.299*tex.r + 0.587*tex.g + 0.114*tex.b;\n"
- " float u = -0.168*tex.r - 0.330*tex.g + 0.498*tex.b + 0.5;\n"
- " float v = 0.498*tex.r - 0.417*tex.g - 0.081*tex.b + 0.5;\n"
- " gl_FragColor = vec4(v,u,y,1);\n"
- "}\n"
- ;
- getOrCreateShader(SHADERID, sProgram);
-}
-
}
diff --git a/src/graphics/GPURGB2YUVFilter.h b/src/graphics/GPURGB2YUVFilter.h
index 9dc9957..9e77ee8 100644
--- a/src/graphics/GPURGB2YUVFilter.h
+++ b/src/graphics/GPURGB2YUVFilter.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -39,7 +39,6 @@ public:
BitmapPtr getResults();
private:
- void initShader();
};
typedef boost::shared_ptr<GPURGB2YUVFilter> GPURGB2YUVFilterPtr;
diff --git a/src/graphics/GPUShadowFilter.cpp b/src/graphics/GPUShadowFilter.cpp
index a435e5f..6c8f0ec 100644
--- a/src/graphics/GPUShadowFilter.cpp
+++ b/src/graphics/GPUShadowFilter.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -22,6 +22,7 @@
#include "GPUShadowFilter.h"
#include "Bitmap.h"
#include "ShaderRegistry.h"
+#include "OGLShader.h"
#include "ImagingProjection.h"
#include "../base/ObjectCounter.h"
@@ -31,22 +32,40 @@
#include <string.h>
#include <iostream>
-#define SHADERID_HORIZ "HORIZBLUR"
-#define SHADERID_VERT "VERTBLUR"
+#define SHADERID_HORIZ "horizshadow"
+#define SHADERID_VERT "vertshadow"
using namespace std;
namespace avg {
-GPUShadowFilter::GPUShadowFilter(const IntPoint& size, const DPoint& offset,
- double stdDev, double opacity, const Pixel32& color)
- : GPUFilter(B8G8R8A8, B8G8R8A8, false, 2)
+GPUShadowFilter::GPUShadowFilter(const IntPoint& size, const glm::vec2& offset,
+ float stdDev, float opacity, const Pixel32& color)
+ : GPUFilter(SHADERID_HORIZ, true, false, 2)
{
ObjectCounter::get()->incRef(&typeid(*this));
+ GLContext::getCurrent()->ensureFullShaders("GPUShadowFilter");
+
setDimensions(size, stdDev, offset);
- initShaders();
+ createShader(SHADERID_VERT);
setParams(offset, stdDev, opacity, color);
+ OGLShaderPtr pShader = getShader();
+ m_pHorizWidthParam = pShader->getParam<float>("u_Width");
+ m_pHorizRadiusParam = pShader->getParam<int>("u_Radius");
+ m_pHorizTextureParam = pShader->getParam<int>("u_Texture");
+ m_pHorizKernelTexParam = pShader->getParam<int>("u_KernelTex");
+ m_pHorizOffsetParam = pShader->getParam<glm::vec2>("u_Offset");
+
+ pShader = avg::getShader(SHADERID_VERT);
+ m_pVertWidthParam = pShader->getParam<float>("u_Width");
+ m_pVertRadiusParam = pShader->getParam<int>("u_Radius");
+ m_pVertTextureParam = pShader->getParam<int>("u_HBlurTex");
+ m_pVertKernelTexParam = pShader->getParam<int>("u_KernelTex");
+ m_pVertColorParam = pShader->getParam<Pixel32>("u_Color");
+ m_pVertOrigTexParam = pShader->getParam<int>("u_OrigTex");
+ m_pVertDestPosParam = pShader->getParam<glm::vec2>("u_DestPos");
+ m_pVertDestSizeParam = pShader->getParam<glm::vec2>("u_DestSize");
}
GPUShadowFilter::~GPUShadowFilter()
@@ -54,14 +73,14 @@ GPUShadowFilter::~GPUShadowFilter()
ObjectCounter::get()->decRef(&typeid(*this));
}
-void GPUShadowFilter::setParams(const DPoint& offset, double stdDev, double opacity,
+void GPUShadowFilter::setParams(const glm::vec2& offset, float stdDev, float opacity,
const Pixel32& color)
{
m_Offset = offset;
m_StdDev = stdDev;
m_Opacity = opacity;
m_Color = color;
- m_pGaussCurveTex = calcBlurKernelTex(m_StdDev, m_Opacity);
+ m_pGaussCurveTex = calcBlurKernelTex(m_StdDev, m_Opacity, false);
setDimensions(getSrcSize(), stdDev, offset);
IntRect destRect2(IntPoint(0,0), getDestRect().size());
m_pProjection2 = ImagingProjectionPtr(new ImagingProjection(
@@ -71,104 +90,47 @@ void GPUShadowFilter::setParams(const DPoint& offset, double stdDev, double opac
void GPUShadowFilter::applyOnGPU(GLTexturePtr pSrcTex)
{
int kernelWidth = m_pGaussCurveTex->getSize().x;
- glDrawBuffer(GL_COLOR_ATTACHMENT1_EXT);
- OGLShaderPtr pHShader = getShader(SHADERID_HORIZ);
- pHShader->activate();
- pHShader->setUniformFloatParam("width", float(kernelWidth));
- pHShader->setUniformIntParam("radius", (kernelWidth-1)/2);
- pHShader->setUniformIntParam("texture", 0);
- pHShader->setUniformIntParam("kernelTex", 1);
+ getFBO(1)->activate();
+ getShader()->activate();
+ m_pHorizWidthParam->set(float(kernelWidth));
+ m_pHorizRadiusParam->set((kernelWidth-1)/2);
+ m_pHorizTextureParam->set(0);
+ m_pHorizKernelTexParam->set(1);
IntPoint size = getSrcSize();
- DPoint texOffset = DPoint(m_Offset.x/size.x, m_Offset.y/size.y);
- pHShader->setUniformDPointParam("offset", texOffset);
+ glm::vec2 texOffset(m_Offset.x/size.x, m_Offset.y/size.y);
+ m_pHorizOffsetParam->set(texOffset);
m_pGaussCurveTex->activate(GL_TEXTURE1);
draw(pSrcTex);
- m_pProjection2->activate();
- glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT);
- OGLShaderPtr pVShader = getShader(SHADERID_VERT);
+ getFBO(0)->activate();
+ OGLShaderPtr pVShader = avg::getShader(SHADERID_VERT);
pVShader->activate();
- pVShader->setUniformFloatParam("width", float(kernelWidth));
- pVShader->setUniformIntParam("radius", (kernelWidth-1)/2);
- pVShader->setUniformIntParam("hBlurTex", 0);
- pVShader->setUniformIntParam("kernelTex", 1);
- pVShader->setUniformColorParam("color", m_Color);
+ m_pVertWidthParam->set(float(kernelWidth));
+ m_pVertRadiusParam->set((kernelWidth-1)/2);
+ m_pVertTextureParam->set(0);
+ m_pVertKernelTexParam->set(1);
+ m_pVertColorParam->set(m_Color);
pSrcTex->activate(GL_TEXTURE2);
- pVShader->setUniformIntParam("origTex", 2);
- DRect destRect = getRelDestRect();
- pVShader->setUniformDPointParam("destPos", destRect.tl);
- pVShader->setUniformDPointParam("destSize", destRect.size());
+ m_pVertOrigTexParam->set(2);
+ FRect destRect = getRelDestRect();
+ m_pVertDestPosParam->set(destRect.tl);
+ m_pVertDestSizeParam->set(destRect.size());
getDestTex(1)->activate(GL_TEXTURE0);
- m_pProjection2->draw();
- glproc::UseProgramObject(0);
-}
-
-void GPUShadowFilter::initShaders()
-{
- string sProgramHead =
- "uniform float width;\n"
- "uniform int radius;\n"
- "uniform sampler2D kernelTex;\n"
- + getStdShaderCode()
- ;
-
- string sHorizProgram = sProgramHead +
- "uniform sampler2D texture;\n"
- "uniform vec2 offset;\n"
- "void main(void)\n"
- "{\n"
- " float sum = 0.;\n"
- " float dx = dFdx(gl_TexCoord[0].x);\n"
- " for (int i=-radius; i<=radius; ++i) {\n"
- " float a = texture2D(texture,\n"
- " gl_TexCoord[0].st-offset+vec2(float(i)*dx,0)).a;\n"
- " float coeff = \n"
- " texture2D(kernelTex, vec2((float(i+radius)+0.5)/width,0)).r;\n"
- " sum += a*coeff;\n"
- " }\n"
- " gl_FragColor = vec4(sum, sum, sum, sum);\n"
- "}\n"
- ;
- getOrCreateShader(SHADERID_HORIZ, sHorizProgram);
-
- string sVertProgram = sProgramHead +
- "uniform sampler2D hBlurTex;\n"
- "uniform sampler2D origTex;\n"
- "uniform float gamma;\n"
- "uniform vec4 color;\n"
- "uniform vec2 destPos;\n"
- "uniform vec2 destSize;\n"
- "void main(void)\n"
- "{\n"
- " float sum = 0.;\n"
- " float dy = dFdy(gl_TexCoord[0].y);\n"
- " for (int i=-radius; i<=radius; ++i) {\n"
- " float a = texture2D(hBlurTex,\n"
- " gl_TexCoord[0].st+vec2(0,float(i)*dy)).a;\n"
- " float coeff = \n"
- " texture2D(kernelTex, vec2((float(i+radius)+0.5)/width,0)).r;\n"
- " sum += a*coeff;\n"
- " }\n"
- " sum = min(1., sum);\n"
- " vec2 origCoord = gl_TexCoord[0].st;\n"
- " origCoord = destPos + \n"
- " vec2(origCoord.s*destSize.x, origCoord.t*destSize.y);\n"
- " vec4 origCol = texture2D(origTex, origCoord);\n"
- " gl_FragColor = origCol+(1.-origCol.a)*color*sum;\n"
- "}\n"
- ;
- getOrCreateShader(SHADERID_VERT, sVertProgram);
+ m_pProjection2->draw(avg::getShader(SHADERID_VERT));
}
-void GPUShadowFilter::setDimensions(IntPoint size, double stdDev, const DPoint& offset)
+void GPUShadowFilter::setDimensions(IntPoint size, float stdDev, const glm::vec2& offset)
{
int radius = getBlurKernelRadius(stdDev);
IntPoint radiusOffset(radius, radius);
IntPoint intOffset(offset);
IntRect destRect(intOffset-radiusOffset, intOffset+size+radiusOffset+IntPoint(1,1));
destRect.expand(IntRect(IntPoint(0,0), size));
- GPUFilter::setDimensions(size, destRect, GL_CLAMP_TO_BORDER);
+ //TODO FIX OPENGLESV2
+ #ifndef AVG_ENABLE_EGL
+ GPUFilter::setDimensions(size, destRect, GL_CLAMP_TO_BORDER);
+ #endif
}
}
diff --git a/src/graphics/GPUShadowFilter.h b/src/graphics/GPUShadowFilter.h
index 4ff3426..2e6a53f 100644
--- a/src/graphics/GPUShadowFilter.h
+++ b/src/graphics/GPUShadowFilter.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -24,38 +24,53 @@
#include "../api.h"
#include "GPUFilter.h"
+#include "GLShaderParam.h"
#include "GLTexture.h"
+#include "../base/GLMHelper.h"
+
namespace avg {
class AVG_API GPUShadowFilter: public GPUFilter
{
public:
- GPUShadowFilter(const IntPoint& size, const DPoint& offset, double stdDev,
- double opacity, const Pixel32& color);
+ GPUShadowFilter(const IntPoint& size, const glm::vec2& offset, float stdDev,
+ float opacity, const Pixel32& color);
virtual ~GPUShadowFilter();
- void setParams(const DPoint& offset, double stdDev, double opacity,
+ void setParams(const glm::vec2& offset, float stdDev, float opacity,
const Pixel32& color);
virtual void applyOnGPU(GLTexturePtr pSrcTex);
private:
- void initShaders();
- void dumpKernel();
- void calcKernel();
- void setDimensions(IntPoint size, double stdDev, const DPoint& offset);
-
- DPoint m_Offset;
- double m_StdDev;
- double m_Opacity;
+ void setDimensions(IntPoint size, float stdDev, const glm::vec2& offset);
+
+ glm::vec2 m_Offset;
+ float m_StdDev;
+ float m_Opacity;
Pixel32 m_Color;
GLTexturePtr m_pGaussCurveTex;
ImagingProjectionPtr m_pProjection2;
+
+ FloatGLShaderParamPtr m_pHorizWidthParam;
+ IntGLShaderParamPtr m_pHorizRadiusParam;
+ IntGLShaderParamPtr m_pHorizTextureParam;
+ IntGLShaderParamPtr m_pHorizKernelTexParam;
+ Vec2fGLShaderParamPtr m_pHorizOffsetParam;
+
+ FloatGLShaderParamPtr m_pVertWidthParam;
+ IntGLShaderParamPtr m_pVertRadiusParam;
+ IntGLShaderParamPtr m_pVertTextureParam;
+ IntGLShaderParamPtr m_pVertKernelTexParam;
+ ColorGLShaderParamPtr m_pVertColorParam;
+ IntGLShaderParamPtr m_pVertOrigTexParam;
+ Vec2fGLShaderParamPtr m_pVertDestPosParam;
+ Vec2fGLShaderParamPtr m_pVertDestSizeParam;
};
typedef boost::shared_ptr<GPUShadowFilter> GPUShadowFilterPtr;
-} // namespace
+}
#endif
diff --git a/src/graphics/GraphicsTest.cpp b/src/graphics/GraphicsTest.cpp
index 03aead7..9d517f5 100644
--- a/src/graphics/GraphicsTest.cpp
+++ b/src/graphics/GraphicsTest.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -21,6 +21,7 @@
#include "GraphicsTest.h"
#include "Bitmap.h"
+#include "BitmapLoader.h"
#include "Filterfliprgb.h"
#include "Filtergrayscale.h"
@@ -58,11 +59,8 @@ void GraphicsTest::createResultImgDir()
BitmapPtr GraphicsTest::loadTestBmp(const std::string& sFName, PixelFormat pf)
{
try {
- BitmapPtr pBmp(new Bitmap(getSrcDirName()+"testfiles/"+sFName+".png"));
- if (pf == I8) {
- return FilterGrayscale().apply(pBmp);
- }
- return pBmp;
+ string sFullName = getSrcDirName()+"../test/media/"+sFName+".png";
+ return loadBitmap(sFullName, pf);
} catch (Exception & ex) {
cerr << ex.getStr() << endl;
throw;
@@ -70,18 +68,12 @@ BitmapPtr GraphicsTest::loadTestBmp(const std::string& sFName, PixelFormat pf)
}
void GraphicsTest::testEqual(Bitmap& resultBmp, const string& sFName, PixelFormat pf,
- double maxAverage, double maxStdDev)
+ float maxAverage, float maxStdDev)
{
BitmapPtr pBaselineBmp;
try {
- pBaselineBmp = BitmapPtr(new Bitmap(getSrcDirName()+"baseline/"+sFName+".png"));
- switch (pf) {
- case I8:
- FilterGrayscale().applyInPlace(pBaselineBmp);
- break;
- default:
- break;
- }
+ string sFullName = getSrcDirName()+"baseline/"+sFName+".png";
+ pBaselineBmp = loadBitmap(sFullName, pf);
} catch (Exception & ex) {
cerr << ex.getStr() << endl;
resultBmp.save("resultimages/"+sFName+".png");
@@ -91,7 +83,7 @@ void GraphicsTest::testEqual(Bitmap& resultBmp, const string& sFName, PixelForma
}
void GraphicsTest::testEqual(Bitmap& resultBmp, Bitmap& baselineBmp,
- const string& sFName, double maxAverage, double maxStdDev)
+ const string& sFName, float maxAverage, float maxStdDev)
{
BitmapPtr pDiffBmp;
try {
@@ -103,8 +95,8 @@ void GraphicsTest::testEqual(Bitmap& resultBmp, Bitmap& baselineBmp,
baselineBmp.save(sResultName+"_baseline.png");
}
if (pDiffBmp) {
- double average = pDiffBmp->getAvg();
- double stdDev = pDiffBmp->getStdDev();
+ float average = pDiffBmp->getAvg();
+ float stdDev = pDiffBmp->getStdDev();
if (average > maxAverage || stdDev > maxStdDev) {
TEST_FAILED("Error: Decoded image differs from baseline '" <<
sFName << "'. average=" << average << ", stdDev=" << stdDev);
@@ -120,9 +112,9 @@ void GraphicsTest::testEqual(Bitmap& resultBmp, Bitmap& baselineBmp,
}
void GraphicsTest::testEqualBrightness(Bitmap& resultBmp, Bitmap& baselineBmp,
- double epsilon)
+ float epsilon)
{
- double diff = fabs(resultBmp.getAvg()-baselineBmp.getAvg());
+ float diff = fabs(resultBmp.getAvg()-baselineBmp.getAvg());
if (diff >= epsilon) {
TEST_FAILED("Error: Baseline brightness: " << baselineBmp.getAvg()
<< ", Result brightness: " << resultBmp.getAvg() << ", difference: "
diff --git a/src/graphics/GraphicsTest.h b/src/graphics/GraphicsTest.h
index ad3bd9b..951bcef 100644
--- a/src/graphics/GraphicsTest.h
+++ b/src/graphics/GraphicsTest.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -37,11 +37,11 @@ public:
protected:
BitmapPtr loadTestBmp(const std::string& sFName, PixelFormat pf = NO_PIXELFORMAT);
virtual void testEqual(Bitmap& resultBmp, const std::string& sFName,
- PixelFormat pf = NO_PIXELFORMAT, double maxAverage=0.01,
- double maxStdDev=0.05);
+ PixelFormat pf = NO_PIXELFORMAT, float maxAverage=0.01f,
+ float maxStdDev=0.05f);
virtual void testEqual(Bitmap& resultBmp, Bitmap& baselineBmp,
- const std::string& sFName, double maxAverage=0.01, double maxStdDev=0.05);
- void testEqualBrightness(Bitmap& resultBmp, Bitmap& baselineBmp, double epsilon);
+ const std::string& sFName, float maxAverage=0.01f, float maxStdDev=0.05f);
+ void testEqualBrightness(Bitmap& resultBmp, Bitmap& baselineBmp, float epsilon);
private:
int sumPixels(Bitmap& bmp);
diff --git a/src/graphics/HistoryPreProcessor.cpp b/src/graphics/HistoryPreProcessor.cpp
index 9c9f5eb..673df90 100644
--- a/src/graphics/HistoryPreProcessor.cpp
+++ b/src/graphics/HistoryPreProcessor.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/graphics/HistoryPreProcessor.h b/src/graphics/HistoryPreProcessor.h
index e4984e1..f56a7a3 100644
--- a/src/graphics/HistoryPreProcessor.h
+++ b/src/graphics/HistoryPreProcessor.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/graphics/ImagingProjection.cpp b/src/graphics/ImagingProjection.cpp
index 9aef8b2..1ab33b7 100644
--- a/src/graphics/ImagingProjection.cpp
+++ b/src/graphics/ImagingProjection.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -21,18 +21,23 @@
#include "ImagingProjection.h"
+#include "GLContext.h"
+#include "OGLShader.h"
+
#include "../base/Exception.h"
namespace avg {
ImagingProjection::ImagingProjection(IntPoint size)
- : m_pVA(new VertexArray)
+ : m_Color(0, 0, 0, 0),
+ m_pVA(new VertexArray)
{
init(size, IntRect(IntPoint(0,0), size));
}
ImagingProjection::ImagingProjection(IntPoint srcSize, IntRect destRect)
- : m_pVA(new VertexArray)
+ : m_Color(0, 0, 0, 0),
+ m_pVA(new VertexArray)
{
init(srcSize, destRect);
}
@@ -41,26 +46,19 @@ ImagingProjection::~ImagingProjection()
{
}
-void ImagingProjection::activate()
+void ImagingProjection::setColor(const Pixel32& color)
{
- IntPoint destSize = m_DestRect.size();
- glViewport(0, 0, destSize.x, destSize.y);
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- gluOrtho2D(0, destSize.x, 0, destSize.y);
-
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- IntPoint offset = m_DestRect.tl;
- glTranslated(-offset.x, -offset.y, 0);
- glScaled(m_SrcSize.x, m_SrcSize.y, 1);
-
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "ImagingProjection::activate()");
+ if (color != m_Color) {
+ m_Color = color;
+ init(m_SrcSize, m_DestRect);
+ }
}
-void ImagingProjection::draw()
+void ImagingProjection::draw(const OGLShaderPtr& pShader)
{
+ IntPoint destSize = m_DestRect.size();
+ glViewport(0, 0, destSize.x, destSize.y);
+ pShader->setTransform(m_ProjMat);
m_pVA->draw();
}
@@ -68,17 +66,25 @@ void ImagingProjection::init(IntPoint srcSize, IntRect destRect)
{
m_SrcSize = srcSize;
m_DestRect = destRect;
- DRect dest = destRect;
- DPoint p1 = DPoint(dest.tl.x/srcSize.x, dest.tl.y/srcSize.y);
- DPoint p3 = DPoint(dest.br.x/srcSize.x, dest.br.y/srcSize.y);
- DPoint p2 = DPoint(p1.x, p3.y);
- DPoint p4 = DPoint(p3.x, p1.y);
+ FRect dest = destRect;
+ glm::vec2 p1(dest.tl.x/srcSize.x, dest.tl.y/srcSize.y);
+ glm::vec2 p3(dest.br.x/srcSize.x, dest.br.y/srcSize.y);
+ glm::vec2 p2(p1.x, p3.y);
+ glm::vec2 p4(p3.x, p1.y);
m_pVA->reset();
- m_pVA->appendPos(p1, p1);
- m_pVA->appendPos(p2, p2);
- m_pVA->appendPos(p3, p3);
- m_pVA->appendPos(p4, p4);
+ m_pVA->appendPos(p1, p1, m_Color);
+ m_pVA->appendPos(p2, p2, m_Color);
+ m_pVA->appendPos(p3, p3, m_Color);
+ m_pVA->appendPos(p4, p4, m_Color);
m_pVA->appendQuadIndexes(1,0,2,3);
+
+ IntPoint destSize = m_DestRect.size();
+ glm::mat4 projMat(glm::ortho(0.f, float(destSize.x), 0.f, float(destSize.y)));
+
+ glm::vec3 offset(-m_DestRect.tl.x, -m_DestRect.tl.y, 0);
+ glm::mat4 transform = glm::translate(projMat, offset);
+ glm::vec3 size(m_SrcSize.x, m_SrcSize.y, 1);
+ m_ProjMat = glm::scale(transform, size);
}
}
diff --git a/src/graphics/ImagingProjection.h b/src/graphics/ImagingProjection.h
index 79a186c..b378bd9 100644
--- a/src/graphics/ImagingProjection.h
+++ b/src/graphics/ImagingProjection.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -25,11 +25,15 @@
#include "../api.h"
#include "VertexArray.h"
-#include "../base/Point.h"
+#include "GLShaderParam.h"
+
#include "../base/Rect.h"
namespace avg {
+class OGLShader;
+typedef boost::shared_ptr<OGLShader> OGLShaderPtr;
+
class AVG_API ImagingProjection
{
public:
@@ -37,8 +41,8 @@ public:
ImagingProjection(IntPoint srcSize, IntRect destRect);
virtual ~ImagingProjection();
- void activate();
- void draw();
+ void setColor(const Pixel32& color);
+ void draw(const OGLShaderPtr& pShader);
private:
void init(IntPoint srcSize, IntRect destRect);
@@ -46,7 +50,10 @@ private:
IntPoint m_SrcSize;
IntRect m_DestRect;
IntPoint m_Offset;
+ Pixel32 m_Color;
VertexArrayPtr m_pVA;
+ Mat4fGLShaderParamPtr m_pTransformParam;
+ glm::mat4 m_ProjMat;
};
typedef boost::shared_ptr<ImagingProjection> ImagingProjectionPtr;
diff --git a/src/graphics/Makefile.am b/src/graphics/Makefile.am
index 5432298..62220b3 100644
--- a/src/graphics/Makefile.am
+++ b/src/graphics/Makefile.am
@@ -1,64 +1,95 @@
-INCLUDES = -I.. @GL_CFLAGS@ @PYTHON_INCLUDES@ @GDK_PIXBUF_CFLAGS@
+SUBDIRS = shaders
-ALL_H = Bitmap.h Filter.h GLContext.h\
+AM_CPPFLAGS = -I.. @GL_CFLAGS@ @GDK_PIXBUF_CFLAGS@
+
+if APPLE
+ GL_SOURCES = CGLContext.cpp PBO.cpp AppleDisplay.cpp
+ GL_INCLUDES = CGLContext.h PBO.h AppleDisplay.h
+else
+if ENABLE_RPI
+ GL_SOURCES = EGLContext.cpp BCMDisplay.cpp X11Display.cpp
+ GL_INCLUDES = EGLContext.h BCMDisplay.h X11Display.h
+else
+if ENABLE_EGL
+ GL_SOURCES = EGLContext.cpp X11Display.cpp
+ GL_INCLUDES = EGLContext.h X11Display.h
+else
+ GL_SOURCES = GLXContext.cpp PBO.cpp X11Display.cpp
+ GL_INCLUDES = GLXContext.h PBO.h X11Display.h
+endif
+endif
+endif
+
+ALL_H = Bitmap.h Filter.h GLContext.h GLContextAttribs.h \
Pixel32.h Pixel24.h Pixel16.h Pixel8.h Pixeldefs.h PixelFormat.h \
Filtercolorize.h Filterfill.h Filterfillrect.h Filterflip.h FilterflipX.h \
Filterfliprgb.h Filterflipuv.h Filtergrayscale.h Filter3x3.h \
- FilterId.h HistoryPreProcessor.h FilterConvol.h FilterHighpass.h \
+ HistoryPreProcessor.h FilterConvol.h FilterHighpass.h \
FilterFastBandpass.h Filterfliprgba.h FilterFastDownscale.h \
FilterGauss.h FilterBandpass.h FilterBlur.h FilterMask.h \
OGLHelper.h OGLShader.h GL/gl.h GL/glext.h GL/glu.h GL/glx.h \
- VertexArray.h OGLImagingContext.h GPUNullFilter.h GPUChromaKeyFilter.h \
+ VertexArray.h GPUNullFilter.h GPUChromaKeyFilter.h Display.h \
GPUBrightnessFilter.h GPUBlurFilter.h GPUShadowFilter.h GraphicsTest.h\
GPUFilter.h GPUBandpassFilter.h GPUHueSatFilter.h GPUInvertFilter.h \
FilterIntensity.h FilterNormalize.h FilterFloodfill.h FilterDilation.h \
- FilterErosion.h FilterGetAlpha.h FBO.h GLTexture.h PBO.h TextureMover.h\
+ FilterErosion.h FilterGetAlpha.h FBO.h GLTexture.h TextureMover.h\
ContribDefs.h TwoPassScale.h FilterResizeBilinear.h FilterThreshold.h \
FilterResizeGaussian.h FilterUnmultiplyAlpha.h ShaderRegistry.h \
- ImagingProjection.h BitmapManager.h BitmapManagerThread.h \
- BitmapManagerMsg.h GLBufferCache.h GLConfig.h BmpTextureMover.h \
- GPURGB2YUVFilter.h
+ ImagingProjection.h GLBufferCache.h GLConfig.h BmpTextureMover.h \
+ GPURGB2YUVFilter.h GLShaderParam.h StandardShader.h SubVertexArray.h \
+ VertexData.h BitmapLoader.h $(GL_INCLUDES)
ALL_CPP = Bitmap.cpp Filter.cpp Pixel32.cpp Filtergrayscale.cpp PixelFormat.cpp \
Filtercolorize.cpp Filterflip.cpp FilterflipX.cpp Filterfliprgb.cpp \
Filterflipuv.cpp Filter3x3.cpp HistoryPreProcessor.cpp FilterHighpass.cpp \
FilterFastBandpass.cpp Filterfliprgba.cpp FilterFastDownscale.cpp \
FilterGauss.cpp FilterBandpass.cpp FilterBlur.cpp FilterMask.cpp \
OGLHelper.cpp OGLShader.cpp GPUNullFilter.cpp GPUChromaKeyFilter.cpp \
- GPUHueSatFilter.cpp GPUInvertFilter.cpp VertexArray.cpp OGLImagingContext.cpp \
+ Display.cpp \
+ GPUHueSatFilter.cpp GPUInvertFilter.cpp VertexArray.cpp GLContextAttribs.cpp \
GPUBrightnessFilter.cpp GPUBlurFilter.cpp GPUShadowFilter.cpp GraphicsTest.cpp \
GPUFilter.cpp GPUBandpassFilter.cpp FilterIntensity.cpp GLContext.cpp \
FilterNormalize.cpp FilterDilation.cpp FilterErosion.cpp \
- FilterGetAlpha.cpp FBO.cpp GLTexture.cpp PBO.cpp TextureMover.cpp \
+ FilterGetAlpha.cpp FBO.cpp GLTexture.cpp TextureMover.cpp \
FilterResizeBilinear.cpp FilterResizeGaussian.cpp FilterThreshold.cpp \
FilterUnmultiplyAlpha.cpp ShaderRegistry.cpp \
- ImagingProjection.cpp BitmapManager.cpp BitmapManagerThread.cpp \
- BitmapManagerMsg.cpp GLBufferCache.cpp GLConfig.cpp BmpTextureMover.cpp \
- GPURGB2YUVFilter.cpp
+ ImagingProjection.cpp GLBufferCache.cpp GLConfig.cpp BmpTextureMover.cpp \
+ GPURGB2YUVFilter.cpp GLShaderParam.cpp StandardShader.cpp SubVertexArray.cpp \
+ VertexData.cpp BitmapLoader.cpp $(GL_SOURCES)
if APPLE
X_LIBS =
else
- X_LIBS = -lX11
+if ENABLE_RPI
+ X_LIBS = -lXxf86vm -lX11 -lGLESv2 -lEGL
+else
+if ENABLE_EGL
+ X_LIBS = -lXxf86vm -lX11 -lGLESv2 -lEGL
+else
+ X_LIBS = -lXxf86vm -lX11
+endif
+endif
endif
-TESTS=testgraphics testgpu
+TESTS = testgraphics testgpu
-EXTRA_DIST = $(wildcard baseline/*.png) $(wildcard testfiles/*.png)
+EXTRA_DIST = $(wildcard baseline/*.png)
noinst_LTLIBRARIES = libgraphics.la
+noinst_PROGRAMS = testgraphics testgpu benchmarkgraphics
libgraphics_la_SOURCES = $(ALL_CPP) $(ALL_H)
-noinst_PROGRAMS=testgraphics testgpu benchmarkgraphics
-testgraphics_SOURCES=testgraphics.cpp $(ALL_H)
-testgraphics_LDADD = ./libgraphics.la ../base/libbase.la \
- @XML2_LIBS@ -l@BOOST_THREAD_LIB@ -lboost_system @PTHREAD_LIBS@ $(X_LIBS) @GDK_PIXBUF_LIBS@
+testgraphics_SOURCES = testgraphics.cpp $(ALL_H)
+testgraphics_LDADD = libgraphics.la ../base/libbase.la \
+ ../base/triangulate/libtriangulate.la \
+ @XML2_LIBS@ @BOOST_THREAD_LIBS@ @PTHREAD_LIBS@ $(X_LIBS) @GDK_PIXBUF_LIBS@
-benchmarkgraphics_SOURCES=benchmarkgraphics.cpp $(ALL_H)
-benchmarkgraphics_LDADD = ./libgraphics.la ../base/libbase.la \
- @XML2_LIBS@ -l@BOOST_THREAD_LIB@ -lboost_system @PTHREAD_LIBS@ @GDK_PIXBUF_LIBS@
+benchmarkgraphics_SOURCES = benchmarkgraphics.cpp $(ALL_H)
+benchmarkgraphics_LDADD = libgraphics.la ../base/libbase.la \
+ ../base/triangulate/libtriangulate.la \
+ @XML2_LIBS@ @BOOST_THREAD_LIBS@ @PTHREAD_LIBS@ @GDK_PIXBUF_LIBS@
-testgpu_SOURCES=testgpu.cpp $(ALL_H)
-testgpu_LDADD = ./libgraphics.la ../base/libbase.la -ldl \
- @XML2_LIBS@ -l@BOOST_THREAD_LIB@ -lboost_system @PTHREAD_LIBS@ $(X_LIBS) \
+testgpu_SOURCES = testgpu.cpp $(ALL_H)
+testgpu_LDADD = libgraphics.la ../base/libbase.la -ldl \
+ ../base/triangulate/libtriangulate.la \
+ @XML2_LIBS@ @BOOST_THREAD_LIBS@ @PTHREAD_LIBS@ $(X_LIBS) \
@GL_LIBS@ @GLU_LIBS@ @SDL_LIBS@ \
@GDK_PIXBUF_LIBS@
-
diff --git a/src/graphics/Makefile.in b/src/graphics/Makefile.in
index e3d238e..c9c5867 100644
--- a/src/graphics/Makefile.in
+++ b/src/graphics/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# Makefile.in generated by automake 1.11.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
-# Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -45,11 +45,12 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ac_cxx_namespaces.m4 \
$(top_srcdir)/m4/ac_path_generic.m4 \
$(top_srcdir)/m4/ax_boost_thread.m4 \
- $(top_srcdir)/m4/ax_check_gl.m4 $(top_srcdir)/m4/libtool.m4 \
- $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
- $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
- $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/m4/python_dev.m4 \
- $(top_srcdir)/configure.in
+ $(top_srcdir)/m4/ax_check_gl.m4 \
+ $(top_srcdir)/m4/ax_python_devel.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/pkg.m4 \
+ $(top_srcdir)/m4/avg_version.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
@@ -58,44 +59,169 @@ CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
LTLIBRARIES = $(noinst_LTLIBRARIES)
libgraphics_la_LIBADD =
-am__objects_1 = Bitmap.lo Filter.lo Pixel32.lo Filtergrayscale.lo \
+am__libgraphics_la_SOURCES_DIST = Bitmap.cpp Filter.cpp Pixel32.cpp \
+ Filtergrayscale.cpp PixelFormat.cpp Filtercolorize.cpp \
+ Filterflip.cpp FilterflipX.cpp Filterfliprgb.cpp \
+ Filterflipuv.cpp Filter3x3.cpp HistoryPreProcessor.cpp \
+ FilterHighpass.cpp FilterFastBandpass.cpp Filterfliprgba.cpp \
+ FilterFastDownscale.cpp FilterGauss.cpp FilterBandpass.cpp \
+ FilterBlur.cpp FilterMask.cpp OGLHelper.cpp OGLShader.cpp \
+ GPUNullFilter.cpp GPUChromaKeyFilter.cpp Display.cpp \
+ GPUHueSatFilter.cpp GPUInvertFilter.cpp VertexArray.cpp \
+ GLContextAttribs.cpp GPUBrightnessFilter.cpp GPUBlurFilter.cpp \
+ GPUShadowFilter.cpp GraphicsTest.cpp GPUFilter.cpp \
+ GPUBandpassFilter.cpp FilterIntensity.cpp GLContext.cpp \
+ FilterNormalize.cpp FilterDilation.cpp FilterErosion.cpp \
+ FilterGetAlpha.cpp FBO.cpp GLTexture.cpp TextureMover.cpp \
+ FilterResizeBilinear.cpp FilterResizeGaussian.cpp \
+ FilterThreshold.cpp FilterUnmultiplyAlpha.cpp \
+ ShaderRegistry.cpp ImagingProjection.cpp GLBufferCache.cpp \
+ GLConfig.cpp BmpTextureMover.cpp GPURGB2YUVFilter.cpp \
+ GLShaderParam.cpp StandardShader.cpp SubVertexArray.cpp \
+ VertexData.cpp BitmapLoader.cpp GLXContext.cpp PBO.cpp \
+ X11Display.cpp EGLContext.cpp BCMDisplay.cpp CGLContext.cpp \
+ AppleDisplay.cpp Bitmap.h Filter.h GLContext.h \
+ GLContextAttribs.h Pixel32.h Pixel24.h Pixel16.h Pixel8.h \
+ Pixeldefs.h PixelFormat.h Filtercolorize.h Filterfill.h \
+ Filterfillrect.h Filterflip.h FilterflipX.h Filterfliprgb.h \
+ Filterflipuv.h Filtergrayscale.h Filter3x3.h \
+ HistoryPreProcessor.h FilterConvol.h FilterHighpass.h \
+ FilterFastBandpass.h Filterfliprgba.h FilterFastDownscale.h \
+ FilterGauss.h FilterBandpass.h FilterBlur.h FilterMask.h \
+ OGLHelper.h OGLShader.h GL/gl.h GL/glext.h GL/glu.h GL/glx.h \
+ VertexArray.h GPUNullFilter.h GPUChromaKeyFilter.h Display.h \
+ GPUBrightnessFilter.h GPUBlurFilter.h GPUShadowFilter.h \
+ GraphicsTest.h GPUFilter.h GPUBandpassFilter.h \
+ GPUHueSatFilter.h GPUInvertFilter.h FilterIntensity.h \
+ FilterNormalize.h FilterFloodfill.h FilterDilation.h \
+ FilterErosion.h FilterGetAlpha.h FBO.h GLTexture.h \
+ TextureMover.h ContribDefs.h TwoPassScale.h \
+ FilterResizeBilinear.h FilterThreshold.h \
+ FilterResizeGaussian.h FilterUnmultiplyAlpha.h \
+ ShaderRegistry.h ImagingProjection.h GLBufferCache.h \
+ GLConfig.h BmpTextureMover.h GPURGB2YUVFilter.h \
+ GLShaderParam.h StandardShader.h SubVertexArray.h VertexData.h \
+ BitmapLoader.h GLXContext.h PBO.h X11Display.h EGLContext.h \
+ BCMDisplay.h CGLContext.h AppleDisplay.h
+@APPLE_FALSE@@ENABLE_EGL_FALSE@@ENABLE_RPI_FALSE@am__objects_1 = GLXContext.lo \
+@APPLE_FALSE@@ENABLE_EGL_FALSE@@ENABLE_RPI_FALSE@ PBO.lo \
+@APPLE_FALSE@@ENABLE_EGL_FALSE@@ENABLE_RPI_FALSE@ X11Display.lo
+@APPLE_FALSE@@ENABLE_EGL_TRUE@@ENABLE_RPI_FALSE@am__objects_1 = \
+@APPLE_FALSE@@ENABLE_EGL_TRUE@@ENABLE_RPI_FALSE@ EGLContext.lo \
+@APPLE_FALSE@@ENABLE_EGL_TRUE@@ENABLE_RPI_FALSE@ X11Display.lo
+@APPLE_FALSE@@ENABLE_RPI_TRUE@am__objects_1 = EGLContext.lo \
+@APPLE_FALSE@@ENABLE_RPI_TRUE@ BCMDisplay.lo X11Display.lo
+@APPLE_TRUE@am__objects_1 = CGLContext.lo PBO.lo AppleDisplay.lo
+am__objects_2 = Bitmap.lo Filter.lo Pixel32.lo Filtergrayscale.lo \
PixelFormat.lo Filtercolorize.lo Filterflip.lo FilterflipX.lo \
Filterfliprgb.lo Filterflipuv.lo Filter3x3.lo \
HistoryPreProcessor.lo FilterHighpass.lo FilterFastBandpass.lo \
Filterfliprgba.lo FilterFastDownscale.lo FilterGauss.lo \
FilterBandpass.lo FilterBlur.lo FilterMask.lo OGLHelper.lo \
- OGLShader.lo GPUNullFilter.lo GPUChromaKeyFilter.lo \
+ OGLShader.lo GPUNullFilter.lo GPUChromaKeyFilter.lo Display.lo \
GPUHueSatFilter.lo GPUInvertFilter.lo VertexArray.lo \
- OGLImagingContext.lo GPUBrightnessFilter.lo GPUBlurFilter.lo \
+ GLContextAttribs.lo GPUBrightnessFilter.lo GPUBlurFilter.lo \
GPUShadowFilter.lo GraphicsTest.lo GPUFilter.lo \
GPUBandpassFilter.lo FilterIntensity.lo GLContext.lo \
FilterNormalize.lo FilterDilation.lo FilterErosion.lo \
- FilterGetAlpha.lo FBO.lo GLTexture.lo PBO.lo TextureMover.lo \
+ FilterGetAlpha.lo FBO.lo GLTexture.lo TextureMover.lo \
FilterResizeBilinear.lo FilterResizeGaussian.lo \
FilterThreshold.lo FilterUnmultiplyAlpha.lo ShaderRegistry.lo \
- ImagingProjection.lo BitmapManager.lo BitmapManagerThread.lo \
- BitmapManagerMsg.lo GLBufferCache.lo GLConfig.lo \
- BmpTextureMover.lo GPURGB2YUVFilter.lo
-am__objects_2 =
-am_libgraphics_la_OBJECTS = $(am__objects_1) $(am__objects_2)
+ ImagingProjection.lo GLBufferCache.lo GLConfig.lo \
+ BmpTextureMover.lo GPURGB2YUVFilter.lo GLShaderParam.lo \
+ StandardShader.lo SubVertexArray.lo VertexData.lo \
+ BitmapLoader.lo $(am__objects_1)
+am__objects_3 =
+am__objects_4 = $(am__objects_3)
+am_libgraphics_la_OBJECTS = $(am__objects_2) $(am__objects_4)
libgraphics_la_OBJECTS = $(am_libgraphics_la_OBJECTS)
-AM_V_lt = $(am__v_lt_$(V))
-am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
am__v_lt_0 = --silent
PROGRAMS = $(noinst_PROGRAMS)
+am__benchmarkgraphics_SOURCES_DIST = benchmarkgraphics.cpp Bitmap.h \
+ Filter.h GLContext.h GLContextAttribs.h Pixel32.h Pixel24.h \
+ Pixel16.h Pixel8.h Pixeldefs.h PixelFormat.h Filtercolorize.h \
+ Filterfill.h Filterfillrect.h Filterflip.h FilterflipX.h \
+ Filterfliprgb.h Filterflipuv.h Filtergrayscale.h Filter3x3.h \
+ HistoryPreProcessor.h FilterConvol.h FilterHighpass.h \
+ FilterFastBandpass.h Filterfliprgba.h FilterFastDownscale.h \
+ FilterGauss.h FilterBandpass.h FilterBlur.h FilterMask.h \
+ OGLHelper.h OGLShader.h GL/gl.h GL/glext.h GL/glu.h GL/glx.h \
+ VertexArray.h GPUNullFilter.h GPUChromaKeyFilter.h Display.h \
+ GPUBrightnessFilter.h GPUBlurFilter.h GPUShadowFilter.h \
+ GraphicsTest.h GPUFilter.h GPUBandpassFilter.h \
+ GPUHueSatFilter.h GPUInvertFilter.h FilterIntensity.h \
+ FilterNormalize.h FilterFloodfill.h FilterDilation.h \
+ FilterErosion.h FilterGetAlpha.h FBO.h GLTexture.h \
+ TextureMover.h ContribDefs.h TwoPassScale.h \
+ FilterResizeBilinear.h FilterThreshold.h \
+ FilterResizeGaussian.h FilterUnmultiplyAlpha.h \
+ ShaderRegistry.h ImagingProjection.h GLBufferCache.h \
+ GLConfig.h BmpTextureMover.h GPURGB2YUVFilter.h \
+ GLShaderParam.h StandardShader.h SubVertexArray.h VertexData.h \
+ BitmapLoader.h GLXContext.h PBO.h X11Display.h EGLContext.h \
+ BCMDisplay.h CGLContext.h AppleDisplay.h
am_benchmarkgraphics_OBJECTS = benchmarkgraphics.$(OBJEXT) \
- $(am__objects_2)
+ $(am__objects_4)
benchmarkgraphics_OBJECTS = $(am_benchmarkgraphics_OBJECTS)
-benchmarkgraphics_DEPENDENCIES = ./libgraphics.la ../base/libbase.la
-am_testgpu_OBJECTS = testgpu.$(OBJEXT) $(am__objects_2)
+benchmarkgraphics_DEPENDENCIES = libgraphics.la ../base/libbase.la \
+ ../base/triangulate/libtriangulate.la
+am__testgpu_SOURCES_DIST = testgpu.cpp Bitmap.h Filter.h GLContext.h \
+ GLContextAttribs.h Pixel32.h Pixel24.h Pixel16.h Pixel8.h \
+ Pixeldefs.h PixelFormat.h Filtercolorize.h Filterfill.h \
+ Filterfillrect.h Filterflip.h FilterflipX.h Filterfliprgb.h \
+ Filterflipuv.h Filtergrayscale.h Filter3x3.h \
+ HistoryPreProcessor.h FilterConvol.h FilterHighpass.h \
+ FilterFastBandpass.h Filterfliprgba.h FilterFastDownscale.h \
+ FilterGauss.h FilterBandpass.h FilterBlur.h FilterMask.h \
+ OGLHelper.h OGLShader.h GL/gl.h GL/glext.h GL/glu.h GL/glx.h \
+ VertexArray.h GPUNullFilter.h GPUChromaKeyFilter.h Display.h \
+ GPUBrightnessFilter.h GPUBlurFilter.h GPUShadowFilter.h \
+ GraphicsTest.h GPUFilter.h GPUBandpassFilter.h \
+ GPUHueSatFilter.h GPUInvertFilter.h FilterIntensity.h \
+ FilterNormalize.h FilterFloodfill.h FilterDilation.h \
+ FilterErosion.h FilterGetAlpha.h FBO.h GLTexture.h \
+ TextureMover.h ContribDefs.h TwoPassScale.h \
+ FilterResizeBilinear.h FilterThreshold.h \
+ FilterResizeGaussian.h FilterUnmultiplyAlpha.h \
+ ShaderRegistry.h ImagingProjection.h GLBufferCache.h \
+ GLConfig.h BmpTextureMover.h GPURGB2YUVFilter.h \
+ GLShaderParam.h StandardShader.h SubVertexArray.h VertexData.h \
+ BitmapLoader.h GLXContext.h PBO.h X11Display.h EGLContext.h \
+ BCMDisplay.h CGLContext.h AppleDisplay.h
+am_testgpu_OBJECTS = testgpu.$(OBJEXT) $(am__objects_4)
testgpu_OBJECTS = $(am_testgpu_OBJECTS)
am__DEPENDENCIES_1 =
-testgpu_DEPENDENCIES = ./libgraphics.la ../base/libbase.la \
- $(am__DEPENDENCIES_1)
-am_testgraphics_OBJECTS = testgraphics.$(OBJEXT) $(am__objects_2)
+testgpu_DEPENDENCIES = libgraphics.la ../base/libbase.la \
+ ../base/triangulate/libtriangulate.la $(am__DEPENDENCIES_1)
+am__testgraphics_SOURCES_DIST = testgraphics.cpp Bitmap.h Filter.h \
+ GLContext.h GLContextAttribs.h Pixel32.h Pixel24.h Pixel16.h \
+ Pixel8.h Pixeldefs.h PixelFormat.h Filtercolorize.h \
+ Filterfill.h Filterfillrect.h Filterflip.h FilterflipX.h \
+ Filterfliprgb.h Filterflipuv.h Filtergrayscale.h Filter3x3.h \
+ HistoryPreProcessor.h FilterConvol.h FilterHighpass.h \
+ FilterFastBandpass.h Filterfliprgba.h FilterFastDownscale.h \
+ FilterGauss.h FilterBandpass.h FilterBlur.h FilterMask.h \
+ OGLHelper.h OGLShader.h GL/gl.h GL/glext.h GL/glu.h GL/glx.h \
+ VertexArray.h GPUNullFilter.h GPUChromaKeyFilter.h Display.h \
+ GPUBrightnessFilter.h GPUBlurFilter.h GPUShadowFilter.h \
+ GraphicsTest.h GPUFilter.h GPUBandpassFilter.h \
+ GPUHueSatFilter.h GPUInvertFilter.h FilterIntensity.h \
+ FilterNormalize.h FilterFloodfill.h FilterDilation.h \
+ FilterErosion.h FilterGetAlpha.h FBO.h GLTexture.h \
+ TextureMover.h ContribDefs.h TwoPassScale.h \
+ FilterResizeBilinear.h FilterThreshold.h \
+ FilterResizeGaussian.h FilterUnmultiplyAlpha.h \
+ ShaderRegistry.h ImagingProjection.h GLBufferCache.h \
+ GLConfig.h BmpTextureMover.h GPURGB2YUVFilter.h \
+ GLShaderParam.h StandardShader.h SubVertexArray.h VertexData.h \
+ BitmapLoader.h GLXContext.h PBO.h X11Display.h EGLContext.h \
+ BCMDisplay.h CGLContext.h AppleDisplay.h
+am_testgraphics_OBJECTS = testgraphics.$(OBJEXT) $(am__objects_4)
testgraphics_OBJECTS = $(am_testgraphics_OBJECTS)
-testgraphics_DEPENDENCIES = ./libgraphics.la ../base/libbase.la \
- $(am__DEPENDENCIES_1)
+testgraphics_DEPENDENCIES = libgraphics.la ../base/libbase.la \
+ ../base/triangulate/libtriangulate.la $(am__DEPENDENCIES_1)
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@@ -106,18 +232,18 @@ LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CXXFLAGS) $(CXXFLAGS)
-AM_V_CXX = $(am__v_CXX_$(V))
-am__v_CXX_ = $(am__v_CXX_$(AM_DEFAULT_VERBOSITY))
+AM_V_CXX = $(am__v_CXX_@AM_V@)
+am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@)
am__v_CXX_0 = @echo " CXX " $@;
-AM_V_at = $(am__v_at_$(V))
-am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
CXXLD = $(CXX)
CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
$(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
-AM_V_CXXLD = $(am__v_CXXLD_$(V))
-am__v_CXXLD_ = $(am__v_CXXLD_$(AM_DEFAULT_VERBOSITY))
+AM_V_CXXLD = $(am__v_CXXLD_@AM_V@)
+am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@)
am__v_CXXLD_0 = @echo " CXXLD " $@;
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@@ -125,28 +251,67 @@ LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
-AM_V_CC = $(am__v_CC_$(V))
-am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
+AM_V_CC = $(am__v_CC_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
am__v_CC_0 = @echo " CC " $@;
CCLD = $(CC)
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
-AM_V_CCLD = $(am__v_CCLD_$(V))
-am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
-AM_V_GEN = $(am__v_GEN_$(V))
-am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
SOURCES = $(libgraphics_la_SOURCES) $(benchmarkgraphics_SOURCES) \
$(testgpu_SOURCES) $(testgraphics_SOURCES)
-DIST_SOURCES = $(libgraphics_la_SOURCES) $(benchmarkgraphics_SOURCES) \
- $(testgpu_SOURCES) $(testgraphics_SOURCES)
+DIST_SOURCES = $(am__libgraphics_la_SOURCES_DIST) \
+ $(am__benchmarkgraphics_SOURCES_DIST) \
+ $(am__testgpu_SOURCES_DIST) $(am__testgraphics_SOURCES_DIST)
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-dvi-recursive install-exec-recursive \
+ install-html-recursive install-info-recursive \
+ install-pdf-recursive install-ps-recursive install-recursive \
+ installcheck-recursive installdirs-recursive pdf-recursive \
+ ps-recursive uninstall-recursive
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
+ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
+ distdir
ETAGS = etags
CTAGS = ctags
am__tty_colors = \
red=; grn=; lgn=; blu=; std=
+DIST_SUBDIRS = $(SUBDIRS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+am__relativize = \
+ dir0=`pwd`; \
+ sed_first='s,^\([^/]*\)/.*$$,\1,'; \
+ sed_rest='s,^[^/]*/*,,'; \
+ sed_last='s,^.*/\([^/]*\)$$,\1,'; \
+ sed_butlast='s,/*[^/]*$$,,'; \
+ while test -n "$$dir1"; do \
+ first=`echo "$$dir1" | sed -e "$$sed_first"`; \
+ if test "$$first" != "."; then \
+ if test "$$first" = ".."; then \
+ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
+ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
+ else \
+ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
+ if test "$$first2" = "$$first"; then \
+ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
+ else \
+ dir2="../$$dir2"; \
+ fi; \
+ dir0="$$dir0"/"$$first"; \
+ fi; \
+ fi; \
+ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
+ done; \
+ reldir="$$dir2"
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
@@ -156,7 +321,7 @@ AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BOOST_PYTHON_LIBS = @BOOST_PYTHON_LIBS@
-BOOST_THREAD_LIB = @BOOST_THREAD_LIB@
+BOOST_THREAD_LIBS = @BOOST_THREAD_LIBS@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
@@ -171,6 +336,7 @@ DC1394_2_CFLAGS = @DC1394_2_CFLAGS@
DC1394_2_LIBS = @DC1394_2_LIBS@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
@@ -211,6 +377,7 @@ LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
MTDEV_CFLAGS = @MTDEV_CFLAGS@
MTDEV_LIBS = @MTDEV_LIBS@
@@ -240,11 +407,13 @@ PTHREAD_CC = @PTHREAD_CC@
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
PTHREAD_LIBS = @PTHREAD_LIBS@
PYTHON = @PYTHON@
+PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@
PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
-PYTHON_INCLUDES = @PYTHON_INCLUDES@
-PYTHON_LIBS = @PYTHON_LIBS@
+PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@
+PYTHON_LDFLAGS = @PYTHON_LDFLAGS@
PYTHON_PLATFORM = @PYTHON_PLATFORM@
PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_SITE_PKG = @PYTHON_SITE_PKG@
PYTHON_VERSION = @PYTHON_VERSION@
RANLIB = @RANLIB@
SDL_CFLAGS = @SDL_CFLAGS@
@@ -267,6 +436,7 @@ abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
@@ -301,7 +471,6 @@ libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
@@ -325,25 +494,34 @@ target_vendor = @target_vendor@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-INCLUDES = -I.. @GL_CFLAGS@ @PYTHON_INCLUDES@ @GDK_PIXBUF_CFLAGS@
-ALL_H = Bitmap.h Filter.h GLContext.h\
+SUBDIRS = shaders
+AM_CPPFLAGS = -I.. @GL_CFLAGS@ @GDK_PIXBUF_CFLAGS@
+@APPLE_FALSE@@ENABLE_EGL_FALSE@@ENABLE_RPI_FALSE@GL_SOURCES = GLXContext.cpp PBO.cpp X11Display.cpp
+@APPLE_FALSE@@ENABLE_EGL_TRUE@@ENABLE_RPI_FALSE@GL_SOURCES = EGLContext.cpp X11Display.cpp
+@APPLE_FALSE@@ENABLE_RPI_TRUE@GL_SOURCES = EGLContext.cpp BCMDisplay.cpp X11Display.cpp
+@APPLE_TRUE@GL_SOURCES = CGLContext.cpp PBO.cpp AppleDisplay.cpp
+@APPLE_FALSE@@ENABLE_EGL_FALSE@@ENABLE_RPI_FALSE@GL_INCLUDES = GLXContext.h PBO.h X11Display.h
+@APPLE_FALSE@@ENABLE_EGL_TRUE@@ENABLE_RPI_FALSE@GL_INCLUDES = EGLContext.h X11Display.h
+@APPLE_FALSE@@ENABLE_RPI_TRUE@GL_INCLUDES = EGLContext.h BCMDisplay.h X11Display.h
+@APPLE_TRUE@GL_INCLUDES = CGLContext.h PBO.h AppleDisplay.h
+ALL_H = Bitmap.h Filter.h GLContext.h GLContextAttribs.h \
Pixel32.h Pixel24.h Pixel16.h Pixel8.h Pixeldefs.h PixelFormat.h \
Filtercolorize.h Filterfill.h Filterfillrect.h Filterflip.h FilterflipX.h \
Filterfliprgb.h Filterflipuv.h Filtergrayscale.h Filter3x3.h \
- FilterId.h HistoryPreProcessor.h FilterConvol.h FilterHighpass.h \
+ HistoryPreProcessor.h FilterConvol.h FilterHighpass.h \
FilterFastBandpass.h Filterfliprgba.h FilterFastDownscale.h \
FilterGauss.h FilterBandpass.h FilterBlur.h FilterMask.h \
OGLHelper.h OGLShader.h GL/gl.h GL/glext.h GL/glu.h GL/glx.h \
- VertexArray.h OGLImagingContext.h GPUNullFilter.h GPUChromaKeyFilter.h \
+ VertexArray.h GPUNullFilter.h GPUChromaKeyFilter.h Display.h \
GPUBrightnessFilter.h GPUBlurFilter.h GPUShadowFilter.h GraphicsTest.h\
GPUFilter.h GPUBandpassFilter.h GPUHueSatFilter.h GPUInvertFilter.h \
FilterIntensity.h FilterNormalize.h FilterFloodfill.h FilterDilation.h \
- FilterErosion.h FilterGetAlpha.h FBO.h GLTexture.h PBO.h TextureMover.h\
+ FilterErosion.h FilterGetAlpha.h FBO.h GLTexture.h TextureMover.h\
ContribDefs.h TwoPassScale.h FilterResizeBilinear.h FilterThreshold.h \
FilterResizeGaussian.h FilterUnmultiplyAlpha.h ShaderRegistry.h \
- ImagingProjection.h BitmapManager.h BitmapManagerThread.h \
- BitmapManagerMsg.h GLBufferCache.h GLConfig.h BmpTextureMover.h \
- GPURGB2YUVFilter.h
+ ImagingProjection.h GLBufferCache.h GLConfig.h BmpTextureMover.h \
+ GPURGB2YUVFilter.h GLShaderParam.h StandardShader.h SubVertexArray.h \
+ VertexData.h BitmapLoader.h $(GL_INCLUDES)
ALL_CPP = Bitmap.cpp Filter.cpp Pixel32.cpp Filtergrayscale.cpp PixelFormat.cpp \
Filtercolorize.cpp Filterflip.cpp FilterflipX.cpp Filterfliprgb.cpp \
@@ -351,37 +529,43 @@ ALL_CPP = Bitmap.cpp Filter.cpp Pixel32.cpp Filtergrayscale.cpp PixelFormat.cpp
FilterFastBandpass.cpp Filterfliprgba.cpp FilterFastDownscale.cpp \
FilterGauss.cpp FilterBandpass.cpp FilterBlur.cpp FilterMask.cpp \
OGLHelper.cpp OGLShader.cpp GPUNullFilter.cpp GPUChromaKeyFilter.cpp \
- GPUHueSatFilter.cpp GPUInvertFilter.cpp VertexArray.cpp OGLImagingContext.cpp \
+ Display.cpp \
+ GPUHueSatFilter.cpp GPUInvertFilter.cpp VertexArray.cpp GLContextAttribs.cpp \
GPUBrightnessFilter.cpp GPUBlurFilter.cpp GPUShadowFilter.cpp GraphicsTest.cpp \
GPUFilter.cpp GPUBandpassFilter.cpp FilterIntensity.cpp GLContext.cpp \
FilterNormalize.cpp FilterDilation.cpp FilterErosion.cpp \
- FilterGetAlpha.cpp FBO.cpp GLTexture.cpp PBO.cpp TextureMover.cpp \
+ FilterGetAlpha.cpp FBO.cpp GLTexture.cpp TextureMover.cpp \
FilterResizeBilinear.cpp FilterResizeGaussian.cpp FilterThreshold.cpp \
FilterUnmultiplyAlpha.cpp ShaderRegistry.cpp \
- ImagingProjection.cpp BitmapManager.cpp BitmapManagerThread.cpp \
- BitmapManagerMsg.cpp GLBufferCache.cpp GLConfig.cpp BmpTextureMover.cpp \
- GPURGB2YUVFilter.cpp
+ ImagingProjection.cpp GLBufferCache.cpp GLConfig.cpp BmpTextureMover.cpp \
+ GPURGB2YUVFilter.cpp GLShaderParam.cpp StandardShader.cpp SubVertexArray.cpp \
+ VertexData.cpp BitmapLoader.cpp $(GL_SOURCES)
-@APPLE_FALSE@X_LIBS = -lX11
+@APPLE_FALSE@@ENABLE_EGL_FALSE@@ENABLE_RPI_FALSE@X_LIBS = -lXxf86vm -lX11
+@APPLE_FALSE@@ENABLE_EGL_TRUE@@ENABLE_RPI_FALSE@X_LIBS = -lXxf86vm -lX11 -lGLESv2 -lEGL
+@APPLE_FALSE@@ENABLE_RPI_TRUE@X_LIBS = -lXxf86vm -lX11 -lGLESv2 -lEGL
@APPLE_TRUE@X_LIBS =
-EXTRA_DIST = $(wildcard baseline/*.png) $(wildcard testfiles/*.png)
+EXTRA_DIST = $(wildcard baseline/*.png)
noinst_LTLIBRARIES = libgraphics.la
libgraphics_la_SOURCES = $(ALL_CPP) $(ALL_H)
testgraphics_SOURCES = testgraphics.cpp $(ALL_H)
-testgraphics_LDADD = ./libgraphics.la ../base/libbase.la \
- @XML2_LIBS@ -l@BOOST_THREAD_LIB@ @PTHREAD_LIBS@ $(X_LIBS) @GDK_PIXBUF_LIBS@
+testgraphics_LDADD = libgraphics.la ../base/libbase.la \
+ ../base/triangulate/libtriangulate.la \
+ @XML2_LIBS@ @BOOST_THREAD_LIBS@ @PTHREAD_LIBS@ $(X_LIBS) @GDK_PIXBUF_LIBS@
benchmarkgraphics_SOURCES = benchmarkgraphics.cpp $(ALL_H)
-benchmarkgraphics_LDADD = ./libgraphics.la ../base/libbase.la \
- @XML2_LIBS@ -l@BOOST_THREAD_LIB@ @PTHREAD_LIBS@ @GDK_PIXBUF_LIBS@
+benchmarkgraphics_LDADD = libgraphics.la ../base/libbase.la \
+ ../base/triangulate/libtriangulate.la \
+ @XML2_LIBS@ @BOOST_THREAD_LIBS@ @PTHREAD_LIBS@ @GDK_PIXBUF_LIBS@
testgpu_SOURCES = testgpu.cpp $(ALL_H)
-testgpu_LDADD = ./libgraphics.la ../base/libbase.la -ldl \
- @XML2_LIBS@ -l@BOOST_THREAD_LIB@ @PTHREAD_LIBS@ $(X_LIBS) \
+testgpu_LDADD = libgraphics.la ../base/libbase.la -ldl \
+ ../base/triangulate/libtriangulate.la \
+ @XML2_LIBS@ @BOOST_THREAD_LIBS@ @PTHREAD_LIBS@ $(X_LIBS) \
@GL_LIBS@ @GLU_LIBS@ @SDL_LIBS@ \
@GDK_PIXBUF_LIBS@
-all: all-am
+all: all-recursive
.SUFFIXES:
.SUFFIXES: .cpp .lo .o .obj
@@ -424,7 +608,7 @@ clean-noinstLTLIBRARIES:
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
-libgraphics.la: $(libgraphics_la_OBJECTS) $(libgraphics_la_DEPENDENCIES)
+libgraphics.la: $(libgraphics_la_OBJECTS) $(libgraphics_la_DEPENDENCIES) $(EXTRA_libgraphics_la_DEPENDENCIES)
$(AM_V_CXXLD)$(CXXLINK) $(libgraphics_la_OBJECTS) $(libgraphics_la_LIBADD) $(LIBS)
clean-noinstPROGRAMS:
@@ -435,13 +619,13 @@ clean-noinstPROGRAMS:
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
echo " rm -f" $$list; \
rm -f $$list
-benchmarkgraphics$(EXEEXT): $(benchmarkgraphics_OBJECTS) $(benchmarkgraphics_DEPENDENCIES)
+benchmarkgraphics$(EXEEXT): $(benchmarkgraphics_OBJECTS) $(benchmarkgraphics_DEPENDENCIES) $(EXTRA_benchmarkgraphics_DEPENDENCIES)
@rm -f benchmarkgraphics$(EXEEXT)
$(AM_V_CXXLD)$(CXXLINK) $(benchmarkgraphics_OBJECTS) $(benchmarkgraphics_LDADD) $(LIBS)
-testgpu$(EXEEXT): $(testgpu_OBJECTS) $(testgpu_DEPENDENCIES)
+testgpu$(EXEEXT): $(testgpu_OBJECTS) $(testgpu_DEPENDENCIES) $(EXTRA_testgpu_DEPENDENCIES)
@rm -f testgpu$(EXEEXT)
$(AM_V_CXXLD)$(CXXLINK) $(testgpu_OBJECTS) $(testgpu_LDADD) $(LIBS)
-testgraphics$(EXEEXT): $(testgraphics_OBJECTS) $(testgraphics_DEPENDENCIES)
+testgraphics$(EXEEXT): $(testgraphics_OBJECTS) $(testgraphics_DEPENDENCIES) $(EXTRA_testgraphics_DEPENDENCIES)
@rm -f testgraphics$(EXEEXT)
$(AM_V_CXXLD)$(CXXLINK) $(testgraphics_OBJECTS) $(testgraphics_LDADD) $(LIBS)
@@ -451,11 +635,14 @@ mostlyclean-compile:
distclean-compile:
-rm -f *.tab.c
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/AppleDisplay.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BCMDisplay.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Bitmap.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BitmapManager.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BitmapManagerMsg.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BitmapManagerThread.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BitmapLoader.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BmpTextureMover.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CGLContext.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Display.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/EGLContext.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FBO.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Filter.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Filter3x3.Plo@am__quote@
@@ -485,7 +672,10 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GLBufferCache.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GLConfig.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GLContext.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GLContextAttribs.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GLShaderParam.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GLTexture.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GLXContext.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GPUBandpassFilter.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GPUBlurFilter.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GPUBrightnessFilter.Plo@am__quote@
@@ -500,14 +690,17 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/HistoryPreProcessor.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ImagingProjection.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OGLHelper.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OGLImagingContext.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OGLShader.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PBO.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Pixel32.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PixelFormat.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ShaderRegistry.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/StandardShader.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SubVertexArray.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TextureMover.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/VertexArray.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/VertexData.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/X11Display.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/benchmarkgraphics.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testgpu.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testgraphics.Po@am__quote@
@@ -515,26 +708,23 @@ distclean-compile:
.cpp.o:
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $<
.cpp.obj:
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
.cpp.lo:
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
-@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
@@ -542,6 +732,76 @@ mostlyclean-libtool:
clean-libtool:
-rm -rf .libs _libs
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @fail= failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+ @fail= failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
@@ -552,10 +812,23 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
mkid -fID $$unique
tags: TAGS
-TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
set x; \
here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
@@ -574,7 +847,7 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
fi; \
fi
ctags: CTAGS
-CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
@@ -675,14 +948,15 @@ check-TESTS: $(TESTS)
fi; \
dashes=`echo "$$dashes" | sed s/./=/g`; \
if test "$$failed" -eq 0; then \
- echo "$$grn$$dashes"; \
+ col="$$grn"; \
else \
- echo "$$red$$dashes"; \
+ col="$$red"; \
fi; \
- echo "$$banner"; \
- test -z "$$skipped" || echo "$$skipped"; \
- test -z "$$report" || echo "$$report"; \
- echo "$$dashes$$std"; \
+ echo "$${col}$$dashes$${std}"; \
+ echo "$${col}$$banner$${std}"; \
+ test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \
+ test -z "$$report" || echo "$${col}$$report$${std}"; \
+ echo "$${col}$$dashes$${std}"; \
test "$$failed" -eq 0; \
else :; fi
@@ -716,25 +990,59 @@ distdir: $(DISTFILES)
|| exit 1; \
fi; \
done
+ @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
+ fi; \
+ done
+ @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
+ $(am__relativize); \
+ new_distdir=$$reldir; \
+ dir1=$$subdir; dir2="$(top_distdir)"; \
+ $(am__relativize); \
+ new_top_distdir=$$reldir; \
+ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
+ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
+ ($(am__cd) $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$new_top_distdir" \
+ distdir="$$new_distdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ am__skip_mode_fix=: \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
check-am: all-am
$(MAKE) $(AM_MAKEFLAGS) check-TESTS
-check: check-am
+check: check-recursive
all-am: Makefile $(LTLIBRARIES) $(PROGRAMS)
-installdirs:
-install: install-am
-install-exec: install-exec-am
-install-data: install-data-am
-uninstall: uninstall-am
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-installcheck: installcheck-am
+installcheck: installcheck-recursive
install-strip:
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- `test -z '$(STRIP)' || \
- echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
mostlyclean-generic:
clean-generic:
@@ -746,92 +1054,94 @@ distclean-generic:
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
-clean: clean-am
+clean: clean-recursive
clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
clean-noinstPROGRAMS mostlyclean-am
-distclean: distclean-am
+distclean: distclean-recursive
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
-dvi: dvi-am
+dvi: dvi-recursive
dvi-am:
-html: html-am
+html: html-recursive
html-am:
-info: info-am
+info: info-recursive
info-am:
install-data-am:
-install-dvi: install-dvi-am
+install-dvi: install-dvi-recursive
install-dvi-am:
install-exec-am:
-install-html: install-html-am
+install-html: install-html-recursive
install-html-am:
-install-info: install-info-am
+install-info: install-info-recursive
install-info-am:
install-man:
-install-pdf: install-pdf-am
+install-pdf: install-pdf-recursive
install-pdf-am:
-install-ps: install-ps-am
+install-ps: install-ps-recursive
install-ps-am:
installcheck-am:
-maintainer-clean: maintainer-clean-am
+maintainer-clean: maintainer-clean-recursive
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
-mostlyclean: mostlyclean-am
+mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
-pdf: pdf-am
+pdf: pdf-recursive
pdf-am:
-ps: ps-am
+ps: ps-recursive
ps-am:
uninstall-am:
-.MAKE: check-am install-am install-strip
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) check-am \
+ ctags-recursive install-am install-strip tags-recursive
-.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \
- clean-generic clean-libtool clean-noinstLTLIBRARIES \
- clean-noinstPROGRAMS ctags distclean distclean-compile \
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+ all all-am check check-TESTS check-am clean clean-generic \
+ clean-libtool clean-noinstLTLIBRARIES clean-noinstPROGRAMS \
+ ctags ctags-recursive distclean distclean-compile \
distclean-generic distclean-libtool distclean-tags distdir dvi \
dvi-am html html-am info info-am install install-am \
install-data install-data-am install-dvi install-dvi-am \
install-exec install-exec-am install-html install-html-am \
install-info install-info-am install-man install-pdf \
install-pdf-am install-ps install-ps-am install-strip \
- installcheck installcheck-am installdirs maintainer-clean \
- maintainer-clean-generic mostlyclean mostlyclean-compile \
- mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
- tags uninstall uninstall-am
+ installcheck installcheck-am installdirs installdirs-am \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags tags-recursive uninstall uninstall-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
diff --git a/src/graphics/OGLHelper.cpp b/src/graphics/OGLHelper.cpp
index dad80f8..3f8b537 100644
--- a/src/graphics/OGLHelper.cpp
+++ b/src/graphics/OGLHelper.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -24,6 +24,8 @@
#include "../base/Logger.h"
#include "../base/Exception.h"
+#include "GLContext.h"
+
#ifndef _WIN32
#include <dlfcn.h>
#endif
@@ -44,92 +46,74 @@ using namespace std;
namespace avg {
namespace glproc {
+#ifndef AVG_ENABLE_EGL
+ PFNGLBUFFERSUBDATAPROC BufferSubData;
+ PFNGLGETBUFFERSUBDATAPROC GetBufferSubData;
+ PFNGLBLITFRAMEBUFFERPROC BlitFramebuffer;
+ PFNGLDRAWBUFFERSPROC DrawBuffers;
+ PFNGLDRAWRANGEELEMENTSPROC DrawRangeElements;
+ PFNGLGETOBJECTPARAMETERIVARBPROC GetObjectParameteriv;
+#endif
PFNGLGENBUFFERSPROC GenBuffers;
PFNGLBUFFERDATAPROC BufferData;
- PFNGLBUFFERSUBDATAPROC BufferSubData;
+ PFNGLDEBUGMESSAGECALLBACKPROC DebugMessageCallback;
PFNGLDELETEBUFFERSPROC DeleteBuffers;
PFNGLBINDBUFFERPROC BindBuffer;
PFNGLMAPBUFFERPROC MapBuffer;
PFNGLUNMAPBUFFERPROC UnmapBuffer;
- PFNGLGETBUFFERSUBDATAPROC GetBufferSubData;
- PFNGLCREATESHADEROBJECTARBPROC CreateShaderObject;
- PFNGLSHADERSOURCEARBPROC ShaderSource;
- PFNGLCOMPILESHADERARBPROC CompileShader;
- PFNGLCREATEPROGRAMOBJECTARBPROC CreateProgramObject;
- PFNGLATTACHOBJECTARBPROC AttachObject;
- PFNGLLINKPROGRAMARBPROC LinkProgram;
- PFNGLGETOBJECTPARAMETERIVARBPROC GetObjectParameteriv;
- PFNGLGETINFOLOGARBPROC GetInfoLog;
- PFNGLUSEPROGRAMOBJECTARBPROC UseProgramObject;
- PFNGLGETUNIFORMLOCATIONARBPROC GetUniformLocation;
- PFNGLUNIFORM1IARBPROC Uniform1i;
- PFNGLUNIFORM1FARBPROC Uniform1f;
- PFNGLUNIFORM2FARBPROC Uniform2f;
- PFNGLUNIFORM3FARBPROC Uniform3f;
- PFNGLUNIFORM4FARBPROC Uniform4f;
- PFNGLUNIFORM1FVARBPROC Uniform1fv;
- PFNGLUNIFORMMATRIX4FVARBPROC UniformMatrix4fv;
+ PFNGLCREATESHADERPROC CreateShader;
+ PFNGLSHADERSOURCEPROC ShaderSource;
+ PFNGLCOMPILESHADERPROC CompileShader;
+ PFNGLCREATEPROGRAMPROC CreateProgram;
+ PFNGLATTACHSHADERPROC AttachShader;
+ PFNGLLINKPROGRAMPROC LinkProgram;
+ PFNGLGETSHADERIVPROC GetShaderiv;
+ PFNGLGETPROGRAMIVPROC GetProgramiv;
+ PFNGLGETSHADERINFOLOGPROC GetShaderInfoLog;
+ PFNGLGETPROGRAMINFOLOGPROC GetProgramInfoLog;
+ PFNGLUSEPROGRAMPROC UseProgram;
+ PFNGLGETUNIFORMLOCATIONPROC GetUniformLocation;
+ PFNGLUNIFORM1IPROC Uniform1i;
+ PFNGLUNIFORM1FPROC Uniform1f;
+ PFNGLUNIFORM2FPROC Uniform2f;
+ PFNGLUNIFORM3FPROC Uniform3f;
+ PFNGLUNIFORM4FPROC Uniform4f;
+ PFNGLUNIFORM1FVPROC Uniform1fv;
+ PFNGLUNIFORMMATRIX4FVPROC UniformMatrix4fv;
PFNGLBLENDFUNCSEPARATEPROC BlendFuncSeparate;
PFNGLBLENDEQUATIONPROC BlendEquation;
PFNGLBLENDCOLORPROC BlendColor;
PFNGLACTIVETEXTUREPROC ActiveTexture;
- PFNGLGENERATEMIPMAPEXTPROC GenerateMipmap;
-
- PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC CheckFramebufferStatus;
- PFNGLGENFRAMEBUFFERSEXTPROC GenFramebuffers;
- PFNGLBINDFRAMEBUFFEREXTPROC BindFramebuffer;
- PFNGLFRAMEBUFFERTEXTURE2DEXTPROC FramebufferTexture2D;
- PFNGLDELETEFRAMEBUFFERSEXTPROC DeleteFramebuffers;
- PFNGLGENRENDERBUFFERSEXTPROC GenRenderbuffers;
- PFNGLBINDRENDERBUFFEREXTPROC BindRenderbuffer;
- PFNGLRENDERBUFFERSTORAGEEXTPROC RenderbufferStorage;
- PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC RenderbufferStorageMultisample;
- PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC FramebufferRenderbuffer;
- PFNGLBLITFRAMEBUFFEREXTPROC BlitFramebuffer;
- PFNGLDELETERENDERBUFFERSEXTPROC DeleteRenderbuffers;
- PFNGLDRAWBUFFERSPROC DrawBuffers;
-#ifdef linux
- PFNGLXSWAPINTERVALSGIPROC SwapIntervalSGI;
- PFNGLXWAITVIDEOSYNCSGIPROC WaitVideoSyncSGI;
+ PFNGLGENERATEMIPMAPPROC GenerateMipmap;
+
+ PFNGLCHECKFRAMEBUFFERSTATUSPROC CheckFramebufferStatus;
+ PFNGLGENFRAMEBUFFERSPROC GenFramebuffers;
+ PFNGLBINDFRAMEBUFFERPROC BindFramebuffer;
+ PFNGLFRAMEBUFFERTEXTURE2DPROC FramebufferTexture2D;
+ PFNGLDELETEFRAMEBUFFERSPROC DeleteFramebuffers;
+ PFNGLGENRENDERBUFFERSPROC GenRenderbuffers;
+ PFNGLBINDRENDERBUFFERPROC BindRenderbuffer;
+ PFNGLRENDERBUFFERSTORAGEPROC RenderbufferStorage;
+ PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC RenderbufferStorageMultisample;
+ PFNGLFRAMEBUFFERRENDERBUFFERPROC FramebufferRenderbuffer;
+ PFNGLDELETERENDERBUFFERSPROC DeleteRenderbuffers;
+ PFNGLVERTEXATTRIBPOINTERPROC VertexAttribPointer;
+ PFNGLENABLEVERTEXATTRIBARRAYPROC EnableVertexAttribArray;
+ PFNGLBINDATTRIBLOCATIONPROC BindAttribLocation;
+#if defined(linux) && !defined(AVG_ENABLE_EGL)
+ PFNGLXSWAPINTERVALEXTPROC SwapIntervalEXT;
#endif
#ifdef _WIN32
- PFNWGLEXTSWAPCONTROLPROC SwapIntervalEXT;
+ PFNWGLGETEXTENSIONSSTRINGARBPROC GetExtensionsStringARB;
+ PFNWGLGETSWAPINTERVALEXTPROC GetSwapIntervalEXT;
+ PFNWGLSWAPINTERVALEXTPROC SwapIntervalEXT;
#endif
void * s_hGLLib = 0;
}
-void OGLErrorCheck(int avgcode, const char* pszWhere)
-{
- GLenum err = glGetError();
- if (err != GL_NO_ERROR) {
- stringstream s;
- s << "OpenGL error in " << pszWhere <<": " << gluErrorString(err)
- << " (#" << err << ") ";
- AVG_TRACE(Logger::ERROR, s.str());
- if (err != GL_INVALID_OPERATION) {
- OGLErrorCheck(avgcode, " --");
- }
- AVG_ASSERT(false);
- }
-}
-
-#ifdef _WIN32
-void winOGLErrorCheck(BOOL bOK, const string& sWhere)
-{
- if (!bOK) {
- char szErr[512];
- FormatMessage((FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_SYSTEM),
- 0, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
- szErr, 512, 0);
- AVG_TRACE(Logger::ERROR, sWhere+":"+szErr);
- AVG_ASSERT(false);
- }
-}
-#endif
-
bool queryOGLExtension(const char *extName)
{
char *p;
@@ -137,9 +121,7 @@ bool queryOGLExtension(const char *extName)
p = (char *)glGetString(GL_EXTENSIONS);
AVG_ASSERT(p != 0);
-
char * end = p + strlen(p);
-
while (p < end) {
size_t n = strcspn(p, " ");
if ((extNameLen == n) && (strncmp(extName, p, n) == 0)) {
@@ -152,7 +134,7 @@ bool queryOGLExtension(const char *extName)
bool queryGLXExtension(const char *extName)
{
-#if (defined __APPLE__) || (defined _WIN32)
+#if (defined __APPLE__) || (defined _WIN32) || (defined AVG_ENABLE_EGL)
return false;
#else
int extNameLen = strlen(extName);
@@ -180,30 +162,6 @@ bool queryGLXExtension(const char *extName)
#endif
}
-void getGLVersion(int& major, int& minor)
-{
- const char* pVersion = (const char*)glGetString(GL_VERSION);
- sscanf(pVersion, "%d.%d", &major, &minor);
-}
-
-void getGLShadingLanguageVersion(int& major, int& minor)
-{
- int glMajor, glMinor;
- getGLVersion(glMajor, glMinor);
-
- major = 0;
- minor = 0;
- if (glMajor == 1) {
- if (queryOGLExtension("GL_ARB_shading_language_100")) {
- major = 1;
- minor = 0;
- }
- } else {
- const char* pVersion = (const char*)glGetString(GL_SHADING_LANGUAGE_VERSION);
- sscanf(pVersion, "%d.%d", &major, &minor);
- }
-}
-
string AVG_API oglModeToString(int mode)
{
switch (mode) {
@@ -213,10 +171,15 @@ string AVG_API oglModeToString(int mode)
return "GL_RGB";
case GL_RGBA:
return "GL_RGBA";
+#ifdef AVG_ENABLE_EGL
+ case GL_BGRA_EXT:
+ return "GL_BGRA_EXT";
+#else
case GL_BGR:
return "GL_BGR";
case GL_BGRA:
return "GL_BGRA";
+#endif
default:
return "UNKNOWN";
}
@@ -238,48 +201,26 @@ string oglMemoryMode2String(OGLMemoryMode mode)
}
}
-// TODO: Unused, possibly broken
-void pushGLState()
+void AVG_API clearGLBuffers(GLbitfield mask, bool bOpaque)
{
- glPushAttrib(GL_ALL_ATTRIB_BITS);
- glPushClientAttrib(GL_ALL_CLIENT_ATTRIB_BITS);
- glMatrixMode(GL_PROJECTION);
- glPushMatrix();
- glMatrixMode(GL_TEXTURE);
- glPushMatrix();
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "pushGLState()");
-}
-
-void popGLState()
-{
- glMatrixMode(GL_MODELVIEW);
- glPopMatrix();
- glMatrixMode(GL_TEXTURE);
- glPopMatrix();
- glMatrixMode(GL_PROJECTION);
- glPopMatrix();
- glPopClientAttrib();
- glPopAttrib();
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "popGLState()");
-}
-
-void AVG_API clearGLBuffers(GLbitfield mask)
-{
- glClearColor(0.0, 0.0, 0.0, 0.0);
+ float alpha;
+ if (bOpaque) {
+ alpha = 1.0;
+ } else {
+ alpha = 0.0;
+ }
+ glClearColor(0.0, 0.0, 0.0, alpha);
if (mask & GL_STENCIL_BUFFER_BIT) {
glStencilMask(~0);
glClearStencil(0);
}
glClear(mask);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "clearGLBuffers()");
+ GLContext::checkError("clearGLBuffers()");
if (mask & GL_STENCIL_BUFFER_BIT) {
glStencilMask(0);
}
}
-
void invalidGLCall()
{
assert(false);
@@ -304,8 +245,12 @@ void loadGLLibrary()
#ifdef __APPLE__
const char * pszFName = "/System/Library/Frameworks/OpenGL.framework/OpenGL";
#else
+#ifdef AVG_ENABLE_EGL
+ const char * pszFName = "libGLESv2.so";
+#else
const char * pszFName = "libGL.so.1";
#endif
+#endif
glproc::s_hGLLib = dlopen(pszFName, RTLD_NOW);
if (glproc::s_hGLLib == 0) {
const char * pszErr = (char *)dlerror();
@@ -353,11 +298,16 @@ GLfunction getFuzzyProcAddress(const char * psz)
pProc = getProcAddress(s);
}
if (!pProc) {
+ string s = string(psz)+"OES";
+ pProc = getProcAddress(s);
+ }
+ if (!pProc) {
pProc = invalidGLCall;
}
return pProc;
}
-#ifdef linux
+
+#if defined(linux) && !defined(AVG_ENABLE_EGL)
GLfunction getglXProcAddress(const char * psz)
{
GLfunction pProc = (GLfunction)glXGetProcAddress((const GLubyte *)psz);
@@ -391,39 +341,33 @@ namespace glproc {
GenBuffers = (PFNGLGENBUFFERSPROC)getFuzzyProcAddress("glGenBuffers");
BufferData = (PFNGLBUFFERDATAPROC)getFuzzyProcAddress("glBufferData");
- BufferSubData = (PFNGLBUFFERSUBDATAPROC)getFuzzyProcAddress("glBufferSubData");
DeleteBuffers = (PFNGLDELETEBUFFERSPROC)getFuzzyProcAddress("glDeleteBuffers");
BindBuffer = (PFNGLBINDBUFFERPROC)getFuzzyProcAddress("glBindBuffer");
MapBuffer = (PFNGLMAPBUFFERPROC)getFuzzyProcAddress("glMapBuffer");
UnmapBuffer = (PFNGLUNMAPBUFFERPROC)getFuzzyProcAddress("glUnmapBuffer");
- GetBufferSubData = (PFNGLGETBUFFERSUBDATAPROC)getFuzzyProcAddress
- ("glGetBufferSubData");
-
- CreateShaderObject = (PFNGLCREATESHADEROBJECTARBPROC)
- getFuzzyProcAddress("glCreateShaderObject");
- ShaderSource = (PFNGLSHADERSOURCEARBPROC)
- getFuzzyProcAddress("glShaderSource");
- CompileShader = (PFNGLCOMPILESHADERARBPROC)
- getFuzzyProcAddress("glCompileShader");
- CreateProgramObject = (PFNGLCREATEPROGRAMOBJECTARBPROC)
- getFuzzyProcAddress("glCreateProgramObject");
- AttachObject = (PFNGLATTACHOBJECTARBPROC)
- getFuzzyProcAddress("glAttachObject");
- LinkProgram = (PFNGLLINKPROGRAMARBPROC)getFuzzyProcAddress("glLinkProgram");
- GetObjectParameteriv = (PFNGLGETOBJECTPARAMETERIVARBPROC)
- getFuzzyProcAddress("glGetObjectParameteriv");
- GetInfoLog = (PFNGLGETINFOLOGARBPROC)getFuzzyProcAddress("glGetInfoLog");
- UseProgramObject =(PFNGLUSEPROGRAMOBJECTARBPROC)
- getFuzzyProcAddress("glUseProgramObject");
- GetUniformLocation = (PFNGLGETUNIFORMLOCATIONARBPROC)
+
+ CreateShader = (PFNGLCREATESHADERPROC)getFuzzyProcAddress("glCreateShader");
+ ShaderSource = (PFNGLSHADERSOURCEPROC)getFuzzyProcAddress("glShaderSource");
+ CompileShader = (PFNGLCOMPILESHADERPROC)getFuzzyProcAddress("glCompileShader");
+ CreateProgram= (PFNGLCREATEPROGRAMPROC)getFuzzyProcAddress("glCreateProgram");
+ AttachShader = (PFNGLATTACHSHADERPROC)getFuzzyProcAddress("glAttachShader");
+ LinkProgram = (PFNGLLINKPROGRAMPROC)getFuzzyProcAddress("glLinkProgram");
+ GetShaderiv = (PFNGLGETSHADERIVPROC)getFuzzyProcAddress("glGetShaderiv");
+ GetProgramiv = (PFNGLGETPROGRAMIVPROC)getFuzzyProcAddress("glGetProgramiv");
+ GetShaderInfoLog = (PFNGLGETSHADERINFOLOGPROC)
+ getFuzzyProcAddress("glGetShaderInfoLog");
+ GetProgramInfoLog = (PFNGLGETPROGRAMINFOLOGPROC)
+ getFuzzyProcAddress("glGetProgramInfoLog");
+ UseProgram =(PFNGLUSEPROGRAMPROC) getFuzzyProcAddress("glUseProgram");
+ GetUniformLocation = (PFNGLGETUNIFORMLOCATIONPROC)
getFuzzyProcAddress("glGetUniformLocation");
- Uniform1i = (PFNGLUNIFORM1IARBPROC)getFuzzyProcAddress("glUniform1i");
- Uniform1f = (PFNGLUNIFORM1FARBPROC)getFuzzyProcAddress("glUniform1f");
- Uniform2f = (PFNGLUNIFORM2FARBPROC)getFuzzyProcAddress("glUniform2f");
- Uniform3f = (PFNGLUNIFORM3FARBPROC)getFuzzyProcAddress("glUniform3f");
- Uniform4f = (PFNGLUNIFORM4FARBPROC)getFuzzyProcAddress("glUniform4f");
- Uniform1fv = (PFNGLUNIFORM1FVARBPROC)getFuzzyProcAddress("glUniform1fv");
- UniformMatrix4fv = (PFNGLUNIFORMMATRIX4FVARBPROC)
+ Uniform1i = (PFNGLUNIFORM1IPROC)getFuzzyProcAddress("glUniform1i");
+ Uniform1f = (PFNGLUNIFORM1FPROC)getFuzzyProcAddress("glUniform1f");
+ Uniform2f = (PFNGLUNIFORM2FPROC)getFuzzyProcAddress("glUniform2f");
+ Uniform3f = (PFNGLUNIFORM3FPROC)getFuzzyProcAddress("glUniform3f");
+ Uniform4f = (PFNGLUNIFORM4FPROC)getFuzzyProcAddress("glUniform4f");
+ Uniform1fv = (PFNGLUNIFORM1FVPROC)getFuzzyProcAddress("glUniform1fv");
+ UniformMatrix4fv = (PFNGLUNIFORMMATRIX4FVPROC)
getFuzzyProcAddress("glUniformMatrix4fv");
BlendFuncSeparate = (PFNGLBLENDFUNCSEPARATEPROC)
@@ -431,44 +375,63 @@ namespace glproc {
BlendEquation = (PFNGLBLENDEQUATIONPROC)getFuzzyProcAddress("glBlendEquation");
BlendColor = (PFNGLBLENDCOLORPROC)getFuzzyProcAddress("glBlendColor");
ActiveTexture = (PFNGLACTIVETEXTUREPROC)getFuzzyProcAddress("glActiveTexture");
- GenerateMipmap = (PFNGLGENERATEMIPMAPEXTPROC)getFuzzyProcAddress
+ GenerateMipmap = (PFNGLGENERATEMIPMAPPROC)getFuzzyProcAddress
("glGenerateMipmap");
- CheckFramebufferStatus = (PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC)
+ CheckFramebufferStatus = (PFNGLCHECKFRAMEBUFFERSTATUSPROC)
getFuzzyProcAddress("glCheckFramebufferStatus");
- GenFramebuffers = (PFNGLGENFRAMEBUFFERSEXTPROC)
+ GenFramebuffers = (PFNGLGENFRAMEBUFFERSPROC)
getFuzzyProcAddress("glGenFramebuffers");
- BindFramebuffer = (PFNGLBINDFRAMEBUFFEREXTPROC)
+ BindFramebuffer = (PFNGLBINDFRAMEBUFFERPROC)
getFuzzyProcAddress("glBindFramebuffer");
- FramebufferTexture2D = (PFNGLFRAMEBUFFERTEXTURE2DEXTPROC)
+ FramebufferTexture2D = (PFNGLFRAMEBUFFERTEXTURE2DPROC)
getFuzzyProcAddress("glFramebufferTexture2D");
- DeleteFramebuffers = (PFNGLDELETEFRAMEBUFFERSEXTPROC)
+ DeleteFramebuffers = (PFNGLDELETEFRAMEBUFFERSPROC)
getFuzzyProcAddress("glDeleteFramebuffers");
- GenRenderbuffers = (PFNGLGENRENDERBUFFERSEXTPROC)
+ GenRenderbuffers = (PFNGLGENRENDERBUFFERSPROC)
getFuzzyProcAddress("glGenRenderbuffers");
- BindRenderbuffer = (PFNGLBINDRENDERBUFFEREXTPROC)
+ BindRenderbuffer = (PFNGLBINDRENDERBUFFERPROC)
getFuzzyProcAddress("glBindRenderbuffer");
- RenderbufferStorage= (PFNGLRENDERBUFFERSTORAGEEXTPROC)
+ RenderbufferStorage= (PFNGLRENDERBUFFERSTORAGEPROC)
getFuzzyProcAddress("glRenderbufferStorage");
- RenderbufferStorageMultisample = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC)
+ RenderbufferStorageMultisample = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC)
getFuzzyProcAddress("glRenderbufferStorageMultisample");
- FramebufferRenderbuffer = (PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC)
+ FramebufferRenderbuffer = (PFNGLFRAMEBUFFERRENDERBUFFERPROC)
getFuzzyProcAddress("glFramebufferRenderbuffer");
- BlitFramebuffer = (PFNGLBLITFRAMEBUFFEREXTPROC)
- getFuzzyProcAddress("glBlitFramebuffer");
- DeleteRenderbuffers = (PFNGLDELETERENDERBUFFERSEXTPROC)
+
+ DeleteRenderbuffers = (PFNGLDELETERENDERBUFFERSPROC)
getFuzzyProcAddress("glDeleteRenderbuffers");
- DrawBuffers = (PFNGLDRAWBUFFERSPROC)
- getFuzzyProcAddress("glDrawBuffers");
-#ifdef linux
- SwapIntervalSGI = (PFNGLXSWAPINTERVALSGIPROC)
- getglXProcAddress("glXSwapIntervalSGI");
- WaitVideoSyncSGI = (PFNGLXWAITVIDEOSYNCSGIPROC)
- getglXProcAddress("glXWaitVideoSyncSGI");
-#endif
+#ifndef AVG_ENABLE_EGL
+ BufferSubData = (PFNGLBUFFERSUBDATAPROC)getFuzzyProcAddress("glBufferSubData");
+ GetBufferSubData = (PFNGLGETBUFFERSUBDATAPROC)getFuzzyProcAddress
+ ("glGetBufferSubData");
+ GetObjectParameteriv = (PFNGLGETOBJECTPARAMETERIVARBPROC)
+ getFuzzyProcAddress("glGetObjectParameteriv");
+ BlitFramebuffer = (PFNGLBLITFRAMEBUFFERPROC)
+ getFuzzyProcAddress("glBlitFramebuffer");
+ DrawBuffers = (PFNGLDRAWBUFFERSPROC)getFuzzyProcAddress("glDrawBuffers");
+ DrawRangeElements = (PFNGLDRAWRANGEELEMENTSPROC)
+ getFuzzyProcAddress("glDrawRangeElements");
+ DebugMessageCallback = (PFNGLDEBUGMESSAGECALLBACKARBPROC)
+ getFuzzyProcAddress("glDebugMessageCallback");
+#endif
+ VertexAttribPointer = (PFNGLVERTEXATTRIBPOINTERPROC)
+ getFuzzyProcAddress("glVertexAttribPointer");
+ EnableVertexAttribArray = (PFNGLENABLEVERTEXATTRIBARRAYPROC)
+ getFuzzyProcAddress("glEnableVertexAttribArray");
+ BindAttribLocation = (PFNGLBINDATTRIBLOCATIONPROC)
+ getFuzzyProcAddress("glBindAttribLocation");
+#if defined(linux) && !defined(AVG_ENABLE_EGL)
+ SwapIntervalEXT = (PFNGLXSWAPINTERVALEXTPROC)
+ getglXProcAddress("glXSwapIntervalEXT");
+#endif
#ifdef _WIN32
- SwapIntervalEXT = (PFNWGLEXTSWAPCONTROLPROC)
+ GetExtensionsStringARB = (PFNWGLGETEXTENSIONSSTRINGARBPROC)
+ getwglProcAddress("wglGetExtensionsStringARB");
+ GetSwapIntervalEXT = (PFNWGLGETSWAPINTERVALEXTPROC)
+ getwglProcAddress("wglGetSwapIntervalEXT");
+ SwapIntervalEXT = (PFNWGLSWAPINTERVALEXTPROC)
getwglProcAddress("wglSwapIntervalEXT");
#endif
}
diff --git a/src/graphics/OGLHelper.h b/src/graphics/OGLHelper.h
index 514142a..25531d6 100644
--- a/src/graphics/OGLHelper.h
+++ b/src/graphics/OGLHelper.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -23,39 +23,61 @@
#define _OGLHelper_H_
#include "../api.h"
+#include "../avgconfigwrapper.h"
+
#ifdef _WIN32
-#include <windows.h>
-#undef ERROR
-#undef WARNING
-#include <GL/gl.h>
-#include <GL/glu.h>
-#include "GL/glext.h"
+ #include <windows.h>
+ #undef ERROR
+ #undef WARNING
+ #include <GL/gl.h>
+ #include <GL/glu.h>
+ #include "GL/glext.h"
+ #include "GL/wglext.h"
#else
-#include "GL/gl.h"
-#include "GL/glu.h"
+ #ifdef AVG_ENABLE_EGL
+ #define EGL_EGLEXT_PROTOTYPES
+ #include <EGL/egl.h>
+ #include <GLES2/gl2.h>
+ #include <GLES2/gl2ext.h>
+ #else
+ #include "GL/gl.h"
+ #include "GL/glu.h"
+ #include "GL/glext.h"
+ #endif
+#endif
+#if defined(linux) && !defined(AVG_ENABLE_EGL)
+ #define GLX_GLXEXT_PROTOTYPES
+ #ifndef __GLXextFuncPtr
+ typedef void (*__GLXextFuncPtr)(void);
+ #endif
+ #include "GL/glx.h"
#endif
+
#ifdef linux
-#define GLX_GLXEXT_PROTOTYPES
-#include <GL/glx.h>
+ #ifndef GLX_CONTEXT_ES2_PROFILE_BIT_EXT
+ #define GLX_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004
+ #endif
#endif
-#ifdef _WIN32
-//TODO: Does anyone know where these are declared?
-typedef void (APIENTRY *PFNWGLEXTSWAPCONTROLPROC) (int);
-typedef int (*PFNWGLEXTGETSWAPINTERVALPROC) (void);
+
+// For NVX_gpu_memory_info
+#ifndef GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX
+ #define GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX 0x9047
+ #define GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX 0x9048
+ #define GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX 0x9049
+ #define GPU_MEMORY_INFO_EVICTION_COUNT_NVX 0x904A
+ #define GPU_MEMORY_INFO_EVICTED_MEMORY_NVX 0x904B
#endif
#include <string>
+#ifndef APIENTRY
+#define APIENTRY
+#endif
+
namespace avg {
-void AVG_API OGLErrorCheck(int avgcode, const char* pszWhere);
-#ifdef _WIN32
-void AVG_API winOGLErrorCheck(BOOL bOK, const std::string& sWhere);
-#endif
bool AVG_API queryOGLExtension(const char* extName);
bool AVG_API queryGLXExtension(const char* extName);
-void AVG_API getGLVersion(int& major, int& minor);
-void AVG_API getGLShadingLanguageVersion(int& major, int& minor);
std::string AVG_API oglModeToString(int mode);
enum OGLMemoryMode {
@@ -65,76 +87,166 @@ enum OGLMemoryMode {
std::string oglMemoryMode2String(OGLMemoryMode mode);
-void AVG_API pushGLState();
-void AVG_API popGLState();
-
-void AVG_API clearGLBuffers(GLbitfield mask);
+void AVG_API clearGLBuffers(GLbitfield mask, bool bOpaque);
typedef void (*GLfunction)();
GLfunction AVG_API getFuzzyProcAddress(const char * psz);
+#ifdef linux
+GLfunction getglXProcAddress(const char * psz);
+#endif
+
+#ifdef AVG_ENABLE_EGL
+#define GL_WRITE_ONLY GL_WRITE_ONLY_OES
+#define GL_DYNAMIC_READ 0x88E9
+#define GL_BGRA 0x80E1
+
+typedef void (GL_APIENTRYP PFNGLGENBUFFERSPROC) (GLsizei n, GLuint *buffers);
+typedef void (GL_APIENTRYP PFNGLBUFFERDATAPROC) (GLenum target, GLsizeiptr size,
+ const GLvoid* data, GLenum usage);
+typedef void (APIENTRY* DEBUGCALLBACKPROC) (GLenum source, GLenum type, GLuint id,
+ GLenum severity, GLsizei length, const GLchar* message, GLvoid* userParam);
+typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGECALLBACKPROC) (DEBUGCALLBACKPROC callback,
+ void* userParam);
+typedef void (GL_APIENTRYP PFNGLDELETEBUFFERSPROC) (GLsizei n, const GLuint* buffers);
+typedef void (GL_APIENTRYP PFNGLBINDBUFFERPROC) (GLenum target, GLuint buffer);
+typedef void* (GL_APIENTRYP PFNGLMAPBUFFERPROC) (GLenum target, GLenum access);
+typedef GLboolean (GL_APIENTRYP PFNGLUNMAPBUFFERPROC) (GLenum target);
+typedef GLuint (GL_APIENTRYP PFNGLCREATESHADERPROC) (GLenum type);
+typedef void (GL_APIENTRYP PFNGLSHADERSOURCEPROC) (GLuint shader, GLsizei count,
+ const GLchar** string, const GLint* length);
+typedef void (GL_APIENTRYP PFNGLCOMPILESHADERPROC) (GLuint shader);
+typedef GLuint (GL_APIENTRYP PFNGLCREATEPROGRAMPROC) (void);
+typedef void (GL_APIENTRYP PFNGLATTACHSHADERPROC) (GLuint program, GLuint shader);
+typedef void (GL_APIENTRYP PFNGLLINKPROGRAMPROC) (GLuint program);
+typedef void (GL_APIENTRYP PFNGLGETSHADERIVPROC) (GLuint shader, GLenum pname,
+ GLint* params);
+typedef void (GL_APIENTRYP PFNGLGETPROGRAMIVPROC) (GLuint program, GLenum pname,
+ GLint* params);
+typedef void (GL_APIENTRYP PFNGLGETSHADERINFOLOGPROC) (GLuint shader, GLsizei bufsize,
+ GLsizei* length, GLchar* infolog);
+typedef void (GL_APIENTRYP PFNGLGETPROGRAMINFOLOGPROC) (GLuint shader, GLsizei bufsize,
+ GLsizei* length, GLchar* infolog);
+typedef void (GL_APIENTRYP PFNGLUSEPROGRAMPROC) (GLuint program);
+typedef int (GL_APIENTRYP PFNGLGETUNIFORMLOCATIONPROC) (GLuint program,
+ const GLchar* name);
+typedef void (GL_APIENTRYP PFNGLUNIFORM1IPROC) (GLint location, GLint x);
+typedef void (GL_APIENTRYP PFNGLUNIFORM1FPROC) (GLint location, GLfloat x);
+typedef void (GL_APIENTRYP PFNGLUNIFORM2FPROC) (GLint location, GLfloat x, GLfloat y);
+typedef void (GL_APIENTRYP PFNGLUNIFORM3FPROC) (GLint location, GLfloat x, GLfloat y,
+ GLfloat z);
+typedef void (GL_APIENTRYP PFNGLUNIFORM4FPROC) (GLint location, GLfloat x, GLfloat y,
+ GLfloat z, GLfloat w);
+typedef void (GL_APIENTRYP PFNGLUNIFORM1FVPROC) (GLint location, GLsizei count,
+ const GLfloat* v);
+typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX4FVPROC) (GLint location, GLsizei count,
+ GLboolean transpose, const GLfloat* value);
+typedef void (GL_APIENTRYP PFNGLBLENDFUNCSEPARATEPROC) (GLenum srcRGB, GLenum dstRGB,
+ GLenum srcAlpha, GLenum dstAlpha);
+typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONPROC) ( GLenum mode );
+typedef void (GL_APIENTRYP PFNGLBLENDCOLORPROC) (GLclampf red, GLclampf green,
+ GLclampf blue, GLclampf alpha);
+typedef void (GL_APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture);
+typedef void (GL_APIENTRYP PFNGLGENERATEMIPMAPPROC) (GLenum target);
+typedef GLenum (GL_APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSPROC) (GLenum target);
+typedef void (GL_APIENTRYP PFNGLGENFRAMEBUFFERSPROC) (GLsizei n, GLuint* framebuffers);
+typedef void (GL_APIENTRYP PFNGLBINDFRAMEBUFFERPROC) (GLenum target, GLuint framebuffer);
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DPROC) (GLenum target,
+ GLenum attachment, GLenum textarget, GLuint texture, GLint level);
+typedef void (GL_APIENTRYP PFNGLDELETEFRAMEBUFFERSPROC) (GLsizei n,
+ const GLuint* framebuffers);
+typedef void (GL_APIENTRYP PFNGLGENRENDERBUFFERSPROC) (GLsizei n, GLuint* renderbuffers);
+typedef void (GL_APIENTRYP PFNGLBINDRENDERBUFFERPROC) (GLenum target,
+ GLuint renderbuffer);
+typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEPROC) (GLenum target,
+ GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC) (GLenum target,
+ GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFERPROC) (GLenum target,
+ GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
+//TODO: BLITFRAMEBUFFER
+typedef void (GL_APIENTRYP PFNGLDELETERENDERBUFFERSPROC) (GLsizei n,
+ const GLuint* renderbuffers);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBPOINTERPROC) (GLuint indx, GLint size,
+ GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr);
+typedef void (GL_APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYPROC) (GLuint index);
+typedef void (GL_APIENTRYP PFNGLBINDATTRIBLOCATIONPROC) (GLuint program, GLuint index,
+ const GLchar* name);
+#else
+#define PFNGLDEBUGMESSAGECALLBACKPROC PFNGLDEBUGMESSAGECALLBACKARBPROC
+#endif
namespace glproc {
extern AVG_API PFNGLGENBUFFERSPROC GenBuffers;
extern AVG_API PFNGLBUFFERDATAPROC BufferData;
+#ifndef AVG_ENABLE_EGL
extern AVG_API PFNGLBUFFERSUBDATAPROC BufferSubData;
+ extern AVG_API PFNGLGETBUFFERSUBDATAPROC GetBufferSubData;
+ extern AVG_API PFNGLDRAWBUFFERSPROC DrawBuffers;
+ extern AVG_API PFNGLDRAWRANGEELEMENTSPROC DrawRangeElements;
+ extern AVG_API PFNGLBLITFRAMEBUFFERPROC BlitFramebuffer;
+ extern AVG_API PFNGLGETOBJECTPARAMETERIVARBPROC GetObjectParameteriv;
+#endif
+ extern AVG_API PFNGLDEBUGMESSAGECALLBACKPROC DebugMessageCallback;
extern AVG_API PFNGLDELETEBUFFERSPROC DeleteBuffers;
extern AVG_API PFNGLBINDBUFFERPROC BindBuffer;
extern AVG_API PFNGLMAPBUFFERPROC MapBuffer;
extern AVG_API PFNGLUNMAPBUFFERPROC UnmapBuffer;
- extern AVG_API PFNGLGETBUFFERSUBDATAPROC GetBufferSubData;
- extern AVG_API PFNGLCREATESHADEROBJECTARBPROC CreateShaderObject;
- extern AVG_API PFNGLSHADERSOURCEARBPROC ShaderSource;
- extern AVG_API PFNGLCOMPILESHADERARBPROC CompileShader;
- extern AVG_API PFNGLCREATEPROGRAMOBJECTARBPROC CreateProgramObject;
- extern AVG_API PFNGLATTACHOBJECTARBPROC AttachObject;
- extern AVG_API PFNGLLINKPROGRAMARBPROC LinkProgram;
- extern AVG_API PFNGLGETOBJECTPARAMETERIVARBPROC GetObjectParameteriv;
- extern AVG_API PFNGLGETINFOLOGARBPROC GetInfoLog;
- extern AVG_API PFNGLUSEPROGRAMOBJECTARBPROC UseProgramObject;
- extern AVG_API PFNGLGETUNIFORMLOCATIONARBPROC GetUniformLocation;
- extern AVG_API PFNGLUNIFORM1IARBPROC Uniform1i;
- extern AVG_API PFNGLUNIFORM1FARBPROC Uniform1f;
- extern AVG_API PFNGLUNIFORM2FARBPROC Uniform2f;
- extern AVG_API PFNGLUNIFORM3FARBPROC Uniform3f;
- extern AVG_API PFNGLUNIFORM4FARBPROC Uniform4f;
- extern AVG_API PFNGLUNIFORM1FVARBPROC Uniform1fv;
- extern AVG_API PFNGLUNIFORMMATRIX4FVARBPROC UniformMatrix4fv;
+ extern AVG_API PFNGLCREATESHADERPROC CreateShader;
+ extern AVG_API PFNGLSHADERSOURCEPROC ShaderSource;
+ extern AVG_API PFNGLCOMPILESHADERPROC CompileShader;
+ extern AVG_API PFNGLCREATEPROGRAMPROC CreateProgram;
+ extern AVG_API PFNGLATTACHSHADERPROC AttachShader;
+ extern AVG_API PFNGLLINKPROGRAMPROC LinkProgram;
+ extern AVG_API PFNGLGETSHADERIVPROC GetShaderiv;
+ extern AVG_API PFNGLGETPROGRAMIVPROC GetProgramiv;
+ extern AVG_API PFNGLGETSHADERINFOLOGPROC GetShaderInfoLog;
+ extern AVG_API PFNGLGETPROGRAMINFOLOGPROC GetProgramInfoLog;
+ extern AVG_API PFNGLUSEPROGRAMPROC UseProgram;
+ extern AVG_API PFNGLGETUNIFORMLOCATIONPROC GetUniformLocation;
+ extern AVG_API PFNGLUNIFORM1IPROC Uniform1i;
+ extern AVG_API PFNGLUNIFORM1FPROC Uniform1f;
+ extern AVG_API PFNGLUNIFORM2FPROC Uniform2f;
+ extern AVG_API PFNGLUNIFORM3FPROC Uniform3f;
+ extern AVG_API PFNGLUNIFORM4FPROC Uniform4f;
+ extern AVG_API PFNGLUNIFORM1FVPROC Uniform1fv;
+ extern AVG_API PFNGLUNIFORMMATRIX4FVPROC UniformMatrix4fv;
extern AVG_API PFNGLBLENDFUNCSEPARATEPROC BlendFuncSeparate;
extern AVG_API PFNGLBLENDEQUATIONPROC BlendEquation;
extern AVG_API PFNGLBLENDCOLORPROC BlendColor;
extern AVG_API PFNGLACTIVETEXTUREPROC ActiveTexture;
- extern AVG_API PFNGLGENERATEMIPMAPEXTPROC GenerateMipmap;
-
- extern AVG_API PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC CheckFramebufferStatus;
- extern AVG_API PFNGLGENFRAMEBUFFERSEXTPROC GenFramebuffers;
- extern AVG_API PFNGLBINDFRAMEBUFFEREXTPROC BindFramebuffer;
- extern AVG_API PFNGLFRAMEBUFFERTEXTURE2DEXTPROC FramebufferTexture2D;
- extern AVG_API PFNGLDELETEFRAMEBUFFERSEXTPROC DeleteFramebuffers;
- extern AVG_API PFNGLGENRENDERBUFFERSEXTPROC GenRenderbuffers;
- extern AVG_API PFNGLBINDRENDERBUFFEREXTPROC BindRenderbuffer;
- extern AVG_API PFNGLRENDERBUFFERSTORAGEEXTPROC RenderbufferStorage;
- extern AVG_API PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC
+ extern AVG_API PFNGLGENERATEMIPMAPPROC GenerateMipmap;
+
+ extern AVG_API PFNGLCHECKFRAMEBUFFERSTATUSPROC CheckFramebufferStatus;
+ extern AVG_API PFNGLGENFRAMEBUFFERSPROC GenFramebuffers;
+ extern AVG_API PFNGLBINDFRAMEBUFFERPROC BindFramebuffer;
+ extern AVG_API PFNGLFRAMEBUFFERTEXTURE2DPROC FramebufferTexture2D;
+ extern AVG_API PFNGLDELETEFRAMEBUFFERSPROC DeleteFramebuffers;
+ extern AVG_API PFNGLGENRENDERBUFFERSPROC GenRenderbuffers;
+ extern AVG_API PFNGLBINDRENDERBUFFERPROC BindRenderbuffer;
+ extern AVG_API PFNGLRENDERBUFFERSTORAGEPROC RenderbufferStorage;
+ extern AVG_API PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC
RenderbufferStorageMultisample;
- extern AVG_API PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC FramebufferRenderbuffer;
- extern AVG_API PFNGLBLITFRAMEBUFFEREXTPROC BlitFramebuffer;
- extern AVG_API PFNGLDELETERENDERBUFFERSEXTPROC DeleteRenderbuffers;
- extern AVG_API PFNGLDRAWBUFFERSPROC DrawBuffers;
-
-#ifdef linux
- extern PFNGLXSWAPINTERVALSGIPROC SwapIntervalSGI;
- extern PFNGLXWAITVIDEOSYNCSGIPROC WaitVideoSyncSGI;
+ extern AVG_API PFNGLFRAMEBUFFERRENDERBUFFERPROC FramebufferRenderbuffer;
+ extern AVG_API PFNGLDELETERENDERBUFFERSPROC DeleteRenderbuffers;
+
+ extern AVG_API PFNGLVERTEXATTRIBPOINTERPROC VertexAttribPointer;
+ extern AVG_API PFNGLENABLEVERTEXATTRIBARRAYPROC EnableVertexAttribArray;
+ extern AVG_API PFNGLBINDATTRIBLOCATIONPROC BindAttribLocation;
+#if defined(linux) && !defined(AVG_ENABLE_EGL)
+ extern PFNGLXSWAPINTERVALEXTPROC SwapIntervalEXT;
#endif
#ifdef _WIN32
- extern AVG_API PFNWGLEXTSWAPCONTROLPROC SwapIntervalEXT;
+ extern AVG_API PFNWGLGETEXTENSIONSSTRINGARBPROC GetExtensionsStringARB;
+ extern AVG_API PFNWGLGETSWAPINTERVALEXTPROC GetSwapIntervalEXT;
+ extern AVG_API PFNWGLSWAPINTERVALEXTPROC SwapIntervalEXT;
#endif
void init();
extern void * s_hGLLib;
}
-
}
#endif
diff --git a/src/graphics/OGLImagingContext.cpp b/src/graphics/OGLImagingContext.cpp
deleted file mode 100644
index 692b430..0000000
--- a/src/graphics/OGLImagingContext.cpp
+++ /dev/null
@@ -1,105 +0,0 @@
-//
-// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 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 "OGLImagingContext.h"
-#undef check
-#include "ShaderRegistry.h"
-#include "GPUFilter.h"
-
-#include "../base/Exception.h"
-
-#ifdef _WIN32
-// XXX: If the following includes are not there, the MS linker optimizes away
-// the classes so they can't be used by plugins anymore (!). Adding /OPT:NOREF
-// to the linker flags doesn't help.
-#include "FilterGetAlpha.h"
-#include "FilterErosion.h"
-#include "FilterDilation.h"
-#include "FilterGetAlpha.h"
-#include "FilterResizeBilinear.h"
-#include "FilterResizeGaussian.h"
-#include "FilterThreshold.h"
-#endif
-
-#include <iostream>
-
-namespace avg {
-
-using namespace std;
-
-OGLImagingContext::OGLImagingContext()
- : GLContext()
-{
- init();
-
- if (!isSupported()) {
- throw Exception(AVG_ERR_VIDEO_GENERAL,
- "GPU imaging not supported by current OpenGL configuration.");
- }
-
- setStandardState();
-}
-
-OGLImagingContext::~OGLImagingContext()
-{
-}
-
-bool OGLImagingContext::isSupported()
-{
- int glMajorVer;
- int glMinorVer;
- int slMajorVer;
- int slMinorVer;
- getGLVersion(glMajorVer, glMinorVer);
- getGLShadingLanguageVersion(slMajorVer, slMinorVer);
- return (glMajorVer > 1 && queryOGLExtension("GL_ARB_texture_rectangle") &&
- queryOGLExtension("GL_ARB_pixel_buffer_object") &&
- queryOGLExtension("GL_EXT_framebuffer_object"));
-}
-
-void OGLImagingContext::setStandardState()
-{
- // Shading etc.
- glDisable(GL_BLEND);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "glDisable(GL_BLEND)");
- glShadeModel(GL_FLAT);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "glShadeModel(GL_FLAT)");
- glDisable(GL_DEPTH_TEST);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "glDisable(GL_DEPTH_TEST)");
- glDisable(GL_STENCIL_TEST);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "glDisable(GL_STENCIL_TEST)");
-
- // Texturing
- glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "glTexEnvf()");
- glBlendFunc(GL_ONE, GL_ZERO);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "glBlendFunc()");
- glDisable(GL_MULTISAMPLE);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "glDisable(GL_MULTISAMPLE);");
-
- glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
- glPixelStorei(GL_PACK_ALIGNMENT, 1);
- glEnableClientState(GL_VERTEX_ARRAY);
- glEnableClientState(GL_TEXTURE_COORD_ARRAY);
-}
-
-}
-
diff --git a/src/graphics/OGLShader.cpp b/src/graphics/OGLShader.cpp
index 7e17690..3abc40d 100644
--- a/src/graphics/OGLShader.cpp
+++ b/src/graphics/OGLShader.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -20,148 +20,187 @@
//
#include "OGLShader.h"
+#include "ShaderRegistry.h"
#include "../base/Logger.h"
#include "../base/Exception.h"
-#include "../base/Matrix3x4.h"
+#include "../base/OSHelper.h"
+
+#include "../graphics/VertexArray.h"
#include <iostream>
+#include <sstream>
using namespace std;
namespace avg {
-OGLShader::OGLShader(string sProgram)
- : m_sProgram(sProgram)
+OGLShader::OGLShader(const string& sName, const string& sVertProgram,
+ const string& sFragProgram, const string& sVertPrefix, const string& sFragPrefix)
+ : m_sName(sName),
+ m_sVertProgram(sVertProgram),
+ m_sFragProgram(sFragProgram)
{
- m_hFragmentShader = glproc::CreateShaderObject(GL_FRAGMENT_SHADER);
- const char * pProgramStr = m_sProgram.c_str();
- glproc::ShaderSource(m_hFragmentShader, 1, &pProgramStr, 0);
- glproc::CompileShader(m_hFragmentShader);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "OGLShader::OGLShader: glCompileShader()");
- dumpInfoLog(m_hFragmentShader);
-
- m_hProgram = glproc::CreateProgramObject();
- glproc::AttachObject(m_hProgram, m_hFragmentShader);
+ m_hProgram = glproc::CreateProgram();
+ if (sVertProgram == "") {
+ m_hVertexShader = 0;
+ } else {
+ glproc::BindAttribLocation(m_hProgram, VertexArray::TEX_INDEX, "a_TexCoord");
+ glproc::BindAttribLocation(m_hProgram, VertexArray::COLOR_INDEX, "a_Color");
+ glproc::BindAttribLocation(m_hProgram, VertexArray::POS_INDEX, "a_Pos");
+ m_hVertexShader = compileShader(GL_VERTEX_SHADER, sVertProgram, sVertPrefix);
+ glproc::AttachShader(m_hProgram, m_hVertexShader);
+ }
+ m_hFragmentShader = compileShader(GL_FRAGMENT_SHADER, sFragProgram, sFragPrefix);
+
+ glproc::AttachShader(m_hProgram, m_hFragmentShader);
glproc::LinkProgram(m_hProgram);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "OGLShader::OGLShader: glLinkProgram()");
+ GLContext::checkError("OGLShader::OGLShader: glLinkProgram()");
GLint bLinked;
- glproc::GetObjectParameteriv(m_hProgram, GL_OBJECT_LINK_STATUS_ARB, &bLinked);
- dumpInfoLog(m_hProgram);
+ glproc::GetProgramiv(m_hProgram, GL_LINK_STATUS, &bLinked);
if (!bLinked) {
- AVG_TRACE(Logger::ERROR, "Linking shader program failed. Aborting.");
+ AVG_LOG_ERROR("Linking shader program '"+sName+"' failed. Aborting.");
+ dumpInfoLog(m_hVertexShader, Logger::severity::ERROR);
+ dumpInfoLog(m_hFragmentShader, Logger::severity::ERROR);
+ dumpInfoLog(m_hProgram, Logger::severity::ERROR, true);
exit(-1);
+ } else {
+ AVG_TRACE(Logger::category::SHADER, Logger::severity::INFO,
+ "Linking shader program '"+sName+"'.");
+ dumpInfoLog(m_hVertexShader, Logger::severity::INFO);
+ dumpInfoLog(m_hFragmentShader, Logger::severity::INFO);
+ dumpInfoLog(m_hProgram, Logger::severity::INFO, true);
+ }
+ m_pShaderRegistry = &*ShaderRegistry::get();
+ if (m_hVertexShader) {
+ m_pTransformParam = getParam<glm::mat4>("transform");
}
-
}
OGLShader::~OGLShader()
{
}
-void OGLShader::activate()
+bool isMountainLion()
{
- glproc::UseProgramObject(m_hProgram);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "OGLShader::activate: glUseProgramObject()");
+#ifdef __APPLE__
+ return getOSXMajorVersion() >= 12;
+#else
+ return false;
+#endif
}
-GLhandleARB OGLShader::getProgram()
+void OGLShader::activate()
{
- return m_hProgram;
+ // If we're running on OS X mountain lion, we need to disable shader activation
+ // caching (See bug #355).
+ OGLShaderPtr pCurShader = m_pShaderRegistry->getCurShader();
+ if (isMountainLion() || !pCurShader || &*pCurShader != this) {
+ glproc::UseProgram(m_hProgram);
+ m_pShaderRegistry->setCurShader(m_sName);
+ GLContext::checkError("OGLShader::activate: glUseProgram()");
+ }
}
-void OGLShader::setUniformIntParam(const std::string& sName, int val)
+GLuint OGLShader::getProgram()
{
- int loc = safeGetUniformLoc(sName);
- glproc::Uniform1i(loc, val);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL,
- (string("OGLShader: glUniform(")+sName+")").c_str());
+ return m_hProgram;
}
-void OGLShader::setUniformFloatParam(const std::string& sName, float val)
+const std::string OGLShader::getName() const
{
- int loc = safeGetUniformLoc(sName);
- glproc::Uniform1f(loc, val);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL,
- (string("OGLShader: glUniform(")+sName+")").c_str());
+ return m_sName;
}
-void OGLShader::setUniformFloatParam(const std::string& sName, double val)
+void OGLShader::setTransform(const glm::mat4& transform)
{
- return setUniformFloatParam(sName, float(val));
+ if (m_hVertexShader) {
+ m_pTransformParam->set(transform);
+ } else {
+#ifdef AVG_ENABLE_EGL
+ // No fixed-function vertex shader in gles
+ AVG_ASSERT(false);
+#else
+ glLoadMatrixf(glm::value_ptr(transform));
+#endif
+ }
}
-void OGLShader::setUniformFloatArrayParam(const std::string& sName, int count,
- float* pVal)
+GLuint OGLShader::compileShader(GLenum shaderType, const std::string& sProgram,
+ const std::string& sPrefix)
{
- int loc = safeGetUniformLoc(sName);
- glproc::Uniform1fv(loc, count, pVal);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL,
- (string("OGLShader: glUniform(")+sName+")").c_str());
+ const char * pProgramStrs[2];
+ pProgramStrs[0] = sPrefix.c_str();
+ pProgramStrs[1] = sProgram.c_str();
+ GLuint hShader = glproc::CreateShader(shaderType);
+ glproc::ShaderSource(hShader, 2, pProgramStrs, 0);
+ glproc::CompileShader(hShader);
+ GLContext::checkError("OGLShader::compileShader()");
+ return hShader;
}
-void OGLShader::setUniformDPointParam(const std::string& sName, DPoint pt)
-{
- int loc = safeGetUniformLoc(sName);
- glproc::Uniform2f(loc, (float)pt.x, (float)pt.y);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL,
- (string("OGLShader: glUniform(")+sName+")").c_str());
-}
-
-void OGLShader::setUniformColorParam(const std::string& sName, Pixel32 col)
+bool OGLShader::findParam(const std::string& sName, unsigned& pos)
{
- int loc = safeGetUniformLoc(sName);
- glproc::Uniform4f(loc, col.getR()/255.f, col.getG()/255.f, col.getB()/255.f,
- col.getA()/255.f);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL,
- (string("OGLShader: glUniform(")+sName+")").c_str());
-}
-
-void OGLShader::setUniformVec4fParam(const std::string& sName, float x, float y, float z,
- float w)
-{
- int loc = safeGetUniformLoc(sName);
- glproc::Uniform4f(loc, x, y, z, w);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL,
- (string("OGLShader: glUniform(")+sName+")").c_str());
+ GLShaderParamPtr pParam;
+ bool bFound = false;
+ pos = 0;
+ while (!bFound && pos<m_pParams.size() && m_pParams[pos]->getName() <= sName) {
+ if (m_pParams[pos]->getName() == sName) {
+ bFound = true;
+ } else {
+ ++pos;
+ }
+ }
+ return bFound;
}
-void OGLShader::dumpInfoLog(GLhandleARB hObj)
+void OGLShader::dumpInfoLog(GLuint hObj, long level, bool bIsProgram)
{
- int InfoLogLength;
- GLcharARB * pInfoLog;
-
- glproc::GetObjectParameteriv(hObj, GL_OBJECT_INFO_LOG_LENGTH_ARB, &InfoLogLength);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL,
- "OGLShader::dumpInfoLog: glGetObjectParameteriv()");
- bool bLogContainsGarbage = (string((char *)glGetString(GL_VENDOR))
- != "NVIDIA Corporation");
- if (InfoLogLength > 1 && !bLogContainsGarbage) {
- pInfoLog = (GLcharARB*)malloc(InfoLogLength);
- int CharsWritten;
- glproc::GetInfoLog(hObj, InfoLogLength, &CharsWritten, pInfoLog);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL,
- "OGLShader::dumpInfoLog: glGetInfoLog()");
- AVG_TRACE(Logger::WARNING, pInfoLog);
+ int infoLogLength;
+ GLchar * pInfoLog;
+
+ if (!hObj) {
+ return;
+ }
+
+ if (bIsProgram) {
+ glproc::GetProgramiv(hObj, GL_INFO_LOG_LENGTH, &infoLogLength);
+ } else {
+ glproc::GetShaderiv(hObj, GL_INFO_LOG_LENGTH, &infoLogLength);
+ }
+ GLContext::checkError("OGLShader::dumpInfoLog: glGetShaderiv()");
+ if (infoLogLength > 1) {
+ pInfoLog = (GLchar*)malloc(infoLogLength);
+ int charsWritten;
+ if (bIsProgram) {
+ glproc::GetProgramInfoLog(hObj, infoLogLength, &charsWritten, pInfoLog);
+ } else {
+ glproc::GetShaderInfoLog(hObj, infoLogLength, &charsWritten, pInfoLog);
+ }
+ string sLog = removeATIInfoLogSpam(pInfoLog);
+ GLContext::checkError("OGLShader::dumpInfoLog: glGetShaderInfoLog()");
+ if (sLog.size() > 3) {
+ AVG_TRACE(Logger::category::SHADER, level, sLog);
+ }
free(pInfoLog);
}
}
-int OGLShader::safeGetUniformLoc(const std::string& sName)
+string OGLShader::removeATIInfoLogSpam(const string& sOrigLog)
{
- // TODO: This takes too much time if it's called whenever the parameter is set.
- map<string, int>::iterator pos = m_UniformLocationMap.find(sName);
- if (pos == m_UniformLocationMap.end()) {
- int loc = glproc::GetUniformLocation(m_hProgram, sName.c_str());
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL,
- "OGLShader::setUniformIntParam: GetUniformLocation()");
- m_UniformLocationMap[sName] = loc;
- return loc;
- } else {
- return pos->second;
+ istringstream stream(sOrigLog);
+ string sLog;
+ string sCurLine;
+ while(getline(stream, sCurLine)) {
+ bool bLineBroken = (sCurLine.find(
+ "shader was successfully compiled to run on hardware.") != string::npos)
+ || (sCurLine.find("shader(s) linked.") != string::npos);
+ if (!bLineBroken) {
+ sLog.append(sCurLine+"\n");
+ }
}
+ return sLog;
}
-
}
diff --git a/src/graphics/OGLShader.h b/src/graphics/OGLShader.h
index ba91ff9..9167f03 100644
--- a/src/graphics/OGLShader.h
+++ b/src/graphics/OGLShader.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -24,46 +24,73 @@
#include "../api.h"
#include "OGLHelper.h"
+#include "GLShaderParam.h"
#include "Pixel32.h"
-#include "../base/Point.h"
+#include "../base/GLMHelper.h"
#include <boost/shared_ptr.hpp>
#include <string>
-#include <map>
+#include <vector>
namespace avg {
-class Matrix3x4;
+class ShaderRegistry;
+typedef boost::shared_ptr<ShaderRegistry> ShaderRegistryPtr;
class AVG_API OGLShader {
public:
virtual ~OGLShader();
void activate();
- GLhandleARB getProgram();
-
- void setUniformIntParam(const std::string& sName, int val);
- void setUniformFloatParam(const std::string& sName, float val);
- void setUniformFloatParam(const std::string& sName, double val);
- void setUniformFloatArrayParam(const std::string& sName, int count, float* pVal);
- void setUniformDPointParam(const std::string& sName, DPoint pt);
- void setUniformColorParam(const std::string& sName, Pixel32 col);
- void setUniformVec4fParam(const std::string& sName, float x, float y, float z,
- float w);
+ GLuint getProgram();
+ const std::string getName() const;
+
+ void setTransform(const glm::mat4& transform);
+
+ template<class VAL_TYPE>
+ boost::shared_ptr<GLShaderParamTemplate<VAL_TYPE> > getParam(
+ const std::string& sName)
+ {
+ unsigned pos;
+ bool bFound = findParam(sName, pos);
+ GLShaderParamPtr pParam;
+ if (bFound) {
+ pParam = m_pParams[pos];
+ } else {
+ pParam = GLShaderParamPtr(
+ new GLShaderParamTemplate<VAL_TYPE>(this, sName));
+ m_pParams.insert(m_pParams.begin()+pos, pParam);
+ }
+ return boost::dynamic_pointer_cast<
+ GLShaderParamTemplate<VAL_TYPE> >(pParam);
+ }
private:
- OGLShader(std::string sProgram);
+ OGLShader(const std::string& sName, const std::string& sVertProgram,
+ const std::string& sFragProgram, const std::string& sVertPrefix,
+ const std::string& sFragPrefix);
friend class ShaderRegistry;
- void dumpInfoLog(GLhandleARB hObj);
- int safeGetUniformLoc(const std::string& sName);
+ GLuint compileShader(GLenum shaderType, const std::string& sProgram,
+ const std::string& sPrefix);
+ bool findParam(const std::string& sName, unsigned& pos);
+ void dumpInfoLog(GLuint hObj, long severity, bool bIsProgram=false);
+ std::string removeATIInfoLogSpam(const std::string& sLog);
+
+ std::string m_sName;
+ GLuint m_hVertexShader;
+ GLuint m_hFragmentShader;
+ GLuint m_hProgram;
+ std::string m_sVertProgram;
+ std::string m_sFragProgram;
+
+ std::vector<GLShaderParamPtr> m_pParams;
+ Mat4fGLShaderParamPtr m_pTransformParam;
- GLhandleARB m_hFragmentShader;
- GLhandleARB m_hProgram;
- std::string m_sProgram;
- std::map<std::string, int> m_UniformLocationMap;
+ // Dumb pointer for speed reasons.
+ ShaderRegistry* m_pShaderRegistry;
};
typedef boost::shared_ptr<OGLShader> OGLShaderPtr;
diff --git a/src/graphics/PBO.cpp b/src/graphics/PBO.cpp
index a54eab0..64967de 100644
--- a/src/graphics/PBO.cpp
+++ b/src/graphics/PBO.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -43,10 +43,9 @@ PBO::PBO(const IntPoint& size, PixelFormat pf, unsigned usage)
unsigned target = getTarget();
glproc::BindBuffer(target, m_PBOID);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "PBO: BindBuffer()");
- int memNeeded = size.x*size.y*getBytesPerPixel(pf);
- glproc::BufferData(target, memNeeded, 0, usage);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "PBO: BufferData()");
+ GLContext::checkError("PBO: BindBuffer()");
+ glproc::BufferData(target, getMemNeeded(), 0, usage);
+ GLContext::checkError("PBO: BufferData()");
glproc::BindBuffer(target, 0);
}
@@ -59,34 +58,36 @@ PBO::~PBO()
pContext->getPBOCache().returnBuffer(m_PBOID);
}
glproc::BindBuffer(getTarget(), 0);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "PBO: DeleteBuffers()");
+ GLContext::checkError("PBO: DeleteBuffers()");
ObjectCounter::get()->decRef(&typeid(*this));
}
void PBO::activate()
{
glproc::BindBuffer(getTarget(), m_PBOID);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "PBO::activate()");
-
+ GLContext::checkError("PBO::activate()");
}
-void PBO::moveBmpToTexture(BitmapPtr pBmp, GLTexture& tex)
+int PBO::getID() const
{
+ return m_PBOID;
+}
+void PBO::moveBmpToTexture(BitmapPtr pBmp, GLTexture& tex)
+{
AVG_ASSERT(pBmp->getSize() == tex.getSize());
AVG_ASSERT(getSize() == pBmp->getSize());
AVG_ASSERT(pBmp->getPixelFormat() == getPF());
AVG_ASSERT(tex.getPF() == getPF());
AVG_ASSERT(!isReadPBO());
glproc::BindBuffer(GL_PIXEL_UNPACK_BUFFER_EXT, m_PBOID);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "PBO::moveBmpToTexture BindBuffer()");
+ GLContext::checkError("PBO::moveBmpToTexture BindBuffer()");
void * pPBOPixels = glproc::MapBuffer(GL_PIXEL_UNPACK_BUFFER_EXT, GL_WRITE_ONLY);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "PBO::moveBmpToTexture MapBuffer()");
- Bitmap PBOBitmap(getSize(), getPF(), (unsigned char *)pPBOPixels,
- getSize().x*getBytesPerPixel(getPF()), false);
+ GLContext::checkError("PBO::moveBmpToTexture MapBuffer()");
+ Bitmap PBOBitmap(getSize(), getPF(), (unsigned char *)pPBOPixels, getStride(), false);
PBOBitmap.copyPixels(*pBmp);
glproc::UnmapBuffer(GL_PIXEL_UNPACK_BUFFER_EXT);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "PBO::setImage: UnmapBuffer()");
+ GLContext::checkError("PBO::setImage: UnmapBuffer()");
tex.setDirty();
moveToTexture(tex);
@@ -104,13 +105,13 @@ void PBO::moveTextureToPBO(GLTexture& tex, int mipmapLevel)
AVG_ASSERT(getSize() == tex.getGLSize());
AVG_ASSERT(getPF() == tex.getPF());
glproc::BindBuffer(GL_PIXEL_PACK_BUFFER_EXT, m_PBOID);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "PBO::getImage BindBuffer()");
+ GLContext::checkError("PBO::getImage BindBuffer()");
tex.activate(GL_TEXTURE0);
glGetTexImage(GL_TEXTURE_2D, mipmapLevel, GLTexture::getGLFormat(getPF()),
GLTexture::getGLType(getPF()), 0);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "PBO::getImage: glGetTexImage()");
+ GLContext::checkError("PBO::getImage: glGetTexImage()");
if (mipmapLevel == 0) {
m_ActiveSize = tex.getSize();
m_BufferStride = tex.getGLSize().x;
@@ -124,15 +125,15 @@ BitmapPtr PBO::movePBOToBmp() const
{
AVG_ASSERT(isReadPBO());
glproc::BindBuffer(GL_PIXEL_PACK_BUFFER_EXT, m_PBOID);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "PBO::getImage BindBuffer()");
+ GLContext::checkError("PBO::getImage BindBuffer()");
void * pPBOPixels = glproc::MapBuffer(GL_PIXEL_PACK_BUFFER_EXT, GL_READ_ONLY);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "PBO::getImage MapBuffer()");
+ GLContext::checkError("PBO::getImage MapBuffer()");
Bitmap PBOBitmap(m_ActiveSize, getPF(), (unsigned char *)pPBOPixels,
m_BufferStride*getBytesPerPixel(getPF()), false);
BitmapPtr pBmp(new Bitmap(m_ActiveSize, getPF()));
pBmp->copyPixels(PBOBitmap);
glproc::UnmapBuffer(GL_PIXEL_PACK_BUFFER_EXT);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "PBO::getImage: UnmapBuffer()");
+ GLContext::checkError("PBO::getImage: UnmapBuffer()");
glproc::BindBuffer(GL_PIXEL_PACK_BUFFER_EXT, 0);
return pBmp;
@@ -143,18 +144,16 @@ BitmapPtr PBO::lock()
AVG_ASSERT(!isReadPBO());
BitmapPtr pBmp;
glproc::BindBuffer(GL_PIXEL_UNPACK_BUFFER_EXT, m_PBOID);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "PBOTexture::lockBmp: glBindBuffer()");
- glproc::BufferData(GL_PIXEL_UNPACK_BUFFER_EXT,
- getSize().x*getSize().y*getBytesPerPixel(getPF()), 0, m_Usage);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "PBOTexture::lockBmp: glBufferData()");
+ GLContext::checkError("PBOTexture::lockBmp: glBindBuffer()");
+ glproc::BufferData(GL_PIXEL_UNPACK_BUFFER_EXT, getMemNeeded(), 0, m_Usage);
+ GLContext::checkError("PBOTexture::lockBmp: glBufferData()");
unsigned char * pBuffer = (unsigned char *)
glproc::MapBuffer(GL_PIXEL_UNPACK_BUFFER_EXT, GL_WRITE_ONLY);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "PBOTexture::lockBmp: glMapBuffer()");
+ GLContext::checkError("PBOTexture::lockBmp: glMapBuffer()");
glproc::BindBuffer(GL_PIXEL_UNPACK_BUFFER_EXT, 0);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "PBOTexture::lockBmp: glBindBuffer(0)");
+ GLContext::checkError("PBOTexture::lockBmp: glBindBuffer(0)");
- pBmp = BitmapPtr(new Bitmap(getSize(), getPF(), pBuffer,
- getSize().x*getBytesPerPixel(getPF()), false));
+ pBmp = BitmapPtr(new Bitmap(getSize(), getPF(), pBuffer, getStride(), false));
return pBmp;
}
@@ -162,11 +161,11 @@ void PBO::unlock()
{
AVG_ASSERT(!isReadPBO());
glproc::BindBuffer(GL_PIXEL_UNPACK_BUFFER_EXT, m_PBOID);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "PBOTexture::unlockBmp: glBindBuffer()");
+ GLContext::checkError("PBOTexture::unlockBmp: glBindBuffer()");
glproc::UnmapBuffer(GL_PIXEL_UNPACK_BUFFER_EXT);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "PBOTexture::unlockBmp: glUnmapBuffer()");
+ GLContext::checkError("PBOTexture::unlockBmp: glUnmapBuffer()");
glproc::BindBuffer(GL_PIXEL_UNPACK_BUFFER_EXT, 0);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "PBOTexture::unlockBmp: glBindBuffer(0)");
+ GLContext::checkError("PBOTexture::unlockBmp: glBindBuffer(0)");
}
void PBO::moveToTexture(GLTexture& tex)
@@ -180,11 +179,19 @@ void PBO::moveToTexture(GLTexture& tex)
size.y = getSize().y;
}
glproc::BindBuffer(GL_PIXEL_UNPACK_BUFFER_EXT, m_PBOID);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "PBOTexture::lockBmp: glBindBuffer()");
+ GLContext::checkError("PBOTexture::lockBmp: glBindBuffer()");
tex.activate(GL_TEXTURE0);
+#ifdef __APPLE__
+ // See getStride()
+ if (getPF() == A8) {
+ glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+ } else {
+ glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
+ }
+#endif
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, size.x, size.y,
GLTexture::getGLFormat(getPF()), GLTexture::getGLType(getPF()), 0);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "PBO::setImage: glTexSubImage2D()");
+ GLContext::checkError("PBO::setImage: glTexSubImage2D()");
glproc::BindBuffer(GL_PIXEL_UNPACK_BUFFER_EXT, 0);
tex.setDirty();
tex.generateMipmaps();
@@ -207,6 +214,25 @@ bool PBO::isReadPBO() const
}
}
+unsigned PBO::getMemNeeded() const
+{
+ return getStride()*getSize().y;
+}
+
+unsigned PBO::getStride() const
+{
+ IntPoint size = getSize();
+ unsigned stride = Bitmap::getPreferredStride(size.x, getPF());
+#ifdef __APPLE__
+ if (getPF() == A8) {
+ // Workaround for apparent bug in Apple/NVidia drivers (Verified on OS X 10.6.8,
+ // MBP early 2011): GL_UNPACK_ALIGNMENT != 1 causes broken A8 textures.
+ stride = size.x;
+ }
+#endif
+ return stride;
+}
+
unsigned PBO::getTarget() const
{
if (isReadPBO()) {
diff --git a/src/graphics/PBO.h b/src/graphics/PBO.h
index 9c8d614..51896a4 100644
--- a/src/graphics/PBO.h
+++ b/src/graphics/PBO.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -29,7 +29,7 @@
#include "OGLHelper.h"
#include "GLTexture.h"
-#include "../base/Point.h"
+#include "../base/GLMHelper.h"
#include <boost/shared_ptr.hpp>
@@ -52,8 +52,11 @@ public:
BitmapPtr movePBOToBmp() const;
bool isReadPBO() const;
+ int getID() const;
private:
+ unsigned getMemNeeded() const;
+ unsigned getStride() const;
unsigned getTarget() const;
unsigned m_Usage;
diff --git a/src/graphics/Pixel16.h b/src/graphics/Pixel16.h
index bafbcec..cca4f73 100644
--- a/src/graphics/Pixel16.h
+++ b/src/graphics/Pixel16.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/graphics/Pixel24.h b/src/graphics/Pixel24.h
index cc0d637..7ae0717 100644
--- a/src/graphics/Pixel24.h
+++ b/src/graphics/Pixel24.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/graphics/Pixel32.cpp b/src/graphics/Pixel32.cpp
index ccde488..f1a3e40 100644
--- a/src/graphics/Pixel32.cpp
+++ b/src/graphics/Pixel32.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -34,35 +34,35 @@ namespace avg {
using namespace std;
-void Pixel32::toHSL(double& h, double& s, double& l)
+void Pixel32::toHSL(float& h, float& s, float& l)
{
- double r = double(m_Data[REDPOS])/255;
- double g = double(m_Data[GREENPOS])/255;
- double b = double(m_Data[BLUEPOS])/255;
- double maxComp = max(r, max(g, b));
- double minComp = min(r, min(g, b));
- l = (maxComp+minComp)/2.0;
+ float r = float(m_Data[REDPOS])/255.f;
+ float g = float(m_Data[GREENPOS])/255.f;
+ float b = float(m_Data[BLUEPOS])/255.f;
+ float maxComp = max(r, max(g, b));
+ float minComp = min(r, min(g, b));
+ l = (maxComp+minComp)/2;
if (maxComp == minComp) {
- s = 0.0;
- h = 0.0;
+ s = 0;
+ h = 0;
} else {
- double delta = maxComp-minComp;
- if (l < 0.5) {
+ float delta = maxComp-minComp;
+ if (l < 0.5f) {
s = delta/(maxComp+minComp);
} else {
- s = delta/(2.0-(maxComp+minComp));
+ s = delta/(2-(maxComp+minComp));
}
- if (r == maxComp) {
+ if (r > g && r > b) {
h = (g-b)/delta;
- if (h < 0.0) {
- h += 6.0;
+ if (h < 0.0f) {
+ h += 6;
}
- } else if (g == maxComp) {
- h = 2.0+(b-r)/delta;
- } else if (b == maxComp) {
- h = 4.0+(r-g)/delta;
+ } else if (g > b) {
+ h = 2+(b-r)/delta;
+ } else {
+ h = 4+(r-g)/delta;
}
- h *= 60.0;
+ h *= 60;
}
}
@@ -75,13 +75,15 @@ std::string Pixel32::getColorString() const
return s.str();
}
-Pixel32 colorStringToColor(const string & s)
+Pixel32 colorStringToColor(const UTF8String& s)
{
- int r,g,b;
- if ((s.length() != 6) || (sscanf(s.c_str(), "%2x%2x%2x", &r, &g, &b) != 3)) {
+ int r, g, b;
+ int numChars;
+ int numItems = sscanf(s.c_str(), "%2x%2x%2x%n", &r, &g, &b, &numChars);
+ if (s.length() != 6 || numChars != 6 || numItems != 3) {
throw(Exception (AVG_ERR_INVALID_ARGS, "colorstring cannot be parsed."));
}
- return Pixel32(r,g,b);
+ return Pixel32(r, g, b);
}
void YUVtoBGR32Pixel(Pixel32* pDest, int y, int u, int v)
diff --git a/src/graphics/Pixel32.h b/src/graphics/Pixel32.h
index ad9ff3e..7ec6e98 100644
--- a/src/graphics/Pixel32.h
+++ b/src/graphics/Pixel32.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -23,6 +23,7 @@
#define _Pixel32_H_
#include "../api.h"
+#include "../base/UTF8String.h"
#include "Pixeldefs.h"
@@ -50,7 +51,7 @@ public:
unsigned char getB() const;
unsigned char getA() const;
void flipRB();
- void toHSL(double& h, double& s, double& l);
+ void toHSL(float& h, float& s, float& l);
bool operator ==(const Pixel32 pix) const;
bool operator !=(const Pixel32 pix) const;
@@ -71,7 +72,7 @@ public:
AVG_API std::ostream& operator <<(std::ostream& os, const Pixel32& pix);
-AVG_API Pixel32 colorStringToColor(const std::string& s);
+AVG_API Pixel32 colorStringToColor(const UTF8String& s);
void YUVtoBGR32Pixel(Pixel32* pDest, int y, int u, int v);
void YUVJtoBGR32Pixel(Pixel32* pDest, int y, int u, int v);
diff --git a/src/graphics/Pixel8.h b/src/graphics/Pixel8.h
index 3581797..1d07037 100644
--- a/src/graphics/Pixel8.h
+++ b/src/graphics/Pixel8.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/graphics/PixelFormat.cpp b/src/graphics/PixelFormat.cpp
index 2104713..c550b62 100644
--- a/src/graphics/PixelFormat.cpp
+++ b/src/graphics/PixelFormat.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -68,6 +68,8 @@ string getPixelFormatString(PixelFormat pf)
return "I8";
case I16:
return "I16";
+ case A8:
+ return "A8";
case YCbCr411:
return "YCbCr411";
case YCbCr422:
@@ -106,7 +108,7 @@ PixelFormat stringToPixelFormat(const string& s)
if (s == "B5G6R5") {
return B5G6R5;
}
- if (s == "B8G8R8" || s == "BGR") {
+ if (s == "B8G8R8") {
return B8G8R8;
}
if (s == "B8G8R8A8") {
@@ -124,7 +126,7 @@ PixelFormat stringToPixelFormat(const string& s)
if (s == "R5G6B5") {
return R5G6B5;
}
- if (s == "R8G8B8" || s == "RGB") {
+ if (s == "R8G8B8") {
return R8G8B8;
}
if (s == "R8G8B8A8") {
@@ -145,10 +147,13 @@ PixelFormat stringToPixelFormat(const string& s)
if (s == "I16") {
return I16;
}
- if (s == "YCbCr411" || s == "YUV411") {
+ if (s == "A8") {
+ return A8;
+ }
+ if (s == "YCbCr411") {
return YCbCr411;
}
- if (s == "YCbCr422" || s == "YUV422") {
+ if (s == "YCbCr422") {
return YCbCr422;
}
if (s == "YUYV422") {
@@ -187,6 +192,18 @@ PixelFormat stringToPixelFormat(const string& s)
return NO_PIXELFORMAT;
}
+std::vector<std::string> getSupportedPixelFormats()
+{
+ std::vector<std::string> pixelFormatsVector;
+ int itPixelFormat = 0;
+ while((PixelFormat)itPixelFormat != NO_PIXELFORMAT){
+ std::string format = getPixelFormatString((PixelFormat)itPixelFormat);
+ pixelFormatsVector.push_back(format);
+ itPixelFormat++;
+ }
+ return pixelFormatsVector;
+}
+
bool pixelFormatIsColored(PixelFormat pf)
{
return (pf != I8 && pf != I16 && pf != I32F);
@@ -209,6 +226,11 @@ bool pixelFormatIsPlanar(PixelFormat pf)
return pf == YCbCr420p || pf == YCbCrJ420p || pf == YCbCrA420p;
}
+bool AVG_API pixelFormatIsBlueFirst(PixelFormat pf)
+{
+ return pf == B5G6R5 || pf == B8G8R8 || pf == B8G8R8X8 || pf == B8G8R8A8;
+}
+
unsigned getNumPixelFormatPlanes(PixelFormat pf)
{
switch (pf) {
@@ -256,13 +278,11 @@ unsigned getBytesPerPixel(PixelFormat pf)
case YCbCr422:
return 2;
default:
- AVG_TRACE(Logger::ERROR, "getBytesPerPixel(): Unknown format " <<
+ AVG_LOG_ERROR("getBytesPerPixel(): Unknown format " <<
getPixelFormatString(pf) << ".");
AVG_ASSERT(false);
return 0;
}
}
-
-
}
diff --git a/src/graphics/PixelFormat.h b/src/graphics/PixelFormat.h
index a0e0816..54d94b7 100644
--- a/src/graphics/PixelFormat.h
+++ b/src/graphics/PixelFormat.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -24,6 +24,7 @@
#include "../api.h"
#include <string>
+#include <vector>
namespace avg {
@@ -52,12 +53,14 @@ AVG_API std::ostream& operator <<(std::ostream& os, PixelFormat pf);
std::string AVG_API getPixelFormatString(PixelFormat pf);
PixelFormat AVG_API stringToPixelFormat(const std::string& s);
+std::vector<std::string> AVG_API getSupportedPixelFormats();
bool AVG_API pixelFormatIsColored(PixelFormat pf);
bool AVG_API pixelFormatIsBayer(PixelFormat pf);
bool AVG_API pixelFormatHasAlpha(PixelFormat pf);
bool AVG_API pixelFormatIsPlanar(PixelFormat pf);
+bool AVG_API pixelFormatIsBlueFirst(PixelFormat pf);
unsigned AVG_API getNumPixelFormatPlanes(PixelFormat pf);
-unsigned getBytesPerPixel(PixelFormat pf);
+unsigned AVG_API getBytesPerPixel(PixelFormat pf);
}
#endif
diff --git a/src/graphics/Pixeldefs.h b/src/graphics/Pixeldefs.h
index c9fad2e..361b7e8 100644
--- a/src/graphics/Pixeldefs.h
+++ b/src/graphics/Pixeldefs.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/graphics/ShaderRegistry.cpp b/src/graphics/ShaderRegistry.cpp
index 540a391..529482f 100644
--- a/src/graphics/ShaderRegistry.cpp
+++ b/src/graphics/ShaderRegistry.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -22,14 +22,22 @@
#include "ShaderRegistry.h"
#include "GLContext.h"
+#include "OGLShader.h"
#include "../base/Logger.h"
#include "../base/Exception.h"
+#include "../base/OSHelper.h"
+#include "../base/FileHelper.h"
+#include "../base/StringHelper.h"
+
+#include <iostream>
using namespace std;
using namespace boost;
namespace avg {
+
+std::string ShaderRegistry::s_sLibPath;
ShaderRegistryPtr ShaderRegistry::get()
{
@@ -38,25 +46,56 @@ ShaderRegistryPtr ShaderRegistry::get()
ShaderRegistry::ShaderRegistry()
{
+ if (s_sLibPath == "") {
+ setShaderPath(getPath(getAvgLibPath())+"shaders");
+ }
}
ShaderRegistry::~ShaderRegistry()
{
}
-OGLShaderPtr ShaderRegistry::getOrCreateShader(const std::string& sID,
- const std::string& sProgram)
+void ShaderRegistry::setShaderPath(const string& sLibPath)
+{
+ s_sLibPath = sLibPath;
+#ifdef __linux
+ // XXX: If we're running make distcheck, the shaders are in a different place than
+ // usual. Grrr.
+ char * pszSrcDir = getenv("srcdir");
+ if (pszSrcDir && string(pszSrcDir) != ".") {
+ s_sLibPath = string(pszSrcDir) + "/../graphics/shaders";
+ }
+#endif
+ AVG_TRACE(Logger::category::CONFIG, Logger::severity::INFO,
+ "Loading shaders from "+s_sLibPath);
+}
+
+void ShaderRegistry::setPreprocessorDefine(const string& sName, const string& sValue)
+{
+ m_PreprocessorDefinesMap[sName] = sValue;
+}
+
+void ShaderRegistry::createShader(const std::string& sID)
{
OGLShaderPtr pShader = getShader(sID);
if (!pShader) {
- m_ShaderMap[sID] = OGLShaderPtr(new OGLShader(sProgram));
+ string sShaderCode;
+ string sVertPreprocessed;
+ loadShaderString(s_sLibPath+"/standard.vert", sVertPreprocessed);
+ string sFilename = s_sLibPath+"/"+sID+".frag";
+ string sFragPreprocessed;
+ loadShaderString(sFilename, sFragPreprocessed);
+ string sVertPrefix = createPrefixString(false);
+ string sFragPrefix = createPrefixString(true);
+ m_ShaderMap[sID] = OGLShaderPtr(
+ new OGLShader(sID, sVertPreprocessed, sFragPreprocessed, sVertPrefix,
+ sFragPrefix));
}
- return pShader;
}
-OGLShaderPtr ShaderRegistry::getShader(const std::string& sID)
+OGLShaderPtr ShaderRegistry::getShader(const std::string& sID) const
{
- ShaderMap::iterator it = m_ShaderMap.find(sID);
+ ShaderMap::const_iterator it = m_ShaderMap.find(sID);
if (it == m_ShaderMap.end()) {
return OGLShaderPtr();
} else {
@@ -64,9 +103,85 @@ OGLShaderPtr ShaderRegistry::getShader(const std::string& sID)
}
}
-OGLShaderPtr getOrCreateShader(const std::string& sID, const std::string& sProgram)
+OGLShaderPtr ShaderRegistry::getCurShader() const
+{
+ return m_pCurShader;
+}
+
+void ShaderRegistry::setCurShader(const std::string& sID)
+{
+ if (sID == "") {
+ m_pCurShader = OGLShaderPtr();
+ } else {
+ m_pCurShader = getShader(sID);
+ }
+}
+
+void ShaderRegistry::loadShaderString(const string& sFilename, string& sPreprocessed)
+{
+ string sShaderCode;
+ readWholeFile(sFilename, sShaderCode);
+ preprocess(sShaderCode, sFilename, sPreprocessed);
+}
+
+void ShaderRegistry::preprocess(const string& sShaderCode, const string& sFileName,
+ string& sProcessed)
+{
+ sProcessed.append("#line 0\n");
+ istringstream stream(sShaderCode);
+ string sCurLine;
+ int curLine = 0;
+ while(getline(stream, sCurLine)) {
+ curLine++;
+ string sStripped = removeStartEndSpaces(sCurLine);
+ if (sStripped.substr(0, 8) == "#include") {
+ size_t startPos = sStripped.find('"');
+ size_t endPos = sStripped.find('"', startPos+1);
+ if (startPos == string::npos || endPos == string::npos) {
+ throwParseError(sFileName, curLine);
+ }
+ string sIncFileName = sStripped.substr(startPos+1, endPos-startPos-1);
+ sIncFileName = s_sLibPath+"/"+sIncFileName;
+ string sIncludedFile;
+ readWholeFile(sIncFileName, sIncludedFile);
+ string sProcessedIncludedFile;
+ preprocess(sIncludedFile, sIncFileName, sProcessedIncludedFile);
+ sProcessed.append(sProcessedIncludedFile);
+ sProcessed.append("#line "+toString(curLine)+"\n");
+ } else {
+ sProcessed.append(sCurLine+"\n");
+ }
+ }
+}
+
+string ShaderRegistry::createPrefixString(bool bFragment)
+{
+ stringstream ss;
+ std::map<std::string, std::string>::iterator it;
+ for (it = m_PreprocessorDefinesMap.begin(); it != m_PreprocessorDefinesMap.end();
+ ++it)
+ {
+ ss << "#define " << it->first << " " << it->second << endl;
+ }
+ if (GLContext::getCurrent()->isGLES()) {
+ ss << endl;
+ if (bFragment) {
+ ss << "#extension GL_OES_standard_derivatives : enable" << endl;
+ }
+ ss << "precision mediump float;" << endl;
+ }
+ return ss.str();
+}
+
+void ShaderRegistry::throwParseError(const string& sFileName, int curLine)
+{
+ throw Exception(AVG_ERR_VIDEO_GENERAL, "File '"+sFileName+"', Line "+
+ toString(curLine)+": Syntax error.");
+}
+
+void createShader(const std::string& sID)
{
- return ShaderRegistry::get()->getOrCreateShader(sID, sProgram);
+ return ShaderRegistry::get()->createShader(sID);
}
OGLShaderPtr getShader(const std::string& sID)
diff --git a/src/graphics/ShaderRegistry.h b/src/graphics/ShaderRegistry.h
index 07de0bb..5bc25a8 100644
--- a/src/graphics/ShaderRegistry.h
+++ b/src/graphics/ShaderRegistry.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -24,8 +24,6 @@
#include "../api.h"
-#include "OGLShader.h"
-
#include <boost/shared_ptr.hpp>
#include <map>
@@ -34,6 +32,8 @@ namespace avg {
class ShaderRegistry;
typedef boost::shared_ptr<ShaderRegistry> ShaderRegistryPtr;
+class OGLShader;
+typedef boost::shared_ptr<OGLShader> OGLShaderPtr;
class AVG_API ShaderRegistry {
public:
@@ -41,16 +41,30 @@ public:
ShaderRegistry();
virtual ~ShaderRegistry();
- OGLShaderPtr getOrCreateShader(const std::string& sID, const std::string& sProgram);
- OGLShaderPtr getShader(const std::string& sID);
+ void setShaderPath(const std::string& sLibPath);
+ void setPreprocessorDefine(const std::string& sName, const std::string& sValue);
+
+ void createShader(const std::string& sID);
+ OGLShaderPtr getShader(const std::string& sID) const;
+
+ OGLShaderPtr getCurShader() const;
+ void setCurShader(const std::string& sID);
private:
+ void loadShaderString(const std::string& sFilename, std::string& sPreprocessed);
+ void preprocess(const std::string& sShaderCode, const std::string& sFileName,
+ std::string& sProcessed);
+ std::string createPrefixString(bool bFragment);
+ void throwParseError(const std::string& sFileName, int curLine);
typedef std::map<std::string, OGLShaderPtr> ShaderMap;
ShaderMap m_ShaderMap;
+ OGLShaderPtr m_pCurShader;
+ std::map<std::string, std::string> m_PreprocessorDefinesMap;
+ static std::string s_sLibPath;
};
-OGLShaderPtr getOrCreateShader(const std::string& sID, const std::string& sProgram);
+void createShader(const std::string& sID);
OGLShaderPtr getShader(const std::string& sID);
diff --git a/src/graphics/StandardShader.cpp b/src/graphics/StandardShader.cpp
new file mode 100644
index 0000000..3fcd93a
--- /dev/null
+++ b/src/graphics/StandardShader.cpp
@@ -0,0 +1,216 @@
+//
+// 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 "StandardShader.h"
+
+#include "GLContext.h"
+#include "ShaderRegistry.h"
+
+#include "../base/Logger.h"
+#include "../base/Exception.h"
+
+#include <iostream>
+
+using namespace std;
+
+#define STANDARD_SHADER "standard"
+#define MINIMAL_SHADER "minimal"
+
+namespace avg {
+
+StandardShaderPtr StandardShader::get()
+{
+ return GLContext::getMain()->getStandardShader();
+}
+
+StandardShader::StandardShader()
+{
+ avg::createShader(STANDARD_SHADER);
+ m_pShader = avg::getShader(STANDARD_SHADER);
+ m_pColorModelParam = m_pShader->getParam<int>("u_ColorModel");
+ m_pAlphaParam = m_pShader->getParam<float>("u_Alpha");
+ m_pColorCoeff0Param = m_pShader->getParam<glm::vec4>("u_ColorCoeff0");
+ m_pColorCoeff1Param = m_pShader->getParam<glm::vec4>("u_ColorCoeff1");
+ m_pColorCoeff2Param = m_pShader->getParam<glm::vec4>("u_ColorCoeff2");
+ m_pColorCoeff3Param = m_pShader->getParam<glm::vec4>("u_ColorCoeff3");
+ m_pGammaParam = m_pShader->getParam<glm::vec4>("u_Gamma");
+
+ m_pUseColorCoeffParam = m_pShader->getParam<int>("u_bUseColorCoeff");
+ m_pPremultipliedAlphaParam = m_pShader->getParam<int>("u_bPremultipliedAlpha");
+ m_pUseMaskParam = m_pShader->getParam<int>("u_bUseMask");
+ m_pMaskPosParam = m_pShader->getParam<glm::vec2>("u_MaskPos");
+ m_pMaskSizeParam = m_pShader->getParam<glm::vec2>("u_MaskSize");
+
+ m_pShader->activate();
+ m_pShader->getParam<int>("u_Texture")->set(0);
+ if (GLContext::getMain()->useGPUYUVConversion()) {
+ m_pShader->getParam<int>("u_CBTexture")->set(1);
+ m_pShader->getParam<int>("u_CRTexture")->set(2);
+ m_pShader->getParam<int>("u_ATexture")->set(3);
+ }
+ m_pShader->getParam<int>("u_MaskTexture")->set(4);
+
+ if (GLContext::getMain()->getShaderUsage() != GLConfig::FULL) {
+ avg::createShader(MINIMAL_SHADER);
+ m_pMinimalShader = avg::getShader(MINIMAL_SHADER);
+ m_pMinimalShader->activate();
+ m_pMinimalShader->getParam<int>("u_Texture")->set(0);
+ m_pMinimalAlphaParam = m_pMinimalShader->getParam<float>("u_Alpha");
+ }
+
+ generateWhiteTexture();
+}
+
+StandardShader::~StandardShader()
+{
+}
+
+void StandardShader::activate()
+{
+ if (useMinimalShader()) {
+ m_pMinimalShader->activate();
+ m_pMinimalShader->setTransform(m_Transform);
+ m_pMinimalAlphaParam->set(m_Alpha);
+ } else {
+ m_pShader->activate();
+ m_pShader->setTransform(m_Transform);
+ m_pColorModelParam->set(m_ColorModel);
+ m_pAlphaParam->set(m_Alpha);
+
+ m_pUseColorCoeffParam->set(m_bUseColorCoeff);
+ const glm::mat4& mat = m_ColorMatrix;
+ m_pColorCoeff0Param->set(glm::vec4(mat[0][0], mat[0][1], mat[0][2], 0));
+ m_pColorCoeff1Param->set(glm::vec4(mat[1][0], mat[1][1], mat[1][2], 0));
+ m_pColorCoeff2Param->set(glm::vec4(mat[2][0], mat[2][1], mat[2][2], 0));
+ m_pColorCoeff3Param->set(glm::vec4(mat[3][0], mat[3][1], mat[3][2], 1));
+ m_pGammaParam->set(m_Gamma);
+
+ m_pPremultipliedAlphaParam->set(m_bPremultipliedAlpha);
+
+ m_pUseMaskParam->set(m_bUseMask);
+ if (m_bUseMask) {
+ m_pMaskPosParam->set(m_MaskPos);
+ m_pMaskSizeParam->set(m_MaskSize);
+ }
+ }
+}
+
+void StandardShader::setTransform(const glm::mat4& transform)
+{
+ m_Transform = transform;
+}
+
+void StandardShader::setColorModel(int model)
+{
+ m_ColorModel = model;
+}
+
+void StandardShader::setAlpha(float alpha)
+{
+ m_Alpha = alpha;
+}
+
+void StandardShader::setUntextured()
+{
+ // Activate an internal 1x1 A8 texture.
+ m_ColorModel = 2;
+ m_pWhiteTex->activate(GL_TEXTURE0);
+ disableColorspaceMatrix();
+ setGamma(glm::vec4(1.f,1.f,1.f,1.f));
+ setPremultipliedAlpha(false);
+ setMask(false);
+}
+
+void StandardShader::setColorspaceMatrix(const glm::mat4& mat)
+{
+ m_bUseColorCoeff = true;
+ m_ColorMatrix = mat;
+}
+
+void StandardShader::disableColorspaceMatrix()
+{
+ m_bUseColorCoeff = false;
+}
+
+void StandardShader::setGamma(const glm::vec4& gamma)
+{
+ m_Gamma = gamma;
+}
+
+void StandardShader::setPremultipliedAlpha(bool bPremultipliedAlpha)
+{
+ m_bPremultipliedAlpha = bPremultipliedAlpha;
+}
+
+void StandardShader::setMask(bool bUseMask, const glm::vec2& maskPos,
+ const glm::vec2& maskSize)
+{
+ m_bUseMask = bUseMask;
+ m_MaskPos = maskPos;
+ m_MaskSize = maskSize;
+}
+
+const OGLShaderPtr& StandardShader::getShader() const
+{
+ if (useMinimalShader()) {
+ return m_pMinimalShader;
+ } else {
+ return m_pShader;
+ }
+}
+
+void StandardShader::dump() const
+{
+ cerr << "---------Standard shader--------" << endl;
+ cerr << " m_Transform: " << m_Transform << endl;
+ cerr << " m_ColorModel: " << m_ColorModel << endl;
+ cerr << " m_Alpha: " << m_Alpha << endl;
+ cerr << " m_bUseColorCoeff: " << m_bUseColorCoeff << endl;
+ cerr << " m_ColorMatrix: " << m_ColorMatrix << endl;
+ cerr << " m_Gamma: " << m_Gamma << endl;
+ cerr << " m_bPremultipliedAlpha: " << m_bPremultipliedAlpha << endl;
+ cerr << " m_bUseMask: " << m_bUseMask << endl;
+ cerr << " m_MaskPos: " << m_MaskPos << endl;
+ cerr << " m_MaskSize: " << m_MaskSize << endl;
+ cerr << endl;
+}
+
+void StandardShader::generateWhiteTexture()
+{
+ BitmapPtr pBmp(new Bitmap(glm::vec2(1,1), I8));
+ *(pBmp->getPixels()) = 255;
+ m_pWhiteTex = GLTexturePtr(new GLTexture(IntPoint(1,1), I8));
+ m_pWhiteTex->moveBmpToTexture(pBmp);
+}
+
+bool StandardShader::useMinimalShader() const
+{
+ bool bActivateMinimal = false;
+ if (GLContext::getMain()->getShaderUsage() != GLConfig::FULL) {
+ bool bGammaIsModified = (!almostEqual(m_Gamma, glm::vec4(1.0f,1.0f,1.0f,1.0f)));
+ if (m_ColorModel == 0 && !m_bUseColorCoeff && !bGammaIsModified && !m_bUseMask) {
+ bActivateMinimal = true;
+ }
+ }
+ return bActivateMinimal;
+}
+
+}
diff --git a/src/graphics/StandardShader.h b/src/graphics/StandardShader.h
new file mode 100644
index 0000000..b22bd0a
--- /dev/null
+++ b/src/graphics/StandardShader.h
@@ -0,0 +1,106 @@
+//
+// 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 _StandardShader_H_
+#define _StandardShader_H_
+
+#include "../api.h"
+#include "OGLHelper.h"
+#include "OGLShader.h"
+#include "GLShaderParam.h"
+#include "GLTexture.h"
+
+#include "../base/GLMHelper.h"
+
+#include <boost/shared_ptr.hpp>
+
+#include <string>
+
+namespace avg {
+
+class StandardShader;
+typedef boost::shared_ptr<StandardShader> StandardShaderPtr;
+
+class AVG_API StandardShader {
+public:
+ static StandardShaderPtr get();
+ StandardShader();
+ virtual ~StandardShader();
+
+ void activate();
+
+ void setTransform(const glm::mat4& transform);
+ void setColorModel(int model);
+ void setAlpha(float alpha);
+ void setUntextured();
+ void setColorspaceMatrix(const glm::mat4& mat);
+ void disableColorspaceMatrix();
+ void setGamma(const glm::vec4& gamma);
+ void setPremultipliedAlpha(bool bPremultipliedAlpha);
+ void setMask(bool bUseMask, const glm::vec2& maskPos = glm::vec2(0,0),
+ const glm::vec2& maskSize = glm::vec2(0,0));
+
+ const OGLShaderPtr& getShader() const;
+
+ void dump() const;
+
+private:
+ void generateWhiteTexture();
+ bool useMinimalShader() const;
+
+ GLTexturePtr m_pWhiteTex;
+
+ glm::mat4 m_Transform;
+ int m_ColorModel;
+ float m_Alpha;
+ bool m_bUseColorCoeff;
+ glm::mat4 m_ColorMatrix;
+ glm::vec4 m_Gamma;
+ bool m_bPremultipliedAlpha;
+ bool m_bUseMask;
+ glm::vec2 m_MaskPos;
+ glm::vec2 m_MaskSize;
+
+ OGLShaderPtr m_pShader;
+ OGLShaderPtr m_pMinimalShader;
+
+ IntGLShaderParamPtr m_pColorModelParam;
+ FloatGLShaderParamPtr m_pAlphaParam;
+
+ Vec4fGLShaderParamPtr m_pColorCoeff0Param;
+ Vec4fGLShaderParamPtr m_pColorCoeff1Param;
+ Vec4fGLShaderParamPtr m_pColorCoeff2Param;
+ Vec4fGLShaderParamPtr m_pColorCoeff3Param;
+ Vec4fGLShaderParamPtr m_pGammaParam;
+
+ IntGLShaderParamPtr m_pUseColorCoeffParam;
+ IntGLShaderParamPtr m_pPremultipliedAlphaParam;
+ IntGLShaderParamPtr m_pUseMaskParam;
+ Vec2fGLShaderParamPtr m_pMaskPosParam;
+ Vec2fGLShaderParamPtr m_pMaskSizeParam;
+
+ FloatGLShaderParamPtr m_pMinimalAlphaParam;
+};
+
+}
+
+#endif
+
diff --git a/src/graphics/SubVertexArray.cpp b/src/graphics/SubVertexArray.cpp
new file mode 100644
index 0000000..157d6a4
--- /dev/null
+++ b/src/graphics/SubVertexArray.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 "SubVertexArray.h"
+
+#include "VertexArray.h"
+#include "GLContext.h"
+
+#include "../base/Exception.h"
+#include "../base/WideLine.h"
+#include "../base/ObjectCounter.h"
+
+#include <iostream>
+#include <stddef.h>
+#include <string.h>
+
+using namespace std;
+using namespace boost;
+
+namespace avg {
+
+SubVertexArray::SubVertexArray()
+{
+}
+
+SubVertexArray::~SubVertexArray()
+{
+}
+
+void SubVertexArray::init(VertexArray* pVertexArray, unsigned startVertex,
+ unsigned startIndex)
+{
+ m_pVA = pVertexArray;
+ m_StartVertex = startVertex;
+ m_StartIndex = startIndex;
+ m_NumVerts = 0;
+ m_NumIndexes = 0;
+}
+
+void SubVertexArray::appendTriIndexes(int v0, int v1, int v2)
+{
+ m_pVA->appendTriIndexes(v0+m_StartVertex, v1+m_StartVertex, v2+m_StartVertex);
+ m_NumIndexes += 3;
+}
+
+void SubVertexArray::appendQuadIndexes(int v0, int v1, int v2, int v3)
+{
+ m_pVA->appendQuadIndexes(v0+m_StartVertex, v1+m_StartVertex, v2+m_StartVertex,
+ v3+m_StartVertex);
+ m_NumIndexes += 6;
+}
+
+void SubVertexArray::addLineData(Pixel32 color, const glm::vec2& p1, const glm::vec2& p2,
+ float width, float tc1, float tc2)
+{
+ m_pVA->addLineData(color, p1, p2, width, tc1, tc2);
+ m_NumIndexes += 6;
+}
+
+void SubVertexArray::appendVertexData(VertexDataPtr pVertexes)
+{
+ m_pVA->appendVertexData(pVertexes);
+ m_NumVerts += pVertexes->getNumVerts();
+ m_NumIndexes += pVertexes->getNumIndexes();
+}
+
+int SubVertexArray::getNumVerts() const
+{
+ return m_NumVerts;
+}
+
+void SubVertexArray::draw()
+{
+ m_pVA->draw(m_StartIndex, m_NumIndexes, m_StartVertex, m_StartIndex);
+}
+
+void SubVertexArray::dump() const
+{
+ cerr << "SubVertexArray: m_StartVertex=" << m_StartVertex << ", "
+ << ", m_StartIndex=" << m_StartIndex << endl;
+ m_pVA->dump(m_StartVertex, m_NumVerts, m_StartIndex, m_NumIndexes);
+}
+
+}
+
diff --git a/src/graphics/SubVertexArray.h b/src/graphics/SubVertexArray.h
new file mode 100644
index 0000000..893b27d
--- /dev/null
+++ b/src/graphics/SubVertexArray.h
@@ -0,0 +1,75 @@
+//
+// 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 _SubVertexArray_H_
+#define _SubVertexArray_H_
+
+#include "../api.h"
+
+#include "VertexArray.h"
+#include "Pixel32.h"
+#include "OGLHelper.h"
+
+#include "../base/GLMHelper.h"
+
+#include <boost/shared_ptr.hpp>
+
+namespace avg {
+
+class AVG_API SubVertexArray {
+public:
+ SubVertexArray();
+ ~SubVertexArray();
+ void init(VertexArray* pVertexArray, unsigned startVertex, unsigned startIndex);
+
+ void appendPos(const glm::vec2& pos,
+ const glm::vec2& texPos, const Pixel32& color = Pixel32(0,0,0,0));
+ void appendTriIndexes(int v0, int v1, int v2);
+ void appendQuadIndexes(int v0, int v1, int v2, int v3);
+ void addLineData(Pixel32 color, const glm::vec2& p1, const glm::vec2& p2,
+ float width, float tc1=0, float tc2=1);
+ void appendVertexData(VertexDataPtr pVertexes);
+ int getNumVerts() const;
+
+ void draw();
+ void dump() const;
+
+private:
+ VertexArray* m_pVA;
+
+ unsigned m_StartVertex;
+ unsigned m_StartIndex;
+ int m_NumVerts;
+ int m_NumIndexes;
+};
+
+inline void SubVertexArray::appendPos(const glm::vec2& pos,
+ const glm::vec2& texPos, const Pixel32& color)
+{
+ m_pVA->appendPos(pos, texPos, color);
+ m_NumVerts++;
+}
+
+typedef boost::shared_ptr<SubVertexArray> SubVertexArrayPtr;
+
+}
+
+#endif
diff --git a/src/graphics/TextureMover.cpp b/src/graphics/TextureMover.cpp
index 92ea55b..f74fbf1 100644
--- a/src/graphics/TextureMover.cpp
+++ b/src/graphics/TextureMover.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -38,8 +38,10 @@ TextureMoverPtr TextureMover::create(OGLMemoryMode memoryMode, IntPoint size,
PixelFormat pf, unsigned usage)
{
switch (memoryMode) {
+#ifndef AVG_ENABLE_EGL
case MM_PBO:
return TextureMoverPtr(new PBO(size, pf, usage));
+#endif
case MM_OGL:
return TextureMoverPtr(new BmpTextureMover(size, pf));
default:
@@ -50,7 +52,7 @@ TextureMoverPtr TextureMover::create(OGLMemoryMode memoryMode, IntPoint size,
TextureMoverPtr TextureMover::create(IntPoint size, PixelFormat pf, unsigned usage)
{
- OGLMemoryMode memMode = GLContext::getCurrent()->getMemoryModeSupported();
+ OGLMemoryMode memMode = GLContext::getCurrent()->getMemoryMode();
return create(memMode, size, pf, usage);
}
diff --git a/src/graphics/TextureMover.h b/src/graphics/TextureMover.h
index 571286e..8435e2d 100644
--- a/src/graphics/TextureMover.h
+++ b/src/graphics/TextureMover.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -26,7 +26,7 @@
#include "PixelFormat.h"
#include "OGLHelper.h"
-#include "../base/Point.h"
+#include "../base/GLMHelper.h"
#include <boost/shared_ptr.hpp>
diff --git a/src/graphics/TwoPassScale.h b/src/graphics/TwoPassScale.h
index 2f8348a..89bf993 100644
--- a/src/graphics/TwoPassScale.h
+++ b/src/graphics/TwoPassScale.h
@@ -176,10 +176,10 @@ template <class DataClass>
LineContribType *
TwoPassScale<DataClass>::CalcContributions(unsigned uLineSize, unsigned uSrcSize)
{
- double dScale = double(uLineSize)/uSrcSize;
- double dWidth;
- double dFScale = 1.0;
- double dFilterWidth = m_ContribDef.GetWidth();
+ float dScale = float(uLineSize)/uSrcSize;
+ float dWidth;
+ float dFScale = 1.0;
+ float dFilterWidth = m_ContribDef.GetWidth();
if (dScale < 1.0) {
// Minification
@@ -198,7 +198,7 @@ TwoPassScale<DataClass>::CalcContributions(unsigned uLineSize, unsigned uSrcSize
for (unsigned u = 0; u < uLineSize; u++) {
// Scan through line of contributions
- double dCenter = (u+0.5)/dScale-0.5; // Reverse mapping
+ float dCenter = (u+0.5f)/dScale-0.5f; // Reverse mapping
// Find the significant edge points that affect the pixel
int iLeft = std::max (0, (int)floor (dCenter - dWidth));
int iRight = std::min ((int)ceil (dCenter + dWidth), int(uSrcSize) - 1);
@@ -218,7 +218,7 @@ TwoPassScale<DataClass>::CalcContributions(unsigned uLineSize, unsigned uSrcSize
for (int iSrc = iLeft; iSrc <= iRight; iSrc++) {
// Calculate weights
int CurWeight = int (dFScale * (m_ContribDef.Filter (dFScale *
- (dCenter - (double)iSrc)))*256);
+ (dCenter - (float)iSrc)))*256);
res->ContribRow[u].Weights[iSrc-iLeft] = CurWeight;
dTotalWeight += CurWeight;
}
@@ -271,15 +271,15 @@ void TwoPassScale<DataClass>::HorizScale(PixelClass * pSrcData, const IntPoint&
// No scaling required, just copy
for (int y = 0; y < destSize.y; y++) {
memcpy(pDest, pSrc, sizeof (PixelClass) * srcSize.x);
- pSrc += srcStride;
- pDest += destStride;
+ pSrc = (PixelClass*)((char*)(pSrc)+srcStride);
+ pDest = (PixelClass*)((char*)(pDest)+destStride);
}
} else {
LineContribType * pContrib = CalcContributions(destSize.x, srcSize.x);
for (int y = 0; y < destSize.y; y++) {
ScaleRow(pSrc, srcSize.x, pDest, destSize.x, pContrib);
- pSrc += srcStride;
- pDest += destStride;
+ pSrc = (PixelClass*)((char*)(pSrc)+srcStride);
+ pDest = (PixelClass*)((char*)(pDest)+destStride);
}
FreeContributions(pContrib); // Free contributions structure
}
@@ -296,8 +296,8 @@ void TwoPassScale<DataClass>::VertScale(PixelClass *pSrcData, const IntPoint& sr
// No scaling required, just copy
for (int y = 0; y < destSize.y; y++) {
memcpy(pDest, pSrc, sizeof (PixelClass) * srcSize.x);
- pSrc += srcStride;
- pDest += destStride;
+ pSrc = (PixelClass*)((char*)(pSrc)+srcStride);
+ pDest = (PixelClass*)((char*)(pDest)+destStride);
}
} else {
LineContribType * pContrib = CalcContributions(destSize.y, srcSize.y);
@@ -306,7 +306,8 @@ void TwoPassScale<DataClass>::VertScale(PixelClass *pSrcData, const IntPoint& sr
int * pWeights = pContrib->ContribRow[y].Weights;
int iLeft = pContrib->ContribRow[y].Left;
int iRight = pContrib->ContribRow[y].Right;
- PixelClass * pSrcPixelBase = pSrc+iLeft*srcStride;
+ PixelClass* pSrcPixelBase = (PixelClass*)((char*)(pSrc)
+ + size_t(iLeft)*srcStride);
for (int x = 0; x < destSize.x; x++) {
typename DataClass::_Accumulator a;
int * pWeight = pWeights;
@@ -317,12 +318,12 @@ void TwoPassScale<DataClass>::VertScale(PixelClass *pSrcData, const IntPoint& sr
// Accumulate weighted effect of each neighboring pixel
a.Accumulate(*pWeight, *pSrcPixel);
pWeight++;
- pSrcPixel += srcStride;
+ pSrcPixel = (PixelClass*)((char*)(pSrcPixel)+srcStride);
}
a.Store(pDestPixel);
pDestPixel++;
}
- pDest += destStride;
+ pDest = (PixelClass*)((char*)(pDest)+destStride);
}
FreeContributions(pContrib); // Free contributions structure
}
@@ -336,15 +337,15 @@ void TwoPassScale<DataClass>::Scale(PixelClass * pSrcData, const IntPoint& srcSi
// Allocate temp image
PixelClass *pTempData = new PixelClass[srcSize.y*dstSize.x];
IntPoint tempSize(dstSize.x, srcSize.y);
- int tempStride = dstSize.x;
+ int tempStride = dstSize.x*sizeof(PixelClass);
// Scale source image horizontally into temporary image
- HorizScale(pSrcData, srcSize, srcStride/sizeof(PixelClass),
+ HorizScale(pSrcData, srcSize, srcStride,
pTempData, tempSize, tempStride);
// Scale temporary image vertically into result image
VertScale (pTempData, tempSize, tempStride,
- pDstData, dstSize, dstStride/sizeof(PixelClass));
+ pDstData, dstSize, dstStride);
delete [] pTempData;
}
diff --git a/src/graphics/VertexArray.cpp b/src/graphics/VertexArray.cpp
index 2b658e1..45da798 100644
--- a/src/graphics/VertexArray.cpp
+++ b/src/graphics/VertexArray.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -22,6 +22,7 @@
#include "VertexArray.h"
#include "GLContext.h"
+#include "SubVertexArray.h"
#include "../base/Exception.h"
#include "../base/WideLine.h"
@@ -35,194 +36,122 @@ using namespace std;
using namespace boost;
namespace avg {
-
-const int MIN_VERTEXES = 100;
-const int MIN_INDEXES = 100;
+
+const unsigned VertexArray::TEX_INDEX = 0;
+const unsigned VertexArray::POS_INDEX = 1;
+const unsigned VertexArray::COLOR_INDEX = 2;
VertexArray::VertexArray(int reserveVerts, int reserveIndexes)
- : m_NumVerts(0),
- m_NumIndexes(0),
- m_ReserveVerts(reserveVerts),
- m_ReserveIndexes(reserveIndexes),
- m_bDataChanged(true)
+ : VertexData(reserveVerts, reserveIndexes)
{
- ObjectCounter::get()->incRef(&typeid(*this));
- if (m_ReserveVerts < MIN_VERTEXES) {
- m_ReserveVerts = MIN_VERTEXES;
- }
- if (m_ReserveIndexes < MIN_INDEXES) {
- m_ReserveIndexes = MIN_INDEXES;
- }
- m_pVertexData = new T2V3C4Vertex[m_ReserveVerts];
- m_pIndexData = new unsigned int[m_ReserveIndexes];
-
- if (m_ReserveVerts != MIN_VERTEXES || m_ReserveIndexes != MIN_INDEXES) {
+ GLContext* pContext = GLContext::getCurrent();
+ if (getReserveVerts() != MIN_VERTEXES || getReserveIndexes() != MIN_INDEXES) {
glproc::GenBuffers(1, &m_GLVertexBufferID);
glproc::GenBuffers(1, &m_GLIndexBufferID);
} else {
- GLContext* pContext = GLContext::getCurrent();
m_GLVertexBufferID = pContext->getVertexBufferCache().getBuffer();
m_GLIndexBufferID = pContext->getIndexBufferCache().getBuffer();
}
+ m_bUseMapBuffer = (!pContext->isGLES());
}
VertexArray::~VertexArray()
{
GLContext* pContext = GLContext::getCurrent();
if (pContext) {
- if (m_ReserveVerts == MIN_VERTEXES) {
+ if (getReserveVerts() == MIN_VERTEXES) {
pContext->getVertexBufferCache().returnBuffer(m_GLVertexBufferID);
} else {
glproc::DeleteBuffers(1, &m_GLVertexBufferID);
}
- if (m_ReserveIndexes == MIN_INDEXES) {
+ if (getReserveIndexes() == MIN_INDEXES) {
pContext->getIndexBufferCache().returnBuffer(m_GLIndexBufferID);
} else {
glproc::DeleteBuffers(1, &m_GLIndexBufferID);
}
}
- delete[] m_pVertexData;
- delete[] m_pIndexData;
- ObjectCounter::get()->decRef(&typeid(*this));
-}
-
-void VertexArray::appendPos(const DPoint& pos, const DPoint& texPos, const Pixel32& color)
-{
- if (m_NumVerts >= m_ReserveVerts-1) {
- grow();
- }
- T2V3C4Vertex* pVertex = &(m_pVertexData[m_NumVerts]);
- pVertex->m_Pos[0] = (GLfloat)pos.x;
- pVertex->m_Pos[1] = (GLfloat)pos.y;
- pVertex->m_Pos[2] = 0.0;
- pVertex->m_Tex[0] = (GLfloat)texPos.x;
- pVertex->m_Tex[1] = (GLfloat)texPos.y;
- pVertex->m_Color = color;
- m_bDataChanged = true;
- m_NumVerts++;
-}
-
-void VertexArray::appendTriIndexes(int v0, int v1, int v2)
-{
- if (m_NumIndexes >= m_ReserveIndexes-3) {
- grow();
- }
- m_pIndexData[m_NumIndexes] = v0;
- m_pIndexData[m_NumIndexes+1] = v1;
- m_pIndexData[m_NumIndexes+2] = v2;
- m_NumIndexes += 3;
}
-void VertexArray::appendQuadIndexes(int v0, int v1, int v2, int v3)
+void VertexArray::update()
{
- if (m_NumIndexes >= m_ReserveIndexes-6) {
- grow();
+ if (hasDataChanged()) {
+ transferBuffer(GL_ARRAY_BUFFER, m_GLVertexBufferID,
+ getReserveVerts()*sizeof(Vertex),
+ getNumVerts()*sizeof(Vertex), getVertexPointer());
+#ifdef AVG_ENABLE_EGL
+ transferBuffer(GL_ELEMENT_ARRAY_BUFFER, m_GLIndexBufferID,
+ getReserveIndexes()*sizeof(unsigned short),
+ getNumIndexes()*sizeof(unsigned short), getIndexPointer());
+#else
+ transferBuffer(GL_ELEMENT_ARRAY_BUFFER, m_GLIndexBufferID,
+ getReserveIndexes()*sizeof(unsigned int),
+ getNumIndexes()*sizeof(unsigned int), getIndexPointer());
+#endif
+ GLContext::checkError("VertexArray::update()");
}
- m_pIndexData[m_NumIndexes] = v0;
- m_pIndexData[m_NumIndexes+1] = v1;
- m_pIndexData[m_NumIndexes+2] = v2;
- m_pIndexData[m_NumIndexes+3] = v1;
- m_pIndexData[m_NumIndexes+4] = v2;
- m_pIndexData[m_NumIndexes+5] = v3;
- m_NumIndexes += 6;
-}
-
-void VertexArray::addLineData(Pixel32 color, const DPoint& p1, const DPoint& p2,
- double width, double tc1, double tc2)
-{
- WideLine wl(p1, p2, width);
- int curVertex = getCurVert();
- appendPos(wl.pl0, DPoint(tc1, 1), color);
- appendPos(wl.pr0, DPoint(tc1, 0), color);
- appendPos(wl.pl1, DPoint(tc2, 1), color);
- appendPos(wl.pr1, DPoint(tc2, 0), color);
- appendQuadIndexes(curVertex+1, curVertex, curVertex+3, curVertex+2);
-}
-
-void VertexArray::reset()
-{
- m_NumVerts = 0;
- m_NumIndexes = 0;
+ resetDataChanged();
}
-void VertexArray::update()
+void VertexArray::activate()
{
- if (m_bDataChanged) {
- glproc::BindBuffer(GL_ARRAY_BUFFER, m_GLVertexBufferID);
- glproc::BufferData(GL_ARRAY_BUFFER, m_ReserveVerts*sizeof(T2V3C4Vertex), 0,
- GL_DYNAMIC_DRAW);
- void * pBuffer = glproc::MapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY);
- memcpy(pBuffer, m_pVertexData, m_NumVerts*sizeof(T2V3C4Vertex));
- glproc::UnmapBuffer(GL_ARRAY_BUFFER);
-
- glproc::BindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_GLIndexBufferID);
- glproc::BufferData(GL_ELEMENT_ARRAY_BUFFER,
- m_ReserveIndexes*sizeof(unsigned int), 0, GL_DYNAMIC_DRAW);
- pBuffer = glproc::MapBuffer(GL_ELEMENT_ARRAY_BUFFER, GL_WRITE_ONLY);
- memcpy(pBuffer, m_pIndexData, m_NumIndexes*sizeof(unsigned int));
- glproc::UnmapBuffer(GL_ELEMENT_ARRAY_BUFFER);
-
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "VertexArray::update");
- }
- m_bDataChanged = false;
+ glproc::BindBuffer(GL_ARRAY_BUFFER, m_GLVertexBufferID);
+ glproc::BindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_GLIndexBufferID);
+ glproc::VertexAttribPointer(TEX_INDEX, 2, GL_SHORT, GL_FALSE,
+ sizeof(Vertex), (void *)(offsetof(Vertex, m_Tex)));
+ glproc::VertexAttribPointer(POS_INDEX, 2, GL_FLOAT, GL_FALSE,
+ sizeof(Vertex), (void *)(offsetof(Vertex, m_Pos)));
+ glproc::VertexAttribPointer(COLOR_INDEX, 4, GL_UNSIGNED_BYTE, GL_TRUE,
+ sizeof(Vertex), (void *)(offsetof(Vertex, m_Color)));
+ glproc::EnableVertexAttribArray(TEX_INDEX);
+ glproc::EnableVertexAttribArray(POS_INDEX);
+ glproc::EnableVertexAttribArray(COLOR_INDEX);
+ GLContext::checkError("VertexArray::activate()");
}
void VertexArray::draw()
{
update();
- glproc::BindBuffer(GL_ARRAY_BUFFER, m_GLVertexBufferID);
- glTexCoordPointer(2, GL_FLOAT, sizeof(T2V3C4Vertex), 0);
- glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(T2V3C4Vertex),
- (void *)(offsetof(T2V3C4Vertex, m_Color)));
- glVertexPointer(3, GL_FLOAT, sizeof(T2V3C4Vertex),
- (void *)(offsetof(T2V3C4Vertex, m_Pos)));
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "VertexArray::draw:1");
-
- glproc::BindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_GLIndexBufferID);
- // TODO: glDrawRangeElements is allegedly faster.
- glDrawElements(GL_TRIANGLES, m_NumIndexes, GL_UNSIGNED_INT, 0);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "VertexArray::draw():2");
+ activate();
+#ifdef AVG_ENABLE_EGL
+ glDrawElements(GL_TRIANGLES, getNumIndexes(), GL_UNSIGNED_SHORT, 0);
+#else
+ glDrawElements(GL_TRIANGLES, getNumIndexes(), GL_UNSIGNED_INT, 0);
+#endif
+ GLContext::checkError("VertexArray::draw()");
}
-int VertexArray::getCurVert() const
+void VertexArray::draw(unsigned startIndex, unsigned numIndexes, unsigned startVertex,
+ unsigned numVertexes)
{
- return m_NumVerts;
+#ifdef AVG_ENABLE_EGL
+ glDrawElements(GL_TRIANGLES, numIndexes, GL_UNSIGNED_SHORT,
+ (void *)(startIndex*sizeof(unsigned short)));
+#else
+ glDrawElements(GL_TRIANGLES, numIndexes, GL_UNSIGNED_INT,
+ (void *)(startIndex*sizeof(unsigned int)));
+#endif
+// XXX: Theoretically faster, but broken on Linux/Intel N10 graphics, Ubuntu 12/04
+// glproc::DrawRangeElements(GL_TRIANGLES, startVertex, startVertex+numVertexes,
+// numIndexes, GL_UNSIGNED_SHORT, (void *)(startIndex*sizeof(unsigned short)));
+ GLContext::checkError("VertexArray::draw()");
}
-int VertexArray::getCurIndex() const
+void VertexArray::startSubVA(SubVertexArray& subVA)
{
- return m_NumIndexes;
+ subVA.init(this, getNumVerts(), getNumIndexes());
}
-void VertexArray::grow()
+void VertexArray::transferBuffer(GLenum target, unsigned bufferID, unsigned reservedSize,
+ unsigned usedSize, const void* pData)
{
- bool bChanged = false;
- if (m_NumVerts >= m_ReserveVerts-1) {
- bChanged = true;
- int oldReserveVerts = m_ReserveVerts;
- m_ReserveVerts = int(m_ReserveVerts*1.5);
- if (m_ReserveVerts < m_NumVerts) {
- m_ReserveVerts = m_NumVerts;
- }
- T2V3C4Vertex* pVertexData = m_pVertexData;
- m_pVertexData = new T2V3C4Vertex[m_ReserveVerts];
- memcpy(m_pVertexData, pVertexData, sizeof(T2V3C4Vertex)*oldReserveVerts);
- delete[] pVertexData;
- }
- if (m_NumIndexes >= m_ReserveIndexes-6) {
- bChanged = true;
- int oldReserveIndexes = m_ReserveIndexes;
- m_ReserveIndexes = int(m_ReserveIndexes*1.5);
- if (m_ReserveIndexes < m_NumIndexes) {
- m_ReserveIndexes = m_NumIndexes;
- }
- unsigned int * pIndexData = m_pIndexData;
- m_pIndexData = new unsigned int[m_ReserveIndexes];
- memcpy(m_pIndexData, pIndexData, sizeof(unsigned int)*oldReserveIndexes);
- delete[] pIndexData;
- }
- if (bChanged) {
- m_bDataChanged = true;
+ glproc::BindBuffer(target, bufferID);
+ if (m_bUseMapBuffer) {
+ glproc::BufferData(target, reservedSize, 0, GL_STREAM_DRAW);
+ void * pBuffer = glproc::MapBuffer(target, GL_WRITE_ONLY);
+ memcpy(pBuffer, pData, usedSize);
+ glproc::UnmapBuffer(target);
+ } else {
+ glproc::BufferData(target, usedSize, pData, GL_STREAM_DRAW);
}
}
diff --git a/src/graphics/VertexArray.h b/src/graphics/VertexArray.h
index 5db9e4f..194072b 100644
--- a/src/graphics/VertexArray.h
+++ b/src/graphics/VertexArray.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -23,56 +23,43 @@
#define _VertexArray_H_
#include "../api.h"
-
+#include "VertexData.h"
#include "Pixel32.h"
#include "OGLHelper.h"
-#include "../base/Point.h"
+#include "../base/GLMHelper.h"
#include <boost/shared_ptr.hpp>
namespace avg {
-struct T2V3C4Vertex {
- GLfloat m_Tex[2];
- Pixel32 m_Color;
- GLfloat m_Pos[3];
-};
+class SubVertexArray;
-class AVG_API VertexArray {
+class AVG_API VertexArray: public VertexData {
public:
+ static const unsigned TEX_INDEX;
+ static const unsigned POS_INDEX;
+ static const unsigned COLOR_INDEX;
+
VertexArray(int reserveVerts = 0, int reserveIndexes = 0);
virtual ~VertexArray();
- virtual void appendPos(const DPoint& pos,
- const DPoint& texPos, const Pixel32& color = Pixel32(0,0,0,0));
- void appendTriIndexes(int v0, int v1, int v2);
- void appendQuadIndexes(int v0, int v1, int v2, int v3);
- void addLineData(Pixel32 color, const DPoint& p1, const DPoint& p2, double width,
- double tc1=0, double tc2=1);
- void reset();
-
void update();
+ void activate();
void draw();
+ void draw(unsigned startIndex, unsigned numIndexes, unsigned startVertex,
+ unsigned numVertexes);
- int getCurVert() const;
- int getCurIndex() const;
- void dump() const;
+ void startSubVA(SubVertexArray& subVA);
private:
- void grow();
-
- int m_NumVerts;
- int m_NumIndexes;
- int m_ReserveVerts;
- int m_ReserveIndexes;
- T2V3C4Vertex * m_pVertexData;
- unsigned int * m_pIndexData;
+ void transferBuffer(GLenum target, unsigned bufferID, unsigned reservedSize,
+ unsigned usedSize, const void* pData);
- bool m_bDataChanged;
+ unsigned m_GLVertexBufferID;
+ unsigned m_GLIndexBufferID;
- unsigned int m_GLVertexBufferID;
- unsigned int m_GLIndexBufferID;
+ bool m_bUseMapBuffer;
};
typedef boost::shared_ptr<VertexArray> VertexArrayPtr;
diff --git a/src/graphics/VertexData.cpp b/src/graphics/VertexData.cpp
new file mode 100644
index 0000000..8548e46
--- /dev/null
+++ b/src/graphics/VertexData.cpp
@@ -0,0 +1,253 @@
+//
+// 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 "VertexData.h"
+
+#include "GLContext.h"
+
+#include "../base/Exception.h"
+#include "../base/WideLine.h"
+#include "../base/ObjectCounter.h"
+
+#include <iostream>
+#include <stddef.h>
+#include <string.h>
+
+using namespace std;
+using namespace boost;
+
+namespace avg {
+
+const int VertexData::MIN_VERTEXES = 100;
+const int VertexData::MIN_INDEXES = 100;
+
+VertexData::VertexData(int reserveVerts, int reserveIndexes)
+ : m_NumVerts(0),
+ m_NumIndexes(0),
+ m_ReserveVerts(reserveVerts),
+ m_ReserveIndexes(reserveIndexes),
+ m_bDataChanged(true)
+{
+ ObjectCounter::get()->incRef(&typeid(*this));
+ if (m_ReserveVerts < MIN_VERTEXES) {
+ m_ReserveVerts = MIN_VERTEXES;
+ }
+ if (m_ReserveIndexes < MIN_INDEXES) {
+ m_ReserveIndexes = MIN_INDEXES;
+ }
+
+ m_pVertexData = new Vertex[m_ReserveVerts];
+ m_pIndexData = new GL_INDEX_TYPE[m_ReserveIndexes];
+
+}
+
+VertexData::~VertexData()
+{
+ delete[] m_pVertexData;
+ delete[] m_pIndexData;
+ ObjectCounter::get()->decRef(&typeid(*this));
+}
+
+void VertexData::appendPos(const glm::vec2& pos, const glm::vec2& texPos,
+ const Pixel32& color)
+{
+ if (m_NumVerts >= m_ReserveVerts-1) {
+ grow();
+ }
+ Vertex* pVertex = &(m_pVertexData[m_NumVerts]);
+ pVertex->m_Pos[0] = (GLfloat)(pos.x);
+ pVertex->m_Pos[1] = (GLfloat)(pos.y);
+ pVertex->m_Tex[0] = (GLshort)(texPos.x*4096.f);
+ pVertex->m_Tex[1] = (GLshort)(texPos.y*4096.f);
+ pVertex->m_Color = color;
+ m_bDataChanged = true;
+ m_NumVerts++;
+}
+
+void VertexData::appendTriIndexes(int v0, int v1, int v2)
+{
+ if (m_NumIndexes >= m_ReserveIndexes-3) {
+ grow();
+ }
+ m_pIndexData[m_NumIndexes] = v0;
+ m_pIndexData[m_NumIndexes+1] = v1;
+ m_pIndexData[m_NumIndexes+2] = v2;
+ m_NumIndexes += 3;
+}
+
+void VertexData::appendQuadIndexes(int v0, int v1, int v2, int v3)
+{
+ if (m_NumIndexes >= m_ReserveIndexes-6) {
+ grow();
+ }
+ m_pIndexData[m_NumIndexes] = v0;
+ m_pIndexData[m_NumIndexes+1] = v1;
+ m_pIndexData[m_NumIndexes+2] = v2;
+ m_pIndexData[m_NumIndexes+3] = v1;
+ m_pIndexData[m_NumIndexes+4] = v2;
+ m_pIndexData[m_NumIndexes+5] = v3;
+ m_NumIndexes += 6;
+}
+
+void VertexData::addLineData(Pixel32 color, const glm::vec2& p1, const glm::vec2& p2,
+ float width, float tc1, float tc2)
+{
+ WideLine wl(p1, p2, width);
+ int curVertex = getNumVerts();
+ appendPos(wl.pl0, glm::vec2(tc1, 1), color);
+ appendPos(wl.pr0, glm::vec2(tc1, 0), color);
+ appendPos(wl.pl1, glm::vec2(tc2, 1), color);
+ appendPos(wl.pr1, glm::vec2(tc2, 0), color);
+ appendQuadIndexes(curVertex+1, curVertex, curVertex+3, curVertex+2);
+}
+
+void VertexData::appendVertexData(const VertexDataPtr& pVertexes)
+{
+ int oldNumVerts = m_NumVerts;
+ int oldNumIndexes = m_NumIndexes;
+ m_NumVerts += pVertexes->getNumVerts();
+ m_NumIndexes += pVertexes->getNumIndexes();
+ if (m_NumVerts > m_ReserveVerts || m_NumIndexes > m_ReserveIndexes) {
+ grow();
+ }
+
+ memcpy(&(m_pVertexData[oldNumVerts]), pVertexes->m_pVertexData,
+ pVertexes->getNumVerts()*sizeof(Vertex));
+ int numIndexes = pVertexes->getNumIndexes();
+ for (int i=0; i<numIndexes; ++i) {
+ m_pIndexData[oldNumIndexes+i] = pVertexes->m_pIndexData[i] + oldNumVerts;
+ }
+ m_bDataChanged = true;
+}
+
+bool VertexData::hasDataChanged() const
+{
+ return m_bDataChanged;
+}
+
+void VertexData::resetDataChanged()
+{
+ m_bDataChanged = false;
+}
+
+void VertexData::reset()
+{
+ m_NumVerts = 0;
+ m_NumIndexes = 0;
+}
+
+int VertexData::getNumVerts() const
+{
+ return m_NumVerts;
+}
+
+int VertexData::getNumIndexes() const
+{
+ return m_NumIndexes;
+}
+
+void VertexData::dump() const
+{
+ dump(0, m_NumVerts, 0, m_NumIndexes);
+}
+
+void VertexData::dump(unsigned startVertex, int numVerts, unsigned startIndex,
+ int numIndexes) const
+{
+ cerr << numVerts << " vertexes: ";
+ for (unsigned i=startVertex; i<startVertex+numVerts; ++i) {
+ cerr << m_pVertexData[i] << endl;
+ }
+ cerr << endl;
+ cerr << numIndexes << " indexes: ";
+ for (unsigned i=startIndex; i<startIndex+numIndexes; ++i) {
+ cerr << m_pIndexData[i] << " ";
+ }
+ cerr << endl;
+}
+
+void VertexData::grow()
+{
+ bool bChanged = false;
+ if (m_NumVerts >= m_ReserveVerts-1) {
+ bChanged = true;
+ int oldReserveVerts = m_ReserveVerts;
+ m_ReserveVerts = int(m_ReserveVerts*1.5);
+#ifdef AVG_ENABLE_EGL
+ if (m_ReserveVerts > 65535) {
+ throw Exception(AVG_ERR_UNSUPPORTED,
+ "Global maximum number of vertexes reached (65535).");
+ }
+#endif
+ if (m_ReserveVerts < m_NumVerts) {
+ m_ReserveVerts = m_NumVerts;
+ }
+ Vertex* pVertexData = m_pVertexData;
+ m_pVertexData = new Vertex[m_ReserveVerts];
+ memcpy(m_pVertexData, pVertexData, sizeof(Vertex)*oldReserveVerts);
+ delete[] pVertexData;
+ }
+ if (m_NumIndexes >= m_ReserveIndexes-6) {
+ bChanged = true;
+ int oldReserveIndexes = m_ReserveIndexes;
+ m_ReserveIndexes = int(m_ReserveIndexes*1.5);
+ if (m_ReserveIndexes < m_NumIndexes) {
+ m_ReserveIndexes = m_NumIndexes;
+ }
+ GL_INDEX_TYPE * pIndexData = m_pIndexData;
+ m_pIndexData = new GL_INDEX_TYPE[m_ReserveIndexes];
+ memcpy(m_pIndexData, pIndexData, sizeof(GL_INDEX_TYPE)*oldReserveIndexes);
+ delete[] pIndexData;
+ }
+ if (bChanged) {
+ m_bDataChanged = true;
+ }
+}
+
+int VertexData::getReserveVerts() const
+{
+ return m_ReserveVerts;
+}
+
+int VertexData::getReserveIndexes() const
+{
+ return m_ReserveIndexes;
+}
+
+const Vertex * VertexData::getVertexPointer() const
+{
+ return m_pVertexData;
+}
+
+const GL_INDEX_TYPE * VertexData::getIndexPointer() const
+{
+ return m_pIndexData;
+}
+
+std::ostream& operator<<(std::ostream& os, const Vertex& v)
+{
+ os << " ((" << v.m_Pos[0] << ", " << v.m_Pos[1] << "), ("
+ << v.m_Tex[0] << ", " << v.m_Tex[1] << "))";
+ return os;
+}
+
+}
+
diff --git a/src/graphics/VertexData.h b/src/graphics/VertexData.h
new file mode 100644
index 0000000..79316b8
--- /dev/null
+++ b/src/graphics/VertexData.h
@@ -0,0 +1,100 @@
+//
+// 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 _VertexData_H_
+#define _VertexData_H_
+
+#include "../api.h"
+
+#include "Pixel32.h"
+#include "OGLHelper.h"
+
+#include "../base/GLMHelper.h"
+
+#include <boost/shared_ptr.hpp>
+
+namespace avg {
+
+struct Vertex {
+ GLshort m_Tex[2]; // 4.12 fixed point.
+ GLfloat m_Pos[2];
+ Pixel32 m_Color;
+};
+
+class VertexData;
+typedef boost::shared_ptr<VertexData> VertexDataPtr;
+
+#ifdef AVG_ENABLE_EGL
+#define GL_INDEX_TYPE unsigned short
+#else
+#define GL_INDEX_TYPE unsigned int
+#endif
+
+class AVG_API VertexData {
+public:
+ VertexData(int reserveVerts = 0, int reserveIndexes = 0);
+ virtual ~VertexData();
+
+ void appendPos(const glm::vec2& pos,
+ const glm::vec2& texPos, const Pixel32& color = Pixel32(0,0,0,0));
+ void appendTriIndexes(int v0, int v1, int v2);
+ void appendQuadIndexes(int v0, int v1, int v2, int v3);
+ void addLineData(Pixel32 color, const glm::vec2& p1, const glm::vec2& p2,
+ float width, float tc1=0, float tc2=1);
+ void appendVertexData(const VertexDataPtr& pVertexes);
+ bool hasDataChanged() const;
+ void resetDataChanged();
+ void reset();
+
+ int getNumVerts() const;
+ int getNumIndexes() const;
+ void dump() const;
+ void dump(unsigned startVertex, int numVerts, unsigned startIndex, int numIndexes)
+ const;
+
+protected:
+ int getReserveVerts() const;
+ int getReserveIndexes() const;
+
+ const Vertex * getVertexPointer() const;
+ const GL_INDEX_TYPE * getIndexPointer() const;
+
+ static const int MIN_VERTEXES;
+ static const int MIN_INDEXES;
+
+private:
+ void grow();
+
+ int m_NumVerts;
+ int m_NumIndexes;
+ int m_ReserveVerts;
+ int m_ReserveIndexes;
+ Vertex * m_pVertexData;
+ GL_INDEX_TYPE * m_pIndexData;
+
+ bool m_bDataChanged;
+};
+
+std::ostream& operator<<(std::ostream& os, const Vertex& v);
+
+}
+
+#endif
diff --git a/src/graphics/X11Display.cpp b/src/graphics/X11Display.cpp
new file mode 100644
index 0000000..b6a3510
--- /dev/null
+++ b/src/graphics/X11Display.cpp
@@ -0,0 +1,124 @@
+//
+// 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 "X11Display.h"
+
+#include "../base/Exception.h"
+#include "../base/Logger.h"
+
+#include <SDL/SDL.h>
+#include <SDL/SDL_syswm.h>
+
+#include <boost/math/special_functions/fpclassify.hpp>
+
+
+namespace avg {
+
+X11Display::X11Display()
+{
+}
+
+X11Display::~X11Display()
+{
+}
+
+float X11Display::queryPPMM()
+{
+ ::Display * pDisplay = XOpenDisplay(0);
+ float ppmm = getScreenResolution().x/float(DisplayWidthMM(pDisplay, 0));
+ XCloseDisplay(pDisplay);
+ return ppmm;
+}
+
+IntPoint X11Display::queryScreenResolution()
+{
+ IntPoint size;
+ // Xinerama query has been removed from here in order to fix #431
+ ::Display * pDisplay = XOpenDisplay(0);
+
+ Screen* pScreen = DefaultScreenOfDisplay(pDisplay);
+ AVG_ASSERT(pScreen);
+ size = IntPoint(pScreen->width, pScreen->height);
+
+ XCloseDisplay(pDisplay);
+ return size;
+}
+
+float X11Display::queryRefreshRate()
+{
+ ::Display * pDisplay = XOpenDisplay(0);
+ int pixelClock;
+ XF86VidModeModeLine modeLine;
+ bool bOK = XF86VidModeGetModeLine(pDisplay, DefaultScreen(pDisplay),
+ &pixelClock, &modeLine);
+ if (!bOK) {
+ AVG_LOG_WARNING(
+ "Could not get current refresh rate (XF86VidModeGetModeLine failed).");
+ AVG_LOG_WARNING("Defaulting to 60 Hz refresh rate.");
+ return 60;
+ }
+ float hSyncRate = (pixelClock * 1000.0) / modeLine.htotal;
+ float refreshRate = hSyncRate / modeLine.vtotal;
+ XCloseDisplay(pDisplay);
+ if ( refreshRate < 20 || refreshRate > 200 || !(boost::math::isnormal(refreshRate))){
+ AVG_LOG_WARNING("Could not get valid refresh rate");
+ AVG_LOG_WARNING("Defaulting to 60 Hz refresh rate.");
+ return 60;
+ }
+ return refreshRate;
+}
+
+::Display* getX11Display(const SDL_SysWMinfo* pSDLWMInfo)
+{
+ ::Display* pDisplay;
+ if (pSDLWMInfo) {
+ // SDL window exists, use it.
+ pDisplay = pSDLWMInfo->info.x11.display;
+ } else {
+ pDisplay = XOpenDisplay(0);
+ }
+ if (!pDisplay) {
+ throw Exception(AVG_ERR_VIDEO_GENERAL, "No X windows display available.");
+ }
+ return pDisplay;
+}
+
+Window createChildWindow(const SDL_SysWMinfo* pSDLWMInfo, XVisualInfo* pVisualInfo,
+ const IntPoint& windowSize, Colormap& colormap)
+
+{
+ // Create a child window with the required attributes to render into.
+ XSetWindowAttributes swa;
+ ::Display* pDisplay = pSDLWMInfo->info.x11.display;
+ colormap = XCreateColormap(pDisplay, RootWindow(pDisplay, pVisualInfo->screen),
+ pVisualInfo->visual, AllocNone);
+ swa.colormap = colormap;
+ swa.background_pixmap = None;
+ swa.event_mask = StructureNotifyMask;
+ Window win = XCreateWindow(pDisplay, pSDLWMInfo->info.x11.window,
+ 0, 0, windowSize.x, windowSize.y, 0, pVisualInfo->depth, InputOutput,
+ pVisualInfo->visual, CWColormap|CWEventMask, &swa);
+ AVG_ASSERT(win);
+ XMapWindow(pDisplay, win);
+ return win;
+}
+
+}
diff --git a/src/graphics/X11Display.h b/src/graphics/X11Display.h
new file mode 100644
index 0000000..50de9cc
--- /dev/null
+++ b/src/graphics/X11Display.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 _X11Display_H_
+#define _X11Display_H_
+#include "../api.h"
+
+#include "Display.h"
+
+#include "../base/GLMHelper.h"
+
+#include "OGLHelper.h"
+
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <X11/extensions/xf86vmode.h>
+
+struct SDL_SysWMinfo;
+
+namespace avg {
+
+class AVG_API X11Display: public Display
+{
+public:
+ X11Display();
+ virtual ~X11Display();
+
+protected:
+ virtual float queryPPMM();
+ virtual IntPoint queryScreenResolution();
+ virtual float queryRefreshRate();
+};
+
+::Display* getX11Display(const SDL_SysWMinfo* pSDLWMInfo);
+
+Window createChildWindow(const SDL_SysWMinfo* pSDLWMInfo, XVisualInfo* pVisualInfo,
+ const IntPoint& windowSize, Colormap& colormap);
+
+}
+#endif
+
+
diff --git a/src/graphics/baseline/ChromaKeyMedianResult.png b/src/graphics/baseline/ChromaKeyMedianResult.png
index 8112708..3de9221 100644
--- a/src/graphics/baseline/ChromaKeyMedianResult.png
+++ b/src/graphics/baseline/ChromaKeyMedianResult.png
Binary files differ
diff --git a/src/graphics/baseline/ResizeBilinearResultB8G8R8.png b/src/graphics/baseline/ResizeBilinearResultB8G8R8.png
new file mode 100644
index 0000000..6a1d7b7
--- /dev/null
+++ b/src/graphics/baseline/ResizeBilinearResultB8G8R8.png
Binary files differ
diff --git a/src/graphics/baseline/blur05_flat.png b/src/graphics/baseline/blur05_flat.png
index 95700b1..79c5ff8 100644
--- a/src/graphics/baseline/blur05_flat.png
+++ b/src/graphics/baseline/blur05_flat.png
Binary files differ
diff --git a/src/graphics/baseline/blur_rgb24-64x64.png b/src/graphics/baseline/blur_rgb24-64x64.png
index 1acf9ea..1114b79 100644
--- a/src/graphics/baseline/blur_rgb24-64x64.png
+++ b/src/graphics/baseline/blur_rgb24-64x64.png
Binary files differ
diff --git a/src/graphics/baseline/invert_rgb24-64x64.png b/src/graphics/baseline/invert_rgb24-64x64.png
new file mode 100644
index 0000000..7e05dc2
--- /dev/null
+++ b/src/graphics/baseline/invert_rgb24-64x64.png
Binary files differ
diff --git a/src/graphics/benchmarkgraphics.cpp b/src/graphics/benchmarkgraphics.cpp
index 7449096..8520033 100644
--- a/src/graphics/benchmarkgraphics.cpp
+++ b/src/graphics/benchmarkgraphics.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -21,6 +21,7 @@
#include "Bitmap.h"
+#include "BitmapLoader.h"
#include "Pixel32.h"
#include "Pixel24.h"
#include "Pixel16.h"
@@ -54,7 +55,7 @@ void runPerformanceTest(int numRuns=500)
for (int i = 0; i < numRuns; ++i) {
PerfTest.run();
}
- double ActiveTime = (TimeSource::get()->getCurrentMicrosecs()-StartTime)/1000.;
+ float ActiveTime = (TimeSource::get()->getCurrentMicrosecs()-StartTime)/1000.;
cerr << PerfTest.getName() << ": " << ActiveTime/numRuns << " ms" << endl;
}
@@ -84,7 +85,7 @@ public:
void run()
{
- BitmapPtr pBmp(new Bitmap("testfiles/rgb24alpha-64x64.png"));
+ BitmapPtr pBmp = loadBitmap("../test/media/rgb24alpha-64x64.png");
}
};
@@ -248,6 +249,7 @@ void runPerformanceTests()
int main(int nargs, char** args)
{
+ BitmapLoader::init(true);
runPerformanceTests();
}
diff --git a/src/graphics/shaders/Makefile.am b/src/graphics/shaders/Makefile.am
new file mode 100644
index 0000000..f968ab0
--- /dev/null
+++ b/src/graphics/shaders/Makefile.am
@@ -0,0 +1,3 @@
+EXTRA_DIST = $(wildcard *.frag) $(wildcard *.vert)
+datadir = $(pkgpyexecdir)/shaders
+data_DATA = $(wildcard *.frag) $(wildcard *.vert)
diff --git a/src/graphics/shaders/Makefile.in b/src/graphics/shaders/Makefile.in
new file mode 100644
index 0000000..c310a31
--- /dev/null
+++ b/src/graphics/shaders/Makefile.in
@@ -0,0 +1,492 @@
+# Makefile.in generated by automake 1.11.3 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = src/graphics/shaders
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/ac_cxx_namespaces.m4 \
+ $(top_srcdir)/m4/ac_path_generic.m4 \
+ $(top_srcdir)/m4/ax_boost_thread.m4 \
+ $(top_srcdir)/m4/ax_check_gl.m4 \
+ $(top_srcdir)/m4/ax_python_devel.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/pkg.m4 \
+ $(top_srcdir)/m4/avg_version.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/src/avgconfig.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+SOURCES =
+DIST_SOURCES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
+am__installdirs = "$(DESTDIR)$(datadir)"
+DATA = $(data_DATA)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BOOST_PYTHON_LIBS = @BOOST_PYTHON_LIBS@
+BOOST_THREAD_LIBS = @BOOST_THREAD_LIBS@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DC1394_2_CFLAGS = @DC1394_2_CFLAGS@
+DC1394_2_LIBS = @DC1394_2_LIBS@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FFMPEG_CFLAGS = @FFMPEG_CFLAGS@
+FFMPEG_LIBS = @FFMPEG_LIBS@
+FGREP = @FGREP@
+FONTCONFIG_CFLAGS = @FONTCONFIG_CFLAGS@
+FONTCONFIG_LIBS = @FONTCONFIG_LIBS@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_CONFIG = @FREETYPE_CONFIG@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GDK_PIXBUF_CFLAGS = @GDK_PIXBUF_CFLAGS@
+GDK_PIXBUF_LIBS = @GDK_PIXBUF_LIBS@
+GLU_CFLAGS = @GLU_CFLAGS@
+GLU_LIBS = @GLU_LIBS@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBFFMPEG = @LIBFFMPEG@
+LIBOBJS = @LIBOBJS@
+LIBRSVG_CFLAGS = @LIBRSVG_CFLAGS@
+LIBRSVG_LIBS = @LIBRSVG_LIBS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBVIDEO_LDADD = @LIBVIDEO_LDADD@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+MTDEV_CFLAGS = @MTDEV_CFLAGS@
+MTDEV_LIBS = @MTDEV_LIBS@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLDFLAGS = @OBJCLDFLAGS@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PANGOFT2_CFLAGS = @PANGOFT2_CFLAGS@
+PANGOFT2_LIBS = @PANGOFT2_LIBS@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PREFIX = @PREFIX@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
+PYTHON = @PYTHON@
+PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@
+PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
+PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@
+PYTHON_LDFLAGS = @PYTHON_LDFLAGS@
+PYTHON_PLATFORM = @PYTHON_PLATFORM@
+PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_SITE_PKG = @PYTHON_SITE_PKG@
+PYTHON_VERSION = @PYTHON_VERSION@
+RANLIB = @RANLIB@
+SDL_CFLAGS = @SDL_CFLAGS@
+SDL_CONFIG = @SDL_CONFIG@
+SDL_LIBS = @SDL_LIBS@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+XI2_1_CFLAGS = @XI2_1_CFLAGS@
+XI2_1_LIBS = @XI2_1_LIBS@
+XI2_2_CFLAGS = @XI2_2_CFLAGS@
+XI2_2_LIBS = @XI2_2_LIBS@
+XMKMF = @XMKMF@
+XML2_CFLAGS = @XML2_CFLAGS@
+XML2_CONFIG = @XML2_CONFIG@
+XML2_LIBS = @XML2_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+acx_pthread_config = @acx_pthread_config@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = $(pkgpyexecdir)/shaders
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+pkgpyexecdir = @pkgpyexecdir@
+pkgpythondir = @pkgpythondir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+pyexecdir = @pyexecdir@
+pythondir = @pythondir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+EXTRA_DIST = $(wildcard *.frag) $(wildcard *.vert)
+data_DATA = $(wildcard *.frag) $(wildcard *.vert)
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/graphics/shaders/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/graphics/shaders/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-dataDATA: $(data_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(datadir)" || $(MKDIR_P) "$(DESTDIR)$(datadir)"
+ @list='$(data_DATA)'; test -n "$(datadir)" || list=; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(datadir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(datadir)" || exit $$?; \
+ done
+
+uninstall-dataDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(data_DATA)'; test -n "$(datadir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ dir='$(DESTDIR)$(datadir)'; $(am__uninstall_files_from_dir)
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(DATA)
+installdirs:
+ for dir in "$(DESTDIR)$(datadir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-dataDATA
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-dataDATA
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ distclean distclean-generic distclean-libtool distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-dataDATA install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ uninstall uninstall-am uninstall-dataDATA
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/src/video/IDemuxer.h b/src/graphics/shaders/bandpass.frag
index 2df0e03..b52d1df 100644
--- a/src/video/IDemuxer.h
+++ b/src/graphics/shaders/bandpass.frag
@@ -19,28 +19,24 @@
// Current versions can be found at www.libavg.de
//
-#ifndef _IDemuxer_H_
-#define _IDemuxer_H_
+uniform sampler2D u_MinTex;
+uniform sampler2D u_MaxTex;
+uniform float u_PostScale;
+uniform bool u_bInvert;
-#include "../api.h"
-#include <math.h>
-
-#include "WrapFFMpeg.h"
-
-#include <boost/shared_ptr.hpp>
-
-namespace avg {
+#ifndef FRAGMENT_ONLY
+varying vec2 v_TexCoord;
+varying vec4 v_Color;
+#endif
- class AVG_API IDemuxer {
- public:
- virtual ~IDemuxer() {};
-
- virtual AVPacket * getPacket(int StreamIndex) = 0;
- virtual void seek(double DestTime) = 0;
- virtual void dump() {};
-
- };
- typedef boost::shared_ptr<IDemuxer> IDemuxerPtr;
+void main(void)
+{
+ vec4 min = texture2D(u_MinTex, v_TexCoord);
+ vec4 max = texture2D(u_MaxTex, v_TexCoord);
+ gl_FragColor = vec4(0.502, 0.502, 0.502, 0) + (max-min)*u_PostScale;
+ if (u_bInvert) {
+ gl_FragColor = vec4(1.004,1.004,1.004,1) - gl_FragColor;
+ }
+ gl_FragColor.a = 1.0;
}
-#endif
diff --git a/src/video/AVCCOpaque.cpp b/src/graphics/shaders/brightness.frag
index fdd7fc8..787c7ae 100644
--- a/src/video/AVCCOpaque.cpp
+++ b/src/graphics/shaders/brightness.frag
@@ -18,31 +18,18 @@
//
// Current versions can be found at www.libavg.de
//
-#include "AVCCOpaque.h"
+uniform float u_Alpha;
+uniform sampler2D u_Texture;
-namespace avg{
-
-AVCCOpaque::AVCCOpaque(VDPAU* pVDPAU, FrameAge* pFrameAge)
- : m_pVDPAU(pVDPAU),
- m_pFrameAge(pFrameAge)
-{
-}
-
-FrameAge* AVCCOpaque::getFrameAge()
-{
- return m_pFrameAge;
-}
-
-void AVCCOpaque::setFrameAge(FrameAge* pFrameAge)
+#ifndef FRAGMENT_ONLY
+varying vec2 v_TexCoord;
+varying vec4 v_Color;
+#endif
+
+void main(void)
{
- m_pFrameAge = pFrameAge;
+ vec4 tex = texture2D(u_Texture, v_TexCoord);
+ gl_FragColor.rgb = tex.rgb*u_Alpha;
+ gl_FragColor.a = tex.a;
}
-
-VDPAU* AVCCOpaque::getVDPAU()
-{
- return m_pVDPAU;
-}
-
-}
-
diff --git a/src/graphics/shaders/chromakey.frag b/src/graphics/shaders/chromakey.frag
new file mode 100644
index 0000000..f1fecad
--- /dev/null
+++ b/src/graphics/shaders/chromakey.frag
@@ -0,0 +1,134 @@
+//
+// libavg - Media Playback Engine.
+// Copyright (C) 2003-2011 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
+//
+
+uniform sampler2D u_Texture;
+uniform float u_HKey;
+uniform float u_HTolerance;
+uniform float u_HSoftTolerance;
+uniform float u_SKey;
+uniform float u_STolerance;
+uniform float u_SSoftTolerance;
+uniform float u_LKey;
+uniform float u_LTolerance;
+uniform float u_LSoftTolerance;
+uniform float u_SpillThreshold;
+uniform bool u_bIsLast;
+
+#include "helper.frag"
+
+#ifndef FRAGMENT_ONLY
+varying vec2 v_TexCoord;
+varying vec4 v_Color;
+#endif
+
+vec4 alphaMin(vec4 v1, vec4 v2)
+{
+ if (v1.a < v2.a) {
+ return v1;
+ } else {
+ return v2;
+ }
+}
+
+vec4 alphaMax(vec4 v1, vec4 v2)
+{
+ if (v1.a < v2.a) {
+ return v2;
+ } else {
+ return v1;
+ }
+}
+
+#define s2(a, b) temp = a; a = alphaMin(a, b); b = alphaMax(temp, b);
+#define mn3(a, b, c) s2(a, b); s2(a, c);
+#define mx3(a, b, c) s2(b, c); s2(a, c);
+
+#define mnmx3(a, b, c) mx3(a, b, c); s2(a, b);
+#define mnmx4(a, b, c, d) s2(a, b); s2(c, d); s2(a, c); s2(b, d);
+
+// Based on McGuire, A fast, small-radius GPU median filter, in ShaderX6,
+// February 2008. http://graphics.cs.williams.edu/papers/MedianShaderX6/
+vec4 getMedian(vec2 texCoord)
+{
+ vec4 v[5];
+ float dx = dFdx(texCoord.x);
+ float dy = dFdy(texCoord.y);
+ v[0] = texture2D(u_Texture, texCoord);
+ v[1] = texture2D(u_Texture, texCoord+vec2(0,-dy));
+ v[2] = texture2D(u_Texture, texCoord+vec2(0,dy));
+ v[3] = texture2D(u_Texture, texCoord+vec2(-dx,0));
+ v[4] = texture2D(u_Texture, texCoord+vec2(dx,0));
+ for (int i = 0; i < 5; ++i) {
+ v[i].a = 0.2989 * v[i].r + 0.5870 * v[i].g + 0.1140 * v[i].b;
+ }
+
+ vec4 temp;
+ mnmx4(v[0], v[1], v[2], v[3]);
+ mnmx3(v[1], v[2], v[4]);
+ return v[2];
+}
+
+void main(void)
+{
+ vec4 tex = getMedian(v_TexCoord);
+ float h;
+ float s;
+ float l;
+ float alpha;
+ rgb2hsl(tex, h, s, l);
+ float hDiff = abs(h-u_HKey);
+ float sDiff = abs(s-u_SKey);
+ float lDiff = abs(l-u_LKey);
+ if (hDiff < u_HSoftTolerance && sDiff < u_SSoftTolerance
+ && lDiff < u_LSoftTolerance)
+ {
+ alpha = 0.0;
+ if (hDiff > u_HTolerance) {
+ alpha = (hDiff-u_HTolerance)/(u_HSoftTolerance-u_HTolerance);
+ }
+ if (sDiff > u_STolerance) {
+ alpha = max(alpha,
+ (sDiff-u_STolerance)/(u_SSoftTolerance-u_STolerance));
+ }
+ if (lDiff > u_LTolerance) {
+ alpha = max(alpha,
+ (lDiff-u_LTolerance)/(u_LSoftTolerance-u_LTolerance));
+ }
+ } else {
+ alpha = 1.0;
+ }
+ tex = texture2D(u_Texture, v_TexCoord);
+ if (alpha > 0.0 && hDiff < u_SpillThreshold) {
+ rgb2hsl(tex, h, s, l);
+ if (u_SpillThreshold > u_HTolerance) {
+ float factor = max(0.0, 1.0-(u_SpillThreshold-hDiff)
+ /(u_SpillThreshold-u_HTolerance));
+ s = s*factor;
+ }
+ tex.rgb = hsl2rgb(h, s, l);
+ }
+ if (u_bIsLast) {
+ gl_FragColor = vec4(tex.rgb*alpha, alpha);
+ } else {
+ gl_FragColor = vec4(tex.rgb, alpha);
+ }
+}
+
diff --git a/src/graphics/shaders/chromakey_erosion.frag b/src/graphics/shaders/chromakey_erosion.frag
new file mode 100644
index 0000000..485d141
--- /dev/null
+++ b/src/graphics/shaders/chromakey_erosion.frag
@@ -0,0 +1,47 @@
+//
+// libavg - Media Playback Engine.
+// Copyright (C) 2003-2011 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
+//
+
+uniform sampler2D u_Texture;
+uniform bool u_bIsLast;
+
+#ifndef FRAGMENT_ONLY
+varying vec2 v_TexCoord;
+varying vec4 v_Color;
+#endif
+
+void main(void)
+{
+ float minAlpha = 1.0;
+ float dx = dFdx(v_TexCoord.x);
+ float dy = dFdy(v_TexCoord.y);
+ for (float y = -1.0; y <= 1.0; ++y) {
+ for (float x = -1.0; x <= 1.0; ++x) {
+ float a = texture2D(u_Texture, v_TexCoord+vec2(x*dx,y*dy)).a;
+ minAlpha = min(minAlpha, a);
+ }
+ }
+ vec4 tex = texture2D(u_Texture, v_TexCoord);
+ if (u_bIsLast) {
+ gl_FragColor = vec4(tex.rgb*minAlpha, minAlpha);
+ } else {
+ gl_FragColor = vec4(tex.rgb, minAlpha);
+ }
+}
diff --git a/src/graphics/shaders/helper.frag b/src/graphics/shaders/helper.frag
new file mode 100644
index 0000000..9fdb59a
--- /dev/null
+++ b/src/graphics/shaders/helper.frag
@@ -0,0 +1,109 @@
+//
+// libavg - Media Playback Engine.
+// Copyright (C) 2003-2011 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
+//
+
+void unPreMultiplyAlpha(inout vec4 color)
+{
+ if (color.a > 0.0) {
+ color.rgb /= color.a;
+ }
+}
+
+void preMultiplyAlpha(inout vec4 color)
+{
+ color.rgb *= color.a;
+}
+
+void rgb2hsl(vec4 rgba, out float h, out float s, out float l)
+{
+ float maxComp = max(rgba.r, max(rgba.g, rgba.b));
+ float minComp = min(rgba.r, min(rgba.g, rgba.b));
+ l = (maxComp+minComp)/2.0;
+ if (maxComp == minComp) {
+ s = 0.0;
+ h = 0.0;
+ } else {
+ float delta = maxComp-minComp;
+ if (l < 0.5) {
+ s = delta/(maxComp+minComp);
+ } else {
+ s = delta/(2.0-(maxComp+minComp));
+ }
+ if (rgba.r == maxComp) {
+ h = (rgba.g-rgba.b)/delta;
+ if (h < 0.0) {
+ h += 6.0;
+ }
+ } else if (rgba.g == maxComp) {
+ h = 2.0+(rgba.b-rgba.r)/delta;
+ } else {
+ h = 4.0+(rgba.r-rgba.g)/delta;
+ }
+ h *= 60.0;
+ }
+}
+
+vec3 hsl2rgb(float h, float s, float l)
+{
+ vec3 rgb = vec3(0.0, 0.0, 0.0);
+ float v;
+ if (l <= 0.5) {
+ v = l*(1.0+s);
+ } else {
+ v = l+s-l*s;
+ }
+ if (v > 0.0) {
+ float m = 2.0*l-v;
+ float sv = (v-m)/v;
+ h /= 60.0;
+ int sextant = int(h);
+ float fract = h-float(sextant);
+ float vsf = v * sv * fract;
+ float mid1 = m + vsf;
+ float mid2 = v - vsf;
+ if (sextant == 0) {
+ rgb.r = v;
+ rgb.g = mid1;
+ rgb.b = m;
+ } else if (sextant == 1) {
+ rgb.r = mid2;
+ rgb.g = v;
+ rgb.b = m;
+ } else if (sextant == 2) {
+ rgb.r = m;
+ rgb.g = v;
+ rgb.b = mid1;
+ } else if (sextant == 3) {
+ rgb.r = m;
+ rgb.g = mid2;
+ rgb.b = v;
+ } else if (sextant == 4) {
+ rgb.r = mid1;
+ rgb.g = m;
+ rgb.b = v;
+ } else if (sextant == 5) {
+ rgb.r = v;
+ rgb.g = m;
+ rgb.b = mid2;
+ }
+ }
+ return rgb;
+}
+
diff --git a/src/graphics/shaders/horizblur.frag b/src/graphics/shaders/horizblur.frag
new file mode 100644
index 0000000..fa78b21
--- /dev/null
+++ b/src/graphics/shaders/horizblur.frag
@@ -0,0 +1,43 @@
+//
+// libavg - Media Playback Engine.
+// Copyright (C) 2003-2011 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
+//
+
+uniform sampler2D u_Texture;
+uniform float u_Width;
+uniform int u_Radius;
+uniform sampler2D u_KernelTex;
+
+#ifndef FRAGMENT_ONLY
+varying vec2 v_TexCoord;
+varying vec4 v_Color;
+#endif
+
+void main(void)
+{
+ vec4 sum = vec4(0,0,0,0);
+ float dx = dFdx(v_TexCoord.x);
+ for (int i=-u_Radius; i<=u_Radius; ++i) {
+ vec4 tex = texture2D(u_Texture, v_TexCoord+vec2(float(i)*dx,0));
+ float coeff = texture2D(u_KernelTex, vec2((float(i+u_Radius)+0.5)/u_Width,0)).r;
+ sum += tex*coeff;
+ }
+ gl_FragColor = sum;
+}
+
diff --git a/src/graphics/shaders/horizshadow.frag b/src/graphics/shaders/horizshadow.frag
new file mode 100644
index 0000000..c9e512d
--- /dev/null
+++ b/src/graphics/shaders/horizshadow.frag
@@ -0,0 +1,44 @@
+//
+// libavg - Media Playback Engine.
+// Copyright (C) 2003-2011 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
+//
+
+uniform float u_Width;
+uniform int u_Radius;
+uniform sampler2D u_KernelTex;
+uniform sampler2D u_Texture;
+uniform vec2 u_Offset;
+
+#ifndef FRAGMENT_ONLY
+varying vec2 v_TexCoord;
+varying vec4 v_Color;
+#endif
+
+void main(void)
+{
+ float sum = 0.;
+ float dx = dFdx(v_TexCoord.x);
+ for (int i=-u_Radius; i<=u_Radius; ++i) {
+ float a = texture2D(u_Texture,
+ v_TexCoord-u_Offset+vec2(float(i)*dx,0)).a;
+ float coeff = texture2D(u_KernelTex, vec2((float(i+u_Radius)+0.5)/u_Width,0)).r;
+ sum += a*coeff;
+ }
+ gl_FragColor = vec4(sum, sum, sum, sum);
+}
diff --git a/src/graphics/shaders/huesat.frag b/src/graphics/shaders/huesat.frag
new file mode 100644
index 0000000..381b5b2
--- /dev/null
+++ b/src/graphics/shaders/huesat.frag
@@ -0,0 +1,72 @@
+//
+// libavg - Media Playback Engine.
+// Copyright (C) 2003-2011 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
+//
+
+const vec3 lumCoeff = vec3(0.2125, 0.7154, 0.0721);
+const vec3 white = vec3(1.0, 1.0, 1.0);
+const vec3 black = vec3(0.0, 0.0, 0.0);
+
+uniform sampler2D u_Texture;
+uniform float u_Hue;
+uniform float u_Sat;
+uniform float u_LightnessOffset;
+uniform bool u_bColorize;
+
+#ifndef FRAGMENT_ONLY
+varying vec2 v_TexCoord;
+varying vec4 v_Color;
+#endif
+
+#include "helper.frag"
+
+void main(void)
+{
+ float tmp;
+ float s;
+ float l;
+ float h;
+ vec4 tex = texture2D(u_Texture, v_TexCoord);
+ unPreMultiplyAlpha(tex);
+ rgb2hsl(tex, tmp, s, l);
+ if (u_bColorize) {
+ h = u_Hue;
+ s = u_Sat;
+ } else {
+ h = u_Hue+tmp;
+ }
+ vec4 rgbTex = vec4(hsl2rgb(mod(h, 360.0), s, l), tex.a);
+
+ // Saturate in rgb - space to imitate photoshop filter
+ if (!u_bColorize) {
+ s = clamp(u_Sat+s, 0.0, 2.0);
+ vec3 intensity = vec3(dot(rgbTex.rgb, lumCoeff));
+ rgbTex.rgb = mix(intensity, rgbTex.rgb, s);
+ }
+
+ // Brightness with black/white pixels to imitate photoshop lightness-offset
+ if (u_LightnessOffset >= 0.0) {
+ rgbTex = vec4(mix(rgbTex.rgb, white, u_LightnessOffset), tex.a);
+ } else if (u_LightnessOffset < 0.0) {
+ rgbTex = vec4(mix(rgbTex.rgb, black, -u_LightnessOffset), tex.a);
+ }
+
+ preMultiplyAlpha(rgbTex);
+ gl_FragColor = rgbTex;
+}
diff --git a/src/graphics/shaders/invert.frag b/src/graphics/shaders/invert.frag
new file mode 100644
index 0000000..36f49c7
--- /dev/null
+++ b/src/graphics/shaders/invert.frag
@@ -0,0 +1,41 @@
+//
+// libavg - Media Playback Engine.
+// Copyright (C) 2003-2011 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
+//
+
+uniform sampler2D u_Texture;
+
+#include "helper.frag"
+
+#ifndef FRAGMENT_ONLY
+varying vec2 v_TexCoord;
+varying vec4 v_Color;
+#endif
+
+void main(void)
+{
+ float hue, s, l;
+ vec4 tex = texture2D(u_Texture, v_TexCoord);
+ unPreMultiplyAlpha(tex);
+ rgb2hsl(tex, hue, s, l);
+ vec4 result = vec4(hsl2rgb(hue, s, 1.0-l), tex.a);
+ preMultiplyAlpha(result);
+ gl_FragColor = result;
+}
+
diff --git a/src/video/AVCCOpaque.h b/src/graphics/shaders/minimal.frag
index 8d909d1..acfbf2d 100644
--- a/src/video/AVCCOpaque.h
+++ b/src/graphics/shaders/minimal.frag
@@ -18,28 +18,20 @@
//
// Current versions can be found at www.libavg.de
//
-#ifndef _AVCCOpaque_H_
-#define _AVCCOpaque_H_
-#include "VDPAU.h"
-#include "FrameAge.h"
+uniform sampler2D u_Texture;
+uniform float u_Alpha;
-namespace avg{
+#ifndef FRAGMENT_ONLY
+varying vec2 v_TexCoord;
+varying vec4 v_Color;
+#endif
-class AVCCOpaque
+// A minimal shader for use on low-end systems where the standard shader hurts
+// performance.
+void main(void)
{
-public:
- AVCCOpaque(VDPAU* pVDPAU, FrameAge* pFrameAge = 0);
- FrameAge* getFrameAge();
- void setFrameAge(FrameAge* pFrameAge);
- VDPAU* getVDPAU();
-
-private:
- VDPAU* m_pVDPAU;
- FrameAge* m_pFrameAge;
-};
-
+ vec4 rgba = texture2D(u_Texture, v_TexCoord);
+ rgba.a *= u_Alpha;
+ gl_FragColor = rgba;
}
-
-#endif
-
diff --git a/src/video/FrameAge.h b/src/graphics/shaders/null.frag
index 18a529f..30b2627 100644
--- a/src/video/FrameAge.h
+++ b/src/graphics/shaders/null.frag
@@ -18,20 +18,16 @@
//
// Current versions can be found at www.libavg.de
//
-#ifndef _FrameAge_H_
-#define _FrameAge_H_
-namespace avg{
-
-struct FrameAge
-{
- FrameAge();
- int m_Age;
- int m_IPAge0;
- int m_IPAge1;
-};
-
-}
+uniform sampler2D u_Texture;
+#ifndef FRAGMENT_ONLY
+varying vec2 v_TexCoord;
+varying vec4 v_Color;
#endif
+void main(void)
+{
+ vec4 tex = texture2D(u_Texture, v_TexCoord);
+ gl_FragColor = tex;
+}
diff --git a/src/graphics/shaders/rgb2yuv.frag b/src/graphics/shaders/rgb2yuv.frag
new file mode 100644
index 0000000..351d3b2
--- /dev/null
+++ b/src/graphics/shaders/rgb2yuv.frag
@@ -0,0 +1,38 @@
+//
+// libavg - Media Playback Engine.
+// Copyright (C) 2003-2011 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
+//
+
+uniform sampler2D u_Texture;
+
+#ifndef FRAGMENT_ONLY
+varying vec2 v_TexCoord;
+varying vec4 v_Color;
+#endif
+
+void main(void)
+{
+ // Uses jpeg coefficients.
+ vec4 tex = texture2D(u_Texture, v_TexCoord);
+ float y = 0.299*tex.r + 0.587*tex.g + 0.114*tex.b;
+ float u = -0.168*tex.r - 0.330*tex.g + 0.498*tex.b + 0.5;
+ float v = 0.498*tex.r - 0.417*tex.g - 0.081*tex.b + 0.5;
+ gl_FragColor = vec4(v,u,y,1);
+}
+
diff --git a/src/graphics/shaders/standard.frag b/src/graphics/shaders/standard.frag
new file mode 100644
index 0000000..d77e835
--- /dev/null
+++ b/src/graphics/shaders/standard.frag
@@ -0,0 +1,101 @@
+//
+// libavg - Media Playback Engine.
+// Copyright (C) 2003-2011 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
+//
+
+uniform sampler2D u_Texture;
+uniform sampler2D u_CBTexture;
+uniform sampler2D u_CRTexture;
+uniform sampler2D u_ATexture;
+uniform sampler2D u_MaskTexture;
+uniform int u_ColorModel; // 0=rgb, 1=yuv, 2=alpha, 3=yuva
+uniform float u_Alpha;
+uniform vec4 u_ColorCoeff0;
+uniform vec4 u_ColorCoeff1;
+uniform vec4 u_ColorCoeff2;
+uniform vec4 u_ColorCoeff3;
+uniform bool u_bUseColorCoeff;
+uniform vec4 u_Gamma;
+uniform bool u_bPremultipliedAlpha;
+uniform bool u_bUseMask;
+uniform vec2 u_MaskPos;
+uniform vec2 u_MaskSize;
+
+#ifndef FRAGMENT_ONLY
+varying vec2 v_TexCoord;
+varying vec4 v_Color;
+#endif
+
+
+vec4 convertYCbCr(mat4 colorCoeff, vec4 tex)
+{
+ vec4 yuv;
+ yuv = vec4(tex.r,
+ texture2D(u_CBTexture, v_TexCoord).r,
+ texture2D(u_CRTexture, v_TexCoord).r,
+ 1.0);
+ vec4 rgb;
+ rgb = colorCoeff*yuv;
+ return vec4(rgb.rgb, u_Alpha);
+}
+
+void main(void)
+{
+ vec4 rgba;
+ mat4 colorCoeff;
+ colorCoeff[0] = u_ColorCoeff0;
+ colorCoeff[1] = u_ColorCoeff1;
+ colorCoeff[2] = u_ColorCoeff2;
+ colorCoeff[3] = u_ColorCoeff3;
+ vec4 tex = texture2D(u_Texture, v_TexCoord);
+ if (u_ColorModel == 0 || u_ColorModel == 2) {
+ float a;
+ if (u_ColorModel == 0) { // 0 = rgb
+ rgba = tex;
+ a = u_Alpha;
+ } else { // 2 = alpha
+ rgba = v_Color;
+ a = tex.a*u_Alpha;
+ }
+ if (u_bUseColorCoeff) {
+ rgba = colorCoeff*rgba;
+ }
+ rgba.a *= a;
+#ifdef ENABLE_YUV_CONVERSION
+ } else if (u_ColorModel == 1) { // yuv
+ rgba = convertYCbCr(colorCoeff, tex);
+ } else if (u_ColorModel == 3) { // yuva
+ rgba = convertYCbCr(colorCoeff, tex);
+ rgba.a *= texture2D(u_ATexture, v_TexCoord).r;
+#endif
+ } else {
+ rgba = vec4(1,1,1,1);
+ }
+ rgba = max(rgba, vec4(0.,0.,0.,0.));
+ rgba = pow(rgba, u_Gamma);
+ if (u_bUseMask) {
+ float mask = texture2D(u_MaskTexture, (v_TexCoord/u_MaskSize)-u_MaskPos).r;
+ if (u_bPremultipliedAlpha) {
+ rgba.rgb *= mask;
+ }
+ rgba.a *= mask;
+ }
+ gl_FragColor = rgba;
+}
+
diff --git a/src/video/FrameAge.cpp b/src/graphics/shaders/standard.vert
index a6dcd1f..ce3ba77 100644
--- a/src/video/FrameAge.cpp
+++ b/src/graphics/shaders/standard.vert
@@ -18,17 +18,19 @@
//
// Current versions can be found at www.libavg.de
//
-#include "FrameAge.h"
-namespace avg{
+uniform mat4 transform;
+attribute vec4 a_Color;
+attribute vec2 a_TexCoord;
+attribute vec2 a_Pos;
-FrameAge::FrameAge():
- m_Age(256*256*256*64),
- m_IPAge0(256*256*256*64),
- m_IPAge1(256*256*256*64)
-{
-}
+varying vec2 v_TexCoord;
+varying vec4 v_Color;
+void main(void)
+{
+ gl_Position = transform * vec4(a_Pos, 0, 1);
+ v_TexCoord = a_TexCoord/4096.;
+ v_Color = a_Color;
}
-
diff --git a/src/graphics/shaders/vertblur.frag b/src/graphics/shaders/vertblur.frag
new file mode 100644
index 0000000..167ef80
--- /dev/null
+++ b/src/graphics/shaders/vertblur.frag
@@ -0,0 +1,42 @@
+//
+// libavg - Media Playback Engine.
+// Copyright (C) 2003-2011 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
+//
+
+uniform sampler2D u_Texture;
+uniform float u_Width;
+uniform int u_Radius;
+uniform sampler2D u_KernelTex;
+
+#ifndef FRAGMENT_ONLY
+varying vec2 v_TexCoord;
+varying vec4 v_Color;
+#endif
+
+void main(void)
+{
+ vec4 sum = vec4(0,0,0,0);
+ float dy = dFdy(v_TexCoord.y);
+ for (int i=-u_Radius; i<=u_Radius; ++i) {
+ vec4 tex = texture2D(u_Texture, v_TexCoord+vec2(0,float(i)*dy));
+ float coeff = texture2D(u_KernelTex, vec2((float(i+u_Radius)+0.5)/u_Width,0)).r;
+ sum += tex*coeff;
+ }
+ gl_FragColor = sum;
+}
diff --git a/src/graphics/shaders/vertshadow.frag b/src/graphics/shaders/vertshadow.frag
new file mode 100644
index 0000000..bed8376
--- /dev/null
+++ b/src/graphics/shaders/vertshadow.frag
@@ -0,0 +1,54 @@
+//
+// libavg - Media Playback Engine.
+// Copyright (C) 2003-2011 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
+//
+
+uniform float u_Width;
+uniform int u_Radius;
+uniform sampler2D u_KernelTex;
+uniform sampler2D u_HBlurTex;
+uniform sampler2D u_OrigTex;
+uniform vec4 u_Color;
+uniform vec2 u_DestPos;
+uniform vec2 u_DestSize;
+
+#ifndef FRAGMENT_ONLY
+varying vec2 v_TexCoord;
+varying vec4 v_Color;
+#endif
+
+void main(void)
+{
+ float sum = 0.;
+ float dy = dFdy(v_TexCoord.y);
+ for (int i=-u_Radius; i<=u_Radius; ++i) {
+ float a = texture2D(u_HBlurTex,
+ v_TexCoord+vec2(0,float(i)*dy)).a;
+ float coeff =
+ texture2D(u_KernelTex, vec2((float(i+u_Radius)+0.5)/u_Width,0)).r;
+ sum += a*coeff;
+ }
+ sum = min(1., sum);
+ vec2 origCoord = v_TexCoord;
+ origCoord = u_DestPos +
+ vec2(origCoord.s*u_DestSize.x, origCoord.t*u_DestSize.y);
+ vec4 origCol = texture2D(u_OrigTex, origCoord);
+ gl_FragColor = origCol+(1.-origCol.a)*u_Color*sum;
+}
+
diff --git a/src/graphics/testgpu.cpp b/src/graphics/testgpu.cpp
index bf7a995..ee322e8 100644
--- a/src/graphics/testgpu.cpp
+++ b/src/graphics/testgpu.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -21,14 +21,17 @@
#include "GraphicsTest.h"
#include "GLTexture.h"
+#include "BitmapLoader.h"
#include "GPUBrightnessFilter.h"
#include "GPUBlurFilter.h"
#include "GPUBandpassFilter.h"
#include "GPUChromaKeyFilter.h"
#include "GPUHueSatFilter.h"
+#include "GPUInvertFilter.h"
#include "GPURGB2YUVFilter.h"
#include "FilterResizeBilinear.h"
-#include "OGLImagingContext.h"
+#include "GLContext.h"
+#include "ShaderRegistry.h"
#include "BmpTextureMover.h"
#include "PBO.h"
@@ -40,98 +43,116 @@
#include <math.h>
#include <iostream>
+#include <glib-object.h>
+
using namespace avg;
using namespace std;
-class TextureMoverTest: public GraphicsTest {
+class BandpassFilterTest: public GraphicsTest {
public:
- TextureMoverTest()
- : GraphicsTest("TextureMoverTest", 2)
+ BandpassFilterTest()
+ : GraphicsTest("BandpassFilterTest", 2)
{
}
void runTests()
{
- for (int i=0; i<2; ++i) {
- bool bPOT = (i==1);
- runImageTest(bPOT, MM_PBO, "rgb24-65x65");
- runImageTest(bPOT, MM_OGL, "rgb24-65x65");
- runImageTest(bPOT, MM_PBO, "rgb24alpha-64x64");
- runImageTest(bPOT, MM_OGL, "rgb24alpha-64x64");
- }
- runMipmapTest(MM_OGL, "rgb24alpha-64x64");
- runMipmapTest(MM_PBO, "rgb24alpha-64x64");
- runMipmapTest(MM_OGL, "rgb24-65x65");
- runMipmapTest(MM_PBO, "rgb24-65x65");
+ runImageTests("spike", B8G8R8X8);
+ runImageTests("i8-64x64", I8);
}
private:
- void runImageTest(bool bPOT, OGLMemoryMode memoryMode, const string& sFName)
+ void runImageTests(const string& sFName, PixelFormat pf)
{
- cerr << " Testing " << sFName << ", " << oglMemoryMode2String(memoryMode);
- if (bPOT) {
- cerr << ", POT" << endl;
- } else {
- cerr << ", NPOT" << endl;
+ cerr << " Testing " << sFName << endl;
+ BitmapPtr pBmp = loadTestBmp(sFName, pf);
+ GPUBandpassFilter f(pBmp->getSize(), pf, 0.5, 1.5, 1, false);
+ BitmapPtr pDestBmp = f.apply(pBmp);
+ TEST(fabs(pDestBmp->getAvg() -128) < 0.06);
+ testEqual(*pDestBmp, "bandpass_"+sFName, pf, 0.2, 0.5);
+ TEST(pDestBmp->getPixelFormat() == pf);
+ }
+};
+
+
+class BlurFilterTest: public GraphicsTest {
+public:
+ BlurFilterTest()
+ : GraphicsTest("BlurFilterTest", 2)
+ {
+ }
+
+ void runTests()
+ {
+/*
+ // This has the effect of printing out all the brightness differences for
+ //different kernel sizes.
+ BitmapPtr pDestBmp;
+ pBmp = loadTestBmp("spike");
+ for (float stddev = 0.5f; stddev < 5; stddev += 0.25f) {
+ pDestBmp = GPUBlurFilter(pBmp->getSize(), pBmp->getPixelFormat(), stddev)
+ .apply(pBmp);
+ testEqualBrightness(*pDestBmp, *pBmp, 1);
}
- BitmapPtr pOrigBmp = loadTestBmp(sFName);
- {
- cerr << " move functions." << endl;
- GLTexturePtr pTex = GLTexturePtr(new GLTexture(pOrigBmp->getSize(),
- pOrigBmp->getPixelFormat(), false, GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE,
- bPOT));
- TextureMoverPtr pWriteMover = TextureMover::create(memoryMode,
- pOrigBmp->getSize(), pOrigBmp->getPixelFormat(), GL_DYNAMIC_DRAW);
- pWriteMover->moveBmpToTexture(pOrigBmp, *pTex);
- BitmapPtr pDestBmp = readback(memoryMode, pOrigBmp, pTex);
- testEqual(*pDestBmp, *pOrigBmp, "pbo", 0.01, 0.1);
+*/
+ runFilterTests(false);
+ if (GLTexture::isFloatFormatSupported()) {
+ runFilterTests(true);
}
+ }
- {
- cerr << " lock functions." << endl;
- GLTexturePtr pTex = GLTexturePtr(new GLTexture(pOrigBmp->getSize(),
- pOrigBmp->getPixelFormat(), false, GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE,
- bPOT));
- TextureMoverPtr pMover = TextureMover::create(memoryMode,
- pOrigBmp->getSize(), pOrigBmp->getPixelFormat(), GL_DYNAMIC_DRAW);
- BitmapPtr pTransferBmp = pMover->lock();
- pTransferBmp->copyPixels(*pOrigBmp);
- pMover->unlock();
- pMover->moveToTexture(*pTex);
- BitmapPtr pDestBmp = readback(memoryMode, pOrigBmp, pTex);
- testEqual(*pDestBmp, *pOrigBmp, "pbo", 0.01, 0.1);
+private:
+ void runFilterTests(bool bUseFloat)
+ {
+ BitmapPtr pBmp;
+ GPUBlurFilterPtr pFilter;
+ pBmp = loadTestBmp("spike");
+ PixelFormat destPF;
+ if (bUseFloat) {
+ destPF = R32G32B32A32F;
+ } else {
+ destPF = B8G8R8A8;
}
+ pFilter = GPUBlurFilterPtr(new GPUBlurFilter(pBmp->getSize(),
+ pBmp->getPixelFormat(), destPF, 0.5f, false));
+ runImageTest(pBmp, pFilter, 0.5f, "blur05_spike");
+ runImageTest(pBmp, pFilter, 1, "blur1_spike");
+ runImageTest(pBmp, pFilter, 3, "blur3_spike");
+
+ pBmp = loadTestBmp("flat");
+ pFilter = GPUBlurFilterPtr(new GPUBlurFilter(pBmp->getSize(),
+ pBmp->getPixelFormat(), destPF, 5, false));
+ runImageTest(pBmp, pFilter, 5, "blur05_flat", true);
+
+ runImageTest("rgb24-64x64", destPF);
+ runImageTest("rgb24alpha-64x64", destPF);
+
}
- void runMipmapTest(OGLMemoryMode memoryMode, const string& sFName)
+ void runImageTest(const string& sFName, PixelFormat destPF)
{
- cerr << " Testing mipmap support, " << sFName << ", " <<
- oglMemoryMode2String(memoryMode) << endl;
- BitmapPtr pOrigBmp = loadTestBmp(sFName);
- GLTexturePtr pTex = GLTexturePtr(new GLTexture(pOrigBmp->getSize(),
- pOrigBmp->getPixelFormat(), true));
- pTex->moveBmpToTexture(pOrigBmp);
- pTex->generateMipmaps();
- TextureMoverPtr pReadMover = TextureMover::create(memoryMode,
- pOrigBmp->getSize(), pOrigBmp->getPixelFormat(), GL_DYNAMIC_READ);
- BitmapPtr pResultBmp = pReadMover->moveTextureToBmp(*pTex, 1);
- IntPoint newSize(pOrigBmp->getSize()/2);
- TEST(pResultBmp->getSize() == newSize);
- FilterResizeBilinear resizer(newSize);
- BitmapPtr pBaselineBmp = resizer.apply(pOrigBmp);
- testEqual(*pResultBmp, *pBaselineBmp, "pbo-mipmap", 2, 7);
+ BitmapPtr pBmp = loadTestBmp(sFName);
+ GPUBlurFilterPtr pFilter(new GPUBlurFilter(pBmp->getSize(),
+ pBmp->getPixelFormat(), destPF, 2, false));
+ runImageTest(pBmp, pFilter, 2, string("blur_")+sFName, true);
}
- BitmapPtr readback(OGLMemoryMode memoryMode, const BitmapPtr& pOrigBmp,
- const GLTexturePtr& pTex)
+ void runImageTest(BitmapPtr pBmp, GPUBlurFilterPtr pFilter, float stdDev,
+ string sBmpName, bool bIgnoreBrightness = false)
{
- TextureMoverPtr pReadMover = TextureMover::create(memoryMode,
- pTex->getGLSize(), pOrigBmp->getPixelFormat(), GL_DYNAMIC_READ);
- return pReadMover->moveTextureToBmp(*pTex);
+ cerr << " Testing " << sBmpName << ", stddev " << stdDev << endl;
+ pFilter->setStdDev(stdDev);
+ BitmapPtr pDestBmp = pFilter->apply(pBmp);
+ if (!bIgnoreBrightness) {
+ testEqualBrightness(*pDestBmp, *pBmp, 0.03);
+ }
+ testEqual(*pDestBmp, sBmpName, pDestBmp->getPixelFormat(), 0.1, 0.3);
}
+
};
+
class BrightnessFilterTest: public GraphicsTest {
public:
BrightnessFilterTest()
@@ -150,13 +171,26 @@ private:
{
cerr << " Testing " << sFName << endl;
BitmapPtr pBmp = loadTestBmp(sFName);
+ PixelFormat pf = pBmp->getPixelFormat();
+ cerr << " Source Bmp: " << pf << endl;
BitmapPtr pDestBmp;
- pDestBmp = GPUBrightnessFilter(pBmp->getSize(), pBmp->getPixelFormat(), 1)
+ pDestBmp = GPUBrightnessFilter(pBmp->getSize(), pixelFormatHasAlpha(pf), 1)
.apply(pBmp);
- testEqual(*pDestBmp, *pBmp, string("brightness_")+sFName, 0.2, 0.5);
+ float maxAverage, maxStdDev;
+ if (GLContext::getCurrent()->isGLES()) {
+ // less strict (lower floating point precision?)
+ maxAverage = 0.5;
+ maxStdDev = 1.5;
+ }
+ else {
+ maxAverage = 0.2;
+ maxStdDev = 0.5;
+ }
+ testEqual(*pDestBmp, *pBmp, string("brightness_")+sFName, maxAverage, maxStdDev);
}
};
+
class ChromaKeyFilterTest: public GraphicsTest {
public:
ChromaKeyFilterTest()
@@ -168,34 +202,35 @@ public:
{
BitmapPtr pBmp = loadTestBmp("chromakey");
BitmapPtr pDestBmp;
- GPUChromaKeyFilter filter(pBmp->getSize(), pBmp->getPixelFormat());
+ GPUChromaKeyFilter filter(pBmp->getSize());
for (int erosion = 0; erosion < 3; ++erosion) {
filter.setParams(Pixel32(0,255,0), 0.1, 0.2, 0.1, 0.1, erosion, 0);
pDestBmp = filter.apply(pBmp);
- testEqual(*pDestBmp, "ChromaKeyResult"+toString(erosion), R8G8B8X8, 0.3,
+ testEqual(*pDestBmp, "ChromaKeyResult"+toString(erosion), B8G8R8A8, 0.3,
0.7);
}
filter.setParams(Pixel32(0,255,0), 0.0, 0.0, 0.0, 0.0, 0, 0.1);
pDestBmp = filter.apply(pBmp);
- testEqual(*pDestBmp, "ChromaKeySpillResult1", R8G8B8X8, 0.3, 0.7);
+ testEqual(*pDestBmp, "ChromaKeySpillResult1", B8G8R8A8, 0.3, 0.7);
filter.setParams(Pixel32(0,255,0), 0.1, 0.1, 0.1, 0.0, 0, 0.1);
pDestBmp = filter.apply(pBmp);
- testEqual(*pDestBmp, "ChromaKeySpillResult2", R8G8B8X8, 0.3, 0.7);
+ testEqual(*pDestBmp, "ChromaKeySpillResult2", B8G8R8A8, 0.3, 0.7);
filter.setParams(Pixel32(0,255,0), 0.1, 0.1, 0.1, 0.0, 0, 0.2);
pDestBmp = filter.apply(pBmp);
- testEqual(*pDestBmp, "ChromaKeySpillResult3", R8G8B8X8, 0.3, 0.7);
+ testEqual(*pDestBmp, "ChromaKeySpillResult3", B8G8R8A8, 0.3, 0.7);
pBmp = loadTestBmp("chromakey-median");
filter.setParams(Pixel32(0,255,0), 0.1, 0.1, 0.1, 0.0, 0, 0.0);
pDestBmp = filter.apply(pBmp);
- testEqual(*pDestBmp, "ChromaKeyMedianResult", R8G8B8X8, 1, 6);
+ testEqual(*pDestBmp, "ChromaKeyMedianResult", B8G8R8A8, 1, 6);
}
};
-class HslColorFilterTest: public GraphicsTest {
+
+class HueSatFilterTest: public GraphicsTest {
public:
- HslColorFilterTest()
- : GraphicsTest("HslColorFilterTest", 2)
+ HueSatFilterTest()
+ : GraphicsTest("HueSatFilterTest", 2)
{
}
@@ -203,106 +238,57 @@ public:
{
BitmapPtr pBmp = loadTestBmp("hsl");
BitmapPtr pDestBmp;
- GPUHueSatFilter filter(pBmp->getSize(), pBmp->getPixelFormat());
+ GPUHueSatFilter filter(pBmp->getSize(), true);
//Test hue functionality
for (int run = 0; run < 3; run++) {
filter.setParams(run*90);
pDestBmp = filter.apply(pBmp);
- testEqual(*pDestBmp, "HslHueResult"+toString(run), R8G8B8X8, 0, 0);
+ testEqual(*pDestBmp, "HslHueResult"+toString(run), NO_PIXELFORMAT, 0, 0);
}
//Test colorize functionality
for (int run = 0; run < 3; run++) {
filter.setParams(run*90, 1, 0, true);
pDestBmp = filter.apply(pBmp);
- testEqual(*pDestBmp, "HslColorizeResult"+toString(run), R8G8B8X8, 0, 0);
+ testEqual(*pDestBmp, "HslColorizeResult"+toString(run), NO_PIXELFORMAT, 0, 0);
}
}
};
-class BlurFilterTest: public GraphicsTest {
+
+class InvertFilterTest: public GraphicsTest {
public:
- BlurFilterTest()
- : GraphicsTest("BlurFilterTest", 2)
+ InvertFilterTest()
+ : GraphicsTest("InvertFilterTest", 2)
{
}
void runTests()
{
- BitmapPtr pBmp;
- BitmapPtr pDestBmp;
-/*
- // This has the effect of printing out all the brightness differences for
- //different kernel sizes.
- pBmp = loadTestBmp("spike");
- for (double stddev = 0.5; stddev < 5; stddev += 0.25) {
- pDestBmp = GPUBlurFilter(pBmp->getSize(), pBmp->getPixelFormat(), stddev)
- .apply(pBmp);
- testEqualBrightness(*pDestBmp, *pBmp, 1);
- }
-*/
- pBmp = loadTestBmp("spike");
- GPUBlurFilter filter(pBmp->getSize(), pBmp->getPixelFormat(), R32G32B32A32F, 0.5,
- false);
- runImageTest(pBmp, filter, 0.5, "blur05_spike");
- runImageTest(pBmp, filter, 1, "blur1_spike");
- runImageTest(pBmp, filter, 3, "blur3_spike");
-
- pBmp = loadTestBmp("flat");
- filter = GPUBlurFilter(pBmp->getSize(), pBmp->getPixelFormat(), R32G32B32A32F, 5,
- false);
- runImageTest(pBmp, filter, 5, "blur05_flat", true);
-
- runImageTest("rgb24-64x64");
- runImageTest("rgb24alpha-64x64");
+ runImageTests("rgb24-64x64");
}
private:
- void runImageTest(const string& sFName)
+ void runImageTests(const string& sFName)
{
+ cerr << " Testing " << sFName << endl;
BitmapPtr pBmp = loadTestBmp(sFName);
- GPUBlurFilter filter(pBmp->getSize(), pBmp->getPixelFormat(), R32G32B32A32F, 2,
- false);
- runImageTest(pBmp, filter, 2, string("blur_")+sFName, true);
- }
-
- void runImageTest(BitmapPtr pBmp, GPUBlurFilter& filter, double stdDev,
- string sBmpName, bool bIgnoreBrightness = false)
- {
- cerr << " Testing " << sBmpName << ", stddev " << stdDev << endl;
- filter.setStdDev(stdDev);
- BitmapPtr pDestBmp = filter.apply(pBmp);
- if (!bIgnoreBrightness) {
- testEqualBrightness(*pDestBmp, *pBmp, 0.03);
+ BitmapPtr pDestBmp;
+ pDestBmp = GPUInvertFilter(pBmp->getSize(), false).apply(pBmp);
+ float maxAverage, maxStdDev;
+ if (GLContext::getCurrent()->isGLES()) {
+ // less strict (lower floating point precision?)
+ maxAverage = 0.6;
+ maxStdDev = 2.0;
}
- testEqual(*pDestBmp, sBmpName, B8G8R8X8, 0.01, 0.1);
+ else {
+ maxAverage = 0.0;
+ maxStdDev = 0.0;
+ }
+ testEqual(*pDestBmp, string("invert_")+sFName, pBmp->getPixelFormat(),
+ maxAverage, maxStdDev);
}
};
-class BandpassFilterTest: public GraphicsTest {
-public:
- BandpassFilterTest()
- : GraphicsTest("BandpassFilterTest", 2)
- {
- }
-
- void runTests()
- {
- runImageTests("spike", B8G8R8X8);
- runImageTests("i8-64x64", I8);
- }
-
-private:
- void runImageTests(const string& sFName, PixelFormat pf)
- {
- cerr << " Testing " << sFName << endl;
- BitmapPtr pBmp = loadTestBmp(sFName, pf);
- GPUBandpassFilter f(pBmp->getSize(), pf, 0.5, 1.5, 1, false);
- BitmapPtr pDestBmp = f.apply(pBmp);
- TEST(fabs(pDestBmp->getAvg() -128) < 0.06);
- testEqual(*pDestBmp, "bandpass_"+sFName, pf, 0.2, 0.5);
- TEST(pDestBmp->getPixelFormat() == pf);
- }
-};
class RGB2YUVFilterTest: public GraphicsTest {
public:
@@ -326,7 +312,7 @@ public:
BitmapPtr convertYUVX444ToRGB(const BitmapPtr& pYUVBmp)
{
- // This is a wierd pixel format that's not used anywhere else, so support
+ // This is a weird pixel format that's not used anywhere else, so support
// hasn't been moved to the Bitmap class.
BitmapPtr pRGBBmp(new Bitmap(pYUVBmp->getSize(), B8G8R8X8));
int height = pRGBBmp->getSize().y;
@@ -347,42 +333,180 @@ public:
};
+class TextureMoverTest: public GraphicsTest {
+public:
+ TextureMoverTest()
+ : GraphicsTest("TextureMoverTest", 2)
+ {
+ }
+
+ void runTests()
+ {
+ for (int i=1; i<2; ++i) {
+ bool bPOT = (i==1);
+ if (GLContext::getCurrent()->arePBOsSupported()) {
+ runImageTest(bPOT, MM_PBO, "rgb24-65x65");
+ runImageTest(bPOT, MM_PBO, "rgb24alpha-64x64");
+ }
+ runImageTest(bPOT, MM_OGL, "rgb24-65x65");
+ runImageTest(bPOT, MM_OGL, "rgb24alpha-64x64");
+ }
+ runCompressionTest(MM_OGL, "rgb24-65x65");
+ if (GLContext::getCurrent()->arePBOsSupported()) {
+ runCompressionTest(MM_PBO, "rgb24-65x65");
+ runMipmapTest(MM_PBO, "rgb24alpha-64x64");
+ runMipmapTest(MM_PBO, "rgb24-65x65");
+ }
+ runMipmapTest(MM_OGL, "rgb24-64x64");
+ runMipmapTest(MM_OGL, "rgb24alpha-64x64");
+ runMipmapTest(MM_OGL, "rgb24-65x65");
+ }
+
+private:
+ void runImageTest(bool bPOT, OGLMemoryMode memoryMode, const string& sFName)
+ {
+ string sResultFName = sFName + "-" + oglMemoryMode2String(memoryMode) + "-";
+ if (bPOT) {
+ sResultFName += "pot";
+ } else {
+ sResultFName += "npot";
+ }
+ cerr << " Testing " << sResultFName << endl;
+ BitmapPtr pOrigBmp = loadTestBmp(sFName);
+ {
+ cerr << " move functions." << endl;
+ GLTexturePtr pTex = GLTexturePtr(new GLTexture(pOrigBmp->getSize(),
+ pOrigBmp->getPixelFormat(), false, 0, GL_CLAMP_TO_EDGE,
+ GL_CLAMP_TO_EDGE, bPOT));
+ TextureMoverPtr pWriteMover = TextureMover::create(memoryMode,
+ pOrigBmp->getSize(), pOrigBmp->getPixelFormat(), GL_DYNAMIC_DRAW);
+ pWriteMover->moveBmpToTexture(pOrigBmp, *pTex);
+ BitmapPtr pDestBmp = pTex->moveTextureToBmp();
+ testEqual(*pDestBmp, *pOrigBmp, sResultFName+"-move", 0.01, 0.1);
+ }
+ {
+ cerr << " lock functions." << endl;
+ GLTexturePtr pTex = GLTexturePtr(new GLTexture(pOrigBmp->getSize(),
+ pOrigBmp->getPixelFormat(), false, 0, GL_CLAMP_TO_EDGE,
+ GL_CLAMP_TO_EDGE, bPOT));
+ TextureMoverPtr pMover = TextureMover::create(memoryMode,
+ pOrigBmp->getSize(), pOrigBmp->getPixelFormat(), GL_DYNAMIC_DRAW);
+ BitmapPtr pTransferBmp = pMover->lock();
+ pTransferBmp->copyPixels(*pOrigBmp);
+ pMover->unlock();
+ pMover->moveToTexture(*pTex);
+ BitmapPtr pDestBmp = pTex->moveTextureToBmp();
+ testEqual(*pDestBmp, *pOrigBmp, sResultFName+"-lock", 0.01, 0.1);
+ }
+ }
+
+ void runMipmapTest(OGLMemoryMode memoryMode, const string& sFName)
+ {
+ cerr << " Testing mipmap support, " << sFName << ", " <<
+ oglMemoryMode2String(memoryMode) << endl;
+ BitmapPtr pOrigBmp = loadTestBmp(sFName);
+ GLTexturePtr pTex = GLTexturePtr(new GLTexture(pOrigBmp->getSize(),
+ pOrigBmp->getPixelFormat(), true));
+ pTex->moveBmpToTexture(pOrigBmp);
+ pTex->generateMipmaps();
+
+ if (GLContext::getCurrent()->isGLES()) {
+ // GLES doesn't support attaching texture mipmap levels other than 0 to
+ // FBOs, so moveTextureToBmp() will fail. Skip result image comparison.
+ return;
+ }
+ BitmapPtr pResultBmp = pTex->moveTextureToBmp(1);
+ IntPoint newSize(pOrigBmp->getSize()/2);
+ TEST(pResultBmp->getSize() == newSize);
+ FilterResizeBilinear resizer(newSize);
+ BitmapPtr pBaselineBmp = resizer.apply(pOrigBmp);
+ string sName;
+ if (memoryMode == MM_PBO) {
+ sName = "pbo-mipmap";
+ } else {
+ sName = "ogl-mipmap";
+ }
+ testEqual(*pResultBmp, *pBaselineBmp, sName, 7, 15);
+ }
+
+ void runCompressionTest(OGLMemoryMode memoryMode, const string& sFName)
+ {
+ cerr << " Testing B5G6R5 compression, " << sFName << ", " <<
+ oglMemoryMode2String(memoryMode) << endl;
+ BitmapPtr pOrigBmp = loadTestBmp(sFName);
+ TextureMoverPtr pMover = TextureMover::create(memoryMode, pOrigBmp->getSize(),
+ B5G6R5, GL_STATIC_DRAW);
+ BitmapPtr pMoverBmp = pMover->lock();
+ pMoverBmp->copyPixels(*pOrigBmp);
+ pMover->unlock();
+ GLTexturePtr pTex = GLTexturePtr(new GLTexture(pMoverBmp->getSize(),
+ pMoverBmp->getPixelFormat(), false, 0, GL_CLAMP_TO_EDGE,
+ GL_CLAMP_TO_EDGE, false));
+ pMover->moveToTexture(*pTex);
+ BitmapPtr pDestBmp = pTex->moveTextureToBmp();
+ }
+};
+
+
class GPUTestSuite: public TestSuite {
public:
- GPUTestSuite()
- : TestSuite("GPUTestSuite")
+ GPUTestSuite(const string& sVariant)
+ : TestSuite("GPUTestSuite ("+sVariant+")")
{
addTest(TestPtr(new TextureMoverTest));
addTest(TestPtr(new BrightnessFilterTest));
- addTest(TestPtr(new RGB2YUVFilterTest));
- if (GLTexture::isFloatFormatSupported()) {
+ addTest(TestPtr(new HueSatFilterTest));
+ addTest(TestPtr(new InvertFilterTest));
+ if (GLContext::getCurrent()->getShaderUsage() == GLConfig::FULL) {
+ addTest(TestPtr(new RGB2YUVFilterTest));
addTest(TestPtr(new ChromaKeyFilterTest));
- addTest(TestPtr(new HslColorFilterTest));
addTest(TestPtr(new BlurFilterTest));
- addTest(TestPtr(new BandpassFilterTest));
- } else {
- cerr << "Skipping some GPU tests since float textures are not supported by "
- << endl << "the OpenGL configuration." << endl;
+ if (GLTexture::isFloatFormatSupported()) {
+ addTest(TestPtr(new BandpassFilterTest));
+ }
}
}
};
+bool runTests(bool bGLES, GLConfig::ShaderUsage su)
+{
+ string sVariant = string("GLES: ") + toString(bGLES) + ", ShaderUsage: " +
+ GLConfig::shaderUsageToString(su);
+ cerr << "---------------------------------------------------" << endl;
+ cerr << sVariant << endl;
+ cerr << "---------------------------------------------------" << endl;
+ GLContext* pContext = GLContext::create(GLConfig(bGLES, false, true, 1, su, true));
+ GLContext::setMain(pContext);
+ pContext->enableErrorChecks(true);
+ glDisable(GL_BLEND);
+ GLContext::checkError("glDisable(GL_BLEND)");
+ ShaderRegistry::get()->setShaderPath("./shaders");
+ try {
+ GPUTestSuite suite(sVariant);
+ suite.runTests();
+ delete pContext;
+ return suite.isOk();
+ } catch (Exception& ex) {
+ cerr << "Exception: " << ex.getStr() << endl;
+ delete pContext;
+ return false;
+ }
+}
+
+
int main(int nargs, char** args)
{
bool bOK = true;
try {
- OGLImagingContext context;
- try {
- if (!queryOGLExtension("GL_ARB_fragment_shader")) {
- throw Exception(AVG_ERR_UNSUPPORTED,
- "Fragment shaders not supported on this Machine. ");
- }
- GPUTestSuite suite;
- suite.runTests();
- bOK = suite.isOk();
- } catch (Exception& ex) {
- cerr << "Exception: " << ex.getStr() << endl;
+#ifndef AVG_ENABLE_EGL
+ BitmapLoader::init(true);
+ bOK = runTests(false, GLConfig::FULL);
+ bOK &= runTests(false, GLConfig::MINIMAL);
+#endif
+ if (GLContext::isGLESSupported()) {
+ BitmapLoader::init(false);
+ bOK &= runTests(true, GLConfig::MINIMAL);
}
} catch (Exception& ex) {
if (ex.getCode() == AVG_ERR_ASSERT_FAILED) {
@@ -396,8 +520,10 @@ int main(int nargs, char** args)
}
if (bOK) {
+ cerr << "testgpu succeeded" << endl;
return 0;
} else {
+ cerr << "testgpu failed" << endl;
return 1;
}
}
diff --git a/src/graphics/testgraphics.cpp b/src/graphics/testgraphics.cpp
index 57a19cc..f6874b6 100644
--- a/src/graphics/testgraphics.cpp
+++ b/src/graphics/testgraphics.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -21,6 +21,7 @@
#include "GraphicsTest.h"
#include "Bitmap.h"
+#include "BitmapLoader.h"
#include "Pixel32.h"
#include "Pixel24.h"
#include "Pixel16.h"
@@ -65,6 +66,8 @@
#include <stdio.h>
#include <stdlib.h>
+#include <glib-object.h>
+
using namespace avg;
using namespace std;
@@ -78,19 +81,20 @@ BitmapPtr initBmp(PixelFormat pf)
}
BitmapPtr pBmp(new Bitmap(IntPoint(4, height), pf));
- for(int y = 0; y < height; ++y) {
+ int bpp = pBmp->getBytesPerPixel();
+ for (int y = 0; y < height; ++y) {
for (int x = 0; x < 4; ++x) {
unsigned char * pPixel =
- pBmp->getPixels()+y*pBmp->getStride()+x*pBmp->getBytesPerPixel();
+ pBmp->getPixels()+y*pBmp->getStride()+x*pBmp->getBytesPerPixel();
*(pPixel) = x;
- if (pBmp->getBytesPerPixel() > 1) {
+ if (bpp > 1) {
*(pPixel+1) = 0;
}
- if (pBmp->getBytesPerPixel() > 2) {
+ if (bpp > 2) {
*(pPixel+2) = x;
*(pPixel) = 16*y;
}
- if (pBmp->getBytesPerPixel() > 3) {
+ if (bpp > 3) {
*(pPixel+3) = 0x80;
}
}
@@ -108,27 +112,26 @@ public:
void runTests()
{
- double h, s, l;
+ float h, s, l;
Pixel32(255, 0, 0).toHSL(h, s, l);
- TEST(h == 0 && s == 1.0 && l == 0.5);
+ TEST(h == 0 && almostEqual(s, 1.0f) && almostEqual(l, 0.5f));
Pixel32(0, 255, 0).toHSL(h, s, l);
- TEST(h == 120 && s == 1.0 && l == 0.5);
+ TEST(h == 120 && almostEqual(s, 1.0f) && almostEqual(l, 0.5f));
Pixel32(0, 0, 255).toHSL(h, s, l);
- TEST(h == 240 && s == 1.0 && l == 0.5);
+ TEST(h == 240 && almostEqual(s, 1.0f) && almostEqual(l, 0.5f));
Pixel32(255, 255, 0).toHSL(h, s, l);
- TEST(h == 60 && s == 1.0 && l == 0.5);
+ TEST(h == 60 && almostEqual(s, 1.0f) && almostEqual(l, 0.5f));
Pixel32(255, 0, 255).toHSL(h, s, l);
- TEST(h == 300 && s == 1.0 && l == 0.5);
+ TEST(h == 300 && almostEqual(s, 1.0f) && almostEqual(l, 0.5f));
Pixel32(0, 255, 255).toHSL(h, s, l);
- TEST(h == 180 && s == 1.0 && l == 0.5);
+ TEST(h == 180 && almostEqual(s, 1.0f) && almostEqual(l, 0.5f));
Pixel32(0, 0, 0).toHSL(h, s, l);
- TEST(s == 0.0 && l == 0.0);
+ TEST(s == 0.0f && l == 0.0f);
Pixel32(255, 255, 255).toHSL(h, s, l);
- TEST(s == 0.0 && l == 1.0);
+ TEST(s == 0.0f && l == 1.0f);
Pixel32(128, 128, 128).toHSL(h, s, l);
- TEST(s == 0.0 && fabs(l-0.5) < 0.02);
+ TEST(s == 0.0f && almostEqual(l, 0.5f, 0.02f));
}
-
};
class BitmapTest: public GraphicsTest {
@@ -293,9 +296,9 @@ private:
cerr << " Testing save for " << pf << endl;
BitmapPtr pBmp = initBmp(pf);
pBmp->save("test.png");
- Bitmap LoadedBmp("test.png");
+ BitmapPtr pLoadedBmp = loadBitmap("test.png");
::remove("test.png");
- testEqual(LoadedBmp, *pBmp, "BmpSave");
+ testEqual(*pLoadedBmp, *pBmp, "BmpSave");
}
template<class PIXEL>
@@ -314,10 +317,8 @@ private:
bmp.drawLine(IntPoint(7,7), IntPoint(14,12), color);
string sFName = getSrcDirName() + "baseline/LineResult" + getPixelFormatString(pf)
+ ".png";
- Bitmap baselineBmp(sFName);
- Bitmap baselineBmp2(IntPoint(15,15), pf);
- baselineBmp2.copyPixels(baselineBmp);
- testEqual(bmp, baselineBmp2, "BmpLineDraw");
+ BitmapPtr pBaselineBmp = loadBitmap(sFName, pf);
+ testEqual(bmp, *pBaselineBmp, "BmpLineDraw");
}
void testCopyToGreyscale(PixelFormat pf)
@@ -356,7 +357,7 @@ private:
template<class PIXEL>
void testStatistics(PixelFormat pf, const PIXEL& p00, const PIXEL& p01,
- const PIXEL& p10, const PIXEL& p11, double avg=1, double stdDev=1)
+ const PIXEL& p10, const PIXEL& p11, float avg=1, float stdDev=1)
{
BitmapPtr pBmp = BitmapPtr(new Bitmap(IntPoint(2,2), pf));
pBmp->setPixel(IntPoint(0,0), p00);
@@ -568,12 +569,8 @@ public:
if (pSrcDir) {
sFilename = (string)pSrcDir+"/";
}
- sFilename += "../test/rgb24-64x64.png";
- Bitmap tempBmp(sFilename);
- PixelFormat pf = R8G8B8;
- BitmapPtr pBmp;
- pBmp = createBmp(tempBmp.getSize(), pf);
- pBmp->copyPixels(tempBmp);
+ sFilename += "../test/media/rgb24-64x64.png";
+ BitmapPtr pBmp = loadBitmap(sFilename, R8G8B8);
FilterColorize(15, 50).applyInPlace(pBmp);
FilterFlipRGB().applyInPlace(pBmp);
} catch (Exception & ex) {
@@ -611,7 +608,7 @@ private:
{
BitmapPtr pBmp(new Bitmap(IntPoint(4, 4), pf));
initBmp<PIXEL>(pBmp);
- double mat[9] =
+ float mat[9] =
{1,0,2,
0,1,0,
3,0,4};
@@ -659,7 +656,7 @@ private:
{
BitmapPtr pBmp(new Bitmap(IntPoint(4, 4), pf));
initBmp<PIXEL>(pBmp);
- double mat[3][3] =
+ float mat[3][3] =
{{1,0,2},
{0,1,0},
{3,0,4}};
@@ -855,10 +852,7 @@ private:
string sFName = string("baseline/MaskResult")+sName+".png";
// pDestBmp->save(sFName);
sFName = getSrcDirName()+sFName;
- BitmapPtr pRGBXBaselineBmp = BitmapPtr(new Bitmap(sFName));
- BitmapPtr pBaselineBmp = BitmapPtr(
- new Bitmap(pRGBXBaselineBmp->getSize(), pBmp->getPixelFormat()));
- pBaselineBmp->copyPixels(*pRGBXBaselineBmp);
+ BitmapPtr pBaselineBmp = loadBitmap(sFName, pBmp->getPixelFormat());
TEST(*pDestBmp == *pBaselineBmp);
}
};
@@ -877,10 +871,7 @@ public:
string sFName = "baseline/ThresholdResult.png";
// pDestBmp->save(sFName);
sFName = getSrcDirName()+sFName;
- BitmapPtr pRGBXBaselineBmp = BitmapPtr(new Bitmap(sFName));
- BitmapPtr pBaselineBmp = BitmapPtr(
- new Bitmap(pRGBXBaselineBmp->getSize(), pBmp->getPixelFormat()));
- pBaselineBmp->copyPixels(*pRGBXBaselineBmp);
+ BitmapPtr pBaselineBmp = loadBitmap(sFName, pBmp->getPixelFormat());
TEST(*pDestBmp == *pBaselineBmp);
}
};
@@ -966,6 +957,8 @@ public:
runTestWithBitmap(pBmp);
pBmp = loadTestBmp("rgb24-64x64", B8G8R8X8);
runTestWithBitmap(pBmp);
+ pBmp = loadTestBmp("rgb24-65x65", B8G8R8);
+ runTestWithBitmap(pBmp);
}
private:
@@ -1049,6 +1042,7 @@ public:
int main(int nargs, char** args)
{
+ BitmapLoader::init(true);
GraphicsTest::createResultImgDir();
GraphicsTestSuite suite;
suite.runTests();
diff --git a/src/imaging/Blob.cpp b/src/imaging/Blob.cpp
index 59726af..b4d5777 100644
--- a/src/imaging/Blob.cpp
+++ b/src/imaging/Blob.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -156,7 +156,7 @@ void Blob::calcStats()
{
m_Center = calcCenter();
m_EstimatedNextCenter = m_Center;
- m_Area = calcArea();
+ m_Area = float(calcArea());
m_BoundingBox = calcBBox();
/*
more useful numbers that can be calculated from c
@@ -167,24 +167,24 @@ void Blob::calcStats()
Inertia = c_xx + c_yy
Eccentricity = ...
*/
- double c_xx = 0; // Variance in x direction
- double c_yy =0; // Variance in y direction
- double c_xy = 0; // Covariance
- double ll=0;
- double l1;
- double l2;
- double tmp_x;
- double tmp_y;
- double mag;
+ float c_xx = 0; // Variance in x direction
+ float c_yy =0; // Variance in y direction
+ float c_xy = 0; // Covariance
+ float ll=0;
+ float l1;
+ float l2;
+ float tmp_x;
+ float tmp_y;
+ float mag;
for (RunArray::iterator r = m_Runs.begin(); r != m_Runs.end();++r) {
//This is the evaluated expression for the variance when using runs...
- ll = r->length();
+ ll = float(r->length());
c_yy += ll* (r->m_Row- m_Center.y)*(r->m_Row- m_Center.y);
c_xx += ( (r->m_EndCol-1) * r->m_EndCol * (2*r->m_EndCol-1)
- - (r->m_StartCol-1) * r->m_StartCol * (2*r->m_StartCol -1))/6.
+ - (r->m_StartCol-1) * r->m_StartCol * (2*r->m_StartCol -1))/6.f
- m_Center.x * ((r->m_EndCol-1)*r->m_EndCol-(r->m_StartCol-1)*r->m_StartCol)
+ ll* m_Center.x*m_Center.x;
- c_xy += (r->m_Row-m_Center.y)*0.5*( (r->m_EndCol-1)*r->m_EndCol
+ c_xy += (r->m_Row-m_Center.y)*0.5f*( (r->m_EndCol-1)*r->m_EndCol
- (r->m_StartCol-1)*r->m_StartCol)
+ ll *(m_Center.x*m_Center.y - m_Center.x*r->m_Row);
}
@@ -195,9 +195,9 @@ void Blob::calcStats()
m_Inertia = c_xx + c_yy;
- double T = sqrt( (c_xx - c_yy) * (c_xx - c_yy) + 4*c_xy*c_xy);
+ float T = sqrt( (c_xx - c_yy) * (c_xx - c_yy) + 4*c_xy*c_xy);
m_Eccentricity = ((c_xx + c_yy) + T)/((c_xx+c_yy) - T);
- m_Orientation = 0.5*atan2(2*c_xy,c_xx-c_yy);
+ m_Orientation = 0.5f*atan2(2*c_xy,c_xx-c_yy);
// The l_i are variances (unit L^2) so to arrive at numbers that
// correspond to lengths in the picture we use sqrt
// Ensure that eigenvectors always have standard orientation, i.e. the determinant
@@ -205,8 +205,8 @@ void Blob::calcStats()
// E_1.x E_2.y - E_1.y E_2.x > 0
if (fabs(c_xy) > 1e-30) {
//FIXME. check l1!=0 l2!=0. li=0 happens for line-like components
- l1 = 0.5 * ((c_xx+c_yy) + sqrt((c_xx+c_yy)*(c_xx+c_yy)-4*(c_xx*c_yy-c_xy*c_xy)));
- l2 = 0.5 * ((c_xx+c_yy) - sqrt((c_xx+c_yy)*(c_xx+c_yy)-4*(c_xx*c_yy-c_xy*c_xy)));
+ l1 = 0.5f * ((c_xx+c_yy) + sqrt((c_xx+c_yy)*(c_xx+c_yy)-4*(c_xx*c_yy-c_xy*c_xy)));
+ l2 = 0.5f * ((c_xx+c_yy) - sqrt((c_xx+c_yy)*(c_xx+c_yy)-4*(c_xx*c_yy-c_xy*c_xy)));
tmp_x = c_xy/l1 - c_xx*c_yy/(c_xy*l1)+ (c_xx/c_xy);
tmp_y = 1.;
mag = sqrt(tmp_x*tmp_x + tmp_y*tmp_y);
@@ -250,17 +250,17 @@ void Blob::calcStats()
m_bStatsAvailable = true;
}
-const DPoint& Blob::getCenter() const
+const glm::vec2& Blob::getCenter() const
{
return m_Center;
}
-const DPoint& Blob::getEstimatedNextCenter() const
+const glm::vec2& Blob::getEstimatedNextCenter() const
{
return m_EstimatedNextCenter;
}
-double Blob::getArea() const
+float Blob::getArea() const
{
return m_Area;
}
@@ -270,37 +270,37 @@ const IntRect& Blob::getBoundingBox() const
return m_BoundingBox;
}
-double Blob::getEccentricity() const
+float Blob::getEccentricity() const
{
return m_Eccentricity;
}
-double Blob::getInertia() const
+float Blob::getInertia() const
{
return m_Inertia;
}
-double Blob::getOrientation() const
+float Blob::getOrientation() const
{
return m_Orientation;
}
-const DPoint & Blob::getScaledBasis(int i) const
+const glm::vec2 & Blob::getScaledBasis(int i) const
{
return m_ScaledBasis[i];
}
-const DPoint & Blob::getEigenVector(int i) const
+const glm::vec2 & Blob::getEigenVector(int i) const
{
return m_EigenVector[i];
}
-const DPoint & Blob::getEigenValues() const
+const glm::vec2 & Blob::getEigenValues() const
{
return m_EigenValues;
}
-void Blob::calcNextCenter(DPoint oldCenter)
+void Blob::calcNextCenter(glm::vec2 oldCenter)
{
m_EstimatedNextCenter = m_Center + (m_Center - oldCenter);
}
@@ -324,12 +324,12 @@ const BlobPtr Blob::getFirstRelated()
}
}
-DPoint Blob::calcCenter()
+glm::vec2 Blob::calcCenter()
{
- DPoint center(0,0);
- double c = 0;
+ glm::vec2 center(0,0);
+ float c = 0;
for (RunArray::iterator r = m_Runs.begin(); r != m_Runs.end(); ++r) {
- center += r->m_Center*r->length();
+ center += r->m_Center * float(r->length());
c += r->length();
}
center = center/c;
diff --git a/src/imaging/Blob.h b/src/imaging/Blob.h
index 5ced2c6..aff1994 100644
--- a/src/imaging/Blob.h
+++ b/src/imaging/Blob.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -30,7 +30,7 @@
#include "../graphics/Bitmap.h"
#include "../graphics/Pixel32.h"
-#include "../base/Point.h"
+#include "../base/GLMHelper.h"
#include <vector>
@@ -65,18 +65,18 @@ class AVG_API Blob
void calcContour(int Precision);
ContourSeq getContour();
- const DPoint& getCenter() const;
- const DPoint& getEstimatedNextCenter() const;
- double getArea() const;
+ const glm::vec2& getCenter() const;
+ const glm::vec2& getEstimatedNextCenter() const;
+ float getArea() const;
const IntRect & getBoundingBox() const;
- double getEccentricity() const;
- double getInertia() const;
- double getOrientation() const;
- const DPoint& getScaledBasis(int i) const;
- const DPoint& getEigenVector(int i) const;
- const DPoint& getEigenValues() const;
-
- void calcNextCenter(DPoint oldCenter);
+ float getEccentricity() const;
+ float getInertia() const;
+ float getOrientation() const;
+ const glm::vec2& getScaledBasis(int i) const;
+ const glm::vec2& getEigenVector(int i) const;
+ const glm::vec2& getEigenValues() const;
+
+ void calcNextCenter(glm::vec2 oldCenter);
void clearRelated();
void addRelated(BlobPtr pBlob);
const BlobPtr getFirstRelated();
@@ -85,7 +85,7 @@ class AVG_API Blob
private:
Blob(const Blob &);
- DPoint calcCenter();
+ glm::vec2 calcCenter();
IntRect calcBBox();
int calcArea();
void initRowPositions();
@@ -98,16 +98,16 @@ class AVG_API Blob
// For hands, this contains the fingers.
bool m_bStatsAvailable;
- DPoint m_EstimatedNextCenter;
- DPoint m_Center;
- double m_Area;
+ glm::vec2 m_EstimatedNextCenter;
+ glm::vec2 m_Center;
+ float m_Area;
IntRect m_BoundingBox;
- double m_Eccentricity;
- double m_Inertia;
- double m_Orientation;
- DPoint m_ScaledBasis[2];
- DPoint m_EigenVector[2];
- DPoint m_EigenValues;
+ float m_Eccentricity;
+ float m_Inertia;
+ float m_Orientation;
+ glm::vec2 m_ScaledBasis[2];
+ glm::vec2 m_EigenVector[2];
+ glm::vec2 m_EigenValues;
ContourSeq m_Contour;
};
diff --git a/src/imaging/CMUCamera.cpp b/src/imaging/CMUCamera.cpp
index 1991916..6c68c5f 100644
--- a/src/imaging/CMUCamera.cpp
+++ b/src/imaging/CMUCamera.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -36,11 +36,9 @@ using namespace std;
namespace avg {
-CMUCamera::CMUCamera(long long guid, bool bFW800, IntPoint Size,
- PixelFormat camPF, PixelFormat destPF, double FrameRate)
- : Camera(camPF, destPF),
- m_Size(Size),
- m_FrameRate(FrameRate),
+CMUCamera::CMUCamera(long long guid, bool bFW800, IntPoint size,
+ PixelFormat camPF, PixelFormat destPF, float frameRate)
+ : Camera(camPF, destPF, size, frameRate),
m_WhitebalanceU(-1),
m_WhitebalanceV(-1),
m_pCamera(0)
@@ -48,7 +46,7 @@ CMUCamera::CMUCamera(long long guid, bool bFW800, IntPoint Size,
m_pCamera = new C1394Camera();
int err;
unsigned long videoFormat, videoMode;
- getVideoFormatAndMode(m_Size, getCamPF(), &videoFormat, &videoMode);
+ getVideoFormatAndMode(getImgSize(), getCamPF(), &videoFormat, &videoMode);
// Find and open camera
if (m_pCamera->RefreshCameraList() <= 0) {
@@ -72,7 +70,7 @@ CMUCamera::CMUCamera(long long guid, bool bFW800, IntPoint Size,
checkCMUError(err, AVG_ERR_CAMERA_NONFATAL,
string("CMUCamera: Error setting video mode ") + toString(videoMode) +
", format: " + toString(videoFormat));
- err = m_pCamera->SetVideoFrameRate(getFrameRateConst(m_FrameRate));
+ err = m_pCamera->SetVideoFrameRate(getFrameRateConst(getFrameRate()));
checkCMUError(err, AVG_ERR_CAMERA_NONFATAL, "Error setting frame rate");
// Start capturing images
@@ -95,10 +93,12 @@ CMUCamera::CMUCamera(long long guid, bool bFW800, IntPoint Size,
m_pCamera->GetCameraVendor(sVendor, 256);
if (strcmp(sModel, "DFx 31BF03") == 0) {
- AVG_TRACE(Logger::CONFIG, "Applying bayer pattern fixup for IS DFx31BF03 camera");
+ AVG_TRACE(Logger::category::CONFIG, Logger::severity::INFO,
+ "Applying bayer pattern fixup for IS DFx31BF03 camera");
setCamPF(BAYER8_GRBG);
} else if (strcmp(sVendor, "Point Grey Research") == 0) {
- AVG_TRACE(Logger::CONFIG, "Applying bayer pattern fixup for PointGrey cameras");
+ AVG_TRACE(Logger::category::CONFIG, Logger::severity::INFO,
+ "Applying bayer pattern fixup for PointGrey cameras");
enablePtGreyBayer();
}
@@ -111,12 +111,6 @@ CMUCamera::~CMUCamera()
delete m_pCamera;
}
-
-IntPoint CMUCamera::getImgSize()
-{
- return m_Size;
-}
-
BitmapPtr CMUCamera::getImage(bool bWait)
{
if (bWait) {
@@ -139,8 +133,8 @@ BitmapPtr CMUCamera::getImage(bool bWait)
unsigned long captureBufferLength;
unsigned char* pCaptureBuffer = m_pCamera->GetRawData(&captureBufferLength);
- BitmapPtr pCamBmp(new Bitmap(m_Size, getCamPF(), pCaptureBuffer,
- captureBufferLength / m_Size.y, false, "TempCameraBmp"));
+ BitmapPtr pCamBmp(new Bitmap(getImgSize(), getCamPF(), pCaptureBuffer,
+ captureBufferLength / getImgSize().y, false, "TempCameraBmp"));
return convertCamFrameToDestPF(pCamBmp);
}
@@ -156,11 +150,6 @@ const std::string& CMUCamera::getDriverName() const
return sDriverName;
}
-double CMUCamera::getFrameRate() const
-{
- return m_FrameRate;
-}
-
int CMUCamera::getFeature(CameraFeature Feature) const
{
unsigned short val1;
@@ -179,7 +168,7 @@ void CMUCamera::setFeature(CameraFeature Feature, int Value, bool bIgnoreOldValu
int err = pControl->SetValue(Value);
checkCMUWarning(err == CAM_SUCCESS, "Error setting camera strobe.");
} else {
- AVG_TRACE(Logger::WARNING, "Camera does not support strobe.");
+ AVG_LOG_WARNING("Camera does not support strobe.");
}
} else {
CAMERA_FEATURE cmuFeature = getFeatureID(Feature);
@@ -196,7 +185,7 @@ void CMUCamera::setFeature(CameraFeature Feature, int Value, bool bIgnoreOldValu
string("Error setting camera feature: ") +
cameraFeatureToString(Feature));
} else {
- AVG_TRACE(Logger::WARNING, string("Camera does not support feature: ") +
+ AVG_LOG_WARNING(string("Camera does not support feature: ") +
cameraFeatureToString(Feature));
}
}
@@ -215,7 +204,7 @@ void CMUCamera::setFeatureOneShot(CameraFeature Feature)
&& err3 == CAM_SUCCESS,
string("Error setting feature: ") + cameraFeatureToString(Feature));
} else {
- AVG_TRACE(Logger::WARNING, string("Camera does not support feature: ") +
+ AVG_LOG_WARNING(string("Camera does not support feature: ") +
cameraFeatureToString(Feature));
}
}
@@ -255,35 +244,127 @@ void CMUCamera::setWhitebalance(int u, int v, bool bIgnoreOldValue)
string("Error setting camera feature: ") +
cameraFeatureToString(CAM_FEATURE_WHITE_BALANCE));
} else {
- AVG_TRACE(Logger::WARNING, string("Camera does not support feature: ") +
+ AVG_LOG_WARNING(string("Camera does not support feature: ") +
cameraFeatureToString(CAM_FEATURE_WHITE_BALANCE));
}
}
}
-void CMUCamera::dumpCameras()
+
+int CMUCamera::countCameras()
{
C1394Camera* pCamera = new C1394Camera();
-
if (pCamera->RefreshCameraList() <= 0) {
- return;
+ return 0;
}
- if (pCamera->GetNumberCameras() == 0) {
- return;
+ int numCameras = pCamera->GetNumberCameras();
+ return numCameras;
+}
+
+CameraInfo* CMUCamera::getCameraInfos(int deviceNumber)
+{
+#ifdef AVG_ENABLE_CMU1394
+ C1394Camera* pCamera = new C1394Camera();
+ int err = pCamera->RefreshCameraList();
+ if (err <= 0) {
+ return 0;
}
- cerr << "CMU Driver Firewire Cameras: " << endl;
- for (int i=0; i<pCamera->GetNumberCameras(); ++i) {
- pCamera->SelectCamera(i);
- char sz[256];
- cerr << " -----------------------" << endl;
- pCamera->GetCameraVendor(sz, 256);
- cerr << " Vendor: " << sz << endl;
- pCamera->GetCameraName(sz, 256);
- cerr << " Name: " << sz << endl;
- long long camGuid;
- pCamera->GetCameraUniqueID((PLARGE_INTEGER)&camGuid);
- cerr << " GUID: " << camGuid << endl;
+
+ err = pCamera->SelectCamera(deviceNumber);
+ if (err != CAM_SUCCESS) {
+ AVG_ASSERT(false);
}
+ pCamera->InitCamera(true);
+
+ long long uniqueID;
+ pCamera->GetCameraUniqueID((PLARGE_INTEGER)&uniqueID);
+ stringstream deviceID;
+ deviceID << uniqueID;
+
+ CameraInfo* pCamInfo = new CameraInfo("Firewire", deviceID.str());
+ getCameraImageFormats(pCamera, pCamInfo);
+ getCameraControls(pCamera, pCamInfo);
+
delete pCamera;
+ return pCamInfo;
+#endif
+ return NULL;
+}
+
+void CMUCamera::getCameraImageFormats(C1394Camera* pCamera, CameraInfo* pCamInfo)
+{
+ //Iterate over formats (up to 3 formats are supported)
+ for (int format = 0; format <= 2; format++) {
+ BOOL hasFormat = false;
+ hasFormat = pCamera->HasVideoFormat(format);
+ if(!hasFormat){
+ continue;
+ }
+ //Iterate over modes (up to 8 modes are supported)
+ for (int mode = 0; mode <= 7; mode++) {
+ BOOL hasMode = false;
+ hasMode = pCamera->HasVideoMode(format, mode);
+ if (!hasMode) {
+ continue;
+ }
+ //Ignore not libavg supported formats
+ if (mode == 0 && format == 0) {
+ continue;
+ }
+
+ IntPoint size;
+ PixelFormat pixelFormat;
+ FrameratesVector framerates;
+
+ getImageSizeAndPF(format, mode, size, pixelFormat);
+ getCameraFramerates(pCamera, format, mode, framerates);
+
+ CameraImageFormat imageFormat = CameraImageFormat(size, pixelFormat, framerates);
+ pCamInfo->addImageFormat(imageFormat);
+ }
+ }
+}
+
+void CMUCamera::getCameraFramerates(C1394Camera* pCamera, unsigned long videoFormat, unsigned long videoMode, FrameratesVector &framerates)
+{
+ for (int itFramerate = 0; itFramerate <= 7; itFramerate++) {
+ BOOL hasFramerate = false;
+ hasFramerate = pCamera->HasVideoFrameRate(videoFormat, videoMode, itFramerate);
+ if (!hasFramerate) {
+ continue;
+ }
+
+ float framerate = getFrameRateFloat(itFramerate);
+ framerates.push_back(framerate);
+ }
+}
+
+void CMUCamera::getCameraControls(C1394Camera* pCamera, CameraInfo* pCamInfo)
+{
+ //Iterate over amount of possible Features (up to 24 in CMU1394 DCD 6.4.5.240)
+ for (int indexFeature = 0; indexFeature <= 23; indexFeature++) {
+ C1394CameraControl* feature = pCamera->GetCameraControl((CAMERA_FEATURE)indexFeature);
+ if (feature == NULL) {
+ continue;
+ }
+ bool hasFeature = pCamera->HasFeature((CAMERA_FEATURE)indexFeature);
+ if (!hasFeature) {
+ continue;
+ }
+ //FrameRate (also known as TransferRate) is not supported
+ if (feature->GetFeatureID() == FEATURE_FRAME_RATE) {
+ continue;
+ }
+
+ std::string featureName = feature->GetName();
+ unsigned short min = -1;
+ unsigned short max = -1;
+ feature->GetRange(&min, &max);
+ unsigned short value_low = -1;
+ unsigned short value_high = -1; //TODO: For Whitebalance or Temperature etc.
+ feature->GetValue(&value_low, &value_high);
+ CameraControl camControl = CameraControl(featureName, (int)min, (int)max, (int)value_low);
+ pCamInfo->addControl(camControl);
+ }
}
int CMUCamera::getCamIndex(long long guid)
@@ -299,7 +380,7 @@ int CMUCamera::getCamIndex(long long guid)
return i;
}
}
- AVG_TRACE(Logger::WARNING, string("Camera with guid ") + toString(guid)
+ AVG_LOG_WARNING(string("Camera with guid ") + toString(guid)
+ " not present. Using first camera.");
return 0;
}
@@ -316,7 +397,7 @@ void CMUCamera::internalGetFeature(CameraFeature Feature, unsigned short* val1,
pControl->Status();
pControl->GetValue(val1, val2);
} else {
- AVG_TRACE(Logger::WARNING, string("Error reading camera feature: ") +
+ AVG_LOG_WARNING(string("Error reading camera feature: ") +
cameraFeatureToString(Feature));
}
}
@@ -338,7 +419,7 @@ void CMUCamera::enablePtGreyBayer()
PixelFormat exactPF = fwBayerStringToPF(bayerFormat);
setCamPF(exactPF);
} else {
- AVG_TRACE(Logger::ERROR, "imageDataFormat not supported.");
+ AVG_LOG_ERROR("imageDataFormat not supported.");
}
}
@@ -352,7 +433,7 @@ void CMUCamera::checkCMUError(int code, int type, const string & sMsg) const
void CMUCamera::checkCMUWarning(bool bOk, const string& sMsg) const
{
if (!bOk) {
- AVG_TRACE(Logger::WARNING, sMsg);
+ AVG_LOG_WARNING(sMsg);
}
}
diff --git a/src/imaging/CMUCamera.h b/src/imaging/CMUCamera.h
index 58dc129..a2f31e0 100644
--- a/src/imaging/CMUCamera.h
+++ b/src/imaging/CMUCamera.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -36,16 +36,14 @@ namespace avg {
class AVG_API CMUCamera : public Camera {
public:
CMUCamera(long long guid, bool bFW800, IntPoint Size, PixelFormat camPF,
- PixelFormat destPF, double FrameRate);
+ PixelFormat destPF, float FrameRate);
virtual ~CMUCamera();
- virtual IntPoint getImgSize();
virtual BitmapPtr getImage(bool bWait);
virtual const std::string& getDevice() const;
virtual const std::string& getDriverName() const;
- virtual double getFrameRate() const;
-
+
virtual int getFeature(CameraFeature Feature) const;
virtual void setFeature(CameraFeature Feature, int Value, bool bIgnoreOldValue=false);
virtual void setFeatureOneShot(CameraFeature Feature);
@@ -54,6 +52,8 @@ public:
virtual void setWhitebalance(int u, int v, bool bIgnoreOldValue=false);
static void dumpCameras();
+ static int countCameras();
+ static CameraInfo* getCameraInfos(int deviceNumber);
private:
int getCamIndex(long long guid);
@@ -64,9 +64,12 @@ private:
void checkCMUWarning(bool bOk, const std::string& sMsg) const;
std::string CMUErrorToString(int code);
+ static void getCameraControls(C1394Camera* pCamera, CameraInfo* camInfo);
+ static void getCameraImageFormats(C1394Camera* pCamera, CameraInfo* pCamInfo);
+ static void getCameraFramerates(C1394Camera* pCamera, unsigned long videoFormat,
+ unsigned long videoMode, FrameratesVector &framerates);
+
std::string m_sDevice;
- IntPoint m_Size;
- double m_FrameRate;
mutable C1394Camera * m_pCamera; // The CMU1394 lib is not const-correct.
FeatureMap m_Features;
diff --git a/src/imaging/CMUCameraUtils.cpp b/src/imaging/CMUCameraUtils.cpp
index 85b2af7..3e10570 100644
--- a/src/imaging/CMUCameraUtils.cpp
+++ b/src/imaging/CMUCameraUtils.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -147,31 +147,56 @@ void getVideoFormatAndMode(IntPoint& Size, PixelFormat pf,
}
}
-unsigned long getFrameRateConst(double FrameRate)
+unsigned long getFrameRateConst(float frameRate)
{
- if (FrameRate == 1.875) {
+ if (frameRate == 1.875f) {
return FRAMERATE_1_875;
- } else if (FrameRate == 3.75) {
+ } else if (frameRate == 3.75f) {
return FRAMERATE_3_75;
- } else if (FrameRate == 7.5) {
+ } else if (frameRate == 7.5f) {
return FRAMERATE_7_5;
- } else if (FrameRate == 15) {
+ } else if (frameRate == 15) {
return FRAMERATE_15;
- } else if (FrameRate == 30) {
+ } else if (frameRate == 30) {
return FRAMERATE_30;
- } else if (FrameRate == 60) {
+ } else if (frameRate == 60) {
return FRAMERATE_60;
- } else if (FrameRate == 120) {
+ } else if (frameRate == 120) {
return FRAMERATE_120;
- } else if (FrameRate == 240) {
+ } else if (frameRate == 240) {
return FRAMERATE_240;
} else {
throw Exception(AVG_ERR_INVALID_ARGS,
- "Unsupported or illegal value ("+toString(FrameRate)+
+ "Unsupported or illegal value ("+toString(frameRate)+
") for camera framerate.");
}
}
+float getFrameRateFloat(unsigned long frameRate)
+{
+ if(frameRate == FRAMERATE_1_875){
+ return 1.875;
+ } else if (frameRate == FRAMERATE_3_75){
+ return 3.75;
+ } else if (frameRate == FRAMERATE_7_5){
+ return 7.5;
+ } else if (frameRate == FRAMERATE_15){
+ return 15;
+ } else if (frameRate == FRAMERATE_30){
+ return 30;
+ } else if (frameRate == FRAMERATE_60){
+ return 60;
+ } else if (frameRate == FRAMERATE_120){
+ return 120;
+ } else if (frameRate == FRAMERATE_240){
+ return 240;
+ } else {
+ throw Exception(AVG_ERR_INVALID_ARGS,
+ "Unsupported or illegal value ("+toString(frameRate)+
+ ") as camera framerate.");
+ }
+}
+
CAMERA_FEATURE getFeatureID(CameraFeature Feature)
{
switch(Feature) {
@@ -218,4 +243,127 @@ CAMERA_FEATURE getFeatureID(CameraFeature Feature)
}
}
+void getImageSizeAndPF(unsigned long videoFormat, unsigned long videoMode,
+ IntPoint &pSize, PixelFormat &pPixelFormat)
+{
+ int format = (int) videoFormat;
+ int mode = (int) videoMode;
+ switch(format) {
+ case FORMAT_0: {
+ if (mode == MODE_160_120_YUV444) {
+ pSize = IntPoint(160,120);
+ pPixelFormat = PixelFormat(NO_PIXELFORMAT); //Not supported by libavg
+ return;
+ } else if (mode == MODE_320x240_YUV422) {
+ pSize = IntPoint(320,240);
+ pPixelFormat = PixelFormat(YCbCr422);
+ return;
+ } else if (mode == MODE_640x480_YUV411) {
+ pSize = IntPoint(640,480);
+ pPixelFormat = PixelFormat(YCbCr411);
+ return;
+ } else if (mode == MODE_640x480_YUV422) {
+ pSize = IntPoint(640,480);
+ pPixelFormat = PixelFormat(YCbCr422);
+ return;
+ } else if (mode == MODE_640x480_RGB) {
+ pSize = IntPoint(640,480);
+ pPixelFormat = PixelFormat(R8G8B8);
+ return;
+ } else if (mode == MODE_640x480_MONO) {
+ pSize = IntPoint(640,480);
+ pPixelFormat = PixelFormat(I8);
+ return;
+ } else if (mode == MODE_640x480_MONO16) {
+ pSize = IntPoint(640,480);
+ pPixelFormat = PixelFormat(I16);
+ return;
+ } else {
+ AVG_ASSERT(false);
+ return;
+ }
+ break;
+ } case FORMAT_1: {
+ if (mode == MODE_800x600_YUV422) {
+ pSize = IntPoint(800,600);
+ pPixelFormat = PixelFormat(YCbCr422);
+ return;
+ } else if (mode == MODE_800x600_RGB) {
+ pSize = IntPoint(800,600);
+ pPixelFormat = PixelFormat(R8G8B8);
+ return;
+ } else if (mode == MODE_800x600_MONO) {
+ pSize = IntPoint(800,600);
+ pPixelFormat = PixelFormat(I8);
+ return;
+ } else if (mode == MODE_1024x768_YUV422) {
+ pSize = IntPoint(1024,768);
+ pPixelFormat = PixelFormat(YCbCr422);
+ return;
+ } else if (mode == MODE_1024x768_RGB) {
+ pSize = IntPoint(1024,768);
+ pPixelFormat = PixelFormat(R8G8B8);
+ return;
+ } else if (mode == MODE_1024x768_MONO) {
+ pSize = IntPoint(1024,768);
+ pPixelFormat = PixelFormat(I8);
+ return;
+ } else if (mode == MODE_800x600_MONO16) {
+ pSize = IntPoint(800,600);
+ pPixelFormat = PixelFormat(I16);
+ return;
+ } else if (mode == MODE_1024x768_MONO16) {
+ pSize = IntPoint(1024,768);
+ pPixelFormat = PixelFormat(I16);
+ return;
+ } else {
+ AVG_ASSERT(false);
+ return;
+ }
+ break;
+ } case FORMAT_2: {
+ if (mode == MODE_1280x960_YUV422) {
+ pSize = IntPoint(1280,960);
+ pPixelFormat = PixelFormat(YCbCr422);
+ return;
+ } else if (mode == MODE_1280x960_RGB) {
+ pSize = IntPoint(1280,960);
+ pPixelFormat = PixelFormat(R8G8B8);
+ return;
+ } else if (mode == MODE_1280x960_MONO) {
+ pSize = IntPoint(1280,960);
+ pPixelFormat = PixelFormat(I8);
+ return;
+ } else if (mode == MODE_1600x1200_YUV422) {
+ pSize = IntPoint(1600,1200);
+ pPixelFormat = PixelFormat(YCbCr422);
+ return;
+ } else if (mode == MODE_1600x1200_RGB) {
+ pSize = IntPoint(1600,1200);
+ pPixelFormat = PixelFormat(R8G8B8);
+ return;
+ } else if (mode == MODE_1600x1200_MONO) {
+ pSize = IntPoint(1600,1200);
+ pPixelFormat = PixelFormat(I8);
+ return;
+ } else if (mode == MODE_1280x960_MONO16) {
+ pSize = IntPoint(1280,960);
+ pPixelFormat = PixelFormat(I16);
+ return;
+ } else if (mode == MODE_1600x1200_MONO16) {
+ pSize = IntPoint(1600,1200);
+ pPixelFormat = PixelFormat(I16);
+ return;
+ } else {
+ AVG_ASSERT(false);
+ return;
+ }
+ break;
+ } default: {
+ AVG_ASSERT(false);
+ return;
+ }
+ }
+}
+
}
diff --git a/src/imaging/CMUCameraUtils.h b/src/imaging/CMUCameraUtils.h
index 8172928..0d00c9f 100644
--- a/src/imaging/CMUCameraUtils.h
+++ b/src/imaging/CMUCameraUtils.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -36,9 +36,11 @@ namespace avg {
void getVideoFormatAndMode(IntPoint& Size, PixelFormat pf,
unsigned long* pVideoFormat, unsigned long* pVideoMode);
-unsigned long getFrameRateConst(double FrameRate);
+unsigned long getFrameRateConst(float FrameRate);
+float getFrameRateFloat(unsigned long FrameRate);
CAMERA_FEATURE getFeatureID(CameraFeature Feature);
-
+void getImageSizeAndPF(unsigned long videoFormat, unsigned long videoMode,
+ IntPoint &pSize, PixelFormat &pPixelFormat);
}
#endif
diff --git a/src/imaging/Camera.cpp b/src/imaging/Camera.cpp
index cfd13ab..51d778e 100644
--- a/src/imaging/Camera.cpp
+++ b/src/imaging/Camera.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -51,9 +51,11 @@ namespace avg {
using namespace std;
-Camera::Camera(PixelFormat camPF, PixelFormat destPF)
+Camera::Camera(PixelFormat camPF, PixelFormat destPF, IntPoint size, float frameRate)
: m_CamPF(camPF),
- m_DestPF(destPF)
+ m_DestPF(destPF),
+ m_Size(size),
+ m_FrameRate(frameRate)
{
// cerr << "Camera: " << getPixelFormatString(camPF) << "-->"
// << getPixelFormatString(destPF) << endl;
@@ -74,7 +76,7 @@ PixelFormat Camera::getDestPF() const
return m_DestPF;
}
-static ProfilingZoneID CameraConvertProfilingZone("Camera format conversion");
+static ProfilingZoneID CameraConvertProfilingZone("Camera format conversion", true);
BitmapPtr Camera::convertCamFrameToDestPF(BitmapPtr pCamBmp)
{
@@ -85,10 +87,24 @@ BitmapPtr Camera::convertCamFrameToDestPF(BitmapPtr pCamBmp)
pDestBmp->setPixelFormat(R8G8B8X8);
FilterFlipRGB().applyInPlace(pDestBmp);
}
+ if (m_CamPF != R8G8B8 && m_DestPF == R8G8B8X8) {
+ pDestBmp->setPixelFormat(B8G8R8X8);
+ FilterFlipRGB().applyInPlace(pDestBmp);
+ }
return pDestBmp;
}
+IntPoint Camera::getImgSize()
+{
+ return m_Size;
+}
+
+float Camera::getFrameRate() const
+{
+ return m_FrameRate;
+}
+
PixelFormat Camera::fwBayerStringToPF(unsigned long reg)
{
string sBayerFormat((char*)&reg, 4);
@@ -108,6 +124,11 @@ PixelFormat Camera::fwBayerStringToPF(unsigned long reg)
}
}
+void Camera::setImgSize(const IntPoint& size)
+{
+ m_Size = size;
+}
+
string cameraFeatureToString(CameraFeature feature)
{
switch (feature) {
@@ -137,6 +158,10 @@ string cameraFeatureToString(CameraFeature feature)
return "temperature";
case CAM_FEATURE_TRIGGER:
return "trigger";
+ case CAM_FEATURE_TRIGGER_DELAY:
+ return "trigger delay";
+ case CAM_FEATURE_WHITE_SHADING:
+ return "white shading";
case CAM_FEATURE_ZOOM:
return "zoom";
case CAM_FEATURE_PAN:
@@ -160,7 +185,7 @@ string cameraFeatureToString(CameraFeature feature)
CameraPtr createCamera(const string& sDriver, const string& sDevice, int unit,
bool bFW800, const IntPoint& captureSize, PixelFormat camPF, PixelFormat destPF,
- double frameRate)
+ float frameRate)
{
CameraPtr pCamera;
try {
@@ -182,8 +207,8 @@ CameraPtr createCamera(const string& sDriver, const string& sDevice, int unit,
pCamera = CameraPtr(new CMUCamera(guid, bFW800, captureSize, camPF, destPF,
frameRate));
#else
- guid = 0; // Silence compiler warning
- AVG_TRACE(Logger::WARNING, "Firewire camera specified, but firewire "
+ (void)guid; // Silence compiler warning
+ AVG_LOG_WARNING("Firewire camera specified, but firewire "
"support not compiled in.");
#endif
} else if (sDriver == "video4linux") {
@@ -191,7 +216,7 @@ CameraPtr createCamera(const string& sDriver, const string& sDevice, int unit,
pCamera = CameraPtr(new V4LCamera(sDevice, unit, captureSize, camPF,
destPF, frameRate));
#else
- AVG_TRACE(Logger::WARNING, "Video4Linux camera specified, but "
+ AVG_LOG_WARNING("Video4Linux camera specified, but "
"Video4Linux support not compiled in.");
#endif
} else if (sDriver == "directshow") {
@@ -203,7 +228,7 @@ CameraPtr createCamera(const string& sDriver, const string& sDevice, int unit,
pCamera = CameraPtr(new DSCamera(sDevice, captureSize, camPF, destPF,
frameRate));
#else
- AVG_TRACE(Logger::WARNING, "DirectShow camera specified, but "
+ AVG_LOG_WARNING("DirectShow camera specified, but "
"DirectShow is only available under windows.");
#endif
} else {
@@ -212,7 +237,7 @@ CameraPtr createCamera(const string& sDriver, const string& sDevice, int unit,
}
} catch (const Exception& e) {
if (e.getCode() == AVG_ERR_CAMERA_NONFATAL) {
- AVG_TRACE(Logger::WARNING, e.getStr());
+ AVG_LOG_WARNING(e.getStr());
} else {
throw;
}
@@ -225,20 +250,52 @@ CameraPtr createCamera(const string& sDriver, const string& sDevice, int unit,
}
-void dumpCameras()
+std::vector<CameraInfo> getCamerasInfos()
{
-#ifdef AVG_ENABLE_1394_2
- FWCamera::dumpCameras();
+ std::vector<CameraInfo> camerasInfo;
+
+#ifdef AVG_ENABLE_1394_2
+ int amountFWCameras = FWCamera::countCameras();
+ for (int i = 0; i < amountFWCameras; i++) {
+ CameraInfo* camInfo = FWCamera::getCameraInfos(i);
+ if (camInfo != NULL) {
+ camInfo->checkAddBayer8();
+ camerasInfo.push_back(*camInfo);
+ }
+ }
#endif
-#ifdef AVG_ENABLE_CMU1394
- CMUCamera::dumpCameras();
+#ifdef AVG_ENABLE_CMU1394
+ int amountCMUCameras = CMUCamera::countCameras();
+ for (int i = 0; i < amountCMUCameras; i++) {
+ CameraInfo* camInfo = CMUCamera::getCameraInfos(i);
+ if (camInfo != NULL) {
+ camInfo->checkAddBayer8();
+ camerasInfo.push_back(*camInfo);
+ }
+ }
#endif
-#ifdef AVG_ENABLE_V4L2
- V4LCamera::dumpCameras();
+#ifdef AVG_ENABLE_DSHOW
+ int amountDSCameras = DSCamera::countCameras();
+ for (int i = 0; i < amountDSCameras; i++) {
+ CameraInfo* camInfo = DSCamera::getCameraInfos(i);
+ if (camInfo != NULL) {
+ camInfo->checkAddBayer8();
+ camerasInfo.push_back(*camInfo);
+ }
+ }
#endif
-#ifdef AVG_ENABLE_DSHOW
- DSCamera::dumpCameras();
+#ifdef AVG_ENABLE_V4L2
+ int amountV4LCameras = V4LCamera::countCameras();
+ for (int i = 0; i < amountV4LCameras; i++) {
+ CameraInfo* camInfo = V4LCamera::getCameraInfos(i);
+ if (camInfo != NULL) {
+ camInfo->checkAddBayer8();
+ camerasInfo.push_back(*camInfo);
+ }
+ }
#endif
+ return camerasInfo;
}
+
}
diff --git a/src/imaging/Camera.h b/src/imaging/Camera.h
index 3a008e3..9d41574 100644
--- a/src/imaging/Camera.h
+++ b/src/imaging/Camera.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -26,8 +26,10 @@
#include "../graphics/Bitmap.h"
#include <boost/shared_ptr.hpp>
+#include "CameraInfo.h"
#include <string>
+#include <list>
#include <map>
namespace avg {
@@ -46,6 +48,8 @@ enum CameraFeature {
CAM_FEATURE_FOCUS,
CAM_FEATURE_TEMPERATURE,
CAM_FEATURE_TRIGGER,
+ CAM_FEATURE_TRIGGER_DELAY,
+ CAM_FEATURE_WHITE_SHADING,
CAM_FEATURE_ZOOM,
CAM_FEATURE_PAN,
CAM_FEATURE_TILT,
@@ -53,27 +57,28 @@ enum CameraFeature {
CAM_FEATURE_CAPTURE_SIZE,
CAM_FEATURE_CAPTURE_QUALITY,
CAM_FEATURE_CONTRAST,
- CAM_FEATURE_STROBE_DURATION
+ CAM_FEATURE_STROBE_DURATION,
+ CAM_FEATURE_UNSUPPORTED
};
class AVG_API Camera
{
public:
- Camera(PixelFormat camPF, PixelFormat destPF);
+ Camera(PixelFormat camPF, PixelFormat destPF, IntPoint size, float frameRate);
virtual ~Camera() {};
virtual void startCapture() {};
-
+
PixelFormat getCamPF() const;
void setCamPF(PixelFormat pf);
PixelFormat getDestPF() const;
BitmapPtr convertCamFrameToDestPF(BitmapPtr pCamBmp);
- virtual IntPoint getImgSize() = 0;
+ IntPoint getImgSize();
+ float getFrameRate() const;
virtual BitmapPtr getImage(bool bWait) = 0;
virtual const std::string& getDevice() const = 0;
virtual const std::string& getDriverName() const = 0;
- virtual double getFrameRate() const = 0;
virtual int getFeature(CameraFeature feature) const = 0;
virtual void setFeature(CameraFeature feature, int Value,
@@ -85,13 +90,19 @@ public:
protected:
PixelFormat fwBayerStringToPF(unsigned long reg);
+ void setImgSize(const IntPoint& size);
private:
Camera();
PixelFormat m_CamPF;
PixelFormat m_DestPF;
+
+ IntPoint m_Size;
+ float m_FrameRate;
};
+
+
std::string cameraFeatureToString(CameraFeature feature);
typedef boost::shared_ptr<Camera> CameraPtr;
@@ -99,9 +110,9 @@ typedef std::map<CameraFeature, int> FeatureMap;
AVG_API CameraPtr createCamera(const std::string& sDriver, const std::string& sDevice,
int unit, bool bFW800, const IntPoint& captureSize, PixelFormat camPF,
- PixelFormat destPF, double frameRate);
+ PixelFormat destPF, float frameRate);
-AVG_API void dumpCameras();
+AVG_API std::vector<CameraInfo> getCamerasInfos();
}
diff --git a/src/imaging/CameraInfo.cpp b/src/imaging/CameraInfo.cpp
new file mode 100644
index 0000000..b33789f
--- /dev/null
+++ b/src/imaging/CameraInfo.cpp
@@ -0,0 +1,159 @@
+//
+// 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
+//
+// V4L2/libavg compliance by 02L > Outside Standing Level
+
+#include "CameraInfo.h"
+
+namespace avg {
+
+CameraImageFormat::CameraImageFormat(IntPoint size, PixelFormat pixelFormat,
+ FrameratesVector framerates)
+{
+ m_Size = size;
+ m_PixelFormat = pixelFormat;
+ m_Framerates = framerates;
+}
+
+CameraImageFormat::~CameraImageFormat()
+{
+
+}
+
+IntPoint CameraImageFormat::getSize()
+{
+ return m_Size;
+}
+
+PixelFormat CameraImageFormat::getPixelFormat()
+{
+ return m_PixelFormat;
+}
+
+FrameratesVector CameraImageFormat::getFramerates()
+{
+ return m_Framerates;
+}
+
+
+CameraControl::CameraControl(const std::string& sControlName, int min, int max,
+ int defaultValue)
+{
+ m_sControlName = sControlName;
+ m_Min = min;
+ m_Max = max;
+ m_DefaultValue = defaultValue;
+}
+
+CameraControl::~CameraControl()
+{
+
+}
+
+std::string CameraControl::getControlName()
+{
+ return m_sControlName;
+}
+
+int CameraControl::getMin()
+{
+ return m_Min;
+}
+
+int CameraControl::getMax()
+{
+ return m_Max;
+}
+
+int CameraControl::getDefault()
+{
+ return m_DefaultValue;
+}
+
+
+CameraInfo::CameraInfo(const std::string& sDriver, const std::string& sDeviceID)
+{
+ m_sDriver = sDriver;
+ m_sDeviceID = sDeviceID;
+}
+
+CameraInfo::~CameraInfo()
+{
+
+}
+
+void CameraInfo::addControl(CameraControl control)
+{
+ m_Controls.push_back(control);
+}
+
+void CameraInfo::addImageFormat(CameraImageFormat format)
+{
+ m_Formats.push_back(format);
+}
+
+std::string CameraInfo::getDriver()
+{
+ return m_sDriver;
+}
+
+std::string CameraInfo::getDeviceID()
+{
+ return m_sDeviceID;
+}
+
+CameraImageFormatsVector CameraInfo::getImageFormats()
+{
+ return m_Formats;
+}
+
+CameraControlsVector CameraInfo::getControls()
+{
+ return m_Controls;
+}
+
+void CameraInfo::checkAddBayer8()
+{
+ CameraImageFormatsVector::iterator it = m_Formats.begin();
+ CameraImageFormatsVector i8ImageFormats;
+ bool hasColor = false;
+ for (; it!=m_Formats.end(); it++) {
+ PixelFormat pf = (*it).getPixelFormat();
+ if (pf == I8) {
+ i8ImageFormats.push_back(*it);
+ }
+ if (hasColor == false) {
+ hasColor = pixelFormatIsColored(pf);
+ }
+ }
+ if (hasColor) {
+ it = i8ImageFormats.begin();
+ for (; it!=i8ImageFormats.end(); it++) {
+ PixelFormat format = BAYER8;
+ IntPoint size = (*it).getSize();
+ FrameratesVector framerates = (*it).getFramerates();
+ CameraImageFormat bayerImageFormat = CameraImageFormat(size, format,
+ framerates);
+ m_Formats.push_back(bayerImageFormat);
+ }
+ }
+}
+
+}
diff --git a/src/imaging/CameraInfo.h b/src/imaging/CameraInfo.h
new file mode 100644
index 0000000..0c5a75b
--- /dev/null
+++ b/src/imaging/CameraInfo.h
@@ -0,0 +1,100 @@
+//
+// 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 CameraInfo_H_
+#define CameraInfo_H_
+
+#include "../api.h"
+#include "../graphics/PixelFormat.h"
+#include "../base/GLMHelper.h"
+
+#include <string>
+#include <list>
+#include <map>
+
+namespace avg{
+
+typedef std::vector<float> FrameratesVector;
+
+class AVG_API CameraImageFormat
+{
+ public:
+ CameraImageFormat(IntPoint size, PixelFormat pixelFormat,
+ FrameratesVector framerates);
+ ~CameraImageFormat();
+
+ IntPoint getSize();
+ PixelFormat getPixelFormat();
+ FrameratesVector getFramerates();
+
+ private:
+ IntPoint m_Size;
+ PixelFormat m_PixelFormat;
+ FrameratesVector m_Framerates;
+};
+
+class AVG_API CameraControl
+{
+ public:
+ CameraControl(const std::string& sControlName, int min, int max,
+ int defaultValue);
+ ~CameraControl();
+
+ std::string getControlName();
+ int getMin();
+ int getMax();
+ int getDefault();
+
+ private:
+ std::string m_sControlName;
+ int m_Min;
+ int m_Max;
+ int m_DefaultValue;
+};
+
+typedef std::vector<CameraImageFormat> CameraImageFormatsVector;
+typedef std::vector<CameraControl> CameraControlsVector;
+
+class AVG_API CameraInfo
+{
+ public:
+ CameraInfo(const std::string& sDriver, const std::string& sDeviceID);
+ ~CameraInfo();
+
+ void addControl(CameraControl control);
+ void addImageFormat(CameraImageFormat format);
+
+ std::string getDriver();
+ std::string getDeviceID();
+ CameraImageFormatsVector getImageFormats();
+ CameraControlsVector getControls();
+ void checkAddBayer8();
+
+ private:
+ std::string m_sDriver;
+ std::string m_sDeviceID;
+ CameraImageFormatsVector m_Formats;
+ CameraControlsVector m_Controls;
+};
+
+}
+
+#endif /* CAMERAINFO_H_ */
diff --git a/src/imaging/CoordTransformer.cpp b/src/imaging/CoordTransformer.cpp
index 1fdbadd..b4d7489 100644
--- a/src/imaging/CoordTransformer.cpp
+++ b/src/imaging/CoordTransformer.cpp
@@ -1,7 +1,7 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/imaging/CoordTransformer.h b/src/imaging/CoordTransformer.h
index 795e9b2..b9ce97d 100644
--- a/src/imaging/CoordTransformer.h
+++ b/src/imaging/CoordTransformer.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -23,7 +23,7 @@
#define _CoordTransformer_H_
#include "../api.h"
-#include "../base/Point.h"
+#include "../base/GLMHelper.h"
#include <boost/shared_ptr.hpp>
@@ -35,8 +35,8 @@ public:
CoordTransformer();
virtual ~CoordTransformer();
- virtual DPoint transform_point(const DPoint & pt) = 0; //(x,y) -> (x', y')
- virtual DPoint inverse_transform_point(const DPoint & pt) = 0; //(x,y) -> (x', y')
+ virtual glm::dvec2 transform_point(const glm::dvec2 & pt) = 0;
+ virtual glm::dvec2 inverse_transform_point(const glm::dvec2 & pt) = 0;
};
typedef boost::shared_ptr<CoordTransformer> CoordTransformerPtr;
diff --git a/src/imaging/DSCamera.cpp b/src/imaging/DSCamera.cpp
index 2d0ae6e..e9e3b3b 100644
--- a/src/imaging/DSCamera.cpp
+++ b/src/imaging/DSCamera.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -42,11 +42,9 @@ namespace avg {
using namespace std;
DSCamera::DSCamera(std::string sDevice, IntPoint size, PixelFormat camPF,
- PixelFormat destPF, double frameRate)
- : Camera(camPF, destPF),
+ PixelFormat destPF, float frameRate)
+ : Camera(camPF, destPF, size, frameRate),
m_sDevice(sDevice),
- m_Size(size),
- m_FrameRate(frameRate),
m_pGraph(0),
m_pCapture(0),
m_pCameraPropControl(0)
@@ -135,11 +133,6 @@ void DSCamera::close()
m_pSampleGrabber->Release();
}
-IntPoint DSCamera::getImgSize()
-{
- return m_Size;
-}
-
BitmapPtr DSCamera::getImage(bool bWait)
{
BitmapPtr pBmp;
@@ -179,7 +172,7 @@ void DSCamera::setCaptureFormat()
checkForDShowError(hr, "DSCamera::dumpMediaTypes::GetStreamCaps");
pvih = (VIDEOINFOHEADER*)(pmtConfig->pbFormat);
bih = pvih->bmiHeader;
- double frameRate = double(10000000L/pvih->AvgTimePerFrame);
+ float frameRate = float(10000000L/pvih->AvgTimePerFrame);
capsPF = mediaSubtypeToPixelFormat(pmtConfig->subtype);
if (capsPF != NO_PIXELFORMAT && bih.biWidth != 0) {
@@ -191,10 +184,10 @@ void DSCamera::setCaptureFormat()
if (height < 0) {
height = -height;
}
- if (bih.biWidth == m_Size.x && height == m_Size.y &&
+ if (bih.biWidth == getImgSize().x && height == getImgSize().y &&
(getCamPF() == capsPF || (getCamPF() == BAYER8_GBRG && capsPF == I8)))
{
- if (fabs(m_FrameRate-frameRate) < 0.001) {
+ if (fabs(getFrameRate()-frameRate) < 0.001) {
bFormatFound = true;
break;
} else if (!bCloseFormatFound) {
@@ -212,10 +205,10 @@ void DSCamera::setCaptureFormat()
}
}
if (bFormatFound) {
- AVG_TRACE(Logger::CONFIG, "Camera image format: "
- << camImageFormatToString(pmtConfig));
+ AVG_TRACE(Logger::category::CONFIG, Logger::severity::INFO,
+ "Camera image format: " << camImageFormatToString(pmtConfig));
int height = ((VIDEOINFOHEADER*)(pmtConfig->pbFormat))->bmiHeader.biHeight;
-// m_bUpsideDown = (height < 0);
+ m_bUpsideDown = (height > 0);
hr = pSC->SetFormat(pmtConfig);
checkForDShowError(hr, "DSCamera::dumpMediaTypes::SetFormat");
CoTaskMemFree((PVOID)pmtConfig->pbFormat);
@@ -224,22 +217,21 @@ void DSCamera::setCaptureFormat()
if (bCloseFormatFound) {
// Set the framerate manually.
pvih = (VIDEOINFOHEADER*)(pmtCloseConfig->pbFormat);
- pvih->AvgTimePerFrame = REFERENCE_TIME(10000000/m_FrameRate);
+ pvih->AvgTimePerFrame = REFERENCE_TIME(10000000/getFrameRate());
int height = pvih->bmiHeader.biHeight;
-// m_bUpsideDown = (height < 0);
+ m_bUpsideDown = (height > 0);
hr = pSC->SetFormat(pmtCloseConfig);
checkForDShowError(hr, "DSCamera::dumpMediaTypes::SetFormat");
- AVG_TRACE(Logger::CONFIG, "Camera image format: "
- << camImageFormatToString(pmtCloseConfig));
+ AVG_TRACE(Logger::category::CONFIG, Logger::severity::INFO,
+ "Camera image format: " << camImageFormatToString(pmtCloseConfig));
CoTaskMemFree((PVOID)pmtCloseConfig->pbFormat);
CoTaskMemFree(pmtCloseConfig);
// TODO: Check if framerate is actually attained.
} else {
- AVG_TRACE(Logger::WARNING,
- "Possibly incomplete list of camera image formats: ");
+ AVG_LOG_WARNING("Possibly incomplete list of camera image formats: ");
for (unsigned i = 0; i < sImageFormats.size(); i++) {
- AVG_TRACE(Logger::WARNING, " " << sImageFormats[i]);
+ AVG_LOG_WARNING(" " << sImageFormats[i]);
}
throw Exception(AVG_ERR_CAMERA_NONFATAL,
"Could not find requested camera image format.");
@@ -260,11 +252,6 @@ const std::string& DSCamera::getDriverName() const
return sDriverName;
}
-double DSCamera::getFrameRate() const
-{
- return m_FrameRate;
-}
-
int DSCamera::getFeature(CameraFeature feature) const
{
long prop = getDSFeatureID(feature);
@@ -277,8 +264,8 @@ int DSCamera::getFeature(CameraFeature feature) const
hr = m_pCameraPropControl->Get(prop, &val, &flags);
}
if (!SUCCEEDED(hr)) {
- AVG_TRACE(Logger::WARNING, "DSCamera::getFeature "
- + cameraFeatureToString(feature)+" failed.");
+ AVG_LOG_WARNING("DSCamera::getFeature " + cameraFeatureToString(feature)+
+ " failed.");
return 0;
}
return val;
@@ -305,14 +292,13 @@ void DSCamera::setFeature(CameraFeature feature, int value, bool bIgnoreOldValue
switch (hr) {
case E_INVALIDARG:
// TODO: Throw exception
- AVG_TRACE(Logger::ERROR, "DSCamera::setFeature("
- << cameraFeatureToString(feature) << ", " << value << ") failed.");
+ AVG_LOG_ERROR("DSCamera::setFeature(" << cameraFeatureToString(feature) <<
+ ", " << value << ") failed.");
break;
case E_PROP_ID_UNSUPPORTED:
case E_PROP_SET_UNSUPPORTED:
- AVG_TRACE(Logger::ERROR, "DSCamera::setFeature("
- << cameraFeatureToString(feature)
- << ") failed: Feature not supported by camera.");
+ AVG_LOG_ERROR("DSCamera::setFeature(" << cameraFeatureToString(feature)
+ << ") failed: Feature not supported by camera.");
break;
default:
checkForDShowError(hr, "DSCamera::setFeature()::Set value");
@@ -321,27 +307,27 @@ void DSCamera::setFeature(CameraFeature feature, int value, bool bIgnoreOldValue
void DSCamera::setFeatureOneShot(CameraFeature feature)
{
- AVG_TRACE(Logger::WARNING,
+ AVG_LOG_WARNING(
"OneShot feature setting not implemented for DirectShow camera driver.");
}
int DSCamera::getWhitebalanceU() const
{
- AVG_TRACE(Logger::WARNING,
+ AVG_LOG_WARNING(
"Whitebalance not implemented for DirectShow camera driver.");
return 0;
}
int DSCamera::getWhitebalanceV() const
{
- AVG_TRACE(Logger::WARNING,
+ AVG_LOG_WARNING(
"Whitebalance not implemented for DirectShow camera driver.");
return 0;
}
void DSCamera::setWhitebalance(int u, int v, bool bIgnoreOldValue)
{
- AVG_TRACE(Logger::WARNING,
+ AVG_LOG_WARNING(
"Whitebalance not implemented for DirectShow camera driver.");
}
@@ -352,64 +338,240 @@ void DSCamera::onSample(IMediaSample * pSample)
// Get the current image.
pSample->GetPointer(&pData);
- int stride = m_Size.x*getBytesPerPixel(getCamPF());
- Bitmap camBmp(m_Size, getCamPF(), pData, stride, false, "CameraImage");
+ int stride = getImgSize().x*getBytesPerPixel(getCamPF());
+ Bitmap camBmp(getImgSize(), getCamPF(), pData, stride, false, "CameraImage");
// Copy over to bitmap queue, doing pixel format conversion if necessary.
- BitmapPtr pDestBmp = BitmapPtr(new Bitmap(m_Size, getDestPF(),
+ BitmapPtr pDestBmp = BitmapPtr(new Bitmap(getImgSize(), getDestPF(),
"ConvertedCameraImage"));
pDestBmp->copyPixels(camBmp);
-/*
+
if (m_bUpsideDown) {
FilterFlip().applyInPlace(pDestBmp);
}
-*/
+
m_BitmapQ.push(pDestBmp);
}
-void DSCamera::dumpCameras()
+int DSCamera::countCameras()
{
+ int count = 0;
HRESULT hr = S_OK;
- // TODO: Check if the threading model is ok.
hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
- checkForDShowError(hr, "DSCamera::dumpCameras()::CoInitializeEx");
+ checkForDShowError(hr, "DSCamera::countCameras()::CoInitializeEx");
- // Create the system device enumerator
ICreateDevEnum *pDevEnum =NULL;
hr = CoCreateInstance(CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC,
IID_ICreateDevEnum, (void **) &pDevEnum);
- checkForDShowError(hr, "DSCamera::dumpCameras()::CreateDevEnum");
+ checkForDShowError(hr, "DSCamera::countCameras()::CreateDevEnum");
- // Create an enumerator for the video capture devices
IEnumMoniker *pClassEnum = NULL;
hr = pDevEnum->CreateClassEnumerator(CLSID_VideoInputDeviceCategory, &pClassEnum, 0);
- checkForDShowError(hr, "DSCamera::dumpCameras()::CreateClassEnumerator");
+ checkForDShowError(hr, "DSCamera::countCameras()::CreateClassEnumerator");
if (pClassEnum == NULL) {
- return;
+ pDevEnum->Release();
+ return count;
}
-
IMoniker* pMoniker = NULL;
- bool bFirst = true;
while (pClassEnum->Next(1, &pMoniker, NULL) == S_OK) {
- if (bFirst) {
- cerr << endl;
- cerr << "DirectShow cameras: " << endl;
- bFirst = false;
- }
- IPropertyBag* pPropBag;
- hr = pMoniker->BindToStorage(0, 0, IID_IPropertyBag, (void**)(&pPropBag));
- checkForDShowError(hr, "DSCamera::dumpCameras()::BindToStorage");
- cerr << " ----------------------------" << endl;
- cerr << " Name: " << getStringProp(pPropBag, L"FriendlyName") << endl;
- cerr << " Description: " << getStringProp(pPropBag, L"Description") << endl;
- cerr << " Device Path: " << getStringProp(pPropBag, L"DevicePath") << endl;
- pPropBag->Release();
+ count += 1;
}
pMoniker->Release();
+ pClassEnum->Release();
pDevEnum->Release();
+ return count;
+}
+
+CameraInfo* DSCamera::getCameraInfos(int deviceNumber)
+{
+#ifdef AVG_ENABLE_DSHOW
+ HRESULT hr = S_OK;
+ // Create apartment for Thread
+ hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
+ checkForDShowError(hr, "DSCamera::getCameraInfos()::CoInitializeEx");
+ // Create the system device enumerator
+ ICreateDevEnum *pDevEnum =NULL;
+ hr = CoCreateInstance(CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC,
+ IID_ICreateDevEnum, (void **) &pDevEnum);
+ checkForDShowError(hr, "DSCamera::getCameraInfos()::CreateDevEnum");
+ // Create an enumerator for the video capture devices
+ IEnumMoniker *pClassEnum = NULL;
+ hr = pDevEnum->CreateClassEnumerator(CLSID_VideoInputDeviceCategory, &pClassEnum, 0);
+ checkForDShowError(hr, "DSCamera::getCameraInfos()::CreateClassEnumerator");
+ if (pClassEnum == NULL) {
+ pClassEnum->Release();
+ pDevEnum->Release();
+ return NULL;
+ }
+ IMoniker* pMoniker = NULL;
+ pClassEnum->Skip(deviceNumber);
+ hr = pClassEnum->Next(1, &pMoniker, NULL);
+ if (hr != S_OK) {
+ pClassEnum->Release();
+ pDevEnum->Release();
+ pMoniker->Release();
+ return NULL;
+ }
+ IPropertyBag* pPropBag;
+ hr = pMoniker->BindToStorage(0, 0, IID_IPropertyBag, (void**)(&pPropBag));
+ checkForDShowError(hr, "DSCamera::getCameraInfos()::BindToStorage");
+
+ std::string deviceID = getStringProp(pPropBag, L"DevicePath");
+ if (deviceID.empty()) {
+ deviceID = getStringProp(pPropBag, L"Description");
+ if (deviceID.empty()) {
+ deviceID = getStringProp(pPropBag, L"FriendlyName");
+ }
+ }
+ CameraInfo* pCamInfo = new CameraInfo("DirectShow", deviceID);
+
+ getCameraImageFormats(pMoniker, pCamInfo);
+ getCameraControls(pMoniker, pCamInfo);
+
+ pPropBag->Release();
+ pMoniker->Release();
pClassEnum->Release();
+ pDevEnum->Release();
+ return pCamInfo;
+#endif
+ return NULL;
+}
+
+void DSCamera::getCameraImageFormats(IMoniker* pMoniker, CameraInfo* pCamInfo)
+{
+ HRESULT hr = S_OK;
+ IAMStreamConfig* pSC;
+ ICaptureGraphBuilder2* pCapture;
+ IBaseFilter* pSrcFilter;
+ // locates the object identified by pMoniker and
+ // returns a pointer to its filter interface
+ hr = pMoniker->BindToObject(0,0,IID_IBaseFilter, (void**) &pSrcFilter);
+ checkForDShowError(hr, "DSCamera::getImageFormats()::BindToObject");
+ if (pSrcFilter == NULL) {
+ return;
+ }
+ // Creates an uninitialized instance and returns a pointer to
+ // the IID_ICaptureGraphBuilder2 interface
+ hr = CoCreateInstance (CLSID_CaptureGraphBuilder2 , NULL, CLSCTX_INPROC,
+ IID_ICaptureGraphBuilder2, (void **) &pCapture);
+ checkForDShowError(hr, "DSCamera::getImageFormats()::CaptureGraphBuilder2");
+ // searches the graph for a IID_IAMStreamConfig interface, returns a pointer
+ hr = pCapture->FindInterface(&PIN_CATEGORY_CAPTURE, &MEDIATYPE_Video,
+ pSrcFilter, IID_IAMStreamConfig, (void **)&pSC);
+ checkForDShowError(hr, "DSCamera::getImageFormats()::FindInterface");
+ int numCaps = 0;
+ int capsSize = 0;
+ hr = pSC->GetNumberOfCapabilities(&numCaps, &capsSize);
+ checkForDShowError(hr, "DSCamera::getImageFormats()::GetNumberOfCapabilities");
+ AM_MEDIA_TYPE* pmtConfig;
+ vector<string> sImageFormats;
+ VIDEOINFOHEADER* pvih;
+ BITMAPINFOHEADER bih;
+ PixelFormat capsPF;
+ for (int i = 0; i < numCaps; i++) {
+ VIDEO_STREAM_CONFIG_CAPS scc;
+ hr = pSC->GetStreamCaps(i, &pmtConfig, (BYTE*)&scc);
+ checkForDShowError(hr, "DSCamera::getImageFormats()::GetStreamCaps");
+ pvih = (VIDEOINFOHEADER*)(pmtConfig->pbFormat);
+ bih = pvih->bmiHeader;
+ capsPF = mediaSubtypeToPixelFormat(pmtConfig->subtype);
+
+ if (capsPF != NO_PIXELFORMAT && bih.biWidth != 0) {
+ IntPoint size;
+ if (bih.biHeight >= 0) {
+ size = IntPoint(bih.biWidth, bih.biHeight);
+ } else {
+ size = IntPoint(bih.biWidth, -bih.biHeight);
+ }
+
+ std::vector<float> framerates;
+ float minFramerate = (float)(10000000 / scc.MinFrameInterval);
+ float maxFramerate = (float)(10000000 / scc.MaxFrameInterval);
+ float averageFramerate = (float)(10000000 / pvih->AvgTimePerFrame);
+ if (maxFramerate != 0.) {
+ framerates.push_back(maxFramerate);
+ }
+ if (averageFramerate != maxFramerate && averageFramerate != minFramerate) {
+ framerates.push_back(averageFramerate);
+ }
+ if (minFramerate != 0. && minFramerate != maxFramerate) {
+ framerates.push_back(minFramerate);
+ }
+ CameraImageFormat imageFormat = CameraImageFormat(size, capsPF, framerates);
+ pCamInfo->addImageFormat(imageFormat);
+ }
+ }
+ pCapture->Release();
+ pSrcFilter->Release();
+}
+
+void DSCamera::getCameraControls(IMoniker* pMoniker, CameraInfo* pCamInfo)
+{
+ HRESULT hr = S_OK;
+ IBaseFilter * pSrcFilter;
+ // locates the object identified by pMoniker and
+ // returns a pointer to its filter interface
+ hr = pMoniker->BindToObject(0,0,IID_IBaseFilter, (void**) &pSrcFilter);
+ checkForDShowError(hr, "DSCamera::dumpImageFormats()::BindToObject");
+ if (pSrcFilter == NULL) {
+ return;
+ }
+ IAMCameraControl* pAMCameraControl;
+ pSrcFilter->QueryInterface(IID_IAMCameraControl,
+ (void **)&pAMCameraControl);
+ if (pAMCameraControl != NULL) {
+ // DirectShow has 7 supported CameraControlProperties
+ for (int indexControl = 0; indexControl <= 6; indexControl++) {
+ long value = -999;
+ long flags = -999;
+ pAMCameraControl->Get((CameraControlProperty)indexControl, &value, &flags);
+ long min = -999;
+ long max = -999;
+ long delta = -999;
+ long defaultValue = -999;
+ flags = -999;
+ pAMCameraControl->GetRange((CameraControlProperty)indexControl, &min, &max,
+ &delta, &defaultValue, &flags);
+
+ CameraFeature feature = getCameraFeatureID_CCP((CameraControlProperty)indexControl);
+ if (min != -999 && max != -999 && defaultValue != -999
+ && feature != CAM_FEATURE_UNSUPPORTED) {
+ std::string featureName = cameraFeatureToString(feature);
+ CameraControl control = CameraControl(featureName,min,max,defaultValue);
+ pCamInfo->addControl(control);
+ }
+ }
+ }
+ IAMVideoProcAmp* pCameraPropControl;
+ pSrcFilter->QueryInterface(IID_IAMVideoProcAmp,
+ (void **)&pCameraPropControl);
+ if (pCameraPropControl != NULL) {
+ // DirectShow has 10 supported VideoProcAmpProperties
+ for (int indexPropControl = 0; indexPropControl <= 9; indexPropControl++) {
+ long value = -999;
+ long flags = -999;
+ pCameraPropControl->Get((VideoProcAmpProperty)indexPropControl, &value,
+ &flags);
+ long min = -999;
+ long max = -999;
+ long delta = -999;
+ long defaultValue = -999;
+ flags = -999;
+ pCameraPropControl->GetRange((VideoProcAmpProperty)indexPropControl, &min,
+ &max, &delta, &defaultValue, &flags);
+
+ CameraFeature feature = getCameraFeatureID_VPAP((VideoProcAmpProperty)indexPropControl);
+ if (min != -999 && max != -999 && defaultValue != -999
+ && feature != CAM_FEATURE_UNSUPPORTED) {
+ std::string featureName = cameraFeatureToString(feature);
+ CameraControl control = CameraControl(featureName,min,max,defaultValue);
+ pCamInfo->addControl(control);
+ }
+ }
+ }
}
+
void DSCamera::initGraphBuilder()
{
HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
@@ -477,7 +639,7 @@ void DSCamera::findCaptureDevice(IBaseFilter ** ppSrcFilter)
if (!bFound) {
pClassEnum->Reset();
if (pClassEnum->Next(1, &pMoniker, NULL) == S_OK) {
- AVG_TRACE(Logger::WARNING, string("Camera ") + m_sDevice
+ AVG_LOG_WARNING(string("Camera ") + m_sDevice
+ " not found. Using first camera.");
bFound = true;
IPropertyBag *pPropBag;
diff --git a/src/imaging/DSCamera.h b/src/imaging/DSCamera.h
index bf562ac..3602a62 100644
--- a/src/imaging/DSCamera.h
+++ b/src/imaging/DSCamera.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -31,7 +31,7 @@
#include "../graphics/Bitmap.h"
#include "../graphics/Pixel24.h"
-#include "../base/Point.h"
+#include "../base/GLMHelper.h"
#include "../base/Queue.h"
#include <string>
@@ -48,16 +48,14 @@ class DSCamera: public Camera, IDSSampleCallback
{
public:
DSCamera(std::string sDevice, IntPoint size, PixelFormat camPF, PixelFormat destPF,
- double frameRate);
+ float frameRate);
virtual ~DSCamera();
- virtual void startCapture();
+ virtual void startCapture();
- virtual IntPoint getImgSize();
virtual BitmapPtr getImage(bool bWait);
virtual const std::string& getDevice() const;
virtual const std::string& getDriverName() const;
- virtual double getFrameRate() const;
virtual int getFeature(CameraFeature feature) const;
virtual void setFeature(CameraFeature feature, int value,
@@ -69,7 +67,8 @@ public:
virtual void onSample(IMediaSample * pSample);
- static void dumpCameras();
+ static int countCameras();
+ static CameraInfo* getCameraInfos(int deviceNumber);
private:
virtual void open();
@@ -81,10 +80,10 @@ private:
void connectFilters(IGraphBuilder *pGraph, IBaseFilter *pSrc, IBaseFilter *pDest);
void getUnconnectedPin(IBaseFilter *pFilter, PIN_DIRECTION pinDir, IPin **ppPin);
static void checkForDShowError(HRESULT hr, const std::string & sAppMsg);
+ static void getCameraImageFormats(IMoniker* pMoniker, CameraInfo* pCamInfo);
+ static void getCameraControls(IMoniker* pMoniker, CameraInfo* pCamInfo);
std::string m_sDevice;
- IntPoint m_Size;
- double m_FrameRate;
IGraphBuilder * m_pGraph;
ICaptureGraphBuilder2 * m_pCapture;
@@ -98,7 +97,7 @@ private:
Queue<Bitmap> m_BitmapQ;
DWORD m_GraphRegisterID;
-// bool m_bUpsideDown;
+ bool m_bUpsideDown;
};
}
diff --git a/src/imaging/DSHelper.cpp b/src/imaging/DSHelper.cpp
index 6802ce9..d8880fb 100644
--- a/src/imaging/DSHelper.cpp
+++ b/src/imaging/DSHelper.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -181,8 +181,8 @@ string camImageFormatToString(const AM_MEDIA_TYPE* pMediaType)
BITMAPINFOHEADER* pBitmapInfo = &pVideoInfo->bmiHeader;
PixelFormat pf = mediaSubtypeToPixelFormat(pMediaType->subtype);
int height = abs(pBitmapInfo->biHeight);
- ss << "(" << pBitmapInfo->biWidth << "x" << height << "), " << pf
- << ", " << 10000000./pVideoInfo->AvgTimePerFrame << " fps.";
+ ss << pf << " " << "(" << pBitmapInfo->biWidth << ", " << height << ")"
+ << " " << 10000000./pVideoInfo->AvgTimePerFrame << " fps.";
return ss.str();
}
@@ -211,12 +211,12 @@ bool isDSFeatureCamControl(CameraFeature feature)
case CAM_FEATURE_CAPTURE_SIZE:
case CAM_FEATURE_CAPTURE_QUALITY:
case CAM_FEATURE_CONTRAST:
- AVG_TRACE(Logger::WARNING, "isDSFeatureCamControl: "
- + cameraFeatureToString(feature) + " not supported by DirectShow.");
+ AVG_LOG_WARNING("isDSFeatureCamControl: " + cameraFeatureToString(feature) +
+ " not supported by DirectShow.");
return false;
default:
- AVG_TRACE(Logger::WARNING, "isDSFeatureCamControl: "
- + cameraFeatureToString(feature) + " unknown.");
+ AVG_LOG_WARNING("isDSFeatureCamControl: " + cameraFeatureToString(feature) +
+ " unknown.");
return false;
}
}
@@ -257,13 +257,55 @@ long getDSFeatureID(CameraFeature feature)
case CAM_FEATURE_CAPTURE_SIZE:
case CAM_FEATURE_CAPTURE_QUALITY:
case CAM_FEATURE_CONTRAST:
- AVG_TRACE(Logger::WARNING, "getDSFeatureID: "+cameraFeatureToString(feature)
+
+ AVG_LOG_WARNING("getDSFeatureID: "+cameraFeatureToString(feature)
+" not supported by DirectShow.");
return 0;
default:
- AVG_TRACE(Logger::WARNING, "getDSFeatureID: "+cameraFeatureToString(feature)+" unknown.");
+ AVG_LOG_WARNING("getDSFeatureID: "+cameraFeatureToString(feature)+" unknown.");
return -1;
}
}
+CameraFeature getCameraFeatureID_VPAP(long videoProcAmpProperty)
+{
+ switch(videoProcAmpProperty) {
+ case VideoProcAmp_Brightness:
+ return CAM_FEATURE_BRIGHTNESS;
+ case VideoProcAmp_Sharpness:
+ return CAM_FEATURE_SHARPNESS;
+ case VideoProcAmp_WhiteBalance:
+ return CAM_FEATURE_WHITE_BALANCE;
+ case VideoProcAmp_Hue:
+ return CAM_FEATURE_HUE;
+ case VideoProcAmp_Saturation:
+ return CAM_FEATURE_SATURATION;
+ case VideoProcAmp_Gamma:
+ return CAM_FEATURE_GAMMA;
+ case VideoProcAmp_Gain:
+ return CAM_FEATURE_GAIN;
+ default:
+ return CAM_FEATURE_UNSUPPORTED;
+ }
+}
+CameraFeature getCameraFeatureID_CCP(long cameraControlProperty)
+{
+ switch(cameraControlProperty) {
+ case CameraControl_Exposure:
+ return CAM_FEATURE_EXPOSURE;
+ case CameraControl_Iris:
+ return CAM_FEATURE_IRIS;
+ case CameraControl_Focus:
+ return CAM_FEATURE_FOCUS;
+ case CameraControl_Zoom:
+ return CAM_FEATURE_ZOOM;
+ case CameraControl_Pan:
+ return CAM_FEATURE_PAN;
+ case CameraControl_Tilt:
+ return CAM_FEATURE_TILT;
+ default:
+ return CAM_FEATURE_UNSUPPORTED;
+ }
+}
+
}
diff --git a/src/imaging/DSHelper.h b/src/imaging/DSHelper.h
index 8904902..a8c6edb 100644
--- a/src/imaging/DSHelper.h
+++ b/src/imaging/DSHelper.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -56,7 +56,8 @@ std::string camImageFormatToString(const AM_MEDIA_TYPE* pMediaType);
bool isDSFeatureCamControl(CameraFeature feature);
long getDSFeatureID(CameraFeature feature);
-
+CameraFeature getCameraFeatureID_VPAP(long videoProcAmpProperty);
+CameraFeature getCameraFeatureID_CCP(long cameraControlProperty);
}
#endif
diff --git a/src/imaging/DSSampleGrabber.cpp b/src/imaging/DSSampleGrabber.cpp
index d38ad5f..1a62c2d 100755..100644
--- a/src/imaging/DSSampleGrabber.cpp
+++ b/src/imaging/DSSampleGrabber.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/imaging/DSSampleGrabber.h b/src/imaging/DSSampleGrabber.h
index 100667c..8c3ba5e 100755..100644
--- a/src/imaging/DSSampleGrabber.h
+++ b/src/imaging/DSSampleGrabber.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/imaging/DeDistort.cpp b/src/imaging/DeDistort.cpp
index abed1c8..5fec652 100644
--- a/src/imaging/DeDistort.cpp
+++ b/src/imaging/DeDistort.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -25,12 +25,13 @@
#include "TrackerConfig.h"
#include "../base/StringHelper.h"
-
+#include "../base/MathHelper.h"
+#include "../glm/gtx/rotate_vector.hpp"
#include <cstring>
#include <iostream>
#include <math.h>
-const double sqrt3 = sqrt(3.);
+const double sqrt3 = sqrt(3.f);
using namespace std;
@@ -61,12 +62,12 @@ DeDistort::DeDistort()
m_RescaleFactor = calc_rescale();
}
-DeDistort::DeDistort(const DPoint& camExtents, const DPoint& displayExtents)
+DeDistort::DeDistort(const glm::vec2& camExtents, const glm::vec2& displayExtents)
: m_Angle(0.0),
m_TrapezoidFactor(0),
m_DisplayOffset(0,0)
{
- m_CamExtents = camExtents;
+ m_CamExtents = glm::vec2(camExtents);
m_DistortionParams.push_back(0);
m_DistortionParams.push_back(0);
m_DisplayScale.x = displayExtents.x/camExtents.x;
@@ -74,9 +75,9 @@ DeDistort::DeDistort(const DPoint& camExtents, const DPoint& displayExtents)
m_RescaleFactor = calc_rescale();
}
-DeDistort::DeDistort(const DPoint& camExtents, const vector<double>& distortionParams,
- double angle, double trapezoidFactor, const DPoint& displayOffset,
- const DPoint& displayScale)
+DeDistort::DeDistort(const glm::vec2& camExtents, const vector<double>& distortionParams,
+ double angle, double trapezoidFactor, const glm::dvec2& displayOffset,
+ const glm::dvec2& displayScale)
: m_CamExtents(camExtents),
m_DistortionParams(distortionParams),
m_Angle(angle),
@@ -91,39 +92,39 @@ DeDistort::~DeDistort()
{
}
-DRect DeDistort::getDisplayArea(const DPoint& displayExtents)
+FRect DeDistort::getDisplayArea(const glm::vec2& displayExtents)
{
- return getActiveBlobArea(DRect(DPoint(0,0), displayExtents));
+ return getActiveBlobArea(FRect(glm::vec2(0,0), displayExtents));
}
-DRect DeDistort::getActiveBlobArea(const DRect& displayROI)
+FRect DeDistort::getActiveBlobArea(const FRect& displayROI)
{
- DRect activeRect;
- activeRect.tl = transformScreenToBlob(DPoint(displayROI.tl));
- activeRect.br = transformScreenToBlob(DPoint(displayROI.br));
+ FRect activeRect;
+ activeRect.tl = transformScreenToBlob(glm::dvec2(displayROI.tl));
+ activeRect.br = transformScreenToBlob(glm::dvec2(displayROI.br));
if (activeRect.height() < 1) {
- double temp = activeRect.tl.y;
+ float temp = activeRect.tl.y;
activeRect.tl.y = activeRect.br.y;
activeRect.br.y = temp;
}
if (activeRect.width() < 1) {
- double temp = activeRect.tl.x;
+ float temp = activeRect.tl.x;
activeRect.tl.x = activeRect.br.x;
activeRect.br.x = temp;
}
return activeRect;
}
-void DeDistort::load(const DPoint& camExtents, const TrackerConfig& config)
+void DeDistort::load(const glm::vec2& camExtents, const TrackerConfig& config)
{
- m_CamExtents = camExtents;
+ m_CamExtents = glm::dvec2(camExtents);
m_DistortionParams.clear();
- m_DistortionParams.push_back(config.getDoubleParam
- ("/transform/distortionparams/@p2"));
- m_DistortionParams.push_back(config.getDoubleParam
- ("/transform/distortionparams/@p3"));
- m_TrapezoidFactor = config.getDoubleParam("/transform/trapezoid/@value");
- m_Angle = config.getDoubleParam("/transform/angle/@value");
+ m_DistortionParams.push_back(double(config.getFloatParam
+ ("/transform/distortionparams/@p2")));
+ m_DistortionParams.push_back(double(config.getFloatParam
+ ("/transform/distortionparams/@p3")));
+ m_TrapezoidFactor = config.getFloatParam("/transform/trapezoid/@value");
+ m_Angle = config.getFloatParam("/transform/angle/@value");
m_DisplayOffset = config.getPointParam("/transform/displaydisplacement/");
m_DisplayScale = config.getPointParam("/transform/displayscale/");
@@ -173,59 +174,59 @@ void DeDistort::dump() const
cerr << " DisplayScale: " << m_DisplayScale << endl;
}
-DPoint DeDistort::transformScreenToBlob(const DPoint& pt)
+glm::dvec2 DeDistort::transformScreenToBlob(const glm::dvec2& pt)
{
// scale to blob image resolution and translate 0,0 to upper left corner.
- DPoint DestPt = pt-m_DisplayOffset;
- DestPt = DPoint(DestPt.x/m_DisplayScale.x, DestPt.y/m_DisplayScale.y);
+ glm::dvec2 DestPt = pt-m_DisplayOffset;
+ DestPt = glm::dvec2(DestPt.x/m_DisplayScale.x, DestPt.y/m_DisplayScale.y);
return DestPt;
}
-DPoint DeDistort::inverse_transform_point(const DPoint& pt)
+glm::dvec2 DeDistort::inverse_transform_point(const glm::dvec2& pt)
{
- DPoint destPt = pt-m_CamExtents/2;
- destPt = DPoint(2*destPt.x/m_CamExtents.x, 2*destPt.y/m_CamExtents.y);
+ glm::dvec2 destPt = pt - m_CamExtents/2.;
+ destPt = glm::dvec2(2*destPt.x/m_CamExtents.x, 2*destPt.y/m_CamExtents.y);
destPt = inv_trapezoid(m_TrapezoidFactor, destPt);
- destPt = destPt.getRotated(-m_Angle);
+ destPt = glm::rotate(destPt, -m_Angle*180/M_PI);
destPt *= m_RescaleFactor;
destPt = inverse_undistort(m_DistortionParams, destPt);
- destPt = DPoint(destPt.x*m_CamExtents.x/2, destPt.y*m_CamExtents.y/2);
- destPt += m_CamExtents/2;
+ destPt = glm::dvec2(destPt.x*m_CamExtents.x/2, destPt.y*m_CamExtents.y/2);
+ destPt += m_CamExtents/2.;
return destPt;
}
-DPoint DeDistort::transformBlobToScreen(const DPoint& pt)
+glm::dvec2 DeDistort::transformBlobToScreen(const glm::dvec2& pt)
{
- DPoint destPt = DPoint(m_DisplayScale.x*pt.x, m_DisplayScale.y*pt.y);
+ glm::dvec2 destPt(m_DisplayScale.x*pt.x, m_DisplayScale.y*pt.y);
destPt += m_DisplayOffset;
return destPt;
}
-DPoint DeDistort::transform_point(const DPoint& pt)
+glm::dvec2 DeDistort::transform_point(const glm::dvec2& pt)
{
- DPoint destPt = pt-m_CamExtents/2;
- destPt = DPoint(2*destPt.x/m_CamExtents.x, 2*destPt.y/m_CamExtents.y);
+ glm::dvec2 destPt = pt-m_CamExtents/2.;
+ destPt = glm::dvec2(2*destPt.x/m_CamExtents.x, 2*destPt.y/m_CamExtents.y);
destPt = undistort(m_DistortionParams, destPt);
destPt /= m_RescaleFactor;
- destPt = destPt.getRotated(m_Angle);
+ destPt = glm::rotate(destPt, m_Angle*180/M_PI);
destPt = trapezoid(m_TrapezoidFactor, destPt);
- destPt = DPoint(destPt.x*m_CamExtents.x/2, destPt.y*m_CamExtents.y/2);
- destPt += m_CamExtents/2;
+ destPt = glm::dvec2(destPt.x*m_CamExtents.x/2, destPt.y*m_CamExtents.y/2);
+ destPt += m_CamExtents/2.;
return destPt;
}
-DPoint DeDistort::inv_trapezoid(const double trapezoid_factor, const DPoint& pt)
+glm::dvec2 DeDistort::inv_trapezoid(const double trapezoid_factor, const glm::dvec2& pt)
{
// stretch x coord
double yn = pt.y;
- return DPoint(pt.x/(1+yn*trapezoid_factor), pt.y);
+ return glm::dvec2(pt.x/(1+yn*trapezoid_factor), pt.y);
}
-DPoint DeDistort::trapezoid(const double trapezoid_factor, const DPoint& pt)
+glm::dvec2 DeDistort::trapezoid(const double trapezoid_factor, const glm::dvec2& pt)
{
// stretch x coord
double yn = pt.y;
- return DPoint(pt.x*(1+yn*trapezoid_factor), pt.y);
+ return glm::dvec2(pt.x*(1+yn*trapezoid_factor), pt.y);
}
double distort_map(const vector<double>& params, double r)
@@ -265,12 +266,13 @@ double inv_distort_map(const vector<double>& params, double r)
}
#define EPSILON 0.00001
-DPoint DeDistort::inverse_undistort(const vector<double> &params, const DPoint &pt)
+glm::dvec2 DeDistort::inverse_undistort(const vector<double> &params,
+ const glm::dvec2 &pt)
{
if (params.empty()) {
return pt;
}
- DPoint pt_norm = pt;
+ glm::dvec2 pt_norm = pt;
double r_d = sqrt(pt_norm.x*pt_norm.x + pt_norm.y*pt_norm.y);
double S;
if (r_d < EPSILON) {
@@ -278,17 +280,17 @@ DPoint DeDistort::inverse_undistort(const vector<double> &params, const DPoint &
} else {
S = inv_distort_map(params, r_d)/r_d;
}
- DPoint result = pt_norm*(S);
+ glm::dvec2 result = pt_norm*(S);
return result;
}
-DPoint DeDistort::undistort(const vector<double>& params, const DPoint &pt)
+glm::dvec2 DeDistort::undistort(const vector<double>& params, const glm::dvec2 &pt)
{
std::vector<double>::const_iterator v = params.begin();
if (v == params.end()) {
return pt;
}
- DPoint pt_norm = pt;
+ glm::dvec2 pt_norm = pt;
double r_d = sqrt(pt_norm.x*pt_norm.x + pt_norm.y*pt_norm.y);
double S;
if (r_d < EPSILON) {
@@ -297,7 +299,7 @@ DPoint DeDistort::undistort(const vector<double>& params, const DPoint &pt)
S = distort_map(params, r_d)/r_d;
}
- DPoint result = pt_norm*(S);
+ glm::dvec2 result = pt_norm*(S);
return result;
}
diff --git a/src/imaging/DeDistort.h b/src/imaging/DeDistort.h
index ab804c6..1c2edc5 100644
--- a/src/imaging/DeDistort.h
+++ b/src/imaging/DeDistort.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -25,7 +25,7 @@
#include "../api.h"
#include "CoordTransformer.h"
-#include "../base/Point.h"
+#include "../base/GLMHelper.h"
#include "../base/Rect.h"
#include <boost/shared_ptr.hpp>
@@ -43,20 +43,21 @@ class TrackerConfig;
class AVG_API DeDistort: public CoordTransformer {
public:
DeDistort();
- DeDistort(const DPoint& camExtents, const DPoint& displayExtents);
- DeDistort(const DPoint& camExtents, const std::vector<double>& distortionParams,
- double angle, double trapezoidFactor, const DPoint& displayOffset,
- const DPoint& displayScale);
+ DeDistort(const glm::vec2& camExtents, const glm::vec2& displayExtents);
+ DeDistort(const glm::vec2& camExtents,
+ const std::vector<double>& distortionParams, double angle,
+ double trapezoidFactor, const glm::dvec2& displayOffset,
+ const glm::dvec2& displayScale);
virtual ~DeDistort();
- DPoint transformBlobToScreen(const DPoint& pt);
- DPoint transformScreenToBlob(const DPoint& pt);
- virtual DPoint transform_point(const DPoint& pt);
- virtual DPoint inverse_transform_point(const DPoint& pt);
- DRect getDisplayArea(const DPoint& displayExtents);
- DRect getActiveBlobArea(const DRect& displayROI);
+ glm::dvec2 transformBlobToScreen(const glm::dvec2& pt);
+ glm::dvec2 transformScreenToBlob(const glm::dvec2& pt);
+ virtual glm::dvec2 transform_point(const glm::dvec2& pt);
+ virtual glm::dvec2 inverse_transform_point(const glm::dvec2& pt);
+ FRect getDisplayArea(const glm::vec2& displayExtents);
+ FRect getActiveBlobArea(const FRect& displayROI);
- void load(const DPoint &CameraExtents, const TrackerConfig& config);
+ void load(const glm::vec2 &CameraExtents, const TrackerConfig& config);
void save(TrackerConfig& config);
bool operator ==(const DeDistort& other) const;
@@ -65,17 +66,18 @@ class AVG_API DeDistort: public CoordTransformer {
private:
double calc_rescale();
- DPoint inverse_undistort(const std::vector<double>& params, const DPoint& pt);
- DPoint undistort(const std::vector<double>& params, const DPoint& pt);
- DPoint trapezoid(const double trapezoid_factor, const DPoint& pt);
- DPoint inv_trapezoid(const double trapezoid_factor, const DPoint& pt);
+ glm::dvec2 inverse_undistort(const std::vector<double>& params,
+ const glm::dvec2& pt);
+ glm::dvec2 undistort(const std::vector<double>& params, const glm::dvec2& pt);
+ glm::dvec2 trapezoid(const double trapezoid_factor, const glm::dvec2& pt);
+ glm::dvec2 inv_trapezoid(const double trapezoid_factor, const glm::dvec2& pt);
- DPoint m_CamExtents;
+ glm::dvec2 m_CamExtents;
std::vector<double> m_DistortionParams;
double m_Angle;
double m_TrapezoidFactor;
- DPoint m_DisplayOffset;
- DPoint m_DisplayScale;
+ glm::dvec2 m_DisplayOffset;
+ glm::dvec2 m_DisplayScale;
double m_RescaleFactor;
};
diff --git a/src/imaging/FWCamera.cpp b/src/imaging/FWCamera.cpp
index d009b97..1fc62ff 100644
--- a/src/imaging/FWCamera.cpp
+++ b/src/imaging/FWCamera.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -37,16 +37,14 @@ namespace avg {
using namespace std;
-FWCamera::FWCamera(uint64_t guid, int unit, bool bFW800, IntPoint size,
- PixelFormat camPF, PixelFormat destPF, double frameRate)
- : Camera(camPF, destPF),
- m_Size(size),
- m_FrameRate(frameRate),
+FWCamera::FWCamera(unsigned long long guid, int unit, bool bFW800, IntPoint size,
+ PixelFormat camPF, PixelFormat destPF, float frameRate)
+ : Camera(camPF, destPF, size, frameRate),
m_WhitebalanceU(-1),
m_WhitebalanceV(-1)
{
#ifdef AVG_ENABLE_1394_2
- m_FrameRateConstant = getFrameRateConst(m_FrameRate);
+ m_FrameRateConstant = getFrameRateConst(getFrameRate());
if (camPF == I16) {
throw Exception(AVG_ERR_CAMERA_NONFATAL,
"I16 pixel format is not supported for firewire cameras.");
@@ -62,13 +60,12 @@ FWCamera::FWCamera(uint64_t guid, int unit, bool bFW800, IntPoint size,
int err = dc1394_camera_enumerate(m_pDC1394, &pCameraList);
if (err != DC1394_SUCCESS) {
- AVG_TRACE(Logger::ERROR, "Unable to look for cameras");
+ AVG_LOG_ERROR("Unable to look for cameras");
#ifdef linux
- AVG_TRACE(Logger::ERROR, "Please check");
- AVG_TRACE(Logger::ERROR,
- " - if the kernel modules `ieee1394',`raw1394' and `ohci1394' are loaded");
- AVG_TRACE(Logger::ERROR,
- " - if you have read/write access to /dev/raw1394.");
+ AVG_LOG_ERROR("Please check");
+ AVG_LOG_ERROR(" - if the kernel modules `ieee1394',`raw1394' and \
+ `ohci1394' are loaded");
+ AVG_LOG_ERROR(" - if you have read/write access to /dev/raw1394.");
#endif
dc1394_free(m_pDC1394);
throw Exception(AVG_ERR_CAMERA_NONFATAL,"Firewire failure");
@@ -87,7 +84,7 @@ FWCamera::FWCamera(uint64_t guid, int unit, bool bFW800, IntPoint size,
}
}
if (id_to_use == -1) {
- AVG_TRACE(Logger::WARNING, "Firewire GUID=" << hex << guid << dec
+ AVG_LOG_WARNING("Firewire GUID=" << hex << guid << dec
<< " requested but not found on bus. Using first camera");
id_to_use = 0;
}
@@ -129,14 +126,14 @@ FWCamera::FWCamera(uint64_t guid, int unit, bool bFW800, IntPoint size,
}
}
if (!bFrameRateSupported) {
- AVG_TRACE(Logger::ERROR, "Camera does not support framerate " << m_FrameRate
+ AVG_LOG_ERROR("Camera does not support framerate " << getFrameRate()
<< " in the current video mode.");
dc1394_capture_stop(m_pCamera);
dc1394_video_set_transmission(m_pCamera, DC1394_OFF);
dc1394_camera_free(m_pCamera);
dc1394_free(m_pDC1394);
throw Exception(AVG_ERR_CAMERA_NONFATAL,
- string("Camera does not support framerate ")+toString(m_FrameRate)+
+ string("Camera does not support framerate ")+toString(getFrameRate())+
" in the current video mode.");
}
@@ -145,10 +142,9 @@ FWCamera::FWCamera(uint64_t guid, int unit, bool bFW800, IntPoint size,
err = dc1394_capture_setup(m_pCamera,8, DC1394_CAPTURE_FLAGS_DEFAULT);
if (err != DC1394_SUCCESS) {
- AVG_TRACE(Logger::ERROR, "Unable to setup camera. Make sure that");
- AVG_TRACE(Logger::ERROR, "video mode and framerate (" <<
- m_FrameRate << ") are");
- AVG_TRACE(Logger::ERROR, "supported by your camera.");
+ AVG_LOG_ERROR("Unable to setup camera. Make sure that");
+ AVG_LOG_ERROR("video mode and framerate (" << getFrameRate() << ") are");
+ AVG_LOG_ERROR("supported by your camera.");
dc1394_capture_stop(m_pCamera);
dc1394_video_set_transmission(m_pCamera, DC1394_OFF);
dc1394_camera_free(m_pCamera);
@@ -168,7 +164,7 @@ FWCamera::~FWCamera()
dc1394_camera_free(m_pCamera);
dc1394_free(m_pDC1394);
#endif
- AVG_TRACE(Logger::CONFIG, "Firewire camera closed.");
+ AVG_TRACE(Logger::category::CONFIG, Logger::severity::INFO, "Firewire camera closed.");
}
void FWCamera::startCapture()
@@ -197,7 +193,7 @@ void FWCamera::startCapture()
DC1394_FEATURE_MODE_MANUAL);
dc1394_feature_set_power(m_pCamera, DC1394_FEATURE_EXPOSURE, DC1394_OFF);
- AVG_TRACE(Logger::CONFIG, "Firewire camera opened.");
+ AVG_TRACE(Logger::category::CONFIG, Logger::severity::INFO, "Firewire camera opened.");
for (FeatureMap::iterator it=m_Features.begin(); it != m_Features.end(); it++) {
setFeature(it->first, it->second, true);
}
@@ -205,11 +201,11 @@ void FWCamera::startCapture()
if (getCamPF() == BAYER8) {
if (strcmp(m_pCamera->model, "DFx 31BF03") == 0) {
- AVG_TRACE(Logger::CONFIG,
+ AVG_TRACE(Logger::category::CONFIG, Logger::severity::INFO,
"Applying bayer pattern fixup for IS DFx31BF03 camera");
setCamPF(BAYER8_GRBG);
} else if (strcmp(m_pCamera->vendor, "Point Grey Research") == 0) {
- AVG_TRACE(Logger::CONFIG,
+ AVG_TRACE(Logger::category::CONFIG, Logger::severity::INFO,
"Applying bayer pattern fixup for PointGrey cameras");
enablePtGreyBayer();
}
@@ -217,18 +213,6 @@ void FWCamera::startCapture()
#endif
}
-IntPoint FWCamera::getImgSize()
-{
-#ifdef AVG_ENABLE_1394_2
- return m_Size;
-#else
- return IntPoint(0, 0);
-#endif
-}
-
-
-static ProfilingZoneID CameraConvertProfilingZone("FW Camera format conversion");
-
BitmapPtr FWCamera::getImage(bool bWait)
{
#ifdef AVG_ENABLE_1394_2
@@ -248,12 +232,12 @@ BitmapPtr FWCamera::getImage(bool bWait)
if (bGotFrame) {
int lineLen;
if (getCamPF() == YCbCr411) {
- lineLen = m_Size.x*1.5;
+ lineLen = getImgSize().x*1.5;
} else {
- lineLen = m_Size.x*getBytesPerPixel(getCamPF());
+ lineLen = getImgSize().x*getBytesPerPixel(getCamPF());
}
- BitmapPtr pCamBmp(new Bitmap(m_Size, getCamPF(), pCaptureBuffer, lineLen, false,
- "TempCameraBmp"));
+ BitmapPtr pCamBmp(new Bitmap(getImgSize(), getCamPF(), pCaptureBuffer, lineLen,
+ false, "TempCameraBmp"));
BitmapPtr pDestBmp = convertCamFrameToDestPF(pCamBmp);
// cerr << "CamBmp: " << pCamBmp->getPixelFormat() << ", DestBmp: "
// << pDestBmp->getPixelFormat() << endl;
@@ -290,11 +274,6 @@ const std::string& FWCamera::getDriverName() const
return sDriverName;
}
-double FWCamera::getFrameRate() const
-{
- return m_FrameRate;
-}
-
int FWCamera::getFeature(CameraFeature feature) const
{
#ifdef AVG_ENABLE_1394_2
@@ -336,8 +315,7 @@ void FWCamera::setFeature(CameraFeature feature, int value, bool bIgnoreOldValue
try {
setStrobeDuration(value);
} catch (Exception& e) {
- AVG_TRACE(Logger::WARNING,
- string("Camera: Setting strobe duration failed. ") +
+ AVG_LOG_WARNING(string("Camera: Setting strobe duration failed. ") +
e.getStr());
}
} else {
@@ -357,7 +335,7 @@ void FWCamera::setFeatureOneShot(CameraFeature feature)
dc1394error_t err = dc1394_feature_set_mode(m_pCamera, featureID,
DC1394_FEATURE_MODE_ONE_PUSH_AUTO);
if (err != DC1394_SUCCESS) {
- AVG_TRACE(Logger::WARNING, "Camera: Unable to set one-shot for "
+ AVG_LOG_WARNING("Camera: Unable to set one-shot for "
<< cameraFeatureToString(feature) << ". Error was " << err);
}
#endif
@@ -396,8 +374,7 @@ void FWCamera::setWhitebalance(int u, int v, bool bIgnoreOldValue)
err = dc1394_feature_whitebalance_set_value(m_pCamera, u, v);
}
if (err != DC1394_SUCCESS) {
- AVG_TRACE(Logger::WARNING,
- "Camera: Unable to set whitebalance. Error was " << err);
+ AVG_LOG_WARNING("Camera: Unable to set whitebalance. Error was " << err);
}
}
}
@@ -417,8 +394,7 @@ void FWCamera::setFeature(dc1394feature_t feature, int value)
err = dc1394_feature_set_value(m_pCamera, feature, value);
}
if (err != DC1394_SUCCESS) {
- AVG_TRACE(Logger::WARNING, "Camera: Unable to set " << feature <<
- ". Error was " << err);
+ AVG_LOG_WARNING("Camera: Unable to set " << feature << ". Error was " << err);
}
/*
dc1394feature_info_t featureInfo;
@@ -450,16 +426,17 @@ void FWCamera::setStrobeDuration(int microsecs)
} else {
// Wierd calculations: IIDC register values for time are non-linear. Translate
// the method parameter in microseconds to appropriate register values.
- double targetMillisecs = microsecs/1000.;
- const double realTimes[] = {1,2,4,6,8,12,16,24,32,48,63.93};
+ float targetMillisecs = microsecs/1000.f;
+ const float realTimes[] = {1,2,4,6,8,12,16,24,32,48,63.93};
const uint32_t regValues[] =
{0x400, 0x600, 0x800, 0x900, 0xA00, 0xB00, 0xC00, 0xD00,
0xE00, 0xF00, 0xFFF};
int len = sizeof(regValues)/sizeof(*regValues);
AVG_ASSERT(len == sizeof(realTimes)/sizeof(*realTimes));
int i;
- for (i = 1; realTimes[i] < targetMillisecs; ++i);
- double ratio = (targetMillisecs-realTimes[i])/(realTimes[i-1]-realTimes[i]);
+ for (i = 1; realTimes[i] < targetMillisecs; ++i) {
+ }
+ float ratio = (targetMillisecs-realTimes[i])/(realTimes[i-1]-realTimes[i]);
durationRegValue = ratio*regValues[i-1]+(1-ratio)*regValues[i];
}
@@ -479,8 +456,7 @@ void FWCamera::getWhitebalance(int* pU, int* pV) const
dc1394error_t err = dc1394_feature_whitebalance_get_value(m_pCamera,
(uint32_t*)pU, (uint32_t*)pV);
if (err != DC1394_SUCCESS) {
- AVG_TRACE(Logger::WARNING,
- "Camera: Unable to get whitebalance setting. Error was " << err);
+ AVG_LOG_WARNING("Camera: Unable to get whitebalance setting. Error was " << err);
}
#endif
}
@@ -508,45 +484,164 @@ void FWCamera::enablePtGreyBayer()
#endif
}
-void FWCamera::dumpCameras()
+int FWCamera::countCameras()
{
#ifdef AVG_ENABLE_1394_2
dc1394_t* pDC1394 = dc1394_new();
if (pDC1394 == 0) {
- return;
+ return 0;
}
dc1394camera_list_t * pCameraList;
int err=dc1394_camera_enumerate(pDC1394, &pCameraList);
if (err == DC1394_SUCCESS) {
- if (pCameraList->num != 0) {
- cerr << "Firewire cameras: " << endl;
- for (unsigned i=0; i<pCameraList->num;++i) {
- dc1394camera_id_t id = pCameraList->ids[i];
- dc1394camera_t * pCamera = dc1394_camera_new_unit(pDC1394, id.guid,
- id.unit);
- if (pCamera) {
- dc1394_camera_print_info(pCamera, stderr);
- dumpCameraInfo(pCamera);
- dc1394_camera_free(pCamera);
- cerr << endl;
- }
- }
+ int numCameras = pCameraList->num;
+ return numCameras;
+ }
+#endif
+ return 0;
+}
+
+CameraInfo* FWCamera::getCameraInfos(int deviceNumber)
+{
+#ifdef AVG_ENABLE_1394_2
+ dc1394_t* pDC1394 = dc1394_new();
+ if (pDC1394 == 0) {
+ AVG_ASSERT(false);
+ return NULL;
+ }
+ dc1394camera_list_t * pCameraList;
+ int err=dc1394_camera_enumerate(pDC1394, &pCameraList);
+ if (err != DC1394_SUCCESS) {
+ AVG_ASSERT(false);
+ return NULL;
+ }
+ if (pCameraList->num != 0) {
+ dc1394camera_id_t id = pCameraList->ids[deviceNumber];
+ dc1394camera_t * pCamera = dc1394_camera_new_unit(pDC1394, id.guid,
+ id.unit);
+ if (pCamera) {
+ stringstream deviceID;
+ deviceID << hex << id.guid;//pCamera->guid;
+ CameraInfo* camInfo = new CameraInfo("Firewire", deviceID.str());
+
+ getCameraControls(pCamera, camInfo);
+ getCameraImageFormats(pCamera, camInfo);
+
+ dc1394_camera_free(pCamera);
+ dc1394_camera_free_list(pCameraList);
+ dc1394_free(pDC1394);
+ return camInfo;
}
- dc1394_camera_free_list(pCameraList);
}
- dc1394_free(pDC1394);
#endif
+ return NULL;
}
#ifdef AVG_ENABLE_1394_2
-void FWCamera::dumpCameraInfo(dc1394camera_t * pCamera)
+void FWCamera::getCameraImageFormats(dc1394camera_t* pCamera, CameraInfo* camInfo)
{
- dc1394error_t err;
- dc1394featureset_t FeatureSet;
- err = dc1394_feature_get_all(pCamera, &FeatureSet);
- AVG_ASSERT(err == DC1394_SUCCESS);
- // TODO: do this using AVG_TRACE
- dc1394_feature_print_all(&FeatureSet, stderr);
+ dc1394video_modes_t videoModes;
+ dc1394framerates_t framerates;
+ dc1394error_t err = dc1394_video_get_supported_modes(pCamera, &videoModes);
+ if (err != DC1394_SUCCESS) {
+ AVG_ASSERT(false);
+ return;
+ }
+ for (unsigned i = 0; i < videoModes.num; i++) {
+ //Covers only libavg supported formats, other capabilities are ignored
+ if (videoModes.modes[i] >= DC1394_VIDEO_MODE_320x240_YUV422
+ && videoModes.modes[i] <= DC1394_VIDEO_MODE_1600x1200_MONO16){
+ PixelFormat pixFormat = getPFFromVideoMode(videoModes.modes[i]);
+ IntPoint size = getFrameSizeFromVideoMode(videoModes.modes[i]);
+ FrameratesVector framerateList;
+ err = dc1394_video_get_supported_framerates(pCamera, videoModes.modes[i],
+ &framerates);
+ if (err != DC1394_SUCCESS) {
+ AVG_LOG_WARNING("Camera: No framerates. Error was: " << err);
+ } else {
+ for (unsigned j = 0; j < framerates.num; j++)
+ {
+ float rate = framerateToFloat(framerates.framerates[j]);
+ framerateList.push_back(rate);
+ }
+ }
+ CameraImageFormat format = CameraImageFormat(size,pixFormat,framerateList);
+ camInfo->addImageFormat(format);
+ }
+ }
+}
+
+void FWCamera::getCameraControls(dc1394camera_t* pCamera, CameraInfo* camInfo)
+{
+ dc1394featureset_t featureSet;
+ int err = dc1394_feature_get_all(pCamera, &featureSet);
+ if (err != DC1394_SUCCESS) {
+ AVG_ASSERT(false);
+ return;
+ }
+
+ for (int i = DC1394_FEATURE_MIN; i <= DC1394_FEATURE_MAX; i++) {
+ dc1394feature_info_t featureInfo = featureSet.feature[i - DC1394_FEATURE_MIN];
+
+ dc1394bool_t bool_t;
+ dc1394_feature_is_present(pCamera,featureInfo.id, &bool_t);
+ if (bool_t != DC1394_TRUE) {
+ continue;
+ }
+
+ uint32_t min = -1;
+ uint32_t max = -1;
+ uint32_t actValue = -1;
+
+ //TODO: 428 (TRIGGER) doesnt have min max
+ err = dc1394_feature_get_boundaries(pCamera, featureInfo.id, &min, &max);
+ if (err != DC1394_SUCCESS) {
+ continue;
+ }
+
+ switch(featureInfo.id) {
+ case DC1394_FEATURE_TEMPERATURE: {
+ uint32_t targetTemp = -1;
+ uint32_t currentTemp = -1;
+ err = dc1394_feature_temperature_get_value(pCamera,&targetTemp,&currentTemp);
+ if (err != DC1394_SUCCESS) {
+ continue;
+ }
+ actValue = currentTemp;
+ break;
+ }
+ //TODO: Think about a way to get this information into CameraInfo
+ case DC1394_FEATURE_WHITE_BALANCE: {
+ uint32_t ubValue = -1;
+ uint32_t vrValue = -1;
+ err = dc1394_feature_whitebalance_get_value(pCamera,&ubValue,&vrValue);
+ if (err != DC1394_SUCCESS) {
+ continue;
+ }
+ //actValue = ubValue; //vrValue;
+ //cout <<"UBlue Value: " << ubValue << " VRed Value: " << vrValue << endl;
+ break;
+ }
+ default: {
+ err = dc1394_feature_get_value(pCamera,featureInfo.id, &actValue);
+ if (err != DC1394_SUCCESS) {
+ continue;
+ }
+ break;
+ }
+ }
+ CameraFeature enumFeature = featureIDToEnum(featureInfo.id);
+ if (enumFeature == CAM_FEATURE_UNSUPPORTED) {
+ continue;
+ }
+ std::string controlName = cameraFeatureToString(enumFeature);
+
+ CameraControl control = CameraControl(controlName,
+ (int) min,
+ (int) max,
+ (int) actValue ); //TODO: isnt really a default value!?
+ camInfo->addControl(control);
+ }
}
#endif
diff --git a/src/imaging/FWCamera.h b/src/imaging/FWCamera.h
index a5af3ad..c7badc0 100644
--- a/src/imaging/FWCamera.h
+++ b/src/imaging/FWCamera.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -29,7 +29,7 @@
#include "../graphics/Bitmap.h"
#include "../graphics/Pixel24.h"
-#include "../base/Point.h"
+#include "../base/GLMHelper.h"
#ifdef AVG_ENABLE_1394_2
#include <dc1394/control.h>
@@ -38,9 +38,6 @@
#ifndef AVG_ENABLE_1394_2
typedef unsigned int dc1394feature_t;
#endif
-#ifndef uint64_t
-#define uint64_t unsigned long long
-#endif
#include <string>
#include <map>
@@ -49,17 +46,15 @@ namespace avg {
class AVG_API FWCamera: public Camera {
public:
- FWCamera(uint64_t guid, int unit, bool bFW800, IntPoint size, PixelFormat camPF,
- PixelFormat destPF, double frameRate);
+ FWCamera(unsigned long long guid, int unit, bool bFW800, IntPoint size,
+ PixelFormat camPF, PixelFormat destPF, float frameRate);
virtual ~FWCamera();
virtual void startCapture();
- virtual IntPoint getImgSize();
virtual BitmapPtr getImage(bool bWait);
virtual const std::string& getDevice() const;
virtual const std::string& getDriverName() const;
- virtual double getFrameRate() const;
virtual int getFeature(CameraFeature feature) const;
bool hasFeature(CameraFeature feature);
@@ -69,7 +64,8 @@ public:
virtual int getWhitebalanceV() const;
virtual void setWhitebalance(int u, int v, bool bIgnoreOldValue=false);
- static void dumpCameras();
+ static int countCameras();
+ static CameraInfo* getCameraInfos(int deviceNumber);
static void resetBus();
private:
@@ -78,15 +74,14 @@ private:
void getWhitebalance(int* pU, int* pV) const;
void enablePtGreyBayer();
- IntPoint m_Size;
- double m_FrameRate;
-
#ifdef AVG_ENABLE_1394_2
+ static void getCameraImageFormats(dc1394camera_t* pCamera, CameraInfo* camInfo);
+ static void getCameraControls(dc1394camera_t* pCamera, CameraInfo* camInfo);
+
dc1394_t * m_pDC1394;
dc1394camera_t * m_pCamera;
dc1394framerate_t m_FrameRateConstant;
- dc1394video_mode_t m_Mode;
- static void dumpCameraInfo(dc1394camera_t * pCamera);
+ dc1394video_mode_t m_Mode;
#endif
FeatureMap m_Features;
diff --git a/src/imaging/FWCameraUtils.cpp b/src/imaging/FWCameraUtils.cpp
index 5e5a8e1..e8f37b8 100644
--- a/src/imaging/FWCameraUtils.cpp
+++ b/src/imaging/FWCameraUtils.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -111,13 +111,13 @@ dc1394video_mode_t getCamMode(IntPoint size, PixelFormat pf)
"), "+getPixelFormatString(pf)+"\" for camera mode.");
}
-dc1394framerate_t getFrameRateConst(double frameRate)
+dc1394framerate_t getFrameRateConst(float frameRate)
{
- if (frameRate == 1.875) {
+ if (frameRate == 1.875f) {
return DC1394_FRAMERATE_1_875;
- } else if (frameRate == 3.75) {
+ } else if (frameRate == 3.75f) {
return DC1394_FRAMERATE_3_75;
- } else if (frameRate == 7.5) {
+ } else if (frameRate == 7.5f) {
return DC1394_FRAMERATE_7_5;
} else if (frameRate == 15) {
return DC1394_FRAMERATE_15;
@@ -134,6 +134,55 @@ dc1394framerate_t getFrameRateConst(double frameRate)
+toString(frameRate)+" for camera framerate.");
}
}
+CameraFeature featureIDToEnum(dc1394feature_t feature)
+{
+ switch (feature) {
+ case DC1394_FEATURE_BRIGHTNESS:
+ return CAM_FEATURE_BRIGHTNESS;
+ case DC1394_FEATURE_EXPOSURE:
+ return CAM_FEATURE_EXPOSURE;
+ case DC1394_FEATURE_SHARPNESS:
+ return CAM_FEATURE_SHARPNESS;
+ case DC1394_FEATURE_WHITE_BALANCE:
+ return CAM_FEATURE_WHITE_BALANCE;
+ case DC1394_FEATURE_HUE:
+ return CAM_FEATURE_HUE;
+ case DC1394_FEATURE_SATURATION:
+ return CAM_FEATURE_SATURATION;
+ case DC1394_FEATURE_GAMMA:
+ return CAM_FEATURE_GAMMA;
+ case DC1394_FEATURE_SHUTTER:
+ return CAM_FEATURE_SHUTTER;
+ case DC1394_FEATURE_GAIN:
+ return CAM_FEATURE_GAIN;
+ case DC1394_FEATURE_IRIS:
+ return CAM_FEATURE_IRIS;
+ case DC1394_FEATURE_FOCUS:
+ return CAM_FEATURE_FOCUS;
+ case DC1394_FEATURE_TEMPERATURE:
+ return CAM_FEATURE_TEMPERATURE;
+ case DC1394_FEATURE_TRIGGER:
+ return CAM_FEATURE_TRIGGER;
+ case DC1394_FEATURE_TRIGGER_DELAY:
+ return CAM_FEATURE_TRIGGER_DELAY;
+ case DC1394_FEATURE_WHITE_SHADING:
+ return CAM_FEATURE_WHITE_SHADING;
+ case DC1394_FEATURE_ZOOM:
+ return CAM_FEATURE_ZOOM;
+ case DC1394_FEATURE_PAN:
+ return CAM_FEATURE_PAN;
+ case DC1394_FEATURE_TILT:
+ return CAM_FEATURE_TILT;
+ case DC1394_FEATURE_OPTICAL_FILTER:
+ return CAM_FEATURE_OPTICAL_FILTER;
+ case DC1394_FEATURE_CAPTURE_SIZE:
+ return CAM_FEATURE_CAPTURE_SIZE;
+ case DC1394_FEATURE_CAPTURE_QUALITY:
+ return CAM_FEATURE_CAPTURE_QUALITY;
+ default:
+ return CAM_FEATURE_UNSUPPORTED;
+ }
+}
dc1394feature_t getFeatureID(CameraFeature feature)
{
@@ -164,6 +213,10 @@ dc1394feature_t getFeatureID(CameraFeature feature)
return DC1394_FEATURE_TEMPERATURE;
case CAM_FEATURE_TRIGGER:
return DC1394_FEATURE_TRIGGER;
+ case CAM_FEATURE_TRIGGER_DELAY:
+ return DC1394_FEATURE_TRIGGER_DELAY;
+ case CAM_FEATURE_WHITE_SHADING:
+ return DC1394_FEATURE_WHITE_SHADING;
case CAM_FEATURE_ZOOM:
return DC1394_FEATURE_ZOOM;
case CAM_FEATURE_PAN:
@@ -182,4 +235,132 @@ dc1394feature_t getFeatureID(CameraFeature feature)
}
}
+IntPoint getFrameSizeFromVideoMode(dc1394video_mode_t mode)
+{
+ IntPoint point = IntPoint();
+ point.x = -1;
+ point.y = -1;
+ switch (mode) {
+ case DC1394_VIDEO_MODE_160x120_YUV444: {
+ point.x = 160;
+ point.y = 120;
+ return point;
+ }
+ case DC1394_VIDEO_MODE_320x240_YUV422: {
+ point.x = 320;
+ point.y = 240;
+ return point;
+ }
+ case DC1394_VIDEO_MODE_640x480_YUV411:
+ case DC1394_VIDEO_MODE_640x480_YUV422:
+ case DC1394_VIDEO_MODE_640x480_RGB8:
+ case DC1394_VIDEO_MODE_640x480_MONO8:
+ case DC1394_VIDEO_MODE_640x480_MONO16: {
+ point.x = 640;
+ point.y = 480;
+ return point;
+ }
+ case DC1394_VIDEO_MODE_800x600_YUV422:
+ case DC1394_VIDEO_MODE_800x600_RGB8:
+ case DC1394_VIDEO_MODE_800x600_MONO8:
+ case DC1394_VIDEO_MODE_800x600_MONO16: {
+ point.x = 800;
+ point.y = 600;
+ return point;
+ }
+ case DC1394_VIDEO_MODE_1024x768_YUV422:
+ case DC1394_VIDEO_MODE_1024x768_RGB8:
+ case DC1394_VIDEO_MODE_1024x768_MONO8:
+ case DC1394_VIDEO_MODE_1024x768_MONO16: {
+ point.x = 1024;
+ point.y = 768;
+ return point;
+ }
+
+
+ case DC1394_VIDEO_MODE_1280x960_YUV422:
+ case DC1394_VIDEO_MODE_1280x960_RGB8:
+ case DC1394_VIDEO_MODE_1280x960_MONO8:
+ case DC1394_VIDEO_MODE_1280x960_MONO16: {
+ point.x = 1280;
+ point.y = 960;
+ return point;
+ }
+ case DC1394_VIDEO_MODE_1600x1200_YUV422:
+ case DC1394_VIDEO_MODE_1600x1200_RGB8:
+ case DC1394_VIDEO_MODE_1600x1200_MONO8:
+ case DC1394_VIDEO_MODE_1600x1200_MONO16: {
+ point.x = 1600;
+ point.y = 1200;
+ return point;
+ }
+ default:
+ AVG_ASSERT(false);
+ return point;
+ }
+}
+
+PixelFormat getPFFromVideoMode(dc1394video_mode_t mode)
+{
+ switch (mode) {
+ case DC1394_VIDEO_MODE_640x480_YUV411:
+ return YCbCr411;
+ case DC1394_VIDEO_MODE_320x240_YUV422:
+ case DC1394_VIDEO_MODE_640x480_YUV422:
+ case DC1394_VIDEO_MODE_800x600_YUV422:
+ case DC1394_VIDEO_MODE_1024x768_YUV422:
+ case DC1394_VIDEO_MODE_1280x960_YUV422:
+ case DC1394_VIDEO_MODE_1600x1200_YUV422:
+ return YCbCr422;
+ case DC1394_VIDEO_MODE_640x480_RGB8:
+ case DC1394_VIDEO_MODE_800x600_RGB8:
+ case DC1394_VIDEO_MODE_1024x768_RGB8:
+ case DC1394_VIDEO_MODE_1280x960_RGB8:
+ case DC1394_VIDEO_MODE_1600x1200_RGB8:
+ return R8G8B8;
+ case DC1394_VIDEO_MODE_640x480_MONO8:
+ case DC1394_VIDEO_MODE_800x600_MONO8:
+ case DC1394_VIDEO_MODE_1024x768_MONO8:
+ case DC1394_VIDEO_MODE_1280x960_MONO8:
+ case DC1394_VIDEO_MODE_1600x1200_MONO8:
+ return I8;
+ case DC1394_VIDEO_MODE_640x480_MONO16:
+ case DC1394_VIDEO_MODE_800x600_MONO16:
+ case DC1394_VIDEO_MODE_1024x768_MONO16:
+ case DC1394_VIDEO_MODE_1280x960_MONO16:
+ case DC1394_VIDEO_MODE_1600x1200_MONO16:
+ return I16;
+ default:
+ AVG_ASSERT(false);
+ return PixelFormat(0);
+ }
+}
+
+float framerateToFloat(dc1394framerate_t framerate)
+{
+ switch (framerate) {
+ case DC1394_FRAMERATE_1_875:
+ return 1.875;
+ case DC1394_FRAMERATE_3_75:
+ return 3.75;
+ case DC1394_FRAMERATE_7_5:
+ return 7.5;
+ case DC1394_FRAMERATE_15:
+ return 15;
+ case DC1394_FRAMERATE_30:
+ return 30;
+ case DC1394_FRAMERATE_60:
+ return 60;
+ case DC1394_FRAMERATE_120:
+ return 120;
+ case DC1394_FRAMERATE_240:
+ return 240;
+ default:{
+ AVG_ASSERT(false);
+ return -1;
+ }
+ }
+}
+
+
}
diff --git a/src/imaging/FWCameraUtils.h b/src/imaging/FWCameraUtils.h
index 634838d..668f5bb 100644
--- a/src/imaging/FWCameraUtils.h
+++ b/src/imaging/FWCameraUtils.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -27,7 +27,7 @@
#include "../avgconfigwrapper.h"
-#include "../base/Point.h"
+#include "../base/GLMHelper.h"
#include <dc1394/control.h>
@@ -36,8 +36,12 @@
namespace avg {
dc1394video_mode_t getCamMode(IntPoint size, PixelFormat pf);
-dc1394framerate_t getFrameRateConst(double frameRate);
+dc1394framerate_t getFrameRateConst(float frameRate);
+CameraFeature featureIDToEnum(dc1394feature_t feature);
dc1394feature_t getFeatureID(CameraFeature feature);
+IntPoint getFrameSizeFromVideoMode(dc1394video_mode_t mode);
+PixelFormat getPFFromVideoMode(dc1394video_mode_t mode);
+float framerateToFloat(dc1394framerate_t framerate);
}
diff --git a/src/imaging/FakeCamera.cpp b/src/imaging/FakeCamera.cpp
index ae966f5..ffb1cb3 100644
--- a/src/imaging/FakeCamera.cpp
+++ b/src/imaging/FakeCamera.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -25,6 +25,7 @@
#include "../graphics/Filterfill.h"
#include "../graphics/Filterfillrect.h"
#include "../graphics/Filtergrayscale.h"
+#include "../graphics/BitmapLoader.h"
#include "../base/TimeSource.h"
#include "../base/Exception.h"
@@ -36,27 +37,25 @@ using namespace std;
namespace avg {
FakeCamera::FakeCamera(PixelFormat camPF, PixelFormat destPF)
- : Camera(camPF, destPF),
+ : Camera(camPF, destPF, IntPoint(640, 480), 60),
m_pBmpQ(new std::queue<BitmapPtr>()),
m_bIsOpen(false)
{
- m_ImgSize = IntPoint(640, 480);
}
FakeCamera::FakeCamera(std::vector<std::string>& pictures)
- : Camera(I8, I8),
+ : Camera(I8, I8, IntPoint(640,480), 60),
m_pBmpQ(new std::queue<BitmapPtr>()),
m_bIsOpen(false)
{
- m_ImgSize = IntPoint(640, 480);
for (vector<string>::iterator it = pictures.begin(); it != pictures.end(); ++it) {
try {
- BitmapPtr pBmp (new Bitmap(*it));
+ BitmapPtr pBmp = loadBitmap(*it);
FilterGrayscale().applyInPlace(pBmp);
- m_ImgSize = pBmp->getSize();
+ setImgSize(pBmp->getSize());
m_pBmpQ->push(pBmp);
} catch (Exception& ex) {
- AVG_TRACE(Logger::ERROR, ex.getStr());
+ AVG_LOG_ERROR(ex.getStr());
throw;
}
}
@@ -77,11 +76,6 @@ void FakeCamera::close()
}
-IntPoint FakeCamera::getImgSize()
-{
- return m_ImgSize;
-}
-
BitmapPtr FakeCamera::getImage(bool bWait)
{
if (bWait) {
@@ -114,11 +108,6 @@ const std::string& FakeCamera::getDriverName() const
return sDriverName;
}
-double FakeCamera::getFrameRate() const
-{
- return 60;
-}
-
const string& FakeCamera::getMode() const
{
static string sMode = "FakeCamera";
diff --git a/src/imaging/FakeCamera.h b/src/imaging/FakeCamera.h
index 7f444cc..4128043 100644
--- a/src/imaging/FakeCamera.h
+++ b/src/imaging/FakeCamera.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -43,13 +43,11 @@ public:
virtual void open();
virtual void close();
- virtual IntPoint getImgSize();
virtual BitmapPtr getImage(bool bWait);
virtual bool isCameraAvailable();
virtual const std::string& getDevice() const;
virtual const std::string& getDriverName() const;
- virtual double getFrameRate() const;
virtual const std::string& getMode() const;
virtual int getFeature(CameraFeature feature) const;
@@ -60,7 +58,6 @@ public:
virtual void setWhitebalance(int u, int v, bool bIgnoreOldValue=false);
private:
- IntPoint m_ImgSize;
BitmapQueuePtr m_pBmpQ;
bool m_bIsOpen;
};
diff --git a/src/imaging/FilterClearBorder.cpp b/src/imaging/FilterClearBorder.cpp
index 549a7bc..dba7c8b 100644
--- a/src/imaging/FilterClearBorder.cpp
+++ b/src/imaging/FilterClearBorder.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/imaging/FilterClearBorder.h b/src/imaging/FilterClearBorder.h
index 869d784..80c700b 100644
--- a/src/imaging/FilterClearBorder.h
+++ b/src/imaging/FilterClearBorder.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -27,7 +27,7 @@
#include "../graphics/Filter.h"
-#include "../base/Point.h"
+#include "../base/GLMHelper.h"
#include "../base/Rect.h"
#include <boost/shared_ptr.hpp>
diff --git a/src/imaging/FilterDistortion.cpp b/src/imaging/FilterDistortion.cpp
index 441dcd3..08b55bb 100644
--- a/src/imaging/FilterDistortion.cpp
+++ b/src/imaging/FilterDistortion.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -41,7 +41,7 @@ FilterDistortion::FilterDistortion(const IntPoint& srcSize,
m_pMap = new IntPoint[m_SrcSize.y*m_SrcSize.x];
for (int y = 0; y < m_SrcSize.y; ++y) {
for (int x = 0; x < m_SrcSize.x; ++x) {
- DPoint tmp = m_pTransformer->inverse_transform_point(DPoint(int(x),int(y)));
+ glm::dvec2 tmp = m_pTransformer->inverse_transform_point(glm::dvec2(x,y));
IntPoint tmp2(int(tmp.x+0.5),int(tmp.y+0.5));
if (tmp2.x < m_SrcSize.x && tmp2.y < m_SrcSize.y &&
tmp2.x >= 0 && tmp2.y >= 0)
diff --git a/src/imaging/FilterDistortion.h b/src/imaging/FilterDistortion.h
index a050796..25de14e 100644
--- a/src/imaging/FilterDistortion.h
+++ b/src/imaging/FilterDistortion.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -29,7 +29,7 @@
#include "../graphics/Filter.h"
-#include "../base/Point.h"
+#include "../base/GLMHelper.h"
#include "../base/Rect.h"
#include <boost/shared_ptr.hpp>
diff --git a/src/imaging/FilterWipeBorder.cpp b/src/imaging/FilterWipeBorder.cpp
index cfdef40..dd09068 100644
--- a/src/imaging/FilterWipeBorder.cpp
+++ b/src/imaging/FilterWipeBorder.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/imaging/FilterWipeBorder.h b/src/imaging/FilterWipeBorder.h
index 91a0505..7804560 100644
--- a/src/imaging/FilterWipeBorder.h
+++ b/src/imaging/FilterWipeBorder.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -27,7 +27,6 @@
#include "../graphics/Filter.h"
-#include "../base/Point.h"
#include "../base/Rect.h"
#include <boost/shared_ptr.hpp>
diff --git a/src/imaging/Makefile.am b/src/imaging/Makefile.am
index 41b5f61..93d1562 100644
--- a/src/imaging/Makefile.am
+++ b/src/imaging/Makefile.am
@@ -1,4 +1,4 @@
-INCLUDES = -I.. @PTHREAD_CFLAGS@ @XML2_CFLAGS@
+AM_CPPFLAGS = -I.. @PTHREAD_CFLAGS@ @XML2_CFLAGS@ @GDK_PIXBUF_CFLAGS@
if ENABLE_V4L2
V4L2_SOURCES = V4LCamera.cpp
@@ -12,7 +12,6 @@ if ENABLE_1394_2
DC1394_SOURCES = FWCameraUtils.cpp
DC1394_INCLUDES = FWCameraUtils.h
else
-
DC1394_SOURCES =
DC1394_INCLUDES =
endif
@@ -20,13 +19,13 @@ endif
ALL_H = Camera.h TrackerThread.h TrackerConfig.h Blob.h FWCamera.h Run.h \
FakeCamera.h CoordTransformer.h FilterDistortion.h $(DC1394_INCLUDES) \
DeDistort.h trackerconfigdtd.h FilterWipeBorder.h FilterClearBorder.h \
- $(V4L2_INCLUDES)
+ $(V4L2_INCLUDES) CameraInfo.h
ALL_CPP = Camera.cpp TrackerThread.cpp TrackerConfig.cpp Blob.cpp FWCamera.cpp Run.cpp \
FakeCamera.cpp CoordTransformer.cpp FilterDistortion.cpp $(DC1394_SOURCES) \
DeDistort.cpp trackerconfigdtd.cpp FilterWipeBorder.cpp FilterClearBorder.cpp \
- $(V4L2_SOURCES)
+ $(V4L2_SOURCES) CameraInfo.cpp
-TESTS=testimaging
+TESTS = testimaging
EXTRA_DIST = avgtrackerrc.minimal $(wildcard baseline/*.png) $(wildcard testfiles/*.png) \
CMUCamera.h CMUCamera.cpp DSCamera.cpp DSCamera.h DSHelper.h DSHelper.cpp \
@@ -34,12 +33,9 @@ EXTRA_DIST = avgtrackerrc.minimal $(wildcard baseline/*.png) $(wildcard testfile
noinst_LTLIBRARIES = libimaging.la
libimaging_la_SOURCES = $(ALL_CPP) $(ALL_H)
-noinst_PROGRAMS=testimaging checktracking
-testimaging_SOURCES=testimaging.cpp $(ALL_H)
+noinst_PROGRAMS = testimaging
+testimaging_SOURCES = testimaging.cpp $(ALL_H)
testimaging_LDADD = ./libimaging.la ../graphics/libgraphics.la ../base/libbase.la \
- @XML2_LIBS@ -l@BOOST_THREAD_LIB@ -lboost_system @PTHREAD_LIBS@ @GDK_PIXBUF_LIBS@
-
-checktracking_SOURCES=checktracking.cpp $(ALL_H)
-checktracking_LDADD = ./libimaging.la ../graphics/libgraphics.la ../base/libbase.la \
- @XML2_LIBS@ -l@BOOST_THREAD_LIB@ -lboost_system @PTHREAD_LIBS@ @GDK_PIXBUF_LIBS@
+ ../base/triangulate/libtriangulate.la \
+ @XML2_LIBS@ @BOOST_THREAD_LIBS@ @PTHREAD_LIBS@ @GDK_PIXBUF_LIBS@
diff --git a/src/imaging/Makefile.in b/src/imaging/Makefile.in
index 3f65abd..8ee4fe5 100644
--- a/src/imaging/Makefile.in
+++ b/src/imaging/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# Makefile.in generated by automake 1.11.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
-# Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -37,18 +37,19 @@ build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
TESTS = testimaging$(EXEEXT)
-noinst_PROGRAMS = testimaging$(EXEEXT) checktracking$(EXEEXT)
+noinst_PROGRAMS = testimaging$(EXEEXT)
subdir = src/imaging
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ac_cxx_namespaces.m4 \
$(top_srcdir)/m4/ac_path_generic.m4 \
$(top_srcdir)/m4/ax_boost_thread.m4 \
- $(top_srcdir)/m4/ax_check_gl.m4 $(top_srcdir)/m4/libtool.m4 \
- $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
- $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
- $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/m4/python_dev.m4 \
- $(top_srcdir)/configure.in
+ $(top_srcdir)/m4/ax_check_gl.m4 \
+ $(top_srcdir)/m4/ax_python_devel.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/pkg.m4 \
+ $(top_srcdir)/m4/avg_version.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
@@ -61,44 +62,37 @@ am__libimaging_la_SOURCES_DIST = Camera.cpp TrackerThread.cpp \
TrackerConfig.cpp Blob.cpp FWCamera.cpp Run.cpp FakeCamera.cpp \
CoordTransformer.cpp FilterDistortion.cpp FWCameraUtils.cpp \
DeDistort.cpp trackerconfigdtd.cpp FilterWipeBorder.cpp \
- FilterClearBorder.cpp V4LCamera.cpp Camera.h TrackerThread.h \
- TrackerConfig.h Blob.h FWCamera.h Run.h FakeCamera.h \
- CoordTransformer.h FilterDistortion.h FWCameraUtils.h \
- DeDistort.h trackerconfigdtd.h FilterWipeBorder.h \
- FilterClearBorder.h V4LCamera.h
+ FilterClearBorder.cpp V4LCamera.cpp CameraInfo.cpp Camera.h \
+ TrackerThread.h TrackerConfig.h Blob.h FWCamera.h Run.h \
+ FakeCamera.h CoordTransformer.h FilterDistortion.h \
+ FWCameraUtils.h DeDistort.h trackerconfigdtd.h \
+ FilterWipeBorder.h FilterClearBorder.h V4LCamera.h \
+ CameraInfo.h
@ENABLE_1394_2_TRUE@am__objects_1 = FWCameraUtils.lo
@ENABLE_V4L2_TRUE@am__objects_2 = V4LCamera.lo
am__objects_3 = Camera.lo TrackerThread.lo TrackerConfig.lo Blob.lo \
FWCamera.lo Run.lo FakeCamera.lo CoordTransformer.lo \
FilterDistortion.lo $(am__objects_1) DeDistort.lo \
trackerconfigdtd.lo FilterWipeBorder.lo FilterClearBorder.lo \
- $(am__objects_2)
+ $(am__objects_2) CameraInfo.lo
am__objects_4 =
am__objects_5 = $(am__objects_4) $(am__objects_4)
am_libimaging_la_OBJECTS = $(am__objects_3) $(am__objects_5)
libimaging_la_OBJECTS = $(am_libimaging_la_OBJECTS)
-AM_V_lt = $(am__v_lt_$(V))
-am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
am__v_lt_0 = --silent
PROGRAMS = $(noinst_PROGRAMS)
-am__checktracking_SOURCES_DIST = checktracking.cpp Camera.h \
- TrackerThread.h TrackerConfig.h Blob.h FWCamera.h Run.h \
- FakeCamera.h CoordTransformer.h FilterDistortion.h \
- FWCameraUtils.h DeDistort.h trackerconfigdtd.h \
- FilterWipeBorder.h FilterClearBorder.h V4LCamera.h
-am_checktracking_OBJECTS = checktracking.$(OBJEXT) $(am__objects_5)
-checktracking_OBJECTS = $(am_checktracking_OBJECTS)
-checktracking_DEPENDENCIES = ./libimaging.la \
- ../graphics/libgraphics.la ../base/libbase.la
am__testimaging_SOURCES_DIST = testimaging.cpp Camera.h \
TrackerThread.h TrackerConfig.h Blob.h FWCamera.h Run.h \
FakeCamera.h CoordTransformer.h FilterDistortion.h \
FWCameraUtils.h DeDistort.h trackerconfigdtd.h \
- FilterWipeBorder.h FilterClearBorder.h V4LCamera.h
+ FilterWipeBorder.h FilterClearBorder.h V4LCamera.h \
+ CameraInfo.h
am_testimaging_OBJECTS = testimaging.$(OBJEXT) $(am__objects_5)
testimaging_OBJECTS = $(am_testimaging_OBJECTS)
testimaging_DEPENDENCIES = ./libimaging.la ../graphics/libgraphics.la \
- ../base/libbase.la
+ ../base/libbase.la ../base/triangulate/libtriangulate.la
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@@ -109,18 +103,18 @@ LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CXXFLAGS) $(CXXFLAGS)
-AM_V_CXX = $(am__v_CXX_$(V))
-am__v_CXX_ = $(am__v_CXX_$(AM_DEFAULT_VERBOSITY))
+AM_V_CXX = $(am__v_CXX_@AM_V@)
+am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@)
am__v_CXX_0 = @echo " CXX " $@;
-AM_V_at = $(am__v_at_$(V))
-am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
CXXLD = $(CXX)
CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
$(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
-AM_V_CXXLD = $(am__v_CXXLD_$(V))
-am__v_CXXLD_ = $(am__v_CXXLD_$(AM_DEFAULT_VERBOSITY))
+AM_V_CXXLD = $(am__v_CXXLD_@AM_V@)
+am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@)
am__v_CXXLD_0 = @echo " CXXLD " $@;
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@@ -128,23 +122,21 @@ LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
-AM_V_CC = $(am__v_CC_$(V))
-am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
+AM_V_CC = $(am__v_CC_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
am__v_CC_0 = @echo " CC " $@;
CCLD = $(CC)
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
-AM_V_CCLD = $(am__v_CCLD_$(V))
-am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
-AM_V_GEN = $(am__v_GEN_$(V))
-am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
-SOURCES = $(libimaging_la_SOURCES) $(checktracking_SOURCES) \
- $(testimaging_SOURCES)
+SOURCES = $(libimaging_la_SOURCES) $(testimaging_SOURCES)
DIST_SOURCES = $(am__libimaging_la_SOURCES_DIST) \
- $(am__checktracking_SOURCES_DIST) \
$(am__testimaging_SOURCES_DIST)
ETAGS = etags
CTAGS = ctags
@@ -160,7 +152,7 @@ AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BOOST_PYTHON_LIBS = @BOOST_PYTHON_LIBS@
-BOOST_THREAD_LIB = @BOOST_THREAD_LIB@
+BOOST_THREAD_LIBS = @BOOST_THREAD_LIBS@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
@@ -175,6 +167,7 @@ DC1394_2_CFLAGS = @DC1394_2_CFLAGS@
DC1394_2_LIBS = @DC1394_2_LIBS@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
@@ -215,6 +208,7 @@ LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
MTDEV_CFLAGS = @MTDEV_CFLAGS@
MTDEV_LIBS = @MTDEV_LIBS@
@@ -244,11 +238,13 @@ PTHREAD_CC = @PTHREAD_CC@
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
PTHREAD_LIBS = @PTHREAD_LIBS@
PYTHON = @PYTHON@
+PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@
PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
-PYTHON_INCLUDES = @PYTHON_INCLUDES@
-PYTHON_LIBS = @PYTHON_LIBS@
+PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@
+PYTHON_LDFLAGS = @PYTHON_LDFLAGS@
PYTHON_PLATFORM = @PYTHON_PLATFORM@
PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_SITE_PKG = @PYTHON_SITE_PKG@
PYTHON_VERSION = @PYTHON_VERSION@
RANLIB = @RANLIB@
SDL_CFLAGS = @SDL_CFLAGS@
@@ -271,6 +267,7 @@ abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
@@ -305,7 +302,6 @@ libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
@@ -329,7 +325,7 @@ target_vendor = @target_vendor@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-INCLUDES = -I.. @PTHREAD_CFLAGS@ @XML2_CFLAGS@
+AM_CPPFLAGS = -I.. @PTHREAD_CFLAGS@ @XML2_CFLAGS@ @GDK_PIXBUF_CFLAGS@
@ENABLE_V4L2_FALSE@V4L2_SOURCES =
@ENABLE_V4L2_TRUE@V4L2_SOURCES = V4LCamera.cpp
@ENABLE_V4L2_FALSE@V4L2_INCLUDES =
@@ -341,12 +337,12 @@ INCLUDES = -I.. @PTHREAD_CFLAGS@ @XML2_CFLAGS@
ALL_H = Camera.h TrackerThread.h TrackerConfig.h Blob.h FWCamera.h Run.h \
FakeCamera.h CoordTransformer.h FilterDistortion.h $(DC1394_INCLUDES) \
DeDistort.h trackerconfigdtd.h FilterWipeBorder.h FilterClearBorder.h \
- $(V4L2_INCLUDES)
+ $(V4L2_INCLUDES) CameraInfo.h
ALL_CPP = Camera.cpp TrackerThread.cpp TrackerConfig.cpp Blob.cpp FWCamera.cpp Run.cpp \
FakeCamera.cpp CoordTransformer.cpp FilterDistortion.cpp $(DC1394_SOURCES) \
DeDistort.cpp trackerconfigdtd.cpp FilterWipeBorder.cpp FilterClearBorder.cpp \
- $(V4L2_SOURCES)
+ $(V4L2_SOURCES) CameraInfo.cpp
EXTRA_DIST = avgtrackerrc.minimal $(wildcard baseline/*.png) $(wildcard testfiles/*.png) \
CMUCamera.h CMUCamera.cpp DSCamera.cpp DSCamera.h DSHelper.h DSHelper.cpp \
@@ -356,11 +352,8 @@ noinst_LTLIBRARIES = libimaging.la
libimaging_la_SOURCES = $(ALL_CPP) $(ALL_H)
testimaging_SOURCES = testimaging.cpp $(ALL_H)
testimaging_LDADD = ./libimaging.la ../graphics/libgraphics.la ../base/libbase.la \
- @XML2_LIBS@ -l@BOOST_THREAD_LIB@ @PTHREAD_LIBS@ @GDK_PIXBUF_LIBS@
-
-checktracking_SOURCES = checktracking.cpp $(ALL_H)
-checktracking_LDADD = ./libimaging.la ../graphics/libgraphics.la ../base/libbase.la \
- @XML2_LIBS@ -l@BOOST_THREAD_LIB@ @PTHREAD_LIBS@ @GDK_PIXBUF_LIBS@
+ ../base/triangulate/libtriangulate.la \
+ @XML2_LIBS@ @BOOST_THREAD_LIBS@ @PTHREAD_LIBS@ @GDK_PIXBUF_LIBS@
all: all-am
@@ -405,7 +398,7 @@ clean-noinstLTLIBRARIES:
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
-libimaging.la: $(libimaging_la_OBJECTS) $(libimaging_la_DEPENDENCIES)
+libimaging.la: $(libimaging_la_OBJECTS) $(libimaging_la_DEPENDENCIES) $(EXTRA_libimaging_la_DEPENDENCIES)
$(AM_V_CXXLD)$(CXXLINK) $(libimaging_la_OBJECTS) $(libimaging_la_LIBADD) $(LIBS)
clean-noinstPROGRAMS:
@@ -416,10 +409,7 @@ clean-noinstPROGRAMS:
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
echo " rm -f" $$list; \
rm -f $$list
-checktracking$(EXEEXT): $(checktracking_OBJECTS) $(checktracking_DEPENDENCIES)
- @rm -f checktracking$(EXEEXT)
- $(AM_V_CXXLD)$(CXXLINK) $(checktracking_OBJECTS) $(checktracking_LDADD) $(LIBS)
-testimaging$(EXEEXT): $(testimaging_OBJECTS) $(testimaging_DEPENDENCIES)
+testimaging$(EXEEXT): $(testimaging_OBJECTS) $(testimaging_DEPENDENCIES) $(EXTRA_testimaging_DEPENDENCIES)
@rm -f testimaging$(EXEEXT)
$(AM_V_CXXLD)$(CXXLINK) $(testimaging_OBJECTS) $(testimaging_LDADD) $(LIBS)
@@ -431,6 +421,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Blob.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Camera.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CameraInfo.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoordTransformer.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DeDistort.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FWCamera.Plo@am__quote@
@@ -443,33 +434,29 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TrackerConfig.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TrackerThread.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/V4LCamera.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/checktracking.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testimaging.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/trackerconfigdtd.Plo@am__quote@
.cpp.o:
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $<
.cpp.obj:
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
.cpp.lo:
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
-@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
@@ -610,14 +597,15 @@ check-TESTS: $(TESTS)
fi; \
dashes=`echo "$$dashes" | sed s/./=/g`; \
if test "$$failed" -eq 0; then \
- echo "$$grn$$dashes"; \
+ col="$$grn"; \
else \
- echo "$$red$$dashes"; \
+ col="$$red"; \
fi; \
- echo "$$banner"; \
- test -z "$$skipped" || echo "$$skipped"; \
- test -z "$$report" || echo "$$report"; \
- echo "$$dashes$$std"; \
+ echo "$${col}$$dashes$${std}"; \
+ echo "$${col}$$banner$${std}"; \
+ test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \
+ test -z "$$report" || echo "$${col}$$report$${std}"; \
+ echo "$${col}$$dashes$${std}"; \
test "$$failed" -eq 0; \
else :; fi
@@ -666,10 +654,15 @@ install-am: all-am
installcheck: installcheck-am
install-strip:
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- `test -z '$(STRIP)' || \
- echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
mostlyclean-generic:
clean-generic:
diff --git a/src/imaging/Run.cpp b/src/imaging/Run.cpp
index e965338..37cc97d 100644
--- a/src/imaging/Run.cpp
+++ b/src/imaging/Run.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -30,7 +30,7 @@ Run::Run(int row, int startCol, int endCol)
m_Row = row;
m_StartCol = startCol;
m_EndCol = endCol;
- m_Center = DPoint((m_StartCol + m_EndCol-1)/2., m_Row);
+ m_Center = glm::vec2((m_StartCol + m_EndCol-1)/2., m_Row);
}
}
diff --git a/src/imaging/Run.h b/src/imaging/Run.h
index d751490..f3375f2 100644
--- a/src/imaging/Run.h
+++ b/src/imaging/Run.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -25,7 +25,7 @@
#define _Run_H_
#include "../api.h"
-#include "../base/Point.h"
+#include "../base/GLMHelper.h"
#include <boost/weak_ptr.hpp>
@@ -42,7 +42,7 @@ struct Run
int m_Row;
int m_StartCol;
int m_EndCol;
- DPoint m_Center;
+ glm::vec2 m_Center;
int length() {
return m_EndCol-m_StartCol;
};
diff --git a/src/imaging/TrackerConfig.cpp b/src/imaging/TrackerConfig.cpp
index 1e86f8e..be4c758 100644
--- a/src/imaging/TrackerConfig.cpp
+++ b/src/imaging/TrackerConfig.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -70,15 +70,17 @@ void TrackerConfig::loadConfigFile(const string& sFilename)
string sDTDFName = "trackerconfig.dtd";
dtd = xmlParseDTD(NULL, (const xmlChar*) sDTDFName.c_str());
if (!dtd) {
- AVG_TRACE(Logger::WARNING,
- "DTD not found at " << sDTDFName
+ AVG_LOG_WARNING("DTD not found at " << sDTDFName
<< ". Not validating trackerconfig files.");
}
- m_Doc = xmlParseFile(sFilename.c_str());
+ // xmlParseFile crashes for some reason under Lion.
+ string sFileContents;
+ readWholeFile(sFilename, sFileContents);
+ m_Doc = xmlParseMemory(sFileContents.c_str(), sFileContents.length());
if (!m_Doc) {
- AVG_TRACE(Logger::ERROR, "Could not open tracker config file "
- << sFilename << ". Using defaults which will probably not work.");
+ AVG_LOG_ERROR("Could not open tracker config file " << sFilename <<
+ ". Using defaults which will probably not work.");
return;
}
@@ -95,7 +97,8 @@ void TrackerConfig::loadConfigFile(const string& sFilename)
xmlFreeDtd(dtd);
m_sFilename = sFilename;
- AVG_TRACE(Logger::CONFIG, "Reading Tracker config file from " << sFilename);
+ AVG_TRACE(Logger::category::CONFIG, Logger::severity::INFO,
+ "Reading Tracker config file from " << sFilename);
}
void TrackerConfig::load()
@@ -117,13 +120,13 @@ xmlXPathObjectPtr TrackerConfig::findConfigNodes(const string& sXPathExpr) const
xpCtx = xmlXPathNewContext(m_Doc);
if(!xpCtx) {
- AVG_TRACE(Logger::ERROR, "Unable to create new XPath context");
+ AVG_LOG_ERROR("Unable to create new XPath context");
return NULL;
}
xpElement = xmlXPathEvalExpression(BAD_CAST sFullPath.c_str(), xpCtx);
if(!xpElement) {
- AVG_TRACE(Logger::ERROR, "Unable to evaluate XPath expression '"
+ AVG_LOG_ERROR("Unable to evaluate XPath expression '"
<< sFullPath << "'");
xmlXPathFreeContext(xpCtx);
return NULL;
@@ -163,7 +166,7 @@ string TrackerConfig::getParam(const string& sXPathExpr) const
throw (Exception(AVG_ERR_OPTION_UNKNOWN,
string("getParam(): cannot find requested element ")+sXPathExpr));
} else if (nodes->nodeNr > 1) {
- AVG_TRACE(Logger::WARNING,
+ AVG_LOG_WARNING(
"getParam(): expression selects more than one node. Returning the first.");
}
@@ -186,23 +189,23 @@ int TrackerConfig::getIntParam(const std::string& sXPathExpr) const
return stringToInt(getParam(sXPathExpr));
}
-double TrackerConfig::getDoubleParam(const std::string& sXPathExpr) const
+float TrackerConfig::getFloatParam(const std::string& sXPathExpr) const
{
- return stringToDouble(getParam(sXPathExpr));
+ return stringToFloat(getParam(sXPathExpr));
}
-DPoint TrackerConfig::getPointParam(const std::string& sXPathExpr) const
+glm::vec2 TrackerConfig::getPointParam(const std::string& sXPathExpr) const
{
- return DPoint(getDoubleParam(sXPathExpr+"@x"), getDoubleParam(sXPathExpr+"@y"));
+ return glm::vec2(getFloatParam(sXPathExpr+"@x"), getFloatParam(sXPathExpr+"@y"));
}
-DRect TrackerConfig::getRectParam(const std::string& sXPathExpr) const
+FRect TrackerConfig::getRectParam(const std::string& sXPathExpr) const
{
- DPoint pos1 = DPoint(getDoubleParam(sXPathExpr+"@x1"),
- getDoubleParam(sXPathExpr+"@y1"));
- DPoint pos2 = DPoint(getDoubleParam(sXPathExpr+"@x2"),
- getDoubleParam(sXPathExpr+"@y2"));
- return DRect(pos1, pos2);
+ glm::vec2 pos1 = glm::vec2(getFloatParam(sXPathExpr+"@x1"),
+ getFloatParam(sXPathExpr+"@y1"));
+ glm::vec2 pos2 = glm::vec2(getFloatParam(sXPathExpr+"@x2"),
+ getFloatParam(sXPathExpr+"@y2"));
+ return FRect(pos1, pos2);
}
xmlNodePtr TrackerConfig::getXmlNode(const std::string& sXPathExpr) const
@@ -214,7 +217,7 @@ xmlNodePtr TrackerConfig::getXmlNode(const std::string& sXPathExpr) const
throw (Exception(AVG_ERR_OPTION_UNKNOWN,
string("getParam(): cannot find requested element ")+sXPathExpr));
} else if (nodes->nodeNr > 1) {
- AVG_TRACE(Logger::WARNING,
+ AVG_LOG_WARNING(
"getXmlNode(): expression selects more than one node. Returning the first.");
}
return nodes->nodeTab[0];
@@ -222,7 +225,7 @@ xmlNodePtr TrackerConfig::getXmlNode(const std::string& sXPathExpr) const
DeDistortPtr TrackerConfig::getTransform() const
{
- DPoint CameraExtents = getPointParam("/camera/size/");
+ glm::vec2 CameraExtents = getPointParam("/camera/size/");
DeDistortPtr pDD(new DeDistort);
pDD->load(CameraExtents, *this);
return pDD;
@@ -243,15 +246,15 @@ void TrackerConfig::dump() const
void TrackerConfig::save()
{
- AVG_TRACE(Logger::CONFIG, "Saving tracker configuration to "
- << m_sFilename << ".");
+ AVG_TRACE(Logger::category::CONFIG, Logger::severity::INFO,
+ "Saving tracker configuration to " << m_sFilename << ".");
if (m_Doc) {
if (fileExists(m_sFilename)) {
string sBakFile = m_sFilename + ".bak";
unlink(sBakFile.c_str());
if (rename(m_sFilename.c_str(), sBakFile.c_str())) {
- AVG_TRACE(Logger::WARNING, "Cannot create tracker config backup. Backing "
+ AVG_LOG_WARNING("Cannot create tracker config backup. Backing "
"it up on current workdir.");
copyFile(m_sFilename, "avgtrackerrc.bak");
}
diff --git a/src/imaging/TrackerConfig.h b/src/imaging/TrackerConfig.h
index 3eb10f7..557f78a 100644
--- a/src/imaging/TrackerConfig.h
+++ b/src/imaging/TrackerConfig.h
@@ -1,4 +1,7 @@
//
+// 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
@@ -47,9 +50,9 @@ public:
std::string getParam(const std::string& sXPathExpr) const;
bool getBoolParam(const std::string& sXPathExpr) const;
int getIntParam(const std::string& sXPathExpr) const;
- double getDoubleParam(const std::string& sXPathExpr) const;
- DPoint getPointParam(const std::string& sXPathExpr) const;
- DRect getRectParam(const std::string& sXPathExpr) const;
+ float getFloatParam(const std::string& sXPathExpr) const;
+ glm::vec2 getPointParam(const std::string& sXPathExpr) const;
+ FRect getRectParam(const std::string& sXPathExpr) const;
xmlNodePtr getXmlNode(const std::string& sXPathExpr) const;
DeDistortPtr getTransform() const;
diff --git a/src/imaging/TrackerThread.cpp b/src/imaging/TrackerThread.cpp
index 16c30e4..079a8d6 100644
--- a/src/imaging/TrackerThread.cpp
+++ b/src/imaging/TrackerThread.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -23,7 +23,7 @@
#include "FilterWipeBorder.h"
#include "../base/Logger.h"
-#include "../base/ProfilingZone.h"
+#include "../base/ProfilingZoneID.h"
#include "../base/TimeSource.h"
#include "../base/ScopeTimer.h"
#include "../base/Exception.h"
@@ -37,9 +37,10 @@
#include "../graphics/FilterBlur.h"
#include "../graphics/FilterGauss.h"
#include "../graphics/FilterMask.h"
-#include "../graphics/OGLImagingContext.h"
+#include "../graphics/GLContext.h"
#include "../graphics/GPUBandpassFilter.h"
#include "../graphics/GPUBlurFilter.h"
+#include "../graphics/BitmapLoader.h"
#include <iostream>
#include <stdlib.h>
@@ -102,12 +103,14 @@ TrackerThread::~TrackerThread()
bool TrackerThread::init()
{
try {
- m_pImagingContext = new OGLImagingContext();
+ m_pImagingContext = GLContext::create(
+ GLConfig(false, false, true, 1, GLConfig::AUTO, false));
createBandpassFilter();
- AVG_TRACE(Logger::CONFIG, "Using fragment shaders for imaging operations.");
+ AVG_TRACE(Logger::category::CONFIG, Logger::severity::INFO,
+ "Using fragment shaders for imaging operations.");
} catch (Exception& e) {
- AVG_TRACE(Logger::WARNING, e.getStr());
- AVG_TRACE(Logger::CONFIG,
+ AVG_LOG_WARNING(e.getStr());
+ AVG_TRACE(Logger::category::CONFIG, Logger::severity::WARNING,
"Using CPU for imaging operations (slow and inaccurate).");
m_pImagingContext = 0;
m_pBandpassFilter = FilterPtr(new FilterFastBandpass());
@@ -116,7 +119,7 @@ bool TrackerThread::init()
m_StartTime = TimeSource::get()->getCurrentMillisecs();
m_HistoryDelay = m_pConfig->getIntParam("/tracker/historydelay/@value");
} catch (Exception& e) {
- AVG_TRACE(Logger::WARNING, e.getStr());
+ AVG_LOG_WARNING(e.getStr());
}
// Done in TrackerInputDevice::ctor to work around Leopard/libdc1394 threading issue.
@@ -138,7 +141,7 @@ bool TrackerThread::work()
ScopeTimer timer(ProfilingZoneCapture);
pCamBmp = m_pCamera->getImage(true);
BitmapPtr pTempBmp1;
- while (pTempBmp1 = m_pCamera->getImage(false)) {
+ while ((pTempBmp1 = m_pCamera->getImage(false))) {
m_NumCamFramesDiscarded++;
m_NumFrames++;
pCamBmp = pTempBmp1;
@@ -153,7 +156,7 @@ bool TrackerThread::work()
FilterMask(m_pCameraMaskBmp).applyInPlace(pCamBmp);
}
if (m_bCreateDebugImages) {
- boost::mutex::scoped_lock lock(*m_pMutex);
+ lock_guard lock(*m_pMutex);
*(m_pBitmaps[TRACKER_IMG_CAMERA]) = *pCamBmp;
ScopeTimer timer(ProfilingZoneHistogram);
drawHistogram(m_pBitmaps[TRACKER_IMG_HISTOGRAM], pCamBmp);
@@ -171,7 +174,7 @@ bool TrackerThread::work()
}
BitmapPtr pCroppedBmp(new Bitmap(*pDistortedBmp, m_ROI));
if (m_bCreateDebugImages) {
- boost::mutex::scoped_lock lock(*m_pMutex);
+ lock_guard lock(*m_pMutex);
m_pBitmaps[TRACKER_IMG_DISTORTED]->copyPixels(*pCroppedBmp);
}
if (m_pHistoryPreProcessor) {
@@ -179,7 +182,7 @@ bool TrackerThread::work()
m_pHistoryPreProcessor->applyInPlace(pCroppedBmp);
}
if (m_bCreateDebugImages) {
- boost::mutex::scoped_lock lock(*m_pMutex);
+ lock_guard lock(*m_pMutex);
m_pBitmaps[TRACKER_IMG_NOHISTORY]->copyPixels(*pCroppedBmp);
FilterNormalize(2).applyInPlace(m_pBitmaps[TRACKER_IMG_NOHISTORY]);
}
@@ -191,7 +194,7 @@ bool TrackerThread::work()
pBmpBandpass = m_pBandpassFilter->apply(pCroppedBmp);
}
if (m_bCreateDebugImages) {
- boost::mutex::scoped_lock lock(*m_pMutex);
+ lock_guard lock(*m_pMutex);
*(m_pBitmaps[TRACKER_IMG_HIGHPASS]) = *pBmpBandpass;
}
}
@@ -205,8 +208,10 @@ bool TrackerThread::work()
void TrackerThread::deinit()
{
m_pCamera = CameraPtr();
- AVG_TRACE(Logger::PROFILE, "Total camera frames: " << m_NumFrames);
- AVG_TRACE(Logger::PROFILE, "Camera frames discarded: " << m_NumCamFramesDiscarded);
+ AVG_TRACE(Logger::category::PROFILE, Logger::severity::INFO,
+ "Total camera frames: " << m_NumFrames);
+ AVG_TRACE(Logger::category::PROFILE, Logger::severity::INFO,
+ "Camera frames discarded: " << m_NumCamFramesDiscarded);
if (m_pBandpassFilter) {
m_pBandpassFilter.reset();
}
@@ -218,7 +223,7 @@ void TrackerThread::deinit()
void TrackerThread::setConfig(TrackerConfig config, IntRect roi,
BitmapPtr ppBitmaps[NUM_TRACKER_IMAGES])
{
- boost::mutex::scoped_lock lock(*m_pMutex);
+ lock_guard lock(*m_pMutex);
try {
m_TouchThreshold = config.getIntParam("/tracker/touch/threshold/@value");
} catch (Exception&) {
@@ -272,10 +277,7 @@ void TrackerThread::setConfig(TrackerConfig config, IntRect roi,
if (sCameraMaskFName == "") {
m_pCameraMaskBmp = BitmapPtr();
} else {
- BitmapPtr pRGBXCameraMaskBmp = BitmapPtr(new Bitmap(sCameraMaskFName));
- m_pCameraMaskBmp = BitmapPtr(
- new Bitmap(pRGBXCameraMaskBmp->getSize(), I8));
- m_pCameraMaskBmp->copyPixels(*pRGBXCameraMaskBmp);
+ BitmapPtr pRGBXCameraMaskBmp = loadBitmap(sCameraMaskFName, I8);
}
}
m_pConfig = TrackerConfigPtr(new TrackerConfig(config));
@@ -309,10 +311,10 @@ void TrackerThread::setBitmaps(IntRect roi, BitmapPtr ppBitmaps[NUM_TRACKER_IMAG
void TrackerThread::createBandpassFilter()
{
if (m_TouchThreshold != 0) {
- double bandpassMin = m_pConfig->getDoubleParam("/tracker/touch/bandpass/@min");
- double bandpassMax = m_pConfig->getDoubleParam("/tracker/touch/bandpass/@max");
- double bandpassPostMult =
- m_pConfig->getDoubleParam("/tracker/touch/bandpasspostmult/@value");
+ float bandpassMin = m_pConfig->getFloatParam("/tracker/touch/bandpass/@min");
+ float bandpassMax = m_pConfig->getFloatParam("/tracker/touch/bandpass/@max");
+ float bandpassPostMult =
+ m_pConfig->getFloatParam("/tracker/touch/bandpasspostmult/@value");
if (m_pImagingContext) {
m_pBandpassFilter = FilterPtr(new GPUBandpassFilter(m_ROI.size(), I8,
bandpassMin, bandpassMax, bandpassPostMult, m_bTrackBrighter));
@@ -366,16 +368,16 @@ void TrackerThread::drawHistogram(BitmapPtr pDestBmp, BitmapPtr pSrcBmp)
}
}
-inline bool isInbetween(double x, double min, double max)
+inline bool isInbetween(float x, float min, float max)
{
return x >= min && x <= max;
}
bool TrackerThread::isRelevant(BlobPtr pBlob, int minArea, int maxArea,
- double minEccentricity, double maxEccentricity)
+ float minEccentricity, float maxEccentricity)
{
bool res;
- res = isInbetween(pBlob->getArea(), minArea, maxArea) &&
+ res = isInbetween(pBlob->getArea(), float(minArea), float(maxArea)) &&
isInbetween(pBlob->getEccentricity(), minEccentricity, maxEccentricity);
return res;
}
@@ -390,8 +392,10 @@ BlobVectorPtr TrackerThread::findRelevantBlobs(BlobVectorPtr pBlobs, bool bTouch
}
int minArea = m_pConfig->getIntParam(sConfigPrefix+"areabounds/@min");
int maxArea = m_pConfig->getIntParam(sConfigPrefix+"areabounds/@max");
- double minEccentricity = m_pConfig->getDoubleParam(sConfigPrefix+"eccentricitybounds/@min");
- double maxEccentricity = m_pConfig->getDoubleParam(sConfigPrefix+"eccentricitybounds/@max");
+ float minEccentricity = m_pConfig->getFloatParam(sConfigPrefix+
+ "eccentricitybounds/@min");
+ float maxEccentricity = m_pConfig->getFloatParam(sConfigPrefix+
+ "eccentricitybounds/@max");
BlobVectorPtr pRelevantBlobs(new BlobVector());
for(BlobVector::iterator it = pBlobs->begin(); it != pBlobs->end(); ++it) {
@@ -420,9 +424,9 @@ void TrackerThread::drawBlobs(BlobVectorPtr pBlobs, BitmapPtr pSrcBmp,
}
int minArea = m_pConfig->getIntParam(sConfigPrefix+"areabounds/@min");
int maxArea = m_pConfig->getIntParam(sConfigPrefix+"areabounds/@max");
- double minEccentricity = m_pConfig->getDoubleParam(
+ float minEccentricity = m_pConfig->getFloatParam(
sConfigPrefix+"eccentricitybounds/@min");
- double maxEccentricity = m_pConfig->getDoubleParam(
+ float maxEccentricity = m_pConfig->getFloatParam(
sConfigPrefix+"eccentricitybounds/@max");
// Get max. pixel value in Bitmap
@@ -466,9 +470,9 @@ void TrackerThread::calcContours(BlobVectorPtr pBlobs)
sConfigPrefix = "/tracker/track/";
int minArea = m_pConfig->getIntParam(sConfigPrefix+"areabounds/@min");
int maxArea = m_pConfig->getIntParam(sConfigPrefix+"areabounds/@max");
- double minEccentricity = m_pConfig->getDoubleParam(
+ float minEccentricity = m_pConfig->getFloatParam(
sConfigPrefix+"eccentricitybounds/@min");
- double maxEccentricity = m_pConfig->getDoubleParam(
+ float maxEccentricity = m_pConfig->getFloatParam(
sConfigPrefix+"eccentricitybounds/@max");
int ContourPrecision = m_pConfig->getIntParam("/tracker/contourprecision/@value");
@@ -510,7 +514,7 @@ void TrackerThread::calcBlobs(BitmapPtr pTrackBmp, BitmapPtr pTouchBmp, long lon
BlobVectorPtr pTouchComps;
{
ScopeTimer timer(ProfilingZoneComps);
- boost::mutex::scoped_lock lock(*m_pMutex);
+ lock_guard lock(*m_pMutex);
BitmapPtr pDestBmp;
if (m_bCreateFingerImage) {
Pixel32 Black(0x00, 0x00, 0x00, 0x00);
diff --git a/src/imaging/TrackerThread.h b/src/imaging/TrackerThread.h
index 5372828..27d91ff 100644
--- a/src/imaging/TrackerThread.h
+++ b/src/imaging/TrackerThread.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -54,7 +54,7 @@ typedef enum {
} TrackerImageID;
typedef boost::shared_ptr<boost::mutex> MutexPtr;
-class OGLImagingContext;
+class GLContext;
class AVG_API IBlobTarget {
public:
@@ -90,7 +90,7 @@ class AVG_API TrackerThread: public WorkerThread<TrackerThread>
void drawHistogram(BitmapPtr pDestBmp, BitmapPtr pSrcBmp);
void calcBlobs(BitmapPtr pTrackBmp, BitmapPtr pTouchBmp, long long time);
bool isRelevant(BlobPtr pBlob, int minArea, int maxArea,
- double minEccentricity, double maxEccentricity);
+ float minEccentricity, float maxEccentricity);
BlobVectorPtr findRelevantBlobs(BlobVectorPtr pBlobs, bool bTouch);
void drawBlobs(BlobVectorPtr pBlobs, BitmapPtr pSrcBmp, BitmapPtr pDestBmp,
int Offset, bool bTouch);
@@ -125,7 +125,7 @@ class AVG_API TrackerThread: public WorkerThread<TrackerThread>
int m_NumFrames;
int m_NumCamFramesDiscarded;
- OGLImagingContext* m_pImagingContext;
+ GLContext* m_pImagingContext;
FilterPtr m_pBandpassFilter;
};
diff --git a/src/imaging/V4LCamera.cpp b/src/imaging/V4LCamera.cpp
index 9452964..85d7d41 100644
--- a/src/imaging/V4LCamera.cpp
+++ b/src/imaging/V4LCamera.cpp
@@ -1,6 +1,6 @@
//
-// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -27,6 +27,7 @@
#include "../base/Logger.h"
#include "../base/Exception.h"
#include "../base/StringHelper.h"
+#include "../base/GLMHelper.h"
#include <sys/stat.h>
#include <sys/ioctl.h>
@@ -62,15 +63,14 @@ namespace {
}
}
+namespace avg {
-V4LCamera::V4LCamera(std::string sDevice, int channel, IntPoint size, PixelFormat camPF,
- PixelFormat destPF, double frameRate)
- : Camera(camPF, destPF),
+V4LCamera::V4LCamera(string sDevice, int channel, IntPoint size, PixelFormat camPF,
+ PixelFormat destPF, float frameRate)
+ : Camera(camPF, destPF, size, frameRate),
m_Fd(-1),
m_Channel(channel),
- m_sDevice(sDevice),
- m_ImgSize(size),
- m_FrameRate(frameRate)
+ m_sDevice(sDevice)
{
m_v4lPF = getV4LPF(camPF);
if (m_sDevice == "") {
@@ -87,27 +87,30 @@ V4LCamera::V4LCamera(std::string sDevice, int channel, IntPoint size, PixelForma
m_FeaturesNames[V4L2_CID_WHITENESS] = "whiteness";
m_FeaturesNames[V4L2_CID_GAMMA] = "gamma";
m_FeaturesNames[V4L2_CID_SATURATION] = "saturation";
-
- struct stat st;
+
+ struct stat st;
if (stat(m_sDevice.c_str(), &st) == -1) {
- fatalError(string("Unable to access v4l2 device '")+m_sDevice+"'." );
+ AVG_ASSERT_MSG(false, (string("Unable to access v4l2 device '" +
+ m_sDevice + "'.").c_str()));
}
if (!S_ISCHR (st.st_mode)) {
- fatalError(string("'")+m_sDevice+" is not a v4l2 device.");
+ AVG_ASSERT_MSG(false, (string("'" + m_sDevice +
+ " is not a v4l2 device.").c_str()));
}
m_Fd = ::open(m_sDevice.c_str(), O_RDWR /* required */ | O_NONBLOCK, 0);
if (m_Fd == -1) {
- fatalError(string("Unable to open v4l2 device '") + m_sDevice + "'.");
+ AVG_ASSERT_MSG(false, (string("Unable to open v4l2 device '" + m_sDevice
+ + "'.").c_str()));
}
-
+
initDevice();
- AVG_TRACE(Logger::CONFIG, "V4L2 Camera opened");
+ AVG_TRACE(Logger::category::CONFIG, Logger::severity::INFO, "V4L2 Camera opened");
}
-V4LCamera::~V4LCamera()
+V4LCamera::~V4LCamera()
{
close();
}
@@ -117,7 +120,7 @@ void V4LCamera::close()
enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
int rc = xioctl(m_Fd, VIDIOC_STREAMOFF, &type);
if (rc == -1) {
- AVG_TRACE(Logger::ERROR, "VIDIOC_STREAMOFF");
+ AVG_LOG_ERROR("VIDIOC_STREAMOFF");
}
vector<Buffer>::iterator it;
for (it = m_vBuffers.begin(); it != m_vBuffers.end(); ++it) {
@@ -127,21 +130,22 @@ void V4LCamera::close()
m_vBuffers.clear();
::close(m_Fd);
- AVG_TRACE(Logger::CONFIG, "V4L2 Camera closed");
+ AVG_TRACE(Logger::category::CONFIG, Logger::severity::INFO, "V4L2 Camera closed");
m_Fd = -1;
}
-IntPoint V4LCamera::getImgSize()
-{
- return m_ImgSize;
-}
-
int V4LCamera::getV4LPF(PixelFormat pf)
{
switch (pf) {
case I8:
return V4L2_PIX_FMT_GREY;
+ case BAYER8:
+ case BAYER8_BGGR:
+ case BAYER8_GBRG:
+ case BAYER8_GRBG:
+ case BAYER8_RGGB:
+ return V4L2_PIX_FMT_GREY;
case YCbCr411:
return V4L2_PIX_FMT_Y41P;
case YCbCr422:
@@ -154,7 +158,7 @@ int V4LCamera::getV4LPF(PixelFormat pf)
return V4L2_PIX_FMT_BGR24;
default:
throw Exception(AVG_ERR_INVALID_ARGS,
- "Unsupported or illegal value for camera pixel format '"
+ "Unsupported or illegal value for camera pixel format '"
+ getPixelFormatString(pf) + "'.");
}
}
@@ -163,37 +167,37 @@ BitmapPtr V4LCamera::getImage(bool bWait)
{
struct v4l2_buffer buf;
CLEAR(buf);
-
+
// wait for incoming data blocking, timeout 2s
if (bWait) {
fd_set fds;
struct timeval tv;
int rc;
-
+
FD_ZERO(&fds);
FD_SET(m_Fd, &fds);
-
+
/* Timeout. */
tv.tv_sec = 2;
tv.tv_usec = 0;
-
+
rc = select (m_Fd+1, &fds, NULL, NULL, &tv);
- // caught signal or something else
+ // caught signal or something else
if (rc == -1) {
- AVG_TRACE(Logger::WARNING, "V4L2: select failed.");
+ AVG_LOG_WARNING("V4L2: select failed.");
return BitmapPtr();
}
// timeout
if (rc == 0) {
- AVG_TRACE(Logger::WARNING, "V4L2: Timeout while waiting for image data");
+ AVG_LOG_WARNING("V4L2: Timeout while waiting for image data");
return BitmapPtr();
}
}
-
+
buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
buf.memory = V4L2_MEMORY_MMAP;
-
+
// dequeue filled buffer
if (xioctl (m_Fd, VIDIOC_DQBUF, &buf) == -1) {
if (errno == EAGAIN) {
@@ -203,31 +207,30 @@ BitmapPtr V4LCamera::getImage(bool bWait)
AVG_ASSERT(false);
}
}
-
+
unsigned char * pCaptureBuffer = (unsigned char*)m_vBuffers[buf.index].start;
-
- double lineLen;
+
+ float lineLen;
switch (getCamPF()) {
case YCbCr411:
- lineLen = m_ImgSize.x*1.5;
+ lineLen = getImgSize().x*1.5f;
break;
case YCbCr420p:
- lineLen = m_ImgSize.x;
+ lineLen = getImgSize().x;
break;
default:
- lineLen = m_ImgSize.x*getBytesPerPixel(getCamPF());
+ lineLen = getImgSize().x*getBytesPerPixel(getCamPF());
}
- BitmapPtr pCamBmp(new Bitmap(m_ImgSize, getCamPF(), pCaptureBuffer, lineLen,
+ BitmapPtr pCamBmp(new Bitmap(getImgSize(), getCamPF(), pCaptureBuffer, lineLen,
false, "TempCameraBmp"));
BitmapPtr pDestBmp = convertCamFrameToDestPF(pCamBmp);
// enqueues free buffer for mmap
if (-1 == xioctl (m_Fd, VIDIOC_QBUF, &buf)) {
- throw(Exception(AVG_ERR_CAMERA_FATAL,
- "V4L Camera: failed to enqueue image buffer."));
+ AVG_ASSERT_MSG(false, "V4L Camera: failed to enqueue image buffer.");
}
-
+
return pDestBmp;
}
@@ -236,28 +239,23 @@ bool V4LCamera::isCameraAvailable()
return m_bCameraAvailable;
}
-const std::string& V4LCamera::getDevice() const
+const string& V4LCamera::getDevice() const
{
return m_sDevice;
}
-const std::string& V4LCamera::getDriverName() const
+const string& V4LCamera::getDriverName() const
{
return m_sDriverName;
}
-double V4LCamera::getFrameRate() const
-{
- return m_FrameRate;
-}
-
-std::string V4LCamera::getFeatureName(V4LCID_t v4lFeature)
+string V4LCamera::getFeatureName(V4LCID_t v4lFeature)
{
- std::string sName = m_FeaturesNames[v4lFeature];
+ string sName = m_FeaturesNames[v4lFeature];
if (sName == "") {
sName = "UNKNOWN";
}
-
+
return sName;
}
@@ -277,21 +275,21 @@ V4LCID_t V4LCamera::getFeatureID(CameraFeature feature) const
} else if (feature == CAM_FEATURE_SATURATION) {
v4lFeature = V4L2_CID_SATURATION;
} else {
- AVG_TRACE(Logger::WARNING, "feature " << cameraFeatureToString(feature)
+ AVG_LOG_WARNING("feature " << cameraFeatureToString(feature)
<< " not supported for V4L2.");
return -1;
}
-
+
return v4lFeature;
}
bool V4LCamera::isFeatureSupported(V4LCID_t v4lFeature) const
{
struct v4l2_queryctrl queryCtrl;
-
+
CLEAR(queryCtrl);
queryCtrl.id = v4lFeature;
-
+
if (ioctl (m_Fd, VIDIOC_QUERYCTRL, &queryCtrl) == -1) {
if (errno != EINVAL) {
cerr << "Got " << strerror(errno) << endl;
@@ -310,9 +308,9 @@ bool V4LCamera::isFeatureSupported(V4LCID_t v4lFeature) const
int V4LCamera::getFeature(CameraFeature feature) const
{
V4LCID_t v4lFeature = getFeatureID(feature);
-
+
FeatureMap::const_iterator it = m_Features.find(v4lFeature);
-
+
if (it == m_Features.end()) {
return 0;
} else {
@@ -323,191 +321,191 @@ int V4LCamera::getFeature(CameraFeature feature) const
void V4LCamera::setFeature(V4LCID_t v4lFeature, int value)
{
if (!m_bCameraAvailable) {
- AVG_TRACE(Logger::WARNING, "setFeature() called before opening device: ignored");
+ AVG_LOG_WARNING("setFeature() called before opening device: ignored");
return;
}
if (!isFeatureSupported(v4lFeature)) {
- AVG_TRACE(Logger::WARNING, "Camera feature " << getFeatureName(v4lFeature) <<
+ AVG_LOG_WARNING("Camera feature " << getFeatureName(v4lFeature) <<
" is not supported by hardware");
return;
}
-
+
struct v4l2_control control;
-
+
CLEAR(control);
control.id = v4lFeature;
control.value = value;
-// AVG_TRACE(Logger::APP, "Setting feature " << getFeatureName(v4lFeature) <<
+// AVG_TRACE(Logger::category::APP, "Setting feature " << getFeatureName(v4lFeature) <<
// " to "<< value);
if (ioctl(m_Fd, VIDIOC_S_CTRL, &control) == -1) {
- AVG_TRACE(Logger::ERROR, "Cannot set feature " <<
- m_FeaturesNames[v4lFeature]);
+ AVG_LOG_ERROR("Cannot set feature " << m_FeaturesNames[v4lFeature]);
}
}
void V4LCamera::setFeatureOneShot(CameraFeature feature)
{
- AVG_TRACE(Logger::WARNING, "setFeatureOneShot is not supported by V4L cameras.");
+ AVG_LOG_WARNING("setFeatureOneShot is not supported by V4L cameras.");
}
int V4LCamera::getWhitebalanceU() const
{
- AVG_TRACE(Logger::WARNING, "getWhitebalance is not supported by V4L cameras.");
+ AVG_LOG_WARNING("getWhitebalance is not supported by V4L cameras.");
return 0;
}
int V4LCamera::getWhitebalanceV() const
{
- AVG_TRACE(Logger::WARNING, "getWhitebalance is not supported by V4L cameras.");
+ AVG_LOG_WARNING("getWhitebalance is not supported by V4L cameras.");
return 0;
}
void V4LCamera::setWhitebalance(int u, int v, bool bIgnoreOldValue)
{
- setFeature(V4L2_CID_RED_BALANCE, u);
- setFeature(V4L2_CID_BLUE_BALANCE, v);
+ setFeature(V4L2_CID_RED_BALANCE, u);
+ setFeature(V4L2_CID_BLUE_BALANCE, v);
}
-int dumpCameras_open(int j)
+int V4LCamera::checkCamera(int j)
{
stringstream minorDeviceNumber;
minorDeviceNumber << j;
string address = "/dev/video";
- string result = address + minorDeviceNumber.str();
+ string result = address + minorDeviceNumber.str();
int fd = ::open(result.c_str(), O_RDWR /* required */ | O_NONBLOCK, 0);
return fd;
}
-v4l2_capability dumpCameraCapabilities(int fd)
+v4l2_capability getCamCapabilities(int fd)
{
v4l2_capability capability;
memset(&capability, 0, sizeof(capability));
- int rc = ioctl(fd, VIDIOC_QUERYCAP, &capability);
- if (rc != -1) {
- cout << capability.card << ":" << endl;
- cout << " Driver: " << capability.driver << endl;
- cout << " Location: " << capability.bus_info;
- cout << endl << endl;
- }
+ ioctl(fd, VIDIOC_QUERYCAP, &capability);
return capability;
}
-void dumpSupportedImgFormats(int fd)
+PixelFormat V4LCamera::intToPixelFormat(unsigned int pixelformat)
+{
+ switch (pixelformat) {
+ case v4l2_fourcc('Y','U','Y','V'):
+ return YUYV422;
+ case v4l2_fourcc('U','Y','V','Y'):
+ return YCbCr422;
+ case v4l2_fourcc('G','R','E','Y'):
+ return I8;
+ case v4l2_fourcc('Y','1','6',' '):
+ return I16;
+ case v4l2_fourcc('R','G','B','3'):
+ return R8G8B8;
+ case v4l2_fourcc('B','G','R','3'):
+ return B8G8R8;
+ default:
+ return NO_PIXELFORMAT;
+ }
+}
+
+int V4LCamera::countCameras()
+{
+ int numberOfCameras = 0;
+ for (int j = 0; j < 256; j++) {
+ int fd = checkCamera(j);
+ if (fd != -1) {
+ numberOfCameras++;
+ }
+ }
+ return numberOfCameras;
+}
+
+CameraInfo* V4LCamera::getCameraInfos(int deviceNumber)
+{
+ int fd = checkCamera(deviceNumber);
+ if (fd == -1) {
+ AVG_ASSERT(false);
+ return NULL;
+ }
+ stringstream ss;
+ ss << "/dev/video" << deviceNumber;
+ CameraInfo* camInfo = new CameraInfo("video4linux", ss.str());
+ v4l2_capability capability = getCamCapabilities(fd);
+ if (capability.capabilities & V4L2_CAP_VIDEO_CAPTURE) {
+ getCameraImageFormats(fd, camInfo);
+ getCameraControls(fd, camInfo);
+ }
+ return camInfo;
+}
+
+void V4LCamera::getCameraImageFormats(int fd, CameraInfo* camInfo)
{
- cout << "Suported Image Formats:" << endl;
for (int i = 0;; i++) {
+// cerr << i << endl;
v4l2_fmtdesc fmtDesc;
memset(&fmtDesc, 0, sizeof(fmtDesc));
fmtDesc.index = i;
fmtDesc.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
int rc = ioctl(fd, VIDIOC_ENUM_FMT, &fmtDesc);
if (rc == -1) {
- break;
+ break;
}
v4l2_frmsizeenum frmSizeEnum;
memset(&frmSizeEnum, 0, sizeof (frmSizeEnum));
frmSizeEnum.index = 0;
frmSizeEnum.pixel_format = fmtDesc.pixelformat;
- bool bSupported = false;
while (ioctl(fd, VIDIOC_ENUM_FRAMESIZES, &frmSizeEnum) == 0) {
- string sAvgPixelformat;
- switch (fmtDesc.pixelformat) {
- case v4l2_fourcc('Y','U','Y','V'):
- sAvgPixelformat = "YUYV422";
- bSupported = true;
- break;
- case v4l2_fourcc('U','Y','V','Y'):
- sAvgPixelformat = "YUV422";
- bSupported = true;
- break;
- case v4l2_fourcc('G','R','E','Y'):
- sAvgPixelformat = "I8";
- bSupported = true;
- break;
- case v4l2_fourcc('Y','1','6',' '):
- sAvgPixelformat = "I16";
- bSupported = true;
- break;
- case v4l2_fourcc('R','G','B','3'):
- sAvgPixelformat = "RGB";
- bSupported = true;
- break;
- case v4l2_fourcc('B','G','R','3'):
- sAvgPixelformat = "BGR";
- bSupported = true;
- break;
- default:
- break;
- }
-
- if (bSupported) {
+/* fprintf(stdout, " pixelformat :%c%c%c%c\\n",
+ fmtDesc.pixelformat & 0xFF,
+ (fmtDesc.pixelformat >> 8) & 0xFF,
+ (fmtDesc.pixelformat >> 16) & 0xFF,
+ (fmtDesc.pixelformat >> 24) & 0xFF);
+*/
+ PixelFormat pixFormat = intToPixelFormat(fmtDesc.pixelformat);
+ if (pixFormat != NO_PIXELFORMAT) {
v4l2_frmivalenum frmIvalEnum;
- cout << " " << sAvgPixelformat << " ";
- cout << " (" << frmSizeEnum.discrete.width << ", ";
- cout << frmSizeEnum.discrete.height << ")";
- cout << " fps: ";
memset (&frmIvalEnum, 0, sizeof (frmIvalEnum));
- frmIvalEnum.index = 0;
- frmIvalEnum.pixel_format = frmSizeEnum.pixel_format;
- frmIvalEnum.width = frmSizeEnum.discrete.width;
+ frmIvalEnum.index = 0;
+ frmIvalEnum.pixel_format = frmSizeEnum.pixel_format;
+ frmIvalEnum.width = frmSizeEnum.discrete.width;
frmIvalEnum.height = frmSizeEnum.discrete.height;
+ IntPoint size;
+ size.x = frmSizeEnum.discrete.width;
+ size.y = frmSizeEnum.discrete.height;
+ std::vector<float> framerates;
while (ioctl(fd, VIDIOC_ENUM_FRAMEINTERVALS, &frmIvalEnum) == 0) {
- cout << frmIvalEnum.discrete.denominator << "/";
- frmIvalEnum.index++;
+ framerates.push_back(frmIvalEnum.discrete.denominator);
+ frmIvalEnum.index++;
}
- cout << endl;
+ CameraImageFormat camImFormat = CameraImageFormat(size, pixFormat,
+ framerates);
+ camInfo->addImageFormat(camImFormat);
}
frmSizeEnum.index++;
}
}
}
-void dumpCameraControls(int fd)
+void V4LCamera::getCameraControls(int fd, CameraInfo* camInfo)
{
- cout << endl << "Camera Controls:" << endl;
v4l2_queryctrl queryCtrl;
for (queryCtrl.id = V4L2_CID_BASE; queryCtrl.id < V4L2_CID_LASTP1; queryCtrl.id++) {
int rc = ioctl (fd, VIDIOC_QUERYCTRL, &queryCtrl);
- if (rc != -1) {
- if (queryCtrl.flags & V4L2_CTRL_FLAG_DISABLED) {
- continue;
- }
- cout << " " << queryCtrl.name << ":" << endl;
- cout << " Min: " << queryCtrl.minimum << " | ";
- cout << "Max: " << queryCtrl.maximum << " | ";
- cout << "Default: "<< queryCtrl.default_value << endl;
- } else {
- if (errno != EINVAL) {
- perror("VIDIOC_QUERYCTRL");
- exit(EXIT_FAILURE);
- }
+ if (rc == -1) {
+ continue;
}
- }
-}
-
-void V4LCamera::dumpCameras()
-{
- for(int j = 0; j < 256; j++){
- int fd = dumpCameras_open(j);
- if (fd != -1) {
- cout << "------------------------Video4linux Camera-------------------------";
- cout << endl;
- cout << "/dev/video" << j << " ";
- v4l2_capability capability = dumpCameraCapabilities(fd);
- if (capability.capabilities & V4L2_CAP_VIDEO_CAPTURE) {
- dumpSupportedImgFormats(fd);
- dumpCameraControls(fd);
- }
- cout << "-------------------------------------------------------------------";
- cout << endl;
+ if (queryCtrl.flags & V4L2_CTRL_FLAG_DISABLED) {
+ continue;
}
+ stringstream ss;
+ ss << queryCtrl.name;
+ std::string sControlName = ss.str();
+ int min = queryCtrl.minimum;
+ int max = queryCtrl.maximum;
+ int defaultValue = queryCtrl.default_value;
+ CameraControl camControl = CameraControl(sControlName, min, max, defaultValue);
+ camInfo->addControl(camControl);
}
}
-
void V4LCamera::setFeature(CameraFeature feature, int value, bool bIgnoreOldValue)
{
// ignore -1 coming from default unbiased cameranode parameters
@@ -518,8 +516,6 @@ void V4LCamera::setFeature(CameraFeature feature, int value, bool bIgnoreOldValu
V4LCID_t v4lFeature = getFeatureID(feature);
m_Features[v4lFeature] = value;
-// AVG_TRACE(Logger::WARNING,"Setting feature " << sFeature <<
-// " to " << value);
if (m_bCameraAvailable) {
setFeature(v4lFeature, value);
}
@@ -527,7 +523,7 @@ void V4LCamera::setFeature(CameraFeature feature, int value, bool bIgnoreOldValu
void V4LCamera::startCapture()
{
-// AVG_TRACE(Logger::APP, "Entering startCapture()...");
+// AVG_TRACE(Logger::category::APP, "Entering startCapture()...");
unsigned int i;
enum v4l2_buf_type type;
@@ -544,7 +540,7 @@ void V4LCamera::startCapture()
int err = xioctl(m_Fd, VIDIOC_QBUF, &buf);
AVG_ASSERT(err != -1);
}
-
+
type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
int err= xioctl (m_Fd, VIDIOC_STREAMON, &type);
AVG_ASSERT(err != -1);
@@ -552,8 +548,8 @@ void V4LCamera::startCapture()
void V4LCamera::initDevice()
{
-// AVG_TRACE(Logger::APP, "Entering initDevice()...");
-
+// AVG_TRACE(Logger::category::APP, "Entering initDevice()...");
+
struct v4l2_capability cap;
struct v4l2_cropcap CropCap;
struct v4l2_crop Crop;
@@ -562,17 +558,17 @@ void V4LCamera::initDevice()
if (xioctl(m_Fd, VIDIOC_QUERYCAP, &cap) == -1) {
close();
- fatalError(m_sDevice + " is not a valid V4L2 device.");
+ AVG_ASSERT_MSG(false, (m_sDevice + " is not a valid V4L2 device.").c_str());
}
if (!(cap.capabilities & V4L2_CAP_VIDEO_CAPTURE)) {
close();
- fatalError(m_sDevice + " does not support capturing");
+ AVG_ASSERT_MSG(false, (m_sDevice + " does not support capturing").c_str());
}
if (!(cap.capabilities & V4L2_CAP_STREAMING)) {
close();
- fatalError(m_sDevice + " does not support streaming i/os");
+ AVG_ASSERT_MSG(false, (m_sDevice + " does not support streaming i/os").c_str());
}
m_sDriverName = (const char *)cap.driver;
@@ -594,58 +590,65 @@ void V4LCamera::initDevice()
break;
}
}
- } else {
+ } else {
/* Errors ignored. */
}
CLEAR(fmt);
fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
- fmt.fmt.pix.width = m_ImgSize.x;
- fmt.fmt.pix.height = m_ImgSize.y;
+ fmt.fmt.pix.width = getImgSize().x;
+ fmt.fmt.pix.height = getImgSize().y;
fmt.fmt.pix.pixelformat = m_v4lPF;
fmt.fmt.pix.field = V4L2_FIELD_ANY;
int rc = xioctl(m_Fd, VIDIOC_S_FMT, &fmt);
- if (int(fmt.fmt.pix.width) != m_ImgSize.x || int(fmt.fmt.pix.height) != m_ImgSize.y
- || rc == -1)
+ if (int(fmt.fmt.pix.width) != getImgSize().x ||
+ int(fmt.fmt.pix.height) != getImgSize().y || rc == -1)
{
- throw(Exception(AVG_ERR_CAMERA_NONFATAL,
+ throw(Exception(AVG_ERR_CAMERA_NONFATAL,
string("Unable to set V4L camera image format: '")
+strerror(errno)
- +"'. Try using avg_showcamera.py --dump to find out what the device supports."));
+ +"'. Try using avg_showcamera.py --list to find out what the device supports."));
}
CLEAR(StreamParam);
-
StreamParam.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
- StreamParam.parm.capture.timeperframe.numerator = 1;
- StreamParam.parm.capture.timeperframe.denominator = (int) m_FrameRate;
- rc = xioctl(m_Fd, VIDIOC_S_PARM, &StreamParam);
- if (m_FrameRate != StreamParam.parm.capture.timeperframe.denominator || rc == -1) {
- throw(Exception(AVG_ERR_CAMERA_NONFATAL,
- string("Unable to set V4L camera framerate: '")
- +strerror(errno)
- +"'. Try using avg_showcamera.py --dump to find out what the device supports."));
+ rc = xioctl(m_Fd, VIDIOC_G_PARM, &StreamParam);
+
+ if(StreamParam.parm.capture.capability == V4L2_CAP_TIMEPERFRAME) {
+ CLEAR(StreamParam);
+
+ StreamParam.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+ StreamParam.parm.capture.timeperframe.numerator = 1;
+ StreamParam.parm.capture.timeperframe.denominator = (int)getFrameRate();
+ rc = xioctl(m_Fd, VIDIOC_S_PARM, &StreamParam);
+ if (getFrameRate() != StreamParam.parm.capture.timeperframe.denominator ||
+ rc == -1)
+ {
+ throw(Exception(AVG_ERR_CAMERA_NONFATAL,
+ string("Unable to set V4L camera framerate: '")
+ +strerror(errno)
+ +"'. Try using avg_showcamera.py --list to find out what the device supports."));
+ }
}
- m_FrameRate = (double)StreamParam.parm.capture.timeperframe.denominator / \
- (double)StreamParam.parm.capture.timeperframe.numerator;
- initMMap ();
-
+ initMMap();
+
// TODO: string channel instead of numeric
// select channel
if (xioctl(m_Fd, VIDIOC_S_INPUT, &m_Channel) == -1) {
close();
- fatalError(string("Cannot set MUX channel ")+toString(m_Channel));
+ AVG_ASSERT_MSG(false, (string("Cannot set MUX channel " +
+ toString(m_Channel))).c_str());
}
-
+
m_bCameraAvailable = true;
for (FeatureMap::iterator it=m_Features.begin(); it != m_Features.end(); it++) {
setFeature(it->first, it->second);
}
-
+
}
void V4LCamera::initMMap()
@@ -660,13 +663,14 @@ void V4LCamera::initMMap()
if (xioctl(m_Fd, VIDIOC_REQBUFS, &req) == -1) {
if (EINVAL == errno) {
close();
- fatalError(m_sDevice+" does not support memory mapping");
+ AVG_ASSERT_MSG(false, (m_sDevice +
+ " does not support memory mapping").c_str());
} else {
cerr << "errno: " << strerror(errno);
AVG_ASSERT(false);
}
}
-
+
if (req.count < 2) {
cerr << "Insufficient buffer memory on " << m_sDevice;
AVG_ASSERT(false);
@@ -689,7 +693,7 @@ void V4LCamera::initMMap()
}
tmp.length = buf.length;
-
+
tmp.start = mmap (NULL /* start anywhere */,
buf.length,
PROT_READ | PROT_WRITE /* required */,
@@ -699,10 +703,11 @@ void V4LCamera::initMMap()
if (MAP_FAILED == tmp.start) {
AVG_ASSERT(false);
}
-
+
m_vBuffers.push_back(tmp);
}
}
+}
diff --git a/src/imaging/V4LCamera.h b/src/imaging/V4LCamera.h
index 6a8ebaa..b779e8e 100644
--- a/src/imaging/V4LCamera.h
+++ b/src/imaging/V4LCamera.h
@@ -1,6 +1,6 @@
//
-// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -39,48 +39,42 @@ class AVG_API V4LCamera: public Camera {
void * start;
size_t length;
};
-
+
public:
V4LCamera(std::string sDevice, int channel, IntPoint size, PixelFormat camPF,
- PixelFormat destPF, double frameRate);
+ PixelFormat destPF, float frameRate);
virtual ~V4LCamera();
- virtual IntPoint getImgSize();
virtual BitmapPtr getImage(bool bWait);
virtual bool isCameraAvailable();
- virtual const std::string& getDevice() const;
- virtual const std::string& getDriverName() const;
- virtual double getFrameRate() const;
-
+ virtual const std::string& getDevice() const;
+ virtual const std::string& getDriverName() const;
+
virtual int getFeature(CameraFeature feature) const;
- virtual void setFeature(CameraFeature feature, int value,
+ virtual void setFeature(CameraFeature feature, int value,
bool bIgnoreOldValue=false);
virtual void setFeatureOneShot(CameraFeature feature);
virtual int getWhitebalanceU() const;
virtual int getWhitebalanceV() const;
virtual void setWhitebalance(int u, int v, bool bIgnoreOldValue=false);
-
- static void dumpCameras();
+
+ static CameraInfo* getCameraInfos(int deviceNumber);
+ static int countCameras();
private:
void initDevice();
void startCapture();
void initMMap();
virtual void close();
-
+
int getV4LPF(PixelFormat pf);
-
- int m_Fd;
- int m_Channel;
- std::string m_sDevice;
- std::string m_sDriverName;
- std::vector<Buffer> m_vBuffers;
- bool m_bCameraAvailable;
- int m_v4lPF;
- IntPoint m_ImgSize;
- double m_FrameRate;
-
+ static int checkCamera(int j);
+ static PixelFormat intToPixelFormat(unsigned int pixelformat);
+
+ static void getCameraImageFormats(int fd, CameraInfo* camInfo);
+ static void getCameraControls(int deviceNumber, CameraInfo* camInfo);
+
void setFeature(V4LCID_t v4lFeature, int value);
V4LCID_t getFeatureID(CameraFeature feature) const;
std::string getFeatureName(V4LCID_t v4lFeature);
@@ -88,9 +82,17 @@ private:
typedef std::map<V4LCID_t, unsigned int> FeatureMap;
typedef std::map<int, std::string> FeatureNamesMap;
FeatureMap m_Features;
- // TODO: Feature strings should really be handled by
+ // TODO: Feature strings should really be handled by
// Camera::cameraFeatureToString
- FeatureNamesMap m_FeaturesNames;
+ FeatureNamesMap m_FeaturesNames;
+
+ int m_Fd;
+ int m_Channel;
+ std::string m_sDevice;
+ std::string m_sDriverName;
+ std::vector<Buffer> m_vBuffers;
+ bool m_bCameraAvailable;
+ int m_v4lPF;
};
}
diff --git a/src/imaging/checktracking.cpp b/src/imaging/checktracking.cpp
deleted file mode 100644
index 86c3935..0000000
--- a/src/imaging/checktracking.cpp
+++ /dev/null
@@ -1,101 +0,0 @@
-//
-// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 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 "TrackerThread.h"
-#include "FWCamera.h"
-#include "FakeCamera.h"
-
-#include "../graphics/Filtergrayscale.h"
-#include "../graphics/FilterGauss.h"
-#include "../graphics/FilterHighpass.h"
-#include "../graphics/FilterBandpass.h"
-#include "../graphics/FilterFastBandpass.h"
-#include "../graphics/FilterBlur.h"
-
-#include <sstream>
-#include <iostream>
-#include <math.h>
-
-using namespace avg;
-using namespace std;
-
-class TestTracker: public IBlobTarget {
-
-public:
-
-TestTracker()
-{
- m_FrameNum = 0;
- std::vector<std::string> p = std::vector<std::string>();
- for (int i=1; i<4; ++i) {
- stringstream s;
- s << "camimages/img" << i << "_nohistory.png";
- p.push_back(s.str());
- }
- CameraPtr pCam = CameraPtr(new FakeCamera(p));
- for (int i=0; i<NUM_TRACKER_IMAGES; i++) {
- m_pBitmaps[i] = BitmapPtr(new Bitmap(pCam->getImgSize(), I8));
- }
- MutexPtr pMutex(new boost::mutex);
- TrackerConfig Config;
- Config.setParam("/tracker/touch/threshold/@value", "131");
- m_pCmdQ = TrackerThread::CQueuePtr(new TrackerThread::CQueue);
- IntRect ROI(0,0,pCam->getImgSize().x, pCam->getImgSize().y);
- boost::thread Thread(
- TrackerThread(ROI, pCam, m_pBitmaps, pMutex, *m_pCmdQ, this,
- false, Config));
- Thread.join();
-}
-
-virtual ~TestTracker()
-{
-}
-
-virtual void update(BlobVectorPtr pBlobs, BitmapPtr)
-{
- m_FrameNum++;
- cerr << "Frame " << m_FrameNum << endl;
- for (int i=0; i<NUM_TRACKER_IMAGES; i++) {
- stringstream s;
- s << "camimages/img" << m_FrameNum << "_" << i << ".png";
- m_pBitmaps[i]->save(s.str());
- }
-}
-
-private:
- int m_FrameNum;
- TrackerThread::CQueuePtr m_pCmdQ;
- BitmapPtr m_pBitmaps[NUM_TRACKER_IMAGES];
-
-};
-
-void testBlur()
-{
- BitmapPtr pBitmap(new Bitmap("camimages/img1_nohistory.png"));
- FilterGrayscale().applyInPlace(pBitmap);
- BitmapPtr pBmpBandpass = FilterFastBandpass().apply(pBitmap);
- pBmpBandpass->save("camimages/img1_bandpass_test.png");
-}
-
-int main(int argc, char **argv)
-{
-// TestTracker t;
- testBlur();
-}
diff --git a/src/imaging/testimaging.cpp b/src/imaging/testimaging.cpp
index 85f7b07..9877c12 100644
--- a/src/imaging/testimaging.cpp
+++ b/src/imaging/testimaging.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -28,7 +28,7 @@
#include "../graphics/GraphicsTest.h"
#include "../graphics/Filtergrayscale.h"
-#include "../graphics/FilterId.h"
+#include "../graphics/BitmapLoader.h"
#include "../base/TestSuite.h"
#include "../base/Exception.h"
@@ -41,9 +41,10 @@
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
-
#include <sstream>
+#include <glib-object.h>
+
using namespace avg;
using namespace std;
@@ -99,68 +100,71 @@ public:
vector<double> params;
params.push_back(0);
params.push_back(0);
- DeDistort IdentityDistort = DeDistort(DPoint(1,1),
- params, 0.0, 0.0,
- DPoint(0,0), DPoint(1,1));
- TEST(almostEqual(IdentityDistort.transform_point(DPoint(0,0)), DPoint(0,0)));
- TEST(almostEqual(IdentityDistort.transform_point(DPoint(1,2)), DPoint(1,2)));
- TEST(almostEqual(IdentityDistort.transformBlobToScreen(DPoint(0,0)),
- DPoint(0,0)));
- TEST(almostEqual(IdentityDistort.transformBlobToScreen(DPoint(1,2)),
- DPoint(1,2)));
- TEST(almostEqual(IdentityDistort.inverse_transform_point(DPoint(0,0)),
- DPoint(0,0)));
- TEST(almostEqual(IdentityDistort.inverse_transform_point(DPoint(1,2)),
- DPoint(1,2)));
- TEST(almostEqual(IdentityDistort.transformScreenToBlob(DPoint(0,0)),
- DPoint(0,0)));
- TEST(almostEqual(IdentityDistort.transformScreenToBlob(DPoint(1,2)),
- DPoint(1,2)));
- TEST(IdentityDistort.getDisplayArea(DPoint(1280,720)) == DRect(0,0,1280,720));
-
- DeDistort scaler = DeDistort(DPoint(1,1), params, 0, 0.0, DPoint(0,0),
- DPoint(2,2));
- TEST(almostEqual(scaler.transform_point(DPoint(0,0)), DPoint(0,0)));
- TEST(almostEqual(scaler.transformBlobToScreen(DPoint(1,2)), DPoint(2,4)));
- TEST(almostEqual(scaler.inverse_transform_point(DPoint(0,0)), DPoint(0,0)));
- TEST(almostEqual(scaler.transformScreenToBlob(DPoint(1,2)), DPoint(0.5,1)));
-
- DeDistort shifter = DeDistort(DPoint(1,1), params, 0, 0.0, DPoint(1,1),
- DPoint(1,1));
- TEST(almostEqual(shifter.transformBlobToScreen(DPoint(0,0)), DPoint(1,1)));
- TEST(almostEqual(shifter.transformBlobToScreen(DPoint(1,2)), DPoint(2,3)));
- TEST(almostEqual(shifter.transformScreenToBlob(DPoint(0,0)), DPoint(-1,-1)));
- TEST(almostEqual(shifter.transformScreenToBlob(DPoint(1,2)), DPoint(0,1)));
- TEST(shifter.getDisplayArea(DPoint(1,1)) == DRect(-1, -1, 0, 0));
+ DeDistort IdentityDistort = DeDistort(glm::vec2(1,1),
+ params, 0.0, 0.0, glm::dvec2(0,0), glm::dvec2(1,1));
+ TEST(almostEqual(IdentityDistort.transform_point(glm::dvec2(0,0)),
+ glm::dvec2(0,0)));
+ TEST(almostEqual(IdentityDistort.transform_point(glm::dvec2(1,2)),
+ glm::dvec2(1,2)));
+ TEST(almostEqual(IdentityDistort.transformBlobToScreen(glm::dvec2(0,0)),
+ glm::dvec2(0,0)));
+ TEST(almostEqual(IdentityDistort.transformBlobToScreen(glm::dvec2(1,2)),
+ glm::dvec2(1,2)));
+ TEST(almostEqual(IdentityDistort.inverse_transform_point(glm::dvec2(0,0)),
+ glm::dvec2(0,0)));
+ TEST(almostEqual(IdentityDistort.inverse_transform_point(glm::dvec2(1,2)),
+ glm::dvec2(1,2)));
+ TEST(almostEqual(IdentityDistort.transformScreenToBlob(glm::dvec2(0,0)),
+ glm::dvec2(0,0)));
+ TEST(almostEqual(IdentityDistort.transformScreenToBlob(glm::dvec2(1,2)),
+ glm::dvec2(1,2)));
+ TEST(IdentityDistort.getDisplayArea(glm::vec2(1280,720)) == FRect(0,0,1280,720));
+
+ DeDistort scaler = DeDistort(glm::vec2(1,1), params, 0, 0.0, glm::dvec2(0,0),
+ glm::dvec2(2,2));
+ TEST(almostEqual(scaler.transform_point(glm::dvec2(0,0)), glm::dvec2(0,0)));
+ TEST(almostEqual(scaler.transformBlobToScreen(glm::dvec2(1,2)), glm::dvec2(2,4)));
+ TEST(almostEqual(scaler.inverse_transform_point(glm::dvec2(0,0)), glm::dvec2(0,0)));
+ TEST(almostEqual(scaler.transformScreenToBlob(glm::dvec2(1,2)), glm::dvec2(0.5,1)));
+
+ DeDistort shifter = DeDistort(glm::vec2(1,1), params, 0, 0.0, glm::dvec2(1,1),
+ glm::dvec2(1,1));
+ TEST(almostEqual(shifter.transformBlobToScreen(glm::dvec2(0,0)), glm::dvec2(1,1)));
+ TEST(almostEqual(shifter.transformBlobToScreen(glm::dvec2(1,2)), glm::dvec2(2,3)));
+ TEST(almostEqual(shifter.transformScreenToBlob(glm::dvec2(0,0)),
+ glm::dvec2(-1,-1)));
+ TEST(almostEqual(shifter.transformScreenToBlob(glm::dvec2(1,2)), glm::dvec2(0,1)));
+ TEST(shifter.getDisplayArea(glm::vec2(1,1)) == FRect(-1, -1, 0, 0));
vector<double> cubed;
cubed.push_back(0);
cubed.push_back(1);
- DeDistort barreler = DeDistort(DPoint(1,1), cubed, 0, 0.0, DPoint(0,0),
- DPoint(1,1));
+ DeDistort barreler = DeDistort(glm::vec2(1,1), cubed, 0, 0.0, glm::dvec2(0,0),
+ glm::dvec2(1,1));
for (double xp = 0; xp < 10; xp++) {
for(double yp = 0; yp < 10; yp++) {
QUIET_TEST(almostEqual(barreler.inverse_transform_point(
- barreler.transform_point(DPoint(xp,yp))), DPoint(xp,yp)));
+ barreler.transform_point(glm::dvec2(xp,yp))), glm::dvec2(xp,yp)));
}
}
- TEST(almostEqual(barreler.transform_point(DPoint(1,1)), DPoint(1,1)));
+ TEST(almostEqual(barreler.transform_point(glm::dvec2(1,1)), glm::dvec2(1,1)));
- DeDistort rotator = DeDistort(DPoint(1,1), params, 0, M_PI/2, DPoint(0,0),
- DPoint(1,1));
+ DeDistort rotator = DeDistort(glm::vec2(1,1), params, 0, M_PI/2, glm::dvec2(0,0),
+ glm::dvec2(1,1));
for (double xp = 0; xp < 10; xp++) {
for(double yp = 0; yp < 10; yp++) {
QUIET_TEST(almostEqual(rotator.inverse_transform_point(
- rotator.transform_point(DPoint(xp,yp))), DPoint(xp,yp)));
+ rotator.transform_point(glm::dvec2(xp,yp))), glm::dvec2(xp,yp)));
}
}
- DeDistort shifterScaler = DeDistort(DPoint(1,1), params, 0, 0.0, DPoint(1,1),
- DPoint(2,2));
+ DeDistort shifterScaler = DeDistort(glm::vec2(1,1), params, 0, 0.0,
+ glm::dvec2(1,1), glm::dvec2(2,2));
for (double xp = 0; xp < 10; xp++) {
for(double yp = 0; yp < 10; yp++) {
QUIET_TEST(almostEqual(shifterScaler.inverse_transform_point(
- shifterScaler.transform_point(DPoint(xp,yp))), DPoint(xp,yp)));
+ shifterScaler.transform_point(glm::dvec2(xp,yp))),
+ glm::dvec2(xp,yp)));
}
}
}
@@ -197,8 +201,8 @@ public:
TrackerConfig loadedConfig;
loadedConfig.load();
- DPoint scale = loadedConfig.getPointParam("/transform/displayscale/");
- TEST(almostEqual(scale, DPoint(2,2)));
+ glm::vec2 scale = loadedConfig.getPointParam("/transform/displayscale/");
+ TEST(almostEqual(scale, glm::vec2(2,2)));
unlink("avgtrackerrc.bak");
}
unlink("avgtrackerrc");
@@ -222,6 +226,7 @@ public:
int main(int nargs, char** args)
{
ImagingTestSuite Suite;
+ BitmapLoader::init(true);
Suite.runTests();
bool bOK = Suite.isOk();
diff --git a/src/imaging/trackerconfigdtd.cpp b/src/imaging/trackerconfigdtd.cpp
index 2d12406..d4185de 100644
--- a/src/imaging/trackerconfigdtd.cpp
+++ b/src/imaging/trackerconfigdtd.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/imaging/trackerconfigdtd.h b/src/imaging/trackerconfigdtd.h
index 20293b2..366b8d4 100644
--- a/src/imaging/trackerconfigdtd.h
+++ b/src/imaging/trackerconfigdtd.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/lmfit/Makefile.am b/src/lmfit/Makefile.am
index 5a66da2..29a7361 100644
--- a/src/lmfit/Makefile.am
+++ b/src/lmfit/Makefile.am
@@ -1,8 +1,7 @@
+AM_CPPFLAGS = -I.
+CPPFLAGS = -DBUG
-INCLUDES = -I.
-CPPFLAGS=-DBUG
-ALL_H = lmmin.h lm_eval.h
+ALL_H = lmmin.h lm_eval.h
noinst_LTLIBRARIES = liblmfit.la
liblmfit_la_SOURCES = lmmin.c lm_eval.c $(ALL_H)
liblmfit_a_CXXFLAGS = -Wno-format-y2k
-
diff --git a/src/lmfit/Makefile.in b/src/lmfit/Makefile.in
index 111f999..ec11583 100644
--- a/src/lmfit/Makefile.in
+++ b/src/lmfit/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# Makefile.in generated by automake 1.11.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
-# Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -41,11 +41,12 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ac_cxx_namespaces.m4 \
$(top_srcdir)/m4/ac_path_generic.m4 \
$(top_srcdir)/m4/ax_boost_thread.m4 \
- $(top_srcdir)/m4/ax_check_gl.m4 $(top_srcdir)/m4/libtool.m4 \
- $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
- $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
- $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/m4/python_dev.m4 \
- $(top_srcdir)/configure.in
+ $(top_srcdir)/m4/ax_check_gl.m4 \
+ $(top_srcdir)/m4/ax_python_devel.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/pkg.m4 \
+ $(top_srcdir)/m4/avg_version.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
@@ -57,8 +58,8 @@ liblmfit_la_LIBADD =
am__objects_1 =
am_liblmfit_la_OBJECTS = lmmin.lo lm_eval.lo $(am__objects_1)
liblmfit_la_OBJECTS = $(am_liblmfit_la_OBJECTS)
-AM_V_lt = $(am__v_lt_$(V))
-am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
am__v_lt_0 = --silent
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src
depcomp = $(SHELL) $(top_srcdir)/depcomp
@@ -70,21 +71,21 @@ LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
-AM_V_CC = $(am__v_CC_$(V))
-am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
+AM_V_CC = $(am__v_CC_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
am__v_CC_0 = @echo " CC " $@;
-AM_V_at = $(am__v_at_$(V))
-am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
CCLD = $(CC)
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
-AM_V_CCLD = $(am__v_CCLD_$(V))
-am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
-AM_V_GEN = $(am__v_GEN_$(V))
-am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
SOURCES = $(liblmfit_la_SOURCES)
DIST_SOURCES = $(liblmfit_la_SOURCES)
@@ -100,7 +101,7 @@ AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BOOST_PYTHON_LIBS = @BOOST_PYTHON_LIBS@
-BOOST_THREAD_LIB = @BOOST_THREAD_LIB@
+BOOST_THREAD_LIBS = @BOOST_THREAD_LIBS@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
@@ -115,6 +116,7 @@ DC1394_2_CFLAGS = @DC1394_2_CFLAGS@
DC1394_2_LIBS = @DC1394_2_LIBS@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
@@ -155,6 +157,7 @@ LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
MTDEV_CFLAGS = @MTDEV_CFLAGS@
MTDEV_LIBS = @MTDEV_LIBS@
@@ -184,11 +187,13 @@ PTHREAD_CC = @PTHREAD_CC@
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
PTHREAD_LIBS = @PTHREAD_LIBS@
PYTHON = @PYTHON@
+PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@
PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
-PYTHON_INCLUDES = @PYTHON_INCLUDES@
-PYTHON_LIBS = @PYTHON_LIBS@
+PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@
+PYTHON_LDFLAGS = @PYTHON_LDFLAGS@
PYTHON_PLATFORM = @PYTHON_PLATFORM@
PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_SITE_PKG = @PYTHON_SITE_PKG@
PYTHON_VERSION = @PYTHON_VERSION@
RANLIB = @RANLIB@
SDL_CFLAGS = @SDL_CFLAGS@
@@ -211,6 +216,7 @@ abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
@@ -245,7 +251,6 @@ libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
@@ -269,8 +274,8 @@ target_vendor = @target_vendor@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-INCLUDES = -I.
-ALL_H = lmmin.h lm_eval.h
+AM_CPPFLAGS = -I.
+ALL_H = lmmin.h lm_eval.h
noinst_LTLIBRARIES = liblmfit.la
liblmfit_la_SOURCES = lmmin.c lm_eval.c $(ALL_H)
liblmfit_a_CXXFLAGS = -Wno-format-y2k
@@ -317,7 +322,7 @@ clean-noinstLTLIBRARIES:
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
-liblmfit.la: $(liblmfit_la_OBJECTS) $(liblmfit_la_DEPENDENCIES)
+liblmfit.la: $(liblmfit_la_OBJECTS) $(liblmfit_la_DEPENDENCIES) $(EXTRA_liblmfit_la_DEPENDENCIES)
$(AM_V_CCLD)$(LINK) $(liblmfit_la_OBJECTS) $(liblmfit_la_LIBADD) $(LIBS)
mostlyclean-compile:
@@ -332,26 +337,23 @@ distclean-compile:
.c.o:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'`
.c.lo:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
-@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
@@ -455,10 +457,15 @@ install-am: all-am
installcheck: installcheck-am
install-strip:
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- `test -z '$(STRIP)' || \
- echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
mostlyclean-generic:
clean-generic:
diff --git a/src/oscpack/Makefile.am b/src/oscpack/Makefile.am
index 891aebb..8408070 100644
--- a/src/oscpack/Makefile.am
+++ b/src/oscpack/Makefile.am
@@ -10,4 +10,3 @@ EXTRA_DIST = CHANGES LICENSE README TODO
noinst_LTLIBRARIES = liboscpack.la
liboscpack_la_SOURCES = $(ALL_CPP) $(ALL_H)
-
diff --git a/src/oscpack/Makefile.in b/src/oscpack/Makefile.in
index ed2eb7d..9cd0b27 100644
--- a/src/oscpack/Makefile.in
+++ b/src/oscpack/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# Makefile.in generated by automake 1.11.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
-# Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -41,11 +41,12 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ac_cxx_namespaces.m4 \
$(top_srcdir)/m4/ac_path_generic.m4 \
$(top_srcdir)/m4/ax_boost_thread.m4 \
- $(top_srcdir)/m4/ax_check_gl.m4 $(top_srcdir)/m4/libtool.m4 \
- $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
- $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
- $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/m4/python_dev.m4 \
- $(top_srcdir)/configure.in
+ $(top_srcdir)/m4/ax_check_gl.m4 \
+ $(top_srcdir)/m4/ax_python_devel.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/pkg.m4 \
+ $(top_srcdir)/m4/avg_version.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
@@ -60,8 +61,8 @@ am__objects_1 = IpEndpointName.lo NetworkingUtils.lo UdpSocket.lo \
am__objects_2 =
am_liboscpack_la_OBJECTS = $(am__objects_1) $(am__objects_2)
liboscpack_la_OBJECTS = $(am_liboscpack_la_OBJECTS)
-AM_V_lt = $(am__v_lt_$(V))
-am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
am__v_lt_0 = --silent
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src
depcomp = $(SHELL) $(top_srcdir)/depcomp
@@ -73,18 +74,18 @@ LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CXXFLAGS) $(CXXFLAGS)
-AM_V_CXX = $(am__v_CXX_$(V))
-am__v_CXX_ = $(am__v_CXX_$(AM_DEFAULT_VERBOSITY))
+AM_V_CXX = $(am__v_CXX_@AM_V@)
+am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@)
am__v_CXX_0 = @echo " CXX " $@;
-AM_V_at = $(am__v_at_$(V))
-am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
CXXLD = $(CXX)
CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
$(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
-AM_V_CXXLD = $(am__v_CXXLD_$(V))
-am__v_CXXLD_ = $(am__v_CXXLD_$(AM_DEFAULT_VERBOSITY))
+AM_V_CXXLD = $(am__v_CXXLD_@AM_V@)
+am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@)
am__v_CXXLD_0 = @echo " CXXLD " $@;
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@@ -92,18 +93,18 @@ LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
-AM_V_CC = $(am__v_CC_$(V))
-am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
+AM_V_CC = $(am__v_CC_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
am__v_CC_0 = @echo " CC " $@;
CCLD = $(CC)
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
-AM_V_CCLD = $(am__v_CCLD_$(V))
-am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
-AM_V_GEN = $(am__v_GEN_$(V))
-am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
SOURCES = $(liboscpack_la_SOURCES)
DIST_SOURCES = $(liboscpack_la_SOURCES)
@@ -119,7 +120,7 @@ AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BOOST_PYTHON_LIBS = @BOOST_PYTHON_LIBS@
-BOOST_THREAD_LIB = @BOOST_THREAD_LIB@
+BOOST_THREAD_LIBS = @BOOST_THREAD_LIBS@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
@@ -134,6 +135,7 @@ DC1394_2_CFLAGS = @DC1394_2_CFLAGS@
DC1394_2_LIBS = @DC1394_2_LIBS@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
@@ -174,6 +176,7 @@ LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
MTDEV_CFLAGS = @MTDEV_CFLAGS@
MTDEV_LIBS = @MTDEV_LIBS@
@@ -203,11 +206,13 @@ PTHREAD_CC = @PTHREAD_CC@
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
PTHREAD_LIBS = @PTHREAD_LIBS@
PYTHON = @PYTHON@
+PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@
PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
-PYTHON_INCLUDES = @PYTHON_INCLUDES@
-PYTHON_LIBS = @PYTHON_LIBS@
+PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@
+PYTHON_LDFLAGS = @PYTHON_LDFLAGS@
PYTHON_PLATFORM = @PYTHON_PLATFORM@
PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_SITE_PKG = @PYTHON_SITE_PKG@
PYTHON_VERSION = @PYTHON_VERSION@
RANLIB = @RANLIB@
SDL_CFLAGS = @SDL_CFLAGS@
@@ -230,6 +235,7 @@ abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
@@ -264,7 +270,6 @@ libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
@@ -343,7 +348,7 @@ clean-noinstLTLIBRARIES:
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
-liboscpack.la: $(liboscpack_la_OBJECTS) $(liboscpack_la_DEPENDENCIES)
+liboscpack.la: $(liboscpack_la_OBJECTS) $(liboscpack_la_DEPENDENCIES) $(EXTRA_liboscpack_la_DEPENDENCIES)
$(AM_V_CXXLD)$(CXXLINK) $(liboscpack_la_OBJECTS) $(liboscpack_la_LIBADD) $(LIBS)
mostlyclean-compile:
@@ -363,26 +368,23 @@ distclean-compile:
.cpp.o:
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $<
.cpp.obj:
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
.cpp.lo:
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
-@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
@@ -486,10 +488,15 @@ install-am: all-am
installcheck: installcheck-am
install-strip:
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- `test -z '$(STRIP)' || \
- echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
mostlyclean-generic:
clean-generic:
diff --git a/src/parport/Makefile.am b/src/parport/Makefile.am
deleted file mode 100644
index eaff53e..0000000
--- a/src/parport/Makefile.am
+++ /dev/null
@@ -1,6 +0,0 @@
-
-INCLUDES = -I.
-
-ALL_H = ParPort.h
-noinst_LTLIBRARIES = libparport.la
-libparport_la_SOURCES = ParPort.cpp $(ALL_H)
diff --git a/src/parport/ParPort.cpp b/src/parport/ParPort.cpp
deleted file mode 100644
index 3b926bb..0000000
--- a/src/parport/ParPort.cpp
+++ /dev/null
@@ -1,234 +0,0 @@
-//
-// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 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 "ParPort.h"
-
-#include "../avgconfigwrapper.h"
-#include "../base/Logger.h"
-#include "../base/Exception.h"
-#include "../base/MathHelper.h"
-
-#ifdef AVG_ENABLE_PARPORT
-#include <linux/ppdev.h>
-#include <linux/parport.h>
-#endif
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <sys/ioctl.h>
-#include <unistd.h>
-
-#include <cstring>
-#include <iostream>
-#include <sstream>
-#include <cerrno>
-
-using namespace std;
-
-namespace avg {
-
-ParPort::ParPort()
- : _myFileDescriptor(-1),
- _myDeviceName(""),
- _isOpen(false),
- _myDataLines(0)
-{
-}
-
-ParPort::~ParPort() {
- deinit();
-}
-
-void
-ParPort::init(const string& theDevice) {
- string myDevice = theDevice;
-#ifdef AVG_ENABLE_PARPORT
- if (myDevice.empty()) {
- myDevice = "/dev/parport0";
- }
- _myFileDescriptor = open(myDevice.c_str(), O_RDONLY);
- if (_myFileDescriptor == -1) {
- AVG_TRACE(Logger::ERROR,
- "Failed to open parallel port '"
- << myDevice << "': " << strerror(errno));
- return;
- } else {
- AVG_TRACE(Logger::CONFIG, "Parallel port opened.");
- }
-
- if (ioctl(_myFileDescriptor, PPCLAIM) == -1) {
- AVG_TRACE(Logger::ERROR,
- "Failed to claim parallel port: "
- << strerror(errno));
- _myFileDescriptor = -1;
- return;
- }
- _isOpen = true;
-#else
- AVG_TRACE(Logger::ERROR,
- "Failed to open parallel port. Support not compiled in.");
- _myFileDescriptor = -1;
-#endif
- _myDeviceName = myDevice;
-}
-
-bool ParPort::setControlLine(int theLine, bool theValue) {
- int theStatus;
- if (theValue) {
- theStatus = theLine;
- } else {
- theStatus = 0;
- }
- return frob(theLine, theStatus);
-}
-
-bool ParPort::getStatusLine(int theLine) {
-#ifdef AVG_ENABLE_PARPORT
- if (_myFileDescriptor == -1) {
- return false;
- }
- unsigned char myStatus;
- int myOk = ioctl(_myFileDescriptor, PPRSTATUS, &myStatus);
- if (myOk == -1) {
- AVG_TRACE(Logger::ERROR,
- "Could not get parallel port status.");
- return false;
- }
- return (myStatus & theLine) == theLine;
-#else
- return false;
-#endif
-}
-
-bool ParPort::setDataLines(unsigned char theData)
-{
-#ifdef AVG_ENABLE_PARPORT
- if (_myFileDescriptor == -1) {
- return false;
- }
- _myDataLines |= theData;
- int myOk = ioctl(_myFileDescriptor, PPWDATA, &_myDataLines);
- if (myOk == -1) {
- AVG_TRACE(Logger::ERROR,
- "Could not write parallel port data.");
- return false;
- }
- return true;
-#else
- return false;
-#endif
-}
-
-bool ParPort::clearDataLines(unsigned char theData)
-{
-#ifdef AVG_ENABLE_PARPORT
- if (_myFileDescriptor == -1) {
- return false;
- }
- _myDataLines &= ~theData;
- int myOk = ioctl(_myFileDescriptor, PPWDATA, &_myDataLines);
- if (myOk == -1) {
- AVG_TRACE(Logger::ERROR,
- "Could not write parallel port data.");
- return false;
- }
- return true;
-#else
- return false;
-#endif
-}
-
-bool ParPort::setAllDataLines(unsigned char theData)
-{
-#ifdef AVG_ENABLE_PARPORT
- if (_myFileDescriptor == -1) {
- return false;
- }
- _myDataLines = theData;
- int myOk = ioctl(_myFileDescriptor, PPWDATA, &_myDataLines);
- if (myOk == -1) {
- AVG_TRACE(Logger::ERROR,
- "Could not write parallel port data.");
- return false;
- }
- return true;
-#else
- return false;
-#endif
-}
-
-bool ParPort::isAvailable()
-{
- return (_myFileDescriptor != -1);
-}
-
-bool ParPort::frob(int theLines, int theStatus)
-{
-#ifdef AVG_ENABLE_PARPORT
- if (_myFileDescriptor == -1) {
- return false;
- }
- ppdev_frob_struct myFrob;
- myFrob.mask = theLines;
- myFrob.val = theStatus;
- int myOk = ioctl(_myFileDescriptor, PPFCONTROL, &myFrob);
- if (myOk == -1) {
- AVG_TRACE(Logger::ERROR,
- "Could not set parallel port control line.");
- return false;
- }
- return true;
-#else
- return false;
-#endif
-}
-
-void ParPort::deinit() {
- if (_isOpen) {
- if (::close(_myFileDescriptor) == -1) {
- AVG_TRACE(Logger::ERROR,
- "Can't close parallel port '"
- << _myDeviceName << "':" << strerror(errno));
- } else {
- AVG_TRACE(Logger::CONFIG, "Parallel port closed.");
- }
- }
-}
-
-bool
-ParPort::writeControlRegister(unsigned char theStatus) {
-#ifdef AVG_ENABLE_PARPORT
- if (_isOpen) {
- if (ioctl(_myFileDescriptor, PPWCONTROL, & theStatus) == -1) {
- AVG_TRACE(Logger::ERROR,
- "ERROR: Failed to write control register: "
- << strerror(errno));
- return false;
- }
- return true;
- }
-#endif
- return false;
-}
-
-}
-
diff --git a/src/parport/ParPort.h b/src/parport/ParPort.h
deleted file mode 100644
index fe7882f..0000000
--- a/src/parport/ParPort.h
+++ /dev/null
@@ -1,80 +0,0 @@
-//
-// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 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 _ParPort_H_
-#define _ParPort_H_
-
-#include "../api.h"
-#include <string>
-
-// Copied from linux/parport.h so we have a plattform-independent interface.
-#define PARPORT_CONTROL_STROBE 0x1
-#define PARPORT_CONTROL_AUTOFD 0x2
-#define PARPORT_CONTROL_INIT 0x4
-#define PARPORT_CONTROL_SELECT 0x8
-
-#define PARPORT_STATUS_ERROR 0x8
-#define PARPORT_STATUS_SELECT 0x10
-#define PARPORT_STATUS_PAPEROUT 0x20
-#define PARPORT_STATUS_ACK 0x40
-#define PARPORT_STATUS_BUSY 0x80
-
-namespace avg {
-
-enum ParPortData {
- BIT0 = 1,
- BIT1 = 2,
- BIT2 = 4,
- BIT3 = 8,
- BIT4 = 16,
- BIT5 = 32,
- BIT6 = 64,
- BIT7 = 128
-};
-
-class AVG_API ParPort
-{
- public:
- ParPort();
- virtual ~ParPort();
- void init(const std::string& theDevice);
- bool setControlLine(int theLine, bool theValue);
- bool getStatusLine(int theLine);
- bool setDataLines(unsigned char theData);
- bool clearDataLines(unsigned char theData);
- bool setAllDataLines(unsigned char theData);
- bool isAvailable();
-
- private:
- bool frob(int theLines, int theStatus);
- void deinit();
- bool writeControlRegister(unsigned char theStatus);
-
- int _myFileDescriptor;
- std::string _myDeviceName;
- bool _isOpen;
-
- unsigned char _myDataLines;
-};
-
-}
-
-#endif
diff --git a/src/player/AVGNode.cpp b/src/player/AVGNode.cpp
index 524bab5..e7c94bc 100644
--- a/src/player/AVGNode.cpp
+++ b/src/player/AVGNode.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -22,7 +22,7 @@
#include "AVGNode.h"
#include "Player.h"
-#include "NodeDefinition.h"
+#include "TypeDefinition.h"
#include "KeyEvent.h"
#include "../base/FileHelper.h"
@@ -33,20 +33,17 @@ using namespace std;
namespace avg {
-NodeDefinition AVGNode::createDefinition()
+void AVGNode::registerType()
{
- return NodeDefinition("avg", Node::buildNode<AVGNode>)
- .extendDefinition(CanvasNode::createDefinition())
- .addArg(Arg<string>("onkeyup", ""))
- .addArg(Arg<string>("onkeydown", ""));
+ TypeDefinition def = TypeDefinition("avg", "canvasbase",
+ ExportedObject::buildObject<AVGNode>);
+ TypeRegistry::get()->registerType(def);
}
AVGNode::AVGNode(const ArgList& args)
: CanvasNode(args)
{
args.setMembers(this);
- addArgEventHandler(Event::KEYUP, Event::NONE, args.getArgVal<string>("onkeyup"));
- addArgEventHandler(Event::KEYDOWN, Event::NONE, args.getArgVal<string>("onkeydown"));
}
AVGNode::~AVGNode()
diff --git a/src/player/AVGNode.h b/src/player/AVGNode.h
index ade1f79..fead377 100644
--- a/src/player/AVGNode.h
+++ b/src/player/AVGNode.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -32,7 +32,7 @@ namespace avg {
class AVG_API AVGNode : public CanvasNode
{
public:
- static NodeDefinition createDefinition();
+ static void registerType();
AVGNode(const ArgList& args);
virtual ~AVGNode();
diff --git a/src/player/AppleTrackpadInputDevice.cpp b/src/player/AppleTrackpadInputDevice.cpp
index d78e946..63059ae 100644
--- a/src/player/AppleTrackpadInputDevice.cpp
+++ b/src/player/AppleTrackpadInputDevice.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -57,27 +57,28 @@ void AppleTrackpadInputDevice::start()
m_Device = MTDeviceCreateDefault();
MTRegisterContactFrameCallback(m_Device, callback);
MTDeviceStart(m_Device, 0);
- AVG_TRACE(Logger::CONFIG, "Apple Trackpad Multitouch event source created.");
+ AVG_TRACE(Logger::category::CONFIG, Logger::severity::INFO,
+ "Apple Trackpad Multitouch event source created.");
}
void AppleTrackpadInputDevice::onData(int device, Finger* pFingers, int numFingers,
- double timestamp, int frame)
+ float timestamp, int frame)
{
- boost::mutex::scoped_lock lock(getMutex());
+ lock_guard lock(getMutex());
for (int i = 0; i < numFingers; i++) {
Finger* pFinger = &pFingers[i];
TouchStatusPtr pTouchStatus = getTouchStatus(pFinger->identifier);
if (!pTouchStatus) {
m_LastID++;
- TouchEventPtr pEvent = createEvent(m_LastID, pFinger, Event::CURSORDOWN);
+ TouchEventPtr pEvent = createEvent(m_LastID, pFinger, Event::CURSOR_DOWN);
addTouchStatus(pFinger->identifier, pEvent);
} else {
Event::Type eventType;
if (pFinger->state == 7) {
- eventType = Event::CURSORUP;
+ eventType = Event::CURSOR_UP;
removeTouchStatus(pFinger->identifier);
} else {
- eventType = Event::CURSORMOTION;
+ eventType = Event::CURSOR_MOTION;
}
TouchEventPtr pEvent = createEvent(0, pFinger, eventType);
pTouchStatus->pushEvent(pEvent);
@@ -96,13 +97,14 @@ int AppleTrackpadInputDevice::callback(int device, Finger *data, int nFingers,
TouchEventPtr AppleTrackpadInputDevice::createEvent(int avgID, Finger* pFinger,
Event::Type eventType)
{
- DPoint size = getWindowSize();
- IntPoint pos(pFinger->normalized.pos.x*size.x, (1-pFinger->normalized.pos.y)*size.y);
- DPoint speed(pFinger->normalized.vel.x*size.x, pFinger->normalized.vel.y*size.y);
- double eccentricity = pFinger->majorAxis/pFinger->minorAxis;
- DPoint majorAxis = DPoint::fromPolar(pFinger->angle, pFinger->majorAxis);
+ glm::vec2 size = getTouchArea();
+ IntPoint pos = getScreenPos(glm::vec2(pFinger->normalized.pos.x,
+ 1-pFinger->normalized.pos.y));
+ glm::vec2 speed(pFinger->normalized.vel.x*size.x, pFinger->normalized.vel.y*size.y);
+ float eccentricity = pFinger->majorAxis/pFinger->minorAxis;
+ glm::vec2 majorAxis = fromPolar(pFinger->angle, pFinger->majorAxis);
majorAxis.y = -majorAxis.y;
- DPoint minorAxis = DPoint::fromPolar(pFinger->angle+1.57, pFinger->minorAxis);
+ glm::vec2 minorAxis = fromPolar(pFinger->angle+1.57, pFinger->minorAxis);
minorAxis.y = -minorAxis.y;
TouchEventPtr pEvent(new TouchEvent(avgID, eventType, pos, Event::TOUCH,
diff --git a/src/player/AreaNode.cpp b/src/player/AreaNode.cpp
index 64e2ae8..b09f4a6 100644
--- a/src/player/AreaNode.cpp
+++ b/src/player/AreaNode.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -26,7 +26,8 @@
#include "MouseEvent.h"
#include "DivNode.h"
#include "ArgList.h"
-#include "NodeDefinition.h"
+#include "TypeDefinition.h"
+#include "TypeRegistry.h"
#include "BoostPython.h"
#include "../base/MathHelper.h"
@@ -43,29 +44,32 @@
#include <iostream>
using namespace boost;
-using namespace boost::python;
using namespace std;
namespace avg {
-NodeDefinition AreaNode::createDefinition()
+void AreaNode::registerType()
{
- return NodeDefinition("areanode")
- .extendDefinition(Node::createDefinition())
- .addArg(Arg<double>("x", 0.0, false, offsetof(AreaNode, m_RelViewport.tl.x)))
- .addArg(Arg<double>("y", 0.0, false, offsetof(AreaNode, m_RelViewport.tl.y)))
- .addArg(Arg<DPoint>("pos", DPoint(0.0, 0.0)))
- .addArg(Arg<double>("width", 0.0, false, offsetof(AreaNode, m_UserSize.x)))
- .addArg(Arg<double>("height", 0.0, false, offsetof(AreaNode, m_UserSize.y)))
- .addArg(Arg<DPoint>("size", DPoint(0.0, 0.0)))
- .addArg(Arg<double>("angle", 0.0, false, offsetof(AreaNode, m_Angle)))
- .addArg(Arg<DPoint>("pivot", DPoint(-32767, -32767), false,
- offsetof(AreaNode, m_Pivot)));
+ TypeDefinition def = TypeDefinition("areanode", "node")
+ .addArg(Arg<float>("x", 0.0, false, offsetof(AreaNode, m_RelViewport.tl.x)))
+ .addArg(Arg<float>("y", 0.0, false, offsetof(AreaNode, m_RelViewport.tl.y)))
+ .addArg(Arg<glm::vec2>("pos", glm::vec2(0.0, 0.0)))
+ .addArg(Arg<float>("width", 0.0, false, offsetof(AreaNode, m_UserSize.x)))
+ .addArg(Arg<float>("height", 0.0, false, offsetof(AreaNode, m_UserSize.y)))
+ .addArg(Arg<glm::vec2>("size", glm::vec2(0.0, 0.0)))
+ .addArg(Arg<float>("angle", 0.0, false, offsetof(AreaNode, m_Angle)))
+ .addArg(Arg<glm::vec2>("pivot", glm::vec2(-32767, -32767), false,
+ offsetof(AreaNode, m_Pivot)))
+ .addArg(Arg<string>("elementoutlinecolor", "", false,
+ offsetof(AreaNode, m_sElementOutlineColor)));
+ TypeRegistry::get()->registerType(def);
}
AreaNode::AreaNode()
- : m_RelViewport(0,0,0,0)
+ : m_RelViewport(0,0,0,0),
+ m_Transform(glm::mat4(0)),
+ m_bTransformChanged(true)
{
ObjectCounter::get()->incRef(&typeid(*this));
}
@@ -83,170 +87,202 @@ void AreaNode::setArgs(const ArgList& args)
m_RelViewport.setWidth(m_UserSize.x);
m_RelViewport.setHeight(m_UserSize.y);
m_bHasCustomPivot = ((m_Pivot.x != -32767) && (m_Pivot.y != -32767));
+ setElementOutlineColor(m_sElementOutlineColor);
}
void AreaNode::connectDisplay()
{
IntPoint MediaSize = getMediaSize();
if (m_UserSize.x == 0.0) {
- m_RelViewport.setWidth(MediaSize.x);
+ m_RelViewport.setWidth(float(MediaSize.x));
} else {
- m_RelViewport.setWidth(m_UserSize.x);
+ m_RelViewport.setWidth(float(m_UserSize.x));
}
if (m_UserSize.y == 0.0) {
- m_RelViewport.setHeight(MediaSize.y);
+ m_RelViewport.setHeight(float(MediaSize.y));
} else {
- m_RelViewport.setHeight(m_UserSize.y);
+ m_RelViewport.setHeight(float(m_UserSize.y));
}
+ if (m_UserSize.x == 0.0 || m_UserSize.y == 0) {
+ notifySubscribers("SIZE_CHANGED", m_RelViewport.size());
+ }
+ m_bTransformChanged = true;
Node::connectDisplay();
}
-double AreaNode::getX() const
+float AreaNode::getX() const
{
return m_RelViewport.tl.x;
}
-void AreaNode::setX(double x)
+void AreaNode::setX(float x)
{
setViewport(x, -32767, -32767, -32767);
}
-double AreaNode::getY() const
+float AreaNode::getY() const
{
return m_RelViewport.tl.y;
}
-void AreaNode::setY(double y)
+void AreaNode::setY(float y)
{
setViewport(-32767, y, -32767, -32767);
}
-const DPoint& AreaNode::getPos() const
+const glm::vec2& AreaNode::getPos() const
{
return m_RelViewport.tl;
}
-void AreaNode::setPos(const DPoint& pt)
+void AreaNode::setPos(const glm::vec2& pt)
{
setViewport(pt.x, pt.y, -32767, -32767);
}
-double AreaNode::getWidth() const
+float AreaNode::getWidth() const
{
return getRelViewport().width();
}
-void AreaNode::setWidth(double width)
+void AreaNode::setWidth(float width)
{
m_UserSize.x = width;
setViewport(-32767, -32767, -32767, -32767);
}
-double AreaNode::getHeight() const
+float AreaNode::getHeight() const
{
return getRelViewport().height();
}
-void AreaNode::setHeight(double height)
+void AreaNode::setHeight(float height)
{
m_UserSize.y = height;
setViewport(-32767, -32767, -32767, -32767);
}
-DPoint AreaNode::getSize() const
+glm::vec2 AreaNode::getSize() const
{
return getRelViewport().size();
}
-void AreaNode::setSize(const DPoint& pt)
+void AreaNode::setSize(const glm::vec2& pt)
{
m_UserSize = pt;
setViewport(-32767, -32767, -32767, -32767);
}
-double AreaNode::getAngle() const
+float AreaNode::getAngle() const
{
return m_Angle;
}
-void AreaNode::setAngle(double angle)
+void AreaNode::setAngle(float angle)
{
- m_Angle = fmod(angle, 2*M_PI);
+ m_Angle = fmod(angle, 2*PI);
+ m_bTransformChanged = true;
}
-DPoint AreaNode::getPivot() const
+glm::vec2 AreaNode::getPivot() const
{
if (m_bHasCustomPivot) {
return m_Pivot;
} else {
- return getSize()/2;
+ return getSize()/2.f;
}
}
-void AreaNode::setPivot(const DPoint& pt)
+void AreaNode::setPivot(const glm::vec2& pt)
{
m_Pivot.x = pt.x;
m_Pivot.y = pt.y;
m_bHasCustomPivot = true;
+ m_bTransformChanged = true;
+}
+
+const std::string& AreaNode::getElementOutlineColor() const
+{
+ return m_sElementOutlineColor;
+}
+
+void AreaNode::setElementOutlineColor(const std::string& sColor)
+{
+ m_sElementOutlineColor = sColor;
+ if (sColor == "") {
+ m_ElementOutlineColor = Pixel32(0,0,0,0);
+ } else {
+ m_ElementOutlineColor = colorStringToColor(m_sElementOutlineColor);
+ }
}
-DPoint AreaNode::toLocal(const DPoint& globalPos) const
+glm::vec2 AreaNode::toLocal(const glm::vec2& globalPos) const
{
- DPoint localPos = globalPos-m_RelViewport.tl;
- return localPos.getRotatedPivot(-getAngle(), getPivot());
+ glm::vec2 localPos = globalPos-m_RelViewport.tl;
+ return getRotatedPivot(localPos, -getAngle(), getPivot());
}
-DPoint AreaNode::toGlobal(const DPoint& localPos) const
+glm::vec2 AreaNode::toGlobal(const glm::vec2& localPos) const
{
- DPoint globalPos = localPos.getRotatedPivot(getAngle(), getPivot());
+ glm::vec2 globalPos = getRotatedPivot(localPos, getAngle(), getPivot());
return globalPos+m_RelViewport.tl;
}
-void AreaNode::getElementsByPos(const DPoint& pos, vector<NodeWeakPtr>& pElements)
+void AreaNode::getElementsByPos(const glm::vec2& pos, vector<NodePtr>& pElements)
{
if (pos.x >= 0 && pos.y >= 0 && pos.x < getSize().x && pos.y < getSize().y &&
reactsToMouseEvents())
{
- pElements.push_back(shared_from_this());
+ pElements.push_back(getSharedThis());
}
}
-void AreaNode::maybeRender(const DRect& rect)
+void AreaNode::maybeRender(const glm::mat4& parentTransform)
{
AVG_ASSERT(getState() == NS_CANRENDER);
if (isVisible()) {
- if (getID() != "") {
- AVG_TRACE(Logger::BLTS, "Rendering " << getTypeStr() <<
- " with ID " << getID());
- } else {
- AVG_TRACE(Logger::BLTS, "Rendering " << getTypeStr());
- }
- GLContext * pContext = GLContext::getCurrent();
- pContext->pushTransform(getRelViewport().tl, getAngle(), getPivot());
- render(rect);
- pContext->popTransform();
+ calcTransform();
+ m_Transform = parentTransform*m_LocalTransform;
+ render();
+ }
+}
+
+void AreaNode::renderOutlines(const VertexArrayPtr& pVA, Pixel32 parentColor)
+{
+ Pixel32 effColor = getEffectiveOutlineColor(parentColor);
+ if (effColor != Pixel32(0,0,0,0)) {
+ glm::vec2 size = getSize();
+ glm::vec2 p0 = getAbsPos(glm::vec2(0.5, 0.5));
+ glm::vec2 p1 = getAbsPos(glm::vec2(size.x+0.5,0.5));
+ glm::vec2 p2 = getAbsPos(glm::vec2(size.x+0.5,size.y+0.5));
+ glm::vec2 p3 = getAbsPos(glm::vec2(0.5,size.y+0.5));
+ pVA->addLineData(effColor, p0, p1, 1);
+ pVA->addLineData(effColor, p1, p2, 1);
+ pVA->addLineData(effColor, p2, p3, 1);
+ pVA->addLineData(effColor, p3, p0, 1);
}
}
-void AreaNode::setViewport(double x, double y, double width, double height)
+void AreaNode::setViewport(float x, float y, float width, float height)
{
+ glm::vec2 oldSize = getRelViewport().size();
if (x == -32767) {
x = getRelViewport().tl.x;
}
if (y == -32767) {
y = getRelViewport().tl.y;
}
- IntPoint MediaSize = getMediaSize();
+ glm::vec2 mediaSize = glm::vec2(getMediaSize());
if (width == -32767) {
if (m_UserSize.x == 0.0) {
- width = MediaSize.x;
+ width = mediaSize.x;
} else {
width = m_UserSize.x;
}
}
if (height == -32767) {
if (m_UserSize.y == 0.0) {
- height = MediaSize.y;
+ height = mediaSize.y;
} else {
height = m_UserSize.y;
}
@@ -254,10 +290,14 @@ void AreaNode::setViewport(double x, double y, double width, double height)
if (width < 0 || height < 0) {
throw Exception(AVG_ERR_OUT_OF_RANGE, "Negative size for a node.");
}
- m_RelViewport = DRect (x, y, x+width, y+height);
+ m_RelViewport = FRect(x, y, x+width, y+height);
+ if (oldSize != m_RelViewport.size()) {
+ notifySubscribers("SIZE_CHANGED", m_RelViewport.size());
+ }
+ m_bTransformChanged = true;
}
-const DRect& AreaNode::getRelViewport() const
+const FRect& AreaNode::getRelViewport() const
{
// cerr << "Node " << getID() << ": " << m_RelViewport << endl;
return m_RelViewport;
@@ -275,9 +315,36 @@ string AreaNode::dump(int indent)
return dumpStr;
}
-DPoint AreaNode::getUserSize() const
+const glm::mat4& AreaNode::getTransform() const
+{
+ return m_Transform;
+}
+
+glm::vec2 AreaNode::getUserSize() const
{
return m_UserSize;
}
+Pixel32 AreaNode::getEffectiveOutlineColor(Pixel32 parentColor) const
+{
+ if (m_ElementOutlineColor == Pixel32(0,0,0,0)) {
+ return parentColor;
+ } else {
+ return m_ElementOutlineColor;
+ }
+}
+
+void AreaNode::calcTransform()
+{
+ if (m_bTransformChanged) {
+ glm::vec3 pos(m_RelViewport.tl.x, m_RelViewport.tl.y, 0);
+ glm::vec3 pivot(getPivot().x, getPivot().y, 0);
+ glm::mat4 transform = glm::translate(glm::mat4(1.0f), pos);
+ transform = glm::translate(transform, pivot);
+ transform = glm::rotate(transform, (180.f/PI)*m_Angle, glm::vec3(0,0,1));
+ m_LocalTransform = glm::translate(transform, -pivot);
+ m_bTransformChanged = false;
+ }
+}
+
}
diff --git a/src/player/AreaNode.h b/src/player/AreaNode.h
index 65bb3bf..7a65c52 100644
--- a/src/player/AreaNode.h
+++ b/src/player/AreaNode.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -26,7 +26,7 @@
#include "Node.h"
-#include "../base/Point.h"
+#include "../base/GLMHelper.h"
#include "../base/Rect.h"
#include "../graphics/OGLShader.h"
@@ -44,9 +44,6 @@ class DivNode;
class ArgList;
typedef boost::shared_ptr<AreaNode> AreaNodePtr;
-typedef boost::weak_ptr<AreaNode> AreaNodeWeakPtr;
-typedef boost::shared_ptr<DivNode> DivNodePtr;
-typedef boost::weak_ptr<DivNode> DivNodeWeakPtr;
class AVG_API AreaNode: public Node
{
@@ -56,45 +53,49 @@ class AVG_API AreaNode: public Node
{
return NodePtr(new NodeType(args));
}
- static NodeDefinition createDefinition();
+ static void registerType();
virtual ~AreaNode() = 0;
virtual void setArgs(const ArgList& args);
virtual void connectDisplay();
- double getX() const;
- void setX(double x);
+ float getX() const;
+ void setX(float x);
- double getY() const;
- void setY(double Y);
+ float getY() const;
+ void setY(float Y);
- const DPoint& getPos() const;
- void setPos(const DPoint& pt);
+ const glm::vec2& getPos() const;
+ void setPos(const glm::vec2& pt);
- virtual double getWidth() const;
- virtual void setWidth(double width);
+ virtual float getWidth() const;
+ virtual void setWidth(float width);
- virtual double getHeight() const;
- virtual void setHeight(double height);
+ virtual float getHeight() const;
+ virtual void setHeight(float height);
- virtual DPoint getSize() const;
- virtual void setSize(const DPoint& pt);
+ virtual glm::vec2 getSize() const;
+ virtual void setSize(const glm::vec2& pt);
- double getAngle() const;
- void setAngle(double angle);
+ float getAngle() const;
+ void setAngle(float angle);
- virtual DPoint getPivot() const;
- void setPivot(const DPoint& pt);
+ virtual glm::vec2 getPivot() const;
+ void setPivot(const glm::vec2& pt);
- virtual DPoint toLocal(const DPoint& globalPos) const;
- virtual DPoint toGlobal(const DPoint& localPos) const;
+ const std::string& getElementOutlineColor() const;
+ void setElementOutlineColor(const std::string& sColor);
+
+ virtual glm::vec2 toLocal(const glm::vec2& globalPos) const;
+ virtual glm::vec2 toGlobal(const glm::vec2& localPos) const;
- virtual void getElementsByPos(const DPoint& pos,
- std::vector<NodeWeakPtr>& pElements);
+ virtual void getElementsByPos(const glm::vec2& pos,
+ std::vector<NodePtr>& pElements);
- virtual void maybeRender(const DRect& rect);
- virtual void setViewport(double x, double y, double width, double height);
- virtual const DRect& getRelViewport() const;
+ virtual void maybeRender(const glm::mat4& parentTransform);
+ virtual void renderOutlines(const VertexArrayPtr& pVA, Pixel32 parentColor);
+ virtual void setViewport(float x, float y, float width, float height);
+ virtual const FRect& getRelViewport() const;
virtual std::string dump(int indent = 0);
@@ -102,18 +103,27 @@ class AVG_API AreaNode: public Node
virtual IntPoint getMediaSize()
{ return IntPoint(0,0); };
+ const glm::mat4& getTransform() const;
protected:
AreaNode();
- DPoint getUserSize() const;
+ glm::vec2 getUserSize() const;
+ Pixel32 getEffectiveOutlineColor(Pixel32 parentColor) const;
private:
- DRect m_RelViewport; // In coordinates relative to the parent.
- double m_Angle;
- DPoint m_Pivot;
+ void calcTransform();
+
+ FRect m_RelViewport; // In coordinates relative to the parent.
+ float m_Angle;
+ glm::vec2 m_Pivot;
bool m_bHasCustomPivot;
+ std::string m_sElementOutlineColor;
+ Pixel32 m_ElementOutlineColor;
- DPoint m_UserSize;
+ glm::vec2 m_UserSize;
+ glm::mat4 m_Transform;
+ glm::mat4 m_LocalTransform;
+ bool m_bTransformChanged;
};
}
diff --git a/src/player/Arg.cpp b/src/player/Arg.cpp
index 6bb7fbb..1518164 100644
--- a/src/player/Arg.cpp
+++ b/src/player/Arg.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -22,6 +22,8 @@
//
#include "Arg.h"
+#include "FontStyle.h"
+
#include <string>
using namespace std;
@@ -31,14 +33,15 @@ namespace avg {
#ifndef _WIN32
template class Arg<int>;
template class Arg<bool>;
-template class Arg<double>;
template class Arg<float>;
template class Arg<string>;
-template class Arg<DPoint>;
-template class Arg<IntTriple>;
-template class Arg<DTriple>;
-template class Arg<vector<double> >;
-template class Arg<vector<DPoint> >;
-template class Arg<vector<IntTriple> >;
+template class Arg<glm::vec2>;
+template class Arg<glm::vec3>;
+template class Arg<glm::ivec3>;
+template class Arg<std::vector<float> >;
+template class Arg<std::vector<int> >;
+template class Arg<vector<glm::vec2> >;
+template class Arg<vector<glm::ivec3> >;
+template class Arg<FontStyle>;
#endif
}
diff --git a/src/player/Arg.h b/src/player/Arg.h
index a48e86f..be441e3 100644
--- a/src/player/Arg.h
+++ b/src/player/Arg.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -25,8 +25,7 @@
#define _Arg_H_
#include "../api.h"
-#include "../base/Point.h"
-#include "../base/Triple.h"
+#include "../base/GLMHelper.h"
#include "ArgBase.h"
@@ -35,7 +34,7 @@
namespace avg {
-class Node;
+class ExportedObject;
template<class T>
class AVG_TEMPLATE_API Arg: public ArgBase
@@ -47,7 +46,7 @@ public:
void setValue(const T& Value);
const T& getValue() const;
- virtual void setMember(Node * pNode) const;
+ virtual void setMember(ExportedObject * pObj) const;
virtual ArgBase* createCopy() const;
private:
@@ -81,10 +80,10 @@ void Arg<T>::setValue(const T& Value)
}
template<class T>
-void Arg<T>::setMember(Node * pNode) const
+void Arg<T>::setMember(ExportedObject * pObj) const
{
if (getMemberOffset() != -1) {
- T* pMember = (T*)((char*)pNode+getMemberOffset());
+ T* pMember = (T*)((char*)pObj+getMemberOffset());
*pMember = m_Value;
}
}
@@ -103,14 +102,14 @@ ArgBase* Arg<T>::createCopy() const
extern template class Arg<int>;
extern template class Arg<bool>;
extern template class Arg<float>;
-extern template class Arg<double>;
extern template class Arg<std::string>;
-extern template class Arg<DPoint>;
-extern template class Arg<IntTriple>;
-extern template class Arg<DTriple>;
-extern template class Arg<std::vector<double> >;
-extern template class Arg<std::vector<DPoint> >;
-extern template class Arg<std::vector<IntTriple> >;
+extern template class Arg<glm::vec2>;
+extern template class Arg<glm::vec3>;
+extern template class Arg<glm::ivec3>;
+extern template class Arg<std::vector<float> >;
+extern template class Arg<std::vector<int> >;
+extern template class Arg<std::vector<glm::vec2> >;
+extern template class Arg<std::vector<glm::ivec2> >;
#endif
#endif
diff --git a/src/player/ArgBase.cpp b/src/player/ArgBase.cpp
index 1c4882d..9409f45 100644
--- a/src/player/ArgBase.cpp
+++ b/src/player/ArgBase.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/player/ArgBase.h b/src/player/ArgBase.h
index c6017f2..fff8969 100644
--- a/src/player/ArgBase.h
+++ b/src/player/ArgBase.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -32,7 +32,7 @@
namespace avg {
-class Node;
+class ExportedObject;
class AVG_API ArgBase
{
@@ -44,7 +44,7 @@ public:
bool isDefault() const;
bool isRequired() const;
- virtual void setMember(Node * pNode) const = 0;
+ virtual void setMember(ExportedObject * pObj) const = 0;
virtual ArgBase* createCopy() const = 0;
diff --git a/src/player/ArgList.cpp b/src/player/ArgList.cpp
index 15b5ce3..5abe78c 100644
--- a/src/player/ArgList.cpp
+++ b/src/player/ArgList.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -23,7 +23,8 @@
#include "ArgList.h"
-#include "Node.h"
+#include "ExportedObject.h"
+#include "FontStyle.h"
#include "../base/Logger.h"
#include "../base/Exception.h"
@@ -36,6 +37,8 @@ using namespace std;
namespace avg {
+typedef std::vector<std::vector<glm::vec2> > CollVec2Vector;
+
ArgList::ArgList()
{
}
@@ -52,18 +55,18 @@ ArgList::ArgList(const ArgList& argTemplates, const xmlNodePtr xmlNode)
}
}
-ArgList::ArgList(const ArgList& argTemplates, const boost::python::dict& PyDict)
+ArgList::ArgList(const ArgList& argTemplates, const py::dict& PyDict)
{
// TODO: Check if all required args are being set.
copyArgsFrom(argTemplates);
- boost::python::list keys = PyDict.keys();
- int nKeys = boost::python::len(keys);
+ py::list keys = PyDict.keys();
+ int nKeys = py::len(keys);
for (int i = 0; i < nKeys; i++)
{
- boost::python::object keyObj = keys[i];
- boost::python::object valObj = PyDict[keyObj];
+ py::object keyObj = keys[i];
+ py::object valObj = PyDict[keyObj];
- boost::python::extract<string> keyStrProxy(keyObj);
+ py::extract<string> keyStrProxy(keyObj);
if (!keyStrProxy.check()) {
throw Exception(AVG_ERR_INVALID_ARGS, "Argument name must be a string.");
}
@@ -93,7 +96,7 @@ const ArgBasePtr ArgList::getArg(const string& sName) const
return valIt->second;
}
-void ArgList::getOverlayedArgVal(DPoint* pResult, const string& sName,
+void ArgList::getOverlayedArgVal(glm::vec2* pResult, const string& sName,
const string& sOverlay1, const string& sOverlay2, const string& sID) const
{
if (hasArg(sName)) {
@@ -102,7 +105,7 @@ void ArgList::getOverlayedArgVal(DPoint* pResult, const string& sName,
string("Duplicate node arguments (")+sName+" and "+
sOverlay1+","+sOverlay2+") for node '"+sID+"'"));
}
- *pResult = getArgVal<DPoint>(sName);
+ *pResult = getArgVal<glm::vec2>(sName);
}
}
@@ -113,7 +116,7 @@ const ArgMap& ArgList::getArgMap() const
void ArgList::setArg(const ArgBase& newArg)
{
- m_Args.insert(ArgMap::value_type(newArg.getName(), ArgBasePtr(newArg.createCopy())));
+ m_Args[newArg.getName()] = ArgBasePtr(newArg.createCopy());
}
void ArgList::setArgs(const ArgList& args)
@@ -123,20 +126,19 @@ void ArgList::setArgs(const ArgList& args)
}
}
-void ArgList::setMembers(Node * pNode) const
+void ArgList::setMembers(ExportedObject * pObj) const
{
for (ArgMap::const_iterator it = m_Args.begin(); it != m_Args.end(); it++) {
const ArgBasePtr pCurArg = it->second;
- pCurArg->setMember(pNode);
+ pCurArg->setMember(pObj);
}
- pNode->setArgs(*this);
+ pObj->setArgs(*this);
}
template<class T>
-void setArgValue(Arg<T>* pArg, const std::string & sName,
- const boost::python::object& value)
+void setArgValue(Arg<T>* pArg, const std::string & sName, const py::object& value)
{
- boost::python::extract<T> valProxy(value);
+ py::extract<T> valProxy(value);
if (!valProxy.check()) {
string sTypeName = getFriendlyTypeName(pArg->getValue());
throw Exception(AVG_ERR_INVALID_ARGS, "Type error in argument "+sName+": "
@@ -145,47 +147,57 @@ void setArgValue(Arg<T>* pArg, const std::string & sName,
pArg->setValue(valProxy());
}
-void ArgList::setArgValue(const std::string & sName, const boost::python::object& value)
+void ArgList::setArgValue(const std::string & sName, const py::object& value)
{
ArgBasePtr pArg = getArg(sName);
Arg<string>* pStringArg = dynamic_cast<Arg<string>* >(&*pArg);
Arg<UTF8String>* pUTF8StringArg = dynamic_cast<Arg<UTF8String>* >(&*pArg);
Arg<int>* pIntArg = dynamic_cast<Arg<int>* >(&*pArg);
- Arg<double>* pDoubleArg = dynamic_cast<Arg<double>* >(&*pArg);
Arg<float>* pFloatArg = dynamic_cast<Arg<float>* >(&*pArg);
Arg<bool>* pBoolArg = dynamic_cast<Arg<bool>* >(&*pArg);
- Arg<DPoint>* pDPointArg = dynamic_cast<Arg<DPoint>* >(&*pArg);
- Arg<IntTriple>* pIntTripleArg = dynamic_cast<Arg<IntTriple>* >(&*pArg);
- Arg<DTriple>* pDTripleArg = dynamic_cast<Arg<DTriple>* >(&*pArg);
- Arg<vector<double> >* pDVectorArg = dynamic_cast<Arg<vector<double> >* >(&*pArg);
- Arg<vector<DPoint> >* pDPointVectorArg =
- dynamic_cast<Arg<vector<DPoint> >* >(&*pArg);
- Arg<vector<IntTriple> >* pIntTripleVectorArg =
- dynamic_cast<Arg<vector<IntTriple> >* >(&*pArg);
+ Arg<glm::vec2>* pVec2Arg = dynamic_cast<Arg<glm::vec2>* >(&*pArg);
+ Arg<glm::vec3>* pVec3Arg = dynamic_cast<Arg<glm::vec3>* >(&*pArg);
+ Arg<glm::ivec3>* pIVec3Arg = dynamic_cast<Arg<glm::ivec3>* >(&*pArg);
+ Arg<vector<float> >* pFVectorArg = dynamic_cast<Arg<vector<float> >* >(&*pArg);
+ Arg<vector<int> >* pIVectorArg = dynamic_cast<Arg<vector<int> >* >(&*pArg);
+ Arg<vector<glm::vec2> >* pVec2VectorArg =
+ dynamic_cast<Arg<vector<glm::vec2> >* >(&*pArg);
+ Arg<vector<glm::ivec3> >* pIVec3VectorArg =
+ dynamic_cast<Arg<vector<glm::ivec3> >* >(&*pArg);
+ Arg<CollVec2Vector>* pCollVec2VectorArg =
+ dynamic_cast<Arg<CollVec2Vector>* >(&*pArg);
+ Arg<FontStyle>* pFontStyleArg = dynamic_cast<Arg<FontStyle>* >(&*pArg);
+ Arg<FontStylePtr>* pFontStylePtrArg = dynamic_cast<Arg<FontStylePtr>* >(&*pArg);
if(pStringArg) {
avg::setArgValue(pStringArg, sName, value);
} else if (pUTF8StringArg) {
avg::setArgValue(pUTF8StringArg, sName, value);
} else if (pIntArg) {
avg::setArgValue(pIntArg, sName, value);
- } else if (pDoubleArg) {
- avg::setArgValue(pDoubleArg, sName, value);
} else if (pFloatArg) {
avg::setArgValue(pFloatArg, sName, value);
} else if (pBoolArg) {
avg::setArgValue(pBoolArg, sName, value);
- } else if (pDPointArg) {
- avg::setArgValue(pDPointArg, sName, value);
- } else if (pDVectorArg) {
- avg::setArgValue(pDVectorArg, sName, value);
- } else if (pDPointVectorArg) {
- avg::setArgValue(pDPointVectorArg, sName, value);
- } else if (pIntTripleArg) {
- avg::setArgValue(pIntTripleArg, sName, value);
- } else if (pDTripleArg) {
- avg::setArgValue(pDTripleArg, sName, value);
- } else if (pIntTripleVectorArg) {
- avg::setArgValue(pIntTripleVectorArg, sName, value);
+ } else if (pVec2Arg) {
+ avg::setArgValue(pVec2Arg, sName, value);
+ } else if (pVec3Arg) {
+ avg::setArgValue(pVec3Arg, sName, value);
+ } else if (pIVec3Arg) {
+ avg::setArgValue(pIVec3Arg, sName, value);
+ } else if (pFVectorArg) {
+ avg::setArgValue(pFVectorArg, sName, value);
+ } else if (pIVectorArg) {
+ avg::setArgValue(pIVectorArg, sName, value);
+ } else if (pVec2VectorArg) {
+ avg::setArgValue(pVec2VectorArg, sName, value);
+ } else if (pIVec3VectorArg) {
+ avg::setArgValue(pIVec3VectorArg, sName, value);
+ } else if (pCollVec2VectorArg) {
+ avg::setArgValue(pCollVec2VectorArg, sName, value);
+ } else if (pFontStyleArg) {
+ avg::setArgValue(pFontStyleArg, sName, value);
+ } else if (pFontStylePtrArg) {
+ avg::setArgValue(pFontStylePtrArg, sName, value);
} else {
AVG_ASSERT(false);
}
@@ -197,45 +209,55 @@ void ArgList::setArgValue(const std::string & sName, const std::string & sValue)
Arg<string>* pStringArg = dynamic_cast<Arg<string>* >(&*pArg);
Arg<UTF8String>* pUTF8StringArg = dynamic_cast<Arg<UTF8String>* >(&*pArg);
Arg<int>* pIntArg = dynamic_cast<Arg<int>* >(&*pArg);
- Arg<double>* pDoubleArg = dynamic_cast<Arg<double>* >(&*pArg);
Arg<float>* pFloatArg = dynamic_cast<Arg<float>* >(&*pArg);
Arg<bool>* pBoolArg = dynamic_cast<Arg<bool>* >(&*pArg);
- Arg<DPoint>* pDPointArg = dynamic_cast<Arg<DPoint>* >(&*pArg);
- Arg<IntTriple>* pIntTripleArg = dynamic_cast<Arg<IntTriple>* >(&*pArg);
- Arg<vector<double> >* pDVectorArg = dynamic_cast<Arg<vector<double> >* >(&*pArg);
- Arg<vector<DPoint> >* pDPointVectorArg =
- dynamic_cast<Arg<vector<DPoint> >* >(&*pArg);
- Arg<vector<IntTriple> >* pIntTripleVectorArg =
- dynamic_cast<Arg<vector<IntTriple> >* >(&*pArg);
-
+ Arg<glm::vec2>* pVec2Arg = dynamic_cast<Arg<glm::vec2>* >(&*pArg);
+ Arg<glm::vec3>* pVec3Arg = dynamic_cast<Arg<glm::vec3>* >(&*pArg);
+ Arg<glm::ivec3>* pIVec3Arg = dynamic_cast<Arg<glm::ivec3>* >(&*pArg);
+ Arg<vector<float> >* pFVectorArg = dynamic_cast<Arg<vector<float> >* >(&*pArg);
+ Arg<vector<int> >* pIVectorArg = dynamic_cast<Arg<vector<int> >* >(&*pArg);
+ Arg<vector<glm::vec2> >* pVec2VectorArg =
+ dynamic_cast<Arg<vector<glm::vec2> >* >(&*pArg);
+ Arg<vector<glm::ivec3> >* pIVec3VectorArg =
+ dynamic_cast<Arg<vector<glm::ivec3> >* >(&*pArg);
+ Arg<CollVec2Vector>* pCollVec2VectorArg =
+ dynamic_cast<Arg<CollVec2Vector>* >(&*pArg);
if (pStringArg) {
pStringArg->setValue(sValue);
} else if (pUTF8StringArg) {
pUTF8StringArg->setValue(sValue);
} else if (pIntArg) {
pIntArg->setValue(stringToInt(sValue));
- } else if (pDoubleArg) {
- pDoubleArg->setValue(stringToDouble(sValue));
} else if (pFloatArg) {
- pFloatArg->setValue(float(stringToDouble(sValue)));
+ pFloatArg->setValue(stringToFloat(sValue));
} else if (pBoolArg) {
pBoolArg->setValue(stringToBool(sValue));
- } else if (pDPointArg) {
- pDPointArg->setValue(stringToDPoint(sValue));
- } else if (pIntTripleArg) {
- pIntTripleArg->setValue(stringToIntTriple(sValue));
- } else if (pDVectorArg) {
- vector<double> v;
+ } else if (pVec2Arg) {
+ pVec2Arg->setValue(stringToVec2(sValue));
+ } else if (pVec3Arg) {
+ pVec3Arg->setValue(stringToVec3(sValue));
+ } else if (pIVec3Arg) {
+ pIVec3Arg->setValue(stringToIVec3(sValue));
+ } else if (pFVectorArg) {
+ vector<float> v;
+ fromString(sValue, v);
+ pFVectorArg->setValue(v);
+ } else if (pIVectorArg) {
+ vector<int> v;
+ fromString(sValue, v);
+ pIVectorArg->setValue(v);
+ } else if (pVec2VectorArg) {
+ vector<glm::vec2> v;
fromString(sValue, v);
- pDVectorArg->setValue(v);
- } else if (pDPointVectorArg) {
- vector<DPoint> v;
+ pVec2VectorArg->setValue(v);
+ } else if (pIVec3VectorArg) {
+ vector<glm::ivec3> v;
fromString(sValue, v);
- pDPointVectorArg->setValue(v);
- } else if (pIntTripleVectorArg) {
- vector<IntTriple> v;
+ pIVec3VectorArg->setValue(v);
+ } else if (pCollVec2VectorArg) {
+ CollVec2Vector v;
fromString(sValue, v);
- pIntTripleVectorArg->setValue(v);
+ pCollVec2VectorArg->setValue(v);
} else {
AVG_ASSERT(false);
}
diff --git a/src/player/ArgList.h b/src/player/ArgList.h
index d04b1d4..5f78114 100644
--- a/src/player/ArgList.h
+++ b/src/player/ArgList.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -38,14 +38,14 @@ namespace avg {
typedef std::map<std::string, ArgBasePtr> ArgMap;
-class Node;
+class ExportedObject;
class AVG_API ArgList
{
public:
ArgList();
ArgList(const ArgList& argTemplates, const xmlNodePtr xmlNode);
- ArgList(const ArgList& argTemplates, const boost::python::dict& PyDict);
+ ArgList(const ArgList& argTemplates, const py::dict& PyDict);
virtual ~ArgList();
bool hasArg(const std::string& sName) const;
@@ -54,7 +54,7 @@ public:
template<class T>
const T& getArgVal(const std::string& sName) const;
- void getOverlayedArgVal(DPoint* pResult, const std::string& sName,
+ void getOverlayedArgVal(glm::vec2* pResult, const std::string& sName,
const std::string& sOverlay1, const std::string& sOverlay2,
const std::string& sID) const;
@@ -62,12 +62,12 @@ public:
void setArg(const ArgBase& newArg);
void setArgs(const ArgList& args);
- void setMembers(Node * pNode) const;
+ void setMembers(ExportedObject * pObj) const;
void copyArgsFrom(const ArgList& argTemplates);
private:
- void setArgValue(const std::string & sName, const boost::python::object& value);
+ void setArgValue(const std::string & sName, const py::object& value);
void setArgValue(const std::string & sName, const std::string & sValue);
ArgMap m_Args;
};
diff --git a/src/graphics/BitmapManager.cpp b/src/player/BitmapManager.cpp
index d1d3676..6151f1e 100644
--- a/src/graphics/BitmapManager.cpp
+++ b/src/player/BitmapManager.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -20,6 +20,7 @@
//
#include "BitmapManager.h"
+#include "IBitmapLoadedListener.h"
#ifdef WIN32
#include <io.h>
@@ -29,6 +30,7 @@
#include "../base/OSHelper.h"
+using namespace std;
namespace avg {
@@ -42,9 +44,9 @@ BitmapManager::BitmapManager()
m_pCmdQueue = BitmapManagerThread::CQueuePtr(new BitmapManagerThread::CQueue);
m_pMsgQueue = BitmapManagerMsgQueuePtr(new BitmapManagerMsgQueue(8));
- m_pBitmapManagerThread = new boost::thread(
- BitmapManagerThread(*m_pCmdQueue, *m_pMsgQueue));
-
+
+ startThreads(1);
+
s_pBitmapManager = this;
}
@@ -56,12 +58,7 @@ BitmapManager::~BitmapManager()
while (!m_pMsgQueue->empty()) {
m_pMsgQueue->pop();
}
- m_pCmdQueue->pushCmd(boost::bind(&BitmapManagerThread::stop, _1));
- if (m_pBitmapManagerThread) {
- m_pBitmapManagerThread->join();
- delete m_pBitmapManagerThread;
- }
-
+ stopThreads();
s_pBitmapManager = 0;
}
@@ -73,45 +70,78 @@ BitmapManager* BitmapManager::get()
return s_pBitmapManager;
}
+void BitmapManager::loadBitmapPy(const UTF8String& sUtf8FileName,
+ const boost::python::object& pyFunc, PixelFormat pf)
+{
+ std::string sFileName = convertUTF8ToFilename(sUtf8FileName);
+ BitmapManagerMsgPtr pMsg = BitmapManagerMsgPtr(
+ new BitmapManagerMsg(sUtf8FileName, pyFunc, pf));
+ internalLoadBitmap(pMsg);
+}
+
void BitmapManager::loadBitmap(const UTF8String& sUtf8FileName,
- const boost::python::object& pyFunc)
+ IBitmapLoadedListener* pLoadedListener, PixelFormat pf)
{
std::string sFileName = convertUTF8ToFilename(sUtf8FileName);
+ BitmapManagerMsgPtr pMsg = BitmapManagerMsgPtr(
+ new BitmapManagerMsg(sUtf8FileName, pLoadedListener, pf));
+ internalLoadBitmap(pMsg);
+}
+void BitmapManager::setNumThreads(int numThreads)
+{
+ stopThreads();
+ startThreads(numThreads);
+}
+
+void BitmapManager::onFrameEnd()
+{
+ while (!m_pMsgQueue->empty()) {
+ BitmapManagerMsgPtr pMsg = m_pMsgQueue->pop();
+ pMsg->executeCallback();
+ }
+}
+
+void BitmapManager::internalLoadBitmap(BitmapManagerMsgPtr pMsg)
+{
#ifdef WIN32
- int rc = _access(sFileName.c_str(), 04);
+ int rc = _access(pMsg->getFilename().c_str(), 04);
#else
- int rc = access(sFileName.c_str(), R_OK);
+ int rc = access(pMsg->getFilename().c_str(), R_OK);
#endif
- BitmapManagerMsgPtr msg = BitmapManagerMsgPtr(new BitmapManagerMsg());
- msg->setRequest(sUtf8FileName, pyFunc);
-
if (rc != 0) {
- msg->setError(Exception(AVG_ERR_FILEIO,
+ pMsg->setError(Exception(AVG_ERR_FILEIO,
std::string("BitmapManager can't open output file '") +
- sFileName + "'. Reason: " +
+ pMsg->getFilename() + "'. Reason: " +
strerror(errno)));
- m_pMsgQueue->push(msg);
+ m_pMsgQueue->push(pMsg);
} else {
- m_pCmdQueue->pushCmd(boost::bind(&BitmapManagerThread::loadBitmap, _1, msg));
+ m_pCmdQueue->pushCmd(boost::bind(&BitmapManagerThread::loadBitmap, _1, pMsg));
}
}
-void BitmapManager::onFrameEnd()
+void BitmapManager::startThreads(int numThreads)
{
- while (!m_pMsgQueue->empty()) {
- BitmapManagerMsgPtr pMsg = m_pMsgQueue->pop();
-
- try {
- pMsg->executeCallback();
- } catch (boost::python::error_already_set &) {
- std::cerr << "Python exception in execute callback." << std::endl;
- PyErr_Print();
- exit(5);
- }
+ for (int i=0; i<numThreads; ++i) {
+ boost::thread* pThread = new boost::thread(
+ BitmapManagerThread(*m_pCmdQueue, *m_pMsgQueue));
+ m_pBitmapManagerThreads.push_back(pThread);
}
}
+void BitmapManager::stopThreads()
+{
+ int numThreads = m_pBitmapManagerThreads.size();
+ for (int i=0; i<numThreads; ++i) {
+ m_pCmdQueue->pushCmd(boost::bind(&BitmapManagerThread::stop, _1));
+ }
+ for (int i=0; i<numThreads; ++i) {
+ boost::thread* pThread = m_pBitmapManagerThreads[i];
+ pThread->join();
+ delete pThread;
+ }
+ m_pBitmapManagerThreads.clear();
+}
}
diff --git a/src/graphics/BitmapManager.h b/src/player/BitmapManager.h
index 2599ba9..64f8ba5 100644
--- a/src/graphics/BitmapManager.h
+++ b/src/player/BitmapManager.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -26,12 +26,12 @@
#include "BitmapManagerMsg.h"
#include "../api.h"
-#include "Bitmap.h"
#include "../base/Queue.h"
#include "../base/IFrameEndListener.h"
#include <boost/thread.hpp>
+#include <vector>
namespace avg {
@@ -41,15 +41,22 @@ class AVG_API BitmapManager : public IFrameEndListener
BitmapManager();
~BitmapManager();
static BitmapManager* get();
+ void loadBitmapPy(const UTF8String& sUtf8FileName,
+ const boost::python::object& pyFunc, PixelFormat pf=NO_PIXELFORMAT);
void loadBitmap(const UTF8String& sUtf8FileName,
- const boost::python::object& pyFunc);
-
+ IBitmapLoadedListener* pLoadedListener, PixelFormat pf=NO_PIXELFORMAT);
+ void setNumThreads(int numThreads);
+
virtual void onFrameEnd();
private:
+ void internalLoadBitmap(BitmapManagerMsgPtr pMsg);
+ void startThreads(int numThreads);
+ void stopThreads();
+
static BitmapManager * s_pBitmapManager;
- boost::thread* m_pBitmapManagerThread;
+ std::vector<boost::thread*> m_pBitmapManagerThreads;
BitmapManagerThread::CQueuePtr m_pCmdQueue;
BitmapManagerMsgQueuePtr m_pMsgQueue;
};
diff --git a/src/graphics/BitmapManagerMsg.cpp b/src/player/BitmapManagerMsg.cpp
index 986c4c4..f9dfc53 100644
--- a/src/graphics/BitmapManagerMsg.cpp
+++ b/src/player/BitmapManagerMsg.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -20,18 +20,31 @@
//
#include "BitmapManagerMsg.h"
+#include "IBitmapLoadedListener.h"
#include "../base/ObjectCounter.h"
#include "../base/Exception.h"
+#include "../base/TimeSource.h"
namespace avg {
-BitmapManagerMsg::BitmapManagerMsg()
- : m_MsgType(NONE),
- m_pEx(0)
+BitmapManagerMsg::BitmapManagerMsg(const UTF8String& sFilename,
+ const boost::python::object& onLoadedCb, PixelFormat pf)
{
ObjectCounter::get()->incRef(&typeid(*this));
+ init(sFilename, pf);
+ m_OnLoadedCb = onLoadedCb;
+ m_pLoadedListener = 0;
+}
+
+BitmapManagerMsg::BitmapManagerMsg(const UTF8String& sFilename,
+ IBitmapLoadedListener* pLoadedListener, PixelFormat pf)
+{
+ ObjectCounter::get()->incRef(&typeid(*this));
+ init(sFilename, pf);
+ m_OnLoadedCb = boost::python::object();
+ m_pLoadedListener = pLoadedListener;
}
BitmapManagerMsg::~BitmapManagerMsg()
@@ -42,25 +55,31 @@ BitmapManagerMsg::~BitmapManagerMsg()
ObjectCounter::get()->decRef(&typeid(*this));
}
-void BitmapManagerMsg::setRequest(const UTF8String& sFilename,
- const boost::python::object& onLoadedCb)
+void BitmapManagerMsg::init(const UTF8String& sFilename, PixelFormat pf)
{
- AVG_ASSERT(m_MsgType == NONE);
m_sFilename = sFilename;
- m_OnLoadedCb = onLoadedCb;
+ m_StartTime = TimeSource::get()->getCurrentMicrosecs()/1000.0f;
+ m_PF = pf;
m_MsgType = REQUEST;
+ m_pEx = 0;
}
void BitmapManagerMsg::executeCallback()
{
- AVG_ASSERT(m_MsgType != NONE);
switch (m_MsgType) {
case BITMAP:
- boost::python::call<void>(m_OnLoadedCb.ptr(), m_pBmp);
+ if (m_pLoadedListener) {
+ m_pLoadedListener->onBitmapLoaded(m_pBmp);
+ } else {
+ boost::python::call<void>(m_OnLoadedCb.ptr(), m_pBmp);
+ }
break;
-
case ERROR:
- boost::python::call<void>(m_OnLoadedCb.ptr(), m_pEx);
+ if (m_pLoadedListener) {
+ m_pLoadedListener->onBitmapLoadError(m_pEx);
+ } else {
+ boost::python::call<void>(m_OnLoadedCb.ptr(), m_pEx);
+ }
break;
default:
@@ -70,10 +89,21 @@ void BitmapManagerMsg::executeCallback()
const UTF8String BitmapManagerMsg::getFilename()
{
- AVG_ASSERT(m_MsgType != NONE);
return m_sFilename;
}
+
+float BitmapManagerMsg::getStartTime()
+{
+ AVG_ASSERT(m_MsgType == REQUEST);
+ return m_StartTime;
+}
+PixelFormat BitmapManagerMsg::getPixelFormat()
+{
+ AVG_ASSERT(m_MsgType == REQUEST);
+ return m_PF;
+}
+
void BitmapManagerMsg::setBitmap(BitmapPtr pBmp)
{
AVG_ASSERT(m_MsgType == REQUEST);
diff --git a/src/graphics/BitmapManagerMsg.h b/src/player/BitmapManagerMsg.h
index 1a2ff38..47ba785 100644
--- a/src/graphics/BitmapManagerMsg.h
+++ b/src/player/BitmapManagerMsg.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -22,11 +22,11 @@
#ifndef _BitmapManagerMsg_H_
#define _BitmapManagerMsg_H_
-#include "../player/WrapPython.h"
+#include "WrapPython.h"
#include "../api.h"
#include "../base/Queue.h"
-#include "Bitmap.h"
+#include "../graphics/Bitmap.h"
#include <boost/shared_ptr.hpp>
#include <boost/python.hpp>
@@ -34,17 +34,24 @@
namespace avg {
+class IBitmapLoadedListener;
+
class AVG_API BitmapManagerMsg
{
public:
- enum MsgType {NONE, REQUEST, BITMAP, ERROR};
+ enum MsgType {REQUEST, BITMAP, ERROR};
- BitmapManagerMsg();
+ BitmapManagerMsg(const UTF8String& sFilename,
+ const boost::python::object& onLoadedCb, PixelFormat pf);
+ BitmapManagerMsg(const UTF8String& sFilename,
+ IBitmapLoadedListener* pLoadedListener, PixelFormat pf);
virtual ~BitmapManagerMsg();
+ void init(const UTF8String& sFilename, PixelFormat pf);
void executeCallback();
- void setRequest(const UTF8String& sFilename, const boost::python::object& onLoadedCb);
const UTF8String getFilename();
+ float getStartTime();
+ PixelFormat getPixelFormat();
void setBitmap(BitmapPtr pBmp);
void setError(const Exception& ex);
@@ -52,8 +59,11 @@ public:
private:
UTF8String m_sFilename;
+ float m_StartTime;
BitmapPtr m_pBmp;
boost::python::object m_OnLoadedCb;
+ IBitmapLoadedListener* m_pLoadedListener;
+ PixelFormat m_PF;
MsgType m_MsgType;
Exception* m_pEx;
};
diff --git a/src/graphics/BitmapManagerThread.cpp b/src/player/BitmapManagerThread.cpp
index fa84882..42372a6 100644
--- a/src/graphics/BitmapManagerThread.cpp
+++ b/src/player/BitmapManagerThread.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -21,20 +21,22 @@
#include "BitmapManagerThread.h"
-#include "Bitmap.h"
#include "../base/Exception.h"
+#include "../base/ScopeTimer.h"
+#include "../base/TimeSource.h"
+
+#include "../graphics/BitmapLoader.h"
#include <stdio.h>
#include <stdlib.h>
namespace avg {
-static ProfilingZoneID ProfilingZoneLoadBitmap("BitmapManager loadBitmap");
-
-BitmapManagerThread::BitmapManagerThread(CQueue& cmdQ,
- BitmapManagerMsgQueue& MsgQueue)
- : WorkerThread<BitmapManagerThread>("BitmapManager", cmdQ),
- m_MsgQueue(MsgQueue)
+BitmapManagerThread::BitmapManagerThread(CQueue& cmdQ, BitmapManagerMsgQueue& MsgQueue)
+ : WorkerThread<BitmapManagerThread>("BitmapManager", cmdQ),
+ m_MsgQueue(MsgQueue),
+ m_TotalLatency(0),
+ m_NumBmpsLoaded(0)
{
}
@@ -44,18 +46,33 @@ bool BitmapManagerThread::work()
return true;
}
+void BitmapManagerThread::deinit()
+{
+ if (m_NumBmpsLoaded > 0) {
+ AVG_TRACE(Logger::category::PROFILE, Logger::severity::INFO,
+ "Average latency for async bitmap loads: " << m_TotalLatency/m_NumBmpsLoaded
+ << " ms");
+ }
+}
+
+static ProfilingZoneID LoaderProfilingZone("loadBitmap", true);
+
void BitmapManagerThread::loadBitmap(BitmapManagerMsgPtr pRequest)
{
BitmapPtr pBmp;
-
+ ScopeTimer timer(LoaderProfilingZone);
+ float startTime = pRequest->getStartTime();
try {
- pBmp = BitmapPtr(new Bitmap(pRequest->getFilename()));
+ pBmp = avg::loadBitmap(pRequest->getFilename(), pRequest->getPixelFormat());
pRequest->setBitmap(pBmp);
} catch (const Exception& ex) {
pRequest->setError(ex);
}
-
m_MsgQueue.push(pRequest);
+ m_NumBmpsLoaded++;
+ float curLatency = TimeSource::get()->getCurrentMicrosecs()/1000 - startTime;
+ m_TotalLatency += curLatency;
+ ThreadProfiler::get()->reset();
}
}
diff --git a/src/graphics/BitmapManagerThread.h b/src/player/BitmapManagerThread.h
index af86be5..fbc5c56 100644
--- a/src/graphics/BitmapManagerThread.h
+++ b/src/player/BitmapManagerThread.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -27,7 +27,7 @@
#include "BitmapManagerMsg.h"
#include "../base/WorkerThread.h"
-#include "Bitmap.h"
+#include "../graphics/Bitmap.h"
#include <boost/thread.hpp>
@@ -43,7 +43,11 @@ class AVG_API BitmapManagerThread : public WorkerThread<BitmapManagerThread>
private:
virtual bool work();
+ virtual void deinit();
BitmapManagerMsgQueue& m_MsgQueue;
+
+ float m_TotalLatency;
+ int m_NumBmpsLoaded;
};
}
diff --git a/src/player/BlurFXNode.cpp b/src/player/BlurFXNode.cpp
index 3a0ad19..16583a8 100644
--- a/src/player/BlurFXNode.cpp
+++ b/src/player/BlurFXNode.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -23,7 +23,6 @@
#include "../base/ObjectCounter.h"
#include "../base/Exception.h"
-#include "../graphics/ShaderRegistry.h"
#include <string>
@@ -31,9 +30,9 @@ using namespace std;
namespace avg {
-BlurFXNode::BlurFXNode()
- : FXNode(),
- m_StdDev(1)
+BlurFXNode::BlurFXNode(float radius)
+ : FXNode(false),
+ m_StdDev(radius)
{
ObjectCounter::get()->incRef(&typeid(*this));
}
@@ -45,10 +44,6 @@ BlurFXNode::~BlurFXNode()
void BlurFXNode::connect()
{
- if (!GLTexture::isFloatFormatSupported()) {
- throw Exception(AVG_ERR_UNSUPPORTED,
- "Cannot create BlurFX: OpenGL configuration doesn't support Blur (no float textures).");
- }
setDirty();
FXNode::connect();
}
@@ -59,12 +54,7 @@ void BlurFXNode::disconnect()
FXNode::disconnect();
}
-void BlurFXNode::setParam(double stdDev)
-{
- setRadius(stdDev);
-}
-
-void BlurFXNode::setRadius(double stdDev)
+void BlurFXNode::setRadius(float stdDev)
{
m_StdDev = stdDev;
if (m_pFilter) {
@@ -73,7 +63,7 @@ void BlurFXNode::setRadius(double stdDev)
setDirty();
}
-double BlurFXNode::getRadius() const
+float BlurFXNode::getRadius() const
{
return m_StdDev;
}
diff --git a/src/player/BlurFXNode.h b/src/player/BlurFXNode.h
index 62eb535..24b5f8c 100644
--- a/src/player/BlurFXNode.h
+++ b/src/player/BlurFXNode.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -33,22 +33,21 @@ namespace avg {
class AVG_API BlurFXNode: public FXNode {
public:
- BlurFXNode();
+ BlurFXNode(float radius=1.f);
virtual ~BlurFXNode();
void connect();
virtual void disconnect();
- void setParam(double stdDev);
- void setRadius(double stdDev);
- double getRadius() const;
+ void setRadius(float stdDev);
+ float getRadius() const;
private:
virtual GPUFilterPtr createFilter(const IntPoint& size);
GPUBlurFilterPtr m_pFilter;
- double m_StdDev;
+ float m_StdDev;
};
typedef boost::shared_ptr<BlurFXNode> BlurFXNodePtr;
diff --git a/src/player/BoostPython.h b/src/player/BoostPython.h
index db1c0c5..6fdc141 100644
--- a/src/player/BoostPython.h
+++ b/src/player/BoostPython.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -28,6 +28,8 @@
#include "../api.h"
#include <boost/python.hpp>
+namespace py = boost::python;
+
#ifdef _WIN32
#pragma warning(pop)
#endif
diff --git a/src/player/CameraNode.cpp b/src/player/CameraNode.cpp
index 8f08dfa..c091a4e 100644
--- a/src/player/CameraNode.cpp
+++ b/src/player/CameraNode.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -21,7 +21,7 @@
#include "CameraNode.h"
#include "OGLSurface.h"
-#include "NodeDefinition.h"
+#include "TypeDefinition.h"
#include "../base/Logger.h"
#include "../base/Exception.h"
@@ -31,6 +31,7 @@
#include "../graphics/Filterfill.h"
#include "../graphics/TextureMover.h"
#include "../graphics/GLTexture.h"
+#include "../graphics/BitmapLoader.h"
#include "../imaging/Camera.h"
#include "../imaging/FWCamera.h"
@@ -46,15 +47,15 @@ using namespace std;
namespace avg {
-NodeDefinition CameraNode::createDefinition()
+void CameraNode::registerType()
{
- return NodeDefinition("camera", Node::buildNode<CameraNode>)
- .extendDefinition(RasterNode::createDefinition())
+ TypeDefinition def = TypeDefinition("camera", "rasternode",
+ ExportedObject::buildObject<CameraNode>)
.addArg(Arg<string>("driver", "firewire"))
.addArg(Arg<string>("device", ""))
.addArg(Arg<int>("unit", -1))
.addArg(Arg<bool>("fw800", false))
- .addArg(Arg<double>("framerate", 15))
+ .addArg(Arg<float>("framerate", 15))
.addArg(Arg<int>("capturewidth", 640))
.addArg(Arg<int>("captureheight", 480))
.addArg(Arg<string>("pixelformat", "RGB"))
@@ -66,6 +67,7 @@ NodeDefinition CameraNode::createDefinition()
.addArg(Arg<int>("shutter", -1))
.addArg(Arg<int>("gain", -1))
.addArg(Arg<int>("strobeduration", -1));
+ TypeRegistry::get()->registerType(def);
}
CameraNode::CameraNode(const ArgList& args)
@@ -79,7 +81,7 @@ CameraNode::CameraNode(const ArgList& args)
string sDevice = args.getArgVal<string>("device");
int unit = args.getArgVal<int>("unit");
bool bFW800 = args.getArgVal<bool>("fw800");
- double frameRate = args.getArgVal<double>("framerate");
+ float frameRate = args.getArgVal<float>("framerate");
int width = args.getArgVal<int>("capturewidth");
int height = args.getArgVal<int>("captureheight");
string sPF = args.getArgVal<string>("pixelformat");
@@ -90,7 +92,11 @@ CameraNode::CameraNode(const ArgList& args)
}
PixelFormat destPF;
if (pixelFormatIsColored(camPF)) {
- destPF = B8G8R8X8;
+ if (BitmapLoader::get()->isBlueFirst()) {
+ destPF = B8G8R8X8;
+ } else {
+ destPF = R8G8B8X8;
+ }
} else {
destPF = I8;
}
@@ -98,8 +104,8 @@ CameraNode::CameraNode(const ArgList& args)
m_pCamera = createCamera(sDriver, sDevice, unit, bFW800, IntPoint(width, height),
camPF, destPF, frameRate);
- AVG_TRACE(Logger::CONFIG, "Got Camera " << m_pCamera->getDevice() << " from driver: "
- << m_pCamera->getDriverName());
+ AVG_TRACE(Logger::category::CONFIG,Logger::severity::INFO, "Got Camera " <<
+ m_pCamera->getDevice() << " from driver: " << m_pCamera->getDriverName());
m_pCamera->setFeature(CAM_FEATURE_BRIGHTNESS, args.getArgVal<int>("brightness"));
m_pCamera->setFeature(CAM_FEATURE_EXPOSURE, args.getArgVal<int>("exposure"));
@@ -273,9 +279,10 @@ BitmapPtr CameraNode::getBitmap()
}
}
-void CameraNode::dumpCameras()
+CamerasInfosVector CameraNode::getCamerasInfos()
{
- avg::dumpCameras();
+ CamerasInfosVector camInfos = avg::getCamerasInfos();
+ return camInfos;
}
void CameraNode::resetFirewireBus()
@@ -283,7 +290,7 @@ void CameraNode::resetFirewireBus()
FWCamera::resetBus();
}
-double CameraNode::getFPS() const
+float CameraNode::getFPS() const
{
return m_pCamera->getFrameRate();
}
@@ -298,6 +305,7 @@ void CameraNode::open()
m_pTex = GLTexturePtr(new GLTexture(size, pf, bMipmap));
m_pTex->enableStreaming();
getSurface()->create(pf, m_pTex);
+ newSurface();
BitmapPtr pBmp = m_pTex->lockStreamingBmp();
if (pf == B8G8R8X8 || pf == B8G8R8A8) {
@@ -308,6 +316,7 @@ void CameraNode::open()
Filter.applyInPlace(pBmp);
}
m_pTex->unlockStreamingBmp(true);
+ setupFX(true);
}
int CameraNode::getFeature(CameraFeature feature) const
@@ -328,9 +337,10 @@ int CameraNode::getFrameNum() const
static ProfilingZoneID CameraFetchImage("Camera fetch image");
static ProfilingZoneID CameraDownloadProfilingZone("Camera tex download");
-void CameraNode::preRender()
+void CameraNode::preRender(const VertexArrayPtr& pVA, bool bIsParentActive,
+ float parentEffectiveOpacity)
{
- Node::preRender();
+ Node::preRender(pVA, bIsParentActive, parentEffectiveOpacity);
if (isAutoUpdateCameraImage()) {
ScopeTimer Timer(CameraFetchImage);
updateToLatestCameraImage();
@@ -346,19 +356,19 @@ void CameraNode::preRender()
AVG_ASSERT(pBmp->getPixelFormat() == m_pCurBmp->getPixelFormat());
pBmp->copyPixels(*m_pCurBmp);
m_pTex->unlockStreamingBmp(true);
- bind();
renderFX(getSize(), Pixel32(255, 255, 255, 255), false);
m_bNewBmp = false;
}
+ calcVertexArray(pVA);
}
static ProfilingZoneID CameraProfilingZone("Camera::render");
-void CameraNode::render(const DRect& rect)
+void CameraNode::render()
{
if (m_bIsPlaying) {
ScopeTimer Timer(CameraProfilingZone);
- blt32(getSize(), getEffectiveOpacity(), getBlendMode());
+ blt32(getTransform(), getSize(), getEffectiveOpacity(), getBlendMode());
}
}
@@ -381,7 +391,7 @@ void CameraNode::updateCameraImage()
{
if (!isAutoUpdateCameraImage()) {
m_pCurBmp = m_pCamera->getImage(false);
- blt32(getSize(), getEffectiveOpacity(), getBlendMode());
+ blt32(getTransform(), getSize(), getEffectiveOpacity(), getBlendMode());
}
}
diff --git a/src/player/CameraNode.h b/src/player/CameraNode.h
index 874593b..1aef572 100644
--- a/src/player/CameraNode.h
+++ b/src/player/CameraNode.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -28,6 +28,7 @@
#include "RasterNode.h"
#include "../imaging/Camera.h"
+#include "../imaging/CameraInfo.h"
#include <boost/thread/thread.hpp>
@@ -38,11 +39,12 @@ namespace avg {
class TextureMover;
typedef boost::shared_ptr<TextureMover> TextureMoverPtr;
+typedef std::vector<CameraInfo> CamerasInfosVector;
class AVG_API CameraNode : public RasterNode
{
public:
- static NodeDefinition createDefinition();
+ static void registerType();
CameraNode(const ArgList& args);
virtual ~CameraNode();
@@ -65,7 +67,7 @@ class AVG_API CameraNode : public RasterNode
return m_pCamera->getDriverName();
}
- double getFrameRate() const
+ float getFrameRate() const
{
return m_pCamera->getFrameRate();
}
@@ -94,21 +96,22 @@ class AVG_API CameraNode : public RasterNode
void setAutoUpdateCameraImage(bool bVal);
bool isImageAvailable() const;
- virtual void preRender();
- virtual void render(const DRect& Rect);
+ virtual void preRender(const VertexArrayPtr& pVA, bool bIsParentActive,
+ float parentEffectiveOpacity);
+ virtual void render();
int getFrameNum() const;
IntPoint getMediaSize();
virtual BitmapPtr getBitmap();
- static void dumpCameras();
+ static CamerasInfosVector getCamerasInfos();
static void resetFirewireBus();
private:
int getFeature (CameraFeature feature) const;
void setFeature (CameraFeature feature, int value);
- virtual double getFPS() const;
+ virtual float getFPS() const;
virtual void open();
virtual PixelFormat getPixelFormat();
void setFeature(int FeatureID);
diff --git a/src/player/Canvas.cpp b/src/player/Canvas.cpp
index 0a21f8a..ae0723e 100644
--- a/src/player/Canvas.cpp
+++ b/src/player/Canvas.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -30,6 +30,8 @@
#include "../base/Logger.h"
#include "../base/ScopeTimer.h"
+#include "../graphics/StandardShader.h"
+
#include <iostream>
using namespace std;
@@ -37,8 +39,6 @@ using namespace boost;
namespace avg {
-CanvasPtr Canvas::s_pActiveCanvas;
-
Canvas::Canvas(Player * pPlayer)
: m_pPlayer(pPlayer),
m_bIsPlaying(false),
@@ -57,8 +57,8 @@ void Canvas::setRoot(NodePtr pRootNode)
{
assert(!m_pRootNode);
m_pRootNode = dynamic_pointer_cast<CanvasNode>(pRootNode);
- m_pRootNode->setParent(DivNodeWeakPtr(), Node::NS_CONNECTED,
- shared_from_this());
+ CanvasPtr pThis = dynamic_pointer_cast<Canvas>(shared_from_this());
+ m_pRootNode->setParent(0, Node::NS_CONNECTED, pThis);
registerNode(m_pRootNode);
}
@@ -67,16 +67,20 @@ void Canvas::initPlayback(int multiSampleSamples)
m_bIsPlaying = true;
m_pRootNode->connectDisplay();
m_MultiSampleSamples = multiSampleSamples;
+ m_pVertexArray = VertexArrayPtr(new VertexArray(2000, 3000));
}
-void Canvas::stopPlayback()
+void Canvas::stopPlayback(bool bIsAbort)
{
if (m_bIsPlaying) {
- m_PlaybackEndSignal.emit();
+ if (!bIsAbort) {
+ m_PlaybackEndSignal.emit();
+ }
m_pRootNode->disconnect(true);
m_pRootNode = CanvasNodePtr();
m_IDMap.clear();
m_bIsPlaying = false;
+ m_pVertexArray = VertexArrayPtr();
}
}
@@ -85,7 +89,6 @@ NodePtr Canvas::getElementByID(const std::string& id)
if (m_IDMap.find(id) != m_IDMap.end()) {
return m_IDMap.find(id)->second;
} else {
- AVG_TRACE(Logger::WARNING, "getElementByID(\"" << id << "\") failed.");
return NodePtr();
}
}
@@ -138,25 +141,26 @@ static ProfilingZoneID RenderProfilingZone("Render");
void Canvas::doFrame(bool bPythonAvailable)
{
- s_pActiveCanvas = shared_from_this();
emitPreRenderSignal();
if (!m_pPlayer->isStopping()) {
ScopeTimer Timer(RenderProfilingZone);
+ Player::get()->startTraversingTree();
if (bPythonAvailable) {
Py_BEGIN_ALLOW_THREADS;
try {
- render();
+ renderTree();
} catch(...) {
Py_BLOCK_THREADS;
+ Player::get()->endTraversingTree();
throw;
}
Py_END_ALLOW_THREADS;
} else {
- render();
+ renderTree();
}
+ Player::get()->endTraversingTree();
}
emitFrameEndSignal();
- s_pActiveCanvas = CanvasPtr();
}
IntPoint Canvas::getSize() const
@@ -165,20 +169,20 @@ IntPoint Canvas::getSize() const
}
static ProfilingZoneID PushClipRectProfilingZone("pushClipRect");
-void Canvas::pushClipRect(VertexArrayPtr pVA)
+void Canvas::pushClipRect(const glm::mat4& transform, SubVertexArray& va)
{
ScopeTimer timer(PushClipRectProfilingZone);
m_ClipLevel++;
- clip(pVA, GL_INCR);
+ clip(transform, va, GL_INCR);
}
static ProfilingZoneID PopClipRectProfilingZone("popClipRect");
-void Canvas::popClipRect(VertexArrayPtr pVA)
+void Canvas::popClipRect(const glm::mat4& transform, SubVertexArray& va)
{
ScopeTimer timer(PopClipRectProfilingZone);
m_ClipLevel--;
- clip(pVA, GL_DECR);
+ clip(transform, va, GL_DECR);
}
void Canvas::registerPlaybackEndListener(IPlaybackEndListener* pListener)
@@ -211,102 +215,69 @@ void Canvas::unregisterPreRenderListener(IPreRenderListener* pListener)
m_PreRenderSignal.disconnect(pListener);
}
-bool Canvas::operator ==(const Canvas& other) const
-{
- return this == &other;
-}
-
-bool Canvas::operator !=(const Canvas& other) const
-{
- return this != &other;
-}
-
-long Canvas::getHash() const
-{
- return long(this);
-}
-
-CanvasPtr Canvas::getActive()
-{
- return s_pActiveCanvas;
-}
-
Player* Canvas::getPlayer() const
{
return m_pPlayer;
}
-vector<NodeWeakPtr> Canvas::getElementsByPos(const DPoint& pos) const
+vector<NodePtr> Canvas::getElementsByPos(const glm::vec2& pos) const
{
- vector<NodeWeakPtr> elements;
+ vector<NodePtr> elements;
m_pRootNode->getElementsByPos(pos, elements);
return elements;
}
static ProfilingZoneID PreRenderProfilingZone("PreRender");
+static ProfilingZoneID VATransferProfilingZone("VA Transfer");
-void Canvas::render(IntPoint windowSize, bool bUpsideDown, FBOPtr pFBO,
- ProfilingZoneID& renderProfilingZone)
+void Canvas::preRender()
{
+ ScopeTimer Timer(PreRenderProfilingZone);
+ m_pVertexArray->reset();
+ m_pRootNode->preRender(m_pVertexArray, true, 1.0f);
{
- ScopeTimer Timer(PreRenderProfilingZone);
- m_pRootNode->preRender();
- }
- if (pFBO) {
- pFBO->activate();
- } else {
- glproc::BindFramebuffer(GL_FRAMEBUFFER_EXT, 0);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "Canvas::render: BindFramebuffer()");
- }
- if (m_MultiSampleSamples > 1) {
- glEnable(GL_MULTISAMPLE);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL,
- "Canvas::render: glEnable(GL_MULTISAMPLE)");
- } else {
- glDisable(GL_MULTISAMPLE);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL,
- "Canvas::render: glDisable(GL_MULTISAMPLE)");
+ ScopeTimer Timer(VATransferProfilingZone);
+ m_pVertexArray->update();
}
- clearGLBuffers(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+}
+
+void Canvas::render(IntPoint windowSize, bool bOffscreen)
+{
+ clearGLBuffers(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT | GL_DEPTH_BUFFER_BIT,
+ !bOffscreen);
glViewport(0, 0, windowSize.x, windowSize.y);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "Canvas::render: glViewport()");
- glMatrixMode(GL_PROJECTION);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "Canvas::render: glMatrixMode()");
- glLoadIdentity();
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "Canvas::render: glLoadIdentity()");
- IntPoint size = IntPoint(m_pRootNode->getSize());
- if (bUpsideDown) {
- gluOrtho2D(0, size.x, 0, size.y);
+ GLContext::checkError("Canvas::render: glViewport()");
+ glm::vec2 size = m_pRootNode->getSize();
+ glm::mat4 projMat;
+ if (bOffscreen) {
+ projMat = glm::ortho(0.f, size.x, 0.f, size.y);
} else {
- gluOrtho2D(0, size.x, size.y, 0);
+ projMat = glm::ortho(0.f, size.x, size.y, 0.f);
}
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "Canvas::render: gluOrtho2D()");
-
- const DRect rc(0,0, size.x, size.y);
- glMatrixMode(GL_MODELVIEW);
- {
- ScopeTimer Timer(renderProfilingZone);
- m_pRootNode->maybeRender(rc);
+ m_pVertexArray->activate();
+ m_pRootNode->maybeRender(projMat);
- renderOutlines();
- }
+ renderOutlines(projMat);
}
-void Canvas::renderOutlines()
+void Canvas::renderOutlines(const glm::mat4& transform)
{
- GLContext* pContext = GLContext::getCurrent();
+ GLContext* pContext = GLContext::getMain();
VertexArrayPtr pVA(new VertexArray);
pContext->setBlendMode(GLContext::BLEND_BLEND, false);
m_pRootNode->renderOutlines(pVA, Pixel32(0,0,0,0));
- if (pVA->getCurVert() != 0) {
+ StandardShaderPtr pShader = pContext->getStandardShader();
+ pShader->setTransform(transform);
+ pShader->setUntextured();
+ pShader->setAlpha(0.5f);
+ pShader->activate();
+ if (pVA->getNumVerts() != 0) {
pVA->update();
- pContext->enableTexture(false);
- pContext->enableGLColorArray(true);
pVA->draw();
}
}
-void Canvas::clip(VertexArrayPtr pVA, GLenum stencilOp)
+void Canvas::clip(const glm::mat4& transform, SubVertexArray& va, GLenum stencilOp)
{
// Disable drawing to color buffer
glColorMask(0, 0, 0, 0);
@@ -318,7 +289,11 @@ void Canvas::clip(VertexArrayPtr pVA, GLenum stencilOp)
glStencilFunc(GL_ALWAYS, 0, 0);
glStencilOp(stencilOp, stencilOp, stencilOp);
- pVA->draw();
+ StandardShaderPtr pShader = GLContext::getMain()->getStandardShader();
+ pShader->setUntextured();
+ pShader->setTransform(transform);
+ pShader->activate();
+ va.draw();
// Set stencil test to only let
glStencilFunc(GL_LEQUAL, m_ClipLevel, ~0);
diff --git a/src/player/Canvas.h b/src/player/Canvas.h
index a5e30ac..38259a5 100644
--- a/src/player/Canvas.h
+++ b/src/player/Canvas.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -21,13 +21,16 @@
#ifndef _Canvas_H_
#define _Canvas_H_
-
+
#include "../api.h"
+#include "FontStyle.h"
+
#include "../base/IPlaybackEndListener.h"
#include "../base/IFrameEndListener.h"
#include "../base/IPreRenderListener.h"
#include "../base/Signal.h"
+#include "../base/GLMHelper.h"
#include "../graphics/OGLHelper.h"
#include "../graphics/Bitmap.h"
@@ -48,9 +51,9 @@ class ProfilingZoneID;
class Canvas;
class FBO;
class VertexArray;
+class SubVertexArray;
typedef boost::shared_ptr<Node> NodePtr;
-typedef boost::weak_ptr<Node> NodeWeakPtr;
typedef boost::shared_ptr<CanvasNode> CanvasNodePtr;
typedef boost::shared_ptr<FBO> FBOPtr;
typedef boost::shared_ptr<VertexArray> VertexArrayPtr;
@@ -59,14 +62,14 @@ class Canvas;
typedef boost::shared_ptr<Canvas> CanvasPtr;
typedef boost::weak_ptr<Canvas> CanvasWeakPtr;
-class AVG_API Canvas: public boost::enable_shared_from_this<Canvas>
+class AVG_API Canvas: public ExportedObject
{
public:
Canvas(Player * pPlayer);
virtual ~Canvas();
virtual void setRoot(NodePtr pRootNode);
void initPlayback(int multiSampleSamples);
- virtual void stopPlayback();
+ virtual void stopPlayback(bool bIsAbort);
CanvasNodePtr getRootNode() const;
NodePtr getElementByID(const std::string& id);
@@ -76,8 +79,8 @@ class AVG_API Canvas: public boost::enable_shared_from_this<Canvas>
virtual void doFrame(bool bPythonAvailable);
IntPoint getSize() const;
virtual BitmapPtr screenshot() const = 0;
- virtual void pushClipRect(VertexArrayPtr pVA);
- virtual void popClipRect(VertexArrayPtr pVA);
+ virtual void pushClipRect(const glm::mat4& transform, SubVertexArray& va);
+ virtual void popClipRect(const glm::mat4& transform, SubVertexArray& va);
void registerPlaybackEndListener(IPlaybackEndListener* pListener);
void unregisterPlaybackEndListener(IPlaybackEndListener* pListener);
@@ -86,30 +89,25 @@ class AVG_API Canvas: public boost::enable_shared_from_this<Canvas>
void registerPreRenderListener(IPreRenderListener* pListener);
void unregisterPreRenderListener(IPreRenderListener* pListener);
- std::vector<NodeWeakPtr> getElementsByPos(const DPoint& Pos) const;
-
- bool operator ==(const Canvas& other) const;
- bool operator !=(const Canvas& other) const;
- long getHash() const;
+ std::vector<NodePtr> getElementsByPos(const glm::vec2& Pos) const;
- static CanvasPtr getActive();
+ virtual void render(IntPoint windowSize, bool bOffscreen);
protected:
Player * getPlayer() const;
- void render(IntPoint windowSize, bool bUpsideDown, FBOPtr pFBO,
- ProfilingZoneID& renderProfilingZone);
+ void preRender();
void emitPreRenderSignal();
void emitFrameEndSignal();
-
private:
- virtual void render()=0;
- void renderOutlines();
+ virtual void renderTree()=0;
+ void renderOutlines(const glm::mat4& transform);
- void clip(VertexArrayPtr pVA, GLenum stencilOp);
+ void clip(const glm::mat4& transform, SubVertexArray& va, GLenum stencilOp);
Player * m_pPlayer;
CanvasNodePtr m_pRootNode;
bool m_bIsPlaying;
+ VertexArrayPtr m_pVertexArray;
typedef std::map<std::string, NodePtr> NodeIDMap;
NodeIDMap m_IDMap;
@@ -120,8 +118,6 @@ class AVG_API Canvas: public boost::enable_shared_from_this<Canvas>
int m_MultiSampleSamples;
int m_ClipLevel;
-
- static CanvasPtr s_pActiveCanvas;
};
}
diff --git a/src/player/CanvasNode.cpp b/src/player/CanvasNode.cpp
index cfa836e..3c267d3 100644
--- a/src/player/CanvasNode.cpp
+++ b/src/player/CanvasNode.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -22,7 +22,7 @@
#include "CanvasNode.h"
#include "Player.h"
-#include "NodeDefinition.h"
+#include "TypeDefinition.h"
#include "../base/FileHelper.h"
#include "../base/Exception.h"
@@ -31,17 +31,18 @@ using namespace std;
namespace avg {
-NodeDefinition CanvasNode::createDefinition()
+void CanvasNode::registerType()
{
- return NodeDefinition("canvasbase", Node::buildNode<CanvasNode>)
- .extendDefinition(DivNode::createDefinition());
+ TypeDefinition def = TypeDefinition("canvasbase", "div",
+ ExportedObject::buildObject<CanvasNode>);
+ TypeRegistry::get()->registerType(def);
}
CanvasNode::CanvasNode(const ArgList& args)
: DivNode(args)
{
args.setMembers(this);
- if (getSize() == DPoint(0, 0)) {
+ if (getSize() == glm::vec2(0, 0)) {
throw (Exception(AVG_ERR_OUT_OF_RANGE,
"<avg> and <canvas> node width and height attributes are mandatory."));
}
diff --git a/src/player/CanvasNode.h b/src/player/CanvasNode.h
index eaf361d..b336a4a 100644
--- a/src/player/CanvasNode.h
+++ b/src/player/CanvasNode.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -32,12 +32,13 @@ namespace avg {
class AVG_API CanvasNode : public DivNode
{
public:
- static NodeDefinition createDefinition();
+ static void registerType();
CanvasNode(const ArgList& args);
virtual ~CanvasNode();
virtual std::string getEffectiveMediaDir();
+
};
typedef boost::shared_ptr<CanvasNode> CanvasNodePtr;
diff --git a/src/player/ChromaKeyFXNode.cpp b/src/player/ChromaKeyFXNode.cpp
index f243ba2..4e70454 100644
--- a/src/player/ChromaKeyFXNode.cpp
+++ b/src/player/ChromaKeyFXNode.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -22,7 +22,6 @@
#include "ChromaKeyFXNode.h"
#include "../base/ObjectCounter.h"
-#include "../graphics/ShaderRegistry.h"
#include <string>
@@ -31,7 +30,7 @@ using namespace std;
namespace avg {
ChromaKeyFXNode::ChromaKeyFXNode()
- : FXNode(),
+ : FXNode(false),
m_sColorName("00FF00"),
m_Color(0, 255, 0),
m_HTolerance(0.0),
@@ -68,46 +67,46 @@ const std::string& ChromaKeyFXNode::getColor() const
return m_sColorName;
}
-void ChromaKeyFXNode::setHTolerance(double tolerance)
+void ChromaKeyFXNode::setHTolerance(float tolerance)
{
m_HTolerance = tolerance;
updateFilter();
}
-double ChromaKeyFXNode::getHTolerance() const
+float ChromaKeyFXNode::getHTolerance() const
{
return m_HTolerance;
}
-void ChromaKeyFXNode::setSTolerance(double tolerance)
+void ChromaKeyFXNode::setSTolerance(float tolerance)
{
m_STolerance = tolerance;
updateFilter();
}
-double ChromaKeyFXNode::getSTolerance() const
+float ChromaKeyFXNode::getSTolerance() const
{
return m_STolerance;
}
-void ChromaKeyFXNode::setLTolerance(double tolerance)
+void ChromaKeyFXNode::setLTolerance(float tolerance)
{
m_LTolerance = tolerance;
updateFilter();
}
-double ChromaKeyFXNode::getLTolerance() const
+float ChromaKeyFXNode::getLTolerance() const
{
return m_LTolerance;
}
-void ChromaKeyFXNode::setSoftness(double softness)
+void ChromaKeyFXNode::setSoftness(float softness)
{
m_Softness = softness;
updateFilter();
}
-double ChromaKeyFXNode::getSoftness() const
+float ChromaKeyFXNode::getSoftness() const
{
return m_Softness;
}
@@ -123,20 +122,20 @@ int ChromaKeyFXNode::getErosion() const
return m_Erosion;
}
-void ChromaKeyFXNode::setSpillThreshold(double spillThreshold)
+void ChromaKeyFXNode::setSpillThreshold(float spillThreshold)
{
m_SpillThreshold = spillThreshold;
updateFilter();
}
-double ChromaKeyFXNode::getSpillThreshold() const
+float ChromaKeyFXNode::getSpillThreshold() const
{
return m_SpillThreshold;
}
GPUFilterPtr ChromaKeyFXNode::createFilter(const IntPoint& size)
{
- m_pFilter = GPUChromaKeyFilterPtr(new GPUChromaKeyFilter(size, B8G8R8A8, false));
+ m_pFilter = GPUChromaKeyFilterPtr(new GPUChromaKeyFilter(size, false));
m_pFilter->setParams(m_Color, m_HTolerance, m_STolerance, m_LTolerance, m_Softness,
m_Erosion, m_SpillThreshold);
setDirty();
diff --git a/src/player/ChromaKeyFXNode.h b/src/player/ChromaKeyFXNode.h
index c8cbe33..3653448 100644
--- a/src/player/ChromaKeyFXNode.h
+++ b/src/player/ChromaKeyFXNode.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -40,18 +40,18 @@ public:
void setColor(const std::string& sColorName);
const std::string& getColor() const;
- void setHTolerance(double tolerance);
- double getHTolerance() const;
- void setSTolerance(double tolerance);
- double getSTolerance() const;
- void setLTolerance(double tolerance);
- double getLTolerance() const;
- void setSoftness(double softness);
- double getSoftness() const;
+ void setHTolerance(float tolerance);
+ float getHTolerance() const;
+ void setSTolerance(float tolerance);
+ float getSTolerance() const;
+ void setLTolerance(float tolerance);
+ float getLTolerance() const;
+ void setSoftness(float softness);
+ float getSoftness() const;
void setErosion(int erosion);
int getErosion() const;
- void setSpillThreshold(double spillThreshold);
- double getSpillThreshold() const;
+ void setSpillThreshold(float spillThreshold);
+ float getSpillThreshold() const;
private:
virtual GPUFilterPtr createFilter(const IntPoint& size);
@@ -61,12 +61,12 @@ private:
std::string m_sColorName;
Pixel32 m_Color;
- double m_HTolerance;
- double m_STolerance;
- double m_LTolerance;
- double m_Softness;
+ float m_HTolerance;
+ float m_STolerance;
+ float m_LTolerance;
+ float m_Softness;
int m_Erosion;
- double m_SpillThreshold;
+ float m_SpillThreshold;
};
typedef boost::shared_ptr<ChromaKeyFXNode> ChromaKeyFXNodePtr;
diff --git a/src/player/CircleNode.cpp b/src/player/CircleNode.cpp
index 1691d4d..8d00a8e 100644
--- a/src/player/CircleNode.cpp
+++ b/src/player/CircleNode.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -21,9 +21,10 @@
#include "CircleNode.h"
-#include "NodeDefinition.h"
+#include "TypeDefinition.h"
#include "../base/Exception.h"
+#include "../base/MathHelper.h"
#include <iostream>
#include <sstream>
@@ -32,15 +33,16 @@ using namespace std;
namespace avg {
-NodeDefinition CircleNode::createDefinition()
+void CircleNode::registerType()
{
- return NodeDefinition("circle", Node::buildNode<CircleNode>)
- .extendDefinition(FilledVectorNode::createDefinition())
- .addArg(Arg<DPoint>("pos", DPoint(0,0), false, offsetof(CircleNode, m_Pos)))
- .addArg(Arg<double>("r", 1, false, offsetof(CircleNode, m_Radius)))
- .addArg(Arg<double>("texcoord1", 0, false, offsetof(CircleNode, m_TC1)))
- .addArg(Arg<double>("texcoord2", 1, false, offsetof(CircleNode, m_TC2)))
+ TypeDefinition def = TypeDefinition("circle", "filledvectornode",
+ ExportedObject::buildObject<CircleNode>)
+ .addArg(Arg<glm::vec2>("pos", glm::vec2(0,0), false, offsetof(CircleNode, m_Pos)))
+ .addArg(Arg<float>("r", 1, false, offsetof(CircleNode, m_Radius)))
+ .addArg(Arg<float>("texcoord1", 0, false, offsetof(CircleNode, m_TC1)))
+ .addArg(Arg<float>("texcoord2", 1, false, offsetof(CircleNode, m_TC2)))
;
+ TypeRegistry::get()->registerType(def);
}
CircleNode::CircleNode(const ArgList& args)
@@ -53,23 +55,23 @@ CircleNode::~CircleNode()
{
}
-const DPoint& CircleNode::getPos() const
+const glm::vec2& CircleNode::getPos() const
{
return m_Pos;
}
-void CircleNode::setPos(const DPoint& pt)
+void CircleNode::setPos(const glm::vec2& pt)
{
m_Pos = pt;
setDrawNeeded();
}
-double CircleNode::getR() const
+float CircleNode::getR() const
{
return m_Radius;
}
-void CircleNode::setR(double r)
+void CircleNode::setR(float r)
{
if (int(r) <= 0) {
throw Exception(AVG_ERR_OUT_OF_RANGE, "Circle radius must be a positive number.");
@@ -78,189 +80,191 @@ void CircleNode::setR(double r)
setDrawNeeded();
}
-double CircleNode::getTexCoord1() const
+float CircleNode::getTexCoord1() const
{
return m_TC1;
}
-void CircleNode::setTexCoord1(double tc)
+void CircleNode::setTexCoord1(float tc)
{
m_TC1 = tc;
setDrawNeeded();
}
-double CircleNode::getTexCoord2() const
+float CircleNode::getTexCoord2() const
{
return m_TC2;
}
-void CircleNode::setTexCoord2(double tc)
+void CircleNode::setTexCoord2(float tc)
{
m_TC2 = tc;
setDrawNeeded();
}
-void CircleNode::getElementsByPos(const DPoint& pos, vector<NodeWeakPtr>& pElements)
+void CircleNode::getElementsByPos(const glm::vec2& pos, vector<NodePtr>& pElements)
{
- if (calcDist(pos, m_Pos) <= m_Radius && reactsToMouseEvents()) {
- pElements.push_back(shared_from_this());
+ if (glm::length(pos-m_Pos) <= m_Radius && reactsToMouseEvents()) {
+ pElements.push_back(getSharedThis());
}
}
-void CircleNode::calcVertexes(VertexArrayPtr& pVertexArray, Pixel32 color)
+void CircleNode::calcVertexes(const VertexDataPtr& pVertexData, Pixel32 color)
{
// TODO: This gets called whenever the circle position changes and is quite
// expensive. Should be optimized away.
- DPoint firstPt1 = getCirclePt(0, m_Radius+getStrokeWidth()/2)+m_Pos;
- DPoint firstPt2 = getCirclePt(0, m_Radius-getStrokeWidth()/2)+m_Pos;
+ glm::vec2 firstPt1 = getCirclePt(0, m_Radius+getStrokeWidth()/2)+m_Pos;
+ glm::vec2 firstPt2 = getCirclePt(0, m_Radius-getStrokeWidth()/2)+m_Pos;
int curVertex = 0;
- pVertexArray->appendPos(firstPt1, DPoint(m_TC1, 0), color);
- pVertexArray->appendPos(firstPt2, DPoint(m_TC1, 1), color);
- vector<DPoint> innerCircle;
+ pVertexData->appendPos(firstPt1, glm::vec2(m_TC1, 0), color);
+ pVertexData->appendPos(firstPt2, glm::vec2(m_TC1, 1), color);
+ vector<glm::vec2> innerCircle;
getEigthCirclePoints(innerCircle, m_Radius-getStrokeWidth()/2);
- vector<DPoint> outerCircle;
+ vector<glm::vec2> outerCircle;
getEigthCirclePoints(outerCircle, m_Radius+getStrokeWidth()/2);
- typedef vector<DPoint>::iterator DPointIt;
- typedef vector<DPoint>::reverse_iterator DPointRIt;
+ typedef vector<glm::vec2>::iterator Vec2It;
+ typedef vector<glm::vec2>::reverse_iterator Vec2RIt;
int i = 0;
- for (DPointIt iit = innerCircle.begin()+1, oit = outerCircle.begin()+1;
+ for (Vec2It iit = innerCircle.begin()+1, oit = outerCircle.begin()+1;
iit != innerCircle.end(); ++iit, ++oit)
{
- appendCirclePoint(pVertexArray, *iit, *oit, color, i, curVertex);
+ appendCirclePoint(pVertexData, *iit, *oit, color, i, curVertex);
}
- for (DPointRIt iit = innerCircle.rbegin()+1, oit = outerCircle.rbegin()+1;
+ for (Vec2RIt iit = innerCircle.rbegin()+1, oit = outerCircle.rbegin()+1;
iit != innerCircle.rend(); ++iit, ++oit)
{
- DPoint iPt = DPoint(-iit->y, -iit->x);
- DPoint oPt = DPoint(-oit->y, -oit->x);
- appendCirclePoint(pVertexArray, iPt, oPt, color, i, curVertex);
+ glm::vec2 iPt = glm::vec2(-iit->y, -iit->x);
+ glm::vec2 oPt = glm::vec2(-oit->y, -oit->x);
+ appendCirclePoint(pVertexData, iPt, oPt, color, i, curVertex);
}
- for (DPointIt iit = innerCircle.begin()+1, oit = outerCircle.begin()+1;
+ for (Vec2It iit = innerCircle.begin()+1, oit = outerCircle.begin()+1;
iit != innerCircle.end(); ++iit, ++oit)
{
- DPoint iPt = DPoint(-iit->y, iit->x);
- DPoint oPt = DPoint(-oit->y, oit->x);
- appendCirclePoint(pVertexArray, iPt, oPt, color, i, curVertex);
+ glm::vec2 iPt = glm::vec2(-iit->y, iit->x);
+ glm::vec2 oPt = glm::vec2(-oit->y, oit->x);
+ appendCirclePoint(pVertexData, iPt, oPt, color, i, curVertex);
}
- for (DPointRIt iit = innerCircle.rbegin()+1, oit = outerCircle.rbegin()+1;
+ for (Vec2RIt iit = innerCircle.rbegin()+1, oit = outerCircle.rbegin()+1;
iit !=innerCircle.rend(); ++iit, ++oit)
{
- DPoint iPt = DPoint(iit->x, -iit->y);
- DPoint oPt = DPoint(oit->x, -oit->y);
- appendCirclePoint(pVertexArray, iPt, oPt, color, i, curVertex);
+ glm::vec2 iPt = glm::vec2(iit->x, -iit->y);
+ glm::vec2 oPt = glm::vec2(oit->x, -oit->y);
+ appendCirclePoint(pVertexData, iPt, oPt, color, i, curVertex);
}
- for (DPointIt iit = innerCircle.begin()+1, oit = outerCircle.begin()+1;
+ for (Vec2It iit = innerCircle.begin()+1, oit = outerCircle.begin()+1;
iit != innerCircle.end(); ++iit, ++oit)
{
- DPoint iPt = DPoint(-iit->x, -iit->y);
- DPoint oPt = DPoint(-oit->x, -oit->y);
- appendCirclePoint(pVertexArray, iPt, oPt, color, i, curVertex);
+ glm::vec2 iPt = glm::vec2(-iit->x, -iit->y);
+ glm::vec2 oPt = glm::vec2(-oit->x, -oit->y);
+ appendCirclePoint(pVertexData, iPt, oPt, color, i, curVertex);
}
- for (DPointRIt iit = innerCircle.rbegin()+1, oit = outerCircle.rbegin()+1;
+ for (Vec2RIt iit = innerCircle.rbegin()+1, oit = outerCircle.rbegin()+1;
iit != innerCircle.rend(); ++iit, ++oit)
{
- DPoint iPt = DPoint(iit->y, iit->x);
- DPoint oPt = DPoint(oit->y, oit->x);
- appendCirclePoint(pVertexArray, iPt, oPt, color, i, curVertex);
+ glm::vec2 iPt = glm::vec2(iit->y, iit->x);
+ glm::vec2 oPt = glm::vec2(oit->y, oit->x);
+ appendCirclePoint(pVertexData, iPt, oPt, color, i, curVertex);
}
- for (DPointIt iit = innerCircle.begin()+1, oit = outerCircle.begin()+1;
+ for (Vec2It iit = innerCircle.begin()+1, oit = outerCircle.begin()+1;
iit != innerCircle.end(); ++iit, ++oit)
{
- DPoint iPt = DPoint(iit->y, -iit->x);
- DPoint oPt = DPoint(oit->y, -oit->x);
- appendCirclePoint(pVertexArray, iPt, oPt, color, i, curVertex);
+ glm::vec2 iPt = glm::vec2(iit->y, -iit->x);
+ glm::vec2 oPt = glm::vec2(oit->y, -oit->x);
+ appendCirclePoint(pVertexData, iPt, oPt, color, i, curVertex);
}
- for (DPointRIt iit = innerCircle.rbegin()+1, oit = outerCircle.rbegin()+1;
+ for (Vec2RIt iit = innerCircle.rbegin()+1, oit = outerCircle.rbegin()+1;
iit != innerCircle.rend(); ++iit, ++oit)
{
- DPoint iPt = DPoint(-iit->x, iit->y);
- DPoint oPt = DPoint(-oit->x, oit->y);
- appendCirclePoint(pVertexArray, iPt, oPt, color, i, curVertex);
+ glm::vec2 iPt = glm::vec2(-iit->x, iit->y);
+ glm::vec2 oPt = glm::vec2(-oit->x, oit->y);
+ appendCirclePoint(pVertexData, iPt, oPt, color, i, curVertex);
}
}
-void CircleNode::calcFillVertexes(VertexArrayPtr& pVertexArray, Pixel32 color)
+void CircleNode::calcFillVertexes(const VertexDataPtr& pVertexData, Pixel32 color)
{
- DPoint minPt = m_Pos-DPoint(m_Radius, m_Radius);
- DPoint maxPt = m_Pos+DPoint(m_Radius, m_Radius);
- DPoint centerTexCoord = calcFillTexCoord(m_Pos, minPt, maxPt);
- pVertexArray->appendPos(m_Pos, centerTexCoord, color);
+ glm::vec2 minPt = m_Pos-glm::vec2(m_Radius, m_Radius);
+ glm::vec2 maxPt = m_Pos+glm::vec2(m_Radius, m_Radius);
+ glm::vec2 centerTexCoord = calcFillTexCoord(m_Pos, minPt, maxPt);
+ pVertexData->appendPos(m_Pos, centerTexCoord, color);
int curVertex = 1;
- DPoint firstPt = getCirclePt(0, m_Radius)+m_Pos;
- DPoint firstTexCoord = calcFillTexCoord(firstPt, minPt, maxPt);
- pVertexArray->appendPos(firstPt, firstTexCoord, color);
- vector<DPoint> circlePoints;
+ glm::vec2 firstPt = getCirclePt(0, m_Radius)+m_Pos;
+ glm::vec2 firstTexCoord = calcFillTexCoord(firstPt, minPt, maxPt);
+ pVertexData->appendPos(firstPt, firstTexCoord, color);
+ vector<glm::vec2> circlePoints;
getEigthCirclePoints(circlePoints, m_Radius);
- for (vector<DPoint>::iterator it = circlePoints.begin()+1; it != circlePoints.end();
- ++it)
+ for (vector<glm::vec2>::iterator it = circlePoints.begin()+1;
+ it != circlePoints.end(); ++it)
{
- DPoint curPt = *it+m_Pos;
- appendFillCirclePoint(pVertexArray, curPt, minPt, maxPt, color, curVertex);
+ glm::vec2 curPt = *it+m_Pos;
+ appendFillCirclePoint(pVertexData, curPt, minPt, maxPt, color, curVertex);
}
- for (vector<DPoint>::reverse_iterator it = circlePoints.rbegin()+1;
+ for (vector<glm::vec2>::reverse_iterator it = circlePoints.rbegin()+1;
it != circlePoints.rend(); ++it)
{
- DPoint curPt = DPoint(-it->y, -it->x)+m_Pos;
- appendFillCirclePoint(pVertexArray, curPt, minPt, maxPt, color, curVertex);
+ glm::vec2 curPt = glm::vec2(-it->y, -it->x)+m_Pos;
+ appendFillCirclePoint(pVertexData, curPt, minPt, maxPt, color, curVertex);
}
- for (vector<DPoint>::iterator it = circlePoints.begin()+1; it != circlePoints.end();
- ++it)
+ for (vector<glm::vec2>::iterator it = circlePoints.begin()+1;
+ it != circlePoints.end(); ++it)
{
- DPoint curPt = DPoint(-it->y, it->x)+m_Pos;
- appendFillCirclePoint(pVertexArray, curPt, minPt, maxPt, color, curVertex);
+ glm::vec2 curPt = glm::vec2(-it->y, it->x)+m_Pos;
+ appendFillCirclePoint(pVertexData, curPt, minPt, maxPt, color, curVertex);
}
- for (vector<DPoint>::reverse_iterator it = circlePoints.rbegin()+1;
+ for (vector<glm::vec2>::reverse_iterator it = circlePoints.rbegin()+1;
it != circlePoints.rend(); ++it)
{
- DPoint curPt = DPoint(it->x, -it->y)+m_Pos;
- appendFillCirclePoint(pVertexArray, curPt, minPt, maxPt, color, curVertex);
+ glm::vec2 curPt = glm::vec2(it->x, -it->y)+m_Pos;
+ appendFillCirclePoint(pVertexData, curPt, minPt, maxPt, color, curVertex);
}
- for (vector<DPoint>::iterator it = circlePoints.begin()+1; it != circlePoints.end();
- ++it)
+ for (vector<glm::vec2>::iterator it = circlePoints.begin()+1;
+ it != circlePoints.end(); ++it)
{
- DPoint curPt = DPoint(-it->x, -it->y)+m_Pos;
- appendFillCirclePoint(pVertexArray, curPt, minPt, maxPt, color, curVertex);
+ glm::vec2 curPt = glm::vec2(-it->x, -it->y)+m_Pos;
+ appendFillCirclePoint(pVertexData, curPt, minPt, maxPt, color, curVertex);
}
- for (vector<DPoint>::reverse_iterator it = circlePoints.rbegin()+1;
+ for (vector<glm::vec2>::reverse_iterator it = circlePoints.rbegin()+1;
it != circlePoints.rend(); ++it)
{
- DPoint curPt = DPoint(it->y, it->x)+m_Pos;
- appendFillCirclePoint(pVertexArray, curPt, minPt, maxPt, color, curVertex);
+ glm::vec2 curPt = glm::vec2(it->y, it->x)+m_Pos;
+ appendFillCirclePoint(pVertexData, curPt, minPt, maxPt, color, curVertex);
}
- for (vector<DPoint>::iterator it = circlePoints.begin()+1; it != circlePoints.end();
- ++it)
+ for (vector<glm::vec2>::iterator it = circlePoints.begin()+1;
+ it != circlePoints.end(); ++it)
{
- DPoint curPt = DPoint(it->y, -it->x)+m_Pos;
- appendFillCirclePoint(pVertexArray, curPt, minPt, maxPt, color, curVertex);
+ glm::vec2 curPt = glm::vec2(it->y, -it->x)+m_Pos;
+ appendFillCirclePoint(pVertexData, curPt, minPt, maxPt, color, curVertex);
}
- for (vector<DPoint>::reverse_iterator it = circlePoints.rbegin()+1;
+ for (vector<glm::vec2>::reverse_iterator it = circlePoints.rbegin()+1;
it != circlePoints.rend(); ++it)
{
- DPoint curPt = DPoint(-it->x, it->y)+m_Pos;
- appendFillCirclePoint(pVertexArray, curPt, minPt, maxPt, color, curVertex);
+ glm::vec2 curPt = glm::vec2(-it->x, it->y)+m_Pos;
+ appendFillCirclePoint(pVertexData, curPt, minPt, maxPt, color, curVertex);
}
}
-void CircleNode::appendCirclePoint(VertexArrayPtr& pVertexArray, const DPoint& iPt,
- const DPoint& oPt, Pixel32 color, int& i, int& curVertex)
+void CircleNode::appendCirclePoint(const VertexDataPtr& pVertexData,
+ const glm::vec2& iPt, const glm::vec2& oPt, Pixel32 color, int& i,
+ int& curVertex)
{
i++;
- double ratio = (double(i)/getNumCircumferencePoints());
- double curTC = (1-ratio)*m_TC1+ratio*m_TC2;
- pVertexArray->appendPos(oPt+m_Pos, DPoint(curTC, 0), color);
- pVertexArray->appendPos(iPt+m_Pos, DPoint(curTC, 1), color);
- pVertexArray->appendQuadIndexes(curVertex+1, curVertex, curVertex+3, curVertex+2);
+ float ratio = (float(i)/getNumCircumferencePoints());
+ float curTC = (1-ratio)*m_TC1+ratio*m_TC2;
+ pVertexData->appendPos(oPt+m_Pos, glm::vec2(curTC, 0), color);
+ pVertexData->appendPos(iPt+m_Pos, glm::vec2(curTC, 1), color);
+ pVertexData->appendQuadIndexes(curVertex+1, curVertex, curVertex+3, curVertex+2);
curVertex += 2;
}
-void CircleNode::appendFillCirclePoint(VertexArrayPtr& pVertexArray, const DPoint& curPt,
- const DPoint& minPt, const DPoint& maxPt, Pixel32 color, int& curVertex)
+void CircleNode::appendFillCirclePoint(const VertexDataPtr& pVertexData,
+ const glm::vec2& curPt, const glm::vec2& minPt, const glm::vec2& maxPt,
+ Pixel32 color, int& curVertex)
{
- DPoint curTexCoord = calcFillTexCoord(curPt, minPt, maxPt);
- pVertexArray->appendPos(curPt, curTexCoord, color);
- pVertexArray->appendTriIndexes(0, curVertex, curVertex+1);
+ glm::vec2 curTexCoord = calcFillTexCoord(curPt, minPt, maxPt);
+ pVertexData->appendPos(curPt, curTexCoord, color);
+ pVertexData->appendTriIndexes(0, curVertex, curVertex+1);
curVertex++;
}
@@ -269,19 +273,19 @@ int CircleNode::getNumCircumferencePoints()
return int(ceil((m_Radius*3)/8)*8);
}
-void CircleNode::getEigthCirclePoints(vector<DPoint>& pts, double radius)
+void CircleNode::getEigthCirclePoints(vector<glm::vec2>& pts, float radius)
{
int numPts = getNumCircumferencePoints();
for (int i = 0; i <= numPts/8; ++i) {
- double ratio = (double(i)/numPts);
- double angle = ratio*2*3.14159;
+ float ratio = (float(i)/numPts);
+ float angle = ratio*2*PI;
pts.push_back(getCirclePt(angle, radius));
}
}
-DPoint CircleNode::getCirclePt(double angle, double radius)
+glm::vec2 CircleNode::getCirclePt(float angle, float radius)
{
- return DPoint(sin(angle)*radius, -cos(angle)*radius);
+ return glm::vec2(sin(angle)*radius, -cos(angle)*radius);
}
}
diff --git a/src/player/CircleNode.h b/src/player/CircleNode.h
index 10ce112..afc4160 100644
--- a/src/player/CircleNode.h
+++ b/src/player/CircleNode.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -32,41 +32,43 @@ namespace avg {
class AVG_API CircleNode : public FilledVectorNode
{
public:
- static NodeDefinition createDefinition();
+ static void registerType();
CircleNode(const ArgList& args);
virtual ~CircleNode();
- const DPoint& getPos() const;
- void setPos(const DPoint& pt);
+ const glm::vec2& getPos() const;
+ void setPos(const glm::vec2& pt);
- double getR() const;
- void setR(double r);
+ float getR() const;
+ void setR(float r);
- double getTexCoord1() const;
- void setTexCoord1(double tc);
+ float getTexCoord1() const;
+ void setTexCoord1(float tc);
- double getTexCoord2() const;
- void setTexCoord2(double tc);
+ float getTexCoord2() const;
+ void setTexCoord2(float tc);
- void getElementsByPos(const DPoint& pos, std::vector<NodeWeakPtr>& pElements);
- virtual void calcVertexes(VertexArrayPtr& pVertexArray, Pixel32 color);
- virtual void calcFillVertexes(VertexArrayPtr& pVertexArray, Pixel32 color);
+ void getElementsByPos(const glm::vec2& pos, std::vector<NodePtr>& pElements);
+ virtual void calcVertexes(const VertexDataPtr& pVertexData, Pixel32 color);
+ virtual void calcFillVertexes(const VertexDataPtr& pVertexData, Pixel32 color);
private:
- void appendCirclePoint(VertexArrayPtr& pVertexArray, const DPoint& iPt,
- const DPoint& oPt, Pixel32 color, int& i, int& curVertex);
- void appendFillCirclePoint(VertexArrayPtr& pVertexArray, const DPoint& curPt,
- const DPoint& minPt, const DPoint& maxPt, Pixel32 color, int& curVertex);
+ void appendCirclePoint(const VertexDataPtr& pVertexData, const glm::vec2& iPt,
+ const glm::vec2& oPt, Pixel32 color, int& i, int& curVertex);
+ void appendFillCirclePoint(const VertexDataPtr& pVertexData,
+ const glm::vec2& curPt, const glm::vec2& minPt, const glm::vec2& maxPt,
+ Pixel32 color, int& curVertex);
int getNumCircumferencePoints();
- void getEigthCirclePoints(std::vector<DPoint>& pts, double radius);
- DPoint getCirclePt(double angle, double radius);
- DPoint calcTexCoord(const DPoint& pt, const DPoint& minPt, const DPoint& maxPt);
+ void getEigthCirclePoints(std::vector<glm::vec2>& pts, float radius);
+ glm::vec2 getCirclePt(float angle, float radius);
+ glm::vec2 calcTexCoord(const glm::vec2& pt, const glm::vec2& minPt,
+ const glm::vec2& maxPt);
- DPoint m_Pos;
- double m_Radius;
- double m_TC1;
- double m_TC2;
+ glm::vec2 m_Pos;
+ float m_Radius;
+ float m_TC1;
+ float m_TC2;
};
}
diff --git a/src/player/Contact.cpp b/src/player/Contact.cpp
index a19abcc..b80615a 100644
--- a/src/player/Contact.cpp
+++ b/src/player/Contact.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -24,9 +24,11 @@
#include "CursorEvent.h"
#include "BoostPython.h"
#include "Player.h"
+#include "PublisherDefinition.h"
#include "../base/Exception.h"
#include "../base/StringHelper.h"
+#include "../base/Logger.h"
#include <iostream>
@@ -36,8 +38,16 @@ namespace avg {
int Contact::s_LastListenerID = 0;
+void Contact::registerType()
+{
+ PublisherDefinitionPtr pPubDef = PublisherDefinition::create("Contact");
+ pPubDef->addMessage("CURSOR_MOTION");
+ pPubDef->addMessage("CURSOR_UP");
+}
+
Contact::Contact(CursorEventPtr pEvent)
- : m_bSendingEvents(false),
+ : Publisher("Contact"),
+ m_bSendingEvents(false),
m_bCurListenerIsDead(false),
m_CursorID(pEvent->getCursorID()),
m_DistanceTravelled(0)
@@ -51,6 +61,7 @@ Contact::~Contact()
int Contact::connectListener(PyObject* pMotionCallback, PyObject* pUpCallback)
{
+ avgDeprecationWarning("1.8", "Contact.connectListener()", "Contact.subscribe()");
s_LastListenerID++;
pair<int, Listener> val =
pair<int, Listener>(s_LastListenerID, Listener(pMotionCallback, pUpCallback));
@@ -60,6 +71,8 @@ int Contact::connectListener(PyObject* pMotionCallback, PyObject* pUpCallback)
void Contact::disconnectListener(int id)
{
+ avgDeprecationWarning("1.8", "Contact.disconnectListener()",
+ "Contact.unsubscribe()");
map<int, Listener>::iterator it = m_ListenerMap.find(id);
if (it == m_ListenerMap.end() || (m_CurListenerID == id && m_bCurListenerIsDead)) {
throw Exception(AVG_ERR_INVALID_ARGS,
@@ -77,27 +90,27 @@ long long Contact::getAge() const
return m_Events.back()->getWhen() - m_Events[0]->getWhen();
}
-double Contact::getDistanceFromStart() const
+float Contact::getDistanceFromStart() const
{
- return getMotionVec().getNorm();
+ return glm::length(getMotionVec());
}
-double Contact::getMotionAngle() const
+float Contact::getMotionAngle() const
{
- DPoint motion = getMotionVec();
- if (motion == DPoint(0,0)) {
+ glm::vec2 motion = getMotionVec();
+ if (motion == glm::vec2(0,0)) {
return 0;
} else {
- return motion.getAngle();
+ return getAngle(motion);
}
}
-DPoint Contact::getMotionVec() const
+glm::vec2 Contact::getMotionVec() const
{
return m_Events.back()->getPos() - m_Events[0]->getPos();
}
-double Contact::getDistanceTravelled() const
+float Contact::getDistanceTravelled() const
{
return m_DistanceTravelled;
}
@@ -110,24 +123,31 @@ vector<CursorEventPtr> Contact::getEvents() const
void Contact::addEvent(CursorEventPtr pEvent)
{
pEvent->setCursorID(m_CursorID);
- pEvent->setContact(shared_from_this());
+ pEvent->setContact(boost::dynamic_pointer_cast<Contact>(shared_from_this()));
calcSpeed(pEvent, m_Events.back());
updateDistanceTravelled(m_Events.back(), pEvent);
m_Events.back()->removeBlob();
+ m_Events.back()->setNode(NodePtr());
m_Events.push_back(pEvent);
}
-bool Contact::hasListeners() const
-{
- return !(m_ListenerMap.empty() ||
- (m_ListenerMap.size() == 1 && m_bCurListenerIsDead));
-}
-
void Contact::sendEventToListeners(CursorEventPtr pCursorEvent)
{
+ switch (pCursorEvent->getType()) {
+ case Event::CURSOR_DOWN:
+ break;
+ case Event::CURSOR_MOTION:
+ notifySubscribers("CURSOR_MOTION", pCursorEvent);
+ break;
+ case Event::CURSOR_UP:
+ notifySubscribers("CURSOR_UP", pCursorEvent);
+ removeSubscribers();
+ break;
+ default:
+ AVG_ASSERT_MSG(false, pCursorEvent->typeStr().c_str());
+ }
m_bSendingEvents = true;
AVG_ASSERT(pCursorEvent->getContact() == shared_from_this());
- EventPtr pEvent = boost::dynamic_pointer_cast<Event>(pCursorEvent);
m_bCurListenerIsDead = false;
for (map<int, Listener>::iterator it = m_ListenerMap.begin();
it != m_ListenerMap.end();)
@@ -136,14 +156,14 @@ void Contact::sendEventToListeners(CursorEventPtr pCursorEvent)
m_CurListenerID = it->first;
m_bCurListenerIsDead = false;
switch (pCursorEvent->getType()) {
- case Event::CURSORMOTION:
+ case Event::CURSOR_MOTION:
if (listener.m_pMotionCallback != Py_None) {
- boost::python::call<void>(listener.m_pMotionCallback, pEvent);
+ py::call<void>(listener.m_pMotionCallback, pCursorEvent);
}
break;
- case Event::CURSORUP:
+ case Event::CURSOR_UP:
if (listener.m_pUpCallback != Py_None) {
- boost::python::call<void>(listener.m_pUpCallback, pEvent);
+ py::call<void>(listener.m_pUpCallback, pCursorEvent);
}
break;
default:
@@ -164,36 +184,20 @@ int Contact::getID() const
return m_CursorID;
}
-bool Contact::operator ==(const Contact& other) const
-{
- return (shared_from_this() == other.shared_from_this());
-}
-
-bool Contact::operator !=(const Contact& other) const
-{
- return (shared_from_this() != other.shared_from_this());
-}
-
-long Contact::getHash() const
-{
- return long(&*shared_from_this());
-
-}
-
void Contact::calcSpeed(CursorEventPtr pEvent, CursorEventPtr pOldEvent)
{
- if (pEvent->getSpeed() == DPoint(0,0)) {
- DPoint posDiff = pEvent->getPos() - pOldEvent->getPos();
+ if (pEvent->getSpeed() == glm::vec2(0,0)) {
+ glm::vec2 posDiff = pEvent->getPos() - pOldEvent->getPos();
long long timeDiff = pEvent->getWhen() - pOldEvent->getWhen();
if (timeDiff != 0) {
- pEvent->setSpeed(posDiff/double(timeDiff));
+ pEvent->setSpeed(posDiff/float(timeDiff));
}
}
}
void Contact::updateDistanceTravelled(CursorEventPtr pEvent1, CursorEventPtr pEvent2)
{
- double dist = (pEvent2->getPos() - pEvent1->getPos()).getNorm();
+ float dist = glm::length(pEvent2->getPos() - pEvent1->getPos());
m_DistanceTravelled += dist;
}
diff --git a/src/player/Contact.h b/src/player/Contact.h
index 922dff8..846b422 100644
--- a/src/player/Contact.h
+++ b/src/player/Contact.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -22,7 +22,9 @@
#ifndef _Contact_H_
#define _Contact_H_
-#include "../base/Point.h"
+#include "Publisher.h"
+
+#include "../base/GLMHelper.h"
#include <boost/shared_ptr.hpp>
#include <boost/weak_ptr.hpp>
@@ -41,10 +43,10 @@ class CursorEvent;
typedef boost::shared_ptr<class CursorEvent> CursorEventPtr;
class Contact;
typedef boost::shared_ptr<class Contact> ContactPtr;
-//typedef boost::weak_ptr<class Contact> ContactWeakPtr;
-class AVG_API Contact: public boost::enable_shared_from_this<Contact> {
+class AVG_API Contact: public Publisher {
public:
+ static void registerType();
Contact(CursorEventPtr pEvent);
virtual ~Contact();
@@ -52,22 +54,17 @@ public:
void disconnectListener(int id);
long long getAge() const;
- double getDistanceFromStart() const;
- double getMotionAngle() const;
- DPoint getMotionVec() const;
- double getDistanceTravelled() const;
+ float getDistanceFromStart() const;
+ float getMotionAngle() const;
+ glm::vec2 getMotionVec() const;
+ float getDistanceTravelled() const;
std::vector<CursorEventPtr> getEvents() const;
void addEvent(CursorEventPtr pEvent);
- bool hasListeners() const;
void sendEventToListeners(CursorEventPtr pCursorEvent);
int getID() const;
- bool operator ==(const Contact& other) const;
- bool operator !=(const Contact& other) const;
- long getHash() const;
-
private:
void calcSpeed(CursorEventPtr pEvent, CursorEventPtr pOldEvent);
void updateDistanceTravelled(CursorEventPtr pEvent1, CursorEventPtr pEvent2);
@@ -91,7 +88,7 @@ private:
int m_CurListenerID;
bool m_bCurListenerIsDead;
int m_CursorID;
- double m_DistanceTravelled;
+ float m_DistanceTravelled;
};
}
diff --git a/src/player/CursorEvent.cpp b/src/player/CursorEvent.cpp
index df71c5c..ee4ba92 100644
--- a/src/player/CursorEvent.cpp
+++ b/src/player/CursorEvent.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -55,14 +55,14 @@ CursorEventPtr CursorEvent::cloneAs(Type eventType) const
return pClone;
}
-void CursorEvent::setPos(const DPoint& pos)
+void CursorEvent::setPos(const glm::vec2& pos)
{
m_Position = IntPoint(pos);
}
-DPoint CursorEvent::getPos() const
+glm::vec2 CursorEvent::getPos() const
{
- return DPoint(m_Position);
+ return glm::vec2(m_Position);
}
int CursorEvent::getXPosition() const
@@ -92,15 +92,15 @@ void CursorEvent::setNode(NodePtr pNode)
NodePtr CursorEvent::getNode() const
{
- return m_pNode.lock();
+ return m_pNode;
}
-void CursorEvent::setSpeed(DPoint speed)
+void CursorEvent::setSpeed(glm::vec2 speed)
{
m_Speed = speed;
}
-const DPoint& CursorEvent::getSpeed() const
+const glm::vec2& CursorEvent::getSpeed() const
{
return m_Speed;
}
@@ -124,10 +124,11 @@ bool operator ==(const CursorEvent& event1, const CursorEvent& event2)
void CursorEvent::trace()
{
string sType = typeStr();
- if (m_pNode.expired()) {
- AVG_TRACE(Logger::EVENTS, sType);
+ if (!m_pNode) {
+ AVG_TRACE(Logger::category::EVENTS, Logger::severity::DEBUG, sType);
} else {
- AVG_TRACE(Logger::EVENTS, m_pNode.lock()->getID()+", "+sType);
+ AVG_TRACE(Logger::category::EVENTS, Logger::severity::DEBUG,
+ m_pNode->getID()+", "+sType);
}
}
diff --git a/src/player/CursorEvent.h b/src/player/CursorEvent.h
index 5c6e699..e84272a 100644
--- a/src/player/CursorEvent.h
+++ b/src/player/CursorEvent.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -27,7 +27,7 @@
#include "../api.h"
#include "Event.h"
-#include "../base/Point.h"
+#include "../base/GLMHelper.h"
#include <boost/shared_ptr.hpp>
#include <boost/weak_ptr.hpp>
@@ -54,16 +54,16 @@ class AVG_API CursorEvent: public Event
int when=-1);
virtual ~CursorEvent();
virtual CursorEventPtr cloneAs(Type eventType) const;
- void setPos(const DPoint& pos);
- DPoint getPos() const;
+ void setPos(const glm::vec2& pos);
+ glm::vec2 getPos() const;
int getXPosition() const;
int getYPosition() const;
void setCursorID(int id);
int getCursorID() const;
void setNode(NodePtr pNode);
NodePtr getNode() const;
- void setSpeed(DPoint speed);
- virtual const DPoint& getSpeed() const;
+ void setSpeed(glm::vec2 speed);
+ virtual const glm::vec2& getSpeed() const;
void setContact(ContactPtr pContact);
ContactPtr getContact() const;
@@ -76,8 +76,8 @@ class AVG_API CursorEvent: public Event
IntPoint m_Position;
int m_ID;
ContactWeakPtr m_pContact;
- NodeWeakPtr m_pNode;
- DPoint m_Speed;
+ NodePtr m_pNode;
+ glm::vec2 m_Speed;
};
bool operator ==(const CursorEvent& event1, const CursorEvent& event2);
diff --git a/src/player/CursorState.cpp b/src/player/CursorState.cpp
index d1f52bb..4408946 100644
--- a/src/player/CursorState.cpp
+++ b/src/player/CursorState.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -27,7 +27,7 @@ using namespace std;
namespace avg {
CursorState::CursorState(const CursorEventPtr pEvent,
- const vector<NodeWeakPtr>& pNodes)
+ const vector<NodePtr>& pNodes)
: m_pNodes(pNodes)
{
m_pLastEvent = pEvent;
@@ -38,13 +38,13 @@ CursorState::~CursorState()
}
void CursorState::setInfo(const CursorEventPtr pEvent,
- const vector<NodeWeakPtr>& pNodes)
+ const vector<NodePtr>& pNodes)
{
m_pLastEvent = pEvent;
m_pNodes = pNodes;
}
-const vector<NodeWeakPtr>& CursorState::getNodes() const
+const vector<NodePtr>& CursorState::getNodes() const
{
return m_pNodes;
}
diff --git a/src/player/CursorState.h b/src/player/CursorState.h
index b9d7693..8cec4c7 100644
--- a/src/player/CursorState.h
+++ b/src/player/CursorState.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -30,23 +30,23 @@
namespace avg {
class Node;
-typedef boost::weak_ptr<Node> NodeWeakPtr;
+typedef boost::shared_ptr<Node> NodePtr;
class CursorEvent;
typedef boost::shared_ptr<CursorEvent> CursorEventPtr;
class AVG_API CursorState {
public:
- CursorState(const CursorEventPtr pEvent, const std::vector<NodeWeakPtr>& pNodes);
+ CursorState(const CursorEventPtr pEvent, const std::vector<NodePtr>& pNodes);
~CursorState();
- void setInfo(const CursorEventPtr pEvent, const std::vector<NodeWeakPtr>& pNodes);
- const std::vector<NodeWeakPtr>& getNodes() const;
+ void setInfo(const CursorEventPtr pEvent, const std::vector<NodePtr>& pNodes);
+ const std::vector<NodePtr>& getNodes() const;
CursorEventPtr getLastEvent() const;
private:
CursorState(const CursorState&);
- std::vector<NodeWeakPtr> m_pNodes;
+ std::vector<NodePtr> m_pNodes;
CursorEventPtr m_pLastEvent;
};
diff --git a/src/player/CurveNode.cpp b/src/player/CurveNode.cpp
index adaabe5..7a685f5 100644
--- a/src/player/CurveNode.cpp
+++ b/src/player/CurveNode.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -21,7 +21,7 @@
#include "CurveNode.h"
-#include "NodeDefinition.h"
+#include "TypeDefinition.h"
#include "../graphics/VertexArray.h"
#include "../base/Exception.h"
@@ -37,16 +37,17 @@ using namespace std;
namespace avg {
-NodeDefinition CurveNode::createDefinition()
+void CurveNode::registerType()
{
- return NodeDefinition("curve", Node::buildNode<CurveNode>)
- .extendDefinition(VectorNode::createDefinition())
- .addArg(Arg<DPoint>("pos1", DPoint(0,0), false, offsetof(CurveNode, m_P1)))
- .addArg(Arg<DPoint>("pos2", DPoint(0,0), false, offsetof(CurveNode, m_P2)))
- .addArg(Arg<DPoint>("pos3", DPoint(0,0), false, offsetof(CurveNode, m_P3)))
- .addArg(Arg<DPoint>("pos4", DPoint(0,0), false, offsetof(CurveNode, m_P4)))
- .addArg(Arg<double>("texcoord1", 0, true, offsetof(CurveNode, m_TC1)))
- .addArg(Arg<double>("texcoord2", 1, true, offsetof(CurveNode, m_TC2)));
+ TypeDefinition def = TypeDefinition("curve", "vectornode",
+ ExportedObject::buildObject<CurveNode>)
+ .addArg(Arg<glm::vec2>("pos1", glm::vec2(0,0), false, offsetof(CurveNode, m_P1)))
+ .addArg(Arg<glm::vec2>("pos2", glm::vec2(0,0), false, offsetof(CurveNode, m_P2)))
+ .addArg(Arg<glm::vec2>("pos3", glm::vec2(0,0), false, offsetof(CurveNode, m_P3)))
+ .addArg(Arg<glm::vec2>("pos4", glm::vec2(0,0), false, offsetof(CurveNode, m_P4)))
+ .addArg(Arg<float>("texcoord1", 0, true, offsetof(CurveNode, m_TC1)))
+ .addArg(Arg<float>("texcoord2", 1, true, offsetof(CurveNode, m_TC2)));
+ TypeRegistry::get()->registerType(def);
}
CurveNode::CurveNode(const ArgList& args)
@@ -59,118 +60,122 @@ CurveNode::~CurveNode()
{
}
-const DPoint& CurveNode::getPos1() const
+const glm::vec2& CurveNode::getPos1() const
{
return m_P1;
}
-void CurveNode::setPos1(const DPoint& pt)
+void CurveNode::setPos1(const glm::vec2& pt)
{
m_P1 = pt;
setDrawNeeded();
}
-const DPoint& CurveNode::getPos2() const
+const glm::vec2& CurveNode::getPos2() const
{
return m_P2;
}
-void CurveNode::setPos2(const DPoint& pt)
+void CurveNode::setPos2(const glm::vec2& pt)
{
m_P2 = pt;
setDrawNeeded();
}
-const DPoint& CurveNode::getPos3() const
+const glm::vec2& CurveNode::getPos3() const
{
return m_P3;
}
-void CurveNode::setPos3(const DPoint& pt)
+void CurveNode::setPos3(const glm::vec2& pt)
{
m_P3 = pt;
setDrawNeeded();
}
-const DPoint& CurveNode::getPos4() const
+const glm::vec2& CurveNode::getPos4() const
{
return m_P4;
}
-void CurveNode::setPos4(const DPoint& pt)
+void CurveNode::setPos4(const glm::vec2& pt)
{
m_P4 = pt;
setDrawNeeded();
}
-double CurveNode::getTexCoord1() const
+float CurveNode::getTexCoord1() const
{
return m_TC1;
}
-void CurveNode::setTexCoord1(double tc)
+void CurveNode::setTexCoord1(float tc)
{
m_TC1 = tc;
setDrawNeeded();
}
-double CurveNode::getTexCoord2() const
+float CurveNode::getTexCoord2() const
{
return m_TC2;
}
-void CurveNode::setTexCoord2(double tc)
+void CurveNode::setTexCoord2(float tc)
{
m_TC2 = tc;
setDrawNeeded();
}
+
+int CurveNode::getCurveLen() const
+{
+ // Calc. upper bound for spline length.
+ float curveLen = glm::length(m_P2-m_P1) + glm::length(m_P3 - m_P2)
+ + glm::length(m_P4-m_P3);
+ return int(curveLen);
+}
-void CurveNode::calcVertexes(VertexArrayPtr& pVertexArray, Pixel32 color)
+glm::vec2 CurveNode::getPtOnCurve(float t) const
{
- updateLines();
-
- pVertexArray->appendPos(m_LeftCurve[0], DPoint(m_TC1,1), color);
- pVertexArray->appendPos(m_RightCurve[0], DPoint(m_TC2,0), color);
- for (unsigned i = 0; i < m_LeftCurve.size()-1; ++i) {
- double ratio = i/double(m_LeftCurve.size());
- double tc = (1-ratio)*m_TC1+ratio*m_TC2;
- pVertexArray->appendPos(m_LeftCurve[i+1], DPoint(tc,1), color);
- pVertexArray->appendPos(m_RightCurve[i+1], DPoint(tc,0), color);
- pVertexArray->appendQuadIndexes((i+1)*2, i*2, (i+1)*2+1, i*2+1);
- }
+ BezierCurve curve(m_P1, m_P2, m_P3, m_P4);
+ return curve.interpolate(t);
}
-int CurveNode::getCurveLen()
+void CurveNode::calcVertexes(const VertexDataPtr& pVertexData, Pixel32 color)
{
- // Calc. upper bound for spline length.
- double curveLen = calcDist(m_P2,m_P1)+calcDist(m_P3,m_P2)+calcDist(m_P4,m_P3);
- if (curveLen > 50000) {
- throw Exception(AVG_ERR_OUT_OF_RANGE, "Illegal points in curve.");
+ updateLines();
+
+ pVertexData->appendPos(m_LeftCurve[0], glm::vec2(m_TC1,1), color);
+ pVertexData->appendPos(m_RightCurve[0], glm::vec2(m_TC2,0), color);
+ for (unsigned i = 0; i < m_LeftCurve.size()-1; ++i) {
+ float ratio = i/float(m_LeftCurve.size());
+ float tc = (1-ratio)*m_TC1+ratio*m_TC2;
+ pVertexData->appendPos(m_LeftCurve[i+1], glm::vec2(tc,1), color);
+ pVertexData->appendPos(m_RightCurve[i+1], glm::vec2(tc,0), color);
+ pVertexData->appendQuadIndexes((i+1)*2, i*2, (i+1)*2+1, i*2+1);
}
- return int(curveLen);
}
void CurveNode::updateLines()
{
BezierCurve curve(m_P1, m_P2, m_P3, m_P4);
- double len = getCurveLen();
+ float len = float(getCurveLen());
m_LeftCurve.clear();
m_RightCurve.clear();
- m_LeftCurve.reserve(int(len+1.5));
- m_RightCurve.reserve(int(len+1.5));
+ m_LeftCurve.reserve(int(len+1.5f));
+ m_RightCurve.reserve(int(len+1.5f));
for (unsigned i = 0; i < len; ++i) {
- double t = i/len;
+ float t = i/len;
addLRCurvePoint(curve.interpolate(t), curve.getDeriv(t));
}
addLRCurvePoint(curve.interpolate(1), curve.getDeriv(1));
}
-void CurveNode::addLRCurvePoint(const DPoint& pos, const DPoint& deriv)
+void CurveNode::addLRCurvePoint(const glm::vec2& pos, const glm::vec2& deriv)
{
- DPoint m = deriv.getNormalized();
- DPoint w = DPoint(m.y, -m.x)*getStrokeWidth()/2;
+ glm::vec2 m = glm::normalize(deriv);
+ glm::vec2 w = glm::vec2(m.y, -m.x)*float(getStrokeWidth()/2);
m_LeftCurve.push_back(pos-w);
m_RightCurve.push_back(pos+w);
}
diff --git a/src/player/CurveNode.h b/src/player/CurveNode.h
index 0a93292..45efc05 100644
--- a/src/player/CurveNode.h
+++ b/src/player/CurveNode.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -32,44 +32,46 @@ namespace avg {
class AVG_API CurveNode : public VectorNode
{
public:
- static NodeDefinition createDefinition();
+ static void registerType();
CurveNode(const ArgList& args);
virtual ~CurveNode();
- const DPoint& getPos1() const;
- void setPos1(const DPoint& pt);
+ const glm::vec2& getPos1() const;
+ void setPos1(const glm::vec2& pt);
- const DPoint& getPos2() const;
- void setPos2(const DPoint& pt);
+ const glm::vec2& getPos2() const;
+ void setPos2(const glm::vec2& pt);
- const DPoint& getPos3() const;
- void setPos3(const DPoint& pt);
+ const glm::vec2& getPos3() const;
+ void setPos3(const glm::vec2& pt);
- const DPoint& getPos4() const;
- void setPos4(const DPoint& pt);
+ const glm::vec2& getPos4() const;
+ void setPos4(const glm::vec2& pt);
- double getTexCoord1() const;
- void setTexCoord1(double tc);
+ float getTexCoord1() const;
+ void setTexCoord1(float tc);
- double getTexCoord2() const;
- void setTexCoord2(double tc);
+ float getTexCoord2() const;
+ void setTexCoord2(float tc);
- virtual void calcVertexes(VertexArrayPtr& pVertexArray, Pixel32 color);
+ int getCurveLen() const;
+ glm::vec2 getPtOnCurve(float t) const;
+
+ virtual void calcVertexes(const VertexDataPtr& pVertexData, Pixel32 color);
private:
- int getCurveLen();
void updateLines();
- void addLRCurvePoint(const DPoint& pos, const DPoint& deriv);
- DPoint m_P1;
- DPoint m_P2;
- DPoint m_P3;
- DPoint m_P4;
- double m_TC1;
- double m_TC2;
-
- std::vector<DPoint> m_LeftCurve;
- std::vector<DPoint> m_RightCurve;
+ void addLRCurvePoint(const glm::vec2& pos, const glm::vec2& deriv);
+ glm::vec2 m_P1;
+ glm::vec2 m_P2;
+ glm::vec2 m_P3;
+ glm::vec2 m_P4;
+ float m_TC1;
+ float m_TC2;
+
+ std::vector<glm::vec2> m_LeftCurve;
+ std::vector<glm::vec2> m_RightCurve;
};
}
diff --git a/src/player/DisplayEngine.cpp b/src/player/DisplayEngine.cpp
index 1f46847..7144e36 100644
--- a/src/player/DisplayEngine.cpp
+++ b/src/player/DisplayEngine.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -25,7 +25,9 @@
#include "../base/ScopeTimer.h"
#include "../base/TimeSource.h"
#include "../base/Exception.h"
-#include "../base/ObjectCounter.h"
+
+#include "../graphics/GLContext.h"
+#include "../graphics/Display.h"
using namespace std;
@@ -38,12 +40,10 @@ DisplayEngine::DisplayEngine()
m_bInitialized(false),
m_EffFramerate(0)
{
- ObjectCounter::get()->incRef(&typeid(*this));
}
DisplayEngine::~DisplayEngine()
{
- ObjectCounter::get()->decRef(&typeid(*this));
}
@@ -64,42 +64,48 @@ void DisplayEngine::initRender()
void DisplayEngine::deinitRender()
{
- AVG_TRACE(Logger::PROFILE, "Framerate statistics: ");
- AVG_TRACE(Logger::PROFILE, " Total frames: " << m_NumFrames);
- double TotalTime = double(TimeSource::get()->getCurrentMicrosecs()
+ AVG_TRACE(Logger::category::PROFILE, Logger::severity::INFO,
+ "Framerate statistics: ");
+ AVG_TRACE(Logger::category::PROFILE, Logger::severity::INFO,
+ " Total frames: " <<m_NumFrames);
+ float TotalTime = float(TimeSource::get()->getCurrentMicrosecs()
-m_StartTime)/1000000;
- AVG_TRACE(Logger::PROFILE, " Total time: " << TotalTime << " seconds");
- double actualFramerate = (m_NumFrames+1)/TotalTime;
- AVG_TRACE(Logger::PROFILE, " Framerate achieved: "
- << actualFramerate);
- AVG_TRACE(Logger::PROFILE, " Frames too late: " << m_FramesTooLate);
- AVG_TRACE(Logger::PROFILE, " Percent of time spent waiting: "
- << double (m_TimeSpentWaiting)/(10000*TotalTime));
+ AVG_TRACE(Logger::category::PROFILE, Logger::severity::INFO,
+ " Total time: " << TotalTime << " seconds");
+ float actualFramerate = (m_NumFrames+1)/TotalTime;
+ AVG_TRACE(Logger::category::PROFILE, Logger::severity::INFO,
+ " Framerate achieved: " << actualFramerate);
+ AVG_TRACE(Logger::category::PROFILE, Logger::severity::INFO,
+ " Frames too late: " << m_FramesTooLate);
+ AVG_TRACE(Logger::category::PROFILE, Logger::severity::INFO,
+ " Percent of time spent waiting: "
+ << float (m_TimeSpentWaiting)/(10000*TotalTime));
if (m_Framerate != 0) {
- AVG_TRACE(Logger::PROFILE, " Framerate goal was: " << m_Framerate);
+ AVG_TRACE(Logger::category::PROFILE, Logger::severity::INFO,
+ " Framerate goal was: " << m_Framerate);
if (m_Framerate*2 < actualFramerate && m_NumFrames > 10) {
- AVG_TRACE(Logger::WARNING,
- "Actual framerate was a lot higher than framerate goal. Is vblank sync forced off?");
+ AVG_LOG_WARNING("Actual framerate was a lot higher than framerate goal.\
+ Is vblank sync forced off?");
}
}
m_bInitialized = false;
}
-void DisplayEngine::setFramerate(double rate)
+void DisplayEngine::setFramerate(float rate)
{
if (rate != 0 && m_bInitialized) {
- initVBlank(0);
+ GLContext::getMain()->initVBlank(0);
}
m_Framerate = rate;
m_VBRate = 0;
}
-double DisplayEngine::getFramerate()
+float DisplayEngine::getFramerate()
{
return m_Framerate;
}
-double DisplayEngine::getEffectiveFramerate()
+float DisplayEngine::getEffectiveFramerate()
{
return m_EffFramerate;
}
@@ -108,10 +114,10 @@ void DisplayEngine::setVBlankRate(int rate)
{
m_VBRate = rate;
if (m_bInitialized) {
- bool bOK = initVBlank(rate);
- m_Framerate = getRefreshRate()/m_VBRate;
+ bool bOK = GLContext::getMain()->initVBlank(rate);
+ m_Framerate = Display::get()->getRefreshRate()/m_VBRate;
if (!bOK || rate == 0) {
- AVG_TRACE(Logger::WARNING, "Using framerate of " << m_Framerate <<
+ AVG_LOG_WARNING("Using framerate of " << m_Framerate <<
" instead of VBRate of " << m_VBRate);
m_VBRate = 0;
}
@@ -133,15 +139,12 @@ void DisplayEngine::frameWait()
m_FrameWaitStartTime = TimeSource::get()->getCurrentMicrosecs();
m_TargetTime = m_LastFrameTime+(long long)(1000000/m_Framerate);
- if (m_VBRate != 0) {
- m_bFrameLate = !vbWait(m_VBRate);
- } else {
- m_bFrameLate = false;
+ m_bFrameLate = false;
+ if (m_VBRate == 0) {
if (m_FrameWaitStartTime <= m_TargetTime) {
long long WaitTime = (m_TargetTime-m_FrameWaitStartTime)/1000;
if (WaitTime > 5000) {
- AVG_TRACE (Logger::WARNING,
- "DisplayEngine: waiting " << WaitTime << " ms.");
+ AVG_LOG_WARNING("DisplayEngine: waiting " << WaitTime << " ms.");
}
TimeSource::get()->sleepUntil(m_TargetTime/1000);
}
@@ -160,7 +163,7 @@ void DisplayEngine::checkJitter()
} else {
long long CurIntervalTime = TimeSource::get()->getCurrentMicrosecs()
-m_LastFrameTime;
- m_EffFramerate = 1000000.0/CurIntervalTime;
+ m_EffFramerate = 1000000.0f/CurIntervalTime;
}
long long frameTime = TimeSource::get()->getCurrentMicrosecs();
@@ -171,9 +174,6 @@ void DisplayEngine::checkJitter()
maxDelay = 6;
}
if ((frameTime - m_TargetTime)/1000 > maxDelay || m_bFrameLate) {
- AVG_TRACE (Logger::PROFILE_LATEFRAMES,
- "DisplayEngine: frame too late by "
- << (frameTime - m_TargetTime)/1000 << " ms.");
m_bFrameLate = true;
m_FramesTooLate++;
}
diff --git a/src/player/DisplayEngine.h b/src/player/DisplayEngine.h
index 1025f6a..9b53e45 100644
--- a/src/player/DisplayEngine.h
+++ b/src/player/DisplayEngine.h
@@ -1,6 +1,6 @@
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -46,13 +46,12 @@ class AVG_API DisplayEngine
virtual void teardown() = 0;
void initRender();
void deinitRender();
- void setFramerate(double rate);
- double getFramerate();
- double getEffectiveFramerate();
+ void setFramerate(float rate);
+ float getFramerate();
+ float getEffectiveFramerate();
void setVBlankRate(int rate);
bool wasFrameLate();
- virtual double getRefreshRate() = 0;
- virtual void setGamma(double Red, double Green, double Blue) = 0;
+ virtual void setGamma(float Red, float Green, float Blue) = 0;
virtual void setMousePos(const IntPoint& pos) = 0;
virtual int getKeyModifierState() const = 0;
@@ -70,9 +69,6 @@ class AVG_API DisplayEngine
protected:
private:
- virtual bool initVBlank(int rate) = 0;
- virtual bool vbWait(int rate) = 0;
-
int m_NumFrames;
int m_FramesTooLate;
long long m_StartTime;
@@ -83,11 +79,11 @@ class AVG_API DisplayEngine
long long m_FrameWaitStartTime;
long long m_TargetTime;
int m_VBRate;
- double m_Framerate;
+ float m_Framerate;
bool m_bInitialized;
bool m_bFrameLate;
- double m_EffFramerate;
+ float m_EffFramerate;
};
typedef boost::shared_ptr<DisplayEngine> DisplayEnginePtr;
diff --git a/src/player/DisplayParams.cpp b/src/player/DisplayParams.cpp
index eb376c5..096da33 100644
--- a/src/player/DisplayParams.cpp
+++ b/src/player/DisplayParams.cpp
@@ -1,5 +1,5 @@
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -20,8 +20,6 @@
#include "DisplayParams.h"
-#include "../base/ObjectCounter.h"
-
#include <iostream>
using namespace std;
@@ -37,18 +35,15 @@ DisplayParams::DisplayParams()
m_bShowCursor(true),
m_VBRate(1),
m_Framerate(0),
- m_bHasWindowFrame(true),
- m_DotsPerMM(0)
+ m_bHasWindowFrame(true)
{
- ObjectCounter::get()->incRef(&typeid(*this));
- m_Gamma[0] = -1.0;
- m_Gamma[1] = -1.0;
- m_Gamma[2] = -1.0;
+ m_Gamma[0] = -1.0f;
+ m_Gamma[1] = -1.0f;
+ m_Gamma[2] = -1.0f;
}
DisplayParams::~DisplayParams()
{
- ObjectCounter::get()->decRef(&typeid(*this));
}
void DisplayParams::dump() const
@@ -63,7 +58,6 @@ void DisplayParams::dump() const
cerr << " vbrate: " << m_VBRate << endl;
cerr << " framerate: " << m_Framerate << endl;
cerr << " has window frame: " << m_bHasWindowFrame << endl;
- cerr << " dots per mm: " << m_DotsPerMM << endl;
}
}
diff --git a/src/player/DisplayParams.h b/src/player/DisplayParams.h
index 1a2114d..178abbf 100644
--- a/src/player/DisplayParams.h
+++ b/src/player/DisplayParams.h
@@ -1,6 +1,6 @@
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -24,7 +24,7 @@
#include "../api.h"
-#include "../base/Point.h"
+#include "../base/GLMHelper.h"
namespace avg {
@@ -41,11 +41,10 @@ struct AVG_API DisplayParams {
IntPoint m_WindowSize;
bool m_bShowCursor;
int m_VBRate;
- double m_Framerate;
+ float m_Framerate;
bool m_bHasWindowFrame;
- double m_DotsPerMM;
- double m_Gamma[3];
+ float m_Gamma[3];
};
}
diff --git a/src/player/DivNode.cpp b/src/player/DivNode.cpp
index 7d3dc7c..7397c10 100644
--- a/src/player/DivNode.cpp
+++ b/src/player/DivNode.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -21,10 +21,9 @@
#include "DivNode.h"
#include "Player.h"
-#include "NodeDefinition.h"
+#include "TypeDefinition.h"
#include "Canvas.h"
-#include "../base/Point.h"
#include "../base/Exception.h"
#include "../base/Logger.h"
#include "../base/StringHelper.h"
@@ -39,36 +38,35 @@
using namespace std;
using namespace boost;
-#define DEFAULT_SIZE 100000
-
namespace avg {
-NodeDefinition DivNode::createDefinition()
+void DivNode::registerType()
{
string sChildArray[] = {"image", "div", "canvas", "words", "video", "camera",
"panoimage", "sound", "line", "rect", "curve", "polyline", "polygon",
"circle", "mesh"};
vector<string> sChildren = vectorFromCArray(
sizeof(sChildArray) / sizeof(*sChildArray), sChildArray);
- return NodeDefinition("div", Node::buildNode<DivNode>)
- .extendDefinition(AreaNode::createDefinition())
+ TypeDefinition def = TypeDefinition("div", "areanode",
+ ExportedObject::buildObject<DivNode>)
.addChildren(sChildren)
.addArg(Arg<bool>("crop", false, false, offsetof(DivNode, m_bCrop)))
- .addArg(Arg<string>("elementoutlinecolor", "", false,
- offsetof(DivNode, m_sElementOutlineColor)))
.addArg(Arg<UTF8String>("mediadir", "", false, offsetof(DivNode, m_sMediaDir)));
+ TypeRegistry::get()->registerType(def);
}
DivNode::DivNode(const ArgList& args)
{
args.setMembers(this);
- setElementOutlineColor(m_sElementOutlineColor);
ObjectCounter::get()->incRef(&typeid(*this));
}
DivNode::~DivNode()
{
+ for (unsigned i = 0; i < getNumChildren(); ++i) {
+ getChild(i)->removeParent();
+ }
ObjectCounter::get()->decRef(&typeid(*this));
}
@@ -78,7 +76,6 @@ void DivNode::connectDisplay()
for (unsigned i = 0; i < getNumChildren(); ++i) {
getChild(i)->connectDisplay();
}
- m_pClipVertexes = VertexArrayPtr(new VertexArray());
}
void DivNode::connect(CanvasPtr pCanvas)
@@ -94,18 +91,12 @@ void DivNode::disconnect(bool bKill)
for (unsigned i = 0; i < getNumChildren(); ++i) {
getChild(i)->disconnect(bKill);
}
- if (m_pClipVertexes) {
- m_pClipVertexes = VertexArrayPtr();
- }
AreaNode::disconnect(bKill);
}
-DPoint DivNode::getPivot() const
+glm::vec2 DivNode::getPivot() const
{
- DPoint pivot = AreaNode::getPivot();
- if (pivot == DPoint(DEFAULT_SIZE / 2, DEFAULT_SIZE / 2)) {
- return DPoint(0, 0);
- }
+ glm::vec2 pivot = AreaNode::getPivot();
return pivot;
}
@@ -163,8 +154,7 @@ void DivNode::insertChild(NodePtr pChild, unsigned i)
if (getState() == NS_CONNECTED || getState() == NS_CANRENDER) {
getCanvas()->registerNode(pChild);
}
- DivNodePtr ptr = dynamic_pointer_cast<DivNode>(shared_from_this());
- pChild->checkSetParentError(ptr);
+ pChild->checkSetParentError(this);
if (!isChildTypeAllowed(pChild->getTypeStr())) {
throw(Exception(AVG_ERR_ALREADY_CONNECTED,
"Can't insert a node of type "+pChild->getTypeStr()+
@@ -177,7 +167,7 @@ void DivNode::insertChild(NodePtr pChild, unsigned i)
std::vector<NodePtr>::iterator pos = m_Children.begin()+i;
m_Children.insert(pos, pChild);
try {
- pChild->setParent(ptr, getState(), getCanvas());
+ pChild->setParent(this, getState(), getCanvas());
} catch (Exception&) {
m_Children.erase(m_Children.begin()+i);
throw;
@@ -267,21 +257,6 @@ void DivNode::setCrop(bool bCrop)
m_bCrop = bCrop;
}
-const std::string& DivNode::getElementOutlineColor() const
-{
- return m_sElementOutlineColor;
-}
-
-void DivNode::setElementOutlineColor(const std::string& sColor)
-{
- m_sElementOutlineColor = sColor;
- if (sColor == "") {
- m_ElementOutlineColor = Pixel32(0,0,0,0);
- } else {
- m_ElementOutlineColor = colorStringToColor(m_sElementOutlineColor);
- }
-}
-
const UTF8String& DivNode::getMediaDir() const
{
return m_sMediaDir;
@@ -289,88 +264,80 @@ const UTF8String& DivNode::getMediaDir() const
void DivNode::setMediaDir(const UTF8String& sMediaDir)
{
+// avgDeprecationWarning("1.7", "DivNode.mediadir", "");
m_sMediaDir = sMediaDir;
checkReload();
}
-void DivNode::getElementsByPos(const DPoint& pos, vector<NodeWeakPtr>& pElements)
+void DivNode::getElementsByPos(const glm::vec2& pos, vector<NodePtr>& pElements)
{
if (reactsToMouseEvents() &&
- ((getSize() == DPoint(DEFAULT_SIZE, DEFAULT_SIZE) ||
+ ((getSize() == glm::vec2(0,0) ||
(pos.x >= 0 && pos.y >= 0 && pos.x < getSize().x && pos.y < getSize().y))))
{
for (int i = getNumChildren()-1; i >= 0; i--) {
NodePtr pCurChild = getChild(i);
- DPoint relPos = pCurChild->toLocal(pos);
+ glm::vec2 relPos = pCurChild->toLocal(pos);
pCurChild->getElementsByPos(relPos, pElements);
if (!pElements.empty()) {
- pElements.push_back(shared_from_this());
+ pElements.push_back(getSharedThis());
return;
}
}
// pos isn't in any of the children.
- if (getSize() != DPoint(DEFAULT_SIZE, DEFAULT_SIZE)) {
+ if (getSize() != glm::vec2(0,0)) {
// Explicit width/height given for div - div reacts on its own.
- pElements.push_back(shared_from_this());
+ pElements.push_back(getSharedThis());
}
}
}
-void DivNode::preRender()
+void DivNode::preRender(const VertexArrayPtr& pVA, bool bIsParentActive,
+ float parentEffectiveOpacity)
{
- Node::preRender();
+ Node::preRender(pVA, bIsParentActive, parentEffectiveOpacity);
+ if (getCrop() && getSize() != glm::vec2(0,0)) {
+ pVA->startSubVA(m_ClipVA);
+ glm::vec2 viewport = getSize();
+ m_ClipVA.appendPos(glm::vec2(0,0), glm::vec2(0,0), Pixel32(0,0,0,0));
+ m_ClipVA.appendPos(glm::vec2(0,viewport.y), glm::vec2(0,0), Pixel32(0,0,0,0));
+ m_ClipVA.appendPos(glm::vec2(viewport.x,0), glm::vec2(0,0), Pixel32(0,0,0,0));
+ m_ClipVA.appendPos(viewport, glm::vec2(0,0), Pixel32(0,0,0,0));
+ m_ClipVA.appendQuadIndexes(0, 1, 2, 3);
+ }
for (unsigned i = 0; i < getNumChildren(); i++) {
- getChild(i)->preRender();
+ getChild(i)->preRender(pVA, bIsParentActive, getEffectiveOpacity());
}
}
-void DivNode::render(const DRect& rect)
+void DivNode::render()
{
- DPoint viewport = getSize();
-
- m_pClipVertexes->reset();
- m_pClipVertexes->appendPos(DPoint(0,0), DPoint(0,0), Pixel32(0,0,0,0));
- m_pClipVertexes->appendPos(DPoint(0,viewport.y), DPoint(0,0), Pixel32(0,0,0,0));
- m_pClipVertexes->appendPos(DPoint(viewport.x,0), DPoint(0,0), Pixel32(0,0,0,0));
- m_pClipVertexes->appendPos(viewport, DPoint(0,0), Pixel32(0,0,0,0));
- m_pClipVertexes->appendQuadIndexes(0, 1, 2, 3);
-
- if (getCrop()) {
- getCanvas()->pushClipRect(m_pClipVertexes);
+ const glm::mat4& transform = getTransform();
+ if (getCrop() && getSize() != glm::vec2(0,0)) {
+ getCanvas()->pushClipRect(transform, m_ClipVA);
}
for (unsigned i = 0; i < getNumChildren(); i++) {
- getChild(i)->maybeRender(rect);
+ getChild(i)->maybeRender(transform);
}
- if (getCrop()) {
- getCanvas()->popClipRect(m_pClipVertexes);
+ if (getCrop() && getSize() != glm::vec2(0,0)) {
+ getCanvas()->popClipRect(transform, m_ClipVA);
}
}
-void DivNode::renderOutlines(const VertexArrayPtr& pVA, Pixel32 color)
+void DivNode::renderOutlines(const VertexArrayPtr& pVA, Pixel32 parentColor)
{
- Pixel32 effColor = color;
- if (m_ElementOutlineColor != Pixel32(0,0,0,0)) {
- effColor = m_ElementOutlineColor;
- effColor.setA(128);
- }
+ Pixel32 effColor = getEffectiveOutlineColor(parentColor);
if (effColor != Pixel32(0,0,0,0)) {
- DPoint size = getSize();
- if (size == DPoint(DEFAULT_SIZE, DEFAULT_SIZE)) {
- DPoint p0 = getAbsPos(DPoint(-4, 0.5));
- DPoint p1 = getAbsPos(DPoint(5, 0.5));
- DPoint p2 = getAbsPos(DPoint(0.5, -4));
- DPoint p3 = getAbsPos(DPoint(0.5, 5));
+ glm::vec2 size = getSize();
+ if (size == glm::vec2(0,0)) {
+ glm::vec2 p0 = getAbsPos(glm::vec2(-4, 0.5));
+ glm::vec2 p1 = getAbsPos(glm::vec2(5, 0.5));
+ glm::vec2 p2 = getAbsPos(glm::vec2(0.5, -4));
+ glm::vec2 p3 = getAbsPos(glm::vec2(0.5, 5));
pVA->addLineData(effColor, p0, p1, 1);
pVA->addLineData(effColor, p2, p3, 1);
} else {
- DPoint p0 = getAbsPos(DPoint(0.5, 0.5));
- DPoint p1 = getAbsPos(DPoint(size.x+0.5,0.5));
- DPoint p2 = getAbsPos(DPoint(size.x+0.5,size.y+0.5));
- DPoint p3 = getAbsPos(DPoint(0.5,size.y+0.5));
- pVA->addLineData(effColor, p0, p1, 1);
- pVA->addLineData(effColor, p1, p2, 1);
- pVA->addLineData(effColor, p2, p3, 1);
- pVA->addLineData(effColor, p3, p0, 1);
+ AreaNode::renderOutlines(pVA, parentColor);
}
}
for (unsigned i = 0; i < getNumChildren(); i++) {
@@ -414,7 +381,7 @@ string DivNode::dump(int indent)
IntPoint DivNode::getMediaSize()
{
- return IntPoint(DEFAULT_SIZE, DEFAULT_SIZE);
+ return IntPoint(0, 0);
}
bool DivNode::isChildTypeAllowed(const string& sType)
diff --git a/src/player/DivNode.h b/src/player/DivNode.h
index 573f2e5..080bf56 100644
--- a/src/player/DivNode.h
+++ b/src/player/DivNode.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -25,19 +25,18 @@
#include "../api.h"
#include "AreaNode.h"
+#include "../graphics/SubVertexArray.h"
+
#include "../base/UTF8String.h"
-#include "../graphics/VertexArray.h"
#include <string>
namespace avg {
-class VertexArray;
-
class AVG_API DivNode : public AreaNode
{
public:
- static NodeDefinition createDefinition();
+ static void registerType();
DivNode(const ArgList& args);
virtual ~DivNode();
@@ -59,20 +58,18 @@ class AVG_API DivNode : public AreaNode
void removeChild(NodePtr pNode, bool bKill);
void removeChild(unsigned i, bool bKill);
- virtual DPoint getPivot() const;
+ virtual glm::vec2 getPivot() const;
bool getCrop() const;
void setCrop(bool bCrop);
- const std::string& getElementOutlineColor() const;
- void setElementOutlineColor(const std::string& sColor);
-
const UTF8String& getMediaDir() const;
void setMediaDir(const UTF8String& mediaDir);
- void getElementsByPos(const DPoint& pos, std::vector<NodeWeakPtr>& pElements);
- virtual void preRender();
- virtual void render(const DRect& rect);
+ void getElementsByPos(const glm::vec2& pos, std::vector<NodePtr>& pElements);
+ virtual void preRender(const VertexArrayPtr& pVA, bool bIsParentActive,
+ float parentEffectiveOpacity);
+ virtual void render();
virtual void renderOutlines(const VertexArrayPtr& pVA, Pixel32 color);
virtual std::string getEffectiveMediaDir();
@@ -86,10 +83,8 @@ class AVG_API DivNode : public AreaNode
UTF8String m_sMediaDir;
bool m_bCrop;
- std::string m_sElementOutlineColor;
- Pixel32 m_ElementOutlineColor;
- VertexArrayPtr m_pClipVertexes;
+ SubVertexArray m_ClipVA;
std::vector<NodePtr> m_Children;
};
diff --git a/src/player/Event.cpp b/src/player/Event.cpp
index a12d31c..07d274b 100644
--- a/src/player/Event.cpp
+++ b/src/player/Event.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -106,24 +106,22 @@ string Event::typeStr() const
string Event::typeStr(Event::Type type)
{
switch(type) {
- case KEYUP:
- return "KEYUP";
- case KEYDOWN:
- return "KEYDOWN";
- case CURSORMOTION:
- return "CURSORMOTION";
- case CURSORUP:
- return "CURSORUP";
- case CURSORDOWN:
- return "CURSORDOWN";
- case CURSOROVER:
- return "CURSOROVER";
- case CURSOROUT:
- return "CURSOROUT";
- case CUSTOMEVENT:
- return "CUSTOMEVENT";
- case RESIZE:
- return "RESIZE";
+ case KEY_UP:
+ return "KEY_UP";
+ case KEY_DOWN:
+ return "KEY_DOWN";
+ case CURSOR_MOTION:
+ return "CURSOR_MOTION";
+ case CURSOR_UP:
+ return "CURSOR_UP";
+ case CURSOR_DOWN:
+ return "CURSOR_DOWN";
+ case CURSOR_OVER:
+ return "CURSOR_OVER";
+ case CURSOR_OUT:
+ return "CURSOR_OUT";
+ case CUSTOM_EVENT:
+ return "CUSTOM_EVENT";
case QUIT:
return "QUIT";
default:
@@ -135,7 +133,7 @@ string Event::typeStr(Event::Type type)
void Event::trace()
{
string sType = typeStr();
- AVG_TRACE(Logger::EVENTS, sType);
+ AVG_TRACE(Logger::category::EVENTS,Logger::severity::INFO, sType);
}
}
diff --git a/src/player/Event.h b/src/player/Event.h
index 9ac5a89..d1b6d9f 100644
--- a/src/player/Event.h
+++ b/src/player/Event.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -39,15 +39,15 @@ typedef boost::weak_ptr<class IInputDevice> IInputDeviceWeakPtr;
class AVG_API Event {
public:
enum Type {
- KEYUP,
- KEYDOWN,
- CURSORMOTION,
- CURSORUP,
- CURSORDOWN,
- CURSOROVER,
- CURSOROUT,
- CUSTOMEVENT,
- RESIZE,
+ // XXX: Hack to make sure this enum can't be passed to Node.subscribe.
+ KEY_UP = 10000,
+ KEY_DOWN,
+ CURSOR_MOTION,
+ CURSOR_UP,
+ CURSOR_DOWN,
+ CURSOR_OVER,
+ CURSOR_OUT,
+ CUSTOM_EVENT,
QUIT
};
enum Source {MOUSE=1, TOUCH=2, TRACK=4, CUSTOM=8, NONE=16};
diff --git a/src/player/EventDispatcher.cpp b/src/player/EventDispatcher.cpp
index f63c42a..23caff2 100644
--- a/src/player/EventDispatcher.cpp
+++ b/src/player/EventDispatcher.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -26,6 +26,7 @@
#include "CursorEvent.h"
#include "../base/Exception.h"
+#include "../base/OSHelper.h"
#include <string>
@@ -34,9 +35,10 @@ using namespace boost;
namespace avg {
-EventDispatcher::EventDispatcher(Player* pPlayer)
+EventDispatcher::EventDispatcher(Player* pPlayer, bool bMouseEnabled)
: m_pPlayer(pPlayer),
- m_NumMouseButtonsDown(0)
+ m_NumMouseButtonsDown(0),
+ m_bMouseEnabled(bMouseEnabled)
{
}
@@ -63,10 +65,13 @@ void EventDispatcher::dispatch()
vector<EventPtr>::iterator it;
for (it = events.begin(); it != events.end(); ++it) {
EventPtr pEvent = *it;
-// cerr << " " << pEvent->typeStr() << ", " << pEvent->getSource() << endl;
- testAddContact(pEvent);
- handleEvent(*it);
- testRemoveContact(pEvent);
+ bool bHookEatsEvent = processEventHook(pEvent);
+ if (!(!m_bMouseEnabled && pEvent->getSource() == Event::MOUSE) &&
+ !bHookEatsEvent) {
+ testAddContact(pEvent);
+ handleEvent(*it);
+ testRemoveContact(pEvent);
+ }
}
}
@@ -80,6 +85,11 @@ void EventDispatcher::sendEvent(EventPtr pEvent)
handleEvent(pEvent);
}
+void EventDispatcher::enableMouse(bool bEnabled)
+{
+ m_bMouseEnabled = bEnabled;
+}
+
ContactPtr EventDispatcher::getContact(int id)
{
std::map<int, ContactPtr>::iterator it = m_ContactMap.find(id);
@@ -95,13 +105,25 @@ void EventDispatcher::handleEvent(EventPtr pEvent)
m_pPlayer->handleEvent(pEvent);
}
+bool EventDispatcher::processEventHook(EventPtr pEvent)
+{
+ PyObject * pEventHook = m_pPlayer->getEventHook();
+ if (pEventHook != Py_None) {
+ // If the hook returns true, stop processing the event
+ if (py::call<bool>(pEventHook, pEvent)) {
+ return true;
+ }
+ }
+ return false;
+}
+
void EventDispatcher::testAddContact(EventPtr pEvent)
{
ContactPtr pContact;
CursorEventPtr pCursorEvent = dynamic_pointer_cast<CursorEvent>(pEvent);
if (pCursorEvent) {
switch (pCursorEvent->getType()) {
- case Event::CURSORDOWN:
+ case Event::CURSOR_DOWN:
if (pCursorEvent->getSource() == Event::MOUSE) {
m_NumMouseButtonsDown++;
if (m_NumMouseButtonsDown == 1) {
@@ -114,8 +136,8 @@ void EventDispatcher::testAddContact(EventPtr pEvent)
m_ContactMap[pCursorEvent->getCursorID()] = pContact;
}
break;
- case Event::CURSORMOTION:
- case Event::CURSORUP: {
+ case Event::CURSOR_MOTION:
+ case Event::CURSOR_UP: {
pContact = getContact(pCursorEvent->getCursorID());
AVG_ASSERT(pContact || (
pCursorEvent->getSource() == Event::MOUSE &&
@@ -125,7 +147,7 @@ void EventDispatcher::testAddContact(EventPtr pEvent)
}
}
break;
- case Event::CUSTOMEVENT:
+ case Event::CUSTOM_EVENT:
break;
default:
cerr << pCursorEvent->typeStr() << endl;
@@ -140,13 +162,16 @@ void EventDispatcher::testAddContact(EventPtr pEvent)
void EventDispatcher::testRemoveContact(EventPtr pEvent)
{
- if (pEvent->getType() == Event::CURSORUP) {
+ if (pEvent->getType() == Event::CURSOR_UP) {
if (pEvent->getSource() == Event::MOUSE) {
- AVG_ASSERT(m_NumMouseButtonsDown > 0);
- m_NumMouseButtonsDown--;
- if (m_NumMouseButtonsDown == 0) {
- int rc = m_ContactMap.erase(MOUSECURSORID);
- AVG_ASSERT(rc == 1);
+ // The following if is only false if the CURSOR_DOWN wasn't registered because
+ // it was outside the application window (or on the window border).
+ if (m_NumMouseButtonsDown > 0) {
+ m_NumMouseButtonsDown--;
+ if (m_NumMouseButtonsDown == 0) {
+ int rc = m_ContactMap.erase(MOUSECURSORID);
+ AVG_ASSERT(rc == 1);
+ }
}
} else {
int rc = m_ContactMap.erase(
diff --git a/src/player/EventDispatcher.h b/src/player/EventDispatcher.h
index 51da86e..19c3f78 100644
--- a/src/player/EventDispatcher.h
+++ b/src/player/EventDispatcher.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -38,17 +38,19 @@ class Player;
class AVG_API EventDispatcher {
public:
- EventDispatcher(Player* pPlayer);
+ EventDispatcher(Player* pPlayer, bool bMouseEnabled);
virtual ~EventDispatcher();
void dispatch();
void addInputDevice(IInputDevicePtr pInputDevice);
void sendEvent(EventPtr pEvent);
+ void enableMouse(bool bEnabled);
ContactPtr getContact(int id);
private:
void handleEvent(EventPtr pEvent);
+ bool processEventHook(EventPtr pEvent);
void testAddContact(EventPtr pEvent);
void testRemoveContact(EventPtr pEvent);
@@ -56,6 +58,7 @@ class AVG_API EventDispatcher {
Player* m_pPlayer;
std::map<int, ContactPtr> m_ContactMap;
int m_NumMouseButtonsDown;
+ bool m_bMouseEnabled;
};
typedef boost::shared_ptr<EventDispatcher> EventDispatcherPtr;
diff --git a/src/player/ExportedObject.cpp b/src/player/ExportedObject.cpp
new file mode 100644
index 0000000..b50a72a
--- /dev/null
+++ b/src/player/ExportedObject.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 "ExportedObject.h"
+#include "TypeDefinition.h"
+#include "Arg.h"
+
+#include "../base/Exception.h"
+#include "../base/Logger.h"
+#include "../base/ObjectCounter.h"
+
+#include <string>
+
+using namespace std;
+
+namespace avg {
+
+ExportedObject::ExportedObject()
+ : m_pSelf(0)
+{
+ ObjectCounter::get()->incRef(&typeid(*this));
+}
+
+ExportedObject::ExportedObject(const ExportedObject& other)
+ : m_pSelf(0)
+{
+ AVG_ASSERT(!other.m_pSelf);
+ m_pDefinition = other.m_pDefinition;
+ ObjectCounter::get()->incRef(&typeid(*this));
+}
+
+ExportedObject::~ExportedObject()
+{
+ ObjectCounter::get()->decRef(&typeid(*this));
+}
+
+void ExportedObject::registerInstance(PyObject* pSelf)
+{
+ m_pSelf = pSelf;
+}
+
+ExportedObjectPtr ExportedObject::getSharedThis()
+{
+ // Just using shared_from_this causes strange behaviour when derived classes
+ // are written in python: The pointer returned by shared_from_this doesn't know
+ // about the python part of the object and cuts it off. Because of this, we remember
+ // a pointer to the python object in m_pSelf and use that to create a functioning
+ // and complete ExportedObjectPtr if there is a python derived class.
+ if (m_pSelf) {
+ return py::extract<ExportedObjectPtr>(m_pSelf);
+ } else {
+ return shared_from_this();
+ }
+}
+
+void ExportedObject::setTypeInfo(const TypeDefinition * pDefinition)
+{
+ m_pDefinition = pDefinition;
+}
+
+const TypeDefinition* ExportedObject::getDefinition() const
+{
+ return m_pDefinition;
+}
+
+string ExportedObject::getTypeStr() const
+{
+ return m_pDefinition->getName();
+}
+
+bool ExportedObject::operator ==(const ExportedObject& other) const
+{
+ return this == &other;
+}
+
+bool ExportedObject::operator !=(const ExportedObject& other) const
+{
+ return this != &other;
+}
+
+long ExportedObject::getHash() const
+{
+ return long(this);
+}
+
+
+}
diff --git a/src/player/ExportedObject.h b/src/player/ExportedObject.h
new file mode 100644
index 0000000..810e787
--- /dev/null
+++ b/src/player/ExportedObject.h
@@ -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
+//
+
+#ifndef _ExportedObject_H_
+#define _ExportedObject_H_
+
+#include "../api.h"
+
+#include <boost/shared_ptr.hpp>
+#include <boost/enable_shared_from_this.hpp>
+
+// Python docs say python.h should be included before any standard headers (!)
+#include "WrapPython.h"
+
+namespace avg {
+
+class TypeDefinition;
+class ArgList;
+
+class ExportedObject;
+typedef boost::shared_ptr<ExportedObject> ExportedObjectPtr;
+
+class AVG_API ExportedObject: public boost::enable_shared_from_this<ExportedObject>
+{
+ public:
+ ExportedObject();
+ ExportedObject(const ExportedObject& other);
+ virtual ~ExportedObject()=0;
+
+ void registerInstance(PyObject* pSelf);
+ ExportedObjectPtr getSharedThis();
+
+ template<class Type>
+ static ExportedObjectPtr buildObject(const ArgList& Args)
+ {
+ return ExportedObjectPtr(new Type(Args));
+ }
+ virtual void setTypeInfo(const TypeDefinition * pDefinition);
+
+ virtual void setArgs(const ArgList& args) {};
+ std::string getTypeStr() const;
+ virtual const TypeDefinition* getDefinition() const;
+
+ bool operator ==(const ExportedObject& other) const;
+ bool operator !=(const ExportedObject& other) const;
+ long getHash() const;
+
+ private:
+ const TypeDefinition* m_pDefinition;
+ PyObject* m_pSelf;
+};
+
+}
+
+#endif
diff --git a/src/player/FXNode.cpp b/src/player/FXNode.cpp
index c0483e5..9aa2fde 100644
--- a/src/player/FXNode.cpp
+++ b/src/player/FXNode.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -29,8 +29,9 @@ namespace avg {
using namespace std;
-FXNode::FXNode()
+FXNode::FXNode(bool bSupportsGLES)
: m_Size(0, 0),
+ m_bSupportsGLES(bSupportsGLES),
m_bDirty(true)
{
ObjectCounter::get()->incRef(&typeid(*this));
@@ -43,6 +44,7 @@ FXNode::~FXNode()
void FXNode::connect()
{
+ checkGLES();
if (m_Size != IntPoint(0,0)) {
m_pFilter = createFilter(m_Size);
}
@@ -66,7 +68,7 @@ void FXNode::setSize(const IntPoint& newSize)
void FXNode::apply(GLTexturePtr pSrcTex)
{
// blt overwrites everything, so no glClear necessary before.
- GLContext::getCurrent()->setBlendMode(GLContext::BLEND_COPY);
+ GLContext::getMain()->setBlendMode(GLContext::BLEND_COPY);
m_pFilter->apply(pSrcTex);
}
@@ -80,7 +82,7 @@ BitmapPtr FXNode::getImage()
return m_pFilter->getImage();
}
-DRect FXNode::getRelDestRect() const
+FRect FXNode::getRelDestRect() const
{
return m_pFilter->getRelDestRect();
}
@@ -105,4 +107,11 @@ void FXNode::setDirty()
m_bDirty = true;
}
+void FXNode::checkGLES() const
+{
+ if (!m_bSupportsGLES && GLContext::getCurrent()->isGLES()) {
+ throw Exception(AVG_ERR_UNSUPPORTED, "This effect is unsupported under OpenGL ES.");
+ }
+}
+
}
diff --git a/src/player/FXNode.h b/src/player/FXNode.h
index e602a9a..05a902e 100644
--- a/src/player/FXNode.h
+++ b/src/player/FXNode.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -32,7 +32,7 @@ namespace avg {
class AVG_API FXNode {
public:
- FXNode();
+ FXNode(bool bSupportsGLES=true);
virtual ~FXNode();
virtual void connect();
@@ -43,7 +43,7 @@ public:
GLTexturePtr getTex();
BitmapPtr getImage();
- DRect getRelDestRect() const;
+ FRect getRelDestRect() const;
bool isDirty() const;
void resetDirty();
@@ -54,10 +54,12 @@ protected:
private:
virtual GPUFilterPtr createFilter(const IntPoint& size) = 0;
+ void checkGLES() const;
IntPoint m_Size;
GPUFilterPtr m_pFilter;
+ bool m_bSupportsGLES;
bool m_bDirty;
};
diff --git a/src/player/FilledVectorNode.cpp b/src/player/FilledVectorNode.cpp
index 69d833b..a804958 100644
--- a/src/player/FilledVectorNode.cpp
+++ b/src/player/FilledVectorNode.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -21,7 +21,7 @@
#include "FilledVectorNode.h"
-#include "NodeDefinition.h"
+#include "TypeDefinition.h"
#include "Image.h"
#include "DivNode.h"
@@ -34,21 +34,21 @@ using namespace boost;
namespace avg {
-NodeDefinition FilledVectorNode::createDefinition()
+void FilledVectorNode::registerType()
{
- return NodeDefinition("filledvector")
- .extendDefinition(VectorNode::createDefinition())
+ TypeDefinition def = TypeDefinition("filledvectornode", "vectornode")
.addArg(Arg<UTF8String>("filltexhref", "", false,
offsetof(FilledVectorNode, m_FillTexHRef)))
- .addArg(Arg<double>("fillopacity", 0, false,
+ .addArg(Arg<float>("fillopacity", 0, false,
offsetof(FilledVectorNode, m_FillOpacity)))
- .addArg(Arg<string>("fillcolor", "FFFFFF", false,
+ .addArg(Arg<UTF8String>("fillcolor", "FFFFFF", false,
offsetof(FilledVectorNode, m_sFillColorName)))
- .addArg(Arg<DPoint>("filltexcoord1", DPoint(0,0), false,
+ .addArg(Arg<glm::vec2>("filltexcoord1", glm::vec2(0,0), false,
offsetof(FilledVectorNode, m_FillTexCoord1)))
- .addArg(Arg<DPoint>("filltexcoord2", DPoint(1,1), false,
+ .addArg(Arg<glm::vec2>("filltexcoord2", glm::vec2(1,1), false,
offsetof(FilledVectorNode, m_FillTexCoord2)))
;
+ TypeRegistry::get()->registerType(def);
}
FilledVectorNode::FilledVectorNode(const ArgList& args)
@@ -57,7 +57,7 @@ FilledVectorNode::FilledVectorNode(const ArgList& args)
{
m_FillTexHRef = args.getArgVal<UTF8String>("filltexhref");
setFillTexHRef(m_FillTexHRef);
- m_sFillColorName = args.getArgVal<string>("fillcolor");
+ m_sFillColorName = args.getArgVal<UTF8String>("fillcolor");
m_FillColor = colorStringToColor(m_sFillColorName);
}
@@ -112,70 +112,71 @@ void FilledVectorNode::setFillBitmap(BitmapPtr pBmp)
setDrawNeeded();
}
-const DPoint& FilledVectorNode::getFillTexCoord1() const
+const glm::vec2& FilledVectorNode::getFillTexCoord1() const
{
return m_FillTexCoord1;
}
-void FilledVectorNode::setFillTexCoord1(const DPoint& pt)
+void FilledVectorNode::setFillTexCoord1(const glm::vec2& pt)
{
m_FillTexCoord1 = pt;
setDrawNeeded();
}
-const DPoint& FilledVectorNode::getFillTexCoord2() const
+const glm::vec2& FilledVectorNode::getFillTexCoord2() const
{
return m_FillTexCoord2;
}
-void FilledVectorNode::setFillTexCoord2(const DPoint& pt)
+void FilledVectorNode::setFillTexCoord2(const glm::vec2& pt)
{
m_FillTexCoord2 = pt;
setDrawNeeded();
}
-double FilledVectorNode::getFillOpacity() const
+float FilledVectorNode::getFillOpacity() const
{
return m_FillOpacity;
}
-void FilledVectorNode::setFillOpacity(double opacity)
+void FilledVectorNode::setFillOpacity(float opacity)
{
m_FillOpacity = opacity;
setDrawNeeded();
}
-void FilledVectorNode::preRender()
+void FilledVectorNode::preRender(const VertexArrayPtr& pVA, bool bIsParentActive,
+ float parentEffectiveOpacity)
{
- Node::preRender();
- double curOpacity = getParent()->getEffectiveOpacity()*m_FillOpacity;
- VertexArrayPtr pFillVA;
- pFillVA = m_pFillShape->getVertexArray();
+ Node::preRender(pVA, bIsParentActive, parentEffectiveOpacity);
+ float curOpacity = parentEffectiveOpacity*m_FillOpacity;
+
+ VertexDataPtr pShapeVD = m_pFillShape->getVertexData();
if (isDrawNeeded() || curOpacity != m_OldOpacity) {
- pFillVA->reset();
+ pShapeVD->reset();
Pixel32 color = getFillColorVal();
- color.setA((unsigned char)(curOpacity*255));
- calcFillVertexes(pFillVA, color);
- pFillVA->update();
+ calcFillVertexes(pShapeVD, color);
m_OldOpacity = curOpacity;
}
- VectorNode::preRender();
+ if (isVisible()) {
+ m_pFillShape->setVertexArray(pVA);
+ }
+ VectorNode::preRender(pVA, bIsParentActive, parentEffectiveOpacity);
}
static ProfilingZoneID RenderProfilingZone("FilledVectorNode::render");
-void FilledVectorNode::render(const DRect& rect)
+void FilledVectorNode::render()
{
ScopeTimer Timer(RenderProfilingZone);
- double curOpacity = getParent()->getEffectiveOpacity()*m_FillOpacity;
+ float curOpacity = getParent()->getEffectiveOpacity()*m_FillOpacity;
if (curOpacity > 0.01) {
- glColor4d(1.0, 1.0, 1.0, curOpacity);
- m_pFillShape->draw();
+ m_pFillShape->draw(getTransform(), curOpacity);
}
- VectorNode::render(rect);
+ VectorNode::render();
}
-void FilledVectorNode::setFillColor(const string& sColor)
+void FilledVectorNode::setFillColor(const UTF8String& sColor)
{
if (m_sFillColorName != sColor) {
m_sFillColorName = sColor;
@@ -184,7 +185,7 @@ void FilledVectorNode::setFillColor(const string& sColor)
}
}
-const string& FilledVectorNode::getFillColor() const
+const UTF8String& FilledVectorNode::getFillColor() const
{
return m_sFillColorName;
}
@@ -194,10 +195,10 @@ Pixel32 FilledVectorNode::getFillColorVal() const
return m_FillColor;
}
-DPoint FilledVectorNode::calcFillTexCoord(const DPoint& pt, const DPoint& minPt,
- const DPoint& maxPt)
+glm::vec2 FilledVectorNode::calcFillTexCoord(const glm::vec2& pt, const glm::vec2& minPt,
+ const glm::vec2& maxPt)
{
- DPoint texPt;
+ glm::vec2 texPt;
texPt.x = (m_FillTexCoord2.x-m_FillTexCoord1.x)*(pt.x-minPt.x)/(maxPt.x-minPt.x)
+m_FillTexCoord1.x;
texPt.y = (m_FillTexCoord2.y-m_FillTexCoord1.y)*(pt.y-minPt.y)/(maxPt.y-minPt.y)
@@ -207,7 +208,7 @@ DPoint FilledVectorNode::calcFillTexCoord(const DPoint& pt, const DPoint& minPt,
bool FilledVectorNode::isVisible() const
{
- return getActive() && (getEffectiveOpacity() > 0.01 ||
+ return getEffectiveActive() && (getEffectiveOpacity() > 0.01 ||
getParent()->getEffectiveOpacity()*m_FillOpacity > 0.01);
}
diff --git a/src/player/FilledVectorNode.h b/src/player/FilledVectorNode.h
index ff8451d..ae98595 100644
--- a/src/player/FilledVectorNode.h
+++ b/src/player/FilledVectorNode.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -32,7 +32,7 @@ namespace avg {
class AVG_API FilledVectorNode : public VectorNode
{
public:
- static NodeDefinition createDefinition();
+ static void registerType();
FilledVectorNode(const ArgList& args);
virtual ~FilledVectorNode();
@@ -44,37 +44,39 @@ class AVG_API FilledVectorNode : public VectorNode
void setFillTexHRef(const UTF8String& href);
void setFillBitmap(BitmapPtr pBmp);
- const DPoint& getFillTexCoord1() const;
- void setFillTexCoord1(const DPoint& pt);
- const DPoint& getFillTexCoord2() const;
- void setFillTexCoord2(const DPoint& pt);
+ const glm::vec2& getFillTexCoord1() const;
+ void setFillTexCoord1(const glm::vec2& pt);
+ const glm::vec2& getFillTexCoord2() const;
+ void setFillTexCoord2(const glm::vec2& pt);
- void setFillColor(const std::string& sColor);
- const std::string& getFillColor() const;
+ void setFillColor(const UTF8String& sColor);
+ const UTF8String& getFillColor() const;
- double getFillOpacity() const;
- void setFillOpacity(double opacity);
+ float getFillOpacity() const;
+ void setFillOpacity(float opacity);
- virtual void preRender();
- virtual void render(const DRect& rect);
+ virtual void preRender(const VertexArrayPtr& pVA, bool bIsParentActive,
+ float parentEffectiveOpacity);
+ virtual void render();
- virtual void calcFillVertexes(VertexArrayPtr& pVertexArray, Pixel32 color) = 0;
+ virtual void calcFillVertexes(
+ const VertexDataPtr& pVertexData, Pixel32 color) = 0;
protected:
Pixel32 getFillColorVal() const;
- DPoint calcFillTexCoord(const DPoint& pt, const DPoint& minPt,
- const DPoint& maxPt);
+ glm::vec2 calcFillTexCoord(const glm::vec2& pt, const glm::vec2& minPt,
+ const glm::vec2& maxPt);
virtual bool isVisible() const;
private:
- double m_OldOpacity;
+ float m_OldOpacity;
UTF8String m_FillTexHRef;
- DPoint m_FillTexCoord1;
- DPoint m_FillTexCoord2;
+ glm::vec2 m_FillTexCoord1;
+ glm::vec2 m_FillTexCoord2;
ShapePtr m_pFillShape;
- double m_FillOpacity;
- std::string m_sFillColorName;
+ float m_FillOpacity;
+ UTF8String m_sFillColorName;
Pixel32 m_FillColor;
};
diff --git a/src/player/FontStyle.cpp b/src/player/FontStyle.cpp
new file mode 100644
index 0000000..2980aa3
--- /dev/null
+++ b/src/player/FontStyle.cpp
@@ -0,0 +1,315 @@
+//
+// 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 "FontStyle.h"
+
+#include "../base/ObjectCounter.h"
+#include "../base/Exception.h"
+
+#include "TypeDefinition.h"
+#include "Arg.h"
+
+using namespace std;
+
+namespace avg {
+
+void FontStyle::registerType()
+{
+ TypeDefinition def = TypeDefinition("fontstyle", "",
+ ExportedObject::buildObject<FontStyle>)
+ .addArg(Arg<string>("font", "sans", false, offsetof(FontStyle, m_sName)))
+ .addArg(Arg<string>("variant", "", false, offsetof(FontStyle, m_sVariant)))
+ .addArg(Arg<string>("color", "FFFFFF", false, offsetof(FontStyle, m_sColorName)))
+ .addArg(Arg<float>("aagamma", 1.0f, false, offsetof(FontStyle, m_AAGamma)))
+ .addArg(Arg<float>("fontsize", 15, false, offsetof(FontStyle, m_Size)))
+ .addArg(Arg<int>("indent", 0, false, offsetof(FontStyle, m_Indent)))
+ .addArg(Arg<float>("linespacing", 0, false, offsetof(FontStyle, m_LineSpacing)))
+ .addArg(Arg<string>("alignment", "left"))
+ .addArg(Arg<string>("wrapmode", "word"))
+ .addArg(Arg<bool>("justify", false, false, offsetof(FontStyle, m_bJustify)))
+ .addArg(Arg<float>("letterspacing", 0, false,
+ offsetof(FontStyle, m_LetterSpacing)))
+ .addArg(Arg<bool>("hint", true, false, offsetof(FontStyle, m_bHint)))
+ .addArg(Arg<FontStylePtr>("basestyle", FontStylePtr()))
+ ;
+ TypeRegistry::get()->registerType(def);
+}
+
+FontStyle::FontStyle(const ArgList& args)
+{
+ args.setMembers(this);
+ setAlignment(args.getArgVal<string>("alignment"));
+ setWrapMode(args.getArgVal<string>("wrapmode"));
+ m_Color = colorStringToColor(m_sColorName);
+ if (args.getArgVal<FontStylePtr>("basestyle") != 0) {
+ applyBaseStyle(*(args.getArgVal<FontStylePtr>("basestyle")), args);
+ }
+}
+
+FontStyle::FontStyle()
+{
+ const ArgList& args = TypeRegistry::get()->getTypeDef("fontstyle").getDefaultArgs();
+ args.setMembers(this);
+ setAlignment(args.getArgVal<string>("alignment"));
+ setWrapMode(args.getArgVal<string>("wrapmode"));
+ m_Color = colorStringToColor(m_sColorName);
+}
+
+FontStyle::~FontStyle()
+{
+}
+
+template<class ATTR>
+void setDefaultedAttr(ATTR& member, const string& sName, const ArgList& args,
+ const ATTR& attr)
+{
+ if (args.getArg(sName)->isDefault()) {
+ member = attr;
+ }
+}
+
+void FontStyle::applyBaseStyle(const FontStyle& baseStyle, const ArgList& args)
+{
+ setDefaultedAttr(m_sName, "font", args, baseStyle.getFont());
+ setDefaultedAttr(m_sVariant, "variant", args, baseStyle.getFontVariant());
+ setDefaultedAttr(m_sColorName, "color", args, baseStyle.getColor());
+ m_Color = colorStringToColor(m_sColorName);
+ setDefaultedAttr(m_AAGamma, "aagamma", args, baseStyle.getAAGamma());
+ setDefaultedAttr(m_Size, "fontsize", args, baseStyle.getFontSize());
+ setDefaultedAttr(m_Indent, "indent", args, baseStyle.getIndent());
+ setDefaultedAttr(m_LineSpacing, "linespacing", args, baseStyle.getLineSpacing());
+ setDefaultedAttr(m_Alignment, "alignment", args, baseStyle.getAlignmentVal());
+ setDefaultedAttr(m_WrapMode, "wrapmode", args, baseStyle.getWrapModeVal());
+ setDefaultedAttr(m_bJustify, "justify", args, baseStyle.getJustify());
+ setDefaultedAttr(m_LetterSpacing, "letterspacing", args,
+ baseStyle.getLetterSpacing());
+ setDefaultedAttr(m_bHint, "hint", args, baseStyle.getHint());
+}
+
+template<class ARG>
+void setDefaultedArg(ARG& member, const string& sName, const ArgList& args)
+{
+ if (!args.getArg(sName)->isDefault()) {
+ member = args.getArgVal<ARG>(sName);
+ }
+}
+
+void FontStyle::setDefaultedArgs(const ArgList& args)
+{
+ // Warning: The ArgList here contains args that are for a different class originally,
+ // so the member offsets are wrong.
+ setDefaultedArg(m_sName, "font", args);
+ setDefaultedArg(m_sVariant, "variant", args);
+ setDefaultedArg(m_sColorName, "color", args);
+ setColor(m_sColorName);
+ setDefaultedArg(m_AAGamma, "aagamma", args);
+ setDefaultedArg(m_Size, "fontsize", args);
+ setDefaultedArg(m_Indent, "indent", args);
+ setDefaultedArg(m_LineSpacing, "linespacing", args);
+ string s = getAlignment();
+ setDefaultedArg(s, "alignment", args);
+ setAlignment(s);
+ s = getWrapMode();
+ setDefaultedArg(s, "wrapmode", args);
+ setWrapMode(s);
+ setDefaultedArg(m_bJustify, "justify", args);
+ setDefaultedArg(m_LetterSpacing, "letterspacing", args);
+ setDefaultedArg(m_bHint, "hint", args);
+}
+
+const std::string& FontStyle::getFont() const
+{
+ return m_sName;
+}
+
+void FontStyle::setFont(const string& sName)
+{
+ m_sName = sName;
+}
+
+const std::string& FontStyle::getFontVariant() const
+{
+ return m_sVariant;
+}
+
+void FontStyle::setFontVariant(const std::string& sVariant)
+{
+ m_sVariant = sVariant;
+}
+
+const std::string& FontStyle::getColor() const
+{
+ return m_sColorName;
+}
+
+void FontStyle::setColor(const string& sColor)
+{
+ m_sColorName = sColor;
+ m_Color = colorStringToColor(m_sColorName);
+}
+
+float FontStyle::getAAGamma() const
+{
+ return m_AAGamma;
+}
+
+void FontStyle::setAAGamma(float gamma)
+{
+ m_AAGamma = gamma;
+}
+
+float FontStyle::getFontSize() const
+{
+ return m_Size;
+}
+
+void FontStyle::setFontSize(float size)
+{
+ if (size <= 1) {
+ throw Exception(AVG_ERR_INVALID_ARGS, "Font size < 1 is illegal.");
+ }
+ m_Size = size;
+}
+
+int FontStyle::getIndent() const
+{
+ return m_Indent;
+}
+
+void FontStyle::setIndent(int indent)
+{
+ m_Indent = indent;
+}
+
+float FontStyle::getLineSpacing() const
+{
+ return m_LineSpacing;
+}
+
+void FontStyle::setLineSpacing(float lineSpacing)
+{
+ m_LineSpacing = lineSpacing;
+}
+
+string FontStyle::getAlignment() const
+{
+ switch(m_Alignment) {
+ case PANGO_ALIGN_LEFT:
+ return "left";
+ case PANGO_ALIGN_CENTER:
+ return "center";
+ case PANGO_ALIGN_RIGHT:
+ return "right";
+ default:
+ AVG_ASSERT(false);
+ return "";
+ }
+}
+
+void FontStyle::setAlignment(const string& sAlign)
+{
+ if (sAlign == "left") {
+ m_Alignment = PANGO_ALIGN_LEFT;
+ } else if (sAlign == "center") {
+ m_Alignment = PANGO_ALIGN_CENTER;
+ } else if (sAlign == "right") {
+ m_Alignment = PANGO_ALIGN_RIGHT;
+ } else {
+ throw(Exception(AVG_ERR_UNSUPPORTED,
+ "Alignment "+sAlign+" not supported."));
+ }
+}
+
+void FontStyle::setWrapMode(const string& sWrapMode)
+{
+ if (sWrapMode == "word") {
+ m_WrapMode = PANGO_WRAP_WORD;
+ } else if (sWrapMode == "char") {
+ m_WrapMode = PANGO_WRAP_CHAR;
+ } else if (sWrapMode == "wordchar") {
+ m_WrapMode = PANGO_WRAP_WORD_CHAR;
+ } else {
+ throw(Exception(AVG_ERR_UNSUPPORTED,
+ "FontStyle wrapping mode "+sWrapMode+" not supported."));
+ }
+}
+
+string FontStyle::getWrapMode() const
+{
+ switch(m_WrapMode) {
+ case PANGO_WRAP_WORD:
+ return "word";
+ case PANGO_WRAP_CHAR:
+ return "char";
+ case PANGO_WRAP_WORD_CHAR:
+ return "wordchar";
+ default:
+ AVG_ASSERT(false);
+ return "";
+ }
+}
+
+bool FontStyle::getJustify() const
+{
+ return m_bJustify;
+}
+
+void FontStyle::setJustify(bool bJustify)
+{
+ m_bJustify = bJustify;
+}
+
+float FontStyle::getLetterSpacing() const
+{
+ return m_LetterSpacing;
+}
+
+void FontStyle::setLetterSpacing(float letterSpacing)
+{
+ m_LetterSpacing = letterSpacing;
+}
+
+bool FontStyle::getHint() const
+{
+ return m_bHint;
+}
+
+void FontStyle::setHint(bool bHint)
+{
+ m_bHint = bHint;
+}
+
+PangoAlignment FontStyle::getAlignmentVal() const
+{
+ return m_Alignment;
+}
+
+PangoWrapMode FontStyle::getWrapModeVal() const
+{
+ return m_WrapMode;
+}
+
+Pixel32 FontStyle::getColorVal() const
+{
+ return m_Color;
+}
+
+}
diff --git a/src/player/FontStyle.h b/src/player/FontStyle.h
new file mode 100644
index 0000000..513aa14
--- /dev/null
+++ b/src/player/FontStyle.h
@@ -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
+//
+
+#ifndef _FontStyle_H_
+#define _FontStyle_H_
+
+#include "../api.h"
+
+#include "ExportedObject.h"
+
+#include "../graphics/Pixel32.h"
+
+#include <pango/pango.h>
+#include <boost/shared_ptr.hpp>
+
+#include <string>
+
+namespace avg {
+
+class FontStyle;
+typedef boost::shared_ptr<class FontStyle> FontStylePtr;
+
+class AVG_API FontStyle: public ExportedObject
+{
+ public:
+ static void registerType();
+
+ FontStyle(const ArgList& args);
+ FontStyle();
+ virtual ~FontStyle();
+
+ void setDefaultedArgs(const ArgList& args);
+
+ const std::string& getFont() const;
+ void setFont(const std::string& sName);
+
+ const std::string& getFontVariant() const;
+ void setFontVariant(const std::string& sVariant);
+
+ const std::string& getColor() const;
+ void setColor(const std::string& sColor);
+
+ virtual float getAAGamma() const;
+ virtual void setAAGamma(float gamma);
+
+ float getFontSize() const;
+ void setFontSize(float size);
+
+ int getIndent() const;
+ void setIndent(int indent);
+
+ float getLineSpacing() const;
+ void setLineSpacing(float lineSpacing);
+
+ std::string getAlignment() const;
+ void setAlignment(const std::string& sAlignment);
+
+ std::string getWrapMode() const;
+ void setWrapMode(const std::string& sWrapMode);
+
+ bool getJustify() const;
+ void setJustify(bool bJustify);
+
+ float getLetterSpacing() const;
+ void setLetterSpacing(float letterSpacing);
+
+ bool getHint() const;
+ void setHint(bool bHint);
+
+ PangoAlignment getAlignmentVal() const;
+ PangoWrapMode getWrapModeVal() const;
+ Pixel32 getColorVal() const;
+
+ private:
+ void applyBaseStyle(const FontStyle& baseStyle, const ArgList& args);
+
+ std::string m_sName;
+ std::string m_sVariant;
+ std::string m_sColorName;
+ Pixel32 m_Color;
+ float m_AAGamma;
+ float m_Size;
+ int m_Indent;
+ float m_LineSpacing;
+ PangoAlignment m_Alignment;
+ PangoWrapMode m_WrapMode;
+ bool m_bJustify;
+ float m_LetterSpacing;
+ bool m_bHint;
+
+};
+
+typedef boost::shared_ptr<class FontStyle> FontStylePtr;
+
+}
+#endif
diff --git a/src/player/HueSatFXNode.cpp b/src/player/HueSatFXNode.cpp
index c65e9fa..b15f333 100644
--- a/src/player/HueSatFXNode.cpp
+++ b/src/player/HueSatFXNode.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -24,7 +24,8 @@
#include "../base/ObjectCounter.h"
#include "../base/Logger.h"
-#include "../graphics/ShaderRegistry.h"
+
+#include "../graphics/BitmapLoader.h"
#include<sstream>
@@ -32,13 +33,12 @@ using namespace std;
namespace avg {
-HueSatFXNode::HueSatFXNode(int hue, int saturation, int lightness,
- bool tint):
- FXNode(),
- m_fHue(hue),
- m_fLightnessOffset(lightness),
- m_fSaturation(saturation),
- m_bColorize(tint)
+HueSatFXNode::HueSatFXNode(int hue, int saturation, int lightness, bool bColorize)
+ : FXNode(),
+ m_fHue(hue),
+ m_fLightnessOffset(lightness),
+ m_fSaturation(saturation),
+ m_bColorize(bColorize)
{
ObjectCounter::get()->incRef(&typeid(*this));
}
@@ -94,9 +94,9 @@ void HueSatFXNode::setHue(int hue)
void HueSatFXNode::setSaturation(int saturation)
{
- if(m_bColorize){
+ if (m_bColorize) {
m_fSaturation = clamp(saturation, 0, 100);
- }else{
+ } else {
m_fSaturation = clamp(saturation, -100, 100);
}
setFilterParams();
@@ -104,23 +104,19 @@ void HueSatFXNode::setSaturation(int saturation)
void HueSatFXNode::setLightnessOffset(int lightnessOffset)
{
- m_fLightnessOffset= clamp(lightnessOffset, -100, 100);
+ m_fLightnessOffset = clamp(lightnessOffset, -100, 100);
setFilterParams();
}
void HueSatFXNode::setColorizing(bool colorize)
{
m_bColorize = colorize;
- m_fHue = 0;
- m_fLightnessOffset = 0;
- m_fSaturation = m_bColorize ? 50 : 0;
setFilterParams();
}
GPUFilterPtr HueSatFXNode::createFilter(const IntPoint& size)
{
- filterPtr = GPUHueSatFilterPtr(new GPUHueSatFilter(size, B8G8R8A8,
- false));
+ filterPtr = GPUHueSatFilterPtr(new GPUHueSatFilter(size, true, false));
setFilterParams();
return filterPtr;
}
@@ -145,9 +141,9 @@ std::string HueSatFXNode::toString()
int HueSatFXNode::clamp(int val, int min, int max)
{
int result = val;
- if(val < min){
+ if (val < min) {
result = min;
- }else if(val > max){
+ } else if (val > max) {
result = max;
}
return result;
diff --git a/src/player/HueSatFXNode.h b/src/player/HueSatFXNode.h
index 780c271..410a7ec 100644
--- a/src/player/HueSatFXNode.h
+++ b/src/player/HueSatFXNode.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -37,8 +37,7 @@ namespace avg {
class AVG_API HueSatFXNode : public FXNode {
public:
- HueSatFXNode(int hue=0, int saturation=0, int lightness=0,
- bool tint=false);
+ HueSatFXNode(int hue=0, int saturation=0, int lightness=0, bool bColorize=false);
virtual ~HueSatFXNode();
virtual void disconnect();
@@ -67,7 +66,7 @@ private:
};
typedef boost::shared_ptr<HueSatFXNode> HueSatFXNodePtr;
-} //end namespace avg
+}
#endif
diff --git a/src/graphics/FilterId.h b/src/player/IBitmapLoadedListener.h
index 5b97e5b..da32f8b 100644
--- a/src/graphics/FilterId.h
+++ b/src/player/IBitmapLoadedListener.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -18,29 +18,27 @@
//
// Current versions can be found at www.libavg.de
//
-// Original author of this file is igor@c-base.org.
-//
-#ifndef _FilterId_H_
-#define _FilterId_H_
+#ifndef _IBitmapLoadedListener_H_
+#define _IBitmapLoadedListener_H_
#include "../api.h"
-#include "Filter.h"
-#include "Bitmap.h"
#include <boost/shared_ptr.hpp>
namespace avg {
-
-class AVG_API FilterId: public Filter
-{
- public:
- FilterId(){};
- virtual void applyInPlace(BitmapPtr img) {};
- virtual ~FilterId(){};
-};
-typedef boost::shared_ptr<FilterId> FilterIdPtr;
+class Bitmap;
+typedef boost::shared_ptr<Bitmap> BitmapPtr;
+class Exception;
+
+class AVG_API IBitmapLoadedListener {
+public:
+ virtual ~IBitmapLoadedListener() {};
+ virtual void onBitmapLoaded(BitmapPtr pBmp) = 0;
+ virtual void onBitmapLoadError(const Exception* e) = 0;
+};
}
+
#endif
diff --git a/src/player/IInputDevice.h b/src/player/IInputDevice.h
index 709809d..b155efe 100644
--- a/src/player/IInputDevice.h
+++ b/src/player/IInputDevice.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/player/Image.cpp b/src/player/Image.cpp
index 35e6801..5ac5fb9 100644
--- a/src/player/Image.cpp
+++ b/src/player/Image.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -26,6 +26,8 @@
#include "../base/ObjectCounter.h"
#include "../graphics/Filterfliprgb.h"
+#include "../graphics/TextureMover.h"
+#include "../graphics/BitmapLoader.h"
#include "OGLSurface.h"
#include "OffscreenCanvas.h"
@@ -122,8 +124,8 @@ void Image::setEmpty()
void Image::setFilename(const std::string& sFilename, TextureCompression comp)
{
assertValid();
- AVG_TRACE(Logger::MEMORY, "Loading " << sFilename);
- BitmapPtr pBmp(new Bitmap(sFilename));
+ AVG_TRACE(Logger::category::MEMORY, Logger::severity::INFO, "Loading " << sFilename);
+ BitmapPtr pBmp = loadBitmap(sFilename);
if (comp == TEXTURECOMPRESSION_B5G6R5 && pBmp->hasAlpha()) {
throw Exception(AVG_ERR_UNSUPPORTED,
"B5G6R5-compressed textures with an alpha channel are not supported.");
@@ -136,6 +138,9 @@ void Image::setFilename(const std::string& sFilename, TextureCompression comp)
switch (comp) {
case TEXTURECOMPRESSION_B5G6R5:
m_pBmp = BitmapPtr(new Bitmap(pBmp->getSize(), B5G6R5, sFilename));
+ if (!BitmapLoader::get()->isBlueFirst()) {
+ FilterFlipRGB().applyInPlace(pBmp);
+ }
m_pBmp->copyPixels(*pBmp);
break;
case TEXTURECOMPRESSION_NONE:
@@ -165,10 +170,13 @@ void Image::setBitmap(BitmapPtr pBmp, TextureCompression comp)
PixelFormat pf;
switch (comp) {
case TEXTURECOMPRESSION_NONE:
- pf = calcSurfacePF(*pBmp);
+ pf = pBmp->getPixelFormat();
break;
case TEXTURECOMPRESSION_B5G6R5:
pf = B5G6R5;
+ if (!BitmapLoader::get()->isBlueFirst()) {
+ FilterFlipRGB().applyInPlace(pBmp);
+ }
break;
default:
assert(false);
@@ -179,7 +187,7 @@ void Image::setBitmap(BitmapPtr pBmp, TextureCompression comp)
m_pSurface->getPixelFormat() != pf)
{
pTex = GLTexturePtr(new GLTexture(pBmp->getSize(), pf,
- m_Material.getUseMipmaps(), m_Material.getWrapSMode(),
+ m_Material.getUseMipmaps(), 0, m_Material.getWrapSMode(),
m_Material.getWrapTMode()));
m_pSurface->create(pf, pTex);
}
@@ -265,23 +273,25 @@ IntPoint Image::getSize()
PixelFormat Image::getPixelFormat()
{
- if (m_Source == NONE) {
- return B8G8R8X8;
+ PixelFormat pf;
+ if (BitmapLoader::get()->isBlueFirst()) {
+ pf = B8G8R8X8;
} else {
+ pf = R8G8B8X8;
+ }
+ if (m_Source != NONE) {
switch (m_State) {
case CPU:
- if (m_Source == SCENE) {
- return B8G8R8X8;
- } else {
- return m_pBmp->getPixelFormat();
+ if (m_Source != SCENE) {
+ pf = m_pBmp->getPixelFormat();
}
case GPU:
- return m_pSurface->getPixelFormat();
+ pf = m_pSurface->getPixelFormat();
default:
AVG_ASSERT(false);
- return B8G8R8X8;
}
}
+ return pf;
}
OGLSurface* Image::getSurface()
@@ -327,34 +337,16 @@ string Image::compression2String(TextureCompression compression)
void Image::setupSurface()
{
- PixelFormat pf = calcSurfacePF(*m_pBmp);
+ PixelFormat pf = m_pBmp->getPixelFormat();
+// cerr << "setupSurface: " << pf << endl;
GLTexturePtr pTex(new GLTexture(m_pBmp->getSize(), pf, m_Material.getUseMipmaps(),
- m_Material.getWrapSMode(), m_Material.getWrapTMode()));
+ 0, m_Material.getWrapSMode(), m_Material.getWrapTMode()));
m_pSurface->create(pf, pTex);
TextureMoverPtr pMover = TextureMover::create(m_pBmp->getSize(), pf, GL_STATIC_DRAW);
- BitmapPtr pMoverBmp = pMover->lock();
- pMoverBmp->copyPixels(*m_pBmp);
- pMover->unlock();
- pMover->moveToTexture(*pTex);
+ pMover->moveBmpToTexture(m_pBmp, *pTex);
m_pBmp = BitmapPtr();
}
-PixelFormat Image::calcSurfacePF(const Bitmap& bmp)
-{
- PixelFormat pf;
- pf = B8G8R8X8;
- if (bmp.hasAlpha()) {
- pf = B8G8R8A8;
- }
- if (bmp.getPixelFormat() == I8) {
- pf = I8;
- }
- if (bmp.getPixelFormat() == B5G6R5) {
- pf = B5G6R5;
- }
- return pf;
-}
-
bool Image::changeSource(Source newSource)
{
if (newSource != m_Source) {
@@ -388,8 +380,7 @@ void Image::assertValid() const
AVG_ASSERT((m_Source == SCENE) == bool(m_pCanvas));
switch (m_State) {
case CPU:
- AVG_ASSERT((m_Source == FILE || m_Source == BITMAP) ==
- bool(m_pBmp));
+ AVG_ASSERT((m_Source == FILE || m_Source == BITMAP) == bool(m_pBmp));
AVG_ASSERT(!(m_pSurface->isCreated()));
break;
case GPU:
diff --git a/src/player/Image.h b/src/player/Image.h
index f7be873..6b6ad83 100644
--- a/src/player/Image.h
+++ b/src/player/Image.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -26,7 +26,7 @@
#include "MaterialInfo.h"
-#include "../base/Point.h"
+#include "../base/GLMHelper.h"
#include "../graphics/Bitmap.h"
#include <boost/shared_ptr.hpp>
@@ -76,7 +76,6 @@ class AVG_API Image
private:
void setupSurface();
- PixelFormat calcSurfacePF(const Bitmap& Bmp);
bool changeSource(Source newSource);
void assertValid() const;
diff --git a/src/player/ImageNode.cpp b/src/player/ImageNode.cpp
index d584ef4..18543c2 100644
--- a/src/player/ImageNode.cpp
+++ b/src/player/ImageNode.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -21,7 +21,7 @@
#include "ImageNode.h"
-#include "NodeDefinition.h"
+#include "TypeDefinition.h"
#include "OGLSurface.h"
#include "Player.h"
#include "OffscreenCanvas.h"
@@ -41,12 +41,13 @@ using namespace std;
namespace avg {
-NodeDefinition ImageNode::createDefinition()
+void ImageNode::registerType()
{
- return NodeDefinition("image", Node::buildNode<ImageNode>)
- .extendDefinition(RasterNode::createDefinition())
+ TypeDefinition def = TypeDefinition("image", "rasternode",
+ ExportedObject::buildObject<ImageNode>)
.addArg(Arg<UTF8String>("href", "", false, offsetof(ImageNode, m_href)))
.addArg(Arg<string>("compression", "none"));
+ TypeRegistry::get()->registerType(def);
}
ImageNode::ImageNode(const ArgList& args)
@@ -73,7 +74,6 @@ void ImageNode::connectDisplay()
if (m_pImage->getSource() == Image::SCENE) {
checkCanvasValid(m_pImage->getCanvas());
}
- getSurface()->attach();
m_pImage->moveToGPU();
RasterNode::connectDisplay();
if (m_pImage->getSource() == Image::SCENE) {
@@ -135,33 +135,40 @@ const string ImageNode::getCompression() const
void ImageNode::setBitmap(BitmapPtr pBmp)
{
- if (m_pImage->getSource() == Image::SCENE && getState() == Node::NS_CANRENDER)
- {
+ if (m_pImage->getSource() == Image::SCENE && getState() == Node::NS_CANRENDER) {
m_pImage->getCanvas()->removeDependentCanvas(getCanvas());
}
m_pImage->setBitmap(pBmp, m_Compression);
if (getState() == Node::NS_CANRENDER) {
- bind();
+ newSurface();
}
m_href = "";
setViewport(-32767, -32767, -32767, -32767);
}
-void ImageNode::preRender()
+static ProfilingZoneID PrerenderProfilingZone("ImageNode::prerender");
+
+void ImageNode::preRender(const VertexArrayPtr& pVA, bool bIsParentActive,
+ float parentEffectiveOpacity)
{
- Node::preRender();
+ ScopeTimer timer(PrerenderProfilingZone);
+ Node::preRender(pVA, bIsParentActive, parentEffectiveOpacity);
if (isVisible()) {
- renderFX(getSize(), Pixel32(255, 255, 255, 255), bool(m_pImage->getCanvas()));
+ bool bHasCanvas = bool(m_pImage->getCanvas());
+ if (m_pImage->getSource() != Image::NONE) {
+ renderFX(getSize(), Pixel32(255, 255, 255, 255), bHasCanvas, bHasCanvas);
+ }
}
+ calcVertexArray(pVA);
}
static ProfilingZoneID RenderProfilingZone("ImageNode::render");
-void ImageNode::render(const DRect& Rect)
+void ImageNode::render()
{
ScopeTimer Timer(RenderProfilingZone);
if (m_pImage->getSource() != Image::NONE) {
- blt32(getSize(), getEffectiveOpacity(), getBlendMode(),
+ blt32(getTransform(), getSize(), getEffectiveOpacity(), getBlendMode(),
bool(m_pImage->getCanvas()));
}
}
@@ -184,21 +191,25 @@ void ImageNode::checkReload()
if (getState() == NS_CANRENDER) {
pCanvas->addDependentCanvas(getCanvas());
}
+ newSurface();
} else {
- Node::checkReload(m_href, m_pImage, m_Compression);
+ bool bNewImage = Node::checkReload(m_href, m_pImage, m_Compression);
+ if (bNewImage) {
+ newSurface();
+ }
}
setViewport(-32767, -32767, -32767, -32767);
RasterNode::checkReload();
}
-void ImageNode::getElementsByPos(const DPoint& pos, vector<NodeWeakPtr>& pElements)
+void ImageNode::getElementsByPos(const glm::vec2& pos, vector<NodePtr>& pElements)
{
if (reactsToMouseEvents()) {
OffscreenCanvasPtr pCanvas = m_pImage->getCanvas();
if (pCanvas && pCanvas->getHandleEvents()) {
- DPoint nodeSize(getSize());
- DPoint canvasSize(pCanvas->getSize());
- DPoint localPos(pos.x*(canvasSize.x/nodeSize.x),
+ glm::vec2 nodeSize(getSize());
+ glm::vec2 canvasSize(pCanvas->getSize());
+ glm::vec2 localPos(pos.x*(canvasSize.x/nodeSize.x),
pos.y*(canvasSize.y/nodeSize.y));
pCanvas->getRootNode()->getElementsByPos(localPos, pElements);
} else {
diff --git a/src/player/ImageNode.h b/src/player/ImageNode.h
index e460c98..fce7d71 100644
--- a/src/player/ImageNode.h
+++ b/src/player/ImageNode.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -36,7 +36,7 @@ namespace avg {
class AVG_API ImageNode : public RasterNode
{
public:
- static NodeDefinition createDefinition();
+ static void registerType();
ImageNode(const ArgList& args);
virtual ~ImageNode();
@@ -50,10 +50,11 @@ class AVG_API ImageNode : public RasterNode
const std::string getCompression() const;
void setBitmap(BitmapPtr pBmp);
- virtual void preRender();
- virtual void render(const DRect& Rect);
+ virtual void preRender(const VertexArrayPtr& pVA, bool bIsParentActive,
+ float parentEffectiveOpacity);
+ virtual void render();
- void getElementsByPos(const DPoint& pos, std::vector<NodeWeakPtr>& pElements);
+ void getElementsByPos(const glm::vec2& pos, std::vector<NodePtr>& pElements);
virtual BitmapPtr getBitmap();
virtual IntPoint getMediaSize();
diff --git a/src/player/InvertFXNode.cpp b/src/player/InvertFXNode.cpp
index 589675a..c99cfa0 100644
--- a/src/player/InvertFXNode.cpp
+++ b/src/player/InvertFXNode.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -23,7 +23,8 @@
#include "../base/ObjectCounter.h"
#include "../base/Logger.h"
-#include "../graphics/ShaderRegistry.h"
+
+#include "../graphics/BitmapLoader.h"
#include <sstream>
@@ -31,13 +32,14 @@ using namespace std;
namespace avg {
-InvertFXNode::InvertFXNode():
- FXNode()
+InvertFXNode::InvertFXNode()
+ : FXNode()
{
ObjectCounter::get()->incRef(&typeid(*this));
}
-InvertFXNode::~InvertFXNode() {
+InvertFXNode::~InvertFXNode()
+{
ObjectCounter::get()->decRef(&typeid(*this));
}
@@ -49,8 +51,7 @@ void InvertFXNode::disconnect()
GPUFilterPtr InvertFXNode::createFilter(const IntPoint& size)
{
- filterPtr = GPUInvertFilterPtr(new GPUInvertFilter(size, B8G8R8A8,
- false));
+ filterPtr = GPUInvertFilterPtr(new GPUInvertFilter(size, true, false));
setDirty();
return filterPtr;
}
diff --git a/src/player/InvertFXNode.h b/src/player/InvertFXNode.h
index 5b148b2..53a6973 100644
--- a/src/player/InvertFXNode.h
+++ b/src/player/InvertFXNode.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/player/KeyEvent.cpp b/src/player/KeyEvent.cpp
index b922280..5ff8ce3 100644
--- a/src/player/KeyEvent.cpp
+++ b/src/player/KeyEvent.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -72,8 +72,8 @@ int KeyEvent::getModifiers() const
void KeyEvent::trace()
{
Event::trace();
- AVG_TRACE(Logger::EVENTS2, "Scancode: " << m_ScanCode
- << ", Keycode: " << m_KeyCode << ", KeyString: "
+ AVG_TRACE(Logger::category::EVENTS, Logger::severity::DEBUG,
+ "Scancode: " << m_ScanCode << ", Keycode: " << m_KeyCode << ", KeyString: "
<< m_KeyString << ", Modifiers: " << m_Modifiers);
}
diff --git a/src/player/KeyEvent.h b/src/player/KeyEvent.h
index 7559b7c..84ef8cf 100644
--- a/src/player/KeyEvent.h
+++ b/src/player/KeyEvent.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/player/LibMTDevInputDevice.cpp b/src/player/LibMTDevInputDevice.cpp
index 30eb11c..edfd061 100644
--- a/src/player/LibMTDevInputDevice.cpp
+++ b/src/player/LibMTDevInputDevice.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -27,7 +27,6 @@
#include "TouchStatus.h"
#include "../base/Logger.h"
-#include "../base/Point.h"
#include "../base/ObjectCounter.h"
#include "../base/Exception.h"
#include "../base/OSHelper.h"
@@ -86,7 +85,8 @@ void LibMTDevInputDevice::start()
m_Dimensions.br.y = pAbsInfo->maximum;
MultitouchInputDevice::start();
- AVG_TRACE(Logger::CONFIG, "Linux MTDev Multitouch event source created.");
+ AVG_TRACE(Logger::category::CONFIG, Logger::severity::INFO,
+ "Linux MTDev Multitouch event source created.");
}
std::vector<EventPtr> LibMTDevInputDevice::pollEvents()
@@ -117,7 +117,7 @@ std::vector<EventPtr> LibMTDevInputDevice::pollEvents()
TouchEventPtr pOldEvent = pTouchStatus->getLastEvent();
TouchEventPtr pUpEvent =
boost::dynamic_pointer_cast<TouchEvent>(
- pOldEvent->cloneAs(Event::CURSORUP));
+ pOldEvent->cloneAs(Event::CURSOR_UP));
pTouchStatus->pushEvent(pUpEvent);
removeTouchStatus(pTouch->id);
}
@@ -162,14 +162,15 @@ void LibMTDevInputDevice::processEvents(const set<int>& changedIDs)
if (!pTouchStatus) {
// Down
m_LastID++;
- TouchEventPtr pEvent = createEvent(m_LastID, Event::CURSORDOWN,
+ TouchEventPtr pEvent = createEvent(m_LastID, Event::CURSOR_DOWN,
touch.pos);
// cerr << "down <" << touch.id << "> --> [" << m_LastID << "]" << endl;
addTouchStatus((long)touch.id, pEvent);
} else {
// cerr << "move <" << touch.id << "> --> " << touch.pos << endl;
// Move
- TouchEventPtr pEvent = createEvent(0, Event::CURSORMOTION, touch.pos);
+ TouchEventPtr pEvent = createEvent(0, Event::CURSOR_MOTION,
+ touch.pos);
pTouchStatus->pushEvent(pEvent);
}
}
@@ -179,9 +180,9 @@ void LibMTDevInputDevice::processEvents(const set<int>& changedIDs)
TouchEventPtr LibMTDevInputDevice::createEvent(int id, Event::Type type, IntPoint pos)
{
- DPoint size = getWindowSize();
- DPoint normPos = DPoint(double(pos.x-m_Dimensions.tl.x)/m_Dimensions.width(),
- double(pos.y-m_Dimensions.tl.y)/m_Dimensions.height());
+ glm::vec2 size(Player::get()->getScreenResolution());
+ glm::vec2 normPos(float(pos.x-m_Dimensions.tl.x)/m_Dimensions.width(),
+ float(pos.y-m_Dimensions.tl.y)/m_Dimensions.height());
IntPoint screenPos(int(normPos.x*size.x+0.5), int(normPos.y*size.y+0.5));
return TouchEventPtr(new TouchEvent(id, type, screenPos, Event::TOUCH));
}
diff --git a/src/player/LibMTDevInputDevice.h b/src/player/LibMTDevInputDevice.h
index cb07695..d8417c1 100644
--- a/src/player/LibMTDevInputDevice.h
+++ b/src/player/LibMTDevInputDevice.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/player/LineNode.cpp b/src/player/LineNode.cpp
index 1ee299f..39a1b57 100644
--- a/src/player/LineNode.cpp
+++ b/src/player/LineNode.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -21,7 +21,7 @@
#include "LineNode.h"
-#include "NodeDefinition.h"
+#include "TypeDefinition.h"
#include "../base/Exception.h"
@@ -32,15 +32,16 @@ using namespace std;
namespace avg {
-NodeDefinition LineNode::createDefinition()
+void LineNode::registerType()
{
- return NodeDefinition("line", Node::buildNode<LineNode>)
- .extendDefinition(VectorNode::createDefinition())
- .addArg(Arg<DPoint>("pos1", DPoint(0,0), false, offsetof(LineNode, m_P1)))
- .addArg(Arg<DPoint>("pos2", DPoint(0,0), false, offsetof(LineNode, m_P2)))
- .addArg(Arg<double>("texcoord1", 0, false, offsetof(LineNode, m_TC1)))
- .addArg(Arg<double>("texcoord2", 1, false, offsetof(LineNode, m_TC2)))
+ TypeDefinition def = TypeDefinition("line", "vectornode",
+ ExportedObject::buildObject<LineNode>)
+ .addArg(Arg<glm::vec2>("pos1", glm::vec2(0,0), false, offsetof(LineNode, m_P1)))
+ .addArg(Arg<glm::vec2>("pos2", glm::vec2(0,0), false, offsetof(LineNode, m_P2)))
+ .addArg(Arg<float>("texcoord1", 0, false, offsetof(LineNode, m_TC1)))
+ .addArg(Arg<float>("texcoord2", 1, false, offsetof(LineNode, m_TC2)))
;
+ TypeRegistry::get()->registerType(def);
}
LineNode::LineNode(const ArgList& args)
@@ -53,53 +54,53 @@ LineNode::~LineNode()
{
}
-const DPoint& LineNode::getPos1() const
+const glm::vec2& LineNode::getPos1() const
{
return m_P1;
}
-void LineNode::setPos1(const DPoint& pt)
+void LineNode::setPos1(const glm::vec2& pt)
{
m_P1 = pt;
setDrawNeeded();
}
-const DPoint& LineNode::getPos2() const
+const glm::vec2& LineNode::getPos2() const
{
return m_P2;
}
-void LineNode::setPos2(const DPoint& pt)
+void LineNode::setPos2(const glm::vec2& pt)
{
m_P2 = pt;
setDrawNeeded();
}
-double LineNode::getTexCoord1() const
+float LineNode::getTexCoord1() const
{
return m_TC1;
}
-void LineNode::setTexCoord1(double tc)
+void LineNode::setTexCoord1(float tc)
{
m_TC1 = tc;
setDrawNeeded();
}
-double LineNode::getTexCoord2() const
+float LineNode::getTexCoord2() const
{
return m_TC2;
}
-void LineNode::setTexCoord2(double tc)
+void LineNode::setTexCoord2(float tc)
{
m_TC2 = tc;
setDrawNeeded();
}
-void LineNode::calcVertexes(VertexArrayPtr& pVertexArray, Pixel32 color)
+void LineNode::calcVertexes(const VertexDataPtr& pVertexData, Pixel32 color)
{
- pVertexArray->addLineData(color, m_P1, m_P2, getStrokeWidth(), m_TC1, m_TC2);
+ pVertexData->addLineData(color, m_P1, m_P2, getStrokeWidth(), m_TC1, m_TC2);
}
}
diff --git a/src/player/LineNode.h b/src/player/LineNode.h
index daa5fbd..2843b48 100644
--- a/src/player/LineNode.h
+++ b/src/player/LineNode.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -32,30 +32,30 @@ namespace avg {
class AVG_API LineNode : public VectorNode
{
public:
- static NodeDefinition createDefinition();
+ static void registerType();
LineNode(const ArgList& args);
virtual ~LineNode();
- const DPoint& getPos1() const;
- void setPos1(const DPoint& pt);
+ const glm::vec2& getPos1() const;
+ void setPos1(const glm::vec2& pt);
- const DPoint& getPos2() const;
- void setPos2(const DPoint& pt);
+ const glm::vec2& getPos2() const;
+ void setPos2(const glm::vec2& pt);
- double getTexCoord1() const;
- void setTexCoord1(double tc);
+ float getTexCoord1() const;
+ void setTexCoord1(float tc);
- double getTexCoord2() const;
- void setTexCoord2(double tc);
+ float getTexCoord2() const;
+ void setTexCoord2(float tc);
- virtual void calcVertexes(VertexArrayPtr& pVertexArray, Pixel32 color);
+ virtual void calcVertexes(const VertexDataPtr& pVertexData, Pixel32 color);
private:
- DPoint m_P1;
- DPoint m_P2;
- double m_TC1;
- double m_TC2;
+ glm::vec2 m_P1;
+ glm::vec2 m_P2;
+ float m_TC1;
+ float m_TC2;
};
}
diff --git a/src/player/MainCanvas.cpp b/src/player/MainCanvas.cpp
index c85db63..2af29fc 100644
--- a/src/player/MainCanvas.cpp
+++ b/src/player/MainCanvas.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -59,7 +59,7 @@ void MainCanvas::setRoot(NodePtr pRootNode)
void MainCanvas::initPlayback(const SDLDisplayEnginePtr& pDisplayEngine)
{
m_pDisplayEngine = pDisplayEngine;
- Canvas::initPlayback(GLContext::getCurrent()->getConfig().m_MultiSampleSamples);
+ Canvas::initPlayback(GLContext::getMain()->getConfig().m_MultiSampleSamples);
}
BitmapPtr MainCanvas::screenshot() const
@@ -73,10 +73,15 @@ BitmapPtr MainCanvas::screenshot() const
static ProfilingZoneID RootRenderProfilingZone("Render MainCanvas");
-void MainCanvas::render()
+void MainCanvas::renderTree()
{
- Canvas::render(m_pDisplayEngine->getWindowSize(), false, FBOPtr(),
- RootRenderProfilingZone);
+ preRender();
+ glproc::BindFramebuffer(GL_FRAMEBUFFER, 0);
+ GLContext::checkError("Canvas::renderTree: BindFramebuffer()");
+ {
+ ScopeTimer Timer(RootRenderProfilingZone);
+ Canvas::render(m_pDisplayEngine->getWindowSize(), false);
+ }
}
}
diff --git a/src/player/MainCanvas.h b/src/player/MainCanvas.h
index c6d2310..55f68d6 100644
--- a/src/player/MainCanvas.h
+++ b/src/player/MainCanvas.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -41,7 +41,7 @@ class AVG_API MainCanvas: public Canvas
virtual BitmapPtr screenshot() const;
private:
- virtual void render();
+ virtual void renderTree();
SDLDisplayEnginePtr m_pDisplayEngine;
};
diff --git a/src/player/Makefile.am b/src/player/Makefile.am
index 6dfd5e2..40d95d4 100644
--- a/src/player/Makefile.am
+++ b/src/player/Makefile.am
@@ -1,17 +1,26 @@
-INCLUDES = -I.. @XML2_CFLAGS@ @FREETYPE_CFLAGS@ \
- @PANGOFT2_CFLAGS@ @PYTHON_INCLUDES@ @GL_CFLAGS@ @FFMPEG_CFLAGS@ \
+AM_CPPFLAGS = -I.. @XML2_CFLAGS@ @FREETYPE_CFLAGS@ \
+ @PANGOFT2_CFLAGS@ @PYTHON_CPPFLAGS@ @GL_CFLAGS@ \
@DC1394_2_CFLAGS@ @LIBRSVG_CFLAGS@ @FONTCONFIG_CFLAGS@ \
$(MTDEV_CFLAGS)
-
+
if APPLE
APPLE_SOURCES = SDLMain.m AppleTrackpadInputDevice.cpp
- APPLE_LINKFLAGS=-read_only_relocs suppress -F/System/Library/PrivateFrameworks -framework MultitouchSupport
+ APPLE_LINKFLAGS = -read_only_relocs suppress -F/System/Library/PrivateFrameworks \
+ -framework MultitouchSupport
XGL_LIBS =
else
APPLE_SOURCES =
- APPLE_LINKFLAGS=
+ APPLE_LINKFLAGS =
+if ENABLE_RPI
+ XGL_LIBS = -lXxf86vm -lX11 -lGLESv2 -lEGL
+else
+if ENABLE_EGL
+ XGL_LIBS = -lXxf86vm -lX11 -lGLESv2 -lEGL
+else
XGL_LIBS = -lXxf86vm -lX11
endif
+endif
+endif
if ENABLE_MTDEV
MTDEV_SOURCES = LibMTDevInputDevice.cpp
@@ -37,66 +46,76 @@ endif
GL_SOURCES = OGLSurface.cpp SDLDisplayEngine.cpp
GL_INCLUDES = OGLSurface.h SDLDisplayEngine.h
-ALL_GL_LIBS = @GL_LIBS@ @SDL_LIBS@ $(XGL_LIBS)
+ALL_GL_LIBS = @GL_LIBS@ @SDL_LIBS@ $(XGL_LIBS)
-ALL_H = Player.h PluginManager.h IInputDevice.h VideoNode.h \
- DisplayEngine.h NodeRegistry.h Arg.h ArgBase.h ArgList.h \
- Node.h AreaNode.h DisplayParams.h NodeDefinition.h TextEngine.h \
+ALL_H = Player.h PluginManager.h IInputDevice.h VideoNode.h ExportedObject.h \
+ DisplayEngine.h TypeRegistry.h Arg.h ArgBase.h ArgList.h \
+ Node.h AreaNode.h DisplayParams.h TypeDefinition.h TextEngine.h \
AVGNode.h DivNode.h CursorState.h MaterialInfo.h Canvas.h MainCanvas.h \
Image.h ImageNode.h Timeout.h WordsNode.h WrapPython.h OffscreenCanvas.h \
EventDispatcher.h CursorEvent.h MouseEvent.h \
- Event.h KeyEvent.h PanoImageNode.h TestHelper.h CanvasNode.h \
+ Event.h KeyEvent.h TestHelper.h CanvasNode.h \
OffscreenCanvasNode.h MultitouchInputDevice.h \
RasterNode.h CameraNode.h TrackerInputDevice.h TrackerCalibrator.h \
TouchEvent.h Contact.h TouchStatus.h TrackerTouchStatus.h BoostPython.h \
- SoundNode.h \
+ SoundNode.h FontStyle.h \
VectorNode.h FilledVectorNode.h LineNode.h PolyLineNode.h RectNode.h \
CurveNode.h PolygonNode.h CircleNode.h Shape.h MeshNode.h FXNode.h \
NullFXNode.h BlurFXNode.h ShadowFXNode.h ChromaKeyFXNode.h HueSatFXNode.h \
InvertFXNode.h TUIOInputDevice.h VideoWriter.h VideoWriterThread.h \
- SVG.h SVGElement.h \
+ SVG.h SVGElement.h Publisher.h SubscriberInfo.h PublisherDefinition.h \
+ PublisherDefinitionRegistry.h MessageID.h VersionInfo.h \
+ PythonLogSink.h BitmapManager.h BitmapManagerThread.h IBitmapLoadedListener.h \
+ BitmapManagerMsg.h \
$(MTDEV_INCLUDES) $(GL_INCLUDES) $(XINPUT2_INCLUDES)
-TESTS=testcalibrator testplayer
+TESTS = testcalibrator testplayer
EXTRA_DIST = SDLMain.h
noinst_LTLIBRARIES = libplayer.la
noinst_PROGRAMS = testcalibrator testplayer
-testplayer_SOURCES=testplayer.cpp
+testplayer_SOURCES = testplayer.cpp
testplayer_LDADD = libplayer.la ../video/libvideo.la ../audio/libaudio.la \
+ ../base/triangulate/libtriangulate.la \
../imaging/libimaging.la ../graphics/libgraphics.la ../base/libbase.la \
../lmfit/liblmfit.la ../oscpack/liboscpack.la \
- @XML2_LIBS@ -l@BOOST_THREAD_LIB@ -lboost_system @PTHREAD_LIBS@ @PANGOFT2_LIBS@ @LIBRSVG_LIBS@\
+ @XML2_LIBS@ @BOOST_THREAD_LIBS@ @PTHREAD_CFLAGS@ @PTHREAD_LIBS@ @PANGOFT2_LIBS@ \
+ @LIBRSVG_LIBS@ \
@DC1394_2_LIBS@ @GLU_LIBS@ $(ALL_GL_LIBS) $(XI2_1_LIBS) $(XI2_2_LIBS) \
- @LIBFFMPEG@ $(BOOST_PYTHON_LIBS) $(PYTHON_LIBS) @GDK_PIXBUF_LIBS@ \
+ @LIBFFMPEG@ $(BOOST_PYTHON_LIBS) $(PYTHON_LDFLAGS) @GDK_PIXBUF_LIBS@ \
@FONTCONFIG_LIBS@
-
+
testplayer_LDFLAGS = $(APPLE_LINKFLAGS) -module -XCClinker
-testcalibrator_SOURCES=testcalibrator.cpp
+testcalibrator_SOURCES = testcalibrator.cpp
testcalibrator_LDADD = libplayer.la ../video/libvideo.la ../audio/libaudio.la \
+ ../base/triangulate/libtriangulate.la \
../imaging/libimaging.la ../graphics/libgraphics.la ../base/libbase.la \
../lmfit/liblmfit.la ../oscpack/liboscpack.la \
- @XML2_LIBS@ -l@BOOST_THREAD_LIB@ -lboost_system @PTHREAD_LIBS@ @LIBRSVG_LIBS@ @GDK_PIXBUF_LIBS@
+ @XML2_LIBS@ @BOOST_THREAD_LIBS@ @PTHREAD_CFLAGS@ @PTHREAD_LIBS@ @LIBRSVG_LIBS@ \
+ @GDK_PIXBUF_LIBS@
-libplayer_la_LIBADD = $(BOOST_PYTHON_LIBS) $(PYTHON_LIBS) $(MTDEV_LIBS)
+libplayer_la_LIBADD = $(BOOST_PYTHON_LIBS) $(PYTHON_LDFLAGS) $(MTDEV_LIBS)
libplayer_la_SOURCES = $(GL_SOURCES) \
- Arg.cpp AreaNode.cpp RasterNode.cpp DivNode.cpp VideoNode.cpp \
- Player.cpp PluginManager.cpp NodeRegistry.cpp ArgBase.cpp ArgList.cpp \
+ Arg.cpp AreaNode.cpp RasterNode.cpp DivNode.cpp VideoNode.cpp ExportedObject.cpp \
+ Player.cpp PluginManager.cpp TypeRegistry.cpp ArgBase.cpp ArgList.cpp \
DisplayEngine.cpp Canvas.cpp CanvasNode.cpp OffscreenCanvasNode.cpp \
- MainCanvas.cpp Node.cpp MultitouchInputDevice.cpp \
- PanoImageNode.cpp WordsNode.cpp CameraNode.cpp NodeDefinition.cpp TextEngine.cpp \
+ MainCanvas.cpp Node.cpp MultitouchInputDevice.cpp WrapPython.cpp \
+ WordsNode.cpp CameraNode.cpp TypeDefinition.cpp TextEngine.cpp \
Timeout.cpp Event.cpp DisplayParams.cpp CursorState.cpp MaterialInfo.cpp \
Image.cpp ImageNode.cpp EventDispatcher.cpp KeyEvent.cpp CursorEvent.cpp \
MouseEvent.cpp TouchEvent.cpp AVGNode.cpp TestHelper.cpp \
TrackerInputDevice.cpp TrackerTouchStatus.cpp TrackerCalibrator.cpp \
- SoundNode.cpp \
+ SoundNode.cpp FontStyle.cpp \
VectorNode.cpp FilledVectorNode.cpp LineNode.cpp PolyLineNode.cpp \
RectNode.cpp CurveNode.cpp PolygonNode.cpp CircleNode.cpp Shape.cpp MeshNode.cpp \
Contact.cpp TouchStatus.cpp OffscreenCanvas.cpp FXNode.cpp TUIOInputDevice.cpp \
NullFXNode.cpp BlurFXNode.cpp ShadowFXNode.cpp ChromaKeyFXNode.cpp \
InvertFXNode.cpp HueSatFXNode.cpp VideoWriter.cpp VideoWriterThread.cpp \
- SVG.cpp SVGElement.cpp \
+ SVG.cpp SVGElement.cpp Publisher.cpp SubscriberInfo.cpp PublisherDefinition.cpp \
+ PublisherDefinitionRegistry.cpp MessageID.cpp VersionInfo.cpp \
+ PythonLogSink.cpp BitmapManager.cpp BitmapManagerThread.cpp \
+ BitmapManagerMsg.cpp \
$(MTDEV_SOURCES) $(XINPUT2_SOURCES) $(APPLE_SOURCES) $(ALL_H)
libplayer_a_CXXFLAGS = -DPREFIXDIR=\"$(prefix)\"
diff --git a/src/player/Makefile.in b/src/player/Makefile.in
index 047b46a..a87be83 100644
--- a/src/player/Makefile.in
+++ b/src/player/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# Makefile.in generated by automake 1.11.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
-# Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -44,11 +44,12 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ac_cxx_namespaces.m4 \
$(top_srcdir)/m4/ac_path_generic.m4 \
$(top_srcdir)/m4/ax_boost_thread.m4 \
- $(top_srcdir)/m4/ax_check_gl.m4 $(top_srcdir)/m4/libtool.m4 \
- $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
- $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
- $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/m4/python_dev.m4 \
- $(top_srcdir)/configure.in
+ $(top_srcdir)/m4/ax_check_gl.m4 \
+ $(top_srcdir)/m4/ax_python_devel.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/pkg.m4 \
+ $(top_srcdir)/m4/avg_version.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
@@ -61,42 +62,52 @@ libplayer_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
am__libplayer_la_SOURCES_DIST = OGLSurface.cpp SDLDisplayEngine.cpp \
Arg.cpp AreaNode.cpp RasterNode.cpp DivNode.cpp VideoNode.cpp \
- Player.cpp PluginManager.cpp NodeRegistry.cpp ArgBase.cpp \
- ArgList.cpp DisplayEngine.cpp Canvas.cpp CanvasNode.cpp \
- OffscreenCanvasNode.cpp MainCanvas.cpp Node.cpp \
- MultitouchInputDevice.cpp PanoImageNode.cpp WordsNode.cpp \
- CameraNode.cpp NodeDefinition.cpp TextEngine.cpp Timeout.cpp \
- Event.cpp DisplayParams.cpp CursorState.cpp MaterialInfo.cpp \
- Image.cpp ImageNode.cpp EventDispatcher.cpp KeyEvent.cpp \
- CursorEvent.cpp MouseEvent.cpp TouchEvent.cpp AVGNode.cpp \
- TestHelper.cpp TrackerInputDevice.cpp TrackerTouchStatus.cpp \
- TrackerCalibrator.cpp SoundNode.cpp VectorNode.cpp \
- FilledVectorNode.cpp LineNode.cpp PolyLineNode.cpp \
- RectNode.cpp CurveNode.cpp PolygonNode.cpp CircleNode.cpp \
- Shape.cpp MeshNode.cpp Contact.cpp TouchStatus.cpp \
- OffscreenCanvas.cpp FXNode.cpp TUIOInputDevice.cpp \
- NullFXNode.cpp BlurFXNode.cpp ShadowFXNode.cpp \
- ChromaKeyFXNode.cpp InvertFXNode.cpp HueSatFXNode.cpp \
- VideoWriter.cpp VideoWriterThread.cpp SVG.cpp SVGElement.cpp \
+ ExportedObject.cpp Player.cpp PluginManager.cpp \
+ TypeRegistry.cpp ArgBase.cpp ArgList.cpp DisplayEngine.cpp \
+ Canvas.cpp CanvasNode.cpp OffscreenCanvasNode.cpp \
+ MainCanvas.cpp Node.cpp MultitouchInputDevice.cpp \
+ WrapPython.cpp WordsNode.cpp CameraNode.cpp TypeDefinition.cpp \
+ TextEngine.cpp Timeout.cpp Event.cpp DisplayParams.cpp \
+ CursorState.cpp MaterialInfo.cpp Image.cpp ImageNode.cpp \
+ EventDispatcher.cpp KeyEvent.cpp CursorEvent.cpp \
+ MouseEvent.cpp TouchEvent.cpp AVGNode.cpp TestHelper.cpp \
+ TrackerInputDevice.cpp TrackerTouchStatus.cpp \
+ TrackerCalibrator.cpp SoundNode.cpp FontStyle.cpp \
+ VectorNode.cpp FilledVectorNode.cpp LineNode.cpp \
+ PolyLineNode.cpp RectNode.cpp CurveNode.cpp PolygonNode.cpp \
+ CircleNode.cpp Shape.cpp MeshNode.cpp Contact.cpp \
+ TouchStatus.cpp OffscreenCanvas.cpp FXNode.cpp \
+ TUIOInputDevice.cpp NullFXNode.cpp BlurFXNode.cpp \
+ ShadowFXNode.cpp ChromaKeyFXNode.cpp InvertFXNode.cpp \
+ HueSatFXNode.cpp VideoWriter.cpp VideoWriterThread.cpp SVG.cpp \
+ SVGElement.cpp Publisher.cpp SubscriberInfo.cpp \
+ PublisherDefinition.cpp PublisherDefinitionRegistry.cpp \
+ MessageID.cpp VersionInfo.cpp PythonLogSink.cpp \
+ BitmapManager.cpp BitmapManagerThread.cpp BitmapManagerMsg.cpp \
LibMTDevInputDevice.cpp XInputMTInputDevice.cpp SDLMain.m \
AppleTrackpadInputDevice.cpp Player.h PluginManager.h \
- IInputDevice.h VideoNode.h DisplayEngine.h NodeRegistry.h \
- Arg.h ArgBase.h ArgList.h Node.h AreaNode.h DisplayParams.h \
- NodeDefinition.h TextEngine.h AVGNode.h DivNode.h \
- CursorState.h MaterialInfo.h Canvas.h MainCanvas.h Image.h \
- ImageNode.h Timeout.h WordsNode.h WrapPython.h \
+ IInputDevice.h VideoNode.h ExportedObject.h DisplayEngine.h \
+ TypeRegistry.h Arg.h ArgBase.h ArgList.h Node.h AreaNode.h \
+ DisplayParams.h TypeDefinition.h TextEngine.h AVGNode.h \
+ DivNode.h CursorState.h MaterialInfo.h Canvas.h MainCanvas.h \
+ Image.h ImageNode.h Timeout.h WordsNode.h WrapPython.h \
OffscreenCanvas.h EventDispatcher.h CursorEvent.h MouseEvent.h \
- Event.h KeyEvent.h PanoImageNode.h TestHelper.h CanvasNode.h \
+ Event.h KeyEvent.h TestHelper.h CanvasNode.h \
OffscreenCanvasNode.h MultitouchInputDevice.h RasterNode.h \
CameraNode.h TrackerInputDevice.h TrackerCalibrator.h \
TouchEvent.h Contact.h TouchStatus.h TrackerTouchStatus.h \
- BoostPython.h SoundNode.h VectorNode.h FilledVectorNode.h \
- LineNode.h PolyLineNode.h RectNode.h CurveNode.h PolygonNode.h \
- CircleNode.h Shape.h MeshNode.h FXNode.h NullFXNode.h \
- BlurFXNode.h ShadowFXNode.h ChromaKeyFXNode.h HueSatFXNode.h \
- InvertFXNode.h TUIOInputDevice.h VideoWriter.h \
- VideoWriterThread.h SVG.h SVGElement.h LibMTDevInputDevice.h \
- OGLSurface.h SDLDisplayEngine.h XInputMTInputDevice.h
+ BoostPython.h SoundNode.h FontStyle.h VectorNode.h \
+ FilledVectorNode.h LineNode.h PolyLineNode.h RectNode.h \
+ CurveNode.h PolygonNode.h CircleNode.h Shape.h MeshNode.h \
+ FXNode.h NullFXNode.h BlurFXNode.h ShadowFXNode.h \
+ ChromaKeyFXNode.h HueSatFXNode.h InvertFXNode.h \
+ TUIOInputDevice.h VideoWriter.h VideoWriterThread.h SVG.h \
+ SVGElement.h Publisher.h SubscriberInfo.h \
+ PublisherDefinition.h PublisherDefinitionRegistry.h \
+ MessageID.h VersionInfo.h PythonLogSink.h BitmapManager.h \
+ BitmapManagerThread.h IBitmapLoadedListener.h \
+ BitmapManagerMsg.h LibMTDevInputDevice.h OGLSurface.h \
+ SDLDisplayEngine.h XInputMTInputDevice.h
am__objects_1 = OGLSurface.lo SDLDisplayEngine.lo
@ENABLE_MTDEV_TRUE@am__objects_2 = LibMTDevInputDevice.lo
@HAVE_XI2_1_FALSE@@HAVE_XI2_2_TRUE@am__objects_3 = \
@@ -106,46 +117,50 @@ am__objects_1 = OGLSurface.lo SDLDisplayEngine.lo
am__objects_5 =
am__objects_6 = $(am__objects_5) $(am__objects_5) $(am__objects_5)
am_libplayer_la_OBJECTS = $(am__objects_1) Arg.lo AreaNode.lo \
- RasterNode.lo DivNode.lo VideoNode.lo Player.lo \
- PluginManager.lo NodeRegistry.lo ArgBase.lo ArgList.lo \
- DisplayEngine.lo Canvas.lo CanvasNode.lo \
+ RasterNode.lo DivNode.lo VideoNode.lo ExportedObject.lo \
+ Player.lo PluginManager.lo TypeRegistry.lo ArgBase.lo \
+ ArgList.lo DisplayEngine.lo Canvas.lo CanvasNode.lo \
OffscreenCanvasNode.lo MainCanvas.lo Node.lo \
- MultitouchInputDevice.lo PanoImageNode.lo WordsNode.lo \
- CameraNode.lo NodeDefinition.lo TextEngine.lo Timeout.lo \
+ MultitouchInputDevice.lo WrapPython.lo WordsNode.lo \
+ CameraNode.lo TypeDefinition.lo TextEngine.lo Timeout.lo \
Event.lo DisplayParams.lo CursorState.lo MaterialInfo.lo \
Image.lo ImageNode.lo EventDispatcher.lo KeyEvent.lo \
CursorEvent.lo MouseEvent.lo TouchEvent.lo AVGNode.lo \
TestHelper.lo TrackerInputDevice.lo TrackerTouchStatus.lo \
- TrackerCalibrator.lo SoundNode.lo VectorNode.lo \
+ TrackerCalibrator.lo SoundNode.lo FontStyle.lo VectorNode.lo \
FilledVectorNode.lo LineNode.lo PolyLineNode.lo RectNode.lo \
CurveNode.lo PolygonNode.lo CircleNode.lo Shape.lo MeshNode.lo \
Contact.lo TouchStatus.lo OffscreenCanvas.lo FXNode.lo \
TUIOInputDevice.lo NullFXNode.lo BlurFXNode.lo ShadowFXNode.lo \
ChromaKeyFXNode.lo InvertFXNode.lo HueSatFXNode.lo \
VideoWriter.lo VideoWriterThread.lo SVG.lo SVGElement.lo \
- $(am__objects_2) $(am__objects_3) $(am__objects_4) \
- $(am__objects_6)
+ Publisher.lo SubscriberInfo.lo PublisherDefinition.lo \
+ PublisherDefinitionRegistry.lo MessageID.lo VersionInfo.lo \
+ PythonLogSink.lo BitmapManager.lo BitmapManagerThread.lo \
+ BitmapManagerMsg.lo $(am__objects_2) $(am__objects_3) \
+ $(am__objects_4) $(am__objects_6)
libplayer_la_OBJECTS = $(am_libplayer_la_OBJECTS)
-AM_V_lt = $(am__v_lt_$(V))
-am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
am__v_lt_0 = --silent
PROGRAMS = $(noinst_PROGRAMS)
am_testcalibrator_OBJECTS = testcalibrator.$(OBJEXT)
testcalibrator_OBJECTS = $(am_testcalibrator_OBJECTS)
testcalibrator_DEPENDENCIES = libplayer.la ../video/libvideo.la \
- ../audio/libaudio.la ../imaging/libimaging.la \
- ../graphics/libgraphics.la ../base/libbase.la \
- ../lmfit/liblmfit.la ../oscpack/liboscpack.la
+ ../audio/libaudio.la ../base/triangulate/libtriangulate.la \
+ ../imaging/libimaging.la ../graphics/libgraphics.la \
+ ../base/libbase.la ../lmfit/liblmfit.la \
+ ../oscpack/liboscpack.la
am_testplayer_OBJECTS = testplayer.$(OBJEXT)
testplayer_OBJECTS = $(am_testplayer_OBJECTS)
am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1)
testplayer_DEPENDENCIES = libplayer.la ../video/libvideo.la \
- ../audio/libaudio.la ../imaging/libimaging.la \
- ../graphics/libgraphics.la ../base/libbase.la \
- ../lmfit/liblmfit.la ../oscpack/liboscpack.la \
- $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) \
+ ../audio/libaudio.la ../base/triangulate/libtriangulate.la \
+ ../imaging/libimaging.la ../graphics/libgraphics.la \
+ ../base/libbase.la ../lmfit/liblmfit.la \
+ ../oscpack/liboscpack.la $(am__DEPENDENCIES_2) \
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
- $(am__DEPENDENCIES_1)
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
testplayer_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
$(CXXFLAGS) $(testplayer_LDFLAGS) $(LDFLAGS) -o $@
@@ -159,18 +174,18 @@ LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CXXFLAGS) $(CXXFLAGS)
-AM_V_CXX = $(am__v_CXX_$(V))
-am__v_CXX_ = $(am__v_CXX_$(AM_DEFAULT_VERBOSITY))
+AM_V_CXX = $(am__v_CXX_@AM_V@)
+am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@)
am__v_CXX_0 = @echo " CXX " $@;
-AM_V_at = $(am__v_at_$(V))
-am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
CXXLD = $(CXX)
CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
$(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
-AM_V_CXXLD = $(am__v_CXXLD_$(V))
-am__v_CXXLD_ = $(am__v_CXXLD_$(AM_DEFAULT_VERBOSITY))
+AM_V_CXXLD = $(am__v_CXXLD_@AM_V@)
+am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@)
am__v_CXXLD_0 = @echo " CXXLD " $@;
OBJCCOMPILE = $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS)
@@ -178,15 +193,15 @@ LTOBJCCOMPILE = $(LIBTOOL) $(AM_V_lt) $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=compile $(OBJC) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_OBJCFLAGS) $(OBJCFLAGS)
-AM_V_OBJC = $(am__v_OBJC_$(V))
-am__v_OBJC_ = $(am__v_OBJC_$(AM_DEFAULT_VERBOSITY))
+AM_V_OBJC = $(am__v_OBJC_@AM_V@)
+am__v_OBJC_ = $(am__v_OBJC_@AM_DEFAULT_V@)
am__v_OBJC_0 = @echo " OBJC " $@;
OBJCLD = $(OBJC)
OBJCLINK = $(LIBTOOL) $(AM_V_lt) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(OBJCLD) $(AM_OBJCFLAGS) $(OBJCFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
-AM_V_OBJCLD = $(am__v_OBJCLD_$(V))
-am__v_OBJCLD_ = $(am__v_OBJCLD_$(AM_DEFAULT_VERBOSITY))
+AM_V_OBJCLD = $(am__v_OBJCLD_@AM_V@)
+am__v_OBJCLD_ = $(am__v_OBJCLD_@AM_DEFAULT_V@)
am__v_OBJCLD_0 = @echo " OBJCLD" $@;
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@@ -194,18 +209,18 @@ LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
-AM_V_CC = $(am__v_CC_$(V))
-am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
+AM_V_CC = $(am__v_CC_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
am__v_CC_0 = @echo " CC " $@;
CCLD = $(CC)
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
-AM_V_CCLD = $(am__v_CCLD_$(V))
-am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
-AM_V_GEN = $(am__v_GEN_$(V))
-am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
SOURCES = $(libplayer_la_SOURCES) $(testcalibrator_SOURCES) \
$(testplayer_SOURCES)
@@ -225,7 +240,7 @@ AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BOOST_PYTHON_LIBS = @BOOST_PYTHON_LIBS@
-BOOST_THREAD_LIB = @BOOST_THREAD_LIB@
+BOOST_THREAD_LIBS = @BOOST_THREAD_LIBS@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
@@ -240,6 +255,7 @@ DC1394_2_CFLAGS = @DC1394_2_CFLAGS@
DC1394_2_LIBS = @DC1394_2_LIBS@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
@@ -280,6 +296,7 @@ LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
MTDEV_CFLAGS = @MTDEV_CFLAGS@
MTDEV_LIBS = @MTDEV_LIBS@
@@ -309,11 +326,13 @@ PTHREAD_CC = @PTHREAD_CC@
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
PTHREAD_LIBS = @PTHREAD_LIBS@
PYTHON = @PYTHON@
+PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@
PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
-PYTHON_INCLUDES = @PYTHON_INCLUDES@
-PYTHON_LIBS = @PYTHON_LIBS@
+PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@
+PYTHON_LDFLAGS = @PYTHON_LDFLAGS@
PYTHON_PLATFORM = @PYTHON_PLATFORM@
PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_SITE_PKG = @PYTHON_SITE_PKG@
PYTHON_VERSION = @PYTHON_VERSION@
RANLIB = @RANLIB@
SDL_CFLAGS = @SDL_CFLAGS@
@@ -336,6 +355,7 @@ abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
@@ -370,7 +390,6 @@ libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
@@ -394,16 +413,20 @@ target_vendor = @target_vendor@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-INCLUDES = -I.. @XML2_CFLAGS@ @FREETYPE_CFLAGS@ \
- @PANGOFT2_CFLAGS@ @PYTHON_INCLUDES@ @GL_CFLAGS@ @FFMPEG_CFLAGS@ \
+AM_CPPFLAGS = -I.. @XML2_CFLAGS@ @FREETYPE_CFLAGS@ \
+ @PANGOFT2_CFLAGS@ @PYTHON_CPPFLAGS@ @GL_CFLAGS@ \
@DC1394_2_CFLAGS@ @LIBRSVG_CFLAGS@ @FONTCONFIG_CFLAGS@ \
$(MTDEV_CFLAGS)
@APPLE_FALSE@APPLE_SOURCES =
@APPLE_TRUE@APPLE_SOURCES = SDLMain.m AppleTrackpadInputDevice.cpp
@APPLE_FALSE@APPLE_LINKFLAGS =
-@APPLE_TRUE@APPLE_LINKFLAGS = -read_only_relocs suppress -F/System/Library/PrivateFrameworks -framework MultitouchSupport
-@APPLE_FALSE@XGL_LIBS = -lXxf86vm -lX11
+@APPLE_TRUE@APPLE_LINKFLAGS = -read_only_relocs suppress -F/System/Library/PrivateFrameworks \
+@APPLE_TRUE@ -framework MultitouchSupport
+
+@APPLE_FALSE@@ENABLE_EGL_FALSE@@ENABLE_RPI_FALSE@XGL_LIBS = -lXxf86vm -lX11
+@APPLE_FALSE@@ENABLE_EGL_TRUE@@ENABLE_RPI_FALSE@XGL_LIBS = -lXxf86vm -lX11 -lGLESv2 -lEGL
+@APPLE_FALSE@@ENABLE_RPI_TRUE@XGL_LIBS = -lXxf86vm -lX11 -lGLESv2 -lEGL
@APPLE_TRUE@XGL_LIBS =
@ENABLE_MTDEV_FALSE@MTDEV_SOURCES =
@ENABLE_MTDEV_TRUE@MTDEV_SOURCES = LibMTDevInputDevice.cpp
@@ -417,61 +440,71 @@ INCLUDES = -I.. @XML2_CFLAGS@ @FREETYPE_CFLAGS@ \
@HAVE_XI2_1_TRUE@XINPUT2_INCLUDES = XInputMTInputDevice.h
GL_SOURCES = OGLSurface.cpp SDLDisplayEngine.cpp
GL_INCLUDES = OGLSurface.h SDLDisplayEngine.h
-ALL_GL_LIBS = @GL_LIBS@ @SDL_LIBS@ $(XGL_LIBS)
-ALL_H = Player.h PluginManager.h IInputDevice.h VideoNode.h \
- DisplayEngine.h NodeRegistry.h Arg.h ArgBase.h ArgList.h \
- Node.h AreaNode.h DisplayParams.h NodeDefinition.h TextEngine.h \
+ALL_GL_LIBS = @GL_LIBS@ @SDL_LIBS@ $(XGL_LIBS)
+ALL_H = Player.h PluginManager.h IInputDevice.h VideoNode.h ExportedObject.h \
+ DisplayEngine.h TypeRegistry.h Arg.h ArgBase.h ArgList.h \
+ Node.h AreaNode.h DisplayParams.h TypeDefinition.h TextEngine.h \
AVGNode.h DivNode.h CursorState.h MaterialInfo.h Canvas.h MainCanvas.h \
Image.h ImageNode.h Timeout.h WordsNode.h WrapPython.h OffscreenCanvas.h \
EventDispatcher.h CursorEvent.h MouseEvent.h \
- Event.h KeyEvent.h PanoImageNode.h TestHelper.h CanvasNode.h \
+ Event.h KeyEvent.h TestHelper.h CanvasNode.h \
OffscreenCanvasNode.h MultitouchInputDevice.h \
RasterNode.h CameraNode.h TrackerInputDevice.h TrackerCalibrator.h \
TouchEvent.h Contact.h TouchStatus.h TrackerTouchStatus.h BoostPython.h \
- SoundNode.h \
+ SoundNode.h FontStyle.h \
VectorNode.h FilledVectorNode.h LineNode.h PolyLineNode.h RectNode.h \
CurveNode.h PolygonNode.h CircleNode.h Shape.h MeshNode.h FXNode.h \
NullFXNode.h BlurFXNode.h ShadowFXNode.h ChromaKeyFXNode.h HueSatFXNode.h \
InvertFXNode.h TUIOInputDevice.h VideoWriter.h VideoWriterThread.h \
- SVG.h SVGElement.h \
+ SVG.h SVGElement.h Publisher.h SubscriberInfo.h PublisherDefinition.h \
+ PublisherDefinitionRegistry.h MessageID.h VersionInfo.h \
+ PythonLogSink.h BitmapManager.h BitmapManagerThread.h IBitmapLoadedListener.h \
+ BitmapManagerMsg.h \
$(MTDEV_INCLUDES) $(GL_INCLUDES) $(XINPUT2_INCLUDES)
EXTRA_DIST = SDLMain.h
noinst_LTLIBRARIES = libplayer.la
testplayer_SOURCES = testplayer.cpp
testplayer_LDADD = libplayer.la ../video/libvideo.la ../audio/libaudio.la \
+ ../base/triangulate/libtriangulate.la \
../imaging/libimaging.la ../graphics/libgraphics.la ../base/libbase.la \
../lmfit/liblmfit.la ../oscpack/liboscpack.la \
- @XML2_LIBS@ -l@BOOST_THREAD_LIB@ @PTHREAD_LIBS@ @PANGOFT2_LIBS@ @LIBRSVG_LIBS@\
+ @XML2_LIBS@ @BOOST_THREAD_LIBS@ @PTHREAD_CFLAGS@ @PTHREAD_LIBS@ @PANGOFT2_LIBS@ \
+ @LIBRSVG_LIBS@ \
@DC1394_2_LIBS@ @GLU_LIBS@ $(ALL_GL_LIBS) $(XI2_1_LIBS) $(XI2_2_LIBS) \
- @LIBFFMPEG@ $(BOOST_PYTHON_LIBS) $(PYTHON_LIBS) @GDK_PIXBUF_LIBS@ \
+ @LIBFFMPEG@ $(BOOST_PYTHON_LIBS) $(PYTHON_LDFLAGS) @GDK_PIXBUF_LIBS@ \
@FONTCONFIG_LIBS@
testplayer_LDFLAGS = $(APPLE_LINKFLAGS) -module -XCClinker
testcalibrator_SOURCES = testcalibrator.cpp
testcalibrator_LDADD = libplayer.la ../video/libvideo.la ../audio/libaudio.la \
+ ../base/triangulate/libtriangulate.la \
../imaging/libimaging.la ../graphics/libgraphics.la ../base/libbase.la \
../lmfit/liblmfit.la ../oscpack/liboscpack.la \
- @XML2_LIBS@ -l@BOOST_THREAD_LIB@ @PTHREAD_LIBS@ @LIBRSVG_LIBS@ @GDK_PIXBUF_LIBS@
+ @XML2_LIBS@ @BOOST_THREAD_LIBS@ @PTHREAD_CFLAGS@ @PTHREAD_LIBS@ @LIBRSVG_LIBS@ \
+ @GDK_PIXBUF_LIBS@
-libplayer_la_LIBADD = $(BOOST_PYTHON_LIBS) $(PYTHON_LIBS) $(MTDEV_LIBS)
+libplayer_la_LIBADD = $(BOOST_PYTHON_LIBS) $(PYTHON_LDFLAGS) $(MTDEV_LIBS)
libplayer_la_SOURCES = $(GL_SOURCES) \
- Arg.cpp AreaNode.cpp RasterNode.cpp DivNode.cpp VideoNode.cpp \
- Player.cpp PluginManager.cpp NodeRegistry.cpp ArgBase.cpp ArgList.cpp \
+ Arg.cpp AreaNode.cpp RasterNode.cpp DivNode.cpp VideoNode.cpp ExportedObject.cpp \
+ Player.cpp PluginManager.cpp TypeRegistry.cpp ArgBase.cpp ArgList.cpp \
DisplayEngine.cpp Canvas.cpp CanvasNode.cpp OffscreenCanvasNode.cpp \
- MainCanvas.cpp Node.cpp MultitouchInputDevice.cpp \
- PanoImageNode.cpp WordsNode.cpp CameraNode.cpp NodeDefinition.cpp TextEngine.cpp \
+ MainCanvas.cpp Node.cpp MultitouchInputDevice.cpp WrapPython.cpp \
+ WordsNode.cpp CameraNode.cpp TypeDefinition.cpp TextEngine.cpp \
Timeout.cpp Event.cpp DisplayParams.cpp CursorState.cpp MaterialInfo.cpp \
Image.cpp ImageNode.cpp EventDispatcher.cpp KeyEvent.cpp CursorEvent.cpp \
MouseEvent.cpp TouchEvent.cpp AVGNode.cpp TestHelper.cpp \
TrackerInputDevice.cpp TrackerTouchStatus.cpp TrackerCalibrator.cpp \
- SoundNode.cpp \
+ SoundNode.cpp FontStyle.cpp \
VectorNode.cpp FilledVectorNode.cpp LineNode.cpp PolyLineNode.cpp \
RectNode.cpp CurveNode.cpp PolygonNode.cpp CircleNode.cpp Shape.cpp MeshNode.cpp \
Contact.cpp TouchStatus.cpp OffscreenCanvas.cpp FXNode.cpp TUIOInputDevice.cpp \
NullFXNode.cpp BlurFXNode.cpp ShadowFXNode.cpp ChromaKeyFXNode.cpp \
InvertFXNode.cpp HueSatFXNode.cpp VideoWriter.cpp VideoWriterThread.cpp \
- SVG.cpp SVGElement.cpp \
+ SVG.cpp SVGElement.cpp Publisher.cpp SubscriberInfo.cpp PublisherDefinition.cpp \
+ PublisherDefinitionRegistry.cpp MessageID.cpp VersionInfo.cpp \
+ PythonLogSink.cpp BitmapManager.cpp BitmapManagerThread.cpp \
+ BitmapManagerMsg.cpp \
$(MTDEV_SOURCES) $(XINPUT2_SOURCES) $(APPLE_SOURCES) $(ALL_H)
libplayer_a_CXXFLAGS = -DPREFIXDIR=\"$(prefix)\"
@@ -518,7 +551,7 @@ clean-noinstLTLIBRARIES:
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
-libplayer.la: $(libplayer_la_OBJECTS) $(libplayer_la_DEPENDENCIES)
+libplayer.la: $(libplayer_la_OBJECTS) $(libplayer_la_DEPENDENCIES) $(EXTRA_libplayer_la_DEPENDENCIES)
$(AM_V_CXXLD)$(CXXLINK) $(libplayer_la_OBJECTS) $(libplayer_la_LIBADD) $(LIBS)
clean-noinstPROGRAMS:
@@ -529,10 +562,10 @@ clean-noinstPROGRAMS:
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
echo " rm -f" $$list; \
rm -f $$list
-testcalibrator$(EXEEXT): $(testcalibrator_OBJECTS) $(testcalibrator_DEPENDENCIES)
+testcalibrator$(EXEEXT): $(testcalibrator_OBJECTS) $(testcalibrator_DEPENDENCIES) $(EXTRA_testcalibrator_DEPENDENCIES)
@rm -f testcalibrator$(EXEEXT)
$(AM_V_CXXLD)$(CXXLINK) $(testcalibrator_OBJECTS) $(testcalibrator_LDADD) $(LIBS)
-testplayer$(EXEEXT): $(testplayer_OBJECTS) $(testplayer_DEPENDENCIES)
+testplayer$(EXEEXT): $(testplayer_OBJECTS) $(testplayer_DEPENDENCIES) $(EXTRA_testplayer_DEPENDENCIES)
@rm -f testplayer$(EXEEXT)
$(AM_V_CXXLD)$(testplayer_LINK) $(testplayer_OBJECTS) $(testplayer_LDADD) $(LIBS)
@@ -548,6 +581,9 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Arg.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ArgBase.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ArgList.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BitmapManager.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BitmapManagerMsg.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BitmapManagerThread.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BlurFXNode.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CameraNode.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Canvas.Plo@am__quote@
@@ -563,8 +599,10 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DivNode.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Event.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/EventDispatcher.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ExportedObject.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FXNode.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FilledVectorNode.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FontStyle.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/HueSatFXNode.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Image.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ImageNode.Plo@am__quote@
@@ -575,20 +613,22 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MainCanvas.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MaterialInfo.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MeshNode.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MessageID.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MouseEvent.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MultitouchInputDevice.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Node.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NodeDefinition.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NodeRegistry.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NullFXNode.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OGLSurface.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OffscreenCanvas.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OffscreenCanvasNode.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PanoImageNode.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Player.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PluginManager.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PolyLineNode.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PolygonNode.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Publisher.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PublisherDefinition.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PublisherDefinitionRegistry.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PythonLogSink.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/RasterNode.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/RectNode.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SDLDisplayEngine.Plo@am__quote@
@@ -598,6 +638,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ShadowFXNode.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Shape.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SoundNode.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SubscriberInfo.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TUIOInputDevice.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TestHelper.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TextEngine.Plo@am__quote@
@@ -607,11 +648,15 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TrackerCalibrator.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TrackerInputDevice.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TrackerTouchStatus.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TypeDefinition.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TypeRegistry.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/VectorNode.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/VersionInfo.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/VideoNode.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/VideoWriter.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/VideoWriterThread.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/WordsNode.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/WrapPython.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/XInputMTInputDevice.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testcalibrator.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testplayer.Po@am__quote@
@@ -619,50 +664,44 @@ distclean-compile:
.cpp.o:
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $<
.cpp.obj:
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
.cpp.lo:
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
-@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
.m.o:
@am__fastdepOBJC_TRUE@ $(AM_V_OBJC)$(OBJCCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepOBJC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@am__fastdepOBJC_FALSE@ $(AM_V_OBJC) @AM_BACKSLASH@
-@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ $(AM_V_OBJC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ DEPDIR=$(DEPDIR) $(OBJCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepOBJC_FALSE@ $(OBJCCOMPILE) -c -o $@ $<
+@am__fastdepOBJC_FALSE@ $(AM_V_OBJC@am__nodep@)$(OBJCCOMPILE) -c -o $@ $<
.m.obj:
@am__fastdepOBJC_TRUE@ $(AM_V_OBJC)$(OBJCCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepOBJC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@am__fastdepOBJC_FALSE@ $(AM_V_OBJC) @AM_BACKSLASH@
-@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ $(AM_V_OBJC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ DEPDIR=$(DEPDIR) $(OBJCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepOBJC_FALSE@ $(OBJCCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepOBJC_FALSE@ $(AM_V_OBJC@am__nodep@)$(OBJCCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
.m.lo:
@am__fastdepOBJC_TRUE@ $(AM_V_OBJC)$(LTOBJCCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepOBJC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
-@am__fastdepOBJC_FALSE@ $(AM_V_OBJC) @AM_BACKSLASH@
-@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ $(AM_V_OBJC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ DEPDIR=$(DEPDIR) $(OBJCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepOBJC_FALSE@ $(LTOBJCCOMPILE) -c -o $@ $<
+@am__fastdepOBJC_FALSE@ $(AM_V_OBJC@am__nodep@)$(LTOBJCCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
@@ -803,14 +842,15 @@ check-TESTS: $(TESTS)
fi; \
dashes=`echo "$$dashes" | sed s/./=/g`; \
if test "$$failed" -eq 0; then \
- echo "$$grn$$dashes"; \
+ col="$$grn"; \
else \
- echo "$$red$$dashes"; \
+ col="$$red"; \
fi; \
- echo "$$banner"; \
- test -z "$$skipped" || echo "$$skipped"; \
- test -z "$$report" || echo "$$report"; \
- echo "$$dashes$$std"; \
+ echo "$${col}$$dashes$${std}"; \
+ echo "$${col}$$banner$${std}"; \
+ test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \
+ test -z "$$report" || echo "$${col}$$report$${std}"; \
+ echo "$${col}$$dashes$${std}"; \
test "$$failed" -eq 0; \
else :; fi
@@ -859,10 +899,15 @@ install-am: all-am
installcheck: installcheck-am
install-strip:
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- `test -z '$(STRIP)' || \
- echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
mostlyclean-generic:
clean-generic:
diff --git a/src/player/MaterialInfo.cpp b/src/player/MaterialInfo.cpp
index f77d89e..2b25b48 100644
--- a/src/player/MaterialInfo.cpp
+++ b/src/player/MaterialInfo.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/player/MaterialInfo.h b/src/player/MaterialInfo.h
index 871e48f..7f1d987 100644
--- a/src/player/MaterialInfo.h
+++ b/src/player/MaterialInfo.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -24,8 +24,6 @@
#include "../api.h"
-#include "../base/Point.h"
-
namespace avg {
class AVG_API MaterialInfo {
diff --git a/src/player/MeshNode.cpp b/src/player/MeshNode.cpp
index 363e00a..09e577f 100644
--- a/src/player/MeshNode.cpp
+++ b/src/player/MeshNode.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -21,11 +21,10 @@
#include "MeshNode.h"
-#include "../wrapper/WrapHelper.h"
#include "../base/Logger.h"
#include "../base/Exception.h"
-#include "NodeDefinition.h"
+#include "TypeDefinition.h"
#include "VectorNode.h"
#include <cstdlib>
@@ -33,25 +32,27 @@
#include <iostream>
using namespace std;
-using namespace boost::python;
namespace avg {
-NodeDefinition MeshNode::createDefinition()
+void MeshNode::registerType()
{
- vector<DPoint> vVert;
- vector<DPoint> vTex;
- vector<IntTriple> vTriangle;
+ vector<glm::vec2> vVert;
+ vector<glm::vec2> vTex;
+ vector<glm::ivec3> vTriangle;
- return NodeDefinition("mesh", (NodeBuilder)MeshNode::buildNode<MeshNode>)
- .extendDefinition(VectorNode::createDefinition())
- .addArg(Arg<vector<DPoint> >("vertexcoords", vVert, false,
+ TypeDefinition def = TypeDefinition("mesh", "vectornode",
+ ExportedObject::buildObject<MeshNode>)
+ .addArg(Arg<vector<glm::vec2> >("vertexcoords", vVert, false,
offsetof(MeshNode, m_VertexCoords)))
- .addArg(Arg<vector<DPoint> >("texcoords", vTex, false,
+ .addArg(Arg<vector<glm::vec2> >("texcoords", vTex, false,
offsetof(MeshNode, m_TexCoords)))
- .addArg(Arg<vector<IntTriple> >("triangles", vTriangle, false,
+ .addArg(Arg<vector<glm::ivec3> >("triangles", vTriangle, false,
offsetof(MeshNode, m_Triangles)))
+ .addArg(Arg<bool>("backfacecull", false, false,
+ offsetof(MeshNode, m_bBackfaceCull)))
;
+ TypeRegistry::get()->registerType(def);
}
MeshNode::MeshNode(const ArgList& args)
@@ -65,7 +66,7 @@ MeshNode::~MeshNode()
{
}
-void MeshNode::isValid(const vector<DPoint>& coords)
+void MeshNode::isValid(const vector<glm::vec2>& coords)
{
if (coords.size() != m_VertexCoords.size()) {
throw(Exception(AVG_ERR_OUT_OF_RANGE,
@@ -73,43 +74,41 @@ void MeshNode::isValid(const vector<DPoint>& coords)
}
}
-const vector<DPoint>& MeshNode::getVertexCoords() const
+const vector<glm::vec2>& MeshNode::getVertexCoords() const
{
return m_VertexCoords;
}
-void MeshNode::setVertexCoords(const vector<DPoint>& coords)
+void MeshNode::setVertexCoords(const vector<glm::vec2>& coords)
{
isValid(coords);
m_VertexCoords = coords;
setDrawNeeded();
}
-const vector<DPoint>& MeshNode::getTexCoords() const
+const vector<glm::vec2>& MeshNode::getTexCoords() const
{
return m_TexCoords;
}
-void MeshNode::setTexCoords(const vector<DPoint>& coords)
+void MeshNode::setTexCoords(const vector<glm::vec2>& coords)
{
isValid(coords);
m_TexCoords = coords;
setDrawNeeded();
}
-const vector<IntTriple>& MeshNode::getTriangles() const
+const vector<glm::ivec3>& MeshNode::getTriangles() const
{
return m_Triangles;
}
-void MeshNode::setTriangles(const vector<IntTriple>& triangles)
+void MeshNode::setTriangles(const vector<glm::ivec3>& triangles)
{
for (unsigned int i = 0; i < triangles.size(); i++) {
- if (static_cast<unsigned int>(triangles[i].x) < 0 ||
- static_cast<unsigned int>(triangles[i].y) < 0 ||
- static_cast<unsigned int>(triangles[i].z) < 0)
+ if (triangles[i].x < 0 || triangles[i].y < 0 || triangles[i].z < 0)
{
throw(Exception(AVG_ERR_OUT_OF_RANGE,
"Triangle Index Out of Range < 0"));
@@ -127,16 +126,39 @@ void MeshNode::setTriangles(const vector<IntTriple>& triangles)
setDrawNeeded();
}
-void MeshNode::calcVertexes(VertexArrayPtr& pVertexArray, Pixel32 color)
+bool MeshNode::getBackfaceCull() const
+{
+ return m_bBackfaceCull;
+}
+
+void MeshNode::setBackfaceCull(const bool bBackfaceCull)
+{
+ m_bBackfaceCull = bBackfaceCull;
+}
+
+void MeshNode::calcVertexes(const VertexDataPtr& pVertexData, Pixel32 color)
{
for (unsigned int i = 0; i < m_VertexCoords.size(); i++) {
- pVertexArray->appendPos(m_VertexCoords[i],m_TexCoords[i], color);
+ pVertexData->appendPos(m_VertexCoords[i],m_TexCoords[i], color);
}
for (unsigned int i = 0; i < m_Triangles.size(); i++) {
- pVertexArray->appendTriIndexes(m_Triangles[i].x, m_Triangles[i].y,
+ pVertexData->appendTriIndexes(m_Triangles[i].x, m_Triangles[i].y,
m_Triangles[i].z);
}
}
+void MeshNode::render()
+{
+ if (m_bBackfaceCull) {
+ glEnable(GL_CULL_FACE);
+ }
+
+ VectorNode::render();
+
+ if (m_bBackfaceCull) {
+ glDisable(GL_CULL_FACE);
+ }
+}
+
}
diff --git a/src/player/MeshNode.h b/src/player/MeshNode.h
index 5f8f40b..e921c12 100644
--- a/src/player/MeshNode.h
+++ b/src/player/MeshNode.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -25,8 +25,10 @@
#include "../api.h"
#include "VectorNode.h"
+
+#include "../base/GLMHelper.h"
#include "../graphics/Pixel32.h"
-#include "../base/Triple.h"
+
#include <vector>
namespace avg {
@@ -34,28 +36,35 @@ namespace avg {
class AVG_API MeshNode : public VectorNode
{
public:
- static NodeDefinition createDefinition();
+ static void registerType();
MeshNode(const ArgList& args);
virtual ~MeshNode();
- void isValid(const std::vector<DPoint>& coords);
+ void isValid(const std::vector<glm::vec2>& coords);
- const std::vector<DPoint>& getVertexCoords() const;
- void setVertexCoords(const std::vector<DPoint>& coords);
+ const std::vector<glm::vec2>& getVertexCoords() const;
+ void setVertexCoords(const std::vector<glm::vec2>& coords);
- const std::vector<DPoint>& getTexCoords() const;
- void setTexCoords(const std::vector<DPoint>& coords);
+ const std::vector<glm::vec2>& getTexCoords() const;
+ void setTexCoords(const std::vector<glm::vec2>& coords);
- const std::vector<IntTriple>& getTriangles() const;
- void setTriangles(const std::vector<IntTriple>& pts);
+ const std::vector<glm::ivec3>& getTriangles() const;
+ void setTriangles(const std::vector<glm::ivec3>& pts);
+
+ bool getBackfaceCull() const;
+ void setBackfaceCull(const bool bBackfaceCull);
- virtual void calcVertexes(VertexArrayPtr& pVertexArray, Pixel32 color);
+ virtual void calcVertexes(const VertexDataPtr& pVertexData, Pixel32 color);
+
+ virtual void render();
private:
- std::vector<DPoint> m_TexCoords;
- std::vector<DPoint> m_VertexCoords;
- std::vector<IntTriple> m_Triangles;
+ std::vector<glm::vec2> m_TexCoords;
+ std::vector<glm::vec2> m_VertexCoords;
+ std::vector<glm::ivec3> m_Triangles;
+
+ bool m_bBackfaceCull;
};
}
#endif
diff --git a/src/player/MessageID.cpp b/src/player/MessageID.cpp
new file mode 100644
index 0000000..6617e0e
--- /dev/null
+++ b/src/player/MessageID.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 "MessageID.h"
+
+#include "../base/StringHelper.h"
+
+using namespace std;
+
+namespace avg {
+
+MessageID::MessageID(const string& sName, int id)
+ : m_sName(sName),
+ m_ID(id)
+{
+}
+
+bool MessageID::operator < (const MessageID& other) const
+{
+ return m_ID < other.m_ID;
+}
+
+bool MessageID::operator == (const MessageID& other) const
+{
+ return m_ID == other.m_ID;
+}
+
+std::string MessageID::getRepr()
+{
+ if (m_sName != "") {
+ return m_sName;
+ } else {
+ return toString(m_ID);
+ }
+}
+
+std::ostream& operator <<(ostream& os, const MessageID& id)
+{
+ os << "(" << id.m_sName << ", " << id.m_ID << ")";
+ return os;
+}
+
+}
+
diff --git a/src/video/PacketVideoMsg.cpp b/src/player/MessageID.h
index e94e98f..f7ec6d6 100644
--- a/src/video/PacketVideoMsg.cpp
+++ b/src/player/MessageID.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -19,39 +19,30 @@
// Current versions can be found at www.libavg.de
//
-#include "PacketVideoMsg.h"
+#ifndef _MessageID_H_
+#define _MessageID_H_
-#include <iostream>
+#include "../api.h"
-using namespace std;
+#include <string>
+#include <iostream>
namespace avg {
-PacketVideoMsg::PacketVideoMsg(AVPacket * pPacket, bool bSeekDone)
-{
- m_pPacket = pPacket;
- m_bSeekDone = bSeekDone;
-}
+struct MessageID {
+ MessageID(const std::string& sName, int id);
-PacketVideoMsg::~PacketVideoMsg()
-{
-}
+ bool operator < (const MessageID& other) const;
+ bool operator == (const MessageID& other) const;
-void PacketVideoMsg::freePacket()
-{
- av_free_packet(m_pPacket);
- delete m_pPacket;
-}
+ std::string getRepr();
-AVPacket * PacketVideoMsg::getPacket()
-{
- return m_pPacket;
-}
+ std::string m_sName;
+ int m_ID;
+};
-bool PacketVideoMsg::isSeekDone()
-{
- return m_bSeekDone;
-}
+std::ostream& operator <<(std::ostream& os, const MessageID& id);
}
+#endif
diff --git a/src/player/MouseEvent.cpp b/src/player/MouseEvent.cpp
index 39acc83..c56dd8c 100644
--- a/src/player/MouseEvent.cpp
+++ b/src/player/MouseEvent.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -33,7 +33,7 @@ namespace avg {
MouseEvent::MouseEvent(Event::Type eventType,
bool leftButtonState, bool middleButtonState, bool rightButtonState,
- const IntPoint& pos, int button, const DPoint& speed, int when)
+ const IntPoint& pos, int button, const glm::vec2& speed, int when)
: CursorEvent(MOUSECURSORID, eventType, pos, MOUSE, when)
{
m_LeftButtonState = leftButtonState;
@@ -75,7 +75,7 @@ bool MouseEvent::isAnyButtonPressed() const
void MouseEvent::trace()
{
CursorEvent::trace();
- AVG_TRACE(Logger::EVENTS2, "pos: " << getPos()
+ AVG_TRACE(Logger::category::EVENTS, Logger::severity::DEBUG, "pos: " << getPos()
<< ", button: " << m_Button);
}
diff --git a/src/player/MouseEvent.h b/src/player/MouseEvent.h
index 0c8e3ab..fb67dde 100644
--- a/src/player/MouseEvent.h
+++ b/src/player/MouseEvent.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -32,7 +32,7 @@ class AVG_API MouseEvent : public CursorEvent {
public:
MouseEvent(Event::Type eventType,
bool leftButtonState, bool middleButtonState, bool rightButtonState,
- const IntPoint& pos, int button, const DPoint& speed=DPoint(0,0),
+ const IntPoint& pos, int button, const glm::vec2& speed=glm::vec2(0,0),
int when=-1);
virtual ~MouseEvent();
diff --git a/src/player/MultitouchInputDevice.cpp b/src/player/MultitouchInputDevice.cpp
index b89aaef..507f3fb 100644
--- a/src/player/MultitouchInputDevice.cpp
+++ b/src/player/MultitouchInputDevice.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -18,8 +18,6 @@
//
// Current versions can be found at www.libavg.de
//
-// Original author of this file is igor@c-base.org
-//
#include "MultitouchInputDevice.h"
#include "TouchEvent.h"
@@ -38,6 +36,11 @@ namespace avg {
MultitouchInputDevice::MultitouchInputDevice()
: IInputDevice(EXTRACT_INPUTDEVICE_CLASSNAME(MultitouchInputDevice))
{
+ m_TouchArea = ConfigMgr::get()->getSizeOption("touch", "area");
+ if (m_TouchArea.x == 0) {
+ m_TouchArea = Player::get()->getScreenResolution();
+ }
+ m_TouchOffset = ConfigMgr::get()->getSizeOption("touch", "offset");
}
MultitouchInputDevice::~MultitouchInputDevice()
@@ -46,23 +49,22 @@ MultitouchInputDevice::~MultitouchInputDevice()
void MultitouchInputDevice::start()
{
- m_WindowSize = Player::get()->getRootNode()->getSize();
m_pMutex = MutexPtr(new boost::mutex);
}
vector<EventPtr> MultitouchInputDevice::pollEvents()
{
- boost::mutex::scoped_lock lock(*m_pMutex);
+ lock_guard lock(*m_pMutex);
vector<EventPtr> events;
vector<TouchStatusPtr>::iterator it;
// cerr << "--------poll---------" << endl;
for (it = m_Touches.begin(); it != m_Touches.end(); ) {
-// cerr << it->first << " ";
+// cerr << (*it)->getID() << " ";
CursorEventPtr pEvent = (*it)->pollEvent();
if (pEvent) {
events.push_back(pEvent);
- if (pEvent->getType() == Event::CURSORUP) {
+ if (pEvent->getType() == Event::CURSOR_UP) {
it = m_Touches.erase(it);
} else {
++it;
@@ -75,11 +77,6 @@ vector<EventPtr> MultitouchInputDevice::pollEvents()
return events;
}
-const DPoint& MultitouchInputDevice::getWindowSize() const
-{
- return m_WindowSize;
-}
-
int MultitouchInputDevice::getNumTouches() const
{
return m_TouchIDMap.size();
@@ -120,6 +117,17 @@ void MultitouchInputDevice::getDeadIDs(const set<int>& liveIDs, set<int>& deadID
}
}
+glm::vec2 MultitouchInputDevice::getTouchArea() const
+{
+ return m_TouchArea;
+}
+
+IntPoint MultitouchInputDevice::getScreenPos(const glm::vec2& pos) const
+{
+ return IntPoint(int(pos.x * m_TouchArea.x + m_TouchOffset.x + 0.5),
+ int(pos.y * m_TouchArea.y + m_TouchOffset.y) + 0.5);
+}
+
boost::mutex& MultitouchInputDevice::getMutex()
{
return *m_pMutex;
diff --git a/src/player/MultitouchInputDevice.h b/src/player/MultitouchInputDevice.h
index 71aa2c5..7ccbfe5 100644
--- a/src/player/MultitouchInputDevice.h
+++ b/src/player/MultitouchInputDevice.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -25,7 +25,8 @@
#include "../api.h"
#include "IInputDevice.h"
-#include "../base/Point.h"
+#include "../base/GLMHelper.h"
+#include "../base/ConfigMgr.h"
#include <boost/thread.hpp>
#include <map>
@@ -48,11 +49,10 @@ public:
MultitouchInputDevice();
virtual ~MultitouchInputDevice() = 0;
virtual void start();
-
+
std::vector<EventPtr> pollEvents();
protected:
- const DPoint& getWindowSize() const;
int getNumTouches() const;
// Note that the id used here is not the libavg cursor id but a touch-driver-specific
// id handed up from the driver level.
@@ -60,13 +60,16 @@ protected:
void addTouchStatus(int id, TouchEventPtr pInitialEvent);
void removeTouchStatus(int id);
void getDeadIDs(const std::set<int>& liveIDs, std::set<int>& deadIDs);
+ glm::vec2 getTouchArea() const;
+ IntPoint getScreenPos(const glm::vec2& pos) const;
boost::mutex& getMutex();
private:
std::map<int, TouchStatusPtr> m_TouchIDMap;
std::vector<TouchStatusPtr> m_Touches;
- DPoint m_WindowSize;
MutexPtr m_pMutex;
+ glm::vec2 m_TouchArea;
+ glm::vec2 m_TouchOffset;
};
typedef boost::shared_ptr<MultitouchInputDevice> MultitouchInputDevicePtr;
diff --git a/src/player/Node.cpp b/src/player/Node.cpp
index eeedc5f..7c3f331 100644
--- a/src/player/Node.cpp
+++ b/src/player/Node.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -21,12 +21,13 @@
#include "Node.h"
-#include "NodeDefinition.h"
+#include "TypeDefinition.h"
#include "Arg.h"
#include "Canvas.h"
#include "DivNode.h"
#include "Player.h"
#include "CursorEvent.h"
+#include "PublisherDefinition.h"
#include "../base/Exception.h"
#include "../base/Logger.h"
@@ -37,27 +38,39 @@
#include <string>
using namespace std;
+using namespace boost;
namespace avg {
-NodeDefinition Node::createDefinition()
-{
- return NodeDefinition("node")
+void Node::registerType()
+{
+ PublisherDefinitionPtr pPubDef = PublisherDefinition::create("Node");
+ pPubDef->addMessage("CURSOR_DOWN");
+ pPubDef->addMessage("CURSOR_MOTION");
+ pPubDef->addMessage("CURSOR_UP");
+ pPubDef->addMessage("CURSOR_OVER");
+ pPubDef->addMessage("CURSOR_OUT");
+ pPubDef->addMessage("HOVER_DOWN");
+ pPubDef->addMessage("HOVER_MOTION");
+ pPubDef->addMessage("HOVER_UP");
+ pPubDef->addMessage("HOVER_OVER");
+ pPubDef->addMessage("HOVER_OUT");
+ pPubDef->addMessage("END_OF_FILE");
+ pPubDef->addMessage("SIZE_CHANGED");
+
+ TypeDefinition def = TypeDefinition("node")
.addArg(Arg<string>("id", "", false, offsetof(Node, m_ID)))
- .addArg(Arg<string>("oncursormove", ""))
- .addArg(Arg<string>("oncursorup", ""))
- .addArg(Arg<string>("oncursordown", ""))
- .addArg(Arg<string>("oncursorover", ""))
- .addArg(Arg<string>("oncursorout", ""))
.addArg(Arg<bool>("active", true, false, offsetof(Node, m_bActive)))
.addArg(Arg<bool>("sensitive", true, false, offsetof(Node, m_bSensitive)))
- .addArg(Arg<double>("opacity", 1.0, false, offsetof(Node, m_Opacity)));
+ .addArg(Arg<float>("opacity", 1.0, false, offsetof(Node, m_Opacity)));
+ TypeRegistry::get()->registerType(def);
}
-Node::Node()
- : m_pCanvas(),
+Node::Node(const std::string& sPublisherName)
+ : Publisher(sPublisherName),
+ m_pParent(0),
+ m_pCanvas(),
m_State(NS_UNCONNECTED)
-
{
ObjectCounter::get()->incRef(&typeid(*this));
}
@@ -68,30 +81,27 @@ Node::~Node()
ObjectCounter::get()->decRef(&typeid(*this));
}
-void Node::setArgs(const ArgList& args)
-{
- addArgEventHandlers(Event::CURSORMOTION, args.getArgVal<string> ("oncursormove"));
- addArgEventHandlers(Event::CURSORUP, args.getArgVal<string> ("oncursorup"));
- addArgEventHandlers(Event::CURSORDOWN, args.getArgVal<string> ("oncursordown"));
- addArgEventHandlers(Event::CURSOROVER, args.getArgVal<string> ("oncursorover"));
- addArgEventHandlers(Event::CURSOROUT, args.getArgVal<string> ("oncursorout"));
-}
-
-void Node::setTypeInfo(const NodeDefinition * pDefinition)
+void Node::registerInstance(PyObject* pSelf, const DivNodePtr& pParent)
{
- m_pDefinition = pDefinition;
+ ExportedObject::registerInstance(pSelf);
+ if (pParent) {
+ pParent->appendChild(getSharedThis());
+ }
}
-void Node::checkSetParentError(DivNodeWeakPtr pParent)
+void Node::checkSetParentError(DivNode* pParent)
{
- if (getParent() && !!(pParent.lock())) {
+ if (getParent() && pParent != 0) {
throw(Exception(AVG_ERR_UNSUPPORTED,
string("Can't change parent of node (") + getID() + ")."));
}
+ if (getSharedThis() == NodePtr()) {
+ throw(Exception(AVG_ERR_UNSUPPORTED,
+ "Node not registered. Please use Node.registerInstance() when deriving from libavg Nodes in python."));
+ }
}
-void Node::setParent(DivNodeWeakPtr pParent, NodeState parentState,
- CanvasPtr pCanvas)
+void Node::setParent(DivNode* pParent, NodeState parentState, CanvasPtr pCanvas)
{
AVG_ASSERT(getState() == NS_UNCONNECTED);
checkSetParentError(pParent);
@@ -103,22 +113,23 @@ void Node::setParent(DivNodeWeakPtr pParent, NodeState parentState,
void Node::removeParent()
{
- m_pParent = DivNodePtr();
+ m_pParent = 0;
}
DivNodePtr Node::getParent() const
{
- if (m_pParent.expired()) {
+ if (m_pParent == 0) {
return DivNodePtr();
} else {
- return m_pParent.lock();
+ NodePtr pParent = m_pParent->getSharedThis();
+ return boost::dynamic_pointer_cast<DivNode>(pParent);
}
}
-vector<NodeWeakPtr> Node::getParentChain()
+vector<NodePtr> Node::getParentChain()
{
- vector<NodeWeakPtr> pNodes;
- boost::shared_ptr<Node> pCurNode = shared_from_this();
+ vector<NodePtr> pNodes;
+ NodePtr pCurNode = getSharedThis();
while (pCurNode) {
pNodes.push_back(pCurNode);
pCurNode = pCurNode->getParent();
@@ -152,7 +163,7 @@ void Node::unlink(bool bKill)
{
DivNodePtr pParent = getParent();
if (pParent != DivNodePtr()) {
- pParent->removeChild(shared_from_this(), bKill);
+ pParent->removeChild(getSharedThis(), bKill);
}
}
@@ -170,12 +181,12 @@ void Node::setID(const std::string& id)
m_ID = id;
}
-double Node::getOpacity() const
+float Node::getOpacity() const
{
return m_Opacity;
}
-void Node::setOpacity(double opacity)
+void Node::setOpacity(float opacity)
{
m_Opacity = opacity;
if (m_Opacity < 0.0) {
@@ -219,7 +230,7 @@ void Node::releaseMouseEventCapture()
void Node::setEventCapture(int cursorID)
{
- Player::get()->setEventCapture(shared_from_this(), cursorID);
+ Player::get()->setEventCapture(getSharedThis(), cursorID);
}
void Node::releaseEventCapture(int cursorID)
@@ -229,6 +240,7 @@ void Node::releaseEventCapture(int cursorID)
void Node::setEventHandler(Event::Type type, int sources, PyObject * pFunc)
{
+ avgDeprecationWarning("1.7", "Node.setEventHandler()", "Node.subscribe()");
for (int source = 1; source <= Event::NONE; source *= 2) {
if (source & sources) {
EventID id(type, (Event::Source)source);
@@ -246,6 +258,7 @@ void Node::setEventHandler(Event::Type type, int sources, PyObject * pFunc)
void Node::connectEventHandler(Event::Type type, int sources,
PyObject * pObj, PyObject * pFunc)
{
+ avgDeprecationWarning("1.8", "Node.connectEventHandler()", "Node.subscribe()");
for (int source = 1; source <= Event::NONE; source *= 2) {
if (source & sources) {
EventID id(type, (Event::Source)source);
@@ -258,6 +271,7 @@ void Node::connectEventHandler(Event::Type type, int sources,
void Node::disconnectEventHandler(PyObject * pObj, PyObject * pFunc)
{
+ avgDeprecationWarning("1.8", "Node.disconnectEventHandler()", "Node.unsubscribe()");
int numDisconnected = 0;
EventHandlerMap::iterator it;
for (it = m_EventHandlerMap.begin(); it != m_EventHandlerMap.end();) {
@@ -294,62 +308,59 @@ bool Node::reactsToMouseEvents()
return m_bActive && m_bSensitive;
}
-DPoint Node::getRelPos(const DPoint& absPos) const
+glm::vec2 Node::getRelPos(const glm::vec2& absPos) const
{
- DPoint parentPos;
- if (m_pParent.expired()) {
+ glm::vec2 parentPos;
+ if (m_pParent == 0) {
parentPos = absPos;
} else {
- parentPos = m_pParent.lock()->getRelPos(absPos);
+ parentPos = m_pParent->getSharedThis()->getRelPos(absPos);
}
return toLocal(parentPos);
}
-DPoint Node::getAbsPos(const DPoint& relPos) const
+glm::vec2 Node::getAbsPos(const glm::vec2& relPos) const
{
- DPoint thisPos = toGlobal(relPos);
- DPoint parentPos;
- if (m_pParent.expired()) {
+ glm::vec2 thisPos = toGlobal(relPos);
+ glm::vec2 parentPos;
+ if (m_pParent == 0) {
parentPos = thisPos;
} else {
- parentPos = m_pParent.lock()->getAbsPos(thisPos);
+ parentPos = m_pParent->getSharedThis()->getAbsPos(thisPos);
}
return parentPos;
}
-DPoint Node::toLocal(const DPoint& globalPos) const
+glm::vec2 Node::toLocal(const glm::vec2& globalPos) const
{
return globalPos;
}
-DPoint Node::toGlobal(const DPoint& localPos) const
+glm::vec2 Node::toGlobal(const glm::vec2& localPos) const
{
return localPos;
}
-NodePtr Node::getElementByPos(const DPoint& pos)
+NodePtr Node::getElementByPos(const glm::vec2& pos)
{
- vector<NodeWeakPtr> elements;
+ vector<NodePtr> elements;
getElementsByPos(pos, elements);
if (elements.empty()) {
return NodePtr();
} else {
- return elements[0].lock();
+ return elements[0];
}
}
-void Node::getElementsByPos(const DPoint& pos,
- vector<NodeWeakPtr>& pElements)
+void Node::getElementsByPos(const glm::vec2& pos, vector<NodePtr>& pElements)
{
}
-void Node::preRender()
+void Node::preRender(const VertexArrayPtr& pVA, bool bIsParentActive,
+ float parentEffectiveOpacity)
{
- if (getParent()) {
- m_EffectiveOpacity = m_Opacity*getParent()->getEffectiveOpacity();
- } else {
- m_EffectiveOpacity = m_Opacity;
- }
+ m_EffectiveOpacity = m_Opacity*parentEffectiveOpacity;
+ m_bEffectiveActive = bIsParentActive && m_bActive;
}
Node::NodeState Node::getState() const
@@ -364,6 +375,11 @@ CanvasPtr Node::getCanvas() const
bool Node::handleEvent(EventPtr pEvent)
{
+ if (pEvent->getSource() != Event::NONE && pEvent->getSource() != Event::CUSTOM) {
+ string messageID = getEventMessageID(pEvent);
+ notifySubscribers(messageID, pEvent);
+ }
+
EventID id(pEvent->getType(), pEvent->getSource());
EventHandlerMap::iterator it = m_EventHandlerMap.find(id);
if (it != m_EventHandlerMap.end()) {
@@ -381,24 +397,7 @@ bool Node::handleEvent(EventPtr pEvent)
}
}
-void Node::addArgEventHandlers(Event::Type eventType, const string& sCode)
-{
- addArgEventHandler(eventType, Event::MOUSE, sCode);
- addArgEventHandler(eventType, Event::TOUCH, sCode);
- addArgEventHandler(eventType, Event::TRACK, sCode);
-}
-
-void Node::addArgEventHandler(Event::Type eventType, Event::Source source,
- const string& sCode)
-{
- PyObject * pFunc = findPythonFunc(sCode);
- if (pFunc) {
- EventID id(eventType, source);
- connectOneEventHandler(id, Py_None, pFunc);
- }
-}
-
-double Node::getEffectiveOpacity() const
+float Node::getEffectiveOpacity() const
{
return m_EffectiveOpacity;
}
@@ -456,7 +455,7 @@ void Node::initFilename(string& sFilename)
}
}
-void Node::checkReload(const std::string& sHRef, const ImagePtr& pImage,
+bool Node::checkReload(const std::string& sHRef, const ImagePtr& pImage,
Image::TextureCompression comp)
{
string sLastFilename = pImage->getFilename();
@@ -473,11 +472,14 @@ void Node::checkReload(const std::string& sHRef, const ImagePtr& pImage,
} catch (Exception& ex) {
pImage->setEmpty();
if (getState() != Node::NS_UNCONNECTED) {
- AVG_TRACE(Logger::ERROR, ex.getStr());
+ AVG_LOG_ERROR(ex.getStr());
} else {
- AVG_TRACE(Logger::MEMORY, ex.getStr());
+ AVG_TRACE(Logger::category::MEMORY, Logger::severity::INFO, ex.getStr());
}
}
+ return true;
+ } else {
+ return false;
}
}
@@ -488,11 +490,12 @@ bool Node::isVisible() const
bool Node::getEffectiveActive() const
{
- if (getParent()) {
- return m_bActive && getParent()->getEffectiveActive();
- } else {
- return m_bActive;
- }
+ return m_bEffectiveActive;
+}
+
+NodePtr Node::getSharedThis()
+{
+ return dynamic_pointer_cast<Node>(ExportedObject::getSharedThis());
}
void Node::connectOneEventHandler(const EventID& id, PyObject * pObj,
@@ -528,58 +531,52 @@ void Node::dumpEventHandlers()
cerr << "-----" << endl;
}
-PyObject * Node::findPythonFunc(const string& sCode)
-{
- if (sCode.empty()) {
- return 0;
- } else {
- PyObject * pModule = PyImport_AddModule("__main__");
- if (!pModule) {
- cerr << "Could not find module __main__." << endl;
- exit(-1);
+string Node::getEventMessageID(const EventPtr& pEvent)
+{
+ Event::Source source = pEvent->getSource();
+ if (source == Event::MOUSE || source == Event::TOUCH) {
+ switch (pEvent->getType()) {
+ case Event::CURSOR_DOWN:
+ return "CURSOR_DOWN";
+ case Event::CURSOR_MOTION:
+ return "CURSOR_MOTION";
+ case Event::CURSOR_UP:
+ return "CURSOR_UP";
+ case Event::CURSOR_OVER:
+ return "CURSOR_OVER";
+ case Event::CURSOR_OUT:
+ return "CURSOR_OUT";
+ default:
+ AVG_ASSERT_MSG(false,
+ (string("Unknown message type ")+pEvent->typeStr()).c_str());
+ return "";
}
- PyObject * pDict = PyModule_GetDict(pModule);
- PyObject * pFunc = PyDict_GetItemString(pDict, sCode.c_str());
- if (!pFunc) {
- AVG_TRACE(Logger::ERROR, "Function \"" << sCode <<
- "\" not defined for node with id '"+getID()+"'. Aborting.");
- exit(-1);
+ } else {
+ switch (pEvent->getType()) {
+ case Event::CURSOR_DOWN:
+ return "HOVER_DOWN";
+ case Event::CURSOR_MOTION:
+ return "HOVER_MOTION";
+ case Event::CURSOR_UP:
+ return "HOVER_UP";
+ case Event::CURSOR_OVER:
+ return "HOVER_OVER";
+ case Event::CURSOR_OUT:
+ return "HOVER_OUT";
+ default:
+ AVG_ASSERT_MSG(false,
+ (string("Unknown message type ")+pEvent->typeStr()).c_str());
+ return "";
}
- return pFunc;
}
}
bool Node::callPython(PyObject * pFunc, EventPtr pEvent)
{
- bool bOk = boost::python::call<bool>(pFunc, pEvent);
+ bool bOk = py::call<bool>(pFunc, pEvent);
return bOk;
}
-bool Node::operator ==(const Node& other) const
-{
- return this == &other;
-}
-
-bool Node::operator !=(const Node& other) const
-{
- return this != &other;
-}
-
-long Node::getHash() const
-{
- return long(this);
-}
-
-const NodeDefinition* Node::getDefinition() const
-{
- return m_pDefinition;
-}
-
-string Node::getTypeStr() const
-{
- return m_pDefinition->getName();
-}
-
Node::EventID::EventID(Event::Type eventType, Event::Source source)
: m_Type(eventType),
m_Source(source)
diff --git a/src/player/Node.h b/src/player/Node.h
index 1130607..9e2b439 100644
--- a/src/player/Node.h
+++ b/src/player/Node.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -24,6 +24,7 @@
#include "../api.h"
+#include "Publisher.h"
#include "Event.h"
#include "Image.h"
@@ -32,15 +33,12 @@
#include <boost/shared_ptr.hpp>
#include <boost/weak_ptr.hpp>
-#include <boost/enable_shared_from_this.hpp>
-
-#include <string>
-#include <vector>
// Python docs say python.h should be included before any standard headers (!)
#include "WrapPython.h"
#include <string>
+#include <vector>
#include <list>
#include <map>
@@ -48,19 +46,15 @@ namespace avg {
class Node;
typedef boost::shared_ptr<Node> NodePtr;
-typedef boost::weak_ptr<Node> NodeWeakPtr;
class DivNode;
typedef boost::shared_ptr<DivNode> DivNodePtr;
-typedef boost::weak_ptr<DivNode> DivNodeWeakPtr;
class ArgList;
-class NodeDefinition;
+class TypeDefinition;
class CanvasNode;
typedef boost::shared_ptr<CanvasNode> CanvasNodePtr;
-typedef boost::weak_ptr<CanvasNode> CanvasNodeWeakPtr;
class AVGNode;
typedef boost::shared_ptr<AVGNode> AVGNodePtr;
-typedef boost::weak_ptr<AVGNode> AVGNodeWeakPtr;
class Image;
typedef boost::shared_ptr<Image> ImagePtr;
class VertexArray;
@@ -69,27 +63,21 @@ class Canvas;
typedef boost::shared_ptr<Canvas> CanvasPtr;
typedef boost::weak_ptr<Canvas> CanvasWeakPtr;
-class AVG_API Node: public boost::enable_shared_from_this<Node>
+class AVG_API Node: public Publisher
{
public:
enum NodeState {NS_UNCONNECTED, NS_CONNECTED, NS_CANRENDER};
-
- static NodeDefinition createDefinition();
- template<class NodeType>
- static NodePtr buildNode(const ArgList& Args)
- {
- return NodePtr(new NodeType(Args));
- }
- virtual void setTypeInfo(const NodeDefinition * pDefinition);
+
+ static void registerType();
+ void registerInstance(PyObject* pSelf, const DivNodePtr& pParent);
virtual ~Node();
- virtual void setArgs(const ArgList& args);
- virtual void setParent(DivNodeWeakPtr pParent, NodeState parentState,
+ virtual void setParent(DivNode* pParent, NodeState parentState,
CanvasPtr pCanvas);
virtual void removeParent();
- void checkSetParentError(DivNodeWeakPtr pParent);
+ void checkSetParentError(DivNode* pParent);
DivNodePtr getParent() const;
- std::vector<NodeWeakPtr> getParentChain();
+ std::vector<NodePtr> getParentChain();
virtual void connectDisplay();
virtual void connect(CanvasPtr pCanvas);
@@ -100,8 +88,8 @@ class AVG_API Node: public boost::enable_shared_from_this<Node>
virtual void setID(const std::string& ID);
- double getOpacity() const;
- void setOpacity(double opacity);
+ float getOpacity() const;
+ void setOpacity(float opacity);
bool getActive() const;
void setActive(bool bActive);
@@ -118,19 +106,21 @@ class AVG_API Node: public boost::enable_shared_from_this<Node>
PyObject * pObj, PyObject * pFunc);
void disconnectEventHandler(PyObject * pObj, PyObject * pFunc=0);
- DPoint getRelPos(const DPoint& absPos) const;
- DPoint getAbsPos(const DPoint& relPos) const;
- virtual DPoint toLocal(const DPoint& pos) const;
- virtual DPoint toGlobal(const DPoint& pos) const;
- NodePtr getElementByPos(const DPoint& pos);
- virtual void getElementsByPos(const DPoint& pos,
- std::vector<NodeWeakPtr>& pElements);
-
- virtual void preRender();
- virtual void maybeRender(const DRect& Rect) {};
- virtual void render(const DRect& Rect) {};
+ glm::vec2 getRelPos(const glm::vec2& absPos) const;
+ glm::vec2 getAbsPos(const glm::vec2& relPos) const;
+ virtual glm::vec2 toLocal(const glm::vec2& pos) const;
+ virtual glm::vec2 toGlobal(const glm::vec2& pos) const;
+ NodePtr getElementByPos(const glm::vec2& pos);
+ virtual void getElementsByPos(const glm::vec2& pos,
+ std::vector<NodePtr>& pElements);
+
+ virtual void preRender(const VertexArrayPtr& pVA, bool bIsParentActive,
+ float parentEffectiveOpacity);
+ virtual void maybeRender(const glm::mat4& parentTransform) {};
+ virtual void render() {};
+ virtual void renderOutlines(const VertexArrayPtr& pVA, Pixel32 color) {};
- double getEffectiveOpacity() const;
+ float getEffectiveOpacity() const;
virtual std::string dump(int indent = 0);
NodeState getState() const;
@@ -139,36 +129,24 @@ class AVG_API Node: public boost::enable_shared_from_this<Node>
virtual bool handleEvent(EventPtr pEvent);
virtual const std::string& getID() const;
- std::string getTypeStr() const;
-
- bool operator ==(const Node& other) const;
- bool operator !=(const Node& other) const;
- long getHash() const;
-
- virtual const NodeDefinition* getDefinition() const;
-
- virtual void renderOutlines(const VertexArrayPtr& pVA, Pixel32 color) {};
-
+
protected:
- Node();
+ Node(const std::string& sPublisherName="Node");
- void addArgEventHandlers(Event::Type eventType, const std::string& sCode);
- void addArgEventHandler(Event::Type eventType, Event::Source source,
- const std::string& sCode);
bool reactsToMouseEvents();
void setState(NodeState state);
void initFilename(std::string& sFilename);
- void checkReload(const std::string& sHRef, const ImagePtr& pImage,
+ bool checkReload(const std::string& sHRef, const ImagePtr& pImage,
Image::TextureCompression comp = Image::TEXTURECOMPRESSION_NONE);
virtual bool isVisible() const;
bool getEffectiveActive() const;
+ NodePtr getSharedThis();
private:
std::string m_ID;
- const NodeDefinition* m_pDefinition;
- DivNodeWeakPtr m_pParent;
+ DivNode* m_pParent;
struct EventID {
EventID(Event::Type eventType, Event::Source source);
@@ -194,19 +172,20 @@ class AVG_API Node: public boost::enable_shared_from_this<Node>
void connectOneEventHandler(const EventID& id, PyObject * pObj, PyObject * pFunc);
void dumpEventHandlers();
- PyObject * findPythonFunc(const std::string& sCode);
+ std::string getEventMessageID(const EventPtr& pEvent);
bool callPython(PyObject * pFunc, avg::EventPtr pEvent);
EventHandlerMap m_EventHandlerMap;
CanvasWeakPtr m_pCanvas;
- double m_Opacity;
+ float m_Opacity;
NodeState m_State;
bool m_bActive;
bool m_bSensitive;
- double m_EffectiveOpacity;
+ float m_EffectiveOpacity;
+ bool m_bEffectiveActive;
};
}
diff --git a/src/player/NodeRegistry.cpp b/src/player/NodeRegistry.cpp
deleted file mode 100644
index 854e827..0000000
--- a/src/player/NodeRegistry.cpp
+++ /dev/null
@@ -1,126 +0,0 @@
-//
-// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 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 "NodeRegistry.h"
-#include "NodeDefinition.h"
-
-#include "../base/Exception.h"
-
-#include <set>
-
-using namespace std;
-
-namespace avg {
-
-NodeRegistry::NodeRegistry()
-{
-}
-
-NodeRegistry::~NodeRegistry()
-{
-}
-
-void NodeRegistry::registerNodeType(const NodeDefinition& def)
-{
- m_NodeDefs.insert(NodeDefMap::value_type(def.getName(), def));
-}
-
-void NodeRegistry::updateNodeDefinition(const NodeDefinition& def)
-{
- m_NodeDefs[def.getName()] = def;
-}
-
-NodePtr NodeRegistry::createNode(const string& sType, const xmlNodePtr xmlNode)
-{
- const NodeDefinition& def = getNodeDef(sType);
- ArgList args(def.getDefaultArgs(), xmlNode);
- NodeBuilder builder = def.getBuilder();
- NodePtr pNode = builder(args);
- pNode->setTypeInfo(&def);
- return pNode;
-}
-
-NodePtr NodeRegistry::createNode(const string& sType, const boost::python::dict& pyDict)
-{
- const NodeDefinition& def = getNodeDef(sType);
- ArgList args(def.getDefaultArgs(), pyDict);
- NodeBuilder builder = def.getBuilder();
- NodePtr pNode = builder(args);
- pNode->setTypeInfo(&def);
- return pNode;
-}
-
-string NodeRegistry::getDTD() const
-{
- if (m_NodeDefs.empty()) {
- return string("");
- }
-
- stringstream ss;
-
- for (NodeDefMap::const_iterator defIt = m_NodeDefs.begin();
- defIt != m_NodeDefs.end(); defIt++)
- {
- const NodeDefinition& def = defIt->second;
- writeNodeDTD(def, ss);
- }
-
- for (NodeDefMap::const_iterator defIt = m_NodeDefs.begin();
- defIt != m_NodeDefs.end(); defIt++)
- {
- const NodeDefinition& def = defIt->second;
- ss << def.getDTDElements();
- }
-
- return ss.str();
-}
-
-const NodeDefinition& NodeRegistry::getNodeDef(const string& sType)
-{
- NodeDefMap::const_iterator it = m_NodeDefs.find(sType);
- if (it == m_NodeDefs.end()) {
- throw (Exception (AVG_ERR_XML_NODE_UNKNOWN,
- string("Unknown node type ") + sType + " encountered."));
- }
- return it->second;
-}
-
-void NodeRegistry::writeNodeDTD(const NodeDefinition& def, stringstream& ss) const
-{
- ss << "<!ELEMENT " << def.getName() << " " << def.getDTDChildrenString() << " >\n";
- if (!def.getDefaultArgs().getArgMap().empty()) {
- ss << "<!ATTLIST " << def.getName();
- for (ArgMap::const_iterator argIt = def.getDefaultArgs().getArgMap().begin();
- argIt != def.getDefaultArgs().getArgMap().end(); argIt++)
- {
- string argName = argIt->first;
- string argType = (argName == "id") ? "ID" : "CDATA";
- string argRequired = def.getDefaultArgs().getArg(argName)->isRequired() ?
- "#REQUIRED" : "#IMPLIED";
- ss << "\n " << argName << " " << argType << " " << argRequired;
- }
- ss << " >\n";
- }
-}
-
-}
diff --git a/src/player/NullFXNode.cpp b/src/player/NullFXNode.cpp
index 544b6d9..d0d943d 100644
--- a/src/player/NullFXNode.cpp
+++ b/src/player/NullFXNode.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -22,7 +22,6 @@
#include "NullFXNode.h"
#include "../base/ObjectCounter.h"
-#include "../graphics/ShaderRegistry.h"
#include <string>
diff --git a/src/player/NullFXNode.h b/src/player/NullFXNode.h
index b79c7b4..107ce4b 100644
--- a/src/player/NullFXNode.h
+++ b/src/player/NullFXNode.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/player/OGLSurface.cpp b/src/player/OGLSurface.cpp
index c83acbe..b0aa58e 100644
--- a/src/player/OGLSurface.cpp
+++ b/src/player/OGLSurface.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -27,23 +27,21 @@
#include "../base/ScopeTimer.h"
#include "../base/ObjectCounter.h"
-#include "../graphics/ShaderRegistry.h"
#include "../graphics/GLContext.h"
#include "../graphics/GLTexture.h"
#include <iostream>
#include <sstream>
-using namespace std;
+#include "../glm/gtc/matrix_transform.hpp"
-#define COLORSPACE_SHADER "COLORSPACE"
+using namespace std;
-static float yuvCoeff[3][4] =
-{
- {1.0f, 0.0f, 1.40f, 0.0f},
- {1.0f, -0.34f, -0.71f, 0.0f},
- {1.0f, 1.77f, 0.0f, 0.0f},
-};
+static glm::mat4 yuvCoeff(
+ 1.0f, 1.0f, 1.0f, 0.0f,
+ 0.0f, -0.34f, 1.77f, 0.0f,
+ 1.40f, -0.71f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 1.0f);
namespace avg {
@@ -52,6 +50,7 @@ OGLSurface::OGLSurface()
m_Gamma(1,1,1),
m_Brightness(1,1,1),
m_Contrast(1,1,1),
+ m_AlphaGamma(1),
m_bIsDirty(true)
{
ObjectCounter::get()->incRef(&typeid(*this));
@@ -62,20 +61,6 @@ OGLSurface::~OGLSurface()
ObjectCounter::get()->decRef(&typeid(*this));
}
-void OGLSurface::attach()
-{
- if (!GLContext::getCurrent()->isUsingShaders()) {
- if (m_pMaskTexture) {
- throw Exception(AVG_ERR_VIDEO_GENERAL,
- "Can't set mask bitmap since shader support is disabled.");
- }
- if (gammaIsModified() || colorIsModified()) {
- throw Exception(AVG_ERR_VIDEO_GENERAL,
- "Can't use color correction (gamma, brightness, contrast) since shader support is disabled.");
- }
- }
-}
-
void OGLSurface::create(PixelFormat pf, GLTexturePtr pTex0, GLTexturePtr pTex1,
GLTexturePtr pTex2, GLTexturePtr pTex3)
{
@@ -116,82 +101,68 @@ void OGLSurface::destroy()
void OGLSurface::activate(const IntPoint& logicalSize, bool bPremultipliedAlpha) const
{
- if (useShader()) {
- OGLShaderPtr pShader = getShader(COLORSPACE_SHADER);
- pShader->activate();
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "OGLSurface::activate()");
- switch (m_pf) {
- case YCbCr420p:
- case YCbCrJ420p:
- pShader->setUniformIntParam("colorModel", 1);
- break;
- case YCbCrA420p:
- pShader->setUniformIntParam("colorModel", 3);
- break;
- case A8:
- pShader->setUniformIntParam("colorModel", 2);
- break;
- default:
- pShader->setUniformIntParam("colorModel", 0);
- }
-
- m_pTextures[0]->activate(GL_TEXTURE0);
- pShader->setUniformIntParam("texture", 0);
-
- if (pixelFormatIsPlanar(m_pf)) {
- m_pTextures[1]->activate(GL_TEXTURE1);
- pShader->setUniformIntParam("cbTexture", 1);
- m_pTextures[2]->activate(GL_TEXTURE2);
- pShader->setUniformIntParam("crTexture", 2);
- if (m_pf == YCbCrA420p) {
- m_pTextures[3]->activate(GL_TEXTURE3);
- pShader->setUniformIntParam("aTexture", 3);
- }
- }
- if (pixelFormatIsPlanar(m_pf) || colorIsModified()) {
- Matrix3x4 mat = calcColorspaceMatrix();
- pShader->setUniformVec4fParam("colorCoeff0",
- mat.val[0][0], mat.val[1][0], mat.val[2][0], 0);
- pShader->setUniformVec4fParam("colorCoeff1",
- mat.val[0][1], mat.val[1][1], mat.val[2][1], 0);
- pShader->setUniformVec4fParam("colorCoeff2",
- mat.val[0][2], mat.val[1][2], mat.val[2][2], 0);
- pShader->setUniformVec4fParam("colorCoeff3",
- mat.val[0][3], mat.val[1][3], mat.val[2][3], 1);
- }
+ StandardShaderPtr pShader = StandardShader::get();
+
+ GLContext::checkError("OGLSurface::activate()");
+ switch (m_pf) {
+ case YCbCr420p:
+ case YCbCrJ420p:
+ pShader->setColorModel(1);
+ break;
+ case YCbCrA420p:
+ pShader->setColorModel(3);
+ break;
+ case A8:
+ pShader->setColorModel(2);
+ break;
+ default:
+ pShader->setColorModel(0);
+ }
- pShader->setUniformVec4fParam("gamma", float(1/m_Gamma.x), float(1/m_Gamma.y),
- float(1/m_Gamma.z), 1.0);
- pShader->setUniformIntParam("bUseColorCoeff", colorIsModified());
+ m_pTextures[0]->activate(GL_TEXTURE0);
- pShader->setUniformIntParam("bPremultipliedAlpha", bPremultipliedAlpha);
- pShader->setUniformIntParam("bUseMask", bool(m_pMaskTexture));
- if (m_pMaskTexture) {
- m_pMaskTexture->activate(GL_TEXTURE4);
- pShader->setUniformIntParam("maskTexture", 4);
- pShader->setUniformDPointParam("maskPos", m_MaskPos);
- // maskScale is (1,1) for everything excepting words nodes.
- DPoint maskScale(1,1);
- if (logicalSize != IntPoint(0,0)) {
- maskScale = DPoint((double)logicalSize.x/m_Size.x,
- (double)logicalSize.y/m_Size.y);
- }
- pShader->setUniformDPointParam("maskSize", m_MaskSize*maskScale);
+ if (pixelFormatIsPlanar(m_pf)) {
+ m_pTextures[1]->activate(GL_TEXTURE1);
+ m_pTextures[2]->activate(GL_TEXTURE2);
+ if (m_pf == YCbCrA420p) {
+ m_pTextures[3]->activate(GL_TEXTURE3);
}
-
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "OGLSurface::activate: params");
+ }
+ if (pixelFormatIsPlanar(m_pf) || colorIsModified()) {
+ glm::mat4 mat = calcColorspaceMatrix();
+ pShader->setColorspaceMatrix(mat);
} else {
- m_pTextures[0]->activate(GL_TEXTURE0);
- if (GLContext::getCurrent()->isUsingShaders()) {
- glproc::UseProgramObject(0);
- }
- for (int i=1; i<5; ++i) {
- glproc::ActiveTexture(GL_TEXTURE0 + i);
- glDisable(GL_TEXTURE_2D);
+ pShader->disableColorspaceMatrix();
+ }
+ pShader->setGamma(glm::vec4(1/m_Gamma.x, 1/m_Gamma.y, 1/m_Gamma.z,
+ 1./m_AlphaGamma));
+
+ pShader->setPremultipliedAlpha(bPremultipliedAlpha);
+ if (m_pMaskTexture) {
+ m_pMaskTexture->activate(GL_TEXTURE4);
+ // Special case for pot textures:
+ // The tex coords in the vertex array are scaled to fit the image texture. We
+ // need to undo this and fit to the mask texture. In the npot case, everything
+ // evaluates to (1,1);
+ glm::vec2 texSize = glm::vec2(m_pTextures[0]->getGLSize());
+ glm::vec2 imgSize = glm::vec2(m_pTextures[0]->getSize());
+ glm::vec2 maskTexSize = glm::vec2(m_pMaskTexture->getGLSize());
+ glm::vec2 maskImgSize = glm::vec2(m_pMaskTexture->getSize());
+ glm::vec2 maskScale = glm::vec2(maskTexSize.x/maskImgSize.x,
+ maskTexSize.y/maskImgSize.y);
+ glm::vec2 imgScale = glm::vec2(texSize.x/imgSize.x, texSize.y/imgSize.y);
+ glm::vec2 maskPos = m_MaskPos/maskScale;
+ // Special case for words nodes.
+ if (logicalSize != IntPoint(0,0)) {
+ maskScale *= glm::vec2((float)logicalSize.x/m_Size.x,
+ (float)logicalSize.y/m_Size.y);
}
- glproc::ActiveTexture(GL_TEXTURE0);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "OGLSurface::activate: fixed function");
+ pShader->setMask(true, maskPos, m_MaskSize*maskScale/imgScale);
+ } else {
+ pShader->setMask(false);
}
+ pShader->activate();
+ GLContext::checkError("OGLSurface::activate");
}
GLTexturePtr OGLSurface::getTex(int i) const
@@ -199,7 +170,7 @@ GLTexturePtr OGLSurface::getTex(int i) const
return m_pTextures[i];
}
-void OGLSurface::setMaskCoords(DPoint maskPos, DPoint maskSize)
+void OGLSurface::setMaskCoords(glm::vec2 maskPos, glm::vec2 maskSize)
{
m_MaskPos = maskPos;
m_MaskSize = maskSize;
@@ -226,94 +197,19 @@ bool OGLSurface::isCreated() const
return m_pTextures[0];
}
-void OGLSurface::setColorParams(const DTriple& gamma, const DTriple& brightness,
- const DTriple& contrast)
+void OGLSurface::setColorParams(const glm::vec3& gamma, const glm::vec3& brightness,
+ const glm::vec3& contrast)
{
m_Gamma = gamma;
m_Brightness = brightness;
m_Contrast = contrast;
- if (!GLContext::getCurrent()->isUsingShaders() &&
- (gammaIsModified() || colorIsModified()))
- {
- throw Exception(AVG_ERR_VIDEO_GENERAL,
- "Can't use color correction (gamma, brightness, contrast) since shader support is disabled.");
- }
m_bIsDirty = true;
}
-void OGLSurface::createShader()
+void OGLSurface::setAlphaGamma(float gamma)
{
- string sProgram =
- "uniform sampler2D texture;\n"
- "uniform sampler2D yTexture;\n"
- "uniform sampler2D cbTexture;\n"
- "uniform sampler2D crTexture;\n"
- "uniform sampler2D aTexture;\n"
- "uniform sampler2D maskTexture;\n"
- "uniform int colorModel; // 0=rgb, 1=yuv, 2=greyscale, 3=yuva\n"
- "uniform vec4 colorCoeff0;\n"
- "uniform vec4 colorCoeff1;\n"
- "uniform vec4 colorCoeff2;\n"
- "uniform vec4 colorCoeff3;\n"
- "uniform bool bUseColorCoeff;\n"
- "uniform vec4 gamma;\n"
- "uniform bool bPremultipliedAlpha;\n"
- "uniform bool bUseMask;\n"
- "uniform vec2 maskPos;\n"
- "uniform vec2 maskSize;\n"
- "\n"
- "vec4 convertYCbCr(mat4 colorCoeff)\n"
- "{\n"
- " vec4 yuv;\n"
- " yuv = vec4(texture2D(texture, gl_TexCoord[0].st).r,\n"
- " texture2D(cbTexture, (gl_TexCoord[0].st)).r,\n"
- " texture2D(crTexture, (gl_TexCoord[0].st)).r,\n"
- " 1.0);\n"
- " vec4 rgb;\n"
- " rgb = colorCoeff*yuv;\n"
- " return vec4(rgb.rgb, gl_Color.a);\n"
- "}\n"
- "\n"
- "void main(void)\n"
- "{\n"
- " vec4 rgba;\n"
- " mat4 colorCoeff;\n"
- " colorCoeff[0] = colorCoeff0;\n"
- " colorCoeff[1] = colorCoeff1;\n"
- " colorCoeff[2] = colorCoeff2;\n"
- " colorCoeff[3] = colorCoeff3;\n"
- " if (colorModel == 0) {\n"
- " rgba = texture2D(texture, gl_TexCoord[0].st);\n"
- " if (bUseColorCoeff) {\n"
- " rgba = colorCoeff*rgba;\n"
- " };\n"
- " rgba.a *= gl_Color.a;\n"
- " } else if (colorModel == 1) {\n"
- " rgba = convertYCbCr(colorCoeff);\n"
- " } else if (colorModel == 2) {\n"
- " rgba = gl_Color;\n"
- " if (bUseColorCoeff) {\n"
- " rgba = colorCoeff*rgba;\n"
- " };\n"
- " rgba.a *= texture2D(texture, gl_TexCoord[0].st).a;\n"
- " } else if (colorModel == 3) {\n"
- " rgba = convertYCbCr(colorCoeff);\n"
- " rgba.a *= texture2D(aTexture, gl_TexCoord[0].st).r;\n"
- " } else {\n"
- " rgba = vec4(1,1,1,1);\n"
- " }\n"
- " rgba = pow(rgba, gamma);\n"
- " if (bUseMask) {\n"
- " if (bPremultipliedAlpha) {\n"
- " rgba.rgb *= texture2D(maskTexture,\n"
- " (gl_TexCoord[0].st/maskSize)-maskPos).r;\n"
- " }\n"
- " rgba.a *= texture2D(maskTexture,\n"
- " (gl_TexCoord[0].st/maskSize)-maskPos).r;\n"
- " }\n"
- " gl_FragColor = rgba;\n"
- "}\n";
- getOrCreateShader(COLORSPACE_SHADER, sProgram);
+ m_AlphaGamma = gamma;
+ m_bIsDirty = true;
}
bool OGLSurface::isDirty() const
@@ -335,40 +231,27 @@ void OGLSurface::resetDirty()
}
}
-bool OGLSurface::useShader() const
-{
- return GLContext::getCurrent()->isUsingShaders() &&
- (m_pMaskTexture || pixelFormatIsPlanar(m_pf) || gammaIsModified() ||
- colorIsModified());
-}
-
-Matrix3x4 OGLSurface::calcColorspaceMatrix() const
+glm::mat4 OGLSurface::calcColorspaceMatrix() const
{
- Matrix3x4 mat;
+ glm::mat4 mat;
if (colorIsModified()) {
- mat *= Matrix3x4::createScale(m_Brightness);
- mat *= Matrix3x4::createTranslate(float(0.5-m_Contrast.x/2),
- float(0.5-m_Contrast.y/2), float(0.5-m_Contrast.z/2));
- mat *= Matrix3x4::createScale(m_Contrast);
+ mat = glm::scale(mat, m_Brightness);
+ glm::vec3 contrast = glm::vec3(0.5f, 0.5f, 0.5f) - m_Contrast/2.f;
+ mat = glm::translate(mat, contrast);
+ mat = glm::scale(mat, m_Contrast);
}
if (m_pf == YCbCr420p || m_pf == YCbCrJ420p || m_pf == YCbCrA420p) {
- mat *= Matrix3x4(*yuvCoeff);
- mat *= Matrix3x4::createTranslate(0.0, -0.5, -0.5);
+ mat *= yuvCoeff;
+ mat = glm::translate(mat, glm::vec3(0.0, -0.5, -0.5));
if (m_pf == YCbCr420p || m_pf == YCbCrA420p) {
- mat *= Matrix3x4::createScale(255.0f/(235-16), 255.0f/(240-16) ,
- 255.0f/(240-16));
- mat *= Matrix3x4::createTranslate(-16.0f/255, -16.0f/255, -16.0f/255);
+ mat = glm::scale(mat,
+ glm::vec3(255.0f/(235-16), 255.0f/(235-16), 255.0f/(235-16)));
+ mat = glm::translate(mat, glm::vec3(-16.0f/255, -16.0f/255, -16.0f/255));
}
}
return mat;
}
-bool OGLSurface::gammaIsModified() const
-{
- return (fabs(m_Gamma.x-1.0) > 0.00001 || fabs(m_Gamma.y-1.0) > 0.00001 ||
- fabs(m_Gamma.z-1.0) > 0.00001);
-}
-
bool OGLSurface::colorIsModified() const
{
return (fabs(m_Brightness.x-1.0) > 0.00001 || fabs(m_Brightness.y-1.0) > 0.00001 ||
diff --git a/src/player/OGLSurface.h b/src/player/OGLSurface.h
index a780b4a..38e6ef4 100644
--- a/src/player/OGLSurface.h
+++ b/src/player/OGLSurface.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -24,12 +24,11 @@
#include "../api.h"
-#include "../base/Point.h"
-#include "../base/Triple.h"
-#include "../base/Matrix3x4.h"
+#include "../base/GLMHelper.h"
#include "../graphics/Bitmap.h"
#include "../graphics/OGLHelper.h"
+#include "../graphics/StandardShader.h"
#include <vector>
#include <string>
@@ -45,7 +44,6 @@ public:
OGLSurface();
virtual ~OGLSurface();
- void attach();
virtual void create(PixelFormat pf, GLTexturePtr pTex0,
GLTexturePtr pTex1 = GLTexturePtr(), GLTexturePtr pTex2 = GLTexturePtr(),
GLTexturePtr pTex3 = GLTexturePtr());
@@ -55,39 +53,38 @@ public:
bool bPremultipliedAlpha = false) const;
GLTexturePtr getTex(int i=0) const;
- void setMaskCoords(DPoint maskPos, DPoint maskSize);
+ void setMaskCoords(glm::vec2 maskPos, glm::vec2 maskSize);
PixelFormat getPixelFormat();
IntPoint getSize();
IntPoint getTextureSize();
bool isCreated() const;
- void setColorParams(const DTriple& gamma, const DTriple& brightness,
- const DTriple& contrast);
- static void createShader();
+ void setColorParams(const glm::vec3& gamma, const glm::vec3& brightness,
+ const glm::vec3& contrast);
+ void setAlphaGamma(float gamma);
bool isDirty() const;
void resetDirty();
private:
- bool useShader() const;
- Matrix3x4 calcColorspaceMatrix() const;
- bool gammaIsModified() const;
+ glm::mat4 calcColorspaceMatrix() const;
bool colorIsModified() const;
GLTexturePtr m_pTextures[4];
IntPoint m_Size;
PixelFormat m_pf;
GLTexturePtr m_pMaskTexture;
- DPoint m_MaskPos;
- DPoint m_MaskSize;
+ glm::vec2 m_MaskPos;
+ glm::vec2 m_MaskSize;
-
- DTriple m_Gamma;
- DTriple m_Brightness;
- DTriple m_Contrast;
+ glm::vec3 m_Gamma;
+ glm::vec3 m_Brightness;
+ glm::vec3 m_Contrast;
+ float m_AlphaGamma;
bool m_bIsDirty;
+
};
}
diff --git a/src/player/OffscreenCanvas.cpp b/src/player/OffscreenCanvas.cpp
index 6ff1c52..758bf43 100644
--- a/src/player/OffscreenCanvas.cpp
+++ b/src/player/OffscreenCanvas.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -25,10 +25,12 @@
#include "Player.h"
#include "../base/Exception.h"
-#include "../base/ProfilingZone.h"
+#include "../base/ProfilingZoneID.h"
#include "../base/ObjectCounter.h"
+#include "../base/ScopeTimer.h"
#include "../graphics/FilterUnmultiplyAlpha.h"
+#include "../graphics/BitmapLoader.h"
#include <iostream>
@@ -62,38 +64,40 @@ void OffscreenCanvas::setRoot(NodePtr pRootNode)
void OffscreenCanvas::initPlayback()
{
m_bUseMipmaps = getMipmap();
- m_pFBO = FBOPtr(new FBO(getSize(), B8G8R8A8, 1, getMultiSampleSamples(), true,
- m_bUseMipmaps));
+ PixelFormat pf;
+ if (BitmapLoader::get()->isBlueFirst()) {
+ pf = B8G8R8A8;
+ } else {
+ pf = R8G8B8A8;
+ }
+ bool bUseDepthBuffer = GLContext::getMain()->useDepthBuffer();
+ m_pFBO = FBOPtr(new FBO(getSize(), pf, 1, getMultiSampleSamples(), bUseDepthBuffer,
+ true, m_bUseMipmaps));
Canvas::initPlayback(getMultiSampleSamples());
m_bIsRendered = false;
}
-void OffscreenCanvas::stopPlayback()
+void OffscreenCanvas::stopPlayback(bool bIsAbort)
{
m_pFBO = FBOPtr();
- Canvas::stopPlayback();
+ Canvas::stopPlayback(bIsAbort);
m_bIsRendered = false;
}
BitmapPtr OffscreenCanvas::screenshot() const
{
- return screenshot(false);
+ BitmapPtr pBmp = screenshotIgnoreAlpha();
+ FilterUnmultiplyAlpha().applyInPlace(pBmp);
+ return pBmp;
}
-static ProfilingZoneID OffscreenRenderProfilingZone("Render OffscreenCanvas");
-
-BitmapPtr OffscreenCanvas::screenshot(bool bIgnoreAlpha) const
+BitmapPtr OffscreenCanvas::screenshotIgnoreAlpha() const
{
if (!isRunning() || !m_bIsRendered) {
throw(Exception(AVG_ERR_UNSUPPORTED,
"OffscreenCanvas::screenshot(): Canvas has not been rendered. No screenshot available"));
}
BitmapPtr pBmp = m_pFBO->getImage(0);
- if (bIgnoreAlpha) {
- pBmp->setPixelFormat(B8G8R8X8);
- } else {
- FilterUnmultiplyAlpha().applyInPlace(pBmp);
- }
return pBmp;
}
@@ -126,7 +130,7 @@ void OffscreenCanvas::setAutoRender(bool bAutoRender)
void OffscreenCanvas::manualRender()
{
emitPreRenderSignal();
- render();
+ renderTree();
emitFrameEndSignal();
}
@@ -184,10 +188,13 @@ bool OffscreenCanvas::isCameraImageAvailable() const
void OffscreenCanvas::addDependentCanvas(CanvasPtr pCanvas)
{
- AVG_ASSERT(!(pCanvas == shared_from_this()));
m_pDependentCanvases.push_back(pCanvas);
- Player::get()->newCanvasDependency(
- dynamic_pointer_cast<OffscreenCanvas>(shared_from_this()));
+ try {
+ Player::get()->newCanvasDependency();
+ } catch (Exception&) {
+ m_pDependentCanvases.pop_back();
+ throw;
+ }
}
void OffscreenCanvas::removeDependentCanvas(CanvasPtr pCanvas)
@@ -202,14 +209,9 @@ void OffscreenCanvas::removeDependentCanvas(CanvasPtr pCanvas)
AVG_ASSERT(false);
}
-bool OffscreenCanvas::hasDependentCanvas(CanvasPtr pCanvas) const
+const vector<CanvasPtr>& OffscreenCanvas::getDependentCanvases() const
{
- for (unsigned i = 0; i < m_pDependentCanvases.size(); ++i) {
- if (pCanvas == m_pDependentCanvases[i]) {
- return true;
- }
- }
- return false;
+ return m_pDependentCanvases;
}
unsigned OffscreenCanvas::getNumDependentCanvases() const
@@ -223,8 +225,11 @@ bool OffscreenCanvas::isSupported()
throw(Exception(AVG_ERR_UNSUPPORTED,
"OffscreenCanvas::isSupported(): Player.play() needs to be called before support can be queried."));
}
-
- return FBO::isFBOSupported() && FBO::isPackedDepthStencilSupported();
+ if (GLContext::getMain()->isGLES()) {
+ return true;
+ } else {
+ return FBO::isFBOSupported() && FBO::isPackedDepthStencilSupported();
+ }
}
bool OffscreenCanvas::isMultisampleSupported()
@@ -245,14 +250,20 @@ void OffscreenCanvas::dump() const
}
}
-void OffscreenCanvas::render()
+static ProfilingZoneID OffscreenRenderProfilingZone("Render OffscreenCanvas");
+
+void OffscreenCanvas::renderTree()
{
if (!isRunning()) {
throw(Exception(AVG_ERR_UNSUPPORTED,
- "OffscreenCanvas::render(): Player.play() needs to be called before rendering offscreen canvases."));
+ "OffscreenCanvas::renderTree(): Player.play() needs to be called before rendering offscreen canvases."));
+ }
+ preRender();
+ m_pFBO->activate();
+ {
+ ScopeTimer Timer(OffscreenRenderProfilingZone);
+ Canvas::render(IntPoint(getRootNode()->getSize()), true);
}
- Canvas::render(IntPoint(getRootNode()->getSize()), true, m_pFBO,
- OffscreenRenderProfilingZone);
m_pFBO->copyToDestTexture();
m_bIsRendered = true;
}
diff --git a/src/player/OffscreenCanvas.h b/src/player/OffscreenCanvas.h
index 808f950..4d740b6 100644
--- a/src/player/OffscreenCanvas.h
+++ b/src/player/OffscreenCanvas.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -41,10 +41,10 @@ class AVG_API OffscreenCanvas: public Canvas
virtual ~OffscreenCanvas();
virtual void setRoot(NodePtr pRootNode);
virtual void initPlayback();
- virtual void stopPlayback();
+ virtual void stopPlayback(bool bIsAbort);
virtual BitmapPtr screenshot() const;
- virtual BitmapPtr screenshot(bool bIgnoreAlpha) const;
+ virtual BitmapPtr screenshotIgnoreAlpha() const;
bool getHandleEvents() const;
int getMultiSampleSamples() const;
bool getMipmap() const;
@@ -65,7 +65,7 @@ class AVG_API OffscreenCanvas: public Canvas
void addDependentCanvas(CanvasPtr pCanvas);
void removeDependentCanvas(CanvasPtr pCanvas);
- bool hasDependentCanvas(CanvasPtr pCanvas) const;
+ const std::vector<CanvasPtr>& getDependentCanvases() const;
unsigned getNumDependentCanvases() const;
static bool isSupported();
@@ -73,7 +73,7 @@ class AVG_API OffscreenCanvas: public Canvas
void dump() const;
protected:
- virtual void render();
+ virtual void renderTree();
private:
FBOPtr m_pFBO;
@@ -82,7 +82,6 @@ class AVG_API OffscreenCanvas: public Canvas
bool m_bIsRendered;
CameraNode* m_pCameraNodeRef;
- int m_cameraFrameRate;
};
typedef boost::shared_ptr<OffscreenCanvas> OffscreenCanvasPtr;
diff --git a/src/player/OffscreenCanvasNode.cpp b/src/player/OffscreenCanvasNode.cpp
index 5c72802..8f712c3 100644
--- a/src/player/OffscreenCanvasNode.cpp
+++ b/src/player/OffscreenCanvasNode.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -22,7 +22,7 @@
#include "OffscreenCanvasNode.h"
#include "Player.h"
-#include "NodeDefinition.h"
+#include "TypeDefinition.h"
#include "../base/FileHelper.h"
@@ -30,10 +30,10 @@ using namespace std;
namespace avg {
-NodeDefinition OffscreenCanvasNode::createDefinition()
+void OffscreenCanvasNode::registerType()
{
- return NodeDefinition("canvas", Node::buildNode<OffscreenCanvasNode>)
- .extendDefinition(CanvasNode::createDefinition())
+ TypeDefinition def = TypeDefinition("canvas", "canvasbase",
+ ExportedObject::buildObject<OffscreenCanvasNode>)
.addArg(Arg<bool>("handleevents", false, false,
offsetof(OffscreenCanvasNode, m_bHandleEvents)))
.addArg(Arg<int>("multisamplesamples", 1, false,
@@ -42,6 +42,7 @@ NodeDefinition OffscreenCanvasNode::createDefinition()
offsetof(OffscreenCanvasNode, m_bMipmap)))
.addArg(Arg<bool>("autorender", true, false,
offsetof(OffscreenCanvasNode, m_bAutoRender)));
+ TypeRegistry::get()->registerType(def);
}
OffscreenCanvasNode::OffscreenCanvasNode(const ArgList& args)
diff --git a/src/player/OffscreenCanvasNode.h b/src/player/OffscreenCanvasNode.h
index 47e1ed7..9d2e850 100644
--- a/src/player/OffscreenCanvasNode.h
+++ b/src/player/OffscreenCanvasNode.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -32,7 +32,7 @@ namespace avg {
class AVG_API OffscreenCanvasNode : public CanvasNode
{
public:
- static NodeDefinition createDefinition();
+ static void registerType();
OffscreenCanvasNode(const ArgList& args);
virtual ~OffscreenCanvasNode();
diff --git a/src/player/PanoImageNode.cpp b/src/player/PanoImageNode.cpp
deleted file mode 100644
index 89157bb..0000000
--- a/src/player/PanoImageNode.cpp
+++ /dev/null
@@ -1,351 +0,0 @@
-//
-// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 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 "PanoImageNode.h"
-#include "NodeDefinition.h"
-
-#include "../base/MathHelper.h"
-#include "../base/Logger.h"
-#include "../base/ProfilingZone.h"
-#include "../base/ScopeTimer.h"
-#include "../base/Exception.h"
-#include "../base/XMLHelper.h"
-
-#include "../graphics/OGLHelper.h"
-
-#include <iostream>
-#include <sstream>
-#include <math.h>
-
-using namespace std;
-
-const int TEX_WIDTH = 64;
-
-namespace avg {
-
-NodeDefinition PanoImageNode::createDefinition()
-{
- return NodeDefinition("panoimage", Node::buildNode<PanoImageNode>)
- .extendDefinition(AreaNode::createDefinition())
- .addArg(Arg<UTF8String>("href", "", false, offsetof(PanoImageNode, m_href)))
- .addArg(Arg<double>("sensorwidth", 1.0, false, offsetof(PanoImageNode, m_SensorWidth)))
- .addArg(Arg<double>("sensorheight", 1.0, false, offsetof(PanoImageNode, m_SensorHeight)))
- .addArg(Arg<double>("focallength", 10.0, false, offsetof(PanoImageNode, m_FocalLength)))
- .addArg(Arg<double>("rotation", -1.0, false, offsetof(PanoImageNode, m_Rotation)));
-}
-
-PanoImageNode::PanoImageNode (const ArgList& Args)
-{
- Args.setMembers(this);
- m_pBmp = BitmapPtr(new Bitmap(IntPoint(1,1), R8G8B8));
- load();
-}
-
-PanoImageNode::~PanoImageNode ()
-{
- clearTextures();
-}
-
-void PanoImageNode::connectDisplay()
-{
- AreaNode::connectDisplay();
-
- setupTextures();
-}
-
-void PanoImageNode::disconnect(bool bKill)
-{
- clearTextures();
- AreaNode::disconnect(bKill);
-}
-
-static ProfilingZoneID PanoRenderProfilingZone("PanoImageNode::render");
-
-void PanoImageNode::render(const DRect& Rect)
-{
- ScopeTimer Timer(PanoRenderProfilingZone);
- pushGLState();
- glproc::ActiveTexture(GL_TEXTURE0);
-
- gluLookAt(0, 0, 0, // Eye
- 0, 0, -1, // Center
- 0, 1, 0); // Up.
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL,
- "PanoImageNode::render: gluLookAt()");
-
- glMatrixMode(GL_PROJECTION);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL,
- "PanoImageNode::render: glMatrixMode(GL_PROJECTION)");
- glLoadIdentity();
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL,
- "PanoImageNode::render: glLoadIdentity()");
-
- calcProjection();
- gluPerspective(m_fovy*180/M_PI, m_aspect, 0.1, 2);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL,
- "PanoImageNode::render: gluPerspective()");
- glMatrixMode(GL_MODELVIEW);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL,
- "PanoImageNode::render: glMatrixMode(GL_MODELVIEW)");
-
- glDisable (GL_CLIP_PLANE0);
- glDisable (GL_CLIP_PLANE1);
- glDisable (GL_CLIP_PLANE2);
- glDisable (GL_CLIP_PLANE3);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL,
- "PanoImageNode::render: glDisable(GL_CLIP_PLANEx)");
- DPoint Vpt = getSize();
- glViewport(0, 0, int(Vpt.x), int(Vpt.y));
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL,
- "PanoImageNode::render: glViewport()");
- glColor4d(1.0, 1.0, 1.0, getEffectiveOpacity());
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL,
- "PanoImageNode::render: glColor4d()");
-//glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
-
- double HorizOffset = m_Rotation+m_fovy*m_aspect/2;
-// glutWireSphere(1, 20, 16);
- for (unsigned int i=0; i<m_TileTextureIDs.size(); ++i) {
- unsigned int TexID = m_TileTextureIDs[i];
- glBindTexture(GL_TEXTURE_2D, TexID);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL,
- "PanoImageNode::render: glBindTexture()");
- double StartAngle=i*m_SliceAngle-HorizOffset;
- double StartX = sin(StartAngle);
- double StartZ = -cos(StartAngle);
- double EndAngle;
- if (i<m_TileTextureIDs.size()-1) {
- EndAngle = (i+1)*m_SliceAngle-HorizOffset;
- } else {
- EndAngle = m_CylAngle-HorizOffset;
- }
- double EndX = sin(EndAngle);
- double EndZ = -cos(EndAngle);
- double TexPartUsed = double(m_pBmp->getSize().y)/m_TexHeight;
- glBegin(GL_QUADS);
- glTexCoord2d(0.0, 0.0);
- glVertex3d(StartX, m_CylHeight, StartZ);
- glTexCoord2d(0.0, TexPartUsed);
- glVertex3d(StartX, -m_CylHeight, StartZ);
- glTexCoord2d(1.0, TexPartUsed);
- glVertex3d(EndX, -m_CylHeight, EndZ);
- glTexCoord2d(1.0, 0.0);
- glVertex3d(EndX, m_CylHeight, EndZ);
- glEnd();
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL,
- "PanoImageNode::render: glEnd()");
- }
-
- popGLState();
-}
-
-double PanoImageNode::getScreenPosFromAngle(double Angle) const
-{
- double HorizOffsetAngle = Angle-m_Rotation-m_fovy*m_aspect/2;
- double PixelDistFromCenter = m_FocalLength*tan(HorizOffsetAngle)/m_SensorWidth
- *getSize().x;
- return PixelDistFromCenter+getSize().x/2;
-}
-
-double PanoImageNode::getScreenPosFromPanoPos(int PanoPos) const
-{
- double AnglePerPixel = m_CylAngle*1/double(m_pBmp->getSize().x);
- return getScreenPosFromAngle(AnglePerPixel*PanoPos);
-}
-
-const UTF8String& PanoImageNode::getHRef() const
-{
- return m_href;
-}
-
-void PanoImageNode::setHRef(const UTF8String& href)
-{
- m_href = href;
- load();
- if (getState() == NS_CANRENDER) {
- setupTextures();
- }
-}
-
-double PanoImageNode::getSensorWidth () const
-{
- return m_SensorWidth;
-}
-
-void PanoImageNode::setSensorWidth (double sensorWidth)
-{
- m_SensorWidth = sensorWidth;
-}
-
-double PanoImageNode::getSensorHeight () const
-{
- return m_SensorHeight;
-}
-
-void PanoImageNode::setSensorHeight (double sensorHeight)
-{
- m_SensorHeight = sensorHeight;
-}
-
-double PanoImageNode::getFocalLength () const
-{
- return m_FocalLength;
-}
-
-void PanoImageNode::setFocalLength (double focalLength)
-{
- m_FocalLength = focalLength;
-}
-
-double PanoImageNode::getRotation () const
-{
- return m_Rotation;
-}
-
-void PanoImageNode::setRotation (double rotation)
-{
- m_Rotation = rotation;
-}
-
-double PanoImageNode::getMaxRotation () const
-{
- return m_MaxRotation;
-}
-
-void PanoImageNode::calcProjection()
-{
- // Takes SensorWidth, SensorHeight and FocalLength and calculates
- // loads of derived values needed for projection.
- m_fovy = 2*atan((m_SensorHeight/2)/m_FocalLength);
- m_aspect = m_SensorWidth/m_SensorHeight;
- m_CylHeight = tan(m_fovy)/2;
- m_CylAngle = m_fovy*m_pBmp->getSize().x/m_pBmp->getSize().y;
- m_SliceAngle = m_CylAngle*TEX_WIDTH/double(m_pBmp->getSize().x);
- m_MaxRotation = m_CylAngle-m_fovy*m_aspect;
-}
-
-DPoint PanoImageNode::getPreferredMediaSize()
-{
- double SensorAspect = m_SensorWidth/m_SensorHeight;
- double Width = m_pBmp->getSize().y*SensorAspect;
- return DPoint(Width, m_pBmp->getSize().y);
-}
-
-void PanoImageNode::load()
-{
- m_Filename = m_href;
- AVG_TRACE(Logger::MEMORY, "Loading " << m_Filename);
- if (m_Filename != "") {
- initFilename(m_Filename);
- try {
-
- m_pBmp = BitmapPtr(new Bitmap(m_Filename));
- } catch (Exception & ex) {
- AVG_TRACE(Logger::ERROR, ex.getStr());
- }
- }
-
- calcProjection();
- if (m_Rotation == -1) {
- m_Rotation = m_MaxRotation/2;
- }
-}
-
-void PanoImageNode::setupTextures()
-{
- if (!m_TileTextureIDs.empty()) {
- clearTextures();
- }
- m_TexHeight = nextpow2(m_pBmp->getSize().y);
- int NumTextures = int(ceil(double(m_pBmp->getSize().x)/TEX_WIDTH));
- glproc::ActiveTexture(GL_TEXTURE0);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL,
- "PanoImageNode::setupTextures: glproc::ActiveTexture(GL_TEXTURE0);");
- glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL,
- "PanoImageNode::setupTextures: glPixelStorei(GL_UNPACK_ALIGNMENT)");
- glPixelStorei(GL_UNPACK_ROW_LENGTH, m_pBmp->getSize().x);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL,
- "PanoImageNode::setupTextures: glPixelStorei(GL_UNPACK_ROW_LENGTH)");
- glEnable(GL_TEXTURE_2D);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL,
- "PanoImageNode::setupTextures: glEnable(GL_TEXTURE_2D);");
- for (int i=0; i<NumTextures; i++) {
- BitmapPtr pRegion;
- if (i != NumTextures-1) {
- pRegion = BitmapPtr(new Bitmap(*m_pBmp,
- IntRect(i*TEX_WIDTH, 0, (i+1)*TEX_WIDTH, m_pBmp->getSize().y)));
- } else {
- // The last column isn't necessarily as wide as the others.
- pRegion = BitmapPtr(new Bitmap(*m_pBmp,
- IntRect(i*TEX_WIDTH, 0,
- m_pBmp->getSize().x, m_pBmp->getSize().y)));
- }
-
- unsigned int TexID;
- glGenTextures(1, &TexID);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL,
- "PanoImageNode::setupTextures: glGenTextures()");
- m_TileTextureIDs.push_back(TexID);
- glBindTexture(GL_TEXTURE_2D, TexID);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL,
- "PanoImageNode::setupTextures: glBindTexture()");
-
- glTexParameteri(GL_TEXTURE_2D,
- GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D,
- GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL,
- "PanoImageNode::setupTextures: glTexParameteri()");
-
- int DestMode;
- if (pRegion->getPixelFormat() == R8G8B8X8) {
- DestMode = GL_RGB;
- } else {
- DestMode = GL_RGBA;
- }
- glTexImage2D(GL_TEXTURE_2D, 0,
- DestMode, TEX_WIDTH, m_TexHeight, 0,
- GL_RGBA, GL_UNSIGNED_BYTE, 0);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL,
- "PanoImageNode::setupTextures: glTexImage2D()");
- unsigned char * pStartPos = pRegion->getPixels();
- glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0,
- pRegion->getSize().x, pRegion->getSize().y,
- GL_RGBA, GL_UNSIGNED_BYTE, pStartPos);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL,
- "PanoImageNode::setupTextures: glTexSubImage2D()");
- }
- glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
-}
-
-void PanoImageNode::clearTextures()
-{
- for (unsigned int i=0; i<m_TileTextureIDs.size(); ++i) {
- unsigned int TexID = m_TileTextureIDs[i];
- glDeleteTextures(1, &TexID);
- }
- m_TileTextureIDs.clear();
-}
-
-}
diff --git a/src/player/PanoImageNode.h b/src/player/PanoImageNode.h
deleted file mode 100644
index 916d2f2..0000000
--- a/src/player/PanoImageNode.h
+++ /dev/null
@@ -1,95 +0,0 @@
-//
-// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 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 _PanoImageNode_H_
-#define _PanoImageNode_H_
-
-#include "../api.h"
-#include "../avgconfigwrapper.h"
-
-#include "AreaNode.h"
-#include "../base/UTF8String.h"
-#include "../graphics/Bitmap.h"
-
-#include <string>
-#include <vector>
-
-namespace avg {
-
-class AVG_API PanoImageNode: public AreaNode
-{
- public:
- static NodeDefinition createDefinition();
-
- PanoImageNode(const ArgList& Args);
- virtual ~PanoImageNode();
-
- virtual void connectDisplay();
- virtual void disconnect(bool bKill);
- virtual void render(const DRect& Rect);
-
- double getScreenPosFromPanoPos(int PanoPos) const;
- double getScreenPosFromAngle(double Angle) const;
- const UTF8String& getHRef() const;
- void setHRef(const UTF8String& href);
- double getSensorWidth() const;
- void setSensorWidth(double sensorWidth);
- double getSensorHeight() const;
- void setSensorHeight(double sensorHeight);
- double getFocalLength() const;
- void setFocalLength(double focalLength);
- double getRotation() const;
- void setRotation(double rotation);
- double getMaxRotation() const;
-
- protected:
- virtual DPoint getPreferredMediaSize();
-
- private:
- void load();
- void calcProjection();
- void setupTextures();
- void clearTextures();
-
- UTF8String m_href;
- std::string m_Filename;
- double m_SensorWidth;
- double m_SensorHeight;
- double m_FocalLength;
- BitmapPtr m_pBmp;
- int m_TexHeight;
- std::vector<unsigned int> m_TileTextureIDs;
-
- // Derived values calculated in calcProjection
- double m_fovy; // Vertical field of view
- double m_aspect; // Sensor aspect ratio
- double m_CylHeight;
- double m_CylAngle; // Total angle covered by panorama
- double m_SliceAngle; // Angle per slice
- double m_MaxRotation; // Maximum rotation angle (=Total angle - visible area)
-
- double m_Rotation;
-};
-
-}
-
-#endif //_PanoImageNode_H_
-
diff --git a/src/player/Player.cpp b/src/player/Player.cpp
index 086f168..77f27d0 100644
--- a/src/player/Player.cpp
+++ b/src/player/Player.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -29,7 +29,6 @@
#include "VideoNode.h"
#include "CameraNode.h"
#include "ImageNode.h"
-#include "PanoImageNode.h"
#include "SoundNode.h"
#include "LineNode.h"
#include "RectNode.h"
@@ -38,7 +37,7 @@
#include "PolygonNode.h"
#include "CircleNode.h"
#include "MeshNode.h"
-#include "NodeDefinition.h"
+#include "FontStyle.h"
#include "PluginManager.h"
#include "TextEngine.h"
#include "TestHelper.h"
@@ -48,6 +47,7 @@
#include "SDLDisplayEngine.h"
#include "MultitouchInputDevice.h"
#include "TUIOInputDevice.h"
+#include "OGLSurface.h"
#ifdef __APPLE__
#include "AppleTrackpadInputDevice.h"
#endif
@@ -64,6 +64,8 @@
#include "KeyEvent.h"
#include "MouseEvent.h"
#include "EventDispatcher.h"
+#include "PublisherDefinition.h"
+#include "BitmapManager.h"
#include "../base/FileHelper.h"
#include "../base/StringHelper.h"
@@ -73,13 +75,16 @@
#include "../base/ConfigMgr.h"
#include "../base/XMLHelper.h"
#include "../base/ScopeTimer.h"
-#include "../base/MathHelper.h"
+#include "../base/WorkerThread.h"
+#include "../base/DAG.h"
-#include "../graphics/BitmapManager.h"
+#include "../graphics/BitmapLoader.h"
+#include "../graphics/ShaderRegistry.h"
+#include "../graphics/Display.h"
#include "../imaging/Camera.h"
-#include "../audio/SDLAudioEngine.h"
+#include "../audio/AudioEngine.h"
#include <libxml/xmlmemory.h>
@@ -94,6 +99,9 @@
#include <fenv.h>
#endif
+#include <glib-object.h>
+#include <typeinfo>
+
using namespace std;
using namespace boost;
@@ -102,23 +110,27 @@ namespace avg {
Player * Player::s_pPlayer=0;
Player::Player()
- : m_pDisplayEngine(),
+ : Publisher("Player"),
+ m_pDisplayEngine(),
+ m_bDisplayEngineBroken(false),
+ m_bIsTraversingTree(false),
m_pMultitouchInputDevice(),
m_bInHandleTimers(false),
m_bCurrentTimeoutDeleted(false),
+ m_bKeepWindowOpen(false),
m_bStopOnEscape(true),
m_bIsPlaying(false),
m_bFakeFPS(false),
m_FakeFPS(0),
m_FrameTime(0),
m_Volume(1),
- m_dtd(0),
m_bPythonAvailable(true),
- m_pLastMouseEvent(new MouseEvent(Event::CURSORMOTION, false, false, false,
- IntPoint(-1, -1), MouseEvent::NO_BUTTON, DPoint(-1, -1), 0)),
- m_EventHookPyFunc(Py_None)
+ m_pLastMouseEvent(new MouseEvent(Event::CURSOR_MOTION, false, false, false,
+ IntPoint(-1, -1), MouseEvent::NO_BUTTON, glm::vec2(-1, -1), 0)),
+ m_EventHookPyFunc(Py_None),
+ m_bMouseEnabled(true)
{
-string sDummy;
+ string sDummy;
#ifdef _WIN32
if (getEnv("AVG_WIN_CRASH_SILENTLY", sDummy)) {
DWORD dwMode = SetErrorMode(SEM_NOGPFAULTERRORBOX);
@@ -129,31 +141,42 @@ string sDummy;
// Turning this on causes fp exceptions in the linux nvidia drivers.
// feenableexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW);
#endif
+ setAffinityMask(true);
+
if (s_pPlayer) {
throw Exception(AVG_ERR_UNKNOWN, "Player has already been instantiated.");
}
- ThreadProfilerPtr pProfiler = ThreadProfiler::get();
+ ThreadProfiler* pProfiler = ThreadProfiler::get();
pProfiler->setName("main");
+
+ SDLDisplayEngine::initSDL();
initConfig();
- // Register all node types
- registerNodeType(AVGNode::createDefinition());
- registerNodeType(OffscreenCanvasNode::createDefinition());
- registerNodeType(CanvasNode::createDefinition());
- registerNodeType(DivNode::createDefinition());
- registerNodeType(ImageNode::createDefinition());
- registerNodeType(WordsNode::createDefinition());
- registerNodeType(VideoNode::createDefinition());
- registerNodeType(CameraNode::createDefinition());
- registerNodeType(PanoImageNode::createDefinition());
- registerNodeType(SoundNode::createDefinition());
- registerNodeType(LineNode::createDefinition());
- registerNodeType(RectNode::createDefinition());
- registerNodeType(CurveNode::createDefinition());
- registerNodeType(PolyLineNode::createDefinition());
- registerNodeType(PolygonNode::createDefinition());
- registerNodeType(CircleNode::createDefinition());
- registerNodeType(MeshNode::createDefinition());
+ FontStyle::registerType();
+ Node::registerType();
+ AreaNode::registerType();
+ RasterNode::registerType();
+ VectorNode::registerType();
+ FilledVectorNode::registerType();
+
+ DivNode::registerType();
+ CanvasNode::registerType();
+ OffscreenCanvasNode::registerType();
+ AVGNode::registerType();
+ ImageNode::registerType();
+ WordsNode::registerType();
+ VideoNode::registerType();
+ CameraNode::registerType();
+ SoundNode::registerType();
+ LineNode::registerType();
+ RectNode::registerType();
+ CurveNode::registerType();
+ PolyLineNode::registerType();
+ PolygonNode::registerType();
+ CircleNode::registerType();
+ MeshNode::registerType();
+
+ Contact::registerType();
m_pTestHelper = TestHelperPtr(new TestHelper());
@@ -173,9 +196,11 @@ void deletePlayer()
Player::~Player()
{
- if (m_dtd) {
- xmlFreeDtd(m_dtd);
+ m_pMainCanvas = MainCanvasPtr();
+ if (m_pDisplayEngine) {
+ m_pDisplayEngine->teardown();
}
+ SDLDisplayEngine::quitSDL();
}
Player* Player::get()
@@ -225,19 +250,41 @@ void Player::setWindowPos(int x, int y)
m_DP.m_Pos.y = y;
}
-void Player::setOGLOptions(bool bUsePOTTextures, bool bUseShaders,
- bool bUsePixelBuffers, int multiSampleSamples)
+void Player::setWindowTitle(const string& sTitle)
+{
+ m_pDisplayEngine->setWindowTitle(sTitle);
+}
+
+void Player::useGLES(bool bGLES)
+{
+ errorIfPlaying("Player.useGLES");
+ m_GLConfig.m_bGLES = bGLES;
+#ifdef AVG_ENABLE_EGL
+ m_GLConfig.m_bGLES = true;
+#endif
+ BitmapLoader::init(!m_GLConfig.m_bGLES);
+}
+
+void Player::setOGLOptions(bool bUsePOTTextures, bool bUsePixelBuffers,
+ int multiSampleSamples, GLConfig::ShaderUsage shaderUsage,
+ bool bUseDebugContext)
{
errorIfPlaying("Player.setOGLOptions");
m_GLConfig.m_bUsePOTTextures = bUsePOTTextures;
- m_GLConfig.m_bUseShaders = bUseShaders;
m_GLConfig.m_bUsePixelBuffers = bUsePixelBuffers;
- m_GLConfig.m_MultiSampleSamples = multiSampleSamples;
+ setMultiSampleSamples(multiSampleSamples);
+ m_GLConfig.m_ShaderUsage = shaderUsage;
+ m_GLConfig.m_bUseDebugContext = bUseDebugContext;
}
void Player::setMultiSampleSamples(int multiSampleSamples)
{
errorIfPlaying("Player.setMultiSampleSamples");
+ if (multiSampleSamples < 1) {
+ throw Exception(AVG_ERR_OUT_OF_RANGE,
+ "MultiSampleSamples must be 1 or greater (was " +
+ toString(multiSampleSamples) + ").");
+ }
m_GLConfig.m_MultiSampleSamples = multiSampleSamples;
}
@@ -248,40 +295,40 @@ void Player::setAudioOptions(int samplerate, int channels)
m_AP.m_Channels = channels;
}
-DPoint Player::getScreenResolution()
+void Player::enableGLErrorChecks(bool bEnable)
+{
+ GLContext::enableErrorChecks(bEnable);
+}
+
+glm::vec2 Player::getScreenResolution()
{
- return DPoint(safeGetDisplayEngine()->getScreenResolution());
+ return glm::vec2(Display::get()->getScreenResolution());
}
-double Player::getPixelsPerMM()
+float Player::getPixelsPerMM()
{
- return safeGetDisplayEngine()->getPixelsPerMM();
+ return Display::get()->getPixelsPerMM();
}
-DPoint Player::getPhysicalScreenDimensions()
+glm::vec2 Player::getPhysicalScreenDimensions()
{
- return safeGetDisplayEngine()->getPhysicalScreenDimensions();
+ return Display::get()->getPhysicalScreenDimensions();
}
-void Player::assumePixelsPerMM(double ppmm)
+void Player::assumePixelsPerMM(float ppmm)
{
- safeGetDisplayEngine()->assumePixelsPerMM(ppmm);
+ Display::get()->assumePixelsPerMM(ppmm);
}
CanvasPtr Player::loadFile(const string& sFilename)
{
errorIfPlaying("Player.loadFile");
NodePtr pNode = loadMainNodeFromFile(sFilename);
- m_pEventDispatcher = EventDispatcherPtr(new EventDispatcher(this));
if (m_pMainCanvas) {
- cleanup();
+ cleanup(false);
}
- m_pMainCanvas = MainCanvasPtr(new MainCanvas(this));
- m_pMainCanvas->setRoot(pNode);
- m_DP.m_Size = m_pMainCanvas->getSize();
-
- registerFrameEndListener(BitmapManager::get());
+ initMainCanvas(pNode);
return m_pMainCanvas;
}
@@ -290,16 +337,11 @@ CanvasPtr Player::loadString(const string& sAVG)
{
errorIfPlaying("Player.loadString");
if (m_pMainCanvas) {
- cleanup();
+ cleanup(false);
}
NodePtr pNode = loadMainNodeFromString(sAVG);
- m_pEventDispatcher = EventDispatcherPtr(new EventDispatcher(this));
- m_pMainCanvas = MainCanvasPtr(new MainCanvas(this));
- m_pMainCanvas->setRoot(pNode);
- m_DP.m_Size = m_pMainCanvas->getSize();
-
- registerFrameEndListener(BitmapManager::get());
+ initMainCanvas(pNode);
return m_pMainCanvas;
}
@@ -316,26 +358,20 @@ OffscreenCanvasPtr Player::loadCanvasString(const string& sAVG)
return registerOffscreenCanvas(pNode);
}
-CanvasPtr Player::createMainCanvas(const boost::python::dict& params)
+CanvasPtr Player::createMainCanvas(const py::dict& params)
{
errorIfPlaying("Player.createMainCanvas");
if (m_pMainCanvas) {
- cleanup();
+ cleanup(false);
}
NodePtr pNode = createNode("avg", params);
-
- m_pEventDispatcher = EventDispatcherPtr(new EventDispatcher(this));
- m_pMainCanvas = MainCanvasPtr(new MainCanvas(this));
- m_pMainCanvas->setRoot(pNode);
- m_DP.m_Size = m_pMainCanvas->getSize();
-
- registerFrameEndListener(BitmapManager::get());
+ initMainCanvas(pNode);
return m_pMainCanvas;
}
-OffscreenCanvasPtr Player::createCanvas(const boost::python::dict& params)
+OffscreenCanvasPtr Player::createCanvas(const py::dict& params)
{
NodePtr pNode = createNode("canvas", params);
return registerOffscreenCanvas(pNode);
@@ -351,7 +387,7 @@ void Player::deleteCanvas(const string& sID)
string("deleteCanvas: Canvas with id ")+sID
+" is still referenced."));
}
- (*it)->stopPlayback();
+ (*it)->stopPlayback(false);
m_pCanvases.erase(it);
return;
}
@@ -376,105 +412,75 @@ OffscreenCanvasPtr Player::getCanvas(const string& sID) const
}
}
-void Player::newCanvasDependency(const OffscreenCanvasPtr pCanvas)
+void Player::newCanvasDependency()
{
- OffscreenCanvasPtr pNewCanvas;
- unsigned i;
- for (i = 0; i < m_pCanvases.size(); ++i) {
- if (pCanvas == m_pCanvases[i]) {
- pNewCanvas = m_pCanvases[i];
- m_pCanvases.erase(m_pCanvases.begin()+i);
- continue;
+ DAG dag;
+ for (unsigned i = 0; i < m_pCanvases.size(); ++i) {
+ set<long> dependentCanvasSet;
+ OffscreenCanvasPtr pCanvas = m_pCanvases[i];
+ const vector<CanvasPtr>& pDependents = pCanvas->getDependentCanvases();
+ for (unsigned j = 0; j < pDependents.size(); ++j) {
+ dependentCanvasSet.insert(pDependents[j]->getHash());
}
+ dag.addNode(pCanvas->getHash(), dependentCanvasSet);
}
- AVG_ASSERT(pNewCanvas);
- bool bFound = false;
- for (i = 0; i < m_pCanvases.size(); ++i) {
- if (pNewCanvas->hasDependentCanvas(m_pCanvases[i])) {
- bFound = true;
- break;
- }
+ dag.addNode(m_pMainCanvas->getHash(), set<long>());
+
+ vector<long> sortedCanvasIDs;
+ try {
+ dag.sort(sortedCanvasIDs);
+ } catch (Exception&) {
+ throw Exception(AVG_ERR_INVALID_ARGS, "Circular dependency between canvases.");
}
- if (bFound) {
- for (unsigned j = i; j < m_pCanvases.size(); ++j) {
- if (m_pCanvases[j]->hasDependentCanvas(pNewCanvas)) {
- throw Exception(AVG_ERR_INVALID_ARGS,
- "Circular dependency between canvases.");
+
+ vector<OffscreenCanvasPtr> pTempCanvases = m_pCanvases;
+ m_pCanvases.clear();
+ for (unsigned i = 0; i < sortedCanvasIDs.size(); ++i) {
+ long canvasID = sortedCanvasIDs[i];
+ for (unsigned j = 0; j < pTempCanvases.size(); ++j) {
+ OffscreenCanvasPtr pCandidateCanvas = pTempCanvases[j];
+ if (pCandidateCanvas->getHash() == canvasID) {
+ m_pCanvases.push_back(pCandidateCanvas);
+ break;
}
}
- m_pCanvases.insert(m_pCanvases.begin()+i, pNewCanvas);
- } else {
- AVG_ASSERT(pNewCanvas->hasDependentCanvas(m_pMainCanvas));
- m_pCanvases.push_back(pNewCanvas);
- }
-/*
- for (unsigned k=0; k<m_pCanvases.size(); ++k) {
- m_pCanvases[k]->dump();
}
-*/
}
NodePtr Player::loadMainNodeFromFile(const string& sFilename)
{
- string RealFilename;
- try {
- AVG_TRACE(Logger::MEMORY, std::string("Player::loadFile(") + sFilename + ")");
-
- // When loading an avg file, assets are loaded from a directory relative
- // to the file.
- char szBuf[1024];
- char * pBuf = getcwd(szBuf, 1024);
- if (sFilename[0] == '/') {
- RealFilename = sFilename;
- } else {
- m_CurDirName = string(pBuf)+"/";
- RealFilename = m_CurDirName+sFilename;
- }
- m_CurDirName = RealFilename.substr(0, RealFilename.rfind('/')+1);
-
- string sAVG;
- readWholeFile(RealFilename, sAVG);
- NodePtr pNode = internalLoad(sAVG);
+ string sRealFilename;
+ AVG_TRACE(Logger::category::MEMORY, Logger::severity::INFO,
+ "Player::loadFile(" << sFilename << ")");
- // Reset the directory to load assets from to the current dir.
+ // When loading an avg file, assets are loaded from a directory relative
+ // to the file.
+ char szBuf[1024];
+ char * pBuf = getcwd(szBuf, 1024);
+ if (sFilename[0] == '/') {
+ sRealFilename = sFilename;
+ } else {
m_CurDirName = string(pBuf)+"/";
- return pNode;
- } catch (Exception& ex) {
- switch (ex.getCode()) {
- case AVG_ERR_XML_PARSE:
- throw (Exception(AVG_ERR_XML_PARSE,
- string("Error parsing xml document ")+RealFilename));
- break;
- case AVG_ERR_XML_VALID:
- throw (Exception(AVG_ERR_XML_VALID,
- RealFilename + " does not validate."));
- break;
- default:
- throw;
- }
+ sRealFilename = m_CurDirName+sFilename;
}
+ m_CurDirName = sRealFilename.substr(0, sRealFilename.rfind('/')+1);
+
+ string sAVG;
+ readWholeFile(sRealFilename, sAVG);
+ NodePtr pNode = internalLoad(sAVG, sRealFilename);
+
+ // Reset the directory to load assets from to the current dir.
+ m_CurDirName = string(pBuf)+"/";
+ return pNode;
}
NodePtr Player::loadMainNodeFromString(const string& sAVG)
{
- try {
- AVG_TRACE(Logger::MEMORY, "Player::loadString()");
+ AVG_TRACE(Logger::category::MEMORY, Logger::severity::INFO, "Player::loadString()");
- string sEffectiveDoc = removeStartEndSpaces(sAVG);
- NodePtr pNode = internalLoad(sEffectiveDoc);
- return pNode;
- } catch (Exception& ex) {
- switch (ex.getCode()) {
- case AVG_ERR_XML_PARSE:
- throw Exception(AVG_ERR_XML_PARSE, "Error parsing xml string.");
- break;
- case AVG_ERR_XML_VALID:
- throw Exception(AVG_ERR_XML_VALID, "Error validating xml string.");
- break;
- default:
- throw;
- }
- }
+ string sEffectiveDoc = removeStartEndSpaces(sAVG);
+ NodePtr pNode = internalLoad(sEffectiveDoc, "");
+ return pNode;
}
void Player::play()
@@ -484,21 +490,24 @@ void Player::play()
throw Exception(AVG_ERR_NO_NODE, "Play called, but no xml file loaded.");
}
initPlayback();
+ notifySubscribers("PLAYBACK_START");
try {
ThreadProfiler::get()->start();
doFrame(true);
while (!m_bStopping) {
doFrame(false);
}
+ notifySubscribers("PLAYBACK_END");
} catch (...) {
- cleanup();
+ cleanup(true);
+ m_bDisplayEngineBroken = true;
throw;
}
- cleanup();
- AVG_TRACE(Logger::PLAYER, "Playback ended.");
+ cleanup(false);
+ AVG_TRACE(Logger::category::PLAYER, Logger::severity::INFO, "Playback ended.");
} catch (Exception& ex) {
m_bIsPlaying = false;
- AVG_TRACE(Logger::ERROR, ex.getStr());
+ AVG_LOG_ERROR(ex.getStr());
throw;
}
}
@@ -508,7 +517,7 @@ void Player::stop()
if (m_bIsPlaying) {
m_bStopping = true;
} else {
- cleanup();
+ cleanup(false);
}
}
@@ -517,11 +526,11 @@ bool Player::isStopping()
return m_bStopping;
}
-void Player::initPlayback()
+void Player::initPlayback(const std::string& sShaderPath)
{
m_bIsPlaying = true;
- AVG_TRACE(Logger::PLAYER, "Playback started.");
- initGraphics();
+ AVG_TRACE(Logger::category::PLAYER, Logger::severity::INFO, "Playback started.");
+ initGraphics(sShaderPath);
initAudio();
try {
for (unsigned i = 0; i < m_pCanvases.size(); ++i) {
@@ -529,7 +538,8 @@ void Player::initPlayback()
}
m_pMainCanvas->initPlayback(m_pDisplayEngine);
} catch (Exception&) {
- cleanup();
+ cleanup(true);
+ m_bDisplayEngineBroken = true;
throw;
}
m_pEventDispatcher->addInputDevice(
@@ -537,6 +547,7 @@ void Player::initPlayback()
m_pEventDispatcher->addInputDevice(m_pTestHelper);
m_pDisplayEngine->initRender();
+ Display::get()->rereadScreenResolution();
m_bStopping = false;
if (m_pMultitouchInputDevice) {
m_pMultitouchInputDevice->start();
@@ -551,27 +562,25 @@ bool Player::isPlaying()
return m_bIsPlaying;
}
-void Player::setFramerate(double rate)
+void Player::setFramerate(float rate)
{
if (m_bIsPlaying) {
m_pDisplayEngine->setFramerate(rate);
- } else {
- m_DP.m_Framerate = rate;
- m_DP.m_VBRate = 0;
}
+ m_DP.m_Framerate = rate;
+ m_DP.m_VBRate = 0;
}
void Player::setVBlankFramerate(int rate)
{
if (m_bIsPlaying) {
m_pDisplayEngine->setVBlankRate(rate);
- } else {
- m_DP.m_Framerate = 0;
- m_DP.m_VBRate = rate;
}
+ m_DP.m_Framerate = 0;
+ m_DP.m_VBRate = rate;
}
-double Player::getEffectiveFramerate()
+float Player::getEffectiveFramerate()
{
if (m_bIsPlaying) {
if (m_bFakeFPS) {
@@ -589,7 +598,7 @@ TestHelper * Player::getTestHelper()
return m_pTestHelper.get();
}
-void Player::setFakeFPS(double fps)
+void Player::setFakeFPS(float fps)
{
if (fabs(fps + 1.0) < 0.0001) {
// fps = -1
@@ -599,8 +608,8 @@ void Player::setFakeFPS(double fps)
m_FakeFPS = fps;
}
- if (SDLAudioEngine::get()) {
- SDLAudioEngine::get()->setAudioEnabled(!m_bFakeFPS);
+ if (AudioEngine::get()) {
+ AudioEngine::get()->setAudioEnabled(!m_bFakeFPS);
}
}
@@ -618,39 +627,24 @@ long long Player::getFrameTime()
return m_FrameTime;
}
-double Player::getFrameDuration()
+float Player::getFrameDuration()
{
if (!m_bIsPlaying) {
throw Exception(AVG_ERR_UNSUPPORTED,
"Must call Player.play() before getFrameDuration().");
}
if (m_bFakeFPS) {
- return 1000.0/m_FakeFPS;
+ return 1000.0f/m_FakeFPS;
} else {
- double framerate = m_pDisplayEngine->getEffectiveFramerate();
+ float framerate = m_pDisplayEngine->getEffectiveFramerate();
if (framerate > 0) {
- return 1000./framerate;
+ return 1000.f/framerate;
} else {
return 0;
}
}
}
-TrackerInputDevice * Player::addTracker()
-{
- if (!m_pMainCanvas) {
- throw Exception(AVG_ERR_UNSUPPORTED,
- "You must use loadFile() before addTracker().");
- }
- m_pMultitouchInputDevice = IInputDevicePtr(new TrackerInputDevice());
- addInputDevice(m_pMultitouchInputDevice);
- if (m_bIsPlaying) {
- m_pMultitouchInputDevice->start();
- }
-
- return dynamic_cast<TrackerInputDevice*>(m_pMultitouchInputDevice.get());
-}
-
TrackerInputDevice * Player::getTracker()
{
TrackerInputDevice* pTracker = dynamic_cast<TrackerInputDevice*>(
@@ -660,6 +654,10 @@ TrackerInputDevice * Player::getTracker()
void Player::enableMultitouch()
{
+ if (!m_bIsPlaying) {
+ throw Exception(AVG_ERR_UNSUPPORTED,
+ "Must call Player.play() before enableMultitouch().");
+ }
string sDriver;
getEnv("AVG_MULTITOUCH_DRIVER", sDriver);
@@ -671,7 +669,7 @@ void Player::enableMultitouch()
#elif defined (AVG_ENABLE_MTDEV)
sDriver = "LINUXMTDEV";
#else
- AVG_TRACE(Logger::WARNING, "Valid values for AVG_MULTITOUCH_DRIVER are WIN7TOUCH, XINPUT, LINUXMTDEV, TRACKER, TUIO and APPLETRACKPAD.");
+ AVG_LOG_WARNING("Valid values for AVG_MULTITOUCH_DRIVER are WIN7TOUCH, XINPUT, LINUXMTDEV, TRACKER, TUIO and APPLETRACKPAD.");
throw Exception(AVG_ERR_MT_INIT,
"Multitouch support: No default driver available. Set AVG_MULTITOUCH_DRIVER.");
#endif
@@ -700,7 +698,7 @@ void Player::enableMultitouch()
} else if (sDriver == "TRACKER") {
m_pMultitouchInputDevice = IInputDevicePtr(new TrackerInputDevice);
} else {
- AVG_TRACE(Logger::WARNING, "Valid values for AVG_MULTITOUCH_DRIVER are WIN7TOUCH, XINPUT, LINUXMTDEV, TRACKER, TUIO and APPLETRACKPAD.");
+ AVG_LOG_WARNING("Valid values for AVG_MULTITOUCH_DRIVER are WIN7TOUCH, XINPUT, LINUXMTDEV, TRACKER, TUIO and APPLETRACKPAD.");
throw Exception(AVG_ERR_UNSUPPORTED, string("Unsupported multitouch driver '")+
sDriver +"'.");
}
@@ -715,6 +713,15 @@ void Player::enableMultitouch()
addInputDevice(m_pMultitouchInputDevice);
}
+void Player::enableMouse(bool enabled)
+{
+ m_bMouseEnabled = enabled;
+
+ if (m_pEventDispatcher) {
+ m_pEventDispatcher->enableMouse(enabled);
+ }
+}
+
bool Player::isMultitouchAvailable() const
{
if (m_bIsPlaying) {
@@ -729,15 +736,17 @@ void Player::setEventCapture(NodePtr pNode, int cursorID=MOUSECURSORID)
{
std::map<int, EventCaptureInfoPtr>::iterator it =
m_EventCaptureInfoMap.find(cursorID);
- if (it != m_EventCaptureInfoMap.end() && !(it->second->m_pNode.expired())) {
+ if (it != m_EventCaptureInfoMap.end()) {
EventCaptureInfoPtr pCaptureInfo = it->second;
- NodePtr pOldNode = pCaptureInfo->m_pNode.lock();
- if (pOldNode == pNode) {
- pCaptureInfo->m_CaptureCount++;
- } else {
- throw Exception(AVG_ERR_INVALID_CAPTURE, "setEventCapture called for '"
- + pNode->getID() + "', but cursor already captured by '"
- + pOldNode->getID() + "'.");
+ NodePtr pOldNode = pCaptureInfo->m_pNode;
+ if (pOldNode->getState() != Node::NS_UNCONNECTED) {
+ if (pOldNode == pNode) {
+ pCaptureInfo->m_CaptureCount++;
+ } else {
+ throw Exception(AVG_ERR_INVALID_CAPTURE, "setEventCapture called for '"
+ + pNode->getID() + "', but cursor already captured by '"
+ + pOldNode->getID() + "'.");
+ }
}
} else {
m_EventCaptureInfoMap[cursorID] = EventCaptureInfoPtr(
@@ -749,7 +758,9 @@ void Player::releaseEventCapture(int cursorID)
{
std::map<int, EventCaptureInfoPtr>::iterator it =
m_EventCaptureInfoMap.find(cursorID);
- if (it == m_EventCaptureInfoMap.end() || (it->second->m_pNode.expired()) ) {
+ if (it == m_EventCaptureInfoMap.end() ||
+ (it->second->m_pNode->getState() == Node::NS_UNCONNECTED))
+ {
throw Exception(AVG_ERR_INVALID_CAPTURE,
"releaseEventCapture called, but cursor not captured.");
} else {
@@ -767,38 +778,40 @@ bool Player::isCaptured(int cursorID)
return (it != m_EventCaptureInfoMap.end());
}
-int Player::setInterval(int time, PyObject * pyfunc)
+void Player::removeDeadEventCaptures()
{
- Timeout* pTimeout = new Timeout(time, pyfunc, true, getFrameTime());
- if (m_bInHandleTimers) {
- m_NewTimeouts.push_back(pTimeout);
- } else {
- addTimeout(pTimeout);
+ std::map<int, EventCaptureInfoPtr>::iterator it;
+ for (it = m_EventCaptureInfoMap.begin(); it != m_EventCaptureInfoMap.end();) {
+ std::map<int, EventCaptureInfoPtr>::iterator lastIt = it;
+ it++;
+ if (lastIt->second->m_pNode->getState() == Node::NS_UNCONNECTED) {
+ m_EventCaptureInfoMap.erase(lastIt);
+ }
}
- return pTimeout->GetID();
+}
+
+int Player::setInterval(int time, PyObject * pyfunc)
+{
+ return internalSetTimeout(time, pyfunc, true);
}
int Player::setTimeout(int time, PyObject * pyfunc)
{
- Timeout* pTimeout = new Timeout(time, pyfunc, false, getFrameTime());
- if (m_bInHandleTimers) {
- m_NewTimeouts.push_back(pTimeout);
- } else {
- addTimeout(pTimeout);
- }
- return pTimeout->GetID();
+ return internalSetTimeout(time, pyfunc, false);
}
int Player::setOnFrameHandler(PyObject * pyfunc)
{
- return setInterval(0, pyfunc);
+ avgDeprecationWarning("1.8", "Player.setOnFrameHandler",
+ "Player.subscribe(Player.ON_FRAME)");
+ return internalSetTimeout(0, pyfunc, true);
}
bool Player::clearInterval(int id)
{
vector<Timeout*>::iterator it;
for (it = m_PendingTimeouts.begin(); it != m_PendingTimeouts.end(); it++) {
- if (id == (*it)->GetID()) {
+ if (id == (*it)->getID()) {
if (it == m_PendingTimeouts.begin() && m_bInHandleTimers) {
m_bCurrentTimeoutDeleted = true;
}
@@ -808,7 +821,7 @@ bool Player::clearInterval(int id)
}
}
for (it = m_NewTimeouts.begin(); it != m_NewTimeouts.end(); it++) {
- if (id == (*it)->GetID()) {
+ if (id == (*it)->getID()) {
delete *it;
m_NewTimeouts.erase(it);
return true;
@@ -817,11 +830,26 @@ bool Player::clearInterval(int id)
return false;
}
+void Player::callFromThread(PyObject * pyfunc)
+{
+ lock_guard lock(m_AsyncCallMutex);
+ Timeout* pTimeout = new Timeout(0, pyfunc, false, getFrameTime());
+ m_AsyncCalls.push_back(pTimeout);
+}
+
MouseEventPtr Player::getMouseState() const
{
return m_pLastMouseEvent;
}
+EventPtr Player::getCurrentEvent() const
+{
+ if (!m_pCurrentEvent) {
+ throw Exception(AVG_ERR_UNSUPPORTED, "No current event.");
+ }
+ return m_pCurrentEvent;
+}
+
void Player::setMousePos(const IntPoint& pos)
{
m_pDisplayEngine->setMousePos(pos);
@@ -838,6 +866,11 @@ BitmapPtr Player::screenshot()
throw Exception(AVG_ERR_UNSUPPORTED,
"Must call Player.play() before screenshot().");
}
+ if (GLContext::getMain()->isGLES()) {
+ // Some GLES implementations invalidate the buffer after eglSwapBuffers.
+ // The only way we can get at the contents at this point is to rerender them.
+ m_pMainCanvas->render(m_pDisplayEngine->getWindowSize(), false);
+ }
return m_pDisplayEngine->screenshot();
}
@@ -849,6 +882,11 @@ void Player::showCursor(bool bShow)
m_DP.m_bShowCursor = bShow;
}
+bool Player::isCursorShown()
+{
+ return m_DP.m_bShowCursor;
+}
+
void Player::setCursor(const Bitmap* pBmp, IntPoint hotSpot)
{
IntPoint size = pBmp->getSize();
@@ -924,14 +962,26 @@ std::string Player::getRootMediaDir()
return sMediaDir;
}
-const NodeDefinition& Player::getNodeDef(const std::string& sType)
+void Player::disablePython()
{
- return m_NodeRegistry.getNodeDef(sType);
+ m_bPythonAvailable = false;
}
-void Player::disablePython()
+void Player::startTraversingTree()
{
- m_bPythonAvailable = false;
+ AVG_ASSERT(!m_bIsTraversingTree);
+ m_bIsTraversingTree = true;
+}
+
+void Player::endTraversingTree()
+{
+ AVG_ASSERT(m_bIsTraversingTree);
+ m_bIsTraversingTree = false;
+}
+
+bool Player::isTraversingTree() const
+{
+ return m_bIsTraversingTree;
}
void Player::registerFrameEndListener(IFrameEndListener* pListener)
@@ -976,21 +1026,15 @@ void Player::unregisterPreRenderListener(IPreRenderListener* pListener)
bool Player::handleEvent(EventPtr pEvent)
{
AVG_ASSERT(pEvent);
-
- PyObject * pEventHook = getEventHook();
- if (pEventHook != Py_None) {
- // If the catchall returns true, stop processing the event
- if (boost::python::call<bool>(pEventHook, pEvent)) {
- return true;
- }
- }
+ EventPtr pLastEvent = m_pCurrentEvent;
+ m_pCurrentEvent = pEvent;
if (MouseEventPtr pMouseEvent = boost::dynamic_pointer_cast<MouseEvent>(pEvent)) {
m_pLastMouseEvent = pMouseEvent;
}
if (CursorEventPtr pCursorEvent = boost::dynamic_pointer_cast<CursorEvent>(pEvent)) {
- if (pEvent->getType() == Event::CURSOROUT ||
- pEvent->getType() == Event::CURSOROVER)
+ if (pEvent->getType() == Event::CURSOR_OUT ||
+ pEvent->getType() == Event::CURSOR_OVER)
{
pEvent->trace();
pCursorEvent->getNode()->handleEvent(pEvent);
@@ -1001,8 +1045,18 @@ bool Player::handleEvent(EventPtr pEvent)
else if (KeyEventPtr pKeyEvent = boost::dynamic_pointer_cast<KeyEvent>(pEvent))
{
pEvent->trace();
+ switch (pEvent->getType()) {
+ case Event::KEY_DOWN:
+ notifySubscribers("KEY_DOWN", pEvent);
+ break;
+ case Event::KEY_UP:
+ notifySubscribers("KEY_UP", pEvent);
+ break;
+ default:
+ AVG_ASSERT(false);
+ }
getRootNode()->handleEvent(pKeyEvent);
- if (getStopOnEscape() && pEvent->getType() == Event::KEYDOWN
+ if (getStopOnEscape() && pEvent->getType() == Event::KEY_DOWN
&& pKeyEvent->getKeyCode() == avg::key::KEY_ESCAPE)
{
stop();
@@ -1017,20 +1071,23 @@ bool Player::handleEvent(EventPtr pEvent)
stop();
}
}
+ m_pCurrentEvent = pLastEvent;
return true;
}
static ProfilingZoneID MainProfilingZone("Player - Total frame time");
static ProfilingZoneID TimersProfilingZone("Player - handleTimers");
static ProfilingZoneID EventsProfilingZone("Dispatch events");
+static ProfilingZoneID MainCanvasProfilingZone("Main canvas rendering");
+static ProfilingZoneID OffscreenProfilingZone("Offscreen rendering");
void Player::doFrame(bool bFirstFrame)
{
{
ScopeTimer Timer(MainProfilingZone);
if (!bFirstFrame) {
+ m_NumFrames++;
if (m_bFakeFPS) {
- m_NumFrames++;
m_FrameTime = (long long)((m_NumFrames*1000.0)/m_FakeFPS);
} else {
m_FrameTime = m_pDisplayEngine->getDisplayTime();
@@ -1043,12 +1100,18 @@ void Player::doFrame(bool bFirstFrame)
ScopeTimer Timer(EventsProfilingZone);
m_pEventDispatcher->dispatch();
sendFakeEvents();
+ removeDeadEventCaptures();
}
}
for (unsigned i = 0; i < m_pCanvases.size(); ++i) {
+ ScopeTimer Timer(OffscreenProfilingZone);
dispatchOffscreenRendering(m_pCanvases[i].get());
}
- m_pMainCanvas->doFrame(m_bPythonAvailable);
+ {
+ ScopeTimer Timer(MainCanvasProfilingZone);
+ m_pMainCanvas->doFrame(m_bPythonAvailable);
+ }
+ GLContext::mandatoryCheckError("End of frame");
if (m_bPythonAvailable) {
Py_BEGIN_ALLOW_THREADS;
try {
@@ -1062,11 +1125,10 @@ void Player::doFrame(bool bFirstFrame)
endFrame();
}
}
- if (m_pDisplayEngine->wasFrameLate()) {
- ThreadProfiler::get()->dumpFrame();
- }
-
ThreadProfiler::get()->reset();
+ if (m_NumFrames == 5) {
+ ThreadProfiler::get()->restart();
+ }
}
void Player::endFrame()
@@ -1076,7 +1138,7 @@ void Player::endFrame()
m_pDisplayEngine->checkJitter();
}
-double Player::getFramerate()
+float Player::getFramerate()
{
if (!m_pDisplayEngine) {
return m_DP.m_Framerate;
@@ -1084,32 +1146,37 @@ double Player::getFramerate()
return m_pDisplayEngine->getFramerate();
}
-double Player::getVideoRefreshRate()
+float Player::getVideoRefreshRate()
+{
+ return Display::get()->getRefreshRate();
+}
+
+size_t Player::getVideoMemInstalled()
{
if (!m_pDisplayEngine) {
- return 0;
+ throw Exception(AVG_ERR_UNSUPPORTED,
+ "Player.getVideoMemInstalled must be called after Player.play().");
}
- return m_pDisplayEngine->getRefreshRate();
+ return GLContext::getMain()->getVideoMemInstalled();
}
-bool Player::isUsingShaders()
+size_t Player::getVideoMemUsed()
{
if (!m_pDisplayEngine) {
throw Exception(AVG_ERR_UNSUPPORTED,
- "Player.isUsingShaders must be called after Player.play().");
+ "Player.getVideoMemUsed must be called after Player.play().");
}
- return GLContext::getCurrent()->isUsingShaders();
+ return GLContext::getMain()->getVideoMemUsed();
}
-void Player::setGamma(double red, double green, double blue)
+void Player::setGamma(float red, float green, float blue)
{
if (m_pDisplayEngine) {
m_pDisplayEngine->setGamma(red, green, blue);
- } else {
- m_DP.m_Gamma[0] = red;
- m_DP.m_Gamma[1] = green;
- m_DP.m_Gamma[2] = blue;
}
+ m_DP.m_Gamma[0] = red;
+ m_DP.m_Gamma[1] = green;
+ m_DP.m_Gamma[2] = blue;
}
void Player::initConfig()
@@ -1119,8 +1186,7 @@ void Player::initConfig()
m_DP.m_BPP = atoi(pMgr->getOption("scr", "bpp")->c_str());
if (m_DP.m_BPP != 15 && m_DP.m_BPP != 16 && m_DP.m_BPP != 24 && m_DP.m_BPP != 32) {
- AVG_TRACE(Logger::ERROR,
- "BPP must be 15, 16, 24 or 32. Current value is "
+ AVG_LOG_ERROR("BPP must be 15, 16, 24 or 32. Current value is "
<< m_DP.m_BPP << ". Aborting." );
exit(-1);
}
@@ -1128,17 +1194,14 @@ void Player::initConfig()
m_DP.m_WindowSize.x = atoi(pMgr->getOption("scr", "windowwidth")->c_str());
m_DP.m_WindowSize.y = atoi(pMgr->getOption("scr", "windowheight")->c_str());
- m_DP.m_DotsPerMM = atof(pMgr->getOption("scr", "dotspermm")->c_str());
if (m_DP.m_bFullscreen && (m_DP.m_WindowSize != IntPoint(0, 0))) {
- AVG_TRACE(Logger::ERROR,
- "Can't set fullscreen and window size at once. Aborting.");
+ AVG_LOG_ERROR("Can't set fullscreen and window size at once. Aborting.");
exit(-1);
}
if (m_DP.m_WindowSize.x != 0 && m_DP.m_WindowSize.y != 0) {
- AVG_TRACE(Logger::ERROR, "Can't set window width and height at once");
- AVG_TRACE(Logger::ERROR,
- "(aspect ratio is determined by avg file). Aborting.");
+ AVG_LOG_ERROR("Can't set window width and height at once");
+ AVG_LOG_ERROR("(aspect ratio is determined by avg file). Aborting.");
exit(-1);
}
@@ -1147,90 +1210,111 @@ void Player::initConfig()
m_AP.m_OutputBufferSamples =
atoi(pMgr->getOption("aud", "outputbuffersamples")->c_str());
+ m_GLConfig.m_bGLES = pMgr->getBoolOption("scr", "gles", false);
m_GLConfig.m_bUsePOTTextures = pMgr->getBoolOption("scr", "usepow2textures", false);
- m_GLConfig.m_bUseShaders = pMgr->getBoolOption("scr", "useshaders", true);
m_GLConfig.m_bUsePixelBuffers = pMgr->getBoolOption("scr", "usepixelbuffers", true);
- m_GLConfig.m_MultiSampleSamples = pMgr->getIntOption("scr", "multisamplesamples", 4);
+ int multiSampleSamples = pMgr->getIntOption("scr", "multisamplesamples", 8);
+ if (multiSampleSamples < 1) {
+ AVG_LOG_ERROR("multisamplesamples must be >= 1. Aborting")
+ exit(-1);
+ }
+ m_GLConfig.m_MultiSampleSamples = multiSampleSamples;
+
+ string sShaderUsage;
+ pMgr->getStringOption("scr", "shaderusage", "auto", sShaderUsage);
+ if (sShaderUsage == "full") {
+ m_GLConfig.m_ShaderUsage = GLConfig::FULL;
+ } else if (sShaderUsage == "minimal") {
+ m_GLConfig.m_ShaderUsage = GLConfig::MINIMAL;
+ } else if (sShaderUsage == "auto") {
+ m_GLConfig.m_ShaderUsage = GLConfig::AUTO;
+ } else {
+ throw Exception(AVG_ERR_OUT_OF_RANGE,
+ "avgrc parameter shaderusage must be full, minimal, fragmentonly or auto");
+ }
+ string sDummy;
+ m_GLConfig.m_bUseDebugContext = getEnv("AVG_USE_DEBUG_GL_CONTEXT", sDummy);
+#ifdef AVG_ENABLE_EGL
+ m_GLConfig.m_bGLES = true;
+#endif
+ BitmapLoader::init(!m_GLConfig.m_bGLES);
+
pMgr->getGammaOption("scr", "gamma", m_DP.m_Gamma);
}
-void Player::initGraphics()
+void Player::initGraphics(const string& sShaderPath)
{
+ if (!Display::isInitialized()) {
+ ConfigMgr* pMgr = ConfigMgr::get();
+ float dotsPerMM = float(atof(pMgr->getOption("scr", "dotspermm")->c_str()));
+ Display::get()->assumePixelsPerMM(dotsPerMM);
+ }
// Init display configuration.
- AVG_TRACE(Logger::CONFIG, "Display bpp: " << m_DP.m_BPP);
+ AVG_TRACE(Logger::category::CONFIG, Logger::severity::INFO,
+ "Display bpp: " << m_DP.m_BPP);
+
+ if (m_bDisplayEngineBroken) {
+ m_bDisplayEngineBroken = false;
+ m_pDisplayEngine->teardown();
+ m_pDisplayEngine = SDLDisplayEnginePtr();
+ }
if (!m_pDisplayEngine) {
m_pDisplayEngine = SDLDisplayEnginePtr(new SDLDisplayEngine());
}
- AVG_TRACE(Logger::CONFIG, "Requested OpenGL configuration: ");
+ AVG_TRACE(Logger::category::CONFIG, Logger::severity::INFO,
+ "Requested OpenGL configuration: ");
m_GLConfig.log();
- m_pDisplayEngine->init(m_DP, m_GLConfig);
+ m_DP.m_WindowSize = m_pDisplayEngine->calcWindowSize(m_DP);
+ if (m_pDisplayEngine->getWindowSize() != m_DP.m_WindowSize ||
+ m_pDisplayEngine->isFullscreen() == true)
+ {
+ m_pDisplayEngine->teardown();
+ m_pDisplayEngine->init(m_DP, m_GLConfig);
+ }
+ AVG_TRACE(Logger::category::CONFIG, Logger::severity::INFO,
+ "Pixels per mm: " << Display::get()->getPixelsPerMM());
+ if (sShaderPath != "") {
+ ShaderRegistry::get()->setShaderPath(sShaderPath);
+ }
+ m_pDisplayEngine->setGamma(1.0, 1.0, 1.0);
+ m_GLConfig = GLContext::getCurrent()->getConfig();
}
void Player::initAudio()
{
- SDLAudioEngine* pAudioEngine = SDLAudioEngine::get();
+ AudioEngine* pAudioEngine = AudioEngine::get();
if (!pAudioEngine) {
- pAudioEngine = new SDLAudioEngine();
+ pAudioEngine = new AudioEngine();
}
pAudioEngine->init(m_AP, m_Volume);
pAudioEngine->setAudioEnabled(!m_bFakeFPS);
pAudioEngine->play();
}
-void Player::updateDTD()
+void Player::initMainCanvas(NodePtr pRootNode)
{
- if (m_dtd) {
- xmlFreeDtd(m_dtd);
- }
- // Find and parse dtd.
- registerDTDEntityLoader("avg.dtd", m_NodeRegistry.getDTD().c_str());
- string sDTDFName = "avg.dtd";
- m_dtd = xmlParseDTD(NULL, (const xmlChar*) sDTDFName.c_str());
- assert (m_dtd);
- m_bDirtyDTD = false;
+ m_pEventDispatcher = EventDispatcherPtr(new EventDispatcher(this, m_bMouseEnabled));
+ m_pMainCanvas = MainCanvasPtr(new MainCanvas(this));
+ m_pMainCanvas->setRoot(pRootNode);
+ m_DP.m_Size = m_pMainCanvas->getSize();
+
+ registerFrameEndListener(BitmapManager::get());
}
-NodePtr Player::internalLoad(const string& sAVG)
+NodePtr Player::internalLoad(const string& sAVG, const string& sFilename)
{
- xmlDocPtr doc = 0;
- try {
- xmlPedanticParserDefault(1);
- xmlDoValidityCheckingDefaultValue=0;
-
- doc = xmlParseMemory(sAVG.c_str(), sAVG.length());
- if (!doc) {
- throw (Exception(AVG_ERR_XML_PARSE, ""));
- }
-
- if (m_bDirtyDTD) {
- updateDTD();
- }
-
- xmlValidCtxtPtr cvp = xmlNewValidCtxt();
- cvp->error = xmlParserValidityError;
- cvp->warning = xmlParserValidityWarning;
- int valid=xmlValidateDtd(cvp, doc, m_dtd);
- xmlFreeValidCtxt(cvp);
- if (!valid) {
- throw (Exception(AVG_ERR_XML_VALID, ""));
- }
- xmlNodePtr xmlNode = xmlDocGetRootElement(doc);
- NodePtr pNode = createNodeFromXml(doc, xmlNode);
- if (!pNode) {
- throw (Exception(AVG_ERR_XML_PARSE,
- "Root node of an avg tree needs to be an <avg> node."));
- }
- xmlFreeDoc(doc);
- return pNode;
- } catch (Exception& ex) {
- AVG_TRACE(Logger::ERROR, ex.getStr());
- if (doc) {
- xmlFreeDoc(doc);
- }
- throw;
+ XMLParser parser;
+ parser.setDTD(TypeRegistry::get()->getDTD(), "avg.dtd");
+ parser.parse(sAVG, sFilename);
+ xmlNodePtr xmlNode = parser.getRootNode();
+ NodePtr pNode = createNodeFromXml(parser.getDoc(), xmlNode);
+ if (!pNode) {
+ throw (Exception(AVG_ERR_XML_PARSE,
+ "Root node of an avg tree needs to be an <avg> node."));
}
+ return pNode;
}
SDLDisplayEnginePtr Player::safeGetDisplayEngine()
@@ -1242,41 +1326,38 @@ SDLDisplayEnginePtr Player::safeGetDisplayEngine()
}
-void Player::registerNodeType(NodeDefinition def, const char* pParentNames[])
-{
- m_NodeRegistry.registerNodeType(def);
-
- if (pParentNames) {
- string sChildArray[1];
- sChildArray[0] = def.getName();
- vector<string> sChildren = vectorFromCArray(1, sChildArray);
- const char **ppCurParentName = pParentNames;
-
- while (*ppCurParentName) {
- NodeDefinition nodeDefinition = m_NodeRegistry.getNodeDef(*ppCurParentName);
- nodeDefinition.addChildren(sChildren);
- m_NodeRegistry.updateNodeDefinition(nodeDefinition);
-
- ++ppCurParentName;
- }
- }
- m_bDirtyDTD = true;
-}
-
-NodePtr Player::createNode(const string& sType, const boost::python::dict& params)
+NodePtr Player::createNode(const string& sType,
+ const py::dict& params, const boost::python::object& self)
{
DivNodePtr pParentNode;
- boost::python::dict attrs = params;
- boost::python::object parent;
+ py::dict attrs = params;
+ py::object parent;
if (params.has_key("parent")) {
parent = params["parent"];
attrs.attr("__delitem__")("parent");
- pParentNode = boost::python::extract<DivNodePtr>(parent);
- }
- NodePtr pNode = m_NodeRegistry.createNode(sType, attrs);
- if (pParentNode) {
- pParentNode->appendChild(pNode);
- }
+ pParentNode = py::extract<DivNodePtr>(parent);
+ }
+ NodePtr pNode = dynamic_pointer_cast<Node>(
+ TypeRegistry::get()->createObject(sType, attrs));
+
+ // See if the class names of self and pNode match. If they don't, there is a
+ // python derived class that's being constructed and we can't set parent here.
+ string sSelfClassName = py::extract<string>(
+ self.attr("__class__").attr("__name__"));
+ py::object pythonClassName =
+ (py::object(pNode).attr("__class__").attr("__name__"));
+ string sThisClassName = py::extract<string>(pythonClassName);
+ bool bHasDerivedClass = sSelfClassName != sThisClassName &&
+ sSelfClassName != "NoneType";
+ if (bHasDerivedClass) {
+ if (pParentNode) {
+ throw Exception(AVG_ERR_UNSUPPORTED,
+ "Can't pass 'parent' parameter to C++ class constructor if there is a derived python class. Use Node.registerInstance() instead.");
+ }
+ pNode->registerInstance(self.ptr(), pParentNode);
+ } else {
+ pNode->registerInstance(0, pParentNode);
+ }
if (parent) {
attrs["parent"] = parent;
}
@@ -1288,43 +1369,29 @@ NodePtr Player::createNodeFromXmlString(const string& sXML)
xmlPedanticParserDefault(1);
xmlDoValidityCheckingDefaultValue =0;
- xmlDocPtr doc;
- doc = xmlParseMemory(sXML.c_str(), int(sXML.length()));
- if (!doc) {
- throw (Exception(AVG_ERR_XML_PARSE,
- string("Error parsing xml:\n ")+sXML));
- }
- NodePtr pNode = createNodeFromXml(doc, xmlDocGetRootElement(doc));
-
- if (m_bDirtyDTD)
- updateDTD();
+ XMLParser parser;
+ parser.setDTD(TypeRegistry::get()->getDTD(), "avg.dtd");
+ parser.parse(sXML, "");
- xmlValidCtxtPtr cvp = xmlNewValidCtxt();
- cvp->error = xmlParserValidityError;
- cvp->warning = xmlParserValidityWarning;
- int valid=xmlValidateDtd(cvp, doc, m_dtd);
- xmlFreeValidCtxt(cvp);
- if (!valid) {
- throw (Exception(AVG_ERR_XML_PARSE,
- "Could not validate '"+sXML+"'"));
- }
+// cvp->error = xmlParserValidityError;
+// cvp->warning = xmlParserValidityWarning;
+ xmlNodePtr xmlNode = parser.getRootNode();
+ NodePtr pNode = createNodeFromXml(parser.getDoc(), xmlNode);
- xmlFreeDoc(doc);
return pNode;
}
NodePtr Player::createNodeFromXml(const xmlDocPtr xmlDoc,
const xmlNodePtr xmlNode)
{
- NodePtr pCurNode;
const char * nodeType = (const char *)xmlNode->name;
- if (!strcmp (nodeType, "text") ||
- !strcmp (nodeType, "comment")) {
+ if (!strcmp (nodeType, "text") || !strcmp (nodeType, "comment")) {
// Ignore whitespace & comments
return NodePtr();
}
- pCurNode = m_NodeRegistry.createNode(nodeType, xmlNode);
+ NodePtr pCurNode = dynamic_pointer_cast<Node>(
+ TypeRegistry::get()->createObject(nodeType, xmlNode));
if (!strcmp(nodeType, "words")) {
// TODO: This is an end-run around the generic serialization mechanism
// that will probably break at some point.
@@ -1399,16 +1466,16 @@ void Player::sendOver(const CursorEventPtr pOtherEvent, Event::Type type,
void Player::handleCursorEvent(CursorEventPtr pEvent, bool bOnlyCheckCursorOver)
{
// Find all nodes under the cursor.
- vector<NodeWeakPtr> pCursorNodes;
+ vector<NodePtr> pCursorNodes;
DivNodePtr pEventReceiverNode = pEvent->getInputDevice()->getEventReceiverNode();
if (!pEventReceiverNode) {
pEventReceiverNode = getRootNode();
}
pEventReceiverNode->getElementsByPos(pEvent->getPos(), pCursorNodes);
ContactPtr pContact = pEvent->getContact();
- if (pContact && pContact->hasListeners() && !bOnlyCheckCursorOver) {
+ if (pContact && !bOnlyCheckCursorOver) {
if (!pCursorNodes.empty()) {
- NodePtr pNode = pCursorNodes.begin()->lock();
+ NodePtr pNode = *(pCursorNodes.begin());
pEvent->setNode(pNode);
}
pContact->sendEventToListeners(pEvent);
@@ -1417,7 +1484,7 @@ void Player::handleCursorEvent(CursorEventPtr pEvent, bool bOnlyCheckCursorOver)
int cursorID = pEvent->getCursorID();
// Determine the nodes the event should be sent to.
- vector<NodeWeakPtr> pDestNodes = pCursorNodes;
+ vector<NodePtr> pDestNodes = pCursorNodes;
if (m_EventCaptureInfoMap.find(cursorID) != m_EventCaptureInfoMap.end()) {
NodeWeakPtr pEventCaptureNode =
m_EventCaptureInfoMap[cursorID]->m_pNode;
@@ -1428,7 +1495,7 @@ void Player::handleCursorEvent(CursorEventPtr pEvent, bool bOnlyCheckCursorOver)
}
}
- vector<NodeWeakPtr> pLastCursorNodes;
+ vector<NodePtr> pLastCursorNodes;
{
map<int, CursorStatePtr>::iterator it;
it = m_pLastCursorStates.find(cursorID);
@@ -1438,50 +1505,48 @@ void Player::handleCursorEvent(CursorEventPtr pEvent, bool bOnlyCheckCursorOver)
}
// Send out events.
- vector<NodeWeakPtr>::const_iterator itLast;
- vector<NodeWeakPtr>::iterator itCur;
+ vector<NodePtr>::const_iterator itLast;
+ vector<NodePtr>::iterator itCur;
for (itLast = pLastCursorNodes.begin(); itLast != pLastCursorNodes.end();
++itLast)
{
- NodePtr pLastNode = itLast->lock();
+ NodePtr pLastNode = *itLast;
for (itCur = pCursorNodes.begin(); itCur != pCursorNodes.end(); ++itCur) {
- if (itCur->lock() == pLastNode) {
+ if (*itCur == pLastNode) {
break;
}
}
if (itCur == pCursorNodes.end()) {
- sendOver(pEvent, Event::CURSOROUT, pLastNode);
+ sendOver(pEvent, Event::CURSOR_OUT, pLastNode);
}
}
// Send over events.
for (itCur = pCursorNodes.begin(); itCur != pCursorNodes.end(); ++itCur) {
- NodePtr pCurNode = itCur->lock();
+ NodePtr pCurNode = *itCur;
for (itLast = pLastCursorNodes.begin(); itLast != pLastCursorNodes.end();
++itLast)
{
- if (itLast->lock() == pCurNode) {
+ if (*itLast == pCurNode) {
break;
}
}
if (itLast == pLastCursorNodes.end()) {
- sendOver(pEvent, Event::CURSOROVER, pCurNode);
+ sendOver(pEvent, Event::CURSOR_OVER, pCurNode);
}
}
if (!bOnlyCheckCursorOver) {
// Iterate through the nodes and send the event to all of them.
- vector<NodeWeakPtr>::iterator it;
+ vector<NodePtr>::iterator it;
for (it = pDestNodes.begin(); it != pDestNodes.end(); ++it) {
- NodePtr pNode = (*it).lock();
- if (pNode) {
- CursorEventPtr pNodeEvent = boost::dynamic_pointer_cast<CursorEvent>(
- pEvent->cloneAs(pEvent->getType()));
- pNodeEvent->setNode(pNode);
- if (pNodeEvent->getType() != Event::CURSORMOTION) {
- pNodeEvent->trace();
+ NodePtr pNode = *it;
+ if (pNode->getState() != Node::NS_UNCONNECTED) {
+ pEvent->setNode(pNode);
+ if (pEvent->getType() != Event::CURSOR_MOTION) {
+ pEvent->trace();
}
- if (pNode->handleEvent(pNodeEvent) == true) {
+ if (pNode->handleEvent(pEvent) == true) {
// stop bubbling
break;
}
@@ -1489,12 +1554,12 @@ void Player::handleCursorEvent(CursorEventPtr pEvent, bool bOnlyCheckCursorOver)
}
}
- if (pEvent->getType() == Event::CURSORUP && pEvent->getSource() != Event::MOUSE) {
+ if (pEvent->getType() == Event::CURSOR_UP && pEvent->getSource() != Event::MOUSE) {
// Cursor has disappeared: send out events.
- vector<NodeWeakPtr>::iterator it;
+ vector<NodePtr>::iterator it;
for (it = pCursorNodes.begin(); it != pCursorNodes.end(); ++it) {
- NodePtr pNode = it->lock();
- sendOver(pEvent, Event::CURSOROUT, pNode);
+ NodePtr pNode = *it;
+ sendOver(pEvent, Event::CURSOR_OUT, pNode);
}
m_pLastCursorStates.erase(cursorID);
} else {
@@ -1539,14 +1604,14 @@ void Player::handleTimers()
m_bInHandleTimers = true;
it = m_PendingTimeouts.begin();
- while (it != m_PendingTimeouts.end() && (*it)->IsReady(getFrameTime())
+ while (it != m_PendingTimeouts.end() && (*it)->isReady(getFrameTime())
&& !m_bStopping)
{
- (*it)->Fire(getFrameTime());
+ (*it)->fire(getFrameTime());
if (m_bCurrentTimeoutDeleted) {
it = m_PendingTimeouts.begin();
} else {
- if ((*it)->IsInterval()) {
+ if ((*it)->isInterval()) {
Timeout* pTempTimeout = *it;
it = m_PendingTimeouts.erase(it);
m_NewTimeouts.insert(m_NewTimeouts.begin(), pTempTimeout);
@@ -1561,8 +1626,25 @@ void Player::handleTimers()
addTimeout(*it);
}
m_NewTimeouts.clear();
+
+ notifySubscribers("ON_FRAME");
+
m_bInHandleTimers = false;
+ if (m_bPythonAvailable) {
+ std::vector<Timeout *> tempAsyncCalls;
+ Py_BEGIN_ALLOW_THREADS;
+ {
+ lock_guard lock(m_AsyncCallMutex);
+ tempAsyncCalls = m_AsyncCalls;
+ m_AsyncCalls.clear();
+ }
+ Py_END_ALLOW_THREADS;
+ for (it = tempAsyncCalls.begin(); it != tempAsyncCalls.end(); ++it) {
+ (*it)->fire(getFrameTime());
+ delete *it;
+ }
+ }
}
SDLDisplayEngine * Player::getDisplayEngine() const
@@ -1570,6 +1652,11 @@ SDLDisplayEngine * Player::getDisplayEngine() const
return m_pDisplayEngine.get();
}
+void Player::keepWindowOpen()
+{
+ m_bKeepWindowOpen = true;
+}
+
void Player::setStopOnEscape(bool bStop)
{
m_bStopOnEscape = bStop;
@@ -1580,19 +1667,44 @@ bool Player::getStopOnEscape() const
return m_bStopOnEscape;
}
-void Player::setVolume(double volume)
+void Player::setVolume(float volume)
{
m_Volume = volume;
- if (SDLAudioEngine::get()) {
- SDLAudioEngine::get()->setVolume(m_Volume);
+ if (AudioEngine::get()) {
+ AudioEngine::get()->setVolume(m_Volume);
}
}
-double Player::getVolume() const
+float Player::getVolume() const
{
return m_Volume;
}
+string Player::getConfigOption(const string& sSubsys, const string& sName) const
+{
+ const string* psValue = ConfigMgr::get()->getOption(sSubsys, sName);
+ if (!psValue) {
+ throw Exception(AVG_ERR_INVALID_ARGS, string("Unknown config option ") + sSubsys
+ + ":" + sName);
+ } else {
+ return *psValue;
+ }
+}
+
+bool Player::isUsingGLES() const
+{
+ return m_GLConfig.m_bGLES;
+}
+
+bool Player::areFullShadersSupported() const
+{
+ if (!m_bIsPlaying) {
+ throw Exception(AVG_ERR_UNSUPPORTED,
+ "Must call Player.play() before areFullShadersSupported().");
+ }
+ return (m_GLConfig.m_ShaderUsage == GLConfig::FULL);
+}
+
OffscreenCanvasPtr Player::getCanvasFromURL(const std::string& sURL)
{
if (sURL.substr(0, 7) != "canvas:") {
@@ -1609,7 +1721,7 @@ OffscreenCanvasPtr Player::getCanvasFromURL(const std::string& sURL)
string("Canvas with url '")+sURL+"' not found.");
}
-void Player::cleanup()
+void Player::cleanup(bool bIsAbort)
{
// Kill all timeouts.
vector<Timeout*>::iterator it;
@@ -1624,7 +1736,7 @@ void Player::cleanup()
if (m_pMainCanvas) {
unregisterFrameEndListener(BitmapManager::get());
delete BitmapManager::get();
- m_pMainCanvas->stopPlayback();
+ m_pMainCanvas->stopPlayback(bIsAbort);
m_pMainCanvas = MainCanvasPtr();
}
@@ -1632,46 +1744,53 @@ void Player::cleanup()
m_pMultitouchInputDevice = IInputDevicePtr();
}
for (unsigned i = 0; i < m_pCanvases.size(); ++i) {
- m_pCanvases[i]->stopPlayback();
+ m_pCanvases[i]->stopPlayback(bIsAbort);
}
m_pCanvases.clear();
if (m_pDisplayEngine) {
- m_pDisplayEngine->deinitRender();
- m_pDisplayEngine->teardown();
+ m_DP.m_WindowSize = IntPoint(0,0);
+ if (!m_bKeepWindowOpen) {
+ m_pDisplayEngine->deinitRender();
+ m_pDisplayEngine->teardown();
+ m_pDisplayEngine = SDLDisplayEnginePtr();
+ }
}
- if (SDLAudioEngine::get()) {
- SDLAudioEngine::get()->teardown();
+ if (AudioEngine::get()) {
+ AudioEngine::get()->teardown();
}
m_pEventDispatcher = EventDispatcherPtr();
- m_pLastMouseEvent = MouseEventPtr(new MouseEvent(Event::CURSORMOTION, false, false,
- false, IntPoint(-1, -1), MouseEvent::NO_BUTTON, DPoint(-1, -1), 0));
+ m_pLastMouseEvent = MouseEventPtr(new MouseEvent(Event::CURSOR_MOTION, false, false,
+ false, IntPoint(-1, -1), MouseEvent::NO_BUTTON, glm::vec2(-1, -1), 0));
m_FrameTime = 0;
m_bIsPlaying = false;
m_CurDirName = getCWD();
+
+ removeSubscribers();
}
-int Player::addTimeout(Timeout* pTimeout)
+int Player::internalSetTimeout(int time, PyObject * pyfunc, bool bIsInterval)
{
- vector<Timeout*>::iterator it = m_PendingTimeouts.begin();
- while (it != m_PendingTimeouts.end() && (**it)<*pTimeout) {
- it++;
+ Timeout* pTimeout = new Timeout(time, pyfunc, bIsInterval, getFrameTime());
+ if (m_bInHandleTimers) {
+ m_NewTimeouts.push_back(pTimeout);
+ } else {
+ addTimeout(pTimeout);
}
- m_PendingTimeouts.insert(it, pTimeout);
- return pTimeout->GetID();
+ return pTimeout->getID();
}
-void Player::removeTimeout(Timeout* pTimeout)
+int Player::addTimeout(Timeout* pTimeout)
{
- delete pTimeout;
vector<Timeout*>::iterator it = m_PendingTimeouts.begin();
- while (*it != pTimeout) {
+ while (it != m_PendingTimeouts.end() && (**it)<*pTimeout) {
it++;
}
- m_PendingTimeouts.erase(it);
+ m_PendingTimeouts.insert(it, pTimeout);
+ return pTimeout->getID();
}
void Player::setPluginPath(const string& newPath)
@@ -1684,7 +1803,7 @@ string Player::getPluginPath() const
return PluginManager::get().getSearchPath();
}
-boost::python::object Player::loadPlugin(const std::string& name)
+py::object Player::loadPlugin(const std::string& name)
{
return PluginManager::get().loadPlugin(name);
}
diff --git a/src/player/Player.h b/src/player/Player.h
index 8c8e786..32d0da5 100644
--- a/src/player/Player.h
+++ b/src/player/Player.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -23,8 +23,9 @@
#define _Player_H_
#include "../api.h"
+#include "Publisher.h"
#include "Timeout.h"
-#include "NodeRegistry.h"
+#include "TypeRegistry.h"
#include "DisplayParams.h"
#include "CursorState.h"
#include "TestHelper.h"
@@ -35,6 +36,7 @@
#include <libxml/parser.h>
#include <boost/shared_ptr.hpp>
+#include <boost/thread/thread.hpp>
#include <string>
#include <vector>
@@ -57,6 +59,7 @@ class EventDispatcher;
class MouseEvent;
class CursorEvent;
class SDLDisplayEngine;
+class Display;
typedef boost::shared_ptr<Node> NodePtr;
typedef boost::weak_ptr<Node> NodeWeakPtr;
@@ -68,8 +71,9 @@ typedef boost::shared_ptr<EventDispatcher> EventDispatcherPtr;
typedef boost::shared_ptr<MouseEvent> MouseEventPtr;
typedef boost::shared_ptr<CursorEvent> CursorEventPtr;
typedef boost::shared_ptr<SDLDisplayEngine> SDLDisplayEnginePtr;
+typedef boost::shared_ptr<Display> DisplayPtr;
-class AVG_API Player
+class AVG_API Player: public Publisher
{
public:
Player();
@@ -82,60 +86,66 @@ class AVG_API Player
bool isFullscreen();
void setWindowFrame(bool bHasWindowFrame);
void setWindowPos(int x=0, int y=0);
- void setOGLOptions(bool bUsePOTTextures, bool bUseShaders,
- bool bUsePixelBuffers, int multiSampleSamples);
+ void setWindowTitle(const std::string& sTitle);
+ void useGLES(bool bGLES);
+ void setOGLOptions(bool bUsePOTTextures, bool bUsePixelBuffers,
+ int multiSampleSamples, GLConfig::ShaderUsage shaderUsage,
+ bool bUseDebugContext);
void setMultiSampleSamples(int multiSampleSamples);
void setAudioOptions(int samplerate, int channels);
- DPoint getScreenResolution();
- double getPixelsPerMM();
- DPoint getPhysicalScreenDimensions();
- void assumePixelsPerMM(double ppmm);
+ void enableGLErrorChecks(bool bEnable);
+ glm::vec2 getScreenResolution();
+ float getPixelsPerMM();
+ glm::vec2 getPhysicalScreenDimensions();
+ void assumePixelsPerMM(float ppmm);
CanvasPtr loadFile(const std::string& sFilename);
CanvasPtr loadString(const std::string& sAVG);
OffscreenCanvasPtr loadCanvasFile(const std::string& sFilename);
OffscreenCanvasPtr loadCanvasString(const std::string& sAVG);
- CanvasPtr createMainCanvas(const boost::python::dict& params);
- OffscreenCanvasPtr createCanvas(const boost::python::dict& params);
+ CanvasPtr createMainCanvas(const py::dict& params);
+ OffscreenCanvasPtr createCanvas(const py::dict& params);
void deleteCanvas(const std::string& sID);
CanvasPtr getMainCanvas() const;
OffscreenCanvasPtr getCanvas(const std::string& sID) const;
- void newCanvasDependency(const OffscreenCanvasPtr pCanvas);
+ void newCanvasDependency();
void play();
void stop();
bool isStopping();
- void initPlayback();
- void cleanup();
+ void initPlayback(const std::string& sShaderPath = "");
+ void cleanup(bool bIsAbort);
bool isPlaying();
- void setFramerate(double rate);
+ void setFramerate(float rate);
void setVBlankFramerate(int rate);
- double getEffectiveFramerate();
+ float getEffectiveFramerate();
TestHelper * getTestHelper();
- void setFakeFPS(double fps);
+ void setFakeFPS(float fps);
long long getFrameTime();
- double getFrameDuration();
+ float getFrameDuration();
- void registerNodeType(NodeDefinition Def, const char* pParentNames[] = 0);
-
- NodePtr createNode(const std::string& sType, const boost::python::dict& PyDict);
+ NodePtr createNode(const std::string& sType, const py::dict& PyDict,
+ const py::object& self=py::object());
NodePtr createNodeFromXmlString(const std::string& sXML);
int setInterval(int time, PyObject * pyfunc);
int setTimeout(int time, PyObject * pyfunc);
int setOnFrameHandler(PyObject * pyfunc);
bool clearInterval(int id);
+ void callFromThread(PyObject * pyfunc);
void addInputDevice(IInputDevicePtr pSource);
MouseEventPtr getMouseState() const;
- TrackerInputDevice * addTracker();
+ EventPtr getCurrentEvent() const;
TrackerInputDevice * getTracker();
void enableMultitouch();
+ void enableMouse(bool enabled);
bool isMultitouchAvailable() const;
void setEventCapture(NodePtr pNode, int cursorID);
void releaseEventCapture(int cursorID);
bool isCaptured(int cursorID);
+ void removeDeadEventCaptures();
EventPtr getCurEvent() const;
void setMousePos(const IntPoint& pos);
int getKeyModifierState() const;
@@ -143,29 +153,38 @@ class AVG_API Player
BitmapPtr screenshot();
void setCursor(const Bitmap* pBmp, IntPoint hotSpot);
void showCursor(bool bShow);
+ bool isCursorShown();
NodePtr getElementByID(const std::string& id);
AVGNodePtr getRootNode();
void doFrame(bool bFirstFrame);
- double getFramerate();
- double getVideoRefreshRate();
- bool isUsingShaders();
- void setGamma(double red, double green, double blue);
+ float getFramerate();
+ float getVideoRefreshRate();
+ size_t getVideoMemInstalled();
+ size_t getVideoMemUsed();
+ void setGamma(float red, float green, float blue);
SDLDisplayEngine * getDisplayEngine() const;
+ void keepWindowOpen();
void setStopOnEscape(bool bStop);
bool getStopOnEscape() const;
- void setVolume(double volume);
- double getVolume() const;
+ void setVolume(float volume);
+ float getVolume() const;
+ std::string getConfigOption(const std::string& sSubsys, const std::string& sName)
+ const;
+ bool isUsingGLES() const;
+ bool areFullShadersSupported() const;
OffscreenCanvasPtr getCanvasFromURL(const std::string& sURL);
std::string getCurDirName();
std::string getRootMediaDir();
- const NodeDefinition& getNodeDef(const std::string& sType);
void disablePython();
+ void startTraversingTree();
+ void endTraversingTree();
+ bool isTraversingTree() const;
- boost::python::object loadPlugin(const std::string& name);
+ py::object loadPlugin(const std::string& name);
void setPluginPath(const std::string& newPath);
std::string getPluginPath() const;
@@ -183,14 +202,13 @@ class AVG_API Player
private:
void initConfig();
- void initGraphics();
+ void initGraphics(const std::string& sShaderPath);
void initAudio();
-
- void updateDTD();
+ void initMainCanvas(NodePtr pRootNode);
NodePtr loadMainNodeFromFile(const std::string& sFilename);
NodePtr loadMainNodeFromString(const std::string& sAVG);
- NodePtr internalLoad(const std::string& sAVG);
+ NodePtr internalLoad(const std::string& sAVG, const std::string& sFilename);
SDLDisplayEnginePtr safeGetDisplayEngine();
NodePtr createNodeFromXml(const xmlDocPtr xmlDoc,
@@ -210,42 +228,44 @@ class AVG_API Player
MainCanvasPtr m_pMainCanvas;
SDLDisplayEnginePtr m_pDisplayEngine;
+ bool m_bDisplayEngineBroken;
TestHelperPtr m_pTestHelper;
std::string m_CurDirName;
+ bool m_bIsTraversingTree;
bool m_bStopping;
- NodeRegistry m_NodeRegistry;
IInputDevicePtr m_pMultitouchInputDevice;
+ // Timeout handling
+ int internalSetTimeout(int time, PyObject * pyfunc, bool bIsInterval);
int addTimeout(Timeout* pTimeout);
- void removeTimeout(Timeout* pTimeout);
void handleTimers();
bool m_bInHandleTimers;
bool m_bCurrentTimeoutDeleted;
std::vector<Timeout *> m_PendingTimeouts;
std::vector<Timeout *> m_NewTimeouts; // Timeouts to be added this frame.
+ std::vector<Timeout *> m_AsyncCalls;
+ boost::mutex m_AsyncCallMutex;
// Configuration variables.
DisplayParams m_DP;
AudioParams m_AP;
GLConfig m_GLConfig;
+ bool m_bKeepWindowOpen;
bool m_bStopOnEscape;
bool m_bIsPlaying;
// Time calculation
bool m_bFakeFPS;
- double m_FakeFPS;
+ float m_FakeFPS;
long long m_FrameTime;
long long m_PlayStartTime;
long long m_NumFrames;
- double m_Volume;
-
- bool m_bDirtyDTD;
- xmlDtdPtr m_dtd;
+ float m_Volume;
bool m_bPythonAvailable;
@@ -258,7 +278,7 @@ class AVG_API Player
struct EventCaptureInfo {
EventCaptureInfo(const NodeWeakPtr& pNode);
- NodeWeakPtr m_pNode;
+ NodePtr m_pNode;
int m_CaptureCount;
};
typedef boost::shared_ptr<EventCaptureInfo> EventCaptureInfoPtr;
@@ -266,11 +286,13 @@ class AVG_API Player
std::map<int, EventCaptureInfoPtr> m_EventCaptureInfoMap;
MouseEventPtr m_pLastMouseEvent;
+ EventPtr m_pCurrentEvent;
// The indexes of this map are cursorids.
std::map<int, CursorStatePtr> m_pLastCursorStates;
PyObject * m_EventHookPyFunc;
+ bool m_bMouseEnabled;
};
}
diff --git a/src/player/PluginManager.cpp b/src/player/PluginManager.cpp
index a117a5b..57d33f0 100644
--- a/src/player/PluginManager.cpp
+++ b/src/player/PluginManager.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -23,8 +23,6 @@
#include "PluginManager.h"
-#include "NodeDefinition.h"
-
#include "../base/DlfcnWrapper.h"
#include "../base/FileHelper.h"
#include "../base/Logger.h"
@@ -58,8 +56,10 @@ PluginManager& PluginManager::get()
PluginManager::PluginManager()
{
- setSearchPath(string("."PATH_DELIMITER) + "./plugin"PATH_DELIMITER +
- getAvgLibPath() + "plugin");
+ setSearchPath(string("."PATH_DELIMITER) +
+ "./plugin"PATH_DELIMITER +
+ "./plugin/.libs"PATH_DELIMITER +
+ getPath(getAvgLibPath()) + "plugin");
}
void PluginManager::setSearchPath(const string& sNewPath)
@@ -73,7 +73,7 @@ string PluginManager::getSearchPath() const
return m_sCurrentSearchPath;
}
-boost::python::object PluginManager::loadPlugin(const std::string& sPluginName)
+py::object PluginManager::loadPlugin(const std::string& sPluginName)
{
// is it loaded aready?
PluginMap::iterator i = m_LoadedPlugins.find(sPluginName);
@@ -89,7 +89,7 @@ boost::python::object PluginManager::loadPlugin(const std::string& sPluginName)
++referenceCount;
m_LoadedPlugins[sPluginName] = make_pair(i->second.first, referenceCount);
}
- boost::python::object sysModule(boost::python::handle<>(PyImport_ImportModule("sys")));
+ py::object sysModule(py::handle<>(PyImport_ImportModule("sys")));
return sysModule.attr("modules")[sPluginName];
}
@@ -106,7 +106,7 @@ string PluginManager::locateSharedObject(const string& sFilename)
}
string sMessage = "Unable to locate plugin file '" + sFilename
+ "'. Was looking in " + m_sCurrentSearchPath;
- AVG_TRACE(Logger::PLUGIN, sMessage);
+ AVG_TRACE(Logger::category::PLUGIN, Logger::severity::INFO, sMessage);
throw PluginNotFound(sMessage);
}
@@ -145,7 +145,8 @@ void PluginManager::parsePath(const string& sPath)
m_PathComponents.push_back(sDirectory);
} while (!sRemaining.empty());
- AVG_TRACE(Logger::PLUGIN, "Plugin search path set to '" << sPath << "'");
+ AVG_TRACE(Logger::category::PLUGIN, Logger::severity::INFO,
+ "Plugin search path set to '" << sPath << "'");
}
void* PluginManager::internalLoadPlugin(const string& sFullpath)
@@ -153,7 +154,8 @@ void* PluginManager::internalLoadPlugin(const string& sFullpath)
void *handle = dlopen(sFullpath.c_str(), RTLD_LOCAL | RTLD_NOW);
if (!handle) {
string sMessage(dlerror());
- AVG_TRACE(Logger::PLUGIN, "Could not load plugin. dlopen failed with message '"
+ AVG_TRACE(Logger::category::PLUGIN, Logger::severity::ERROR,
+ "Could not load plugin. dlopen failed with message '"
<< sMessage << "'");
throw PluginCorrupted(sMessage);
}
@@ -163,7 +165,8 @@ void* PluginManager::internalLoadPlugin(const string& sFullpath)
dlclose(handle);
throw e;
}
- AVG_TRACE(Logger::PLUGIN, "Loaded plugin '" << sFullpath << "'");
+ AVG_TRACE(Logger::category::PLUGIN,Logger::severity::INFO,
+ "Loaded plugin '" << sFullpath << "'");
return handle;
}
@@ -176,7 +179,8 @@ void PluginManager::registerPlugin(void* handle)
if (registerPlugin) {
registerPlugin();
} else {
- AVG_TRACE(Logger::PLUGIN, "No plugin registration function detected");
+ AVG_TRACE(Logger::category::PLUGIN, Logger::severity::ERROR,
+ "No plugin registration function detected");
throw PluginCorrupted("No plugin registration function detected");
}
}
diff --git a/src/player/PluginManager.h b/src/player/PluginManager.h
index f46b8d7..37a5d23 100644
--- a/src/player/PluginManager.h
+++ b/src/player/PluginManager.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -52,7 +52,7 @@ public:
void setSearchPath(const std::string& aNewPath);
std::string getSearchPath() const;
- boost::python::object loadPlugin(const std::string& aPluginName);
+ py::object loadPlugin(const std::string& aPluginName);
private:
PluginManager();
diff --git a/src/player/PolyLineNode.cpp b/src/player/PolyLineNode.cpp
index 48f40f6..16899f7 100644
--- a/src/player/PolyLineNode.cpp
+++ b/src/player/PolyLineNode.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -21,7 +21,7 @@
#include "PolyLineNode.h"
-#include "NodeDefinition.h"
+#include "TypeDefinition.h"
#include "../graphics/VertexArray.h"
#include "../base/Exception.h"
@@ -33,17 +33,18 @@ using namespace std;
namespace avg {
-NodeDefinition PolyLineNode::createDefinition()
+void PolyLineNode::registerType()
{
- vector<DPoint> v;
- vector<double> vd;
- return NodeDefinition("polyline", Node::buildNode<PolyLineNode>)
- .extendDefinition(VectorNode::createDefinition())
+ vector<glm::vec2> v;
+ vector<float> vd;
+ TypeDefinition def = TypeDefinition("polyline", "vectornode",
+ ExportedObject::buildObject<PolyLineNode>)
.addArg(Arg<string>("linejoin", "bevel"))
- .addArg(Arg<vector<DPoint> >("pos", v, false, offsetof(PolyLineNode, m_Pts)))
- .addArg(Arg<vector<double> >("texcoords", vd, false,
+ .addArg(Arg<vector<glm::vec2> >("pos", v, false, offsetof(PolyLineNode, m_Pts)))
+ .addArg(Arg<vector<float> >("texcoords", vd, false,
offsetof(PolyLineNode, m_TexCoords)))
;
+ TypeRegistry::get()->registerType(def);
}
PolyLineNode::PolyLineNode(const ArgList& args)
@@ -62,20 +63,13 @@ PolyLineNode::~PolyLineNode()
{
}
-const vector<DPoint>& PolyLineNode::getPos() const
+const vector<glm::vec2>& PolyLineNode::getPos() const
{
return m_Pts;
}
-void PolyLineNode::setPos(const vector<DPoint>& pts)
+void PolyLineNode::setPos(const vector<glm::vec2>& pts)
{
- vector<DPoint>::const_iterator it;
- for (it = pts.begin(); it != pts.end(); ++it) {
- if (it->isNaN() || it->isInf()) {
- throw Exception(AVG_ERR_INVALID_ARGS,
- "polyline positions must not be nan or inf.");
- }
- }
m_Pts = pts;
m_TexCoords.clear();
m_EffTexCoords.clear();
@@ -83,12 +77,12 @@ void PolyLineNode::setPos(const vector<DPoint>& pts)
setDrawNeeded();
}
-const vector<double>& PolyLineNode::getTexCoords() const
+const vector<float>& PolyLineNode::getTexCoords() const
{
return m_TexCoords;
}
-void PolyLineNode::setTexCoords(const vector<double>& coords)
+void PolyLineNode::setTexCoords(const vector<float>& coords)
{
if (coords.size() > m_Pts.size()) {
throw(Exception(AVG_ERR_OUT_OF_RANGE,
@@ -110,7 +104,7 @@ void PolyLineNode::setLineJoin(const string& s)
setDrawNeeded();
}
-void PolyLineNode::calcVertexes(VertexArrayPtr& pVertexArray, Pixel32 color)
+void PolyLineNode::calcVertexes(const VertexDataPtr& pVertexData, Pixel32 color)
{
if (getNumDifferentPts(m_Pts) < 2) {
return;
@@ -118,7 +112,7 @@ void PolyLineNode::calcVertexes(VertexArrayPtr& pVertexArray, Pixel32 color)
if (m_EffTexCoords.empty()) {
calcEffPolyLineTexCoords(m_EffTexCoords, m_TexCoords, m_CumulDist);
}
- calcPolyLine(m_Pts, m_EffTexCoords, false, m_LineJoin, pVertexArray, color);
+ calcPolyLine(m_Pts, m_EffTexCoords, false, m_LineJoin, pVertexData, color);
}
}
diff --git a/src/player/PolyLineNode.h b/src/player/PolyLineNode.h
index 80b4255..41ee162 100644
--- a/src/player/PolyLineNode.h
+++ b/src/player/PolyLineNode.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -35,27 +35,27 @@ namespace avg {
class AVG_API PolyLineNode : public VectorNode
{
public:
- static NodeDefinition createDefinition();
+ static void registerType();
PolyLineNode(const ArgList& args);
virtual ~PolyLineNode();
- const std::vector<DPoint>& getPos() const;
- void setPos(const std::vector<DPoint>& pts);
+ const std::vector<glm::vec2>& getPos() const;
+ void setPos(const std::vector<glm::vec2>& pts);
- const std::vector<double>& getTexCoords() const;
- void setTexCoords(const std::vector<double>& coords);
+ const std::vector<float>& getTexCoords() const;
+ void setTexCoords(const std::vector<float>& coords);
std::string getLineJoin() const;
void setLineJoin(const std::string& s);
- virtual void calcVertexes(VertexArrayPtr& pVertexArray, Pixel32 color);
+ virtual void calcVertexes(const VertexDataPtr& pVertexData, Pixel32 color);
private:
- std::vector<DPoint> m_Pts;
- std::vector<double> m_CumulDist;
- std::vector<double> m_TexCoords;
- std::vector<double> m_EffTexCoords;
+ std::vector<glm::vec2> m_Pts;
+ std::vector<float> m_CumulDist;
+ std::vector<float> m_TexCoords;
+ std::vector<float> m_EffTexCoords;
LineJoin m_LineJoin;
};
diff --git a/src/player/PolygonNode.cpp b/src/player/PolygonNode.cpp
index 4c9411d..6e81b9b 100644
--- a/src/player/PolygonNode.cpp
+++ b/src/player/PolygonNode.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -21,12 +21,14 @@
#include "PolygonNode.h"
-#include "NodeDefinition.h"
+#include "TypeDefinition.h"
#include "../graphics/VertexArray.h"
#include "../base/Exception.h"
#include "../base/GeomHelper.h"
-#include "../base/Triangulate.h"
+#include "../base/triangulate/Triangulate.h"
+
+#include "../glm/gtx/norm.hpp"
#include <iostream>
#include <sstream>
@@ -35,17 +37,20 @@ using namespace std;
namespace avg {
-NodeDefinition PolygonNode::createDefinition()
+void PolygonNode::registerType()
{
- vector<DPoint> v;
- vector<double> vd;
- return NodeDefinition("polygon", Node::buildNode<PolygonNode>)
- .extendDefinition(FilledVectorNode::createDefinition())
+ VectorVec2Vector cv;
+ vector<glm::vec2> v;
+ vector<float> vd;
+ TypeDefinition def = TypeDefinition("polygon", "filledvectornode",
+ ExportedObject::buildObject<PolygonNode>)
.addArg(Arg<string>("linejoin", "bevel"))
- .addArg(Arg<vector<DPoint> >("pos", v, false, offsetof(PolygonNode, m_Pts)))
- .addArg(Arg<vector<double> >("texcoords", vd, false,
+ .addArg(Arg<vector<glm::vec2> >("pos", v, false, offsetof(PolygonNode, m_Pts)))
+ .addArg(Arg<vector<float> >("texcoords", vd, false,
offsetof(PolygonNode, m_TexCoords)))
+ .addArg(Arg<VectorVec2Vector>("holes", cv, false, offsetof(PolygonNode, m_Holes)))
;
+ TypeRegistry::get()->registerType(def);
}
PolygonNode::PolygonNode(const ArgList& args)
@@ -56,6 +61,18 @@ PolygonNode::PolygonNode(const ArgList& args)
throw(Exception(AVG_ERR_OUT_OF_RANGE,
"Too many texture coordinates in polygon"));
}
+ if (m_Pts.size() != 0 && m_Pts.size() < 3) {
+ throw(Exception(AVG_ERR_UNSUPPORTED,
+ "A polygon must have min. tree points."));
+ }
+ if (m_Holes.size() > 0) {
+ for (unsigned int i = 0; i < m_Holes.size(); i++) {
+ if (m_Holes[i].size() < 3) {
+ throw(Exception(AVG_ERR_UNSUPPORTED,
+ "A hole of a polygon must have min. tree points."));
+ }
+ }
+ }
setLineJoin(args.getArgVal<string>("linejoin"));
calcPolyLineCumulDist(m_CumulDist, m_Pts, true);
}
@@ -64,13 +81,14 @@ PolygonNode::~PolygonNode()
{
}
-const vector<DPoint>& PolygonNode::getPos() const
+const vector<glm::vec2>& PolygonNode::getPos() const
{
return m_Pts;
}
-void PolygonNode::setPos(const vector<DPoint>& pts)
+void PolygonNode::setPos(const vector<glm::vec2>& pts)
{
+ m_Pts.clear();
m_Pts = pts;
m_TexCoords.clear();
m_EffTexCoords.clear();
@@ -78,12 +96,25 @@ void PolygonNode::setPos(const vector<DPoint>& pts)
setDrawNeeded();
}
-const vector<double>& PolygonNode::getTexCoords() const
+const vector<float>& PolygonNode::getTexCoords() const
{
return m_TexCoords;
}
-void PolygonNode::setTexCoords(const vector<double>& coords)
+const VectorVec2Vector& PolygonNode::getHoles() const
+{
+ return m_Holes;
+}
+
+void PolygonNode::setHoles(const VectorVec2Vector& holes)
+{
+ m_Holes = holes;
+ m_TexCoords.clear();
+ m_EffTexCoords.clear();
+ setDrawNeeded();
+}
+
+void PolygonNode::setTexCoords(const vector<float>& coords)
{
if (coords.size() > m_Pts.size()+1) {
throw(Exception(AVG_ERR_OUT_OF_RANGE,
@@ -105,14 +136,14 @@ void PolygonNode::setLineJoin(const string& s)
setDrawNeeded();
}
-void PolygonNode::getElementsByPos(const DPoint& pos, vector<NodeWeakPtr>& pElements)
+void PolygonNode::getElementsByPos(const glm::vec2& pos, vector<NodePtr>& pElements)
{
if (reactsToMouseEvents() && pointInPolygon(pos, m_Pts)) {
- pElements.push_back(shared_from_this());
+ pElements.push_back(getSharedThis());
}
}
-void PolygonNode::calcVertexes(VertexArrayPtr& pVertexArray, Pixel32 color)
+void PolygonNode::calcVertexes(const VertexDataPtr& pVertexData, Pixel32 color)
{
if (getNumDifferentPts(m_Pts) < 3) {
return;
@@ -120,28 +151,43 @@ void PolygonNode::calcVertexes(VertexArrayPtr& pVertexArray, Pixel32 color)
if (m_EffTexCoords.empty()) {
calcEffPolyLineTexCoords(m_EffTexCoords, m_TexCoords, m_CumulDist);
}
- calcPolyLine(m_Pts, m_EffTexCoords, true, m_LineJoin, pVertexArray, color);
+ calcPolyLine(m_Pts, m_EffTexCoords, true, m_LineJoin, pVertexData, color);
+
+ for (unsigned i = 0; i < m_Holes.size(); i++) {
+ calcPolyLine(m_Holes[i], m_EffTexCoords, true, m_LineJoin, pVertexData, color);
+ }
}
-void PolygonNode::calcFillVertexes(VertexArrayPtr& pVertexArray, Pixel32 color)
+void PolygonNode::calcFillVertexes(const VertexDataPtr& pVertexData, Pixel32 color)
{
if (getNumDifferentPts(m_Pts) < 3) {
return;
}
// Remove duplicate points
- vector<DPoint> pts;
+ vector<glm::vec2> pts;
+ vector<unsigned int> holeIndexes;
pts.reserve(m_Pts.size());
- pts.push_back(m_Pts[0]);
+ if (glm::distance2(m_Pts[0], m_Pts[m_Pts.size()-1]) > 0.1) {
+ pts.push_back(m_Pts[0]);
+ }
for (unsigned i = 1; i < m_Pts.size(); ++i) {
- if (calcDistSquared(m_Pts[i], m_Pts[i-1]) > 0.1) {
+ if (glm::distance2(m_Pts[i], m_Pts[i-1]) > 0.1) {
pts.push_back(m_Pts[i]);
}
}
+ if (m_Holes.size() > 0) {
+ for (unsigned int i = 0; i < m_Holes.size(); i++) { //loop over collection
+ holeIndexes.push_back(pts.size());
+ for (unsigned int j = 0; j < m_Holes[i].size(); j++) { //loop over vector
+ pts.push_back(m_Holes[i][j]);
+ }
+ }
+ }
if (color.getA() > 0) {
- DPoint minCoord = pts[0];
- DPoint maxCoord = pts[0];
+ glm::vec2 minCoord = pts[0];
+ glm::vec2 maxCoord = pts[0];
for (unsigned i = 1; i < pts.size(); ++i) {
if (pts[i].x < minCoord.x) {
minCoord.x = pts[i].x;
@@ -156,14 +202,15 @@ void PolygonNode::calcFillVertexes(VertexArrayPtr& pVertexArray, Pixel32 color)
maxCoord.y = pts[i].y;
}
}
- vector<int> triIndexes;
- triangulatePolygon(pts, triIndexes);
+ vector<unsigned int> triIndexes;
+ triangulatePolygon(triIndexes, pts, holeIndexes);
+
for (unsigned i = 0; i < pts.size(); ++i) {
- DPoint texCoord = calcFillTexCoord(pts[i], minCoord, maxCoord);
- pVertexArray->appendPos(pts[i], texCoord, color);
+ glm::vec2 texCoord = calcFillTexCoord(pts[i], minCoord, maxCoord);
+ pVertexData->appendPos(pts[i], texCoord, color);
}
for (unsigned i = 0; i < triIndexes.size(); i+=3) {
- pVertexArray->appendTriIndexes(triIndexes[i], triIndexes[i+1],
+ pVertexData->appendTriIndexes(triIndexes[i], triIndexes[i+1],
triIndexes[i+2]);
}
}
diff --git a/src/player/PolygonNode.h b/src/player/PolygonNode.h
index e8d4899..850f88f 100644
--- a/src/player/PolygonNode.h
+++ b/src/player/PolygonNode.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -32,33 +32,39 @@
namespace avg {
+typedef std::vector<std::vector<glm::vec2> > VectorVec2Vector;
+
class AVG_API PolygonNode : public FilledVectorNode
{
public:
- static NodeDefinition createDefinition();
+ static void registerType();
PolygonNode(const ArgList& args);
virtual ~PolygonNode();
- const std::vector<DPoint>& getPos() const;
- void setPos(const std::vector<DPoint>& pts);
+ const std::vector<glm::vec2>& getPos() const;
+ void setPos(const std::vector<glm::vec2>& pts);
+
+ const std::vector<float>& getTexCoords() const;
+ void setTexCoords(const std::vector<float>& coords);
- const std::vector<double>& getTexCoords() const;
- void setTexCoords(const std::vector<double>& coords);
+ const VectorVec2Vector& getHoles() const;
+ void setHoles(const VectorVec2Vector& holes);
std::string getLineJoin() const;
void setLineJoin(const std::string& s);
- void getElementsByPos(const DPoint& pos, std::vector<NodeWeakPtr>& pElements);
+ void getElementsByPos(const glm::vec2& pos, std::vector<NodePtr>& pElements);
- virtual void calcVertexes(VertexArrayPtr& pVertexArray, Pixel32 color);
- virtual void calcFillVertexes(VertexArrayPtr& pVertexArray, Pixel32 color);
+ virtual void calcVertexes(const VertexDataPtr& pVertexData, Pixel32 color);
+ virtual void calcFillVertexes(const VertexDataPtr& pVertexData, Pixel32 color);
private:
- std::vector<DPoint> m_Pts;
- std::vector<double> m_CumulDist;
- std::vector<double> m_TexCoords;
- std::vector<double> m_EffTexCoords;
+ std::vector<glm::vec2> m_Pts;
+ std::vector<float> m_CumulDist;
+ std::vector<float> m_TexCoords;
+ std::vector<float> m_EffTexCoords;
+ VectorVec2Vector m_Holes;
LineJoin m_LineJoin;
};
diff --git a/src/player/Publisher.cpp b/src/player/Publisher.cpp
new file mode 100644
index 0000000..01bbea3
--- /dev/null
+++ b/src/player/Publisher.cpp
@@ -0,0 +1,248 @@
+//
+// 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 "Publisher.h"
+
+#include "SubscriberInfo.h"
+#include "PublisherDefinitionRegistry.h"
+#include "Player.h"
+
+#include "../base/Exception.h"
+#include "../base/StringHelper.h"
+
+using namespace std;
+
+namespace avg {
+
+int Publisher::s_LastSubscriberID = 0;
+
+Publisher::Publisher()
+{
+ m_pPublisherDef = PublisherDefinition::create("");
+}
+
+Publisher::Publisher(const string& sTypeName)
+{
+ m_pPublisherDef = PublisherDefinitionRegistry::get()->getDefinition(sTypeName);
+ vector<MessageID> messageIDs = m_pPublisherDef->getMessageIDs();
+ for (unsigned i=0; i<messageIDs.size(); ++i) {
+ m_SignalMap[messageIDs[i]] = list<SubscriberInfoPtr>();
+ }
+}
+
+Publisher::~Publisher()
+{
+}
+
+int Publisher::subscribe(MessageID messageID, const py::object& callable)
+{
+ SubscriberInfoList& subscribers = safeFindSubscribers(messageID);
+ int subscriberID = s_LastSubscriberID;
+ s_LastSubscriberID++;
+// cerr << this << " subscribe " << messageID << ", " << subscriberID << endl;
+ subscribers.push_front(SubscriberInfoPtr(new SubscriberInfo(subscriberID, callable)));
+ return subscriberID;
+}
+
+void Publisher::unsubscribe(MessageID messageID, int subscriberID)
+{
+// cerr << this << " unsubscribe " << messageID << ", " << subscriberID << endl;
+// cerr << " ";
+// dumpSubscribers(messageID);
+ SubscriberInfoList& subscribers = safeFindSubscribers(messageID);
+ SubscriberInfoList::iterator it;
+ for (it = subscribers.begin(); it != subscribers.end(); it++) {
+ if ((*it)->getID() == subscriberID) {
+ unsubscribeIterator(messageID, it);
+ return;
+ }
+ }
+// cerr << " End of unsubscribe: ";
+// dumpSubscribers(messageID);
+ throwSubscriberNotFound(messageID, subscriberID);
+}
+
+void Publisher::unsubscribe1(int subscriberID)
+{
+ SignalMap::iterator it;
+ for (it = m_SignalMap.begin(); it != m_SignalMap.end(); ++it) {
+ SubscriberInfoList& subscribers = it->second;
+ SubscriberInfoList::iterator it2;
+ for (it2 = subscribers.begin(); it2 != subscribers.end(); it2++) {
+ if ((*it2)->getID() == subscriberID) {
+ MessageID messageID = it->first;
+ unsubscribeIterator(messageID, it2);
+ return;
+ }
+ }
+ }
+ throw Exception(AVG_ERR_INVALID_ARGS,
+ "Subscriber with ID "+toString(subscriberID)+" not found.");
+}
+
+void Publisher::unsubscribeCallable(MessageID messageID, const py::object& callable)
+{
+ SubscriberInfoList& subscribers = safeFindSubscribers(messageID);
+ SubscriberInfoList::iterator it;
+ for (it = subscribers.begin(); it != subscribers.end(); it++) {
+ if ((*it)->isCallable(callable)) {
+ unsubscribeIterator(messageID, it);
+ return;
+ }
+ }
+ throwSubscriberNotFound(messageID, -1);
+}
+
+int Publisher::getNumSubscribers(MessageID messageID)
+{
+ SubscriberInfoList& subscribers = safeFindSubscribers(messageID);
+ return subscribers.size();
+}
+
+bool Publisher::isSubscribed(MessageID messageID, int subscriberID)
+{
+ SubscriberInfoList& subscribers = safeFindSubscribers(messageID);
+ SubscriberInfoList::iterator it;
+ for (it = subscribers.begin(); it != subscribers.end(); it++) {
+ if ((*it)->getID() == subscriberID) {
+ return true;
+ }
+ }
+ return false;
+}
+
+bool Publisher::isSubscribedCallable(MessageID messageID, const py::object& callable)
+{
+ SubscriberInfoList& subscribers = safeFindSubscribers(messageID);
+ SubscriberInfoList::iterator it;
+ for (it = subscribers.begin(); it != subscribers.end(); it++) {
+ if ((*it)->isCallable(callable)) {
+ return true;
+ }
+ }
+ return false;
+}
+
+void Publisher::publish(MessageID messageID)
+{
+ if (m_SignalMap.find(messageID) != m_SignalMap.end()) {
+ throw Exception(AVG_ERR_INVALID_ARGS, "Signal with ID "+toString(messageID)+
+ "already registered.");
+ }
+ m_SignalMap[messageID] = SubscriberInfoList();
+}
+
+void Publisher::removeSubscribers()
+{
+ SignalMap::iterator it;
+ for (it = m_SignalMap.begin(); it != m_SignalMap.end(); ++it) {
+ it->second = SubscriberInfoList();
+ }
+}
+
+void Publisher::notifySubscribers(MessageID messageID)
+{
+ SubscriberInfoList& subscribers = safeFindSubscribers(messageID);
+ if (!subscribers.empty()) {
+ py::list args;
+ notifySubscribersPy(messageID, args);
+ }
+}
+
+void Publisher::notifySubscribers(const string& sMsgName)
+{
+ MessageID messageID = m_pPublisherDef->getMessageID(sMsgName);
+ notifySubscribers(messageID);
+}
+
+void Publisher::notifySubscribersPy(MessageID messageID, const py::list& args)
+{
+// cerr << this << " notifySubscribers " << messageID << endl;
+// cerr << " ";
+// dumpSubscribers(messageID);
+ AVG_ASSERT(!(Player::get()->isTraversingTree()));
+ SubscriberInfoList& subscribers = safeFindSubscribers(messageID);
+ WeakSubscriberInfoList subRefs;
+ for (SubscriberInfoList::iterator it = subscribers.begin(); it != subscribers.end();
+ ++it)
+ {
+ subRefs.push_back(*it);
+ }
+ WeakSubscriberInfoList::iterator it;
+ for (it = subRefs.begin(); it != subRefs.end(); ++it) {
+// cerr << " next" << endl;
+ if (!(*it).expired()) {
+ SubscriberInfoPtr pSub = (*it).lock();
+ if (pSub->hasExpired()) {
+ // Python subscriber doesn't exist anymore -> auto-unsubscribe.
+ unsubscribe(messageID, pSub->getID());
+ } else {
+// cerr << " invoke: " << (*it)->getID() << endl;
+ pSub->invoke(args);
+ }
+ }
+ }
+// cerr << " end notify" << endl;
+}
+
+MessageID Publisher::genMessageID()
+{
+ return PublisherDefinitionRegistry::get()->genMessageID();
+}
+
+void Publisher::unsubscribeIterator(MessageID messageID, SubscriberInfoList::iterator it)
+{
+ m_SignalMap[messageID].erase(it);
+}
+
+
+Publisher::SubscriberInfoList& Publisher::safeFindSubscribers(MessageID messageID)
+{
+ if (m_SignalMap.find(messageID) == m_SignalMap.end()) {
+ throw Exception(AVG_ERR_INVALID_ARGS, "No signal with ID "+toString(messageID));
+ }
+ SubscriberInfoList& subscribers = m_SignalMap[messageID];
+ return subscribers;
+}
+
+void Publisher::throwSubscriberNotFound(MessageID messageID, int subscriberID)
+{
+ if (subscriberID == -1) {
+ throw Exception(AVG_ERR_INVALID_ARGS, "Signal with ID "+toString(messageID)+
+ " doesn't have a subscriber with the given callable.");
+ } else {
+ throw Exception(AVG_ERR_INVALID_ARGS, "Signal with ID "+toString(messageID)+
+ " doesn't have a subscriber with ID "+toString(subscriberID));
+ }
+}
+
+void Publisher::dumpSubscribers(MessageID messageID)
+{
+ SubscriberInfoList& subscribers = safeFindSubscribers(messageID);
+ SubscriberInfoList::iterator it;
+ for (it = subscribers.begin(); it != subscribers.end(); it++) {
+ cerr << (*it)->getID() << " ";
+ }
+ cerr << endl;
+}
+
+
+}
diff --git a/src/player/Publisher.h b/src/player/Publisher.h
new file mode 100644
index 0000000..1270544
--- /dev/null
+++ b/src/player/Publisher.h
@@ -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
+//
+
+#ifndef _Publisher_H_
+#define _Publisher_H_
+
+#include "../api.h"
+
+#include "ExportedObject.h"
+#include "BoostPython.h"
+#include "PublisherDefinition.h"
+#include "MessageID.h"
+
+#include <boost/shared_ptr.hpp>
+
+// Python docs say python.h should be included before any standard headers (!)
+#include "WrapPython.h"
+
+#include <list>
+#include <map>
+
+namespace avg {
+
+class SubscriberInfo;
+typedef boost::shared_ptr<SubscriberInfo> SubscriberInfoPtr;
+typedef boost::weak_ptr<SubscriberInfo> SubscriberInfoWeakPtr;
+
+class Publisher;
+typedef boost::shared_ptr<Publisher> PublisherPtr;
+
+class AVG_API Publisher: public ExportedObject
+{
+public:
+ Publisher();
+ Publisher(const std::string& sTypeName);
+ virtual ~Publisher();
+
+ int subscribe(MessageID messageID, const py::object& callable);
+ void unsubscribe(MessageID messageID, int subscriberID);
+ void unsubscribe1(int subscriberID);
+ void unsubscribeCallable(MessageID messageID, const py::object& callable);
+ int getNumSubscribers(MessageID messageID);
+ bool isSubscribed(MessageID messageID, int subscriberID);
+ bool isSubscribedCallable(MessageID messageID, const py::object& callable);
+
+ // The following methods should really be protected, but python derived classes need
+ // to call them too.
+ void publish(MessageID messageID);
+
+ void notifySubscribers(MessageID messageID);
+ void notifySubscribers(const std::string& sMsgName);
+ template<class ARG_TYPE>
+ void notifySubscribers(const std::string& sMsgName, const ARG_TYPE& arg);
+ void notifySubscribersPy(MessageID messageID, const py::list& args);
+
+ static MessageID genMessageID();
+
+protected:
+ void removeSubscribers();
+
+private:
+ typedef std::list<SubscriberInfoWeakPtr> WeakSubscriberInfoList;
+ typedef std::list<SubscriberInfoPtr> SubscriberInfoList;
+ typedef std::map<MessageID, SubscriberInfoList> SignalMap;
+
+ void unsubscribeIterator(MessageID messageID, SubscriberInfoList::iterator it);
+ SubscriberInfoList& safeFindSubscribers(MessageID messageID);
+ void throwSubscriberNotFound(MessageID messageID, int subscriberID);
+ void dumpSubscribers(MessageID messageID);
+
+ PublisherDefinitionPtr m_pPublisherDef;
+ SignalMap m_SignalMap;
+ static int s_LastSubscriberID;
+
+ typedef std::pair<MessageID, int> UnsubscribeDescription;
+};
+
+template<class ARG_TYPE>
+void Publisher::notifySubscribers(const std::string& sMsgName, const ARG_TYPE& arg)
+{
+ MessageID messageID = m_pPublisherDef->getMessageID(sMsgName);
+ SubscriberInfoList& subscribers = safeFindSubscribers(messageID);
+ if (!subscribers.empty()) {
+ py::list args;
+ py::object pyArg(arg);
+ args.append(pyArg);
+ notifySubscribersPy(messageID, args);
+ }
+}
+
+
+}
+
+#endif
+
diff --git a/src/player/PublisherDefinition.cpp b/src/player/PublisherDefinition.cpp
new file mode 100644
index 0000000..33fddf0
--- /dev/null
+++ b/src/player/PublisherDefinition.cpp
@@ -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
+//
+
+#include "PublisherDefinition.h"
+
+#include "PublisherDefinitionRegistry.h"
+
+#include "../base/Exception.h"
+
+using namespace std;
+
+namespace avg {
+
+PublisherDefinition::PublisherDefinition(const string& sName, const string& sBaseName)
+ : m_sName(sName)
+{
+ if (sBaseName != "") {
+ PublisherDefinitionPtr pBaseDef =
+ PublisherDefinitionRegistry::get()->getDefinition(sBaseName);
+ m_MessageIDs = pBaseDef->m_MessageIDs;
+ }
+}
+
+PublisherDefinition::~PublisherDefinition()
+{
+}
+
+PublisherDefinitionPtr PublisherDefinition::create(const std::string& sName,
+ const std::string& sBaseName)
+{
+ PublisherDefinitionPtr pDef(new PublisherDefinition(sName, sBaseName));
+ PublisherDefinitionRegistry::get()->registerDefinition(pDef);
+ return pDef;
+}
+
+void PublisherDefinition::addMessage(const std::string& sName)
+{
+ m_MessageIDs.push_back(PublisherDefinitionRegistry::get()->genMessageID(sName));
+}
+
+const MessageID& PublisherDefinition::getMessageID(const std::string& sName) const
+{
+ for (unsigned i=0; i<m_MessageIDs.size(); ++i) {
+ if (m_MessageIDs[i].m_sName == sName) {
+ return m_MessageIDs[i];
+ }
+ }
+ AVG_ASSERT_MSG(false, (string("Message named '")+sName+("' unknown.")).c_str());
+ // Avoid compiler warning.
+ static MessageID nullMsg("", -1);
+ return nullMsg;
+}
+
+const std::vector<MessageID>& PublisherDefinition::getMessageIDs() const
+{
+ return m_MessageIDs;
+}
+
+const std::string& PublisherDefinition::getName() const
+{
+ return m_sName;
+}
+
+void PublisherDefinition::dump() const
+{
+ cerr << m_sName << endl;
+ for (unsigned i=0; i<m_MessageIDs.size(); ++i) {
+ cerr << " " << m_MessageIDs[i].m_sName << ": " << m_MessageIDs[i].m_ID << endl;
+ }
+}
+
+}
diff --git a/src/player/PublisherDefinition.h b/src/player/PublisherDefinition.h
new file mode 100644
index 0000000..a8d5e7e
--- /dev/null
+++ b/src/player/PublisherDefinition.h
@@ -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
+//
+
+#ifndef _PublisherDefinition_H_
+#define _PublisherDefinition_H_
+
+#include "../api.h"
+
+#include "MessageID.h"
+
+#include <boost/shared_ptr.hpp>
+#include <vector>
+#include <string>
+
+namespace avg {
+
+class PublisherDefinition;
+typedef boost::shared_ptr<PublisherDefinition> PublisherDefinitionPtr;
+
+class AVG_API PublisherDefinition
+{
+public:
+ virtual ~PublisherDefinition();
+ static PublisherDefinitionPtr create(const std::string& sName,
+ const std::string& sBaseName="");
+
+ void addMessage(const std::string& sName);
+ const MessageID& getMessageID(const std::string& sName) const;
+ const std::vector<MessageID> & getMessageIDs() const;
+
+ const std::string& getName() const;
+ void dump() const;
+
+private:
+ PublisherDefinition(const std::string& sName, const std::string& sBaseName);
+
+ std::string m_sName;
+ std::vector<MessageID> m_MessageIDs;
+};
+
+}
+
+#endif
+
diff --git a/src/player/PublisherDefinitionRegistry.cpp b/src/player/PublisherDefinitionRegistry.cpp
new file mode 100644
index 0000000..3972a32
--- /dev/null
+++ b/src/player/PublisherDefinitionRegistry.cpp
@@ -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
+//
+
+#include "PublisherDefinitionRegistry.h"
+
+#include "PublisherDefinition.h"
+
+#include "../base/Exception.h"
+
+using namespace std;
+
+
+namespace avg {
+
+PublisherDefinitionRegistry* PublisherDefinitionRegistry::s_pInstance = 0;
+
+PublisherDefinitionRegistry::PublisherDefinitionRegistry()
+ : m_LastMessageID(-1)
+{
+ s_pInstance = this;
+ // The following should really happen in the player constructor, but the entries
+ // need to exist for the player to be constructed.
+ PublisherDefinitionPtr pPlayerDef = PublisherDefinition::create("Player");
+ pPlayerDef->addMessage("KEY_DOWN");
+ pPlayerDef->addMessage("KEY_UP");
+ pPlayerDef->addMessage("PLAYBACK_START");
+ pPlayerDef->addMessage("PLAYBACK_END");
+ pPlayerDef->addMessage("ON_FRAME");
+}
+
+PublisherDefinitionRegistry::~PublisherDefinitionRegistry()
+{
+}
+
+PublisherDefinitionRegistry* PublisherDefinitionRegistry::get()
+{
+ if (!s_pInstance) {
+ new PublisherDefinitionRegistry();
+ }
+ return s_pInstance;
+}
+
+void PublisherDefinitionRegistry::registerDefinition(PublisherDefinitionPtr def)
+{
+ m_Definitions.push_back(def);
+}
+
+PublisherDefinitionPtr PublisherDefinitionRegistry::getDefinition(const string& sName)
+ const
+{
+ for (unsigned i=0; i<m_Definitions.size(); ++i) {
+ if (m_Definitions[i]->getName() == sName) {
+ return m_Definitions[i];
+ }
+ }
+ AVG_ASSERT_MSG(false, (string("Can't find PublisherDefinition ")+sName).c_str());
+ return PublisherDefinitionPtr();
+}
+
+void PublisherDefinitionRegistry::dump() const
+{
+ for (unsigned i=0; i<m_Definitions.size(); ++i) {
+ m_Definitions[i]->dump();
+ }
+}
+
+MessageID PublisherDefinitionRegistry::genMessageID(const string& sName)
+{
+ return MessageID(sName, ++m_LastMessageID);
+}
+
+}
diff --git a/src/base/Triple.h b/src/player/PublisherDefinitionRegistry.h
index 879a809..8d3acac 100644
--- a/src/base/Triple.h
+++ b/src/player/PublisherDefinitionRegistry.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -19,48 +19,45 @@
// Current versions can be found at www.libavg.de
//
-#ifndef _Triple_H_
-#define _Triple_H_
+#ifndef _PublisherDefinitionRegistry_H_
+#define _PublisherDefinitionRegistry_H_
#include "../api.h"
-#include <ostream>
-#include <istream>
-#include <vector>
+#include "MessageID.h"
-// Fix for non-C99 win compilers up to MSVC++2008
-#if defined _MSC_VER && _MSC_VER <= 1500
-#define isinf(x) (!_finite(x))
-#define isnan(x) (_isnan(x))
-#endif
+#include <boost/shared_ptr.hpp>
+#include <vector>
+#include <string>
namespace avg {
-template<class NUM>
-class AVG_TEMPLATE_API Triple
+class PublisherDefinition;
+typedef boost::shared_ptr<PublisherDefinition> PublisherDefinitionPtr;
+
+class AVG_API PublisherDefinitionRegistry
{
public:
- NUM x;
- NUM y;
- NUM z;
-
- Triple();
- Triple(NUM X, NUM Y, NUM Z);
- Triple(const Triple<NUM> & p);
- Triple(const std::vector<NUM>& v);
- ~Triple();
-
+ static PublisherDefinitionRegistry* get();
+ virtual ~PublisherDefinitionRegistry();
+
+ void registerDefinition(PublisherDefinitionPtr def);
+ PublisherDefinitionPtr getDefinition(const std::string& sName) const;
+
+ void dump() const;
+
+ MessageID genMessageID(const std::string& sName="");
+
+private:
+ PublisherDefinitionRegistry();
+ std::vector<PublisherDefinitionPtr> m_Definitions;
+ int m_LastMessageID;
+
+ static PublisherDefinitionRegistry* s_pInstance;
};
-template<class NUM>
-std::ostream& operator<<(std::ostream& os, const Triple<NUM> &p);
-
-template<class NUM>
-std::istream& operator>>(std::istream& is, Triple<NUM>& p);
-
-typedef Triple<double> DTriple;
-typedef Triple<int> IntTriple;
-
}
#endif
+
+
diff --git a/src/player/PythonLogSink.cpp b/src/player/PythonLogSink.cpp
new file mode 100644
index 0000000..5da5829
--- /dev/null
+++ b/src/player/PythonLogSink.cpp
@@ -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
+
+#include "PythonLogSink.h"
+#include "WrapPython.h"
+#include "../base/Logger.h"
+
+#include <iostream>
+#include <boost/algorithm/string.hpp>
+#include <boost/python/errors.hpp>
+
+namespace avg
+{
+
+PythonLogSink::PythonLogSink(PyObject *pyLogger):
+ m_pyLogger(pyLogger)
+{
+ Py_INCREF(pyLogger);
+ assert(pyLogger);
+}
+
+PythonLogSink::~PythonLogSink()
+{
+ Py_DecRef(m_pyLogger);
+}
+
+const char * PythonLogSink::LogSeverityToPythonString(severity_t severity)
+{
+ if(severity == Logger::severity::CRITICAL) {
+ return "critical";
+ } else if(severity == Logger::severity::ERROR) {
+ return "error";
+ } else if(severity == Logger::severity::WARNING) {
+ return "warning";
+ } else if(severity == Logger::severity::INFO) {
+ return "info";
+ } else if(severity == Logger::severity::DEBUG) {
+ return "debug";
+ }
+ throw Exception(AVG_ERR_UNKNOWN, "Unkown log severity");
+}
+
+void PythonLogSink::logMessage(const tm* pTime, unsigned millis,
+ const category_t& category, severity_t severity, const UTF8String& sMsg)
+{
+ try {
+ aquirePyGIL aquireGil;
+ PyObject * extra = PyDict_New();
+ PyObject * pyCat = PyString_FromString(category.c_str());
+
+ PyDict_SetItemString(extra, "category", pyCat);
+
+ PyObject * pyMsg = PyString_FromString(sMsg.c_str());
+ PyObject * args = PyTuple_New(1);
+ PyObject * kwargs = PyDict_New();
+ PyDict_SetItemString(kwargs, "extra", extra);
+ PyTuple_SetItem(args, 0, pyMsg);
+
+ PyObject_Call(PyObject_GetAttrString(m_pyLogger,
+ LogSeverityToPythonString(severity)), args, kwargs);
+
+ Py_DECREF(extra);
+ Py_DECREF(pyCat);
+ Py_DECREF(args);
+ Py_DECREF(kwargs);
+ } catch (const boost::python::error_already_set &) {
+ std::cerr << "PythonLogSink: Python raised exception\n";
+ } catch (const exception &) {
+ std::cerr << "PythonLogSink: Couldn't log to python logger.\n";
+ }
+}
+
+}
diff --git a/src/base/CmdLine.h b/src/player/PythonLogSink.h
index db57104..045eb4e 100644
--- a/src/base/CmdLine.h
+++ b/src/player/PythonLogSink.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -17,34 +17,30 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// Current versions can be found at www.libavg.de
-//
-
-#ifndef _CmdLine_H_
-#define _CmdLine_H_
-#include "../api.h"
-#include <string>
-#include <vector>
-#include <map>
+#ifndef _PYTHONLOGHANDLER_H_
+#define _PYTHONLOGHANDLER_H_
-namespace avg {
+#include "../base/ILogSink.h"
+#include "../player/WrapPython.h"
-typedef std::map<std::string, std::string> OptionMap;
-
-class AVG_API CmdLine {
+namespace avg
+{
+class PythonLogSink: public ILogSink
+{
public:
- CmdLine(int argc, char **argv);
+ PythonLogSink(PyObject *pyLogger);
+ virtual ~PythonLogSink ();
- const OptionMap& getOptions() const;
- const std::string* getOption(const std::string& sName) const;
- int getNumArgs() const;
- const std::string* getArg(unsigned int i) const;
+ virtual void logMessage(const tm* pTime, unsigned millis, const category_t& category,
+ severity_t severity, const UTF8String& sMsg);
private:
- OptionMap m_Options;
- std::vector<std::string> m_Args;
+
+ PyObject *m_pyLogger;
+ static const char * LogSeverityToPythonString(severity_t severity);
};
}
-#endif
+#endif
diff --git a/src/player/RasterNode.cpp b/src/player/RasterNode.cpp
index 0bf304c..daace6b 100644
--- a/src/player/RasterNode.cpp
+++ b/src/player/RasterNode.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -21,11 +21,13 @@
#include "RasterNode.h"
-#include "NodeDefinition.h"
+#include "TypeDefinition.h"
#include "OGLSurface.h"
#include "FXNode.h"
#include "../graphics/ImagingProjection.h"
+#include "../graphics/ShaderRegistry.h"
+#include "../graphics/BitmapLoader.h"
#include "../base/MathHelper.h"
#include "../base/Logger.h"
@@ -37,10 +39,9 @@ using namespace std;
namespace avg {
-NodeDefinition RasterNode::createDefinition()
+void RasterNode::registerType()
{
- return NodeDefinition("rasternode")
- .extendDefinition(AreaNode::createDefinition())
+ TypeDefinition def = TypeDefinition("rasternode", "areanode")
.addArg(Arg<int>("maxtilewidth", -1, false,
offsetof(RasterNode, m_MaxTileSize.x)))
.addArg(Arg<int>("maxtileheight", -1, false,
@@ -49,24 +50,23 @@ NodeDefinition RasterNode::createDefinition()
offsetof(RasterNode, m_sBlendMode)))
.addArg(Arg<bool>("mipmap", false))
.addArg(Arg<UTF8String>("maskhref", "", false, offsetof(RasterNode, m_sMaskHref)))
- .addArg(Arg<DPoint>("maskpos", DPoint(0,0), false,
+ .addArg(Arg<glm::vec2>("maskpos", glm::vec2(0,0), false,
offsetof(RasterNode, m_MaskPos)))
- .addArg(Arg<DPoint>("masksize", DPoint(0,0), false,
+ .addArg(Arg<glm::vec2>("masksize", glm::vec2(0,0), false,
offsetof(RasterNode, m_MaskSize)))
- .addArg(Arg<DTriple>("gamma", DTriple(1.0,1.0,1.0), false,
+ .addArg(Arg<glm::vec3>("gamma", glm::vec3(1.0f,1.0f,1.0f), false,
offsetof(RasterNode, m_Gamma)))
- .addArg(Arg<DTriple>("contrast", DTriple(1.0,1.0,1.0), false,
+ .addArg(Arg<glm::vec3>("contrast", glm::vec3(1.0f,1.0f,1.0f), false,
offsetof(RasterNode, m_Contrast)))
- .addArg(Arg<DTriple>("intensity", DTriple(1.0,1.0,1.0), false,
+ .addArg(Arg<glm::vec3>("intensity", glm::vec3(1.0f,1.0f,1.0f), false,
offsetof(RasterNode, m_Intensity)));
+ TypeRegistry::get()->registerType(def);
}
RasterNode::RasterNode()
: m_pSurface(0),
m_Material(GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE, false),
- m_bBound(false),
m_TileSize(-1,-1),
- m_pVertexes(0),
m_bFXDirty(true)
{
}
@@ -95,15 +95,12 @@ void RasterNode::setArgs(const ArgList& args)
void RasterNode::connectDisplay()
{
- checkMaskSupport(m_sMaskHref);
AreaNode::connectDisplay();
- m_pSurface->attach();
- m_bBound = false;
if (m_MaxTileSize != IntPoint(-1, -1)) {
m_TileSize = m_MaxTileSize;
}
- calcVertexGrid(m_TileVertices);
+ newSurface();
setBlendModeStr(m_sBlendMode);
if (m_pMaskBmp) {
downloadMask();
@@ -115,10 +112,6 @@ void RasterNode::connectDisplay()
void RasterNode::disconnect(bool bKill)
{
- if (m_pVertexes) {
- delete m_pVertexes;
- m_pVertexes = 0;
- }
if (m_pSurface) {
m_pSurface->destroy();
}
@@ -143,13 +136,9 @@ void RasterNode::checkReload()
m_sMaskFilename = sMaskFilename;
try {
if (m_sMaskFilename != "") {
- AVG_TRACE(Logger::MEMORY, "Loading " << m_sMaskFilename);
- m_pMaskBmp = BitmapPtr(new Bitmap(m_sMaskFilename));
- if (m_pMaskBmp->getPixelFormat() != I8) {
- BitmapPtr pTempBmp = m_pMaskBmp;
- m_pMaskBmp = BitmapPtr(new Bitmap(m_pMaskBmp->getSize(), I8));
- m_pMaskBmp->copyPixels(*pTempBmp);
- }
+ AVG_TRACE(Logger::category::MEMORY, Logger::severity::INFO,
+ "Loading " << m_sMaskFilename);
+ m_pMaskBmp = loadBitmap(m_sMaskFilename, I8);
setMaskCoords();
}
} catch (Exception & ex) {
@@ -158,9 +147,9 @@ void RasterNode::checkReload()
}
m_sMaskFilename = "";
if (getState() != Node::NS_UNCONNECTED) {
- AVG_TRACE(Logger::ERROR, ex.getStr());
+ AVG_LOG_ERROR(ex.getStr());
} else {
- AVG_TRACE(Logger::MEMORY, ex.getStr());
+ AVG_TRACE(Logger::category::MEMORY, Logger::severity::ERROR, ex.getStr());
}
}
if (m_sMaskFilename == "") {
@@ -178,9 +167,6 @@ void RasterNode::checkReload()
VertexGrid RasterNode::getOrigVertexCoords()
{
checkDisplayAvailable("getOrigVertexCoords");
- if (!m_bBound) {
- bind();
- }
VertexGrid grid;
calcVertexGrid(grid);
return grid;
@@ -189,18 +175,12 @@ VertexGrid RasterNode::getOrigVertexCoords()
VertexGrid RasterNode::getWarpedVertexCoords()
{
checkDisplayAvailable("getWarpedVertexCoords");
- if (!m_bBound) {
- bind();
- }
return m_TileVertices;
}
void RasterNode::setWarpedVertexCoords(const VertexGrid& grid)
{
checkDisplayAvailable("setWarpedVertexCoords");
- if (!m_bBound) {
- bind();
- }
bool bGridOK = true;
IntPoint numTiles = getNumTiles();
if (grid.size() != (unsigned)(numTiles.y+1)) {
@@ -216,7 +196,6 @@ void RasterNode::setWarpedVertexCoords(const VertexGrid& grid)
"setWarpedVertexCoords() called with incorrect grid size.");
}
m_TileVertices = grid;
- m_bVertexArrayDirty = true;
}
int RasterNode::getMaxTileWidth() const
@@ -241,8 +220,15 @@ const std::string& RasterNode::getBlendModeStr() const
void RasterNode::setBlendModeStr(const string& sBlendMode)
{
+ GLContext::BlendMode blendMode = GLContext::stringToBlendMode(sBlendMode);
+ if (!GLContext::getMain()->isBlendModeSupported(blendMode)) {
+ m_sBlendMode = "blend";
+ m_BlendMode = GLContext::BLEND_BLEND;
+ throw Exception(AVG_ERR_UNSUPPORTED,
+ "Min and max blend modes are not supported in this OpenGL configuration.");
+ }
m_sBlendMode = sBlendMode;
- m_BlendMode = GLContext::stringToBlendMode(sBlendMode);
+ m_BlendMode = blendMode;
}
const UTF8String& RasterNode::getMaskHRef() const
@@ -252,36 +238,33 @@ const UTF8String& RasterNode::getMaskHRef() const
void RasterNode::setMaskHRef(const UTF8String& sHref)
{
- if (GLContext::getCurrent()) {
- checkMaskSupport(sHref);
- }
m_sMaskHref = sHref;
checkReload();
}
-const DPoint& RasterNode::getMaskPos() const
+const glm::vec2& RasterNode::getMaskPos() const
{
return m_MaskPos;
}
-void RasterNode::setMaskPos(const DPoint& pos)
+void RasterNode::setMaskPos(const glm::vec2& pos)
{
m_MaskPos = pos;
setMaskCoords();
}
-const DPoint& RasterNode::getMaskSize() const
+const glm::vec2& RasterNode::getMaskSize() const
{
return m_MaskSize;
}
-void RasterNode::setMaskSize(const DPoint& size)
+void RasterNode::setMaskSize(const glm::vec2& size)
{
m_MaskSize = size;
setMaskCoords();
}
-void RasterNode::getElementsByPos(const DPoint& pos, vector<NodeWeakPtr>& pElements)
+void RasterNode::getElementsByPos(const glm::vec2& pos, vector<NodePtr>& pElements)
{
// Node isn't pickable if it's warped.
if (m_MaxTileSize == IntPoint(-1, -1)) {
@@ -289,12 +272,12 @@ void RasterNode::getElementsByPos(const DPoint& pos, vector<NodeWeakPtr>& pEleme
}
}
-DTriple RasterNode::getGamma() const
+glm::vec3 RasterNode::getGamma() const
{
return m_Gamma;
}
-void RasterNode::setGamma(const DTriple& gamma)
+void RasterNode::setGamma(const glm::vec3& gamma)
{
m_Gamma = gamma;
if (getState() == Node::NS_CANRENDER) {
@@ -302,12 +285,12 @@ void RasterNode::setGamma(const DTriple& gamma)
}
}
-DTriple RasterNode::getIntensity() const
+glm::vec3 RasterNode::getIntensity() const
{
return m_Intensity;
}
-void RasterNode::setIntensity(const DTriple& intensity)
+void RasterNode::setIntensity(const glm::vec3& intensity)
{
m_Intensity = intensity;
if (getState() == Node::NS_CANRENDER) {
@@ -315,12 +298,12 @@ void RasterNode::setIntensity(const DTriple& intensity)
}
}
-DTriple RasterNode::getContrast() const
+glm::vec3 RasterNode::getContrast() const
{
return m_Contrast;
}
-void RasterNode::setContrast(const DTriple& contrast)
+void RasterNode::setContrast(const glm::vec3& contrast)
{
m_Contrast = contrast;
if (getState() == Node::NS_CANRENDER) {
@@ -342,16 +325,35 @@ void RasterNode::setEffect(FXNodePtr pFXNode)
}
}
-void RasterNode::blt32(const DPoint& destSize, double opacity,
- GLContext::BlendMode mode, bool bPremultipliedAlpha)
+void RasterNode::calcVertexArray(const VertexArrayPtr& pVA, const Pixel32& color)
+{
+ if (isVisible() && m_pSurface->isCreated()) {
+ pVA->startSubVA(m_SubVA);
+ for (unsigned y = 0; y < m_TileVertices.size()-1; y++) {
+ for (unsigned x = 0; x < m_TileVertices[0].size()-1; x++) {
+ int curVertex = m_SubVA.getNumVerts();
+ m_SubVA.appendPos(m_TileVertices[y][x], m_TexCoords[y][x], color);
+ m_SubVA.appendPos(m_TileVertices[y][x+1], m_TexCoords[y][x+1], color);
+ m_SubVA.appendPos(m_TileVertices[y+1][x+1], m_TexCoords[y+1][x+1], color);
+ m_SubVA.appendPos(m_TileVertices[y+1][x], m_TexCoords[y+1][x], color);
+ m_SubVA.appendQuadIndexes(
+ curVertex+1, curVertex, curVertex+2, curVertex+3);
+ }
+ }
+ }
+}
+
+void RasterNode::blt32(const glm::mat4& transform, const glm::vec2& destSize,
+ float opacity, GLContext::BlendMode mode, bool bPremultipliedAlpha)
{
- blt(destSize, mode, opacity, Pixel32(255, 255, 255, 255), bPremultipliedAlpha);
+ blt(transform, destSize, mode, opacity, Pixel32(255, 255, 255, 255),
+ bPremultipliedAlpha);
}
-void RasterNode::blta8(const DPoint& destSize, double opacity,
- const Pixel32& color, GLContext::BlendMode mode)
+void RasterNode::blta8(const glm::mat4& transform, const glm::vec2& destSize,
+ float opacity, const Pixel32& color, GLContext::BlendMode mode)
{
- blt(destSize, mode, opacity, color, false);
+ blt(transform, destSize, mode, opacity, color, false);
}
GLContext::BlendMode RasterNode::getBlendMode() const
@@ -383,25 +385,17 @@ void RasterNode::setMaskCoords()
void RasterNode::calcMaskCoords()
{
- DPoint maskSize;
- DPoint mediaSize = DPoint(getMediaSize());
- if (m_MaskSize == DPoint(0,0)) {
- maskSize = DPoint(1,1);
+ glm::vec2 maskSize;
+ glm::vec2 mediaSize = glm::vec2(getMediaSize());
+ if (m_MaskSize == glm::vec2(0,0)) {
+ maskSize = glm::vec2(1,1);
} else {
- maskSize = DPoint(m_MaskSize.x/mediaSize.x, m_MaskSize.y/mediaSize.y);
+ maskSize = glm::vec2(m_MaskSize.x/mediaSize.x, m_MaskSize.y/mediaSize.y);
}
- DPoint maskPos = DPoint(m_MaskPos.x/mediaSize.x, m_MaskPos.y/mediaSize.y);
+ glm::vec2 maskPos = glm::vec2(m_MaskPos.x/mediaSize.x, m_MaskPos.y/mediaSize.y);
m_pSurface->setMaskCoords(maskPos, maskSize);
}
-void RasterNode::checkMaskSupport(const string& sHref)
-{
- if (!(GLContext::getCurrent()->isUsingShaders()) && sHref != "") {
- throw Exception(AVG_ERR_UNSUPPORTED,
- "Can't use masks - unsupported on this hardware/driver combination.");
- }
-}
-
void RasterNode::downloadMask()
{
GLTexturePtr pTex(new GLTexture(m_pMaskBmp->getSize(), I8,
@@ -410,64 +404,45 @@ void RasterNode::downloadMask()
m_pSurface->setMask(pTex);
}
-void RasterNode::bind()
-{
- if (!m_bBound) {
- calcTexCoords();
- }
- m_bBound = true;
-}
-
static ProfilingZoneID FXProfilingZone("RasterNode::renderFX");
-void RasterNode::renderFX(const DPoint& destSize, const Pixel32& color,
- bool bPremultipliedAlpha)
+void RasterNode::renderFX(const glm::vec2& destSize, const Pixel32& color,
+ bool bPremultipliedAlpha, bool bForceRender)
{
- ScopeTimer Timer(FXProfilingZone);
setupFX(false);
- GLContext* pContext = GLContext::getCurrent();
- pContext->enableGLColorArray(false);
- pContext->enableTexture(true);
- if (m_pFXNode && (m_bFXDirty || m_pSurface->isDirty() || m_pFXNode->isDirty())) {
- if (!m_bBound) {
- bind();
- }
+ if (m_pFXNode && (m_bFXDirty || m_pSurface->isDirty() || m_pFXNode->isDirty() ||
+ bForceRender))
+ {
+ ScopeTimer Timer(FXProfilingZone);
+ GLContext* pContext = GLContext::getMain();
+ StandardShader::get()->setAlpha(1.0f);
m_pSurface->activate(getMediaSize());
m_pFBO->activate();
- clearGLBuffers(GL_COLOR_BUFFER_BIT);
+ clearGLBuffers(GL_COLOR_BUFFER_BIT, false);
- glColor4d(double(color.getR())/256, double(color.getG())/256,
- double(color.getB())/256, 1);
if (bPremultipliedAlpha) {
glproc::BlendColor(1.0f, 1.0f, 1.0f, 1.0f);
}
pContext->setBlendMode(GLContext::BLEND_BLEND, bPremultipliedAlpha);
-
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
-
- m_pImagingProjection->activate();
- m_pImagingProjection->draw();
+ m_pImagingProjection->setColor(color);
+ m_pImagingProjection->draw(StandardShader::get()->getShader());
/*
static int i=0;
stringstream ss;
- ss << "foo" << i << ".png";
+ ss << "node" << i << ".png";
BitmapPtr pBmp = m_pFBO->getImage(0);
pBmp->save(ss.str());
- */
+*/
m_pFXNode->apply(m_pFBO->getTex());
- glPopMatrix();
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "RasterNode::renderFX(): glPopMatrix");
/*
stringstream ss1;
- ss1 << "bar" << ".png";
+ ss1 << "nodefx" << i << ".png";
i++;
m_pFXNode->getImage()->save(ss1.str());
*/
- glproc::UseProgramObject(0);
m_bFXDirty = false;
m_pSurface->resetDirty();
m_pFXNode->resetDirty();
@@ -486,83 +461,71 @@ void RasterNode::checkDisplayAvailable(std::string sMsg)
}
}
+void RasterNode::newSurface()
+{
+ if (m_pSurface->isCreated()) {
+ calcVertexGrid(m_TileVertices);
+ calcTexCoords();
+ }
+}
+
void RasterNode::setupFX(bool bNewFX)
{
if (m_pSurface && m_pSurface->getSize() != IntPoint(-1, -1) && m_pFXNode) {
- if (!GLContext::getCurrent()->isUsingShaders()) {
- throw Exception(AVG_ERR_UNSUPPORTED,
- "Can't use FX - unsupported on this hardware/driver combination.");
- }
if (bNewFX || !m_pFBO || m_pFBO->getSize() != m_pSurface->getSize()) {
m_pFXNode->setSize(m_pSurface->getSize());
m_pFXNode->connect();
m_bFXDirty = true;
}
if (!m_pFBO || m_pFBO->getSize() != m_pSurface->getSize()) {
- m_pFBO = FBOPtr(new FBO(IntPoint(m_pSurface->getSize()), B8G8R8A8, 1, 1,
- false, getMipmap()));
+ PixelFormat pf = BitmapLoader::get()->getDefaultPixelFormat(true);
+ m_pFBO = FBOPtr(new FBO(IntPoint(m_pSurface->getSize()), pf, 1, 1, false,
+ getMipmap()));
GLTexturePtr pTex = m_pFBO->getTex();
+ #ifndef AVG_ENABLE_EGL
pTex->setWrapMode(GL_CLAMP_TO_BORDER, GL_CLAMP_TO_BORDER);
+ #endif
m_pImagingProjection = ImagingProjectionPtr(new ImagingProjection(
m_pSurface->getSize()));
}
}
}
-void RasterNode::blt(const DPoint& destSize, GLContext::BlendMode mode,
- double opacity, const Pixel32& color, bool bPremultipliedAlpha)
+void RasterNode::blt(const glm::mat4& transform, const glm::vec2& destSize,
+ GLContext::BlendMode mode, float opacity, const Pixel32& color,
+ bool bPremultipliedAlpha)
{
- if (!m_bBound) {
- bind();
- }
- GLContext* pContext = GLContext::getCurrent();
- pContext->enableGLColorArray(false);
- pContext->enableTexture(true);
- DRect destRect;
+ GLContext* pContext = GLContext::getMain();
+ FRect destRect;
+
+ StandardShaderPtr pShader = pContext->getStandardShader();
+ pContext->setBlendColor(glm::vec4(1.0f, 1.0f, 1.0f, opacity));
+ pShader->setAlpha(opacity);
if (m_pFXNode) {
- m_pFXNode->getTex()->activate(GL_TEXTURE0);
-
pContext->setBlendMode(mode, true);
- glColor4d(1.0, 1.0, 1.0, opacity);
- DRect relDestRect = m_pFXNode->getRelDestRect();
- destRect = DRect(relDestRect.tl.x*destSize.x, relDestRect.tl.y*destSize.y,
+ m_pFXNode->getTex()->activate(GL_TEXTURE0);
+ pShader->setColorModel(0);
+ pShader->disableColorspaceMatrix();
+ pShader->setGamma(glm::vec4(1.0f, 1.0f, 1.0f, 1.0f));
+ pShader->setPremultipliedAlpha(true);
+ pShader->setMask(false);
+
+ FRect relDestRect = m_pFXNode->getRelDestRect();
+ destRect = FRect(relDestRect.tl.x*destSize.x, relDestRect.tl.y*destSize.y,
relDestRect.br.x*destSize.x, relDestRect.br.y*destSize.y);
} else {
m_pSurface->activate(getMediaSize(), bPremultipliedAlpha);
pContext->setBlendMode(mode, bPremultipliedAlpha);
- glColor4d(double(color.getR())/256, double(color.getG())/256,
- double(color.getB())/256, opacity);
- destRect = DRect(DPoint(0,0), destSize);
- }
- glproc::BlendColor(1.0f, 1.0f, 1.0f, float(opacity));
- glPushMatrix();
- glTranslated(destRect.tl.x, destRect.tl.y, 1);
- glScaled(destRect.size().x, destRect.size().y, 1);
-
- if (m_bVertexArrayDirty) {
- m_pVertexes->reset();
- for (unsigned y = 0; y < m_TileVertices.size()-1; y++) {
- for (unsigned x = 0; x < m_TileVertices[0].size()-1; x++) {
- int curVertex = m_pVertexes->getCurVert();
- m_pVertexes->appendPos(m_TileVertices[y][x], m_TexCoords[y][x]);
- m_pVertexes->appendPos(m_TileVertices[y][x+1], m_TexCoords[y][x+1]);
- m_pVertexes->appendPos(m_TileVertices[y+1][x+1], m_TexCoords[y+1][x+1]);
- m_pVertexes->appendPos(m_TileVertices[y+1][x], m_TexCoords[y+1][x]);
- m_pVertexes->appendQuadIndexes(
- curVertex+1, curVertex, curVertex+2, curVertex+3);
- }
- }
- m_bVertexArrayDirty = false;
+ destRect = FRect(glm::vec2(0,0), destSize);
}
+ glm::vec3 pos(destRect.tl.x, destRect.tl.y, 0);
+ glm::vec3 scaleVec(destRect.size().x, destRect.size().y, 1);
+ glm::mat4 localTransform = glm::translate(transform, pos);
+ localTransform = glm::scale(localTransform, scaleVec);
+ pShader->setTransform(localTransform);
+ pShader->activate();
- m_pVertexes->draw();
-
- glPopMatrix();
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "RasterNode::blt(): glPopMatrix 2");
-
- PixelFormat pf = m_pSurface->getPixelFormat();
- AVG_TRACE(Logger::BLTS, "(" << destSize.x << ", " << destSize.y << ")"
- << ", m_pf: " << pf);
+ m_SubVA.draw();
}
IntPoint RasterNode::getNumTiles()
@@ -571,38 +534,33 @@ IntPoint RasterNode::getNumTiles()
if (m_TileSize.x == -1) {
return IntPoint(1,1);
} else {
- return IntPoint(safeCeil(double(size.x)/m_TileSize.x),
- safeCeil(double(size.y)/m_TileSize.y));
+ return IntPoint(safeCeil(float(size.x)/m_TileSize.x),
+ safeCeil(float(size.y)/m_TileSize.y));
}
}
void RasterNode::calcVertexGrid(VertexGrid& grid)
{
IntPoint numTiles = getNumTiles();
- std::vector<DPoint> TileVerticesLine(numTiles.x+1);
- grid = std::vector<std::vector<DPoint> > (numTiles.y+1, TileVerticesLine);
+ std::vector<glm::vec2> TileVerticesLine(numTiles.x+1);
+ grid = std::vector<std::vector<glm::vec2> > (numTiles.y+1, TileVerticesLine);
for (unsigned y = 0; y < grid.size(); y++) {
for (unsigned x = 0; x < grid[y].size(); x++) {
calcTileVertex(x, y, grid[y][x]);
}
}
- if (m_pVertexes) {
- delete m_pVertexes;
- }
- m_bVertexArrayDirty = true;
- m_pVertexes = new VertexArray(numTiles.x*numTiles.y*4, numTiles.x*numTiles.y*6);
}
-void RasterNode::calcTileVertex(int x, int y, DPoint& Vertex)
+void RasterNode::calcTileVertex(int x, int y, glm::vec2& Vertex)
{
IntPoint numTiles = getNumTiles();
if (x < numTiles.x) {
- Vertex.x = double(m_TileSize.x*x) / m_pSurface->getSize().x;
+ Vertex.x = float(m_TileSize.x*x) / m_pSurface->getSize().x;
} else {
Vertex.x = 1;
}
if (y < numTiles.y) {
- Vertex.y = double(m_TileSize.y*y) / m_pSurface->getSize().y;
+ Vertex.y = float(m_TileSize.y*y) / m_pSurface->getSize().y;
} else {
Vertex.y = 1;
}
@@ -610,22 +568,22 @@ void RasterNode::calcTileVertex(int x, int y, DPoint& Vertex)
void RasterNode::calcTexCoords()
{
- DPoint textureSize = DPoint(m_pSurface->getTextureSize());
- DPoint imageSize = DPoint(m_pSurface->getSize());
- DPoint texCoordExtents = DPoint(imageSize.x/textureSize.x,
+ glm::vec2 textureSize = glm::vec2(m_pSurface->getTextureSize());
+ glm::vec2 imageSize = glm::vec2(m_pSurface->getSize());
+ glm::vec2 texCoordExtents = glm::vec2(imageSize.x/textureSize.x,
imageSize.y/textureSize.y);
- DPoint texSizePerTile;
+ glm::vec2 texSizePerTile;
if (m_TileSize.x == -1) {
texSizePerTile = texCoordExtents;
} else {
- texSizePerTile = DPoint(double(m_TileSize.x)/imageSize.x*texCoordExtents.x,
- double(m_TileSize.y)/imageSize.y*texCoordExtents.y);
+ texSizePerTile = glm::vec2(float(m_TileSize.x)/imageSize.x*texCoordExtents.x,
+ float(m_TileSize.y)/imageSize.y*texCoordExtents.y);
}
IntPoint numTiles = getNumTiles();
- vector<DPoint> texCoordLine(numTiles.x+1);
- m_TexCoords = std::vector<std::vector<DPoint> >
+ vector<glm::vec2> texCoordLine(numTiles.x+1);
+ m_TexCoords = std::vector<std::vector<glm::vec2> >
(numTiles.y+1, texCoordLine);
for (unsigned y = 0; y < m_TexCoords.size(); y++) {
for (unsigned x = 0; x < m_TexCoords[y].size(); x++) {
@@ -641,6 +599,5 @@ void RasterNode::calcTexCoords()
}
}
}
- m_bVertexArrayDirty = true;
}
}
diff --git a/src/player/RasterNode.h b/src/player/RasterNode.h
index 92d9ac4..1e86e17 100644
--- a/src/player/RasterNode.h
+++ b/src/player/RasterNode.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -27,10 +27,10 @@
#include "MaterialInfo.h"
#include "../avgconfigwrapper.h"
-#include "../base/Point.h"
-#include "../base/Triple.h"
+#include "../base/GLMHelper.h"
#include "../base/UTF8String.h"
#include "../graphics/GLContext.h"
+#include "../graphics/SubVertexArray.h"
#include <string>
@@ -46,19 +46,19 @@ typedef boost::shared_ptr<GLTexture> GLTexturePtr;
class FXNode;
typedef boost::shared_ptr<FXNode> FXNodePtr;
-typedef std::vector<std::vector<DPoint> > VertexGrid;
+typedef std::vector<std::vector<glm::vec2> > VertexGrid;
class AVG_API RasterNode: public AreaNode
{
public:
- static NodeDefinition createDefinition();
+ static void registerType();
virtual ~RasterNode ();
virtual void connectDisplay();
virtual void setArgs(const ArgList& args);
virtual void disconnect(bool bKill);
virtual void checkReload();
-
+
// Warping support.
VertexGrid getOrigVertexCoords();
VertexGrid getWarpedVertexCoords();
@@ -75,50 +75,55 @@ class AVG_API RasterNode: public AreaNode
const UTF8String& getMaskHRef() const;
void setMaskHRef(const UTF8String& sHref);
- const DPoint& getMaskPos() const;
- void setMaskPos(const DPoint& pos);
+ const glm::vec2& getMaskPos() const;
+ void setMaskPos(const glm::vec2& pos);
- const DPoint& getMaskSize() const;
- void setMaskSize(const DPoint& size);
+ const glm::vec2& getMaskSize() const;
+ void setMaskSize(const glm::vec2& size);
- void getElementsByPos(const DPoint& pos, std::vector<NodeWeakPtr>& pElements);
+ void getElementsByPos(const glm::vec2& pos, std::vector<NodePtr>& pElements);
- DTriple getGamma() const;
- void setGamma(const DTriple& gamma);
- DTriple getIntensity() const;
- void setIntensity(const DTriple& intensity);
- DTriple getContrast() const;
- void setContrast(const DTriple& contrast);
+ glm::vec3 getGamma() const;
+ void setGamma(const glm::vec3& gamma);
+ glm::vec3 getIntensity() const;
+ void setIntensity(const glm::vec3& intensity);
+ glm::vec3 getContrast() const;
+ void setContrast(const glm::vec3& contrast);
void setEffect(FXNodePtr pFXNode);
protected:
RasterNode();
- void blt32(const DPoint& destSize, double opacity, GLContext::BlendMode mode,
- bool bPremultipliedAlpha = false);
- void blta8(const DPoint& destSize, double opacity,
+
+ void calcVertexArray(const VertexArrayPtr& pVA,
+ const Pixel32& color = Pixel32(0,0,0,0));
+ void blt32(const glm::mat4& transform, const glm::vec2& destSize, float opacity,
+ GLContext::BlendMode mode, bool bPremultipliedAlpha = false);
+ void blta8(const glm::mat4& transform, const glm::vec2& destSize, float opacity,
const Pixel32& color, GLContext::BlendMode mode);
virtual OGLSurface * getSurface();
const MaterialInfo& getMaterial() const;
bool hasMask() const;
void setMaskCoords();
- void bind();
- void renderFX(const DPoint& destSize, const Pixel32& color,
- bool bPremultipliedAlpha);
+ void renderFX(const glm::vec2& destSize, const Pixel32& color,
+ bool bPremultipliedAlpha, bool bForceRender=false);
+
+ protected:
+ void newSurface();
+ void setupFX(bool bNewFX);
private:
void downloadMask();
virtual void calcMaskCoords();
- void checkMaskSupport(const std::string& sHref);
void checkDisplayAvailable(std::string sMsg);
- void setupFX(bool bNewFX);
- void blt(const DPoint& destSize, GLContext::BlendMode mode,
- double opacity, const Pixel32& color, bool bPremultipliedAlpha);
+ void blt(const glm::mat4& transform, const glm::vec2& destSize,
+ GLContext::BlendMode mode, float opacity, const Pixel32& color,
+ bool bPremultipliedAlpha);
IntPoint getNumTiles();
void calcVertexGrid(VertexGrid& grid);
- void calcTileVertex(int x, int y, DPoint& Vertex);
+ void calcTileVertex(int x, int y, glm::vec2& Vertex);
void calcTexCoords();
OGLSurface * m_pSurface;
@@ -131,20 +136,17 @@ class AVG_API RasterNode: public AreaNode
UTF8String m_sMaskHref;
std::string m_sMaskFilename;
BitmapPtr m_pMaskBmp;
- DPoint m_MaskPos;
- DPoint m_MaskSize;
+ glm::vec2 m_MaskPos;
+ glm::vec2 m_MaskSize;
- bool m_bBound;
-
IntPoint m_TileSize;
VertexGrid m_TileVertices;
- bool m_bVertexArrayDirty;
- VertexArray * m_pVertexes;
- std::vector<std::vector<DPoint> > m_TexCoords;
+ SubVertexArray m_SubVA;
+ std::vector<std::vector<glm::vec2> > m_TexCoords;
- DTriple m_Gamma;
- DTriple m_Intensity;
- DTriple m_Contrast;
+ glm::vec3 m_Gamma;
+ glm::vec3 m_Intensity;
+ glm::vec3 m_Contrast;
FBOPtr m_pFBO;
FXNodePtr m_pFXNode;
diff --git a/src/player/RectNode.cpp b/src/player/RectNode.cpp
index d7387df..980a957 100644
--- a/src/player/RectNode.cpp
+++ b/src/player/RectNode.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -21,7 +21,7 @@
#include "RectNode.h"
-#include "NodeDefinition.h"
+#include "TypeDefinition.h"
#include "../graphics/VertexArray.h"
#include "../base/Exception.h"
@@ -34,63 +34,66 @@ using namespace std;
namespace avg {
-NodeDefinition RectNode::createDefinition()
+void RectNode::registerType()
{
- double texCoords[] = {0, 0.25, 0.5, 0.75, 1};
- return NodeDefinition("rect", Node::buildNode<RectNode>)
- .extendDefinition(FilledVectorNode::createDefinition())
- .addArg(Arg<DPoint>("pos", DPoint(0,0), false, offsetof(RectNode, m_Rect.tl)))
- .addArg(Arg<DPoint>("size", DPoint(0,0)))
- .addArg(Arg<double>("angle", 0.0, false, offsetof(RectNode, m_Angle)))
- .addArg(Arg<vector<double> >("texcoords", vectorFromCArray(5, texCoords), false,
+ float texCoords[] = {0, 0.25f, 0.5f, 0.75f, 1};
+ TypeDefinition def = TypeDefinition("rect", "filledvectornode",
+ ExportedObject::buildObject<RectNode>)
+ .addArg(Arg<glm::vec2>("pos", glm::vec2(0,0), false,
+ offsetof(RectNode, m_Rect.tl)))
+ .addArg(Arg<glm::vec2>("size", glm::vec2(0,0)))
+ .addArg(Arg<float>("angle", 0.0f, false, offsetof(RectNode, m_Angle)))
+ .addArg(Arg<vector<float> >("texcoords", vectorFromCArray(5, texCoords), false,
offsetof(RectNode, m_TexCoords)))
;
+ TypeRegistry::get()->registerType(def);
}
RectNode::RectNode(const ArgList& args)
: FilledVectorNode(args)
{
args.setMembers(this);
- setSize(args.getArgVal<DPoint>("size"));
+ setSize(args.getArgVal<glm::vec2>("size"));
}
RectNode::~RectNode()
{
}
-const DPoint& RectNode::getPos() const
+const glm::vec2& RectNode::getPos() const
{
return m_Rect.tl;
}
-void RectNode::setPos(const DPoint& pt)
+void RectNode::setPos(const glm::vec2& pt)
{
- double w = m_Rect.width();
- double h = m_Rect.height();
+ float w = m_Rect.width();
+ float h = m_Rect.height();
m_Rect.tl = pt;
m_Rect.setWidth(w);
m_Rect.setHeight(h);
setDrawNeeded();
}
-DPoint RectNode::getSize() const
+glm::vec2 RectNode::getSize() const
{
return m_Rect.size();
}
-void RectNode::setSize(const DPoint& pt)
+void RectNode::setSize(const glm::vec2& pt)
{
m_Rect.setWidth(pt.x);
m_Rect.setHeight(pt.y);
+ notifySubscribers("SIZE_CHANGED", m_Rect.size());
setDrawNeeded();
}
-const vector<double>& RectNode::getTexCoords() const
+const vector<float>& RectNode::getTexCoords() const
{
return m_TexCoords;
}
-void RectNode::setTexCoords(const vector<double>& coords)
+void RectNode::setTexCoords(const vector<float>& coords)
{
if (coords.size() != 5) {
throw(Exception(AVG_ERR_OUT_OF_RANGE,
@@ -100,64 +103,76 @@ void RectNode::setTexCoords(const vector<double>& coords)
setDrawNeeded();
}
-double RectNode::getAngle() const
+float RectNode::getAngle() const
{
return m_Angle;
}
-void RectNode::setAngle(double angle)
+void RectNode::setAngle(float angle)
{
- m_Angle = fmod(angle, 2*M_PI);
+ m_Angle = fmod(angle, 2*PI);
setDrawNeeded();
}
-void RectNode::getElementsByPos(const DPoint& pos, vector<NodeWeakPtr>& pElements)
+glm::vec2 RectNode::toLocal(const glm::vec2& globalPos) const
{
- DPoint pivot = m_Rect.tl+m_Rect.size()/2;
- DPoint rpos = pos.getRotatedPivot(m_Angle, pivot);
- if (rpos.x >= m_Rect.tl.x && rpos.y >= m_Rect.tl.y && rpos.x < m_Rect.br.x &&
- rpos.y < m_Rect.br.y && reactsToMouseEvents())
+ glm::vec2 localPos = globalPos - m_Rect.tl;
+ glm::vec2 pivot = m_Rect.size()/2.f;
+ return getRotatedPivot(localPos, -m_Angle, pivot);
+}
+
+glm::vec2 RectNode::toGlobal(const glm::vec2& localPos) const
+{
+ glm::vec2 pivot = m_Rect.tl + m_Rect.size()/2.f;
+ glm::vec2 globalPos = getRotatedPivot(localPos, m_Angle, pivot);
+ return globalPos + m_Rect.tl;
+}
+
+void RectNode::getElementsByPos(const glm::vec2& pos, vector<NodePtr>& pElements)
+{
+ if (pos.x >= 0 && pos.y >= 0 && pos.x < m_Rect.size().x && pos.y < m_Rect.size().y
+ && reactsToMouseEvents())
{
- pElements.push_back(shared_from_this());
+ pElements.push_back(getSharedThis());
}
}
-void RectNode::calcVertexes(VertexArrayPtr& pVertexArray, Pixel32 color)
+void RectNode::calcVertexes(const VertexDataPtr& pVertexData, Pixel32 color)
{
- DPoint pivot = m_Rect.tl+m_Rect.size()/2;
+ glm::vec2 pivot = m_Rect.tl+m_Rect.size()/2.f;
- DPoint p1 = m_Rect.tl;
- DPoint p2(m_Rect.tl.x, m_Rect.br.y);
- DPoint p3 = m_Rect.br;
- DPoint p4(m_Rect.br.x, m_Rect.tl.y);
+ glm::vec2 p1 = m_Rect.tl;
+ glm::vec2 p2(m_Rect.tl.x, m_Rect.br.y);
+ glm::vec2 p3 = m_Rect.br;
+ glm::vec2 p4(m_Rect.br.x, m_Rect.tl.y);
- vector<DPoint> pts;
- pts.push_back(p1.getRotatedPivot(m_Angle, pivot));
- pts.push_back(p2.getRotatedPivot(m_Angle, pivot));
- pts.push_back(p3.getRotatedPivot(m_Angle, pivot));
- pts.push_back(p4.getRotatedPivot(m_Angle, pivot));
- calcPolyLine(pts, m_TexCoords, true, LJ_MITER, pVertexArray, color);
-}
-
-void RectNode::calcFillVertexes(VertexArrayPtr& pVertexArray, Pixel32 color)
-{
- DPoint pivot = m_Rect.tl+m_Rect.size()/2;
-
- DPoint p1 = m_Rect.tl;
- DPoint p2(m_Rect.tl.x, m_Rect.br.y);
- DPoint p3 = m_Rect.br;
- DPoint p4(m_Rect.br.x, m_Rect.tl.y);
- DPoint rp1 = p1.getRotatedPivot(m_Angle, pivot);
- DPoint rp2 = p2.getRotatedPivot(m_Angle, pivot);
- DPoint rp3 = p3.getRotatedPivot(m_Angle, pivot);
- DPoint rp4 = p4.getRotatedPivot(m_Angle, pivot);
- pVertexArray->appendPos(rp1, getFillTexCoord1(), color);
- DPoint blTexCoord = DPoint(getFillTexCoord1().x, getFillTexCoord2().y);
- pVertexArray->appendPos(rp2, blTexCoord, color);
- pVertexArray->appendPos(rp3, getFillTexCoord2(), color);
- DPoint trTexCoord = DPoint(getFillTexCoord2().x, getFillTexCoord1().y);
- pVertexArray->appendPos(rp4, trTexCoord, color);
- pVertexArray->appendQuadIndexes(1, 0, 2, 3);
+ vector<glm::vec2> pts;
+ pts.push_back(getRotatedPivot(p1, m_Angle, pivot));
+ pts.push_back(getRotatedPivot(p2, m_Angle, pivot));
+ pts.push_back(getRotatedPivot(p3, m_Angle, pivot));
+ pts.push_back(getRotatedPivot(p4, m_Angle, pivot));
+ calcPolyLine(pts, m_TexCoords, true, LJ_MITER, pVertexData, color);
+}
+
+void RectNode::calcFillVertexes(const VertexDataPtr& pVertexData, Pixel32 color)
+{
+ glm::vec2 pivot = m_Rect.tl+m_Rect.size()/2.f;
+
+ glm::vec2 p1 = m_Rect.tl;
+ glm::vec2 p2(m_Rect.tl.x, m_Rect.br.y);
+ glm::vec2 p3 = m_Rect.br;
+ glm::vec2 p4(m_Rect.br.x, m_Rect.tl.y);
+ glm::vec2 rp1 = getRotatedPivot(p1, m_Angle, pivot);
+ glm::vec2 rp2 = getRotatedPivot(p2, m_Angle, pivot);
+ glm::vec2 rp3 = getRotatedPivot(p3, m_Angle, pivot);
+ glm::vec2 rp4 = getRotatedPivot(p4, m_Angle, pivot);
+ pVertexData->appendPos(rp1, getFillTexCoord1(), color);
+ glm::vec2 blTexCoord = glm::vec2(getFillTexCoord1().x, getFillTexCoord2().y);
+ pVertexData->appendPos(rp2, blTexCoord, color);
+ pVertexData->appendPos(rp3, getFillTexCoord2(), color);
+ glm::vec2 trTexCoord = glm::vec2(getFillTexCoord2().x, getFillTexCoord1().y);
+ pVertexData->appendPos(rp4, trTexCoord, color);
+ pVertexData->appendQuadIndexes(1, 0, 2, 3);
}
}
diff --git a/src/player/RectNode.h b/src/player/RectNode.h
index 842bf35..f1a3c4e 100644
--- a/src/player/RectNode.h
+++ b/src/player/RectNode.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -32,33 +32,35 @@ namespace avg {
class AVG_API RectNode : public FilledVectorNode
{
public:
- static NodeDefinition createDefinition();
+ static void registerType();
RectNode(const ArgList& args);
virtual ~RectNode();
- const DPoint& getPos() const;
- void setPos(const DPoint& pt);
+ const glm::vec2& getPos() const;
+ void setPos(const glm::vec2& pt);
- DPoint getSize() const;
- void setSize(const DPoint& pt);
+ glm::vec2 getSize() const;
+ void setSize(const glm::vec2& pt);
- const std::vector<double>& getTexCoords() const;
- void setTexCoords(const std::vector<double>& coords);
+ const std::vector<float>& getTexCoords() const;
+ void setTexCoords(const std::vector<float>& coords);
- double getAngle() const;
- void setAngle(double angle);
+ float getAngle() const;
+ void setAngle(float angle);
- void getElementsByPos(const DPoint& pos, std::vector<NodeWeakPtr>& pElements);
+ glm::vec2 toLocal(const glm::vec2& globalPos) const;
+ glm::vec2 toGlobal(const glm::vec2& localPos) const;
+ void getElementsByPos(const glm::vec2& pos, std::vector<NodePtr>& pElements);
- virtual void calcVertexes(VertexArrayPtr& pVertexArray, Pixel32 color);
- virtual void calcFillVertexes(VertexArrayPtr& pVertexArray, Pixel32 color);
+ virtual void calcVertexes(const VertexDataPtr& pVertexData, Pixel32 color);
+ virtual void calcFillVertexes(const VertexDataPtr& pVertexData, Pixel32 color);
private:
- DRect m_Rect;
- std::vector<double> m_TexCoords;
+ FRect m_Rect;
+ std::vector<float> m_TexCoords;
- double m_Angle;
+ float m_Angle;
};
}
diff --git a/src/player/SDLDisplayEngine.cpp b/src/player/SDLDisplayEngine.cpp
index 0b6293f..74a3698 100644
--- a/src/player/SDLDisplayEngine.cpp
+++ b/src/player/SDLDisplayEngine.cpp
@@ -1,6 +1,6 @@
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -45,20 +45,19 @@
#include "../graphics/GLContext.h"
#include "../graphics/Filterflip.h"
#include "../graphics/Filterfliprgb.h"
-#include "../graphics/ShaderRegistry.h"
+#include "../graphics/Display.h"
+
+#include "../video/VideoDecoder.h"
#include "OGLSurface.h"
#include "OffscreenCanvas.h"
-#include <SDL/SDL.h>
-
#ifdef __APPLE__
#include <ApplicationServices/ApplicationServices.h>
#endif
-#ifdef linux
+
+#include <SDL/SDL.h>
#include <SDL/SDL_syswm.h>
-#include <X11/extensions/xf86vmode.h>
-#endif
#ifdef __APPLE__
#include <OpenGL/OpenGL.h>
@@ -68,6 +67,9 @@
#include <sys/ioctl.h>
#include <sys/fcntl.h>
#endif
+#ifdef AVG_ENABLE_XINERAMA
+#include <X11/extensions/Xinerama.h>
+#endif
#include <signal.h>
#include <iostream>
@@ -84,39 +86,43 @@ using namespace std;
namespace avg {
-double SDLDisplayEngine::s_RefreshRate = 0.0;
-
-void safeSetAttribute(SDL_GLattr attr, int value)
+void SDLDisplayEngine::initSDL()
{
- int err = SDL_GL_SetAttribute(attr, value);
+#ifdef __APPLE__
+ static bool bSDLInitialized = false;
+ if (!bSDLInitialized) {
+ CustomSDLMain();
+ bSDLInitialized = true;
+ }
+#endif
+#ifdef linux
+ // Disable all other video drivers (DirectFB, libcaca, ...) to avoid confusing
+ // error messages.
+ SDL_putenv((char*)"SDL_VIDEODRIVER=x11");
+#endif
+ int err = SDL_InitSubSystem(SDL_INIT_VIDEO);
if (err == -1) {
- throw Exception(AVG_ERR_VIDEO_GENERAL, SDL_GetError());
+ throw Exception(AVG_ERR_VIDEO_INIT_FAILED, SDL_GetError());
}
}
+void SDLDisplayEngine::quitSDL()
+{
+#ifndef _WIN32
+ SDL_QuitSubSystem(SDL_INIT_VIDEO);
+#endif
+}
+
SDLDisplayEngine::SDLDisplayEngine()
: IInputDevice(EXTRACT_INPUTDEVICE_CLASSNAME(SDLDisplayEngine)),
m_WindowSize(0,0),
- m_PPMM(0),
m_pScreen(0),
- m_VBMethod(VB_NONE),
- m_VBMod(0),
- m_bMouseOverApp(true),
- m_pLastMouseEvent(new MouseEvent(Event::CURSORMOTION, false, false, false,
- IntPoint(-1, -1), MouseEvent::NO_BUTTON, DPoint(-1, -1), 0)),
- m_NumMouseButtonsDown(0)
+ m_pLastMouseEvent(new MouseEvent(Event::CURSOR_MOTION, false, false, false,
+ IntPoint(-1, -1), MouseEvent::NO_BUTTON, glm::vec2(-1, -1), 0)),
+ m_pGLContext(0)
{
-#ifdef __APPLE__
- static bool bSDLInitialized = false;
- if (!bSDLInitialized) {
- CustomSDLMain();
- bSDLInitialized = true;
- }
-#endif
- if (SDL_InitSubSystem(SDL_INIT_VIDEO)==-1) {
- AVG_TRACE(Logger::ERROR, "Can't init SDL display subsystem.");
- exit(-1);
- }
+ initSDL();
+
m_Gamma[0] = 1.0;
m_Gamma[1] = 1.0;
m_Gamma[2] = 1.0;
@@ -125,144 +131,102 @@ SDLDisplayEngine::SDLDisplayEngine()
SDLDisplayEngine::~SDLDisplayEngine()
{
-#ifndef _WIN32
- SDL_QuitSubSystem(SDL_INIT_VIDEO);
-#endif
}
void SDLDisplayEngine::init(const DisplayParams& dp, GLConfig glConfig)
{
- calcScreenDimensions(dp.m_DotsPerMM);
+ // This "fixes" the default behaviour of SDL under x11, avoiding it
+ // to report relative mouse coordinates when going fullscreen and
+ // the mouse cursor is hidden (grabbed). So far libavg and apps based
+ // on it don't use relative coordinates.
+ setEnv("SDL_MOUSE_RELATIVE", "0");
+
+ if (m_Gamma[0] != 1.0f || m_Gamma[1] != 1.0f || m_Gamma[2] != 1.0f) {
+ internalSetGamma(1.0f, 1.0f, 1.0f);
+ }
stringstream ss;
if (dp.m_Pos.x != -1) {
ss << dp.m_Pos.x << "," << dp.m_Pos.y;
setEnv("SDL_VIDEO_WINDOW_POS", ss.str().c_str());
}
-#ifdef linux
- IntPoint oldWindowSize = m_WindowSize;
-#endif
- double aspectRatio = double(dp.m_Size.x)/double(dp.m_Size.y);
- if (dp.m_WindowSize == IntPoint(0, 0)) {
- m_WindowSize = dp.m_Size;
- } else if (dp.m_WindowSize.x == 0) {
- m_WindowSize.x = int(dp.m_WindowSize.y*aspectRatio);
- m_WindowSize.y = dp.m_WindowSize.y;
- } else {
- m_WindowSize.x = dp.m_WindowSize.x;
- m_WindowSize.y = int(dp.m_WindowSize.x/aspectRatio);
+ m_WindowSize = dp.m_WindowSize;
+ unsigned int Flags = 0;
+ if (dp.m_bFullscreen) {
+ Flags |= SDL_FULLSCREEN;
}
+ m_bIsFullscreen = dp.m_bFullscreen;
+ if (!dp.m_bHasWindowFrame) {
+ Flags |= SDL_NOFRAME;
+ }
+
+#ifndef linux
+ if (glConfig.m_bUseDebugContext) {
+ glConfig.m_bUseDebugContext = false;
+ }
switch (dp.m_BPP) {
- case 32:
- safeSetAttribute(SDL_GL_RED_SIZE, 8);
- safeSetAttribute(SDL_GL_GREEN_SIZE, 8);
- safeSetAttribute(SDL_GL_BLUE_SIZE, 8);
- safeSetAttribute(SDL_GL_BUFFER_SIZE, 32);
- break;
case 24:
- safeSetAttribute(SDL_GL_RED_SIZE, 8);
- safeSetAttribute(SDL_GL_GREEN_SIZE, 8);
- safeSetAttribute(SDL_GL_BLUE_SIZE, 8);
- safeSetAttribute(SDL_GL_BUFFER_SIZE, 24);
+ SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
+ SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
+ SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
+ SDL_GL_SetAttribute(SDL_GL_BUFFER_SIZE, 24);
break;
case 16:
- safeSetAttribute(SDL_GL_RED_SIZE, 5);
- safeSetAttribute(SDL_GL_GREEN_SIZE, 6);
- safeSetAttribute(SDL_GL_BLUE_SIZE, 5);
- safeSetAttribute(SDL_GL_BUFFER_SIZE, 16);
- break;
- case 15:
- safeSetAttribute(SDL_GL_RED_SIZE, 5);
- safeSetAttribute(SDL_GL_GREEN_SIZE, 5);
- safeSetAttribute(SDL_GL_BLUE_SIZE, 5);
- safeSetAttribute(SDL_GL_BUFFER_SIZE, 15);
+ SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
+ SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 6);
+ SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
+ SDL_GL_SetAttribute(SDL_GL_BUFFER_SIZE, 16);
break;
default:
- AVG_TRACE(Logger::ERROR, "Unsupported bpp " << dp.m_BPP <<
+ AVG_LOG_ERROR("Unsupported bpp " << dp.m_BPP <<
"in SDLDisplayEngine::init()");
exit(-1);
}
- safeSetAttribute(SDL_GL_DEPTH_SIZE, 24);
- safeSetAttribute(SDL_GL_STENCIL_SIZE, 8);
- safeSetAttribute(SDL_GL_DOUBLEBUFFER, 1);
+ SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 0);
+ SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8);
+ SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
+ SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL , 0);
+ Flags |= SDL_OPENGL;
- unsigned int Flags = SDL_OPENGL;
- if (dp.m_bFullscreen) {
- Flags |= SDL_FULLSCREEN;
- }
- m_bIsFullscreen = dp.m_bFullscreen;
-
- if (!dp.m_bHasWindowFrame) {
- Flags |= SDL_NOFRAME;
- }
-
- bool bAllMultisampleValuesTested = false;
m_pScreen = 0;
- while (!bAllMultisampleValuesTested && !m_pScreen) {
+ while (glConfig.m_MultiSampleSamples && !m_pScreen) {
if (glConfig.m_MultiSampleSamples > 1) {
- safeSetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
- safeSetAttribute(SDL_GL_MULTISAMPLESAMPLES, glConfig.m_MultiSampleSamples);
+ SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
+ SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES,
+ glConfig.m_MultiSampleSamples);
} else {
- safeSetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 0);
- safeSetAttribute(SDL_GL_MULTISAMPLESAMPLES, 0);
+ SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 0);
+ SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 0);
}
m_pScreen = SDL_SetVideoMode(m_WindowSize.x, m_WindowSize.y, dp.m_BPP, Flags);
if (!m_pScreen) {
- switch (glConfig.m_MultiSampleSamples) {
- case 1:
- bAllMultisampleValuesTested = true;
- break;
- case 2:
- glConfig.m_MultiSampleSamples = 1;
- break;
- case 4:
- glConfig.m_MultiSampleSamples = 2;
- break;
- case 8:
- glConfig.m_MultiSampleSamples = 4;
- break;
- default:
- glConfig.m_MultiSampleSamples = 8;
- break;
- }
+ glConfig.m_MultiSampleSamples = GLContext::nextMultiSampleValue(
+ glConfig.m_MultiSampleSamples);
}
}
+#else
+ // Linux version: Context created manually, not by SDL
+ m_pScreen = SDL_SetVideoMode(m_WindowSize.x, m_WindowSize.y, dp.m_BPP, Flags);
+#endif
if (!m_pScreen) {
throw Exception(AVG_ERR_UNSUPPORTED, string("Setting SDL video mode failed: ")
+ SDL_GetError() + ". (size=" + toString(m_WindowSize) + ", bpp=" +
- toString(dp.m_BPP) + ", multisamplesamples=" +
- toString(glConfig.m_MultiSampleSamples) + ").");
+ toString(dp.m_BPP) + ").");
}
- m_pGLContext = GLContextPtr(new GLContext(true, glConfig));
+ SDL_SysWMinfo info;
+ SDL_VERSION(&info.version);
+ int rc = SDL_GetWMInfo(&info);
+ AVG_ASSERT(rc != -1);
+ m_pGLContext = GLContext::create(glConfig, m_WindowSize, &info);
+ GLContext::setMain(m_pGLContext);
#if defined(HAVE_XI2_1) || defined(HAVE_XI2_2)
SDL_EventState(SDL_SYSWMEVENT, SDL_ENABLE);
m_pXIMTInputDevice = 0;
#endif
SDL_WM_SetCaption("libavg", 0);
- calcRefreshRate();
+ Display::get()->getRefreshRate();
- glEnable(GL_BLEND);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "init: glEnable(GL_BLEND)");
- glShadeModel(GL_FLAT);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "init: glShadeModel(GL_FLAT)");
- glDisable(GL_DEPTH_TEST);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "init: glDisable(GL_DEPTH_TEST)");
- glEnable(GL_STENCIL_TEST);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "init: glEnable(GL_STENCIL_TEST)");
- glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "init: glTexEnvf()");
- glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
- glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
- glPixelStorei(GL_PACK_ROW_LENGTH, 0);
- glPixelStorei(GL_PACK_ALIGNMENT, 1);
- if (!queryOGLExtension("GL_ARB_vertex_buffer_object")) {
- throw Exception(AVG_ERR_UNSUPPORTED,
- "Graphics driver lacks vertex buffer support, unable to initialize graphics.");
- }
-
- glEnableClientState(GL_VERTEX_ARRAY);
- glEnableClientState(GL_TEXTURE_COORD_ARRAY);
setGamma(dp.m_Gamma[0], dp.m_Gamma[1], dp.m_Gamma[2]);
showCursor(dp.m_bShowCursor);
if (dp.m_Framerate == 0) {
@@ -275,11 +239,31 @@ void SDLDisplayEngine::init(const DisplayParams& dp, GLConfig glConfig)
// SDL sets up a signal handler we really don't want.
signal(SIGSEGV, SIG_DFL);
m_pGLContext->logConfig();
+ VideoDecoder::logConfig();
SDL_EnableUNICODE(1);
- if (m_pGLContext->isUsingShaders()) {
- OGLSurface::createShader();
+}
+
+IntPoint SDLDisplayEngine::calcWindowSize(const DisplayParams& dp) const
+{
+ float aspectRatio = float(dp.m_Size.x)/float(dp.m_Size.y);
+ IntPoint windowSize;
+ if (dp.m_WindowSize == IntPoint(0, 0)) {
+ windowSize = dp.m_Size;
+ } else if (dp.m_WindowSize.x == 0) {
+ windowSize.x = int(dp.m_WindowSize.y*aspectRatio);
+ windowSize.y = dp.m_WindowSize.y;
+ } else {
+ windowSize.x = dp.m_WindowSize.x;
+ windowSize.y = int(dp.m_WindowSize.x/aspectRatio);
}
+ AVG_ASSERT(windowSize.x != 0 && windowSize.y != 0);
+ return windowSize;
+}
+
+void SDLDisplayEngine::setWindowTitle(const string& sTitle)
+{
+ SDL_WM_SetCaption(sTitle.c_str(), 0);
}
#ifdef _WIN32
@@ -288,37 +272,28 @@ void SDLDisplayEngine::init(const DisplayParams& dp, GLConfig glConfig)
void SDLDisplayEngine::teardown()
{
if (m_pScreen) {
- if (m_Gamma[0] != 1.0 || m_Gamma[1] != 1.0 || m_Gamma[2] != 1.0) {
- SDL_SetGamma(1.0, 1.0, 1.0);
- }
#ifdef linux
// Workaround for broken mouse cursor on exit under Ubuntu 8.04.
SDL_ShowCursor(SDL_ENABLE);
-// SDL_SetVideoMode(m_WindowWidth, m_WindowHeight, 24, 0);
#endif
m_pScreen = 0;
- m_pGLContext = GLContextPtr();
- }
-}
-
-double SDLDisplayEngine::getRefreshRate()
-{
- if (s_RefreshRate == 0.0) {
- calcRefreshRate();
+ if (m_pGLContext) {
+ delete m_pGLContext;
+ m_pGLContext = 0;
+ }
+ GLContext::setMain(0);
}
- return s_RefreshRate;
}
-void SDLDisplayEngine::setGamma(double red, double green, double blue)
+void SDLDisplayEngine::setGamma(float red, float green, float blue)
{
if (red > 0) {
- AVG_TRACE(Logger::CONFIG, "Setting gamma to " << red << ", " << green << ", " << blue);
- int err = SDL_SetGamma(float(red), float(green), float(blue));
+ bool bOk = internalSetGamma(red, green, blue);
m_Gamma[0] = red;
m_Gamma[1] = green;
m_Gamma[2] = blue;
- if (err == -1) {
- AVG_TRACE(Logger::WARNING, "Unable to set display gamma.");
+ if (!bOk) {
+ AVG_LOG_WARNING("Unable to set display gamma.");
}
}
}
@@ -333,32 +308,17 @@ int SDLDisplayEngine::getKeyModifierState() const
return SDL_GetModState();
}
-void SDLDisplayEngine::calcScreenDimensions(double dotsPerMM)
+bool SDLDisplayEngine::internalSetGamma(float red, float green, float blue)
{
- if (dotsPerMM != 0) {
- const SDL_VideoInfo* pInfo = SDL_GetVideoInfo();
- m_ScreenResolution = IntPoint(pInfo->current_w, pInfo->current_h);
- m_PPMM = dotsPerMM;
- }
-
- if (m_PPMM == 0) {
- const SDL_VideoInfo* pInfo = SDL_GetVideoInfo();
- m_ScreenResolution = IntPoint(pInfo->current_w, pInfo->current_h);
-#ifdef WIN32
- HDC hdc = CreateDC("DISPLAY", NULL, NULL, NULL);
- m_PPMM = GetDeviceCaps(hdc, LOGPIXELSX)/25.4;
+#ifdef __APPLE__
+ // Workaround for broken SDL_SetGamma for libSDL 1.2.15 under Lion
+ CGError err = CGSetDisplayTransferByFormula(kCGDirectMainDisplay, 0, 1, 1/red,
+ 0, 1, 1/green, 0, 1, 1/blue);
+ return (err == CGDisplayNoErr);
#else
- #ifdef linux
- Display * pDisplay = XOpenDisplay(0);
- DPoint displayMM(DisplayWidthMM(pDisplay,0), DisplayHeightMM(pDisplay,0));
- #elif defined __APPLE__
- CGSize size = CGDisplayScreenSize(CGMainDisplayID());
- DPoint displayMM(size.width, size.height);
- #endif
- // Non-Square pixels cause errors here. We'll fix that when it happens.
- m_PPMM = m_ScreenResolution.x/displayMM.x;
+ int err = SDL_SetGamma(float(red), float(green), float(blue));
+ return (err != -1);
#endif
- }
}
static ProfilingZoneID SwapBufferProfilingZone("Render - swap buffers");
@@ -366,9 +326,12 @@ static ProfilingZoneID SwapBufferProfilingZone("Render - swap buffers");
void SDLDisplayEngine::swapBuffers()
{
ScopeTimer timer(SwapBufferProfilingZone);
+#ifdef linux
+ m_pGLContext->swapBuffers();
+#else
SDL_GL_SwapBuffers();
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "swapBuffers()");
- AVG_TRACE(Logger::BLTS, "GL SwapBuffers");
+#endif
+ GLContext::checkError("swapBuffers()");
}
void SDLDisplayEngine::showCursor(bool bShow)
@@ -391,24 +354,35 @@ void SDLDisplayEngine::showCursor(bool bShow)
BitmapPtr SDLDisplayEngine::screenshot(int buffer)
{
- BitmapPtr pBmp (new Bitmap(m_WindowSize, B8G8R8X8, "screenshot"));
- string sTmp;
- bool bBroken = getEnv("AVG_BROKEN_READBUFFER", sTmp);
- GLenum buf = buffer;
- if (!buffer) {
- if (bBroken) {
- // Workaround for buggy GL_FRONT on some machines.
- buf = GL_BACK;
- } else {
- buf = GL_FRONT;
+ BitmapPtr pBmp;
+ glproc::BindFramebuffer(GL_FRAMEBUFFER, 0);
+ if (m_pGLContext->isGLES()) {
+ pBmp = BitmapPtr(new Bitmap(m_WindowSize, R8G8B8X8, "screenshot"));
+ glReadPixels(0, 0, m_WindowSize.x, m_WindowSize.y, GL_RGBA, GL_UNSIGNED_BYTE,
+ pBmp->getPixels());
+ GLContext::checkError("SDLDisplayEngine::screenshot:glReadPixels()");
+ } else {
+#ifndef AVG_ENABLE_EGL
+ pBmp = BitmapPtr(new Bitmap(m_WindowSize, B8G8R8X8, "screenshot"));
+ string sTmp;
+ bool bBroken = getEnv("AVG_BROKEN_READBUFFER", sTmp);
+ GLenum buf = buffer;
+ if (!buffer) {
+ if (bBroken) {
+ // Workaround for buggy GL_FRONT on some machines.
+ buf = GL_BACK;
+ } else {
+ buf = GL_FRONT;
+ }
}
+ glReadBuffer(buf);
+ GLContext::checkError("SDLDisplayEngine::screenshot:glReadBuffer()");
+ glproc::BindBuffer(GL_PIXEL_PACK_BUFFER, 0);
+ glReadPixels(0, 0, m_WindowSize.x, m_WindowSize.y, GL_BGRA, GL_UNSIGNED_BYTE,
+ pBmp->getPixels());
+ GLContext::checkError("SDLDisplayEngine::screenshot:glReadPixels()");
+#endif
}
- glReadBuffer(buf);
- glproc::BindBuffer(GL_PIXEL_PACK_BUFFER_EXT, 0);
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "SDLDisplayEngine::screenshot:glReadBuffer()");
- glReadPixels(0, 0, m_WindowSize.x, m_WindowSize.y, GL_BGRA, GL_UNSIGNED_BYTE,
- pBmp->getPixels());
- OGLErrorCheck(AVG_ERR_VIDEO_GENERAL, "SDLDisplayEngine::screenshot:glReadPixels()");
FilterFlip().applyInPlace(pBmp);
return pBmp;
}
@@ -418,172 +392,6 @@ IntPoint SDLDisplayEngine::getSize()
return m_Size;
}
-void SDLDisplayEngine::initMacVBlank(int rate)
-{
-#ifdef __APPLE__
- CGLContextObj context = CGLGetCurrentContext();
- AVG_ASSERT (context);
-#if MAC_OS_X_VERSION_10_5
- GLint l = rate;
-#else
- long l = rate;
-#endif
- if (rate > 1) {
- AVG_TRACE(Logger::WARNING,
- "VBlank rate set to " << rate
- << " but Mac OS X only supports 1. Assuming 1.");
- l = 1;
- }
- CGLError err = CGLSetParameter(context, kCGLCPSwapInterval, &l);
- AVG_ASSERT(!err);
-#endif
-}
-
-bool SDLDisplayEngine::initVBlank(int rate)
-{
- if (rate > 0) {
-#ifdef __APPLE__
- initMacVBlank(rate);
- m_VBMethod = VB_APPLE;
-#elif defined _WIN32
- if (queryOGLExtension("WGL_EXT_swap_control")) {
- glproc::SwapIntervalEXT(rate);
- m_VBMethod = VB_WIN;
- } else {
- AVG_TRACE(Logger::WARNING,
- "Windows VBlank setup failed: OpenGL Extension not supported.");
- m_VBMethod = VB_NONE;
- }
-#else
- if (getenv("__GL_SYNC_TO_VBLANK") != 0) {
- AVG_TRACE(Logger::WARNING,
- "__GL_SYNC_TO_VBLANK set. This interferes with libavg vblank handling.");
- m_VBMethod = VB_NONE;
- } else {
- if (queryGLXExtension("GLX_SGI_swap_control")) {
- m_VBMethod = VB_SGI;
- glproc::SwapIntervalSGI(rate);
-
- } else {
- AVG_TRACE(Logger::WARNING,
- "Linux VBlank setup failed: OpenGL Extension not supported.");
- m_VBMethod = VB_NONE;
- }
- }
-#endif
- } else {
- switch (m_VBMethod) {
- case VB_APPLE:
- initMacVBlank(0);
- break;
- case VB_WIN:
-#ifdef _WIN32
- glproc::SwapIntervalEXT(0);
-#endif
- break;
- case VB_SGI:
-#ifdef linux
- if (queryGLXExtension("GLX_SGI_swap_control")) {
- glproc::SwapIntervalSGI(rate);
- }
-#endif
- break;
- default:
- break;
- }
- m_VBMethod = VB_NONE;
- }
- switch(m_VBMethod) {
- case VB_SGI:
- AVG_TRACE(Logger::CONFIG,
- " Using SGI OpenGL extension for vertical blank support.");
- break;
- case VB_APPLE:
- AVG_TRACE(Logger::CONFIG, " Using Apple GL vertical blank support.");
- break;
- case VB_WIN:
- AVG_TRACE(Logger::CONFIG, " Using Windows GL vertical blank support.");
- break;
- case VB_NONE:
- AVG_TRACE(Logger::CONFIG, " Vertical blank support disabled.");
- break;
- default:
- AVG_TRACE(Logger::WARNING, " Illegal vblank enum value.");
- }
- return m_VBMethod != VB_NONE;
-}
-
-bool SDLDisplayEngine::vbWait(int rate)
-{
- switch(m_VBMethod) {
- case VB_SGI:
- case VB_APPLE:
- case VB_WIN:
- return true;
- case VB_NONE:
- default:
- AVG_ASSERT(false);
- return false;
- }
-}
-
-void SDLDisplayEngine::calcRefreshRate()
-{
- double lastRefreshRate = s_RefreshRate;
- s_RefreshRate = 0;
-#ifdef __APPLE__
- CFDictionaryRef modeInfo = CGDisplayCurrentMode(CGMainDisplayID());
- if (modeInfo) {
- CFNumberRef value = (CFNumberRef) CFDictionaryGetValue(modeInfo,
- kCGDisplayRefreshRate);
- if (value) {
- CFNumberGetValue(value, kCFNumberIntType, &s_RefreshRate);
- if (s_RefreshRate < 1.0) {
- AVG_TRACE(Logger::CONFIG,
- "This seems to be a TFT screen, assuming 60 Hz refresh rate.");
- s_RefreshRate = 60;
- }
- } else {
- AVG_TRACE(Logger::WARNING,
- "Apple refresh rate calculation (CFDictionaryGetValue) failed");
- }
- } else {
- AVG_TRACE(Logger::WARNING,
- "Apple refresh rate calculation (CGDisplayCurrentMode) failed");
- }
-#elif defined _WIN32
- // This isn't correct for multi-monitor systems.
- HDC hDC = CreateDC("DISPLAY", NULL, NULL, NULL);
- s_RefreshRate = GetDeviceCaps(hDC, VREFRESH);
- if (s_RefreshRate < 2) {
- s_RefreshRate = 60;
- }
- DeleteDC(hDC);
-#else
- Display * pDisplay = XOpenDisplay(0);
- int pixelClock;
- XF86VidModeModeLine modeLine;
- bool bOK = XF86VidModeGetModeLine (pDisplay, DefaultScreen(pDisplay),
- &pixelClock, &modeLine);
- if (!bOK) {
- AVG_TRACE (Logger::WARNING,
- "Could not get current refresh rate (XF86VidModeGetModeLine failed).");
- AVG_TRACE (Logger::WARNING,
- "Defaulting to 60 Hz refresh rate.");
- }
- double HSyncRate = pixelClock*1000.0/modeLine.htotal;
- s_RefreshRate = HSyncRate/modeLine.vtotal;
- XCloseDisplay(pDisplay);
-#endif
- if (s_RefreshRate == 0 || isnan(s_RefreshRate)) {
- s_RefreshRate = 60;
- }
- if (lastRefreshRate != s_RefreshRate) {
- AVG_TRACE(Logger::CONFIG, "Vertical Refresh Rate: " << s_RefreshRate);
- }
-
-}
-
vector<long> SDLDisplayEngine::KeyCodeTranslationTable(SDLK_LAST, key::KEY_UNKNOWN);
const char * getEventTypeName(unsigned char type)
@@ -627,12 +435,14 @@ vector<EventPtr> SDLDisplayEngine::pollEvents()
SDL_Event sdlEvent;
vector<EventPtr> events;
+ int numEvents = 0;
while (SDL_PollEvent(&sdlEvent)) {
+ numEvents++;
EventPtr pNewEvent;
switch (sdlEvent.type) {
case SDL_MOUSEMOTION:
- if (m_bMouseOverApp) {
- pNewEvent = createMouseEvent(Event::CURSORMOTION, sdlEvent,
+ {
+ pNewEvent = createMouseEvent(Event::CURSOR_MOTION, sdlEvent,
MouseEvent::NO_BUTTON);
CursorEventPtr pNewCursorEvent =
boost::dynamic_pointer_cast<CursorEvent>(pNewEvent);
@@ -646,10 +456,10 @@ vector<EventPtr> SDLDisplayEngine::pollEvents()
}
break;
case SDL_MOUSEBUTTONDOWN:
- pNewEvent = createMouseButtonEvent(Event::CURSORDOWN, sdlEvent);
+ pNewEvent = createMouseButtonEvent(Event::CURSOR_DOWN, sdlEvent);
break;
case SDL_MOUSEBUTTONUP:
- pNewEvent = createMouseButtonEvent(Event::CURSORUP, sdlEvent);
+ pNewEvent = createMouseButtonEvent(Event::CURSOR_UP, sdlEvent);
break;
case SDL_JOYAXISMOTION:
// pNewEvent = createAxisEvent(sdlEvent));
@@ -661,10 +471,10 @@ vector<EventPtr> SDLDisplayEngine::pollEvents()
// pNewEvent = createButtonEvent(Event::BUTTON_UP, sdlEvent));
break;
case SDL_KEYDOWN:
- pNewEvent = createKeyEvent(Event::KEYDOWN, sdlEvent);
+ pNewEvent = createKeyEvent(Event::KEY_DOWN, sdlEvent);
break;
case SDL_KEYUP:
- pNewEvent = createKeyEvent(Event::KEYUP, sdlEvent);
+ pNewEvent = createKeyEvent(Event::KEY_UP, sdlEvent);
break;
case SDL_QUIT:
pNewEvent = EventPtr(new Event(Event::QUIT, Event::NONE));
@@ -690,6 +500,10 @@ vector<EventPtr> SDLDisplayEngine::pollEvents()
events.push_back(pNewEvent);
}
}
+ if (numEvents > 124) {
+ AVG_TRACE(Logger::category::EVENTS, Logger::severity::WARNING,
+ "SDL Event queue full, dropping events.");
+ }
return events;
}
@@ -706,13 +520,13 @@ EventPtr SDLDisplayEngine::createMouseEvent(Event::Type type, const SDL_Event& s
Uint8 buttonState = SDL_GetMouseState(&x, &y);
x = int((x*m_Size.x)/m_WindowSize.x);
y = int((y*m_Size.y)/m_WindowSize.y);
- DPoint lastMousePos = m_pLastMouseEvent->getPos();
- DPoint speed;
+ glm::vec2 lastMousePos = m_pLastMouseEvent->getPos();
+ glm::vec2 speed;
if (lastMousePos.x == -1) {
- speed = DPoint(0,0);
+ speed = glm::vec2(0,0);
} else {
- double lastFrameTime = 1000/getEffectiveFramerate();
- speed = DPoint(x-lastMousePos.x, y-lastMousePos.y)/lastFrameTime;
+ float lastFrameTime = 1000/getEffectiveFramerate();
+ speed = glm::vec2(x-lastMousePos.x, y-lastMousePos.y)/lastFrameTime;
}
MouseEventPtr pEvent(new MouseEvent(type, (buttonState & SDL_BUTTON(1)) != 0,
(buttonState & SDL_BUTTON(2)) != 0, (buttonState & SDL_BUTTON(3)) != 0,
@@ -795,7 +609,8 @@ EventPtr SDLDisplayEngine::createKeyEvent(Event::Type type, const SDL_Event& sdl
KeyEventPtr pEvent(new KeyEvent(type,
sdlEvent.key.keysym.scancode, keyCode,
- SDL_GetKeyName(sdlEvent.key.keysym.sym), sdlEvent.key.keysym.unicode, modifiers));
+ SDL_GetKeyName(sdlEvent.key.keysym.sym), sdlEvent.key.keysym.unicode,
+ modifiers));
return pEvent;
}
@@ -1047,32 +862,4 @@ bool SDLDisplayEngine::isFullscreen() const
return m_bIsFullscreen;
}
-IntPoint SDLDisplayEngine::getScreenResolution()
-{
- calcScreenDimensions();
- return m_ScreenResolution;
-}
-
-double SDLDisplayEngine::getPixelsPerMM()
-{
- calcScreenDimensions();
-
- return m_PPMM;
-}
-
-DPoint SDLDisplayEngine::getPhysicalScreenDimensions()
-{
- calcScreenDimensions();
- DPoint size;
- DPoint screenRes = DPoint(getScreenResolution());
- size.x = screenRes.x/m_PPMM;
- size.y = screenRes.y/m_PPMM;
- return size;
-}
-
-void SDLDisplayEngine::assumePixelsPerMM(double ppmm)
-{
- m_PPMM = ppmm;
-}
-
}
diff --git a/src/player/SDLDisplayEngine.h b/src/player/SDLDisplayEngine.h
index 7a824cb..90f31ed 100644
--- a/src/player/SDLDisplayEngine.h
+++ b/src/player/SDLDisplayEngine.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -44,19 +44,22 @@ class XInputMTInputDevice;
class MouseEvent;
typedef boost::shared_ptr<class MouseEvent> MouseEventPtr;
class GLContext;
-typedef boost::shared_ptr<class GLContext> GLContextPtr;
class AVG_API SDLDisplayEngine: public DisplayEngine, public IInputDevice
{
public:
+ static void initSDL();
+ static void quitSDL();
SDLDisplayEngine();
virtual ~SDLDisplayEngine();
virtual void init(const DisplayParams& dp, GLConfig glConfig);
+ IntPoint calcWindowSize(const DisplayParams& dp) const;
+
+ void setWindowTitle(const std::string& sTitle);
// From DisplayEngine
virtual void teardown();
- virtual double getRefreshRate();
- virtual void setGamma(double red, double green, double blue);
+ virtual void setGamma(float red, float green, float blue);
virtual void setMousePos(const IntPoint& pos);
virtual int getKeyModifierState() const;
@@ -71,54 +74,32 @@ class AVG_API SDLDisplayEngine: public DisplayEngine, public IInputDevice
const IntPoint& getWindowSize() const;
bool isFullscreen() const;
- IntPoint getScreenResolution();
- double getPixelsPerMM();
- DPoint getPhysicalScreenDimensions();
- void assumePixelsPerMM(double ppmm);
virtual void swapBuffers();
private:
- void initSDL(int width, int height, bool isFullscreen, int bpp);
void initTranslationTable();
- void calcScreenDimensions(double dotsPerMM=0);
+
+ bool internalSetGamma(float red, float green, float blue);
EventPtr createMouseEvent
(Event::Type Type, const SDL_Event & SDLEvent, long Button);
- EventPtr createMouseButtonEvent
- (Event::Type Type, const SDL_Event & SDLEvent);
- EventPtr createKeyEvent
- (Event::Type Type, const SDL_Event & SDLEvent);
+ EventPtr createMouseButtonEvent(Event::Type Type, const SDL_Event & SDLEvent);
+ EventPtr createKeyEvent(Event::Type Type, const SDL_Event & SDLEvent);
IntPoint m_Size;
bool m_bIsFullscreen;
IntPoint m_WindowSize;
- IntPoint m_ScreenResolution;
- double m_PPMM;
SDL_Surface * m_pScreen;
- // Vertical blank stuff.
- virtual bool initVBlank(int rate);
- void initMacVBlank(int rate);
- bool vbWait(int rate);
- enum VBMethod {VB_SGI, VB_APPLE, VB_WIN, VB_NONE};
- VBMethod m_VBMethod;
- int m_VBMod;
- int m_LastVBCount;
-
- static void calcRefreshRate();
- static double s_RefreshRate;
-
// Event handling.
- bool m_bMouseOverApp;
MouseEventPtr m_pLastMouseEvent;
- int m_NumMouseButtonsDown;
static std::vector<long> KeyCodeTranslationTable;
XInputMTInputDevice * m_pXIMTInputDevice;
- GLContextPtr m_pGLContext;
+ GLContext* m_pGLContext;
- double m_Gamma[3];
+ float m_Gamma[3];
};
typedef boost::shared_ptr<SDLDisplayEngine> SDLDisplayEnginePtr;
diff --git a/src/player/SVG.cpp b/src/player/SVG.cpp
index 2a69560..9e778fa 100644
--- a/src/player/SVG.cpp
+++ b/src/player/SVG.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -30,42 +30,40 @@
#include "../graphics/PixelFormat.h"
#include "../graphics/Filterfill.h"
+#include "../graphics/Filterfliprgb.h"
#include "../graphics/FilterUnmultiplyAlpha.h"
+#include "../graphics/BitmapLoader.h"
#include "OGLSurface.h"
#include "Player.h"
#include "ImageNode.h"
#include <glib-object.h>
+
+#ifndef RSVG_CAIRO_H
#include <librsvg/rsvg-cairo.h>
+#endif
+
#include <cairo.h>
#include <iostream>
-using namespace boost::python;
using namespace std;
namespace avg {
-bool SVG::s_RSVGInitialized = false;
-
SVG::SVG(const UTF8String& sFilename, bool bUnescapeIllustratorIDs)
: m_sFilename(sFilename),
m_bUnescapeIllustratorIDs(bUnescapeIllustratorIDs)
{
- if (!s_RSVGInitialized) {
- rsvg_init();
- s_RSVGInitialized = true;
- }
-
- GError* pErr = new GError;
+ GError* pErr = 0;
m_pRSVG = rsvg_handle_new_from_file(m_sFilename.c_str(), &pErr);
if (!m_pRSVG) {
throw Exception(AVG_ERR_INVALID_ARGS,
string("Could not open svg file: ") + m_sFilename);
+ g_error_free(pErr);
}
- delete pErr;
}
SVG::~SVG()
@@ -78,52 +76,58 @@ BitmapPtr SVG::renderElement(const UTF8String& sElementID)
return renderElement(sElementID, 1);
}
-BitmapPtr SVG::renderElement(const UTF8String& sElementID, const DPoint& size)
+BitmapPtr SVG::renderElement(const UTF8String& sElementID, const glm::vec2& size)
{
SVGElementPtr pElement = getElement(sElementID);
- DPoint elementSize = pElement->getSize();
+ glm::vec2 elementSize = pElement->getSize();
return internalRenderElement(pElement, size, elementSize);
}
-BitmapPtr SVG::renderElement(const UTF8String& sElementID, double scale)
+BitmapPtr SVG::renderElement(const UTF8String& sElementID, float scale)
{
SVGElementPtr pElement = getElement(sElementID);
- DPoint size = pElement->getSize();
- DPoint renderSize = size * scale;
+ glm::vec2 size = pElement->getSize();
+ glm::vec2 renderSize = size * scale;
return internalRenderElement(pElement, renderSize, size);
}
-NodePtr SVG::createImageNode(const UTF8String& sElementID, const dict& nodeAttrs)
+NodePtr SVG::createImageNode(const UTF8String& sElementID, const py::dict& nodeAttrs)
{
BitmapPtr pBmp = renderElement(sElementID);
return createImageNodeFromBitmap(pBmp, nodeAttrs);
}
-NodePtr SVG::createImageNode(const UTF8String& sElementID, const dict& nodeAttrs,
- const DPoint& renderSize)
+NodePtr SVG::createImageNode(const UTF8String& sElementID, const py::dict& nodeAttrs,
+ const glm::vec2& renderSize)
{
BitmapPtr pBmp = renderElement(sElementID, renderSize);
return createImageNodeFromBitmap(pBmp, nodeAttrs);
}
-NodePtr SVG::createImageNode(const UTF8String& sElementID, const dict& nodeAttrs,
- double scale)
+NodePtr SVG::createImageNode(const UTF8String& sElementID, const py::dict& nodeAttrs,
+ float scale)
{
BitmapPtr pBmp = renderElement(sElementID, scale);
return createImageNodeFromBitmap(pBmp, nodeAttrs);
}
-DPoint SVG::getElementSize(const UTF8String& sElementID)
+glm::vec2 SVG::getElementPos(const UTF8String& sElementID)
+{
+ SVGElementPtr pElement = getElement(sElementID);
+ return pElement->getPos();
+}
+
+glm::vec2 SVG::getElementSize(const UTF8String& sElementID)
{
SVGElementPtr pElement = getElement(sElementID);
return pElement->getSize();
}
BitmapPtr SVG::internalRenderElement(const SVGElementPtr& pElement,
- const DPoint& renderSize, const DPoint& size)
+ const glm::vec2& renderSize, const glm::vec2& size)
{
- DPoint pos = pElement->getPos();
- DPoint scale(renderSize.x/size.x, renderSize.y/size.y);
+ glm::vec2 pos = pElement->getPos();
+ glm::vec2 scale(renderSize.x/size.x, renderSize.y/size.y);
IntPoint boundingBox = IntPoint(renderSize) +
IntPoint(int(scale.x+0.5), int(scale.y+0.5));
BitmapPtr pBmp(new Bitmap(boundingBox, B8G8R8A8));
@@ -143,11 +147,15 @@ BitmapPtr SVG::internalRenderElement(const SVGElementPtr& pElement,
cairo_surface_destroy(pSurface);
cairo_destroy(pCairo);
-
+
+ if (!BitmapLoader::get()->isBlueFirst()) {
+ FilterFlipRGB().applyInPlace(pBmp);
+ }
+
return pBmp;
}
-NodePtr SVG::createImageNodeFromBitmap(BitmapPtr pBmp, const dict& nodeAttrs)
+NodePtr SVG::createImageNodeFromBitmap(BitmapPtr pBmp, const py::dict& nodeAttrs)
{
ImageNodePtr pNode = boost::dynamic_pointer_cast<ImageNode>(
Player::get()->createNode("image", nodeAttrs));
diff --git a/src/player/SVG.h b/src/player/SVG.h
index cc38620..73f0d55 100644
--- a/src/player/SVG.h
+++ b/src/player/SVG.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -48,29 +48,28 @@ public:
virtual ~SVG();
BitmapPtr renderElement(const UTF8String& sElementID);
- BitmapPtr renderElement(const UTF8String& sElementID, const DPoint& size);
- BitmapPtr renderElement(const UTF8String& sElementID, double scale);
+ BitmapPtr renderElement(const UTF8String& sElementID, const glm::vec2& size);
+ BitmapPtr renderElement(const UTF8String& sElementID, float scale);
NodePtr createImageNode(const UTF8String& sElementID,
- const boost::python::dict& nodeAttrs);
+ const py::dict& nodeAttrs);
NodePtr createImageNode(const UTF8String& sElementID,
- const boost::python::dict& nodeAttrs, const DPoint& renderSize);
+ const py::dict& nodeAttrs, const glm::vec2& renderSize);
NodePtr createImageNode(const UTF8String& sElementID,
- const boost::python::dict& nodeAttrs, double scale);
- DPoint getElementSize(const UTF8String& sElementID);
+ const py::dict& nodeAttrs, float scale);
+ glm::vec2 getElementPos(const UTF8String& sElementID);
+ glm::vec2 getElementSize(const UTF8String& sElementID);
private:
BitmapPtr internalRenderElement(const SVGElementPtr& pElement,
- const DPoint& renderSize, const DPoint& size);
+ const glm::vec2& renderSize, const glm::vec2& size);
NodePtr createImageNodeFromBitmap(BitmapPtr pBmp,
- const boost::python::dict& nodeAttrs);
+ const py::dict& nodeAttrs);
SVGElementPtr getElement(const UTF8String& sElementID);
std::map<UTF8String, SVGElementPtr> m_ElementMap;
UTF8String m_sFilename;
bool m_bUnescapeIllustratorIDs;
RsvgHandle* m_pRSVG;
-
- static bool s_RSVGInitialized;
};
}
diff --git a/src/player/SVGElement.cpp b/src/player/SVGElement.cpp
index 6531431..dc0ba28 100644
--- a/src/player/SVGElement.cpp
+++ b/src/player/SVGElement.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -36,11 +36,11 @@ SVGElement::SVGElement(RsvgHandle* pRSVG, const UTF8String& sFilename,
RsvgPositionData pos;
rsvg_handle_get_position_sub(pRSVG, &pos, m_sUnescapedID.c_str());
- m_Pos = DPoint(pos.x, pos.y);
+ m_Pos = glm::vec2(pos.x, pos.y);
RsvgDimensionData dim;
rsvg_handle_get_dimensions_sub(pRSVG, &dim, m_sUnescapedID.c_str());
- m_Size = DPoint(dim.width+1, dim.height+1);
+ m_Size = glm::vec2(dim.width+1, dim.height+1);
}
const UTF8String& SVGElement::getUnescapedID() const
@@ -48,12 +48,12 @@ const UTF8String& SVGElement::getUnescapedID() const
return m_sUnescapedID;
}
-const DPoint& SVGElement::getPos() const
+const glm::vec2& SVGElement::getPos() const
{
return m_Pos;
}
-const DPoint& SVGElement::getSize() const
+const glm::vec2& SVGElement::getSize() const
{
return m_Size;
}
@@ -66,16 +66,18 @@ UTF8String SVGElement::unescapeID(RsvgHandle* pRSVG, const UTF8String& sFilename
vector<string> sPossibleIDs;
sPossibleIDs.push_back(sResult);
string::size_type pos = sResult.find("_");
- while (pos != UTF8String::npos) {
- sResult.replace(pos, 1, "_x5F_");
- pos = sResult.find("_", pos+5);
+ if (pos != UTF8String::npos) {
+ while (pos != UTF8String::npos) {
+ sResult.replace(pos, 1, "_x5F_");
+ pos = sResult.find("_", pos+5);
+ }
+ sPossibleIDs.push_back(sResult);
}
// Illustrator adds suffixes to IDs to get rid of duplicates. Even after the
// duplicates are removed, the suffixes remain :-(.
// We handle two cases here:
// 1) If there is only one version with a suffix, we take that version.
// 2) If there are duplicate IDs, we warn.
- sPossibleIDs.push_back(sResult);
for (int i=1; i<30; ++i) {
string sTempID = sResult + "_" + toString(i) + "_";
sPossibleIDs.push_back(sTempID);
@@ -92,8 +94,7 @@ UTF8String SVGElement::unescapeID(RsvgHandle* pRSVG, const UTF8String& sFilename
throwIDNotFound(sFilename, sElementID);
}
if (numFound > 1) {
- AVG_TRACE(Logger::WARNING,
- "svg file '" << sFilename <<
+ AVG_LOG_WARNING("svg file '" << sFilename <<
"' has more than one element with id '" << sElementID << "'.");
}
} else {
diff --git a/src/player/SVGElement.h b/src/player/SVGElement.h
index 8eda90d..280df6b 100644
--- a/src/player/SVGElement.h
+++ b/src/player/SVGElement.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -25,7 +25,7 @@
#include "../api.h"
#include "../base/UTF8String.h"
-#include "../base/Point.h"
+#include "../base/GLMHelper.h"
#include <librsvg/rsvg.h>
#include <boost/shared_ptr.hpp>
@@ -41,8 +41,8 @@ public:
const UTF8String& sElementID, bool bUnescapeIllustratorIDs);
const UTF8String& getUnescapedID() const;
- const DPoint& getPos() const;
- const DPoint& getSize() const;
+ const glm::vec2& getPos() const;
+ const glm::vec2& getSize() const;
private:
UTF8String unescapeID(RsvgHandle* pRSVG, const UTF8String& sFilename,
@@ -50,8 +50,8 @@ private:
void throwIDNotFound(const UTF8String& sFilename, const UTF8String& sElementID);
UTF8String m_sUnescapedID;
- DPoint m_Pos;
- DPoint m_Size;
+ glm::vec2 m_Pos;
+ glm::vec2 m_Size;
};
typedef boost::shared_ptr<SVGElement> SVGElementPtr;
diff --git a/src/player/ShadowFXNode.cpp b/src/player/ShadowFXNode.cpp
index 703a901..30ef766 100644
--- a/src/player/ShadowFXNode.cpp
+++ b/src/player/ShadowFXNode.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -23,7 +23,6 @@
#include "../base/ObjectCounter.h"
#include "../base/Exception.h"
-#include "../graphics/ShaderRegistry.h"
#include <string>
@@ -31,18 +30,15 @@ using namespace std;
namespace avg {
-ShadowFXNode::ShadowFXNode()
- : FXNode(),
- m_Offset(0,0),
- m_StdDev(1),
- m_Opacity(1),
- m_Color(255,255,255,255)
+ShadowFXNode::ShadowFXNode(glm::vec2 offset, float radius, float opacity, string sColor)
+ : FXNode(false),
+ m_Offset(offset),
+ m_StdDev(radius),
+ m_Opacity(opacity)
{
+ m_sColorName = sColor;
+ m_Color = colorStringToColor(sColor);
ObjectCounter::get()->incRef(&typeid(*this));
- if (!GLTexture::isFloatFormatSupported()) {
- throw Exception(AVG_ERR_UNSUPPORTED,
- "OpenGL configuration doesn't support Shadow (no float textures).");
- }
}
ShadowFXNode::~ShadowFXNode()
@@ -52,10 +48,6 @@ ShadowFXNode::~ShadowFXNode()
void ShadowFXNode::connect()
{
- if (!GLTexture::isFloatFormatSupported()) {
- throw Exception(AVG_ERR_UNSUPPORTED,
- "Cannot create ShadowFX: OpenGL configuration doesn't support Blur (no float textures).");
- }
FXNode::connect();
}
@@ -65,46 +57,35 @@ void ShadowFXNode::disconnect()
FXNode::disconnect();
}
-void ShadowFXNode::setParams(const DPoint& offset, double stdDev, double opacity,
- const string& sColor)
-{
- m_Offset = offset;
- m_StdDev = stdDev;
- m_Opacity = opacity;
- m_sColorName = sColor;
- m_Color = colorStringToColor(sColor);
- updateFilter();
-}
-
-void ShadowFXNode::setOffset(const DPoint& offset)
+void ShadowFXNode::setOffset(const glm::vec2& offset)
{
m_Offset = offset;
updateFilter();
}
-DPoint ShadowFXNode::getOffset() const
+glm::vec2 ShadowFXNode::getOffset() const
{
return m_Offset;
}
-void ShadowFXNode::setRadius(double radius)
+void ShadowFXNode::setRadius(float radius)
{
m_StdDev = radius;
updateFilter();
}
-double ShadowFXNode::getRadius() const
+float ShadowFXNode::getRadius() const
{
return m_StdDev;
}
-void ShadowFXNode::setOpacity(double opacity)
+void ShadowFXNode::setOpacity(float opacity)
{
m_Opacity = opacity;
updateFilter();
}
-double ShadowFXNode::getOpacity() const
+float ShadowFXNode::getOpacity() const
{
return m_Opacity;
}
diff --git a/src/player/ShadowFXNode.h b/src/player/ShadowFXNode.h
index bd5a19c..e0bd77a 100644
--- a/src/player/ShadowFXNode.h
+++ b/src/player/ShadowFXNode.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -26,6 +26,7 @@
#include "FXNode.h"
#include "../graphics/GPUShadowFilter.h"
+#include "../base/GLMHelper.h"
#include <boost/shared_ptr.hpp>
#include <string>
@@ -34,20 +35,19 @@ namespace avg {
class AVG_API ShadowFXNode: public FXNode {
public:
- ShadowFXNode();
+ ShadowFXNode(glm::vec2 offset=glm::vec2(0,0), float radius=1.f, float opacity=1.f,
+ std::string sColor="FFFFFF");
virtual ~ShadowFXNode();
virtual void connect();
virtual void disconnect();
- void setParams(const DPoint& offset, double stdDev, double opacity,
- const std::string& sColor);
- void setOffset(const DPoint& offset);
- DPoint getOffset() const;
- void setRadius(double radius);
- double getRadius() const;
- void setOpacity(double opacity);
- double getOpacity() const;
+ void setOffset(const glm::vec2& offset);
+ glm::vec2 getOffset() const;
+ void setRadius(float radius);
+ float getRadius() const;
+ void setOpacity(float opacity);
+ float getOpacity() const;
void setColor(const std::string& sColor);
std::string getColor() const;
@@ -57,9 +57,9 @@ private:
GPUShadowFilterPtr m_pFilter;
- DPoint m_Offset;
- double m_StdDev;
- double m_Opacity;
+ glm::vec2 m_Offset;
+ float m_StdDev;
+ float m_Opacity;
std::string m_sColorName;
Pixel32 m_Color;
};
diff --git a/src/player/Shape.cpp b/src/player/Shape.cpp
index f93cd6b..a40f01b 100644
--- a/src/player/Shape.cpp
+++ b/src/player/Shape.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -26,6 +26,7 @@
#include "../graphics/Filterfliprgb.h"
#include "../graphics/GLContext.h"
+#include "../graphics/OGLShader.h"
#include "OGLSurface.h"
@@ -58,21 +59,20 @@ void Shape::setBitmap(BitmapPtr pBmp)
if (m_pImage->getState() == Image::GPU) {
if (prevState != Image::GPU) {
// TODO: This shouldn't happen.
- m_pVertexArray = VertexArrayPtr(new VertexArray());
+ m_pVertexData = VertexDataPtr(new VertexData());
}
}
}
void Shape::moveToGPU()
{
- m_pSurface->attach();
m_pImage->moveToGPU();
- m_pVertexArray = VertexArrayPtr(new VertexArray());
+ m_pVertexData = VertexDataPtr(new VertexData());
}
void Shape::moveToCPU()
{
- m_pVertexArray = VertexArrayPtr();
+ m_pVertexData = VertexDataPtr();
m_pImage->moveToCPU();
}
@@ -86,35 +86,43 @@ bool Shape::isTextured() const
return m_pImage->getSource() != Image::NONE;
}
-VertexArrayPtr Shape::getVertexArray()
+VertexDataPtr Shape::getVertexData()
{
- return m_pVertexArray;
+ return m_pVertexData;
}
-void Shape::draw()
+void Shape::setVertexArray(const VertexArrayPtr& pVA)
+{
+ pVA->startSubVA(m_SubVA);
+ m_SubVA.appendVertexData(m_pVertexData);
+/*
+ cerr << endl;
+ cerr << "Global VA: " << endl;
+ pVA->dump();
+ cerr << "Local vertex data: " << endl;
+ m_pVertexData->dump();
+*/
+}
+
+void Shape::draw(const glm::mat4& transform, float opacity)
{
bool bIsTextured = isTextured();
- GLContext* pContext = GLContext::getCurrent();
+ GLContext* pContext = GLContext::getMain();
+ StandardShaderPtr pShader = pContext->getStandardShader();
+ pShader->setTransform(transform);
+ pShader->setAlpha(opacity);
if (bIsTextured) {
m_pSurface->activate();
} else {
- if (GLContext::getCurrent()->isUsingShaders()) {
- glproc::UseProgramObject(0);
- }
- for (int i = 1; i < 5; ++i) {
- glproc::ActiveTexture(GL_TEXTURE0 + i);
- glDisable(GL_TEXTURE_2D);
- }
- glproc::ActiveTexture(GL_TEXTURE0);
+ pShader->setUntextured();
+ pShader->activate();
}
- pContext->enableTexture(bIsTextured);
- pContext->enableGLColorArray(!bIsTextured);
- m_pVertexArray->draw();
+ m_SubVA.draw();
}
void Shape::discard()
{
- m_pVertexArray = VertexArrayPtr();
+ m_pVertexData = VertexDataPtr();
m_pImage->discard();
}
diff --git a/src/player/Shape.h b/src/player/Shape.h
index 6502aaa..4cbb390 100644
--- a/src/player/Shape.h
+++ b/src/player/Shape.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -26,9 +26,9 @@
#include "Image.h"
#include "MaterialInfo.h"
-#include "../base/Point.h"
+#include "../base/GLMHelper.h"
#include "../graphics/Bitmap.h"
-#include "../graphics/VertexArray.h"
+#include "../graphics/SubVertexArray.h"
#include <boost/shared_ptr.hpp>
#include <string>
@@ -47,15 +47,17 @@ class AVG_API Shape
virtual void moveToCPU();
ImagePtr getImage();
- VertexArrayPtr getVertexArray();
- void draw();
+ VertexDataPtr getVertexData();
+ void setVertexArray(const VertexArrayPtr& pVA);
+ void draw(const glm::mat4& transform, float opacity);
void discard();
private:
bool isTextured() const;
- VertexArrayPtr m_pVertexArray;
+ VertexDataPtr m_pVertexData;
+ SubVertexArray m_SubVA;
OGLSurface * m_pSurface;
ImagePtr m_pImage;
};
diff --git a/src/player/SoundNode.cpp b/src/player/SoundNode.cpp
index 9d31597..3bb089c 100644
--- a/src/player/SoundNode.cpp
+++ b/src/player/SoundNode.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -20,18 +20,18 @@
//
#include "SoundNode.h"
#include "Player.h"
-#include "NodeDefinition.h"
+#include "TypeDefinition.h"
#include "Canvas.h"
#include "../base/Exception.h"
#include "../base/Logger.h"
#include "../base/ScopeTimer.h"
#include "../base/XMLHelper.h"
+#include "../base/ObjectCounter.h"
-#include "../audio/SDLAudioEngine.h"
+#include "../audio/AudioEngine.h"
#include "../video/AsyncVideoDecoder.h"
-#include "../video/FFMpegDecoder.h"
#include <iostream>
#include <sstream>
@@ -40,33 +40,35 @@
#include <unistd.h>
#endif
-using namespace boost::python;
+using namespace boost;
using namespace std;
namespace avg {
-NodeDefinition SoundNode::createDefinition()
+void SoundNode::registerType()
{
- return NodeDefinition("sound", Node::buildNode<SoundNode>)
- .extendDefinition(AreaNode::createDefinition())
+ TypeDefinition def = TypeDefinition("sound", "areanode",
+ ExportedObject::buildObject<SoundNode>)
.addArg(Arg<UTF8String>("href", "", false, offsetof(SoundNode, m_href)))
.addArg(Arg<bool>("loop", false, false, offsetof(SoundNode, m_bLoop)))
- .addArg(Arg<double>("volume", 1.0, false, offsetof(SoundNode, m_Volume)))
+ .addArg(Arg<float>("volume", 1.0, false, offsetof(SoundNode, m_Volume)))
;
+ TypeRegistry::get()->registerType(def);
}
SoundNode::SoundNode(const ArgList& args)
: m_Filename(""),
m_pEOFCallback(0),
+ m_SeekBeforeCanRenderTime(0),
m_pDecoder(0),
m_Volume(1.0),
- m_State(Unloaded)
+ m_State(Unloaded),
+ m_AudioID(-1)
{
args.setMembers(this);
m_Filename = m_href;
initFilename(m_Filename);
- VideoDecoderPtr pSyncDecoder(new FFMpegDecoder());
- m_pDecoder = new AsyncVideoDecoder(pSyncDecoder, 8);
+ m_pDecoder = new AsyncVideoDecoder(8);
ObjectCounter::get()->incRef(&typeid(*this));
}
@@ -110,7 +112,7 @@ int SoundNode::getNumAudioChannels() const
long long SoundNode::getCurTime() const
{
exceptionIfUnloaded("getCurTime");
- return (long long)(m_pDecoder->getCurTime(SS_AUDIO)*1000);
+ return (long long)(m_pDecoder->getCurTime()*1000);
}
void SoundNode::seekToTime(long long Time)
@@ -129,13 +131,19 @@ void SoundNode::setEOFCallback(PyObject * pEOFCallback)
if (m_pEOFCallback) {
Py_DECREF(m_pEOFCallback);
}
- Py_INCREF(pEOFCallback);
- m_pEOFCallback = pEOFCallback;
+ if (pEOFCallback == Py_None) {
+ m_pEOFCallback = 0;
+ } else {
+ avgDeprecationWarning("1.8", "SoundNode.setEOFCallback()",
+ "Node.subscribe(END_OF_FILE)");
+ Py_INCREF(pEOFCallback);
+ m_pEOFCallback = pEOFCallback;
+ }
}
void SoundNode::connectDisplay()
{
- if (!SDLAudioEngine::get()) {
+ if (!AudioEngine::get()) {
throw Exception(AVG_ERR_UNSUPPORTED,
"Sound nodes can only be created if audio is not disabled.");
}
@@ -154,6 +162,7 @@ void SoundNode::connectDisplay()
void SoundNode::connect(CanvasPtr pCanvas)
{
+ checkReload();
AreaNode::connect(pCanvas);
pCanvas->registerFrameEndListener(this);
}
@@ -194,19 +203,19 @@ void SoundNode::setHRef(const UTF8String& href)
checkReload();
}
-double SoundNode::getVolume()
+float SoundNode::getVolume()
{
return m_Volume;
}
-void SoundNode::setVolume(double volume)
+void SoundNode::setVolume(float volume)
{
if (volume < 0) {
volume = 0;
}
m_Volume = volume;
- if (m_pDecoder) {
- m_pDecoder->setVolume(volume);
+ if (m_AudioID != -1) {
+ AudioEngine::get()->setSourceVolume(m_AudioID, volume);
}
}
@@ -215,13 +224,12 @@ void SoundNode::checkReload()
string fileName (m_href);
if (m_href != "") {
initFilename(fileName);
- if (fileName != m_Filename) {
- SoundState oldState = m_State;
+ if (fileName != m_Filename && m_State != Unloaded) {
changeSoundState(Unloaded);
m_Filename = fileName;
- if (oldState != Unloaded) {
- changeSoundState(Paused);
- }
+ changeSoundState(Paused);
+ } else {
+ m_Filename = fileName;
}
} else {
changeSoundState(Unloaded);
@@ -231,17 +239,12 @@ void SoundNode::checkReload()
void SoundNode::onFrameEnd()
{
- if (m_State == Playing && m_pDecoder->isEOF(SS_AUDIO)) {
- onEOF();
- }
-}
-
-int SoundNode::fillAudioBuffer(AudioBufferPtr pBuffer)
-{
if (m_State == Playing) {
- return m_pDecoder->fillAudioBuffer(pBuffer);
- } else {
- return 0;
+ m_pDecoder->updateAudioStatus();
+ }
+ if (m_State == Playing && m_pDecoder->isEOF()) {
+ NodePtr pTempThis = getSharedThis();
+ onEOF();
}
}
@@ -265,8 +268,10 @@ void SoundNode::changeSoundState(SoundState newSoundState)
}
if (newSoundState == Paused) {
m_PauseStartTime = curTime;
+ AudioEngine::get()->pauseSource(m_AudioID);
} else if (newSoundState == Playing && m_State == Paused) {
m_PauseTime += curTime-m_PauseStartTime;
+ AudioEngine::get()->playSource(m_AudioID);
}
}
m_State = newSoundState;
@@ -274,16 +279,22 @@ void SoundNode::changeSoundState(SoundState newSoundState)
void SoundNode::seek(long long destTime)
{
- m_pDecoder->seek(double(destTime)/1000);
- m_StartTime = Player::get()->getFrameTime() - destTime;
- m_PauseTime = 0;
- m_PauseStartTime = Player::get()->getFrameTime();
+ if (getState() == NS_CANRENDER) {
+ AudioEngine::get()->notifySeek(m_AudioID);
+ m_pDecoder->seek(float(destTime)/1000);
+ m_StartTime = Player::get()->getFrameTime() - destTime;
+ m_PauseTime = 0;
+ m_PauseStartTime = Player::get()->getFrameTime();
+ } else {
+ // If we get a seek command before decoding has really started, we need to defer
+ // the actual seek until the decoder is ready.
+ m_SeekBeforeCanRenderTime = destTime;
+ }
}
void SoundNode::open()
{
- m_pDecoder->setVolume(m_Volume);
- m_pDecoder->open(m_Filename, true);
+ m_pDecoder->open(m_Filename, false, true);
VideoInfo videoInfo = m_pDecoder->getVideoInfo();
if (!videoInfo.m_bHasAudio) {
throw Exception(AVG_ERR_VIDEO_GENERAL,
@@ -294,14 +305,23 @@ void SoundNode::open()
void SoundNode::startDecoding()
{
- SDLAudioEngine* pEngine = SDLAudioEngine::get();
+ AudioEngine* pEngine = AudioEngine::get();
m_pDecoder->startDecoding(false, pEngine->getParams());
- pEngine->addSource(this);
+ m_AudioID = pEngine->addSource(*m_pDecoder->getAudioMsgQ(),
+ *m_pDecoder->getAudioStatusQ());
+ pEngine->setSourceVolume(m_AudioID, m_Volume);
+ if (m_SeekBeforeCanRenderTime != 0) {
+ seek(m_SeekBeforeCanRenderTime);
+ m_SeekBeforeCanRenderTime = 0;
+ }
}
void SoundNode::close()
{
- SDLAudioEngine::get()->removeSource(this);
+ if (m_AudioID != -1) {
+ AudioEngine::get()->removeSource(m_AudioID);
+ m_AudioID = -1;
+ }
m_pDecoder->close();
}
@@ -309,7 +329,7 @@ void SoundNode::exceptionIfUnloaded(const std::string& sFuncName) const
{
if (m_State == Unloaded) {
throw Exception(AVG_ERR_VIDEO_GENERAL,
- string("SoundNode.")+sFuncName+" failed: video not loaded.");
+ string("SoundNode.")+sFuncName+" failed: sound not loaded.");
}
}
@@ -324,10 +344,11 @@ void SoundNode::onEOF()
PyObject * result = PyEval_CallObject(m_pEOFCallback, arglist);
Py_DECREF(arglist);
if (!result) {
- throw error_already_set();
+ throw py::error_already_set();
}
Py_DECREF(result);
}
+ notifySubscribers("END_OF_FILE");
}
}
diff --git a/src/player/SoundNode.h b/src/player/SoundNode.h
index 04f927d..66f9308 100644
--- a/src/player/SoundNode.h
+++ b/src/player/SoundNode.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -28,16 +28,15 @@
#include "../base/IFrameEndListener.h"
#include "../base/UTF8String.h"
-#include "../audio/IAudioSource.h"
namespace avg {
-class VideoDecoder;
+class AsyncVideoDecoder;
-class AVG_API SoundNode : public AreaNode, IFrameEndListener, IAudioSource
+class AVG_API SoundNode : public AreaNode, IFrameEndListener
{
public:
- static NodeDefinition createDefinition();
+ static void registerType();
SoundNode(const ArgList& args);
virtual ~SoundNode();
@@ -52,8 +51,8 @@ class AVG_API SoundNode : public AreaNode, IFrameEndListener, IAudioSource
const UTF8String& getHRef() const;
void setHRef(const UTF8String& href);
- double getVolume();
- void setVolume(double volume);
+ float getVolume();
+ void setVolume(float volume);
void checkReload();
long long getDuration() const;
@@ -68,8 +67,6 @@ class AVG_API SoundNode : public AreaNode, IFrameEndListener, IAudioSource
virtual void onFrameEnd();
- virtual int fillAudioBuffer(AudioBufferPtr pBuffer);
-
private:
void seek(long long destTime);
void onEOF();
@@ -85,15 +82,16 @@ class AVG_API SoundNode : public AreaNode, IFrameEndListener, IAudioSource
std::string m_Filename;
bool m_bLoop;
PyObject * m_pEOFCallback;
- bool m_bAudioEnabled;
+ long long m_SeekBeforeCanRenderTime;
long long m_StartTime;
long long m_PauseTime;
long long m_PauseStartTime;
- VideoDecoder * m_pDecoder;
- double m_Volume;
+ AsyncVideoDecoder* m_pDecoder;
+ float m_Volume;
SoundState m_State;
+ int m_AudioID;
};
}
diff --git a/src/player/SubscriberInfo.cpp b/src/player/SubscriberInfo.cpp
new file mode 100644
index 0000000..85c0da2
--- /dev/null
+++ b/src/player/SubscriberInfo.cpp
@@ -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
+//
+
+#include "SubscriberInfo.h"
+
+#include "../base/Exception.h"
+#include "../base/ObjectCounter.h"
+#include "../base/ScopeTimer.h"
+
+#include <boost/python/slice.hpp>
+
+using namespace std;
+
+namespace avg {
+
+py::object SubscriberInfo::s_MethodrefModule;
+
+SubscriberInfo::SubscriberInfo(int id, const py::object& callable)
+ : m_ID(id)
+{
+ ObjectCounter::get()->incRef(&typeid(*this));
+ if (s_MethodrefModule.ptr() == py::object().ptr()) {
+ s_MethodrefModule = py::import("libavg.methodref");
+ }
+ // Use the methodref module to manage the lifetime of the callables. This makes
+ // sure that we can delete bound-method callbacks when the object they are bound
+ // to disappears.
+ m_Callable = py::object(s_MethodrefModule.attr("methodref")(callable));
+}
+
+SubscriberInfo::~SubscriberInfo()
+{
+ ObjectCounter::get()->decRef(&typeid(*this));
+}
+
+bool SubscriberInfo::hasExpired() const
+{
+ py::object func = m_Callable();
+ return (func.ptr() == py::object().ptr());
+}
+
+static ProfilingZoneID InvokeSubscriberProfilingZone("SubscriberInfo: invoke");
+
+void SubscriberInfo::invoke(py::list args) const
+{
+ ScopeTimer timer(InvokeSubscriberProfilingZone);
+ py::object func = m_Callable();
+ py::tuple argsTuple(args);
+ py::object pyResult = func(*argsTuple);
+ if (pyResult.ptr() == 0) {
+ throw py::error_already_set();
+ }
+}
+
+int SubscriberInfo::getID() const
+{
+ return m_ID;
+}
+
+bool SubscriberInfo::isCallable(const py::object& callable) const
+{
+ bool bResult = py::call_method<bool>(m_Callable.ptr(), "isSameFunc", callable);
+ return bResult;
+}
+
+}
diff --git a/src/player/SubscriberInfo.h b/src/player/SubscriberInfo.h
new file mode 100644
index 0000000..a8dc388
--- /dev/null
+++ b/src/player/SubscriberInfo.h
@@ -0,0 +1,58 @@
+//
+// 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 _SubscriberInfo_H_
+#define _SubscriberInfo_H_
+
+#include "../api.h"
+
+#include "BoostPython.h"
+#include <boost/shared_ptr.hpp>
+
+// Python docs say python.h should be included before any standard headers (!)
+#include "WrapPython.h"
+
+#include <vector>
+
+namespace avg {
+
+class SubscriberInfo {
+public:
+ SubscriberInfo(int id, const py::object& callable);
+ virtual ~SubscriberInfo();
+
+ bool hasExpired() const;
+ void invoke(py::list args) const;
+ int getID() const;
+ bool isCallable(const py::object& callable) const;
+
+private:
+ int m_ID;
+ py::object m_Callable;
+ static py::object s_MethodrefModule;
+};
+
+typedef boost::shared_ptr<SubscriberInfo> SubscriberInfoPtr;
+}
+
+#endif
+
+
diff --git a/src/player/TUIOInputDevice.cpp b/src/player/TUIOInputDevice.cpp
index a722289..f6f3f08 100644
--- a/src/player/TUIOInputDevice.cpp
+++ b/src/player/TUIOInputDevice.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -28,7 +28,6 @@
#include "../base/Logger.h"
#include "../base/StringHelper.h"
#include "../base/OSHelper.h"
-#include "../base/Point.h"
#include "../base/ObjectCounter.h"
#include "../base/Exception.h"
@@ -49,7 +48,8 @@ DWORD WINAPI TUIOInputDevice::threadFunc(LPVOID p)
};
TUIOInputDevice::TUIOInputDevice()
- : m_LastID(0)
+ : m_pSocket(0),
+ m_LastID(0)
{
}
@@ -83,8 +83,8 @@ void TUIOInputDevice::start()
if (!m_pSocket->IsBound()) {
throw Exception(AVG_ERR_MT_INIT, "TUIO event source: Socket not bound.");
}
- AVG_TRACE(Logger::CONFIG, "TUIO multitouch event source created, listening on port "
- << port);
+ AVG_TRACE(Logger::category::CONFIG,Logger::severity::INFO,
+ "TUIO multitouch event source created, listening on port " << port);
#ifndef WIN32
pthread_create(&m_Thread, NULL, threadFunc, this);
@@ -97,7 +97,7 @@ void TUIOInputDevice::start()
void TUIOInputDevice::ProcessPacket(const char* pData, int size,
const IpEndpointName& remoteEndpoint)
{
- boost::mutex::scoped_lock lock(getMutex());
+ lock_guard lock(getMutex());
try {
ReceivedPacket packet(pData, size);
if (packet.IsBundle()) {
@@ -105,8 +105,8 @@ void TUIOInputDevice::ProcessPacket(const char* pData, int size,
} else {
processMessage(ReceivedMessage(packet), remoteEndpoint);
}
- } catch (MalformedBundleException& e) {
- AVG_TRACE(Logger::WARNING, "Malformed OSC bundle received: " << e.what());
+ } catch (osc::Exception& e) {
+ AVG_LOG_WARNING("OSC exception: " << e.what());
}
}
@@ -123,8 +123,8 @@ void TUIOInputDevice::processBundle(const ReceivedBundle& bundle,
processMessage(ReceivedMessage(*it), remoteEndpoint);
}
}
- } catch (MalformedBundleException& e) {
- AVG_TRACE(Logger::WARNING, "Malformed OSC bundle received: " << e.what());
+ } catch (osc::Exception& e) {
+ AVG_LOG_WARNING("OSC exception: " << e.what());
}
}
@@ -149,7 +149,7 @@ void TUIOInputDevice::processMessage(const ReceivedMessage& msg,
}
}
} catch (osc::Exception& e) {
- AVG_TRACE(Logger::WARNING, "Error parsing TUIO message: " << e.what()
+ AVG_LOG_WARNING("Error parsing TUIO message: " << e.what()
<< ". Message was " << msg);
}
}
@@ -161,19 +161,19 @@ void TUIOInputDevice::processSet(ReceivedMessageArgumentStream& args)
float xspeed, yspeed;
float accel;
args >> tuioID >> xpos >> ypos >> xspeed >> yspeed >> accel;
- DPoint pos(xpos, ypos);
- DPoint speed(xspeed, yspeed);
+ glm::vec2 pos(xpos, ypos);
+ glm::vec2 speed(xspeed, yspeed);
// cerr << "Set: ID: " << tuioID << ", pos: " << pos << ", speed: " << speed
// << ", accel: " << accel << endl;
TouchStatusPtr pTouchStatus = getTouchStatus(tuioID);
if (!pTouchStatus) {
// Down
m_LastID++;
- TouchEventPtr pEvent = createEvent(m_LastID, Event::CURSORDOWN, pos, speed);
+ TouchEventPtr pEvent = createEvent(m_LastID, Event::CURSOR_DOWN, pos, speed);
addTouchStatus((long)tuioID, pEvent);
} else {
// Move
- TouchEventPtr pEvent = createEvent(0, Event::CURSORMOTION, pos, speed);
+ TouchEventPtr pEvent = createEvent(0, Event::CURSOR_MOTION, pos, speed);
pTouchStatus->pushEvent(pEvent);
}
}
@@ -196,20 +196,20 @@ void TUIOInputDevice::processAlive(ReceivedMessageArgumentStream& args)
TouchStatusPtr pTouchStatus = getTouchStatus(id);
TouchEventPtr pOldEvent = pTouchStatus->getLastEvent();
TouchEventPtr pUpEvent = boost::dynamic_pointer_cast<TouchEvent>(
- pOldEvent->cloneAs(Event::CURSORUP));
+ pOldEvent->cloneAs(Event::CURSOR_UP));
pTouchStatus->pushEvent(pUpEvent);
removeTouchStatus(id);
}
}
-TouchEventPtr TUIOInputDevice::createEvent(int id, Event::Type type, DPoint pos,
- DPoint speed)
+TouchEventPtr TUIOInputDevice::createEvent(int id, Event::Type type, glm::vec2 pos,
+ glm::vec2 speed)
{
- DPoint size = getWindowSize();
- IntPoint screenPos(int(pos.x*size.x+0.5), int(pos.y*size.y+0.5));
- DPoint screenSpeed(int(speed.x*size.x+0.5), int(speed.y*size.y+0.5));
+ const glm::vec2 size = getTouchArea();
+ IntPoint screenPos = getScreenPos(pos);
+ glm::vec2 screenSpeed(int(speed.x*size.x+0.5), int(speed.y*size.y+0.5));
TouchEventPtr pEvent(new TouchEvent(id, type, screenPos, Event::TOUCH));
- pEvent->setSpeed(screenSpeed/1000);
+ pEvent->setSpeed(screenSpeed/1000.f);
return pEvent;
}
diff --git a/src/player/TUIOInputDevice.h b/src/player/TUIOInputDevice.h
index 6bd99f1..7315345 100644
--- a/src/player/TUIOInputDevice.h
+++ b/src/player/TUIOInputDevice.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -60,7 +60,7 @@ private:
const IpEndpointName& remoteEndpoint);
void processSet(osc::ReceivedMessageArgumentStream& args);
void processAlive(osc::ReceivedMessageArgumentStream& args);
- TouchEventPtr createEvent(int id, Event::Type type, DPoint pos, DPoint speed);
+ TouchEventPtr createEvent(int id, Event::Type type, glm::vec2 pos, glm::vec2 speed);
UdpListeningReceiveSocket* m_pSocket;
int m_LastID;
diff --git a/src/player/TestHelper.cpp b/src/player/TestHelper.cpp
index c9a3e48..342e7fd 100644
--- a/src/player/TestHelper.cpp
+++ b/src/player/TestHelper.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -65,7 +65,7 @@ void TestHelper::fakeMouseEvent(Event::Type eventType,
}
void TestHelper::fakeTouchEvent(int id, Event::Type eventType,
- Event::Source source, const DPoint& pos, const DPoint& speed)
+ Event::Source source, const glm::vec2& pos, const glm::vec2& speed)
{
checkEventType(eventType);
// The id is modified to avoid collisions with real touch events.
@@ -73,14 +73,14 @@ void TestHelper::fakeTouchEvent(int id, Event::Type eventType,
IntPoint(pos), source, speed));
map<int, TouchStatusPtr>::iterator it = m_Touches.find(pEvent->getCursorID());
switch (pEvent->getType()) {
- case Event::CURSORDOWN: {
+ case Event::CURSOR_DOWN: {
AVG_ASSERT(it == m_Touches.end());
TouchStatusPtr pTouchStatus(new TouchStatus(pEvent));
m_Touches[pEvent->getCursorID()] = pTouchStatus;
}
break;
- case Event::CURSORMOTION:
- case Event::CURSORUP: {
+ case Event::CURSOR_MOTION:
+ case Event::CURSOR_UP: {
if (it == m_Touches.end()) {
cerr << "borked: " << pEvent->getCursorID() << ", " <<
pEvent->typeStr() << endl;
@@ -110,6 +110,11 @@ void TestHelper::dumpObjects()
cerr << ObjectCounter::get()->dump();
}
+TypeMap TestHelper::getObjectCount()
+{
+ return ObjectCounter::get()->getObjectCount();
+}
+
// From IInputDevice
std::vector<EventPtr> TestHelper::pollEvents()
{
@@ -120,7 +125,7 @@ std::vector<EventPtr> TestHelper::pollEvents()
CursorEventPtr pEvent = pTouchStatus->pollEvent();
if (pEvent) {
events.push_back(pEvent);
- if (pEvent->getType() == Event::CURSORUP) {
+ if (pEvent->getType() == Event::CURSOR_UP) {
m_Touches.erase(it++);
} else {
++it;
@@ -136,9 +141,9 @@ std::vector<EventPtr> TestHelper::pollEvents()
void TestHelper::checkEventType(Event::Type eventType)
{
- if (eventType == Event::CURSOROVER || eventType == Event::CURSOROUT) {
+ if (eventType == Event::CURSOR_OVER || eventType == Event::CURSOR_OUT) {
throw Exception(AVG_ERR_UNSUPPORTED, "TestHelper::fakeXxxEvent: Can't send "
- "CURSOROVER and CURSOROUT events directly. They are generated "
+ "CURSOR_OVER and CURSOR_OUT events directly. They are generated "
"internally.");
}
}
diff --git a/src/player/TestHelper.h b/src/player/TestHelper.h
index 0461729..f0741e9 100644
--- a/src/player/TestHelper.h
+++ b/src/player/TestHelper.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -23,6 +23,7 @@
#define _TestHelper_H_
#include "../api.h"
+#include "../base/ObjectCounter.h"
#include "../graphics/Bitmap.h"
#include "Event.h"
#include "IInputDevice.h"
@@ -51,11 +52,12 @@ class AVG_API TestHelper : public IInputDevice
bool rightButtonState,
int xPosition, int yPosition, int button);
void fakeTouchEvent(int id, Event::Type eventType, Event::Source source,
- const DPoint& pos, const DPoint& speed=DPoint(0, 0));
+ const glm::vec2& pos, const glm::vec2& speed=glm::vec2(0, 0));
void fakeKeyEvent(Event::Type eventType,
unsigned char scanCode, int keyCode,
const std::string& keyString, int unicode, int modifiers);
void dumpObjects();
+ TypeMap getObjectCount();
// From IInputDevice
virtual std::vector<EventPtr> pollEvents();
diff --git a/src/player/TextEngine.cpp b/src/player/TextEngine.cpp
index 9d89e36..226b0de 100644
--- a/src/player/TextEngine.cpp
+++ b/src/player/TextEngine.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -78,7 +78,6 @@ TextEngine::~TextEngine()
void TextEngine::init()
{
- g_type_init();
m_pFontMap = PANGO_FT2_FONT_MAP(pango_ft2_font_map_new());
pango_ft2_font_map_set_resolution(m_pFontMap, 72, 72);
if (m_bHint) {
@@ -88,7 +87,11 @@ void TextEngine::init()
pango_ft2_font_map_set_default_substitute(m_pFontMap, text_subst_func_nohint,
0, 0);
}
+#if PANGO_VERSION > PANGO_VERSION_ENCODE(1,22,0)
+ m_pPangoContext = pango_font_map_create_context(PANGO_FONT_MAP(m_pFontMap));
+#else
m_pPangoContext = pango_ft2_font_map_create_context(m_pFontMap);
+#endif
pango_context_set_language(m_pPangoContext,
pango_language_from_string ("en_US"));
@@ -160,7 +163,7 @@ PangoFontDescription * TextEngine::getFontDescription(const string& sFamily,
pFamily = getFontFamily(sFamily);
} catch (Exception&) {
if (m_sFontsNotFound.find(sFamily) == m_sFontsNotFound.end()) {
- AVG_TRACE(Logger::WARNING, "Could not find font face " << sFamily <<
+ AVG_LOG_WARNING("Could not find font face " << sFamily <<
". Using sans instead.");
m_sFontsNotFound.insert(sFamily);
}
@@ -186,7 +189,7 @@ PangoFontDescription * TextEngine::getFontDescription(const string& sFamily,
pair<string, string> variant(sFamily, sVariant);
if (m_VariantsNotFound.find(variant) == m_VariantsNotFound.end()) {
m_VariantsNotFound.insert(variant);
- AVG_TRACE(Logger::WARNING, "Could not find font variant "
+ AVG_LOG_WARNING("Could not find font variant "
<< sFamily << ":" << sVariant << ". Using " <<
pango_font_face_get_face_name(pFace) << " instead.");
}
@@ -205,32 +208,41 @@ PangoFontDescription * TextEngine::getFontDescription(const string& sFamily,
void GLibLogFunc(const gchar *log_domain, GLogLevelFlags log_level,
const gchar *message, gpointer unused_data)
{
+//TODO: Make this use correct AVG_LOG_LEVEL function
#ifndef WIN32
string s = "Pango ";
if (log_level & G_LOG_LEVEL_ERROR) {
- s += "error: ";
+ s += message;
+ AVG_LOG_ERROR(s);
+ return;
} else if (log_level & G_LOG_LEVEL_CRITICAL) {
- s += string("critical: ")+message;
- AVG_TRACE(Logger::ERROR, s);
+ s += message;
+ AVG_LOG_ERROR(s);
AVG_ASSERT(false);
} else if (log_level & G_LOG_LEVEL_WARNING) {
- s += "warning: ";
+ s += message;
+ AVG_LOG_WARNING(s);
+ return;
} else if (log_level & G_LOG_LEVEL_MESSAGE) {
- s += "message: ";
+ s += (string("message: ") + message);
+ AVG_LOG_INFO(s);
+ return;
} else if (log_level & G_LOG_LEVEL_INFO) {
- s += "info: ";
+ s += message;
+ AVG_LOG_INFO(s);
+ return;
} else if (log_level & G_LOG_LEVEL_DEBUG) {
- s += "debug: ";
+ s += message;
+ AVG_TRACE(Logger::category::NONE, Logger::severity::DEBUG, s);
+ return;
}
s += message;
- AVG_TRACE(Logger::WARNING, s);
+ AVG_LOG_WARNING(s);
#endif
}
void TextEngine::initFonts()
{
- g_type_init();
-
std::vector<std::string> fontConfPathPrefixList;
#ifndef WIN32
fontConfPathPrefixList.push_back("/");
diff --git a/src/player/TextEngine.h b/src/player/TextEngine.h
index 734b2a4..4fef426 100644
--- a/src/player/TextEngine.h
+++ b/src/player/TextEngine.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
diff --git a/src/player/Timeout.cpp b/src/player/Timeout.cpp
index 48f5e11..9820699 100644
--- a/src/player/Timeout.cpp
+++ b/src/player/Timeout.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -21,19 +21,19 @@
#include "Timeout.h"
+#include "BoostPython.h"
+
#include "../base/Exception.h"
#include "../base/ObjectCounter.h"
-#include "BoostPython.h"
-
#include <iostream>
-using namespace boost::python;
using namespace std;
namespace avg {
-int Timeout::s_LastID = 0;
+// Hack to make sure ids don't overlap with publisher/subsriber ids
+int Timeout::s_LastID = 100000;
Timeout::Timeout(int time, PyObject * pyfunc, bool isInterval, long long startTime)
: m_Interval(time),
@@ -54,17 +54,17 @@ Timeout::~Timeout()
ObjectCounter::get()->decRef(&typeid(*this));
}
-bool Timeout::IsReady(long long time) const
+bool Timeout::isReady(long long time) const
{
return m_NextTimeout <= time;
}
-bool Timeout::IsInterval() const
+bool Timeout::isInterval() const
{
return m_IsInterval;
}
-void Timeout::Fire(long long curTime)
+void Timeout::fire(long long curTime)
{
if (m_IsInterval) {
m_NextTimeout = m_Interval + curTime;
@@ -75,12 +75,12 @@ void Timeout::Fire(long long curTime)
// by a call to clearTimeout()!
Py_DECREF(arglist);
if (!result) {
- throw error_already_set();
+ throw py::error_already_set();
}
Py_DECREF(result);
}
-int Timeout::GetID() const
+int Timeout::getID() const
{
return m_ID;
}
diff --git a/src/player/Timeout.h b/src/player/Timeout.h
index 0f73a4e..9682d76 100644
--- a/src/player/Timeout.h
+++ b/src/player/Timeout.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -34,10 +34,10 @@ class AVG_API Timeout
Timeout (int time, PyObject * pyfunc, bool isInterval, long long startTime);
virtual ~Timeout ();
- bool IsReady(long long time) const;
- bool IsInterval() const;
- void Fire(long long curTime);
- int GetID() const;
+ bool isReady(long long time) const;
+ bool isInterval() const;
+ void fire(long long curTime);
+ int getID() const;
bool operator <(const Timeout& other) const;
private:
diff --git a/src/player/TouchEvent.cpp b/src/player/TouchEvent.cpp
index 17a1f52..c2541df 100644
--- a/src/player/TouchEvent.cpp
+++ b/src/player/TouchEvent.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -38,7 +38,7 @@ using namespace std;
namespace avg {
TouchEvent::TouchEvent(int id, Type eventType, BlobPtr pBlob, const IntPoint& pos,
- Source source, const DPoint& speed)
+ Source source, const glm::vec2& speed)
: CursorEvent(id, eventType, pos, source),
m_pBlob(pBlob),
m_bHasHandOrientation(false)
@@ -49,9 +49,9 @@ TouchEvent::TouchEvent(int id, Type eventType, BlobPtr pBlob, const IntPoint& po
m_Area = pBlob->getArea();
m_Center = pBlob->getCenter();
m_Eccentricity = pBlob->getEccentricity();
- const DPoint& axis0 = m_pBlob->getScaledBasis(0);
- const DPoint& axis1 = m_pBlob->getScaledBasis(1);
- if (axis0.getNorm() > axis1.getNorm()) {
+ const glm::vec2& axis0 = m_pBlob->getScaledBasis(0);
+ const glm::vec2& axis1 = m_pBlob->getScaledBasis(1);
+ if (glm::length(axis0) > glm::length(axis1)) {
m_MajorAxis = axis0;
m_MinorAxis = axis1;
} else {
@@ -61,16 +61,16 @@ TouchEvent::TouchEvent(int id, Type eventType, BlobPtr pBlob, const IntPoint& po
} else {
m_Orientation = 0;
m_Area = 20;
- m_Center = DPoint(0, 0);
+ m_Center = glm::vec2(0, 0);
m_Eccentricity = 0;
- m_MajorAxis = DPoint(5, 0);
- m_MinorAxis = DPoint(0, 5);
+ m_MajorAxis = glm::vec2(5, 0);
+ m_MinorAxis = glm::vec2(0, 5);
}
}
TouchEvent::TouchEvent(int id, Type eventType, const IntPoint& pos, Source source,
- const DPoint& speed, double orientation, double area, double eccentricity,
- DPoint majorAxis, DPoint minorAxis)
+ const glm::vec2& speed, float orientation, float area, float eccentricity,
+ glm::vec2 majorAxis, glm::vec2 minorAxis)
: CursorEvent(id, eventType, pos, source),
m_Orientation(orientation),
m_Area(area),
@@ -82,7 +82,7 @@ TouchEvent::TouchEvent(int id, Type eventType, const IntPoint& pos, Source sourc
}
TouchEvent::TouchEvent(int id, Type eventType, const IntPoint& pos, Source source,
- const DPoint& speed)
+ const glm::vec2& speed)
: CursorEvent(id, eventType, pos, source),
m_Orientation(0),
m_Area(20),
@@ -104,32 +104,32 @@ CursorEventPtr TouchEvent::cloneAs(Type eventType) const
return pClone;
}
-double TouchEvent::getOrientation() const
+float TouchEvent::getOrientation() const
{
return m_Orientation;
}
-double TouchEvent::getArea() const
+float TouchEvent::getArea() const
{
return m_Area;
}
-const DPoint & TouchEvent::getCenter() const
+const glm::vec2 & TouchEvent::getCenter() const
{
return m_Center;
}
-double TouchEvent::getEccentricity() const
+float TouchEvent::getEccentricity() const
{
return m_Eccentricity;
}
-const DPoint & TouchEvent::getMajorAxis() const
+const glm::vec2 & TouchEvent::getMajorAxis() const
{
return m_MajorAxis;
}
-const DPoint & TouchEvent::getMinorAxis() const
+const glm::vec2 & TouchEvent::getMinorAxis() const
{
return m_MinorAxis;
}
@@ -149,14 +149,14 @@ ContourSeq TouchEvent::getContour()
}
}
-double TouchEvent::getHandOrientation() const
+float TouchEvent::getHandOrientation() const
{
if (getSource() == Event::TOUCH) {
if (m_bHasHandOrientation) {
return m_HandOrientation;
} else {
- DPoint screenCenter = Player::get()->getRootNode()->getSize()/2;
- return (getPos()-screenCenter).getAngle();
+ glm::vec2 screenCenter = Player::get()->getRootNode()->getSize()/2.f;
+ return getAngle(getPos()-screenCenter);
}
} else {
throw Exception(AVG_ERR_UNSUPPORTED,
@@ -169,7 +169,7 @@ void TouchEvent::addRelatedEvent(TouchEventPtr pEvent)
m_RelatedEvents.push_back(pEvent);
if (getSource() == Event::TOUCH && m_RelatedEvents.size() == 1) {
TouchEventPtr pHandEvent = m_RelatedEvents.begin()->lock();
- m_HandOrientation = (pHandEvent->getPos()-getPos()).getAngle();
+ m_HandOrientation = getAngle(pHandEvent->getPos()-getPos());
m_bHasHandOrientation = true;
}
}
@@ -192,7 +192,7 @@ void TouchEvent::removeBlob()
void TouchEvent::trace()
{
CursorEvent::trace();
- AVG_TRACE(Logger::EVENTS2, "pos: " << getPos()
+ AVG_TRACE(Logger::category::EVENTS,Logger::severity::DEBUG, "pos: " << getPos()
<< ", ID: " << getCursorID()
<< ", Area: " << m_Area
<< ", Eccentricity: " << m_Eccentricity);
diff --git a/src/player/TouchEvent.h b/src/player/TouchEvent.h
index 95bbca4..730883a 100644
--- a/src/player/TouchEvent.h
+++ b/src/player/TouchEvent.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -28,7 +28,7 @@
#include "CursorEvent.h"
#include "../imaging/Blob.h"
-#include "../base/Point.h"
+#include "../base/GLMHelper.h"
#include <math.h>
#include <boost/weak_ptr.hpp>
@@ -43,25 +43,25 @@ class AVG_API TouchEvent: public CursorEvent
{
public:
TouchEvent(int id, Type eventType, BlobPtr pBlob, const IntPoint& pos,
- Source source, const DPoint& speed=DPoint(0,0));
+ Source source, const glm::vec2& speed=glm::vec2(0,0));
TouchEvent(int id, Type eventType, const IntPoint& pos, Source source,
- const DPoint& speed, double orientation, double area, double eccentricity,
- DPoint majorAxis, DPoint minorAxis);
+ const glm::vec2& speed, float orientation, float area,
+ float eccentricity, glm::vec2 majorAxis, glm::vec2 minorAxis);
TouchEvent(int id, Type eventType, const IntPoint& pos, Source source,
- const DPoint& speed=DPoint(0, 0));
+ const glm::vec2& speed=glm::vec2(0, 0));
virtual ~TouchEvent();
virtual CursorEventPtr cloneAs(Type eventType) const;
- double getOrientation() const;
- double getArea() const;
- const DPoint & getCenter() const;
- double getEccentricity() const;
- const DPoint & getMajorAxis() const;
- const DPoint & getMinorAxis() const;
+ float getOrientation() const;
+ float getArea() const;
+ const glm::vec2 & getCenter() const;
+ float getEccentricity() const;
+ const glm::vec2 & getMajorAxis() const;
+ const glm::vec2 & getMinorAxis() const;
const BlobPtr getBlob() const;
ContourSeq getContour();
- double getHandOrientation() const;
+ float getHandOrientation() const;
void addRelatedEvent(TouchEventPtr pEvent);
std::vector<TouchEventPtr> getRelatedEvents() const;
@@ -72,15 +72,15 @@ class AVG_API TouchEvent: public CursorEvent
private:
BlobPtr m_pBlob;
- double m_Orientation;
- double m_Area;
- DPoint m_Center;
- double m_Eccentricity;
- DPoint m_MajorAxis;
- DPoint m_MinorAxis;
+ float m_Orientation;
+ float m_Area;
+ glm::vec2 m_Center;
+ float m_Eccentricity;
+ glm::vec2 m_MajorAxis;
+ glm::vec2 m_MinorAxis;
std::vector<TouchEventWeakPtr> m_RelatedEvents;
bool m_bHasHandOrientation;
- double m_HandOrientation;
+ float m_HandOrientation;
};
}
diff --git a/src/player/TouchStatus.cpp b/src/player/TouchStatus.cpp
index 66d63bb..ff08bc9 100644
--- a/src/player/TouchStatus.cpp
+++ b/src/player/TouchStatus.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -53,14 +53,14 @@ void TouchStatus::pushEvent(TouchEventPtr pEvent, bool bCheckMotion)
if (m_bFirstFrame) {
// Ignore unless cursorup.
- if (pEvent->getType() == Event::CURSORUP) {
+ if (pEvent->getType() == Event::CURSOR_UP) {
// Down and up in the first frame. To avoid inconsistencies, both
// messages must be delivered. This is the only time that m_pNewEvents
// has more than one entry.
m_pNewEvents.push_back(pEvent);
}
} else {
- if (bCheckMotion && pEvent->getType() == Event::CURSORMOTION &&
+ if (bCheckMotion && pEvent->getType() == Event::CURSOR_MOTION &&
getLastEvent()->getPos() == pEvent->getPos())
{
// Ignore motion events without motion.
diff --git a/src/player/TouchStatus.h b/src/player/TouchStatus.h
index 7a4eb5a..ffe3e7f 100644
--- a/src/player/TouchStatus.h
+++ b/src/player/TouchStatus.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -22,7 +22,7 @@
#ifndef _TouchStatus_H_
#define _TouchStatus_H_
-#include "../base/Point.h"
+#include "../api.h"
#include <boost/shared_ptr.hpp>
diff --git a/src/player/TrackerCalibrator.cpp b/src/player/TrackerCalibrator.cpp
index a6a6a58..4bc13b9 100644
--- a/src/player/TrackerCalibrator.cpp
+++ b/src/player/TrackerCalibrator.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -83,7 +83,7 @@ TrackerCalibrator::TrackerCalibrator(const IntPoint& CamExtents,
m_DisplayPoints.push_back(
IntPoint(OffsetPerPoint.x*x+MIN_DIST_FROM_BORDER,
OffsetPerPoint.y*y+MIN_DIST_FROM_BORDER));
- m_CamPoints.push_back(DPoint(0,0));
+ m_CamPoints.push_back(glm::dvec2(0,0));
}
}
}
@@ -116,7 +116,7 @@ IntPoint TrackerCalibrator::getDisplayPoint()
return m_DisplayPoints[m_CurPoint];
}
-void TrackerCalibrator::setCamPoint(const DPoint& pt)
+void TrackerCalibrator::setCamPoint(const glm::vec2& pt)
{
m_CamPoints[m_CurPoint] = pt;
m_bCurPointSet = true;
@@ -140,8 +140,8 @@ DeDistortPtr TrackerCalibrator::makeTransformer()
m_DistortParams.push_back(0);
m_Angle = 0;
m_TrapezoidFactor = 0.0;
- m_DisplayOffset= DPoint(0,0);
- m_DisplayScale = DPoint(2,2);
+ m_DisplayOffset= glm::vec2(0,0);
+ m_DisplayScale = glm::vec2(2,2);
int n_p = NUM_PARAMS;
//should really match the Params enum!!!!
@@ -160,15 +160,15 @@ DeDistortPtr TrackerCalibrator::makeTransformer()
initThisFromDouble(p);
/*
for(int i=0;i<NUM_POINTS*NUM_POINTS;i++) {
- DPoint screenPoint = m_CurrentTrafo->transformBlobToScreen(
+ glm::vec2 screenPoint = m_CurrentTrafo->transformBlobToScreen(
m_CurrentTrafo->transform_point(m_CamPoints[i]));
cerr << "sample value of trafo of (cam) "
<< m_CamPoints[i]<<" : (transformed) "
<< screenPoint
<< "== (display)"
- << DPoint(m_DisplayPoints[i])
+ << glm::vec2(m_DisplayPoints[i])
<< " dist="
- << calcDist(DPoint(m_DisplayPoints[i]), screenPoint)
+ << calcDist(glm::vec2(m_DisplayPoints[i]), screenPoint)
<< endl;
}
cerr<<" DisplayScale = "<<m_DisplayScale << endl;
@@ -192,7 +192,7 @@ void TrackerCalibrator::initThisFromDouble(double *p)
m_Angle = p[ANGLE];
m_TrapezoidFactor = p[TRAPEZ];
m_CurrentTrafo = DeDistortPtr(
- new DeDistort(DPoint(m_CamExtents),
+ new DeDistort(glm::vec2(m_CamExtents),
m_DistortParams,
m_Angle,
m_TrapezoidFactor,
@@ -206,13 +206,10 @@ void TrackerCalibrator::evaluate_tracker(double *p, int m_dat, double* fvec, int
{
initThisFromDouble(p);
- for (int i=0; i<m_dat; i++){
- fvec[i] = calcDist(
- m_CurrentTrafo->transformBlobToScreen(
- m_CurrentTrafo->transform_point(m_CamPoints[i])
- ),
- DPoint(m_DisplayPoints[i])
- );
+ for (int i=0; i<m_dat; i++) {
+ glm::dvec2 resultPt = m_CurrentTrafo->transformBlobToScreen(
+ m_CurrentTrafo->transform_point(m_CamPoints[i]));
+ fvec[i] = glm::length(resultPt - glm::dvec2(m_DisplayPoints[i]));
}
*info = *info; /* to prevent a 'unused variable' warning */
/* if <parameters drifted away> { *info = -1; } */
diff --git a/src/player/TrackerCalibrator.h b/src/player/TrackerCalibrator.h
index 9b31963..93779a6 100644
--- a/src/player/TrackerCalibrator.h
+++ b/src/player/TrackerCalibrator.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -24,7 +24,7 @@
#include "../api.h"
#include "../imaging/DeDistort.h"
-#include "../base/Point.h"
+#include "../base/GLMHelper.h"
#include <vector>
@@ -43,7 +43,7 @@ public:
bool nextPoint();
IntPoint getDisplayPoint();
- void setCamPoint(const DPoint& pt);
+ void setCamPoint(const glm::vec2& pt);
DeDistortPtr makeTransformer();
@@ -56,13 +56,13 @@ private:
std::vector<double> m_DistortParams;
double m_Angle;
- DPoint m_DisplayScale;
- DPoint m_DisplayOffset;
+ glm::dvec2 m_DisplayScale;
+ glm::dvec2 m_DisplayOffset;
double m_TrapezoidFactor;
DeDistortPtr m_CurrentTrafo;
unsigned int m_CurPoint;
std::vector<IntPoint> m_DisplayPoints;
- std::vector<DPoint> m_CamPoints;
+ std::vector<glm::dvec2> m_CamPoints;
IntPoint m_CamExtents;
IntPoint m_DisplayExtents;
diff --git a/src/player/TrackerInputDevice.cpp b/src/player/TrackerInputDevice.cpp
index af85784..88e6baa 100644
--- a/src/player/TrackerInputDevice.cpp
+++ b/src/player/TrackerInputDevice.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -37,6 +37,8 @@
#include "../imaging/DeDistort.h"
#include "../imaging/CoordTransformer.h"
+#include "../glm/gtx/norm.hpp"
+
#include "Player.h"
#include "AVGNode.h"
@@ -69,7 +71,7 @@ TrackerInputDevice::TrackerInputDevice()
bool bFW800 = m_TrackerConfig.getBoolParam("/camera/fw800/@value");
IntPoint captureSize(m_TrackerConfig.getPointParam("/camera/size/"));
string sCaptureFormat = m_TrackerConfig.getParam("/camera/format/@value");
- double frameRate = m_TrackerConfig.getDoubleParam("/camera/framerate/@value");
+ float frameRate = m_TrackerConfig.getFloatParam("/camera/framerate/@value");
PixelFormat camPF = stringToPixelFormat(sCaptureFormat);
if (camPF == NO_PIXELFORMAT) {
@@ -77,12 +79,14 @@ TrackerInputDevice::TrackerInputDevice()
"Unknown camera pixel format "+sCaptureFormat+".");
}
- AVG_TRACE(Logger::CONFIG, "Trying to create a Tracker for " << sDriver
+ AVG_TRACE(Logger::category::CONFIG, Logger::severity::INFO,
+ "Trying to create a Tracker for " << sDriver
<< " Camera: " << sDevice << " Size: " << captureSize << "format: "
<< sCaptureFormat);
m_pCamera = createCamera(sDriver, sDevice, -1, bFW800, captureSize, camPF, I8,
frameRate);
- AVG_TRACE(Logger::CONFIG, "Got Camera " << m_pCamera->getDevice() << " from driver: "
+ AVG_TRACE(Logger::category::CONFIG, Logger::severity::INFO,
+ "Got Camera " << m_pCamera->getDevice() << " from driver: "
<< m_pCamera->getDriverName());
IntPoint imgSize = m_pCamera->getImgSize();
@@ -99,15 +103,14 @@ TrackerInputDevice::TrackerInputDevice()
try {
m_DisplayROI = m_TrackerConfig.getRectParam("/transform/displayroi/");
} catch (Exception) {
- m_DisplayROI = DRect(DPoint(0,0), DPoint(m_ActiveDisplaySize));
+ m_DisplayROI = FRect(glm::vec2(0,0), glm::vec2(m_ActiveDisplaySize));
}
IntRect roi = m_pDeDistort->getActiveBlobArea(m_DisplayROI);
if (roi.tl.x < 0 || roi.tl.y < 0 ||
roi.br.x > imgSize.x || roi.br.y > imgSize.y)
{
- AVG_TRACE(Logger::ERROR,
- "Impossible tracker configuration: Region of interest is "
+ AVG_LOG_ERROR("Impossible tracker configuration: Region of interest is "
<< roi << ", camera image size is " << imgSize << ". Aborting.");
exit(5);
}
@@ -157,8 +160,8 @@ void TrackerInputDevice::setParam(const string& sElement, const string& sValue)
m_TrackerConfig.setParam(sElement, sValue);
// Test if active area is outside camera.
- DRect area = m_pDeDistort->getActiveBlobArea(m_DisplayROI);
- DPoint size = m_TrackerConfig.getPointParam("/camera/size/");
+ FRect area = m_pDeDistort->getActiveBlobArea(m_DisplayROI);
+ glm::vec2 size = m_TrackerConfig.getPointParam("/camera/size/");
int prescale = m_TrackerConfig.getIntParam("/tracker/prescale/@value");
if (area.br.x > size.x/prescale || area.br.y > size.y/prescale ||
area.tl.x < 0 || area.tl.y < 0)
@@ -194,7 +197,7 @@ void TrackerInputDevice::saveConfig()
void TrackerInputDevice::setConfig()
{
m_pDeDistort = m_TrackerConfig.getTransform();
- DRect area = m_pDeDistort->getActiveBlobArea(m_DisplayROI);
+ FRect area = m_pDeDistort->getActiveBlobArea(m_DisplayROI);
createBitmaps(area);
m_pCmdQueue->pushCmd(boost::bind(&TrackerThread::setConfig, _1, m_TrackerConfig,
area, m_pBitmaps));
@@ -202,7 +205,7 @@ void TrackerInputDevice::setConfig()
void TrackerInputDevice::createBitmaps(const IntRect& area)
{
- boost::mutex::scoped_lock lock(*m_pMutex);
+ lock_guard lock(*m_pMutex);
for (int i=1; i<NUM_TRACKER_IMAGES; i++) {
switch (i) {
case TRACKER_IMG_HISTOGRAM:
@@ -226,16 +229,16 @@ void TrackerInputDevice::createBitmaps(const IntRect& area)
Bitmap * TrackerInputDevice::getImage(TrackerImageID imageID) const
{
- boost::mutex::scoped_lock lock(*m_pMutex);
+ lock_guard lock(*m_pMutex);
return new Bitmap(*m_pBitmaps[imageID]);
}
-DPoint TrackerInputDevice::getDisplayROIPos() const
+glm::vec2 TrackerInputDevice::getDisplayROIPos() const
{
return m_DisplayROI.tl;
}
-DPoint TrackerInputDevice::getDisplayROISize() const
+glm::vec2 TrackerInputDevice::getDisplayROISize() const
{
return m_DisplayROI.size();
}
@@ -259,14 +262,14 @@ void TrackerInputDevice::update(BlobVectorPtr pTrackBlobs,
// Temporary structure to be put into heap of blob distances. Used only in
// trackBlobIDs.
struct BlobDistEntry {
- BlobDistEntry(double dist, BlobPtr pNewBlob, BlobPtr pOldBlob)
+ BlobDistEntry(float dist, BlobPtr pNewBlob, BlobPtr pOldBlob)
: m_Dist(dist),
m_pNewBlob(pNewBlob),
m_pOldBlob(pOldBlob)
{
}
- double m_Dist;
+ float m_Dist;
BlobPtr m_pNewBlob;
BlobPtr m_pOldBlob;
};
@@ -300,14 +303,14 @@ void TrackerInputDevice::trackBlobIDs(BlobVectorPtr pNewBlobs, long long time,
oldBlobs.push_back((*it).first);
}
// Create a heap that contains all distances of old to new blobs < MaxDist
- double MaxDist = m_TrackerConfig.getDoubleParam(sConfigPath+"similarity/@value");
- double MaxDistSquared = MaxDist*MaxDist;
+ float MaxDist = m_TrackerConfig.getFloatParam(sConfigPath+"similarity/@value");
+ float MaxDistSquared = MaxDist*MaxDist;
priority_queue<BlobDistEntryPtr> distHeap;
for (BlobVector::iterator it = pNewBlobs->begin(); it != pNewBlobs->end(); ++it) {
BlobPtr pNewBlob = *it;
for(BlobVector::iterator it2 = oldBlobs.begin(); it2 != oldBlobs.end(); ++it2) {
BlobPtr pOldBlob = *it2;
- double distSquared = calcDistSquared(pNewBlob->getCenter(),
+ float distSquared = glm::distance2(pNewBlob->getCenter(),
pOldBlob->getEstimatedNextCenter());
if (distSquared <= MaxDistSquared) {
BlobDistEntryPtr pEntry = BlobDistEntryPtr(
@@ -368,9 +371,9 @@ TrackerCalibrator* TrackerInputDevice::startCalibration()
AVG_ASSERT(!m_pCalibrator);
m_pOldTransformer = m_TrackerConfig.getTransform();
m_OldDisplayROI = m_DisplayROI;
- m_DisplayROI = DRect(DPoint(0,0), DPoint(m_ActiveDisplaySize));
+ m_DisplayROI = FRect(glm::vec2(0,0), glm::vec2(m_ActiveDisplaySize));
m_TrackerConfig.setTransform(DeDistortPtr(new DeDistort(
- DPoint(m_pBitmaps[0]->getSize()), DPoint(m_ActiveDisplaySize))));
+ glm::vec2(m_pBitmaps[0]->getSize()), glm::vec2(m_ActiveDisplaySize))));
setConfig();
m_pCalibrator = new TrackerCalibrator(m_pBitmaps[0]->getSize(),
m_ActiveDisplaySize);
@@ -382,10 +385,9 @@ void TrackerInputDevice::endCalibration()
AVG_ASSERT(m_pCalibrator);
m_TrackerConfig.setTransform(m_pCalibrator->makeTransformer());
m_DisplayROI = m_OldDisplayROI;
- DRect area = m_TrackerConfig.getTransform()->getActiveBlobArea(m_DisplayROI);
+ FRect area = m_TrackerConfig.getTransform()->getActiveBlobArea(m_DisplayROI);
if (area.size().x*area.size().y > 1024*1024*8) {
- AVG_TRACE(Logger::WARNING, "Ignoring calibration - resulting area would be "
- << area);
+ AVG_LOG_WARNING("Ignoring calibration - resulting area would be " << area);
m_TrackerConfig.setTransform(m_pOldTransformer);
}
setConfig();
@@ -406,7 +408,7 @@ void TrackerInputDevice::abortCalibration()
vector<EventPtr> TrackerInputDevice::pollEvents()
{
- boost::mutex::scoped_lock lock(*m_pMutex);
+ lock_guard lock(*m_pMutex);
vector<EventPtr> pTouchEvents;
vector<EventPtr> pTrackEvents;
pollEventType(pTouchEvents, m_TouchEvents, CursorEvent::TOUCH);
@@ -429,7 +431,7 @@ void TrackerInputDevice::pollEventType(vector<EventPtr>& res, TouchStatusMap& Ev
pEvent = pTouchStatus->pollEvent();
if (pEvent) {
res.push_back(pEvent);
- if (pEvent->getType() == Event::CURSORUP) {
+ if (pEvent->getType() == Event::CURSOR_UP) {
Events.erase(it++);
} else {
++it;
@@ -476,12 +478,12 @@ void TrackerInputDevice::findFingertips(std::vector<EventPtr>& pTouchEvents)
TouchEventPtr pTouchEvent = boost::dynamic_pointer_cast<TouchEvent>(*it);
vector<TouchEventPtr> pTrackEvents = pTouchEvent->getRelatedEvents();
if (pTrackEvents.size() > 0) {
- double handAngle = pTouchEvent->getHandOrientation();
- double dist = pTouchEvent->getMajorAxis().getNorm()*2;
- DPoint tweakVec = DPoint::fromPolar(handAngle, dist);
- DPoint newPos = pTouchEvent->getPos()-tweakVec;
- newPos.x = max(0.0, min(newPos.x, double(m_ActiveDisplaySize.x)));
- newPos.y = max(0.0, min(newPos.y, double(m_ActiveDisplaySize.y)));
+ float handAngle = pTouchEvent->getHandOrientation();
+ float dist = glm::length(pTouchEvent->getMajorAxis())*2;
+ glm::vec2 tweakVec = fromPolar(handAngle, dist);
+ glm::vec2 newPos = pTouchEvent->getPos()-tweakVec;
+ newPos.x = max(0.0f, min(newPos.x, float(m_ActiveDisplaySize.x)));
+ newPos.y = max(0.0f, min(newPos.y, float(m_ActiveDisplaySize.y)));
pTouchEvent->setPos(newPos);
}
}
diff --git a/src/player/TrackerInputDevice.h b/src/player/TrackerInputDevice.h
index b09890b..eda8a8d 100644
--- a/src/player/TrackerInputDevice.h
+++ b/src/player/TrackerInputDevice.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -62,8 +62,8 @@ class AVG_API TrackerInputDevice: public IBlobTarget, public IInputDevice
void setDebugImages(bool bImg, bool bFinger);
void saveConfig();
Bitmap * getImage(TrackerImageID imageID) const;
- DPoint getDisplayROIPos() const;
- DPoint getDisplayROISize() const;
+ glm::vec2 getDisplayROIPos() const;
+ glm::vec2 getDisplayROISize() const;
std::vector<EventPtr> pollEvents(); //main thread
@@ -95,8 +95,8 @@ class AVG_API TrackerInputDevice: public IBlobTarget, public IInputDevice
DeDistortPtr m_pDeDistort;
DeDistortPtr m_pOldTransformer;
IntPoint m_ActiveDisplaySize;
- DRect m_DisplayROI;
- DRect m_OldDisplayROI;
+ FRect m_DisplayROI;
+ FRect m_OldDisplayROI;
TrackerCalibrator * m_pCalibrator;
bool m_bFindFingertips;
diff --git a/src/player/TrackerTouchStatus.cpp b/src/player/TrackerTouchStatus.cpp
index 2377228..f52bd3b 100644
--- a/src/player/TrackerTouchStatus.cpp
+++ b/src/player/TrackerTouchStatus.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -35,8 +35,8 @@ namespace avg {
int TrackerTouchStatus::s_LastID = 0;
TrackerTouchStatus::TrackerTouchStatus(BlobPtr pFirstBlob, long long time,
- DeDistortPtr pDeDistort, const DRect& displayROI, Event::Source source)
- : TouchStatus(createEvent(source, Event::CURSORDOWN, ++s_LastID, pFirstBlob, time,
+ DeDistortPtr pDeDistort, const FRect& displayROI, Event::Source source)
+ : TouchStatus(createEvent(source, Event::CURSOR_DOWN, ++s_LastID, pFirstBlob, time,
pDeDistort, displayROI)),
m_Source(source),
m_pDeDistort(pDeDistort),
@@ -62,16 +62,16 @@ void TrackerTouchStatus::blobChanged(BlobPtr pNewBlob, long long time, bool bKee
AVG_ASSERT(m_pBlob);
AVG_ASSERT(pNewBlob);
if (!m_bGone) {
- DPoint c = pNewBlob->getCenter();
+ glm::vec2 c = pNewBlob->getCenter();
bool bPosChanged;
if (bKeepEvent) {
bPosChanged = true;
} else {
- bPosChanged = (calcDist(c, m_LastCenter) > 1);
+ bPosChanged = (glm::length(c-m_LastCenter) > 1);
}
if (bPosChanged) {
m_LastCenter = pNewBlob->getCenter();
- TouchEventPtr pEvent = createEvent(Event::CURSORMOTION, pNewBlob, time);
+ TouchEventPtr pEvent = createEvent(Event::CURSOR_MOTION, pNewBlob, time);
pushEvent(pEvent, false);
}
m_pBlob = pNewBlob;
@@ -83,7 +83,7 @@ void TrackerTouchStatus::blobChanged(BlobPtr pNewBlob, long long time, bool bKee
void TrackerTouchStatus::blobGone()
{
if (!m_bGone) {
- TouchEventPtr pEvent = createEvent(Event::CURSORUP, m_pBlob, m_LastTime+1);
+ TouchEventPtr pEvent = createEvent(Event::CURSOR_UP, m_pBlob, m_LastTime+1);
pushEvent(pEvent, false);
m_bGone = true;
}
@@ -101,11 +101,11 @@ bool TrackerTouchStatus::isStale()
TouchEventPtr TrackerTouchStatus::createEvent(Event::Source source, Event::Type type,
int id, BlobPtr pBlob, long long time, DeDistortPtr pDeDistort,
- const DRect& displayROI)
+ const FRect& displayROI)
{
- DPoint blobOffset = pDeDistort->getActiveBlobArea(displayROI).tl;
- DPoint pt = pBlob->getCenter() + blobOffset;
- DPoint screenpos = pDeDistort->transformBlobToScreen(pt);
+ glm::vec2 blobOffset = pDeDistort->getActiveBlobArea(displayROI).tl;
+ glm::vec2 pt = pBlob->getCenter() + blobOffset;
+ glm::dvec2 screenpos(pDeDistort->transformBlobToScreen(glm::dvec2(pt)));
IntPoint pos(int(screenpos.x+0.5), int(screenpos.y+0.5));
return TouchEventPtr(new TouchEvent(id, type, pBlob, pos, source));
diff --git a/src/player/TrackerTouchStatus.h b/src/player/TrackerTouchStatus.h
index 53b9e4a..5d75f5d 100644
--- a/src/player/TrackerTouchStatus.h
+++ b/src/player/TrackerTouchStatus.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -26,7 +26,7 @@
#include "Event.h"
#include "TouchStatus.h"
-#include "../base/Point.h"
+#include "../base/GLMHelper.h"
#include "../imaging/Blob.h"
#include "../imaging/DeDistort.h"
@@ -39,7 +39,7 @@ class AVG_API TrackerTouchStatus: public TouchStatus
{
public:
TrackerTouchStatus(BlobPtr pFirstBlob, long long time, DeDistortPtr pDeDistort,
- const DRect& displayROI, Event::Source source);
+ const FRect& displayROI, Event::Source source);
virtual ~TrackerTouchStatus();
void blobChanged(BlobPtr pNewBlob, long long time, bool bKeepEvent);
void blobGone();
@@ -49,18 +49,18 @@ class AVG_API TrackerTouchStatus: public TouchStatus
private:
TouchEventPtr createEvent(Event::Source source, Event::Type type, int id,
BlobPtr pBlob, long long time, DeDistortPtr pDeDistort,
- const DRect& displayROI);
+ const FRect& displayROI);
TouchEventPtr createEvent(Event::Type type, BlobPtr pBlob, long long time);
Event::Source m_Source;
DeDistortPtr m_pDeDistort;
- DRect m_DisplayROI;
+ FRect m_DisplayROI;
bool m_Stale;
bool m_bGone;
int m_ID;
BlobPtr m_pBlob;
long long m_LastTime;
- DPoint m_LastCenter;
+ glm::vec2 m_LastCenter;
static int s_LastID;
};
diff --git a/src/player/NodeDefinition.cpp b/src/player/TypeDefinition.cpp
index 32cfb68..f2d5ec5 100644
--- a/src/player/NodeDefinition.cpp
+++ b/src/player/TypeDefinition.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -18,10 +18,8 @@
//
// Current versions can be found at www.libavg.de
//
-// Original author of this file is Nick Hebner (hebnern@gmail.com).
-//
-#include "NodeDefinition.h"
+#include "TypeDefinition.h"
#include "../base/Logger.h"
@@ -29,42 +27,48 @@ using namespace std;
namespace avg {
-NodeDefinition::NodeDefinition() :
+TypeDefinition::TypeDefinition() :
m_pBuilder(0)
{
}
-NodeDefinition::NodeDefinition(const string& sName, NodeBuilder pBuilder)
+TypeDefinition::TypeDefinition(const string& sName, const string& sBaseName,
+ ObjectBuilder pBuilder)
: m_sName(sName),
m_pBuilder(pBuilder)
{
+ if (sBaseName != "") {
+ TypeDefinition baseDef = TypeRegistry::get()->getTypeDef(sBaseName);
+ m_Args.copyArgsFrom(baseDef.m_Args);
+ m_sChildren = baseDef.m_sChildren;
+ }
}
-NodeDefinition::~NodeDefinition()
+TypeDefinition::~TypeDefinition()
{
}
-const std::string& NodeDefinition::getName() const
+const std::string& TypeDefinition::getName() const
{
return m_sName;
}
-NodeBuilder NodeDefinition::getBuilder() const
+ObjectBuilder TypeDefinition::getBuilder() const
{
return m_pBuilder;
}
-const ArgList& NodeDefinition::getDefaultArgs() const
+const ArgList& TypeDefinition::getDefaultArgs() const
{
return m_Args;
}
-const string& NodeDefinition::getDTDElements() const
+const string& TypeDefinition::getDTDElements() const
{
return m_sDTDElements;
}
-string NodeDefinition::getDTDChildrenString() const
+string TypeDefinition::getDTDChildrenString() const
{
if (m_sChildren.empty()) {
return "EMPTY";
@@ -79,7 +83,7 @@ string NodeDefinition::getDTDChildrenString() const
}
}
-bool NodeDefinition::isChildAllowed(const string& sChild) const
+bool TypeDefinition::isChildAllowed(const string& sChild) const
{
for (unsigned i=0; i<m_sChildren.size(); ++i) {
if (m_sChildren[i] == sChild) {
@@ -89,34 +93,38 @@ bool NodeDefinition::isChildAllowed(const string& sChild) const
return false;
}
-bool NodeDefinition::hasChildren() const
+bool TypeDefinition::hasChildren() const
{
return !m_sChildren.empty();
}
-NodeDefinition& NodeDefinition::extendDefinition(const NodeDefinition& Def)
+bool TypeDefinition::isAbstract() const
{
- m_Args.copyArgsFrom(Def.m_Args);
- m_sChildren = Def.m_sChildren;
- return *this;
+ return m_pBuilder == 0;
}
-NodeDefinition& NodeDefinition::addArg(const ArgBase& newArg)
+TypeDefinition& TypeDefinition::addArg(const ArgBase& newArg)
{
m_Args.setArg(newArg);
return *this;
}
-NodeDefinition& NodeDefinition::addDTDElements(const string& s)
+TypeDefinition& TypeDefinition::addDTDElements(const string& s)
{
m_sDTDElements = s;
return *this;
}
-NodeDefinition& NodeDefinition::addChildren(const vector<string>& sChildren)
+TypeDefinition& TypeDefinition::addChildren(const vector<string>& sChildren)
{
m_sChildren.insert(m_sChildren.end(), sChildren.begin(), sChildren.end());
return *this;
}
+TypeDefinition& TypeDefinition::addChild(const string& sChild)
+{
+ m_sChildren.push_back(sChild);
+ return *this;
+}
+
}
diff --git a/src/player/NodeDefinition.h b/src/player/TypeDefinition.h
index aeda123..e1275f4 100644
--- a/src/player/NodeDefinition.h
+++ b/src/player/TypeDefinition.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -18,51 +18,52 @@
//
// Current versions can be found at www.libavg.de
//
-// Original author of this file is Nick Hebner (hebnern@gmail.com).
-//
-#ifndef _NodeDefinition_H_
-#define _NodeDefinition_H_
+#ifndef _TypeDefinition_H_
+#define _TypeDefinition_H_
#include "../api.h"
#include "ArgList.h"
+#include "TypeRegistry.h"
#include <map>
#include <string>
namespace avg {
-class Node;
-typedef boost::shared_ptr<Node> NodePtr;
-class NodeDefinition;
+class ExportedObject;
+typedef boost::shared_ptr<ExportedObject> ExportedObjectPtr;
+class TypeDefinition;
-typedef NodePtr (*NodeBuilder)(const ArgList& Args);
-typedef std::map<std::string, NodeDefinition> ChildMap;
+typedef ExportedObjectPtr (*ObjectBuilder)(const ArgList& Args);
+typedef std::map<std::string, TypeDefinition> ChildMap;
-class AVG_API NodeDefinition
+class AVG_API TypeDefinition
{
public:
- NodeDefinition();
- NodeDefinition(const std::string& sName, NodeBuilder pBuilder = 0);
- virtual ~NodeDefinition();
+ TypeDefinition();
+ TypeDefinition(const std::string& sName, const std::string& sBaseName="",
+ ObjectBuilder pBuilder = 0);
+ virtual ~TypeDefinition();
const std::string& getName() const;
- NodeBuilder getBuilder() const;
+ ObjectBuilder getBuilder() const;
const ArgList& getDefaultArgs() const;
const std::string& getDTDElements() const;
std::string getDTDChildrenString() const;
bool isChildAllowed(const std::string& sChild) const;
bool hasChildren() const;
+ bool isAbstract() const;
- NodeDefinition& extendDefinition(const NodeDefinition& Def);
- NodeDefinition& addArg(const ArgBase& newArg);
- NodeDefinition& addDTDElements(const std::string& s);
- NodeDefinition& addChildren(const std::vector<std::string>& sChildren);
+ TypeDefinition& addArg(const ArgBase& newArg);
+ TypeDefinition& addDTDElements(const std::string& s);
+ TypeDefinition& addChildren(const std::vector<std::string>& sChildren);
+ TypeDefinition& addChild(const std::string& sChild);
private:
std::string m_sName;
- NodeBuilder m_pBuilder;
+ ObjectBuilder m_pBuilder;
ArgList m_Args;
std::string m_sDTDElements;
std::vector<std::string> m_sChildren;
diff --git a/src/player/TypeRegistry.cpp b/src/player/TypeRegistry.cpp
new file mode 100644
index 0000000..0de3609
--- /dev/null
+++ b/src/player/TypeRegistry.cpp
@@ -0,0 +1,159 @@
+//
+// 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 "TypeRegistry.h"
+#include "TypeDefinition.h"
+
+#include "../base/MathHelper.h"
+#include "../base/Exception.h"
+
+#include <set>
+
+using namespace std;
+
+namespace avg {
+
+TypeRegistry* TypeRegistry::s_pInstance = 0;
+
+TypeRegistry::TypeRegistry()
+{
+}
+
+TypeRegistry::~TypeRegistry()
+{
+}
+
+TypeRegistry* TypeRegistry::get()
+{
+ if (!s_pInstance) {
+ s_pInstance = new TypeRegistry();
+ }
+ return s_pInstance;
+}
+
+void TypeRegistry::registerType(const TypeDefinition& def, const char* pParentNames[])
+{
+ m_TypeDefs.insert(TypeDefMap::value_type(def.getName(), def));
+
+ if (pParentNames) {
+ string sChildArray[1];
+ sChildArray[0] = def.getName();
+ vector<string> sChildren = vectorFromCArray(1, sChildArray);
+ const char **ppCurParentName = pParentNames;
+
+ while (*ppCurParentName) {
+ TypeDefinition def = getTypeDef(*ppCurParentName);
+ def.addChildren(sChildren);
+ updateDefinition(def);
+
+ ++ppCurParentName;
+ }
+ }
+}
+
+void TypeRegistry::updateDefinition(const TypeDefinition& def)
+{
+ m_TypeDefs[def.getName()] = def;
+}
+
+ExportedObjectPtr TypeRegistry::createObject(const string& sType,
+ const xmlNodePtr xmlNode)
+{
+ const TypeDefinition& def = getTypeDef(sType);
+ ArgList args(def.getDefaultArgs(), xmlNode);
+ ObjectBuilder builder = def.getBuilder();
+ ExportedObjectPtr pObj = builder(args);
+ pObj->setTypeInfo(&def);
+ return pObj;
+}
+
+ExportedObjectPtr TypeRegistry::createObject(const string& sType, const py::dict& pyDict)
+{
+ const TypeDefinition& def = getTypeDef(sType);
+ py::dict effParams;
+ effParams = pyDict;
+ ArgList args(def.getDefaultArgs(), effParams);
+ ObjectBuilder builder = def.getBuilder();
+ ExportedObjectPtr pObj = builder(args);
+ pObj->setTypeInfo(&def);
+ return pObj;
+}
+
+string TypeRegistry::getDTD() const
+{
+ if (m_TypeDefs.empty()) {
+ return string("");
+ }
+
+ stringstream ss;
+
+ for (TypeDefMap::const_iterator defIt = m_TypeDefs.begin();
+ defIt != m_TypeDefs.end(); defIt++)
+ {
+ const TypeDefinition& def = defIt->second;
+ if (!def.isAbstract()) {
+ writeTypeDTD(def, ss);
+ }
+ }
+
+ for (TypeDefMap::const_iterator defIt = m_TypeDefs.begin();
+ defIt != m_TypeDefs.end(); defIt++)
+ {
+ const TypeDefinition& def = defIt->second;
+ if (!def.isAbstract()) {
+ ss << def.getDTDElements();
+ }
+ }
+
+ return ss.str();
+}
+
+TypeDefinition& TypeRegistry::getTypeDef(const string& sType)
+{
+ TypeDefMap::iterator it = m_TypeDefs.find(sType);
+ if (it == m_TypeDefs.end()) {
+ throw (Exception (AVG_ERR_XML_NODE_UNKNOWN,
+ string("Unknown node type ") + sType + " encountered."));
+ }
+ return it->second;
+}
+
+void TypeRegistry::writeTypeDTD(const TypeDefinition& def, stringstream& ss) const
+{
+ ss << "<!ELEMENT " << def.getName() << " " << def.getDTDChildrenString() << " >\n";
+ if (!def.getDefaultArgs().getArgMap().empty()) {
+ ss << "<!ATTLIST " << def.getName();
+ for (ArgMap::const_iterator argIt = def.getDefaultArgs().getArgMap().begin();
+ argIt != def.getDefaultArgs().getArgMap().end(); argIt++)
+ {
+ string argName = argIt->first;
+ string argType = (argName == "id") ? "ID" : "CDATA";
+ string argRequired = def.getDefaultArgs().getArg(argName)->isRequired() ?
+ "#REQUIRED" : "#IMPLIED";
+ ss << "\n " << argName << " " << argType << " " << argRequired;
+ }
+ ss << " >\n";
+ }
+}
+
+}
diff --git a/src/player/NodeRegistry.h b/src/player/TypeRegistry.h
index 9aee371..3b38018 100644
--- a/src/player/NodeRegistry.h
+++ b/src/player/TypeRegistry.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -21,14 +21,14 @@
// Original author of this file is Nick Hebner (hebnern@gmail.com).
//
-#ifndef _NodeRegistry_H_
-#define _NodeRegistry_H_
+#ifndef _TypeRegistry_H_
+#define _TypeRegistry_H_
#include "../api.h"
#include "WrapPython.h"
#include "Node.h"
#include "ArgList.h"
-#include "NodeDefinition.h"
+#include "TypeDefinition.h"
#include <map>
#include <string>
@@ -36,25 +36,28 @@
namespace avg {
-class AVG_API NodeRegistry
+class AVG_API TypeRegistry
{
public:
- NodeRegistry();
- virtual ~NodeRegistry();
+ virtual ~TypeRegistry();
+ static TypeRegistry* get();
- void registerNodeType(const NodeDefinition& def);
- void updateNodeDefinition(const NodeDefinition& def);
- const NodeDefinition& getNodeDef(const std::string& Type);
- NodePtr createNode(const std::string& Type, const xmlNodePtr xmlNode);
- NodePtr createNode(const std::string& Type, const boost::python::dict& PyDict);
+ void registerType(const TypeDefinition& def, const char* pParentNames[] = 0);
+ void updateDefinition(const TypeDefinition& def);
+ TypeDefinition& getTypeDef(const std::string& Type);
+ ExportedObjectPtr createObject(const std::string& Type, const xmlNodePtr xmlNode);
+ ExportedObjectPtr createObject(const std::string& Type, const py::dict& PyDict);
std::string getDTD() const;
private:
- void writeNodeDTD(const NodeDefinition& def, std::stringstream& ss) const;
+ TypeRegistry();
+ void writeTypeDTD(const TypeDefinition& def, std::stringstream& ss) const;
- typedef std::map<std::string, NodeDefinition> NodeDefMap;
- NodeDefMap m_NodeDefs;
+ typedef std::map<std::string, TypeDefinition> TypeDefMap;
+ TypeDefMap m_TypeDefs;
+
+ static TypeRegistry* s_pInstance;
};
}
diff --git a/src/player/VectorNode.cpp b/src/player/VectorNode.cpp
index 427d637..f484a3b 100644
--- a/src/player/VectorNode.cpp
+++ b/src/player/VectorNode.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -21,7 +21,7 @@
#include "VectorNode.h"
-#include "NodeDefinition.h"
+#include "TypeDefinition.h"
#include "OGLSurface.h"
#include "Image.h"
@@ -37,6 +37,8 @@
#include "../graphics/VertexArray.h"
#include "../graphics/Filterfliprgb.h"
+#include "../glm/gtx/norm.hpp"
+
#include <iostream>
#include <sstream>
@@ -45,19 +47,20 @@ using namespace boost;
namespace avg {
-NodeDefinition VectorNode::createDefinition()
+void VectorNode::registerType()
{
- return NodeDefinition("vector")
- .extendDefinition(Node::createDefinition())
+ TypeDefinition def = TypeDefinition("vectornode", "node")
.addArg(Arg<string>("color", "FFFFFF", false, offsetof(VectorNode, m_sColorName)))
- .addArg(Arg<double>("strokewidth", 1, false, offsetof(VectorNode, m_StrokeWidth)))
+ .addArg(Arg<float>("strokewidth", 1, false, offsetof(VectorNode, m_StrokeWidth)))
.addArg(Arg<UTF8String>("texhref", "", false, offsetof(VectorNode, m_TexHRef)))
.addArg(Arg<string>("blendmode", "blend", false,
offsetof(VectorNode, m_sBlendMode)))
;
+ TypeRegistry::get()->registerType(def);
}
VectorNode::VectorNode(const ArgList& args)
+ : m_Transform(glm::mat4(0))
{
m_pShape = ShapePtr(createDefaultShape());
@@ -79,7 +82,6 @@ void VectorNode::connectDisplay()
m_Color = colorStringToColor(m_sColorName);
Node::connectDisplay();
m_pShape->moveToGPU();
- m_OldOpacity = -1;
setBlendModeStr(m_sBlendMode);
}
@@ -140,51 +142,44 @@ void VectorNode::setBlendModeStr(const string& sBlendMode)
static ProfilingZoneID PrerenderProfilingZone("VectorNode::prerender");
-void VectorNode::preRender()
+void VectorNode::preRender(const VertexArrayPtr& pVA, bool bIsParentActive,
+ float parentEffectiveOpacity)
{
- Node::preRender();
- double curOpacity = getEffectiveOpacity();
-
- VertexArrayPtr pVA = m_pShape->getVertexArray();
+ Node::preRender(pVA, bIsParentActive, parentEffectiveOpacity);
{
- if (m_bDrawNeeded || curOpacity != m_OldOpacity) {
- ScopeTimer timer(PrerenderProfilingZone);
- pVA->reset();
+ ScopeTimer timer(PrerenderProfilingZone);
+ VertexDataPtr pShapeVD = m_pShape->getVertexData();
+ if (m_bDrawNeeded) {
+ pShapeVD->reset();
Pixel32 color = getColorVal();
- color.setA((unsigned char)(curOpacity*255));
- calcVertexes(pVA, color);
- pVA->update();
+ calcVertexes(pShapeVD, color);
m_bDrawNeeded = false;
- m_OldOpacity = curOpacity;
+ }
+ if (isVisible()) {
+ m_pShape->setVertexArray(pVA);
}
}
-
}
-void VectorNode::maybeRender(const DRect& rect)
+void VectorNode::maybeRender(const glm::mat4& parentTransform)
{
AVG_ASSERT(getState() == NS_CANRENDER);
if (isVisible()) {
- if (getID() != "") {
- AVG_TRACE(Logger::BLTS, "Rendering " << getTypeStr() <<
- " with ID " << getID());
- } else {
- AVG_TRACE(Logger::BLTS, "Rendering " << getTypeStr());
- }
- GLContext::getCurrent()->setBlendMode(m_BlendMode);
- render(rect);
+ m_Transform = parentTransform;
+ GLContext::getMain()->setBlendMode(m_BlendMode);
+ render();
}
}
static ProfilingZoneID RenderProfilingZone("VectorNode::render");
-void VectorNode::render(const DRect& rect)
+void VectorNode::render()
{
ScopeTimer timer(RenderProfilingZone);
-// glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
- double curOpacity = getEffectiveOpacity();
- glColor4d(1.0, 1.0, 1.0, curOpacity);
- m_pShape->draw();
+ float curOpacity = getEffectiveOpacity();
+ if (curOpacity > 0.01) {
+ m_pShape->draw(m_Transform, curOpacity);
+ }
}
void VectorNode::setColor(const string& sColor)
@@ -201,7 +196,7 @@ const string& VectorNode::getColor() const
return m_sColorName;
}
-void VectorNode::setStrokeWidth(double width)
+void VectorNode::setStrokeWidth(float width)
{
if (width != m_StrokeWidth) {
m_bDrawNeeded = true;
@@ -209,7 +204,7 @@ void VectorNode::setStrokeWidth(double width)
}
}
-double VectorNode::getStrokeWidth() const
+float VectorNode::getStrokeWidth() const
{
return m_StrokeWidth;
}
@@ -259,27 +254,27 @@ bool VectorNode::isDrawNeeded()
return m_bDrawNeeded;
}
-void VectorNode::calcPolyLineCumulDist(vector<double>& cumulDists,
- const vector<DPoint>& pts, bool bIsClosed)
+void VectorNode::calcPolyLineCumulDist(vector<float>& cumulDists,
+ const vector<glm::vec2>& pts, bool bIsClosed)
{
cumulDists.clear();
cumulDists.reserve(pts.size());
if (!pts.empty()) {
- vector<double> distances;
+ vector<float> distances;
distances.reserve(pts.size());
- double totalDist = 0;
+ float totalDist = 0;
for (unsigned i = 1; i < pts.size(); ++i) {
- double dist = calcDist(pts[i], pts[i-1]);
+ float dist = glm::length(pts[i] - pts[i-1]);
distances.push_back(dist);
totalDist += dist;
}
if (bIsClosed) {
- double dist = calcDist(pts[pts.size()-1], pts[0]);
+ float dist = glm::length(pts[pts.size()-1] - pts[0]);
distances.push_back(dist);
totalDist += dist;
}
- double cumulDist = 0;
+ float cumulDist = 0;
cumulDists.push_back(0);
for (unsigned i = 0; i < distances.size(); ++i) {
cumulDist += distances[i]/totalDist;
@@ -288,8 +283,8 @@ void VectorNode::calcPolyLineCumulDist(vector<double>& cumulDists,
}
}
-void VectorNode::calcEffPolyLineTexCoords(vector<double>& effTC,
- const vector<double>& tc, const vector<double>& cumulDist)
+void VectorNode::calcEffPolyLineTexCoords(vector<float>& effTC,
+ const vector<float>& tc, const vector<float>& cumulDist)
{
if (tc.empty()) {
effTC = cumulDist;
@@ -298,39 +293,40 @@ void VectorNode::calcEffPolyLineTexCoords(vector<double>& effTC,
} else {
effTC.reserve(cumulDist.size());
effTC = tc;
- double minGivenTexCoord = tc[0];
- double maxGivenTexCoord = tc[tc.size()-1];
- double maxCumulDist = cumulDist[tc.size()-1];
+ float minGivenTexCoord = tc[0];
+ float maxGivenTexCoord = tc[tc.size()-1];
+ float maxCumulDist = cumulDist[tc.size()-1];
int baselineDist = 0;
for (unsigned i = tc.size(); i < cumulDist.size(); ++i) {
int repeatFactor = int(cumulDist[i]/maxCumulDist);
- double effCumulDist = fmod(cumulDist[i], maxCumulDist);
+ float effCumulDist = fmod(cumulDist[i], maxCumulDist);
while (cumulDist[baselineDist+1] < effCumulDist) {
baselineDist++;
}
- double ratio = (effCumulDist-cumulDist[baselineDist])/
+ float ratio = (effCumulDist-cumulDist[baselineDist])/
(cumulDist[baselineDist+1]-cumulDist[baselineDist]);
- double rawTexCoord = (1-ratio)*tc[baselineDist] +ratio*tc[baselineDist+1];
- double texCoord = rawTexCoord
+ float rawTexCoord = (1-ratio)*tc[baselineDist] +ratio*tc[baselineDist+1];
+ float texCoord = rawTexCoord
+repeatFactor*(maxGivenTexCoord-minGivenTexCoord);
effTC.push_back(texCoord);
}
}
+
}
-void VectorNode::calcPolyLine(const vector<DPoint>& origPts,
- const vector<double>& origTexCoords, bool bIsClosed, LineJoin lineJoin,
- VertexArrayPtr& pVertexArray, Pixel32 color)
+void VectorNode::calcPolyLine(const vector<glm::vec2>& origPts,
+ const vector<float>& origTexCoords, bool bIsClosed, LineJoin lineJoin,
+ const VertexDataPtr& pVertexData, Pixel32 color)
{
- vector<DPoint> pts;
+ vector<glm::vec2> pts;
pts.reserve(origPts.size());
- vector<double> texCoords;
+ vector<float> texCoords;
texCoords.reserve(origPts.size());
pts.push_back(origPts[0]);
texCoords.push_back(origTexCoords[0]);
for (unsigned i = 1; i < origPts.size(); ++i) {
- if (calcDistSquared(origPts[i], origPts[i-1]) > 0.1) {
+ if (glm::distance2(origPts[i], origPts[i-1]) > 0.1) {
pts.push_back(origPts[i]);
texCoords.push_back(origTexCoords[i]);
}
@@ -353,38 +349,38 @@ void VectorNode::calcPolyLine(const vector<DPoint>& origPts,
// First points
if (bIsClosed) {
WideLine lastLine = lines[lines.size()-1];
- DPoint pli = getLineLineIntersection(lastLine.pl0, lastLine.dir,
+ glm::vec2 pli = getLineLineIntersection(lastLine.pl0, lastLine.dir,
lines[0].pl0, lines[0].dir);
- DPoint pri = getLineLineIntersection(lastLine.pr0, lastLine.dir,
+ glm::vec2 pri = getLineLineIntersection(lastLine.pr0, lastLine.dir,
lines[0].pr0, lines[0].dir);
Triangle tri(lastLine.pl1, lines[0].pl0, pri);
if (tri.isClockwise()) {
- if (!DLineSegment(lastLine.pr0, lastLine.pr1).isPointOver(pri) &&
- !DLineSegment(lines[0].pr0, lines[0].pr1).isPointOver(pri))
+ if (!LineSegment(lastLine.pr0, lastLine.pr1).isPointOver(pri) &&
+ !LineSegment(lines[0].pr0, lines[0].pr1).isPointOver(pri))
{
pri = lines[0].pr1;
}
} else {
- if (!DLineSegment(lastLine.pl0, lastLine.pl1).isPointOver(pli) &&
- !DLineSegment(lines[0].pl0, lines[0].pl1).isPointOver(pli))
+ if (!LineSegment(lastLine.pl0, lastLine.pl1).isPointOver(pli) &&
+ !LineSegment(lines[0].pl0, lines[0].pl1).isPointOver(pli))
{
pli = lines[0].pl1;
}
}
- double curTC = texCoords[0];
+ float curTC = texCoords[0];
switch (lineJoin) {
case LJ_MITER:
- pVertexArray->appendPos(pli, DPoint(curTC,1), color);
- pVertexArray->appendPos(pri, DPoint(curTC,0), color);
+ pVertexData->appendPos(pli, glm::vec2(curTC,1), color);
+ pVertexData->appendPos(pri, glm::vec2(curTC,0), color);
break;
case LJ_BEVEL: {
if (tri.isClockwise()) {
- pVertexArray->appendPos(lines[0].pl0, DPoint(curTC,1), color);
- pVertexArray->appendPos(pri, DPoint(curTC,0), color);
+ pVertexData->appendPos(lines[0].pl0, glm::vec2(curTC,1), color);
+ pVertexData->appendPos(pri, glm::vec2(curTC,0), color);
} else {
- pVertexArray->appendPos(pli, DPoint(curTC,1), color);
- pVertexArray->appendPos(lines[0].pr0, DPoint(curTC,0), color);
+ pVertexData->appendPos(pli, glm::vec2(curTC,1), color);
+ pVertexData->appendPos(lines[0].pr0, glm::vec2(curTC,0), color);
}
}
break;
@@ -393,8 +389,8 @@ void VectorNode::calcPolyLine(const vector<DPoint>& origPts,
break;
}
} else {
- pVertexArray->appendPos(lines[0].pl0, DPoint(texCoords[0],1), color);
- pVertexArray->appendPos(lines[0].pr0, DPoint(texCoords[0],0), color);
+ pVertexData->appendPos(lines[0].pl0, glm::vec2(texCoords[0],1), color);
+ pVertexData->appendPos(lines[0].pr0, glm::vec2(texCoords[0],0), color);
}
// All complete line segments
@@ -412,53 +408,55 @@ void VectorNode::calcPolyLine(const vector<DPoint>& origPts,
} else {
pLine2 = &(lines[i+1]);
}
- DPoint pli = getLineLineIntersection(pLine1->pl0, pLine1->dir, pLine2->pl0, pLine2->dir);
- DPoint pri = getLineLineIntersection(pLine1->pr0, pLine1->dir, pLine2->pr0, pLine2->dir);
+ glm::vec2 pli = getLineLineIntersection(pLine1->pl0, pLine1->dir, pLine2->pl0,
+ pLine2->dir);
+ glm::vec2 pri = getLineLineIntersection(pLine1->pr0, pLine1->dir, pLine2->pr0,
+ pLine2->dir);
Triangle tri(pLine1->pl1, pLine2->pl0, pri);
if (tri.isClockwise()) {
- if (!DLineSegment(pLine1->pr0, pLine1->pr1).isPointOver(pri) &&
- !DLineSegment(pLine2->pr0, pLine2->pr1).isPointOver(pri))
+ if (!LineSegment(pLine1->pr0, pLine1->pr1).isPointOver(pri) &&
+ !LineSegment(pLine2->pr0, pLine2->pr1).isPointOver(pri))
{
pri = pLine2->pr1;
}
} else {
- if (!DLineSegment(pLine1->pl0, pLine1->pl1).isPointOver(pli) &&
- !DLineSegment(pLine2->pl0, pLine2->pl1).isPointOver(pli))
+ if (!LineSegment(pLine1->pl0, pLine1->pl1).isPointOver(pli) &&
+ !LineSegment(pLine2->pl0, pLine2->pl1).isPointOver(pli))
{
pli = pLine2->pl1;
}
}
- int curVertex = pVertexArray->getCurVert();
- double curTC = texCoords[i+1];
+ int curVertex = pVertexData->getNumVerts();
+ float curTC = texCoords[i+1];
switch (lineJoin) {
case LJ_MITER:
- pVertexArray->appendPos(pli, DPoint(curTC,1), color);
- pVertexArray->appendPos(pri, DPoint(curTC,0), color);
- pVertexArray->appendQuadIndexes(
+ pVertexData->appendPos(pli, glm::vec2(curTC,1), color);
+ pVertexData->appendPos(pri, glm::vec2(curTC,0), color);
+ pVertexData->appendQuadIndexes(
curVertex-1, curVertex-2, curVertex+1, curVertex);
break;
case LJ_BEVEL:
{
- double TC0;
- double TC1;
+ float TC0;
+ float TC1;
if (tri.isClockwise()) {
calcBevelTC(*pLine1, *pLine2, true, texCoords, i+1, TC0, TC1);
- pVertexArray->appendPos(pLine1->pl1, DPoint(TC0,1), color);
- pVertexArray->appendPos(pLine2->pl0, DPoint(TC1,1), color);
- pVertexArray->appendPos(pri, DPoint(curTC,0), color);
- pVertexArray->appendQuadIndexes(
+ pVertexData->appendPos(pLine1->pl1, glm::vec2(TC0,1), color);
+ pVertexData->appendPos(pLine2->pl0, glm::vec2(TC1,1), color);
+ pVertexData->appendPos(pri, glm::vec2(curTC,0), color);
+ pVertexData->appendQuadIndexes(
curVertex-1, curVertex-2, curVertex+2, curVertex);
- pVertexArray->appendTriIndexes(
+ pVertexData->appendTriIndexes(
curVertex, curVertex+1, curVertex+2);
} else {
calcBevelTC(*pLine1, *pLine2, false, texCoords, i+1, TC0, TC1);
- pVertexArray->appendPos(pLine1->pr1, DPoint(TC0,0), color);
- pVertexArray->appendPos(pli, DPoint(curTC,1), color);
- pVertexArray->appendPos(pLine2->pr0, DPoint(TC1,0), color);
- pVertexArray->appendQuadIndexes(
+ pVertexData->appendPos(pLine1->pr1, glm::vec2(TC0,0), color);
+ pVertexData->appendPos(pli, glm::vec2(curTC,1), color);
+ pVertexData->appendPos(pLine2->pr0, glm::vec2(TC1,0), color);
+ pVertexData->appendQuadIndexes(
curVertex-2, curVertex-1, curVertex+1, curVertex);
- pVertexArray->appendTriIndexes(
+ pVertexData->appendTriIndexes(
curVertex, curVertex+1, curVertex+2);
}
}
@@ -470,49 +468,54 @@ void VectorNode::calcPolyLine(const vector<DPoint>& origPts,
// Last segment (PolyLine only)
if (!bIsClosed) {
- int curVertex = pVertexArray->getCurVert();
- double curTC = texCoords[numPts-1];
- pVertexArray->appendPos(lines[numPts-2].pl1, DPoint(curTC,1), color);
- pVertexArray->appendPos(lines[numPts-2].pr1, DPoint(curTC,0), color);
- pVertexArray->appendQuadIndexes(curVertex-1, curVertex-2, curVertex+1, curVertex);
+ int curVertex = pVertexData->getNumVerts();
+ float curTC = texCoords[numPts-1];
+ pVertexData->appendPos(lines[numPts-2].pl1, glm::vec2(curTC,1), color);
+ pVertexData->appendPos(lines[numPts-2].pr1, glm::vec2(curTC,0), color);
+ pVertexData->appendQuadIndexes(curVertex-1, curVertex-2, curVertex+1, curVertex);
}
}
void VectorNode::calcBevelTC(const WideLine& line1, const WideLine& line2,
- bool bIsLeft, const vector<double>& texCoords, unsigned i,
- double& TC0, double& TC1)
+ bool bIsLeft, const vector<float>& texCoords, unsigned i,
+ float& TC0, float& TC1)
{
- double line1Len = line1.getLen();
- double line2Len = line2.getLen();
- double triLen;
+ float line1Len = line1.getLen();
+ float line2Len = line2.getLen();
+ float triLen;
if (bIsLeft) {
- triLen = calcDist(line1.pl1, line2.pl0);
+ triLen = glm::length(line1.pl1 - line2.pl0);
} else {
- triLen = calcDist(line1.pr1, line2.pr0);
+ triLen = glm::length(line1.pr1 - line2.pr0);
}
- double ratio0 = line1Len/(line1Len+triLen/2);
+ float ratio0 = line1Len/(line1Len+triLen/2);
TC0 = (1-ratio0)*texCoords[i-1]+ratio0*texCoords[i];
- double nextTexCoord;
+ float nextTexCoord;
if (i == texCoords.size()-1) {
nextTexCoord = texCoords[i];
} else {
nextTexCoord = texCoords[i+1];
}
- double ratio1 = line2Len/(line2Len+triLen/2);
+ float ratio1 = line2Len/(line2Len+triLen/2);
TC1 = ratio1*texCoords[i]+(1-ratio1)*nextTexCoord;
}
-int VectorNode::getNumDifferentPts(const vector<DPoint>& pts)
+int VectorNode::getNumDifferentPts(const vector<glm::vec2>& pts)
{
int numPts = pts.size();
for (unsigned i=1; i<pts.size(); ++i) {
- if (calcDistSquared(pts[i], pts[i-1])<0.1) {
+ if (glm::distance2(pts[i], pts[i-1])<0.1) {
numPts--;
}
}
return numPts;
}
+const glm::mat4& VectorNode::getTransform() const
+{
+ return m_Transform;
+}
+
Shape* VectorNode::createDefaultShape() const
{
return new Shape(MaterialInfo(GL_REPEAT, GL_CLAMP_TO_EDGE, false));
diff --git a/src/player/VectorNode.h b/src/player/VectorNode.h
index d17c7c4..4568342 100644
--- a/src/player/VectorNode.h
+++ b/src/player/VectorNode.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -40,7 +40,7 @@ class AVG_API VectorNode : public Node
public:
enum LineJoin {LJ_MITER, LJ_BEVEL};
- static NodeDefinition createDefinition();
+ static void registerType();
VectorNode(const ArgList& args);
virtual ~VectorNode();
@@ -56,17 +56,18 @@ class AVG_API VectorNode : public Node
const std::string& getBlendModeStr() const;
void setBlendModeStr(const std::string& sBlendMode);
- virtual void preRender();
- virtual void maybeRender(const DRect& rect);
- virtual void render(const DRect& rect);
+ virtual void preRender(const VertexArrayPtr& pVA, bool bIsParentActive,
+ float parentEffectiveOpacity);
+ virtual void maybeRender(const glm::mat4& parentTransform);
+ virtual void render();
- virtual void calcVertexes(VertexArrayPtr& pVertexArray, Pixel32 color) = 0;
+ virtual void calcVertexes(const VertexDataPtr& pVertexData, Pixel32 color) = 0;
void setColor(const std::string& sColor);
const std::string& getColor() const;
- void setStrokeWidth(double width);
- double getStrokeWidth() const;
+ void setStrokeWidth(float width);
+ float getStrokeWidth() const;
static LineJoin string2LineJoin(const std::string& s);
static std::string lineJoin2String(LineJoin lineJoin);
@@ -78,33 +79,35 @@ class AVG_API VectorNode : public Node
void setDrawNeeded();
bool isDrawNeeded();
bool hasVASizeChanged();
- void calcPolyLineCumulDist(std::vector<double>& cumulDist,
- const std::vector<DPoint>& pts, bool bIsClosed);
- void calcEffPolyLineTexCoords(std::vector<double>& effTC,
- const std::vector<double>& tc, const std::vector<double>& cumulDist);
-
- void calcPolyLine(const std::vector<DPoint>& origPts,
- const std::vector<double>& origTexCoords, bool bIsClosed, LineJoin lineJoin,
- VertexArrayPtr& pVertexArray, Pixel32 color);
+ void calcPolyLineCumulDist(std::vector<float>& cumulDist,
+ const std::vector<glm::vec2>& pts, bool bIsClosed);
+ void calcEffPolyLineTexCoords(std::vector<float>& effTC,
+ const std::vector<float>& tc, const std::vector<float>& cumulDist);
+
+ void calcPolyLine(const std::vector<glm::vec2>& origPts,
+ const std::vector<float>& origTexCoords, bool bIsClosed,
+ LineJoin lineJoin, const VertexDataPtr& pVertexData, Pixel32 color);
void calcBevelTC(const WideLine& line1, const WideLine& line2,
- bool bIsLeft, const std::vector<double>& texCoords, unsigned i,
- double& TC0, double& TC1);
- int getNumDifferentPts(const std::vector<DPoint>& pts);
+ bool bIsLeft, const std::vector<float>& texCoords, unsigned i,
+ float& TC0, float& TC1);
+ int getNumDifferentPts(const std::vector<glm::vec2>& pts);
+
+ protected:
+ const glm::mat4& getTransform() const;
private:
Shape* createDefaultShape() const;
- private:
std::string m_sColorName;
Pixel32 m_Color;
- double m_StrokeWidth;
+ float m_StrokeWidth;
UTF8String m_TexHRef;
std::string m_sBlendMode;
bool m_bDrawNeeded;
bool m_bVASizeChanged;
- double m_OldOpacity;
+ glm::mat4 m_Transform;
ShapePtr m_pShape;
GLContext::BlendMode m_BlendMode;
};
diff --git a/src/player/VersionInfo.cpp b/src/player/VersionInfo.cpp
new file mode 100644
index 0000000..3ab861b
--- /dev/null
+++ b/src/player/VersionInfo.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 "VersionInfo.h"
+#include "../version.h"
+
+namespace avg {
+
+const std::string VersionInfo::getFull()
+{
+ return std::string(AVG_VERSION_FULL);
+}
+
+const std::string VersionInfo::getRelease()
+{
+ return std::string(AVG_VERSION_RELEASE);
+}
+
+const std::string VersionInfo::getBranchUrl()
+{
+ return std::string(AVG_VERSION_BRANCH_URL);
+}
+
+const std::string VersionInfo::getBuilder()
+{
+ return std::string(AVG_VERSION_BUILDER);
+}
+
+const std::string VersionInfo::getBuildTime()
+{
+ return std::string(AVG_VERSION_BUILDTIME);
+}
+
+const std::string VersionInfo::getMajor()
+{
+ return AVG_VERSION_MAJOR;
+}
+
+const std::string VersionInfo::getMinor()
+{
+ return AVG_VERSION_MINOR;
+}
+
+const std::string VersionInfo::getMicro()
+{
+ return AVG_VERSION_MICRO;
+}
+
+int VersionInfo::getRevision()
+{
+ return AVG_VERSION_REVISION;
+}
+
+}
diff --git a/src/audio/IAudioSource.h b/src/player/VersionInfo.h
index a112904..5a01e7e 100644
--- a/src/audio/IAudioSource.h
+++ b/src/player/VersionInfo.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -18,29 +18,30 @@
//
// Current versions can be found at www.libavg.de
//
-// Original author of this file is Nick Hebner (hebnern@gmail.com).
-//
-#ifndef _IAudioSource_H_
-#define _IAudioSource_H_
+#ifndef _VersionInfo_H_
+#define _VersionInfo_H_
#include "../api.h"
-#include "AudioBuffer.h"
-
-#include <boost/shared_ptr.hpp>
-#include <boost/weak_ptr.hpp>
+#include <string>
namespace avg {
-class AVG_API IAudioSource
+class AVG_API VersionInfo
{
public:
- virtual ~IAudioSource() {};
- virtual int fillAudioBuffer(AudioBufferPtr pBuffer) = 0;
+ const std::string getFull();
+ const std::string getRelease();
+ const std::string getBranchUrl();
+ const std::string getBuilder();
+ const std::string getBuildTime();
+ const std::string getMajor();
+ const std::string getMinor();
+ const std::string getMicro();
+ int getRevision();
};
-typedef boost::weak_ptr<IAudioSource> IAudioSourceWeakPtr;
-
}
-#endif /*AUDIOSOURCE_H_*/
+#endif
+
diff --git a/src/player/VideoNode.cpp b/src/player/VideoNode.cpp
index 0df4129..75b2ccc 100644
--- a/src/player/VideoNode.cpp
+++ b/src/player/VideoNode.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -21,22 +21,26 @@
#include "VideoNode.h"
#include "Player.h"
#include "OGLSurface.h"
-#include "NodeDefinition.h"
+#include "TypeDefinition.h"
#include "Canvas.h"
#include "../base/Exception.h"
#include "../base/Logger.h"
#include "../base/ScopeTimer.h"
#include "../base/XMLHelper.h"
+#include "../base/ObjectCounter.h"
#include "../graphics/Filterfill.h"
#include "../graphics/GLTexture.h"
#include "../graphics/TextureMover.h"
-#include "../audio/SDLAudioEngine.h"
+#include "../audio/AudioEngine.h"
#include "../video/AsyncVideoDecoder.h"
-#include "../video/FFMpegDecoder.h"
+#include "../video/SyncVideoDecoder.h"
+#ifdef AVG_ENABLE_VDPAU
+#include "../video/VDPAUDecoder.h"
+#endif
#include <iostream>
#include <sstream>
@@ -45,25 +49,28 @@
#include <unistd.h>
#endif
-using namespace boost::python;
+using namespace boost;
using namespace std;
namespace avg {
-NodeDefinition VideoNode::createDefinition()
+void VideoNode::registerType()
{
- return NodeDefinition("video", Node::buildNode<VideoNode>)
- .extendDefinition(RasterNode::createDefinition())
+ TypeDefinition def = TypeDefinition("video", "rasternode",
+ ExportedObject::buildObject<VideoNode>)
.addArg(Arg<UTF8String>("href", "", false, offsetof(VideoNode, m_href)))
.addArg(Arg<bool>("loop", false, false, offsetof(VideoNode, m_bLoop)))
.addArg(Arg<bool>("threaded", true, false, offsetof(VideoNode, m_bThreaded)))
- .addArg(Arg<double>("fps", 0.0, false, offsetof(VideoNode, m_FPS)))
+ .addArg(Arg<float>("fps", 0.0, false, offsetof(VideoNode, m_FPS)))
.addArg(Arg<int>("queuelength", 8, false,
offsetof(VideoNode, m_QueueLength)))
- .addArg(Arg<double>("volume", 1.0, false, offsetof(VideoNode, m_Volume)))
+ .addArg(Arg<float>("volume", 1.0, false, offsetof(VideoNode, m_Volume)))
.addArg(Arg<bool>("accelerated", false, false,
offsetof(VideoNode, m_bUsesHardwareAcceleration)))
+ .addArg(Arg<bool>("enablesound", true, false,
+ offsetof(VideoNode, m_bEnableSound)))
;
+ TypeRegistry::get()->registerType(def);
}
VideoNode::VideoNode(const ArgList& args)
@@ -78,7 +85,9 @@ VideoNode::VideoNode(const ArgList& args)
m_SeekBeforeCanRenderTime(0),
m_pDecoder(0),
m_Volume(1.0),
- m_bUsesHardwareAcceleration(false)
+ m_bUsesHardwareAcceleration(false),
+ m_bEnableSound(true),
+ m_AudioID(-1)
{
args.setMembers(this);
m_Filename = m_href;
@@ -88,11 +97,11 @@ VideoNode::VideoNode(const ArgList& args)
"Can't set queue length for unthreaded videos because there is no decoder queue in this case.");
}
if (m_bThreaded) {
- VideoDecoderPtr pSyncDecoder = VideoDecoderPtr(new FFMpegDecoder());
- m_pDecoder = new AsyncVideoDecoder(pSyncDecoder, m_QueueLength);
+ m_pDecoder = new AsyncVideoDecoder(m_QueueLength);
} else {
- m_pDecoder = new FFMpegDecoder();
+ m_pDecoder = new SyncVideoDecoder();
}
+
ObjectCounter::get()->incRef(&typeid(*this));
}
@@ -124,6 +133,7 @@ void VideoNode::connectDisplay()
void VideoNode::connect(CanvasPtr pCanvas)
{
pCanvas->registerFrameEndListener(this);
+ checkReload();
RasterNode::connect(pCanvas);
}
@@ -183,7 +193,7 @@ void VideoNode::seekToFrame(int frameNum)
}
exceptionIfUnloaded("seekToFrame");
if (getCurFrame() != frameNum) {
- long long destTime = (long long)(frameNum*1000.0/m_pDecoder->getNominalFPS());
+ long long destTime = (long long)(frameNum*1000.0/m_pDecoder->getStreamFPS());
seek(destTime);
}
}
@@ -200,11 +210,32 @@ long long VideoNode::getDuration() const
return (long long)(m_pDecoder->getVideoInfo().m_Duration*1000);
}
+long long VideoNode::getVideoDuration() const
+{
+ exceptionIfUnloaded("getVideoDuration");
+ return (long long)(m_pDecoder->getVideoInfo().m_VideoDuration*1000);
+}
+
+long long VideoNode::getAudioDuration() const
+{
+ exceptionIfUnloaded("getAudioDuration");
+ if (!hasAudio()) {
+ throw Exception(AVG_ERR_INVALID_ARGS, "Video has no audio track.");
+ }
+
+ return (long long)(m_pDecoder->getVideoInfo().m_AudioDuration*1000);
+}
+
int VideoNode::getBitrate() const
{
exceptionIfUnloaded("getBitrate");
return m_pDecoder->getVideoInfo().m_Bitrate;
}
+std::string VideoNode::getContainerFormat() const
+{
+ exceptionIfUnloaded("getContainerFormat");
+ return m_pDecoder->getVideoInfo().m_sContainerFormat;
+}
string VideoNode::getVideoCodec() const
{
@@ -286,6 +317,8 @@ void VideoNode::setEOFCallback(PyObject * pEOFCallback)
if (pEOFCallback == Py_None) {
m_pEOFCallback = 0;
} else {
+ avgDeprecationWarning("1.8", "VideoNode.setEOFCallback()",
+ "Node.subscribe(END_OF_FILE)");
Py_INCREF(pEOFCallback);
m_pEOFCallback = pEOFCallback;
}
@@ -308,19 +341,19 @@ void VideoNode::setHRef(const UTF8String& href)
checkReload();
}
-double VideoNode::getVolume()
+float VideoNode::getVolume()
{
return m_Volume;
}
-void VideoNode::setVolume(double Volume)
+void VideoNode::setVolume(float volume)
{
- if (Volume < 0) {
- Volume = 0;
+ if (volume < 0) {
+ volume = 0;
}
- m_Volume = Volume;
- if (m_VideoState != Unloaded && hasAudio()) {
- m_pDecoder->setVolume(Volume);
+ m_Volume = volume;
+ if (m_AudioID != -1) {
+ AudioEngine::get()->setSourceVolume(m_AudioID, volume);
}
}
@@ -345,62 +378,65 @@ void VideoNode::checkReload()
void VideoNode::onFrameEnd()
{
+ AsyncVideoDecoder* pAsyncDecoder = dynamic_cast<AsyncVideoDecoder*>(m_pDecoder);
+ if (pAsyncDecoder && (m_VideoState == Playing || m_VideoState == Paused)) {
+ pAsyncDecoder->updateAudioStatus();
+ }
if (m_bEOFPending) {
// If the VideoNode is unlinked by python in onEOF, the following line prevents
// the object from being deleted until we return from this function.
- NodePtr pTempThis = shared_from_this();
+ NodePtr pTempThis = getSharedThis();
m_bEOFPending = false;
onEOF();
}
}
-int VideoNode::fillAudioBuffer(AudioBufferPtr pBuffer)
-{
- AVG_ASSERT(m_bThreaded);
- if (m_VideoState == Playing) {
- return m_pDecoder->fillAudioBuffer(pBuffer);
- } else {
- return 0;
- }
-}
-
-void VideoNode::changeVideoState(VideoState NewVideoState)
+void VideoNode::changeVideoState(VideoState newVideoState)
{
long long curTime = Player::get()->getFrameTime();
- if (m_VideoState == NewVideoState) {
+ if (m_VideoState == newVideoState) {
return;
}
if (m_VideoState == Unloaded) {
m_PauseStartTime = curTime;
open();
}
- if (NewVideoState == Unloaded) {
+ if (newVideoState == Unloaded) {
close();
}
if (getState() == NS_CANRENDER) {
if (m_VideoState == Unloaded) {
startDecoding();
}
- if (NewVideoState == Paused) {
+ if (newVideoState == Paused) {
m_PauseStartTime = curTime;
- } else if (NewVideoState == Playing && m_VideoState == Paused) {
+ if (m_AudioID != -1) {
+ AudioEngine::get()->pauseSource(m_AudioID);
+ }
+ } else if (newVideoState == Playing && m_VideoState == Paused) {
/*
cerr << "Play after pause:" << endl;
cerr << " getFrameTime()=" << curTime << endl;
cerr << " m_PauseStartTime=" << m_PauseStartTime << endl;
cerr << " offset=" << (1000.0/m_pDecoder->getFPS()) << endl;
*/
+ if (m_AudioID != -1) {
+ AudioEngine::get()->playSource(m_AudioID);
+ }
m_PauseTime += (curTime-m_PauseStartTime
- (long long)(1000.0/m_pDecoder->getFPS()));
}
}
- m_VideoState = NewVideoState;
+ m_VideoState = newVideoState;
}
void VideoNode::seek(long long destTime)
{
if (getState() == NS_CANRENDER) {
- m_pDecoder->seek(double(destTime)/1000.0);
+ if (m_AudioID != -1) {
+ AudioEngine::get()->notifySeek(m_AudioID);
+ }
+ m_pDecoder->seek(float(destTime)/1000.0f);
m_StartTime = Player::get()->getFrameTime() - destTime;
m_JitterCompensation = 0.5;
m_PauseTime = 0;
@@ -419,8 +455,7 @@ void VideoNode::open()
m_FramesTooLate = 0;
m_FramesInRowTooLate = 0;
m_FramesPlayed = 0;
- m_pDecoder->open(m_Filename, m_bThreaded, m_bUsesHardwareAcceleration);
- m_pDecoder->setVolume(m_Volume);
+ m_pDecoder->open(m_Filename, m_bUsesHardwareAcceleration, m_bEnableSound);
VideoInfo videoInfo = m_pDecoder->getVideoInfo();
if (!videoInfo.m_bHasVideo) {
m_pDecoder->close();
@@ -431,34 +466,38 @@ void VideoNode::open()
m_JitterCompensation = 0.5;
m_PauseTime = 0;
+ m_bSeekPending = false;
m_bFirstFrameDecoded = false;
m_bFrameAvailable = false;
m_bUsesHardwareAcceleration = videoInfo.m_bUsesVDPAU;
+ setViewport(-32767, -32767, -32767, -32767);
}
void VideoNode::startDecoding()
{
const AudioParams * pAP = 0;
- SDLAudioEngine* pAudioEngine = SDLAudioEngine::get();
+ AudioEngine* pAudioEngine = AudioEngine::get();
if (pAudioEngine) {
pAP = pAudioEngine->getParams();
}
- m_pDecoder->startDecoding(GLContext::getCurrent()->isUsingShaders(), pAP);
+ m_pDecoder->startDecoding(GLContext::getMain()->useGPUYUVConversion(), pAP);
VideoInfo videoInfo = m_pDecoder->getVideoInfo();
if (m_FPS != 0.0) {
if (videoInfo.m_bHasAudio) {
- AVG_TRACE(Logger::WARNING,
- getID() + ": Can't set FPS if video contains audio. Ignored.");
+ AVG_LOG_WARNING(getID() + ": Can't set FPS if video contains audio. Ignored.");
} else {
m_pDecoder->setFPS(m_FPS);
}
}
if (videoInfo.m_bHasAudio && pAudioEngine) {
- pAudioEngine->addSource(this);
+ AsyncVideoDecoder* pAsyncDecoder =
+ dynamic_cast<AsyncVideoDecoder*>(m_pDecoder);
+ m_AudioID = pAudioEngine->addSource(*pAsyncDecoder->getAudioMsgQ(),
+ *pAsyncDecoder->getAudioStatusQ());
+ pAudioEngine->setSourceVolume(m_AudioID, m_Volume);
}
m_bSeekPending = true;
- setViewport(-32767, -32767, -32767, -32767);
createTextures(videoInfo.m_Size);
if (m_SeekBeforeCanRenderTime != 0) {
@@ -474,8 +513,8 @@ void VideoNode::createTextures(IntPoint size)
if (pixelFormatIsPlanar(pf)) {
m_pTextures[0] = GLTexturePtr(new GLTexture(size, I8, bMipmap));
IntPoint halfSize(size.x/2, size.y/2);
- m_pTextures[1] = GLTexturePtr(new GLTexture(halfSize, I8, bMipmap));
- m_pTextures[2] = GLTexturePtr(new GLTexture(halfSize, I8, bMipmap));
+ m_pTextures[1] = GLTexturePtr(new GLTexture(halfSize, I8, bMipmap, 128));
+ m_pTextures[2] = GLTexturePtr(new GLTexture(halfSize, I8, bMipmap, 128));
if (pixelFormatHasAlpha(pf)) {
m_pTextures[3] = GLTexturePtr(new GLTexture(size, I8, bMipmap));
}
@@ -501,13 +540,15 @@ void VideoNode::createTextures(IntPoint size)
} else {
getSurface()->create(pf, m_pTextures[0]);
}
+ newSurface();
}
void VideoNode::close()
{
- SDLAudioEngine* pAudioEngine = SDLAudioEngine::get();
- if (hasAudio() && pAudioEngine) {
- pAudioEngine->removeSource(this);
+ AudioEngine* pAudioEngine = AudioEngine::get();
+ if (m_AudioID != -1) {
+ pAudioEngine->removeSource(m_AudioID);
+ m_AudioID = -1;
}
m_pDecoder->close();
if (m_FramesTooLate > 0) {
@@ -517,8 +558,9 @@ void VideoNode::close()
} else {
sID = getID();
}
- AVG_TRACE(Logger::PROFILE_VIDEO, "Missed video frames for '" << sID << "': "
- << m_FramesTooLate << " of " << m_FramesPlayed);
+ AVG_TRACE(Logger::category::PROFILE_VIDEO, Logger::severity::INFO,
+ "Missed video frames for '" << sID << "': " << m_FramesTooLate <<
+ " of " << m_FramesPlayed);
m_FramesTooLate = 0;
}
}
@@ -537,7 +579,7 @@ IntPoint VideoNode::getMediaSize()
}
}
-double VideoNode::getFPS() const
+float VideoNode::getFPS() const
{
return m_pDecoder->getFPS();
}
@@ -553,6 +595,7 @@ long long VideoNode::getNextFrameTime() const
case Unloaded:
return 0;
case Paused:
+ AVG_ASSERT(m_PauseStartTime-m_StartTime >= 0);
return m_PauseStartTime-m_StartTime;
case Playing:
{
@@ -596,10 +639,11 @@ void VideoNode::exceptionIfUnloaded(const std::string& sFuncName) const
static ProfilingZoneID PrerenderProfilingZone("VideoNode::prerender");
-void VideoNode::preRender()
+void VideoNode::preRender(const VertexArrayPtr& pVA, bool bIsParentActive,
+ float parentEffectiveOpacity)
{
ScopeTimer timer(PrerenderProfilingZone);
- Node::preRender();
+ Node::preRender(pVA, bIsParentActive, parentEffectiveOpacity);
if (isVisible()) {
if (m_VideoState != Unloaded) {
if (m_VideoState == Playing) {
@@ -616,35 +660,36 @@ void VideoNode::preRender()
}
}
} else {
- if (m_bSeekPending && m_bFirstFrameDecoded && m_VideoState != Unloaded) {
+ if (m_VideoState != Unloaded && m_bSeekPending && m_bFirstFrameDecoded) {
renderFrame();
}
if (m_VideoState == Playing) {
// Throw away frames that are not visible to make sure the video
// stays in sync.
- m_pDecoder->throwAwayFrame(getNextFrameTime()/1000.0);
+ m_pDecoder->throwAwayFrame(getNextFrameTime()/1000.0f);
if (m_pDecoder->isEOF()) {
updateStatusDueToDecoderEOF();
}
}
}
+ calcVertexArray(pVA);
}
static ProfilingZoneID RenderProfilingZone("VideoNode::render");
-void VideoNode::render(const DRect& rect)
+void VideoNode::render()
{
ScopeTimer timer(RenderProfilingZone);
if (m_VideoState != Unloaded && m_bFirstFrameDecoded) {
- blt32(getSize(), getEffectiveOpacity(), getBlendMode());
+ blt32(getTransform(), getSize(), getEffectiveOpacity(), getBlendMode());
}
}
VideoNode::VideoAccelType VideoNode::getVideoAccelConfig()
{
#ifdef AVG_ENABLE_VDPAU
- if (VDPAU::isAvailable()) {
+ if (VDPAUDecoder::isAvailable()) {
return VDPAU;
}
#endif
@@ -653,12 +698,26 @@ VideoNode::VideoAccelType VideoNode::getVideoAccelConfig()
bool VideoNode::renderFrame()
{
- FrameAvailableCode frameAvailable = renderToSurface();
+ FrameAvailableCode frameAvailable =
+ m_pDecoder->renderToTexture(m_pTextures, getNextFrameTime()/1000.0f);
+
+ // Even with vsync, frame duration has a bit of jitter. If the video frames rendered
+ // are at the border of a frame's time, this can cause irregular display times.
+ // So, if we detect this condition, we adjust the frame time by a small fraction
+ // to move it towards the center of the time slot.
+ long long jitter = (long long)(getNextFrameTime()-m_pDecoder->getCurTime()*1000);
+ if (jitter > (long long)(0.4*(1000/m_pDecoder->getFPS()))) {
+ m_JitterCompensation += 0.05;
+ if (m_JitterCompensation > 1) {
+ m_JitterCompensation -= 1;
+ }
+ }
+
if (m_pDecoder->isEOF()) {
-// AVG_TRACE(Logger::PROFILE, "------------------ EOF -----------------");
updateStatusDueToDecoderEOF();
if (m_bLoop) {
- frameAvailable = renderToSurface();
+ frameAvailable =
+ m_pDecoder->renderToTexture(m_pTextures, getNextFrameTime()/1000.0f);
}
}
@@ -666,17 +725,16 @@ bool VideoNode::renderFrame()
case FA_NEW_FRAME:
m_FramesPlayed++;
m_FramesInRowTooLate = 0;
- bind();
m_bSeekPending = false;
setMaskCoords();
-// AVG_TRACE(Logger::PROFILE, "New frame.");
+// AVG_TRACE(Logger::category::PROFILE, "New frame.");
break;
case FA_STILL_DECODING:
{
m_FramesPlayed++;
m_FramesTooLate++;
m_FramesInRowTooLate++;
- double framerate = Player::get()->getEffectiveFramerate();
+ float framerate = Player::get()->getEffectiveFramerate();
long long frameTime = Player::get()->getFrameTime();
if (m_VideoState == Playing) {
if (m_FramesInRowTooLate > 3 && framerate != 0) {
@@ -702,50 +760,18 @@ bool VideoNode::renderFrame()
}
}
}
-// AVG_TRACE(Logger::PROFILE, "Missed video frame.");
+// AVG_TRACE(Logger::category::PROFILE, "Missed video frame.");
break;
case FA_USE_LAST_FRAME:
m_FramesInRowTooLate = 0;
m_bSeekPending = false;
-// AVG_TRACE(Logger::PROFILE, "Video frame reused.");
+// AVG_TRACE(Logger::category::PROFILE, "Video frame reused.");
break;
default:
AVG_ASSERT(false);
}
return (frameAvailable == FA_NEW_FRAME);
- return false;
-}
-
-FrameAvailableCode VideoNode::renderToSurface()
-{
- FrameAvailableCode frameAvailable;
- PixelFormat pf = m_pDecoder->getPixelFormat();
- std::vector<BitmapPtr> pBmps;
- for (unsigned i=0; i<getNumPixelFormatPlanes(pf); ++i) {
- pBmps.push_back(m_pTextures[i]->lockStreamingBmp());
- }
- if (pixelFormatIsPlanar(pf)) {
- frameAvailable = m_pDecoder->renderToBmps(pBmps, getNextFrameTime()/1000.0);
- } else {
- frameAvailable = m_pDecoder->renderToBmp(pBmps[0], getNextFrameTime()/1000.0);
- }
- for (unsigned i=0; i<getNumPixelFormatPlanes(pf); ++i) {
- m_pTextures[i]->unlockStreamingBmp(frameAvailable == FA_NEW_FRAME);
- }
-
- // Even with vsync, frame duration has a bit of jitter. If the video frames rendered
- // are at the border of a frame's time, this can cause irregular display times.
- // So, if we detect this condition, we adjust the frame time by a small fraction
- // to move it towards the center of the time slot.
- long long jitter = (long long)(getNextFrameTime()-m_pDecoder->getCurTime()*1000);
- if (jitter > (long long)(0.4*(1000/m_pDecoder->getFPS()))) {
- m_JitterCompensation += 0.05;
- if (m_JitterCompensation > 1) {
- m_JitterCompensation -= 1;
- }
- }
- return frameAvailable;
}
void VideoNode::onEOF()
@@ -755,22 +781,26 @@ void VideoNode::onEOF()
PyObject * result = PyEval_CallObject(m_pEOFCallback, arglist);
Py_DECREF(arglist);
if (!result) {
- throw error_already_set();
+ throw py::error_already_set();
}
Py_DECREF(result);
}
+ notifySubscribers("END_OF_FILE");
}
-
void VideoNode::updateStatusDueToDecoderEOF()
{
m_bEOFPending = true;
if (m_bLoop) {
m_StartTime = Player::get()->getFrameTime();
+ m_PauseStartTime = Player::get()->getFrameTime();
m_JitterCompensation = 0.5;
m_PauseTime = 0;
m_FramesInRowTooLate = 0;
m_bFrameAvailable = false;
+ if (m_AudioID != -1) {
+ AudioEngine::get()->notifySeek(m_AudioID);
+ }
m_pDecoder->loop();
} else {
changeVideoState(Paused);
diff --git a/src/player/VideoNode.h b/src/player/VideoNode.h
index e625e03..2ae2caf 100644
--- a/src/player/VideoNode.h
+++ b/src/player/VideoNode.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -29,11 +29,10 @@
#include "Node.h"
#include "RasterNode.h"
-#include "../base/Point.h"
+#include "../base/GLMHelper.h"
#include "../base/IFrameEndListener.h"
#include "../base/UTF8String.h"
-#include "../audio/IAudioSource.h"
#include "../video/VideoDecoder.h"
namespace avg {
@@ -42,12 +41,12 @@ class VideoDecoder;
class TextureMover;
typedef boost::shared_ptr<TextureMover> TextureMoverPtr;
-class AVG_API VideoNode: public RasterNode, IFrameEndListener, IAudioSource
+class AVG_API VideoNode: public RasterNode, IFrameEndListener
{
public:
enum VideoAccelType {NONE, VDPAU};
- static NodeDefinition createDefinition();
+ static void registerType();
VideoNode(const ArgList& args);
virtual ~VideoNode();
@@ -62,9 +61,9 @@ class AVG_API VideoNode: public RasterNode, IFrameEndListener, IAudioSource
const UTF8String& getHRef() const;
void setHRef(const UTF8String& href);
- double getVolume();
- void setVolume(double volume);
- double getFPS() const;
+ float getVolume();
+ void setVolume(float volume);
+ float getFPS() const;
int getQueueLength() const;
void checkReload();
@@ -74,7 +73,10 @@ class AVG_API VideoNode: public RasterNode, IFrameEndListener, IAudioSource
void seekToFrame(int frameNum);
std::string getStreamPixelFormat() const;
long long getDuration() const;
+ long long getVideoDuration() const;
+ long long getAudioDuration() const;
int getBitrate() const;
+ std::string getContainerFormat() const;
std::string getVideoCodec() const;
std::string getAudioCodec() const;
int getAudioSampleRate() const;
@@ -89,18 +91,17 @@ class AVG_API VideoNode: public RasterNode, IFrameEndListener, IAudioSource
void setEOFCallback(PyObject * pEOFCallback);
bool isAccelerated() const;
- virtual void render(const DRect& rect);
- virtual void preRender();
+ virtual void preRender(const VertexArrayPtr& pVA, bool bIsParentActive,
+ float parentEffectiveOpacity);
+ virtual void render();
virtual void onFrameEnd();
- virtual int fillAudioBuffer(AudioBufferPtr pBuffer);
virtual IntPoint getMediaSize();
static VideoAccelType getVideoAccelConfig();
private:
bool renderFrame();
- FrameAvailableCode renderToSurface();
void seek(long long destTime);
void onEOF();
void updateStatusDueToDecoderEOF();
@@ -126,7 +127,7 @@ class AVG_API VideoNode: public RasterNode, IFrameEndListener, IAudioSource
std::string m_Filename;
bool m_bLoop;
bool m_bThreaded;
- double m_FPS;
+ float m_FPS;
int m_QueueLength;
bool m_bEOFPending;
PyObject * m_pEOFCallback;
@@ -139,11 +140,13 @@ class AVG_API VideoNode: public RasterNode, IFrameEndListener, IAudioSource
long long m_StartTime;
long long m_PauseTime;
long long m_PauseStartTime;
- double m_JitterCompensation;
+ float m_JitterCompensation;
VideoDecoder * m_pDecoder;
- double m_Volume;
+ float m_Volume;
bool m_bUsesHardwareAcceleration;
+ bool m_bEnableSound;
+ int m_AudioID;
GLTexturePtr m_pTextures[4];
};
diff --git a/src/player/VideoWriter.cpp b/src/player/VideoWriter.cpp
index c2c39e9..e91db38 100644
--- a/src/player/VideoWriter.cpp
+++ b/src/player/VideoWriter.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -55,7 +55,12 @@ VideoWriter::VideoWriter(CanvasPtr pCanvas, const string& sOutFileName, int fram
m_StartTime(-1),
m_bFramePending(false)
{
- m_FrameSize = m_pCanvas->getSize();
+ if (!pCanvas) {
+ throw Exception(AVG_ERR_INVALID_ARGS, "VideoWriter needs a canvas to write to.");
+ }
+ if (GLContext::getCurrent()->isGLES()) {
+ throw Exception(AVG_ERR_UNSUPPORTED, "VideoWriter not supported under GLES.");
+ }
#ifdef WIN32
int fd = _open(m_sOutFileName.c_str(), O_RDWR | O_CREAT, _S_IREAD | _S_IWRITE);
#elif defined linux
@@ -75,10 +80,12 @@ VideoWriter::VideoWriter(CanvasPtr pCanvas, const string& sOutFileName, int fram
#endif
remove(m_sOutFileName.c_str());
CanvasPtr pMainCanvas = Player::get()->getMainCanvas();
- if (pMainCanvas != m_pCanvas) {
+ if (pMainCanvas == m_pCanvas) {
+ m_FrameSize = Player::get()->getDisplayEngine()->getWindowSize();
+ } else {
+ m_FrameSize = m_pCanvas->getSize();
m_pFBO = dynamic_pointer_cast<OffscreenCanvas>(m_pCanvas)->getFBO();
- m_pCanvas->registerPreRenderListener(this);
- if (GLContext::getCurrent()->isUsingShaders()) {
+ if (GLContext::getMain()->useGPUYUVConversion()) {
m_pFilter = GPURGB2YUVFilterPtr(new GPURGB2YUVFilter(m_FrameSize));
}
}
@@ -92,8 +99,10 @@ VideoWriter::VideoWriter(CanvasPtr pCanvas, const string& sOutFileName, int fram
VideoWriter::~VideoWriter()
{
stop();
- m_pThread->join();
- delete m_pThread;
+ if (m_pThread) {
+ m_pThread->join();
+ delete m_pThread;
+ }
}
void VideoWriter::stop()
@@ -109,9 +118,6 @@ void VideoWriter::stop()
m_pCanvas->unregisterFrameEndListener(this);
m_pCanvas->unregisterPlaybackEndListener(this);
- if (m_pFBO) {
- m_pCanvas->unregisterPreRenderListener(this);
- }
}
}
@@ -163,8 +169,12 @@ void VideoWriter::onFrameEnd()
// For MainCanvas, it simply does a screenshot onFrameEnd and sends that to the
// VideoWriterThread immediately.
// For OffscreenCanvas, an asynchronous PBO readback is started in onFrameEnd.
- // In the next frame's onPreRender, the data is read into a bitmap and sent to
+ // In the next frame's onFrameEnd, the data is read into a bitmap and sent to
// the VideoWriterThread.
+ if (m_pFBO) {
+ // Read last frame's bitmap.
+ getFrameFromPBO();
+ }
if (m_StartTime == -1) {
m_StartTime = Player::get()->getFrameTime();
}
@@ -174,7 +184,7 @@ void VideoWriter::onFrameEnd()
} else {
long long movieTime = Player::get()->getFrameTime() - m_StartTime
- m_PauseTime;
- double timePerFrame = 1000./m_FrameRate;
+ float timePerFrame = 1000.f/m_FrameRate;
int wantedFrame = int(movieTime/timePerFrame+0.1);
if (wantedFrame > m_CurFrame) {
getFrameFromFBO();
@@ -190,21 +200,13 @@ void VideoWriter::onFrameEnd()
}
}
-void VideoWriter::onPreRender()
-{
- getFrameFromPBO();
-}
-
void VideoWriter::getFrameFromFBO()
{
if (m_pFBO) {
if (m_pFilter) {
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
m_pFilter->apply(m_pFBO->getTex());
FBOPtr pYUVFBO = m_pFilter->getFBO();
pYUVFBO->moveToPBO();
- glPopMatrix();
} else {
m_pFBO->moveToPBO();
}
@@ -243,6 +245,9 @@ void VideoWriter::sendFrameToEncoder(BitmapPtr pBitmap)
void VideoWriter::onPlaybackEnd()
{
stop();
+ m_pThread->join();
+ delete m_pThread;
+ m_pThread = 0;
}
void VideoWriter::writeDummyFrame()
diff --git a/src/player/VideoWriter.h b/src/player/VideoWriter.h
index c372991..ef3f724 100644
--- a/src/player/VideoWriter.h
+++ b/src/player/VideoWriter.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -28,8 +28,7 @@
#include "../base/IFrameEndListener.h"
#include "../base/IPlaybackEndListener.h"
-#include "../base/IPreRenderListener.h"
-#include "../base/Point.h"
+#include "../base/GLMHelper.h"
#include <boost/shared_ptr.hpp>
#include <boost/thread.hpp>
@@ -45,8 +44,7 @@ typedef boost::shared_ptr<FBO> FBOPtr;
class GPURGB2YUVFilter;
typedef boost::shared_ptr<GPURGB2YUVFilter> GPURGB2YUVFilterPtr;
-class AVG_API VideoWriter : public IFrameEndListener, IPreRenderListener,
- IPlaybackEndListener
+class AVG_API VideoWriter : public IFrameEndListener, IPlaybackEndListener
{
public:
VideoWriter(CanvasPtr pCanvas, const std::string& sOutFileName,
@@ -62,7 +60,6 @@ class AVG_API VideoWriter : public IFrameEndListener, IPreRenderListener,
int getQMax() const;
virtual void onFrameEnd();
- virtual void onPreRender();
virtual void onPlaybackEnd();
private:
diff --git a/src/player/VideoWriterThread.cpp b/src/player/VideoWriterThread.cpp
index 3bb9a32..821df1b 100644
--- a/src/player/VideoWriterThread.cpp
+++ b/src/player/VideoWriterThread.cpp
@@ -1,7 +1,7 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -22,12 +22,12 @@
#include "VideoWriterThread.h"
-#include "../base/ProfilingZone.h"
+#include "../base/ProfilingZoneID.h"
#include "../base/ScopeTimer.h"
#include "../base/StringHelper.h"
-#if LIBAVFORMAT_VERSION_MAJOR > 52
-#include <libavutil/mathematics.h>
+#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(55, 18, 102)
+ typedef CodecID AVCodecID;
#endif
using namespace std;
@@ -35,11 +35,11 @@ using namespace std;
namespace avg {
const unsigned int VIDEO_BUFFER_SIZE = 400000;
-const ::PixelFormat STREAM_PIXEL_FORMAT = ::PIX_FMT_YUVJ420P;
+const AVPixelFormat STREAM_PIXEL_FORMAT = ::PIX_FMT_YUVJ420P;
-VideoWriterThread::VideoWriterThread(CQueue& CmdQueue, const string& sFilename,
+VideoWriterThread::VideoWriterThread(CQueue& cmdQueue, const string& sFilename,
IntPoint size, int frameRate, int qMin, int qMax)
- : WorkerThread<VideoWriterThread>(sFilename, CmdQueue, Logger::PROFILE),
+ : WorkerThread<VideoWriterThread>(sFilename, cmdQueue, Logger::category::PROFILE),
m_sFilename(sFilename),
m_Size(size),
m_FrameRate(frameRate),
@@ -53,7 +53,7 @@ VideoWriterThread::~VideoWriterThread()
{
}
-static ProfilingZoneID ProfilingZoneEncodeFrame("Encode frame");
+static ProfilingZoneID ProfilingZoneEncodeFrame("Encode frame", true);
void VideoWriterThread::encodeYUVFrame(BitmapPtr pBmp)
{
@@ -86,7 +86,11 @@ void VideoWriterThread::close()
}
if (!(m_pOutputFormat->flags & AVFMT_NOFILE)) {
+#if LIBAVCODEC_VERSION_INT > AV_VERSION_INT(53, 8, 0)
+ avio_close(m_pOutputFormatContext->pb);
+#else
url_fclose(m_pOutputFormatContext->pb);
+#endif
}
av_free(m_pOutputFormatContext);
@@ -120,9 +124,9 @@ void VideoWriterThread::open()
av_register_all(); // TODO: make sure this is only done once.
// av_log_set_level(AV_LOG_DEBUG);
#if LIBAVFORMAT_VERSION_MAJOR > 52
- m_pOutputFormat = av_guess_format("mov", NULL, NULL);
+ m_pOutputFormat = av_guess_format(0, m_sFilename.c_str(), 0);
#else
- m_pOutputFormat = guess_format("mov", NULL, NULL);
+ m_pOutputFormat = guess_format(0, m_sFilename.c_str(), 0);
#endif
m_pOutputFormat->video_codec = CODEC_ID_MJPEG;
@@ -143,9 +147,7 @@ void VideoWriterThread::open()
av_set_parameters(m_pOutputFormatContext, NULL);
#endif
- double muxPreload = 0.5;
- double muxMaxDelay = 0.7;
- m_pOutputFormatContext->preload = int(muxPreload * AV_TIME_BASE);
+ float muxMaxDelay = 0.7;
m_pOutputFormatContext->max_delay = int(muxMaxDelay * AV_TIME_BASE);
// av_dump_format(m_pOutputFormatContext, 0, m_sFilename.c_str(), 1);
@@ -158,8 +160,13 @@ void VideoWriterThread::open()
}
if (!(m_pOutputFormat->flags & AVFMT_NOFILE)) {
+#if LIBAVCODEC_VERSION_INT > AV_VERSION_INT(53, 8, 0)
+ int retVal = avio_open(&m_pOutputFormatContext->pb, m_sFilename.c_str(),
+ URL_WRONLY);
+#else
int retVal = url_fopen(&m_pOutputFormatContext->pb, m_sFilename.c_str(),
URL_WRONLY);
+#endif
if (retVal < 0) {
throw Exception(AVG_ERR_VIDEO_INIT_FAILED,
string("Could not open output file: '") + m_sFilename + "'");
@@ -181,10 +188,14 @@ void VideoWriterThread::open()
void VideoWriterThread::setupVideoStream()
{
+#if LIBAVCODEC_VERSION_INT > AV_VERSION_INT(53, 21, 0)
+ m_pVideoStream = avformat_new_stream(m_pOutputFormatContext, 0);
+#else
m_pVideoStream = av_new_stream(m_pOutputFormatContext, 0);
+#endif
AVCodecContext* pCodecContext = m_pVideoStream->codec;
- pCodecContext->codec_id = static_cast<CodecID>(m_pOutputFormat->video_codec);
+ pCodecContext->codec_id = static_cast<AVCodecID>(m_pOutputFormat->video_codec);
pCodecContext->codec_type = AVMEDIA_TYPE_VIDEO;
/* put sample parameters */
@@ -215,11 +226,16 @@ void VideoWriterThread::openVideoCodec()
AVCodec* videoCodec = avcodec_find_encoder(m_pVideoStream->codec->codec_id);
AVG_ASSERT(videoCodec);
+#if LIBAVCODEC_VERSION_INT > AV_VERSION_INT(53, 8, 0)
+ int rc = avcodec_open2(m_pVideoStream->codec, videoCodec, 0);
+
+#else
int rc = avcodec_open(m_pVideoStream->codec, videoCodec);
+#endif
AVG_ASSERT(rc == 0);
}
-AVFrame* VideoWriterThread::createFrame(::PixelFormat pixelFormat, IntPoint size)
+AVFrame* VideoWriterThread::createFrame(AVPixelFormat pixelFormat, IntPoint size)
{
AVFrame* pPicture;
@@ -233,7 +249,7 @@ AVFrame* VideoWriterThread::createFrame(::PixelFormat pixelFormat, IntPoint size
return pPicture;
}
-static ProfilingZoneID ProfilingZoneConvertImage(" Convert image");
+static ProfilingZoneID ProfilingZoneConvertImage(" Convert image", true);
void VideoWriterThread::convertRGBImage(BitmapPtr pSrcBmp)
{
@@ -284,7 +300,7 @@ void VideoWriterThread::convertYUVImage(BitmapPtr pSrcBmp)
// pUBmp->save("foo"+toString(m_FramesWritten)+".png");
}
-static ProfilingZoneID ProfilingZoneWriteFrame(" Write frame");
+static ProfilingZoneID ProfilingZoneWriteFrame(" Write frame", true);
void VideoWriterThread::writeFrame(AVFrame* pFrame)
{
@@ -299,7 +315,7 @@ void VideoWriterThread::writeFrame(AVFrame* pFrame)
AVPacket packet;
av_init_packet(&packet);
- if ((unsigned long long)(pCodecContext->coded_frame->pts) != AV_NOPTS_VALUE) {
+ if ((pCodecContext->coded_frame->pts) != (long long)AV_NOPTS_VALUE) {
packet.pts = av_rescale_q(pCodecContext->coded_frame->pts,
pCodecContext->time_base, m_pVideoStream->time_base);
}
diff --git a/src/player/VideoWriterThread.h b/src/player/VideoWriterThread.h
index 6d61c6d..4cefa1e 100644
--- a/src/player/VideoWriterThread.h
+++ b/src/player/VideoWriterThread.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -38,7 +38,7 @@ namespace avg {
class AVG_API VideoWriterThread : public WorkerThread<VideoWriterThread> {
public:
- VideoWriterThread(CQueue& CmdQueue, const std::string& sFilename, IntPoint size,
+ VideoWriterThread(CQueue& cmdQueue, const std::string& sFilename, IntPoint size,
int frameRate, int qMin, int qMax);
virtual ~VideoWriterThread();
@@ -57,7 +57,7 @@ class AVG_API VideoWriterThread : public WorkerThread<VideoWriterThread> {
void setupVideoStream();
void openVideoCodec();
- AVFrame* createFrame(::PixelFormat pixelFormat, IntPoint size);
+ AVFrame* createFrame(AVPixelFormat pixelFormat, IntPoint size);
void convertRGBImage(BitmapPtr pSrcBmp);
void convertYUVImage(BitmapPtr pSrcBmp);
@@ -76,8 +76,6 @@ class AVG_API VideoWriterThread : public WorkerThread<VideoWriterThread> {
AVFrame* m_pConvertedFrame;
unsigned char* m_pPictureBuffer;
unsigned char* m_pVideoBuffer;
- int m_VideoBufferSize;
- PixelFormat m_StreamPixelFormat;
int m_FramesWritten;
};
diff --git a/src/player/WordsNode.cpp b/src/player/WordsNode.cpp
index be20edb..ba67720 100644
--- a/src/player/WordsNode.cpp
+++ b/src/player/WordsNode.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -21,7 +21,7 @@
#include "WordsNode.h"
#include "OGLSurface.h"
-#include "NodeDefinition.h"
+#include "TypeDefinition.h"
#include "TextEngine.h"
#include "../base/Logger.h"
@@ -46,7 +46,7 @@ using namespace std;
namespace avg {
-NodeDefinition WordsNode::createDefinition()
+void WordsNode::registerType()
{
static const string sDTDElements =
"<!ELEMENT span (#PCDATA|span|b|big|i|s|sub|sup|small|tt|u)*>\n"
@@ -84,42 +84,50 @@ NodeDefinition WordsNode::createDefinition()
"small", "tt", "u", "br"};
vector<string> sChildren = vectorFromCArray(sizeof(sChildArray)/sizeof(*sChildArray),
sChildArray);
- return NodeDefinition("words", Node::buildNode<WordsNode>)
- .extendDefinition(RasterNode::createDefinition())
+ TypeDefinition def = TypeDefinition("words", "rasternode",
+ ExportedObject::buildObject<WordsNode>)
.addChildren(sChildren)
.addDTDElements(sDTDElements)
- .addArg(Arg<string>("font", "arial", false, offsetof(WordsNode, m_sFontName)))
- .addArg(Arg<string>("variant", "", false, offsetof(WordsNode, m_sFontVariant)))
+ .addArg(Arg<string>("font", "sans"))
+ .addArg(Arg<string>("variant", ""))
.addArg(Arg<UTF8String>("text", ""))
- .addArg(Arg<string>("color", "FFFFFF", false, offsetof(WordsNode, m_sColorName)))
- .addArg(Arg<double>("fontsize", 15, false, offsetof(WordsNode, m_FontSize)))
- .addArg(Arg<int>("indent", 0, false, offsetof(WordsNode, m_Indent)))
- .addArg(Arg<double>("linespacing", -1, false, offsetof(WordsNode, m_LineSpacing)))
+ .addArg(Arg<string>("color", "FFFFFF"))
+ .addArg(Arg<float>("aagamma", 1.0f))
+ .addArg(Arg<float>("fontsize", 15))
+ .addArg(Arg<int>("indent", 0, false))
+ .addArg(Arg<float>("linespacing", 0))
.addArg(Arg<string>("alignment", "left"))
.addArg(Arg<string>("wrapmode", "word"))
- .addArg(Arg<bool>("justify", false, false, offsetof(WordsNode, m_bJustify)))
+ .addArg(Arg<bool>("justify", false))
.addArg(Arg<bool>("rawtextmode", false, false,
offsetof(WordsNode, m_bRawTextMode)))
- .addArg(Arg<double>("letterspacing", 0, false,
- offsetof(WordsNode, m_LetterSpacing)))
- .addArg(Arg<bool>("hint", true, false, offsetof(WordsNode, m_bHint)))
+ .addArg(Arg<float>("letterspacing", 0))
+ .addArg(Arg<bool>("hint", true))
+ .addArg(Arg<FontStyle>("fontstyle", FontStyle()))
;
+ TypeRegistry::get()->registerType(def);
}
WordsNode::WordsNode(const ArgList& args)
: m_LogicalSize(0,0),
m_pFontDescription(0),
m_pLayout(0),
- m_RedrawState(FONT_CHANGED)
+ m_bRenderNeeded(true)
{
m_bParsedText = false;
-
args.setMembers(this);
- setAlignment(args.getArgVal<string>("alignment"));
- setWrapMode(args.getArgVal<string>("wrapmode"));
+
+ m_FontStyle = args.getArgVal<FontStyle>("fontstyle");
+ m_FontStyle.setDefaultedArgs(args);
+#ifdef _WIN32
+ if (m_FontStyle.getFont() == "sans") {
+ m_FontStyle.setFont("Arial");
+ m_FontStyle.setFontVariant("Regular");
+ }
+#endif
+ updateFont();
setText(args.getArgVal<UTF8String>("text"));
- m_Color = colorStringToColor(m_sColorName);
- setViewport(-32767, -32767, -32767, -32767);
+
ObjectCounter::get()->incRef(&typeid(*this));
}
@@ -146,7 +154,7 @@ void WordsNode::setTextFromNodeValue(const string& sText)
void WordsNode::connectDisplay()
{
RasterNode::connectDisplay();
- setDirty(FONT_CHANGED);
+ getSurface()->setAlphaGamma(m_FontStyle.getAAGamma());
}
void WordsNode::connect(CanvasPtr pCanvas)
@@ -160,132 +168,126 @@ void WordsNode::disconnect(bool bKill)
if (m_pFontDescription) {
pango_font_description_free(m_pFontDescription);
m_pFontDescription = 0;
- setDirty(FONT_CHANGED);
+ updateFont();
}
RasterNode::disconnect(bKill);
}
string WordsNode::getAlignment() const
{
- switch(m_Alignment) {
- case PANGO_ALIGN_LEFT:
- return "left";
- case PANGO_ALIGN_CENTER:
- return "center";
- case PANGO_ALIGN_RIGHT:
- return "right";
- default:
- AVG_ASSERT(false);
- return "";
- }
+ return m_FontStyle.getAlignment();
}
void WordsNode::setAlignment(const string& sAlign)
{
- if (sAlign == "left") {
- m_Alignment = PANGO_ALIGN_LEFT;
- } else if (sAlign == "center") {
- m_Alignment = PANGO_ALIGN_CENTER;
- } else if (sAlign == "right") {
- m_Alignment = PANGO_ALIGN_RIGHT;
- } else {
- throw(Exception(AVG_ERR_UNSUPPORTED,
- "WordsNode alignment "+sAlign+" not supported."));
- }
-
- setDirty(LAYOUT_CHANGED);
+ m_FontStyle.setAlignment(sAlign);
+ updateLayout();
}
bool WordsNode::getJustify() const
{
- return m_bJustify;
+ return m_FontStyle.getJustify();
}
void WordsNode::setJustify(bool bJustify)
{
- m_bJustify = bJustify;
- setDirty(LAYOUT_CHANGED);
+ m_FontStyle.setJustify(bJustify);
+ updateLayout();
}
-double WordsNode::getLetterSpacing() const
+float WordsNode::getLetterSpacing() const
{
- return m_LetterSpacing;
+ return m_FontStyle.getLetterSpacing();
}
-void WordsNode::setLetterSpacing(double letterSpacing)
+void WordsNode::setLetterSpacing(float letterSpacing)
{
- m_LetterSpacing = letterSpacing;
- setDirty(LAYOUT_CHANGED);
+ m_FontStyle.setLetterSpacing(letterSpacing);
+ updateLayout();
}
bool WordsNode::getHint() const
{
- return m_bHint;
+ return m_FontStyle.getHint();
}
void WordsNode::setHint(bool bHint)
{
- setDirty(LAYOUT_CHANGED);
- m_bHint = bHint;
+ m_FontStyle.setHint(bHint);
+ updateLayout();
}
-double WordsNode::getWidth() const
+float WordsNode::getWidth() const
{
- const_cast<WordsNode*>(this)->updateLayout();
return AreaNode::getWidth();
}
-void WordsNode::setWidth(double width)
+void WordsNode::setWidth(float width)
{
- setDirty(LAYOUT_CHANGED);
AreaNode::setWidth(width);
+ updateLayout();
}
-double WordsNode::getHeight() const
+float WordsNode::getHeight() const
{
- const_cast<WordsNode*>(this)->updateLayout();
return AreaNode::getHeight();
}
-void WordsNode::setHeight(double width)
+void WordsNode::setHeight(float width)
{
- setDirty(LAYOUT_CHANGED);
AreaNode::setHeight(width);
+ updateLayout();
}
-DPoint WordsNode::getSize() const
+glm::vec2 WordsNode::getSize() const
{
- const_cast<WordsNode*>(this)->updateLayout();
return AreaNode::getSize();
}
-void WordsNode::setSize(const DPoint& pt)
+void WordsNode::setSize(const glm::vec2& pt)
{
- setDirty(LAYOUT_CHANGED);
AreaNode::setSize(pt);
+ updateLayout();
}
-void WordsNode::getElementsByPos(const DPoint& pos, vector<NodeWeakPtr>& pElements)
+glm::vec2 WordsNode::toLocal(const glm::vec2& globalPos) const
{
- updateLayout();
- DPoint relPos = pos-DPoint(m_AlignOffset, 0);
- AreaNode::getElementsByPos(relPos, pElements);
+ glm::vec2 localPos = globalPos - getRelViewport().tl - glm::vec2(m_AlignOffset, 0);
+ return getRotatedPivot(localPos, -getAngle(), getPivot());
+}
+
+glm::vec2 WordsNode::toGlobal(const glm::vec2& localPos) const
+{
+ glm::vec2 alignPos = localPos + glm::vec2(m_AlignOffset, 0);
+ glm::vec2 globalPos = getRotatedPivot(alignPos, getAngle(), getPivot());
+ return globalPos + getRelViewport().tl;
+}
+
+const FontStyle& WordsNode::getFontStyle() const
+{
+ return m_FontStyle;
+}
+
+void WordsNode::setFontStyle(const FontStyle& fontStyle)
+{
+ m_FontStyle = fontStyle;
+ updateFont();
}
const std::string& WordsNode::getFont() const
{
- return m_sFontName;
+ return m_FontStyle.getFont();
}
void WordsNode::setFont(const std::string& sName)
{
- m_sFontName = sName;
- setDirty(FONT_CHANGED);
+ m_FontStyle.setFont(sName);
+ updateFont();
}
const std::string& WordsNode::getFontVariant() const
{
- return m_sFontVariant;
+ return m_FontStyle.getFontVariant();
}
void WordsNode::addFontDir(const std::string& sDir)
@@ -296,8 +298,8 @@ void WordsNode::addFontDir(const std::string& sDir)
void WordsNode::setFontVariant(const std::string& sVariant)
{
- m_sFontVariant = sVariant;
- setDirty(FONT_CHANGED);
+ m_FontStyle.setFontVariant(sVariant);
+ updateFont();
}
const UTF8String& WordsNode::getText() const
@@ -317,59 +319,67 @@ void WordsNode::setText(const UTF8String& sText)
m_sText = m_sRawText;
if (m_bRawTextMode) {
m_bParsedText = false;
+ updateLayout();
} else {
setParsedText(sText);
}
- setDirty(LAYOUT_CHANGED);
}
}
const std::string& WordsNode::getColor() const
{
- return m_sColorName;
+ return m_FontStyle.getColor();
}
void WordsNode::setColor(const string& sColor)
{
- m_sColorName = sColor;
- m_Color = colorStringToColor(m_sColorName);
- setDirty(RENDER_NEEDED);
+ m_FontStyle.setColor(sColor);
+}
+
+float WordsNode::getAAGamma() const
+{
+ return m_FontStyle.getAAGamma();
+}
+
+void WordsNode::setAAGamma(float gamma)
+{
+ m_FontStyle.setAAGamma(gamma);
+ if (getState() == Node::NS_CANRENDER) {
+ getSurface()->setAlphaGamma(gamma);
+ }
}
-double WordsNode::getFontSize() const
+float WordsNode::getFontSize() const
{
- return m_FontSize;
+ return m_FontStyle.getFontSize();
}
-void WordsNode::setFontSize(double size)
+void WordsNode::setFontSize(float size)
{
- if (size <= 1) {
- throw Exception(AVG_ERR_INVALID_ARGS, "Words node: Font size < 1 is illegal.");
- }
- m_FontSize = size;
- setDirty(FONT_CHANGED);
+ m_FontStyle.setFontSize(size);
+ updateFont();
}
int WordsNode::getIndent() const
{
- return m_Indent;
+ return m_FontStyle.getIndent();
}
void WordsNode::setIndent(int indent)
{
- m_Indent = indent;
- setDirty(LAYOUT_CHANGED);
+ m_FontStyle.setIndent(indent);
+ updateLayout();
}
-double WordsNode::getLineSpacing() const
+float WordsNode::getLineSpacing() const
{
- return m_LineSpacing;
+ return m_FontStyle.getLineSpacing();
}
-void WordsNode::setLineSpacing(double lineSpacing)
+void WordsNode::setLineSpacing(float lineSpacing)
{
- m_LineSpacing = lineSpacing;
- setDirty(LAYOUT_CHANGED);
+ m_FontStyle.setLineSpacing(lineSpacing);
+ updateLayout();
}
bool WordsNode::getRawTextMode() const
@@ -387,33 +397,34 @@ void WordsNode::setRawTextMode(bool rawTextMode)
setParsedText(m_sText);
}
m_bRawTextMode = rawTextMode;
- setDirty(LAYOUT_CHANGED);
+ updateLayout();
}
}
-DPoint WordsNode::getGlyphPos(int i)
+glm::vec2 WordsNode::getGlyphPos(int i)
{
PangoRectangle rect = getGlyphRect(i);
- return DPoint(double(rect.x)/PANGO_SCALE, double(rect.y)/PANGO_SCALE);
+ return glm::vec2(float(rect.x)/PANGO_SCALE, float(rect.y)/PANGO_SCALE);
}
-DPoint WordsNode::getGlyphSize(int i)
+glm::vec2 WordsNode::getGlyphSize(int i)
{
PangoRectangle rect = getGlyphRect(i);
- return DPoint(double(rect.width)/PANGO_SCALE, double(rect.height)/PANGO_SCALE);
+ return glm::vec2(float(rect.width)/PANGO_SCALE, float(rect.height)/PANGO_SCALE);
}
int WordsNode::getNumLines()
{
- updateLayout();
- return pango_layout_get_line_count(m_pLayout);
+ if(m_sText.length() != 0) {
+ return pango_layout_get_line_count(m_pLayout);
+ }
+ return 0;
}
-PyObject* WordsNode::getCharIndexFromPos(DPoint p)
+PyObject* WordsNode::getCharIndexFromPos(glm::vec2 p)
{
int index;
int trailing;
- updateLayout();
gboolean bXyToIndex = pango_layout_xy_to_index(m_pLayout,
int(p.x*PANGO_SCALE), int(p.y*PANGO_SCALE), &index, &trailing);
if (bXyToIndex) {
@@ -426,52 +437,31 @@ PyObject* WordsNode::getCharIndexFromPos(DPoint p)
std::string WordsNode::getTextAsDisplayed()
{
- updateLayout();
return pango_layout_get_text(m_pLayout);
}
-DPoint WordsNode::getLineExtents(int line)
+glm::vec2 WordsNode::getLineExtents(int line)
{
- if(line < 0 || line >= getNumLines()) {
+ if (line < 0 || line >= getNumLines()) {
throw Exception(AVG_ERR_OUT_OF_RANGE, "WordsNode.getLineExtents: line index "
+toString(line)+" is out of range.");
}
- updateLayout();
PangoRectangle logical_rect;
PangoRectangle ink_rect;
PangoLayoutLine *layoutLine = pango_layout_get_line_readonly(m_pLayout, line);
pango_layout_line_get_pixel_extents(layoutLine, &ink_rect, &logical_rect);
- return DPoint(double(logical_rect.width), double(logical_rect.height));
+ return glm::vec2(float(logical_rect.width), float(logical_rect.height));
}
void WordsNode::setWrapMode(const string& sWrapMode)
{
- if (sWrapMode == "word") {
- m_WrapMode = PANGO_WRAP_WORD;
- } else if (sWrapMode == "char") {
- m_WrapMode = PANGO_WRAP_CHAR;
- } else if (sWrapMode == "wordchar") {
- m_WrapMode = PANGO_WRAP_WORD_CHAR;
- } else {
- throw(Exception(AVG_ERR_UNSUPPORTED,
- "WordsNode wrapping mode "+sWrapMode+" not supported."));
- }
- setDirty(LAYOUT_CHANGED);
+ m_FontStyle.setWrapMode(sWrapMode);
+ updateLayout();
}
string WordsNode::getWrapMode() const
{
- switch(m_WrapMode) {
- case PANGO_WRAP_WORD:
- return "word";
- case PANGO_WRAP_CHAR:
- return "char";
- case PANGO_WRAP_WORD_CHAR:
- return "wordchar";
- default:
- AVG_ASSERT(false);
- return "";
- }
+ return m_FontStyle.getWrapMode();
}
void WordsNode::parseString(PangoAttrList** ppAttrList, char** ppText)
@@ -497,31 +487,21 @@ void WordsNode::parseString(PangoAttrList** ppAttrList, char** ppText)
void WordsNode::calcMaskCoords()
{
- updateLayout();
-
// Calculate texture coordinates for the mask texture, normalized to
// the extents of the text.
- DPoint normMaskSize;
- DPoint normMaskPos;
- DPoint mediaSize = DPoint(getMediaSize());
- DPoint effMaskPos = getMaskPos()-DPoint(m_InkOffset);
- DPoint maskSize = getMaskSize();
- switch (m_Alignment) {
- case PANGO_ALIGN_LEFT:
- break;
- case PANGO_ALIGN_CENTER:
- effMaskPos.x -= m_AlignOffset+getSize().x/2;
- break;
- case PANGO_ALIGN_RIGHT:
- effMaskPos.x -= m_AlignOffset+getSize().x;
- break;
- }
- if (maskSize == DPoint(0,0)) {
- normMaskSize = DPoint(getSize().x/mediaSize.x, getSize().y/mediaSize.y);
- normMaskPos = DPoint(effMaskPos.x/getSize().x, effMaskPos.y/getSize().y);
+ glm::vec2 normMaskSize;
+ glm::vec2 normMaskPos;
+ glm::vec2 mediaSize = glm::vec2(getMediaSize());
+ glm::vec2 effMaskPos = getMaskPos()-glm::vec2(m_InkOffset);
+ glm::vec2 maskSize = getMaskSize();
+
+ if (maskSize == glm::vec2(0,0)) {
+ normMaskSize = glm::vec2(getSize().x/mediaSize.x, getSize().y/mediaSize.y);
+ normMaskPos = glm::vec2(effMaskPos.x/getSize().x, effMaskPos.y/getSize().y);
} else {
- normMaskSize = DPoint(maskSize.x/mediaSize.x, maskSize.y/mediaSize.y);
- normMaskPos = DPoint(effMaskPos.x/getMaskSize().x, effMaskPos.y/getMaskSize().y);
+ normMaskSize = glm::vec2(maskSize.x/mediaSize.x, maskSize.y/mediaSize.y);
+ normMaskPos = glm::vec2(effMaskPos.x/getMaskSize().x,
+ effMaskPos.y/getMaskSize().y);
}
/*
cerr << "calcMaskCoords" << endl;
@@ -535,126 +515,114 @@ void WordsNode::calcMaskCoords()
getSurface()->setMaskCoords(normMaskPos, normMaskSize);
}
-void WordsNode::setDirty(RedrawState newState)
-{
- if (newState < m_RedrawState) {
- m_RedrawState = newState;
- }
-}
-
static ProfilingZoneID UpdateFontProfilingZone("WordsNode: Update font");
void WordsNode::updateFont()
{
- if (m_RedrawState == FONT_CHANGED) {
+ {
ScopeTimer timer(UpdateFontProfilingZone);
if (m_pFontDescription) {
pango_font_description_free(m_pFontDescription);
}
- m_pFontDescription = TextEngine::get(m_bHint).getFontDescription(m_sFontName,
- m_sFontVariant);
+ TextEngine& engine = TextEngine::get(m_FontStyle.getHint());
+ m_pFontDescription = engine.getFontDescription(m_FontStyle.getFont(),
+ m_FontStyle.getFontVariant());
pango_font_description_set_absolute_size(m_pFontDescription,
- (int)(m_FontSize * PANGO_SCALE));
-
- m_RedrawState = LAYOUT_CHANGED;
+ (int)(m_FontStyle.getFontSize() * PANGO_SCALE));
}
+ updateLayout();
}
static ProfilingZoneID UpdateLayoutProfilingZone("WordsNode: Update layout");
void WordsNode::updateLayout()
{
- updateFont();
- if (m_RedrawState == LAYOUT_CHANGED) {
- ScopeTimer timer(UpdateLayoutProfilingZone);
+ ScopeTimer timer(UpdateLayoutProfilingZone);
- if (m_sText.length() == 0) {
- m_LogicalSize = IntPoint(0,0);
- m_RedrawState = RENDER_NEEDED;
- } else {
- PangoContext* pContext = TextEngine::get(m_bHint).getPangoContext();
- pango_context_set_font_description(pContext, m_pFontDescription);
+ if (m_sText.length() == 0) {
+ m_LogicalSize = IntPoint(0,0);
+ m_bRenderNeeded = true;
+ } else {
+ TextEngine& engine = TextEngine::get(m_FontStyle.getHint());
+ PangoContext* pContext = engine.getPangoContext();
+ pango_context_set_font_description(pContext, m_pFontDescription);
- if (m_pLayout) {
- g_object_unref(m_pLayout);
- }
- m_pLayout = pango_layout_new(pContext);
+ if (m_pLayout) {
+ g_object_unref(m_pLayout);
+ }
+ m_pLayout = pango_layout_new(pContext);
- PangoAttrList * pAttrList = 0;
+ PangoAttrList * pAttrList = 0;
#if PANGO_VERSION > PANGO_VERSION_ENCODE(1,18,2)
- PangoAttribute * pLetterSpacing = pango_attr_letter_spacing_new
- (int(m_LetterSpacing*1024));
+ PangoAttribute * pLetterSpacing = pango_attr_letter_spacing_new
+ (int(m_FontStyle.getLetterSpacing()*1024));
#endif
- if (m_bParsedText) {
- char * pText = 0;
- parseString(&pAttrList, &pText);
+ if (m_bParsedText) {
+ char * pText = 0;
+ parseString(&pAttrList, &pText);
#if PANGO_VERSION > PANGO_VERSION_ENCODE(1,18,2)
- // Workaround for pango bug.
- pango_attr_list_insert_before(pAttrList, pLetterSpacing);
+ // Workaround for pango bug.
+ pango_attr_list_insert_before(pAttrList, pLetterSpacing);
#endif
- pango_layout_set_text(m_pLayout, pText, -1);
- g_free (pText);
- } else {
- pAttrList = pango_attr_list_new();
+ pango_layout_set_text(m_pLayout, pText, -1);
+ g_free(pText);
+ } else {
+ pAttrList = pango_attr_list_new();
#if PANGO_VERSION > PANGO_VERSION_ENCODE(1,18,2)
- pango_attr_list_insert_before(pAttrList, pLetterSpacing);
+ pango_attr_list_insert_before(pAttrList, pLetterSpacing);
#endif
- pango_layout_set_text(m_pLayout, m_sText.c_str(), -1);
- }
- pango_layout_set_attributes(m_pLayout, pAttrList);
- pango_attr_list_unref(pAttrList);
-
- pango_layout_set_wrap(m_pLayout, m_WrapMode);
- pango_layout_set_alignment(m_pLayout, m_Alignment);
- pango_layout_set_justify(m_pLayout, m_bJustify);
- if (getUserSize().x != 0) {
- pango_layout_set_width(m_pLayout, int(getUserSize().x * PANGO_SCALE));
- }
- pango_layout_set_indent(m_pLayout, m_Indent * PANGO_SCALE);
- if (m_Indent < 0) {
- // For hanging indentation, we add a tabstop to support lists
- PangoTabArray* pTabs = pango_tab_array_new_with_positions(1, false,
- PANGO_TAB_LEFT, -m_Indent * PANGO_SCALE);
- pango_layout_set_tabs(m_pLayout, pTabs);
- pango_tab_array_free(pTabs);
- }
- if (m_LineSpacing != -1) {
- pango_layout_set_spacing(m_pLayout, (int)(m_LineSpacing*PANGO_SCALE));
- }
- PangoRectangle logical_rect;
- PangoRectangle ink_rect;
- pango_layout_get_pixel_extents(m_pLayout, &ink_rect, &logical_rect);
-
- /*
- cerr << getID() << endl;
- cerr << "Ink: " << ink_rect.x << ", " << ink_rect.y << ", "
- << ink_rect.width << ", " << ink_rect.height << endl;
- cerr << "Logical: " << logical_rect.x << ", " << logical_rect.y << ", "
- << logical_rect.width << ", " << logical_rect.height << endl;
- cerr << "User Size: " << getUserSize() << endl;
- */
- m_InkSize.y = ink_rect.height;
- if (getUserSize().x == 0) {
- m_InkSize.x = ink_rect.width;
- } else {
- m_InkSize.x = int(getUserSize().x);
- }
- if (m_InkSize.x == 0) {
- m_InkSize.x = 1;
- }
- if (m_InkSize.y == 0) {
- m_InkSize.y = 1;
- }
- m_LogicalSize.y = logical_rect.height;
- m_LogicalSize.x = logical_rect.width;
- m_InkOffset = IntPoint(ink_rect.x-logical_rect.x, ink_rect.y-logical_rect.y);
- if (m_LineSpacing == -1) {
- m_LineSpacing = pango_layout_get_spacing(m_pLayout)/PANGO_SCALE;
- }
- m_RedrawState = RENDER_NEEDED;
- setViewport(-32767, -32767, -32767, -32767);
+ pango_layout_set_text(m_pLayout, m_sText.c_str(), -1);
+ }
+ pango_layout_set_attributes(m_pLayout, pAttrList);
+ pango_attr_list_unref(pAttrList);
+
+ pango_layout_set_wrap(m_pLayout, m_FontStyle.getWrapModeVal());
+ pango_layout_set_alignment(m_pLayout, m_FontStyle.getAlignmentVal());
+ pango_layout_set_justify(m_pLayout, m_FontStyle.getJustify());
+ if (getUserSize().x != 0) {
+ pango_layout_set_width(m_pLayout, int(getUserSize().x * PANGO_SCALE));
+ }
+ int indent = m_FontStyle.getIndent() * PANGO_SCALE;
+ pango_layout_set_indent(m_pLayout, indent);
+ if (indent < 0) {
+ // For hanging indentation, we add a tabstop to support lists
+ PangoTabArray* pTabs = pango_tab_array_new_with_positions(1, false,
+ PANGO_TAB_LEFT, -indent);
+ pango_layout_set_tabs(m_pLayout, pTabs);
+ pango_tab_array_free(pTabs);
+ }
+ pango_layout_set_spacing(m_pLayout,
+ (int)(m_FontStyle.getLineSpacing()*PANGO_SCALE));
+ PangoRectangle logical_rect;
+ PangoRectangle ink_rect;
+ pango_layout_get_pixel_extents(m_pLayout, &ink_rect, &logical_rect);
+
+ /*
+ cerr << getID() << endl;
+ cerr << "Ink: " << ink_rect.x << ", " << ink_rect.y << ", "
+ << ink_rect.width << ", " << ink_rect.height << endl;
+ cerr << "Logical: " << logical_rect.x << ", " << logical_rect.y << ", "
+ << logical_rect.width << ", " << logical_rect.height << endl;
+ cerr << "User Size: " << getUserSize() << endl;
+ */
+ m_InkSize.y = ink_rect.height;
+ if (getUserSize().x == 0) {
+ m_InkSize.x = ink_rect.width;
+ } else {
+ m_InkSize.x = int(getUserSize().x);
+ }
+ if (m_InkSize.x == 0) {
+ m_InkSize.x = 1;
+ }
+ if (m_InkSize.y == 0) {
+ m_InkSize.y = 1;
}
+ m_LogicalSize.y = logical_rect.height;
+ m_LogicalSize.x = logical_rect.width;
+ m_InkOffset = IntPoint(ink_rect.x-logical_rect.x, ink_rect.y-logical_rect.y);
+ m_bRenderNeeded = true;
+ setViewport(-32767, -32767, -32767, -32767);
}
}
@@ -662,15 +630,16 @@ static ProfilingZoneID RenderTextProfilingZone("WordsNode: render text");
void WordsNode::renderText()
{
- AVG_ASSERT(m_RedrawState == RENDER_NEEDED || m_RedrawState == CLEAN);
-
if (!(getState() == NS_CANRENDER)) {
return;
}
- if (m_RedrawState == RENDER_NEEDED) {
+ if (m_bRenderNeeded) {
if (m_sText.length() != 0) {
ScopeTimer timer(RenderTextProfilingZone);
- int maxTexSize = GLContext::getCurrent()->getMaxTexSize();
+ TextEngine& engine = TextEngine::get(m_FontStyle.getHint());
+ PangoContext* pContext = engine.getPangoContext();
+ pango_context_set_font_description(pContext, m_pFontDescription);
+ int maxTexSize = GLContext::getMain()->getMaxTexSize();
if (m_InkSize.x > maxTexSize || m_InkSize.y > maxTexSize) {
throw Exception(AVG_ERR_UNSUPPORTED,
"WordsNode size exceeded maximum (Size="
@@ -695,7 +664,7 @@ void WordsNode::renderText()
PangoRectangle ink_rect;
pango_layout_get_pixel_extents(m_pLayout, &ink_rect, &logical_rect);
pango_ft2_render_layout(&bitmap, m_pLayout, -ink_rect.x, -ink_rect.y);
- switch (m_Alignment) {
+ switch (m_FontStyle.getAlignmentVal()) {
case PANGO_ALIGN_LEFT:
m_AlignOffset = 0;
break;
@@ -711,10 +680,9 @@ void WordsNode::renderText()
pMover->unlock();
pMover->moveToTexture(*pTex);
-
- bind();
+ newSurface();
}
- m_RedrawState = CLEAN;
+ m_bRenderNeeded = false;
}
}
@@ -722,45 +690,43 @@ void WordsNode::redraw()
{
AVG_ASSERT(m_sText.length() < 32767);
- updateLayout();
renderText();
}
-void WordsNode::preRender()
+void WordsNode::preRender(const VertexArrayPtr& pVA, bool bIsParentActive,
+ float parentEffectiveOpacity)
{
- Node::preRender();
+ Node::preRender(pVA, bIsParentActive, parentEffectiveOpacity);
if (isVisible()) {
redraw();
- } else {
- updateLayout();
}
+ Pixel32 color = m_FontStyle.getColorVal();
if (m_sText.length() != 0 && isVisible()) {
- renderFX(getSize(), m_Color, false);
+ renderFX(getSize(), color, false);
}
+ calcVertexArray(pVA, color);
}
static ProfilingZoneID RenderProfilingZone("WordsNode::render");
-void WordsNode::render(const DRect& rect)
+void WordsNode::render()
{
ScopeTimer timer(RenderProfilingZone);
if (m_sText.length() != 0 && isVisible()) {
IntPoint offset = m_InkOffset + IntPoint(m_AlignOffset, 0);
- GLContext* pContext = GLContext::getCurrent();
- if (offset != IntPoint(0,0)) {
- pContext->pushTransform(DPoint(offset), 0, DPoint(0,0));
- }
- blta8(DPoint(getSurface()->getSize()), getEffectiveOpacity(), m_Color,
- getBlendMode());
- if (offset != IntPoint(0,0)) {
- pContext->popTransform();
+ glm::mat4 transform;
+ if (offset == IntPoint(0,0)) {
+ transform = getTransform();
+ } else {
+ transform = glm::translate(getTransform(), glm::vec3(offset.x, offset.y, 0));
}
+ blta8(transform, glm::vec2(getSurface()->getSize()), getEffectiveOpacity(),
+ m_FontStyle.getColorVal(), getBlendMode());
}
}
IntPoint WordsNode::getMediaSize()
{
- updateLayout();
return m_LogicalSize;
}
@@ -798,7 +764,6 @@ PangoRectangle WordsNode::getGlyphRect(int i)
throw(Exception(AVG_ERR_INVALID_ARGS,
string("getGlyphRect: Index ") + toString(i) + " out of range."));
}
- updateLayout();
const char* pText = pango_layout_get_text(m_pLayout);
char * pChar = g_utf8_offset_to_pointer(pText, i);
int byteOffset = pChar-pText;
@@ -818,16 +783,16 @@ PangoRectangle WordsNode::getGlyphRect(int i)
void WordsNode::setParsedText(const UTF8String& sText)
{
m_sText = removeExcessSpaces(sText);
- setDirty(LAYOUT_CHANGED);
// This just does a syntax check and throws an exception if appropriate.
// The results are discarded.
PangoAttrList * pAttrList = 0;
char * pText = 0;
parseString(&pAttrList, &pText);
- pango_attr_list_unref (pAttrList);
- g_free (pText);
+ pango_attr_list_unref(pAttrList);
+ g_free(pText);
m_bParsedText = true;
+ updateLayout();
}
UTF8String WordsNode::applyBR(const UTF8String& sText)
diff --git a/src/player/WordsNode.h b/src/player/WordsNode.h
index 23c225c..c189e9f 100644
--- a/src/player/WordsNode.h
+++ b/src/player/WordsNode.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -24,6 +24,7 @@
#include "../api.h"
#include "RasterNode.h"
+#include "FontStyle.h"
#include "../graphics/Pixel32.h"
#include "../base/UTF8String.h"
@@ -37,7 +38,7 @@ namespace avg {
class AVG_API WordsNode : public RasterNode
{
public:
- static NodeDefinition createDefinition();
+ static void registerType();
WordsNode(const ArgList& args);
virtual ~WordsNode();
@@ -45,21 +46,27 @@ class AVG_API WordsNode : public RasterNode
virtual void connectDisplay();
virtual void connect(CanvasPtr pCanvas);
virtual void disconnect(bool bKill);
- virtual void preRender();
- virtual void render(const DRect& rect);
+ virtual void preRender(const VertexArrayPtr& pVA, bool bIsParentActive,
+ float parentEffectiveOpacity);
+ virtual void render();
- virtual double getWidth() const;
- virtual void setWidth(double width);
+ virtual float getWidth() const;
+ virtual void setWidth(float width);
- virtual double getHeight() const;
- virtual void setHeight(double width);
+ virtual float getHeight() const;
+ virtual void setHeight(float width);
- virtual DPoint getSize() const;
- virtual void setSize(const DPoint& pt);
+ virtual glm::vec2 getSize() const;
+ virtual void setSize(const glm::vec2& pt);
+
+ glm::vec2 toLocal(const glm::vec2& globalPos) const;
+ glm::vec2 toGlobal(const glm::vec2& localPos) const;
- void getElementsByPos(const DPoint& pos, std::vector<NodeWeakPtr>& pElements);
void setTextFromNodeValue(const std::string& sText);
+ const FontStyle& getFontStyle() const;
+ void setFontStyle(const FontStyle& fontStyle);
+
const std::string& getFont() const;
void setFont(const std::string& sName);
@@ -72,14 +79,17 @@ class AVG_API WordsNode : public RasterNode
const std::string& getColor() const;
void setColor(const std::string& sColor);
- double getFontSize() const;
- void setFontSize(double size);
+ virtual float getAAGamma() const;
+ virtual void setAAGamma(float gamma);
+
+ float getFontSize() const;
+ void setFontSize(float size);
int getIndent() const;
void setIndent(int indent);
- double getLineSpacing() const;
- void setLineSpacing(double lineSpacing);
+ float getLineSpacing() const;
+ void setLineSpacing(float lineSpacing);
bool getRawTextMode() const;
void setRawTextMode(bool rawTextMode);
@@ -93,20 +103,20 @@ class AVG_API WordsNode : public RasterNode
bool getJustify() const;
void setJustify(bool bJustify);
- double getLetterSpacing() const;
- void setLetterSpacing(double letterSpacing);
+ float getLetterSpacing() const;
+ void setLetterSpacing(float letterSpacing);
bool getHint() const;
void setHint(bool bHint);
- DPoint getGlyphPos(int i);
- DPoint getGlyphSize(int i);
+ glm::vec2 getGlyphPos(int i);
+ glm::vec2 getGlyphSize(int i);
virtual IntPoint getMediaSize();
int getNumLines();
- PyObject* getCharIndexFromPos(DPoint p);
+ PyObject* getCharIndexFromPos(glm::vec2 p);
std::string getTextAsDisplayed();
- DPoint getLineExtents(int line);
+ glm::vec2 getLineExtents(int line);
static const std::vector<std::string>& getFontFamilies();
static const std::vector<std::string>& getFontVariants(
@@ -114,10 +124,7 @@ class AVG_API WordsNode : public RasterNode
static void addFontDir(const std::string& sDir);
private:
- enum RedrawState {FONT_CHANGED, LAYOUT_CHANGED, RENDER_NEEDED, CLEAN};
-
virtual void calcMaskCoords();
- void setDirty(RedrawState newState);
void updateFont();
void updateLayout();
void renderText();
@@ -129,21 +136,10 @@ class AVG_API WordsNode : public RasterNode
PangoRectangle getGlyphRect(int i);
// Exposed Attributes
- std::string m_sFontName;
- std::string m_sFontVariant;
+ FontStyle m_FontStyle;
UTF8String m_sText;
UTF8String m_sRawText;
- std::string m_sColorName;
- Pixel32 m_Color;
- double m_FontSize;
- int m_Indent;
- double m_LineSpacing;
- PangoAlignment m_Alignment;
- PangoWrapMode m_WrapMode;
- bool m_bJustify;
- double m_LetterSpacing;
- bool m_bHint;
-
+
bool m_bParsedText;
bool m_bRawTextMode;
IntPoint m_LogicalSize;
@@ -153,7 +149,7 @@ class AVG_API WordsNode : public RasterNode
PangoFontDescription * m_pFontDescription;
PangoLayout * m_pLayout;
- RedrawState m_RedrawState;
+ bool m_bRenderNeeded;
};
}
diff --git a/src/player/WrapPython.cpp b/src/player/WrapPython.cpp
new file mode 100644
index 0000000..e0eb9bc
--- /dev/null
+++ b/src/player/WrapPython.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 "WrapPython.h"
+
+#include "../base/Logger.h"
+#include "../base/StringHelper.h"
+#include "../base/FileHelper.h"
+
+#include <frameobject.h>
+
+using namespace std;
+
+namespace avg {
+
+aquirePyGIL::aquirePyGIL()
+{
+ m_pyGilState = PyGILState_Ensure();
+}
+aquirePyGIL::~aquirePyGIL()
+{
+ PyGILState_Release(m_pyGilState);
+}
+
+void avgDeprecationWarning(const string& sVersion, const string& sOldEntryPoint,
+ const string& sNewEntryPoint)
+{
+ static vector<string> sWarningsIssued;
+ bool bWarned = false;
+ for (vector<string>::iterator it = sWarningsIssued.begin();
+ it != sWarningsIssued.end(); ++it)
+ {
+ if (*it == sOldEntryPoint) {
+ return;
+ }
+ }
+ if (!bWarned) {
+ sWarningsIssued.push_back(sOldEntryPoint);
+
+ PyFrameObject* pFrame = PyEval_GetFrame();
+ int lineNo = PyCode_Addr2Line(pFrame->f_code, pFrame->f_lasti);
+ // lineNo = PyFrame_GetLineNumber(pFrame);
+ string sFName = getFilenamePart(PyString_AS_STRING(pFrame->f_code->co_filename));
+ string sMsg = sFName + ":" + toString(lineNo) + ": ";
+ sMsg += string(sOldEntryPoint) + " deprecated since version " +
+ string(sVersion)+".";
+ if (sNewEntryPoint != string("")) {
+ sMsg += " Use "+string(sNewEntryPoint) + " instead.";
+ }
+ AVG_TRACE(Logger::category::DEPRECATION, Logger::severity::WARNING, sMsg);
+ }
+}
+
+}
diff --git a/src/player/WrapPython.h b/src/player/WrapPython.h
index b81b4eb..20ce764 100644
--- a/src/player/WrapPython.h
+++ b/src/player/WrapPython.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -19,6 +19,9 @@
// Current versions can be found at www.libavg.de
//
+#ifndef _WrapPython_H_
+#define _WrapPython_H_
+
#include "../api.h"
#ifdef _DEBUG
@@ -47,3 +50,21 @@
# define _DEBUG
#endif
+namespace avg {
+
+class aquirePyGIL
+{
+public:
+ aquirePyGIL();
+ virtual ~aquirePyGIL();
+
+private:
+ PyGILState_STATE m_pyGilState;
+};
+
+void avgDeprecationWarning(const std::string& sVersion, const std::string& sOldEntryPoint,
+ const std::string& sNewEntryPoint);
+
+}
+
+#endif
diff --git a/src/player/XInputMTInputDevice.cpp b/src/player/XInputMTInputDevice.cpp
index 0e042c2..14145c8 100644
--- a/src/player/XInputMTInputDevice.cpp
+++ b/src/player/XInputMTInputDevice.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -43,7 +43,7 @@ using namespace std;
namespace avg {
-Display* XInputMTInputDevice::s_pDisplay = 0;
+::Display* XInputMTInputDevice::s_pDisplay = 0;
const char* cookieTypeToName(int evtype);
string xEventTypeToName(int evtype);
@@ -69,6 +69,10 @@ void XInputMTInputDevice::start()
{
Status status;
SDLDisplayEngine * pEngine = Player::get()->getDisplayEngine();
+ glm::vec2 size(pEngine->getSize());
+ glm::vec2 windowSize(pEngine->getWindowSize());
+ m_DisplayScale.x = size.x/windowSize.x;
+ m_DisplayScale.y = size.y/windowSize.y;
SDL_SysWMinfo info;
SDL_VERSION(&info.version);
@@ -132,7 +136,8 @@ void XInputMTInputDevice::start()
pEngine->setXIMTInputDevice(this);
MultitouchInputDevice::start();
- AVG_TRACE(Logger::CONFIG, "XInput Multitouch event source created.");
+ AVG_TRACE(Logger::category::CONFIG, Logger::severity::INFO,
+ "XInput Multitouch event source created.");
}
void XInputMTInputDevice::handleXIEvent(const XEvent& xEvent)
@@ -148,14 +153,14 @@ void XInputMTInputDevice::handleXIEvent(const XEvent& xEvent)
{
// cerr << "TouchBegin " << xid << ", " << pos << endl;
m_LastID++;
- TouchEventPtr pEvent = createEvent(m_LastID, Event::CURSORDOWN, pos);
+ TouchEventPtr pEvent = createEvent(m_LastID, Event::CURSOR_DOWN, pos);
addTouchStatus(xid, pEvent);
}
break;
case XI_TouchUpdate:
{
// cerr << "TouchUpdate " << xid << ", " << pos << endl;
- TouchEventPtr pEvent = createEvent(0, Event::CURSORMOTION, pos);
+ TouchEventPtr pEvent = createEvent(0, Event::CURSOR_MOTION, pos);
TouchStatusPtr pTouchStatus = getTouchStatus(xid);
AVG_ASSERT(pTouchStatus);
pTouchStatus->pushEvent(pEvent);
@@ -166,7 +171,7 @@ void XInputMTInputDevice::handleXIEvent(const XEvent& xEvent)
// cerr << "TouchEnd " << xid << ", " << pos << endl;
TouchStatusPtr pTouchStatus = getTouchStatus(xid);
AVG_ASSERT(pTouchStatus);
- TouchEventPtr pEvent = createEvent(0, Event::CURSORUP, pos);
+ TouchEventPtr pEvent = createEvent(0, Event::CURSOR_UP, pos);
pTouchStatus->pushEvent(pEvent);
}
break;
@@ -198,7 +203,6 @@ void XInputMTInputDevice::findMTDevice()
pDevices = XIQueryDevice(s_pDisplay, XIAllDevices, &ndevices);
XITouchClassInfo* pTouchClass = 0;
- int maxTouches;
for (int i = 0; i < ndevices && !pTouchClass; ++i) {
pDevice = &pDevices[i];
// cerr << "Device " << pDevice->name << "(id: " << pDevice->deviceid << ")."
@@ -217,7 +221,6 @@ void XInputMTInputDevice::findMTDevice()
} else {
m_OldMasterDeviceID = -1;
}
- maxTouches = pTouchClass->num_touches;
break;
}
}
@@ -225,8 +228,9 @@ void XInputMTInputDevice::findMTDevice()
}
}
if (pTouchClass) {
- AVG_TRACE(Logger::CONFIG, "Using multitouch input device " << m_sDeviceName
- << ", max touches: " << maxTouches);
+ AVG_TRACE(Logger::category::CONFIG,Logger::severity::INFO,
+ "Using multitouch input device " << m_sDeviceName << ", max touches: " <<
+ pTouchClass->num_touches);
} else {
throw Exception(AVG_ERR_MT_INIT,
"XInput multitouch event source: No multitouch device found.");
@@ -236,6 +240,8 @@ void XInputMTInputDevice::findMTDevice()
TouchEventPtr XInputMTInputDevice::createEvent(int id, Event::Type type, IntPoint pos)
{
+ pos.x *= m_DisplayScale.x;
+ pos.y *= m_DisplayScale.y;
return TouchEventPtr(new TouchEvent(id, type, pos, Event::TOUCH));
}
diff --git a/src/player/XInputMTInputDevice.h b/src/player/XInputMTInputDevice.h
index af10249..d395884 100644
--- a/src/player/XInputMTInputDevice.h
+++ b/src/player/XInputMTInputDevice.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -28,7 +28,7 @@
#include "MultitouchInputDevice.h"
#include "Event.h"
-#include "../base/Point.h"
+#include "../base/GLMHelper.h"
#include <X11/Xlib.h>
#include <vector>
@@ -56,7 +56,7 @@ private:
int m_LastID;
- static Display* s_pDisplay;
+ static ::Display* s_pDisplay;
void (*m_SDLLockFunc)(void);
void (*m_SDLUnlockFunc)(void);
@@ -66,6 +66,7 @@ private:
int m_DeviceID;
int m_OldMasterDeviceID;
+ glm::vec2 m_DisplayScale;
};
typedef boost::shared_ptr<XInputMTInputDevice> XInputMTInputDevicePtr;
diff --git a/src/player/testcalibrator.cpp b/src/player/testcalibrator.cpp
index 175488f..a9898f5 100644
--- a/src/player/testcalibrator.cpp
+++ b/src/player/testcalibrator.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -21,7 +21,7 @@
#include "TrackerCalibrator.h"
-#include "../base/Point.h"
+#include "../base/GLMHelper.h"
#include "../base/TestSuite.h"
#include "../base/Exception.h"
@@ -49,45 +49,46 @@ public:
bool bDone = false;
while (!bDone) {
IntPoint displayPoint(calibrator.getDisplayPoint());
- calibrator.setCamPoint(DPoint(displayPoint));
+ calibrator.setCamPoint(glm::vec2(displayPoint));
bDone = !calibrator.nextPoint();
}
pTrafo = calibrator.makeTransformer();
- TEST( calcDist(pTrafo->transformBlobToScreen( DPoint(1.00,1.00) ) , DPoint(1.00,1.00))<1);
-// cerr << "scale: " << scale << ", offset: " << offset << endl;
- TEST(checkTransform(pTrafo, DPoint(0,0), DPoint(0,0)));
- TEST(checkTransform(pTrafo, DPoint(640, 480), DPoint(640, 480)));
+ TEST(glm::length(pTrafo->transformBlobToScreen(glm::dvec2(1.00,1.00)) -
+ glm::dvec2(1.00,1.00)) < 1);
+ TEST(checkTransform(pTrafo, glm::dvec2(0,0), glm::dvec2(0,0)));
+ TEST(checkTransform(pTrafo, glm::dvec2(640, 480), glm::dvec2(640, 480)));
}
{
TrackerCalibrator calibrator(IntPoint(640, 480), IntPoint(1280,720));
bool bDone = false;
while (!bDone) {
IntPoint displayPoint(calibrator.getDisplayPoint());
- calibrator.setCamPoint(DPoint(displayPoint.x/2, displayPoint.y/1.5));
+ calibrator.setCamPoint(glm::vec2(displayPoint.x/2, displayPoint.y/1.5));
bDone = !calibrator.nextPoint();
}
pTrafo = calibrator.makeTransformer();
- TEST( calcDist( pTrafo->transformBlobToScreen( DPoint(1.00,1.00) ), DPoint(2.00,1.50)) <1 );
-// cerr << "scale: " << scale << ", offset: " << offset << endl;
- TEST(checkTransform(pTrafo, DPoint(0,0), DPoint(0,0)));
- TEST(checkTransform(pTrafo, DPoint(640, 480), DPoint(640, 480)));
- TEST(checkBlobToScreen(pTrafo, DPoint(0,0), DPoint(0,0)));
- TEST(checkBlobToScreen(pTrafo, DPoint(640, 480), DPoint(1280, 720)));
+ TEST(glm::length(pTrafo->transformBlobToScreen(glm::dvec2(1.00,1.00)) -
+ glm::dvec2(2.00,1.50)) < 1);
+ TEST(checkTransform(pTrafo, glm::dvec2(0,0), glm::dvec2(0,0)));
+ TEST(checkTransform(pTrafo, glm::dvec2(640, 480), glm::dvec2(640, 480)));
+ TEST(checkBlobToScreen(pTrafo, glm::dvec2(0,0), glm::dvec2(0,0)));
+ TEST(checkBlobToScreen(pTrafo, glm::dvec2(640, 480), glm::dvec2(1280, 720)));
}
}
- bool checkTransform(CoordTransformerPtr pTrafo, const DPoint& srcPt,
- const DPoint& destPt)
+ bool checkTransform(CoordTransformerPtr pTrafo, const glm::dvec2& srcPt,
+ const glm::dvec2& destPt)
{
- DPoint ResultPt = pTrafo->transform_point(srcPt);
+ glm::dvec2 ResultPt = pTrafo->transform_point(srcPt);
// cerr << srcPt << " -> " << ResultPt << ", expected " << destPt << endl;
return ((fabs(ResultPt.x-destPt.x) < 0.1) && (fabs(ResultPt.y-destPt.y) < 0.1));
}
bool checkBlobToScreen(DeDistortPtr pTrafo,
- const DPoint& srcPt, const DPoint& destPt)
+ const glm::dvec2& srcPt, const glm::dvec2& destPt)
{
- DPoint ResultPt = pTrafo->transformBlobToScreen(pTrafo->transform_point(srcPt));
+ glm::dvec2 ResultPt =
+ pTrafo->transformBlobToScreen(pTrafo->transform_point(srcPt));
// cerr << srcPt << " -> " << ResultPt << ", expected " << destPt << endl;
return ((fabs(ResultPt.x-destPt.x) < 1) && (fabs(ResultPt.y-destPt.y) < 1));
}
diff --git a/src/player/testplayer.cpp b/src/player/testplayer.cpp
index 342a2c4..aa0bef9 100644
--- a/src/player/testplayer.cpp
+++ b/src/player/testplayer.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -25,11 +25,17 @@
#include "../base/Exception.h"
#include "../base/Logger.h"
+#include "../graphics/GLConfig.h"
+
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string>
+#ifdef WIN32
+#include <direct.h>
+#endif
+
using namespace avg;
using namespace std;
@@ -49,11 +55,18 @@ public:
" <words text=\"foo\"/>"
" </avg>"
);
+ player.setOGLOptions(false, true, 1, GLConfig::AUTO, true);
+ GLContext::enableErrorChecks(true);
player.disablePython();
if (!getenv("AVG_CONSOLE_TEST")) {
- player.initPlayback();
+#ifdef WIN32
+ char sz[1024];
+ _getcwd(sz, 1024);
+ cerr << "Current directory: " << sz << endl;
+#endif
+ player.initPlayback("../graphics/shaders/");
player.doFrame(false);
- player.cleanup();
+ player.cleanup(false);
}
try {
throw bad_cast();
diff --git a/src/python/Makefile.am b/src/python/Makefile.am
index 92fede9..0ec168f 100644
--- a/src/python/Makefile.am
+++ b/src/python/Makefile.am
@@ -1,6 +1,6 @@
-SUBDIRS = ui data
-pkgpyexec_PYTHON = anim.py draggable.py camcalibrator.py textarea.py\
- clusteredEventList.py eventList.py gameapp.py grabbable.py \
- mathutil.py app.py appstarter.py utils.py \
- trackerhelper.py mtemu.py geom.py parsecamargs.py apphelpers.py \
- statemachine.py coordcalibrator.py graph.py __init__.py
+SUBDIRS = widget data app
+pkgpyexec_PYTHON = enumcompat.py camcalibrator.py textarea.py \
+ mathutil.py avgapp.py appstarter.py utils.py filter.py \
+ mtemu.py geom.py parsecamargs.py apphelpers.py methodref.py \
+ statemachine.py coordcalibrator.py graph.py __init__.py gesture.py \
+ persist.py
diff --git a/src/python/Makefile.in b/src/python/Makefile.in
index c2bcb3e..4d6b594 100644
--- a/src/python/Makefile.in
+++ b/src/python/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# Makefile.in generated by automake 1.11.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
-# Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -41,22 +41,23 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ac_cxx_namespaces.m4 \
$(top_srcdir)/m4/ac_path_generic.m4 \
$(top_srcdir)/m4/ax_boost_thread.m4 \
- $(top_srcdir)/m4/ax_check_gl.m4 $(top_srcdir)/m4/libtool.m4 \
- $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
- $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
- $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/m4/python_dev.m4 \
- $(top_srcdir)/configure.in
+ $(top_srcdir)/m4/ax_check_gl.m4 \
+ $(top_srcdir)/m4/ax_python_devel.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/pkg.m4 \
+ $(top_srcdir)/m4/avg_version.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/src/avgconfig.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
-AM_V_GEN = $(am__v_GEN_$(V))
-am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
-AM_V_at = $(am__v_at_$(V))
-am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
SOURCES =
DIST_SOURCES =
@@ -88,6 +89,13 @@ am__nobase_list = $(am__nobase_strip_setup); \
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
+am__py_compile = PYTHON=$(PYTHON) $(SHELL) $(py_compile)
am__installdirs = "$(DESTDIR)$(pkgpyexecdir)"
py_compile = $(top_srcdir)/py-compile
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
@@ -133,7 +141,7 @@ AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BOOST_PYTHON_LIBS = @BOOST_PYTHON_LIBS@
-BOOST_THREAD_LIB = @BOOST_THREAD_LIB@
+BOOST_THREAD_LIBS = @BOOST_THREAD_LIBS@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
@@ -148,6 +156,7 @@ DC1394_2_CFLAGS = @DC1394_2_CFLAGS@
DC1394_2_LIBS = @DC1394_2_LIBS@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
@@ -188,6 +197,7 @@ LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
MTDEV_CFLAGS = @MTDEV_CFLAGS@
MTDEV_LIBS = @MTDEV_LIBS@
@@ -217,11 +227,13 @@ PTHREAD_CC = @PTHREAD_CC@
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
PTHREAD_LIBS = @PTHREAD_LIBS@
PYTHON = @PYTHON@
+PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@
PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
-PYTHON_INCLUDES = @PYTHON_INCLUDES@
-PYTHON_LIBS = @PYTHON_LIBS@
+PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@
+PYTHON_LDFLAGS = @PYTHON_LDFLAGS@
PYTHON_PLATFORM = @PYTHON_PLATFORM@
PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_SITE_PKG = @PYTHON_SITE_PKG@
PYTHON_VERSION = @PYTHON_VERSION@
RANLIB = @RANLIB@
SDL_CFLAGS = @SDL_CFLAGS@
@@ -244,6 +256,7 @@ abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
@@ -278,7 +291,6 @@ libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
@@ -302,12 +314,12 @@ target_vendor = @target_vendor@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-SUBDIRS = ui data
-pkgpyexec_PYTHON = anim.py draggable.py camcalibrator.py textarea.py\
- clusteredEventList.py eventList.py gameapp.py grabbable.py \
- mathutil.py app.py appstarter.py utils.py \
- trackerhelper.py mtemu.py geom.py parsecamargs.py apphelpers.py \
- statemachine.py coordcalibrator.py graph.py __init__.py
+SUBDIRS = widget data app
+pkgpyexec_PYTHON = enumcompat.py camcalibrator.py textarea.py \
+ mathutil.py avgapp.py appstarter.py utils.py filter.py \
+ mtemu.py geom.py parsecamargs.py apphelpers.py methodref.py \
+ statemachine.py coordcalibrator.py graph.py __init__.py gesture.py \
+ persist.py
all: all-recursive
@@ -366,11 +378,8 @@ install-pkgpyexecPYTHON: $(pkgpyexec_PYTHON)
$(INSTALL_DATA) $$files "$(DESTDIR)$(pkgpyexecdir)" || exit $$?; \
done || exit $$?; \
if test -n "$$dlist"; then \
- if test -z "$(DESTDIR)"; then \
- PYTHON=$(PYTHON) $(py_compile) --basedir "$(pkgpyexecdir)" $$dlist; \
- else \
- PYTHON=$(PYTHON) $(py_compile) --destdir "$(DESTDIR)" --basedir "$(pkgpyexecdir)" $$dlist; \
- fi; \
+ $(am__py_compile) --destdir "$(DESTDIR)" \
+ --basedir "$(pkgpyexecdir)" $$dlist; \
else :; fi
uninstall-pkgpyexecPYTHON:
@@ -378,14 +387,14 @@ uninstall-pkgpyexecPYTHON:
@list='$(pkgpyexec_PYTHON)'; test -n "$(pkgpyexecdir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
test -n "$$files" || exit 0; \
+ dir='$(DESTDIR)$(pkgpyexecdir)'; \
filesc=`echo "$$files" | sed 's|$$|c|'`; \
fileso=`echo "$$files" | sed 's|$$|o|'`; \
- echo " ( cd '$(DESTDIR)$(pkgpyexecdir)' && rm -f" $$files ")"; \
- cd "$(DESTDIR)$(pkgpyexecdir)" && rm -f $$files || exit $$?; \
- echo " ( cd '$(DESTDIR)$(pkgpyexecdir)' && rm -f" $$filesc ")"; \
- cd "$(DESTDIR)$(pkgpyexecdir)" && rm -f $$filesc || exit $$?; \
- echo " ( cd '$(DESTDIR)$(pkgpyexecdir)' && rm -f" $$fileso ")"; \
- cd "$(DESTDIR)$(pkgpyexecdir)" && rm -f $$fileso
+ st=0; \
+ for files in "$$files" "$$filesc" "$$fileso"; do \
+ $(am__uninstall_files_from_dir) || st=$$?; \
+ done; \
+ exit $$st
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
@@ -598,10 +607,15 @@ install-am: all-am
installcheck: installcheck-recursive
install-strip:
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- `test -z '$(STRIP)' || \
- echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
mostlyclean-generic:
clean-generic:
diff --git a/src/python/__init__.py b/src/python/__init__.py
index de2addb..5d0d2cf 100644
--- a/src/python/__init__.py
+++ b/src/python/__init__.py
@@ -1,3 +1,8 @@
+'''
+libavg is a high-level development platform for media-centric applications.
+https://www.libavg.de
+'''
+
# Work around libstdc++ Mesa bug
# (https://bugs.launchpad.net/ubuntu/+source/mesa/+bug/259219)
from platform import system
@@ -8,12 +13,17 @@ if system() == 'Linux':
del system
from avg import *
-import anim
-import draggable
+player = avg.Player.get()
+
+from enumcompat import *
+
import textarea
import statemachine
-from grabbable import Grabbable
-from app import AVGApp, App
+from avgapp import AVGApp
from appstarter import AVGAppStarter, AVGMTAppStarter, AppStarter
-import utils
-import gameapp
+import utils, methodref
+import gesture
+import filter
+import persist
+import app
+
diff --git a/src/python/anim.py b/src/python/anim.py
deleted file mode 100644
index 1e70916..0000000
--- a/src/python/anim.py
+++ /dev/null
@@ -1,487 +0,0 @@
-# libavg - Media Playback Engine.
-# Copyright (C) 2003-2011 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
-#
-
-"""
-Deprecated framework for time-based animations - there is a better
-framework in the avg module.
-"""
-
-import math
-from libavg import avg
-
-g_Player = None
-
-# Map of all active SimpleAnimations: (node, attribute)->SimpleAnimation
-g_ActiveAnimations = {}
-
-def getNumRunningAnims():
- return len(g_ActiveAnimations)
-
-def abortAnim(node, attrName):
- global g_ActiveAnimations
- if g_ActiveAnimations.has_key((node, attrName)):
- curAnim = g_ActiveAnimations.get((node, attrName))
- curAnim._remove()
-
-g_DeprecationWarned = False
-
-def deprecationWarning():
- global g_DeprecationWarned
- if not(g_DeprecationWarned):
- g_DeprecationWarned = True
- print "The anim package is deprecated and will be removed in the next release; use the anim classes in the avg namespace instead."
-
-class SimpleAnim:
- """
- Deprecated.
- Base class for animations that change libavg node attributes by interpolating
- over a set amount of time. Constructing an animation object starts the
- animation. If abort() isn't needed, there is no need to hold on to the object -
- 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
- silently aborted.
- """
- def __init__(self, node, attrName, duration, useInt, onStop, onStart):
- global g_Player
- global g_ActiveAnimations
-
- deprecationWarning()
- g_Player = avg.Player.get()
- self.node = node
- self.attrName = attrName
- self.duration = duration
- self.onStart = onStart
- self.onStop = onStop
- self.onAbort = lambda: None
- self.useInt = useInt
-
- def setHandler(self, onStop, onAbort):
- self.onStop = onStop
- self.onAbort = onAbort
-
- def start(self, keepAttr=False):
- abortAnim(self.node, self.attrName)
- g_ActiveAnimations[(self.node, self.attrName)] = self
- if keepAttr:
- self._calcStartTime()
- else:
- self.startTime = g_Player.getFrameTime()
- self.__interval = g_Player.setOnFrameHandler(self._step)
- self.__done = False
- if self.onStart:
- self.onStart()
- if self.duration == 0:
- self._regularStop()
- elif self.duration:
- self.__stopTimeout = g_Player.setTimeout(self.duration, self._regularStop)
- self._step()
-
- def abort(self):
- """
- Stops the animation. Does not call onStop()
- """
- if not(self.isDone()):
- self._remove()
- if self.onAbort:
- self.onAbort()
-
- def isDone(self):
- """
- Returns True if the animation has run its course.
- """
- return self.__done
-
- def _remove(self):
- global g_ActiveAnimations
- self.__done = True
- g_ActiveAnimations.pop((self.node, self.attrName))
- g_Player.clearInterval(self.__interval)
- if self.duration:
- g_Player.clearInterval(self.__stopTimeout)
-
-
-class LinearAnim(SimpleAnim):
- """
- Deprecated.
- Class that animates an attribute of a libavg node by interpolating linearly
- between start and end values.
- """
- def __init__(self, node, attrName, duration, startValue, endValue, useInt=False,
- onStop=None, onStart=None):
- """
- @param node: The libavg node object to animate.
- @param attrName: The name of the attribute to change. Must be a numeric
- attribute.
- @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 True, the attribute is always set to an integer value.
- @param onStop: Python callable to invoke when duration has elapsed and
- the animation has finished. This can be used to chain
- animations together by using lambda to create a second animation.
- """
- self.__startValue = startValue
- self.__endValue = endValue
- SimpleAnim.__init__(self, node, attrName, duration, useInt, onStop, onStart)
-
- def _step(self):
- if not(self.isDone()):
- part = ((float(g_Player.getFrameTime())-self.startTime)/self.duration)
- if part > 1.0:
- part = 1.0
- curValue = self.__startValue+(self.__endValue-self.__startValue)*part
- if self.useInt:
- curValue = int(curValue+0.5)
- setattr(self.node, self.attrName, curValue)
-
- def _regularStop(self):
- setattr(self.node, self.attrName, self.__endValue)
- self._remove()
- if self.onStop != None:
- self.onStop()
-
- def _calcStartTime(self):
- curVal = getattr(self.node, self.attrName)
- part = float(curVal-self.__startValue)/(self.__endValue-self.__startValue)
- self.startTime = g_Player.getFrameTime()-part*self.duration
-
-
-class EaseInOutAnim(SimpleAnim):
- def __init__(self, node, attrName, duration, startValue, endValue,
- easeInDuration, easeOutDuration, useInt=False, onStop=None,
- onStart=None):
- self.__startValue = startValue
- self.__endValue = endValue
- self.__easeInDuration = float(easeInDuration)/duration
- self.__easeOutDuration = float(easeOutDuration)/duration
- SimpleAnim.__init__(self, node, attrName, duration, useInt, onStop, onStart)
-
- def _step(self):
- if not(self.isDone()):
- t = (float(g_Player.getFrameTime())-self.startTime)/self.duration;
- part = self.__ease(t, self.__easeInDuration, self.__easeOutDuration)
- curValue = self.__startValue+(self.__endValue-self.__startValue)*part
- if self.useInt:
- curValue = int(curValue+0.5)
- setattr(self.node, self.attrName, curValue)
-
- def _regularStop(self):
- setattr(self.node, self.attrName, self.__endValue)
- self._remove()
- if self.onStop != None:
- self.onStop()
-
- def _calcStartTime(self):
- #XXX: This calculates an inaccurate start time
- curVal = getattr(self.node, self.attrName)
- part = float(curVal-self.__startValue)/(self.__endValue-self.__startValue)
- self.startTime = g_Player.getFrameTime()-part*self.duration
-
- def __ease(self, t, easeInDuration, easeOutDuration):
- # All times here are normalized to be between 0 and 1
- if t > 1:
- t=1
- accelDist = easeInDuration*2/math.pi
- decelDist = easeOutDuration*2/math.pi
- if t<easeInDuration:
- # Acceleration stage
- nt=t/easeInDuration
- s=math.sin(-math.pi/2+nt*math.pi/2)+1;
- dist=s*accelDist;
- elif t > 1-easeOutDuration:
- # Deceleration stage
- nt = (t-(1-easeOutDuration))/easeOutDuration
- s = math.sin(nt*math.pi/2)
- dist = accelDist+(1-easeInDuration-easeOutDuration)+s*decelDist
- else:
- # Linear stage
- dist = accelDist+t-easeInDuration
- return dist/(accelDist+(1-easeInDuration-easeOutDuration)+decelDist)
-
-
-class SplineAnim(SimpleAnim):
- """
- Deprecated.
- Class that animates an attribute of a libavg node by interpolating
- between start and end values using a cubic spline.
- """
- def __init__(self, node, attrName, duration, startValue, startSpeed, endValue,
- endSpeed, useInt=False, onStop=None, onStart=None):
- """
- @param node: The libavg node object to animate.
- @param attrName: The name of the attribute to change. Must be a numeric
- attribute.
- @param duration: The length of the animation in milliseconds.
- @param startValue: Initial value of the attribute.
- @param startSpeed: Initial speed of the animation.
- @param endValue: Value of the attribute after duration has elapsed.
- @param endSpeed: Final speed of the animation.
- @param useInt: If True, the attribute is always set to an integer value.
- @param onStop: Python callable to invoke when duration has elapsed and
- the animation has finished. This can be used to chain
- animations together by using lambda to create a second animation.
- """
- self.__startValue = startValue+0.0
- self.__startSpeed = startSpeed
- self.__endValue = endValue
- self.__endSpeed = endSpeed
- self.__a = -2*(self.__endValue-self.__startValue)+self.__startSpeed+self.__endSpeed
- self.__b = 3*(self.__endValue-self.__startValue)-2*self.__startSpeed-self.__endSpeed
- self.__c = self.__startSpeed
- self.__d = self.__startValue
- SimpleAnim.__init__(self, node, attrName, duration, useInt, onStop, onStart)
-
- def _step(self):
- if not(self.isDone()):
- part = ((float(g_Player.getFrameTime())-self.startTime)/self.duration)
- if part > 1.0:
- part = 1.0
- curValue = ((self.__a*part+self.__b)*part+self.__c)*part+self.__d
- if self.useInt:
- curValue = int(curValue+0.5)
- setattr(self.node, self.attrName, curValue)
-
- def _regularStop(self):
- setattr(self.node, self.attrName, self.__endValue)
- self._remove()
- if self.onStop != None:
- self.onStop()
-
- def _calcStartTime(self):
- #XXX: This calculates an inaccurate start time
- curVal = getattr(self.node, self.attrName)
- part = float(curVal-self.__startValue)/(self.__endValue-self.__startValue)
- self.startTime = g_Player.getFrameTime()-part*self.duration
-
-
-def fadeOut(node, duration, onStop = None):
- """
- Deprecated.
- Fades the opacity of a node to zero.
- @param node: The node to fade.
- @param duration: Length of the fade in milliseconds.
- """
- fader = LinearAnim(node, "opacity", duration, node.opacity, 0, onStop = onStop)
- fader.start()
- return fader
-
-def fadeIn(node, duration, max=1.0, onStop = None):
- """
- Deprecated.
- 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.
- """
- fader = LinearAnim(node, "opacity", duration, node.opacity, max, onStop = onStop)
- fader.start()
- return fader
-
-
-class ContinuousAnim(SimpleAnim):
- """
- Deprecated.
- Class that animates an attribute of a libavg node continuously and
- linearly. The animation will not stop until the abort() method is called.
- A possible use case is the continuous rotation of an object.
- """
- def __init__(self, node, attrName, startValue, speed, useInt=False,
- onStart=None):
- """
- @param node: The libavg node object to animate.
- @param attrName: The name of the attribute to change. Must be a numeric
- attribute.
- @param startValue: Initial value of the attribute.
- @param speed: Animation speed, value to be added per second.
- @param useInt: If True, the attribute is always set to an integer value.
- """
- self.__startValue = startValue
- self.__speed = speed
- SimpleAnim.__init__(self, node, attrName, None, useInt, None, onStart)
-
- def _step(self):
- time = (float(g_Player.getFrameTime())-self.startTime)/1000
- curValue = self.__startValue+time*self.__speed
- if self.useInt:
- curValue = int(curValue+0.5)
- setattr(self.node, self.attrName, curValue)
-
- def _calcStartTime(self):
- curVal = getattr(self.node, self.attrName)
- self.__startValue = curVal
-
-
-class WaitAnim:
- def __init__(self, duration=None, onStop=None, onStart=None):
- self.__duration = duration
- self.onStart = onStart
- self.onStop = onStop
- self.onAbort = None
- self.__isDone = True
-
- def setHandler(self, onStop, onAbort):
- self.onStop = onStop
- self.onAbort = onAbort
-
- def start(self, keepAttr=False):
- self.__isDone = False
- if self.onStart:
- self.onStart()
- if self.__duration:
- self.__stopTimeout = g_Player.setTimeout(self.__duration, self.__regularStop)
- else:
- self.__stopTimeout = None
-
- def abort(self):
- if self.__stopTimeout:
- g_Player.clearInterval(self.__stopTimeout)
- if not(self.__isDone):
- self.__isDone = True
- if self.onAbort:
- self.onAbort()
-
- def isDone(self):
- return self.__isDone
-
- def _calcStartTime(self):
- pass
-
- def __regularStop(self):
- g_Player.clearInterval(self.__stopTimeout)
- self.__isDone = True
- self.onStop()
-
-
-class ParallelAnim:
- def __init__(self, anims, onStop=None, onStart=None, maxAge=None):
- self.__anims = anims
- self.onStart = onStart
- self.onStop = onStop
- self.__maxAge = maxAge
- self.__isDone = False
-
- def setHandler(self, onStop, onAbort):
- self.onStop = onStop
- self.onAbort = onAbort
-
- def start(self, keepAttr=False):
- self.__isDone = False
- if self.onStart:
- self.onStart()
- self.__runningAnims = self.__anims[:]
- if self.__maxAge:
- self.__maxAgeTimeout = g_Player.setTimeout(self.__maxAge,
- self.__maxAgeReached)
- for anim in self.__runningAnims:
- stopHandler = lambda anim=anim: self.__animStopped(anim)
- anim.setHandler(onStop = stopHandler, onAbort = stopHandler)
- anim.start(keepAttr)
-
- def abort(self):
- if not(self.__isDone):
- self.__isDone = True
- for anim in self.__runningAnims:
- anim.abort()
- if self.onAbort:
- self.onAbort()
- if self.__maxAge:
- g_Player.clearInterval(self.__maxAgeTimeout)
-
- def isDone(self):
- return self.__isDone
-
- def __maxAgeReached(self):
- if not(self.__isDone):
- for anim in self.__runningAnims:
- anim.abort()
- self.onStop()
- self.__isDone = True
-
- def __animStopped(self, anim):
- self.__runningAnims.remove(anim)
- if len(self.__runningAnims) == 0 and not(self.__isDone):
- self.onStop()
- self.__isDone = True
- if self.__maxAge:
- g_Player.clearInterval(self.__maxAgeTimeout)
-
-
-class StateAnim:
- def __init__(self, states, transitions, initialState=None):
- self.__states = states
- for name in states:
- states[name].setHandler(self.__onStateDone, None)
- self.__transitions = transitions
- self.__curState = None
- self.__debug = False
- if initialState:
- self.setState(initialState)
-
- def delete(self):
- if self.__debug:
- print self, " delete"
- self.setState(None)
-
- def setState(self, stateName, keepAttr=False):
- if self.__debug:
- print self, " setState: ", self.__curState, "-->", stateName
- if self.__curState == stateName:
- return
- if self.__curState:
- self.__states[self.__curState].abort()
- self.__curState = stateName
- if stateName:
- self.__states[stateName].start(keepAttr)
-
- def getState(self):
- return self.__curState
-
- def setDebug(self, debug):
- self.__debug = debug
-
- def __onStateDone(self):
- if self.__curState in self.__transitions:
- transition = self.__transitions[self.__curState]
- if transition.callback:
- transition.callback()
- stateName = transition.nextAnimName
- if self.__debug:
- print self, " StateDone: ", self.__curState, "-->", stateName
- self.__curState = stateName
- self.__states[stateName].start()
- else:
- if self.__debug:
- print self, " StateDone: ", self.__curState, "--> None"
- self.__curState = None
-
-
-class AnimTransition:
- def __init__(self, nextAnimName, callback = None):
- self.nextAnimName = nextAnimName
- self.callback = callback
-
-
-def init(g_avg):
- global avg
- global g_ActiveAnimations
- avg = g_avg
- g_ActiveAnimations = {}
diff --git a/src/python/app/Makefile.am b/src/python/app/Makefile.am
new file mode 100644
index 0000000..8c78161
--- /dev/null
+++ b/src/python/app/Makefile.am
@@ -0,0 +1,3 @@
+pkgwidgetdir = $(pkgpyexecdir)/app
+pkgwidget_PYTHON = __init__.py app.py settings.py flashmessage.py keyboardmanager.py \
+ debugpanel.py touchvisualization.py
diff --git a/src/python/ui/Makefile.in b/src/python/app/Makefile.in
index fbb00e5..9566893 100644
--- a/src/python/ui/Makefile.in
+++ b/src/python/app/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# Makefile.in generated by automake 1.11.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
-# Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -34,29 +34,30 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
-subdir = src/python/ui
-DIST_COMMON = $(pkgui_PYTHON) $(srcdir)/Makefile.am \
+subdir = src/python/app
+DIST_COMMON = $(pkgwidget_PYTHON) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ac_cxx_namespaces.m4 \
$(top_srcdir)/m4/ac_path_generic.m4 \
$(top_srcdir)/m4/ax_boost_thread.m4 \
- $(top_srcdir)/m4/ax_check_gl.m4 $(top_srcdir)/m4/libtool.m4 \
- $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
- $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
- $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/m4/python_dev.m4 \
- $(top_srcdir)/configure.in
+ $(top_srcdir)/m4/ax_check_gl.m4 \
+ $(top_srcdir)/m4/ax_python_devel.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/pkg.m4 \
+ $(top_srcdir)/m4/avg_version.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/src/avgconfig.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
-AM_V_GEN = $(am__v_GEN_$(V))
-am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
-AM_V_at = $(am__v_at_$(V))
-am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
SOURCES =
DIST_SOURCES =
@@ -81,7 +82,14 @@ am__nobase_list = $(am__nobase_strip_setup); \
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
-am__installdirs = "$(DESTDIR)$(pkguidir)"
+am__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
+am__py_compile = PYTHON=$(PYTHON) $(SHELL) $(py_compile)
+am__installdirs = "$(DESTDIR)$(pkgwidgetdir)"
py_compile = $(top_srcdir)/py-compile
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
@@ -93,7 +101,7 @@ AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BOOST_PYTHON_LIBS = @BOOST_PYTHON_LIBS@
-BOOST_THREAD_LIB = @BOOST_THREAD_LIB@
+BOOST_THREAD_LIBS = @BOOST_THREAD_LIBS@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
@@ -108,6 +116,7 @@ DC1394_2_CFLAGS = @DC1394_2_CFLAGS@
DC1394_2_LIBS = @DC1394_2_LIBS@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
@@ -148,6 +157,7 @@ LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
MTDEV_CFLAGS = @MTDEV_CFLAGS@
MTDEV_LIBS = @MTDEV_LIBS@
@@ -177,11 +187,13 @@ PTHREAD_CC = @PTHREAD_CC@
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
PTHREAD_LIBS = @PTHREAD_LIBS@
PYTHON = @PYTHON@
+PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@
PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
-PYTHON_INCLUDES = @PYTHON_INCLUDES@
-PYTHON_LIBS = @PYTHON_LIBS@
+PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@
+PYTHON_LDFLAGS = @PYTHON_LDFLAGS@
PYTHON_PLATFORM = @PYTHON_PLATFORM@
PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_SITE_PKG = @PYTHON_SITE_PKG@
PYTHON_VERSION = @PYTHON_VERSION@
RANLIB = @RANLIB@
SDL_CFLAGS = @SDL_CFLAGS@
@@ -204,6 +216,7 @@ abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
@@ -238,7 +251,6 @@ libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
@@ -262,8 +274,10 @@ target_vendor = @target_vendor@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-pkguidir = $(pkgpyexecdir)/ui
-pkgui_PYTHON = __init__.py button.py keyboard.py gesture.py helper.py
+pkgwidgetdir = $(pkgpyexecdir)/app
+pkgwidget_PYTHON = __init__.py app.py settings.py flashmessage.py keyboardmanager.py \
+ debugpanel.py touchvisualization.py
+
all: all-am
.SUFFIXES:
@@ -276,9 +290,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/python/ui/Makefile'; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/python/app/Makefile'; \
$(am__cd) $(top_srcdir) && \
- $(AUTOMAKE) --foreign src/python/ui/Makefile
+ $(AUTOMAKE) --foreign src/python/app/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
@@ -303,10 +317,10 @@ mostlyclean-libtool:
clean-libtool:
-rm -rf .libs _libs
-install-pkguiPYTHON: $(pkgui_PYTHON)
+install-pkgwidgetPYTHON: $(pkgwidget_PYTHON)
@$(NORMAL_INSTALL)
- test -z "$(pkguidir)" || $(MKDIR_P) "$(DESTDIR)$(pkguidir)"
- @list='$(pkgui_PYTHON)'; dlist=; list2=; test -n "$(pkguidir)" || list=; \
+ test -z "$(pkgwidgetdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgwidgetdir)"
+ @list='$(pkgwidget_PYTHON)'; dlist=; list2=; test -n "$(pkgwidgetdir)" || list=; \
for p in $$list; do \
if test -f "$$p"; then b=; else b="$(srcdir)/"; fi; \
if test -f $$b$$p; then \
@@ -317,30 +331,27 @@ install-pkguiPYTHON: $(pkgui_PYTHON)
done; \
for file in $$list2; do echo $$file; done | $(am__base_list) | \
while read files; do \
- echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkguidir)'"; \
- $(INSTALL_DATA) $$files "$(DESTDIR)$(pkguidir)" || exit $$?; \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgwidgetdir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgwidgetdir)" || exit $$?; \
done || exit $$?; \
if test -n "$$dlist"; then \
- if test -z "$(DESTDIR)"; then \
- PYTHON=$(PYTHON) $(py_compile) --basedir "$(pkguidir)" $$dlist; \
- else \
- PYTHON=$(PYTHON) $(py_compile) --destdir "$(DESTDIR)" --basedir "$(pkguidir)" $$dlist; \
- fi; \
+ $(am__py_compile) --destdir "$(DESTDIR)" \
+ --basedir "$(pkgwidgetdir)" $$dlist; \
else :; fi
-uninstall-pkguiPYTHON:
+uninstall-pkgwidgetPYTHON:
@$(NORMAL_UNINSTALL)
- @list='$(pkgui_PYTHON)'; test -n "$(pkguidir)" || list=; \
+ @list='$(pkgwidget_PYTHON)'; test -n "$(pkgwidgetdir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
test -n "$$files" || exit 0; \
+ dir='$(DESTDIR)$(pkgwidgetdir)'; \
filesc=`echo "$$files" | sed 's|$$|c|'`; \
fileso=`echo "$$files" | sed 's|$$|o|'`; \
- echo " ( cd '$(DESTDIR)$(pkguidir)' && rm -f" $$files ")"; \
- cd "$(DESTDIR)$(pkguidir)" && rm -f $$files || exit $$?; \
- echo " ( cd '$(DESTDIR)$(pkguidir)' && rm -f" $$filesc ")"; \
- cd "$(DESTDIR)$(pkguidir)" && rm -f $$filesc || exit $$?; \
- echo " ( cd '$(DESTDIR)$(pkguidir)' && rm -f" $$fileso ")"; \
- cd "$(DESTDIR)$(pkguidir)" && rm -f $$fileso
+ st=0; \
+ for files in "$$files" "$$filesc" "$$fileso"; do \
+ $(am__uninstall_files_from_dir) || st=$$?; \
+ done; \
+ exit $$st
tags: TAGS
TAGS:
@@ -382,7 +393,7 @@ check-am: all-am
check: check-am
all-am: Makefile
installdirs:
- for dir in "$(DESTDIR)$(pkguidir)"; do \
+ for dir in "$(DESTDIR)$(pkgwidgetdir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
@@ -395,10 +406,15 @@ install-am: all-am
installcheck: installcheck-am
install-strip:
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- `test -z '$(STRIP)' || \
- echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
mostlyclean-generic:
clean-generic:
@@ -430,7 +446,7 @@ info: info-am
info-am:
-install-data-am: install-pkguiPYTHON
+install-data-am: install-pkgwidgetPYTHON
install-dvi: install-dvi-am
@@ -474,7 +490,7 @@ ps: ps-am
ps-am:
-uninstall-am: uninstall-pkguiPYTHON
+uninstall-am: uninstall-pkgwidgetPYTHON
.MAKE: install-am install-strip
@@ -484,11 +500,11 @@ uninstall-am: uninstall-pkguiPYTHON
install-data install-data-am install-dvi install-dvi-am \
install-exec install-exec-am install-html install-html-am \
install-info install-info-am install-man install-pdf \
- install-pdf-am install-pkguiPYTHON install-ps install-ps-am \
- install-strip installcheck installcheck-am installdirs \
- maintainer-clean maintainer-clean-generic mostlyclean \
- mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
- uninstall uninstall-am uninstall-pkguiPYTHON
+ install-pdf-am install-pkgwidgetPYTHON install-ps \
+ install-ps-am install-strip installcheck installcheck-am \
+ installdirs maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
+ ps ps-am uninstall uninstall-am uninstall-pkgwidgetPYTHON
# Tell versions [3.59,3.63) of GNU make to not export all variables.
diff --git a/src/python/app/__init__.py b/src/python/app/__init__.py
new file mode 100644
index 0000000..32d41e0
--- /dev/null
+++ b/src/python/app/__init__.py
@@ -0,0 +1,29 @@
+#!/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
+#
+# Original author of this file is OXullo Interecans <x at brainrapers dot org>
+
+from app import App
+from app import MainDiv
+
+instance = None
+
diff --git a/src/python/app/app.py b/src/python/app/app.py
new file mode 100644
index 0000000..8c7ddda
--- /dev/null
+++ b/src/python/app/app.py
@@ -0,0 +1,385 @@
+#!/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
+#
+# Original author of this file is OXullo Interecans <x at brainrapers dot org>
+
+
+import os
+import math
+import time
+
+import libavg
+from libavg import avg, Point2D, mtemu
+
+import settings
+from settings import Option
+import keyboardmanager
+import debugpanel
+import flashmessage
+
+
+class MainDiv(libavg.avg.DivNode):
+ VERSION = 'undef'
+
+ def __init__(self, **kargs):
+ assert not 'parent' in kargs
+ super(MainDiv, self).__init__(**kargs)
+ self.registerInstance(self, None)
+
+ def onArgvParserCreated(self, parser):
+ pass
+
+ def onArgvParsed(self, options, args, parser):
+ pass
+
+ def onStartup(self):
+ pass
+
+ def onInit(self):
+ pass
+
+ def onExit(self):
+ pass
+
+ def onFrame(self):
+ pass
+
+
+class App(object):
+ def __init__(self):
+ self._setupInstance()
+
+ self._mainDiv = None
+ self._appParent = None
+ self._debugPanel = None
+ self._overlayPanel = None
+ self._resolution = None
+ self._windowSize = None
+ self._mtEmu = None
+
+ self.__lastFrameTimestamp = 0
+
+ self._setupSettings()
+
+ def run(self, mainDiv, **kargs):
+ assert isinstance(mainDiv, MainDiv)
+ self._mainDiv = mainDiv
+
+ self.mainDiv.settings = self._settings
+ self._applySettingsExtenders(kargs)
+ self._setupLogging()
+
+ mainDiv.onStartup()
+
+ self._setupResolution()
+ self._setupRootNode()
+ self._setupMouse()
+ pos, size, angle = self._getAppParentGeometry()
+ self._setupAppParent(pos, size, angle)
+ self._setupMainDiv()
+ self._setupTopPanel()
+
+ self._setupDebugPanel()
+ self._setupKeyboardManager()
+ self._setupDebuggingWidgets()
+ self._applyResolution()
+ self._setupOnInit()
+
+ self.onBeforeLaunch()
+
+ self.__lastFrameTimestamp = time.time()
+
+ try:
+ self._runLoop()
+ except Exception, e:
+ self._teardownKeyboardManager()
+ raise
+
+ mainDiv.onExit()
+
+ self._teardownKeyboardManager()
+
+ return 0
+
+ @property
+ def mainDiv(self):
+ return self._mainDiv
+
+ @property
+ def debugPanel(self):
+ return self._debugPanel
+
+ @property
+ def overlayPanel(self):
+ return self._overlayPanel
+
+ @property
+ def settings(self):
+ return self._settings
+
+ def onBeforeLaunch(self):
+ pass
+
+ def takeScreenshot(self, targetFolder='.'):
+ screenBmp = libavg.player.screenshot()
+
+ filenameTemplate = os.path.join(targetFolder, '%s-%03d.png')
+
+ i = 1
+ while i < 1000:
+ filename = filenameTemplate % (self.__class__.__name__, i)
+ if os.path.exists(filename):
+ i += 1
+ else:
+ break
+
+ if i == 1000:
+ flashmessage.FlashMessage('Maximum number of screenshots reached',
+ parent=self._appParent, isError=True)
+ else:
+ screenBmp.save(filename)
+ flashmessage.FlashMessage('Screenshot saved as %s' % filename,
+ parent=self._appParent)
+
+ def dumpTextObjectCount(self):
+ objects = libavg.player.getTestHelper().getObjectCount()
+ savedSeverity = libavg.logger.getCategories()[libavg.logger.Category.APP]
+ libavg.logger.configureCategory(libavg.logger.Category.APP,
+ libavg.logger.Severity.INFO)
+ libavg.logger.info('Dumping objects count')
+ for key, value in objects.iteritems():
+ libavg.logger.info(' %-25s: %s' % (key, value))
+
+ libavg.logger.configureCategory(libavg.logger.Category.APP, savedSeverity)
+
+ def _setupInstance(self):
+ import libavg.app
+
+ if libavg.app.instance is not None:
+ raise RuntimeError('%s has been already instantiated' %
+ self.__class__.__name__)
+
+ libavg.app.instance = self
+
+ def _setupSettings(self):
+ self._settings = settings.Settings()
+ self._settings.addOption(Option('app_resolution', '640x480'))
+ self._settings.addOption(Option('app_window_size', ''))
+ self._settings.addOption(Option('app_fullscreen', 'false'))
+ self._settings.addOption(Option('app_show_cursor', 'true'))
+ self._settings.addOption(Option('app_rotation', 'normal'))
+ self._settings.addOption(Option('app_panel_fontsize', '10'))
+ self._settings.addOption(Option('app_mouse_enabled', 'true'))
+ self._settings.addOption(Option('multitouch_enabled', 'false'))
+ self._settings.addOption(Option('multitouch_driver', ''))
+ self._settings.addOption(Option('multitouch_tuio_port', ''))
+ self._settings.addOption(Option('multitouch_mtdev_device', ''))
+ self._settings.addOption(Option('log_avg_categories', ''))
+
+ def _applySettingsExtenders(self, kargs):
+ self.settings.applyExtender(settings.KargsExtender(kargs))
+ argvExtender = settings.ArgvExtender(self.mainDiv.VERSION)
+ self.mainDiv.onArgvParserCreated(argvExtender.parser)
+ self.settings.applyExtender(argvExtender)
+ self.mainDiv.onArgvParsed(argvExtender.parsedArgs[0], argvExtender.parsedArgs[1],
+ argvExtender.parser)
+
+ def _setupLogging(self):
+ catMap = self.settings.get('log_avg_categories').strip()
+ if catMap:
+ for catPair in catMap.split(' '):
+ cat, strLevel = catPair.split(':')
+ level = getattr(avg.logger.Severity, strLevel)
+
+ libavg.avg.logger.configureCategory(cat, level)
+
+ def _setupRootNode(self):
+ libavg.player.loadString('''<?xml version="1.0"?>
+ <!DOCTYPE avg SYSTEM "../../libavg/doc/avg.dtd">
+ <avg width="%s" height="%s">
+ </avg>''' % tuple(self._resolution))
+
+ def _setupMouse(self):
+ libavg.player.enableMouse(self.settings.getBoolean('app_mouse_enabled'))
+
+ def _setupMultitouch(self):
+ if self.settings.getBoolean('multitouch_enabled'):
+ driver = self.settings.get('multitouch_driver').upper()
+ if driver:
+ os.putenv('AVG_MULTITOUCH_DRIVER', driver)
+
+ tuio_port = self.settings.get('multitouch_tuio_port').upper()
+ if tuio_port:
+ os.putenv('AVG_TUIO_PORT', tuio_port)
+
+ mtdev_device = self.settings.get('multitouch_mtdev_device').upper()
+ if mtdev_device:
+ os.putenv('AVG_LINUX_MULTITOUCH_DEVICE', mtdev_device)
+
+ libavg.player.enableMultitouch()
+
+ def _getAppParentGeometry(self):
+ rotation = self.settings.get('app_rotation').lower()
+ size = self._resolution
+ pos = (0, 0)
+ angle = 0
+
+ if rotation == 'left':
+ angle = -math.pi / 2
+ size = (self._resolution.y, self._resolution.x)
+ pos = ((self._resolution.x - self._resolution.y) / 2,
+ (self._resolution.y - self._resolution.x) / 2)
+ elif rotation == 'right':
+ angle = math.pi / 2
+ size = (self._resolution.y, self._resolution.x)
+ pos = ((self._resolution.x - self._resolution.y) / 2,
+ (self._resolution.y - self._resolution.x) / 2)
+ elif rotation == 'inverted':
+ angle = math.pi
+ elif rotation != 'normal':
+ raise TypeError('Invalid rotation %s' % rotation)
+
+ return (pos, size, angle)
+
+ def _setupAppParent(self, pos, size, angle):
+ self._appParent = libavg.avg.DivNode(parent=libavg.player.getRootNode(),
+ pos=pos, size=size, angle=angle)
+
+ def _setupMainDiv(self):
+ self._appParent.appendChild(self.mainDiv)
+ self.mainDiv.size = self._appParent.size
+
+ def _setupTopPanel(self):
+ self._overlayPanel = libavg.avg.DivNode(parent=self._appParent, id='overlayPanel')
+
+ def _setupDebugPanel(self):
+ self._debugPanel = debugpanel.DebugPanel(parent=self._appParent,
+ size=self._appParent.size, id='debugPanel',
+ fontsize=self.settings.getFloat('app_panel_fontsize'))
+
+ def _setupDebuggingWidgets(self):
+ pass
+
+ def _setupResolution(self):
+ rotation = self.settings.get('app_rotation').lower()
+ resolutionStr = self.settings.get('app_resolution').lower()
+ if resolutionStr != '':
+ resolution = self.settings.getPoint2D('app_resolution')
+ else:
+ resolution = libavg.player.getScreenResolution()
+
+ windowSizeStr = self.settings.get('app_window_size')
+ if windowSizeStr != '':
+ windowSize = self.settings.getPoint2D('app_window_size')
+ else:
+ windowSize = resolution
+
+ if rotation in ('left', 'right'):
+ resolution = Point2D(resolution.y, resolution.x)
+ windowSize = Point2D(windowSize.y, windowSize.x)
+
+ self._resolution = resolution
+ self._windowSize = windowSize
+
+ def _applyResolution(self):
+ fullscreen = self.settings.getBoolean('app_fullscreen')
+
+ if fullscreen:
+ resolution = self._resolution
+ else:
+ resolution = self._windowSize
+
+ libavg.player.setResolution(
+ fullscreen,
+ int(resolution.x), int(resolution.y),
+ 0 # color depth
+ )
+
+ libavg.player.showCursor(self.settings.getBoolean('app_show_cursor'))
+
+ def _setupKeyboardManager(self):
+ keyboardmanager.init()
+ keyboardmanager.bindKeyDown(
+ keystring='d',
+ handler=self._debugPanel.toggleVisibility,
+ help='Show/hide the debug panel',
+ modifiers=libavg.avg.KEYMOD_CTRL)
+
+ keyboardmanager.bindKeyDown(
+ keystring='h',
+ handler=lambda: libavg.player.showCursor(
+ not libavg.player.isCursorShown()),
+ help='Show/hide cursor',
+ modifiers=libavg.avg.KEYMOD_CTRL)
+
+ keyboardmanager.bindKeyDown(
+ keystring='p',
+ handler=self.takeScreenshot,
+ help='Take screenshot',
+ modifiers=libavg.avg.KEYMOD_CTRL)
+
+ keyboardmanager.bindKeyDown(
+ keystring='b',
+ handler=self.dumpTextObjectCount,
+ help='Dump objects count to the console',
+ modifiers=libavg.avg.KEYMOD_CTRL)
+
+ keyboardmanager.bindKeyDown(
+ keystring='e',
+ handler=self._toggleMtEmulation,
+ help='Toggle multitouch emulation',
+ modifiers=libavg.avg.KEYMOD_CTRL)
+
+ self.debugPanel.setupKeys()
+
+ def _toggleMtEmulation(self):
+ if self._mtEmu is None:
+ self._mtEmu = mtemu.MTemu()
+ keyboardmanager.bindKeyDown('shift', self._mtEmu.enableDualTouch,
+ 'Enable pinch gesture emulation')
+ keyboardmanager.bindKeyUp('shift', self._mtEmu.disableDualTouch,
+ 'Disable pinch gesture emulation')
+
+ keyboardmanager.bindKeyDown('t', self._mtEmu.toggleSource,
+ 'Toggle source between TOUCH and TRACK', libavg.avg.KEYMOD_CTRL)
+ else:
+ self._mtEmu.deinit()
+ keyboardmanager.unbindKeyDown('t', libavg.avg.KEYMOD_CTRL)
+ keyboardmanager.unbindKeyDown('shift')
+ keyboardmanager.unbindKeyUp('shift')
+
+ del self._mtEmu
+ self._mtEmu = None
+
+ def _teardownKeyboardManager(self):
+ keyboardmanager.unbindAll()
+
+ def _setupOnInit(self):
+ libavg.player.setTimeout(0, self._onInitInternal)
+
+ def _runLoop(self):
+ libavg.player.play()
+
+ def _onInitInternal(self):
+ self._setupMultitouch()
+ self.mainDiv.onInit()
+ libavg.player.subscribe(libavg.player.ON_FRAME, self.mainDiv.onFrame)
diff --git a/src/python/app/debugpanel.py b/src/python/app/debugpanel.py
new file mode 100644
index 0000000..c786785
--- /dev/null
+++ b/src/python/app/debugpanel.py
@@ -0,0 +1,697 @@
+#!/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
+#
+# Original authors of this file are
+# OXullo Interecans <x at brainrapers dot org>
+# Richard Klemm <richy at coding-reality.de>
+
+from collections import defaultdict
+from collections import deque
+import math
+
+import libavg
+from libavg import avg
+from touchvisualization import DebugTouchVisualization
+from touchvisualization import TouchVisualizationOverlay as TouchVisOverlay
+
+
+import keyboardmanager as kbmgr
+
+g_fontsize = 10
+
+PANGO_ENTITIES_MAP = {
+ "&": "&amp;",
+ '"': "&quot;",
+ "'": "&apos;",
+ ">": "&gt;",
+ "<": "&lt;",
+}
+
+def subscribe(publisher, msgID, callable_):
+ publisher.subscribe(msgID, callable_)
+ return lambda: publisher.unsubscribe(msgID, callable_)
+
+
+class DebugWidgetFrame(avg.DivNode):
+
+ BORDER = 7
+ FRAME_HEIGHT_CHANGED = avg.Publisher.genMessageID()
+
+ def __init__(self, size, widgetCls, *args, **kwargs):
+ super(DebugWidgetFrame, self).__init__(size=size, *args, **kwargs)
+ self.registerInstance(self, None)
+ self.setup(widgetCls)
+ self.subscribe(self.SIZE_CHANGED, self._onSizeChanged)
+ self.size = size
+ self._onSizeChanged(size)
+
+ def setup(self, widgetCls):
+ self.__background = avg.RectNode(parent=self, opacity=0.8,
+ fillcolor='000000', fillopacity=0.8)
+ self.__widget = widgetCls(parent=self,
+ size=(max(0, self.width - self.BORDER * 2), 0),
+ pos=(self.BORDER, self.BORDER))
+ self.__selectHighlight = avg.RectNode(parent=self, color="35C0CD",
+ strokewidth=self.BORDER, opacity=0.8,
+ pos=(self.BORDER / 2, self.BORDER / 2), active=False, sensitive=False)
+ self.__boundary = avg.RectNode(parent=self, sensitive=False)
+
+ self.publish(DebugWidgetFrame.FRAME_HEIGHT_CHANGED)
+
+ self.__widget.subscribe(self.__widget.WIDGET_HEIGHT_CHANGED,
+ self.adjustWidgetHeight)
+ self.__widget.update()
+
+ def _onSizeChanged(self, size):
+ self.__boundary.size = size
+ self.__background.size = size
+ childSize = (max(0, size[0] - self.BORDER * 2), max(0, size[1] - self.BORDER * 2))
+ self.__selectHighlight.size = (max(0, size[0] - self.BORDER),
+ max(0, size[1] - self.BORDER))
+ self.__widget.size = childSize
+ self.__widget.syncSize(childSize)
+
+ def adjustWidgetHeight(self, height):
+ self.size = (max(0, self.width), height + 2 * self.BORDER)
+ self.notifySubscribers(DebugWidgetFrame.FRAME_HEIGHT_CHANGED, [])
+
+ def toggleSelect(self, event=None):
+ self.__selectHighlight.active = not(self.__selectHighlight.active)
+
+ def isSelected(self):
+ return self.__selectHighlight.active
+
+ def select(self):
+ self.__selectHighlight.active = True
+
+ def unselect(self):
+ self.__selectHighlight.active = False
+
+ def show(self):
+ self.active = True
+ self.__widget.onShow()
+ self.__widget.update()
+
+ def hide(self):
+ self.active = False
+ self.__widget.onHide()
+
+ @property
+ def widget(self):
+ return self.__widget
+
+
+class DebugWidget(avg.DivNode):
+ SLOT_HEIGHT = 200
+ CAPTION = ''
+
+ WIDGET_HEIGHT_CHANGED = avg.Publisher.genMessageID()
+
+ def __init__(self, parent=None, **kwargs):
+ super(DebugWidget, self).__init__(**kwargs)
+ self.registerInstance(self, parent)
+ self.publish(DebugWidget.WIDGET_HEIGHT_CHANGED)
+ if self.CAPTION:
+ self._caption = avg.WordsNode(text=self.CAPTION, pivot=(0, 0),
+ opacity=0.5, fontsize=14, parent=self)
+ self._caption.angle = math.pi / 2
+ self._caption.pos = (self.width, 0)
+
+ def syncSize(self, size):
+ self._caption.width = size[1]
+
+ def update(self):
+ pass
+
+ def onShow(self):
+ pass
+
+ def onHide(self):
+ pass
+
+ def kill(self):
+ pass
+
+
+NUM_COLS = 10
+COL_WIDTH = 60
+ROW_HEIGHT = g_fontsize + 2
+
+
+class TableRow(avg.DivNode):
+ COL_POS_X = 0
+ ROW_ID = 0
+
+ def __init__(self, parent=None, **kwargs):
+ super(TableRow, self).__init__(**kwargs)
+ self.registerInstance(self, parent)
+ global NUM_COLS
+ NUM_COLS = int((self.parent.width - COL_WIDTH * 4) / COL_WIDTH)
+ self._initRow()
+ TableRow.ROW_ID += 1
+
+ def _initRow(self):
+ self.columnBackground = avg.RectNode(parent=self, fillcolor="222222",
+ fillopacity=0.6, opacity=0)
+ self.columnContainer = avg.DivNode(parent=self)
+ if TableRow.ROW_ID % 2 != 0:
+ self.columnBackground.fillopacity = 0
+ self.cols = [0] * NUM_COLS
+ self.liveColumn = avg.WordsNode(parent=self.columnContainer, fontsize=g_fontsize,
+ text="N/A - SPECIAL", size=(COL_WIDTH, ROW_HEIGHT), variant="bold")
+ for i in xrange(0, NUM_COLS):
+ self.cols[i] = (avg.WordsNode(parent=self.columnContainer,
+ fontsize=g_fontsize,
+ text="0", size=(COL_WIDTH / 2.0, ROW_HEIGHT),
+ pos=((i+1) * COL_WIDTH, 0)),
+ avg.WordsNode(parent=self.columnContainer,
+ fontsize=g_fontsize,
+ text="(0)", size=(COL_WIDTH / 2.0, ROW_HEIGHT),
+ pos=((i+1) * COL_WIDTH + COL_WIDTH / 2, 0),
+ color="000000"))
+
+ self.rowData = deque([(0, 0)] * (NUM_COLS + 1), maxlen=NUM_COLS + 1)
+ self.label = avg.WordsNode(parent=self, fontsize=g_fontsize, variant="bold")
+ self.setLabel("NONE")
+
+ @property
+ def height(self):
+ return self.label.height
+
+ def setLabel(self, label):
+ if self.label.text == label + ":":
+ return
+ self.label.text = label + ":"
+ TableRow.COL_POS_X = max(TableRow.COL_POS_X, self.label.width)
+ if self.label.width < TableRow.COL_POS_X:
+ self.parent.labelColumnSizeChanged()
+
+ def resizeLabelColumn(self):
+ self.columnContainer.pos = (TableRow.COL_POS_X + 10, 0)
+ self.columnBackground.size = (self.columnContainer.x + self.liveColumn.x +
+ self.liveColumn.width, g_fontsize)
+
+ def insertValue(self, data):
+ prevValue = self.rowData[0][0]
+ self.rowData.appendleft([data, data-prevValue])
+ for i in xrange(0, len(self.rowData)-1):
+ val, diff = self.rowData[i]
+ column = self.cols[i]
+ column[0].text = str(val)
+ column[1].text = "({diff})".format(diff=diff)
+ column[1].pos = (column[0].x + column[0].getLineExtents(0)[0] + 2,
+ column[0].y)
+ if diff == 0:
+ column[1].color = "000000"
+ elif diff < 0:
+ column[1].color = "00FF00"
+ else:
+ column[1].color = "FF0000"
+
+ def updateLiveColumn(self, value):
+ self.liveColumn.text = str(value)
+
+
+class Table(avg.DivNode):
+ def __init__(self, parent=None, **kwargs):
+ super(Table, self).__init__(**kwargs)
+ self.registerInstance(self, parent)
+
+ def labelColumnSizeChanged(self):
+ for childID in xrange(0, self.getNumChildren()):
+ child = self.getChild(childID)
+ child.resizeLabelColumn()
+
+
+class ObjectDumpWidget(DebugWidget):
+ CAPTION = 'Objects count'
+
+ def __init__(self, parent=None, **kwargs):
+ super(ObjectDumpWidget, self).__init__(**kwargs)
+ self.registerInstance(self, parent)
+ self.tableContainer = Table(parent=self, size=(self.width, self.SLOT_HEIGHT))
+ self.tableDivs = defaultdict(lambda: TableRow(parent=self.tableContainer))
+
+ def update(self):
+ objDump = libavg.player.getTestHelper().getObjectCount()
+ pos = (0, 0)
+ for key in sorted(objDump.iterkeys()):
+ val = objDump[key]
+ self.tableDivs[key].updateLiveColumn(val)
+ self.tableDivs[key].setLabel(key)
+ self.tableDivs[key].pos = pos
+ pos = (0, pos[1] + self.tableDivs[key].height)
+ height = len(objDump) * self.tableDivs[key].height
+ if self.height != height:
+ self.notifySubscribers(DebugWidget.WIDGET_HEIGHT_CHANGED, [height])
+
+ def persistColumn(self):
+ objDump = libavg.player.getTestHelper().getObjectCount()
+ for key, val in objDump.iteritems():
+ self.tableDivs[key].insertValue(val)
+
+ def syncSize(self, size):
+ self.tableContainer.size = (size[0], size[1] - (g_fontsize + 2))
+
+ def onShow(self):
+ self.intervalID = libavg.player.setInterval(1000, self.update)
+ kbmgr.bindKeyDown(keystring='i',
+ handler=self.persistColumn,
+ help="Object count snapshot",
+ modifiers=libavg.KEYMOD_CTRL)
+
+ def onHide(self):
+ if self.intervalID:
+ libavg.player.clearInterval(self.intervalID)
+ self.intervalID = None
+ kbmgr.unbindKeyDown(keystring='i', modifiers=libavg.KEYMOD_CTRL)
+
+ def kill(self):
+ self.onHide()
+ self.tableDivs = None
+
+
+class GraphWidget(DebugWidget):
+ def __init__(self, **kwargs):
+ super(GraphWidget, self).__init__(**kwargs)
+ self.registerInstance(self, None)
+ self.__graph = None
+
+ def onShow(self):
+ if self.__graph:
+ self.__graph.active = True
+ else:
+ self.__graph = self._createGraph()
+
+ def onHide(self):
+ if self.__graph:
+ self.__graph.active = False
+
+ def kill(self):
+ self.__graph.unlink(True)
+
+ def _createGraph(self):
+ pass
+
+
+class MemoryGraphWidget(GraphWidget):
+ CAPTION = 'Memory usage'
+
+ def _createGraph(self):
+ return libavg.graph.AveragingGraph(parent=self, size=self.size,
+ getValue=avg.getMemoryUsage)
+
+
+class FrametimeGraphWidget(GraphWidget):
+ CAPTION = 'Time per frame'
+
+ def _createGraph(self):
+ return libavg.graph.SlidingBinnedGraph(parent=self,
+ getValue=libavg.player.getFrameTime,
+ binsThresholds=[0.0, 20.0, 40.0, 80.0, 160.0],
+ size=self.size)
+
+
+class GPUMemoryGraphWidget(GraphWidget):
+ CAPTION = 'GPU Memory usage'
+
+ def _createGraph(self):
+ try:
+ libavg.player.getVideoMemUsed()
+ except RuntimeError:
+ return avg.WordsNode(parent=self,
+ text='GPU memory graph is not supported on this hardware',
+ color='ff5555')
+ else:
+ return libavg.graph.AveragingGraph(parent=self, size=self.size,
+ getValue=libavg.player.getVideoMemUsed)
+
+
+class KeyboardManagerBindingsShower(DebugWidget):
+ CAPTION = 'Keyboard bindings'
+
+ def __init__(self, *args, **kwargs):
+ super(KeyboardManagerBindingsShower, self).__init__(**kwargs)
+ self.registerInstance(self, None)
+ self.keybindingWordNodes = []
+ kbmgr.publisher.subscribe(kbmgr.publisher.BINDINGS_UPDATED, self.update)
+
+ def clear(self):
+ for node in self.keybindingWordNodes:
+ node.unlink(True)
+ self.keybindingWordNodes = []
+
+ def update(self):
+ self.clear()
+ for binding in kbmgr.getCurrentBindings():
+ keystring = binding.keystring.decode('utf8')
+ modifiersStr = self.__modifiersToString(binding.modifiers)
+
+ if modifiersStr is not None:
+ key = '%s-%s' % (modifiersStr, keystring)
+ else:
+ key = keystring
+
+ if binding.type == libavg.avg.KEYDOWN:
+ key = '%s %s' % (unichr(8595), key)
+ else:
+ key = '%s %s' % (unichr(8593), key)
+
+ node = avg.WordsNode(
+ text='<span size="large"><b>%s</b></span>: %s' %
+ (key, binding.help),
+ fontsize=g_fontsize, parent=self)
+ self.keybindingWordNodes.append(node)
+
+ self._placeNodes()
+
+ def _placeNodes(self):
+ if not self.keybindingWordNodes:
+ return
+
+ maxWidth = max([node.width for node in self.keybindingWordNodes])
+ columns = int(self.parent.width / maxWidth)
+ rows = len(self.keybindingWordNodes) / columns
+ remainder = len(self.keybindingWordNodes) % columns
+
+ if remainder != 0:
+ rows += 1
+
+ colSize = self.parent.width / columns
+
+ currentColumn = 0
+ currentRow = 0
+ heights = [0] * columns
+ for node in self.keybindingWordNodes:
+ if currentRow == rows and currentColumn < columns - 1:
+ currentRow = 0
+ currentColumn += 1
+
+ node.pos = (currentColumn * colSize, heights[currentColumn])
+ heights[currentColumn] += node.height
+ currentRow += 1
+
+ finalHeight = max(heights)
+ if self.height != finalHeight:
+ self.notifySubscribers(self.WIDGET_HEIGHT_CHANGED, [finalHeight])
+
+ def __modifiersToString(self, modifiers):
+ def isSingleBit(number):
+ bitsSet = 0
+ for i in xrange(8):
+ if (1 << i) & number:
+ bitsSet += 1
+
+ return bitsSet == 1
+
+ if modifiers in (0, kbmgr.KEYMOD_ANY):
+ return None
+
+ allModifiers = []
+ for mod in dir(avg):
+ if 'KEYMOD_' in mod:
+ maskVal = int(getattr(avg, mod))
+ if isSingleBit(maskVal):
+ allModifiers.append((maskVal, mod))
+
+ modifiersStringsList = []
+ for modval, modstr in allModifiers:
+ if modifiers & modval:
+ modifiersStringsList.append(modstr.replace('KEYMOD_', ''))
+
+ for doubleMod in ['CTRL', 'META', 'SHIFT']:
+ left = 'L' + doubleMod
+ right = 'R' + doubleMod
+ if left in modifiersStringsList and right in modifiersStringsList:
+ modifiersStringsList.remove(left)
+ modifiersStringsList.remove(right)
+ modifiersStringsList.append(doubleMod)
+
+ return '/'.join(modifiersStringsList).lower()
+
+
+class DebugPanel(avg.DivNode):
+ def __init__(self, parent=None, fontsize=10, **kwargs):
+ super(DebugPanel, self).__init__(**kwargs)
+ self.registerInstance(self, parent)
+
+ avg.RectNode(size=self.size, opacity=0, fillopacity=0.3, fillcolor='ff0000',
+ parent=self)
+ avg.WordsNode(text='Debug panel', fontsize=fontsize,
+ pos=(0, self.height - fontsize - fontsize / 3),
+ parent=self)
+
+ self.sensitive = False
+ self.active = False
+ self.__panel = None
+ self.__callables = []
+ self.__fontsize = fontsize
+ self.__touchVisOverlay = None
+
+ def setupKeys(self):
+ kbmgr.bindKeyDown(keystring='g',
+ handler=lambda: self.toggleWidget(GPUMemoryGraphWidget),
+ help="GPU memory graph",
+ modifiers=libavg.avg.KEYMOD_CTRL)
+
+ kbmgr.bindKeyDown(keystring='m',
+ handler=lambda: self.toggleWidget(MemoryGraphWidget),
+ help="Memory graph",
+ modifiers=libavg.avg.KEYMOD_CTRL)
+
+ kbmgr.bindKeyDown(keystring='f',
+ handler=lambda: self.toggleWidget(FrametimeGraphWidget),
+ help="Frametime graph",
+ modifiers=libavg.avg.KEYMOD_CTRL)
+
+ kbmgr.bindKeyDown(keystring='?',
+ handler=lambda: self.toggleWidget(KeyboardManagerBindingsShower),
+ help="Show keyboard bindings",
+ modifiers=kbmgr.KEYMOD_ANY)
+
+ kbmgr.bindKeyDown(keystring='o',
+ handler=lambda: self.toggleWidget(ObjectDumpWidget),
+ help="Object count table",
+ modifiers=libavg.avg.KEYMOD_CTRL)
+
+ kbmgr.bindKeyDown(keystring='v', handler=self.toggleTouchVisualization,
+ help="Cursor visualization",
+ modifiers=libavg.avg.KEYMOD_CTRL)
+
+ def addWidget(self, widgetCls, *args, **kwargs):
+ callable_ = lambda: self.__panel.addWidget(widgetCls, *args, **kwargs)
+ if self.__panel:
+ callable_()
+ else:
+ self.__callables.append(callable_)
+
+ def toggleWidget(self, *args, **kwargs):
+ if not self.active:
+ self.show()
+ self.__panel.ensureWidgetWisible(*args, **kwargs)
+ else:
+ self.__panel.toggleWidget(*args, **kwargs)
+
+ if not self.__panel.activeWidgetClasses:
+ self.hide()
+
+ def hide(self):
+ if self.__panel and self.active:
+ self.__panel.hide()
+ self.active = False
+
+ def show(self):
+ if self.__panel:
+ if not self.active:
+ self.__panel.show()
+ else:
+ self.forceLoadPanel()
+
+ self.active = True
+
+ def toggleVisibility(self):
+ if self.active:
+ self.hide()
+ else:
+ self.show()
+
+ def toggleTouchVisualization(self):
+ if self.__touchVisOverlay is None:
+ self.__touchVisOverlay = TouchVisOverlay(
+ isDebug=True,
+ visClass=DebugTouchVisualization,
+ size=self.parent.size,
+ parent=self.parent)
+ else:
+ self.__touchVisOverlay.unlink(True)
+ self.__touchVisOverlay = None
+
+ def forceLoadPanel(self):
+ if self.__panel is None:
+ self.__panel = _DebugPanel(parent=self, size=self.size,
+ fontsize=self.__fontsize)
+ for callable_ in self.__callables:
+ callable_()
+
+
+class _DebugPanel(avg.DivNode):
+
+ def __init__(self, parent=None, fontsize=10, **kwargs):
+ super(_DebugPanel, self).__init__(**kwargs)
+ self.registerInstance(self, parent)
+
+ self.__slots = []
+
+ self.maxSize = self.size
+ self.size = (self.size[0], 0)
+ self.activeWidgetClasses = []
+ self.__selectedWidget = None
+
+ global g_fontsize
+ g_fontsize = fontsize
+
+ self.show()
+
+ def show(self):
+ for widgetFrame in self.__slots:
+ if widgetFrame:
+ widgetFrame.show()
+ self.updateWidgets()
+
+ def hide(self):
+ for widget in self.__slots:
+ if widget:
+ widget.hide()
+
+ def ensureWidgetWisible(self, widgetClass, *args, **kwargs):
+ if not widgetClass in self.activeWidgetClasses:
+ self.toggleWidget(widgetClass, *args, **kwargs)
+
+ def toggleWidget(self, widgetClass, *args, **kwargs):
+ if widgetClass in self.activeWidgetClasses:
+ self._removeWidgetByClass(widgetClass)
+ else:
+ self.addWidget(widgetClass, *args, **kwargs)
+
+ def addWidget(self, widgetClass, *args, **kwargs):
+ if widgetClass in self.activeWidgetClasses:
+ libavg.logger.warning("You can't add the same widget twice")
+ return
+
+ widgetFrame = DebugWidgetFrame((max(0, self.width), DebugWidget.SLOT_HEIGHT),
+ widgetClass)
+ height = 0
+ for frame in self.__slots:
+ if frame:
+ height += frame.height
+ height += widgetFrame.height
+
+ if height > self.maxSize[1]:
+ libavg.logger.warning("No vertical space left. "
+ "Delete a widget and try again")
+ return False
+
+ self.appendChild(widgetFrame)
+
+ widgetPlaced = False
+ for idx, slot in enumerate(self.__slots):
+ if slot is None:
+ self.__slots[idx] = widgetFrame
+ widgetPlaced = True
+ break
+ if not widgetPlaced:
+ self.__slots.append(widgetFrame)
+ widgetFrame.subscribe(widgetFrame.FRAME_HEIGHT_CHANGED, self._heightChanged)
+
+ self.reorderWidgets()
+ widgetFrame.show()
+ self.updateWidgets()
+ self.activeWidgetClasses.append(widgetClass)
+
+ def _removeWidgetByClass(self, widgetClass):
+ for frame in self.__slots:
+ if frame and frame.widget.__class__ == widgetClass:
+ self.removeWidgetFrame(frame)
+ return
+
+ def _heightChanged(self):
+ height = 0
+ for childID in xrange(0, self.getNumChildren()):
+ child = self.getChild(childID)
+ height += child.height
+ self.height = height
+ self.reorderWidgets()
+
+ def updateWidgets(self):
+ for childID in xrange(0, self.getNumChildren()):
+ self.getChild(childID).widget.update()
+
+ def selectWidget(self, id):
+ id = id % self.getNumChildren()
+ for childID in xrange(0, self.getNumChildren()):
+ self.getChild(childID).unselect()
+ self.getChild(id).select()
+ self.__selectedWidget = id
+
+ def selectPreviousWidget(self):
+ if self.__selectedWidget is None:
+ self.selectWidget(-1)
+ else:
+ self.selectWidget(self.__selectedWidget - 1)
+
+ def selectNextWidget(self):
+ if self.__selectedWidget is None:
+ self.selectWidget(0)
+ else:
+ self.selectWidget(self.__selectedWidget + 1)
+
+ def removeWidgetFrame(self, widgetFrame):
+ self.activeWidgetClasses.remove(widgetFrame.widget.__class__)
+ for idx, slot in enumerate(self.__slots):
+ if slot == widgetFrame:
+ self.__slots[idx] = None
+ break
+ widgetFrame.widget.kill()
+ widgetFrame.unlink(True)
+ self.reorderWidgets()
+ self.updateWidgets()
+
+ def removeSelectedWidgetFrames(self):
+ candidates = []
+ for childID in xrange(0, self.getNumChildren()):
+ child = self.getChild(childID)
+ if child.isSelected():
+ candidates.append(child)
+ for widgetFrame in candidates:
+ self.removeWidgetFrame(widgetFrame)
+ self.__selectedWidget = None
+
+ def reorderWidgets(self):
+ #TODO: This is no layout management, yet
+ count = 0
+ height = 0
+ for idx, widgetFrame in enumerate(self.__slots):
+ if widgetFrame:
+ widgetFrame.pos = (0, height)
+ count += 1
+ height += widgetFrame.height
+ self.size = (self.maxSize[0], height)
diff --git a/src/python/app/flashmessage.py b/src/python/app/flashmessage.py
new file mode 100644
index 0000000..ebaab85
--- /dev/null
+++ b/src/python/app/flashmessage.py
@@ -0,0 +1,98 @@
+#!/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
+#
+# Original author of this file is OXullo Interecans <x at brainrapers dot org>
+
+
+'''
+Simple user notification API to report information to the user
+'''
+
+import libavg
+
+class FlashMessage(object):
+ DEFAULT_TIMEOUT = 3000
+ LINE_HEIGHT = 20
+ BORDER = 2
+
+ messages = []
+
+ @classmethod
+ def remove(cls, killedMessage):
+ cls.messages.remove(killedMessage)
+ for index, message in enumerate(cls.messages):
+ message.move(index)
+
+ def __init__(self, text, timeout=DEFAULT_TIMEOUT, parent=None, isError=False,
+ acknowledge=False):
+ FlashMessage.messages.append(self)
+
+ if parent is None:
+ parent = libavg.player.getRootNode()
+
+ if isError:
+ color = 'ff0000'
+ else:
+ color = 'ffffff'
+
+ rootNode = libavg.player.getRootNode()
+ self.__container = libavg.avg.DivNode(sensitive=acknowledge, parent=parent)
+ libavg.avg.RectNode(opacity=0, fillcolor='ffffff', fillopacity=1,
+ pos=(self.BORDER, self.BORDER),
+ size=(rootNode.size.x - self.BORDER * 2, self.LINE_HEIGHT - self.BORDER),
+ parent=self.__container)
+ libavg.avg.RectNode(opacity=0, fillcolor='000000', fillopacity=0.8,
+ pos=(self.BORDER, self.BORDER),
+ size=(rootNode.size.x - self.BORDER * 2, self.LINE_HEIGHT - self.BORDER),
+ parent=self.__container)
+ libavg.avg.WordsNode(text=text, fontsize=(self.LINE_HEIGHT - 3),
+ sensitive=False,
+ color=color,
+ pos=(self.BORDER, self.BORDER),
+ parent=self.__container)
+
+ self.move(len(FlashMessage.messages) - 1, animate=False)
+
+ if acknowledge:
+ self.__container.subscribe(self.__container.CURSOR_DOWN,
+ lambda e: self.__kill())
+ else:
+ libavg.player.setTimeout(timeout, self.__kill)
+
+ def move(self, index, animate=True):
+ finalPos = (self.BORDER, index * self.LINE_HEIGHT)
+
+ if animate:
+ libavg.avg.LinearAnim(self.__container, 'pos', duration=150,
+ startValue=self.__container.pos,
+ endValue=finalPos).start()
+ else:
+ self.__container.pos = finalPos
+
+ def __kill(self):
+ def finalizeRemoval():
+ self.__container.unlink(True)
+ self.__container = None
+ FlashMessage.remove(self)
+
+ libavg.avg.fadeOut(self.__container, 200, finalizeRemoval)
+
diff --git a/src/python/app/keyboardmanager.py b/src/python/app/keyboardmanager.py
new file mode 100644
index 0000000..accdf52
--- /dev/null
+++ b/src/python/app/keyboardmanager.py
@@ -0,0 +1,204 @@
+#!/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
+#
+# Original author of this file is OXullo Interecans <x at brainrapers dot org>
+
+
+from collections import namedtuple
+
+from libavg import avg, player
+
+IGNORED_KEYMODS = avg.KEYMOD_NUM
+KEYMOD_ANY = -1
+
+LOGCAT = avg.logger.configureCategory('KEYBOARDMANAGER',
+ avg.logger.Severity.WARN)
+
+class KeyboardManagerPublisher(avg.Publisher):
+ BINDINGS_UPDATED = avg.Publisher.genMessageID()
+ def __init__(self):
+ super(KeyboardManagerPublisher, self).__init__()
+ self.publish(self.BINDINGS_UPDATED)
+
+ def notifyUpdate(self):
+ self.notifySubscribers(self.BINDINGS_UPDATED, [])
+
+publisher = KeyboardManagerPublisher()
+
+_KeyBinding = namedtuple('_KeyBinding',
+ ['keystring', 'handler', 'help', 'modifiers', 'type'])
+
+
+_modifiedKeyBindings = []
+_plainKeyBindings = []
+_plainKeyBindingsStack = []
+_isEnabled = True
+
+
+def init():
+ player.subscribe(player.KEY_DOWN, _onKeyDown)
+ player.subscribe(player.KEY_UP, _onKeyUp)
+ avg.logger.debug('Keyboardmanager initialized', LOGCAT)
+
+def bindKeyDown(keystring, handler, help, modifiers=avg.KEYMOD_NONE):
+ _bindKey(keystring, handler, help, modifiers, avg.KEYDOWN)
+
+def bindKeyUp(keystring, handler, help, modifiers=avg.KEYMOD_NONE):
+ _bindKey(keystring, handler, help, modifiers, avg.KEYUP)
+
+def unbindKeyUp(keystring, modifiers=avg.KEYMOD_NONE):
+ _unbindKey(keystring, modifiers, avg.KEYUP)
+
+def unbindKeyDown(keystring, modifiers=avg.KEYMOD_NONE):
+ _unbindKey(keystring, modifiers, avg.KEYDOWN)
+
+def unbindAll():
+ global _modifiedKeyBindings, _plainKeyBindings, _plainKeyBindingsStack
+ _modifiedKeyBindings = []
+ _plainKeyBindings = []
+ _plainKeyBindingsStack = []
+ publisher.notifyUpdate()
+
+def push():
+ '''
+ Push the current non-modified defined key bindings to the stack
+ '''
+ global _plainKeyBindings
+ _plainKeyBindingsStack.append(_plainKeyBindings)
+ _plainKeyBindings = []
+ publisher.notifyUpdate()
+
+def pop():
+ '''
+ Pop from the stack the current non-modified defined key bindings
+ '''
+ global _plainKeyBindings
+ _plainKeyBindings = _plainKeyBindingsStack.pop()
+ publisher.notifyUpdate()
+
+def getCurrentBindings():
+ return _modifiedKeyBindings + _plainKeyBindings
+
+def enable():
+ global _isEnabled
+ _isEnabled = True
+
+def disable():
+ global _isEnabled
+ _isEnabled = False
+
+def _bindKey(keystring, handler, help, modifiers, type_):
+ if type(keystring) == unicode:
+ keystring = keystring.encode('utf8')
+
+ avg.logger.info('Binding key <%s> (mod:%s) to handler %s (%s)' % (keystring,
+ modifiers, handler, type), LOGCAT)
+ _checkDuplicates(keystring, modifiers, type_)
+ keyBinding = _KeyBinding(keystring, handler, help, modifiers, type_)
+
+ if modifiers != avg.KEYMOD_NONE:
+ _modifiedKeyBindings.append(keyBinding)
+ else:
+ _plainKeyBindings.append(keyBinding)
+
+ publisher.notifyUpdate()
+
+def _findAndRemoveKeybinding(keystring, modifiers, type, list):
+ for keybinding in list:
+ if keybinding.keystring == keystring and \
+ keybinding.modifiers == modifiers and \
+ keybinding.type == type:
+ list.remove(keybinding)
+ break;
+
+def _unbindKey(keystring, modifiers, type_):
+ if type(keystring) == unicode:
+ keystring = keystring.encode('utf8')
+
+ avg.logger.info('Unbinding key <%s> (mod:%s) (%s)' % (keystring,
+ modifiers, type), LOGCAT)
+ if modifiers != avg.KEYMOD_NONE:
+ _findAndRemoveKeybinding(keystring, modifiers, type_, _modifiedKeyBindings)
+ else:
+ _findAndRemoveKeybinding(keystring, modifiers, type_, _plainKeyBindings)
+
+ publisher.notifyUpdate()
+
+def _onKeyDown(event):
+ if _isEnabled:
+ _processEvent(event, avg.KEYDOWN)
+
+def _onKeyUp(event):
+ if _isEnabled:
+ _processEvent(event, avg.KEYUP)
+
+def _testModifiers(mod1, mod2):
+ if mod1 == KEYMOD_ANY or mod2 == KEYMOD_ANY:
+ return True
+
+ mod1 &= ~IGNORED_KEYMODS
+ mod2 &= ~IGNORED_KEYMODS
+ return mod1 == mod2 or mod1 & mod2
+
+def _testPatternMatch(pattern, text):
+ if pattern in ('shift', 'alt', 'ctrl', 'meta', 'super'):
+ return pattern in text
+ else:
+ return False
+
+def _testMatchString(keyBinding, keyString, type_):
+ sameType = keyBinding.type == type_
+ patternMatch = _testPatternMatch(keyBinding.keystring, keyString)
+ directMatch = keyBinding.keystring == keyString
+
+ return sameType and (directMatch or patternMatch)
+
+def _testMatchEvent(keyBinding, event, type_):
+ if not _testModifiers(event.modifiers, keyBinding.modifiers):
+ return False
+
+ if _testMatchString(keyBinding, event.keystring, type_):
+ return True
+
+ if type_ == avg.KEYDOWN:
+ return _testMatchString(keyBinding,
+ unichr(event.unicode).encode('utf8'), type_)
+ else:
+ return False
+
+def _processEvent(event, type_):
+ avg.logger.debug('Processing event keystring=%s '
+ 'modifiers=%s type=%s' % (event.keystring, event.modifiers, event.type),
+ LOGCAT)
+ for keyBinding in _plainKeyBindings + _modifiedKeyBindings:
+ if _testMatchEvent(keyBinding, event, type_):
+ avg.logger.debug(' Found keyBinding=%s' % (keyBinding,), LOGCAT)
+ keyBinding.handler()
+ return
+
+def _checkDuplicates(keystring, modifiers, type_):
+ for keyBinding in _plainKeyBindings + _modifiedKeyBindings:
+ if (_testModifiers(keyBinding.modifiers, modifiers) and
+ _testMatchString(keyBinding, keystring, type_)):
+ raise RuntimeError('Key binding keystring=%s modifiers=%s type=%s '
+ 'already defined' % (keystring, modifiers, type_))
+
diff --git a/src/python/app/settings.py b/src/python/app/settings.py
new file mode 100644
index 0000000..a25eece
--- /dev/null
+++ b/src/python/app/settings.py
@@ -0,0 +1,277 @@
+#!/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
+#
+# Original author of this file is OXullo Interecans <x at brainrapers dot org>
+
+
+import sys
+import re
+import optparse
+
+import libavg
+
+
+class Option(object):
+ def __init__(self, key, value, help=None):
+ if not isinstance(key, str):
+ raise ValueError('The type of %s key is not string (value=%s)' % (key, value))
+
+ self.__key = key
+ self.value = value
+ self.__help = help
+
+ def __repr__(self):
+ return '<%s key=%s value=%s help=%s>' % (self.__class__.__name__,
+ self.key, self.value, self.help)
+
+ @property
+ def key(self):
+ return self.__key
+
+ @property
+ def value(self):
+ return self.__value
+
+ @value.setter
+ def value(self, value):
+ if not isinstance(value, str):
+ raise ValueError('The type of %s value (%s) '
+ 'must be string instead of %s' % (self.__key, value, type(value)))
+
+ self.__value = value
+
+ @property
+ def group(self):
+ components = self.__getComponents()
+ if len(components) == 1:
+ return 'DEFAULT'
+ else:
+ return components[0]
+
+ @property
+ def tail(self):
+ components = self.__getComponents()
+ if len(components) == 1:
+ return self.key
+ else:
+ return components[1]
+
+ @property
+ def help(self):
+ return self.__help
+
+ def __getComponents(self):
+ return self.key.split('_', 1)
+
+
+class KargsExtender(object):
+ def __init__(self, optionsKargs):
+ self.__optionsKargs = optionsKargs
+
+ def __call__(self, optionsList):
+ optionsKeyset = set([option.key for option in optionsList])
+ kaKeyset = set(self.__optionsKargs.keys())
+
+ if not optionsKeyset.issuperset(kaKeyset):
+ raise RuntimeError('No such option/s: %s' % list(kaKeyset - optionsKeyset))
+
+ for option in optionsList:
+ if option.key in self.__optionsKargs:
+ option.value = self.__optionsKargs[option.key]
+
+ return optionsList
+
+
+class HelpPrintingOptionParser(optparse.OptionParser):
+ def error(self, *args, **kargs):
+ self.print_help()
+ optparse.OptionParser.error(self, *args, **kargs)
+
+
+class ArgvExtender(object):
+ def __init__(self, appVersionInfo, args=None):
+ self.__appVersionInfo = appVersionInfo
+ self.__parser = HelpPrintingOptionParser()
+ self.__args = args
+ self.__parsedArgs = None
+
+ def __call__(self, optionsList):
+ self.__parser.add_option('-v', '--version', dest='version', action='store_true',
+ help='print libavg and application version information')
+
+ groups = self.__groupOptionsKeys(optionsList)
+
+ for group in sorted(groups):
+ parserGroup = optparse.OptionGroup(self.__parser,
+ '%s section' % group.title())
+
+ keys = sorted(groups[group])
+
+ for option in [option for option in optionsList if option.key in keys]:
+ cliKey = '--%s' % option.key.replace('_', '-').lower()
+ currentValue = option.value if option.value else '<undefined>'
+
+ help = '[Default: %s]' % currentValue
+
+ if option.help:
+ help = '%s %s' % (option.help, help)
+
+ parserGroup.add_option(cliKey, help=help)
+
+ self.__parser.add_option_group(parserGroup)
+
+ if self.__args is None:
+ self.__args = sys.argv[1:]
+
+ self.__parsedArgs = self.__parser.parse_args(args=self.__args)
+
+ parsedOptions = self.__parsedArgs[0]
+
+ if parsedOptions.version:
+ print 'libavg'
+ vi = libavg.VersionInfo()
+ print ' version : %s' % vi.full
+ print ' builder : %s (%s)' % (vi.builder, vi.buildtime)
+ print ' branchurl: %s' % vi.branchurl
+ print
+ print 'application'
+ print ' version: %s' % self.__appVersionInfo
+ sys.exit(0)
+
+ for key, value in parsedOptions.__dict__.iteritems():
+ if value is not None:
+ for option in optionsList:
+ if option.key == key:
+ option.value = value
+
+ return optionsList
+
+ @property
+ def parsedArgs(self):
+ if self.__parsedArgs is None:
+ raise RuntimeError('Cannot provide parsedArgs before applying the extender')
+
+ return self.__parsedArgs
+
+ @property
+ def parser(self):
+ return self.__parser
+
+ def __groupOptionsKeys(self, optionsList):
+ groups = {}
+ for option in optionsList:
+ if not option.group in groups:
+ groups[option.group] = []
+
+ groups[option.group].append(option.key)
+
+ return groups
+
+
+class Settings(object):
+ def __init__(self, defaults=[]):
+ if (type(defaults) not in (tuple, list) or
+ not all([isinstance(opt, Option) for opt in defaults])):
+ raise ValueError('Settings must be initialized with a list '
+ 'of Option instances')
+
+ self.__options = []
+
+ for option in defaults:
+ self.addOption(option)
+
+ def __iter__(self):
+ return self.__options.__iter__()
+
+ def applyExtender(self, extender):
+ self.__options = extender(self.__options)
+
+ def hasOption(self, key):
+ return self.__getOptionOrNone(key) is not None
+
+ def getOption(self, key):
+ option = self.__getOptionOrNone(key)
+
+ if option is None:
+ raise RuntimeError('Cannot find key %s in the settings' % key)
+
+ return option
+
+ def get(self, key, convertFunc=lambda v: v):
+ option = self.getOption(key)
+
+ try:
+ return convertFunc(option.value)
+ except (TypeError, ValueError), e:
+ raise ValueError('%s (option=%s)' % (e, option))
+
+ def getJson(self, key):
+ import json
+
+ return self.get(key, json.loads)
+
+ def getPoint2D(self, key):
+ value = self.get(key)
+ maybeTuple = re.split(r'\s*[,xX]\s*', value)
+
+ if len(maybeTuple) != 2:
+ raise ValueError('Cannot convert key %s value %s to Point2D' % (key, value))
+
+ return libavg.Point2D(map(float, maybeTuple))
+
+ def getInt(self, key):
+ return self.get(key, int)
+
+ def getFloat(self, key):
+ return self.get(key, float)
+
+ def getBoolean(self, key):
+ value = self.get(key).lower()
+
+ if value in ('yes', 'true'):
+ return True
+ elif value in ('no', 'false'):
+ return False
+ else:
+ raise ValueError('Cannot convert %s to boolean' % value)
+
+ def set(self, key, value):
+ option = self.getOption(key)
+ option.value = value
+
+ def addOption(self, option):
+ if not isinstance(option, Option):
+ raise TypeError('Must be an instance of Option')
+
+ if self.__getOptionOrNone(option.key):
+ raise RuntimeError('Option %s has been already defined' % option.key)
+
+ self.__options.append(option)
+
+ def __getOptionOrNone(self, key):
+ for option in self.__options:
+ if option.key == key:
+ return option
+
+ return None
+
+
diff --git a/src/python/app/touchvisualization.py b/src/python/app/touchvisualization.py
new file mode 100644
index 0000000..7953b02
--- /dev/null
+++ b/src/python/app/touchvisualization.py
@@ -0,0 +1,188 @@
+# 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
+#
+
+import os
+
+from libavg import avg, player
+
+
+class BaseTouchVisualization(avg.DivNode):
+
+ def __init__(self, event, parent=None, **kwargs):
+ avg.DivNode.__init__(self, **kwargs)
+ self.registerInstance(self, parent)
+
+ event.contact.subscribe(avg.Contact.CURSOR_MOTION, self._onMotion)
+ event.contact.subscribe(avg.Contact.CURSOR_UP, self._onUp)
+ self.pos = avg.Point2D(event.pos)
+ self._fingerSize = 7*player.getPixelsPerMM() # Assume 14mm width for a finger.
+ self._radius = self._getRadius(event)
+
+ def _abort(self):
+ self.unlink(True)
+ del self
+
+ def _onMotion(self, event):
+ self.pos = event.pos
+ self._radius = self._getRadius(event)
+
+ def _onUp(self, event):
+ self.unlink(True)
+ del self
+
+ def _getRadius(self, event):
+ if event.source in [avg.Event.MOUSE]:
+ return self._fingerSize
+ else:
+ return max(self._fingerSize, event.majoraxis.getNorm())
+
+
+
+class DebugTouchVisualization(BaseTouchVisualization):
+
+ def __init__(self, event, **kwargs):
+ BaseTouchVisualization.__init__(self, event, **kwargs)
+ self.positions = [event.pos]
+
+ if event.source == avg.Event.TOUCH:
+ color = 'e5d8d8'
+ else:
+ color = 'd8e5e5'
+ self.opacity = 0.5
+
+ self.__transparentCircle = avg.CircleNode(r=self._radius+20, fillcolor=color,
+ fillopacity=0.2, opacity=0.0, strokewidth=1, sensitive=False, parent=self)
+ self.__pulsecircle = avg.CircleNode(r=self._radius, fillcolor=color, color=color,
+ fillopacity=0.5, opacity=0.5, strokewidth=1,
+ sensitive=False, parent=self)
+ if event.source in [avg.Event.TOUCH, avg.Event.TRACK]:
+ self.__majorAxis = avg.LineNode(pos1=(0,0), pos2=event.majoraxis,
+ color='FFFFFF', sensitive=False, parent=self)
+ self.__minorAxis = avg.LineNode(pos1=(0,0), pos2=event.minoraxis,
+ color='FFFFFF', sensitive=False, parent=self)
+ if event.source == avg.Event.TOUCH:
+ self.__handAxis = avg.LineNode(pos1=(0,0), pos2=self.__getHandVector(event),
+ opacity=0.5, color='A0FFA0', sensitive=False, parent=self)
+ fontPos = avg.Point2D(self.__pulsecircle.r, 0)
+
+ if event.cursorid == -1:
+ text = 'MOUSE'
+ else:
+ text = '%s %d' % (event.source, event.cursorid)
+ avg.WordsNode(pos=fontPos, text=text, fontsize=9, parent=self)
+ self.motionPath = avg.PolyLineNode(pos=self.positions,
+ opacity=0.7, color=color, parent=kwargs['parent'])
+ self.motionVector = avg.LineNode(pos1=(0,0) , pos2=-event.contact.motionvec,
+ opacity=0.4, parent=self)
+ pulseCircleAnim = avg.LinearAnim(self.__pulsecircle, 'r', 200, 50, self._radius)
+ pulseCircleAnim.start()
+
+ def unlink(self, kill=True):
+ if self.motionPath:
+ self.motionPath.unlink(True)
+ super(DebugTouchVisualization, self).unlink(kill)
+
+ def _onMotion(self, event):
+ BaseTouchVisualization._onMotion(self, event)
+ self.positions.append(event.pos)
+ if len(self.positions) > 100:
+ self.positions.pop(0)
+
+ self.__pulsecircle.r = self._radius
+ self.setAxisSecondPos(event)
+ self.motionVector.pos2 = -event.contact.motionvec
+ if event.source == avg.Event.TOUCH:
+ self.__handAxis.pos2 = self.__getHandVector(event)
+ self.motionPath.pos = self.positions
+
+ def __getHandVector(self, event):
+ return -avg.Point2D.fromPolar(event.handorientation, 30)
+
+ def setAxisSecondPos(self, event):
+ if event.source not in [avg.Event.MOUSE]:
+ self.__majorAxis.pos2 = event.majoraxis
+ self.__minorAxis.pos2 = event.minoraxis
+
+
+class TouchVisualization(BaseTouchVisualization):
+
+ mediadir = os.path.join(os.path.dirname(__file__), os.path.pardir, 'data')
+ sources = [avg.Event.TOUCH]
+ bmp = avg.Bitmap(mediadir+"/TouchFeedback.png")
+
+ def __init__(self, event, **kwargs):
+ BaseTouchVisualization.__init__(self, event, **kwargs)
+
+ if event.source in self.sources:
+ self.__circle = avg.ImageNode(parent=self)
+ self.__circle.setBitmap(self.bmp)
+ self.__setRadius(self._radius)
+ avg.LinearAnim(self.__circle, "opacity", 200, 0.7, 0.4).start()
+ else:
+ self.unlink(True)
+ self._abort()
+
+ def _onMotion(self, event):
+ BaseTouchVisualization._onMotion(self, event)
+ self.__setRadius(self._radius)
+
+ def _onUp(self, event):
+
+ def gone(self):
+ BaseTouchVisualization._onUp(self, event)
+ self.unlink(True)
+ del self
+
+ avg.fadeIn(self.__circle, 100, 1)
+ avg.LinearAnim(self.__circle, "size", 100, self.__circle.size, (4,4)).start()
+ avg.LinearAnim(self.__circle, "pos", 100, self.__circle.pos, (-2,-2)).start()
+ player.setTimeout(100, lambda: gone(self))
+
+ def __setRadius(self, radius):
+ self.__circle.pos = (-radius, -radius)
+ self.__circle.size = (radius*2,radius*2)
+
+
+class TouchVisualizationOverlay(avg.DivNode):
+ def __init__(self, isDebug, visClass, rootNode=None, parent=None,
+ **kwargs):
+ super(TouchVisualizationOverlay, self).__init__(**kwargs)
+ self.registerInstance(self, parent)
+
+ self.sensitive = False
+ self.visClass = visClass
+ if rootNode is None:
+ rootNode = player.getRootNode()
+
+ if isDebug:
+ self.elementoutlinecolor='FFFFAA'
+ avg.RectNode(parent=self, size=self.size, fillopacity=0.2, fillcolor='000000')
+ rootNode.subscribe(avg.Node.CURSOR_DOWN, self.__onTouchDown)
+ rootNode.subscribe(avg.Node.HOVER_DOWN, self.__onTouchDown)
+
+ def unlink(self, kill=True):
+ rootNode = player.getRootNode()
+ if rootNode:
+ rootNode.unsubscribe(avg.Node.CURSOR_DOWN, self.__onTouchDown)
+ rootNode.unsubscribe(avg.Node.HOVER_DOWN, self.__onTouchDown)
+ super(TouchVisualizationOverlay, self).unlink(kill)
+
+ def __onTouchDown(self, event):
+ self.visClass(event, parent=self)
diff --git a/src/python/apphelpers.py b/src/python/apphelpers.py
index 65e9f1e..b23b69c 100644
--- a/src/python/apphelpers.py
+++ b/src/python/apphelpers.py
@@ -1,5 +1,5 @@
# libavg - Media Playback Engine.
-# Copyright (C) 2003-2011 Ulrich von Zadow
+# 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
@@ -20,151 +20,16 @@
import os
-from libavg import avg
+from libavg import avg, player
-g_Player = avg.Player.get()
-
-
-class BaseTouchVisualization(avg.DivNode):
-
- def __init__(self, event, **kwargs):
- avg.DivNode.__init__(self, **kwargs)
- self.contact = event.contact
- self.listenerid = event.contact.connectListener(self._onMotion, self._onUp)
- self.pos = avg.Point2D(event.pos)
- self._fingerSize = 7*g_Player.getPixelsPerMM() # Assume 14mm width for a finger.
- self._radius = max(self._fingerSize, event.majoraxis.getNorm())
-
- def _abort(self):
- self.contact.disconnectListener(self.listenerid)
- self.contact = None
-
- def _onMotion(self, event):
- self.pos = event.pos
- self._radius = max(self._fingerSize, event.majoraxis.getNorm())
-
- def _onUp(self, event):
- self.unlink(True)
- self.contact = None
- del self
-
-
-class DebugTouchVisualization(BaseTouchVisualization):
-
- def __init__(self, event, **kwargs):
- BaseTouchVisualization.__init__(self, event, **kwargs)
- self.positions = [event.pos]
-
- if event.source == avg.TOUCH:
- color = 'e5d8d8'
- else:
- color = 'd8e5e5'
- self.opacity = 0.5
-
- self.__transparentCircle = avg.CircleNode(r=self._radius+20, fillcolor=color,
- fillopacity=0.2, opacity=0.0, strokewidth=1, sensitive=False, parent=self)
- self.__pulsecircle = avg.CircleNode(r=self._radius, fillcolor=color, color=color,
- fillopacity=0.5, opacity=0.5, strokewidth=1,
- sensitive=False, parent=self)
- self.__majorAxis = avg.LineNode(pos1=(0,0), pos2=event.majoraxis,
- color='FFFFFF', sensitive=False, parent=self)
- self.__minorAxis = avg.LineNode(pos1=(0,0), pos2=event.minoraxis,
- color='FFFFFF', sensitive=False, parent=self)
- if event.source == avg.TOUCH:
- self.__handAxis = avg.LineNode(pos1=(0,0), pos2=self.__getHandVector(event),
- opacity=0.5, color='A0FFA0', sensitive=False, parent=self)
- fontPos = avg.Point2D(self.__pulsecircle.r, 0)
- avg.WordsNode(pos=fontPos, text=str(event.cursorid), parent=self)
- self.motionPath = avg.PolyLineNode(pos=self.positions,
- opacity=0.7, color=color, parent=kwargs['parent'])
- self.motionVector = avg.LineNode(pos1=(0,0) , pos2=-event.contact.motionvec,
- opacity=0.4, parent=self)
- pulseCircleAnim = avg.LinearAnim(self.__pulsecircle, 'r', 200, 50, self._radius)
- pulseCircleAnim.start()
-
- def __del__(self):
- self.motionPath.unlink(True)
-
- def _onMotion(self, event):
- BaseTouchVisualization._onMotion(self, event)
- self.positions.append(event.pos)
- if len(self.positions) > 100:
- self.positions.pop(0)
-
- self.__pulsecircle.r = self._radius
- self.__majorAxis.pos2 = event.majoraxis
- self.__minorAxis.pos2 = event.minoraxis
- self.motionVector.pos2 = -event.contact.motionvec
- if event.source == avg.TOUCH:
- self.__handAxis.pos2 = self.__getHandVector(event)
- self.motionPath.pos = self.positions
-
- def __getHandVector(self, event):
- return -avg.Point2D.fromPolar(event.handorientation, 30)
-
-
-class TouchVisualization(BaseTouchVisualization):
-
- mediadir = os.path.join(os.path.dirname(__file__), 'data')
- bmp = avg.Bitmap(mediadir+"/TouchFeedback.png")
-
- def __init__(self, event, **kwargs):
- BaseTouchVisualization.__init__(self, event, **kwargs)
-
- if event.source == avg.TOUCH:
- self.__circle = avg.ImageNode(parent=self)
- self.__circle.setBitmap(TouchVisualization.bmp)
- self.__setRadius(self._radius)
- avg.LinearAnim(self.__circle, "opacity", 200, 0.7, 0.4).start()
- else:
- self.unlink(True)
- self._abort()
-
- def _onMotion(self, event):
- BaseTouchVisualization._onMotion(self, event)
- self.__setRadius(self._radius)
-
- def _onUp(self, event):
-
- def gone(self):
- BaseTouchVisualization._onUp(self, event)
- self.unlink(True)
- del self
-
- avg.fadeIn(self.__circle, 100, 1)
- avg.LinearAnim(self.__circle, "size", 100, self.__circle.size, (4,4)).start()
- avg.LinearAnim(self.__circle, "pos", 100, self.__circle.pos, (-2,-2)).start()
- g_Player.setTimeout(100, lambda: gone(self))
-
- def __setRadius(self, radius):
- self.__circle.pos = (-radius, -radius)
- self.__circle.size = (radius*2,radius*2)
-
-
-class TouchVisualizationOverlay(avg.DivNode):
- def __init__(self, isDebug, visClass, **kwargs):
- super(TouchVisualizationOverlay, self).__init__(**kwargs)
- self.sensitive = False
- self.visClass = visClass
-
- rootNode = g_Player.getRootNode()
- if isDebug:
- self.elementoutlinecolor='FFFFAA'
- avg.RectNode(parent=self, size=self.size, fillopacity=0.2, fillcolor='000000')
- rootNode.connectEventHandler(avg.CURSORDOWN, avg.TOUCH | avg.TRACK,
- self, self.__onTouchDown)
-
- def deinit(self):
- rootNode = g_Player.getRootNode()
- rootNode.disconnectEventHandler(self, self.__onTouchDown)
-
- def __onTouchDown(self, event):
- self.visClass(event, parent=self)
+from app.touchvisualization import *
class KeysCaptionNode(avg.DivNode):
- def __init__(self, **kwargs):
+ def __init__(self, parent=None, **kwargs):
super(KeysCaptionNode, self).__init__(**kwargs)
+ self.registerInstance(self, parent)
+
self.sensitive = False
self.opacity = 0
@@ -277,14 +142,13 @@ class KeyboardManager(object):
return cls._instance
def setup(self, onKeyDownCb, onKeyUpCb):
- rootNode = g_Player.getRootNode()
- rootNode.setEventHandler(avg.KEYDOWN, avg.NONE, self.__onKeyDown)
- rootNode.setEventHandler(avg.KEYUP, avg.NONE, self.__onKeyUp)
+ player.subscribe(avg.Player.KEY_DOWN, self.__onKeyDown)
+ player.subscribe(avg.Player.KEY_UP, self.__onKeyUp)
self.__onKeyDownCb = onKeyDownCb
self.__onKeyUpCb = onKeyUpCb
- self.__keyCaptionsNode = KeysCaptionNode(pos=(5,5), parent=rootNode)
+ self.__keyCaptionsNode = KeysCaptionNode(pos=(5,5), parent=player.getRootNode())
def teardown(self):
self.__keyBindings = []
@@ -307,6 +171,10 @@ class KeyboardManager(object):
return self.__keyBindings
def bindKey(self, key, func, funcName, state='down'):
+ import warnings
+ warnings.warn('libavg.KeyboardManager is deprecated, use '
+ 'libavg.app.keyboardmanager instead')
+
if isinstance(key, unicode) and state != 'down':
raise RuntimeError('bindKey() with unicode keys '
'can be used only with state=down')
diff --git a/src/python/appstarter.py b/src/python/appstarter.py
index 89f8258..aca4fe0 100644
--- a/src/python/appstarter.py
+++ b/src/python/appstarter.py
@@ -1,5 +1,5 @@
# libavg - Media Playback Engine.
-# Copyright (C) 2003-2011 Ulrich von Zadow
+# 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
@@ -24,7 +24,7 @@ import os
import gc
import math
-from libavg import avg, Point2D
+from libavg import avg, Point2D, player
import graph
from mtemu import MTemu
import apphelpers
@@ -32,8 +32,6 @@ import apphelpers
DEFAULT_RESOLUTION = (640, 480)
-g_Player = avg.Player.get()
-g_Log = avg.Logger.get()
g_KbManager = apphelpers.KeyboardManager.get()
@@ -41,6 +39,7 @@ class AppStarter(object):
'''Starts an AVGApp'''
def __init__(self, appClass, resolution=DEFAULT_RESOLUTION,
debugWindowSize=None, fakeFullscreen=False):
+
resolution = Point2D(resolution)
testMode = not 'AVG_DEPLOY' in os.environ
@@ -49,10 +48,6 @@ class AppStarter(object):
else:
debugWindowSize = Point2D(0, 0)
- self._setupBaseDivs(resolution)
-
- g_Player.showCursor(testMode)
-
if fakeFullscreen:
if os.name != 'nt':
raise RuntimeError('Fakefullscreen is supported only on windows')
@@ -63,7 +58,11 @@ class AppStarter(object):
else:
fullscreen = not testMode
- g_Player.setResolution(
+ player.enableMouse(not 'AVG_DISABLE_MOUSE' in os.environ)
+ player.showCursor(testMode)
+ self._setupBaseDivs(resolution)
+
+ player.setResolution(
fullscreen,
int(debugWindowSize.x), int(debugWindowSize.y),
0 # color depth
@@ -73,7 +72,7 @@ class AppStarter(object):
def _startApp(self, appClass):
self._onBeforePlay()
- g_Player.setTimeout(0, self._onStart)
+ player.setTimeout(0, self._onStart)
self._appInstance = appClass(self._appNode)
g_KbManager.setup(
self._appInstance.onKeyDown,
@@ -82,18 +81,18 @@ class AppStarter(object):
self._setupDefaultKeys()
self._appInstance.setStarter(self)
- g_Player.play()
+ player.play()
self._appInstance.exit()
g_KbManager.teardown()
-
+
def _setupBaseDivs(self, resolution):
- g_Player.loadString('''
+ player.loadString('''
<?xml version="1.0"?>
<!DOCTYPE avg SYSTEM "../../libavg/doc/avg.dtd">
<avg width="%s" height="%s">
</avg>''' % (resolution.x, resolution.y))
- rootNode = g_Player.getRootNode()
+ rootNode = player.getRootNode()
self._appNode = avg.DivNode(opacity=0, sensitive=False,
size=rootNode.size, parent=rootNode)
@@ -111,16 +110,17 @@ class AppStarter(object):
self._appInstance.enter()
def __enableFakeFullscreen(self):
- g_Player.setWindowPos(0, 0)
- g_Player.setWindowFrame(False)
+ player.setWindowPos(0, 0)
+ player.setWindowFrame(False)
class AVGAppStarter(AppStarter):
def __init__(self, *args, **kwargs):
- self.__graphs = 0
+ self.__graphs = []
self._mtEmu = None
- self.__showingMemGraph = False
- self.__showingFrGraph = False
+ self.__memGraph = None
+ self.__vidMemGraph = None
+ self.__frGraph = None
self.__notifyNode = None
self.__debugTouchVisOverlay = None
@@ -129,48 +129,73 @@ class AVGAppStarter(AppStarter):
def _setupDefaultKeys(self):
super(AVGAppStarter, self)._setupDefaultKeys()
g_KbManager.bindKey('o', self.__dumpObjects, 'Dump objects')
- g_KbManager.bindKey('m', self.showMemoryUsage, 'Show memory usage')
- g_KbManager.bindKey('f', self.showFrameRate, 'Show frameTime usage')
+ g_KbManager.bindKey('m', self.showMemoryUsage, 'Show memory usage graph')
+
+ g_KbManager.bindKey('f', self.showFrameRate, 'Show framerate graph')
g_KbManager.bindKey('t', self.__switchMtemu, 'Activate multitouch emulation')
g_KbManager.bindKey('e', self.__switchShowMTEvents, 'Show multitouch events')
g_KbManager.bindKey('s', self.__screenshot, 'Take screenshot')
-
+
+ def _onStart(self):
+ try:
+ player.getVideoMemUsed()
+ g_KbManager.bindKey('v', self.showVideoMemoryUsage,
+ 'Show video memory usage graph')
+ except RuntimeError:
+ # Video memory query not supported.
+ pass
+
+ AppStarter._onStart(self)
+
def __dumpObjects(self):
gc.collect()
- testHelper = g_Player.getTestHelper()
+ testHelper = player.getTestHelper()
testHelper.dumpObjects()
print 'Num anims: ', avg.getNumRunningAnims()
print 'Num python objects: ', len(gc.get_objects())
def showMemoryUsage(self):
- if self.__showingMemGraph:
- self.__memGraph.delete()
+ if self.__memGraph:
+ self.__memGraph.unlink(True)
+ self.__graphs.remove(self.__memGraph)
self.__memGraph = None
- self.__graphs = self.__graphs -1
- if(self.__graphs == 1 ):
- self.__frGraph.setYpos(10)
else:
- self.__memGraph = graph.MemGraph('Memory Graph',
- getValue = avg.getMemoryUsage)
- self.__graphs = self.__graphs +1
- if(self.__graphs > 1 ):
- self.__memGraph.setYpos(190)
- self.__showingMemGraph = not(self.__showingMemGraph)
+ size = (self._appNode.width, self._appNode.height/6.0)
+ self.__memGraph = graph.AveragingGraph(title = 'Memory Usage',
+ getValue = avg.getMemoryUsage, parent=player.getRootNode(), size=size)
+ self.__graphs.append(self.__memGraph)
+ self.__positionGraphs()
+
+ def showVideoMemoryUsage(self):
+ if self.__vidMemGraph:
+ self.__vidMemGraph.unlink(True)
+ self.__graphs.remove(self.__vidMemGraph)
+ self.__vidMemGraph = None
+ else:
+ size = (self._appNode.width, self._appNode.height/6.0)
+ self.__vidMemGraph = graph.AveragingGraph(title='Video Memory Usage',
+ getValue=player.getVideoMemUsed, parent=player.getRootNode(),
+ size=size)
+ self.__graphs.append(self.__vidMemGraph)
+ self.__positionGraphs()
def showFrameRate(self):
- if self.__showingFrGraph:
- self.__frGraph.delete()
+ if self.__frGraph:
+ self.__frGraph.unlink(True)
+ self.__graphs.remove(self.__frGraph)
self.__frGraph = None
- self.__graphs = self.__graphs -1
- if(self.__graphs == 1 ):
- self.__memGraph.setYpos(10)
else:
- self.__frGraph = graph.FrameRateGraph('FrameTime Graph',
- getValue = g_Player.getFrameTime)
- self.__graphs = self.__graphs +1
- if(self.__graphs >1):
- self.__frGraph.setYpos(190)
- self.__showingFrGraph = not(self.__showingFrGraph)
+ size = (self._appNode.width, self._appNode.height/6.0)
+ self.__frGraph = graph.SlidingGraph(title = 'Time per Frame',
+ getValue = player.getFrameTime, parent = self._appNode, size=size)
+ self.__graphs.append(self.__frGraph)
+ self.__positionGraphs()
+
+ def __positionGraphs(self):
+ ypos = 10
+ for gr in self.__graphs:
+ gr.y = ypos
+ ypos += gr.height + 10
def __switchMtemu(self):
if self._mtEmu is None:
@@ -195,12 +220,11 @@ class AVGAppStarter(AppStarter):
def __switchShowMTEvents(self):
if self.__debugTouchVisOverlay is None:
- rootNode = g_Player.getRootNode()
+ rootNode = player.getRootNode()
self.__debugTouchVisOverlay = apphelpers.TouchVisualizationOverlay(
isDebug=True, visClass=apphelpers.DebugTouchVisualization,
size=self._appNode.size, parent=rootNode)
else:
- self.__debugTouchVisOverlay.deinit()
self.__debugTouchVisOverlay.unlink(True)
del self.__debugTouchVisOverlay
self.__debugTouchVisOverlay = None
@@ -217,7 +241,7 @@ class AVGAppStarter(AppStarter):
fnum += 1
try:
- g_Player.screenshot().save('screenshot-%03d.png' % fnum)
+ player.screenshot().save('screenshot-%03d.png' % fnum)
except RuntimeError:
text = 'Cannot save snapshot file'
else:
@@ -226,11 +250,11 @@ class AVGAppStarter(AppStarter):
self.__killNotifyNode()
self.__notifyNode = avg.WordsNode(
- text=text, x=g_Player.getRootNode().width - 50,
- y=g_Player.getRootNode().height - 50, alignment='right', fontsize=20,
- sensitive=False, parent=g_Player.getRootNode())
+ text=text, x=player.getRootNode().width - 50,
+ y=player.getRootNode().height - 50, alignment='right', fontsize=20,
+ sensitive=False, parent=player.getRootNode())
- g_Player.setTimeout(2000, self.__killNotifyNode)
+ player.setTimeout(2000, self.__killNotifyNode)
class AVGMTAppStarter(AVGAppStarter):
@@ -241,14 +265,13 @@ class AVGMTAppStarter(AVGAppStarter):
def setTouchVisualization(self, visClass):
if not(self.__touchVisOverlay is None):
- self.__touchVisOverlay.deinit()
self.__touchVisOverlay.unlink(True)
del self.__touchVisOverlay
self.__touchVisOverlay = None
if not(visClass is None):
- rootNode = g_Player.getRootNode()
+ rootNode = player.getRootNode()
self.__touchVisOverlay = apphelpers.TouchVisualizationOverlay(
- isDebug=False, visClass=visClass, size=self._appNode.size,
+ isDebug=False, visClass=visClass, size=self._appNode.size,
parent=rootNode)
def toggleTrackerImage(self):
@@ -262,7 +285,7 @@ class AVGMTAppStarter(AVGAppStarter):
return
self.__showTrackerImage = True
self.__updateTrackerImageInterval = \
- g_Player.setOnFrameHandler(self.__updateTrackerImage)
+ player.subscribe(player.ON_FRAME, self.__updateTrackerImage)
self.__trackerImageNode.opacity = 1
self.tracker.setDebugImages(False, True)
@@ -271,7 +294,7 @@ class AVGMTAppStarter(AVGAppStarter):
return
self.__showTrackerImage = False
if self.__updateTrackerImageInterval:
- g_Player.clearInterval(self.__updateTrackerImageInterval)
+ player.clearInterval(self.__updateTrackerImageInterval)
self.__updateTrackerImageInterval = None
self.__trackerImageNode.opacity = 0
self.tracker.setDebugImages(False, False)
@@ -299,19 +322,19 @@ class AVGMTAppStarter(AVGAppStarter):
# we must add the tracker first, calibrator depends on it
try:
- g_Player.enableMultitouch()
+ player.enableMultitouch()
except RuntimeError, err:
- g_Log.trace(g_Log.WARNING, str(err))
+ avg.logger.warning(str(err))
- self.tracker = g_Player.getTracker()
+ self.tracker = player.getTracker()
if self.tracker:
if Calibrator:
- self.__calibratorNode = g_Player.createNode('div',{
+ self.__calibratorNode = player.createNode('div',{
'opacity': 0,
'active': False,
})
- rootNode = g_Player.getRootNode()
+ rootNode = player.getRootNode()
rootNode.appendChild(self.__calibratorNode)
self.__calibratorNode.size = rootNode.size
self.__calibrator = Calibrator(self.__calibratorNode, appStarter=self)
@@ -322,11 +345,11 @@ class AVGMTAppStarter(AVGAppStarter):
self.__showTrackerImage = False
self.__updateTrackerImageInterval = None
- self.__trackerImageNode = g_Player.createNode('image', {'sensitive': False})
- g_Player.getRootNode().appendChild(self.__trackerImageNode)
+ self.__trackerImageNode = player.createNode('image', {'sensitive': False})
+ player.getRootNode().appendChild(self.__trackerImageNode)
self.__updateTrackerImageFixup()
-
+
g_KbManager.bindKey('h', self.tracker.resetHistory, 'RESET tracker history')
g_KbManager.bindKey('d', self.toggleTrackerImage, 'toggle tracker image')
@@ -341,7 +364,7 @@ class AVGMTAppStarter(AVGAppStarter):
self.__trackerImageNode.angle = angle
self.trackerFlipX = (float(self.tracker.getParam('/transform/displayscale/@x'))
< 0)
- self.trackerFlipY = (float(self.tracker.getParam('/transform/displayscale/@y'))
+ self.trackerFlipY = (float(self.tracker.getParam('/transform/displayscale/@y'))
< 0)
def __onCalibrationSuccess(self):
@@ -352,7 +375,7 @@ class AVGMTAppStarter(AVGAppStarter):
def leaveCalibrator():
g_KbManager.unbindKey('e')
self._activeApp = self._appInstance
- self._appInstance.enter()
+ self._appInstance.enter()
self.__calibrator.leave()
self._appNode.opacity = 1
self._appNode.active = True
@@ -362,9 +385,9 @@ class AVGMTAppStarter(AVGAppStarter):
if self.__calibrator.isRunning():
print "calibrator already running!"
return
-
+
self._activeApp = self.__calibrator
- self.__calibrator.enter()
+ self.__calibrator.enter()
g_KbManager.bindKey('e', leaveCalibrator, 'leave Calibrator')
self._appInstance.leave()
self.__calibratorNode.opacity = 1
diff --git a/src/python/app.py b/src/python/avgapp.py
index 0961d90..5e3d4b3 100644
--- a/src/python/app.py
+++ b/src/python/avgapp.py
@@ -1,5 +1,5 @@
# libavg - Media Playback Engine.
-# Copyright (C) 2003-2011 Ulrich von Zadow
+# 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
@@ -20,14 +20,13 @@
# Original author of this file is Martin Heistermann <mh at sponc dot de>
#
-from libavg import avg
from appstarter import AppStarter
-g_Player = avg.Player.get()
-g_Log = avg.Logger.get()
-class App(object):
+class AVGApp(object):
_instances = {}
+ multitouch = False
+ fakeFullscreen = False
def __init__(self, parentNode):
'''
@@ -37,6 +36,9 @@ class App(object):
super(YourApp, self).__init__(parentNode)
'''
+ import warnings
+ warnings.warn('AVGApp is deprecated, use libavg.app.App instead')
+
appname = self.__class__.__name__
if appname in AVGApp._instances:
raise RuntimeError('App %s already setup' % appname)
@@ -65,8 +67,15 @@ class App(object):
return cls._instances.get(cls.__name__, None)
@classmethod
- def start(cls, appStarter=AppStarter, **kwargs):
- appStarter(appClass=cls, **kwargs)
+ def start(cls, **kwargs):
+ if cls.multitouch:
+ from appstarter import AVGMTAppStarter
+ starter = AVGMTAppStarter
+ else:
+ from appstarter import AVGAppStarter
+ starter = AVGAppStarter
+
+ starter(appClass=cls, fakeFullscreen=cls.fakeFullscreen, **kwargs)
def init(self):
"""main initialization
@@ -125,20 +134,9 @@ class App(object):
return self._starter
-class AVGApp(App):
- '''Backward compatibility class'''
- multitouch = False
- fakeFullscreen = False
-
+class App(object):
@classmethod
- def start(cls, **kwargs):
- # TODO: deprecation warning
- if cls.multitouch:
- from appstarter import AVGMTAppStarter
- starter = AVGMTAppStarter
- else:
- from appstarter import AVGAppStarter
- starter = AVGAppStarter
-
- super(AVGApp, cls).start(appStarter=starter,
- fakeFullscreen=cls.fakeFullscreen, **kwargs)
+ def start(cls, *args, **kargs):
+ raise RuntimeError('avgapp.App cannot be used any longer. Use libavg.AVGApp for '
+ 'a compatible class or switch to the new libavg.app.App')
+
diff --git a/src/python/camcalibrator.py b/src/python/camcalibrator.py
index 784048d..08bd308 100644
--- a/src/python/camcalibrator.py
+++ b/src/python/camcalibrator.py
@@ -1,5 +1,5 @@
# libavg - Media Playback Engine.
-# Copyright (C) 2003-2011 Ulrich von Zadow
+# 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
@@ -21,14 +21,12 @@
#
import sys, os
-from libavg import avg, AVGApp, AVGAppStarter
+from libavg import avg, AVGApp, player
import coordcalibrator
import apphelpers
mediadir = os.path.join(os.path.dirname(__file__), 'data')
-g_Player = avg.Player.get()
-g_Log = avg.Logger.get()
g_KbManager = apphelpers.KeyboardManager.get()
@@ -79,7 +77,7 @@ def camera_setup(CameraType):
'min':16, 'max':683, 'increment':2, 'precision':0},
]
else:
- g_Log.trace(g_Log.ERROR, "Unknown CameraType %s" % CameraType)
+ avg.logger.error("Unknown CameraType %s" % CameraType)
sys.exit()
paramList.extend([
@@ -165,7 +163,7 @@ class Calibrator(AVGApp):
self.paramList = camera_setup(CameraType)
self.parentNode=parentNode
self.appStarter = appStarter
- self.mainNode = g_Player.createNode(
+ self.mainNode = player.createNode(
"""
<div active="False" opacity="0">
<image width="1280" height="800" href="black.png"/>
@@ -173,69 +171,66 @@ class Calibrator(AVGApp):
sensitive="false" opacity="1"/>
<words id="cal_fps" x="30" y="30" color="00FF00" text=""/>
<words id="cal_notification" x="390" y="390" width="500" fontsize="18"
- font="Zurich Ex BT" color="ff3333" alignment="center" />
+ color="ff3333" alignment="center" />
<div id="cal_gui" x="30" y="540">
<image id="cal_shadow" x="0" y="13" width="500" height="150"
href="black.png" opacity="0.6"/>
- <words x="2" y="13" text="camera" fontsize="16" font="Zurich Ex BT"
- color="00FF00"/>
+ <words x="2" y="13" text="camera" fontsize="16" color="00FF00"/>
<image x="2" y="32" href="CamImgBorder.png"/>
<image id="cal_camera" x="4" y="34" width="160" height="120"/>
- <words x="168" y="13" text="nohistory" fontsize="16" font="Zurich Ex BT"
- color="00FF00"/>
+ <words x="168" y="13" text="nohistory" fontsize="16" color="00FF00"/>
<image x="168" y="32" href="CamImgBorder.png"/>
<image id="cal_nohistory" x="170" y="34" width="160" height="120"/>
- <words x="334" y="13" text="histogram" fontsize="16" font="Zurich Ex BT"
- color="00FF00"/>
+ <words x="334" y="13" text="histogram" fontsize="16" color="00FF00"/>
<image x="334" y="32" href="CamImgBorder.png"/>
<image id="cal_histogram" x="336" y="34" width="160" height="120"/>
<div id="cal_params" y="170" opacity="0.9">
<image id="cal_shadow2" width="750" height="65" href="black.png" opacity="0.6"/>
<div id="cal_paramdiv0" x="2">
- <words text="camera" y="0" fontsize="10" font="Zurich Ex BT" color="00ff00" />
- <words id="cal_param0" y="12" fontsize="10" font="Zurich Ex BT" />
- <words id="cal_param1" y="24" fontsize="10" font="Zurich Ex BT" />
- <words id="cal_param2" y="36" fontsize="10" font="Zurich Ex BT" />
- <words id="cal_param3" y="48" fontsize="10" font="Zurich Ex BT" />
+ <words text="camera" y="0" fontsize="10" color="00ff00" />
+ <words id="cal_param0" y="12" fontsize="10"/>
+ <words id="cal_param1" y="24" fontsize="10"/>
+ <words id="cal_param2" y="36" fontsize="10"/>
+ <words id="cal_param3" y="48" fontsize="10"/>
</div>
<div id="cal_paramdiv1" x="80">
- <words text="touch" y="0" fontsize="10" font="Zurich Ex BT" color="00ff00" />
- <words id="cal_param4" y="12" fontsize="10" font="Zurich Ex BT" />
- <words id="cal_param5" y="24" fontsize="10" font="Zurich Ex BT" />
- <words id="cal_param6" y="36" fontsize="10" font="Zurich Ex BT" />
- <words id="cal_param7" y="48" fontsize="10" font="Zurich Ex BT" />
+ <words text="touch" y="0" fontsize="10" color="00ff00" />
+ <words id="cal_param4" y="12" fontsize="10"/>
+ <words id="cal_param5" y="24" fontsize="10"/>
+ <words id="cal_param6" y="36" fontsize="10"/>
+ <words id="cal_param7" y="48" fontsize="10"/>
</div>
<div id="cal_paramdiv2" x="200">
- <words id="cal_param8" y="0" fontsize="10" font="Zurich Ex BT" />
- <words id="cal_param9" y="12" fontsize="10" font="Zurich Ex BT" />
- <words id="cal_param10" y="24" fontsize="10" font="Zurich Ex BT" />
- <words id="cal_param11" y="36" fontsize="10" font="Zurich Ex BT" />
- <words id="cal_param12" y="48" fontsize="10" font="Zurich Ex BT" />
+ <words id="cal_param8" y="0" fontsize="10"/>
+ <words id="cal_param9" y="12" fontsize="10"/>
+ <words id="cal_param10" y="24" fontsize="10"/>
+ <words id="cal_param11" y="36" fontsize="10"/>
+ <words id="cal_param12" y="48" fontsize="10"/>
</div>
<div id="cal_paramdiv3" x="350">
- <words text="track" y="0" fontsize="10" font="Zurich Ex BT" color="00ff00" />
- <words id="cal_param13" y="12" fontsize="10" font="Zurich Ex BT" />
- <words id="cal_param14" y="24" fontsize="10" font="Zurich Ex BT" />
- <words id="cal_param15" y="36" fontsize="10" font="Zurich Ex BT" />
- <words id="cal_param16" y="48" fontsize="10" font="Zurich Ex BT" />
+ <words text="track" y="0" fontsize="10" color="00ff00" />
+ <words id="cal_param13" y="12" fontsize="10"/>
+ <words id="cal_param14" y="24" fontsize="10"/>
+ <words id="cal_param15" y="36" fontsize="10"/>
+ <words id="cal_param16" y="48" fontsize="10"/>
</div>
<div id="cal_paramdiv4" x="500">
- <words id="cal_param17" y="0" fontsize="10" font="Zurich Ex BT" />
- <words text="distort" y="12" fontsize="10" font="Zurich Ex BT" color="00ff00" />
- <words id="cal_param18" y="24" fontsize="10" font="Zurich Ex BT" />
- <words id="cal_param19" y="36" fontsize="10" font="Zurich Ex BT" />
- <words id="cal_param20" y="48" fontsize="10" font="Zurich Ex BT" />
+ <words id="cal_param17" y="0" fontsize="10"/>
+ <words text="distort" y="12" fontsize="10" color="00ff00"/>
+ <words id="cal_param18" y="24" fontsize="10"/>
+ <words id="cal_param19" y="36" fontsize="10"/>
+ <words id="cal_param20" y="48" fontsize="10"/>
</div>
<div id="cal_paramdiv5" x="650">
- <words id="cal_param21" y="0" fontsize="10" font="Zurich Ex BT" />
- <words id="cal_param22" y="12" fontsize="10" font="Zurich Ex BT" />
- <words id="cal_param23" y="24" fontsize="10" font="Zurich Ex BT" />
- <words id="cal_param24" y="36" fontsize="10" font="Zurich Ex BT" />
- <words id="cal_param25" y="48" fontsize="10" font="Zurich Ex BT" />
+ <words id="cal_param21" y="0" fontsize="10"/>
+ <words id="cal_param22" y="12" fontsize="10"/>
+ <words id="cal_param23" y="24" fontsize="10"/>
+ <words id="cal_param24" y="36" fontsize="10"/>
+ <words id="cal_param25" y="48" fontsize="10"/>
</div>
</div>
</div>
@@ -251,7 +246,7 @@ class Calibrator(AVGApp):
parentNode.insertChild(self.mainNode, 0)
self.coordCal = None
- self.tracker = g_Player.getTracker()
+ self.tracker = player.getTracker()
self.curParam = 0
self.saveIndex = 0
self.hideMainNodeTimeout = None
@@ -287,13 +282,13 @@ class Calibrator(AVGApp):
self.tracker.setDebugImages(True, True)
avg.fadeIn(self.mainNode, 400, 1)
Bitmap = self.tracker.getImage(avg.IMG_DISTORTED) # Why is this needed?
- self.__onFrameID=g_Player.setOnFrameHandler(self.__onFrame)
+ self.__onFrameID = player.subscribe(player.ON_FRAME, self.__onFrame)
#grandparent = self.parentNode.getParent()
#if grandparent:
# grandparent.reorderChild(grandparent.indexOf(self.parentNode), grandparent.getNumChildren()-1)
self.displayParams()
if self.hideMainNodeTimeout:
- g_Player.clearInterval(self.hideMainNodeTimeout)
+ player.clearInterval(self.hideMainNodeTimeout)
def _leave(self):
#unbind all calibrator keys - bind old keys
@@ -306,8 +301,8 @@ class Calibrator(AVGApp):
#grandparent = self.parentNode.getParent()
#if grandparent:
# grandparent.reorderChild(grandparent.indexOf(self.parentNode), 0)
- self.hideMainNodeTimeout = g_Player.setTimeout(400, hideMainNode)
- g_Player.clearInterval(self.__onFrameID)
+ self.hideMainNodeTimeout = player.setTimeout(400, hideMainNode)
+ player.clearInterval(self.__onFrameID)
def reparent(self, newParent):
"""reparents the calibrator node; returns the old(!) parent node"""
@@ -321,7 +316,7 @@ class Calibrator(AVGApp):
self.tracker.resetHistory()
self.setNotification('')
g_KbManager.pop()
- g_Player.getElementByID('cal_params').opacity = 0.9
+ player.getElementByID('cal_params').opacity = 0.9
def __clearNotification(self):
self.__notificationTimer = None
@@ -329,12 +324,12 @@ class Calibrator(AVGApp):
def __toggleGUI(self):
self.__guiOpacity = 1 - self.__guiOpacity
- g_Player.getElementByID('cal_gui').opacity = self.__guiOpacity
+ player.getElementByID('cal_gui').opacity = self.__guiOpacity
def __onFrame(self):
def showTrackerImage(trackerImageID, nodeID, size, pos=(0,0)):
bitmap = self.tracker.getImage(trackerImageID)
- node = g_Player.getElementByID(nodeID)
+ node = player.getElementByID(nodeID)
node.setBitmap(bitmap)
node.size = size
if pos != (0,0):
@@ -354,8 +349,8 @@ class Calibrator(AVGApp):
showTrackerImage(avg.IMG_CAMERA, "cal_camera", (160, 120))
showTrackerImage(avg.IMG_NOHISTORY, "cal_nohistory", (160, 120))
showTrackerImage(avg.IMG_HISTOGRAM, "cal_histogram", (160, 120))
- fps = g_Player.getEffectiveFramerate()
- g_Player.getElementByID("cal_fps").text = '%(val).2f' % {'val': fps}
+ fps = player.getEffectiveFramerate()
+ player.getElementByID("cal_fps").text = '%(val).2f' % {'val': fps}
def __trackerSetDebugImages(self):
self.appStarter.toggleTrackerImage()
@@ -394,7 +389,7 @@ class Calibrator(AVGApp):
def __trackerSaveConfig(self):
self.tracker.saveConfig()
self.setNotification('Tracker configuration saved', 2000)
- g_Log.trace(g_Log.APP, "Tracker configuration saved.")
+ avg.logger.info("Tracker configuration saved.")
def __saveTrackerIMG(self):
def saveTrackerImage(id, name):
@@ -408,7 +403,7 @@ class Calibrator(AVGApp):
saveTrackerImage(avg.IMG_FINGERS, "fingers")
saveTrackerImage(avg.IMG_HISTOGRAM, "histogram")
self.setNotification('Tracker images dumped', 2000)
- g_Log.trace(g_Log.APP, "Tracker images saved.")
+ avg.logger.info("Tracker images saved.")
def __startCoordCalibration(self):
assert(not self.coordCal)
@@ -432,24 +427,24 @@ class Calibrator(AVGApp):
self.__onCalibrationSuccess = callback
def deferredRefresh(self):
- g_Player.setTimeout(1500, self.__deferredRefreshCB)
+ player.setTimeout(1500, self.__deferredRefreshCB)
self.setNotification('Please wait for settlement')
g_KbManager.push()
- g_Player.getElementByID('cal_params').opacity = 0.3
+ player.getElementByID('cal_params').opacity = 0.3
def setNotification(self, text, timeout=0):
- g_Player.getElementByID('cal_notification').text = text
+ player.getElementByID('cal_notification').text = text
if timeout:
if self.__notificationTimer is not None:
- g_Player.clearInterval(self.__notificationTimer)
+ player.clearInterval(self.__notificationTimer)
- self.__notificationTimer = g_Player.setTimeout(timeout,
+ self.__notificationTimer = player.setTimeout(timeout,
self.__clearNotification)
def displayParams(self):
i = 0
for Param in self.paramList:
- Node = g_Player.getElementByID("cal_param"+str(i))
+ Node = player.getElementByID("cal_param"+str(i))
Path = Param['path']
Val = float(self.tracker.getParam(Path))
Node.text = (Param['Name']+": "
diff --git a/src/python/clusteredEventList.py b/src/python/clusteredEventList.py
deleted file mode 100644
index d75ac99..0000000
--- a/src/python/clusteredEventList.py
+++ /dev/null
@@ -1,257 +0,0 @@
-# libavg - Media Playback Engine.
-# Copyright (C) 2003-2011 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 Martin Heistermann <mh at sponc dot de>
-#
-
-from libavg import avg, Point2D
-from eventList import EventList, Cursor
-from mathutil import getDistSquared
-
-g_Log = avg.Logger.get()
-
-MAX_ITERATIONS=50
-
-class Centroid (Cursor):
- def __init__(self):
- super(Centroid, self).__init__()
- self.__members = []
-
- def isBroken(self):
- return len(self.__members)==0
-
- def reposition (self):
- if len(self.__members) == 0:
- return
- pointSum = Point2D(0,0)
- for point in self.__members:
- pointSum += point.getPos()
- center = pointSum / len(self.__members)
- oldPos = self._pos
- self.setPos(center)
- return oldPos != self._pos
-
- def removeMember (self, member):
- self.__members.remove(member)
- self.reposition()
- self.resetMotion()
-
- def addMember (self, member):
- self.__members.append(member)
- self.reposition()
- self.resetMotion()
-
- def hasMember (self, member):
- return member in self.__members
-
- def __len__(self):
- return len(self.__members)
-
- def __repr__(self):
- return "centroid at %s, startpos %s, members %s" % (self._pos, self._startPos, self.__members)
-
-
-class ClusteredEventList:
- """ implements a variant of k-means.
- same API as EventList, with the difference that ClusteredEventList
- will simulate a maximum of 2 cursors (if more actual cursors are
- on the node, they are clustered.
- In contrast to EventList, the callbacks provide no EventCursors.
- """
- def __init__(self,
- node,
- source,
- onDown = lambda x: None,
- onUp = lambda x: None,
- onMotion = lambda x: None,
- resetMotion = lambda: None,
- captureEvents = True):
- self.__centroids = []
- self.__centroidByEvent = {}
- self.__doNewMotion = False
-
- self.__callback = {
- 'onDown': onDown,
- 'onUp': onUp,
- 'onMotion': onMotion,
- 'resetMotion': resetMotion,
- }
- self.__eventList = EventList(
- node = node,
- source = source,
- onDown = self.__onDown,
- onUp = self.__onUp,
- onMotion = self.__onMotion,
- resetMotion = self.__resetMotion,
- captureEvents = captureEvents)
-
- def handleInitialDown(self,event):
- self.__eventList.handleInitialDown(event)
-
- def __onDown(self, eventCursor):
- #self.__callback['onDown'](eventCursor)
- centroids = list(self.__centroids) # copy
- self.calcClusters()
- self.__resetMotion()
- if len(centroids) != len(self.__centroids):
- if len(centroids) and self.__centroids[0] == centroids[0]:
- newCentroid = self.__centroids[1]
- else:
- newCentroid = self.__centroids[0]
- self.__callback['onDown']()
-
- def __onUp(self, eventCursor):
- assert eventCursor in self.__centroidByEvent
- centroid = self.__centroidByEvent[eventCursor]
- centroid.removeMember(eventCursor)
- del self.__centroidByEvent[eventCursor]
-
- self.calcClusters()
- self.__resetMotion()
-
- if len(centroid) == 0:
- self.__callback['onUp']()
-
- def __onMotion(self, eventCursor):
- oldPositions = {}
- for centroid in self.__centroids:
- oldPositions[centroid] = centroid.getPos()
- self.calcClusters()
- self.__callback['onMotion']()
-
- def __resetMotion(self):
- for centroid in self.__centroids:
- centroid.resetMotion()
- self.__callback['resetMotion']()
-
- def delete(self):
- self.__centroids = []
- self.__centroidByEvent = {}
- self.__eventList.delete()
- self.__callback = {
- 'onDown': lambda x: None,
- 'onUp': lambda x: None,
- 'onMotion': lambda x: None,
- 'resetMotion': lambda x: None,
- }
-
- def __calcMemberships (self):
- """ returns True if a membership changed, else False."""
- changed = False
- if not len(self.__centroids):
- return changed
- for point in self.__eventList.getCursors():
- closestCentroid = self.__centroids[0]
- minDist = getDistSquared(point.getPos(), closestCentroid.getPos())
- for centroid in self.__centroids:
- distance = getDistSquared (point.getPos(), centroid.getPos())
- if distance < minDist:
- minDist = distance
- closestCentroid = centroid
- if not closestCentroid.hasMember(point):
- self.__doNewMotion = True
- if point in self.__centroidByEvent:
- self.__centroidByEvent[point].removeMember(point)
- self.__centroidByEvent[point] = closestCentroid
- closestCentroid.addMember(point)
- changed = True
- return changed
-
- def __tryCalcClusters (self):
- def __calcInitialCentroids():
- self.__centroidByEvent = {}
- self.__centroids = []
- def createCentroid(point):
- centroid = Centroid()
- centroid.addMember(point)
- self.__centroidByEvent[point] = centroid
- self.__centroids.append(centroid)
-
- maxDist = 0
- points = None
- if len(self.__eventList)>1:
- cursors = self.__eventList.getCursors()
- for p in cursors:
- for q in cursors:
- dist = getDistSquared(p.getPos(),q.getPos())
- if dist >= maxDist and p != q:
- points = p,q
- maxDist = dist
-
- assert(points)
- for point in points:
- createCentroid(point)
- elif len(self.__eventList) == 1:
- createCentroid(self.__eventList.getCursors()[0])
-
- def __setCentroids():
- changed = False
- for centroid in self.__centroids:
- if centroid.reposition():
- changed = True
- return changed
-
- if not len(self.__centroids):
- __calcInitialCentroids()
- self.__calcMemberships()
-
- changed = True
- iterations = 0
- while changed:
- changed = False
- if __setCentroids():
- changed = True
- if self.__calcMemberships():
- changed = True
- iterations+=1
- if iterations>MAX_ITERATIONS:
- #print "too many iterations(%u), aborting" % iterations
- __setCentroids()
- break
-
- def calcClusters (self):
- def __hasBrokenCentroids():
- if len(self.__eventList)>1 and len(self.__centroids)!=2:
- return True
- for centroid in self.__centroids:
- if centroid.isBroken():
- return True
- if len(self.__centroids)==2:
- if self.__centroids[0].getPos() == self.__centroids[1].getPos():
- return True
- return False
-
- self.__tryCalcClusters()
-
- if __hasBrokenCentroids():
- self.__centroids=[]
- self.__tryCalcClusters()
-# if __hasBrokenCentroids():
-# g_Log.trace(g_Log.APP,
-# "Cannot fix broken centroids: %s" % self.__centroids)
- if self.__doNewMotion:
- self.__doNewMotion = False
- self.__resetMotion()
-
- def getCursors (self):
- return self.__centroids
-
- def __len__(self):
- return min(len(self.__eventList), len(self.__centroids))
-
diff --git a/src/python/coordcalibrator.py b/src/python/coordcalibrator.py
index 8dda84b..c3dad01 100644
--- a/src/python/coordcalibrator.py
+++ b/src/python/coordcalibrator.py
@@ -1,5 +1,5 @@
# libavg - Media Playback Engine.
-# Copyright (C) 2003-2011 Ulrich von Zadow
+# 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
@@ -16,33 +16,32 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# Current versions can be found at www.libavg.de
-#
-# Released with permission from Archimedes-Solutions GmbH
-from libavg import avg
+from libavg import avg, player
import apphelpers
g_KbManager = apphelpers.KeyboardManager.get()
-g_Player = avg.Player.get()
-class CoordCalibrator:
+class CoordCalibrator(object):
def __init__(self, calibrationTerminatedCb):
self.__calibrationTerminatedCb = calibrationTerminatedCb
self.__CurPointIndex = 0
- self.__CPPCal = g_Player.getTracker().startCalibration()
+ self.__CPPCal = player.getTracker().startCalibration()
self.__LastCenter = None
self.__NumMessages = 0
self._mycursor = None
- mainNode = g_Player.getElementByID("cal_coordcalibrator")
+ mainNode = player.getElementByID("cal_coordcalibrator")
mainNode.active = True
mainNode.opacity = 1
- mainNode.setEventHandler(avg.CURSORDOWN, avg.TOUCH, self.__onTouchDown)
- mainNode.setEventHandler(avg.CURSORMOTION, avg.TOUCH, self.__onTouchMove)
- mainNode.setEventHandler(avg.CURSORUP, avg.TOUCH, self.__onTouchUp)
- self.__crosshair = g_Player.getElementByID("cal_crosshair")
- self.__feedback = g_Player.getElementByID("cal_feedback")
+ mainNode.setEventHandler(avg.Event.CURSOR_DOWN, avg.Event.TOUCH,
+ self.__onTouchDown)
+ mainNode.setEventHandler(avg.Event.CURSOR_MOTION, avg.Event.TOUCH,
+ self.__onTouchMove)
+ mainNode.setEventHandler(avg.Event.CURSOR_UP, avg.Event.TOUCH, self.__onTouchUp)
+ self.__crosshair = player.getElementByID("cal_crosshair")
+ self.__feedback = player.getElementByID("cal_feedback")
self.__feedback.opacity = 0
self.__addMessage("Starting calibration.")
self.__moveMarker()
@@ -52,9 +51,9 @@ class CoordCalibrator:
g_KbManager.bindKey('a', self.__abortCalibration, 'abort calibration')
def __endCalibration(self, isSuccessful):
- g_Player.getElementByID("cal_coordcalibrator").active = False
- g_Player.getElementByID("cal_coordcalibrator").opacity = 0
- MsgsNode = g_Player.getElementByID("cal_messages")
+ player.getElementByID("cal_coordcalibrator").active = False
+ player.getElementByID("cal_coordcalibrator").opacity = 0
+ MsgsNode = player.getElementByID("cal_messages")
for i in range(0, MsgsNode.getNumChildren()):
MsgsNode.removeChild(0)
@@ -74,14 +73,14 @@ class CoordCalibrator:
if not hasNextPoint:
# Note: may raise RuntimeError. A rollback doesn't appear to be possible,
# which means crashing here is safer than handling the exception
- g_Player.getTracker().endCalibration()
+ player.getTracker().endCalibration()
self.__endCalibration(True)
else:
self.__CurPointIndex += 1
self.__moveMarker()
def __abortCalibration(self):
- g_Player.getTracker().abortCalibration()
+ player.getTracker().abortCalibration()
self.__endCalibration(False)
def __moveMarker(self):
@@ -91,14 +90,14 @@ class CoordCalibrator:
self.__addMessage("Calibrating point "+str(self.__CurPointIndex))
def __addMessage(self, text):
- MsgsNode = g_Player.getElementByID("cal_messages")
+ MsgsNode = player.getElementByID("cal_messages")
if self.__NumMessages > 38:
for i in range(0, MsgsNode.getNumChildren()-1):
MsgsNode.getChild(i).text = MsgsNode.getChild(i+1).text
MsgsNode.removeChild(MsgsNode.getNumChildren()-1)
else:
self.__NumMessages += 1
- Node = g_Player.createNode(
+ Node = player.createNode(
"<words fontsize='10' font='Eurostile' color='00FF00'/>")
Node.x = 0
Node.y = self.__NumMessages*13
@@ -106,7 +105,7 @@ class CoordCalibrator:
MsgsNode.appendChild(Node)
def __onTouchDown(self, Event):
- if Event.source != avg.TOUCH:
+ if Event.source != avg.Event.TOUCH:
return
if not self._mycursor:
self._mycursor = Event.cursorid
@@ -118,13 +117,13 @@ class CoordCalibrator:
self.__feedback.opacity = 1
def __onTouchMove(self,Event):
- if Event.source != avg.TOUCH:
+ if Event.source != avg.Event.TOUCH:
return
if self._mycursor == Event.cursorid:
self.__LastCenter = Event.center
def __onTouchUp(self, Event):
- if Event.source != avg.TOUCH:
+ if Event.source != avg.Event.TOUCH:
return
self.__addMessage("touchup")
self.__feedback.opacity = 0
diff --git a/src/python/data/Makefile.am b/src/python/data/Makefile.am
index c0496ed..02a416a 100644
--- a/src/python/data/Makefile.am
+++ b/src/python/data/Makefile.am
@@ -1,4 +1,4 @@
-EXTRA_DIST = $(wildcard *.png) $(wildcard *.avg)
+EXTRA_DIST = $(wildcard *.xml) $(wildcard *.xsd) $(wildcard *.png) $(wildcard *.avg) \
+ $(wildcard *.mpg) $(wildcard *.avi) $(wildcard *.mov)
datadir = $(pkgpyexecdir)/data
-data_DATA = CamImgBorder.png border.png camcalibrator.avg crosshair.png black.png \
- Feedback.png TouchFeedback.png
+data_DATA = $(EXTRA_DIST)
diff --git a/src/python/data/Makefile.in b/src/python/data/Makefile.in
index 796c2b5..2d8c6d4 100644
--- a/src/python/data/Makefile.in
+++ b/src/python/data/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# Makefile.in generated by automake 1.11.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
-# Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -41,22 +41,23 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ac_cxx_namespaces.m4 \
$(top_srcdir)/m4/ac_path_generic.m4 \
$(top_srcdir)/m4/ax_boost_thread.m4 \
- $(top_srcdir)/m4/ax_check_gl.m4 $(top_srcdir)/m4/libtool.m4 \
- $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
- $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
- $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/m4/python_dev.m4 \
- $(top_srcdir)/configure.in
+ $(top_srcdir)/m4/ax_check_gl.m4 \
+ $(top_srcdir)/m4/ax_python_devel.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/pkg.m4 \
+ $(top_srcdir)/m4/avg_version.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/src/avgconfig.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
-AM_V_GEN = $(am__v_GEN_$(V))
-am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
-AM_V_at = $(am__v_at_$(V))
-am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
SOURCES =
DIST_SOURCES =
@@ -81,6 +82,12 @@ am__nobase_list = $(am__nobase_strip_setup); \
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
am__installdirs = "$(DESTDIR)$(datadir)"
DATA = $(data_DATA)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -93,7 +100,7 @@ AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BOOST_PYTHON_LIBS = @BOOST_PYTHON_LIBS@
-BOOST_THREAD_LIB = @BOOST_THREAD_LIB@
+BOOST_THREAD_LIBS = @BOOST_THREAD_LIBS@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
@@ -108,6 +115,7 @@ DC1394_2_CFLAGS = @DC1394_2_CFLAGS@
DC1394_2_LIBS = @DC1394_2_LIBS@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
@@ -148,6 +156,7 @@ LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
MTDEV_CFLAGS = @MTDEV_CFLAGS@
MTDEV_LIBS = @MTDEV_LIBS@
@@ -177,11 +186,13 @@ PTHREAD_CC = @PTHREAD_CC@
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
PTHREAD_LIBS = @PTHREAD_LIBS@
PYTHON = @PYTHON@
+PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@
PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
-PYTHON_INCLUDES = @PYTHON_INCLUDES@
-PYTHON_LIBS = @PYTHON_LIBS@
+PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@
+PYTHON_LDFLAGS = @PYTHON_LDFLAGS@
PYTHON_PLATFORM = @PYTHON_PLATFORM@
PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_SITE_PKG = @PYTHON_SITE_PKG@
PYTHON_VERSION = @PYTHON_VERSION@
RANLIB = @RANLIB@
SDL_CFLAGS = @SDL_CFLAGS@
@@ -204,6 +215,7 @@ abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
@@ -238,7 +250,6 @@ libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
@@ -262,10 +273,10 @@ target_vendor = @target_vendor@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-EXTRA_DIST = $(wildcard *.png) $(wildcard *.avg)
-data_DATA = CamImgBorder.png border.png camcalibrator.avg crosshair.png black.png \
- Feedback.png TouchFeedback.png
+EXTRA_DIST = $(wildcard *.xml) $(wildcard *.xsd) $(wildcard *.png) $(wildcard *.avg) \
+ $(wildcard *.mpg) $(wildcard *.avi) $(wildcard *.mov)
+data_DATA = $(EXTRA_DIST)
all: all-am
.SUFFIXES:
@@ -322,9 +333,7 @@ uninstall-dataDATA:
@$(NORMAL_UNINSTALL)
@list='$(data_DATA)'; test -n "$(datadir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
- test -n "$$files" || exit 0; \
- echo " ( cd '$(DESTDIR)$(datadir)' && rm -f" $$files ")"; \
- cd "$(DESTDIR)$(datadir)" && rm -f $$files
+ dir='$(DESTDIR)$(datadir)'; $(am__uninstall_files_from_dir)
tags: TAGS
TAGS:
@@ -379,10 +388,15 @@ install-am: all-am
installcheck: installcheck-am
install-strip:
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- `test -z '$(STRIP)' || \
- echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
mostlyclean-generic:
clean-generic:
diff --git a/src/python/data/SimpleSkin.xml b/src/python/data/SimpleSkin.xml
new file mode 100644
index 0000000..3f21274
--- /dev/null
+++ b/src/python/data/SimpleSkin.xml
@@ -0,0 +1,83 @@
+<skin>
+ <fontdef id="stdFont" font="Bitstream Vera Sans" variant="Roman" fontsize="12"
+ color="000000" letterspacing="0" linespacing="-1"/>
+ <fontdef id="downFont" baseid="stdFont" color="CCCCCC"/>
+ <fontdef id="disabledFont" baseid="stdFont" color="444444"/>
+ <textbutton
+ upSrc="button_bg_up.png"
+ downSrc="button_bg_down.png"
+ font="stdFont"
+ downFont="downFont"
+ disabledFont="disabledFont"
+ endsExtent="(7,7)"/>
+ <slider>
+ <horizontal
+ trackSrc="slider_horiz_track.png"
+ trackDisabledSrc="slider_horiz_track_disabled.png"
+ trackEndsExtent="6"
+ thumbUpSrc="slider_thumb_up.png"
+ thumbDownSrc="slider_thumb_down.png"/>
+ <vertical
+ trackSrc="slider_vert_track.png"
+ trackDisabledSrc="slider_vert_track_disabled.png"
+ trackEndsExtent="6"
+ thumbUpSrc="slider_thumb_up.png"
+ thumbDownSrc="slider_thumb_down.png"/>
+ </slider>
+ <scrollbar>
+ <horizontal
+ trackSrc="scrollbar_horiz_track.png"
+ trackDisabledSrc="scrollbar_horiz_track_disabled.png"
+ trackEndsExtent="2"
+ thumbUpSrc="scrollbar_horiz_thumb_up.png"
+ thumbDownSrc="scrollbar_horiz_thumb_down.png"
+ thumbEndsExtent="4"/>
+ <vertical
+ trackSrc="scrollbar_vert_track.png"
+ trackDisabledSrc="scrollbar_vert_track_disabled.png"
+ trackEndsExtent="2"
+ thumbUpSrc="scrollbar_vert_thumb_up.png"
+ thumbDownSrc="scrollbar_vert_thumb_down.png"
+ thumbEndsExtent="4"/>
+ </scrollbar>
+ <progressbar>
+ <horizontal
+ trackSrc="scrollbar_horiz_track.png"
+ trackEndsExtent="2"
+ thumbUpSrc="scrollbar_horiz_thumb_up.png"
+ thumbDisabledSrc="scrollbar_vert_thumb_down.png"
+ thumbEndsExtent="4"/>
+ <vertical
+ trackSrc="scrollbar_vert_track.png"
+ trackEndsExtent="2"
+ thumbUpSrc="scrollbar_vert_thumb_up.png"
+ thumbDisabledSrc="scrollbar_vert_thumb_down.png"
+ thumbEndsExtent="4"/>
+ </progressbar>
+ <scrollarea
+ borderSrc="scrollarea_border.png"
+ borderEndsExtent="(8,8)"
+ margins="(1,1,8,8)"
+ friction="-1"
+ sensitiveScrollBars="True"/>
+ <checkbox
+ uncheckedUpSrc="checkbox_unchecked_up.png"
+ uncheckedDownSrc="checkbox_unchecked_down.png"
+ uncheckedDisabledSrc="checkbox_unchecked_disabled.png"
+ checkedUpSrc="checkbox_checked_up.png"
+ checkedDownSrc="checkbox_checked_down.png"
+ checkedDisabledSrc="checkbox_checked_disabled.png"
+ font="stdFont"
+ downFont="stdFont"
+ disabledFont="disabledFont"/>
+ <mediacontrol
+ playUpSrc="play_button_up.png"
+ playDownSrc="play_button_down.png"
+ pauseUpSrc="pause_button_up.png"
+ pauseDownSrc="pause_button_down.png"
+ font="stdFont"
+ timePos="(15,0)"
+ timeLeftPos="(-42,0)"
+ barPos="(55,2)"
+ barRight="-45"/>
+</skin>
diff --git a/src/python/data/button_bg_down.png b/src/python/data/button_bg_down.png
new file mode 100644
index 0000000..c44179b
--- /dev/null
+++ b/src/python/data/button_bg_down.png
Binary files differ
diff --git a/src/python/data/button_bg_up.png b/src/python/data/button_bg_up.png
new file mode 100644
index 0000000..475c9c9
--- /dev/null
+++ b/src/python/data/button_bg_up.png
Binary files differ
diff --git a/src/python/data/camcalibrator.avg b/src/python/data/camcalibrator.avg
deleted file mode 100644
index 3c77962..0000000
--- a/src/python/data/camcalibrator.avg
+++ /dev/null
@@ -1,27 +0,0 @@
-<div>
- <image href="border.png"/>
- <image id="bkgnd" width="1280" height="720" />
- <div id="tracking" x="300" y="32">
- <words x="0" y="13" text="camera" fontsize="16" />
- <image x="0" y="32" href="CamImgBorder.png"/>
- <image id="camera" x="2" y="34" width="160" height="120" />
-
- <words x="166" y="13" text="distorted" fontsize="16" />
- <image x="166" y="32" href="CamImgBorder.png"/>
- <image id="distorted" x="168" y="34" width="160" height="120" />
-
- <words x="332" y="13" text="history" fontsize="16" />
- <image x="332" y="32" href="CamImgBorder.png"/>
- <image id="nohistory" x="334" y="34" width="160" height="120" />
-
- <image x="498" y="32" href="CamImgBorder.png"/>
- <image id="histogram" x="500" y="34" width="160" height="120" />
-
- <words id="param0" x="0" y="162" fontsize="13" />
- <words id="param1" x="0" y="178" fontsize="13" />
- <words id="param2" x="0" y="194" fontsize="13" />
- <words id="param3" x="166" y="162" fontsize="13" />
- <words id="param4" x="166" y="178" fontsize="13" />
- </div>
- <div id="coordcalibrator" width="1280" height="720" />
-</div>
diff --git a/src/python/data/checkbox_checked_disabled.png b/src/python/data/checkbox_checked_disabled.png
new file mode 100644
index 0000000..da58829
--- /dev/null
+++ b/src/python/data/checkbox_checked_disabled.png
Binary files differ
diff --git a/src/python/data/checkbox_checked_down.png b/src/python/data/checkbox_checked_down.png
new file mode 100644
index 0000000..4fbbd83
--- /dev/null
+++ b/src/python/data/checkbox_checked_down.png
Binary files differ
diff --git a/src/python/data/checkbox_checked_up.png b/src/python/data/checkbox_checked_up.png
new file mode 100644
index 0000000..ca901f4
--- /dev/null
+++ b/src/python/data/checkbox_checked_up.png
Binary files differ
diff --git a/src/python/data/checkbox_unchecked_disabled.png b/src/python/data/checkbox_unchecked_disabled.png
new file mode 100644
index 0000000..e8c2116
--- /dev/null
+++ b/src/python/data/checkbox_unchecked_disabled.png
Binary files differ
diff --git a/src/python/data/checkbox_unchecked_down.png b/src/python/data/checkbox_unchecked_down.png
new file mode 100644
index 0000000..69f8282
--- /dev/null
+++ b/src/python/data/checkbox_unchecked_down.png
Binary files differ
diff --git a/src/python/data/checkbox_unchecked_up.png b/src/python/data/checkbox_unchecked_up.png
new file mode 100644
index 0000000..e354492
--- /dev/null
+++ b/src/python/data/checkbox_unchecked_up.png
Binary files differ
diff --git a/src/video/testfiles/mpeg1-48x48-sound.avi b/src/python/data/mpeg1-48x48-sound.avi
index be415db..be415db 100644
--- a/src/video/testfiles/mpeg1-48x48-sound.avi
+++ b/src/python/data/mpeg1-48x48-sound.avi
Binary files differ
diff --git a/src/python/data/mpeg1-48x48.mov b/src/python/data/mpeg1-48x48.mov
new file mode 100644
index 0000000..16ab499
--- /dev/null
+++ b/src/python/data/mpeg1-48x48.mov
Binary files differ
diff --git a/src/python/data/pause_button_down.png b/src/python/data/pause_button_down.png
new file mode 100644
index 0000000..c06b34a
--- /dev/null
+++ b/src/python/data/pause_button_down.png
Binary files differ
diff --git a/src/python/data/pause_button_up.png b/src/python/data/pause_button_up.png
new file mode 100644
index 0000000..1a923b9
--- /dev/null
+++ b/src/python/data/pause_button_up.png
Binary files differ
diff --git a/src/python/data/play_button_down.png b/src/python/data/play_button_down.png
new file mode 100644
index 0000000..07b167b
--- /dev/null
+++ b/src/python/data/play_button_down.png
Binary files differ
diff --git a/src/python/data/play_button_up.png b/src/python/data/play_button_up.png
new file mode 100644
index 0000000..e16ec9e
--- /dev/null
+++ b/src/python/data/play_button_up.png
Binary files differ
diff --git a/src/graphics/testfiles/rgb24alpha-64x64.png b/src/python/data/rgb24alpha-64x64.png
index 41b69c3..41b69c3 100644
--- a/src/graphics/testfiles/rgb24alpha-64x64.png
+++ b/src/python/data/rgb24alpha-64x64.png
Binary files differ
diff --git a/src/python/data/scrollarea_border.png b/src/python/data/scrollarea_border.png
new file mode 100644
index 0000000..2e95f57
--- /dev/null
+++ b/src/python/data/scrollarea_border.png
Binary files differ
diff --git a/src/python/data/scrollbar_horiz_thumb_down.png b/src/python/data/scrollbar_horiz_thumb_down.png
new file mode 100644
index 0000000..6dc6fd1
--- /dev/null
+++ b/src/python/data/scrollbar_horiz_thumb_down.png
Binary files differ
diff --git a/src/python/data/scrollbar_horiz_thumb_up.png b/src/python/data/scrollbar_horiz_thumb_up.png
new file mode 100644
index 0000000..02748f2
--- /dev/null
+++ b/src/python/data/scrollbar_horiz_thumb_up.png
Binary files differ
diff --git a/src/python/data/scrollbar_horiz_track.png b/src/python/data/scrollbar_horiz_track.png
new file mode 100644
index 0000000..052002a
--- /dev/null
+++ b/src/python/data/scrollbar_horiz_track.png
Binary files differ
diff --git a/src/python/data/scrollbar_horiz_track_disabled.png b/src/python/data/scrollbar_horiz_track_disabled.png
new file mode 100644
index 0000000..7ac86fe
--- /dev/null
+++ b/src/python/data/scrollbar_horiz_track_disabled.png
Binary files differ
diff --git a/src/python/data/scrollbar_vert_thumb_down.png b/src/python/data/scrollbar_vert_thumb_down.png
new file mode 100644
index 0000000..c7b09d1
--- /dev/null
+++ b/src/python/data/scrollbar_vert_thumb_down.png
Binary files differ
diff --git a/src/python/data/scrollbar_vert_thumb_up.png b/src/python/data/scrollbar_vert_thumb_up.png
new file mode 100644
index 0000000..f6c2f88
--- /dev/null
+++ b/src/python/data/scrollbar_vert_thumb_up.png
Binary files differ
diff --git a/src/python/data/scrollbar_vert_track.png b/src/python/data/scrollbar_vert_track.png
new file mode 100644
index 0000000..58af284
--- /dev/null
+++ b/src/python/data/scrollbar_vert_track.png
Binary files differ
diff --git a/src/python/data/scrollbar_vert_track_disabled.png b/src/python/data/scrollbar_vert_track_disabled.png
new file mode 100644
index 0000000..695b112
--- /dev/null
+++ b/src/python/data/scrollbar_vert_track_disabled.png
Binary files differ
diff --git a/src/python/data/skin.xsd b/src/python/data/skin.xsd
new file mode 100644
index 0000000..4b8e545
--- /dev/null
+++ b/src/python/data/skin.xsd
@@ -0,0 +1,137 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <xsd:complexType name="SliderDef">
+ <xsd:attribute name="trackSrc" type="xsd:string" use="required"/>
+ <xsd:attribute name="trackDisabledSrc" type="xsd:string"/>
+ <xsd:attribute name="trackEndsExtent" type="xsd:integer"/>
+ <xsd:attribute name="thumbUpSrc" type="xsd:string" use="required"/>
+ <xsd:attribute name="thumbDownSrc" type="xsd:string"/>
+ <xsd:attribute name="thumbDisabledSrc" type="xsd:string"/>
+ </xsd:complexType>
+ <xsd:complexType name="ScrollBarDef">
+ <xsd:complexContent>
+ <xsd:extension base="SliderDef">
+ <xsd:attribute name="thumbEndsExtent" type="xsd:integer"/>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+ <xsd:complexType name="ProgressBarDef">
+ <xsd:attribute name="trackSrc" type="xsd:string" use="required"/>
+ <xsd:attribute name="trackEndsExtent" type="xsd:integer"/>
+ <xsd:attribute name="thumbUpSrc" type="xsd:string" use="required"/>
+ <xsd:attribute name="thumbDisabledSrc" type="xsd:string"/>
+ <xsd:attribute name="thumbEndsExtent" type="xsd:integer"/>
+ </xsd:complexType>
+ <xsd:simpleType name="bool">
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="True"/>
+ <xsd:enumeration value="False"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:element name="skin">
+ <xsd:complexType>
+ <xsd:sequence maxOccurs="unbounded">
+ <xsd:element name="fontdef" minOccurs="0" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:attribute name="id" type="xsd:ID" use="required"/>
+ <xsd:attribute name="baseid" type="xsd:IDREF"/>
+ <xsd:attribute name="font" type="xsd:string"/>
+ <xsd:attribute name="variant" type="xsd:string"/>
+ <xsd:attribute name="color" type="xsd:string"/>
+ <xsd:attribute name="aagamma" type="xsd:decimal"/>
+ <xsd:attribute name="fontsize" type="xsd:decimal"/>
+ <xsd:attribute name="indent" type="xsd:integer"/>
+ <xsd:attribute name="linespacing" type="xsd:decimal"/>
+ <xsd:attribute name="alignment" type="xsd:string"/>
+ <xsd:attribute name="wrapmode" type="xsd:string"/>
+ <xsd:attribute name="justify" type="bool"/>
+ <xsd:attribute name="letterspacing" type="xsd:decimal"/>
+ <xsd:attribute name="hint" type="bool"/>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="textbutton" minOccurs="0" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ <xsd:attribute name="upSrc" type="xsd:string" use="required"/>
+ <xsd:attribute name="downSrc" type="xsd:string" use="required"/>
+ <xsd:attribute name="disabledSrc" type="xsd:string"/>
+ <xsd:attribute name="endsExtent" type="xsd:string" use="required"/>
+ <xsd:attribute name="font" type="xsd:IDREF" use="required"/>
+ <xsd:attribute name="downFont" type="xsd:IDREF"/>
+ <xsd:attribute name="disabledFont" type="xsd:IDREF"/>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="checkbox" minOccurs="0" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ <xsd:attribute name="checkedUpSrc" type="xsd:string" use="required"/>
+ <xsd:attribute name="checkedDownSrc" type="xsd:string" use="required"/>
+ <xsd:attribute name="checkedDisabledSrc" type="xsd:string"/>
+ <xsd:attribute name="uncheckedUpSrc" type="xsd:string" use="required"/>
+ <xsd:attribute name="uncheckedDownSrc" type="xsd:string" use="required"/>
+ <xsd:attribute name="uncheckedDisabledSrc" type="xsd:string"/>
+ <xsd:attribute name="font" type="xsd:IDREF" use="required"/>
+ <xsd:attribute name="downFont" type="xsd:IDREF"/>
+ <xsd:attribute name="disabledFont" type="xsd:IDREF"/>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="mediacontrol" minOccurs="0" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ <xsd:attribute name="playUpSrc" type="xsd:string" use="required"/>
+ <xsd:attribute name="playDownSrc" type="xsd:string" use="required"/>
+ <xsd:attribute name="playDisabledSrc" type="xsd:string"/>
+ <xsd:attribute name="pauseUpSrc" type="xsd:string" use="required"/>
+ <xsd:attribute name="pauseDownSrc" type="xsd:string" use="required"/>
+ <xsd:attribute name="pauseDisabledSrc" type="xsd:string"/>
+ <xsd:attribute name="font" type="xsd:IDREF" use="required"/>
+ <xsd:attribute name="timePos" type="xsd:string" use="required"/>
+ <xsd:attribute name="timeLeftPos" type="xsd:string" use="required"/>
+ <xsd:attribute name="barPos" type="xsd:string" use="required"/>
+ <xsd:attribute name="barRight" type="xsd:string" use="required"/>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="slider" minOccurs="0" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:all>
+ <xsd:element name="vertical" type="SliderDef" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="horizontal" type="SliderDef" minOccurs="0"
+ maxOccurs="1"/>
+ </xsd:all>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="scrollbar" minOccurs="0" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:all>
+ <xsd:element name="vertical" type="ScrollBarDef" minOccurs="0"
+ maxOccurs="1"/>
+ <xsd:element name="horizontal" type="ScrollBarDef" minOccurs="1"
+ maxOccurs="1"/>
+ </xsd:all>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="progressbar" minOccurs="0" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:all>
+ <xsd:element name="vertical" type="ProgressBarDef" minOccurs="0"
+ maxOccurs="1"/>
+ <xsd:element name="horizontal" type="ProgressBarDef" minOccurs="0"
+ maxOccurs="1"/>
+ </xsd:all>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="scrollarea" minOccurs="0" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ <xsd:attribute name="scrollBarID" type="xsd:IDREF"/>
+ <xsd:attribute name="borderSrc" type="xsd:string"/>
+ <xsd:attribute name="borderEndsExtent" type="xsd:string"/>
+ <xsd:attribute name="margins" type="xsd:string"/>
+ <xsd:attribute name="friction" type="xsd:string"/>
+ <xsd:attribute name="sensitiveScrollBars" type="bool" use="required"/>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+</xsd:schema>
diff --git a/src/python/data/slider_horiz_track.png b/src/python/data/slider_horiz_track.png
new file mode 100644
index 0000000..6e233a5
--- /dev/null
+++ b/src/python/data/slider_horiz_track.png
Binary files differ
diff --git a/src/python/data/slider_horiz_track_disabled.png b/src/python/data/slider_horiz_track_disabled.png
new file mode 100644
index 0000000..01c880d
--- /dev/null
+++ b/src/python/data/slider_horiz_track_disabled.png
Binary files differ
diff --git a/src/python/data/slider_thumb_down.png b/src/python/data/slider_thumb_down.png
new file mode 100644
index 0000000..1f2acc2
--- /dev/null
+++ b/src/python/data/slider_thumb_down.png
Binary files differ
diff --git a/src/python/data/slider_thumb_up.png b/src/python/data/slider_thumb_up.png
new file mode 100644
index 0000000..885506d
--- /dev/null
+++ b/src/python/data/slider_thumb_up.png
Binary files differ
diff --git a/src/python/data/slider_vert_track.png b/src/python/data/slider_vert_track.png
new file mode 100644
index 0000000..51bac37
--- /dev/null
+++ b/src/python/data/slider_vert_track.png
Binary files differ
diff --git a/src/python/data/slider_vert_track_disabled.png b/src/python/data/slider_vert_track_disabled.png
new file mode 100644
index 0000000..bc8d7b6
--- /dev/null
+++ b/src/python/data/slider_vert_track_disabled.png
Binary files differ
diff --git a/src/python/draggable.py b/src/python/draggable.py
deleted file mode 100644
index 4bc4cd0..0000000
--- a/src/python/draggable.py
+++ /dev/null
@@ -1,107 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-# libavg - Media Playback Engine.
-# Copyright (C) 2003-2011 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
-#
-
-g_Player = None
-
-from libavg import avg
-
-
-class Draggable:
- def __init__(self, node, onDragStart=None, onDragEnd=None, onDragMove=None):
- global g_Player
- g_Player = avg.Player.get()
- self.__node = node
- self.__onDragStart = onDragStart
- self.__onDragEnd = onDragEnd
- self.__onDragMove = onDragMove
- self.__isDragging = False
-
- def enable(self):
- self.__node.setEventHandler(avg.CURSORDOWN, avg.MOUSE | avg.TOUCH, self.__onStart)
-
- def disable(self):
- if self.__isDragging:
- self.__stop()
- self.__node.setEventHandler(avg.CURSORDOWN, avg.MOUSE | avg.TOUCH, None)
- self.__node.setEventHandler(avg.CURSORMOTION, avg.MOUSE | avg.TOUCH, None)
- self.__node.setEventHandler(avg.CURSORUP, avg.MOUSE | avg.TOUCH, None)
-
- def startDrag(self, event):
- self.__onStart(event)
-
- def isDragging(self):
- return self.__isDragging
-
- def __onStart(self, event):
- self.__cursorID = event.cursorid
- self.__isDragging = True
- self.__lastDownPos = event.pos
- groupsNode = self.__node.getParent()
- groupsNode.reorderChild(groupsNode.indexOf(self.__node),
- groupsNode.getNumChildren()-1)
- self.__node.setEventCapture(event.cursorid)
- self.__node.setEventHandler(avg.CURSORDOWN, avg.MOUSE | avg.TOUCH, None)
- self.__node.setEventHandler(avg.CURSORMOTION, avg.MOUSE | avg.TOUCH,
- self.__onMove)
- self.__node.setEventHandler(avg.CURSORUP, avg.MOUSE | avg.TOUCH, self.__onStop)
- stopBubble = False
- if self.__onDragStart:
- stopBubble = self.__onDragStart(event)
- if stopBubble == None:
- stopBubble = False
- self.__startDragPos = self.__node.pos
- return stopBubble
-
- def __onMove(self, event):
- if event.cursorid == self.__cursorID:
- self.__node.pos = (self.__startDragPos[0]+event.x-self.__lastDownPos[0],
- self.__startDragPos[1]+event.y-self.__lastDownPos[1])
- stopBubble = False
- if self.__onDragMove:
- stopBubble = self.__onDragMove(event)
- if stopBubble == None:
- stopBubble = False
- return stopBubble
-
- def __onStop(self, event):
- if event.cursorid == self.__cursorID:
- self.__onMove(event)
- self.__stop()
- stopBubble = False
- if self.__onDragEnd:
- stopBubble = self.__onDragEnd(event)
- if stopBubble == None:
- stopBubble = False
- return stopBubble
-
- def __stop(self):
- self.__isDragging = False
- self.__node.setEventHandler(avg.CURSORDOWN, avg.MOUSE | avg.TOUCH, self.__onStart)
- self.__node.setEventHandler(avg.CURSORMOTION, avg.MOUSE | avg.TOUCH, None)
- self.__node.setEventHandler(avg.CURSORUP, avg.MOUSE | avg.TOUCH, None)
- self.__node.releaseEventCapture(self.__cursorID)
-
-
-def init(g_avg):
- global avg
- avg = g_avg
diff --git a/src/python/enumcompat.py b/src/python/enumcompat.py
new file mode 100644
index 0000000..df859a5
--- /dev/null
+++ b/src/python/enumcompat.py
@@ -0,0 +1,37 @@
+# -*- 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
+#
+
+import avg
+avg.KEYUP = avg.Event.KEY_UP
+avg.KEYDOWN = avg.Event.KEY_DOWN
+avg.CURSORMOTION = avg.Event.CURSOR_MOTION
+avg.CURSORUP = avg.Event.CURSOR_UP
+avg.CURSORDOWN = avg.Event.CURSOR_DOWN
+avg.CURSOROVER = avg.Event.CURSOR_OVER
+avg.CURSOROUT = avg.Event.CURSOR_OUT
+avg.CUSTOMEVENT = avg.Event.CUSTOM_EVENT
+
+avg.MOUSE = avg.Event.MOUSE
+avg.TOUCH = avg.Event.TOUCH
+avg.TRACK = avg.Event.TRACK
+avg.CUSTOM = avg.Event.CUSTOM
+avg.NONE = avg.Event.NONE
+
diff --git a/src/python/eventList.py b/src/python/eventList.py
deleted file mode 100644
index ebc4205..0000000
--- a/src/python/eventList.py
+++ /dev/null
@@ -1,174 +0,0 @@
-# libavg - Media Playback Engine.
-# Copyright (C) 2003-2011 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 Martin Heistermann <mh at sponc dot de>
-#
-
-from libavg import avg
-
-class Cursor(object):
- def __init__(self):
- self._pos = None
- self.resetMotion()
-
- def resetMotion(self):
- self._startPos = self._pos
-
- def getDelta (self):
- return self._pos - self._startPos
-
- def getStartPos (self):
- return self._startPos
-
- def getPos (self):
- return self._pos
-
- def setPos (self, newPos):
- self._pos = newPos
- if not self._startPos:
- self._startPos = self._pos
-
- def getX(self):
- return self._pos.x
- x = property(getX)
-
- def getY(self):
- return self._pos.y
- y = property(getY)
-
- def __unicode__ (self):
- print "cursor %s->%s" % (self.getStartPos(), self.getPos())
-
-class EventCursor(Cursor):
- def __init__(self, event):
- super(EventCursor, self).__init__()
- self.__cursorid = event.cursorid
- self.update (event)
-
- def update (self, event):
- assert event.cursorid == self.__cursorid
- self.setPos(event.pos)
- self.__speed = event.speed
-
- def getSpeed (self):
- return self.__speed
-
- def getCursorID (self):
- return self.__cursorid
-
-class EventList:
- """Keep track of cursors pressed on a Node"""
- def __init__(self,
- node,
- source,
- onDown = lambda x: None,
- onUp = lambda x: None,
- onMotion = lambda x: None,
- resetMotion = lambda: None,
- maxEvents = None,
- captureEvents = True):
-
- self.__node = node
- self.__source = source
- self.__callback = {
- 'onDown': onDown,
- 'onUp': onUp,
- 'onMotion': onMotion,
- 'resetMotion': resetMotion,
- }
-
- self.__maxEvents = maxEvents
- self.__captureEvents = captureEvents
-
- self.__capturedCursors = []
- self.__node.setEventHandler (avg.CURSORDOWN, self.__source, self.__onDown)
- self.__node.setEventHandler (avg.CURSORUP, self.__source, self.__onUp)
- self.__node.setEventHandler (avg.CURSORMOTION, self.__source, self.__onMotion)
-
- self.__eventCursors = []
-
- def handleInitialDown(self, event):
- self.__onDown(event)
-
- def delete(self):
- for cursorid in self.__capturedCursors:
- self.__node.releaseEventCapture (cursorid)
- self.__capturedCursors = []
-
- for type_ in avg.CURSORDOWN, avg.CURSORMOTION, avg.CURSORUP:
- self.__node.setEventHandler(type_, self.__source, None)
- self.__node = None
-
- def __setitem__(self, key, val):
- raise Exception
-
- def __findEventCursor(self, event):
- found = filter (lambda ec: ec.getCursorID() == event.cursorid, self.__eventCursors)
- return found[0] if found else None
-
- def __resetMotion(self):
- map(EventCursor.resetMotion, self.__eventCursors)
- self.__callback['resetMotion']()
-
- def __onUp(self, event):
- def __removeCursor (cursor):
- def __releaseCapture (cursorid):
- if cursorid in self.__capturedCursors:
- try:
- self.__node.releaseEventCapture (cursorid)
- self.__capturedCursors.remove (cursorid)
- except RuntimeError: # XXX
- print "warning: could not release event capture for cursor %u" % cursorid
-
- __releaseCapture (cursor.getCursorID())
- self.__eventCursors.remove (cursor)
- self.__resetMotion ()
- ec = self.__findEventCursor (event)
- if ec:
- ec.update (event)
- __removeCursor (ec)
- self.__callback['onUp'](ec)
-
- def __onDown(self, event):
- if self.__maxEvents and len(self.__eventCursors) >= self.__maxEvents:
- return
-
- if self.__captureEvents:
- try:
- self.__node.setEventCapture(event.cursorid)
- self.__capturedCursors.append(event.cursorid)
- except RuntimeError:
- print "warning: could capture events for cursor %u" % event.cursorid
-
- ec = EventCursor (event)
- self.__eventCursors.append (ec)
- self.__resetMotion ()
- self.__callback['onDown'](ec)
-
- def __onMotion(self, event):
- ec = self.__findEventCursor (event)
- if ec:
- ec.update (event)
- self.__callback['onMotion'](ec)
-
- def getCursors(self):
- return self.__eventCursors
-
- def __len__(self):
- return len(self.__eventCursors)
diff --git a/src/python/filter.py b/src/python/filter.py
new file mode 100644
index 0000000..f6c268b
--- /dev/null
+++ b/src/python/filter.py
@@ -0,0 +1,95 @@
+# -*- 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
+#
+
+import math
+
+# Input filter based on:
+# Casiez, G., Roussel, N. and Vogel, D. (2012). 1€ Filter: A Simple Speed-based Low-pass
+# Filter for Noisy Input in Interactive Systems. Proceedings of the ACM Conference on
+# Human Factors in Computing Systems (CHI '12). Austin, Texas (May 5-12, 2012). New York:
+# ACM Press, pp. 2527-2530.
+
+class LowPassFilter(object):
+
+ def __init__(self, alpha):
+ self.__setAlpha(alpha)
+ self.__y = None
+ self.__s = None
+
+ def __setAlpha(self, alpha):
+ alpha = float(alpha)
+ if alpha <= 0 or alpha > 1.0:
+ raise RuntimeError("LowPassFilter alpha (%s) should be in (0.0, 1.0]"%alpha)
+ self.__alpha = alpha
+
+ def apply(self, value, timestamp=None, alpha=None):
+ if alpha is not None:
+ self.__setAlpha(alpha)
+ if self.__y is None:
+ s = value
+ else:
+ s = self.__alpha*value + (1.0-self.__alpha)*self.__s
+ self.__y = value
+ self.__s = s
+ return s
+
+ def lastValue(self):
+ return self.__y
+
+
+class OneEuroFilter(object):
+
+ def __init__(self, mincutoff=1.0, beta=0.0, dcutoff=1.0):
+ if mincutoff<=0:
+ raise ValueError("mincutoff should be >0")
+ if dcutoff<=0:
+ raise ValueError("dcutoff should be >0")
+ self.__freq = 60 # Initial freq, updated as soon as we have > 1 sample
+ self.__mincutoff = float(mincutoff)
+ self.__beta = float(beta)
+ self.__dcutoff = float(dcutoff)
+ self.__x = LowPassFilter(self.__alpha(self.__mincutoff))
+ self.__dx = LowPassFilter(self.__alpha(self.__dcutoff))
+ self.__lasttime = None
+
+ def __alpha(self, cutoff):
+ te = 1.0 / self.__freq
+ tau = 1.0 / (2*math.pi*cutoff)
+ return 1.0 / (1.0 + tau/te)
+
+ def apply(self, x, timestamp):
+ timestamp /= 1000.
+ if self.__lasttime == timestamp:
+ return x
+ else:
+ # ---- update the sampling frequency based on timestamps
+ if self.__lasttime and timestamp:
+ self.__freq = 1.0 / (timestamp-self.__lasttime)
+ self.__lasttime = timestamp
+ # ---- estimate the current variation per second
+ prev_x = self.__x.lastValue()
+ dx = 0.0 if prev_x is None else (x-prev_x)*self.__freq # FIXME: 0.0 or value?
+ edx = self.__dx.apply(dx, timestamp, alpha=self.__alpha(self.__dcutoff))
+ # ---- use it to update the cutoff frequency
+ cutoff = self.__mincutoff + self.__beta*math.fabs(edx)
+ # ---- filter the given value
+ return self.__x.apply(x, timestamp, alpha=self.__alpha(cutoff))
+
diff --git a/src/python/gameapp.py b/src/python/gameapp.py
deleted file mode 100644
index 350a7ec..0000000
--- a/src/python/gameapp.py
+++ /dev/null
@@ -1,327 +0,0 @@
-# libavg - Media Playback Engine.
-# Copyright (C) 2003-2011 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 OXullo Intersecans <x@brainrapers.org>
-#
-
-'''
-Transitional class to fulfill some of the missing features of AVGApp,
-currently needed for multitouch games.
-'''
-
-from __future__ import with_statement
-import os
-import sys
-import cPickle as pickle
-
-import libavg
-from libavg import avg
-
-g_Player = avg.Player.get()
-g_Log = avg.Logger.get()
-
-
-class Datastore(object):
- '''
- General purpose persistent object (state in self.data)
-
- Even if it's possible to use Datastore independently from GameApp, the suggested
- use is described with the following case (given MyApp a subclass of GameApp):
-
- >>> from mypackage.app import MyApp
- >>> g_App = MyApp.get()
-
- >>> def validate(data):
- >>> return type(data) == list and isinstance(data[2], Bar)
-
- >>> myInitialData = [1, 'foo', Bar(12)]
- >>> myDs = g_App.initDatastore('hiscore', myInitialData, validate)
- >>> myDs.data[2].foobarize(1)
- >>> myDs.data[0] = 2
- >>> myDs.commit()
-
- >>> againMyDs = g_App.getDatastore('hiscore')
- '''
-
- def __init__(self, dumpFile, initialData, validator, autoCommit):
- '''
- dumpFile: path to a file which is used for storing and retrieving data
- initialData: a callable (class, method) or an instance that is used to initialize
- the datastore when the dumpfile either doesn't exist, it's corrupted, or
- cannot be accessed or when the loaded data don't comply with the optional
- validator. Defaults to an empty dict.
- validator: a callable to which stored data are passed and that is able to
- determine if the data format is expected. If the call returns True, the
- proposed data are accepted and set. With False as return value the
- Datastore uses initialData instead.
- autoCommit: if True, the datastore sync itself when the program exits (uses
- atexit). It's always possible to commit() manually.
- '''
- self.__dumpFile = dumpFile
-
- if hasattr(initialData, '__call__'):
- initialData = initialData()
- elif initialData is None:
- initialData = dict()
-
- if os.path.exists(self.__dumpFile):
- if not os.path.isfile:
- raise RuntimeError('%s dump file '
- 'is not a plain file' % self)
- elif not os.access(self.__dumpFile, os.R_OK | os.W_OK):
- raise RuntimeError('%s dump file'
- 'cannot be accessed with r/w permissions' % self)
-
- try:
- f = open(self.__dumpFile)
- except IOError:
- g_Log.trace(g_Log.APP, 'Initializing %s' % self)
- self.data = initialData
- self.commit()
- else:
- try:
- self.data = pickle.load(f)
- except:
- f.close()
- g_Log.trace(g_Log.ERROR, 'Datastore %s is corrupted, '
- 'reinitializing' % self)
- self.data = initialData
- self.commit()
- else:
- f.close()
- if not validator(self.data):
- g_Log.trace(g_Log.ERROR, 'Sanity check failed for %s: '
- 'reinitializing' % self)
- self.data = initialData
- self.commit()
- else:
- g_Log.trace(g_Log.APP, '%s successfully '
- 'loaded' % self)
-
- if autoCommit:
- import atexit
- atexit.register(self.commit)
-
- def commit(self):
- '''
- Dump Datastore data to disk
- '''
- import time
-
- tempFile = self.__dumpFile + '.tmp.' + str(int(time.time() * 1000))
-
- try:
- with open(tempFile, 'wb') as f:
- pickle.dump(self.data, f)
- except Exception, e:
- g_Log.trace(g_Log.ERROR, 'Cannot save '
- '%s (%s)' % (self.__dumpFile, str(e)))
- return False
- else:
- if os.path.exists(self.__dumpFile):
- try:
- os.remove(self.__dumpFile)
- except Exception, e:
- g_Log.trace(g_Log.ERROR, 'Cannot overwrite '
- 'dump file %s (%s)' % (self, str(e)))
- return False
- try:
- os.rename(tempFile, self.__dumpFile)
- except Exception, e:
- g_Log.trace(g_Log.ERROR, 'Cannot save '
- '%s (%s)' % (self, str(e)))
- os.remove(tempFile)
- return False
- else:
- g_Log.trace(g_Log.APP, '%s saved' % self)
- return True
-
- def __repr__(self):
- return '<%s %s>' % (self.__class__.__name__, self.__dumpFile)
-
-
-class GameApp(libavg.AVGApp):
- '''
- Derivation from this class adds a command line parser, which can be used to
- define fullscreen behavior and resolution. It defaults to fullscreen and
- sets the resolution as the current desktop's one.
- Multitouch is enabled by default.
- '''
- multitouch = True
- instances = {}
-
- def __init__(self, *args, **kwargs):
- appname = self.__class__.__name__
- if appname in GameApp.instances:
- raise RuntimeError('App %s already setup' % appname)
-
- GameApp.instances[appname] = self
-
- super(GameApp, self).__init__(*args, **kwargs)
-
- self.__datastores = {}
-
- pkgpath = self._getPackagePath()
- if pkgpath is not None:
- avg.WordsNode.addFontDir(libavg.utils.getMediaDir(pkgpath, 'fonts'))
- self._parentNode.mediadir = libavg.utils.getMediaDir(pkgpath)
-
- @classmethod
- def get(cls):
- '''
- Get the Application instance
-
- Note: this class method has to be called from the top-level app class:
-
- >>> class MyApp(gameapp.GameApp):
- ... pass
- >>> instance = MyApp.get()
- '''
- return cls.instances.get(cls.__name__, None)
-
- @classmethod
- def start(cls, *args, **kwargs):
- import optparse
-
- parser = optparse.OptionParser()
- parser.add_option('-r', '--resolution', dest='resolution',
- default=None, help='set an explicit resolution', metavar='WIDTHxHEIGHT')
- parser.add_option('-w', '--window', dest='window', action='store_true',
- default=False, help='run the game in a window')
-
- (options, args) = parser.parse_args()
-
- if options.resolution is not None:
- import re
-
- m = re.match('^(\d+)x(\d+)$', options.resolution)
-
- if m is None:
- sys.stderr.write('\n** ERROR: invalid resolution '
- 'specification %s\n\n' % options.resolution)
- parser.print_help()
- sys.exit(1)
- else:
- kwargs['resolution'] = map(int, m.groups())
- elif not 'resolution' in kwargs:
- kwargs['resolution'] = g_Player.getScreenResolution()
-
- if options.window:
- if options.resolution is None:
- sys.stderr.write('\n** ERROR: in window mode the resolution '
- 'must be set\n\n')
- parser.print_help()
- sys.exit(1)
- else:
- if 'AVG_DEPLOY' in os.environ:
- del os.environ['AVG_DEPLOY']
- else:
- os.environ['AVG_DEPLOY'] = '1'
-
- g_Log.trace(g_Log.APP, 'Setting resolution to: %s' % str(kwargs['resolution']))
-
- super(GameApp, cls).start(*args, **kwargs)
-
- def quit(self):
- '''
- Quit the application
- The player is stopped if the application has been started by its own
- (eg: no appchooser)
- '''
- self.leave()
- if self.getStarter() is not None:
- g_Player.get().stop()
-
- def getUserdataPath(self, fname):
- '''
- Return a path which is platform dependent and that points to a directory
- which can be used to store games data.
- These data will belong to the current user and are not meant for system-wide
- settings.
- The path is constructed using the name of the app's class and it is created
- if it doesn't exist.
- '''
- if os.name == 'posix':
- path = os.path.join(os.environ['HOME'], '.avg',
- self.__class__.__name__.lower())
- elif os.name == 'nt':
- path = os.path.join(os.environ['APPDATA'], 'Avg',
- self.__class__.__name__.lower())
- else:
- raise RuntimeError('Unsupported system %s' % os.name)
-
- try:
- os.makedirs(path)
- except OSError, e:
- import errno
- if e.errno != errno.EEXIST:
- raise
-
- return os.path.join(path, fname)
-
- def initDatastore(self, tag, initialData=None, validator=lambda ds: True,
- autoCommit=True):
- '''
- Initialize and return a Datastore instance
-
- tag: a string that references the datastore. Such tags are uniques within
- the application's scope and may be retrieved from different parts of
- the game's package with getDatastore() method.
-
- See the documentation on Datastore class for the rest of the parameters.
-
- >>> myDs = MyApp.get().initDatastore('hiscore', [])
- >>> myDs.data.append(ScoreEntry(12321, 'oxi'))
- >>> myDs.commit()
- '''
-
- if type(tag) != str:
- raise TypeError('Tag must be a string instead of %s' % type(tag))
-
- if tag in self.__datastores:
- raise RuntimeError('Datastore %s already initialized')
-
- ds = Datastore(self.getUserdataPath(tag + '.pkl'), initialData, validator,
- autoCommit)
-
- self.__datastores[tag] = ds
-
- return ds
-
- def getDatastore(self, tag):
- '''
- Return an initialized Datastore instance given its tag
- '''
- return self.__datastores.get(tag, None)
-
- def _getPackagePath(self):
- '''
- Overload this method in your App class if you want to get 'media' and 'fonts'
- easily set up (respectively as mediadir for App._parentNode and for local font
- path).
- This method should return a relative (to CWD) or absolute path. It can be a file
- path as well.
- Eg:
-
- def _getPackagePath(self):
- return __file__
- '''
- return None
-
-
diff --git a/src/python/geom.py b/src/python/geom.py
index c7d5fd8..5f6f98c 100644
--- a/src/python/geom.py
+++ b/src/python/geom.py
@@ -1,5 +1,5 @@
# libavg - Media Playback Engine.
-# Copyright (C) 2003-2011 Ulrich von Zadow
+# 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
@@ -19,17 +19,15 @@
#
from libavg import avg
-g_Player = None
class RoundedRect(avg.PolygonNode):
def __init__(self, size, radius, pos=(0,0), parent=None, **kwargs):
- avg.PolygonNode.__init__(self, **kwargs)
+ super(RoundedRect, self).__init__(**kwargs)
self.__pos = avg.Point2D(pos)
self.__size = avg.Point2D(size)
self.__radius = radius
self.__calcPolygon()
- if parent:
- parent.appendChild(self)
+ self.registerInstance(self, parent)
def getPos(self):
return self.__pos
@@ -65,14 +63,14 @@ class RoundedRect(avg.PolygonNode):
pos.append(p)
return pos
- if self.__size.x < self.__radius*2:
- self.__radius = self.__size.x/2
- if self.__size.y < self.__radius*2:
- self.__radius = self.__size.y/2
- if self.__radius == 0:
- self.__radius = 0.01
- pos = []
r = self.__radius
+ if self.__size.x < r*2:
+ r = self.__size.x/2
+ if self.__size.y < r*2:
+ r = self.__size.y/2
+ if r == 0:
+ r = 0.01
+ pos = []
size = self.__size
pos.extend(calcQuarterCircle(self.pos+(size.x-r,r), r, -1.57))
pos.extend(calcQuarterCircle(self.pos+(size.x-r,size.y-r), r, 0))
@@ -84,14 +82,13 @@ class RoundedRect(avg.PolygonNode):
class PieSlice(avg.PolygonNode):
def __init__(self, radius, startangle, endangle, pos=(0,0), parent=None,
**kwargs):
- avg.PolygonNode.__init__(self, **kwargs)
+ super(PieSlice, self).__init__(**kwargs)
self.__pos = avg.Point2D(pos)
self.__radius = radius
self.__startangle = startangle
self.__endangle = endangle
self.__calcPolygon()
- if parent:
- parent.appendChild(self)
+ self.registerInstance(self, parent)
def getPos(self):
return self.__pos
@@ -148,14 +145,13 @@ class Arc(avg.PolyLineNode):
# TODO: Code duplication with PieSlice
def __init__(self, radius, startangle, endangle, pos=(0,0), parent=None,
**kwargs):
- avg.PolyLineNode.__init__(self, **kwargs)
+ super(Arc, self).__init__(**kwargs)
self.__pos = avg.Point2D(pos)
self.__radius = radius
self.__startangle = startangle
self.__endangle = endangle
self.__calcPolygon()
- if parent:
- parent.appendChild(self)
+ self.registerInstance(self, parent)
def getPos(self):
return self.__pos
diff --git a/src/python/gesture.py b/src/python/gesture.py
new file mode 100644
index 0000000..0334e26
--- /dev/null
+++ b/src/python/gesture.py
@@ -0,0 +1,1000 @@
+# -*- 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
+#
+
+from libavg import avg, statemachine, player, filter
+
+import weakref
+
+import math
+
+class Recognizer(avg.Publisher):
+
+ POSSIBLE = avg.Publisher.genMessageID()
+ DETECTED = avg.Publisher.genMessageID()
+ FAILED = avg.Publisher.genMessageID()
+ MOTION = avg.Publisher.genMessageID()
+ UP = avg.Publisher.genMessageID()
+ END = avg.Publisher.genMessageID()
+
+ def __init__(self, node, isContinuous, maxContacts, initialEvent,
+ possibleHandler=None, failHandler=None, detectedHandler=None,
+ endHandler=None):
+ super(Recognizer, self).__init__()
+
+ if node:
+ self.__node = weakref.ref(node)
+ else:
+ self.__node = None
+ self.__isContinuous = isContinuous
+ self.__maxContacts = maxContacts
+
+ self.__setEventHandler()
+ self.__isEnabled = True
+ self._contacts = set()
+ self.__dirty = False
+
+ self.publish(Recognizer.POSSIBLE)
+ self.publish(Recognizer.DETECTED)
+ self.publish(Recognizer.FAILED)
+ self.publish(Recognizer.END)
+ self.__stateMachine = statemachine.StateMachine(str(type(self)), "IDLE")
+ if self.__isContinuous:
+ self.publish(Recognizer.MOTION)
+ self.publish(Recognizer.UP)
+ self.__stateMachine.addState("IDLE", ("POSSIBLE", "RUNNING"))
+ self.__stateMachine.addState("POSSIBLE", ("IDLE", "RUNNING"))
+ self.__stateMachine.addState("RUNNING", ("IDLE",))
+ else:
+ self.__stateMachine.addState("IDLE", ("POSSIBLE",))
+ self.__stateMachine.addState("POSSIBLE", ("IDLE",))
+
+ self.subscribe(Recognizer.POSSIBLE, possibleHandler)
+ self.subscribe(Recognizer.FAILED, failHandler)
+ self.subscribe(Recognizer.DETECTED, detectedHandler)
+ self.subscribe(Recognizer.END, endHandler)
+ # self.__stateMachine.traceChanges(True)
+ self.__frameHandlerID = None
+
+ if initialEvent:
+ self.__onDown(initialEvent)
+
+ @property
+ def contacts(self):
+ return list(self._contacts)
+
+ def abort(self):
+ if self.__isEnabled:
+ self.__abort()
+ self.__setEventHandler()
+
+ def enable(self, isEnabled):
+ if bool(isEnabled) != self.__isEnabled:
+ self.__isEnabled = bool(isEnabled)
+ if isEnabled:
+ self.__setEventHandler()
+ else:
+ self.__abort()
+
+ def isEnabled(self):
+ return self.__isEnabled
+
+ def getState(self):
+ return self.__stateMachine.state
+
+ def _setPossible(self, event):
+ self.__stateMachine.changeState("POSSIBLE")
+ self.notifySubscribers(Recognizer.POSSIBLE, [])
+
+ def _setFail(self, event):
+ assert(self.__stateMachine.state != "RUNNING")
+ if self.__stateMachine.state != "IDLE":
+ self.__stateMachine.changeState("IDLE")
+ self._disconnectContacts()
+ self.notifySubscribers(Recognizer.FAILED, [])
+
+ def _setDetected(self, event):
+ if self.__isContinuous:
+ self.__stateMachine.changeState("RUNNING")
+ else:
+ self.__stateMachine.changeState("IDLE")
+ self.notifySubscribers(Recognizer.DETECTED, [])
+
+ def _setEnd(self, event):
+ assert(self.__stateMachine.state != "POSSIBLE")
+ if self.__stateMachine.state != "IDLE":
+ self.__stateMachine.changeState("IDLE")
+ self.notifySubscribers(Recognizer.END, [])
+
+ def __onDown(self, event):
+ nodeGone = self._handleNodeGone()
+ if event.contact and not(nodeGone):
+ if (self.__maxContacts == None or len(self._contacts) <
+ self.__maxContacts):
+ event.contact.subscribe(avg.Contact.CURSOR_MOTION, self.__onMotion)
+ event.contact.subscribe(avg.Contact.CURSOR_UP, self.__onUp)
+ self._contacts.add(event.contact)
+ if len(self._contacts) == 1:
+ self.__frameHandlerID = player.subscribe(player.ON_FRAME,
+ self._onFrame)
+ self.__dirty = True
+ return self._handleDown(event)
+
+ def __onMotion(self, event):
+ nodeGone = self._handleNodeGone()
+ if event.contact and not(nodeGone):
+ self.__dirty = True
+ self._handleMove(event)
+
+ def __onUp(self, event):
+ nodeGone = self._handleNodeGone()
+ if event.contact and not(nodeGone):
+ self.__dirty = True
+ self._contacts.remove(event.contact)
+ if len(self._contacts) == 0:
+ player.unsubscribe(player.ON_FRAME, self.__frameHandlerID)
+ self.__frameHandlerID = None
+ self._handleUp(event)
+
+ def __abort(self):
+ if self.__stateMachine.state != "IDLE":
+ self.__stateMachine.changeState("IDLE")
+ if len(self._contacts) != 0:
+ self._disconnectContacts()
+ if self.__node and self.__node():
+ self.__node().unsubscribe(avg.Node.CURSOR_DOWN, self.__onDown)
+
+ def _disconnectContacts(self):
+ for contact in self._contacts:
+ contact.unsubscribe(avg.Contact.CURSOR_MOTION, self.__onMotion)
+ contact.unsubscribe(avg.Contact.CURSOR_UP, self.__onUp)
+ self._contacts = set()
+ if self.__frameHandlerID:
+ player.unsubscribe(player.ON_FRAME, self.__frameHandlerID)
+ self.__frameHandlerID = None
+
+ def _handleDown(self, event):
+ pass
+
+ def _handleMove(self, event):
+ pass
+
+ def _handleUp(self, event):
+ pass
+
+ def _handleChange(self):
+ pass
+
+ def _onFrame(self):
+ nodeGone = self._handleNodeGone()
+ if not(nodeGone) and self.__dirty:
+ self._handleChange()
+ self.__dirty = False
+
+ def _handleNodeGone(self):
+ if self.__node and not(self.__node()):
+ self.enable(False)
+ return True
+ else:
+ return False
+
+ def __setEventHandler(self):
+ if self.__node and self.__node():
+ self.__node().subscribe(avg.Node.CURSOR_DOWN, self.__onDown)
+
+
+class TapRecognizer(Recognizer):
+
+ MAX_TAP_DIST = None
+
+ def __init__(self, node, maxTime=None, maxDist=None, initialEvent=None,
+ possibleHandler=None, failHandler=None, detectedHandler=None):
+ self.__maxTime = maxTime
+ if maxDist == None:
+ maxDist = TapRecognizer.MAX_TAP_DIST
+ self.__maxDist = maxDist
+ super(TapRecognizer, self).__init__(node, False, 1, initialEvent,
+ possibleHandler, failHandler, detectedHandler)
+
+ def _handleDown(self, event):
+ self._setPossible(event)
+ self.__startTime = player.getFrameTime()
+
+ def _handleMove(self, event):
+ if self.getState() != "IDLE":
+ if (event.contact.distancefromstart >
+ self.__maxDist*player.getPixelsPerMM()):
+ self._setFail(event)
+
+ def _handleUp(self, event):
+ if self.getState() == "POSSIBLE":
+ if (event.contact.distancefromstart >
+ self.__maxDist*player.getPixelsPerMM()):
+ self._setFail(event)
+ else:
+ self._setDetected(event)
+
+ def _onFrame(self):
+ downTime = player.getFrameTime() - self.__startTime
+ if self.getState() == "POSSIBLE":
+ if self.__maxTime and downTime > self.__maxTime:
+ self._setFail(None)
+ super(TapRecognizer, self)._onFrame()
+
+
+class DoubletapRecognizer(Recognizer):
+
+ MAX_DOUBLETAP_TIME = None
+
+ def __init__(self, node, maxTime=None, maxDist=None, initialEvent=None,
+ possibleHandler=None, failHandler=None, detectedHandler=None):
+ if maxTime == None:
+ maxTime = DoubletapRecognizer.MAX_DOUBLETAP_TIME
+ self.__maxTime = maxTime
+ if maxDist == None:
+ maxDist = TapRecognizer.MAX_TAP_DIST
+ self.__maxDist = maxDist
+
+ self.__stateMachine = statemachine.StateMachine("DoubletapRecognizer", "IDLE")
+ self.__stateMachine.addState("IDLE", ("DOWN1",), enterFunc=self.__enterIdle)
+ self.__stateMachine.addState("DOWN1", ("UP1", "IDLE"))
+ self.__stateMachine.addState("UP1", ("DOWN2", "IDLE"))
+ self.__stateMachine.addState("DOWN2", ("IDLE",))
+ #self.__stateMachine.traceChanges(True)
+ self.__frameHandlerID = None
+ super(DoubletapRecognizer, self).__init__(node, False, 1,
+ initialEvent, possibleHandler, failHandler, detectedHandler)
+
+ def abort(self):
+ if self.__stateMachine.state != "IDLE":
+ self.__stateMachine.changeState("IDLE")
+ super(DoubletapRecognizer, self).abort()
+
+ def enable(self, isEnabled):
+ if self.__stateMachine.state != "IDLE":
+ self.__stateMachine.changeState("IDLE")
+ super(DoubletapRecognizer, self).enable(isEnabled)
+
+ def _handleDown(self, event):
+ self.__startTime = player.getFrameTime()
+ if self.__stateMachine.state == "IDLE":
+ self.__frameHandlerID = player.subscribe(player.ON_FRAME, self.__onFrame)
+ self.__stateMachine.changeState("DOWN1")
+ self.__startPos = event.pos
+ self._setPossible(event)
+ elif self.__stateMachine.state == "UP1":
+ if ((event.pos - self.__startPos).getNorm() >
+ self.__maxDist*player.getPixelsPerMM()):
+ self.__stateMachine.changeState("IDLE")
+ self._setFail(event)
+ else:
+ self.__stateMachine.changeState("DOWN2")
+ else:
+ assert(False), self.__stateMachine.state
+
+ def _handleMove(self, event):
+ if self.__stateMachine.state != "IDLE":
+ if ((event.pos - self.__startPos).getNorm() >
+ self.__maxDist*player.getPixelsPerMM()):
+ self.__stateMachine.changeState("IDLE")
+ self._setFail(event)
+
+ def _handleUp(self, event):
+ if self.__stateMachine.state == "DOWN1":
+ self.__startTime = player.getFrameTime()
+ self.__stateMachine.changeState("UP1")
+ elif self.__stateMachine.state == "DOWN2":
+ if ((event.pos - self.__startPos).getNorm() >
+ self.__maxDist*player.getPixelsPerMM()):
+ self._setFail(event)
+ else:
+ self._setDetected(event)
+ self.__stateMachine.changeState("IDLE")
+ elif self.__stateMachine.state == "IDLE":
+ pass
+ else:
+ assert(False), self.__stateMachine.state
+
+ def __onFrame(self):
+ downTime = player.getFrameTime() - self.__startTime
+ if downTime > self.__maxTime:
+ self._setFail(None)
+ self.__stateMachine.changeState("IDLE")
+
+ def __enterIdle(self):
+ player.unsubscribe(player.ON_FRAME, self.__frameHandlerID)
+
+
+class SwipeRecognizer(Recognizer):
+
+ LEFT = 1
+ RIGHT = 2
+ UP = 3
+ DOWN = 4
+
+ SWIPE_DIRECTION_TOLERANCE = math.pi/8
+ MIN_SWIPE_DIST = 50
+ MAX_SWIPE_CONTACT_DIST = 100
+
+ def __init__(self, node, direction, numContacts=1, initialEvent=None,
+ directionTolerance=SWIPE_DIRECTION_TOLERANCE, minDist=MIN_SWIPE_DIST,
+ maxContactDist=MAX_SWIPE_CONTACT_DIST,
+ possibleHandler=None, failHandler=None, detectedHandler=None):
+
+ self.__numContacts = numContacts
+ self.__angleWanted = self.__angleFromDirection(direction)
+ self.__directionTolerance = directionTolerance
+ self.__minDist = minDist*player.getPixelsPerMM()
+ self.__maxInterContactDist = maxContactDist*player.getPixelsPerMM()
+ super(SwipeRecognizer, self).__init__(node, False, numContacts,
+ initialEvent, possibleHandler=possibleHandler, failHandler=failHandler,
+ detectedHandler=detectedHandler)
+
+ def _handleDown(self, event):
+ if len(self._contacts) == 1:
+ self.__startPos = event.pos
+ else:
+ if (event.pos-self.__startPos).getNorm() > self.__maxInterContactDist:
+ self._setFail(event)
+ return
+ if len(self._contacts) == self.__numContacts:
+ self._setPossible(event)
+
+ def _handleMove(self, event):
+ pass
+
+ def _handleUp(self, event):
+ if self.getState() == "POSSIBLE":
+ if (event.contact.distancefromstart < self.__minDist or
+ not(self.__isValidAngle(event.contact.motionangle))):
+ self._setFail(event)
+ elif len(self._contacts) == 0:
+ self._setDetected(event)
+
+ def __angleFromDirection(self, direction):
+ if direction == SwipeRecognizer.RIGHT:
+ return 0
+ elif direction == SwipeRecognizer.DOWN:
+ return math.pi/2
+ elif direction == SwipeRecognizer.LEFT:
+ return math.pi
+ elif direction == SwipeRecognizer.UP:
+ return 3*math.pi/2
+ else:
+ raise RuntimeError("%s is not a valid direction."%direction)
+
+ def __isValidAngle(self, angle):
+ if angle < 0:
+ angle += 2*math.pi
+ minAngle = self.__angleWanted - self.__directionTolerance
+ maxAngle = self.__angleWanted + self.__directionTolerance
+ if minAngle >= 0:
+ return angle > minAngle and angle < maxAngle
+ else:
+ # Valid range spans 0
+ return angle > minAngle+2*math.pi or angle < maxAngle
+
+
+class HoldRecognizer(Recognizer):
+
+ HOLD_DELAY = None
+
+ def __init__(self, node, delay=None, maxDist=None, initialEvent=None,
+ possibleHandler=None, failHandler=None,
+ detectedHandler=None, stopHandler=None):
+ if delay == None:
+ delay = HoldRecognizer.HOLD_DELAY
+ self.__delay = delay
+ if maxDist == None:
+ maxDist = TapRecognizer.MAX_TAP_DIST
+ self.__maxDist = maxDist
+
+ self.__lastEvent = None
+ super(HoldRecognizer, self).__init__(node, True, 1, initialEvent,
+ possibleHandler, failHandler, detectedHandler, stopHandler)
+
+ def _handleDown(self, event):
+ self.__lastEvent = event
+ self._setPossible(event)
+ self.__startTime = player.getFrameTime()
+
+ def _handleMove(self, event):
+ self.__lastEvent = event
+ if self.getState() == "POSSIBLE":
+ if (event.contact.distancefromstart >
+ self.__maxDist*player.getPixelsPerMM()):
+ self._setFail(event)
+
+ def _handleUp(self, event):
+ self.__lastEvent = event
+ if self.getState() == "POSSIBLE":
+ self._setFail(event)
+ elif self.getState() == "RUNNING":
+ self._setEnd(event)
+
+ def _onFrame(self):
+ downTime = player.getFrameTime() - self.__startTime
+ if self.getState() == "POSSIBLE":
+ if downTime > self.__delay:
+ self._setDetected(self.__lastEvent)
+ super(HoldRecognizer, self)._onFrame()
+
+
+class DragRecognizer(Recognizer):
+
+ ANY_DIRECTION = 0
+ VERTICAL = 1
+ HORIZONTAL = 2
+
+ DIRECTION_TOLERANCE = math.pi/4
+ MIN_DRAG_DIST = None
+ FRICTION = None
+
+ def __init__(self, eventNode, coordSysNode=None, initialEvent=None,
+ direction=ANY_DIRECTION, directionTolerance=DIRECTION_TOLERANCE,
+ friction=None, minDragDist=None,
+ possibleHandler=None, failHandler=None, detectedHandler=None,
+ moveHandler=None, upHandler=None, endHandler=None):
+
+ if coordSysNode != None:
+ self.__coordSysNode = weakref.ref(coordSysNode)
+ else:
+ self.__coordSysNode = weakref.ref(eventNode)
+ self.__direction = direction
+ self.__directionTolerance = directionTolerance
+
+ if minDragDist != None:
+ self.__minDragDist = minDragDist
+ else:
+ if self.__direction == DragRecognizer.ANY_DIRECTION:
+ self.__minDragDist = 0
+ else:
+ self.__minDragDist = DragRecognizer.MIN_DRAG_DIST
+
+ if friction == None:
+ self.__friction = DragRecognizer.FRICTION
+ else:
+ self.__friction = friction
+
+ self.__isSliding = False
+ self.__inertiaHandler = None
+ super(DragRecognizer, self).__init__(eventNode, True, 1,
+ initialEvent, possibleHandler=possibleHandler, failHandler=failHandler,
+ detectedHandler=detectedHandler, endHandler=endHandler)
+ self.subscribe(Recognizer.MOTION, moveHandler)
+ self.subscribe(Recognizer.UP, upHandler)
+
+ def abort(self):
+ if self.__inertiaHandler:
+ self.__inertiaHandler.abort()
+ self.__inertiaHandler = None
+ super(DragRecognizer, self).abort()
+
+ def _handleDown(self, event):
+ if not self._handleCoordSysNodeUnlinked():
+ if self.__inertiaHandler:
+ self.__inertiaHandler.abort()
+ self._setEnd(event)
+ if self.__friction != -1:
+ self.__inertiaHandler = InertiaHandler(self.__friction,
+ self.__onInertiaMove, self.__onInertiaStop)
+ if self.__minDragDist == 0:
+ self._setDetected(event)
+ else:
+ self._setPossible(event)
+ pos = self.__relEventPos(event)
+ self.__dragStartPos = pos
+ self.__lastPos = pos
+
+ def _handleMove(self, event):
+ if not self._handleCoordSysNodeUnlinked():
+ if self.getState() != "IDLE":
+ pos = self.__relEventPos(event)
+ offset = pos - self.__dragStartPos
+ if self.getState() == "RUNNING":
+ self.notifySubscribers(Recognizer.MOTION, [offset]);
+ else:
+ if offset.getNorm() > self.__minDragDist*player.getPixelsPerMM():
+ if self.__angleFits(offset):
+ self._setDetected(event)
+ self.notifySubscribers(Recognizer.MOTION, [offset]);
+ else:
+ self.__fail(event)
+ if self.__inertiaHandler:
+ self.__inertiaHandler.onDrag(Transform(pos - self.__lastPos))
+ self.__lastPos = pos
+
+ def _handleUp(self, event):
+ if not self._handleCoordSysNodeUnlinked():
+ if self.getState() != "IDLE":
+ pos = self.__relEventPos(event)
+ if self.getState() == "RUNNING":
+ self.__offset = pos - self.__dragStartPos
+ self.notifySubscribers(Recognizer.UP, [self.__offset]);
+ if self.__friction != -1:
+ self.__isSliding = True
+ self.__inertiaHandler.onDrag(Transform(pos - self.__lastPos))
+ self.__inertiaHandler.onUp()
+ else:
+ self._setEnd(event)
+ else:
+ self.__fail(event)
+
+ def _handleCoordSysNodeUnlinked(self):
+ if self.__coordSysNode().getParent():
+ return False
+ else:
+ self.abort()
+ return True
+
+ def __fail(self, event):
+ self._setFail(event)
+ if self.__inertiaHandler:
+ self.__inertiaHandler.abort()
+ self.__inertiaHandler = None
+
+ def __onInertiaMove(self, transform):
+ self.__offset += transform.trans
+ self.notifySubscribers(Recognizer.MOTION, [self.__offset]);
+
+ def __onInertiaStop(self):
+ self.__inertiaHandler = None
+ self.__isSliding = False
+ if self.getState() == "POSSIBLE":
+ self._setFail(None)
+ else:
+ self._setEnd(None)
+
+ def __relEventPos(self, event):
+ return self.__coordSysNode().getParent().getRelPos(event.pos)
+
+ def __angleFits(self, offset):
+ angle = offset.getAngle()
+ if angle < 0:
+ angle = -angle
+ if self.__direction == DragRecognizer.VERTICAL:
+ return (angle > math.pi/2-self.__directionTolerance
+ and angle < math.pi/2+self.__directionTolerance)
+ elif self.__direction == DragRecognizer.HORIZONTAL:
+ return (angle < self.__directionTolerance
+ or angle > math.pi-self.__directionTolerance)
+ else:
+ return True
+
+class Mat3x3:
+ # Internal class. Will be removed again.
+
+ def __init__(self, row0=(1,0,0), row1=(0,1,0), row2=(0,0,1)):
+ self.m = [row0, row1, row2]
+
+ @classmethod
+ def translate(cls, t):
+ return Mat3x3([1, 0, t[0]],
+ [0, 1, t[1]])
+
+ @classmethod
+ def rotate(cls, a):
+ return Mat3x3([math.cos(a), -math.sin(a), 0],
+ [math.sin(a), math.cos(a), 0])
+
+ @classmethod
+ def pivotRotate(cls, t, a):
+ rot = Mat3x3.rotate(a)
+ trans = Mat3x3.translate(t)
+ return trans.applyMat(rot.applyMat(trans.inverse()))
+
+ @classmethod
+ def scale(cls, s):
+ return Mat3x3([s[0], 0, 0],
+ [0, s[1], 0])
+
+ @classmethod
+ def fromNode(cls, node):
+ return Mat3x3.translate(node.pos).applyMat(
+ Mat3x3.translate(node.pivot).applyMat(
+ Mat3x3.rotate(node.angle).applyMat(
+ Mat3x3.translate(-node.pivot).applyMat(
+ Mat3x3.scale(node.size)))))
+
+ def setNodeTransform(self, node):
+ v = self.applyVec([1,0,0])
+ rot = avg.Point2D(v[0], v[1]).getAngle()
+ node.angle = rot
+ if self.getScale().x < 9999 and self.getScale().y < 9999:
+ node.size = self.getScale()
+ else:
+ node.size = (0,0)
+ node.pivot = node.size/2
+ v = self.applyVec([0,0,1])
+ node.pos = (avg.Point2D(v[0], v[1]) + (node.pivot).getRotated(node.angle) -
+ node.pivot)
+
+ def getScale(self):
+ v = self.applyVec([1,0,0])
+ xscale = avg.Point2D(v[0], v[1]).getNorm()
+ v = self.applyVec([0,1,0])
+ yscale = avg.Point2D(v[0], v[1]).getNorm()
+ return avg.Point2D(xscale, yscale)
+
+ def __str__(self):
+ return self.m.__str__()
+
+ def applyVec(self, v):
+ m = self.m
+ v1 = []
+ for i in range(3):
+ v1.append(m[i][0]*v[0] + m[i][1]*v[1] + m[i][2]*v[2])
+ return v1
+
+ def applyMat(self, m1):
+ m0 = self.m
+ result = Mat3x3()
+ for i in range(3):
+ v = []
+ for j in range(3):
+ v.append(m0[i][0]*m1.m[0][j] + m0[i][1]*m1.m[1][j] + m0[i][2]*m1.m[2][j])
+ result.m[i] = v
+ return result
+
+ def det(self):
+ m = self.m
+ return float( m[0][0] * (m[2][2]*m[1][1]-m[2][1]*m[1][2])
+ -m[1][0] * (m[2][2]*m[0][1]-m[2][1]*m[0][2])
+ +m[2][0] * (m[1][2]*m[0][1]-m[1][1]*m[0][2]))
+
+ def scalarMult(self, s):
+ m = self.m
+ result = Mat3x3()
+ for i in range(3):
+ v = []
+ for j in range(3):
+ v.append(m[i][j]*s)
+ result.m[i] = v
+ return result
+
+ def inverse(self):
+ m = self.m
+ temp = Mat3x3([ m[2][2]*m[1][1]-m[2][1]*m[1][2], -(m[2][2]*m[0][1]-m[2][1]*m[0][2]), m[1][2]*m[0][1]-m[1][1]*m[0][2] ],
+ [-(m[2][2]*m[1][0]-m[2][0]*m[1][2]), m[2][2]*m[0][0]-m[2][0]*m[0][2] , -(m[1][2]*m[0][0]-m[1][0]*m[0][2])],
+ [ m[2][1]*m[1][0]-m[2][0]*m[1][1], -(m[2][1]*m[0][0]-m[2][0]*m[0][1]), m[1][1]*m[0][0]-m[1][0]*m[0][1] ])
+ return temp.scalarMult(1/self.det())
+
+
+def getCentroid(indexes, pts):
+ c = avg.Point2D(0, 0)
+ for i in indexes:
+ c += pts[i]
+ return c/len(indexes)
+
+def calcKMeans(pts):
+
+ # in: List of points
+ # out: Two lists, each containing indexes into the input list
+ assert(len(pts) > 1)
+ p1 = pts[0]
+ p2 = pts[1]
+ oldP1 = None
+ oldP2 = None
+ j = 0
+ while not(p1 == oldP1 and p2 == oldP2) and j < 50:
+ l1 = []
+ l2 = []
+ # Group points
+ for i, pt in enumerate(pts):
+ dist1 = (pt-p1).getNorm()
+ dist2 = (pt-p2).getNorm()
+ if dist1 < dist2:
+ l1.append(i)
+ else:
+ l2.append(i)
+ oldP1 = p1
+ oldP2 = p2
+ p1 = getCentroid(l1, pts)
+ p2 = getCentroid(l2, pts)
+ j += 1
+ return l1, l2
+
+
+class Transform():
+ def __init__(self, trans, rot=0, scale=1, pivot=(0,0)):
+ self.trans = avg.Point2D(trans)
+ self.rot = rot
+ self.scale = scale
+ self.pivot = avg.Point2D(pivot)
+
+ def moveNode(self, node):
+ transMat = Mat3x3.translate(self.trans)
+ rotMat = Mat3x3.rotate(self.rot)
+ scaleMat = Mat3x3.scale((self.scale, self.scale))
+ pivotMat = Mat3x3.translate(self.pivot)
+ invPivotMat = pivotMat.inverse()
+ startTransform = Mat3x3.fromNode(node)
+ newTransform = pivotMat.applyMat(
+ rotMat.applyMat(
+ scaleMat.applyMat(
+ invPivotMat.applyMat(
+ transMat.applyMat(
+ startTransform)))))
+ newTransform.setNodeTransform(node)
+
+ def __repr__(self):
+ return "Transform"+str((self.trans, self.rot, self.scale, self.pivot))
+
+
+class TransformRecognizer(Recognizer):
+
+ FILTER_MIN_CUTOFF = None
+ FILTER_BETA = None
+
+ def __init__(self, eventNode, coordSysNode=None, initialEvent=None, friction=None,
+ detectedHandler=None, moveHandler=None, upHandler=None, endHandler=None):
+ if coordSysNode != None:
+ self.__coordSysNode = weakref.ref(coordSysNode)
+ else:
+ self.__coordSysNode = weakref.ref(eventNode)
+
+ if friction == None:
+ self.__friction = DragRecognizer.FRICTION
+ else:
+ self.__friction = friction
+
+ self.__baseTransform = Mat3x3()
+ self.__lastPosns = []
+ self.__posns = []
+ self.__inertiaHandler = None
+ self.__filters = {}
+ self.__frameHandlerID = None
+ super(TransformRecognizer, self).__init__(eventNode, True, None,
+ initialEvent, detectedHandler=detectedHandler, endHandler=endHandler)
+ self.subscribe(Recognizer.MOTION, moveHandler)
+ self.subscribe(Recognizer.UP, upHandler)
+
+ def enable(self, isEnabled):
+ if bool(isEnabled) != self.isEnabled() and not(isEnabled):
+ self.__abort()
+ super(TransformRecognizer, self).enable(isEnabled)
+
+ def abort(self):
+ self.__abort()
+ super(TransformRecognizer, self).abort()
+
+ def _handleDown(self, event):
+ numContacts = len(self._contacts)
+ self.__newPhase()
+ if self.__isFiltered():
+ self.__filters[event.contact] = [
+ filter.OneEuroFilter(mincutoff=TransformRecognizer.FILTER_MIN_CUTOFF,
+ beta=TransformRecognizer.FILTER_BETA),
+ filter.OneEuroFilter(mincutoff=TransformRecognizer.FILTER_MIN_CUTOFF,
+ beta=TransformRecognizer.FILTER_BETA)]
+ if numContacts == 1:
+ if self.__inertiaHandler:
+ self.__inertiaHandler.abort()
+ self._setEnd(event)
+ self._setDetected(event)
+ self.__frameHandlerID = player.subscribe(player.ON_FRAME, self.__onFrame)
+ if self.__friction != -1:
+ self.__inertiaHandler = InertiaHandler(self.__friction,
+ self.__onInertiaMove, self.__onInertiaStop)
+
+ def _handleUp(self, event):
+ numContacts = len(self._contacts)
+ if numContacts == 0:
+ contact = event.contact
+ transform = Transform(self.__filteredRelContactPos(contact)
+ - self.__lastPosns[0])
+ self.notifySubscribers(Recognizer.UP, [transform]);
+ player.unsubscribe(player.ON_FRAME, self.__frameHandlerID)
+ self.__frameHandlerID = None
+ if self.__friction != -1:
+ self.__inertiaHandler.onDrag(transform)
+ self.__inertiaHandler.onUp()
+ else:
+ self._setEnd(event)
+ elif numContacts == 1:
+ self.__newPhase()
+ else:
+ self.__newPhase()
+ if self.__isFiltered():
+ del self.__filters[event.contact]
+
+ def _handleNodeGone(self):
+ if self.__coordSysNode and not(self.__coordSysNode()):
+ self.enable(False)
+ return True
+ else:
+ return super(TransformRecognizer, self)._handleNodeGone()
+
+ def __onFrame(self):
+ nodeGone = self._handleNodeGone()
+ if not(nodeGone):
+ self.__move()
+
+ def __move(self):
+ numContacts = len(self._contacts)
+ contactPosns = [self.__filteredRelContactPos(contact)
+ for contact in self._contacts]
+ if numContacts == 1:
+ transform = Transform(contactPosns[0] - self.__lastPosns[0])
+ if self.__friction != -1:
+ self.__inertiaHandler.onDrag(transform)
+ self.notifySubscribers(Recognizer.MOTION, [transform]);
+ self.__lastPosns = contactPosns
+ else:
+ if numContacts == 2:
+ self.__posns = contactPosns
+ else:
+ self.__posns = [getCentroid(self.__clusters[i], contactPosns) for
+ i in range(2)]
+
+ startDelta = self.__lastPosns[1]-self.__lastPosns[0]
+ curDelta = self.__posns[1]-self.__posns[0]
+
+ pivot = (self.__posns[0]+self.__posns[1])/2
+
+ rot = avg.Point2D.angle(curDelta, startDelta)
+
+ if self.__lastPosns[0] == self.__lastPosns[1]:
+ scale = 1
+ else:
+ scale = ((self.__posns[0]-self.__posns[1]).getNorm() /
+ (self.__lastPosns[0]-self.__lastPosns[1]).getNorm())
+
+ trans = ((self.__posns[0]+self.__posns[1])/2 -
+ (self.__lastPosns[0]+self.__lastPosns[1])/2)
+ transform = Transform(trans, rot, scale, pivot)
+ if self.__friction != -1:
+ self.__inertiaHandler.onDrag(transform)
+ self.notifySubscribers(Recognizer.MOTION, [transform]);
+ self.__lastPosns = self.__posns
+
+ def __newPhase(self):
+ self.__lastPosns = []
+ numContacts = len(self._contacts)
+ contactPosns = [self.__relContactPos(contact)
+ for contact in self._contacts]
+ if numContacts == 1:
+ self.__lastPosns.append(contactPosns[0])
+ else:
+ if numContacts == 2:
+ self.__lastPosns = contactPosns
+ else:
+ self.__clusters = calcKMeans(contactPosns)
+ self.__lastPosns = [getCentroid(self.__clusters[i], contactPosns) for
+ i in range(2)]
+
+ def __onInertiaMove(self, transform):
+ self.notifySubscribers(Recognizer.MOTION, [transform]);
+
+ def __onInertiaStop(self):
+ self.__inertiaHandler = None
+ self._setEnd(None)
+
+ def __filteredRelContactPos(self, contact):
+ rawPos = self.__relContactPos(contact)
+ if self.__isFiltered():
+ f = self.__filters[contact]
+ return avg.Point2D(f[0].apply(rawPos.x, player.getFrameTime()),
+ f[1].apply(rawPos.y, player.getFrameTime()))
+ else:
+ return rawPos
+
+ def __relContactPos(self, contact):
+ return self.__coordSysNode().getParent().getRelPos(contact.events[-1].pos)
+
+ def __isFiltered(self):
+ return TransformRecognizer.FILTER_MIN_CUTOFF != None
+
+ def __abort(self):
+ if self.__frameHandlerID:
+ player.unsubscribe(player.ON_FRAME, self.__frameHandlerID)
+ self.__frameHandlerID = None
+ if self.__inertiaHandler:
+ self.__inertiaHandler.abort()
+ self.__inertiaHandler = None
+
+
+class InertiaHandler(object):
+ def __init__(self, friction, moveHandler, stopHandler):
+ self.__friction = friction
+ self.__moveHandler = moveHandler
+ self.__stopHandler = stopHandler
+
+ self.__transVel = avg.Point2D(0, 0)
+ self.__curPivot = avg.Point2D(0, 0)
+ self.__angVel = 0
+ self.__sizeVel = avg.Point2D(0, 0)
+ self.__frameHandlerID = player.subscribe(player.ON_FRAME, self.__onDragFrame)
+
+ def abort(self):
+ player.unsubscribe(player.ON_FRAME, self.__frameHandlerID)
+ self.__stopHandler = None
+ self.__moveHandler = None
+
+ def onDrag(self, transform):
+ frameDuration = player.getFrameDuration()
+ if frameDuration > 0:
+ self.__transVel += 0.1*transform.trans/frameDuration
+ if transform.pivot != avg.Point2D(0,0):
+ self.__curPivot = transform.pivot
+ if transform.rot > math.pi:
+ transform.rot -= 2*math.pi
+ if frameDuration > 0:
+ self.__angVel += 0.1*transform.rot/frameDuration
+
+ def onUp(self):
+ player.unsubscribe(player.ON_FRAME, self.__frameHandlerID)
+ self.__frameHandlerID = player.subscribe(player.ON_FRAME, self.__onInertiaFrame)
+ self.__onInertiaFrame()
+
+ def __onDragFrame(self):
+ self.__transVel *= 0.9
+ self.__angVel *= 0.9
+
+ def __onInertiaFrame(self):
+ transNorm = self.__transVel.getNorm()
+ if transNorm - self.__friction > 0:
+ direction = self.__transVel.getNormalized()
+ self.__transVel = direction * (transNorm-self.__friction)
+ curTrans = self.__transVel * player.getFrameDuration()
+ else:
+ curTrans = avg.Point2D(0, 0)
+
+ if self.__angVel != 0:
+ angSign = self.__angVel/math.fabs(self.__angVel)
+ self.__angVel = self.__angVel - angSign*self.__friction/200
+ newAngSign = self.__angVel/math.fabs(self.__angVel)
+ if newAngSign != angSign:
+ self.__angVel = 0
+ curAng = self.__angVel * player.getFrameDuration()
+ self.__curPivot += curTrans
+
+ if transNorm - self.__friction > 0 or self.__angVel != 0:
+ if self.__moveHandler:
+ self.__moveHandler(Transform(curTrans, curAng, 1, self.__curPivot))
+ else:
+ self.__stop()
+
+ def __stop(self):
+ player.unsubscribe(player.ON_FRAME, self.__frameHandlerID)
+ self.__stopHandler()
+ self.__stopHandler = None
+ self.__moveHandler = None
+
+
+def initConfig():
+ def getFloatOption(name):
+ return float(player.getConfigOption("gesture", name))
+
+ TapRecognizer.MAX_TAP_DIST = getFloatOption("maxtapdist")
+ DoubletapRecognizer.MAX_DOUBLETAP_TIME = getFloatOption("maxdoubletaptime")
+ SwipeRecognizer.MIN_SWIPE_DIST = getFloatOption("minswipedist")
+ SwipeRecognizer.SWIPE_DIRECTION_TOLERANCE = getFloatOption("swipedirectiontolerance")
+ SwipeRecognizer.MAX_SWIPE_CONTACT_DIST = getFloatOption("maxswipecontactdist")
+ HoldRecognizer.HOLD_DELAY = getFloatOption("holddelay")
+ DragRecognizer.MIN_DRAG_DIST = getFloatOption("mindragdist")
+ DragRecognizer.FRICTION = getFloatOption("friction")
+ TransformRecognizer.FILTER_MIN_CUTOFF = getFloatOption("filtermincutoff")
+ if TransformRecognizer.FILTER_MIN_CUTOFF == -1:
+ TransformRecognizer.FILTER_MIN_CUTOFF = None
+ TransformRecognizer.FILTER_BETA = getFloatOption("filterbeta")
+
+
+initConfig()
diff --git a/src/python/grabbable.py b/src/python/grabbable.py
deleted file mode 100644
index 800e73b..0000000
--- a/src/python/grabbable.py
+++ /dev/null
@@ -1,320 +0,0 @@
-# libavg - Media Playback Engine.
-# Copyright (C) 2003-2011 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 Martin Heistermann <mh at sponc dot de>
-#
-
-import math
-
-from libavg import avg, Point2D
-from clusteredEventList import ClusteredEventList
-from mathutil import solveEquationMatrix, EquationSingular, EquationNotSolvable
-from mathutil import getAngle, getDistance, getScaledDim, getOffsetForMovedPivot
-
-
-NUM_SPEEDS = 5
-
-g_Player = avg.Player.get()
-
-def getRelPos(pos, nodePos, angle, pivot):
- return (pos - nodePos).getRotated(-angle, pivot)
-
-def getAbsPos(pos, nodePos, angle, pivot):
- return Point2D(pos).getRotated(angle, Point2D(pivot)) + Point2D(nodePos)
-
-
-class Grabbable:
- """Helper for multitouch object movement.
- Grabbable will add the well-known multitouch gestures
- to a node, i.e. moving with one finger, rotating,
- resizing and moving with 2 fingers.
- It also works with many more cursors/fingers, clustering
- them.
- """
- def __init__(self,
- node,
- source = avg.TOUCH | avg.MOUSE,
- maxSize = None, minSize = None,
- onResize = lambda: None,
- onDrop = lambda: None,
- onStop = lambda: None,
- onAction = lambda: None,
- onMotion = lambda pos, size, angle, pivot: None,
- onResetMotion = lambda: None,
- onDragStart = lambda: None,
- initialDown = None,
- inertia = 0.95,
- torque = 0.95,
- moveNode = True):
-
- global g_Player
- self.__inertia = inertia
- self.__torque = torque
- self.__node = node
- self.__minSize = minSize
- self.__maxSize = maxSize
- self.__moveNode = moveNode
- self.__callback = {
- 'onResize': onResize,
- 'onDrop': onDrop,
- 'onStop': onStop,
- 'onAction': onAction,
- 'onMotion': onMotion,
- 'onResetMotion': onResetMotion,
- 'onDragStart': onDragStart,
- }
-
- self.__stopInertia()
- #self.__oldAngle = 0.0
- self.__lastFixPoint = None
- self.__lastNumFingers = 0
- self.__onFrameHandler = g_Player.setOnFrameHandler(self.__onFrame)
-
- self.__eventList = ClusteredEventList (self.__node,
- source = source,
- onMotion = self.__onMotion,
- onUp = self.__onUp,
- onDown = self.__onDown,
- resetMotion = self.__resetMotion
- )
- if initialDown:
- self.__eventList.handleInitialDown (initialDown)
- self.__lastPos = None
- self.__stopped = True
-
- def isDragging(self):
- return len(self.__eventList) > 0
-
- def getSpeed(self):
- return self.__speed
-
- def getAngle(self):
- return self.__angle
-
- def delete(self):
- global g_Player
- g_Player.clearInterval(self.__onFrameHandler)
- self.__eventList.delete()
- self.__node = None
-
- def __onFrame(self):
- global g_Player
- if len (self.__eventList) == 0:
- # inertia
- if self.__speed.getNorm() < 1:
- if not self.__stopped:
- pos = Point2D(round(self.__node.pos.x), round(self.__node.pos.y))
- size = Point2D(round(self.__node.size.x), round(self.__node.size.y))
- self.__callback['onMotion'](pos, size, self.__node.angle,
- self.__node.pivot)
- self.__stopped = True
- self.__callback['onStop']()
- self.__stopInertia()
- return
-
- pos = self.__node.pos + self.__speed
- angle = self.__node.angle + self.__rotSpeed
- size = self.__node.size
- pivot = self.__node.pivot
-
- if self.__moveNode:
- self.__node.pos = pos
- self.__node.size = size
- self.__node.angle = angle
- self.__node.pivot = pivot
-
- self.__callback['onMotion'](pos, size, angle, pivot)
-
- self.__speed *= self.__inertia
- self.__rotSpeed *= self.__torque
- else:
- self.__stopped = False
- # save current speed for inertia
- pos = self.__node.pos
- angle = self.__node.angle
- if self.__lastPos:
- speed = pos - self.__lastPos
- rotSpeed = angle - self.__lastAngle
- # use minimal angle to avoid extreme rotation:
- if rotSpeed < -math.pi/2:
- rotSpeed += math.pi*2
- if rotSpeed > math.pi/2:
- rotSpeed -= math.pi*2
- self.__speeds = (self.__speeds + [speed])[-NUM_SPEEDS:]
- self.__rotSpeeds = (self.__rotSpeeds + [rotSpeed])[-NUM_SPEEDS:]
- self.__lastPos = pos
- self.__lastAngle = angle
-
- def __stopInertia (self):
- self.__speed = Point2D(0,0)
- self.__rotSpeed = 0
- self.__speeds = [Point2D(0,0)]
- self.__rotSpeeds = [0.0]
- self.__lastPos = None
-
- def __onDown(self):
- def __gotoTopLayer():
- parent = self.__node.getParent()
- numChildren = parent.getNumChildren()
- parent.reorderChild(self.__node, numChildren - 1)
-
- self.__stopInertia()
- self.__reshape()
- if len(self.__eventList) == 1: # first finger down
- if self.__moveNode:
- __gotoTopLayer()
- self.__callback['onDragStart']()
- self.__callback['onAction']()
-
- def __onMotion(self):
- self.__reshape()
- self.__callback['onAction']()
-
- def __drop(self):
- self.__speed = sum(self.__speeds, Point2D(0,0)) / len(self.__speeds)
- self.__rotSpeed = sum(self.__rotSpeeds, 0.0) / len(self.__rotSpeeds)
- self.__callback['onDrop']()
-
- def __onUp(self):
- if len(self.__eventList) == 0:
- self.__drop()
- self.__callback['onAction']()
-
- def __reshape (self):
- def applyAffineTransformation (parameters, p):
- """apply transformation to point:
- M: v:
- P' = P * (m -n) + (v0)
- (n m) (v1) """
- m, n, v0, v1 = parameters
- nx = p[0] * m - p[1] * n + v0
- ny = p[0] * n + p[1] * m + v1
- return Point2D(nx, ny)
-
- clusters = self.__eventList.getCursors()
-
- if len(clusters) == 1:
- cursor = self.__eventList.getCursors()[0]
-
- pos = self.__oldpos + cursor.getDelta()
- size = self.__node.size
- angle = self.__node.angle
- pivot = self.__node.pivot
-
- elif len(clusters) == 2:
- # calculate an affine transformation which describes cluster movement
- # TODO: explain used maths
- cursor1, cursor2 = clusters
- equationMatrix = (
- ((cursor1.getStartPos().x, -cursor1.getStartPos().y, 1, 0), cursor1.getPos().x),
- ((cursor1.getStartPos().y, cursor1.getStartPos().x, 0, 1), cursor1.getPos().y),
- ((cursor2.getStartPos().x, -cursor2.getStartPos().y, 1, 0), cursor2.getPos().x),
- ((cursor2.getStartPos().y, cursor2.getStartPos().x, 0, 1), cursor2.getPos().y),
- )
- try:
- param = solveEquationMatrix (equationMatrix)
- except (EquationSingular, EquationNotSolvable):
-# g_Log.trace(g_Log.APP,
-# "Grabbable: cannot solve equation, skipping movement")
- return False
-
- absTouchCenter = cursor2.getPos() + (cursor1.getPos() - cursor2.getPos()) / 2
-
- n_tl = applyAffineTransformation (param, self.o_tl)
- n_bl = applyAffineTransformation (param, self.o_bl)
- n_tr = applyAffineTransformation (param, self.o_tr)
-
- pos = n_tl
- if pos.x > 1e6 and pos.x > self.o_tl.x:
- pos = self.o_tl
- if pos.y > 1e6 and pos.y > self.o_tl.y:
- pos = self.o_tl
- if pos.x < -1e6 and pos.x < self.o_tl.x:
- pos = self.o_tl
- if pos.y < -1e6 and pos.y < self.o_tl.y:
- pos = self.o_tl
-
- size = Point2D(getDistance (n_tl, n_tr), getDistance (n_tl, n_bl))
- if size.x<=0.1:
- size.x=0.1
- if size.y<=0.1:
- size.y=0.1
- angle = getAngle(n_tl, n_tr) # pivot for this rotation is 0,0 (rel. to node)
-
- # get middle of touches relative to the node
- relTouchCenter = getRelPos(absTouchCenter, pos, angle, Point2D(0,0))
- pos += getOffsetForMovedPivot(
- oldPivot = Point2D(0,0),
- newPivot = relTouchCenter,
- angle = angle)
- pivot = relTouchCenter
-
- # the absolute position of the pivot should change when
- # resizing, so we track and revert absolute pivot movement
- oldAbsPivot = getAbsPos(pivot, pos, angle, pivot)
-
- newSize = getScaledDim (size,
- max = self.__maxSize,
- min = self.__minSize)
-
- ratio = newSize.x / size.x
- newPivot = pivot * ratio
-
- pos += getOffsetForMovedPivot(
- oldPivot = pivot,
- newPivot = newPivot,
- angle = angle)
- oldPivot = pivot
- pivot = newPivot
-
- size = newSize
-
- newAbsPivot = getAbsPos(pivot, pos, angle, pivot)
-
- # move node to revert absolute pivot position
- pos -= (newAbsPivot - oldAbsPivot)
-
- else: # more than 2 clusters
- assert False
-
- if self.__moveNode:
- self.__node.angle = angle
- self.__node.size = size
- self.__node.pos = pos
- self.__node.pivot = pivot
- self.__callback['onResize']()
-
- self.__callback['onMotion'](pos, size, angle, pivot)
-
- def __resetMotion (self):
- """ sets a new movement start point """
- # store absolute position at the beginning of the movement
- # for 2-finger-movements:
- def getPos(pos):
- return getAbsPos(pos, self.__node.pos, self.__node.angle, self.__node.pivot)
- self.o_tl = getPos((0, 0))
- self.o_bl = getPos((0, self.__node.height))
- self.o_tr = getPos((self.__node.width, 0))
-
- # for 1-finger-movements:
- self.__oldpos = self.__node.pos
-
- self.__lastFixPoint = None
- self.__callback['onResetMotion']()
-
diff --git a/src/python/graph.py b/src/python/graph.py
index c59cc2b..9be9d6d 100644
--- a/src/python/graph.py
+++ b/src/python/graph.py
@@ -1,5 +1,5 @@
# libavg - Media Playback Engine.
-# Copyright (C) 2003-2011 Ulrich von Zadow
+# 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
@@ -17,153 +17,213 @@
#
# Current versions can be found at www.libavg.de
+import math
import time
-from libavg import avg
+from libavg import avg, player, Point2D
-g_Player = avg.Player.get()
-class Graph(object):
- def __init__(self, graph, getValue):
- self._getValue = getValue
- self._xSkip = 2
- self._memGraphStartTime = g_Player.getFrameTime()
+class Graph(avg.DivNode):
+ def __init__(self, title='', getValue=None, parent=None, **kwargs):
+ super(Graph, self).__init__(**kwargs)
+ self.registerInstance(self, parent)
+
+ self._getValue = getValue
+ self._xSkip = 2
self._curUsage = 0
-
- self._rootNode = g_Player.getRootNode()
- size = avg.Point2D(self._rootNode.width-20, self._rootNode.height/6)
-
- self._node = g_Player.createNode("""
- <div opacity="0" sensitive="False" x="10" y="10" size="%(size)s">
- <rect strokewidth="0" fillopacity="0.6" fillcolor="FFFFFF"
- size="%(size)s"/>
- <words x="10" y="%(wordsheight0)i" color="000080"/>
- <words x="10" y="%(wordsheight1)i" color="000080"/>
- <polyline color="008000"/>
- <polyline color="000080"/>
- <words x="10" y="0" color="000080"/>
- </div>"""
- % {'size': str(size), 'wordsheight0':size.y-22, 'wordsheight1':size.y-39})
-
- self._graphSize = size-avg.Point2D(20, 20)
- self._rootNode.appendChild(self._node)
- self._textNode0 = self._node.getChild(1)
- self._textNode1 = self._node.getChild(2)
- self._maxLineNode = self._node.getChild(3)
- self._lineNode = self._node.getChild(4)
- self.__graphText = self._node.getChild(5)
- self.__graphText.text = graph
+ self.sensitive = False
+ avg.RectNode(parent=self, strokewidth=0, fillopacity=0.6, fillcolor="FFFFFF",
+ size=self.size)
+ self._textNode0 = avg.WordsNode(parent=self, x=10, y=self.size.y - 22,
+ color="000080")
+ self._textNode1 = avg.WordsNode(parent=self, x=10, y=self.size.y - 39,
+ color="000080")
+ self._maxLineNode = avg.PolyLineNode(parent=self, color="880000")
+ self._lineNode = avg.PolyLineNode(parent=self, color="008000")
+ self.__graphText = avg.WordsNode(parent=self, x=10, y=0, color="000080")
+ self.__graphText.text = title
self._setup()
- avg.fadeIn(self._node, 300)
-
+
def _setup(self):
- raise RuntimeError, 'Please overload _setup() function'
+ raise RuntimeError('Please overload _setup() function')
+
+
+class AveragingGraph(Graph):
+
+ def __init__(self, title='', getValue=None, parent=None, **kwargs):
+ super(AveragingGraph, self).__init__(title, getValue, parent, **kwargs)
+ self.registerInstance(self, None)
+
+ def unlink(self, kill):
+ player.clearInterval(self.__interval)
+ self.__interval = None
+ super(AveragingGraph, self).unlink(kill)
- def setYpos(self,ypos):
- self._node.y = ypos
-
- def delete(self):
- def kill():
- self._node.unlink()
- avg.LinearAnim(self._node, "opacity", 300, 1, 0, None, kill).start()
- g_Player.clearInterval(self._interval)
- self._interval = None
-
-
-class MemGraph(Graph):
def _setup(self):
- self._interval = g_Player.setInterval(1000, self._nextMemSample)
- self._memSampleNum = 0
+ self.__interval = player.setInterval(1000, self._nextMemSample)
+ self.__numSamples = 0
self._usage = [0]
self._maxUsage = [0]
self._minutesUsage = [0]
self._minutesMaxUsage = [0]
-
+ self._nextMemSample()
+
def _nextMemSample(self):
curUsage = self._getValue()
self._usage.append(curUsage)
maxUsage = self._maxUsage[-1]
-
- if curUsage>maxUsage:
+
+ if curUsage > maxUsage:
maxUsage = curUsage
lastMaxChangeTime = time.time()
self._textNode1.text = ("Last increase in maximum: "
- +time.strftime("%d.%m.%Y %H:%M:%S",
- time.localtime(lastMaxChangeTime)))
+ + time.strftime("%d.%m.%Y %H:%M:%S",
+ time.localtime(lastMaxChangeTime)))
self._maxUsage.append(maxUsage)
- self._memSampleNum += 1
-
- if self._memSampleNum % 60 == 0:
- lastMinuteAverage = sum(self._usage[-60:])/60
+ self.__numSamples += 1
+
+ if self.__numSamples % 60 == 0:
+ lastMinuteAverage = sum(self._usage[-60:]) / 60
self._minutesUsage.append(lastMinuteAverage)
self._minutesMaxUsage.append(maxUsage)
-
- if self._memSampleNum < 60*60:
+
+ if self.__numSamples < 60 * 60:
self._plotLine(self._usage, self._lineNode, maxUsage)
- self._plotLine(self._maxUsage, self._maxLineNode, maxUsage)
- else:
+ self._plotLine(self._maxUsage, self._maxLineNode, maxUsage)
+ else:
self._plotLine(self._minutesUsage, self._lineNode, maxUsage)
self._plotLine(self._minutesMaxUsage, self._maxLineNode, maxUsage)
-
- self._textNode0.text = ("Max. memory usage: %(size).2f MB"
- %{"size":maxUsage/(1024*1024.)})
-
- if self._memSampleNum % 3600 == 0:
+
+ self._textNode0.text = ("Max. memory usage: %(size).2f MB" %
+ {"size": maxUsage / (1024 * 1024.0)})
+
+ if self.__numSamples % 3600 == 0:
del self._usage[0:3600]
del self._maxUsage[0:3599]
- if self._memSampleNum == 604800:
- self._memSampleNum == 0
-
+ if self.__numSamples == 604800:
+ self.__numSamples == 0
+
def _plotLine(self, data, node, maxy):
- yfactor = self._graphSize.y/float(maxy)
- xfactor = self._graphSize.x/float(len(data)-1)
- node.pos = [(pos[0]*xfactor+10, (maxy-pos[1])*yfactor+10)
- for pos in enumerate(data)]
+ yfactor = (self.size.y - 10.0) / float(maxy)
+ xfactor = (self.size.x - 10.0) / float(len(data) - 1)
+ node.pos = [(pos[0] * xfactor + 10, (maxy - pos[1]) * yfactor + 10.0)
+ for pos in enumerate(data)]
-class FrameRateGraph(Graph):
+class SlidingGraph(Graph):
+ def __init__(self, title='', getValue=None, limit=120.0, parent=None, **kwargs):
+ super(SlidingGraph, self).__init__(title, getValue, parent, **kwargs)
+ self.registerInstance(self, None)
+ self._limitValue = float(limit)
+
def _setup(self):
- self._interval = g_Player.setOnFrameHandler(self._nextFrameTimeSample)
- self._sampleNum = 0
- self._memSampleNum = 0
+ self.__frameHandlerID = player.subscribe(avg.Player.ON_FRAME,
+ self._nextFrameTimeSample)
+ self._numSamples = 0
self._lastCurUsage = 0
self._maxFrameTime = 0
self._values = []
-
- def _nextFrameTimeSample(self):
+
+ def _nextFrameTimeSample(self):
val = self._frameTimeSample()
self._appendValue(val)
- self._sampleNum += 1
-
- def _appendValue(self,value):
- y = value + self._rootNode.height/6
- numValues = int(self._rootNode.width/self._xSkip)-10
+ self._numSamples += 1
+
+ def _appendValue(self, value):
+ maxValue = min(self._limitValue, value)
+ y = self.height - (self.height * (maxValue / self._limitValue))
+ y = max(0, y)
+ numValues = int(self.width / self._xSkip)
self._values = (self._values + [y])[-numValues:]
self._plotGraph()
-
+
def _frameTimeSample(self):
- frameTime = self._getValue()
- diff = frameTime - self._lastCurUsage
- #if(self._sampleNum % 1800 == 0):
- # self._maxFrameTime = 0
- if self._sampleNum < 2:
+ frameTime = self._getValue()
+ diff = frameTime - self._lastCurUsage
+ if self._numSamples < 2:
self._maxFrameTime = 0
if diff > self._maxFrameTime:
- lastMaxChangeTime = time.time()
+ lastMaxChangeTime = time.time()
self._maxFrameTime = diff
- self._textNode0.text = ("Max FrameTime: %.f" %self._maxFrameTime + " ms" +
- " Time: " +time.strftime("%d.%m.%Y %H:%M:%S",
- time.localtime(lastMaxChangeTime)))
- if diff > self._node.y-1:
- y = self._node.y-1
-
+ self._textNode0.text = ("Max FrameTime: %.f" % self._maxFrameTime + " ms" +
+ " Time: " + time.strftime("%d.%m.%Y %H:%M:%S",
+ time.localtime(lastMaxChangeTime)))
+
self._lastCurUsage = frameTime
- self._textNode1.text = ("Current FrameTime: %.f" %diff + " ms" )
- return -diff
+ self._textNode1.text = ("Current FrameTime: %.f" % diff + " ms")
+ return diff
def _plotGraph(self):
self._lineNode.pos = self._getCoords()
-
+
def _getCoords(self):
- return zip(xrange(10,len(self._values)*self._xSkip, self._xSkip), self._values)
+ return zip(xrange(0, len(self._values) * self._xSkip, self._xSkip), self._values)
+
+
+class BinBar(avg.DivNode):
+ def __init__(self, label, parent=None, **kwargs):
+ super(BinBar, self).__init__(**kwargs)
+ self.registerInstance(self, parent)
+
+ avg.WordsNode(text=label, fontsize=8, alignment='center',
+ pos=(self.size.x / 2, self.size.y - 12), parent=self)
+
+ self._vbar = avg.RectNode(opacity=0, fillopacity=0.4,
+ fillcolor='ff0000', parent=self)
+
+ self.update(0)
+
+ def update(self, value):
+ value = min(max(value, 0), 1)
+
+ height = (self.size.y - 15) * value
+ self._vbar.size = (self.size.x - 2, height)
+ self._vbar.pos = (1, self.size.y - height - 12)
+
+
+class BinsGraph(avg.DivNode):
+ def __init__(self, binsThresholds, parent=None, **kwargs):
+ super(BinsGraph, self).__init__(**kwargs)
+ self.registerInstance(self, parent)
+
+ avg.RectNode(size=self.size, parent=self)
+ colWidth = self.size.x / len(binsThresholds)
+ self._binBars = [BinBar(str(int(thr)),
+ pos=(idx * colWidth, 0),
+ size=(colWidth, self.size.y),
+ parent=self)
+ for idx, thr in enumerate(binsThresholds)]
+
+ def update(self, values):
+ s = sum(values)
+
+ for binBar, value in zip(self._binBars, values):
+ normValue = float(value) / s
+ logValue = math.log10(normValue * 9 + 1) if normValue != 0 else 0
+ binBar.update(logValue)
+
+
+class SlidingBinnedGraph(SlidingGraph):
+ def __init__(self, title='', getValue=None, limit=120.0, binsThresholds=[],
+ parent=None, **kwargs):
+ super(SlidingBinnedGraph, self).__init__(title, getValue, limit, parent, **kwargs)
+ if not all([isinstance(x, (int, float)) for x in binsThresholds]):
+ raise RuntimeError('Bins thresholds must be provided as list of numbers')
+
+ self._bins = [0] * len(binsThresholds)
+ self._binsThresholds = binsThresholds
+ self._binsGraph = BinsGraph(binsThresholds=binsThresholds,
+ pos=(self.size.x - 120, 5), size=(90, self.size.y - 10),
+ parent=self)
+
+ def _appendValue(self, value):
+ for i in xrange(len(self._binsThresholds) - 1, -1, -1):
+ if value >= self._binsThresholds[i]:
+ self._bins[i] += 1
+ break
+
+ if sum(self._bins) % 100 == 0:
+ self._binsGraph.update(self._bins)
+
+ super(SlidingBinnedGraph, self)._appendValue(value)
diff --git a/src/python/mathutil.py b/src/python/mathutil.py
index caa9968..b27758e 100644
--- a/src/python/mathutil.py
+++ b/src/python/mathutil.py
@@ -1,5 +1,5 @@
# libavg - Media Playback Engine.
-# Copyright (C) 2003-2011 Ulrich von Zadow
+# 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
diff --git a/src/python/methodref.py b/src/python/methodref.py
new file mode 100644
index 0000000..f59ed24
--- /dev/null
+++ b/src/python/methodref.py
@@ -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
+
+import weakref, new
+
+class methodref(object):
+ # From Python Cookbook
+ """ Wraps any callable, most importantly a bound method, in a way that allows a bound
+ method's object to be GC'ed, while providing the same interface as a normal weak
+ reference."""
+ def __init__(self, fn):
+ try:
+ # Try getting object, function and class
+ o, f, c = fn.im_self, fn.im_func, fn.im_class
+ except AttributeError:
+ # It's not a bound method
+ self._obj = None
+ self._func = fn
+ self._clas = None
+ if fn:
+ self.__name__ = fn.__name__
+ else:
+ self.__name__ = None
+ else:
+ # Bound method
+ if o is None: # ... actually UN-bound
+ self._obj = None
+ self.__name__ = f.__name__
+ else:
+ self._obj = weakref.ref(o)
+ self.__name__ = fn.im_class.__name__ + "." + fn.__name__
+ self._func = f
+ self._clas = c
+
+ def isSameFunc(self, func):
+ if self._obj is None:
+ return func == self._func
+ elif self._obj() is None:
+ return func is None
+ else:
+ try:
+ o, f, c = func.im_self, func.im_func, func.im_class
+ except AttributeError:
+ return False
+ else:
+ return (o == self._obj() and f == self._func and c == self._clas)
+
+ def __call__(self):
+ if self._obj is None:
+ return self._func
+ elif self._obj() is None:
+ return None
+ return new.instancemethod(self._func, self._obj(), self._clas)
diff --git a/src/python/mtemu.py b/src/python/mtemu.py
index 9171051..3bd348f 100644
--- a/src/python/mtemu.py
+++ b/src/python/mtemu.py
@@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
# libavg - Media Playback Engine.
-# Copyright (C) 2003-2011 Ulrich von Zadow
+# 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
@@ -23,132 +23,144 @@
# <sm (at) archimedes-solutions (dot) de>
'''
-this class provides a test to emulate one or two TOUCH/TRACK events.
-by pressing "ctrl left/right" the TOUCH events will be switched into TRACK events and the
-other way around.
-by pressing "shift left/right" a second event is created whenever the mousebutton (left)
-is clicked.
-
-Note: remove any mouse event handling from your application to avoid emulation issues
-
-For example:
-
-1) avg.MOUSE | avg.TOUCH filters can be safely reduced to avg.TOUCH
-2) the current libavg button module breaks the emulation
-3) the current libavg Grabbable class breaks the emulation, unless is created with
-source = avg.TOUCH parameter
+Multitouch emulation helper, supporting pinch gestures
'''
-from libavg import avg, Point2D
+from libavg import avg, Point2D, player
-g_Player = avg.Player.get()
class MTemu(object):
-
- mouseState = 'Up'
- cursorID = 0
- dualTouch = False
- secondTouch = False
- source = avg.TOUCH
+ MOUSE_STATE_UP = 'MOUSE_STATE_UP'
+ MOUSE_STATE_DOWN = 'MOUSE_STATE_DOWN'
def __init__(self):
- self.__rootNode = g_Player.getRootNode()
- self.__rootNode.connectEventHandler(avg.CURSORUP, avg.MOUSE,
- self, self.__onMouseUp)
- self.__rootNode.connectEventHandler(avg.CURSORDOWN, avg.MOUSE,
- self, self.__onMouseDown)
- self.__rootNode.connectEventHandler(avg.CURSORMOTION, avg.MOUSE,
- self, self.__onMouseMotion)
- posX = self.__rootNode.size.x - 15
- posY = self.__rootNode.size.y - 20
-
- self.__layer = avg.WordsNode(text='Multitouch emulation active',
- pos=(posX, posY),
+ self.__mouseState = self.MOUSE_STATE_UP
+ self.__cursorID = 0
+ self.__dualTouch = False
+ self.__secondTouch = False
+ self.__source = avg.Event.TOUCH
+
+ self.__oldEventHook = player.getEventHook()
+ player.setEventHook(self.__onEvent)
+
+ root = player.getRootNode()
+ self.__caption = avg.WordsNode(pos=(root.size.x - 15, root.size.y - 20),
alignment = 'right',
color='DDDDDD',
sensitive=False,
- fontsize=18,
- parent=self.__rootNode)
+ fontsize=14,
+ parent=root)
+ self.__updateCaption()
def deinit(self):
- self.__rootNode.disconnectEventHandler(self)
- self.__rootNode = None
- self.__layer.unlink()
- if self.mouseState == 'Down':
- self.__releaseTouch(self.cursorID)
- if self.secondTouch:
- self.__releaseTouch(self.cursorID+1)
+ player.setEventHook(self.__oldEventHook)
+ self.__caption.unlink()
+ if self.__mouseState == self.MOUSE_STATE_DOWN:
+ self.__releaseTouch(self.__cursorID)
+ if self.__secondTouch:
+ self.__releaseTouch(self.__cursorID+1)
def toggleSource(self):
'''
- Switch between avg.TOUCH and avg.TRACK - source
+ Switch between avg.Event.TOUCH and avg.Event.TRACK - source
'''
- if self.mouseState == 'Down':
- self.__releaseTouch(self.cursorID)
- if self.secondTouch:
- self.__releaseTouch(self.cursorID+1)
- self.mouseState = 'Up'
- self.secondTouch = False
- self.source = avg.TOUCH if self.source == avg.TRACK else avg.TRACK
+ self.__clearSourceState()
+ self.__source = (avg.Event.TOUCH if self.__source == avg.Event.TRACK
+ else avg.Event.TRACK)
+ self.__updateCaption()
def toggleDualTouch(self):
- self.dualTouch = not(self.dualTouch)
- if self.mouseState == 'Down':
- if self.secondTouch:
- self.__releaseTouch(self.cursorID+1)
+ self.__dualTouch = not(self.__dualTouch)
+ self.__clearDualtouchState()
+
+ def enableDualTouch(self):
+ self.__dualTouch = True
+ self.__clearDualtouchState()
+
+ def disableDualTouch(self):
+ self.__dualTouch = False
+ self.__clearDualtouchState()
+
+ def __clearSourceState(self):
+ if self.__mouseState == self.MOUSE_STATE_DOWN:
+ self.__releaseTouch(self.__cursorID)
+ if self.__secondTouch:
+ self.__releaseTouch(self.__cursorID+1)
+ self.__mouseState = self.MOUSE_STATE_UP
+ self.__secondTouch = False
+
+ def __clearDualtouchState(self):
+ if self.__mouseState == self.MOUSE_STATE_DOWN:
+ if self.__secondTouch:
+ self.__releaseTouch(self.__cursorID+1)
else:
- self.__sendFakeTouch(self.cursorID+1, Point2D(0,0),
- avg.CURSORDOWN, mirror=True)
- self.secondTouch = not(self.secondTouch)
+ self.__sendFakeTouch(self.__cursorID+1, Point2D(0,0),
+ avg.Event.CURSOR_DOWN, mirror=True)
+ self.__secondTouch = not(self.__secondTouch)
+
+ def __updateCaption(self):
+ self.__caption.text = 'Multitouch emulation (%s source)' % self.__source
+
+ def __onEvent(self, event):
+ if event.source == avg.Event.MOUSE:
+ if event.type == avg.Event.CURSOR_DOWN:
+ self.__onMouseDown(event)
+ elif event.type == avg.Event.CURSOR_MOTION:
+ self.__onMouseMotion(event)
+ elif event.type == avg.Event.CURSOR_UP:
+ self.__onMouseUp(event)
+ return True
+ else:
+ return False
def __onMouseDown(self, event):
self._initialPos = event.pos
- if self.mouseState == 'Up' and event.button == 1:
- self.__sendFakeTouch(self.cursorID, event.pos, event.type)
- if self.dualTouch and not self.secondTouch:
- self.__sendFakeTouch(self.cursorID+1, event.pos, event.type,
+ if self.__mouseState == self.MOUSE_STATE_UP and event.button == 1:
+ self.__sendFakeTouch(self.__cursorID, event.pos, event.type)
+ if self.__dualTouch and not self.__secondTouch:
+ self.__sendFakeTouch(self.__cursorID+1, event.pos, event.type,
True)
- self.secondTouch = True
- self.mouseState = 'Down'
+ self.__secondTouch = True
+ self.__mouseState = self.MOUSE_STATE_DOWN
def __onMouseMotion(self, event):
- if self.mouseState == 'Down':
- self.__sendFakeTouch(self.cursorID, event.pos, event.type)
- if self.dualTouch and self.secondTouch:
- self.__sendFakeTouch(self.cursorID+1, event.pos,
+ if self.__mouseState == self.MOUSE_STATE_DOWN:
+ self.__sendFakeTouch(self.__cursorID, event.pos, event.type)
+ if self.__dualTouch and self.__secondTouch:
+ self.__sendFakeTouch(self.__cursorID+1, event.pos,
event.type, True)
def __onMouseUp(self, event):
- if self.mouseState == 'Down' and event.button == 1:
- self.__sendFakeTouch(self.cursorID, event.pos, event.type)
- if self.dualTouch and self.secondTouch:
- self.__sendFakeTouch(self.cursorID+1, event.pos,
+ if self.__mouseState == self.MOUSE_STATE_DOWN and event.button == 1:
+ self.__sendFakeTouch(self.__cursorID, event.pos, event.type)
+ if self.__dualTouch and self.__secondTouch:
+ self.__sendFakeTouch(self.__cursorID+1, event.pos,
event.type, True)
- self.secondTouch = False
- self.mouseState = 'Up'
- self.cursorID += 2 #Even for left uneven for right touch
+ self.__secondTouch = False
+ self.__mouseState = self.MOUSE_STATE_UP
+ self.__cursorID += 2 #Even for left uneven for right touch
def __sendFakeTouch(self, cursorID, pos, touchType, mirror=False):
offset = Point2D(0,0)
- if self.dualTouch:
+ if self.__dualTouch:
offset = Point2D(40, 0)
if mirror:
pos = 2*(self._initialPos)-pos
offset = -offset
- g_Player.getTestHelper().fakeTouchEvent(cursorID,
- touchType, self.source, self.__clampPos(pos+offset))
+ player.getTestHelper().fakeTouchEvent(cursorID,
+ touchType, self.__source, self.__clampPos(pos+offset))
def __releaseTouch(self, cursorID):
- self.__sendFakeTouch(cursorID, Point2D(0,0), avg.CURSORUP)
+ self.__sendFakeTouch(cursorID, Point2D(0,0), avg.Event.CURSOR_UP)
def __clampPos(self, pos):
if pos[0] < 0:
pos[0] = 0
if pos[1] < 0:
pos[1] = 0
- if pos[0] >= g_Player.getRootNode().size[0]:
- pos[0] = g_Player.getRootNode().size[0]-1
- if pos[1] >= g_Player.getRootNode().size[1]:
- pos[1] = g_Player.getRootNode().size[1]-1
+ if pos[0] >= player.getRootNode().size[0]:
+ pos[0] = player.getRootNode().size[0]-1
+ if pos[1] >= player.getRootNode().size[1]:
+ pos[1] = player.getRootNode().size[1]-1
return pos
diff --git a/src/python/parsecamargs.py b/src/python/parsecamargs.py
index 805ae14..7515b2f 100644
--- a/src/python/parsecamargs.py
+++ b/src/python/parsecamargs.py
@@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
#
# libavg - Media Playback Engine.
-# Copyright (C) 2003-2011 Ulrich von Zadow
+# 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
@@ -21,9 +21,11 @@
# Current versions can be found at www.libavg.de
#
-import optparse
+from libavg import avg
-validPixFmt = ('I8', 'I16', 'YUV411', 'YUV422', 'YUYV422', 'RGB', 'BGR', 'BAYER8')
+validPixFmt = list();
+for formatItem in avg.getSupportedPixelFormats():
+ validPixFmt.append(formatItem);
validDrivers = ('firewire', 'video4linux', 'directshow')
def addOptions(parser):
@@ -38,7 +40,7 @@ def addOptions(parser):
help="capture width in pixels")
parser.add_option("-e", "--height", dest="height", default="480", type="int",
help="capture height in pixels")
- parser.add_option("-p", "--pixformat", dest="pixelFormat", default="RGB",
+ parser.add_option("-p", "--pixformat", dest="pixelFormat", default="R8G8B8",
choices=validPixFmt,
help="camera frame pixel format (one of: %s)" %', '.join(validPixFmt))
parser.add_option("-f", "--framerate", dest="framerate", default="15", type="float",
diff --git a/src/python/persist.py b/src/python/persist.py
new file mode 100644
index 0000000..fab8cfd
--- /dev/null
+++ b/src/python/persist.py
@@ -0,0 +1,157 @@
+#!/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
+#
+# Original author of this file is OXullo Interecans <x at brainrapers dot org>
+
+
+import os
+import time
+import cPickle as pickle
+
+import libavg
+
+
+class Persist(object):
+ def __init__(self, storeFile, initialData, validator=lambda v: True,
+ autoCommit=False):
+ self.__storeFile = storeFile
+
+ if hasattr(initialData, '__call__'):
+ initialData = initialData()
+ elif initialData is None:
+ initialData = dict()
+
+ if os.path.exists(self.__storeFile):
+ if not os.path.isfile:
+ raise RuntimeError('%s dump file is not a plain file' % self)
+ elif not os.access(self.__storeFile, os.R_OK | os.W_OK):
+ raise RuntimeError('%s dump file'
+ 'cannot be accessed with r/w permissions' % self)
+
+ try:
+ f = open(self.__storeFile)
+ except IOError:
+ libavg.logger.debug('Initializing %s' % self)
+ self.data = initialData
+ self.commit()
+ else:
+ try:
+ self.data = pickle.load(f)
+ except:
+ f.close()
+ libavg.logger.error('Persist %s is corrupted or unreadable, '
+ 'reinitializing' % self)
+ self.data = initialData
+ self.commit()
+ else:
+ f.close()
+ if not validator(self.data):
+ libavg.logger.error('Sanity check failed for %s, '
+ 'reinitializing' % self)
+ self.data = initialData
+ self.commit()
+ else:
+ libavg.logger.debug('%s successfully loaded' % self)
+
+ if autoCommit:
+ import atexit
+ atexit.register(self.commit)
+
+ def __repr__(self):
+ return '<%s %s>' % (self.__class__.__name__, self.__storeFile)
+
+ @property
+ def storeFile(self):
+ return self.__storeFile
+
+ def commit(self):
+ tempFile = self.__storeFile + '.tmp.' + str(int(time.time() * 1000))
+
+ try:
+ with open(tempFile, 'wb') as f:
+ pickle.dump(self.data, f)
+ except Exception, e:
+ libavg.logger.error('Cannot save %s (%s)' % (self.__storeFile, str(e)))
+ return False
+ else:
+ if os.path.exists(self.__storeFile):
+ try:
+ os.remove(self.__storeFile)
+ except Exception, e:
+ libavg.logger.error('Cannot overwrite dump file '
+ '%s (%s)' % (self, str(e)))
+ return False
+ try:
+ os.rename(tempFile, self.__storeFile)
+ except Exception, e:
+ libavg.logger.error('Cannot save %s (%s)' % (self, str(e)))
+ os.remove(tempFile)
+ return False
+ else:
+ libavg.logger.debug('%s saved' % self)
+ return True
+
+
+class UserPersistentData(Persist):
+ def __init__(self, appName, fileName, *args, **kargs):
+ basePath = os.path.join(self._getUserDataPath(), appName)
+ fullPath = os.path.join(basePath, '%s.pkl' % fileName)
+
+ try:
+ os.makedirs(basePath)
+ except OSError, e:
+ import errno
+ if e.errno != errno.EEXIST:
+ raise
+
+ super(UserPersistentData, self).__init__(fullPath, *args, **kargs)
+
+ def _getUserDataPath(self):
+ if os.name == 'posix':
+ path = os.path.join(os.environ['HOME'], '.avg')
+ elif os.name == 'nt':
+ path = os.path.join(os.environ['APPDATA'], 'Avg')
+ else:
+ raise RuntimeError('Unsupported system %s' % os.name)
+
+ return path
+
+
+if __name__ == '__main__':
+ testFile = './testfile.pkl'
+ initialData = {'initial': True}
+ p = Persist(testFile, initialData)
+ p.commit()
+ p.data['initial'] = False
+ p.commit()
+
+ p = Persist(testFile, initialData)
+ print not p.data['initial']
+
+ os.unlink(testFile)
+
+ p = UserPersistentData('myapp', 'hiscore', initialData)
+ p.data['initial'] = False
+ p.commit()
+
+ print p
+
diff --git a/src/python/statemachine.py b/src/python/statemachine.py
index 3bc92c1..993ef9b 100644
--- a/src/python/statemachine.py
+++ b/src/python/statemachine.py
@@ -1,5 +1,5 @@
# libavg - Media Playback Engine.
-# Copyright (C) 2003-2011 Ulrich von Zadow
+# 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
@@ -18,21 +18,25 @@
# Current versions can be found at www.libavg.de
#
-import utils
+from methodref import methodref
-class State:
+import subprocess
+import os
+
+class State(object):
def __init__(self, transitions, enterFunc, leaveFunc):
self.transitions = {}
for destState, transfunc in transitions.items():
- ref = utils.methodref(transfunc)
+ ref = methodref(transfunc)
self.transitions[destState] = ref
- self.enterFunc = utils.methodref(enterFunc)
- self.leaveFunc = utils.methodref(leaveFunc)
+ self.enterFunc = methodref(enterFunc)
+ self.leaveFunc = methodref(leaveFunc)
-class StateMachine:
+class StateMachine(object):
def __init__(self, name, startState):
self.__states = {}
self.__name = name
+ self.__startState = startState
self.__curState = startState
self.__trace = False
self.__initDone = False
@@ -86,12 +90,57 @@ class StateMachine:
return self.__curState
def dump(self):
- for oldState, transitions in self.__states.iteritems():
- print oldState, ":"
- for newState, func in transitions.iteritems():
- print " -->", newState, ":", func.__name__
+ for oldStateName, state in self.__states.iteritems():
+ print oldStateName, ("(enter: " + self.__getNiceFuncName(state.enterFunc)
+ + ", leave: " + self.__getNiceFuncName(state.leaveFunc) + "):")
+ for newState, func in state.transitions.iteritems():
+ print " -->", newState, ":", self.__getNiceFuncName(func)
print "Current state:", self.__curState
+ def makeDiagram(self, fName, showMethods=False):
+ def writeState(stateName, state):
+ label = stateName
+ if showMethods:
+ if state.enterFunc.__name__ is not(None):
+ label += ('<br/><font point-size="10">entry/'
+ + state.enterFunc.__name__ + '</font>')
+ if state.leaveFunc.__name__ is not(None):
+ label += ('<br/><font point-size="10">exit/'
+ + state.leaveFunc.__name__ + '</font>')
+ dotFile.write(' "'+stateName+'" [label=<'+label+'>];\n')
+
+ def writeTransition(origState, destState, func):
+ dotFile.write(' "'+origState+'" -> "'+destState+'"')
+ if showMethods and func and func.__name__ is not(None):
+ dotFile.write(' [label="/'+func.__name__+'", fontsize=10]')
+ dotFile.write(";\n")
+
+
+ dotFile = open("tmp.dot", "w")
+ dotFile.write('digraph "'+self.__name+'" {\n')
+ dotFile.write(' node [fontsize=12, shape=box, style=rounded];\n')
+ dotFile.write(' startstate [shape=point, height=0.2, width=0.2, label=""];\n')
+ dotFile.write(' { rank=source; "startstate" };\n')
+ writeTransition("startstate", self.__startState, None)
+ for stateName, state in self.__states.iteritems():
+ writeState(stateName, state)
+ for destState, func in state.transitions.iteritems():
+ writeTransition(stateName, destState, func)
+ dotFile.write(' "'+self.__curState+'" [style="rounded,bold"];\n')
+ dotFile.write('}\n')
+ dotFile.close()
+ try:
+ subprocess.call(["dot", "tmp.dot", "-Tpng", "-o"+fName])
+ except OSError:
+ raise RuntimeError("dot executable not found. graphviz needs to be installed for StateMachine.makeDiagram to work.")
+ os.remove("tmp.dot")
+
+ def __getNiceFuncName(self, f):
+ if f.__name__ is not(None):
+ return f.__name__
+ else:
+ return "None"
+
def __doSanityCheck(self):
for stateName, state in self.__states.iteritems():
for transitionName in state.transitions.iterkeys():
diff --git a/src/python/textarea.py b/src/python/textarea.py
index 4ff1a8b..8b9bcf1 100644
--- a/src/python/textarea.py
+++ b/src/python/textarea.py
@@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
#
# libavg - Media Playback Engine.
-# Copyright (C) 2003-2011 Ulrich von Zadow
+# 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
@@ -40,7 +40,6 @@ textarea module provides two classes:
"""
-g_Player = None
g_FocusContext = None
g_LastKeyEvent = None
g_activityCallback = None
@@ -69,14 +68,14 @@ DEFAULT_BLUR_OPACITY = 0.3
import time
-from libavg import avg
+from libavg import avg, player, gesture
from avg import Point2D
-class FocusContext:
+class FocusContext(object):
"""
This class helps to group TextArea elements
-
+
TextArea elements that belong to the same FocusContext cycle focus among
themselves. There can be several FocusContextes but only one active at once
( using the global function setActiveFocusContext() )
@@ -90,11 +89,11 @@ class FocusContext:
Test if this FocusContext is currently active
"""
return self.__isActive
-
+
def register(self, taElement):
"""
Register a floating textarea on this FocusContext
-
+
@param taElement: a TextArea instance
"""
self.__elements.append(taElement)
@@ -102,7 +101,7 @@ class FocusContext:
def getFocused(self):
"""
Query the TextArea element that currently has focus
-
+
@return: TextArea instance or None
"""
for ob in self.__elements:
@@ -113,7 +112,7 @@ class FocusContext:
def keyCharPressed(self, kchar):
"""
Inject an utf-8 encoded characted into the flow
-
+
Shift a character (Unicode keycode) into the active (w/focus) TextArea
@type kchar: string
@param kchar: a single character (if more than one, the following are ignored)
@@ -124,7 +123,7 @@ class FocusContext:
def keyUCodePressed(self, keycode):
"""
Inject an Unicode code point into the flow
-
+
Shift a character (Unicode keycode) into the active (w/focus) TextArea
@type keycode: int
@param keycode: unicode code point of the character
@@ -147,7 +146,7 @@ class FocusContext:
Emulate a backspace character keypress
"""
self.keyUCodePressed(KEYCODES_BACKSPACE[0])
-
+
def delete(self):
"""
Emulate a delete character keypress
@@ -166,33 +165,33 @@ class FocusContext:
"""
for ob in self.__elements:
ob.clearFocus()
-
+
def cycleFocus(self, backwards=False):
"""
Force a focus cycle among instantiated textareas
-
+
TAB/Sh-TAB keypress is what is translated in a focus cycle.
@param backwards: as default, the method cycles following the order
that has been followed during the registration of TextArea
instances. Setting this to True, the order is inverted.
"""
-
+
els = []
els.extend(self.__elements)
if len(els) == 0:
return
-
+
if backwards:
els.reverse()
-
+
elected = 0
for ob in els:
if not ob.hasFocus():
elected = elected + 1
else:
break
-
+
# elects the first if no ta are in focus or if the
# last one has it
if elected in (len(els), len(els)-1):
@@ -204,7 +203,7 @@ class FocusContext:
ob.setFocus(False)
els[elected].setFocus(True)
-
+
def getRegistered(self):
"""
Returns a list of TextArea currently registered within this FocusContext
@@ -222,54 +221,55 @@ class FocusContext:
self.__isActive = active
-class TextArea:
+class TextArea(avg.DivNode):
"""
TextArea class is a libavg widget to create editable text fields
TextArea is an extended <words> node that reacts to user input (mouse/touch for
focus, keyboard for text input). Can be set as a single line or span to multiple
lines.
- It sits in a given container matching its dimensions, therefore the appropriate
- way to create it, is to set a <div> node with defined width/height attributes.
"""
- def __init__(self, parent, focusContext=None, disableMouseFocus=False, id=''):
+ def __init__(self, focusContext=None, disableMouseFocus=False,
+ moveCoursorOnTouch=True, textBackgroundNode=None, loupeBackgroundNode=None,
+ parent=None, **kwargs):
"""
- @param parent: a div node with defined dimensions
+ @param parent: parent of the node
@param focusContext: FocusContext object which directs focus for TextArea elements
@param disableMouseFocus: boolean, prevents that mouse can set focus for
this instance
- @param id: optional handle to identify the object when dealing with events. ID
- uniqueness is not guaranteed
+ @param moveCoursorOnTouch: boolean, activate the coursor motion on touch events
"""
- global g_Player
- g_Player = avg.Player.get()
- self.__parent = parent
+ super(TextArea, self).__init__(**kwargs)
+ self.registerInstance(self, parent)
+
self.__focusContext = focusContext
self.__blurOpacity = DEFAULT_BLUR_OPACITY
self.__border = 0
- self.__id = id
self.__data = []
self.__cursorPosition = 0
-
- textNode = g_Player.createNode("words", {'rawtextmode':True})
-
+
+ textNode = avg.WordsNode(rawtextmode=True)
+
+ if textBackgroundNode != None:
+ self.appendChild(textBackgroundNode)
+
if not disableMouseFocus:
- parent.setEventHandler(avg.CURSORUP, avg.MOUSE, self.__onClick)
- parent.setEventHandler(avg.CURSORUP, avg.TOUCH, self.__onClick)
-
- parent.appendChild(textNode)
-
- cursorContainer = g_Player.createNode('div', {})
- cursorNode = g_Player.createNode('line', {'color': '000000'})
- parent.appendChild(cursorContainer)
+ self.setEventHandler(avg.Event.CURSOR_UP, avg.Event.MOUSE, self.__onClick)
+ self.setEventHandler(avg.Event.CURSOR_UP, avg.Event.TOUCH, self.__onClick)
+
+ self.appendChild(textNode)
+
+ cursorContainer = avg.DivNode()
+ cursorNode = avg.LineNode(color='000000')
+ self.appendChild(cursorContainer)
cursorContainer.appendChild(cursorNode)
self.__flashingCursor = False
self.__cursorContainer = cursorContainer
self.__cursorNode = cursorNode
self.__textNode = textNode
- self.__charSize = -1
- self.setStyle()
+
+ self.__loupe = None
if focusContext is not None:
focusContext.register(self)
@@ -277,48 +277,68 @@ class TextArea:
else:
self.setFocus(True)
- g_Player.setInterval(CURSOR_FLASHING_DELAY, self.__tickFlashCursor)
+ player.setInterval(CURSOR_FLASHING_DELAY, self.__tickFlashCursor)
self.__lastActivity = 0
-
- def getID(self):
- """
- Returns the ID of the textarea (set on the constructor).
- """
- return self.__id
-
+
+ if moveCoursorOnTouch:
+ self.__recognizer = gesture.DragRecognizer(eventNode=self, friction=-1,
+ moveHandler=self.__moveHandler,
+ detectedHandler=self.__detectedHandler,
+ upHandler=self.__upHandler)
+ self.__loupeZoomFactor = 0.5
+ self.__loupe = avg.DivNode(parent=self, crop=True)
+
+ if loupeBackgroundNode != None:
+ self.__loupe.appendChild(loupeBackgroundNode)
+ self.__loupe.size = loupeBackgroundNode.size
+ else:
+ self.__loupe.size = (50,50)
+ avg.RectNode(fillopacity=1, fillcolor="f5f5f5", color="ffffff",
+ size=self.__loupe.size, parent=self.__loupe)
+ self.__loupeOffset = (self.__loupe.size[0]/2.0, self.__loupe.size[1]+20)
+ self.__loupe.unlink()
+ self.__zoomedImage = avg.DivNode(parent=self.__loupe)
+ self.__loupeTextNode = avg.WordsNode(rawtextmode=True,
+ parent=self.__zoomedImage)
+
+ self.__loupeCursorContainer = avg.DivNode(parent=self.__zoomedImage)
+ self.__loupeCursorNode = avg.LineNode(color='000000',
+ parent=self.__loupeCursorContainer)
+ self.setStyle()
+
def clearText(self):
"""
Clears the text
"""
self.setText(u'')
-
+
def setText(self, uString):
"""
Set the text on the TextArea
-
+
@param uString: an unicode string (or an utf-8 encoded string)
"""
if not isinstance(uString, unicode):
uString = unicode(uString, 'utf-8')
-
+
self.__data = []
for c in uString:
self.__data.append(c)
-
+
self.__cursorPosition = len(self.__data)
self.__update()
-
+
def getText(self):
"""
Get the text stored and displayed on the TextArea
"""
return self.__getUnicodeFromData()
-
- def setStyle(self, font='Arial', fontsize=12, alignment='left', variant='Regular',
- color='000000', multiline=True, cursorWidth=None, border=0,
- blurOpacity=DEFAULT_BLUR_OPACITY, flashingCursor=False,
- cursorColor='000000', lineSpacing=0, letterSpacing=0):
+
+ def setStyle(self, font='sans', fontsize=12, alignment='left', variant='Regular',
+ color='000000', multiline=True, cursorWidth=None, border=(0,0),
+ blurOpacity=DEFAULT_BLUR_OPACITY, flashingCursor=False, cursorColor='000000',
+ lineSpacing=0, letterSpacing=0):
"""
Set TextArea's graphical appearance
@param font: font face
@@ -337,27 +357,38 @@ class TextArea:
@param lineSpacing: linespacing property of words node
@param letterSpacing: letterspacing property of words node
"""
- self.__textNode.font = font
- self.__textNode.fontsize = int(fontsize)
- self.__textNode.alignment = alignment
+ self.__textNode.fontstyle = avg.FontStyle(font=font, fontsize=fontsize,
+ alignment=alignment, variant=variant, linespacing=lineSpacing,
+ letterspacing=letterSpacing)
self.__textNode.color = color
- self.__textNode.variant = variant
- self.__textNode.linespacing = lineSpacing
- self.__textNode.letterspacing = letterSpacing
self.__isMultiline = multiline
self.__border = border
self.__maxLength = -1
self.__blurOpacity = blurOpacity
-
+
if multiline:
- self.__textNode.width = int(self.__parent.width) - self.__border * 2
+ self.__textNode.width = int(self.width) - self.__border[0] * 2
self.__textNode.wrapmode = 'wordchar'
else:
- self.__textNode.width = 0
-
- self.__textNode.x = self.__border
- self.__textNode.y = self.__border
-
+ self.__textNode.width = 0
+
+ self.__textNode.x = self.__border[0]
+ self.__textNode.y = self.__border[1]
+
+ tempNode = avg.WordsNode(text=u'W', font=font, fontsize=int(fontsize),
+ variant=variant)
+ self.__textNode.realFontSize = tempNode.getGlyphSize(0)
+ del tempNode
+ self.__textNode.alignmentOffset = Point2D(0,0)
+
+ if alignment != "left":
+ offset = Point2D(self.size.x / 2,0)
+ if alignment == "right":
+ offset = Point2D(self.size.x,0)
+ self.__textNode.pos += offset
+ self.__textNode.alignmentOffset = offset
+ self.__cursorContainer.pos = offset
+
self.__cursorNode.color = cursorColor
if cursorWidth is not None:
self.__cursorNode.strokewidth = cursorWidth
@@ -369,45 +400,80 @@ class TextArea:
x = self.__cursorNode.strokewidth / 2.0
self.__cursorNode.pos1 = Point2D(x, self.__cursorNode.pos1.y)
self.__cursorNode.pos2 = Point2D(x, self.__cursorNode.pos2.y)
-
+
self.__flashingCursor = flashingCursor
if not flashingCursor:
self.__cursorContainer.opacity = 1
+
+ if self.__loupe:
+ zoomfactor = (1.0 + self.__loupeZoomFactor)
+ self.__loupeTextNode.fontstyle = self.__textNode.fontstyle
+ self.__loupeTextNode.fontsize = int(fontsize) * zoomfactor
+ self.__loupeTextNode.color = color
+ if multiline:
+ self.__loupeTextNode.width = self.__textNode.width * zoomfactor
+ self.__loupeTextNode.wrapmode = 'wordchar'
+ else:
+ self.__loupeTextNode.width = 0
+
+ self.__loupeTextNode.x = self.__border[0] * 2
+ self.__loupeTextNode.y = self.__border[1] * 2
- self.__updateCursor()
+ self.__loupeTextNode.realFontSize = self.__textNode.realFontSize * zoomfactor
+
+ if alignment != "left":
+ self.__loupeTextNode.pos = self.__textNode.pos * zoomfactor
+ self.__loupeTextNode.alignmentOffset = self.__textNode.alignmentOffset * \
+ zoomfactor
+ self.__loupeCursorContainer.pos = self.__cursorContainer.pos * zoomfactor
+
+ self.__loupeCursorNode.color = cursorColor
+ if cursorWidth is not None:
+ self.__loupeCursorNode.strokewidth = cursorWidth * zoomfactor
+ else:
+ w = float(self.__loupeTextNode.fontsize) * CURSOR_WIDTH_PCT / 100.0
+ if w < 1:
+ w = 1
+ self.__loupeCursorNode.strokewidth = w * zoomfactor
+ x = self.__loupeCursorNode.strokewidth / 2.0
+ self.__loupeCursorNode.pos1 = Point2D(x, self.__loupeCursorNode.pos1.y)
+ self.__loupeCursorNode.pos2 = Point2D(x, self.__loupeCursorNode.pos2.y)
+
+ if not flashingCursor:
+ self.__loupeCursorContainer.opacity = 1
+ self.__updateCursors()
-
def setMaxLength(self, maxlen):
"""
Set character limit of the input
-
+
@param maxlen: max number of character allowed
"""
self.__maxLength = maxlen
-
+
def clearFocus(self):
"""
Compact form to blur the TextArea
"""
- self.__parent.opacity = self.__blurOpacity
+ self.opacity = self.__blurOpacity
self.__hasFocus = False
-
+
def setFocus(self, hasFocus):
"""
Force the focus (or blur) of this TextArea
-
+
@param hasFocus: boolean
"""
if self.__focusContext is not None:
self.__focusContext.resetFocuses()
-
+
if hasFocus:
- self.__parent.opacity = 1
+ self.opacity = 1
self.__cursorContainer.opacity = 1
else:
self.clearFocus()
self.__cursorContainer.opacity = 0
-
+
self.__hasFocus = hasFocus
def hasFocus(self):
@@ -419,13 +485,17 @@ class TextArea:
def showCursor(self, show):
if show:
avg.fadeIn(self.__cursorNode, 200)
+ if self.__loupe:
+ avg.fadeIn(self.__loupeCursorNode, 200)
else:
avg.fadeOut(self.__cursorNode, 200)
+ if self.__loupe:
+ avg.fadeOut(self.__loupeCursorNode, 200)
def onKeyDown(self, keycode):
"""
Inject a keycode into TextArea flow
-
+
Used mainly by FocusContext. It can be used directly, but the best option
is always to use a FocusContext helper, which exposes convenience method for
injection.
@@ -435,29 +505,32 @@ class TextArea:
# Ensure that the cursor is shown
if self.__flashingCursor:
self.__cursorContainer.opacity = 1
-
+
if keycode in KEYCODES_BACKSPACE:
self.__removeChar(left=True)
self.__updateLastActivity()
- self.__updateCursor()
+ self.__updateCursors()
elif keycode == KEYCODES_DEL:
self.__removeChar(left=False)
self.__updateLastActivity()
- self.__updateCursor()
+ self.__updateCursors()
# NP/FF clears text
elif keycode == KEYCODE_FORMFEED:
self.clearText()
- elif keycode in (KEYCODE_CRS_UP, KEYCODE_CRS_DOWN, KEYCODE_CRS_LEFT, KEYCODE_CRS_RIGHT):
+ elif keycode in (KEYCODE_CRS_UP, KEYCODE_CRS_DOWN, KEYCODE_CRS_LEFT,
+ KEYCODE_CRS_RIGHT):
if keycode == KEYCODE_CRS_LEFT and self.__cursorPosition > 0:
self.__cursorPosition -= 1
self.__update()
- elif keycode == KEYCODE_CRS_RIGHT and self.__cursorPosition < len(self.__data):
+ elif (keycode == KEYCODE_CRS_RIGHT and
+ self.__cursorPosition < len(self.__data)):
self.__cursorPosition += 1
self.__update()
elif keycode == KEYCODE_CRS_UP and self.__cursorPosition != 0:
self.__cursorPosition = 0
self.__update()
- elif keycode == KEYCODE_CRS_DOWN and self.__cursorPosition != len(self.__data):
+ elif (keycode == KEYCODE_CRS_DOWN and
+ self.__cursorPosition != len(self.__data)):
self.__cursorPosition = len(self.__data)
self.__update()
# add linefeed only on multiline textareas
@@ -467,7 +540,7 @@ class TextArea:
elif keycode not in (KEYCODE_LINEFEED, 0, 25, 63272):
self.__appendKeycode(keycode)
self.__updateLastActivity()
- self.__updateCursor()
+ self.__updateCursors()
def __onClick(self, e):
if self.__focusContext is not None:
@@ -475,38 +548,36 @@ class TextArea:
self.setFocus(True)
else:
self.setFocus(True)
-
+
def __getUnicodeFromData(self):
return u''.join(self.__data)
-
+
def __appendKeycode(self, keycode):
self.__appendUChar(unichr(keycode))
-
+
def __appendUChar(self, uchar):
# if maximum number of char is specified, honour the limit
if self.__maxLength > -1 and len(self.__data) > self.__maxLength:
return
-
+
# Boundary control
if len(self.__data) > 0:
maxCharDim = self.__textNode.fontsize
lastCharPos = self.__textNode.getGlyphPos(len(self.__data) - 1)
- if (not self.__isMultiline and
- lastCharPos[0] + maxCharDim * 1.5 > self.__parent.width - self.__border * 2):
- return
-
- if (self.__isMultiline and
- lastCharPos[1] + maxCharDim * 2 > self.__parent.height - self.__border * 2):
- if (lastCharPos[0] + maxCharDim * 1.5 > self.__parent.width - self.__border * 2):
- return
- if (ord(uchar) == 10 and
- lastCharPos[1] + maxCharDim * 2 > self.__parent.height - self.__border * 2):
+ if self.__isMultiline:
+ if lastCharPos[1] + maxCharDim*2 > self.height - self.__border[1]*2:
+ if lastCharPos[0] + maxCharDim*1.5 > self.width - self.__border[0]*2:
+ return
+ if ord(uchar) == 10:
+ return
+ else:
+ if lastCharPos[0] + maxCharDim*1.5 > self.width - self.__border[0]*2:
return
self.__data.insert(self.__cursorPosition, uchar)
self.__cursorPosition += 1
self.__update()
-
+
def __removeChar(self, left=True):
if left and self.__cursorPosition > 0:
self.__cursorPosition -= 1
@@ -518,52 +589,171 @@ class TextArea:
def __update(self):
self.__textNode.text = self.__getUnicodeFromData()
- self.__updateCursor()
-
- def __updateCursor(self):
+ if self.__loupe:
+ self.__loupeTextNode.text = self.__getUnicodeFromData()
+ self.__updateCursors()
+
+ def __updateCursors(self):
+ self.__updateCursor(self.__cursorNode, self.__cursorContainer, self.__textNode)
+ if self.__loupe:
+ self.__updateCursor(self.__loupeCursorNode, self.__loupeCursorContainer,
+ self.__loupeTextNode)
+
+ def __updateCursor(self, cursorNode, cursorContainer, textNode):
if self.__cursorPosition == 0:
lastCharPos = (0,0)
lastCharExtents = (0,0)
else:
- lastCharPos = self.__textNode.getGlyphPos(self.__cursorPosition - 1)
- lastCharExtents = self.__textNode.getGlyphSize(self.__cursorPosition - 1)
-
+ lastCharPos = textNode.getGlyphPos(self.__cursorPosition - 1)
+ lastCharExtents = textNode.getGlyphSize(self.__cursorPosition - 1)
+
if self.__data[self.__cursorPosition - 1] == '\n':
lastCharPos = (0, lastCharPos[1] + lastCharExtents[1])
lastCharExtents = (0, lastCharExtents[1])
-
- xPos = self.__cursorNode.pos2.x
- if lastCharExtents[1] > 0:
- self.__cursorNode.pos2 = Point2D(xPos, lastCharExtents[1] * (1 - CURSOR_PADDING_PCT/100.0))
+
+ xPos = cursorNode.pos2.x
+ cursorNode.pos2 = Point2D(xPos, textNode.realFontSize.y * \
+ (1 - CURSOR_PADDING_PCT/100.0))
+
+ if textNode.alignment != "left":
+ if len(self.__data) > 0:
+ lineWidth = textNode.getLineExtents(self.__selectTextLine(lastCharPos,
+ textNode))
+ else:
+ lineWidth = Point2D(0,0)
+ if textNode.alignment == "center":
+ lineWidth *= 0.5
+ cursorContainer.x = textNode.alignmentOffset.x - lineWidth.x + \
+ lastCharPos[0] + lastCharExtents[0] + self.__border[0]
else:
- self.__cursorNode.pos2 = Point2D(xPos, self.__textNode.fontsize)
-
- self.__cursorContainer.x = lastCharPos[0] + lastCharExtents[0] + self.__border
- self.__cursorContainer.y = (lastCharPos[1] +
- self.__cursorNode.pos2.y * CURSOR_PADDING_PCT/200.0 + self.__border)
-
+ cursorContainer.x = lastCharPos[0] + lastCharExtents[0] + self.__border[0]
+ cursorContainer.y = (lastCharPos[1] +
+ cursorNode.pos2.y * CURSOR_PADDING_PCT/200.0 + self.__border[1])
+
def __updateLastActivity(self):
self.__lastActivity = time.time()
-
+
def __tickFlashCursor(self):
if (self.__flashingCursor and
self.__hasFocus and
time.time() - self.__lastActivity > CURSOR_FLASH_AFTER_INACTIVITY/1000.0):
if self.__cursorContainer.opacity == 0:
self.__cursorContainer.opacity = 1
+ if self.__loupe:
+ self.__loupeCursorContainer.opacity = 1
else:
self.__cursorContainer.opacity = 0
+ if self.__loupe:
+ self.__loupeCursorContainer.opacity = 0
elif self.__hasFocus:
self.__cursorContainer.opacity = 1
+ if self.__loupe:
+ self.__loupeCursorContainer.opacity = 1
+
+ def __moveHandler(self, offset):
+ self.__addLoupe()
+ event = player.getCurrentEvent()
+ eventPos = self.getRelPos(event.pos)
+ if ( (eventPos[0] >= -1 and eventPos[0] <= self.size[0]) and
+ (eventPos[1] >= 0 and eventPos[1] <= self.size[1]) ):
+ self.__updateCursorPosition(event)
+ else:
+ self.__upHandler(None)
+
+ def __detectedHandler(self):
+ event = player.getCurrentEvent()
+ self.__updateCursorPosition(event)
+ self.__timerID = player.setTimeout(1000, self.__addLoupe)
+
+ def __addLoupe(self):
+ if not self.__loupe.getParent():
+ self.appendChild(self.__loupe)
+
+ def __upHandler (self, offset):
+ player.clearInterval(self.__timerID)
+ if self.__loupe.getParent():
+ self.__loupe.unlink()
+
+ def __selectTextLine(self, pos, textNode):
+ for line in range(textNode.getNumLines()):
+ curLine = textNode.getLineExtents(line)
+ minMaxHight = (curLine[1] * line,curLine[1] * (line + 1) )
+ if pos[1] >= minMaxHight[0] and pos[1] < minMaxHight[1]:
+ return line
+ return 0
+
+ def __updateCursorPosition(self, event):
+ eventPos = self.__textNode.getRelPos(event.pos)
+ if len(self.__data) > 0:
+ lineWidth = self.__textNode.getLineExtents(self.__selectTextLine(eventPos,
+ self.__textNode))
+ else:
+ lineWidth = Point2D(0,0)
+ if self.__textNode.alignment != "left":
+ if self.__textNode.alignment == "center":
+ eventPos = Point2D(eventPos.x + lineWidth.x / 2, eventPos.y)
+ else:
+ eventPos = Point2D(eventPos.x + lineWidth.x, eventPos.y)
+ length = len(self.__data)
+ if length > 0:
+ index = self.__textNode.getCharIndexFromPos(eventPos) # click on letter
+ if index == None: # click behind line
+ realLines = self.__textNode.getNumLines() - 1
+ for line in range(realLines + 1):
+ curLine = self.__textNode.getLineExtents(line)
+ minMaxHight = (curLine[1] * line,curLine[1] * (line + 1) )
+ if eventPos[1] >= minMaxHight[0] and eventPos[1] < minMaxHight[1]:
+ if curLine[0] != 0: # line with letters
+ correction = 1
+ if self.__textNode.alignment != "left":
+ if eventPos[0] < 0:
+ targetLine = (1, curLine[1] * line)
+ correction = 0
+ else:
+ targetLine = (curLine[0] - 1, curLine[1] * line)
+ else:
+ targetLine = (curLine[0] - 1, curLine[1] * line)
+ index = (self.__textNode.getCharIndexFromPos(targetLine)
+ + correction)
+ else: # empty line
+ count = 0
+ for char in range(length-1):
+ if count < line:
+ if self.__textNode.text[char] == "\n":
+ count += 1
+ else:
+ index = char
+ break
+ break
+ if index == None: # click under text
+ curLine = self.__textNode.getLineExtents(realLines)
+ curLine *= realLines
+ index = self.__textNode.getCharIndexFromPos( (eventPos[0],curLine[1]) )
+ if index == None:
+ index = length
+ self.__cursorPosition = index
-
+ self.__update()
+ self.__updateLoupe(event)
+
+ def __updateLoupe(self, event):
+ # setzt es mittig ueber das orginal
+# self.__zoomedImage.pos = - self.getRelPos(event.pos) + self.__loupe.size / 2.0
+ # add zoomfactor position
+# self.__zoomedImage.pos = - self.getRelPos(event.pos) + self.__loupe.size / 2.0 -\
+# ( 0.0,(self.__textNode.fontsize * self.__loupeZoomFactor))
+ # add scrolling | without zoom positioning
+
+ self.__zoomedImage.pos = - self.getRelPos(event.pos) + self.__loupe.size / 2.0 - \
+ self.getRelPos(event.pos)* self.__loupeZoomFactor + Point2D(0,5)
+ self.__loupe.pos = self.getRelPos(event.pos) - self.__loupeOffset
##################################
# MODULE FUNCTIONS
def init(g_avg, catchKeyboard=True, repeatDelay=0.2, charDelay=0.1):
"""
Initialization routine for the module
-
+
This method should be called immediately after avg file
load (Player.loadFile())
@param g_avg: avg package
@@ -576,17 +766,17 @@ def init(g_avg, catchKeyboard=True, repeatDelay=0.2, charDelay=0.1):
avg = g_avg
g_RepeatDelay = repeatDelay
g_CharDelay = charDelay
-
- avg.Player.get().setOnFrameHandler(_onFrame)
-
+
+ player.subscribe(player.ON_FRAME, _onFrame)
+
if catchKeyboard:
- avg.Player.get().getRootNode().setEventHandler(avg.KEYDOWN, avg.NONE, _onKeyDown)
- avg.Player.get().getRootNode().setEventHandler(avg.KEYUP, avg.NONE, _onKeyUp)
+ player.subscribe(avg.Player.KEY_DOWN, _onKeyDown)
+ player.subscribe(avg.Player.KEY_UP, _onKeyUp)
def setActiveFocusContext(focusContext):
"""
Tell the module what FocusContext is presently active
-
+
Only one FocusContext at once can be set 'active' and therefore
prepared to receive the flow of user events from keyboard.
@param focusContext: set the active focusContext. If initialization has been
@@ -597,14 +787,14 @@ def setActiveFocusContext(focusContext):
if g_FocusContext is not None:
g_FocusContext._switchActive(False)
-
+
g_FocusContext = focusContext
g_FocusContext._switchActive(True)
def setActivityCallback(pyfunc):
"""
Set a callback that is called at every keyboard's keypress
-
+
If a callback of user interaction is needed (eg: resetting idle timeout)
just pass a function to this method, which is going to be called at each
user intervention (keydown, keyup).
diff --git a/src/python/trackerhelper.py b/src/python/trackerhelper.py
deleted file mode 100644
index 93e0bf3..0000000
--- a/src/python/trackerhelper.py
+++ /dev/null
@@ -1,58 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-# libavg - Media Playback Engine.
-# Copyright (C) 2003-2011 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
-#
-
-import math
-from libavg import avg, Point2D, RasterNode
-
-g_Player = avg.Player.get()
-
-class TrackerImageFlipper:
- def __init__(self):
- self.readConfig()
-
- def readConfig(self):
- global g_tracker
- print "reading tracker config"
- g_tracker = g_Player.getTracker()
- trackerAngle = float(g_tracker.getParam('/transform/angle/@value'))
- self.angle = round(trackerAngle/math.pi) * math.pi
- self.flipX = 0 > float(g_tracker.getParam('/transform/displayscale/@x'))
- self.flipY = 0 > float(g_tracker.getParam('/transform/displayscale/@y'))
-
- def transformPos(self, (x, y)):
- if self.flipX:
- x = 1 - x
- if self.flipY:
- y = 1 - y
- return (x, y)
-
- def flipNode(self, node):
- node.angle = self.angle
- grid = node.getOrigVertexCoords()
- grid = [ [ self.transformPos(pos) for pos in line ] for line in grid]
- node.setWarpedVertexCoords(grid)
-
- def loadTrackerImage(self, node, imageID):
- fingerBitmap = g_tracker.getImage(imageID)
- node.setBitmap(fingerBitmap)
- self.flipNode(node)
-
diff --git a/src/python/ui/Makefile.am b/src/python/ui/Makefile.am
deleted file mode 100644
index e4fddd6..0000000
--- a/src/python/ui/Makefile.am
+++ /dev/null
@@ -1,2 +0,0 @@
-pkguidir = $(pkgpyexecdir)/ui
-pkgui_PYTHON = __init__.py button.py keyboard.py gesture.py helper.py
diff --git a/src/python/ui/__init__.py b/src/python/ui/__init__.py
deleted file mode 100755
index 211e035..0000000
--- a/src/python/ui/__init__.py
+++ /dev/null
@@ -1,4 +0,0 @@
-from button import Button, TouchButton
-from keyboard import Keyboard
-from gesture import Recognizer, TapRecognizer, DragRecognizer, DoubletapRecognizer, TransformRecognizer, calcKMeans, Mat3x3, Transform, HoldRecognizer
-from helper import ScrollPane
diff --git a/src/python/ui/button.py b/src/python/ui/button.py
deleted file mode 100644
index 43b902d..0000000
--- a/src/python/ui/button.py
+++ /dev/null
@@ -1,364 +0,0 @@
-# -*- coding: utf-8 -*-
-# libavg - Media Playback Engine.
-# Copyright (C) 2003-2011 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 Henrik Thoms
-
-from libavg import avg, statemachine, utils
-import gesture
-from helper import *
-
-g_Player = avg.Player.get()
-
-class Button(avg.DivNode):
- STATE_DISABLED = 1
- STATE_UP = 2
- STATE_DOWN = 3
-
- def __init__(self, upNode = None, downNode = None, disabledNode = None,
- activeAreaNode = None, pressHandler = None, clickHandler = None,
- stateChangeHandler = None, **kwargs):
- avg.DivNode.__init__(self, **kwargs)
-
- self.__upNode = upNode
- self.__downNode = downNode
- self.__disabledNode = disabledNode
- self.__activeAreaNode = activeAreaNode
-
- self.__pressCallback = utils.methodref(pressHandler)
- self.__clickCallback = utils.methodref(clickHandler)
- self.__stateChangeCallback = utils.methodref(stateChangeHandler)
-
- self.__capturedCursorIds = set()
- self.__overCursorIds = set()
-
- self.__isCheckable = False
- self.__isToggled = False
-
- self.__isOver = False
- self.__state = Button.STATE_UP
-
- if self.__upNode and self.__downNode:
- self.__setupNodes()
-
- def delete(self):
- self.__pressCallback = None
- self.__clickCallback = None
- self.__stateChangeCallback = None
- self.__deactivateEventHandlers()
-
- def setEventHandler(self, type, source, func):
- raise RuntimeError("Setting event handlers for buttons is not supported")
-
- def getUpNode(self):
- return self.__upNode
-
- def getDownNode(self):
- return self.__downNode
-
- def getDisabledNode(self):
- return self.__disabledNode
-
- def setNodes(self, upNode, downNode, disabledNode = None, activeAreaNode = None):
- if self.__activeAreaNode and self.isEnabled():
- self.__deactivateEventHandlers()
- self.__upNode = upNode
- self.__downNode = downNode
- self.__disabledNode = disabledNode
- self.__activeAreaNode = activeAreaNode
- self.__setupNodes()
-
- def setPressHandler(self, handler):
- self.__pressCallback = utils.methodref(handler)
-
- def setClickHandler(self, handler):
- self.__clickCallback = utils.methodref(handler)
-
- def setCheckable(self, val):
- self.__isCheckable = val
-
- def isCheckable(self):
- return self.__isCheckable
-
- def setChecked(self, val):
- assert(self.__isCheckable)
- assert(self.isEnabled())
- self.__isToggled = val
- state = Button.STATE_DOWN if self.__isToggled else Button.STATE_UP
- self.__changeState(state)
-
- def isChecked(self):
- assert(self.__isCheckable)
- # XXX: Shouldn't this check self.__isToggled?
- return self.__state == Button.STATE_DOWN
-
- def setEnabled(self, isEnabled):
- if (isEnabled == self.isEnabled()):
- # No state change
- return
-
- state = Button.STATE_DISABLED if not(isEnabled) else Button.STATE_UP
- self.__changeState(state)
-
- if self.__state == Button.STATE_DISABLED:
- self.__deactivateEventHandlers()
- self.__overCursorIds = set()
- else:
- self.__activateEventHandlers()
-
- def isEnabled(self):
- return self.__state != Button.STATE_DISABLED
-
- def __setupNodes(self):
- while self.getNumChildren() > 0:
- self.removeChild(self.getChild(0))
-
- self.appendChild(self.__upNode)
- self.appendChild(self.__downNode)
-
- if self.__disabledNode:
- self.appendChild(self.__disabledNode)
-
- if self.__activeAreaNode == None:
- self.__activeAreaNode = avg.RectNode(opacity=0, size=self.__upNode.size)
- self.appendChild(self.__activeAreaNode)
-
- self.size = self.__activeAreaNode.size
- self.__updateNodesVisibility()
- if self.isEnabled():
- self.__activateEventHandlers()
-
- def __updateNodesVisibility(self):
- for element in (self.__upNode, self.__downNode, self.__disabledNode):
- if element:
- element.active = False
-
- if self.__state == Button.STATE_UP:
- activeNode = self.__upNode
- elif self.__state == Button.STATE_DOWN:
- activeNode = self.__downNode
- elif self.__state == Button.STATE_DISABLED:
- activeNode = self.__disabledNode
- else:
- # This state doesn't exist.
- assert(False)
-
- activeNode.active = True
-
- def __changeState(self, state):
- self.__state = state
- self.__updateNodesVisibility()
- utils.callWeakRef(self.__stateChangeCallback, state)
-
- def __captureCursor(self, id):
- self.__capturedCursorIds.add(id)
- self.__activeAreaNode.setEventCapture(id)
-
- def __releaseCapturedCursor(self, id):
- self.__capturedCursorIds.remove(id)
- self.releaseEventCapture(id)
-
- def __isCursorCaptured(self, id):
- return id in self.__capturedCursorIds
-
- def __getNumberOfCapturedCursors(self):
- return len(self.__capturedCursorIds)
-
- def __hasCapturedCursor(self):
- return len(self.__capturedCursorIds) != 0
-
- def __pressHandler(self, event):
- if not self.__isCursorCaptured(event.cursorid):
- self.__captureCursor(event.cursorid)
-
- if event.cursorid not in self.__overCursorIds:
- self.__overCursorIds.add(event.cursorid)
-
- if self.__getNumberOfCapturedCursors() <= 1:
- self.__changeState(Button.STATE_DOWN)
- utils.callWeakRef(self.__pressCallback, event)
-
- def __releaseHandler(self, event):
- numberOfCapturedCursors = self.__getNumberOfCapturedCursors()
- numberOfOverCursors = len(self.__overCursorIds)
-
- if self.__isCursorCaptured(event.cursorid):
- self.__releaseCapturedCursor(event.cursorid)
-
- if event.cursorid in self.__overCursorIds:
- self.__overCursorIds.remove(event.cursorid)
-
- if numberOfCapturedCursors == 1 and numberOfOverCursors == 1:
- newState = Button.STATE_UP
- if self.isCheckable():
- self.__isToggled = not self.__isToggled
- if self.__isToggled:
- newState = Button.STATE_DOWN
-
- self.__changeState(newState)
-
- utils.callWeakRef(self.__clickCallback, event)
-
- def __overHandler(self, event):
- if event.cursorid not in self.__overCursorIds:
- self.__overCursorIds.add(event.cursorid)
-
- if self.__hasCapturedCursor() and len(self.__overCursorIds):
- self.__changeState(Button.STATE_DOWN)
-
- self.__isOver = not(self.__isOver)
- return True
-
- def __outHandler(self, event):
- if event.cursorid in self.__overCursorIds:
- self.__overCursorIds.remove(event.cursorid)
-
- if self.__hasCapturedCursor() and not len(self.__overCursorIds):
- newState = Button.STATE_UP
- if self.isCheckable():
- if self.__isToggled:
- newState = Button.STATE_DOWN
- self.__changeState(newState)
-
- self.__isOver = not(self.__isOver)
- return True
-
- def __activateEventHandlers(self):
- def setOneHandler(type, handler):
- self.__activeAreaNode.connectEventHandler(type, avg.MOUSE | avg.TOUCH,
- self, handler)
-
- setOneHandler(avg.CURSORDOWN, self.__pressHandler)
- setOneHandler(avg.CURSORUP, self.__releaseHandler)
- setOneHandler(avg.CURSOROVER, self.__overHandler)
- setOneHandler(avg.CURSOROUT, self.__outHandler)
-
- def __deactivateEventHandlers(self):
- for id in self.__capturedCursorIds:
- self.releaseEventCapture(id)
- self.__capturedCursorIds = set()
- self.__activeAreaNode.disconnectEventHandler(self)
-
-
-class TouchButton(avg.DivNode):
-
- def __init__(self, upNode, downNode, disabledNode = None, activeAreaNode = None,
- fatFingerEnlarge=False, clickHandler = None, **kwargs):
- avg.DivNode.__init__(self, **kwargs)
-
- self.__upNode = upNode
- self.__downNode = downNode
- self.__disabledNode = disabledNode
- self.__activeAreaNode = activeAreaNode
-
- self.__clickHandler = utils.methodref(clickHandler)
-
- self.__isOver = False
- self.__stateMachine = statemachine.StateMachine("TouchButton", "UP")
- self.__stateMachine.addState("UP", ("DOWN", "DISABLED"),
- enterFunc=self.enterUp, leaveFunc=self.leaveUp)
- self.__stateMachine.addState("DOWN", ("UP", "DISABLED"),
- enterFunc=self.enterDown, leaveFunc=self.leaveDown)
- self.__stateMachine.addState("DISABLED", ("UP", "DOWN"),
- enterFunc=self.enterDisabled, leaveFunc=self.leaveDisabled)
-
- self.appendChild(self.__upNode)
- self.__upNode.active = True
- self.appendChild(self.__downNode)
- self.__downNode.active = False
-
- if self.__disabledNode:
- self.appendChild(self.__disabledNode)
- self.__disabledNode.active = False
-
- if fatFingerEnlarge:
- if self.__activeAreaNode != None:
- raise(RuntimeError(
- "TouchButton: Can't specify both fatFingerEnlarge and activeAreaNode"))
- size = upNode.size
- minSize = 20*g_Player.getPixelsPerMM()
- size = avg.Point2D(max(minSize, size.x), max(minSize, size.y))
- self.__activeAreaNode = avg.RectNode(size=size, opacity=0, parent=self)
- else:
- if self.__activeAreaNode == None:
- self.__activeAreaNode = self.__upNode
- else:
- self.appendChild(self.__activeAreaNode)
-
- self.__tapRecognizer = gesture.TapRecognizer(self.__activeAreaNode,
- possibleHandler=self.__onDown,
- detectedHandler=self.__onTap,
- failHandler=self.__onTapFail)
-
- @classmethod
- def fromSrc(cls, upSrc, downSrc, disabledSrc=None, **kwargs):
- upNode = avg.ImageNode(href=upSrc)
- downNode = avg.ImageNode(href=downSrc)
- if disabledSrc != None:
- disabledNode = avg.ImageNode(href=disabledSrc)
- else:
- disabledNode = None
- return TouchButton(upNode=upNode, downNode=downNode, disabledNode=disabledNode,
- **kwargs)
-
- def getEnabled(self):
- return self.__stateMachine.state != "DISABLED"
-
- def setEnabled(self, enabled):
- if enabled:
- if self.__stateMachine.state == "DISABLED":
- self.__stateMachine.changeState("UP")
- else:
- if self.__stateMachine.state != "DISABLED":
- self.__stateMachine.changeState("DISABLED")
-
- enabled = property(getEnabled, setEnabled)
-
- def __onDown(self, event):
- self.__stateMachine.changeState("DOWN")
-
- def __onTap(self, event):
- self.__stateMachine.changeState("UP")
- utils.callWeakRef(self.__clickHandler)
-
- def __onTapFail(self, event):
- self.__stateMachine.changeState("UP")
-
- def enterUp(self):
- self.__upNode.active = True
-
- def leaveUp(self):
- self.__upNode.active = False
-
- def enterDown(self):
- self.__downNode.active = True
-
- def leaveDown(self):
- self.__downNode.active = False
-
- def enterDisabled(self):
- if self.__disabledNode:
- self.__disabledNode.active = True
- self.__tapRecognizer.enable(False)
-
- def leaveDisabled(self):
- if self.__disabledNode:
- self.__disabledNode.active = False
- self.__tapRecognizer.enable(True)
-
diff --git a/src/python/ui/gesture.py b/src/python/ui/gesture.py
deleted file mode 100644
index 1c0782d..0000000
--- a/src/python/ui/gesture.py
+++ /dev/null
@@ -1,746 +0,0 @@
-# -*- coding: utf-8 -*-
-# libavg - Media Playback Engine.
-# Copyright (C) 2003-2011 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
-#
-
-from libavg import avg, statemachine, utils
-
-from helper import *
-
-from math import *
-
-g_Player = avg.Player.get()
-
-MAX_TAP_DIST = 15
-MAX_TAP_TIME = 500
-MAX_DOUBLETAP_TIME = 300
-MIN_DRAG_DIST = 5
-HOLD_DELAY = 500
-
-class ContactData:
-
- def __init__(self, listenerid):
- self.listenerid = listenerid
-
-
-class Recognizer(object):
-
- def __init__(self, node, isContinuous, eventSource, maxContacts, initialEvent,
- possibleHandler=None, failHandler=None, detectedHandler=None,
- endHandler=None):
- self._node = node
- self.__isContinuous = isContinuous
- self.__eventSource = eventSource
- self.__maxContacts = maxContacts
-
- self.__possibleHandler = utils.methodref(possibleHandler)
- self.__failHandler = utils.methodref(failHandler)
- self.__detectedHandler = utils.methodref(detectedHandler)
- self.__endHandler = utils.methodref(endHandler)
-
- self.__setEventHandler()
- self.__isEnabled = True
- self._contacts = {}
- self.__dirty = False
-
- self.__stateMachine = statemachine.StateMachine(str(type(self)), "IDLE")
- if self.__isContinuous:
- self.__stateMachine.addState("IDLE", ("POSSIBLE", "RUNNING"))
- self.__stateMachine.addState("POSSIBLE", ("IDLE", "RUNNING"))
- self.__stateMachine.addState("RUNNING", ("IDLE",))
- else:
- self.__stateMachine.addState("IDLE", ("POSSIBLE",))
- self.__stateMachine.addState("POSSIBLE", ("IDLE",))
-
-# self.__stateMachine.traceChanges(True)
-
- if initialEvent:
- self.__onDown(initialEvent)
-
- def enable(self, isEnabled):
- if isEnabled != self.__isEnabled:
- self.__isEnabled = isEnabled
- if isEnabled:
- self.__setEventHandler()
- else:
- if self._contacts != {}:
- self._abort()
- if self._node:
- self._node.disconnectEventHandler(self)
-
- def getState(self):
- return self.__stateMachine.state
-
- def _setPossible(self, event):
- self.__stateMachine.changeState("POSSIBLE")
- utils.callWeakRef(self.__possibleHandler, event)
-
- def _setFail(self, event):
- assert(self.__stateMachine.state == "POSSIBLE")
- self.__stateMachine.changeState("IDLE")
- utils.callWeakRef(self.__failHandler, event)
-
- def _setDetected(self, event):
- if self.__isContinuous:
- self.__stateMachine.changeState("RUNNING")
- else:
- self.__stateMachine.changeState("IDLE")
- utils.callWeakRef(self.__detectedHandler, event)
-
- def _setEnd(self, event):
- assert(self.__stateMachine.state == "RUNNING")
- self.__stateMachine.changeState("IDLE")
- utils.callWeakRef(self.__endHandler, event)
-
- def __onDown(self, event):
- if self.__maxContacts == None or len(self._contacts) < self.__maxContacts:
- listenerid = event.contact.connectListener(self.__onMotion, self.__onUp)
- self._contacts[event.contact] = ContactData(listenerid)
- if len(self._contacts) == 1:
- self.__frameHandlerID = g_Player.setOnFrameHandler(self._onFrame)
- self.__dirty = True
- return self._handleDown(event)
-
- def __onMotion(self, event):
- self.__dirty = True
- self._handleMove(event)
-
- def __onUp(self, event):
- self.__dirty = True
- listenerid = self._contacts[event.contact].listenerid
- del self._contacts[event.contact]
- event.contact.disconnectListener(listenerid)
- if self._contacts == {}:
- g_Player.clearInterval(self.__frameHandlerID)
- self._handleUp(event)
-
- def _abort(self):
- for contact, contactData in self._contacts.iteritems():
- contact.disconnectListener(contactData.listenerid)
- self._contacts = {}
- g_Player.clearInterval(self.__frameHandlerID)
-
- def _handleDown(self, event):
- pass
-
- def _handleMove(self, event):
- pass
-
- def _handleUp(self, event):
- pass
-
- def _handleChange(self):
- pass
-
- def _onFrame(self):
- if self.__dirty:
- self._handleChange()
- self.__dirty = False
-
- def __setEventHandler(self):
- if self._node:
- self._node.connectEventHandler(avg.CURSORDOWN, self.__eventSource, self,
- self.__onDown)
-
-
-class TapRecognizer(Recognizer):
-
- def __init__(self, node, eventSource=avg.TOUCH | avg.MOUSE,
- maxTime=MAX_TAP_TIME, initialEvent=None,
- possibleHandler=None, failHandler=None, detectedHandler=None):
- self.__maxTime = maxTime
-
- self.__maxDistance = (
- MAX_TAP_DIST*g_Player.getPixelsPerMM())
- Recognizer.__init__(self, node, False, eventSource, 1, initialEvent,
- possibleHandler, failHandler, detectedHandler)
-
- def _handleDown(self, event):
- self._setPossible(event)
- self.__startTime = g_Player.getFrameTime()
-
- def _handleMove(self, event):
- if self.getState() != "IDLE":
- if event.contact.distancefromstart > self.__maxDistance:
- self._setFail(event)
-
- def _handleUp(self, event):
- if self.getState() == "POSSIBLE":
- if event.contact.distancefromstart > self.__maxDistance:
- self._setFail(event)
- else:
- self._setDetected(event)
-
- def _onFrame(self):
- downTime = g_Player.getFrameTime() - self.__startTime
- if self.getState() == "POSSIBLE":
- if downTime > self.__maxTime:
- self._setFail(None)
- Recognizer._onFrame(self)
-
-
-class DoubletapRecognizer(Recognizer):
-
- def __init__(self, node, eventSource=avg.TOUCH | avg.MOUSE,
- maxTime=MAX_DOUBLETAP_TIME, initialEvent=None,
- possibleHandler=None, failHandler=None, detectedHandler=None):
- self.__maxTime = maxTime
-
- self.__stateMachine = statemachine.StateMachine("TapRecognizer", "IDLE")
- self.__stateMachine.addState("IDLE", ("DOWN1",), enterFunc=self.__enterIdle)
- self.__stateMachine.addState("DOWN1", ("UP1", "IDLE"))
- self.__stateMachine.addState("UP1", ("DOWN2", "IDLE"))
- self.__stateMachine.addState("DOWN2", ("IDLE",))
-# self.__stateMachine.traceChanges(True)
- self.__frameHandlerID = None
- self.__maxDistance = MAX_TAP_DIST*g_Player.getPixelsPerMM()
- Recognizer.__init__(self, node, False, eventSource, 1, initialEvent,
- possibleHandler, failHandler, detectedHandler)
-
- def _handleDown(self, event):
- self.__startTime = g_Player.getFrameTime()
- if self.__stateMachine.state == "IDLE":
- self.__frameHandlerID = g_Player.setOnFrameHandler(self.__onFrame)
- self.__stateMachine.changeState("DOWN1")
- self.__startPos = event.pos
- self._setPossible(event)
- elif self.__stateMachine.state == "UP1":
- if (event.pos - self.__startPos).getNorm() > self.__maxDistance:
- self.__stateMachine.changeState("IDLE")
- self._setFail(event)
- else:
- self.__stateMachine.changeState("DOWN2")
- else:
- assert(False)
-
- def _handleMove(self, event):
- if self.__stateMachine.state != "IDLE":
- if (event.pos - self.__startPos).getNorm() > self.__maxDistance:
- self.__stateMachine.changeState("IDLE")
- self._setFail(event)
-
- def _handleUp(self, event):
- if self.__stateMachine.state == "DOWN1":
- self.__startTime = g_Player.getFrameTime()
- self.__stateMachine.changeState("UP1")
- elif self.__stateMachine.state == "DOWN2":
- if (event.pos - self.__startPos).getNorm() > self.__maxDistance:
- self._setFail(event)
- else:
- self._setDetected(event)
- self.__stateMachine.changeState("IDLE")
- elif self.__stateMachine.state == "IDLE":
- pass
- else:
- assert(False)
-
- def __onFrame(self):
- downTime = g_Player.getFrameTime() - self.__startTime
- if downTime > self.__maxTime:
- self._setFail(None)
- self.__stateMachine.changeState("IDLE")
-
- def __enterIdle(self):
- g_Player.clearInterval(self.__frameHandlerID)
-
-
-class HoldRecognizer(Recognizer):
-
- def __init__(self, node, eventSource=avg.TOUCH | avg.MOUSE,
- delay=HOLD_DELAY, initialEvent=None, possibleHandler=None, failHandler=None,
- detectedHandler=None, stopHandler=None):
- self.__delay = delay
-
- self.__maxDistance = (
- MAX_TAP_DIST*g_Player.getPixelsPerMM())
- self.__lastEvent = None
- Recognizer.__init__(self, node, True, eventSource, 1, initialEvent,
- possibleHandler, failHandler, detectedHandler, stopHandler)
-
- def _handleDown(self, event):
- self.__lastEvent = event
- self._setPossible(event)
- self.__startTime = g_Player.getFrameTime()
-
- def _handleMove(self, event):
- self.__lastEvent = event
- if self.getState() == "POSSIBLE":
- if event.contact.distancefromstart > self.__maxDistance:
- self._setFail(event)
-
- def _handleUp(self, event):
- self.__lastEvent = event
- if self.getState() == "POSSIBLE":
- self._setFail(event)
- elif self.getState() == "RUNNING":
- self._setEnd(event)
-
- def _onFrame(self):
- downTime = g_Player.getFrameTime() - self.__startTime
- if self.getState() == "POSSIBLE":
- if downTime > self.__delay:
- self._setDetected(self.__lastEvent)
- Recognizer._onFrame(self)
-
-
-class DragRecognizer(Recognizer):
-
- ANY_DIRECTION=0
- VERTICAL=1
- HORIZONTAL=2
-
- DIRECTION_TOLERANCE=pi/4
-
- def __init__(self, eventNode, coordSysNode=None, eventSource=avg.TOUCH | avg.MOUSE,
- initialEvent=None,
- direction=ANY_DIRECTION, directionTolerance=DIRECTION_TOLERANCE,
- friction=-1,
- possibleHandler=None, failHandler=None, detectedHandler=None,
- moveHandler=None, upHandler=None, endHandler=None):
-
- if coordSysNode != None:
- self.__coordSysNode = coordSysNode
- else:
- self.__coordSysNode = eventNode
- self.__moveHandler = utils.methodref(moveHandler)
- self.__upHandler = utils.methodref(upHandler)
- self.__direction = direction
- if self.__direction == DragRecognizer.ANY_DIRECTION:
- self.__minDist = 0
- else:
- self.__minDist = MIN_DRAG_DIST*g_Player.getPixelsPerMM()
- self.__directionTolerance = directionTolerance
- self.__friction = friction
-
- self.__isSliding = False
- self.__inertiaHandler = None
- Recognizer.__init__(self, eventNode, True, eventSource, 1, initialEvent,
- possibleHandler=possibleHandler, failHandler=failHandler,
- detectedHandler=detectedHandler, endHandler=endHandler)
-
- def abortInertia(self):
- if self.__isSliding:
- self.__inertiaHandler.abort()
-
- def _handleDown(self, event):
- if self.__isSliding:
- self.__inertiaHandler.abort()
- if self.__direction == DragRecognizer.ANY_DIRECTION:
- self._setDetected(event)
- else:
- self._setPossible(event)
- pos = self.__relEventPos(event)
- if self.__friction != -1:
- self.__inertiaHandler = InertiaHandler(self.__friction, self.__onInertiaMove,
- self.__onInertiaStop)
- self.__dragStartPos = pos
- self.__lastPos = pos
-
- def _handleMove(self, event):
- if self.getState() != "IDLE":
- pos = self.__relEventPos(event)
- offset = pos - self.__dragStartPos
- if self.getState() == "RUNNING":
- utils.callWeakRef(self.__moveHandler, event, offset)
- else:
- if offset.getNorm() > self.__minDist:
- if self.__angleFits(offset):
- self._setDetected(event)
- utils.callWeakRef(self.__moveHandler, event, offset)
- else:
- self._setFail(event)
- self._abort()
- self.__inertiaHandler = None
- if self.__inertiaHandler:
- self.__inertiaHandler.onDrag(Transform(pos - self.__lastPos))
- self.__lastPos = pos
-
- def _handleUp(self, event):
- if self.getState() != "IDLE":
- pos = self.__relEventPos(event)
- if self.getState() == "RUNNING":
- self.__offset = pos - self.__dragStartPos
- utils.callWeakRef(self.__upHandler, event, self.__offset)
- if self.__friction != -1:
- self.__isSliding = True
- self.__inertiaHandler.onDrag(Transform(pos - self.__lastPos))
- self.__inertiaHandler.onUp()
- else:
- self._setEnd(event)
- else:
- self._setFail(event)
- self.__inertiaHandler = None
-
- def __onInertiaMove(self, transform):
- self.__offset += transform.trans
- utils.callWeakRef(self.__moveHandler, None, self.__offset)
-
- def __onInertiaStop(self):
- self._setEnd(None)
- self.__inertiaHandler = None
- self.__isSliding = False
-
- def __relEventPos(self, event):
- return self.__coordSysNode.getParent().getRelPos(event.pos)
-
- def __angleFits(self, offset):
- angle = offset.getAngle()
- if angle < 0:
- angle = -angle
- if self.__direction == DragRecognizer.VERTICAL:
- return (angle > pi/2-self.__directionTolerance
- and angle < pi/2+self.__directionTolerance)
- elif self.__direction == DragRecognizer.HORIZONTAL:
- return (angle < self.__directionTolerance
- or angle > pi-self.__directionTolerance)
- else:
- assert(False)
-
-class Mat3x3:
- # Internal class. Will be removed again.
-
- def __init__(self, row0=(1,0,0), row1=(0,1,0), row2=(0,0,1)):
- self.m = [row0, row1, row2]
-
- @classmethod
- def translate(cls, t):
- return Mat3x3([1, 0, t[0]],
- [0, 1, t[1]])
-
- @classmethod
- def rotate(cls, a):
- return Mat3x3([cos(a), -sin(a), 0],
- [sin(a), cos(a), 0])
-
- @classmethod
- def pivotRotate(cls, t, a):
- rot = Mat3x3.rotate(a)
- trans = Mat3x3.translate(t)
- return trans.applyMat(rot.applyMat(trans.inverse()))
-
- @classmethod
- def scale(cls, s):
- return Mat3x3([s[0], 0, 0],
- [0, s[1], 0])
-
- @classmethod
- def fromNode(cls, node):
- return Mat3x3.translate(node.pos).applyMat(
- Mat3x3.translate(node.pivot).applyMat(
- Mat3x3.rotate(node.angle).applyMat(
- Mat3x3.translate(-node.pivot).applyMat(
- Mat3x3.scale(node.size)))))
-
- def setNodeTransform(self, node):
- v = self.applyVec([1,0,0])
- rot = avg.Point2D(v[0], v[1]).getAngle()
- node.angle = rot
- node.size = self.getScale()
- node.pivot = node.size/2
- v = self.applyVec([0,0,1])
- node.pos = (avg.Point2D(v[0], v[1]) + (node.pivot).getRotated(node.angle) -
- node.pivot)
-
- def getScale(self):
- v = self.applyVec([1,0,0])
- xscale = avg.Point2D(v[0], v[1]).getNorm()
- v = self.applyVec([0,1,0])
- yscale = avg.Point2D(v[0], v[1]).getNorm()
- return avg.Point2D(xscale, yscale)
-
- def __str__(self):
- return self.m.__str__()
-
- def applyVec(self, v):
- m = self.m
- v1 = []
- for i in range(3):
- v1.append(m[i][0]*v[0] + m[i][1]*v[1] + m[i][2]*v[2])
- return v1
-
- def applyMat(self, m1):
- m0 = self.m
- result = Mat3x3()
- for i in range(3):
- v = []
- for j in range(3):
- v.append(m0[i][0]*m1.m[0][j] + m0[i][1]*m1.m[1][j] + m0[i][2]*m1.m[2][j])
- result.m[i] = v
- return result
-
- def det(self):
- m = self.m
- return float( m[0][0] * (m[2][2]*m[1][1]-m[2][1]*m[1][2])
- -m[1][0] * (m[2][2]*m[0][1]-m[2][1]*m[0][2])
- +m[2][0] * (m[1][2]*m[0][1]-m[1][1]*m[0][2]))
-
- def scalarMult(self, s):
- m = self.m
- result = Mat3x3()
- for i in range(3):
- v = []
- for j in range(3):
- v.append(m[i][j]*s)
- result.m[i] = v
- return result
-
- def inverse(self):
- m = self.m
- temp = Mat3x3([ m[2][2]*m[1][1]-m[2][1]*m[1][2], -(m[2][2]*m[0][1]-m[2][1]*m[0][2]), m[1][2]*m[0][1]-m[1][1]*m[0][2] ],
- [-(m[2][2]*m[1][0]-m[2][0]*m[1][2]), m[2][2]*m[0][0]-m[2][0]*m[0][2] , -(m[1][2]*m[0][0]-m[1][0]*m[0][2])],
- [ m[2][1]*m[1][0]-m[2][0]*m[1][1], -(m[2][1]*m[0][0]-m[2][0]*m[0][1]), m[1][1]*m[0][0]-m[1][0]*m[0][1] ])
- return temp.scalarMult(1/self.det())
-
-
-def getCentroid(indexes, pts):
- c = avg.Point2D(0, 0)
- for i in indexes:
- c += pts[i]
- return c/len(indexes)
-
-def calcKMeans(pts):
-
- # in: List of points
- # out: Two lists, each containing indexes into the input list
- assert(len(pts) > 1)
- p1 = pts[0]
- p2 = pts[1]
- oldP1 = None
- oldP2 = None
- j = 0
- while not(p1 == oldP1 and p2 == oldP2) and j < 50:
- l1 = []
- l2 = []
- # Group points
- for i, pt in enumerate(pts):
- dist1 = (pt-p1).getNorm()
- dist2 = (pt-p2).getNorm()
- if dist1 < dist2:
- l1.append(i)
- else:
- l2.append(i)
- oldP1 = p1
- oldP2 = p2
- p1 = getCentroid(l1, pts)
- p2 = getCentroid(l2, pts)
- j += 1
- return l1, l2
-
-
-class Transform():
- def __init__(self, trans, rot=0, scale=1, pivot=(0,0)):
- self.trans = avg.Point2D(trans)
- self.rot = rot
- self.scale = scale
- self.pivot = avg.Point2D(pivot)
-
- def moveNode(self, node):
- transMat = Mat3x3.translate(self.trans)
- rotMat = Mat3x3.rotate(self.rot)
- scaleMat = Mat3x3.scale((self.scale, self.scale))
- pivotMat = Mat3x3.translate(self.pivot)
- invPivotMat = pivotMat.inverse()
- startTransform = Mat3x3.fromNode(node)
- newTransform = pivotMat.applyMat(
- rotMat.applyMat(
- scaleMat.applyMat(
- invPivotMat.applyMat(
- transMat.applyMat(
- startTransform)))))
- newTransform.setNodeTransform(node)
-
- def __repr__(self):
- return "Transform"+str((self.trans, self.rot, self.scale, self.pivot))
-
-
-class TransformRecognizer(Recognizer):
-
- def __init__(self, eventNode, coordSysNode=None, eventSource=avg.TOUCH,
- initialEvent=None, friction=-1,
- detectedHandler=None, moveHandler=None, upHandler=None, endHandler=None):
- if coordSysNode != None:
- self.__coordSysNode = coordSysNode
- else:
- self.__coordSysNode = eventNode
- self.__moveHandler = utils.methodref(moveHandler)
- self.__upHandler = utils.methodref(upHandler)
- self.__friction = friction
-
- self.__baseTransform = Mat3x3()
- self.__lastPosns = []
- self.__posns = []
- self.__inertiaHandler = None
- Recognizer.__init__(self, eventNode, True, eventSource, None, initialEvent,
- detectedHandler=detectedHandler, endHandler=endHandler)
-
- def _handleDown(self, event):
- numContacts = len(self._contacts)
- self.__newPhase()
- if numContacts == 1:
- if self.__inertiaHandler:
- self.__inertiaHandler.abort()
- self._setDetected(event)
- if self.__friction != -1:
- self.__inertiaHandler = InertiaHandler(self.__friction,
- self.__onInertiaMove, self.__onInertiaStop)
-
- def _handleUp(self, event):
- numContacts = len(self._contacts)
- if numContacts == 0:
- contact = event.contact
- transform = Transform(self.__relContactPos(contact) - self.__lastPosns[0])
- utils.callWeakRef(self.__upHandler, transform)
- if self.__friction != -1:
- self.__inertiaHandler.onDrag(transform)
- self.__inertiaHandler.onUp()
- else:
- self._setEnd(event)
- elif numContacts == 1:
- self.__newPhase()
- else:
- self.__newPhase()
-
- def _handleChange(self):
- numContacts = len(self._contacts)
- if numContacts == 1:
- contact = self._contacts.keys()[0]
- transform = Transform(self.__relContactPos(contact) - self.__lastPosns[0])
- if self.__friction != -1:
- self.__inertiaHandler.onDrag(transform)
- utils.callWeakRef(self.__moveHandler, transform)
- self.__lastPosns = [self.__relContactPos(contact)]
- else:
- contactPosns = [self.__relContactPos(contact)
- for contact in self._contacts.keys()]
- if numContacts == 2:
- self.__posns = contactPosns
- else:
- self.__posns = [getCentroid(self.__clusters[i], contactPosns) for
- i in range(2)]
-
- startDelta = self.__lastPosns[1]-self.__lastPosns[0]
- curDelta = self.__posns[1]-self.__posns[0]
-
- pivot = (self.__posns[0]+self.__posns[1])/2
-
- rot = avg.Point2D.angle(curDelta, startDelta)
-
- if self.__lastPosns[0] == self.__lastPosns[1]:
- scale = 1
- else:
- scale = ((self.__posns[0]-self.__posns[1]).getNorm() /
- (self.__lastPosns[0]-self.__lastPosns[1]).getNorm())
-
- trans = ((self.__posns[0]+self.__posns[1])/2 -
- (self.__lastPosns[0]+self.__lastPosns[1])/2)
- transform = Transform(trans, rot, scale, pivot)
- if self.__friction != -1:
- self.__inertiaHandler.onDrag(transform)
- utils.callWeakRef(self.__moveHandler, transform)
- self.__lastPosns = self.__posns
-
-
- def __newPhase(self):
- self.__lastPosns = []
- numContacts = len(self._contacts)
- if numContacts == 1:
- contact = self._contacts.keys()[0]
- self.__lastPosns.append(self.__relContactPos(contact))
- else:
- contactPosns = [self.__relContactPos(contact)
- for contact in self._contacts.keys()]
- if numContacts == 2:
- self.__lastPosns = contactPosns
- else:
- self.__clusters = calcKMeans(contactPosns)
- self.__lastPosns = [getCentroid(self.__clusters[i], contactPosns) for
- i in range(2)]
-
- def __onInertiaMove(self, transform):
- utils.callWeakRef(self.__moveHandler, transform)
-
- def __onInertiaStop(self):
- self._setEnd(None)
- self.__inertiaHandler = None
-
- def __relContactPos(self, contact):
- return self.__coordSysNode.getParent().getRelPos(contact.events[-1].pos)
-
-
-class InertiaHandler():
- def __init__(self, friction, moveHandler, stopHandler):
- self.__friction = friction
- self.__moveHandler = moveHandler
- self.__stopHandler = stopHandler
-
- self.__transVel = avg.Point2D(0, 0)
- self.__curPivot = avg.Point2D(0, 0)
- self.__angVel = 0
- self.__sizeVel = avg.Point2D(0, 0)
- self.__frameHandlerID = g_Player.setOnFrameHandler(self.__onDragFrame)
-
- def abort(self):
- self.__stop()
-
- def onDrag(self, transform):
- frameDuration = g_Player.getFrameDuration()
- self.__transVel += 0.1*transform.trans/frameDuration
- if transform.pivot != avg.Point2D(0,0):
- self.__curPivot = transform.pivot
- if transform.rot > pi:
- transform.rot -= 2*pi
- self.__angVel += 0.1*transform.rot/frameDuration
-
- def onUp(self):
- g_Player.clearInterval(self.__frameHandlerID)
- self.__frameHandlerID = g_Player.setOnFrameHandler(self.__onInertiaFrame)
-
- def __onDragFrame(self):
- self.__transVel *= 0.9
- self.__angVel *= 0.9
-
- def __onInertiaFrame(self):
- transNorm = self.__transVel.getNorm()
- if transNorm - self.__friction > 0:
- direction = self.__transVel.getNormalized()
- self.__transVel = direction * (transNorm-self.__friction)
- curTrans = self.__transVel * g_Player.getFrameDuration()
- else:
- curTrans = avg.Point2D(0, 0)
-
- if self.__angVel != 0:
- angSign = self.__angVel/fabs(self.__angVel)
- self.__angVel = self.__angVel - angSign*self.__friction/200
- newAngSign = self.__angVel/fabs(self.__angVel)
- if newAngSign != angSign:
- self.__angVel = 0
- curAng = self.__angVel * g_Player.getFrameDuration()
- self.__curPivot += curTrans
-
- if transNorm - self.__friction > 0 or self.__angVel != 0:
- if self.__moveHandler:
- self.__moveHandler(Transform(curTrans, curAng, 1, self.__curPivot))
- else:
- self.__stop()
-
- def __stop(self):
- g_Player.clearInterval(self.__frameHandlerID)
- self.__stopHandler()
- self.__stopHandler = None
- self.__moveHandler = None
diff --git a/src/python/ui/helper.py b/src/python/ui/helper.py
deleted file mode 100644
index 3963a99..0000000
--- a/src/python/ui/helper.py
+++ /dev/null
@@ -1,61 +0,0 @@
-# -*- coding: utf-8 -*-
-# libavg - Media Playback Engine.
-# Copyright (C) 2003-2011 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
-#
-
-from libavg import avg
-
-class ScrollPane(avg.DivNode):
-
- def __init__(self, contentDiv, *args, **kwargs):
-
- avg.DivNode.__init__(self, crop=True, *args, **kwargs)
- self.appendChild(contentDiv)
- self.__contentDiv = contentDiv
-
- def setContentPos(self, pos):
-
- def constrain(pos, limit):
- if limit < 0:
- # Content larger than container
- if pos < limit:
- pos = limit
- elif pos > 0:
- pos = 0
- else:
- # Content smaller than container
- if pos < 0:
- pos = 0
- elif pos > limit:
- pos = limit
- return pos
-
- maxPos = self.getMaxContentPos()
- pos = avg.Point2D(pos)
- pos.x = constrain(pos.x, maxPos.x)
- pos.y = constrain(pos.y, maxPos.y)
- self.__contentDiv.pos = pos
-
- def getContentPos(self):
- return self.__contentDiv.pos
- contentpos = property(getContentPos, setContentPos)
-
- def getMaxContentPos(self):
- maxPos = self.size - self.__contentDiv.size
- return maxPos
diff --git a/src/python/ui/keyboard.py b/src/python/ui/keyboard.py
deleted file mode 100644
index 419fd9f..0000000
--- a/src/python/ui/keyboard.py
+++ /dev/null
@@ -1,243 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-#
-# libavg - Media Playback Engine.
-# Copyright (C) 2003-2011 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 module: Thomas Schott <scotty at c-base dot org>
-#
-
-import os.path
-
-from libavg import avg
-
-g_Player = avg.Player.get()
-g_Logger = avg.Logger.get()
-
-
-class Key(avg.ImageNode):
- def __init__(self, keyDef, ovlHref, onDownCallback, onUpCallback,
- onOutCallback=lambda event, keyCode:None, sticky=False, *args, **kwargs):
- kwargs['pos'] = keyDef[1]
- kwargs['size'] = keyDef[2]
- kwargs['opacity'] = 0.0
- super(Key, self).__init__(*args, **kwargs)
-
- if ovlHref:
- self.__createImage(ovlHref)
- self.__keyCode = keyDef[0]
- self.__onDownCallback = onDownCallback
- self.__onUpCallback = onUpCallback
- self.__onOutCallback = onOutCallback
- self.__sticky = sticky
- if self.__sticky:
- self.__stickyIsDown = False
- self.__cursorID = None
- self.setEventHandler(avg.CURSORDOWN, avg.MOUSE | avg.TOUCH, self.__onDown)
- self.setEventHandler(avg.CURSORUP, avg.MOUSE | avg.TOUCH, self.__onUp)
- self.setEventHandler(avg.CURSOROUT, avg.MOUSE | avg.TOUCH, self.__onOut)
-
- def reset(self):
- if self.__sticky:
- self.opacity = 0.0
- self.__stickyIsDown = False
-
- def __createImage(self, ovlHref):
- if os.path.isabs(ovlHref):
- effectiveHref = ovlHref
- else:
- effectiveHref = self.getParent().getEffectiveMediaDir() + ovlHref
- canvas = g_Player.loadCanvasString(
- '''
- <canvas id="offscreen" size="%s">
- <image href="%s" pos="%s"/>
- </canvas>
- '''
- %(str(self.size),
- effectiveHref,
- str(-self.pos)))
- canvas.render()
- self.setBitmap(canvas.screenshot())
- g_Player.deleteCanvas('offscreen')
-
- def __onDown(self, event):
- if self.__sticky:
- self.__stickyIsDown = not(self.__stickyIsDown)
- if self.__stickyIsDown:
- self.__pseudoDown(event)
- else:
- self.__pseudoUp(event)
- else:
- if self.__cursorID:
- return
- self.__pseudoDown(event)
-
- def __onUp(self, event):
- if not self.__cursorID == event.cursorid:
- return
- if not (self.__sticky):
- self.__pseudoUp(event)
-
- def __onOut(self, event):
- if not self.__cursorID == event.cursorid:
- return
- if not(self.__sticky):
- self.__cursorID = None
- self.opacity = 0.0
- self.__onOutCallback(event, self.__keyCode)
-
- def __pseudoDown(self, event):
- self.__cursorID = event.cursorid
-
- self.opacity = 1.0
- if self.__onDownCallback:
- self.__onDownCallback(event, self.__keyCode)
-
- def __pseudoUp(self, event):
- self.__cursorID = None
-
- self.opacity = 0.0
- if self.__onUpCallback:
- self.__onUpCallback(event, self.__keyCode)
-
-
-
-class Keyboard(avg.DivNode):
-
- def __init__(self, bgHref, ovlHref, keyDefs, shiftKeyCode, altGrKeyCode=None,
- stickyShift=False, *args, **kwargs):
- # TODO: shift and altGr handling have some duplicated code.
- super(Keyboard, self).__init__(*args, **kwargs)
-
- self.__shiftKeyCode = shiftKeyCode
- self.__shiftDownCounter = 0
- self.__stickyShift = stickyShift
- self.__altGrKeyCode = altGrKeyCode
- self.__altGrKeyCounter = 0
- if not(self.__shiftKeyCode) and self.__altGrKeyCode:
- raise RuntimeError(
- "Keyboard: If there is an altgr key, there must also be a shift key.")
- self.__codesPerKey = 1
- if self.__shiftKeyCode:
- self.__codesPerKey = 2
- if self.__altGrKeyCode:
- self.__codesPerKey = 3
-
- self.__downKeyHandler = None
- self.__upKeyHandler = None
-
- self.__keys = []
- if bgHref:
- avg.ImageNode(href=bgHref, parent=self)
- for kd in keyDefs:
- if isinstance(kd[0], tuple):
- while len(kd[0]) < self.__codesPerKey:
- kd[0] += (kd[0][0],)
- key = Key(kd, ovlHref, self.__onCharKeyDown, self.__onCharKeyUp,
- parent=self)
- else:
- sticky =(self.__stickyShift and
- (self.__shiftKeyCode == kd[0] or self.__altGrKeyCode == kd[0]))
- key = Key(kd, ovlHref, self.__onCommandKeyDown, self.__onCommandKeyUp,
- self.__onCommandKeyUp, sticky=sticky, parent=self)
- self.__keys.append(key)
-
- @classmethod
- def makeRowKeyDefs(cls, startPos, keySize, spacing, keyStr, shiftKeyStr,
- altGrKeyStr=None):
- keyDefs = []
- curPos = startPos
- offset = keySize[0]+spacing
- if altGrKeyStr:
- for keyCode, shiftKeyCode, altGrKeyCode in (
- zip(keyStr, shiftKeyStr, altGrKeyStr)):
- keyDefs.append([(keyCode, shiftKeyCode, altGrKeyCode), curPos, keySize])
- curPos = (curPos[0]+offset, curPos[1])
- else:
- for keyCode, shiftKeyCode in zip(keyStr, shiftKeyStr):
- keyDefs.append([(keyCode, shiftKeyCode), curPos, keySize])
- curPos = (curPos[0]+offset, curPos[1])
- return keyDefs
-
- def setKeyHandler(self, downHandler, upHandler=None):
- self.__downKeyHandler = downHandler
- self.__upKeyHandler = upHandler
-
- def reset(self):
- for key in self.__keys:
- key.reset()
- self.__shiftDownCounter = 0
- self.__altGrKeyCounter = 0
-
- def _getCharKeyCode(self, keyCodes):
- '''
- Return one of a character key's keycodes depending on shift key(s) status.
- Overload this method to change character key keycode handling.
- '''
- if self.__shiftDownCounter:
- return keyCodes[1]
- elif self.__altGrKeyCounter:
- return keyCodes[2]
- else:
- return keyCodes[0]
-
- def _onCommandKeyDown(self, event, keyCode):
- '''
- Overload this method to add command key functionality.
- '''
- pass
-
- def _onCommandKeyUp(self, event, keyCode):
- '''
- Overload this method to add command key functionality.
- '''
- pass
-
- def __onCharKeyDown(self, event, keyCodes):
- if self.__downKeyHandler:
- self.__downKeyHandler(event, self._getCharKeyCode(keyCodes), None)
-
- def __onCharKeyUp(self, event, keyCodes):
- if self.__upKeyHandler:
- self.__upKeyHandler(event, self._getCharKeyCode(keyCodes), None)
-
- def __onCommandKeyDown(self, event, keyCode):
- self._onCommandKeyDown(event, keyCode)
- if keyCode == self.__shiftKeyCode:
- self.__shiftDownCounter += 1
- if keyCode == self.__altGrKeyCode:
- self.__altGrKeyCounter += 1
- if self.__downKeyHandler:
- self.__downKeyHandler(event, None, keyCode)
-
- def __onCommandKeyUp(self, event, keyCode):
- self._onCommandKeyUp(event, keyCode)
- if keyCode == self.__shiftKeyCode:
- if self.__shiftDownCounter > 0:
- self.__shiftDownCounter -= 1
- else:
- g_Logger.trace(g_Logger.WARNING,
- 'Keyboard: ShiftDownCounter=0 on [%s] up'
- %self.__shiftKeyCode)
- elif keyCode == self.__altGrKeyCode:
- if self.__altGrKeyCounter > 0:
- self.__altGrKeyCounter -= 1
- if self.__upKeyHandler:
- self.__upKeyHandler(event, None, keyCode)
-
diff --git a/src/python/utils.py b/src/python/utils.py
index 363191b..86f76c0 100644
--- a/src/python/utils.py
+++ b/src/python/utils.py
@@ -1,5 +1,5 @@
# libavg - Media Playback Engine.
-# Copyright (C) 2003-2011 Ulrich von Zadow
+# 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
@@ -22,14 +22,13 @@
import os
-import weakref, new
+from libavg import avg, mathutil, player
-from libavg import avg, mathutil
-g_Player = avg.Player.get()
-
-def getMediaDir(_file_, subdir='media'):
+def getMediaDir(_file_=None, subdir='media'):
"""call with _file_=__file__"""
+ if _file_ == None:
+ _file_ = __file__
myDir = os.path.dirname(_file_)
mediaDir = os.path.join(myDir, subdir)
return os.path.abspath(mediaDir)
@@ -47,7 +46,7 @@ def getMediaDirFromNode(node, path=''):
return path
def createImagePreviewNode(maxSize, absHref):
- node = g_Player.createNode('image', {'href': absHref})
+ node = player.createNode('image', {'href': absHref})
node.size = mathutil.getScaledDim(node.size, max = maxSize)
return node
@@ -56,46 +55,9 @@ def initFXCache(numFXNodes):
mediadir = os.path.join(os.path.dirname(__file__), 'data')
for i in range(numFXNodes):
node = avg.ImageNode(href=mediadir+"/black.png",
- parent=g_Player.getRootNode())
+ parent=player.getRootNode())
node.setEffect(avg.NullFXNode())
nodes.append(node)
for node in nodes:
node.unlink(True)
-class methodref(object):
- # From Python Cookbook
- """ Wraps any callable, most importantly a bound method, in a way that allows a bound
- method's object to be GC'ed, while providing the same interface as a normal weak
- reference."""
- def __init__(self, fn):
- try:
- # Try getting object, function and class
- o, f, c = fn.im_self, fn.im_func, fn.im_class
- except AttributeError:
- # It's not a bound method
- self._obj = None
- self._func = fn
- self._clas = None
- else:
- # Bound method
- if o is None: # ... actually UN-bound
- self._obj = None
- else:
- self._obj = weakref.ref(o)
- self._func = f
- self._clas = c
-
- def __call__(self):
- if self._obj is None:
- return self._func
- elif self._obj() is None:
- return None
- return new.instancemethod(self._func, self._obj(), self._clas)
-
-def callWeakRef(ref, *args, **kwargs):
- func = ref()
- if func is None:
- return
- else:
- return func(*args, **kwargs)
-
diff --git a/src/python/widget/Makefile.am b/src/python/widget/Makefile.am
new file mode 100644
index 0000000..ad04474
--- /dev/null
+++ b/src/python/widget/Makefile.am
@@ -0,0 +1,3 @@
+pkgwidgetdir = $(pkgpyexecdir)/widget
+pkgwidget_PYTHON = __init__.py button.py keyboard.py scrollarea.py slider.py base.py \
+ skin.py mediacontrol.py
diff --git a/src/python/widget/Makefile.in b/src/python/widget/Makefile.in
new file mode 100644
index 0000000..a2bbfe7
--- /dev/null
+++ b/src/python/widget/Makefile.in
@@ -0,0 +1,512 @@
+# Makefile.in generated by automake 1.11.3 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = src/python/widget
+DIST_COMMON = $(pkgwidget_PYTHON) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/ac_cxx_namespaces.m4 \
+ $(top_srcdir)/m4/ac_path_generic.m4 \
+ $(top_srcdir)/m4/ax_boost_thread.m4 \
+ $(top_srcdir)/m4/ax_check_gl.m4 \
+ $(top_srcdir)/m4/ax_python_devel.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/pkg.m4 \
+ $(top_srcdir)/m4/avg_version.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/src/avgconfig.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+SOURCES =
+DIST_SOURCES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
+am__py_compile = PYTHON=$(PYTHON) $(SHELL) $(py_compile)
+am__installdirs = "$(DESTDIR)$(pkgwidgetdir)"
+py_compile = $(top_srcdir)/py-compile
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BOOST_PYTHON_LIBS = @BOOST_PYTHON_LIBS@
+BOOST_THREAD_LIBS = @BOOST_THREAD_LIBS@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DC1394_2_CFLAGS = @DC1394_2_CFLAGS@
+DC1394_2_LIBS = @DC1394_2_LIBS@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FFMPEG_CFLAGS = @FFMPEG_CFLAGS@
+FFMPEG_LIBS = @FFMPEG_LIBS@
+FGREP = @FGREP@
+FONTCONFIG_CFLAGS = @FONTCONFIG_CFLAGS@
+FONTCONFIG_LIBS = @FONTCONFIG_LIBS@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_CONFIG = @FREETYPE_CONFIG@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GDK_PIXBUF_CFLAGS = @GDK_PIXBUF_CFLAGS@
+GDK_PIXBUF_LIBS = @GDK_PIXBUF_LIBS@
+GLU_CFLAGS = @GLU_CFLAGS@
+GLU_LIBS = @GLU_LIBS@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBFFMPEG = @LIBFFMPEG@
+LIBOBJS = @LIBOBJS@
+LIBRSVG_CFLAGS = @LIBRSVG_CFLAGS@
+LIBRSVG_LIBS = @LIBRSVG_LIBS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBVIDEO_LDADD = @LIBVIDEO_LDADD@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+MTDEV_CFLAGS = @MTDEV_CFLAGS@
+MTDEV_LIBS = @MTDEV_LIBS@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLDFLAGS = @OBJCLDFLAGS@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PANGOFT2_CFLAGS = @PANGOFT2_CFLAGS@
+PANGOFT2_LIBS = @PANGOFT2_LIBS@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PREFIX = @PREFIX@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
+PYTHON = @PYTHON@
+PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@
+PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
+PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@
+PYTHON_LDFLAGS = @PYTHON_LDFLAGS@
+PYTHON_PLATFORM = @PYTHON_PLATFORM@
+PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_SITE_PKG = @PYTHON_SITE_PKG@
+PYTHON_VERSION = @PYTHON_VERSION@
+RANLIB = @RANLIB@
+SDL_CFLAGS = @SDL_CFLAGS@
+SDL_CONFIG = @SDL_CONFIG@
+SDL_LIBS = @SDL_LIBS@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+XI2_1_CFLAGS = @XI2_1_CFLAGS@
+XI2_1_LIBS = @XI2_1_LIBS@
+XI2_2_CFLAGS = @XI2_2_CFLAGS@
+XI2_2_LIBS = @XI2_2_LIBS@
+XMKMF = @XMKMF@
+XML2_CFLAGS = @XML2_CFLAGS@
+XML2_CONFIG = @XML2_CONFIG@
+XML2_LIBS = @XML2_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+acx_pthread_config = @acx_pthread_config@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+pkgpyexecdir = @pkgpyexecdir@
+pkgpythondir = @pkgpythondir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+pyexecdir = @pyexecdir@
+pythondir = @pythondir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+pkgwidgetdir = $(pkgpyexecdir)/widget
+pkgwidget_PYTHON = __init__.py button.py keyboard.py scrollarea.py slider.py base.py \
+ skin.py mediacontrol.py
+
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/python/widget/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/python/widget/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-pkgwidgetPYTHON: $(pkgwidget_PYTHON)
+ @$(NORMAL_INSTALL)
+ test -z "$(pkgwidgetdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgwidgetdir)"
+ @list='$(pkgwidget_PYTHON)'; dlist=; list2=; test -n "$(pkgwidgetdir)" || list=; \
+ for p in $$list; do \
+ if test -f "$$p"; then b=; else b="$(srcdir)/"; fi; \
+ if test -f $$b$$p; then \
+ $(am__strip_dir) \
+ dlist="$$dlist $$f"; \
+ list2="$$list2 $$b$$p"; \
+ else :; fi; \
+ done; \
+ for file in $$list2; do echo $$file; done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgwidgetdir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgwidgetdir)" || exit $$?; \
+ done || exit $$?; \
+ if test -n "$$dlist"; then \
+ $(am__py_compile) --destdir "$(DESTDIR)" \
+ --basedir "$(pkgwidgetdir)" $$dlist; \
+ else :; fi
+
+uninstall-pkgwidgetPYTHON:
+ @$(NORMAL_UNINSTALL)
+ @list='$(pkgwidget_PYTHON)'; test -n "$(pkgwidgetdir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ test -n "$$files" || exit 0; \
+ dir='$(DESTDIR)$(pkgwidgetdir)'; \
+ filesc=`echo "$$files" | sed 's|$$|c|'`; \
+ fileso=`echo "$$files" | sed 's|$$|o|'`; \
+ st=0; \
+ for files in "$$files" "$$filesc" "$$fileso"; do \
+ $(am__uninstall_files_from_dir) || st=$$?; \
+ done; \
+ exit $$st
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+ for dir in "$(DESTDIR)$(pkgwidgetdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-pkgwidgetPYTHON
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-pkgwidgetPYTHON
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ distclean distclean-generic distclean-libtool distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-pkgwidgetPYTHON install-ps \
+ install-ps-am install-strip installcheck installcheck-am \
+ installdirs maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
+ ps ps-am uninstall uninstall-am uninstall-pkgwidgetPYTHON
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/src/python/widget/__init__.py b/src/python/widget/__init__.py
new file mode 100644
index 0000000..c94febb
--- /dev/null
+++ b/src/python/widget/__init__.py
@@ -0,0 +1,7 @@
+from base import SwitchNode, HStretchNode, VStretchNode, HVStretchNode, Orientation
+from button import Button, BmpButton, TextButton, ToggleButton, BmpToggleButton, CheckBox
+from keyboard import Keyboard
+from scrollarea import ScrollPane, ScrollArea
+from skin import Skin
+from slider import Slider, ScrollBar, ScrollBarTrack, ScrollBarThumb, SliderThumb, ProgressBar
+from mediacontrol import TimeSlider, MediaControl
diff --git a/src/python/widget/base.py b/src/python/widget/base.py
new file mode 100644
index 0000000..7a898e6
--- /dev/null
+++ b/src/python/widget/base.py
@@ -0,0 +1,267 @@
+# -*- 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
+
+from libavg import avg, player
+
+class Orientation():
+ VERTICAL = 0
+ HORIZONTAL = 1
+
+
+def bmpFromSrc(src):
+ if isinstance(src, basestring):
+ return avg.Bitmap(src)
+ elif isinstance(src, avg.Bitmap):
+ return src
+ else:
+ raise RuntimeError("src must be a string or a Bitmap.")
+
+class _StretchNodeBase(avg.DivNode):
+
+ def __init__(self, src=None, parent=None, **kwargs):
+ super(_StretchNodeBase, self).__init__(**kwargs)
+ self.registerInstance(self, parent)
+ if isinstance(src, avg.Bitmap):
+ self._bmp = src
+ else:
+ self._bmp = bmpFromSrc(src)
+
+ self.subscribe(self.SIZE_CHANGED, self._positionNodes)
+
+ def _initNodes(self):
+ self._setSizeFromBmp(self._bmp)
+ self._positionNodes(self.size)
+
+ if player.isPlaying():
+ self._renderImages()
+ else:
+ player.subscribe(avg.Player.PLAYBACK_START, self._renderImages)
+
+ def _setSizeFromBmp(self, bmp):
+ size = bmp.getSize()
+ if self.width == 0:
+ self.width = size.x
+ if self.height == 0:
+ self.height = size.y
+
+ def _checkExtents(self, endsExtent, minExtent):
+ if endsExtent < 0:
+ raise RuntimeError(
+ "Illegal value for endsExtent: %i. Must be >= 0"%endsExtent)
+ elif endsExtent == 0:
+ # 1 has same effect as 0 - we just create one-pixel wide start and end images.
+ endsExtent = 1
+
+ if minExtent == -1:
+ minExtent = endsExtent*2+1
+ else:
+ minExtent = minExtent
+ return (endsExtent, minExtent)
+
+ def _renderImage(self, srcBmp, node, pos, size):
+ canvas = player.createCanvas(id="stretch_canvas", size=size)
+ img = avg.ImageNode(pos=pos, parent=canvas.getRootNode())
+ img.setBitmap(srcBmp)
+ canvas.render()
+ node.setBitmap(canvas.screenshot())
+ player.deleteCanvas("stretch_canvas")
+
+
+class HStretchNode(_StretchNodeBase):
+
+ def __init__(self, endsExtent, minExtent=-1, **kwargs):
+ super(HStretchNode, self).__init__(**kwargs)
+
+ (self.__endsExtent, self.__minExtent) = self._checkExtents(endsExtent, minExtent)
+
+ self.__startImg = avg.ImageNode(parent=self)
+ self.__centerImg = avg.ImageNode(parent=self)
+ self.__endImg = avg.ImageNode(parent=self)
+
+ self._initNodes()
+
+ def _positionNodes(self, newSize):
+ if newSize.x < self.__minExtent:
+ self.width = self.__minExtent
+ else:
+ self.__centerImg.x = self.__endsExtent
+ self.__centerImg.width = newSize.x - self.__endsExtent*2
+ self.__endImg.x = newSize.x - self.__endsExtent
+
+ def _renderImages(self):
+ height = self._bmp.getSize().y
+ self._renderImage(self._bmp, self.__startImg, (0,0), (self.__endsExtent, height))
+ self._renderImage(self._bmp, self.__centerImg,
+ (-self.__endsExtent,0), (1, height))
+ endOffset = self._bmp.getSize().x - self.__endsExtent
+ self._renderImage(self._bmp, self.__endImg,
+ (-endOffset,0), (self.__endsExtent, height))
+
+
+class VStretchNode(_StretchNodeBase):
+
+ def __init__(self, endsExtent, minExtent=-1, **kwargs):
+ super(VStretchNode, self).__init__(**kwargs)
+
+ (self.__endsExtent, self.__minExtent) = self._checkExtents(endsExtent, minExtent)
+
+ self.__startImg = avg.ImageNode(parent=self)
+ self.__centerImg = avg.ImageNode(parent=self)
+ self.__endImg = avg.ImageNode(parent=self)
+
+ self._initNodes()
+
+ def _positionNodes(self, newSize):
+ if newSize.y < self.__minExtent:
+ self.height = self.__minExtent
+ else:
+ self.__centerImg.y = self.__endsExtent
+ self.__centerImg.height = newSize.y - self.__endsExtent*2
+ self.__endImg.y = newSize.y - self.__endsExtent
+
+ def _renderImages(self):
+ width = self._bmp.getSize().x
+ self._renderImage(self._bmp, self.__startImg, (0,0), (width, self.__endsExtent))
+ self._renderImage(self._bmp, self.__centerImg,
+ (0,-self.__endsExtent), (width, 1))
+ endOffset = self._bmp.getSize().y - self.__endsExtent
+ self._renderImage(self._bmp, self.__endImg, (0,-endOffset),
+ (width, self.__endsExtent))
+
+
+class HVStretchNode(_StretchNodeBase):
+
+ def __init__(self, endsExtent, minExtent=(-1,-1), **kwargs):
+ super(HVStretchNode, self).__init__(**kwargs)
+
+ (hEndsExtent, hMinExtent) = self._checkExtents(endsExtent[0], minExtent[0])
+ (vEndsExtent, vMinExtent) = self._checkExtents(endsExtent[1], minExtent[1])
+ self.__endsExtent = avg.Point2D(hEndsExtent, vEndsExtent)
+ self.__minExtent = avg.Point2D(hMinExtent, vMinExtent)
+
+ self.__createNodes()
+
+ self._initNodes()
+
+ def __calcNodePositions(self, newSize):
+ xPosns = (0, self.__endsExtent[0], newSize.x-self.__endsExtent[0], newSize.x)
+ yPosns = (0, self.__endsExtent[1], newSize.y-self.__endsExtent[1], newSize.y)
+
+ self.__nodePosns = []
+ for y in range(4):
+ curRow = []
+ for x in range(4):
+ curRow.append(avg.Point2D(xPosns[x], yPosns[y]))
+ self.__nodePosns.append(curRow)
+
+ def __createNodes(self):
+ self.__nodes = []
+ for y in range(3):
+ curRow = []
+ for x in range(3):
+ node = avg.ImageNode(parent=self)
+ curRow.append(node)
+ self.__nodes.append(curRow)
+
+ def _positionNodes(self, newSize):
+ newSize = avg.Point2D(
+ max(self.__minExtent.x, newSize.x),
+ max(self.__minExtent.y, newSize.y))
+
+ self.__calcNodePositions(newSize)
+
+ for y in range(3):
+ for x in range(3):
+ pos = self.__nodePosns[y][x]
+ size = self.__nodePosns[y+1][x+1] - self.__nodePosns[y][x]
+ node = self.__nodes[y][x]
+ node.pos = pos
+ node.size = size
+
+ def _renderImages(self):
+ bmpSize = self._bmp.getSize()
+ xPosns = (0, self.__endsExtent[0], bmpSize.x-self.__endsExtent[0], bmpSize.x)
+ yPosns = (0, self.__endsExtent[1], bmpSize.y-self.__endsExtent[1], bmpSize.y)
+ for y in range(3):
+ for x in range(3):
+ node = self.__nodes[y][x]
+ pos = avg.Point2D(xPosns[x], yPosns[y])
+ size = avg.Point2D(xPosns[x+1], yPosns[y+1]) - pos
+ if x == 1:
+ size.x = 1
+ if y == 1:
+ size.y = 1
+ self._renderImage(self._bmp, node, -pos, size)
+
+
+class SwitchNode(avg.DivNode):
+
+ def __init__(self, nodeMap=None, visibleid=None, parent=None, **kwargs):
+ super(SwitchNode, self).__init__(**kwargs)
+ self.registerInstance(self, parent)
+
+ self.__nodeMap = None
+ if nodeMap:
+ self.setNodeMap(nodeMap)
+ if visibleid:
+ self.setVisibleID(visibleid)
+
+ self.subscribe(self.SIZE_CHANGED, self.__setChildSizes)
+
+ def setNodeMap(self, nodeMap):
+ if self.__nodeMap is not None:
+ raise RuntimeError("SwitchNode.nodeMap can only be set once.")
+ self.__nodeMap = nodeMap
+ for node in self.__nodeMap.itervalues():
+ if node:
+ # Only insert child if it hasn't been inserted yet.
+ try:
+ self.indexOf(node)
+ except RuntimeError:
+ self.appendChild(node)
+ if self.size != (0,0):
+ size = self.size
+ else:
+ key = list(self.__nodeMap.keys())[0]
+ size = self.__nodeMap[key].size
+ self.size = size
+
+ def getVisibleID(self):
+ return self.__visibleid
+
+ def setVisibleID(self, visibleid):
+ if not (visibleid in self.__nodeMap):
+ raise RuntimeError("'%s' is not a registered id." % visibleid)
+ self.__visibleid = visibleid
+ for node in self.__nodeMap.itervalues():
+ node.active = False
+ self.__nodeMap[visibleid].active = True
+
+ visibleid = property(getVisibleID, setVisibleID)
+
+ def __setChildSizes(self, newSize):
+ if self.__nodeMap:
+ for node in self.__nodeMap.itervalues():
+ if node:
+ node.size = newSize
+ # Hack to support min. size in SwitchNodes containing StretchNodes
+ if node.size > newSize:
+ self.size = node.size
+ return
diff --git a/src/python/widget/button.py b/src/python/widget/button.py
new file mode 100644
index 0000000..f938e46
--- /dev/null
+++ b/src/python/widget/button.py
@@ -0,0 +1,443 @@
+# -*- 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
+#
+# Original author of this file is Henrik Thoms
+
+from libavg import avg, statemachine, player, gesture
+
+from base import SwitchNode, HVStretchNode
+from . import skin
+
+class _ButtonBase(avg.DivNode):
+
+ PRESSED = avg.Publisher.genMessageID()
+ RELEASED = avg.Publisher.genMessageID()
+
+ def __init__(self, parent=None, **kwargs):
+ super(_ButtonBase, self).__init__(**kwargs)
+ self.registerInstance(self, parent)
+ self.publish(self.PRESSED)
+ self.publish(self.RELEASED)
+
+ def _setActiveArea(self, upNode, activeAreaNode, fatFingerEnlarge):
+ if fatFingerEnlarge:
+ if activeAreaNode:
+ raise(RuntimeError(
+ "Button: Can't specify both fatFingerEnlarge and activeAreaNode"))
+ size = upNode.size
+ minSize = 20*player.getPixelsPerMM()
+ size = avg.Point2D(max(minSize, size.x), max(minSize, size.y))
+ activeAreaNode = avg.RectNode(size=size, opacity=0, parent=self)
+ #Here we need to store a 'hard' reference to the active area node
+ #because the tap recognizer won't keep it
+ self.__activeAreaNode = activeAreaNode
+ else:
+ if activeAreaNode == None:
+ activeAreaNode = self
+ else:
+ self.appendChild(activeAreaNode)
+
+ self._tapRecognizer = gesture.TapRecognizer(activeAreaNode,
+ possibleHandler=self._onDown,
+ detectedHandler=self._onTap,
+ failHandler=self._onTapFail)
+
+
+class Button(_ButtonBase):
+
+ CLICKED = avg.Publisher.genMessageID()
+
+ def __init__(self, upNode, downNode, disabledNode=None, activeAreaNode=None,
+ enabled=True, fatFingerEnlarge=False, **kwargs):
+ super(Button, self).__init__(**kwargs)
+
+ if disabledNode == None:
+ disabledNode = upNode
+
+ nodeMap = {
+ "UP": upNode,
+ "DOWN": downNode,
+ "DISABLED": disabledNode
+ }
+ self.__switchNode = SwitchNode(nodeMap=nodeMap, visibleid="UP", parent=self)
+ self.publish(self.CLICKED)
+
+ self.__stateMachine = statemachine.StateMachine("Button", "UP")
+ self.__stateMachine.addState("UP", ("DOWN", "DISABLED"),
+ enterFunc=self._enterUp, leaveFunc=self._leaveUp)
+ self.__stateMachine.addState("DOWN", ("UP", "DISABLED"),
+ enterFunc=self._enterDown, leaveFunc=self._leaveDown)
+ self.__stateMachine.addState("DISABLED", ("UP",),
+ enterFunc=self._enterDisabled, leaveFunc=self._leaveDisabled)
+
+ self._setActiveArea(upNode, activeAreaNode, fatFingerEnlarge)
+
+ if not(enabled):
+ self.setEnabled(False)
+
+ def getEnabled(self):
+ return self.__stateMachine.state != "DISABLED"
+
+ def setEnabled(self, enabled):
+ if enabled:
+ if self.__stateMachine.state == "DISABLED":
+ self.__stateMachine.changeState("UP")
+ else:
+ if self.__stateMachine.state != "DISABLED":
+ self.__stateMachine.changeState("DISABLED")
+
+ enabled = property(getEnabled, setEnabled)
+
+ def _getState(self):
+ return self.__stateMachine.state
+
+ def _onDown(self):
+ self.__stateMachine.changeState("DOWN")
+ self.notifySubscribers(self.PRESSED, [])
+
+ def _onTap(self):
+ self.__stateMachine.changeState("UP")
+ self.notifySubscribers(self.CLICKED, [])
+ self.notifySubscribers(self.RELEASED, [])
+
+ def _onTapFail(self):
+ self.__stateMachine.changeState("UP")
+ self.notifySubscribers(self.RELEASED, [])
+
+ def _enterUp(self):
+ self.__setActiveNode()
+
+ def _leaveUp(self):
+ pass
+
+ def _enterDown(self):
+ self.__setActiveNode()
+
+ def _leaveDown(self):
+ pass
+
+ def _enterDisabled(self):
+ self.__setActiveNode()
+ self._tapRecognizer.enable(False)
+
+ def _leaveDisabled(self):
+ self._tapRecognizer.enable(True)
+
+ def __setActiveNode(self):
+ self.__switchNode.visibleid = self.__stateMachine.state
+
+
+class BmpButton(Button):
+
+ def __init__(self, upSrc, downSrc, disabledSrc=None, **kwargs):
+ upNode = avg.ImageNode(href=upSrc)
+ downNode = avg.ImageNode(href=downSrc)
+ if disabledSrc != None:
+ disabledNode = avg.ImageNode(href=disabledSrc)
+ else:
+ disabledNode = None
+ super(BmpButton, self).__init__(upNode=upNode, downNode=downNode,
+ disabledNode=disabledNode, **kwargs)
+
+
+class TextButton(Button):
+
+ def __init__(self, text, skinObj=skin.Skin.default, **kwargs):
+ size = avg.Point2D(kwargs["size"])
+ cfg = skinObj.defaultTextButtonCfg
+
+ self.wordsNodes = []
+
+ upNode = self.__createStateNode(size, cfg, "upBmp", text, "font")
+ downNode = self.__createStateNode(size, cfg, "downBmp", text, "downFont")
+ if "disabledBmp" in cfg:
+ disabledNode = self.__createStateNode(size, cfg, "disabledBmp", text,
+ "disabledFont")
+ else:
+ disabledNode = None
+
+ super(TextButton, self).__init__(upNode=upNode, downNode=downNode,
+ disabledNode=disabledNode, **kwargs)
+
+ def __createStateNode(self, size, cfg, bmpName, text, fontStyleName):
+ stateNode = avg.DivNode(size=size)
+ endsExtent = eval(cfg["endsExtent"], {}, {})
+ HVStretchNode(size=size, src=cfg[bmpName], endsExtent=endsExtent,
+ parent=stateNode)
+ words = avg.WordsNode(text=text, fontstyle=cfg[fontStyleName], parent=stateNode)
+ words.pos = (round((size.x-words.size.x)/2), round((size.y-words.size.y)/2))
+ self.wordsNodes.append(words)
+ return stateNode
+
+ def getText(self):
+ return self.wordsNodes[0].text
+
+ def setText(self, text):
+ for node in self.wordsNodes:
+ node.text = text
+ node.pos = (self.size-node.size)/2
+
+ text = property(getText, setText)
+
+
+class ToggleButton(_ButtonBase):
+
+ TOGGLED = avg.Publisher.genMessageID()
+
+ def __init__(self, uncheckedUpNode, uncheckedDownNode, checkedUpNode, checkedDownNode,
+ uncheckedDisabledNode=None, checkedDisabledNode=None, activeAreaNode=None,
+ enabled=True, fatFingerEnlarge=False, checked=False, **kwargs):
+ super(ToggleButton, self).__init__(**kwargs)
+ nodeMap = {
+ "UNCHECKED_UP": uncheckedUpNode,
+ "UNCHECKED_DOWN": uncheckedDownNode,
+ "CHECKED_UP": checkedUpNode,
+ "CHECKED_DOWN": checkedDownNode,
+ "UNCHECKED_DISABLED": uncheckedDisabledNode,
+ "CHECKED_DISABLED": checkedDisabledNode,
+ }
+ if uncheckedDisabledNode == None:
+ nodeMap["UNCHECKED_DISABLED"] = uncheckedUpNode
+ if checkedDisabledNode == None:
+ nodeMap["CHECKED_DISABLED"] = checkedUpNode
+ self.__switchNode = SwitchNode(nodeMap=nodeMap, visibleid="UNCHECKED_UP",
+ parent=self)
+
+ self.publish(ToggleButton.TOGGLED)
+
+ self.__stateMachine = statemachine.StateMachine("ToggleButton", "UNCHECKED_UP")
+ self.__stateMachine.addState("UNCHECKED_UP", ("UNCHECKED_DOWN",
+ "UNCHECKED_DISABLED"), enterFunc=self._enterUncheckedUp,
+ leaveFunc=self._leaveUncheckedUp)
+ self.__stateMachine.addState("UNCHECKED_DOWN", ("UNCHECKED_UP",
+ "UNCHECKED_DISABLED", "CHECKED_UP"), enterFunc=self._enterUncheckedDown,
+ leaveFunc=self._leaveUncheckedDown)
+ self.__stateMachine.addState("CHECKED_UP", ("CHECKED_DOWN", "CHECKED_DISABLED"),
+ enterFunc=self._enterCheckedUp, leaveFunc=self._leaveCheckedUp)
+ self.__stateMachine.addState("CHECKED_DOWN", ("CHECKED_UP", "UNCHECKED_UP",
+ "CHECKED_DISABLED"), enterFunc=self._enterCheckedDown,
+ leaveFunc=self._leaveCheckedDown)
+ self.__stateMachine.addState("UNCHECKED_DISABLED", ("UNCHECKED_UP",),
+ enterFunc=self._enterUncheckedDisabled,
+ leaveFunc=self._leaveUncheckedDisabled)
+ self.__stateMachine.addState("CHECKED_DISABLED", ("CHECKED_UP", ),
+ enterFunc=self._enterCheckedDisabled,
+ leaveFunc=self._leaveCheckedDisabled)
+
+ self._setActiveArea(uncheckedUpNode, activeAreaNode, fatFingerEnlarge)
+
+ if not enabled:
+ self.__stateMachine.changeState("UNCHECKED_DISABLED")
+ if checked:
+ self.setChecked(True)
+
+ def getEnabled(self):
+ return (self.__stateMachine.state != "CHECKED_DISABLED" and
+ self.__stateMachine.state != "UNCHECKED_DISABLED")
+
+ def setEnabled(self, enabled):
+ if enabled:
+ if self.__stateMachine.state == "CHECKED_DISABLED":
+ self.__stateMachine.changeState("CHECKED_UP")
+ elif self.__stateMachine.state == "UNCHECKED_DISABLED":
+ self.__stateMachine.changeState("UNCHECKED_UP")
+ else:
+ if (self.__stateMachine.state == "CHECKED_UP" or
+ self.__stateMachine.state == "CHECKED_DOWN") :
+ self.__stateMachine.changeState("CHECKED_DISABLED")
+ elif (self.__stateMachine.state == "UNCHECKED_UP" or
+ self.__stateMachine.state == "UNCHECKED_DOWN") :
+ self.__stateMachine.changeState("UNCHECKED_DISABLED")
+
+ enabled = property(getEnabled, setEnabled)
+
+ def getChecked(self):
+ return (self.__stateMachine.state != "UNCHECKED_UP" and
+ self.__stateMachine.state != "UNCHECKED_DOWN" and
+ self.__stateMachine.state != "UNCHECKED_DISABLED")
+
+ def setChecked(self, checked):
+ oldEnabled = self.getEnabled()
+ if checked:
+ if self.__stateMachine.state == "UNCHECKED_DISABLED":
+ self.__stateMachine.changeState("UNCHECKED_UP")
+ if self.__stateMachine.state == "UNCHECKED_UP":
+ self.__stateMachine.changeState("UNCHECKED_DOWN")
+ if self.__stateMachine.state != "CHECKED_UP":
+ self.__stateMachine.changeState("CHECKED_UP")
+ if not oldEnabled:
+ self.__stateMachine.changeState("CHECKED_DISABLED")
+ else:
+ if self.__stateMachine.state == "CHECKED_DISABLED":
+ self.__stateMachine.changeState("CHECKED_UP")
+ if self.__stateMachine.state == "CHECKED_UP":
+ self.__stateMachine.changeState("CHECKED_DOWN")
+ if self.__stateMachine.state != "UNCHECKED_UP":
+ self.__stateMachine.changeState("UNCHECKED_UP")
+ if not oldEnabled:
+ self.__stateMachine.changeState("UNCHECKED_DISABLED")
+
+ checked = property(getChecked, setChecked)
+
+ def _getState(self):
+ return self.__stateMachine.state
+
+ def _enterUncheckedUp(self):
+ self.__setActiveNode()
+
+ def _leaveUncheckedUp(self):
+ pass
+
+ def _enterUncheckedDown(self):
+ self.__setActiveNode()
+
+ def _leaveUncheckedDown(self):
+ pass
+
+ def _enterCheckedUp(self):
+ self.__setActiveNode()
+
+ def _leaveCheckedUp(self):
+ pass
+
+ def _enterCheckedDown(self):
+ self.__setActiveNode()
+
+ def _leaveCheckedDown(self):
+ pass
+
+ def _enterUncheckedDisabled(self):
+ self.__setActiveNode()
+ self._tapRecognizer.enable(False)
+
+ def _leaveUncheckedDisabled(self):
+ self._tapRecognizer.enable(True)
+
+ def _enterCheckedDisabled(self):
+ self.__setActiveNode()
+ self._tapRecognizer.enable(False)
+
+ def _leaveCheckedDisabled(self):
+ self._tapRecognizer.enable(True)
+
+ def _onDown(self):
+ if self.__stateMachine.state == "UNCHECKED_UP":
+ self.__stateMachine.changeState("UNCHECKED_DOWN")
+ elif self.__stateMachine.state == "CHECKED_UP":
+ self.__stateMachine.changeState("CHECKED_DOWN")
+ self.notifySubscribers(self.PRESSED, [])
+
+ def _onTap(self):
+ if self.__stateMachine.state == "UNCHECKED_DOWN":
+ self.__stateMachine.changeState("CHECKED_UP")
+ self.notifySubscribers(ToggleButton.TOGGLED, [True])
+ elif self.__stateMachine.state == "CHECKED_DOWN":
+ self.__stateMachine.changeState("UNCHECKED_UP")
+ self.notifySubscribers(ToggleButton.TOGGLED, [False])
+ self.notifySubscribers(self.RELEASED, [])
+
+ def _onTapFail(self):
+ if self.__stateMachine.state == "UNCHECKED_DOWN":
+ self.__stateMachine.changeState("UNCHECKED_UP")
+ elif self.__stateMachine.state == "CHECKED_DOWN":
+ self.__stateMachine.changeState("CHECKED_UP")
+ self.notifySubscribers(self.RELEASED, [])
+
+ def __setActiveNode(self):
+ self.__switchNode.visibleid = self.__stateMachine.state
+
+
+class CheckBox(ToggleButton):
+
+ def __init__(self, text="", skinObj=skin.Skin.default, **kwargs):
+ self.cfg = skinObj.defaultCheckBoxCfg
+
+ uncheckedUpNode = self.__createImageNode(self.cfg["uncheckedUpBmp"])
+ uncheckedDownNode = self.__createImageNode(self.cfg["uncheckedDownBmp"])
+ uncheckedDisabledNode = self.__createImageNode(self.cfg["uncheckedDisabledBmp"])
+ checkedUpNode = self.__createImageNode(self.cfg["checkedUpBmp"])
+ checkedDownNode = self.__createImageNode(self.cfg["checkedDownBmp"])
+ checkedDisabledNode = self.__createImageNode(self.cfg["checkedDisabledBmp"])
+
+ super(CheckBox, self).__init__(uncheckedUpNode=uncheckedUpNode,
+ uncheckedDownNode=uncheckedDownNode,
+ uncheckedDisabledNode=uncheckedDisabledNode,
+ checkedUpNode=checkedUpNode,
+ checkedDownNode=checkedDownNode,
+ checkedDisabledNode=checkedDisabledNode,
+ **kwargs)
+ self.textNode = avg.WordsNode(pos=(20,0), text=text, fontstyle=self.cfg["font"],
+ parent=self)
+
+ def _enterUncheckedUp(self):
+ self.textNode.fontstyle = self.cfg["font"]
+ super(CheckBox, self)._enterUncheckedUp()
+
+ def _enterUncheckedDown(self):
+ self.textNode.fontstyle = self.cfg["downFont"]
+ super(CheckBox, self)._enterUncheckedDown()
+
+ def _enterCheckedUp(self):
+ self.textNode.fontstyle = self.cfg["font"]
+ super(CheckBox, self)._enterCheckedUp()
+
+ def _enterCheckedDown(self):
+ self.textNode.fontstyle = self.cfg["downFont"]
+ super(CheckBox, self)._enterCheckedDown()
+
+ def _enterUncheckedDisabled(self):
+ self.textNode.fontstyle = self.cfg["disabledFont"]
+ super(CheckBox, self)._enterUncheckedDisabled()
+
+ def _enterCheckedDisabled(self):
+ self.textNode.fontstyle = self.cfg["disabledFont"]
+ super(CheckBox, self)._enterCheckedDisabled()
+
+ def __createImageNode(self, bmp):
+ node = avg.ImageNode()
+ node.setBitmap(bmp)
+ return node
+
+
+class BmpToggleButton(ToggleButton):
+ def __init__(self, uncheckedUpSrc, uncheckedDownSrc, checkedUpSrc, checkedDownSrc,
+ uncheckedDisabledSrc=None, checkedDisabledSrc=None, **kwargs):
+ uncheckedUpNode = avg.ImageNode(href=uncheckedUpSrc)
+ uncheckedDownNode = avg.ImageNode(href=uncheckedDownSrc)
+ checkedUpNode = avg.ImageNode(href=checkedUpSrc)
+ checkedDownNode = avg.ImageNode(href=checkedDownSrc)
+
+ if uncheckedDisabledSrc != None:
+ uncheckedDisabledNode = avg.ImageNode(href=uncheckedDisabledSrc)
+ else:
+ uncheckedDisabledNode = None
+ if checkedDisabledSrc != None:
+ checkedDisabledNode = avg.ImageNode(href=checkedDisabledSrc)
+ else:
+ checkedDisabledNode = None
+
+ super(BmpToggleButton, self).__init__(uncheckedUpNode=uncheckedUpNode,
+ uncheckedDownNode=uncheckedDownNode,
+ checkedUpNode=checkedUpNode,
+ checkedDownNode=checkedDownNode,
+ uncheckedDisabledNode=uncheckedDisabledNode,
+ checkedDisabledNode=checkedDisabledNode,
+ **kwargs)
+
diff --git a/src/python/widget/keyboard.py b/src/python/widget/keyboard.py
new file mode 100644
index 0000000..cca0afc
--- /dev/null
+++ b/src/python/widget/keyboard.py
@@ -0,0 +1,302 @@
+#!/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
+#
+# Original author of this module: Thomas Schott <scotty at c-base dot org>
+#
+
+import os.path
+
+from libavg import avg, player
+
+FEEDBACK_ZOOM_FACTOR = 1.0
+
+# XXX Merge with base.bmpFromSrc()
+def _bmpFromSrc(node, src):
+ if isinstance(src, basestring):
+ if os.path.isabs(src):
+ effectiveSrc = src
+ else:
+ effectiveSrc = node.getParent().getEffectiveMediaDir() + src
+ return avg.Bitmap(effectiveSrc)
+ elif isinstance(src, avg.Bitmap):
+ return src
+ elif src is None:
+ return None
+ else:
+ raise RuntimeError("src must be a string or a Bitmap.")
+
+class Key(avg.DivNode):
+ # KeyDef is (keyCode, pos, size, isCommand=False)
+ def __init__(self, keyDef, downBmp, feedbackBmp, sticky=False, parent=None,
+ **kwargs):
+ self.__keyCode = keyDef[0]
+ if not(isinstance(self.__keyCode, tuple)):
+ self.__keyCode = (self.__keyCode,)
+ kwargs['pos'] = avg.Point2D(keyDef[1])
+ kwargs['size'] = avg.Point2D(keyDef[2])
+ if len(keyDef) == 4:
+ self.__isCommand = keyDef[3]
+ else:
+ self.__isCommand = False
+ super(Key, self).__init__(**kwargs)
+ self.registerInstance(self, parent)
+
+ self.__sticky = sticky
+ self.__stickyIsDown = False
+ self.__cursorID = None
+ if downBmp:
+ if player.isPlaying():
+ self.__createImages(downBmp, feedbackBmp)
+ else:
+ player.subscribe(avg.Player.PLAYBACK_START,
+ lambda: self.__createImages(downBmp, feedbackBmp))
+
+ def reset(self):
+ if self.__sticky:
+ self.__image.opacity = 0.0
+ self.__stickyIsDown = False
+
+ def isCommand(self):
+ return self.__isCommand
+
+ def getCode(self):
+ return self.__keyCode
+
+ def isStickyDown(self):
+ return self.__sticky and self.__stickyIsDown
+
+ def onDown(self, event):
+ if self.__cursorID:
+ return
+ self.__cursorID = event.cursorid
+ self.__image.opacity = 1.0
+
+ def onUp(self, event):
+ if not self.__cursorID == event.cursorid:
+ return
+ if self.__sticky:
+ self.__stickyIsDown = not(self.__stickyIsDown)
+ if not self.__stickyIsDown:
+ self.__image.opacity = 0.0
+ else:
+ self.__image.opacity = 0.0
+ self.__cursorID = None
+
+ def onOut(self, event):
+ if not self.__cursorID == event.cursorid:
+ return
+ if not(self.__sticky) or (not self.__stickyIsDown):
+ self.__cursorID = None
+ self.__image.opacity = 0.0
+
+ def showFeedback(self, show):
+ if show:
+ self.__feedbackImage.opacity = 0.95
+ else:
+ self.__feedbackImage.opacity = 0.0
+
+ def __createImages(self, downBmp, feedbackBmp):
+ self.__image = avg.ImageNode(parent=self, opacity=0.0)
+ self.__createImage(self.__image, downBmp, 1)
+
+ self.__feedbackImage = avg.ImageNode(parent=self, opacity=0.0)
+ if feedbackBmp and not(self.__isCommand):
+ self.__createImage(self.__feedbackImage, feedbackBmp, 2)
+ self.__feedbackImage.pos = (-self.size.x/2, -self.size.y/3 - \
+ self.__feedbackImage.size.y)
+
+ def __createImage(self, node, bmp, sizeFactor):
+ canvas = player.createCanvas(id="keycanvas", size=self.size*sizeFactor)
+ canvasImage = avg.ImageNode(pos=-self.pos*sizeFactor, parent=canvas.getRootNode())
+ canvasImage.setBitmap(bmp)
+ canvas.render()
+ node.setBitmap(canvas.screenshot())
+ player.deleteCanvas('keycanvas')
+
+
+class Keyboard(avg.DivNode):
+
+ DOWN = avg.Publisher.genMessageID()
+ UP = avg.Publisher.genMessageID()
+ CHAR = avg.Publisher.genMessageID()
+
+ def __init__(self, bgSrc, downSrc, keyDefs, shiftKeyCode, altGrKeyCode=None,
+ stickyShift=False, feedbackSrc=None, parent=None, **kwargs):
+ super(Keyboard, self).__init__(**kwargs)
+ self.registerInstance(self, parent)
+
+ self.__shiftKeyCode = shiftKeyCode
+ self.__shiftDownCounter = 0
+ self.__stickyShift = stickyShift
+ self.__altGrKeyCode = altGrKeyCode
+ self.__altGrKeyCounter = 0
+ if not(self.__shiftKeyCode) and self.__altGrKeyCode:
+ raise RuntimeError(
+ "Keyboard: If there is an altgr key, there must also be a shift key.")
+ self.__codesPerKey = 1
+ if self.__shiftKeyCode:
+ self.__codesPerKey = 2
+ if self.__altGrKeyCode:
+ self.__codesPerKey = 3
+
+ self.__keys = []
+ if bgSrc:
+ bgNode = avg.ImageNode(parent=self)
+ bgNode.setBitmap(_bmpFromSrc(self, bgSrc))
+ for kd in keyDefs:
+ downBmp = _bmpFromSrc(self, downSrc)
+ feedbackBmp = _bmpFromSrc(self, feedbackSrc)
+ if isinstance(kd[0], tuple):
+ while len(kd[0]) < self.__codesPerKey:
+ kd[0] += (kd[0][0],)
+ key = Key(kd, downBmp, feedbackBmp, parent=self)
+ else:
+ sticky =(self.__stickyShift and
+ (self.__shiftKeyCode == kd[0] or self.__altGrKeyCode == kd[0]))
+ key = Key(kd, downBmp, feedbackBmp, sticky=sticky, parent=self)
+ self.__keys.append(key)
+ self.subscribe(avg.Node.CURSOR_DOWN, self.__onCursorDown)
+ self.__curKeys = {}
+ self.__feedbackKey = None
+
+ self.publish(Keyboard.DOWN)
+ self.publish(Keyboard.UP)
+ self.publish(Keyboard.CHAR)
+
+ @classmethod
+ def makeRowKeyDefs(cls, startPos, keySize, spacing, keyStr, shiftKeyStr,
+ altGrKeyStr=None):
+ keyDefs = []
+ curPos = avg.Point2D(startPos)
+ offset = keySize[0]+spacing
+ if (len(shiftKeyStr) != len(keyStr) or
+ (altGrKeyStr and len(altGrKeyStr) != len(keyStr))):
+ raise RuntimeError("makeRowKeyDefs string lengths must be identical.")
+
+ for i in xrange(len(keyStr)):
+ if altGrKeyStr:
+ codes = (keyStr[i], shiftKeyStr[i], altGrKeyStr[i])
+ else:
+ codes = (keyStr[i], shiftKeyStr[i])
+ keyDefs.append([codes, curPos, avg.Point2D(keySize), False])
+ curPos = (curPos[0]+offset, curPos[1])
+ return keyDefs
+
+ def reset(self):
+ for key in self.__keys:
+ key.reset()
+ self.__shiftDownCounter = 0
+ self.__altGrKeyCounter = 0
+
+ def __onCursorDown(self, event):
+ curKey = self.__findKey(event.pos)
+ self.__keyDown(curKey, event)
+ event.contact.subscribe(avg.Contact.CURSOR_MOTION, self.__onCursorMotion)
+ event.contact.subscribe(avg.Contact.CURSOR_UP, self.__onCursorUp)
+
+ def __onCursorMotion(self, event):
+ newKey = self.__findKey(event.pos)
+ oldKey = self.__curKeys[event.contact]
+ if newKey != oldKey:
+ if oldKey:
+ oldKey.onOut(event)
+ self.notifySubscribers(Keyboard.UP, [oldKey.getCode()[0]])
+ if oldKey.isCommand():
+ self.__onCommandKeyUp(oldKey)
+ self.__keyDown(newKey, event)
+
+ def __onCursorUp(self, event):
+ self.__onCursorMotion(event)
+ key = self.__curKeys[event.contact]
+ if key:
+ key.onUp(event)
+ self.notifySubscribers(Keyboard.UP, [key.getCode()[0]])
+ if key.isCommand():
+ self.__onCommandKeyUp(key)
+ else:
+ self.__onCharKeyUp(key.getCode())
+ self.__switchFeedbackKey(None)
+ del self.__curKeys[event.contact]
+
+ def __findKey(self, pos):
+ for key in self.__keys:
+ localPos = key.getRelPos(pos)
+ if self.__isInside(localPos, key):
+ return key
+ return None
+
+ def __isInside(self, pos, node):
+ return (pos.x >= 0 and pos.y >= 0 and
+ pos.x <= node.size.x and pos.y <= node.size.y)
+
+ def __switchFeedbackKey(self, newKey):
+ if self.__feedbackKey:
+ self.__feedbackKey.showFeedback(False)
+ self.__feedbackKey = newKey
+ if self.__feedbackKey:
+ self.__feedbackKey.showFeedback(True)
+
+ def __keyDown(self, key, event):
+ self.__switchFeedbackKey(key)
+ self.__curKeys[event.contact] = key
+ if key:
+ key.onDown(event)
+ if key.isCommand():
+ self.__onCommandKeyDown(key)
+ else:
+ self.__onCharKeyDown(key.getCode())
+
+ def __getCharKeyCode(self, keyCodes):
+ if self.__shiftDownCounter:
+ return keyCodes[1]
+ elif self.__altGrKeyCounter:
+ return keyCodes[2]
+ else:
+ return keyCodes[0]
+
+ def __onCharKeyDown(self, keyCodes):
+ self.notifySubscribers(Keyboard.DOWN, [keyCodes[0]])
+
+ def __onCharKeyUp(self, keyCodes):
+ self.notifySubscribers(Keyboard.CHAR, [self.__getCharKeyCode(keyCodes)])
+
+ def __onCommandKeyDown(self, key):
+ keyCode = key.getCode()[0]
+ if not(key.isStickyDown()):
+ if keyCode == self.__shiftKeyCode:
+ self.__shiftDownCounter += 1
+ if keyCode == self.__altGrKeyCode:
+ self.__altGrKeyCounter += 1
+ self.notifySubscribers(Keyboard.DOWN, [keyCode])
+
+ def __onCommandKeyUp(self, key):
+ keyCode = key.getCode()[0]
+ if not(key.isStickyDown()):
+ if keyCode == self.__shiftKeyCode:
+ if self.__shiftDownCounter > 0:
+ self.__shiftDownCounter -= 1
+ else:
+ avg.logger.warning('Keyboard: ShiftDownCounter=0 on [%s] up'
+ %self.__shiftKeyCode)
+ elif keyCode == self.__altGrKeyCode:
+ if self.__altGrKeyCounter > 0:
+ self.__altGrKeyCounter -= 1
diff --git a/src/python/widget/mediacontrol.py b/src/python/widget/mediacontrol.py
new file mode 100644
index 0000000..3e740d0
--- /dev/null
+++ b/src/python/widget/mediacontrol.py
@@ -0,0 +1,161 @@
+# -*- 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
+
+from libavg import avg
+from . import slider, button, skin
+
+class TimeSlider(slider.Slider):
+
+ def __init__(self, orientation=slider.Orientation.HORIZONTAL,
+ skinObj=skin.Skin.default, **kwargs):
+ self.__progressThumb = None
+ super(TimeSlider, self).__init__(skinObj=skinObj, orientation=orientation,
+ **kwargs)
+
+ if self._orientation == slider.Orientation.HORIZONTAL:
+ progressCfg = skinObj.defaultProgressBarCfg["horizontal"]
+ else:
+ progressCfg = skinObj.defaultProgressBarCfg["vertical"]
+
+ thumbUpBmp = progressCfg["thumbUpBmp"]
+ thumbDisabledBmp = skin.getBmpFromCfg(progressCfg, "thumbDisabledBmp",
+ "thumbUpBmp")
+ endsExtent = progressCfg["thumbEndsExtent"]
+ self.__progressThumb = slider.ScrollBarThumb(orientation=orientation,
+ upBmp=thumbUpBmp, downBmp=thumbUpBmp, disabledBmp=thumbDisabledBmp,
+ endsExtent=endsExtent)
+ self.insertChildAfter(self.__progressThumb, self._trackNode)
+ self._positionNodes()
+
+ def _positionNodes(self, newSliderPos=None):
+ super(TimeSlider, self)._positionNodes(newSliderPos)
+
+ if self.__progressThumb:
+ if self._orientation == slider.Orientation.HORIZONTAL:
+ self.__progressThumb.width = self._thumbNode.x+self._thumbNode.width/2
+ else:
+ self.__progressThumb.height = self._thumbNode.y+self._thumbNode.height/2
+
+
+class MediaControl(avg.DivNode):
+
+ PLAY_CLICKED = avg.Publisher.genMessageID()
+ PAUSE_CLICKED = avg.Publisher.genMessageID()
+ SEEK_PRESSED = avg.Publisher.genMessageID()
+ SEEK_MOTION = avg.Publisher.genMessageID()
+ SEEK_RELEASED = avg.Publisher.genMessageID()
+
+ def __init__(self, skinObj=skin.Skin.default, duration=1000, time=0, parent=None,
+ **kwargs):
+ super(MediaControl, self).__init__(**kwargs)
+ self.registerInstance(self, parent)
+
+ cfg = skinObj.defaultMediaControlCfg
+
+ # subscribe to button & slider changes
+ self._playButton = button.ToggleButton(
+ uncheckedUpNode=self.__createImageNode(cfg, "playUpBmp"),
+ uncheckedDownNode=self.__createImageNode(cfg, "playDownBmp"),
+ uncheckedDisabledNode=self.__createImageNode(cfg, "playDisabledBmp",
+ "playUpBmp"),
+ checkedUpNode=self.__createImageNode(cfg, "pauseUpBmp"),
+ checkedDownNode=self.__createImageNode(cfg, "pauseDownBmp"),
+ checkedDisabledNode=self.__createImageNode(cfg, "pauseDisabledBmp",
+ "pauseUpBmp"),
+ parent=self)
+ self._playButton.subscribe(button.ToggleButton.TOGGLED, self.__onTogglePlay)
+
+ sliderWidth = self.width + cfg["barRight"] - cfg["barPos"][0]
+ self._timeSlider = TimeSlider(skinObj=skinObj, pos=cfg["barPos"],
+ width=sliderWidth, parent=self)
+ self._timeSlider.subscribe(TimeSlider.PRESSED, self.__onSliderPressed)
+ self._timeSlider.subscribe(TimeSlider.RELEASED, self.__onSliderReleased)
+ self._timeSlider.subscribe(TimeSlider.THUMB_POS_CHANGED, self.__onSliderMotion)
+
+ self._timeNode = avg.WordsNode(pos=cfg["timePos"], fontstyle=cfg["font"],
+ color="FFFFFF", parent=self)
+ timeLeftPos = (self.width+cfg["timeLeftPos"][0], cfg["timeLeftPos"][1])
+ self._timeLeftNode = avg.WordsNode(pos=timeLeftPos, fontstyle=cfg["font"],
+ color="FFFFFF", parent=self)
+
+ self.setDuration(duration)
+ self.setTime(time)
+
+ self.publish(MediaControl.PLAY_CLICKED)
+ self.publish(MediaControl.PAUSE_CLICKED)
+ self.publish(MediaControl.SEEK_PRESSED)
+ self.publish(MediaControl.SEEK_MOTION)
+ self.publish(MediaControl.SEEK_RELEASED)
+
+ def play(self):
+ self._playButton.checked = True
+
+ def pause(self):
+ self._playButton.checked = False
+
+ def getDuration(self):
+ return self._timeSlider.range[1]
+
+ def setDuration(self, duration):
+ self._timeSlider.range = (0, duration-100)
+ self.__updateText()
+ duration = property(getDuration, setDuration)
+
+ def getTime(self):
+ return self._timeSlider.thumbPos
+
+ def setTime(self, curTime):
+ self._timeSlider.thumbPos = curTime
+ self.__updateText()
+ time = property(getTime, setTime)
+
+ def __onTogglePlay(self, play):
+ if play:
+ self.notifySubscribers(MediaControl.PLAY_CLICKED, [])
+ else:
+ self.notifySubscribers(MediaControl.PAUSE_CLICKED, [])
+
+ def __onSliderPressed(self):
+ self.notifySubscribers(MediaControl.SEEK_PRESSED, [])
+
+ def __onSliderReleased(self):
+ self.notifySubscribers(MediaControl.SEEK_RELEASED, [])
+
+ def __onSliderMotion(self, curTime):
+ self.__updateText()
+ self.notifySubscribers(MediaControl.SEEK_MOTION, [curTime])
+
+ def __updateText(self):
+ self._timeNode.text = self.__msToMinSec(self._timeSlider.thumbPos)
+ self._timeLeftNode.text = "-"+self.__msToMinSec(
+ (self._timeSlider.range[1]-self._timeSlider.thumbPos))
+
+ def __createImageNode(self, cfg, src, defaultSrc=None):
+ bmp = skin.getBmpFromCfg(cfg, src, defaultSrc)
+ node = avg.ImageNode()
+ node.setBitmap(bmp)
+ return node
+
+ def __msToMinSec(self, ms):
+ ms += 500
+ minutes, ms = divmod(ms, 60000)
+ seconds, ms = divmod(ms, 1000)
+ return "%d:%02d"%(minutes, seconds)
+
diff --git a/src/python/widget/scrollarea.py b/src/python/widget/scrollarea.py
new file mode 100644
index 0000000..d22877f
--- /dev/null
+++ b/src/python/widget/scrollarea.py
@@ -0,0 +1,240 @@
+# -*- 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
+#
+
+from libavg import avg, gesture
+from . import slider
+from base import HVStretchNode, Orientation
+from . import skin
+
+class ScrollPane(avg.DivNode):
+
+ def __init__(self, contentNode, parent=None, **kwargs):
+
+ super(ScrollPane, self).__init__(crop=True, **kwargs)
+ self.registerInstance(self, parent)
+
+ self.appendChild(contentNode)
+ self._contentNode = contentNode
+
+ def setContentPos(self, pos):
+
+ def constrain(pos, limit):
+ if limit > 0:
+ # Content larger than container
+ if pos > limit:
+ pos = limit
+ elif pos < 0:
+ pos = 0
+ else:
+ # Content smaller than container
+ if pos > 0:
+ pos = 0
+ elif pos < limit:
+ pos = limit
+ return pos
+
+ maxPos = self.getMaxContentPos()
+ pos = avg.Point2D(pos)
+ pos.x = constrain(pos.x, maxPos.x)
+ pos.y = constrain(pos.y, maxPos.y)
+ self._contentNode.pos = -pos
+
+ def getContentPos(self):
+ return -self._contentNode.pos
+ contentpos = property(getContentPos, setContentPos)
+
+ def getContentSize(self):
+ return self._contentNode.size
+
+ def setContentSize(self, size):
+ self._contentNode.size = size
+ self.setContentPos(-self._contentNode.pos) # Recheck constraints.
+ contentsize = property(getContentSize, setContentSize)
+
+ def getMaxContentPos(self):
+ maxPos = avg.Point2D(self._contentNode.size - self.size)
+ if maxPos.x < 0:
+ maxPos.x = 0
+ if maxPos.y < 0:
+ maxPos.y = 0
+ return maxPos
+
+
+class ScrollArea(avg.DivNode):
+
+ PRESSED = avg.Publisher.genMessageID()
+ RELEASED = avg.Publisher.genMessageID()
+ CONTENT_POS_CHANGED = avg.Publisher.genMessageID()
+
+ def __init__(self, contentNode, size, skinObj=skin.Skin.default, enabled=True,
+ scrollBars=(Orientation.HORIZONTAL, Orientation.VERTICAL),
+ parent=None, **kwargs):
+
+ super(ScrollArea, self).__init__(**kwargs)
+ self.registerInstance(self, parent)
+ self.cfg = skinObj.defaultScrollAreaCfg
+
+ self.publish(self.PRESSED)
+ self.publish(self.RELEASED)
+ self.publish(self.CONTENT_POS_CHANGED)
+
+ self.__scrollPane = ScrollPane(contentNode=contentNode, parent=self)
+
+ if "borderBmp" in self.cfg:
+ endsExtent = self.cfg["borderEndsExtent"]
+ self._borderNode = HVStretchNode(src=self.cfg["borderBmp"],
+ endsExtent=endsExtent, sensitive=False, parent=self)
+ else:
+ self._borderNode = None
+
+ sensitiveScrollBars = self.cfg["sensitiveScrollBars"]
+
+ if Orientation.HORIZONTAL in scrollBars:
+ self._hScrollBar = slider.ScrollBar(sensitive=sensitiveScrollBars,
+ parent=self, skinObj=skinObj)
+ self._hScrollBar.subscribe(slider.Slider.THUMB_POS_CHANGED,
+ self.__onHThumbMove)
+ else:
+ self._hScrollBar = None
+
+ if Orientation.VERTICAL in scrollBars:
+ self._vScrollBar = slider.ScrollBar(orientation=Orientation.VERTICAL,
+ sensitive=sensitiveScrollBars, parent=self, skinObj=skinObj)
+ self._vScrollBar.subscribe(slider.Slider.THUMB_POS_CHANGED,
+ self.__onVThumbMove)
+ else:
+ self._vScrollBar = None
+
+ self.subscribe(self.SIZE_CHANGED, self.__positionNodes)
+ self.size = size
+
+ self.__enabled = True
+ if not(enabled):
+ self.setEnabled(False)
+
+ self.recognizer = gesture.DragRecognizer(
+ eventNode=self.__scrollPane,
+ detectedHandler=self.__onDragStart,
+ moveHandler=self.__onDragMove,
+ upHandler=self.__onDragUp,
+ friction=self.cfg["friction"]
+ )
+
+ def getContentSize(self):
+ return self.__scrollPane._contentNode.size
+
+ def setContentSize(self, size):
+ self.__scrollPane.contentsize = size
+ self.__positionNodes(self.size)
+ contentsize = property(getContentSize, setContentSize)
+
+ def getContentPos(self):
+ return self.__scrollPane.contentpos
+
+ def setContentPos(self, pos):
+ self.__scrollPane.contentpos = pos
+ self.__positionNodes(self.size)
+ self.__positionThumbs(avg.Point2D(pos))
+ self.notifySubscribers(self.CONTENT_POS_CHANGED, [self.__scrollPane.contentpos])
+ contentpos = property(getContentPos, setContentPos)
+
+ def getEnabled(self):
+ return self.__enabled
+
+ def setEnabled(self, enabled):
+ if enabled and not(self.__enabled):
+ self.recognizer.enable(True)
+ elif not(enabled) and self.__enabled:
+ self.recognizer.enable(False)
+
+ if self._vScrollBar:
+ self._vScrollBar.enabled = enabled
+ if self._hScrollBar:
+ self._hScrollBar.enabled = enabled
+ self.__enabled = enabled
+ enabled = property(getEnabled, setEnabled)
+
+ def __onHThumbMove(self, thumbPos):
+ self.__scrollPane.contentpos = (thumbPos, self.__scrollPane.contentpos.y)
+ self.notifySubscribers(self.CONTENT_POS_CHANGED, [self.__scrollPane.contentpos])
+
+ def __onVThumbMove(self, thumbPos):
+ self.__scrollPane.contentpos = (self.__scrollPane.contentpos.x, thumbPos)
+ self.notifySubscribers(self.CONTENT_POS_CHANGED, [self.__scrollPane.contentpos])
+
+ def __onDragStart(self):
+ self.__dragStartPos = self.__scrollPane.contentpos
+ self.notifySubscribers(self.PRESSED, [])
+
+ def __onDragMove(self, offset):
+ contentpos = self.__dragStartPos - offset
+ self.__scrollPane.contentpos = contentpos
+ self.__positionThumbs(contentpos)
+ self.notifySubscribers(self.CONTENT_POS_CHANGED, [self.__scrollPane.contentpos])
+
+ def __onDragUp(self, offset):
+ self.__onDragMove(offset)
+ self.notifySubscribers(self.RELEASED, [])
+
+ def __positionNodes(self, size):
+ paneSize = size
+ if self._borderNode:
+ self._borderNode.size = size
+
+ margins = self.cfg["margins"]
+ if self._hScrollBar:
+ paneSize -= (0, margins[0]+margins[2])
+ if self._vScrollBar:
+ paneSize -= (margins[1]+margins[3], 0)
+ self.__scrollPane.pos = (margins[0], margins[1])
+ self.__scrollPane.size = paneSize
+
+
+ if self._hScrollBar:
+ self._hScrollBar.pos = (0, size.y-self._hScrollBar.height)
+ self._hScrollBar.width = self.__scrollPane.width
+
+ if self.__scrollPane.contentsize.x <= self.__scrollPane.width:
+ self._hScrollBar.range = (0, self.__scrollPane.width)
+ self._hScrollBar.enabled = False
+ else:
+ self._hScrollBar.range = (0, self.__scrollPane.contentsize.x)
+ self._hScrollBar.enabled = True
+ self._hScrollBar.thumbExtent = self.__scrollPane.width
+
+ if self._vScrollBar:
+ self._vScrollBar.pos = (size.x-self._vScrollBar.width, 0)
+ self._vScrollBar.height = self.__scrollPane.height
+
+ if self.__scrollPane.contentsize.y <= self.__scrollPane.height:
+ self._vScrollBar.range = (0, self.__scrollPane.height)
+ self._vScrollBar.enabled = False
+ else:
+ self._vScrollBar.range = (0, self.__scrollPane.contentsize.y)
+ self._vScrollBar.enabled = True
+ self._vScrollBar.thumbExtent = self.__scrollPane.height
+
+ def __positionThumbs(self, contentPos):
+ if self._hScrollBar:
+ self._hScrollBar.thumbPos = contentPos.x
+ if self._vScrollBar:
+ self._vScrollBar.thumbPos = contentPos.y
+
diff --git a/src/python/widget/skin.py b/src/python/widget/skin.py
new file mode 100644
index 0000000..9490d40
--- /dev/null
+++ b/src/python/widget/skin.py
@@ -0,0 +1,161 @@
+# -*- 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
+
+from libavg import avg
+
+import os, copy
+import xml.etree.ElementTree as ET
+
+class Skin:
+
+ default = None
+
+ def __init__(self, skinXmlFName, mediaDir=""):
+ global defaultMediaDir
+ self.__mediaDir = defaultMediaDir if mediaDir == "" else mediaDir
+ schemaFName = defaultMediaDir+"skin.xsd"
+ schemaString = open(schemaFName, "r").read()
+ skinPath = os.path.join(self.__mediaDir, skinXmlFName)
+ xmlString = open(skinPath, "r").read()
+ avg.validateXml(xmlString, schemaString, skinXmlFName, schemaFName)
+
+ xmlRoot = ET.fromstring(xmlString)
+
+ self.fonts = {}
+ for fontNode in xmlRoot.findall("fontdef"):
+ fontid, attrs = self.__splitAttrs(fontNode)
+ if "baseid" in attrs:
+ self.fonts[fontid] = copy.copy(self.fonts[attrs["baseid"]])
+ font = self.fonts[fontid]
+ del attrs["baseid"]
+ for (key, value) in attrs.iteritems():
+ setattr(font, key, value)
+ else:
+ kwargs = self.__extractArgs(attrs,
+ ("fontsize", "letterspacing", "linespacing"))
+ self.fonts[fontid] = avg.FontStyle(**kwargs)
+
+ self.textButtonCfg, self.defaultTextButtonCfg = self.__parseElement(
+ xmlRoot, "textbutton",
+ bmpArgNames={"upSrc": "upBmp", "downSrc": "downBmp",
+ "disabledSrc": "disabledBmp"},
+ fontArgNames=("font", "downFont", "disabledFont"))
+
+ self.checkBoxCfg, self.defaultCheckBoxCfg = self.__parseElement(
+ xmlRoot, "checkbox",
+ bmpArgNames={"uncheckedUpSrc":"uncheckedUpBmp",
+ "uncheckedDownSrc":"uncheckedDownBmp",
+ "uncheckedDisabledSrc":"uncheckedDisabledBmp",
+ "checkedUpSrc":"checkedUpBmp",
+ "checkedDownSrc":"checkedDownBmp",
+ "checkedDisabledSrc":"checkedDisabledBmp"},
+ fontArgNames=("font", "downFont", "disabledFont"))
+
+ self.sliderCfg, self.defaultSliderCfg = self.__initSliders(xmlRoot, "slider")
+ self.scrollBarCfg, self.defaultScrollBarCfg = self.__initSliders(
+ xmlRoot, "scrollbar")
+ self.progressBarCfg, self.defaultProgressBarCfg = self.__initSliders(
+ xmlRoot, "progressbar")
+
+ self.scrollAreaCfg, self.defaultScrollAreaCfg = self.__parseElement(
+ xmlRoot, "scrollarea",
+ pyArgNames=("friction","borderEndsExtent","margins",
+ "sensitiveScrollBars"),
+ bmpArgNames={"borderSrc":"borderBmp"})
+
+ self.mediaControlCfg, self.defaultMediaControlCfg = self.__parseElement(
+ xmlRoot, "mediacontrol",
+ bmpArgNames={"playUpSrc":"playUpBmp",
+ "playDownSrc":"playDownBmp",
+ "playDisabledSrc":"playDisabledBmp",
+ "pauseUpSrc":"pauseUpBmp",
+ "pauseDownSrc":"pauseDownBmp",
+ "pauseDisabledSrc":"pauseDisabledBmp"},
+ pyArgNames=("timePos", "timeLeftPos", "barPos", "barRight"),
+ fontArgNames=("font"))
+
+ def __parseElement(self, xmlRoot, elementName, pyArgNames=(), bmpArgNames={},
+ fontArgNames=()):
+ cfgMap = {}
+ defaultCfg = None
+ for node in xmlRoot.findall(elementName):
+ nodeid, attrs = self.__splitAttrs(node)
+ kwargs = self.__extractArgs(attrs, pyArgNames=pyArgNames,
+ bmpArgNames=bmpArgNames, fontArgNames=fontArgNames)
+ cfgMap[nodeid] = kwargs
+ if defaultCfg == None or nodeid == None:
+ defaultCfg = kwargs
+ return cfgMap, defaultCfg
+
+ def __splitAttrs(self, xmlNode):
+ attrs = xmlNode.attrib
+ if "id" in attrs:
+ nodeID = attrs["id"]
+ del attrs["id"]
+ else:
+ nodeID = None
+ return nodeID, attrs
+
+ def __extractArgs(self, attrs, pyArgNames=(), bmpArgNames={}, fontArgNames=()):
+ kwargs = {}
+ for (key, value) in attrs.iteritems():
+ if key in pyArgNames:
+ kwargs[key] = eval(value)
+ elif key in bmpArgNames.iterkeys():
+ argkey = bmpArgNames[key]
+ kwargs[argkey] = avg.Bitmap(os.path.join(self.__mediaDir, value))
+ elif key in fontArgNames:
+ kwargs[key] = self.fonts[value]
+ else:
+ kwargs[key] = value
+ return kwargs
+
+ def __initSliders(self, xmlRoot, typeName):
+ sliderCfg = {}
+ defaultSliderCfg = None
+ for sliderXmlNode in xmlRoot.findall(typeName):
+ (nodeID, bogus) = self.__splitAttrs(sliderXmlNode)
+ sliderCfg[nodeID] = {}
+ if defaultSliderCfg == None or nodeID == None:
+ defaultSliderCfg = sliderCfg[nodeID]
+ for xmlNode in sliderXmlNode.findall("*"):
+ # Loop through orientations (horiz, vert)
+ bogus, attrs = self.__splitAttrs(xmlNode)
+ kwargs = self.__extractArgs(attrs,
+ pyArgNames=("trackEndsExtent", "thumbEndsExtent"),
+ bmpArgNames={"trackSrc": "trackBmp",
+ "trackDisabledSrc": "trackDisabledBmp",
+ "thumbUpSrc": "thumbUpBmp",
+ "thumbDownSrc": "thumbDownBmp",
+ "thumbDisabledSrc": "thumbDisabledBmp"})
+ sliderCfg[nodeID][xmlNode.tag] = kwargs
+
+ return (sliderCfg, defaultSliderCfg)
+
+
+def getBmpFromCfg(cfg, bmpName, defaultName=None):
+ if bmpName in cfg:
+ return cfg[bmpName]
+ else:
+ return cfg[defaultName]
+
+
+defaultMediaDir = os.path.join(os.path.dirname(__file__), "..", 'data/')
+Skin.default = Skin("SimpleSkin.xml", "")
diff --git a/src/python/widget/slider.py b/src/python/widget/slider.py
new file mode 100644
index 0000000..1e63f0a
--- /dev/null
+++ b/src/python/widget/slider.py
@@ -0,0 +1,371 @@
+# -*- 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
+
+from libavg import avg, gesture
+from base import SwitchNode, HStretchNode, VStretchNode, Orientation
+from . import skin
+
+import math
+
+
+class ScrollBarTrack(SwitchNode):
+
+ def __init__(self, bmp, endsExtent, disabledBmp, orientation=Orientation.HORIZONTAL,
+ **kwargs):
+
+ super(ScrollBarTrack, self).__init__(nodeMap=None, **kwargs)
+ if orientation == Orientation.HORIZONTAL:
+ StretchNode = HStretchNode
+ else:
+ StretchNode = VStretchNode
+ self.__enabledNode = StretchNode(src=bmp, endsExtent=endsExtent, parent=self)
+ self.__disabledNode = StretchNode(src=disabledBmp, endsExtent=endsExtent,
+ parent=self)
+
+ self.setNodeMap({
+ "ENABLED": self.__enabledNode,
+ "DISABLED": self.__disabledNode
+ })
+ self.visibleid = "ENABLED"
+
+
+class ScrollBarThumb(SwitchNode):
+
+ def __init__(self, upBmp, downBmp, disabledBmp, endsExtent,
+ orientation=Orientation.HORIZONTAL, minExtent=-1,
+ **kwargs):
+
+ super(ScrollBarThumb, self).__init__(nodeMap=None, **kwargs)
+
+ if orientation == Orientation.HORIZONTAL:
+ StretchNode = HStretchNode
+ else:
+ StretchNode = VStretchNode
+ self.__upNode = StretchNode(src=upBmp, endsExtent=endsExtent, minExtent=minExtent)
+ self.__downNode = StretchNode(src=downBmp, endsExtent=endsExtent,
+ minExtent=minExtent)
+ self.__disabledNode = StretchNode(src=disabledBmp, endsExtent=endsExtent,
+ minExtent=minExtent)
+
+ self.setNodeMap({
+ "UP": self.__upNode,
+ "DOWN": self.__downNode,
+ "DISABLED": self.__disabledNode
+ })
+ self.visibleid = "UP"
+
+
+class SliderThumb(SwitchNode):
+
+ def __init__(self, upBmp, downBmp, disabledBmp, **kwargs):
+ upNode = avg.ImageNode()
+ upNode.setBitmap(upBmp)
+ downNode = avg.ImageNode()
+ downNode.setBitmap(downBmp)
+ disabledNode = avg.ImageNode()
+ disabledNode.setBitmap(disabledBmp)
+ nodeMap = {"UP": upNode, "DOWN": downNode, "DISABLED": disabledNode}
+ super(SliderThumb, self).__init__(nodeMap=nodeMap, visibleid="UP", **kwargs)
+
+
+class ProgressBar(avg.DivNode):
+
+ def __init__(self, orientation, skinObj=skin.Skin.default, height=0, width=0,
+ range=(0.,1.), value=0.0, parent=None, **kwargs):
+ super(ProgressBar, self).__init__(**kwargs)
+ self.registerInstance(self, parent)
+ if orientation == Orientation.HORIZONTAL:
+ cfg = skinObj.defaultProgressBarCfg["horizontal"]
+ else:
+ cfg = skinObj.defaultProgressBarCfg["vertical"]
+
+ self._orientation = orientation
+
+ trackBmp = cfg["trackBmp"]
+ self._trackNode = ScrollBarTrack(bmp=trackBmp, disabledBmp=trackBmp,
+ endsExtent=cfg["trackEndsExtent"], orientation=self._orientation)
+ self.appendChild(self._trackNode)
+
+ thumbUpBmp = cfg["thumbUpBmp"]
+ endsExtent=cfg["thumbEndsExtent"]
+
+ self.__thumbNode = ScrollBarThumb(orientation=self._orientation,
+ upBmp=thumbUpBmp, downBmp=thumbUpBmp, disabledBmp=thumbUpBmp,
+ endsExtent=endsExtent)
+ self.appendChild(self.__thumbNode)
+
+ self.__range = range
+ self.__value = value
+
+ if orientation == Orientation.HORIZONTAL:
+ self.size = (width, trackBmp.getSize().y)
+ else:
+ self.size = (trackBmp.getSize().x, height)
+ self._positionNodes()
+
+ def getRange(self):
+ return self.__range
+
+ def setRange(self, range):
+ self.__range = (float(range[0]), float(range[1]))
+ self._positionNodes()
+ range = property(getRange, setRange)
+
+ def getValue(self):
+ return self.__value
+
+ def setValue(self, value):
+ self._positionNodes(value)
+ value = property(getValue, setValue)
+
+ def _positionNodes(self, newValue=None):
+ if newValue is not None:
+ self.__value = float(newValue)
+ if self.__value < self.__range[0]:
+ self.__value = self.__range[0]
+ if self.__value > self.__range[1]:
+ self.__value = self.__range[1]
+ self._trackNode.size = self.size
+
+ effectiveRange = math.fabs(self.__range[1] - self.__range[0])
+ normValue = ((self.__value-self.__range[0])/effectiveRange)
+ if self._orientation == Orientation.HORIZONTAL:
+ self.__thumbNode.width = normValue*self.size.x
+ else:
+ self.__thumbNode.height = normValue*self.size.y
+
+
+class SliderBase(avg.DivNode):
+
+ THUMB_POS_CHANGED = avg.Publisher.genMessageID()
+ PRESSED = avg.Publisher.genMessageID()
+ RELEASED = avg.Publisher.genMessageID()
+
+ def __init__(self, orientation, cfg, enabled=True, height=0, width=0, range=(0.,1.),
+ thumbPos=0.0, parent=None, **kwargs):
+ super(SliderBase, self).__init__(**kwargs)
+ self.registerInstance(self, parent)
+
+ self.publish(SliderBase.THUMB_POS_CHANGED)
+ self.publish(SliderBase.PRESSED)
+ self.publish(SliderBase.RELEASED)
+
+ self._orientation = orientation
+
+ trackBmp = cfg["trackBmp"]
+ trackDisabledBmp = cfg["trackDisabledBmp"]
+ self._trackNode = ScrollBarTrack(bmp=trackBmp, disabledBmp=trackDisabledBmp,
+ endsExtent=cfg["trackEndsExtent"], orientation=self._orientation)
+ self.appendChild(self._trackNode)
+
+ self._initThumb(cfg)
+
+ self._range = range
+ self._thumbPos = thumbPos
+
+ self.subscribe(self.SIZE_CHANGED, lambda newSize: self._positionNodes())
+ if orientation == Orientation.HORIZONTAL:
+ self.size = (width, trackBmp.getSize().y)
+ else:
+ self.size = (trackBmp.getSize().x, height)
+ if not(enabled):
+ self.setEnabled(False)
+
+ self.__recognizer = gesture.DragRecognizer(self._thumbNode, friction=-1,
+ detectedHandler=self.__onDragStart, moveHandler=self.__onDrag,
+ upHandler=self.__onUp)
+
+ def getRange(self):
+ return self._range
+
+ def setRange(self, range):
+ self._range = (float(range[0]), float(range[1]))
+ self._positionNodes()
+
+ # range[1] > range[0]: Reversed scrollbar.
+ range = property(getRange, setRange)
+
+ def getThumbPos(self):
+ return self._thumbPos
+
+ def setThumbPos(self, thumbPos):
+ self._positionNodes(thumbPos)
+
+ thumbPos = property(getThumbPos, setThumbPos)
+
+ def getEnabled(self):
+ return self._trackNode.visibleid != "DISABLED"
+
+ def setEnabled(self, enabled):
+ if enabled:
+ if self._trackNode.visibleid == "DISABLED":
+ self._trackNode.visibleid = "ENABLED"
+ self._thumbNode.visibleid = "UP"
+ self.__recognizer.enable(True)
+ else:
+ if self._trackNode.visibleid != "DISABLED":
+ self._trackNode.visibleid = "DISABLED"
+ self._thumbNode.visibleid = "DISABLED"
+ self.__recognizer.enable(False)
+
+ enabled = property(getEnabled, setEnabled)
+
+ def _positionNodes(self, newSliderPos=None):
+ if newSliderPos is not None:
+ self._thumbPos = float(newSliderPos)
+ self._trackNode.size = self.size
+
+ self._constrainSliderPos()
+
+ pixelRange = self._getScrollRangeInPixels()
+ if self._getSliderRange() == 0:
+ thumbPixelPos = 0
+ else:
+ thumbPixelPos = (((self._thumbPos-self._range[0])/self._getSliderRange())*
+ pixelRange)
+ if self._orientation == Orientation.HORIZONTAL:
+ self._thumbNode.x = thumbPixelPos
+ else:
+ self._thumbNode.y = thumbPixelPos
+
+ def __onDragStart(self):
+ self._thumbNode.visibleid = "DOWN"
+ self.__dragStartPos = self._thumbPos
+ self.notifySubscribers(Slider.PRESSED, [])
+
+ def __onDrag(self, offset):
+ pixelRange = self._getScrollRangeInPixels()
+ if pixelRange == 0:
+ normalizedOffset = 0
+ else:
+ if self._orientation == Orientation.HORIZONTAL:
+ normalizedOffset = offset.x/pixelRange
+ else:
+ normalizedOffset = offset.y/pixelRange
+ oldThumbPos = self._thumbPos
+ self._positionNodes(self.__dragStartPos + normalizedOffset*self._getSliderRange())
+ if self._thumbPos != oldThumbPos:
+ self.notifySubscribers(Slider.THUMB_POS_CHANGED, [self._thumbPos])
+
+ def __onUp(self, offset):
+ self.__onDrag(offset)
+ self._thumbNode.visibleid = "UP"
+ self.notifySubscribers(Slider.RELEASED, [])
+
+
+class Slider(SliderBase):
+
+ def __init__(self, orientation=Orientation.HORIZONTAL, skinObj=skin.Skin.default,
+ **kwargs):
+ if orientation == Orientation.HORIZONTAL:
+ cfg = skinObj.defaultSliderCfg["horizontal"]
+ else:
+ cfg = skinObj.defaultSliderCfg["vertical"]
+ super(Slider, self).__init__(orientation, cfg, **kwargs)
+
+ def _initThumb(self, cfg):
+ thumbUpBmp = cfg["thumbUpBmp"]
+ thumbDownBmp = skin.getBmpFromCfg(cfg, "thumbDownBmp", "thumbUpBmp")
+ thumbDisabledBmp = skin.getBmpFromCfg(cfg, "thumbDisabledBmp", "thumbUpBmp")
+ self._thumbNode = SliderThumb(upBmp=thumbUpBmp, downBmp=thumbDownBmp,
+ disabledBmp=thumbDisabledBmp)
+ self.appendChild(self._thumbNode)
+
+ def _getScrollRangeInPixels(self):
+ if self._orientation == Orientation.HORIZONTAL:
+ return self.size.x - self._thumbNode.size.x
+ else:
+ return self.size.y - self._thumbNode.size.y
+
+ def _getSliderRange(self):
+ return self._range[1] - self._range[0]
+
+ def _constrainSliderPos(self):
+ rangeMin = min(self._range[0], self._range[1])
+ rangeMax = max(self._range[0], self._range[1])
+ self._thumbPos = max(rangeMin, self._thumbPos)
+ self._thumbPos = min(rangeMax, self._thumbPos)
+
+
+class ScrollBar(SliderBase):
+
+ def __init__(self, orientation=Orientation.HORIZONTAL, skinObj=skin.Skin.default,
+ thumbExtent=0.1, **kwargs):
+ self.__thumbExtent = thumbExtent
+ if orientation == Orientation.HORIZONTAL:
+ cfg = skinObj.defaultScrollBarCfg["horizontal"]
+ else:
+ cfg = skinObj.defaultScrollBarCfg["vertical"]
+ super(ScrollBar, self).__init__(orientation=orientation, cfg=cfg, **kwargs)
+
+ def _initThumb(self, cfg):
+ thumbUpBmp = cfg["thumbUpBmp"]
+ thumbDownBmp = skin.getBmpFromCfg(cfg, "thumbDownBmp", "thumbUpBmp")
+ thumbDisabledBmp = skin.getBmpFromCfg(cfg, "thumbDisabledBmp", "thumbUpBmp")
+ endsExtent=cfg["thumbEndsExtent"]
+
+ self._thumbNode = ScrollBarThumb(orientation=self._orientation,
+ upBmp=thumbUpBmp, downBmp=thumbDownBmp,
+ disabledBmp=thumbDisabledBmp, endsExtent=endsExtent)
+ self.appendChild(self._thumbNode)
+
+ def getThumbExtent(self):
+ return self.__thumbExtent
+
+ def setThumbExtent(self, thumbExtent):
+ self.__thumbExtent = float(thumbExtent)
+ self._positionNodes()
+
+ thumbExtent = property(getThumbExtent, setThumbExtent)
+
+ def _getScrollRangeInPixels(self):
+ if self._orientation == Orientation.HORIZONTAL:
+ return self.size.x - self._thumbNode.width
+ else:
+ return self.size.y - self._thumbNode.height
+
+ def _positionNodes(self, newSliderPos=None):
+ effectiveRange = math.fabs(self._range[1] - self._range[0])
+ if self._orientation == Orientation.HORIZONTAL:
+ thumbExtent = (self.__thumbExtent/effectiveRange)*self.size.x
+ self._thumbNode.width = thumbExtent
+ else:
+ thumbExtent = (self.__thumbExtent/effectiveRange)*self.size.y
+ self._thumbNode.height = thumbExtent
+ super(ScrollBar, self)._positionNodes(newSliderPos)
+ if self._range[1] < self._range[0]:
+ # Reversed (upside-down) scrollbar
+ if self._orientation == Orientation.HORIZONTAL:
+ self._thumbNode.x -= thumbExtent
+ else:
+ self._thumbNode.y -= thumbExtent
+
+ def _getSliderRange(self):
+ if self._range[1] > self._range[0]:
+ return self._range[1] - self._range[0] - self.__thumbExtent
+ else:
+ return self._range[1] - self._range[0] + self.__thumbExtent
+
+ def _constrainSliderPos(self):
+ rangeMin = min(self._range[0], self._range[1])
+ rangeMax = max(self._range[0], self._range[1])
+ self._thumbPos = max(rangeMin, self._thumbPos)
+ self._thumbPos = min(rangeMax-self.__thumbExtent, self._thumbPos)
+
diff --git a/src/samples/Makefile.am b/src/samples/Makefile.am
index 3840524..8af2a57 100644
--- a/src/samples/Makefile.am
+++ b/src/samples/Makefile.am
@@ -2,3 +2,4 @@ EXTRA_DIST = $(wildcard *.avg) $(wildcard *.png) $(wildcard *.avi)
pkgsampledir = $(pkgpyexecdir)/samples
pkgsample_PYTHON = $(wildcard *.py)
pkgsample_DATA = $(wildcard *.avg) $(wildcard *.png) $(wildcard *.avi)
+SUBDIRS = firebirds
diff --git a/src/samples/Makefile.in b/src/samples/Makefile.in
index 8bd283b..0336921 100644
--- a/src/samples/Makefile.in
+++ b/src/samples/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# Makefile.in generated by automake 1.11.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
-# Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -42,25 +42,33 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ac_cxx_namespaces.m4 \
$(top_srcdir)/m4/ac_path_generic.m4 \
$(top_srcdir)/m4/ax_boost_thread.m4 \
- $(top_srcdir)/m4/ax_check_gl.m4 $(top_srcdir)/m4/libtool.m4 \
- $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
- $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
- $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/m4/python_dev.m4 \
- $(top_srcdir)/configure.in
+ $(top_srcdir)/m4/ax_check_gl.m4 \
+ $(top_srcdir)/m4/ax_python_devel.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/pkg.m4 \
+ $(top_srcdir)/m4/avg_version.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/src/avgconfig.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
-AM_V_GEN = $(am__v_GEN_$(V))
-am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
-AM_V_at = $(am__v_at_$(V))
-am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
SOURCES =
DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-dvi-recursive install-exec-recursive \
+ install-html-recursive install-info-recursive \
+ install-pdf-recursive install-ps-recursive install-recursive \
+ installcheck-recursive installdirs-recursive pdf-recursive \
+ ps-recursive uninstall-recursive
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
@@ -82,11 +90,51 @@ am__nobase_list = $(am__nobase_strip_setup); \
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
+am__py_compile = PYTHON=$(PYTHON) $(SHELL) $(py_compile)
am__installdirs = "$(DESTDIR)$(pkgsampledir)" \
"$(DESTDIR)$(pkgsampledir)"
py_compile = $(top_srcdir)/py-compile
DATA = $(pkgsample_DATA)
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
+ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
+ distdir
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+am__relativize = \
+ dir0=`pwd`; \
+ sed_first='s,^\([^/]*\)/.*$$,\1,'; \
+ sed_rest='s,^[^/]*/*,,'; \
+ sed_last='s,^.*/\([^/]*\)$$,\1,'; \
+ sed_butlast='s,/*[^/]*$$,,'; \
+ while test -n "$$dir1"; do \
+ first=`echo "$$dir1" | sed -e "$$sed_first"`; \
+ if test "$$first" != "."; then \
+ if test "$$first" = ".."; then \
+ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
+ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
+ else \
+ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
+ if test "$$first2" = "$$first"; then \
+ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
+ else \
+ dir2="../$$dir2"; \
+ fi; \
+ dir0="$$dir0"/"$$first"; \
+ fi; \
+ fi; \
+ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
+ done; \
+ reldir="$$dir2"
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
@@ -96,7 +144,7 @@ AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BOOST_PYTHON_LIBS = @BOOST_PYTHON_LIBS@
-BOOST_THREAD_LIB = @BOOST_THREAD_LIB@
+BOOST_THREAD_LIBS = @BOOST_THREAD_LIBS@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
@@ -111,6 +159,7 @@ DC1394_2_CFLAGS = @DC1394_2_CFLAGS@
DC1394_2_LIBS = @DC1394_2_LIBS@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
@@ -151,6 +200,7 @@ LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
MTDEV_CFLAGS = @MTDEV_CFLAGS@
MTDEV_LIBS = @MTDEV_LIBS@
@@ -180,11 +230,13 @@ PTHREAD_CC = @PTHREAD_CC@
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
PTHREAD_LIBS = @PTHREAD_LIBS@
PYTHON = @PYTHON@
+PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@
PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
-PYTHON_INCLUDES = @PYTHON_INCLUDES@
-PYTHON_LIBS = @PYTHON_LIBS@
+PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@
+PYTHON_LDFLAGS = @PYTHON_LDFLAGS@
PYTHON_PLATFORM = @PYTHON_PLATFORM@
PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_SITE_PKG = @PYTHON_SITE_PKG@
PYTHON_VERSION = @PYTHON_VERSION@
RANLIB = @RANLIB@
SDL_CFLAGS = @SDL_CFLAGS@
@@ -207,6 +259,7 @@ abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
@@ -241,7 +294,6 @@ libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
@@ -269,7 +321,8 @@ EXTRA_DIST = $(wildcard *.avg) $(wildcard *.png) $(wildcard *.avi)
pkgsampledir = $(pkgpyexecdir)/samples
pkgsample_PYTHON = $(wildcard *.py)
pkgsample_DATA = $(wildcard *.avg) $(wildcard *.png) $(wildcard *.avi)
-all: all-am
+SUBDIRS = firebirds
+all: all-recursive
.SUFFIXES:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@@ -326,11 +379,8 @@ install-pkgsamplePYTHON: $(pkgsample_PYTHON)
$(INSTALL_DATA) $$files "$(DESTDIR)$(pkgsampledir)" || exit $$?; \
done || exit $$?; \
if test -n "$$dlist"; then \
- if test -z "$(DESTDIR)"; then \
- PYTHON=$(PYTHON) $(py_compile) --basedir "$(pkgsampledir)" $$dlist; \
- else \
- PYTHON=$(PYTHON) $(py_compile) --destdir "$(DESTDIR)" --basedir "$(pkgsampledir)" $$dlist; \
- fi; \
+ $(am__py_compile) --destdir "$(DESTDIR)" \
+ --basedir "$(pkgsampledir)" $$dlist; \
else :; fi
uninstall-pkgsamplePYTHON:
@@ -338,14 +388,14 @@ uninstall-pkgsamplePYTHON:
@list='$(pkgsample_PYTHON)'; test -n "$(pkgsampledir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
test -n "$$files" || exit 0; \
+ dir='$(DESTDIR)$(pkgsampledir)'; \
filesc=`echo "$$files" | sed 's|$$|c|'`; \
fileso=`echo "$$files" | sed 's|$$|o|'`; \
- echo " ( cd '$(DESTDIR)$(pkgsampledir)' && rm -f" $$files ")"; \
- cd "$(DESTDIR)$(pkgsampledir)" && rm -f $$files || exit $$?; \
- echo " ( cd '$(DESTDIR)$(pkgsampledir)' && rm -f" $$filesc ")"; \
- cd "$(DESTDIR)$(pkgsampledir)" && rm -f $$filesc || exit $$?; \
- echo " ( cd '$(DESTDIR)$(pkgsampledir)' && rm -f" $$fileso ")"; \
- cd "$(DESTDIR)$(pkgsampledir)" && rm -f $$fileso
+ st=0; \
+ for files in "$$files" "$$filesc" "$$fileso"; do \
+ $(am__uninstall_files_from_dir) || st=$$?; \
+ done; \
+ exit $$st
install-pkgsampleDATA: $(pkgsample_DATA)
@$(NORMAL_INSTALL)
test -z "$(pkgsampledir)" || $(MKDIR_P) "$(DESTDIR)$(pkgsampledir)"
@@ -363,15 +413,142 @@ uninstall-pkgsampleDATA:
@$(NORMAL_UNINSTALL)
@list='$(pkgsample_DATA)'; test -n "$(pkgsampledir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
- test -n "$$files" || exit 0; \
- echo " ( cd '$(DESTDIR)$(pkgsampledir)' && rm -f" $$files ")"; \
- cd "$(DESTDIR)$(pkgsampledir)" && rm -f $$files
+ dir='$(DESTDIR)$(pkgsampledir)'; $(am__uninstall_files_from_dir)
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @fail= failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+ @fail= failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
tags: TAGS
-TAGS:
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
ctags: CTAGS
-CTAGS:
-
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
@@ -403,27 +580,61 @@ distdir: $(DISTFILES)
|| exit 1; \
fi; \
done
+ @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
+ fi; \
+ done
+ @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
+ $(am__relativize); \
+ new_distdir=$$reldir; \
+ dir1=$$subdir; dir2="$(top_distdir)"; \
+ $(am__relativize); \
+ new_top_distdir=$$reldir; \
+ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
+ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
+ ($(am__cd) $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$new_top_distdir" \
+ distdir="$$new_distdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ am__skip_mode_fix=: \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
check-am: all-am
-check: check-am
+check: check-recursive
all-am: Makefile $(DATA)
-installdirs:
+installdirs: installdirs-recursive
+installdirs-am:
for dir in "$(DESTDIR)$(pkgsampledir)" "$(DESTDIR)$(pkgsampledir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
-install: install-am
-install-exec: install-exec-am
-install-data: install-data-am
-uninstall: uninstall-am
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-installcheck: installcheck-am
+installcheck: installcheck-recursive
install-strip:
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- `test -z '$(STRIP)' || \
- echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
mostlyclean-generic:
clean-generic:
@@ -435,86 +646,90 @@ distclean-generic:
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
-clean: clean-am
+clean: clean-recursive
clean-am: clean-generic clean-libtool mostlyclean-am
-distclean: distclean-am
+distclean: distclean-recursive
-rm -f Makefile
-distclean-am: clean-am distclean-generic
+distclean-am: clean-am distclean-generic distclean-tags
-dvi: dvi-am
+dvi: dvi-recursive
dvi-am:
-html: html-am
+html: html-recursive
html-am:
-info: info-am
+info: info-recursive
info-am:
install-data-am: install-pkgsampleDATA install-pkgsamplePYTHON
-install-dvi: install-dvi-am
+install-dvi: install-dvi-recursive
install-dvi-am:
install-exec-am:
-install-html: install-html-am
+install-html: install-html-recursive
install-html-am:
-install-info: install-info-am
+install-info: install-info-recursive
install-info-am:
install-man:
-install-pdf: install-pdf-am
+install-pdf: install-pdf-recursive
install-pdf-am:
-install-ps: install-ps-am
+install-ps: install-ps-recursive
install-ps-am:
installcheck-am:
-maintainer-clean: maintainer-clean-am
+maintainer-clean: maintainer-clean-recursive
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
-mostlyclean: mostlyclean-am
+mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
-pdf: pdf-am
+pdf: pdf-recursive
pdf-am:
-ps: ps-am
+ps: ps-recursive
ps-am:
uninstall-am: uninstall-pkgsampleDATA uninstall-pkgsamplePYTHON
-.MAKE: install-am install-strip
-
-.PHONY: all all-am check check-am clean clean-generic clean-libtool \
- distclean distclean-generic distclean-libtool distdir dvi \
- dvi-am html html-am info info-am install install-am \
- install-data install-data-am install-dvi install-dvi-am \
- install-exec install-exec-am install-html install-html-am \
- install-info install-info-am install-man install-pdf \
- install-pdf-am install-pkgsampleDATA install-pkgsamplePYTHON \
- install-ps install-ps-am install-strip installcheck \
- installcheck-am installdirs maintainer-clean \
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
+ install-am install-strip tags-recursive
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+ all all-am check check-am clean clean-generic clean-libtool \
+ ctags ctags-recursive distclean distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-pkgsampleDATA install-pkgsamplePYTHON install-ps \
+ install-ps-am install-strip installcheck installcheck-am \
+ installdirs installdirs-am maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-generic \
- mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \
- uninstall-pkgsampleDATA uninstall-pkgsamplePYTHON
+ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
+ uninstall uninstall-am uninstall-pkgsampleDATA \
+ uninstall-pkgsamplePYTHON
# Tell versions [3.59,3.63) of GNU make to not export all variables.
diff --git a/src/samples/abort_gestures.py b/src/samples/abort_gestures.py
new file mode 100755
index 0000000..f948805
--- /dev/null
+++ b/src/samples/abort_gestures.py
@@ -0,0 +1,114 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+from libavg import avg, gesture, app
+
+import gestures
+
+RESOLUTION = avg.Point2D(800, 600)
+
+nodeList = []
+nodesEnabled = True
+
+def abortAll():
+ for node in nodeList:
+ node.recognizer.abort()
+
+def switchNodesEnabled():
+ global nodesEnabled
+ nodesEnabled = not nodesEnabled
+ for node in nodeList:
+ node.recognizer.enable(nodesEnabled)
+
+
+class TapButton(gestures.TextRect):
+ def __init__(self, text, **kwargs):
+ super(TapButton, self).__init__(text, **kwargs)
+
+ self.recognizer = gesture.TapRecognizer(node=self,
+ possibleHandler=self._onPossible, detectedHandler=self._onDetected,
+ failHandler=self._onFail)
+
+ def _onPossible(self):
+ self.rect.fillcolor = "FFFFFF"
+
+ def _onDetected(self):
+ self.rect.fillcolor = "000000"
+ self.rect.color = "00FF00"
+
+ def _onFail(self):
+ self.rect.fillcolor = "000000"
+ self.rect.color = "FF0000"
+
+
+class AbortButton(TapButton):
+ def __init__(self, text, **kwargs):
+ super(AbortButton, self).__init__(text, **kwargs)
+
+ def _onPossible(self):
+ super(AbortButton, self)._onPossible()
+ self.words.color = "000000"
+
+ def _onDetected(self):
+ super(AbortButton, self)._onDetected()
+ abortAll()
+ self.words.color = "FFFFFF"
+
+ def _onFail(self):
+ super(AbortButton, self)._onFail()
+ self.words.color = "FFFFFF"
+
+
+class EnableButton(TapButton):
+ def __init__(self, text, **kwargs):
+ super(EnableButton, self).__init__(text, **kwargs)
+
+ self.words.color = "FF0000"
+
+ def changeText(self):
+ if(nodesEnabled):
+ self.words.text = "Disable all"
+ self.words.color = "FF0000"
+ else:
+ self.words.text = "Enable all"
+ self.words.color = "00FF00"
+
+ def _onDetected(self):
+ super(EnableButton, self)._onDetected()
+ switchNodesEnabled()
+ self.changeText()
+
+
+class GestureDemoDiv(app.MainDiv):
+
+ def onInit(self):
+
+ avg.WordsNode(text='''a - abort recognition <br/>
+ d - enable/disable recognition <br/><br/>
+ or use the buttons on the right side''',
+ pos=(20, 510), parent=self)
+
+ nodeList.append(gestures.HoldNode(text="HoldRecognizer", pos=(20,20), parent=self))
+
+ nodeList.append(gestures.DragNode(text="DragRecognizer<br/>friction",pos=(200,20),
+ friction=0.05, parent=self))
+
+ nodeList.append(gestures.TransformNode(text="TransformRecognizer",
+ ignoreRotation=False, ignoreScale=False, pos=(380,20), parent=self))
+
+ self.abortButton = AbortButton(text="Abort all", pos = (630, 490), parent=self)
+
+ self.enableButton = EnableButton(text="Disable all", pos = (630, 540), parent=self)
+
+ app.keyboardmanager.bindKeyDown(keystring="a", handler=abortAll,
+ help="abort recognition")
+ app.keyboardmanager.bindKeyDown(keystring="d", handler=self.onEnableKey,
+ help="Enable/disable recognition")
+
+ def onEnableKey(self):
+ switchNodesEnabled()
+ self.enableButton.changeText()
+
+
+if __name__ == '__main__':
+ app.App().run(GestureDemoDiv(), app_resolution="800,600")
diff --git a/src/samples/anim1.py b/src/samples/anim1.py
index 12d6bef..0e78c02 100755
--- a/src/samples/anim1.py
+++ b/src/samples/anim1.py
@@ -6,10 +6,10 @@ from libavg import *
def startAnim():
animObj.start()
-player = avg.Player.get()
-player.loadFile("text.avg")
+canvas = player.createMainCanvas(size=(640,480))
+rootNode = canvas.getRootNode()
+node = avg.WordsNode(pos=(10,10), text="Hello World", parent=rootNode)
-node = player.getElementByID("HelloText")
animObj = LinearAnim(node, "x", 2000, 0, 200)
player.setTimeout(0, startAnim)
diff --git a/src/samples/anim2.py b/src/samples/anim2.py
index 1eb3a27..f48106f 100755
--- a/src/samples/anim2.py
+++ b/src/samples/anim2.py
@@ -6,10 +6,10 @@ from libavg import *
def startAnim():
animObj.start()
-player = avg.Player.get()
-player.loadFile("text.avg")
+canvas = player.createMainCanvas(size=(640,480))
+rootNode = canvas.getRootNode()
+node = avg.WordsNode(pos=(10,10), text="Hello World", parent=rootNode)
-node = player.getElementByID("HelloText")
animObj = ParallelAnim(
[LinearAnim(node, "x", 2000, 0, 200),
LinearAnim(node, "y", 2000, 0, 10)])
diff --git a/src/samples/app_complete.py b/src/samples/app_complete.py
new file mode 100755
index 0000000..ac4af8d
--- /dev/null
+++ b/src/samples/app_complete.py
@@ -0,0 +1,58 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import libavg
+from libavg import app, player
+
+
+class MyMainDiv(app.MainDiv):
+ # An OptionParser instance is passed to this function, allowing the MainDiv to
+ # add command line arguments
+ def onArgvParserCreated(self, parser):
+ parser.add_option('--speed', '-s', default='0.3', dest='speed',
+ help='Pixels per second')
+ parser.add_option('--color', '-c', default='ff0000', dest='color',
+ help='Fill color of the running block')
+
+ # This method is called when the command line options are being parsed.
+ # options, args are the result of OptionParser.parse_args().
+ def onArgvParsed(self, options, args, parser):
+ self.argvoptions = options
+
+ # This is called as soon as the player is started by the App object.
+ # Initialize everything here.
+ def onInit(self):
+ libavg.WordsNode(text='block_speed=%s app_resolution=%s' %
+ (self.argvoptions.speed,
+ self.settings.getPoint2D('app_resolution')),
+ pos=(10, self.height - 25), parent=self)
+
+ # Create a graphic element that will be animated
+ self.__runningBlock = libavg.RectNode(pos=(0, 100), size=(20, 20),
+ fillopacity=1, fillcolor=self.argvoptions.color,
+ parent=self)
+ self.__shouldMove = True
+
+ app.keyboardmanager.bindKeyDown('m', self.__toggleMotion, 'Toggle motion')
+
+ def onExit(self):
+ print 'Exiting..'
+
+ def onFrame(self):
+ if self.__shouldMove:
+ speed = float(self.argvoptions.speed)
+ self.__runningBlock.pos += (speed * player.getFrameDuration(), 0)
+ if self.__runningBlock.pos.x > self.size.x:
+ self.__runningBlock.pos = (0, 100)
+
+ def __toggleMotion(self):
+ self.__shouldMove = not self.__shouldMove
+ # Flash messages are debug notifications that are shown temporarily on top of all
+ # the visible elements.
+ app.flashmessage.FlashMessage('Should move: %s' % self.__shouldMove)
+
+
+if __name__ == '__main__':
+ # App options (such as app_resolution) can be changed as parameters of App().run()
+ app.App().run(MyMainDiv(), app_resolution='1024x500')
+
diff --git a/src/samples/app_minimal.py b/src/samples/app_minimal.py
new file mode 100755
index 0000000..230b98f
--- /dev/null
+++ b/src/samples/app_minimal.py
@@ -0,0 +1,17 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+from libavg import app
+
+class MyMainDiv(app.MainDiv):
+ def onInit(self):
+ pass
+
+ def onExit(self):
+ pass
+
+ def onFrame(self):
+ pass
+
+app.App().run(MyMainDiv())
+
diff --git a/src/samples/asyncload.py b/src/samples/asyncload.py
index 885fafb..48f15db 100755
--- a/src/samples/asyncload.py
+++ b/src/samples/asyncload.py
@@ -16,43 +16,36 @@ glitches while loading
'''
import sys
-import libavg
+from libavg import avg, player, app
APP_RESOLUTION = (640, 480)
-g_player = libavg.avg.Player.get()
+class AsyncLoadDiv(app.MainDiv):
-class AsyncLoadApp(libavg.AVGApp):
- def init(self):
+ def onInit(self):
'''
Create placeholders for the example. A single ImageNode is used to show
the pictures.
'''
- self.__imageNode = libavg.avg.ImageNode(pos=(10, 20), parent=self._parentNode)
- self.__spinner = libavg.avg.RectNode(color='222222',
- fillopacity=1, size=(40, 40), active=False,
- pos=(10, self._parentNode.size.y - 50), parent=self._parentNode)
- self.__infoNode = libavg.avg.WordsNode(text='Press space to load the first image',
- fontsize=11, pos=(10, 5), parent=self._parentNode)
+ self.__imageNode = avg.ImageNode(pos=(10, 20), parent=self)
+ self.__spinner = avg.RectNode(color='222222', fillopacity=1, size=(40, 40),
+ active=False, pos=(10, self.size.y - 50), parent=self)
+ self.__infoNode = avg.WordsNode(text='Press space to load the first image',
+ fontsize=11, pos=(10, 5), parent=self)
self.__pics = sys.argv[1:]
self.__currentPic = -1
- g_player.setOnFrameHandler(self.__onFrame)
-
- def onKeyDown(self, event):
- '''
- Intercept a space keypress and trigger the request.
- '''
- if event.keystring == 'space':
- self.__requestNextBitmap()
+ player.subscribe(player.ON_FRAME, self.__onFrame)
+ app.keyboardmanager.bindKeyDown(keystring="space", handler=self.__requestNextBitmap,
+ help="Request next bitmap")
def __requestNextBitmap(self):
'''
Ask the BitmapManager to load a new file. loadBitmap() call returns immediately.
'''
self.__currentPic = (self.__currentPic + 1) % len(self.__pics)
- libavg.avg.BitmapManager.get().loadBitmap(self.__pics[self.__currentPic],
+ avg.BitmapManager.get().loadBitmap(self.__pics[self.__currentPic],
self.__onBitmapLoaded)
self.__spinner.active = True
@@ -92,5 +85,5 @@ if len(sys.argv) == 1:
print 'Usage: %s <filename> [<filename> [<filename> [..]]]' % sys.argv[0]
sys.exit(1)
-AsyncLoadApp.start(resolution=APP_RESOLUTION)
+app.App().run(AsyncLoadDiv(), app_resolution="640,480")
diff --git a/src/samples/attributes.py b/src/samples/attributes.py
index 887271c..b4aa6d4 100755
--- a/src/samples/attributes.py
+++ b/src/samples/attributes.py
@@ -1,12 +1,11 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-from libavg import avg
+from libavg import avg, player
-player = avg.Player.get()
-
-player.loadFile("text.avg")
-node = player.getElementByID("HelloText")
+canvas = player.createMainCanvas(size=(640,480))
+rootNode = canvas.getRootNode()
+node = avg.WordsNode(pos=(10,10), text="Hello World", parent=rootNode)
print node.x
node.x = 200
player.play()
diff --git a/src/samples/canvas.avg b/src/samples/canvas.avg
deleted file mode 100644
index e2244cf..0000000
--- a/src/samples/canvas.avg
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0"?>
-<canvas id="londoncalling" width="320" height="240">
- <words x="10" y="10" text="London Calling" font="Arial" variant="Bold"
- fontsize="18" color="CF8000"/>
-</canvas>
-
diff --git a/src/samples/canvas.py b/src/samples/canvas.py
index 050f9a6..ad5bb2b 100755
--- a/src/samples/canvas.py
+++ b/src/samples/canvas.py
@@ -1,13 +1,14 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-from libavg import avg
-
-player = avg.Player.get()
-player.loadCanvasFile("canvas.avg")
-player.loadString("""
- <avg width="640" height="480">
- <image href="canvas:londoncalling"/>
- </avg>
-""")
+from libavg import avg, player
+
+offscreenCanvas = player.createCanvas(id="londoncalling", size=(320,240))
+avg.WordsNode(pos=(10,10), text="London Calling",
+ parent=offscreenCanvas.getRootNode())
+
+mainCanvas = player.createMainCanvas(size=(640,480))
+rootNode = mainCanvas.getRootNode()
+avg.ImageNode(href="canvas:londoncalling", parent=rootNode)
+
player.play()
diff --git a/src/samples/drag.py b/src/samples/drag.py
index 8541a26..e5d50e7 100755
--- a/src/samples/drag.py
+++ b/src/samples/drag.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-from libavg import avg
+from libavg import avg, player
offset = None
@@ -25,13 +25,12 @@ def onMouseUp(event):
node.releaseEventCapture()
offset = None;
-player = avg.Player.get()
-
-player.loadFile("text.avg")
-node = player.getElementByID("HelloText")
-node.setEventHandler(avg.CURSORDOWN, avg.MOUSE, onMouseDown)
-node.setEventHandler(avg.CURSORMOTION, avg.MOUSE, onMouseMove)
-node.setEventHandler(avg.CURSORUP, avg.MOUSE, onMouseUp)
+canvas = player.createMainCanvas(size=(640,480))
+rootNode = canvas.getRootNode()
+node = avg.WordsNode(pos=(10,10), text="Hello World", parent=rootNode)
+node.subscribe(node.CURSOR_DOWN, onMouseDown)
+node.subscribe(node.CURSOR_MOTION, onMouseMove)
+node.subscribe(node.CURSOR_UP, onMouseUp)
player.play()
diff --git a/src/samples/event1.py b/src/samples/event1.py
index a9b3422..d0de427 100755
--- a/src/samples/event1.py
+++ b/src/samples/event1.py
@@ -1,21 +1,20 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-from libavg import avg
+from libavg import avg, player
def onMouseOver(event):
- node = player.getElementByID("HelloText")
+ global node
node.color = "FF8000"
def onMouseOut(event):
- node = player.getElementByID("HelloText")
+ global node
node.color = "FFFFFF"
-player = avg.Player.get()
-
-player.loadFile("text.avg")
-node = player.getElementByID("HelloText")
-node.setEventHandler(avg.CURSOROVER, avg.MOUSE, onMouseOver)
-node.setEventHandler(avg.CURSOROUT, avg.MOUSE, onMouseOut)
+canvas = player.createMainCanvas(size=(640,480))
+rootNode = canvas.getRootNode()
+node = avg.WordsNode(pos=(10,10), text="Hello World", parent=rootNode)
+node.subscribe(node.CURSOR_OVER, onMouseOver)
+node.subscribe(node.CURSOR_OUT, onMouseOut)
player.play()
diff --git a/src/samples/event2.avg b/src/samples/event2.avg
deleted file mode 100644
index c6ff732..0000000
--- a/src/samples/event2.avg
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0"?>
-<avg width="640" height="480">
- <words id="ClashText" x="10" y="10" font="arial" text="Should I stay or should I go?"/>
- <div id="div1" x="100" y="0" width="80" height="200"/>
-</avg>
-
diff --git a/src/samples/event2.py b/src/samples/event2.py
index b9180cc..6e7de63 100755
--- a/src/samples/event2.py
+++ b/src/samples/event2.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-from libavg import avg
+from libavg import avg, player
def onDiv(event):
words.color = "FF8000"
@@ -9,12 +9,13 @@ def onDiv(event):
def onWords(event):
words.color = "00FF00"
-player = avg.Player.get()
-
-player.loadFile("event2.avg")
-words = player.getElementByID("ClashText")
-words.setEventHandler(avg.CURSORMOTION, avg.MOUSE, onWords)
-player.getElementByID("div1").setEventHandler(avg.CURSORMOTION, avg.MOUSE, onDiv)
+canvas = player.createMainCanvas(size=(640,480))
+rootNode = canvas.getRootNode()
+words = avg.WordsNode(pos=(10,10), text="Should I stay or should I go?",
+ parent=rootNode)
+div = avg.DivNode(pos=(100,0), size=(80,200), parent=rootNode)
+words.subscribe(words.CURSOR_MOTION, onWords)
+div.subscribe(div.CURSOR_MOTION, onDiv)
player.play()
diff --git a/src/samples/event3.py b/src/samples/event3.py
deleted file mode 100755
index e51126f..0000000
--- a/src/samples/event3.py
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-from libavg import avg
-
-def clickFunc(event):
- node = player.getElementByID("mouseBlock")
- node.fillcolor = "FF0000"
-
-def keyboardFunc(event):
- if event.keystring == 'x':
- node = player.getElementByID("mouseBlock")
- node.fillcolor = "00FF00"
-
-player = avg.Player.get()
-
-player.loadString('''
-<?xml version="1.0"?>
-<avg width="640" height="480">
- <rect pos="(10,10)" size="(250,250)" fillopacity="1" id="mouseBlock"/>
-</avg>
-''')
-
-mouseBlock = player.getElementByID("mouseBlock")
-mouseBlock.setEventHandler(avg.CURSORDOWN, avg.MOUSE, clickFunc)
-
-rootNode = player.getRootNode()
-rootNode.setEventHandler(avg.KEYDOWN, avg.NONE, keyboardFunc)
-
-player.play()
-
diff --git a/src/samples/firebirds/Makefile.am b/src/samples/firebirds/Makefile.am
new file mode 100644
index 0000000..c574414
--- /dev/null
+++ b/src/samples/firebirds/Makefile.am
@@ -0,0 +1,3 @@
+pkgtutorialdir = $(pkgpyexecdir)/samples/firebirds
+pkgtutorial_PYTHON = $(wildcard *.py)
+SUBDIRS = plugin media
diff --git a/src/samples/firebirds/Makefile.in b/src/samples/firebirds/Makefile.in
new file mode 100644
index 0000000..fab128c
--- /dev/null
+++ b/src/samples/firebirds/Makefile.in
@@ -0,0 +1,713 @@
+# Makefile.in generated by automake 1.11.3 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = src/samples/firebirds
+DIST_COMMON = $(pkgtutorial_PYTHON) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/ac_cxx_namespaces.m4 \
+ $(top_srcdir)/m4/ac_path_generic.m4 \
+ $(top_srcdir)/m4/ax_boost_thread.m4 \
+ $(top_srcdir)/m4/ax_check_gl.m4 \
+ $(top_srcdir)/m4/ax_python_devel.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/pkg.m4 \
+ $(top_srcdir)/m4/avg_version.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/src/avgconfig.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-dvi-recursive install-exec-recursive \
+ install-html-recursive install-info-recursive \
+ install-pdf-recursive install-ps-recursive install-recursive \
+ installcheck-recursive installdirs-recursive pdf-recursive \
+ ps-recursive uninstall-recursive
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
+am__py_compile = PYTHON=$(PYTHON) $(SHELL) $(py_compile)
+am__installdirs = "$(DESTDIR)$(pkgtutorialdir)"
+py_compile = $(top_srcdir)/py-compile
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
+ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
+ distdir
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+am__relativize = \
+ dir0=`pwd`; \
+ sed_first='s,^\([^/]*\)/.*$$,\1,'; \
+ sed_rest='s,^[^/]*/*,,'; \
+ sed_last='s,^.*/\([^/]*\)$$,\1,'; \
+ sed_butlast='s,/*[^/]*$$,,'; \
+ while test -n "$$dir1"; do \
+ first=`echo "$$dir1" | sed -e "$$sed_first"`; \
+ if test "$$first" != "."; then \
+ if test "$$first" = ".."; then \
+ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
+ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
+ else \
+ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
+ if test "$$first2" = "$$first"; then \
+ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
+ else \
+ dir2="../$$dir2"; \
+ fi; \
+ dir0="$$dir0"/"$$first"; \
+ fi; \
+ fi; \
+ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
+ done; \
+ reldir="$$dir2"
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BOOST_PYTHON_LIBS = @BOOST_PYTHON_LIBS@
+BOOST_THREAD_LIBS = @BOOST_THREAD_LIBS@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DC1394_2_CFLAGS = @DC1394_2_CFLAGS@
+DC1394_2_LIBS = @DC1394_2_LIBS@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FFMPEG_CFLAGS = @FFMPEG_CFLAGS@
+FFMPEG_LIBS = @FFMPEG_LIBS@
+FGREP = @FGREP@
+FONTCONFIG_CFLAGS = @FONTCONFIG_CFLAGS@
+FONTCONFIG_LIBS = @FONTCONFIG_LIBS@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_CONFIG = @FREETYPE_CONFIG@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GDK_PIXBUF_CFLAGS = @GDK_PIXBUF_CFLAGS@
+GDK_PIXBUF_LIBS = @GDK_PIXBUF_LIBS@
+GLU_CFLAGS = @GLU_CFLAGS@
+GLU_LIBS = @GLU_LIBS@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBFFMPEG = @LIBFFMPEG@
+LIBOBJS = @LIBOBJS@
+LIBRSVG_CFLAGS = @LIBRSVG_CFLAGS@
+LIBRSVG_LIBS = @LIBRSVG_LIBS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBVIDEO_LDADD = @LIBVIDEO_LDADD@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+MTDEV_CFLAGS = @MTDEV_CFLAGS@
+MTDEV_LIBS = @MTDEV_LIBS@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLDFLAGS = @OBJCLDFLAGS@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PANGOFT2_CFLAGS = @PANGOFT2_CFLAGS@
+PANGOFT2_LIBS = @PANGOFT2_LIBS@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PREFIX = @PREFIX@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
+PYTHON = @PYTHON@
+PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@
+PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
+PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@
+PYTHON_LDFLAGS = @PYTHON_LDFLAGS@
+PYTHON_PLATFORM = @PYTHON_PLATFORM@
+PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_SITE_PKG = @PYTHON_SITE_PKG@
+PYTHON_VERSION = @PYTHON_VERSION@
+RANLIB = @RANLIB@
+SDL_CFLAGS = @SDL_CFLAGS@
+SDL_CONFIG = @SDL_CONFIG@
+SDL_LIBS = @SDL_LIBS@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+XI2_1_CFLAGS = @XI2_1_CFLAGS@
+XI2_1_LIBS = @XI2_1_LIBS@
+XI2_2_CFLAGS = @XI2_2_CFLAGS@
+XI2_2_LIBS = @XI2_2_LIBS@
+XMKMF = @XMKMF@
+XML2_CFLAGS = @XML2_CFLAGS@
+XML2_CONFIG = @XML2_CONFIG@
+XML2_LIBS = @XML2_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+acx_pthread_config = @acx_pthread_config@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+pkgpyexecdir = @pkgpyexecdir@
+pkgpythondir = @pkgpythondir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+pyexecdir = @pyexecdir@
+pythondir = @pythondir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+pkgtutorialdir = $(pkgpyexecdir)/samples/firebirds
+pkgtutorial_PYTHON = $(wildcard *.py)
+SUBDIRS = plugin media
+all: all-recursive
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/samples/firebirds/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/samples/firebirds/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-pkgtutorialPYTHON: $(pkgtutorial_PYTHON)
+ @$(NORMAL_INSTALL)
+ test -z "$(pkgtutorialdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgtutorialdir)"
+ @list='$(pkgtutorial_PYTHON)'; dlist=; list2=; test -n "$(pkgtutorialdir)" || list=; \
+ for p in $$list; do \
+ if test -f "$$p"; then b=; else b="$(srcdir)/"; fi; \
+ if test -f $$b$$p; then \
+ $(am__strip_dir) \
+ dlist="$$dlist $$f"; \
+ list2="$$list2 $$b$$p"; \
+ else :; fi; \
+ done; \
+ for file in $$list2; do echo $$file; done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgtutorialdir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgtutorialdir)" || exit $$?; \
+ done || exit $$?; \
+ if test -n "$$dlist"; then \
+ $(am__py_compile) --destdir "$(DESTDIR)" \
+ --basedir "$(pkgtutorialdir)" $$dlist; \
+ else :; fi
+
+uninstall-pkgtutorialPYTHON:
+ @$(NORMAL_UNINSTALL)
+ @list='$(pkgtutorial_PYTHON)'; test -n "$(pkgtutorialdir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ test -n "$$files" || exit 0; \
+ dir='$(DESTDIR)$(pkgtutorialdir)'; \
+ filesc=`echo "$$files" | sed 's|$$|c|'`; \
+ fileso=`echo "$$files" | sed 's|$$|o|'`; \
+ st=0; \
+ for files in "$$files" "$$filesc" "$$fileso"; do \
+ $(am__uninstall_files_from_dir) || st=$$?; \
+ done; \
+ exit $$st
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @fail= failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+ @fail= failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+ @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
+ fi; \
+ done
+ @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
+ $(am__relativize); \
+ new_distdir=$$reldir; \
+ dir1=$$subdir; dir2="$(top_distdir)"; \
+ $(am__relativize); \
+ new_top_distdir=$$reldir; \
+ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
+ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
+ ($(am__cd) $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$new_top_distdir" \
+ distdir="$$new_distdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ am__skip_mode_fix=: \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile
+installdirs: installdirs-recursive
+installdirs-am:
+ for dir in "$(DESTDIR)$(pkgtutorialdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+html-am:
+
+info: info-recursive
+
+info-am:
+
+install-data-am: install-pkgtutorialPYTHON
+
+install-dvi: install-dvi-recursive
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-recursive
+
+install-html-am:
+
+install-info: install-info-recursive
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-pdf-am:
+
+install-ps: install-ps-recursive
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-pkgtutorialPYTHON
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
+ install-am install-strip tags-recursive
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+ all all-am check check-am clean clean-generic clean-libtool \
+ ctags ctags-recursive distclean distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-pkgtutorialPYTHON install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ installdirs-am maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
+ ps ps-am tags tags-recursive uninstall uninstall-am \
+ uninstall-pkgtutorialPYTHON
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/src/samples/firebirds/firebirds.py b/src/samples/firebirds/firebirds.py
new file mode 100755
index 0000000..3656255
--- /dev/null
+++ b/src/samples/firebirds/firebirds.py
@@ -0,0 +1,469 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+# libavg - Media Playback Engine.
+# Copyright (C) 2012-2013 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: Thomas Schott <scotty@c-base.org>
+
+# See the LICENSE file for license information regarding the media
+# used by this sample.
+
+from random import randint
+
+from libavg import avg, player
+from libavg import app
+from libavg.utils import getMediaDir
+
+player.loadPlugin('collisiondetector')
+
+def playVideo(video):
+ if not player.isUsingGLES():
+ video.play()
+
+
+### game elements ###
+
+class Bullet(avg.VideoNode):
+ __SPEED = 360 # px/s
+
+ def __init__(self, parent=None, **kwargs):
+ super(Bullet, self).__init__(href='bullet.mov', loop=True, active=False, **kwargs)
+ self.registerInstance(self, parent)
+ self.pause()
+
+ def reset(self, pos):
+ self.pos = pos
+ self.active = True
+ playVideo(self)
+
+ def update(self, dt):
+ y = self.y - Bullet.__SPEED * dt
+ if y > -self.height:
+ self.y = y
+ else:
+ self.destroy()
+
+ def destroy(self):
+ self.active = False
+ self.pause()
+
+
+class _Aircraft(avg.DivNode):
+ _SPEED = 300 # px/s
+ __SHADOW_SCALE = 0.5
+ __SHADOW_OFFSET = avg.Point2D(170, 170)
+
+ def __init__(self, mediabase, shadowdiv, parent=None, **kwargs):
+ super(_Aircraft, self).__init__(**kwargs)
+ self.registerInstance(self, parent)
+ self.__alive = False
+ self.__aircraftVid = avg.VideoNode(href=mediabase+'.mov', loop=True, parent=self)
+ self.__aircraftVid.pause()
+ self.__destroyVid = avg.VideoNode(href='explosion.mov', active=False,
+ threaded=False, parent=self)
+ self.__destroyVid.pause()
+ self.__destroyVid.subscribe(avg.VideoNode.END_OF_FILE, self._hide)
+ self.__shadowImg = avg.ImageNode(href=mediabase+'.gif', opacity=0.5,
+ pos=self.pos + _Aircraft.__SHADOW_OFFSET, parent=shadowdiv)
+ self.__shadowImg.size *= _Aircraft.__SHADOW_SCALE
+ if not player.isUsingGLES():
+ self.__shadowImg.setEffect(avg.BlurFXNode(6.0))
+ self.size = self.__aircraftVid.size
+ #self._debug('created')
+
+ @property
+ def alive(self):
+ return self.__alive
+
+ def reset(self):
+ #self._debug('reset')
+ self.active = True
+ self.__alive = True
+ self.__aircraftVid.active = True
+ playVideo(self.__aircraftVid)
+ self.__destroyVid.active = False
+ self.__destroyVid.pause()
+ self.__shadowImg.active = True
+
+ def destroy(self):
+ #self._debug('destroy')
+ self.__alive = False
+ self.__aircraftVid.active = False
+ self.__aircraftVid.pause()
+ self.__destroyVid.active = True
+ playVideo(self.__destroyVid)
+ self.__destroyVid.seekToFrame(0)
+ self.__shadowImg.active = False
+ if player.isUsingGLES():
+ self._hide()
+
+ def _move(self, pos):
+ self.pos = pos
+ self.__shadowImg.pos = self.pos + _Aircraft.__SHADOW_OFFSET
+
+ def _hide(self):
+ #self._debug('hide')
+ self.active = False
+ self.__alive = False
+ self.__aircraftVid.pause()
+ self.__destroyVid.pause()
+ self.__shadowImg.active = False
+
+ @classmethod
+ def _debug(cls, msg):
+ print '%6d [%s] %s' %(player.getFrameTime(), cls.__name__, msg)
+
+
+class PlayerAircraft(_Aircraft):
+ ACTION_KEYS = ('left', 'right', 'up', 'down', 'space')
+ __BULLET_OFFSET_L = avg.Point2D( 52, 16)
+ __BULLET_OFFSET_R = avg.Point2D(140, 16)
+
+ def __init__(self, shadowdiv, gunCtrl, parent=None, **kwargs):
+ super(PlayerAircraft, self).__init__('spitfire', shadowdiv, parent, **kwargs)
+ self.__gunCtrl = gunCtrl
+ self.__bullets = [Bullet(parent=self.parent) for i in xrange(10)]
+ self.__engineSnd = avg.SoundNode(href='flySound.mp3', loop=True, parent=self)
+ self.__bulletSnd = avg.SoundNode(href='bulletSound.mp3', volume=0.75, parent=self)
+ self.__maxX, self.__maxY = self.parent.size - self.size
+
+ def reset(self):
+ super(PlayerAircraft, self).reset()
+ self.__gunCtrl.reset()
+ self._move((self.__maxX / 2, self.__maxY))
+ self.__engineSnd.play()
+
+ def destroy(self):
+ super(PlayerAircraft, self).destroy()
+ self.__engineSnd.stop()
+
+ def update(self, dt, keyStates):
+ d = _Aircraft._SPEED * dt
+ dx = 0
+ if keyStates['left']:
+ dx = -d
+ if keyStates['right']:
+ dx += d
+ dy = 0
+ if keyStates['up']:
+ dy = -d
+ if keyStates['down']:
+ dy += d
+ pos = (max(min(self.x + dx, self.__maxX), 0),
+ max(min(self.y + dy, self.__maxY), 0))
+ if pos != self.pos:
+ self._move(pos)
+
+ if keyStates['space'] and self.__gunCtrl.shoot():
+ # fire bullets
+ bulletLeft = None
+ bulletRight = None
+ for b in self.__bullets:
+ if b.active:
+ b.update(dt)
+ elif not bulletLeft:
+ bulletLeft = b
+ elif not bulletRight:
+ bulletRight = b
+ if not bulletLeft:
+ bulletLeft = Bullet(parent=self.parent)
+ self.__bullets.append(bulletLeft)
+ if not bulletRight:
+ bulletRight = Bullet(parent=self.parent)
+ self.__bullets.append(bulletRight)
+ bulletLeft.reset(self.pos + PlayerAircraft.__BULLET_OFFSET_L)
+ bulletRight.reset(self.pos + PlayerAircraft.__BULLET_OFFSET_R)
+ self.__bulletSnd.play()
+ self.__bulletSnd.seekToTime(0)
+ else:
+ self.__gunCtrl.update(dt)
+ self.updateBullets(dt)
+
+ def updateBullets(self, dt):
+ bulletsAlive = False
+ for b in self.__bullets:
+ if b.active:
+ bulletsAlive = True
+ b.update(dt)
+ return bulletsAlive
+
+ def getActiveBullets(self):
+ return [b for b in self.__bullets if b.active]
+
+
+class EnemyAircraft(_Aircraft):
+ ESCAPED = avg.Publisher.genMessageID()
+
+ def __init__(self, shadowdiv, parent=None, **kwargs):
+ super(EnemyAircraft, self).__init__('enemy', shadowdiv, parent, **kwargs)
+ self.publish(EnemyAircraft.ESCAPED)
+ self.__destroySnd = avg.SoundNode(href='enemyDeath.mp3', volume=2.0, parent=self)
+ self._hide()
+
+ def reset(self):
+ super(EnemyAircraft, self).reset()
+ self._move((randint(0, self.parent.width - self.width), -self.height))
+
+ def destroy(self):
+ super(EnemyAircraft, self).destroy()
+ self.__destroySnd.play()
+ self.__destroySnd.seekToTime(0)
+
+ def update(self, dt):
+ y = self.y + _Aircraft._SPEED * dt
+ if y < self.parent.height:
+ self._move((self.x, y))
+ else:
+ self._hide()
+ self.notifySubscribers(EnemyAircraft.ESCAPED, [])
+
+
+### gui elements ###
+
+class ScrollingBackground(object):
+ __SCROLL_SPEED = 120.0 # px/s
+
+ def __init__(self, parent):
+ self.__imgA = avg.ImageNode(href='ground.jpg', parent=parent)
+ self.__imgB = avg.ImageNode(href='ground.jpg', pos=(0, -self.__imgA.height),
+ parent=parent)
+
+ def update(self, dt):
+ dy = ScrollingBackground.__SCROLL_SPEED * dt
+ self.__imgA.y += dy
+ self.__imgB.y += dy
+ if self.__imgA.y >= self.__imgA.height:
+ self.__imgA.y = self.__imgB.y - self.__imgA.height
+ elif self.__imgB.y >= self.__imgA.height:
+ self.__imgB.y = self.__imgA.y - self.__imgA.height
+
+
+class LiveCounter(avg.DivNode):
+ __NUM_LIVES = 3
+
+ def __init__(self, parent=None, **kwargs):
+ super(LiveCounter, self).__init__(**kwargs)
+ self.registerInstance(self, parent)
+ self.__numLives = 0
+ self.__images = []
+ x = 0
+ for i in xrange(LiveCounter.__NUM_LIVES):
+ avg.ImageNode(href='gui_lives_bg.png', pos=(x, 0), parent=self)
+ img = avg.ImageNode(href='gui_lives_fg.png', pos=(x, 0), parent=self)
+ self.__images.append(img)
+ x += img.width
+
+ def reset(self):
+ self.__numLives = 3
+ for img in self.__images:
+ avg.fadeIn(img, 250)
+
+ def dec(self):
+ assert(self.__numLives)
+ self.__numLives -= 1
+ avg.fadeOut(self.__images[self.__numLives], 250)
+ return not self.__numLives
+
+
+class ScoreCounter(avg.DivNode):
+ def __init__(self, parent=None, **kwargs):
+ super(ScoreCounter, self).__init__(size=(3 * 34, 34), crop=True, **kwargs)
+ self.registerInstance(self, parent)
+ self.__score = 0
+ self.__images = [avg.ImageNode(href='gui_numbers.png', pos=((2 - i) * 34, 0),
+ parent=self) for i in xrange(3)]
+
+ def reset(self):
+ self.__score = 0
+ for img in self.__images:
+ if img.y != 0:
+ avg.LinearAnim(img, 'y', 250, img.y, 0).start()
+
+ def inc(self):
+ self.__score += 1
+ self.__updateImages()
+
+ def dec(self):
+ if self.__score > 0:
+ self.__score -= 1
+ self.__updateImages()
+
+ def __updateImages(self):
+ s = self.__score
+ for img in self.__images:
+ y = s % 10 * -34
+ if img.y != y:
+ avg.LinearAnim(img, 'y', 250, img.y, y).start()
+ s /= 10
+
+
+class GunControl(avg.DivNode):
+ __SHOOT_INTERVAL = 1.0 / 7 # ms
+ __TEMPERATURE_INC = 30 # px/shot
+ __TEMPERATURE_DEC = 60 # px/s
+
+ def __init__(self, parent=None, **kwargs):
+ super(GunControl, self).__init__(**kwargs)
+ self.registerInstance(self, parent)
+ bg = avg.ImageNode(href='gui_heatbar_bg.png', parent=self)
+ self.__heatbar = avg.DivNode(size=(1, bg.height), crop=True, parent=self)
+ avg.ImageNode(href='gui_heatbar_fg.png', parent=self.__heatbar)
+ self.__maxTemp = bg.width - GunControl.__TEMPERATURE_INC
+ self.__shootTimeout = 0.0
+
+ def reset(self):
+ self.__heatbar.width = 1
+
+ def update(self, dt):
+ if self.__shootTimeout > 0.0:
+ self.__shootTimeout = max(0.0, self.__shootTimeout - dt)
+ dw = GunControl.__TEMPERATURE_DEC * dt
+ if self.__heatbar.width > dw:
+ self.__heatbar.width -= dw
+
+ def shoot(self):
+ if self.__shootTimeout == 0.0 and self.__heatbar.width < self.__maxTemp:
+ self.__shootTimeout = GunControl.__SHOOT_INTERVAL
+ self.__heatbar.width += GunControl.__TEMPERATURE_INC
+ return True
+ return False
+
+
+### application ###
+
+class FireBirds(app.MainDiv):
+ ENEMY_SPAWN_TIMEOUT = 1000 # ms
+
+ def onInit(self):
+ self.mediadir = getMediaDir(__file__)
+
+ self.__gameMusic = avg.SoundNode(href='Fire_Birds.mp3', loop=True,
+ volume=0.75, parent=self)
+ self.__scrollingBg = ScrollingBackground(self)
+ self.__shadowDiv = avg.DivNode(parent=self)
+ self.__gameDiv = avg.DivNode(size=self.size, parent=self)
+ self.__guiDiv = avg.DivNode(parent=self)
+
+ bg = avg.ImageNode(href='gui_frame.png', parent=self.__guiDiv)
+ self.__guiDiv.pos = (0, self.height - bg.height)
+ self.__liveCounter = LiveCounter(pos=(8, 12), parent=self.__guiDiv)
+ gunCtrl = GunControl(pos=(300, 54), parent=self.__guiDiv)
+ self.__scoreCounter = ScoreCounter(pos=(1142, 54), parent=self.__guiDiv)
+
+ self.__enemies = []
+ for i in xrange(2):
+ self.__createEnemy()
+ self.__player = PlayerAircraft(self.__shadowDiv, gunCtrl, parent=self.__gameDiv)
+
+ enemyMask = avg.Bitmap(self.mediadir + '/enemy.gif')
+ self.__playerCollisionDetector = collisiondetector.CollisionDetector(
+ enemyMask, avg.Bitmap(self.mediadir + '/spitfire.gif'))
+ self.__bulletCollisionDetector = collisiondetector.CollisionDetector(
+ enemyMask, avg.Bitmap(self.mediadir + '/bullet.gif'))
+
+ self.__keyStates = dict.fromkeys(PlayerAircraft.ACTION_KEYS, False)
+ self.__frameHandlerId = None
+ self.__spawnTimeoutId = None
+ self.__gameMusic.play()
+ self.__start()
+ player.subscribe(player.KEY_DOWN, self.__onKeyDown)
+ player.subscribe(player.KEY_UP, self.__onKeyUp)
+
+ def __onKeyDown(self, event):
+ if self.__player.alive:
+ if event.keystring in PlayerAircraft.ACTION_KEYS:
+ self.__keyStates[event.keystring] = True
+ elif not self.__frameHandlerId: # game stopped
+ if event.keystring == 'space':
+ self.__start()
+ # else: wait for bullets and enemies to leave the screen
+
+ def __onKeyUp(self, event):
+ if event.keystring in PlayerAircraft.ACTION_KEYS:
+ self.__keyStates[event.keystring] = False
+
+ def __start(self):
+ assert(not self.__frameHandlerId and not self.__spawnTimeoutId)
+ self.__liveCounter.reset()
+ self.__scoreCounter.reset()
+ self.__player.reset()
+ self.__frameHandlerId = player.subscribe(player.ON_FRAME, self.__onFrame)
+ self.__spawnTimeoutId = player.setInterval(self.ENEMY_SPAWN_TIMEOUT,
+ self.__spawnEnemy)
+
+ def __stop(self):
+ assert(self.__frameHandlerId and self.__spawnTimeoutId)
+ player.clearInterval(self.__spawnTimeoutId)
+ self.__spawnTimeoutId = None
+
+ def __createEnemy(self):
+ enemy = EnemyAircraft(self.__shadowDiv, parent=self.__gameDiv)
+ enemy.subscribe(EnemyAircraft.ESCAPED, self.__scoreCounter.dec)
+ self.__enemies.append(enemy)
+ return enemy
+
+ def __spawnEnemy(self):
+ assert(self.__frameHandlerId)
+ enemy = None
+ for e in self.__enemies:
+ if not e.active:
+ enemy = e
+ break
+ if not enemy:
+ enemy = self.__createEnemy()
+ enemy.reset()
+
+ def __onFrame(self):
+ dt = player.getFrameDuration() * 0.001
+ self.__scrollingBg.update(dt)
+
+ bullets = self.__player.getActiveBullets()
+ enemiesActive = False
+ for e in self.__enemies:
+ if e.active:
+ enemiesActive = True
+ if e.alive:
+ for b in bullets:
+ if self.__bulletCollisionDetector.detect(e.pos, b.pos):
+ self.__scoreCounter.inc()
+ e.destroy()
+ b.destroy()
+ break
+ if e.alive: # no bullet hit
+ if self.__player.alive and \
+ self.__playerCollisionDetector.detect(e.pos, self.__player.pos):
+ e.destroy()
+ if self.__liveCounter.dec():
+ self.__stop()
+ self.__player.destroy()
+ if e.alive: # no player collision
+ e.update(dt)
+
+ if self.__player.alive:
+ self.__player.update(dt, self.__keyStates)
+ elif not self.__player.updateBullets(dt) and not enemiesActive:
+ # player dead, all bullets and enemies left the screen, all destroy videos played
+ player.unsubscribe(player.ON_FRAME, self.__frameHandlerId)
+ self.__frameHandlerId = None
+
+
+if __name__ == '__main__':
+ app.App().run(FireBirds(), app_resolution='1280x720')
+
diff --git a/src/samples/firebirds/media/Fire_Birds.mp3 b/src/samples/firebirds/media/Fire_Birds.mp3
new file mode 100644
index 0000000..264723e
--- /dev/null
+++ b/src/samples/firebirds/media/Fire_Birds.mp3
Binary files differ
diff --git a/src/samples/firebirds/media/Makefile.am b/src/samples/firebirds/media/Makefile.am
new file mode 100644
index 0000000..bfd5cdf
--- /dev/null
+++ b/src/samples/firebirds/media/Makefile.am
@@ -0,0 +1,5 @@
+EXTRA_DIST = $(wildcard *.gif) $(wildcard *.png) $(wildcard *.jpg) \
+ $(wildcard *.mov) $(wildcard *.mp3)
+datadir = $(pkgpyexecdir)/samples/firebirds/media
+data_DATA = $(wildcard *.gif) $(wildcard *.png) $(wildcard *.jpg) \
+ $(wildcard *.mov) $(wildcard *.mp3)
diff --git a/src/samples/firebirds/media/Makefile.in b/src/samples/firebirds/media/Makefile.in
new file mode 100644
index 0000000..8eb455c
--- /dev/null
+++ b/src/samples/firebirds/media/Makefile.in
@@ -0,0 +1,496 @@
+# Makefile.in generated by automake 1.11.3 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = src/samples/firebirds/media
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/ac_cxx_namespaces.m4 \
+ $(top_srcdir)/m4/ac_path_generic.m4 \
+ $(top_srcdir)/m4/ax_boost_thread.m4 \
+ $(top_srcdir)/m4/ax_check_gl.m4 \
+ $(top_srcdir)/m4/ax_python_devel.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/pkg.m4 \
+ $(top_srcdir)/m4/avg_version.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/src/avgconfig.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+SOURCES =
+DIST_SOURCES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
+am__installdirs = "$(DESTDIR)$(datadir)"
+DATA = $(data_DATA)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BOOST_PYTHON_LIBS = @BOOST_PYTHON_LIBS@
+BOOST_THREAD_LIBS = @BOOST_THREAD_LIBS@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DC1394_2_CFLAGS = @DC1394_2_CFLAGS@
+DC1394_2_LIBS = @DC1394_2_LIBS@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FFMPEG_CFLAGS = @FFMPEG_CFLAGS@
+FFMPEG_LIBS = @FFMPEG_LIBS@
+FGREP = @FGREP@
+FONTCONFIG_CFLAGS = @FONTCONFIG_CFLAGS@
+FONTCONFIG_LIBS = @FONTCONFIG_LIBS@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_CONFIG = @FREETYPE_CONFIG@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GDK_PIXBUF_CFLAGS = @GDK_PIXBUF_CFLAGS@
+GDK_PIXBUF_LIBS = @GDK_PIXBUF_LIBS@
+GLU_CFLAGS = @GLU_CFLAGS@
+GLU_LIBS = @GLU_LIBS@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBFFMPEG = @LIBFFMPEG@
+LIBOBJS = @LIBOBJS@
+LIBRSVG_CFLAGS = @LIBRSVG_CFLAGS@
+LIBRSVG_LIBS = @LIBRSVG_LIBS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBVIDEO_LDADD = @LIBVIDEO_LDADD@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+MTDEV_CFLAGS = @MTDEV_CFLAGS@
+MTDEV_LIBS = @MTDEV_LIBS@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLDFLAGS = @OBJCLDFLAGS@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PANGOFT2_CFLAGS = @PANGOFT2_CFLAGS@
+PANGOFT2_LIBS = @PANGOFT2_LIBS@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PREFIX = @PREFIX@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
+PYTHON = @PYTHON@
+PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@
+PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
+PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@
+PYTHON_LDFLAGS = @PYTHON_LDFLAGS@
+PYTHON_PLATFORM = @PYTHON_PLATFORM@
+PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_SITE_PKG = @PYTHON_SITE_PKG@
+PYTHON_VERSION = @PYTHON_VERSION@
+RANLIB = @RANLIB@
+SDL_CFLAGS = @SDL_CFLAGS@
+SDL_CONFIG = @SDL_CONFIG@
+SDL_LIBS = @SDL_LIBS@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+XI2_1_CFLAGS = @XI2_1_CFLAGS@
+XI2_1_LIBS = @XI2_1_LIBS@
+XI2_2_CFLAGS = @XI2_2_CFLAGS@
+XI2_2_LIBS = @XI2_2_LIBS@
+XMKMF = @XMKMF@
+XML2_CFLAGS = @XML2_CFLAGS@
+XML2_CONFIG = @XML2_CONFIG@
+XML2_LIBS = @XML2_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+acx_pthread_config = @acx_pthread_config@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = $(pkgpyexecdir)/samples/firebirds/media
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+pkgpyexecdir = @pkgpyexecdir@
+pkgpythondir = @pkgpythondir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+pyexecdir = @pyexecdir@
+pythondir = @pythondir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+EXTRA_DIST = $(wildcard *.gif) $(wildcard *.png) $(wildcard *.jpg) \
+ $(wildcard *.mov) $(wildcard *.mp3)
+
+data_DATA = $(wildcard *.gif) $(wildcard *.png) $(wildcard *.jpg) \
+ $(wildcard *.mov) $(wildcard *.mp3)
+
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/samples/firebirds/media/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/samples/firebirds/media/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-dataDATA: $(data_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(datadir)" || $(MKDIR_P) "$(DESTDIR)$(datadir)"
+ @list='$(data_DATA)'; test -n "$(datadir)" || list=; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(datadir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(datadir)" || exit $$?; \
+ done
+
+uninstall-dataDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(data_DATA)'; test -n "$(datadir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ dir='$(DESTDIR)$(datadir)'; $(am__uninstall_files_from_dir)
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(DATA)
+installdirs:
+ for dir in "$(DESTDIR)$(datadir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-dataDATA
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-dataDATA
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ distclean distclean-generic distclean-libtool distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-dataDATA install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ uninstall uninstall-am uninstall-dataDATA
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/src/samples/firebirds/media/bullet.gif b/src/samples/firebirds/media/bullet.gif
new file mode 100644
index 0000000..ad1cca3
--- /dev/null
+++ b/src/samples/firebirds/media/bullet.gif
Binary files differ
diff --git a/src/samples/firebirds/media/bullet.mov b/src/samples/firebirds/media/bullet.mov
new file mode 100644
index 0000000..eac58d5
--- /dev/null
+++ b/src/samples/firebirds/media/bullet.mov
Binary files differ
diff --git a/src/samples/firebirds/media/bulletSound.mp3 b/src/samples/firebirds/media/bulletSound.mp3
new file mode 100644
index 0000000..2172667
--- /dev/null
+++ b/src/samples/firebirds/media/bulletSound.mp3
Binary files differ
diff --git a/src/samples/firebirds/media/enemy.gif b/src/samples/firebirds/media/enemy.gif
new file mode 100644
index 0000000..59cc1e2
--- /dev/null
+++ b/src/samples/firebirds/media/enemy.gif
Binary files differ
diff --git a/src/samples/firebirds/media/enemy.mov b/src/samples/firebirds/media/enemy.mov
new file mode 100644
index 0000000..8487095
--- /dev/null
+++ b/src/samples/firebirds/media/enemy.mov
Binary files differ
diff --git a/src/samples/firebirds/media/enemyDeath.mp3 b/src/samples/firebirds/media/enemyDeath.mp3
new file mode 100644
index 0000000..c5b0b67
--- /dev/null
+++ b/src/samples/firebirds/media/enemyDeath.mp3
Binary files differ
diff --git a/src/samples/firebirds/media/explosion.mov b/src/samples/firebirds/media/explosion.mov
new file mode 100644
index 0000000..a03f4e9
--- /dev/null
+++ b/src/samples/firebirds/media/explosion.mov
Binary files differ
diff --git a/src/samples/firebirds/media/flySound.mp3 b/src/samples/firebirds/media/flySound.mp3
new file mode 100644
index 0000000..bc83bf4
--- /dev/null
+++ b/src/samples/firebirds/media/flySound.mp3
Binary files differ
diff --git a/src/samples/firebirds/media/ground.jpg b/src/samples/firebirds/media/ground.jpg
new file mode 100644
index 0000000..2425fcc
--- /dev/null
+++ b/src/samples/firebirds/media/ground.jpg
Binary files differ
diff --git a/src/samples/firebirds/media/gui_frame.png b/src/samples/firebirds/media/gui_frame.png
new file mode 100644
index 0000000..414cb00
--- /dev/null
+++ b/src/samples/firebirds/media/gui_frame.png
Binary files differ
diff --git a/src/samples/firebirds/media/gui_heatbar_bg.png b/src/samples/firebirds/media/gui_heatbar_bg.png
new file mode 100644
index 0000000..3e330e2
--- /dev/null
+++ b/src/samples/firebirds/media/gui_heatbar_bg.png
Binary files differ
diff --git a/src/samples/firebirds/media/gui_heatbar_fg.png b/src/samples/firebirds/media/gui_heatbar_fg.png
new file mode 100644
index 0000000..fa79bb7
--- /dev/null
+++ b/src/samples/firebirds/media/gui_heatbar_fg.png
Binary files differ
diff --git a/src/samples/firebirds/media/gui_lives_bg.png b/src/samples/firebirds/media/gui_lives_bg.png
new file mode 100644
index 0000000..e206a9d
--- /dev/null
+++ b/src/samples/firebirds/media/gui_lives_bg.png
Binary files differ
diff --git a/src/samples/firebirds/media/gui_lives_fg.png b/src/samples/firebirds/media/gui_lives_fg.png
new file mode 100644
index 0000000..cdceba8
--- /dev/null
+++ b/src/samples/firebirds/media/gui_lives_fg.png
Binary files differ
diff --git a/src/samples/firebirds/media/gui_numbers.png b/src/samples/firebirds/media/gui_numbers.png
new file mode 100644
index 0000000..c567766
--- /dev/null
+++ b/src/samples/firebirds/media/gui_numbers.png
Binary files differ
diff --git a/src/samples/firebirds/media/spitfire.gif b/src/samples/firebirds/media/spitfire.gif
new file mode 100644
index 0000000..47976cc
--- /dev/null
+++ b/src/samples/firebirds/media/spitfire.gif
Binary files differ
diff --git a/src/samples/firebirds/media/spitfire.mov b/src/samples/firebirds/media/spitfire.mov
new file mode 100644
index 0000000..384cac2
--- /dev/null
+++ b/src/samples/firebirds/media/spitfire.mov
Binary files differ
diff --git a/src/samples/firebirds/plugin/CollisionDetector.cpp b/src/samples/firebirds/plugin/CollisionDetector.cpp
new file mode 100644
index 0000000..1eca5c9
--- /dev/null
+++ b/src/samples/firebirds/plugin/CollisionDetector.cpp
@@ -0,0 +1,122 @@
+#include "CollisionDetector.h"
+
+#include "../../../base/ScopeTimer.h"
+#include "../../../wrapper/WrapHelper.h"
+
+namespace avg {
+
+CollisionDetector::CollisionDetector(const Bitmap& bmpA, const Bitmap& bmpB)
+{
+ m_pBmpA = new Bitmap(bmpA.getSize(), B8G8R8A8);
+ m_pBmpA->copyPixels(bmpA);
+ m_pBmpB = new Bitmap(bmpB.getSize(), B8G8R8A8);
+ m_pBmpB->copyPixels(bmpB);
+}
+
+CollisionDetector::~CollisionDetector()
+{
+ delete m_pBmpA;
+ delete m_pBmpB;
+}
+
+static ProfilingZoneID CollisionDetectorProfilingZone("Detect collisions");
+
+bool CollisionDetector::detect(glm::vec2 posA, glm::vec2 posB)
+{
+ ScopeTimer Timer(CollisionDetectorProfilingZone);
+
+ int widthA = m_pBmpA->getSize().x;
+ int heightA = m_pBmpA->getSize().y;
+ int rightA = posA.x + widthA;
+ int bottomA = posA.y + heightA;
+ int widthB = m_pBmpB->getSize().x;
+ int heightB = m_pBmpB->getSize().y;
+ int rightB = posB.x + widthB;
+ int bottomB = posB.y + heightB;
+
+ // bounding box test
+ if (rightA <= posB.x || posA.x >= rightB || bottomA <= posB.y || posA.y >= bottomB) {
+ return false;
+ }
+
+ // pixel level test
+
+ // calculate x overlap
+ int dX = posB.x - posA.x;
+ if (dX < 0) {
+ posA.x = 0;
+ posB.x = -dX;
+ }
+ else {
+ posA.x = dX;
+ posB.x = 0;
+ }
+ int width;
+ dX = rightB - rightA;
+ if (dX < 0)
+ width = std::min(widthA + dX, widthB);
+ else
+ width = std::min(widthB - dX, widthA);
+ // calculate y overlap
+ int dY = posB.y - posA.y;
+ if (dY < 0) {
+ posA.y = 0;
+ posB.y = -dY;
+ }
+ else {
+ posA.y = dY;
+ posB.y = 0;
+ }
+ int height;
+ dY = bottomB - bottomA;
+ if (dY < 0)
+ height = std::min(heightA + dY, heightB);
+ else
+ height = std::min(heightB - dY, heightA);
+
+ // test alpha channels
+ const unsigned char* pPixStartA = m_pBmpA->getPixels() +
+ (int) posA.y * m_pBmpA->getStride() +
+ (int) posA.x * 4 + 3; // alpha channel of 1st A pixel
+ const unsigned char* pPixStartB = m_pBmpB->getPixels() +
+ (int) posB.y * m_pBmpB->getStride() +
+ (int) posB.x * 4 + 3; // alpha channel of 1st B pixel
+ const unsigned char* pPixA = pPixStartA;
+ const unsigned char* pPixB = pPixStartB;
+ for (int y = 0; y < height; y++) {
+ for (int x = 0; x < width; x++) {
+ if (*pPixA && *pPixB) {
+ return true; // both pixels have alpha > 0 --> collision
+ }
+ pPixA += 4;
+ pPixB += 4;
+ }
+ pPixA = pPixStartA + y * m_pBmpA->getStride();
+ pPixB = pPixStartB + y * m_pBmpB->getStride();
+ }
+
+ return false;
+}
+
+} // namespace avg
+
+
+using namespace boost::python;
+
+BOOST_PYTHON_MODULE(collisiondetector)
+{
+ class_<avg::CollisionDetector, boost::noncopyable>("CollisionDetector", no_init)
+ .def(init<avg::Bitmap&, avg::Bitmap&>())
+ .def("detect", &avg::CollisionDetector::detect)
+ ;
+}
+
+
+AVG_PLUGIN_API void registerPlugin()
+{
+ initcollisiondetector(); // created by BOOST_PYTHON_MODULE
+ object mainModule(handle<>(borrowed(PyImport_AddModule("__main__"))));
+ object collisiondetectorModule(handle<>(PyImport_ImportModule("collisiondetector")));
+ mainModule.attr("collisiondetector") = collisiondetectorModule;
+}
+
diff --git a/src/samples/firebirds/plugin/CollisionDetector.h b/src/samples/firebirds/plugin/CollisionDetector.h
new file mode 100644
index 0000000..7d477e2
--- /dev/null
+++ b/src/samples/firebirds/plugin/CollisionDetector.h
@@ -0,0 +1,28 @@
+#ifndef _COLLISION_DETECTOR_H_
+#define _COLLISION_DETECTOR_H_
+
+#define AVG_PLUGIN
+
+#include "../../../graphics/Bitmap.h"
+
+
+namespace avg {
+
+class CollisionDetector
+{
+public:
+ CollisionDetector(const Bitmap& bmpA, const Bitmap& bmpB);
+ ~CollisionDetector();
+
+ bool detect(glm::vec2 posA, glm::vec2 posB);
+
+private:
+ Bitmap* m_pBmpA;
+ Bitmap* m_pBmpB;
+};
+
+}
+
+
+#endif
+
diff --git a/src/samples/firebirds/plugin/Makefile.am b/src/samples/firebirds/plugin/Makefile.am
new file mode 100644
index 0000000..69a63db
--- /dev/null
+++ b/src/samples/firebirds/plugin/Makefile.am
@@ -0,0 +1,16 @@
+AM_CPPFLAGS = -I. @XML2_CFLAGS@ @PYTHON_CPPFLAGS@
+
+if APPLE
+ XGL_LIBS =
+ EXTRA_LDFLAGS = -read_only_relocs suppress
+else
+ XGL_LIBS = -lXxf86vm
+ EXTRA_LDFLAGS = -XCClinker ../../../wrapper/.libs/avg.so
+endif
+
+ALL_GL_LIBS = @GL_LIBS@ @SDL_LIBS@ $(XGL_LIBS)
+
+pkgplugindir = $(pkgpyexecdir)/samples/firebirds/plugin
+pkgplugin_LTLIBRARIES = collisiondetector.la
+collisiondetector_la_SOURCES = CollisionDetector.h CollisionDetector.cpp
+collisiondetector_la_LDFLAGS = $(EXTRA_LDFLAGS) -module
diff --git a/src/parport/Makefile.in b/src/samples/firebirds/plugin/Makefile.in
index bf5a31f..4a91fe1 100644
--- a/src/parport/Makefile.in
+++ b/src/samples/firebirds/plugin/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# Makefile.in generated by automake 1.11.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
-# Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -35,31 +35,63 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
-subdir = src/parport
+subdir = src/samples/firebirds/plugin
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ac_cxx_namespaces.m4 \
$(top_srcdir)/m4/ac_path_generic.m4 \
$(top_srcdir)/m4/ax_boost_thread.m4 \
- $(top_srcdir)/m4/ax_check_gl.m4 $(top_srcdir)/m4/libtool.m4 \
- $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
- $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
- $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/m4/python_dev.m4 \
- $(top_srcdir)/configure.in
+ $(top_srcdir)/m4/ax_check_gl.m4 \
+ $(top_srcdir)/m4/ax_python_devel.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/pkg.m4 \
+ $(top_srcdir)/m4/avg_version.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/src/avgconfig.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
-LTLIBRARIES = $(noinst_LTLIBRARIES)
-libparport_la_LIBADD =
-am__objects_1 =
-am_libparport_la_OBJECTS = ParPort.lo $(am__objects_1)
-libparport_la_OBJECTS = $(am_libparport_la_OBJECTS)
-AM_V_lt = $(am__v_lt_$(V))
-am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
+am__installdirs = "$(DESTDIR)$(pkgplugindir)"
+LTLIBRARIES = $(pkgplugin_LTLIBRARIES)
+collisiondetector_la_LIBADD =
+am_collisiondetector_la_OBJECTS = CollisionDetector.lo
+collisiondetector_la_OBJECTS = $(am_collisiondetector_la_OBJECTS)
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
am__v_lt_0 = --silent
+collisiondetector_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \
+ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \
+ $(AM_CXXFLAGS) $(CXXFLAGS) $(collisiondetector_la_LDFLAGS) \
+ $(LDFLAGS) -o $@
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@@ -70,18 +102,18 @@ LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CXXFLAGS) $(CXXFLAGS)
-AM_V_CXX = $(am__v_CXX_$(V))
-am__v_CXX_ = $(am__v_CXX_$(AM_DEFAULT_VERBOSITY))
+AM_V_CXX = $(am__v_CXX_@AM_V@)
+am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@)
am__v_CXX_0 = @echo " CXX " $@;
-AM_V_at = $(am__v_at_$(V))
-am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
CXXLD = $(CXX)
CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
$(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
-AM_V_CXXLD = $(am__v_CXXLD_$(V))
-am__v_CXXLD_ = $(am__v_CXXLD_$(AM_DEFAULT_VERBOSITY))
+AM_V_CXXLD = $(am__v_CXXLD_@AM_V@)
+am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@)
am__v_CXXLD_0 = @echo " CXXLD " $@;
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@@ -89,21 +121,21 @@ LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
-AM_V_CC = $(am__v_CC_$(V))
-am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
+AM_V_CC = $(am__v_CC_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
am__v_CC_0 = @echo " CC " $@;
CCLD = $(CC)
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
-AM_V_CCLD = $(am__v_CCLD_$(V))
-am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
-AM_V_GEN = $(am__v_GEN_$(V))
-am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
-SOURCES = $(libparport_la_SOURCES)
-DIST_SOURCES = $(libparport_la_SOURCES)
+SOURCES = $(collisiondetector_la_SOURCES)
+DIST_SOURCES = $(collisiondetector_la_SOURCES)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -116,7 +148,7 @@ AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BOOST_PYTHON_LIBS = @BOOST_PYTHON_LIBS@
-BOOST_THREAD_LIB = @BOOST_THREAD_LIB@
+BOOST_THREAD_LIBS = @BOOST_THREAD_LIBS@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
@@ -131,6 +163,7 @@ DC1394_2_CFLAGS = @DC1394_2_CFLAGS@
DC1394_2_LIBS = @DC1394_2_LIBS@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
@@ -171,6 +204,7 @@ LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
MTDEV_CFLAGS = @MTDEV_CFLAGS@
MTDEV_LIBS = @MTDEV_LIBS@
@@ -200,11 +234,13 @@ PTHREAD_CC = @PTHREAD_CC@
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
PTHREAD_LIBS = @PTHREAD_LIBS@
PYTHON = @PYTHON@
+PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@
PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
-PYTHON_INCLUDES = @PYTHON_INCLUDES@
-PYTHON_LIBS = @PYTHON_LIBS@
+PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@
+PYTHON_LDFLAGS = @PYTHON_LDFLAGS@
PYTHON_PLATFORM = @PYTHON_PLATFORM@
PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_SITE_PKG = @PYTHON_SITE_PKG@
PYTHON_VERSION = @PYTHON_VERSION@
RANLIB = @RANLIB@
SDL_CFLAGS = @SDL_CFLAGS@
@@ -227,6 +263,7 @@ abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
@@ -261,7 +298,6 @@ libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
@@ -285,10 +321,16 @@ target_vendor = @target_vendor@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-INCLUDES = -I.
-ALL_H = ParPort.h
-noinst_LTLIBRARIES = libparport.la
-libparport_la_SOURCES = ParPort.cpp $(ALL_H)
+AM_CPPFLAGS = -I. @XML2_CFLAGS@ @PYTHON_CPPFLAGS@
+@APPLE_FALSE@XGL_LIBS = -lXxf86vm
+@APPLE_TRUE@XGL_LIBS =
+@APPLE_FALSE@EXTRA_LDFLAGS = -XCClinker ../../../wrapper/.libs/avg.so
+@APPLE_TRUE@EXTRA_LDFLAGS = -read_only_relocs suppress
+ALL_GL_LIBS = @GL_LIBS@ @SDL_LIBS@ $(XGL_LIBS)
+pkgplugindir = $(pkgpyexecdir)/samples/firebirds/plugin
+pkgplugin_LTLIBRARIES = collisiondetector.la
+collisiondetector_la_SOURCES = CollisionDetector.h CollisionDetector.cpp
+collisiondetector_la_LDFLAGS = $(EXTRA_LDFLAGS) -module
all: all-am
.SUFFIXES:
@@ -302,9 +344,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/parport/Makefile'; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/samples/firebirds/plugin/Makefile'; \
$(am__cd) $(top_srcdir) && \
- $(AUTOMAKE) --foreign src/parport/Makefile
+ $(AUTOMAKE) --foreign src/samples/firebirds/plugin/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
@@ -323,17 +365,39 @@ $(top_srcdir)/configure: $(am__configure_deps)
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
+install-pkgpluginLTLIBRARIES: $(pkgplugin_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(pkgplugindir)" || $(MKDIR_P) "$(DESTDIR)$(pkgplugindir)"
+ @list='$(pkgplugin_LTLIBRARIES)'; test -n "$(pkgplugindir)" || list=; \
+ list2=; for p in $$list; do \
+ if test -f $$p; then \
+ list2="$$list2 $$p"; \
+ else :; fi; \
+ done; \
+ test -z "$$list2" || { \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkgplugindir)'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkgplugindir)"; \
+ }
+
+uninstall-pkgpluginLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(pkgplugin_LTLIBRARIES)'; test -n "$(pkgplugindir)" || list=; \
+ for p in $$list; do \
+ $(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkgplugindir)/$$f'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkgplugindir)/$$f"; \
+ done
-clean-noinstLTLIBRARIES:
- -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
- @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
+clean-pkgpluginLTLIBRARIES:
+ -test -z "$(pkgplugin_LTLIBRARIES)" || rm -f $(pkgplugin_LTLIBRARIES)
+ @list='$(pkgplugin_LTLIBRARIES)'; for p in $$list; do \
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
test "$$dir" != "$$p" || dir=.; \
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
-libparport.la: $(libparport_la_OBJECTS) $(libparport_la_DEPENDENCIES)
- $(AM_V_CXXLD)$(CXXLINK) $(libparport_la_OBJECTS) $(libparport_la_LIBADD) $(LIBS)
+collisiondetector.la: $(collisiondetector_la_OBJECTS) $(collisiondetector_la_DEPENDENCIES) $(EXTRA_collisiondetector_la_DEPENDENCIES)
+ $(AM_V_CXXLD)$(collisiondetector_la_LINK) -rpath $(pkgplugindir) $(collisiondetector_la_OBJECTS) $(collisiondetector_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
@@ -341,31 +405,28 @@ mostlyclean-compile:
distclean-compile:
-rm -f *.tab.c
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ParPort.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CollisionDetector.Plo@am__quote@
.cpp.o:
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $<
.cpp.obj:
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
.cpp.lo:
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
-@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
@@ -459,6 +520,9 @@ check-am: all-am
check: check-am
all-am: Makefile $(LTLIBRARIES)
installdirs:
+ for dir in "$(DESTDIR)$(pkgplugindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
@@ -469,10 +533,15 @@ install-am: all-am
installcheck: installcheck-am
install-strip:
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- `test -z '$(STRIP)' || \
- echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
mostlyclean-generic:
clean-generic:
@@ -486,7 +555,7 @@ maintainer-clean-generic:
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
-clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
+clean-am: clean-generic clean-libtool clean-pkgpluginLTLIBRARIES \
mostlyclean-am
distclean: distclean-am
@@ -507,7 +576,7 @@ info: info-am
info-am:
-install-data-am:
+install-data-am: install-pkgpluginLTLIBRARIES
install-dvi: install-dvi-am
@@ -553,22 +622,23 @@ ps: ps-am
ps-am:
-uninstall-am:
+uninstall-am: uninstall-pkgpluginLTLIBRARIES
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
- clean-libtool clean-noinstLTLIBRARIES ctags distclean \
+ clean-libtool clean-pkgpluginLTLIBRARIES ctags distclean \
distclean-compile distclean-generic distclean-libtool \
distclean-tags distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am install-man \
- install-pdf install-pdf-am install-ps install-ps-am \
- install-strip installcheck installcheck-am installdirs \
- maintainer-clean maintainer-clean-generic mostlyclean \
- mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
- pdf pdf-am ps ps-am tags uninstall uninstall-am
+ install-pdf install-pdf-am install-pkgpluginLTLIBRARIES \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-pkgpluginLTLIBRARIES
# Tell versions [3.59,3.63) of GNU make to not export all variables.
diff --git a/src/samples/flashmessages.py b/src/samples/flashmessages.py
new file mode 100644
index 0000000..25c11d1
--- /dev/null
+++ b/src/samples/flashmessages.py
@@ -0,0 +1,58 @@
+#!/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
+#
+# Original author of this file is OXullo Interecans <x at brainrapers dot org>
+# Sponsored by Archimedes Exhibitions GmbH ( http://www.archimedes-exhibitions.de )
+
+
+import libavg
+from libavg import app
+
+
+class MyScene(app.MainDiv):
+ def onInit(self):
+ # This message is displayed immediately
+ app.flashmessage.FlashMessage('helloworld! this message will disappear in a bit')
+
+ # Displayed when the 'v' key is pressed, again a simple flash message
+ app.keyboardmanager.bindKeyDown('v',
+ lambda: app.flashmessage.FlashMessage('v key pressed'), 'Test me')
+
+ # This message shows the message in a different color and sends the text to
+ # the logger as well
+ app.keyboardmanager.bindKeyDown('b',
+ lambda: app.flashmessage.FlashMessage('this is an error', isError=True),
+ 'Test me too')
+
+ # This message disappears when it's acknowledged with a mouse click
+ app.keyboardmanager.bindKeyDown('n',
+ lambda: app.flashmessage.FlashMessage('persistent, click here to dismiss',
+ acknowledge=True),
+ 'Test me too again')
+
+ libavg.avg.WordsNode(parent=self, pos=(10, 50), fontsize=20,
+ text='Press the keys: v, b, n')
+
+
+if __name__ == '__main__':
+ app.App().run(MyScene())
+
diff --git a/src/samples/fontstyle.py b/src/samples/fontstyle.py
new file mode 100755
index 0000000..c6707a4
--- /dev/null
+++ b/src/samples/fontstyle.py
@@ -0,0 +1,23 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+from libavg import avg, player
+
+BASE_STYLE = avg.FontStyle(font='Arial', variant='Regular', fontsize=14, linespacing=2)
+HEADER_STYLE = avg.FontStyle(basestyle=BASE_STYLE, variant='Bold', color='FF0000')
+
+SAMPLE_TEXT="""
+Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin vitae gravida urna. Nam ut nisi ac nulla venenatis tincidunt a in urna. Cras vel enim purus, sit amet adipiscing dolor. Aliquam tincidunt interdum velit sed hendrerit. Proin ut enim dolor, sit amet egestas mi. Aenean felis quam, sollicitudin sed tempus in, pharetra eget turpis.
+"""
+
+canvas = player.createMainCanvas(size=(640, 480))
+rootNode = canvas.getRootNode()
+
+avg.WordsNode(pos=(50, 50), text='Lorem Ipsum', fontstyle=HEADER_STYLE, parent=rootNode)
+avg.WordsNode(pos=(50, 70), text='Lorem Ipsum', fontstyle=HEADER_STYLE, variant='Italic',
+ parent=rootNode)
+avg.WordsNode(pos=(50, 90), text=SAMPLE_TEXT, width=400, fontstyle=BASE_STYLE,
+ parent=rootNode)
+
+player.play()
+
diff --git a/src/samples/gestures.py b/src/samples/gestures.py
index 447691d..9b4a0be 100755
--- a/src/samples/gestures.py
+++ b/src/samples/gestures.py
@@ -1,8 +1,7 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-from libavg import avg, ui
-import libavg
+from libavg import avg, gesture, app
RESOLUTION = avg.Point2D(800, 600)
@@ -23,8 +22,11 @@ def moveNodeOnScreen(node):
class TextRect(avg.DivNode):
- def __init__(self, text, **kwargs):
- avg.DivNode.__init__(self, size=(150,40), **kwargs)
+ def __init__(self, text, parent=None, **kwargs):
+ super(TextRect, self).__init__(size=(150,40), **kwargs)
+ if parent:
+ parent.appendChild(self)
+
self.rect = avg.RectNode(size=self.size, fillopacity=1, fillcolor="000000",
color="FFFFFF", parent=self)
self.words = avg.WordsNode(color="FFFFFF", text=text, alignment="center",
@@ -44,11 +46,11 @@ class TextRect(avg.DivNode):
class TransformNode(TextRect):
def __init__(self, text, ignoreScale, ignoreRotation, friction=-1, **kwargs):
- TextRect.__init__(self, text, **kwargs)
+ super(TransformNode, self).__init__(text, **kwargs)
self.__ignoreScale = ignoreScale
self.__ignoreRotation = ignoreRotation
- ui.TransformRecognizer(
+ self.recognizer = gesture.TransformRecognizer(
eventNode=self,
detectedHandler=self.__onDetected,
moveHandler=self.__onMove,
@@ -56,7 +58,7 @@ class TransformNode(TextRect):
friction=friction
)
- def __onDetected(self, event):
+ def __onDetected(self):
moveNodeToTop(self)
def __onMove(self, transform):
@@ -72,22 +74,25 @@ class TransformNode(TextRect):
class TransformChildNode(avg.DivNode):
- def __init__(self, text, **kwargs):
- avg.DivNode.__init__(self, **kwargs)
+ def __init__(self, text, parent=None, **kwargs):
+ super(TransformChildNode, self).__init__( **kwargs)
+ if parent:
+ parent.appendChild(self)
+
self.textRect = TextRect(text, parent=self)
self.size = self.textRect.size
self.inputNode = avg.RectNode(size=(self.size.x, self.size.y/2),
fillopacity=0.5, fillcolor="808080", strokewidth=0, parent=self)
- ui.TransformRecognizer(
+ self.recognizer = gesture.TransformRecognizer(
eventNode=self.inputNode,
coordSysNode=self,
detectedHandler=self.__onDetected,
moveHandler=self.__onMove,
friction=0.05
)
-
- def __onDetected(self, event):
+
+ def __onDetected(self):
moveNodeToTop(self)
def __onMove(self, transform):
@@ -99,9 +104,9 @@ class TransformChildNode(avg.DivNode):
class DragNode(TextRect):
def __init__(self, text, friction=-1, **kwargs):
- TextRect.__init__(self, text, **kwargs)
-
- ui.DragRecognizer(
+ super(DragNode, self).__init__(text, **kwargs)
+
+ self.recognizer = gesture.DragRecognizer(
eventNode=self,
detectedHandler=self.__onDetected,
moveHandler=self.__onMove,
@@ -110,74 +115,100 @@ class DragNode(TextRect):
friction=friction
)
- def __onDetected(self, event):
+ def __onDetected(self):
self.__dragStartPos = self.pos
moveNodeToTop(self)
- def __onMove(self, event, offset):
+ def __onMove(self, offset):
self.pos = self.__dragStartPos + offset
moveNodeOnScreen(self)
- def __onEnd(self, event):
+ def __onEnd(self):
pass
class ConstrainedDragNode(TextRect):
def __init__(self, text, friction=-1, **kwargs):
- TextRect.__init__(self, text, **kwargs)
-
- ui.DragRecognizer(
+ super(ConstrainedDragNode, self).__init__(text, **kwargs)
+
+ self.recognizer = gesture.DragRecognizer(
eventNode=self,
detectedHandler=self.__onDetected,
moveHandler=self.__onHorizMove,
upHandler=self.__onHorizMove,
- direction=ui.DragRecognizer.HORIZONTAL,
+ direction=gesture.DragRecognizer.HORIZONTAL,
friction=0.05
)
-
- ui.DragRecognizer(
+
+ self.recognizer2 = gesture.DragRecognizer(
eventNode=self,
detectedHandler=self.__onDetected,
moveHandler=self.__onVertMove,
upHandler=self.__onVertMove,
- direction=ui.DragRecognizer.VERTICAL,
+ direction=gesture.DragRecognizer.VERTICAL,
friction=0.05
)
-
- def __onDetected(self, event):
+
+ def __onDetected(self):
self.__dragStartPos = self.pos
moveNodeToTop(self)
- def __onHorizMove(self, event, offset):
+ def __onHorizMove(self, offset):
self.pos = self.__dragStartPos + (offset.x, 0)
moveNodeOnScreen(self)
- def __onVertMove(self, event, offset):
- self.pos = self.__dragStartPos + offset
+ def __onVertMove(self, offset):
+ self.pos = self.__dragStartPos + (0, offset.y)
moveNodeOnScreen(self)
class TapNode(TextRect):
def __init__(self, text, isDoubleTap, **kwargs):
- TextRect.__init__(self, text, **kwargs)
-
+ super(TapNode, self).__init__(text, **kwargs)
+
if isDoubleTap:
- ui.DoubletapRecognizer(node=self, possibleHandler=self.__onPossible,
- detectedHandler=self.__onDetected, failHandler=self.__onFail)
+ self.recognizer = gesture.DoubletapRecognizer(node=self,
+ possibleHandler=self.__onPossible, detectedHandler=self.__onDetected,
+ failHandler=self.__onFail)
else:
- ui.TapRecognizer(node=self, possibleHandler=self.__onPossible,
- detectedHandler=self.__onDetected, failHandler=self.__onFail)
+ self.recognizer = gesture.TapRecognizer(node=self,
+ possibleHandler=self.__onPossible, detectedHandler=self.__onDetected,
+ failHandler=self.__onFail)
+
+ def __onPossible(self):
+ self.rect.fillcolor = "FFFFFF"
+ self.words.color = "000000"
+
+ def __onDetected(self):
+ self.rect.fillcolor = "000000"
+ self.words.color = "FFFFFF"
+ self.rect.color = "00FF00"
+
+ def __onFail(self):
+ self.rect.fillcolor = "000000"
+ self.words.color = "FFFFFF"
+ self.rect.color = "FF0000"
+
- def __onPossible(self, event):
+class SwipeNode(TextRect):
+ def __init__(self, text, numContacts, **kwargs):
+ super(SwipeNode, self).__init__(text, **kwargs)
+
+ self.recognizer = gesture.SwipeRecognizer(node=self, minDist=25,
+ numContacts=numContacts, direction=gesture.SwipeRecognizer.RIGHT,
+ possibleHandler=self.__onPossible, detectedHandler=self.__onDetected,
+ failHandler=self.__onFail)
+
+ def __onPossible(self):
self.rect.fillcolor = "FFFFFF"
self.words.color = "000000"
- def __onDetected(self, event):
+ def __onDetected(self):
self.rect.fillcolor = "000000"
self.words.color = "FFFFFF"
self.rect.color = "00FF00"
- def __onFail(self, event):
+ def __onFail(self):
self.rect.fillcolor = "000000"
self.words.color = "FFFFFF"
self.rect.color = "FF0000"
@@ -185,72 +216,72 @@ class TapNode(TextRect):
class HoldNode(TextRect):
def __init__(self, text, **kwargs):
- TextRect.__init__(self, text, **kwargs)
-
- ui.HoldRecognizer(node=self, possibleHandler=self.__onPossible,
- detectedHandler=self.__onDetected, failHandler=self.__onFail,
- stopHandler=self.__onStop)
+ super(HoldNode, self).__init__(text, **kwargs)
- def __onPossible(self, event):
+ self.recognizer = gesture.HoldRecognizer(node=self,
+ possibleHandler=self.__onPossible, detectedHandler=self.__onDetected,
+ failHandler=self.__onFail, stopHandler=self.__onStop)
+
+ def __onPossible(self):
self.rect.fillcolor = "FFFFFF"
self.rect.color = "FFFFFF"
self.words.color = "000000"
- def __onDetected(self, event):
+ def __onDetected(self):
self.rect.fillcolor = "000000"
self.words.color = "FFFFFF"
self.rect.color = "00FF00"
- def __onFail(self, event):
+ def __onFail(self):
self.rect.fillcolor = "000000"
self.words.color = "FFFFFF"
self.rect.color = "FF0000"
- def __onStop(self, event):
+ def __onStop(self):
self.rect.fillcolor = "000000"
self.rect.color = "FFFFFF"
self.words.color = "FFFFFF"
-class GestureDemoApp(libavg.AVGApp):
- multitouch = True
+class GestureDemoDiv(app.MainDiv):
- def init(self):
+ def onInit(self):
TransformNode(text="TransformRecognizer",
- ignoreRotation=False, ignoreScale=False,
- pos=(20,20), parent=self._parentNode)
+ ignoreRotation=False, ignoreScale=False, pos=(20,20), parent=self)
TransformNode(text="TransformRecognizer<br/>ignoreRotation",
- ignoreRotation=True, ignoreScale=False,
- pos=(20,70), parent=self._parentNode)
+ ignoreRotation=True, ignoreScale=False, pos=(20,70), parent=self)
TransformNode(text="TransformRecognizer<br/>ignoreScale",
- ignoreRotation=False, ignoreScale=True,
- pos=(20,120), parent=self._parentNode)
+ ignoreRotation=False, ignoreScale=True, pos=(20,120), parent=self)
TransformNode(text="TransformRecognizer<br/>friction",
ignoreRotation=False, ignoreScale=False,
- pos=(20,170), friction=0.02, parent=self._parentNode)
+ pos=(20,170), friction=0.02, parent=self)
TransformChildNode(text="TransformRecognizer<br/>child dragger",
- pos=(20,220), parent=self._parentNode)
+ pos=(20,220), parent=self)
- DragNode(text="DragRecognizer", pos=(200,20), parent=self._parentNode)
+ DragNode(text="DragRecognizer", pos=(200,20), parent=self)
- DragNode(text="DragRecognizer<br/>friction", pos=(200,70), friction=0.05,
- parent=self._parentNode)
+ DragNode(text="DragRecognizer<br/>friction", pos=(200,70), friction=0.01,
+ parent=self)
ConstrainedDragNode(text="DragRecognizer<br/>constrained", pos=(200,120),
- parent=self._parentNode)
+ friction=0.01, parent=self)
+
+ TapNode(text="TapRecognizer", pos=(380,20), isDoubleTap=False, parent=self)
+
+ TapNode(text="DoubletapRecognizer", pos=(380,70), isDoubleTap=True, parent=self)
- TapNode(text="TapRecognizer", pos=(380,20), isDoubleTap=False,
- parent=self._parentNode)
+ HoldNode(text="HoldRecognizer", pos=(380,120), parent=self)
- TapNode(text="DoubletapRecognizer", pos=(380,70), isDoubleTap=True,
- parent=self._parentNode)
+ SwipeNode(text="SwipeRecognizer<br/>(Right)", pos=(380,170),
+ numContacts=1, parent=self)
- HoldNode(text="HoldRecognizer", pos=(380,120), parent=self._parentNode)
+ SwipeNode(text="SwipeRecognizer<br/>(Right, 2 fingers)", pos=(380,220),
+ numContacts=2, parent=self)
if __name__ == '__main__':
- GestureDemoApp.start(resolution=RESOLUTION)
+ app.App().run(GestureDemoDiv(), app_resolution="800,600")
diff --git a/src/samples/globalcoords.avg b/src/samples/globalcoords.avg
deleted file mode 100644
index e7dd70c..0000000
--- a/src/samples/globalcoords.avg
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0"?>
-<avg width="160" height="120">
- <image href="rgb24-64x64.png" pos="(40, 30)" size="(80, 60)"/>
-</avg>
diff --git a/src/samples/globalcoords.py b/src/samples/globalcoords.py
new file mode 100755
index 0000000..be95bb2
--- /dev/null
+++ b/src/samples/globalcoords.py
@@ -0,0 +1,9 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+from libavg import avg, player
+
+canvas = player.createMainCanvas(size=(160,120))
+rootNode = canvas.getRootNode()
+avg.ImageNode(pos=(40,30), size=(80,60), href="rgb24-64x64.png", parent=rootNode)
+player.play()
diff --git a/src/samples/gpuhuefx.py b/src/samples/gpuhuefx.py
deleted file mode 100755
index 4188406..0000000
--- a/src/samples/gpuhuefx.py
+++ /dev/null
@@ -1,77 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-# libavg - Media Playback Engine.
-# Copyright (C) 2003-2011 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
-
-from libavg import avg, AVGApp
-from libavg.avg import ImageNode
-
-g_Player = avg.Player.get()
-
-class HSL(AVGApp):
-
- multiTouch = False
-
- def init(self):
- rootNode = g_Player.getRootNode()
-
- background = ImageNode(parent=rootNode, href='../graphics/testfiles/hsl.png',
- size=(640,640))
- self.hsl_fx = avg.HueSatFXNode()
- background.setEffect(self.hsl_fx)
- self.sat = avg.WordsNode(pos=(800, 200), text="Sat: " +
- str(self.hsl_fx.saturation), parent=rootNode)
- self.light = avg.WordsNode(pos=(800, 250), text= "Bright" +
- str(self.hsl_fx.lightness), parent=rootNode)
- self.colorize = avg.WordsNode(pos=(800, 300), text="Colorized: " +
- str(self.hsl_fx.colorize), parent=rootNode)
- self.hue = avg.WordsNode(pos=(800, 350), text="Hue: " +
- str(self.hsl_fx.hue), parent=rootNode)
- rootNode.connectEventHandler(avg.KEYDOWN, avg.NONE, self,
- self.__onKeyDown)
- g_Player.setOnFrameHandler(self._increaseHue)
-
- def __onKeyDown(self, event):
- if event.keystring == 'v':
- self.hsl_fx.saturation -= 10
- elif event.keystring == 'b':
- self.hsl_fx.saturation += 10
- elif event.keystring == 'n':
- self.hsl_fx.lightness += 10
- elif event.keystring == 'k':
- self.hsl_fx.lightness -= 10
- elif event.keystring == 'h':
- self.hsl_fx.hue += 10
- elif event.keystring == 'g':
- self.hsl_fx.hue -= 10
- elif event.keystring == 'c':
- self.hsl_fx.colorize = not(self.hsl_fx.colorize)
- self.sat.text = "Sat: " + str(self.hsl_fx.saturation)
- self.light.text = "Bright: " + str(self.hsl_fx.lightness)
- self.colorize.text = "Colorized: " + str(self.hsl_fx.colorize)
- self.hue.text = "Hue: " + str(self.hsl_fx.hue)
-
- def _increaseHue(self):
- self.hsl_fx.hue += 1
- self.hue.text = "Hue: " + str(self.hsl_fx.hue)
-
-if __name__ == '__main__':
- HSL.start(resolution=(1000,800),debugWindowSize=(800,600))
-
diff --git a/src/samples/invertfx.py b/src/samples/invertfx.py
index 40d2ae6..039a99a 100644..100755
--- a/src/samples/invertfx.py
+++ b/src/samples/invertfx.py
@@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
# libavg - Media Playback Engine.
-# Copyright (C) 2003-2011 Ulrich von Zadow
+# 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
@@ -20,23 +20,16 @@
#
# Current versions can be found at www.libavg.de
-from libavg import avg, AVGApp
-from libavg.avg import ImageNode
+from libavg import avg, app
-g_Player = avg.Player.get()
-
-class INVERT(AVGApp):
-
- multiTouch = False
-
- def init(self):
- rootNode = g_Player.getRootNode()
-
- orig = ImageNode(parent = rootNode, href='../graphics/testfiles/hsl.png')
- invert = ImageNode(parent = rootNode, href='../graphics/testfiles/hsl.png',
+class Invert(app.MainDiv):
+ def onInit(self):
+ orig = avg.ImageNode(parent=self, href='../test/media/hsl.png')
+ invert = avg.ImageNode(parent=self, href='../test/media/hsl.png',
pos=(orig.size.x+10, 0))
invert.setEffect(avg.InvertFXNode())
+
if __name__ == '__main__':
- INVERT.start(resolution=(200,200),debugWindowSize=(200,200))
+ app.App().run(Invert(), app_resolution='200x200')
diff --git a/src/samples/localcoords.avg b/src/samples/localcoords.avg
deleted file mode 100644
index bea628c..0000000
--- a/src/samples/localcoords.avg
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0"?>
-<avg width="160" height="120">
- <div pos="(40, 30)">
- <image href="rgb24-64x64.png" pos="(40, 30)" size="(80, 60)"/>
- </div>
-</avg>
-
diff --git a/src/samples/localcoords.py b/src/samples/localcoords.py
new file mode 100755
index 0000000..f40b63f
--- /dev/null
+++ b/src/samples/localcoords.py
@@ -0,0 +1,10 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+from libavg import avg, player
+
+canvas = player.createMainCanvas(size=(160,120))
+rootNode = canvas.getRootNode()
+divNode = avg.DivNode(pos=(40,30), parent=rootNode)
+avg.ImageNode(pos=(40,30), size=(80,60), href="rgb24-64x64.png", parent=divNode)
+player.play()
diff --git a/src/samples/localcoordsrot.avg b/src/samples/localcoordsrot.avg
deleted file mode 100644
index 69a6564..0000000
--- a/src/samples/localcoordsrot.avg
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0"?>
-<avg width="160" height="120">
- <div pos="(120, 30)" pivot="(0,0)" angle="1.570">
- <image href="rgb24-64x64.png" pos="(40, 30)" size="(40, 30)"/>
- </div>
-</avg>
-
diff --git a/src/samples/localcoordsrot.py b/src/samples/localcoordsrot.py
new file mode 100755
index 0000000..0cefadd
--- /dev/null
+++ b/src/samples/localcoordsrot.py
@@ -0,0 +1,11 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+from libavg import avg, player
+
+canvas = player.createMainCanvas(size=(160,120))
+rootNode = canvas.getRootNode()
+divNode = avg.DivNode(pos=(120,30), pivot=(0,0), angle=1.570, parent=rootNode)
+avg.ImageNode(pos=(40,30), size=(40,30), href="rgb24-64x64.png", parent=divNode)
+player.play()
+
diff --git a/src/samples/logsample.py b/src/samples/logsample.py
new file mode 100755
index 0000000..0436c4f
--- /dev/null
+++ b/src/samples/logsample.py
@@ -0,0 +1,55 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import logging
+
+from libavg import avg, app
+
+# Setup Python Logger
+hdlr = logging.StreamHandler()
+# category is added as an extra formatting key by libavg
+formatter = logging.Formatter('[%(asctime)s][%(levelname)s][%(category)s] : %(message)s')
+hdlr.setFormatter(formatter)
+pyLogger = logging.getLogger(__name__)
+pyLogger.addHandler(hdlr)
+pyLogger.propagate = False
+pyLogger.level = logging.DEBUG
+
+
+class LoggingTest(app.MainDiv):
+ def onInit(self):
+ # Add the python logger to libavgs logger as a message sink
+ avg.logger.removeStdLogSink()
+ avg.logger.addSink(pyLogger)
+
+ avg.logger.debug("Hidden, unless AVG_LOG_CATEGORIES configured with APP:DEBUG")
+
+ avg.logger.configureCategory(avg.logger.Category.APP, avg.logger.Severity.INFO)
+ avg.logger.log("Custom Info level message", avg.logger.Category.APP,
+ avg.logger.Severity.INFO)
+
+ avg.logger.info("Info level message, with APP Category")
+ avg.logger.warning("Warn level message, with APP Category")
+
+ #Remove the logSink, no message should be logged now, if run with
+ #AVG_LOG_OMIT_STDERR=1
+ #avg.logger.removeSink(logging.getLogger("MY_APP"))
+
+ avg.logger.error("std::err - Error")
+ avg.logger.critical("std::err - Critical")
+ avg.logger.log("std::err - Log")
+
+ #Register custom log category
+ CUSTOM_LOG_CAT = avg.logger.configureCategory("My Custom Category",
+ avg.logger.Severity.INFO)
+
+ #Log with custom log category
+ avg.logger.log("Message with custom category", CUSTOM_LOG_CAT)
+ avg.logger.debug("Hidden message", CUSTOM_LOG_CAT)
+ avg.logger.configureCategory(CUSTOM_LOG_CAT, avg.logger.Severity.DBG)
+ avg.logger.debug("This will show up", CUSTOM_LOG_CAT)
+
+
+if __name__ == '__main__':
+ app.App().run(LoggingTest(), app_resolution='140x140')
+
diff --git a/src/samples/mesh.py b/src/samples/mesh.py
index 8ea8d03..8f18de1 100755
--- a/src/samples/mesh.py
+++ b/src/samples/mesh.py
@@ -1,18 +1,13 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-from libavg import avg
+from libavg import avg, player
-player = avg.Player.get()
-
-player.loadString("""
-<avg width="160" height="120"/>
-""")
-mesh = avg.MeshNode(texhref="rgb24-64x64.png",
+canvas = player.createMainCanvas(size=(160,120))
+avg.MeshNode(texhref="rgb24-64x64.png",
vertexcoords=((0,0), (64,0), (0,64), (64, 64), (32, 32)),
texcoords=((0,0), (1,0), (0,1), (1,1), (0.5,0.5)),
- triangles=((0,1,4), (1,3,4), (3,2,4), (2,0,4)))
-player.getRootNode().appendChild(mesh)
-player.setResolution(0,640,0,0)
+ triangles=((0,1,4), (1,3,4), (3,2,4), (2,0,4)),
+ parent=player.getRootNode())
player.play()
diff --git a/src/samples/minimal.py b/src/samples/minimal.py
index 971de97..bc57f21 100755
--- a/src/samples/minimal.py
+++ b/src/samples/minimal.py
@@ -1,8 +1,9 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-from libavg import avg
+from libavg import avg, player
-player = avg.Player.get()
-player.loadFile("text.avg")
+canvas = player.createMainCanvas(size=(640,480))
+rootNode = canvas.getRootNode()
+avg.WordsNode(pos=(10,10), text="Hello World", parent=rootNode)
player.play()
diff --git a/src/samples/plugin.py b/src/samples/plugin.py
index 0d5084e..6aa7100 100755
--- a/src/samples/plugin.py
+++ b/src/samples/plugin.py
@@ -1,17 +1,15 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-from libavg import avg
+from libavg import player
-player = avg.Player.get()
-
-player.loadString("""<avg width="160" height="120" id="container" />""")
+canvas = player.createMainCanvas(size=(160,120))
# Change following line if the plugin is somewhere else.
player.pluginPath = "../test/plugin/.libs"
-player.loadPlugin("libColorNode")
+player.loadPlugin("colorplugin")
-node = player.createNode('<colornode fillcolor="0f3f7f" id="mynode" />')
-player.getElementByID("container").appendChild(node)
-mynode = player.getElementByID("mynode")
-mynode.fillcolor = "7f007f"
+rootNode = canvas.getRootNode()
+node = colorplugin.ColorNode(fillcolor="7f7f00", parent=rootNode)
+node.fillcolor = "7f007f"
player.play()
+
diff --git a/src/samples/rotcustompivot.avg b/src/samples/rotcustompivot.avg
deleted file mode 100644
index 62cf9db..0000000
--- a/src/samples/rotcustompivot.avg
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0"?>
-<avg width="160" height="120">
- <image href="rgb24-64x64.png" pos="(80, 30)" size="(40, 30)" angle="1.570" pivot="(0,0)"/>
-</avg>
-
diff --git a/src/samples/rotcustompivot.py b/src/samples/rotcustompivot.py
new file mode 100755
index 0000000..b4765a6
--- /dev/null
+++ b/src/samples/rotcustompivot.py
@@ -0,0 +1,11 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+from libavg import avg, player
+
+canvas = player.createMainCanvas(size=(160,120))
+rootNode = canvas.getRootNode()
+avg.ImageNode(pos=(80,30), size=(40,30), href="rgb24-64x64.png", angle=1.570, pivot=(0,0),
+ parent=rootNode)
+player.play()
+
diff --git a/src/samples/rotdefaultpivot.avg b/src/samples/rotdefaultpivot.avg
deleted file mode 100644
index 3e802cc..0000000
--- a/src/samples/rotdefaultpivot.avg
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0"?>
-<avg width="160" height="120">
- <image href="rgb24-64x64.png" pos="(40, 30)" size="(80, 60)" angle="1.570"/>
-</avg>
-
diff --git a/src/samples/rotdefaultpivot.py b/src/samples/rotdefaultpivot.py
new file mode 100755
index 0000000..99f1826
--- /dev/null
+++ b/src/samples/rotdefaultpivot.py
@@ -0,0 +1,11 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+from libavg import avg, player
+
+canvas = player.createMainCanvas(size=(160,120))
+rootNode = canvas.getRootNode()
+avg.ImageNode(pos=(40,30), size=(80,60), href="rgb24-64x64.png", angle=1.570,
+ parent=rootNode)
+player.play()
+
diff --git a/src/samples/sampleapp.py b/src/samples/sampleapp.py
deleted file mode 100755
index fb7af6a..0000000
--- a/src/samples/sampleapp.py
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-from libavg import avg, AVGApp, utils, anim
-from libavg.utils import getMediaDir
-
-# usually you need the Player in many places, so it's useful
-# to keep it in a global variable (it's a singleton anyway).
-g_Player = avg.Player.get()
-
-class HelloWorld(AVGApp):
- def init(self):
- # Put all your nodes in the hierarchy below self._parentNode
- self.node = avg.WordsNode(pos=(50,50), text="Hello World",
- parent=self._parentNode)
-
- def _enter(self):
- # You should start and stop all animations, intervals etc.
- # in _enter and _leave, so your application uses only
- # minimal resources while it is not running.
- self.anim = anim.ContinuousAnim(self.node, 'angle', 0, 3.14)
- self.anim.start()
-
- def _leave(self):
- self.anim.abort()
- self.anim = None
-
-HelloWorld.start(resolution=(640, 480))
-
diff --git a/src/samples/showvideo.py b/src/samples/showvideo.py
index 126deec..571034b 100755
--- a/src/samples/showvideo.py
+++ b/src/samples/showvideo.py
@@ -1,16 +1,14 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-from libavg import *
+from libavg import avg, app
import sys
-g_Player = avg.Player.get()
-
-class VideoApp(AVGApp):
+class VideoPlayer(app.MainDiv):
def init(self):
- self.videoNode = VideoNode(
+ self.videoNode = avg.VideoNode(
href=sys.argv[1],
- parent=self._parentNode)
+ parent=self)
self.videoNode.play()
-VideoApp.start(resolution=(1920, 1080), debugWindowSize=(720, 450))
+app.App().run(VideoPlayer(), app_resolution='1920x1080', app_window_size='720x450')
diff --git a/src/samples/slideshow.py b/src/samples/slideshow.py
new file mode 100755
index 0000000..98704d0
--- /dev/null
+++ b/src/samples/slideshow.py
@@ -0,0 +1,159 @@
+#!/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
+#
+# Original author of this file: Thomas Schott <scotty@c-base.org>
+#
+
+"""
+Image slideshow example which shows all images found in the current working
+directory (default) or the one provided via the "app_image_dir" setting.
+
+Images are cross-faded and some random motion/scaling is applied while they're shown.
+This example also shows how to use libavg's BitmapManager to asynchronously load images
+in background.
+"""
+
+# TODO:
+# add app settings for:
+# * show/transition intervals
+# * max. move distance
+# * sorted/shuffled show order (shuffled yet)
+
+import sys
+import os
+from random import shuffle, randint
+from libavg import avg, player, app
+
+
+IMAGE_EXTENSIONS = ['.jpg', '.jpeg', '.png', '.gif', '.bmp', '.tga', '.tif', '.tiff']
+SHOW_INTERVAL = 6000 # [ms]
+TRANS_INTERVAL = 2000 # [ms]
+CHANGE_INTERVAL = SHOW_INTERVAL + TRANS_INTERVAL
+ANIM_INTERVAL = CHANGE_INTERVAL + TRANS_INTERVAL
+ANIM_MAX_MOVE = 200 # [px]
+
+BitmapMgr = avg.BitmapManager.get()
+
+
+def scaleMax(srcSize, maxSize):
+ """
+ Returns scrSize aspect correct scaled to fit right into maxSize.
+ """
+ aspect = srcSize.x / srcSize.y
+ if aspect < maxSize.x / maxSize.y:
+ return avg.Point2D(maxSize.y * aspect, maxSize.y)
+ return avg.Point2D(maxSize.x, maxSize.x / aspect)
+
+def scaleMin(srcSize, minSize):
+ """
+ Returns scrSize aspect correct scaled to completely fill minSize.
+ """
+ aspect = srcSize.x / srcSize.y
+ if aspect < minSize.x / minSize.y:
+ return avg.Point2D(minSize.x, minSize.x / aspect)
+ return avg.Point2D(minSize.y * aspect, minSize.y)
+
+
+class Slide(avg.ImageNode):
+ HIDE_DONE = avg.Publisher.genMessageID()
+
+ def __init__(self, parent=None, **kwargs):
+ super(Slide, self).__init__(opacity=0.0, **kwargs)
+ self.registerInstance(self, parent)
+ self.publish(Slide.HIDE_DONE)
+
+ def show(self):
+ s = self.getMediaSize()
+ assert s.x and s.y
+ # initial size and position (scaled to screen size and centered)
+ self.size = scaleMax(s, self.parent.size)
+ self.pos = (self.parent.size - self.size) * 0.5
+ # random final size and position (center moved by (dx, dy) and scaled up accordingly)
+ dx = float(randint(-ANIM_MAX_MOVE, ANIM_MAX_MOVE))
+ dy = float(randint(-ANIM_MAX_MOVE, ANIM_MAX_MOVE))
+ size = scaleMin(s, self.size + avg.Point2D(abs(dx), abs(dy)) * 2.0)
+ pos = self.pos + avg.Point2D(dx, dy) + (self.size - size) * 0.5
+ # start in-transition
+ avg.fadeIn(self, TRANS_INTERVAL)
+ # start move/scale animation
+ avg.ParallelAnim([
+ avg.LinearAnim(self, 'size', ANIM_INTERVAL, self.size, size),
+ avg.LinearAnim(self, 'pos', ANIM_INTERVAL, self.pos, pos)]).start()
+
+ def hide(self):
+ # start out-transition, notify subscribers when finished
+ avg.fadeOut(self, TRANS_INTERVAL,
+ lambda: self.notifySubscribers(Slide.HIDE_DONE, [self]))
+
+
+class Slideshow(app.MainDiv):
+ def onArgvParserCreated(self, parser):
+ parser.set_usage('%prog <images dir>')
+
+ def onArgvParsed(self, options, args, parser):
+ if len(args) != 1:
+ parser.print_help()
+ sys.exit(1)
+ self._imagesDir = args[0]
+
+ def onInit(self):
+ if not os.path.isdir(self._imagesDir):
+ avg.logger.error('Directory [%s] not found' % self._imagesDir)
+ exit(1)
+ avg.logger.info('Scanning directory [%s] ...' % self._imagesDir)
+
+ imgExts = tuple(IMAGE_EXTENSIONS + [ext.upper() for ext in IMAGE_EXTENSIONS])
+ self.__imgFiles = [os.path.join(self._imagesDir, imgFile) for imgFile in
+ filter(lambda f: f.endswith(imgExts), os.listdir(self._imagesDir))]
+ if not self.__imgFiles:
+ avg.logger.error('No image files found, '
+ 'scanned file extensions:\n%s' % (', '.join(imgExts)))
+ exit(1)
+ l = len(self.__imgFiles)
+ avg.logger.info('%d image file%s found' % (l, 's' if l > 1 else ''))
+ shuffle(self.__imgFiles)
+
+ self.__slidesDiv = avg.DivNode(size=self.size, parent=self)
+ # ping-pong two slides for cross-fade transition
+ self.__newSlide = Slide(parent=self.__slidesDiv)
+ self.__oldSlide = Slide(href=self.__imgFiles[0], parent=self.__slidesDiv)
+ # HIDE_DONE notifications will trigger asynchronous pre-loading of the next image
+ self.__newSlide.subscribe(Slide.HIDE_DONE, self.__asyncPreload)
+ self.__oldSlide.subscribe(Slide.HIDE_DONE, self.__asyncPreload)
+ self.__currentIdx = 0
+ self.__changeSlide()
+ player.setInterval(CHANGE_INTERVAL, self.__changeSlide)
+
+ def __asyncPreload(self, slide):
+ self.__currentIdx = (self.__currentIdx + 1) % len(self.__imgFiles)
+ BitmapMgr.loadBitmap(self.__imgFiles[self.__currentIdx], slide.setBitmap)
+
+ def __changeSlide(self):
+ self.__oldSlide, self.__newSlide = self.__newSlide, self.__oldSlide
+ self.__slidesDiv.reorderChild(self.__newSlide, 1) # move to top
+ self.__newSlide.show()
+ self.__oldSlide.hide()
+
+
+if __name__ == '__main__':
+ app.App().run(Slideshow())
+
diff --git a/src/samples/subclass.py b/src/samples/subclass.py
new file mode 100755
index 0000000..b0b6380
--- /dev/null
+++ b/src/samples/subclass.py
@@ -0,0 +1,40 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+from libavg import avg, gesture, app
+import libavg
+
+class TextRect(avg.DivNode):
+ def __init__(self, text, parent=None, **kwargs):
+ super(TextRect, self).__init__(**kwargs)
+ self.registerInstance(self, parent)
+ self.rect = avg.RectNode(size=self.size, fillopacity=1, fillcolor="000000",
+ color="FFFFFF", parent=self)
+ self.words = avg.WordsNode(color="FFFFFF", text=text, alignment="center",
+ parent=self)
+ self.words.pos = (self.size-(0,self.words.size.y)) / 2
+
+ def getSize(self):
+ return self.__divSize
+
+ def setSize(self, size):
+ self.rect.size = size
+ self.words.pos = (size-(0,self.words.size.y)) / 2
+ self.__divSize = size
+ __divSize = avg.DivNode.size
+ size = property(getSize, setSize)
+
+
+class SubclassDemo(app.MainDiv):
+
+ def onInit(self):
+ self.rect = TextRect(text="Hello World", pos=(20,20), size=(200,120),
+ parent=self)
+ self.__recognizer = gesture.TapRecognizer(node=self.rect,
+ detectedHandler=self.onTap)
+
+ def onTap(self):
+ self.rect.size = self.rect.size + (10,10)
+
+if __name__ == '__main__':
+ app.App().run(SubclassDemo(), app_resolution='800x600')
diff --git a/src/samples/text.avg b/src/samples/text.avg
deleted file mode 100644
index 270d904..0000000
--- a/src/samples/text.avg
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0"?>
-<avg width="640" height="480">
- <words id="HelloText" x="10" y="10" font="arial" text="Hello World"/>
-</avg>
diff --git a/src/samples/timer.py b/src/samples/timer.py
index 7c87910..9973d4e 100755
--- a/src/samples/timer.py
+++ b/src/samples/timer.py
@@ -1,15 +1,15 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-from libavg import avg
+from libavg import avg, player
def moveText():
- node = player.getElementByID("HelloText")
+ global node
node.x = 200
-player = avg.Player.get()
-
-player.loadFile("text.avg")
+canvas = player.createMainCanvas(size=(640,480))
+rootNode = canvas.getRootNode()
+node = avg.WordsNode(pos=(10,10), text="Hello World", parent=rootNode)
player.setTimeout(1000, moveText)
player.play()
diff --git a/src/samples/timer2.py b/src/samples/timer2.py
index 9533e81..006005d 100755
--- a/src/samples/timer2.py
+++ b/src/samples/timer2.py
@@ -1,18 +1,17 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-from libavg import avg
+from libavg import avg, player
def moveText():
- node = player.getElementByID("HelloText")
+ global node
if node.x < 200:
node.x += 1
-player = avg.Player.get()
+canvas = player.createMainCanvas(size=(640,480))
+rootNode = canvas.getRootNode()
+node = avg.WordsNode(pos=(10,10), text="Hello World", parent=rootNode)
+player.subscribe(player.ON_FRAME, moveText)
-player.loadFile("text.avg")
-player.setOnFrameHandler(moveText)
-
-player.setVBlankFramerate(1)
player.play()
diff --git a/src/samples/timer3.py b/src/samples/timer3.py
index 9983685..492cdda 100755
--- a/src/samples/timer3.py
+++ b/src/samples/timer3.py
@@ -1,17 +1,19 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-from libavg import avg
+from libavg import avg, player
def moveText():
- node = player.getElementByID("HelloText")
+ global node
if node.x < 200:
node.x += 20
+ else:
+ player.clearInterval(timer)
-player = avg.Player.get()
-
-player.loadFile("text.avg")
-player.setInterval(200, moveText)
+canvas = player.createMainCanvas(size=(640,480))
+rootNode = canvas.getRootNode()
+node = avg.WordsNode(pos=(10,10), text="Hello World", parent=rootNode)
+timer = player.setInterval(200, moveText)
player.play()
diff --git a/src/samples/twovideos.py b/src/samples/twovideos.py
index a7cc58c..1ad3fca 100755
--- a/src/samples/twovideos.py
+++ b/src/samples/twovideos.py
@@ -1,22 +1,34 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-from libavg import *
import sys
+import libavg
+from libavg import avg, app, player
-g_Player = avg.Player.get()
-FADE_DURATION = 2000
+class HDVideo(app.MainDiv):
+ def onArgvParserCreated(self, parser):
+ parser.set_usage('%prog <video1> <video2>')
+ parser.add_option('--duration', '-d', dest='duration',
+ default=2000, type='int', help='Crossfade duration')
-class HDVideoApp(AVGApp):
- def init(self):
+ def onArgvParsed(self, options, args, parser):
+ if len(args) != 2:
+ parser.print_help()
+ sys.exit(1)
+
+ self.__videos = args
+ self.__duration = options.duration
+
+ def onInit(self):
self.videoNodes = []
- for fileName in (sys.argv[1], sys.argv[2]):
- videoNode = VideoNode(
- size=(1440, 810),
+ for fileName in (self.__videos[0], self.__videos[1]):
+ videoNode = avg.VideoNode(
+ size=(1680, 1050),
href=fileName,
opacity=0,
- parent=self._parentNode)
+ loop=True,
+ parent=self)
videoNode.play()
self.videoNodes.append(videoNode)
@@ -24,21 +36,20 @@ class HDVideoApp(AVGApp):
self.runningVideo = 0
self.isFading = False
- def onKeyDown(self, event):
- if event.keystring == '1':
- if not(self.isFading):
- if self.runningVideo == 0:
- fadeIn(self.videoNodes[1], FADE_DURATION)
- else:
- fadeOut(self.videoNodes[1], FADE_DURATION)
- g_Player.setTimeout(FADE_DURATION, self.fadeEnd)
- self.runningVideo = (self.runningVideo+1)%2
- self.isFading = True
- return True
- else:
- return False
+ app.keyboardmanager.bindKeyDown('1', self.onButtonPressed,
+ 'Crossfade between videos')
+
+ def onButtonPressed(self):
+ if not(self.isFading):
+ if self.runningVideo == 0:
+ avg.fadeIn(self.videoNodes[1], self.__duration)
+ else:
+ avg.fadeOut(self.videoNodes[1], self.__duration)
+ player.setTimeout(self.__duration, self.fadeEnd)
+ self.runningVideo = (self.runningVideo+1)%2
+ self.isFading = True
def fadeEnd(self):
self.isFading = False
-HDVideoApp.start(resolution=(1440, 900), debugWindowSize=(720, 450))
+app.App().run(HDVideo(), app_resolution='1680x1050', app_window_size='720x450')
diff --git a/src/samples/video.py b/src/samples/video.py
index 7438d31..73d8c3e 100755
--- a/src/samples/video.py
+++ b/src/samples/video.py
@@ -1,11 +1,11 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-from libavg import avg
+from libavg import avg, player
-player = avg.Player.get()
-player.loadString("""<avg size="(160,120)"/>""")
+canvas = player.createMainCanvas(size=(160,120))
+rootNode = canvas.getRootNode()
videoNode = avg.VideoNode(href="mpeg1-48x48-sound.avi", pos=(10,10),
- parent=player.getRootNode())
+ parent=rootNode)
videoNode.play()
player.play()
diff --git a/src/samples/videochooser.py b/src/samples/videochooser.py
index 084bf08..c0f9fb4 100755
--- a/src/samples/videochooser.py
+++ b/src/samples/videochooser.py
@@ -1,49 +1,61 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-from libavg import *
import os, sys
+from libavg import avg, app, player, Point2D
-g_Player = avg.Player.get()
-THUMBNAIL_WIDTH = 320
-FADE_DURATION = 1000
+class VideoChooser(app.MainDiv):
+ def onArgvParserCreated(self, parser):
+ parser.set_usage("%prog <folder>")
+ parser.add_option('--duration', '-d', dest='duration',
+ default=2000, type='int', help='Fade duration')
+ parser.add_option('--width', '-w', dest='thumbWidth',
+ default=320, type='int', help='Thumbnail width')
-class VideoChooserApp(AVGApp):
- def init(self):
- g_Player.showCursor(True)
- dir = sys.argv[1]
+ def onArgvParsed(self, options, args, parser):
+ if len(args) != 1:
+ parser.print_help()
+ sys.exit(1)
- self.videoListNode = DivNode(parent=self._parentNode)
- self.videoNodes=[]
- fileNames=os.listdir(dir)
+ self.__folder = args[0]
+ self.__duration = options.duration
+ self.__thumbWidth = options.thumbWidth
+
+ def onInit(self):
+ player.showCursor(True)
+
+ self.videoListNode = avg.DivNode(parent=self)
+ self.videoNodes = []
+ fileNames = os.listdir(self.__folder)
i = 0
for fileName in fileNames:
try:
- videoNode = VideoNode(
- pos = (i*(THUMBNAIL_WIDTH+20), 0),
- href=dir+"/"+fileName,
+ videoNode = avg.VideoNode(
+ pos=(i*(self.__thumbWidth+20), 0),
+ href=self.__folder+'/'+fileName,
loop=True,
- parent=self.videoListNode)
+ mipmap=True,
+ enablesound=False,
+ parent = self.videoListNode)
videoNode.play()
self.videoNodes.append(videoNode)
size = videoNode.getMediaSize()
- height = (THUMBNAIL_WIDTH*size.y)/size.x
- videoNode.size = (THUMBNAIL_WIDTH, height)
-
- videoNode.setEventHandler(avg.CURSORDOWN, avg.MOUSE,
+ height = (self.__thumbWidth*size.y)/size.x
+ videoNode.size = (self.__thumbWidth, height)
+ videoNode.subscribe(videoNode.CURSOR_DOWN,
lambda event, videoNode=videoNode:
self.chooseVideo(event, videoNode))
i += 1
except RuntimeError:
pass
- self._parentNode.setEventHandler(avg.CURSORMOTION, avg.MOUSE, self.onMouseMove)
+ self.subscribe(self.CURSOR_MOTION, self.onMouseMove)
self.bigVideoNode = None
def onMouseMove(self, event):
- windowWidth = g_Player.getRootNode().width
+ windowWidth = player.getRootNode().width
ratio = event.x/float(windowWidth)
self.videoListNode.x = -(ratio*(self.getTotalWidth()-windowWidth))
@@ -54,21 +66,22 @@ class VideoChooserApp(AVGApp):
destPos = Point2D(720, 550)-destSize/2
absPos = videoNode.getAbsPos(Point2D(0,0))
frame = videoNode.getCurFrame()
- self.bigVideoNode = VideoNode(href=videoNode.href, loop=True,
- parent=self._parentNode)
+ self.bigVideoNode = avg.VideoNode(href=videoNode.href, loop=True, sensitive=False,
+ parent=self)
self.bigVideoNode.play()
self.bigVideoNode.seekToFrame(frame)
- EaseInOutAnim(self.bigVideoNode, "pos", 1000, absPos, destPos, False,
- 300, 300).start()
- EaseInOutAnim(self.bigVideoNode, "size", 1000, videoNode.size, destSize, False,
+ avg.EaseInOutAnim(self.bigVideoNode, "pos", 1000, absPos, destPos, False,
300, 300).start()
+ avg.EaseInOutAnim(self.bigVideoNode, "size", 1000, videoNode.size, destSize,
+ False, 300, 300).start()
def removeBigVideo(self):
oldVideoNode = self.bigVideoNode
- fadeOut(oldVideoNode, FADE_DURATION, lambda: oldVideoNode.unlink(True))
+ avg.fadeOut(oldVideoNode, self.__duration, lambda: oldVideoNode.unlink(True))
def getTotalWidth(self):
- return (THUMBNAIL_WIDTH+20)*len(self.videoNodes)
+ return (self.__thumbWidth+20)*len(self.videoNodes)
+
-VideoChooserApp.start(resolution=(1440, 900), debugWindowSize=(720, 450))
+app.App().run(VideoChooser(), app_resolution='1440x900', app_window_size='720x450')
diff --git a/src/samples/widget.py b/src/samples/widget.py
new file mode 100755
index 0000000..0396299
--- /dev/null
+++ b/src/samples/widget.py
@@ -0,0 +1,77 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+from libavg import avg, app, widget
+
+class SimpleUI(app.MainDiv):
+ def onInit(self):
+ avg.RectNode(size=(1024,768), fillopacity=1, fillcolor="FFFFFF",
+ parent=self)
+
+ hScrollBar = widget.ScrollBar(pos=(10,10), width=150, parent=self)
+ self.__addValueDisplay(hScrollBar, (175,12))
+
+ vScrollBar = widget.ScrollBar(pos=(15,60), height=150,
+ orientation=widget.Orientation.VERTICAL, parent=self)
+ vScrollBar.thumbExtent = 5
+ vScrollBar.range = (10,0)
+ self.__addValueDisplay(vScrollBar, (10,220))
+
+ hSlider = widget.Slider(pos=(10,35), width=150, parent=self)
+ self.__addValueDisplay(hSlider, (175,33))
+
+ vSlider = widget.Slider(pos=(60.5,60), height=150,
+ orientation=widget.Orientation.VERTICAL, parent=self)
+ vSlider.range = (1,0)
+ self.__addValueDisplay(vSlider, (55,220))
+ self.controls = [hScrollBar, vScrollBar, hSlider, vSlider]
+
+ self.createScrollArea(avg.Point2D(220,10))
+
+ checkBox = widget.CheckBox(pos=(10,270), text="Disable everything",
+ parent=self)
+ checkBox.subscribe(widget.CheckBox.TOGGLED, self.onCheck)
+
+ def setText(self, pos, node):
+ node.text = "%.2f"%pos
+
+ def setImageWidth(self, scrollArea, thumbPos):
+ scrollArea.contentsize = (thumbPos, scrollArea.contentsize.y)
+
+ def setImageHeight(self, scrollArea, thumbPos):
+ scrollArea.contentsize = (scrollArea.contentsize.x, thumbPos)
+
+ def createScrollArea(self, pos):
+ image = avg.ImageNode(href="rgb24-64x64.png", size=(1024, 1024))
+ scrollArea = widget.ScrollArea(contentNode=image, parent=self,
+ pos=pos, size=(220,220))
+
+ imageWidthSlider = widget.Slider(pos=pos+(0,230), width=220,
+ parent=self)
+ imageWidthSlider.range = (100,1024)
+ imageWidthSlider.thumbPos = 1024
+ imageWidthSlider.subscribe(widget.ScrollBar.THUMB_POS_CHANGED,
+ lambda thumbPos, scrollArea=scrollArea:
+ self.setImageWidth(scrollArea, thumbPos))
+
+ imageHeightSlider = widget.Slider(pos=pos+(230,0), height=220,
+ orientation=widget.Orientation.VERTICAL, parent=self)
+ imageHeightSlider.range = (100,1024)
+ imageHeightSlider.thumbPos = 1024
+ imageHeightSlider.subscribe(widget.ScrollBar.THUMB_POS_CHANGED,
+ lambda thumbPos, scrollArea=scrollArea:
+ self.setImageHeight(scrollArea, thumbPos))
+ self.controls.extend([scrollArea, imageWidthSlider, imageHeightSlider])
+
+ def onCheck(self, isChecked):
+ for node in self.controls:
+ node.enabled = not(isChecked)
+
+ def __addValueDisplay(self, scrollBar, pos):
+ textNode = avg.WordsNode(pos=pos, color="000000", parent=self)
+ scrollBar.subscribe(widget.ScrollBar.THUMB_POS_CHANGED,
+ lambda pos, node=textNode: self.setText(pos, node))
+ self.setText(scrollBar.thumbPos, textNode)
+
+
+app.App().run(SimpleUI(), app_resolution='1024x768')
diff --git a/src/samples/words1.avg b/src/samples/words1.avg
deleted file mode 100644
index 8d003fe..0000000
--- a/src/samples/words1.avg
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0"?>
-<avg width="320" height="240">
- <words x="10" y="10" text="Apples and Oranges" font="Arial" variant="Bold"
- fontsize="18" color="CF8000"/>
-</avg>
-
diff --git a/src/samples/words2.avg b/src/samples/words2.avg
deleted file mode 100644
index 051d95a..0000000
--- a/src/samples/words2.avg
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0"?>
-<avg width="320" height="240">
- <words x="10" y="10" text="The quick brown fox jumped over the lazy dog."
- font="Arial" variant="Bold" fontsize="18" color="CF8000"
- width="170" linespacing="10" alignment="left" indent="10"/>
-</avg>
-
diff --git a/src/samples/wordspos.avg b/src/samples/wordspos.avg
deleted file mode 100644
index 4ca1efb..0000000
--- a/src/samples/wordspos.avg
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0"?>
-<avg width="160" height="120">
- <words pos="(10,10)" width="70">
- <i>Left-justified paragraph.</i>
- </words>
- <words pos="(150, 10)" width="70" alignment="right"
- text="Right-justified paragraph."/>
- <words pos="(80, 80)" width="70" alignment="center"
- text="Centered paragraph"/>
-</avg>
-
diff --git a/src/samples/wordspos.py b/src/samples/wordspos.py
new file mode 100755
index 0000000..85a8ceb
--- /dev/null
+++ b/src/samples/wordspos.py
@@ -0,0 +1,15 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+from libavg import avg, player
+
+canvas = player.createMainCanvas(size=(160,120))
+rootNode = canvas.getRootNode()
+avg.WordsNode(pos=(10,10), width=70, text="<i>Left-justified paragraph</i>",
+ parent=rootNode)
+avg.WordsNode(pos=(150,10), width=70, alignment="right", text="Right-justified paragraph",
+ parent=rootNode)
+avg.WordsNode(pos=(80,80), width=70, alignment="center", text="Centered paragraph",
+ parent=rootNode)
+player.play()
+
diff --git a/src/test/AVGAppTest.py b/src/test/AVGAppTest.py
index 5c7ed1a..7c21bc8 100644
--- a/src/test/AVGAppTest.py
+++ b/src/test/AVGAppTest.py
@@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
# libavg - Media Playback Engine.
-# Copyright (C) 2003-2011 Ulrich von Zadow
+# 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
@@ -24,22 +24,21 @@ import os
import time
import libavg
-from libavg import avg, Point2D
+from libavg import avg, Point2D, player
import testcase
-g_Player = avg.Player.get()
-g_helper = g_Player.getTestHelper()
+g_helper = player.getTestHelper()
TEST_RESOLUTION = (160, 120)
class TestAppBase(libavg.AVGApp):
def requestStop(self, timeout=0):
- g_Player.setTimeout(timeout, g_Player.stop)
+ player.setTimeout(timeout, player.stop)
def singleKeyPress(self, char):
- g_helper.fakeKeyEvent(avg.KEYDOWN, ord(char), ord(char), char, ord(char),
+ g_helper.fakeKeyEvent(avg.Event.KEY_DOWN, ord(char), ord(char), char, ord(char),
avg.KEYMOD_NONE)
- g_helper.fakeKeyEvent(avg.KEYUP, ord(char), ord(char), char, ord(char),
+ g_helper.fakeKeyEvent(avg.Event.KEY_UP, ord(char), ord(char), char, ord(char),
avg.KEYMOD_NONE)
@@ -48,7 +47,7 @@ class AVGAppTestCase(testcase.AVGTestCase):
class MinimalApp(TestAppBase):
testInstance = self
def init(self):
- self.testInstance.assert_(not g_Player.isFullscreen())
+ self.testInstance.assert_(not player.isFullscreen())
self.requestStop()
if 'AVG_DEPLOY' in os.environ:
@@ -59,12 +58,12 @@ class AVGAppTestCase(testcase.AVGTestCase):
class FullscreenApp(TestAppBase):
testInstance = self
def init(self):
- self.testInstance.assert_(g_Player.isFullscreen())
- rootNodeSize = g_Player.getRootNode().size
+ self.testInstance.assert_(player.isFullscreen())
+ rootNodeSize = player.getRootNode().size
self.testInstance.assertEqual(rootNodeSize, resolution)
self.requestStop()
- resolution = g_Player.getScreenResolution()
+ resolution = player.getScreenResolution()
os.environ['AVG_DEPLOY'] = '1'
FullscreenApp.start(resolution=resolution)
del os.environ['AVG_DEPLOY']
@@ -73,11 +72,11 @@ class AVGAppTestCase(testcase.AVGTestCase):
class DebugwindowApp(TestAppBase):
testInstance = self
def init(self):
- self.testInstance.assert_(not g_Player.isFullscreen())
- rootNodeSize = g_Player.getRootNode().size
+ self.testInstance.assert_(not player.isFullscreen())
+ rootNodeSize = player.getRootNode().size
self.testInstance.assertEqual(rootNodeSize, TEST_RESOLUTION)
- # windowSize = g_Player.getWindowResolution()
+ # windowSize = player.getWindowResolution()
# self.testInstance.assertEqual(windowSize, Point2D(TEST_RESOLUTION)/2)
self.requestStop()
@@ -104,19 +103,19 @@ class AVGAppTestCase(testcase.AVGTestCase):
raise RuntimeError('Cannot find the expected '
'screenshot file %s' % screenshotFile)
- g_Player.stop()
+ player.stop()
class ScreenshotApp(TestAppBase):
def init(self):
self.singleKeyPress('s')
self.singleKeyPress('s')
self.timeStarted = time.time()
- self.timerId = g_Player.setOnFrameHandler(self.onFrame)
+ self.timerId = player.subscribe(player.ON_FRAME, self.onFrame)
def onFrame(self):
if (os.path.exists(expectedFiles[-1]) or
time.time() - self.timeStarted > 1):
- g_Player.clearInterval(self.timerId)
+ player.clearInterval(self.timerId)
checkCallback()
cleanup()
@@ -131,7 +130,7 @@ class AVGAppTestCase(testcase.AVGTestCase):
def enableGraphs(self):
self.singleKeyPress('f')
self.singleKeyPress('m')
- g_Player.setTimeout(500, self.disableGraphs)
+ player.setTimeout(500, self.disableGraphs)
def disableGraphs(self):
self.singleKeyPress('m')
@@ -145,15 +144,15 @@ class AVGAppTestCase(testcase.AVGTestCase):
class ToggleKeysApp(TestAppBase):
def init(self):
self.keys = TOGGLE_KEYS[:]
- g_Player.setTimeout(0, self.nextKey)
+ player.setTimeout(0, self.nextKey)
def nextKey(self):
if not self.keys:
- g_Player.stop()
+ player.stop()
else:
key = self.keys.pop()
self.singleKeyPress(key)
- g_Player.setTimeout(0, self.nextKey)
+ player.setTimeout(0, self.nextKey)
ToggleKeysApp.start(resolution=TEST_RESOLUTION)
@@ -161,9 +160,9 @@ class AVGAppTestCase(testcase.AVGTestCase):
class FakeFullscreenApp(TestAppBase):
fakeFullscreen = True
def init(self):
- g_Player.setTimeout(0, g_Player.stop)
+ player.setTimeout(0, player.stop)
- resolution = g_Player.getScreenResolution()
+ resolution = player.getScreenResolution()
if os.name == 'nt':
FakeFullscreenApp.start(resolution=resolution)
else:
diff --git a/src/test/AVTest.py b/src/test/AVTest.py
index bc4e752..04de91e 100644
--- a/src/test/AVTest.py
+++ b/src/test/AVTest.py
@@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
# libavg - Media Playback Engine.
-# Copyright (C) 2003-2011 Ulrich von Zadow
+# 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
@@ -20,7 +20,7 @@
# Current versions can be found at www.libavg.de
#
-from libavg import avg
+from libavg import avg, player
from testcase import *
class AVTestCase(AVGTestCase):
@@ -32,35 +32,50 @@ class AVTestCase(AVGTestCase):
def testEOF(self, node):
def onEOF():
- Player.stop()
+ player.stop()
def onNoEOF():
self.fail("No EOF")
+ def onSubscribeEOF():
+ self.eofCalled = True
+
+ self.eofCalled = False
root = self.loadEmptyScene()
root.appendChild(node)
node.play()
node.setEOFCallback(onEOF)
- Player.setTimeout(100000, onNoEOF)
- Player.play()
-
+ node.subscribe(avg.Node.END_OF_FILE, onSubscribeEOF)
+ player.setTimeout(100000, onNoEOF)
+ player.play()
+ self.assert_(self.eofCalled)
+
def testVideoInfo(self):
def checkInfo():
node.pause()
+ self.assertEqual(node.getContainerFormat(), "avi")
self.assertEqual(node.getCurFrame(), 0)
self.assertEqual(node.getCurTime(), 0)
self.assertEqual(node.getDuration(), 1000)
self.assertEqual(node.getBitrate(), 224064)
self.assertEqual(node.getVideoCodec(), "mpeg4")
self.assertEqual(node.getStreamPixelFormat(), "yuv420p")
+ self.assertEqual(node.getVideoDuration(), 1000)
if isThreaded:
self.assertEqual(node.getAudioCodec(), "mp2")
self.assertEqual(node.getAudioSampleRate(), 44100)
self.assertEqual(node.getNumAudioChannels(), 2)
+ self.assert_(node.getVideoDuration() >= 1000)
+
+ def checkEnableSound():
+ node = avg.VideoNode(href="mpeg1-48x48-sound.avi", threaded=isThreaded,
+ enablesound=False, parent=root)
+ node.pause()
+ self.assertEqual(node.getVideoCodec(), "mpeg4")
+ self.assertException(node.getAudioCodec)
def checkExceptions():
- node = avg.VideoNode(href="../video/testfiles/mpeg1-48x48.mpg",
- threaded=isThreaded)
+ node = avg.VideoNode(href="mpeg1-48x48.mov", threaded=isThreaded)
self.assertException(node.getDuration)
self.assertException(node.getBitrate)
self.assertException(node.getVideoCodec)
@@ -72,24 +87,27 @@ class AVTestCase(AVGTestCase):
root.appendChild(node)
def checkAudioFile():
- node = avg.VideoNode(href="../video/testfiles/44.1kHz_16bit_stereo.wav",
- threaded=isThreaded, parent=root)
+ node = avg.VideoNode(href="44.1kHz_16bit_stereo.wav", threaded=isThreaded,
+ parent=root)
self.assertException(node.pause)
+ sys.stderr.write("\n")
for isThreaded in (False, True):
+ sys.stderr.write(" Threaded: " + str(isThreaded) + "\n")
root = self.loadEmptyScene()
- node = avg.VideoNode(href="../video/testfiles/mpeg1-48x48-sound.avi",
- threaded=isThreaded, parent=root)
+ node = avg.VideoNode(href="mpeg1-48x48-sound.avi", threaded=isThreaded,
+ parent=root)
checkInfo()
+ checkEnableSound()
checkExceptions()
- self.start((
- checkInfo,
+ self.start(False,
+ (checkInfo,
checkExceptions,
checkAudioFile,
))
+ sys.stderr.write(" Nonstandard queue length\n")
root = self.loadEmptyScene()
- node = avg.VideoNode(href="../video/testfiles/mpeg1-48x48-sound.avi",
- queuelength=23, parent=root)
+ node = avg.VideoNode(href="mpeg1-48x48-sound.avi", queuelength=23, parent=root)
self.assertEqual(node.queuelength, 23)
def testVideoFiles(self):
@@ -98,11 +116,11 @@ class AVTestCase(AVGTestCase):
node.volume = volume
def testGetVolume(volume):
- self.assertEqual(node.volume, volume)
+ self.assertAlmostEqual(node.volume, volume)
def checkImage(filename):
if not(isThreaded):
- self.compareImage("testVideo-"+filename+"1", False)
+ self.compareImage("testVideo-"+filename+"1")
def testInfo():
if filename == "mpeg1-48x48-sound.avi" and isThreaded:
@@ -113,14 +131,14 @@ class AVTestCase(AVGTestCase):
filename == "vp6a-yuva-48x48.flv") == node.hasAlpha())
root = self.loadEmptyScene()
- node = avg.VideoNode(href="../video/testfiles/"+filename, volume=0.8,
- size=(96,96), threaded=isThreaded)
+ node = avg.VideoNode(href=filename, volume=0.8, size=(96,96),
+ threaded=isThreaded)
self.assertEqual(node.threaded, isThreaded)
setVolume(0.6)
root.appendChild(node)
self.assertException(node.hasAudio)
- self.start((
- lambda: setVolume(0.5),
+ self.start(False,
+ (lambda: setVolume(0.5),
lambda: testGetVolume(0.5),
lambda: node.play(),
lambda: checkImage(filename),
@@ -129,47 +147,48 @@ class AVTestCase(AVGTestCase):
testInfo,
lambda: node.stop()
))
- videoFiles = ["mjpeg-48x48.avi", "mpeg1-48x48.mpg", "mpeg1-48x48-sound.avi",
+ videoFiles = ["mjpeg-48x48.avi", "mpeg1-48x48.mov", #"mpeg1-48x48-sound.avi",
"rgba-48x48.mov", "h264-48x48.h264", "vp6a-yuva-48x48.flv"]
- print
+ sys.stderr.write("\n")
for filename in videoFiles:
- print " " + filename
+ sys.stderr.write(" "+filename+"\n")
for isThreaded in [False, True]:
- print " threaded: ", isThreaded
+ sys.stderr.write(" threaded: "+str(isThreaded)+"\n")
testVideoFile(filename, isThreaded)
def testPlayBeforeConnect(self):
- node = avg.VideoNode(href="../video/testfiles/mpeg1-48x48.mpg", threaded=False)
+ node = avg.VideoNode(href="media/mpeg1-48x48.mov", threaded=False)
node.play()
- root = self.loadEmptyScene()
+ player.createMainCanvas(size=(160,120))
+ root = player.getRootNode()
root.insertChild(node, 0)
- Player.setFakeFPS(25)
- self.start((
- lambda: self.assertEqual(node.size, (48, 48)),
- lambda: self.compareImage("testPlayBeforeConnect", False),
+ player.setFakeFPS(25)
+ self.start(False,
+ (lambda: self.assertEqual(node.size, (48, 48)),
+ lambda: self.compareImage("testPlayBeforeConnect"),
))
def testVideoState(self):
for accelerated in [True, False]:
root = self.loadEmptyScene()
- node = avg.VideoNode(href="../video/testfiles/mpeg1-48x48.mpg", size=(96,96),
- threaded=False, accelerated=accelerated, parent=root)
- Player.setFakeFPS(25)
- self.start((
- lambda: node.play(),
- lambda: self.compareImage("testVideoState1", False),
+ node = avg.VideoNode(href="mpeg1-48x48.mov", size=(96,96), threaded=False,
+ accelerated=accelerated, parent=root)
+ player.setFakeFPS(25)
+ self.start(False,
+ (lambda: node.play(),
+ lambda: self.compareImage("testVideoState1"),
lambda: node.pause(),
- lambda: self.compareImage("testVideoState2", False),
- lambda: self.compareImage("testVideoState2", False),
+ lambda: self.compareImage("testVideoState2"),
+ lambda: self.compareImage("testVideoState2"),
lambda: node.play(),
- lambda: self.compareImage("testVideoState3", False),
+ lambda: self.compareImage("testVideoState3"),
lambda: node.stop(),
- lambda: self.compareImage("testVideoState4", False),
+ lambda: self.compareImage("testVideoState4"),
lambda: node.pause(),
- lambda: self.compareImage("testVideoState5", False),
- lambda: self.compareImage("testVideoState5", False),
+ lambda: self.compareImage("testVideoState5"),
+ lambda: self.compareImage("testVideoState5"),
lambda: node.stop(),
- lambda: self.compareImage("testVideoState4", False),
+ lambda: self.compareImage("testVideoState4"),
))
def testVideoActive(self):
@@ -180,15 +199,15 @@ class AVTestCase(AVGTestCase):
node.active=1
root = self.loadEmptyScene()
- node = avg.VideoNode(href="../video/testfiles/mpeg1-48x48.mpg", size=(96,96),
- threaded=False, parent=root)
- Player.setFakeFPS(25)
- self.start((
- lambda: node.play(),
+ node = avg.VideoNode(href="mpeg1-48x48.mov", size=(96,96), threaded=False,
+ parent=root)
+ player.setFakeFPS(25)
+ self.start(False,
+ (lambda: node.play(),
deactivate,
- lambda: self.compareImage("testVideoActive1", False),
+ lambda: self.compareImage("testVideoActive1"),
activate,
- lambda: self.compareImage("testVideoActive2", False)
+ lambda: self.compareImage("testVideoActive2")
))
def testVideoHRef(self):
@@ -196,11 +215,11 @@ class AVTestCase(AVGTestCase):
self.assertEqual(node.getMediaSize(), (48, 48))
def setHRefLoaded():
- node.href = "../video/testfiles/h264-48x48.h264"
+ node.href = "h264-48x48.h264"
def setHRefUnloaded():
node = avg.VideoNode()
- node.href = "../video/testfiles/h264-48x48.h264"
+ node.href = "h264-48x48.h264"
node.play()
def testVideoNotFound():
@@ -210,19 +229,24 @@ class AVTestCase(AVGTestCase):
# Now libavg notices the missing file.
self.assertException(node.play)
+ def testVideoBroken():
+ node = avg.VideoNode(href="rgb24-64x64.png")
+ self.assertException(node.play)
+
root = self.loadEmptyScene()
- node = avg.VideoNode(href="../video/testfiles/mpeg1-48x48.mpg", threaded=False,
- parent=root)
- Player.setFakeFPS(25)
+ node = avg.VideoNode(href="mpeg1-48x48.mov", threaded=False, parent=root)
+ player.setFakeFPS(25)
testVideoNotFound()
+ testVideoBroken()
setHRefUnloaded()
- self.start((
- lambda: node.play(),
+ self.start(False,
+ (lambda: node.play(),
testGetMediaSize,
setHRefLoaded,
- lambda: self.compareImage("testVideoHRef1", False),
+ lambda: self.compareImage("testVideoHRef1"),
testGetMediaSize,
- testVideoNotFound
+ testVideoNotFound,
+ testVideoBroken
))
def testVideoOpacity(self):
@@ -233,22 +257,22 @@ class AVTestCase(AVGTestCase):
def show():
self.videoNode.opacity=1
- Player.setFakeFPS(25)
+ player.setFakeFPS(25)
root = self.loadEmptyScene()
self.videoNode = avg.VideoNode(href=filename, loop=True, threaded=False,
parent=root)
- self.start((
- lambda: self.videoNode.play(),
+ self.start(False,
+ (lambda: self.videoNode.play(),
None,
- lambda: self.compareImage(testImgName+"1", False),
+ lambda: self.compareImage(testImgName+"1"),
hide,
None,
None,
show,
- lambda: self.compareImage(testImgName+"2", False)
+ lambda: self.compareImage(testImgName+"2")
))
- testWithFile("../video/testfiles/rgba-48x48.mov", "testVideoOpacityRGBA")
- testWithFile("../video/testfiles/mpeg1-48x48.mpg", "testVideoOpacityYUV")
+ testWithFile("rgba-48x48.mov", "testVideoOpacityRGBA")
+ testWithFile("mpeg1-48x48.mov", "testVideoOpacityYUV")
def testVideoSeek(self):
def seek(frame):
@@ -257,53 +281,46 @@ class AVTestCase(AVGTestCase):
def checkCurFrame():
self.assertEqual(videoNode.getCurFrame(), 26)
- Player.setFakeFPS(25)
+ player.setFakeFPS(25)
for useCustomFPS in [False, True]:
root = self.loadEmptyScene()
if useCustomFPS:
videoNode = avg.VideoNode(parent=root, loop=True, size=(96,96), fps=25,
- threaded=False, href="../video/testfiles/mjpeg-48x48.avi")
+ threaded=False, href="mjpeg-48x48.avi")
else:
videoNode = avg.VideoNode(parent=root, loop=True, size=(96,96),
- threaded=False, href="../video/testfiles/mjpeg-48x48.avi")
+ threaded=False, href="mjpeg-48x48.avi")
videoNode.play()
seek(26)
- self.start((
- checkCurFrame,
- lambda: self.compareImage("testVideoSeek0", False),
+ self.start(False,
+ (checkCurFrame,
+ lambda: self.compareImage("testVideoSeek0"),
lambda: seek(100),
- lambda: self.compareImage("testVideoSeek1", False),
+ lambda: self.compareImage("testVideoSeek1"),
lambda: videoNode.pause(),
lambda: seek(26),
None,
- lambda: self.compareImage("testVideoSeek2", False),
+ lambda: self.compareImage("testVideoSeek2"),
lambda: videoNode.play(),
None,
- lambda: self.compareImage("testVideoSeek3", False)
+ lambda: self.compareImage("testVideoSeek3")
))
def checkSeek():
seek(26)
self.assertNotEqual(videoNode.getCurFrame(), 0)
- root = self.loadEmptyScene()
- videoNode = avg.VideoNode(parent=root, loop=True, fps=25,
- href="../video/testfiles/mjpeg-48x48.avi")
- videoNode.play()
- seek(5)
- self.start((checkSeek,))
-
def testVideoFPS(self):
- Player.setFakeFPS(25)
+ player.setFakeFPS(25)
root = self.loadEmptyScene()
root = root
videoNode = avg.VideoNode(size=(80,80), loop=True, threaded=False,
- href="../video/testfiles/mjpeg-48x48.avi", fps=250, parent=root)
- self.start((
- lambda: videoNode.play(),
+ href="mjpeg-48x48.avi", fps=250, parent=root)
+ self.start(False,
+ (lambda: videoNode.play(),
None,
- lambda: self.compareImage("testVideoFPS", False)
+ lambda: self.compareImage("testVideoFPS")
))
def testVideoLoop(self):
@@ -313,19 +330,19 @@ class AVTestCase(AVGTestCase):
def onFrame():
if self.eof:
if not(threaded):
- self.compareImage("testVideoLoop", False)
- Player.stop()
+ self.compareImage("testVideoLoop")
+ player.stop()
for threaded in [False, True]:
self.eof = False
- Player.setFakeFPS(25)
+ player.setFakeFPS(25)
root = self.loadEmptyScene()
videoNode = avg.VideoNode(parent=root, loop=True, fps=25, size=(96,96),
- threaded=threaded, href="../video/testfiles/mpeg1-48x48.mpg")
- videoNode.setEOFCallback(onEOF)
+ threaded=threaded, href="mpeg1-48x48.mov")
+ videoNode.subscribe(avg.Node.END_OF_FILE, onEOF)
videoNode.play()
- Player.setOnFrameHandler(onFrame)
- Player.play()
+ player.subscribe(player.ON_FRAME, onFrame)
+ player.play()
def testVideoMask(self):
def testWithFile(filename, testImgName):
@@ -335,29 +352,26 @@ class AVTestCase(AVGTestCase):
def setOpacity():
video.opacity = 0.5
- Player.setFakeFPS(25)
+ player.setFakeFPS(25)
root = self.loadEmptyScene()
video = avg.VideoNode(href=filename, threaded=False,
parent=root)
video.play()
- self.start([
- lambda: setMask("mask.png"),
- lambda: self.compareImage(testImgName+"1", False),
+ self.start(False,
+ (lambda: setMask("mask.png"),
+ lambda: self.compareImage(testImgName+"1"),
lambda: video.seekToFrame(10),
lambda: setMask(""),
- lambda: self.compareImage(testImgName+"2", False),
+ lambda: self.compareImage(testImgName+"2"),
lambda: setMask("mask2.png"),
- lambda: self.compareImage(testImgName+"3", False),
+ lambda: self.compareImage(testImgName+"3"),
setOpacity,
- lambda: self.compareImage(testImgName+"4", False),
- ])
+ lambda: self.compareImage(testImgName+"4"),
+ ))
- if not(self._hasShaderSupport()):
- return
-
- testWithFile("../video/testfiles/mpeg1-48x48.mpg", "testVideoMaskYUV")
- testWithFile("../video/testfiles/mjpeg-48x48.avi", "testVideoMaskYUVJ")
- testWithFile("../video/testfiles/rgba-48x48.mov", "testVideoMaskRGBA")
+ testWithFile("mpeg1-48x48.mov", "testVideoMaskYUV")
+ testWithFile("mjpeg-48x48.avi", "testVideoMaskYUVJ")
+ testWithFile("rgba-48x48.mov", "testVideoMaskRGBA")
def testException(self):
class TestException(Exception):
@@ -366,46 +380,68 @@ class AVTestCase(AVGTestCase):
def throwException():
raise TestException
- Player.setFakeFPS(0.1)
+ player.setFakeFPS(0.1)
videoNode = avg.VideoNode(threaded = False)
- videoNode.href = "./testmediadir/mjpeg-48x48.avi"
- videoNode.setEOFCallback(throwException)
+ videoNode.href = "../testmediadir/mjpeg-48x48.avi"
+ videoNode.subscribe(avg.Node.END_OF_FILE, throwException)
root = self.loadEmptyScene()
- avg.Player.get().getRootNode().appendChild(videoNode)
+ root.appendChild(videoNode)
self.__exceptionThrown = False
try:
- self.start((
- videoNode.pause,
- lambda: videoNode.seekToFrame(videoNode.getNumFrames()),
- videoNode.play,
- lambda: None))
+ self.start(False,
+ (videoNode.pause,
+ lambda: videoNode.seekToFrame(videoNode.getNumFrames()),
+ videoNode.play,
+ lambda: None
+ ))
except TestException:
self.__exceptionThrown = True
self.assert_(self.__exceptionThrown)
def testVideoEOF(self):
- Player.setFakeFPS(25)
- for filename in ["mpeg1-48x48.mpg", "mpeg1-48x48-sound.avi"]:
- node = avg.VideoNode(href="../video/testfiles/"+filename)
+ player.setFakeFPS(25)
+ for filename in ["mpeg1-48x48.mov", "mpeg1-48x48-sound.avi"]:
+ node = avg.VideoNode(href=filename)
self.testEOF(node)
- node = avg.VideoNode(href="../video/testfiles/mpeg1-48x48.mpg", opacity=0)
+ node = avg.VideoNode(href="mpeg1-48x48.mov", opacity=0)
self.testEOF(node)
root = self.loadEmptyScene()
- video = avg.VideoNode(href="../video/testfiles/mpeg1-48x48.mpg", threaded=False,
+ video = avg.VideoNode(href="mpeg1-48x48.mov", threaded=False,
parent=root)
- Player.setFakeFPS(0.1)
-
- video.setEOFCallback(lambda: foo) # Should never be called
- self.start([
- lambda: video.setEOFCallback(None),
+ player.setFakeFPS(0.1)
+
+ # Should never be called
+ eofID = video.subscribe(avg.Node.END_OF_FILE, lambda: self.assert_(False))
+ self.start(False,
+ (lambda: video.unsubscribe(avg.Node.END_OF_FILE, eofID),
video.play,
None
- ])
+ ))
+
+ def testVideoSeekAfterEOF(self):
+ def onEOF():
+ node.seekToTime(0)
+ player.subscribe(avg.Player.ON_FRAME, onFrame)
+ def onFrame():
+ if node.getCurTime() < 100:
+ self.compareImage("testSeekAfterEOF")
+ player.stop()
+
+ def onNoEOF():
+ self.fail("No EOF")
+
+ player.setFakeFPS(25)
+ root = self.loadEmptyScene()
+ node = avg.VideoNode(href="mpeg1-48x48.mov", parent=root)
+ node.play()
+ node.subscribe(avg.VideoNode.END_OF_FILE, onEOF)
+ player.setTimeout(100000, onNoEOF)
+ player.play()
def testSound(self):
def testSoundFile(filename):
@@ -413,13 +449,12 @@ class AVTestCase(AVGTestCase):
node.volume = volume
def testGetVolume(volume):
- self.assertEqual(node.volume, volume)
+ self.assertAlmostEqual(node.volume, volume)
root = self.loadEmptyScene()
- node = avg.SoundNode(href="../video/testfiles/"+filename,
- parent=root)
- self.start((
- lambda: setVolume(0.5),
+ node = avg.SoundNode(href=filename, parent=root)
+ self.start(False,
+ (lambda: setVolume(0.5),
lambda: testGetVolume(0.5),
lambda: node.play(),
None,
@@ -435,10 +470,12 @@ class AVTestCase(AVGTestCase):
lambda: testGetVolume(0.3),
lambda: node.pause()
))
- Player.setFakeFPS(-1)
- Player.volume = 0
+ player.setFakeFPS(-1)
+ player.volume = 0
+ # "44.1kHz_mono.ogg" not tested for now - broken under Windows.
+ # Assuming buggy ffmpeg version.
for filename in ["22.050Hz_16bit_mono.wav", "44.1kHz_16bit_stereo.aif",
- "44.1kHz_16bit_stereo.wav", "44.1kHz_mono.ogg", "44.1kHz_stereo.mp3",
+ "44.1kHz_16bit_stereo.wav", "44.1kHz_stereo.mp3",
"48kHz_24bit_stereo.wav"]:
testSoundFile(filename)
@@ -450,40 +487,50 @@ class AVTestCase(AVGTestCase):
self.assertEqual(node.getNumAudioChannels(), 2)
def checkExceptions():
- node = avg.SoundNode(href="../video/testfiles/44.1kHz_16bit_stereo.wav")
+ node = avg.SoundNode(href="44.1kHz_16bit_stereo.wav")
self.assertException(node.getAudioCodec)
self.assertException(node.getAudioSampleRate)
self.assertException(node.getNumAudioChannels)
def checkVideoFile():
- node = avg.SoundNode(href="../video/testfiles/mpeg1-48x48.mpg",
- parent=root)
+ node = avg.SoundNode(href="mpeg1-48x48.mov", parent=root)
self.assertException(node.pause)
root = self.loadEmptyScene()
- node = avg.SoundNode(href="../video/testfiles/44.1kHz_16bit_stereo.wav",
- parent=root)
+ node = avg.SoundNode(href="44.1kHz_16bit_stereo.wav", parent=root)
checkInfo()
checkExceptions()
- self.start((
- checkInfo,
+ self.start(False,
+ (checkInfo,
checkExceptions,
checkVideoFile,
))
+ def testSoundSeek(self):
+ player.setFakeFPS(-1)
+ player.volume = 0
+ root = self.loadEmptyScene()
+ soundNode = avg.SoundNode(parent=root, href="44.1kHz_16bit_stereo.wav")
+ soundNode.play()
+ soundNode.seekToTime(500)
+ self.start(False,
+ (None,
+ lambda: soundNode.seekToTime(200),
+ ))
+
+
def testBrokenSound(self):
def openSound():
- node = avg.SoundNode(href="../video/testfiles/44.1kHz_16bit_6Chan.ogg",
- parent=root)
+ node = avg.SoundNode(href="44.1kHz_16bit_6Chan.ogg", parent=root)
self.assertException(node.play)
root = self.loadEmptyScene()
- self.start([openSound])
+ self.start(False, [openSound])
def testSoundEOF(self):
- Player.setFakeFPS(-1)
- Player.volume = 0
- node = avg.SoundNode(href="../video/testfiles/44.1kHz_16bit_mono.wav")
+ player.setFakeFPS(-1)
+ player.volume = 0
+ node = avg.SoundNode(href="44.1kHz_16bit_mono.wav")
self.testEOF(node)
def testVideoWriter(self):
@@ -511,50 +558,56 @@ class AVTestCase(AVGTestCase):
videoNode.opacity = 1
def checkVideo(numFrames):
- savedVideoNode = avg.VideoNode(href="test.mov", pos=(48,0), threaded=False,
- parent=root)
+ savedVideoNode = avg.VideoNode(href="../test.mov", pos=(48,0),
+ threaded=False, parent=root)
savedVideoNode.pause()
self.assertEqual(savedVideoNode.getVideoCodec(), "mjpeg")
self.assertEqual(savedVideoNode.getNumFrames(), numFrames)
self.assertEqual(savedVideoNode.getStreamPixelFormat(), "yuvj420p")
def testCreateException():
- self.assertException(lambda: avg.VideoWriter(Player.getMainCanvas(),
+ self.assertException(lambda: avg.VideoWriter(player.getMainCanvas(),
"nonexistentdir/test.mov", 30))
if not(self._isCurrentDirWriteable()):
- self.skip("Current dir not writeable")
+ self.skip("Current dir not writeable.")
+ return
+ if player.isUsingGLES():
+ self.skip("VideoWriter not supported under GLES.")
return
+ self.assertException(lambda:
+ avg.VideoWriter(player.getMainCanvas(), "test.mov", 30, 3, 5, False))
+
for useCanvas in (False, True):
- Player.setFakeFPS(30)
+ player.setFakeFPS(30)
root = self.loadEmptyScene()
- videoNode = avg.VideoNode(href="../video/testfiles/mpeg1-48x48.mpg",
- threaded=False)
+ videoNode = avg.VideoNode(href="mpeg1-48x48.mov", threaded=False)
if useCanvas:
- canvas = Player.createCanvas(id="canvas", size=(48,48))
+ canvas = player.createCanvas(id="canvas", size=(48,48),
+ mediadir="media")
canvas.getRootNode().appendChild(videoNode)
avg.ImageNode(parent=root, href="canvas:canvas")
testImageName = "testVideoWriterCanvas"
else:
root.appendChild(videoNode)
- canvas = Player.getMainCanvas()
+ canvas = player.getMainCanvas()
testImageName = "testVideoWriter"
- self.start((
- videoNode.play,
+ self.start(False,
+ (videoNode.play,
lambda: startWriter(30, True),
- lambda: self.delay(66),
+ lambda: self.delay(100),
stopWriter,
killWriter,
lambda: checkVideo(4),
hideVideo,
- lambda: self.compareImage(testImageName+"1", False),
+ lambda: self.compareImage(testImageName+"1"),
showVideo,
testCreateException,
lambda: startWriter(15, False),
- lambda: self.delay(100),
+ lambda: self.delay(150),
stopWriter,
killWriter,
lambda: checkVideo(2),
@@ -572,23 +625,22 @@ class AVTestCase(AVGTestCase):
os.remove("test.mov")
def test2VideosAtOnce(self):
- Player.setFakeFPS(25)
+ player.setFakeFPS(25)
self.loadEmptyScene()
- root = Player.getRootNode()
+ root = player.getRootNode()
for pos in ((0,0), (80,0)):
- video = avg.VideoNode(pos=pos, threaded=False,
- href="../video/testfiles/mpeg1-48x48.mpg", parent=root)
+ video = avg.VideoNode(pos=pos, threaded=False, href="mpeg1-48x48.mov",
+ parent=root)
video.play()
- self.start([lambda: self.compareImage("test2VideosAtOnce1", False),])
+ self.start(False,
+ [lambda: self.compareImage("test2VideosAtOnce1"),])
def testVideoAccel(self):
accelConfig = avg.VideoNode.getVideoAccelConfig()
- video = avg.VideoNode(threaded=False, accelerated=False,
- href="../video/testfiles/mpeg1-48x48.mpg")
+ video = avg.VideoNode(accelerated=False, href="media/mpeg1-48x48.mov")
video.play()
self.assertEqual(video.accelerated, False)
- video = avg.VideoNode(threaded=False, accelerated=True,
- href="../video/testfiles/mpeg1-48x48.mpg")
+ video = avg.VideoNode(accelerated=True, href="media/mpeg1-48x48.mov")
video.play()
self.assertEqual(video.accelerated, (accelConfig != avg.NO_ACCELERATION))
@@ -597,6 +649,7 @@ def AVTestSuite(tests):
availableTests = [
"testSound",
"testSoundInfo",
+ "testSoundSeek",
"testBrokenSound",
"testSoundEOF",
"testVideoInfo",
@@ -611,6 +664,7 @@ def AVTestSuite(tests):
"testVideoLoop",
"testVideoMask",
"testVideoEOF",
+ "testVideoSeekAfterEOF",
"testException",
"testVideoWriter",
"test2VideosAtOnce",
@@ -618,4 +672,3 @@ def AVTestSuite(tests):
]
return createAVGTestSuite(availableTests, AVTestCase, tests)
-Player = avg.Player.get()
diff --git a/src/test/AnimTest.py b/src/test/AnimTest.py
index bdd80cc..7ba49cc 100644
--- a/src/test/AnimTest.py
+++ b/src/test/AnimTest.py
@@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
# libavg - Media Playback Engine.
-# Copyright (C) 2003-2011 Ulrich von Zadow
+# 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
@@ -20,9 +20,7 @@
# Current versions can be found at www.libavg.de
#
-import unittest
-
-from libavg import avg
+from libavg import avg, player
from testcase import *
class AnimTestCase(AVGTestCase):
@@ -33,7 +31,7 @@ class AnimTestCase(AVGTestCase):
root = self.loadEmptyScene()
self.__node = avg.ImageNode(id="test", pos=(64,30), href="rgb24-65x65.png",
parent=root)
- Player.setFakeFPS(10)
+ player.setFakeFPS(10)
def testAnimType(self, curAnim, imgBaseName):
def onStop():
@@ -54,27 +52,27 @@ class AnimTestCase(AVGTestCase):
self.__anim.setStopCallback(onStop)
self.__onStopCalled = False
self.assertException(lambda: self.__anim.start())
- self.start((
- startAnim,
- lambda: self.compareImage(imgBaseName+"1", False),
- lambda: self.compareImage(imgBaseName+"2", False),
- lambda: self.compareImage(imgBaseName+"3", False),
+ self.start(False,
+ (startAnim,
+ lambda: self.compareImage(imgBaseName+"1"),
+ lambda: self.compareImage(imgBaseName+"2"),
+ lambda: self.compareImage(imgBaseName+"3"),
lambda: self.assert_(self.__onStopCalled),
lambda: self.assert_(not(self.__anim.isRunning())),
lambda: self.assertEqual(avg.getNumRunningAnims(), 0),
- lambda: self.compareImage(imgBaseName+"4", False),
+ lambda: self.compareImage(imgBaseName+"4"),
lambda: self.assertEqual(self.__node.x, 100),
startAnim,
- lambda: self.compareImage(imgBaseName+"1", False),
+ lambda: self.compareImage(imgBaseName+"1"),
lambda: self.assertEqual(avg.getNumRunningAnims(), 1),
abortAnim,
lambda: self.assertEqual(avg.getNumRunningAnims(), 0),
- lambda: self.compareImage(imgBaseName+"5", False),
+ lambda: self.compareImage(imgBaseName+"5"),
lambda: self.assert_(not(self.__anim.isRunning())),
None,
lambda: self.assert_(self.__onStopCalled),
startKeepAttr,
- lambda: self.compareImage(imgBaseName+"6", False),
+ lambda: self.compareImage(imgBaseName+"6"),
lambda: self.assertEqual(avg.getNumRunningAnims(), 1)
))
self.__anim = None
@@ -92,15 +90,15 @@ class AnimTestCase(AVGTestCase):
self.__onStopBeforeOnStart = self.__onStopCalled
self.initScene()
- sameNode = Player.getElementByID("test")
+ sameNode = player.getElementByID("test")
anim1 = avg.LinearAnim(self.__node, "x", 500, 0, 100,
False, None, on1Stop)
anim2 = avg.LinearAnim(sameNode, "x", 300, 0, 100,
False, on2Start)
self.__onStopCalled = False
self.__onStopBeforeOnStart = False
- self.start((
- lambda: anim1.start(),
+ self.start(False,
+ (lambda: anim1.start(),
lambda: self.assert_(not(self.__onStopCalled)),
lambda: anim2.start(),
lambda: self.assert_(self.__onStopBeforeOnStart),
@@ -116,11 +114,11 @@ class AnimTestCase(AVGTestCase):
self.initScene()
self.__node.opacity=0.5
self.__onStopCalled = False
- self.start((
- lambda: avg.fadeIn(self.__node, 200, 1, onStop),
- lambda: self.compareImage("testFadeIn1", False),
- lambda: self.compareImage("testFadeIn2", False),
- lambda: self.compareImage("testFadeIn3", False),
+ self.start(False,
+ (lambda: avg.fadeIn(self.__node, 200, 1, onStop),
+ lambda: self.compareImage("testFadeIn1"),
+ lambda: self.compareImage("testFadeIn2"),
+ lambda: self.compareImage("testFadeIn3"),
lambda: self.assert_(self.__onStopCalled),
lambda: self.assertEqual(avg.getNumRunningAnims(), 0)
))
@@ -133,11 +131,11 @@ class AnimTestCase(AVGTestCase):
self.initScene()
self.__node.opacity=0.5
self.__onStopCalled = False
- self.start((
- lambda: avg.fadeOut(self.__node, 200, onStop),
- lambda: self.compareImage("testFadeOut1", False),
- lambda: self.compareImage("testFadeOut2", False),
- lambda: self.compareImage("testFadeOut3", False),
+ self.start(False,
+ (lambda: avg.fadeOut(self.__node, 200, onStop),
+ lambda: self.compareImage("testFadeOut1"),
+ lambda: self.compareImage("testFadeOut2"),
+ lambda: self.compareImage("testFadeOut3"),
lambda: self.assert_(self.__onStopCalled),
lambda: self.assertEqual(avg.getNumRunningAnims(), 0)
))
@@ -159,9 +157,9 @@ class AnimTestCase(AVGTestCase):
self.initScene()
self.__anim = avg.LinearAnim(self.__node, "x", 0, 0, 100, False, None, onStop)
self.__onStopCalled = False
- self.start((
- startAnim,
- lambda: self.compareImage("testLinearAnimZeroDurationC1", False),
+ self.start(False,
+ (startAnim,
+ lambda: self.compareImage("testLinearAnimZeroDurationC1"),
lambda: self.assertEqual(avg.getNumRunningAnims(), 0),
lambda: self.assert_(self.__onStopCalled),
lambda: self.assert_(not(self.__anim.isRunning()))
@@ -180,10 +178,10 @@ class AnimTestCase(AVGTestCase):
anim.start()
self.initScene()
- self.start((
- forth,
- lambda: self.delay(300),
- ))
+ self.start(False,
+ (forth,
+ lambda: self.delay(300),
+ ))
def testPointAnim(self):
def startAnim():
@@ -196,32 +194,29 @@ class AnimTestCase(AVGTestCase):
self.initScene()
self.__anim = avg.LinearAnim(self.__node, "pos", 200, avg.Point2D(0,0),
avg.Point2D(100,40), False)
- self.start((
- startAnim,
- lambda: self.compareImage("testPointAnim1", False),
- lambda: self.compareImage("testPointAnim2", False),
+ self.start(False,
+ (startAnim,
+ lambda: self.compareImage("testPointAnim1"),
+ lambda: self.compareImage("testPointAnim2"),
None,
lambda: self.assert_(not(self.__anim.isRunning())),
startKeepAttr,
- lambda: self.compareImage("testPointAnim3", False),
+ lambda: self.compareImage("testPointAnim3"),
))
def testIntAnim(self):
- def startAnim():
- self.__anim.start()
-
self.initScene()
self.__doubleAnim = avg.LinearAnim(self.__node, "x", 300, 0, 100, True)
self.__pointAnim = avg.LinearAnim(self.__node, "pos", 200, avg.Point2D(0,0),
avg.Point2D(100,40), True)
- self.start((
- self.__doubleAnim.start,
+ self.start(False,
+ (self.__doubleAnim.start,
lambda: self.delay(100),
- lambda: self.compareImage("testIntAnim1", False),
+ lambda: self.compareImage("testIntAnim1"),
self.__doubleAnim.abort,
self.__pointAnim.start,
lambda: self.delay(100),
- lambda: self.compareImage("testIntAnim2", False),
+ lambda: self.compareImage("testIntAnim2"),
))
def testEaseInOutAnim(self):
@@ -247,17 +242,17 @@ class AnimTestCase(AVGTestCase):
self.__animStarted = False
self.__animStopped = False
- self.start((
- self.__anim.start,
+ self.start(False,
+ (self.__anim.start,
lambda: self.assert_(self.__animStarted),
- lambda: self.compareImage("testContinuousAnim1", False),
+ lambda: self.compareImage("testContinuousAnim1"),
self.__anim.abort,
lambda: self.assert_(self.__animStopped),
reset,
self.__anim.start,
self.__linearAnim.start,
lambda: self.assert_(self.__animStopped),
- lambda: self.compareImage("testContinuousAnim2", False),
+ lambda: self.compareImage("testContinuousAnim2"),
self.__linearAnim.abort,
))
@@ -271,8 +266,8 @@ class AnimTestCase(AVGTestCase):
self.initScene()
self.__endCalled = False
- self.start((
- startAnim,
+ self.start(False,
+ (startAnim,
lambda: self.assert_(self.anim.isRunning()),
lambda: self.delay(200),
lambda: self.assert_(not(self.anim.isRunning())),
@@ -318,24 +313,24 @@ class AnimTestCase(AVGTestCase):
node = avg.ImageNode(id=str(i), pos=(64, i*20), href="rgb24-64x64.png")
root.appendChild(node)
self.nodes.append(node)
- Player.setFakeFPS(10)
+ player.setFakeFPS(10)
self.__endCalled = False
- self.start((
- startFireForgetAnim,
+ self.start(False,
+ (startFireForgetAnim,
lambda: self.assertEqual(avg.getNumRunningAnims(), 2),
None,
startAnim,
lambda: self.assertEqual(avg.getNumRunningAnims(), 3),
- lambda: self.compareImage("testParallelAnimC1", False),
+ lambda: self.compareImage("testParallelAnimC1"),
lambda: self.assert_(self.anim.isRunning()),
lambda: self.delay(200),
lambda: self.assert_(not(self.anim.isRunning())),
- lambda: self.compareImage("testParallelAnimC2", False),
+ lambda: self.compareImage("testParallelAnimC2"),
lambda: self.assert_(self.__endCalled),
lambda: self.assertEqual(avg.getNumRunningAnims(), 0),
startAnim,
abortAnim,
- lambda: self.compareImage("testParallelAnimC3", False),
+ lambda: self.compareImage("testParallelAnimC3"),
lambda: self.assert_(self.__endCalled),
lambda: self.assertEqual(avg.getNumRunningAnims(), 0),
startTimedAnim,
@@ -356,8 +351,8 @@ class AnimTestCase(AVGTestCase):
avg.LinearAnim(self.__node, "x", 300, 0, 100, False, None).start()
self.initScene()
- self.start((
- makeAnims,
+ self.start(False,
+ (makeAnims,
None
))
@@ -387,25 +382,80 @@ class AnimTestCase(AVGTestCase):
self.__state1StopCallbackCalled = False
self.__state2StartCallbackCalled = False
self.__stop1Start2CallbackOrder = False
- self.start((
- makeAnim,
- lambda: self.compareImage("testStateAnimC1", False),
+ self.start(False,
+ (makeAnim,
+ lambda: self.compareImage("testStateAnimC1"),
lambda: self.anim.setState("STATE1"),
None,
- lambda: self.compareImage("testStateAnimC2", False),
+ lambda: self.compareImage("testStateAnimC2"),
lambda: self.assertEqual(self.anim.getState(), "STATE2"),
- lambda: self.compareImage("testStateAnimC3", False),
+ lambda: self.compareImage("testStateAnimC3"),
lambda: self.assert_(self.__state1StopCallbackCalled),
lambda: self.assert_(self.__state2StartCallbackCalled),
lambda: self.assert_(self.__stop1Start2CallbackOrder),
lambda: self.assertEqual(self.anim.getState(), "STATE3"),
- lambda: self.compareImage("testStateAnimC4", False),
+ lambda: self.compareImage("testStateAnimC4"),
lambda: self.anim.setState("STATE1"),
lambda: self.assertEqual(avg.getNumRunningAnims(), 1),
- lambda: self.compareImage("testStateAnimC5", False),
+ lambda: self.compareImage("testStateAnimC5"),
killAnim,
-# lambda: Player.getTestHelper().dumpObjects()
+# lambda: player.getTestHelper().dumpObjects()
+ ))
+
+ def testNonNodeAttrAnim(self):
+ class GenericClass(object):
+ def __init__(self):
+ self.numberValue = 0
+ self.pointValue = avg.Point2D(0.0, 0.0)
+
+ def on1Stop():
+ self.__onStopCalled = True
+
+ def on2Start():
+ self.__onStopBeforeOnStart = self.__onStopCalled
+
+ self.loadEmptyScene()
+ player.setFakeFPS(10)
+ genericObject1 = GenericClass()
+ genericObject2 = genericObject1
+ genericObject3 = GenericClass()
+ anim1 = avg.LinearAnim(genericObject1, "numberValue", 1000, 0, 100,
+ False, None, on1Stop)
+ anim2 = avg.LinearAnim(genericObject2, "numberValue", 1200, 0, 200,
+ False, on2Start)
+ anim3 = avg.LinearAnim(genericObject1, "pointValue", 800, (0, 0), (100, 200))
+ anim4 = avg.LinearAnim(genericObject3, "numberValue", 400, 0, 42)
+ self.__onStopCalled = False
+ self.__onStopBeforeOnStart = False
+ self.start(False,
+ (lambda: anim1.start(),
+ lambda: self.assert_(anim1.isRunning()),
+ lambda: self.assert_(not(self.__onStopCalled)),
+ lambda: anim2.start(),
+ lambda: self.assert_(self.__onStopBeforeOnStart),
+ lambda: self.assert_(not(anim1.isRunning())),
+ lambda: self.assert_(anim2.isRunning()),
+ lambda: self.assertEqual(avg.getNumRunningAnims(), 1),
+ lambda: anim3.start(),
+ lambda: self.assert_(anim2.isRunning()),
+ lambda: self.assert_(anim3.isRunning()),
+ lambda: self.assertEqual(avg.getNumRunningAnims(), 2),
+ lambda: anim4.start(),
+ lambda: self.assert_(anim4.isRunning()),
+ lambda: self.assertEqual(avg.getNumRunningAnims(), 3),
+ lambda: self.delay(200),
+ lambda: self.assertEqual(avg.getNumRunningAnims(), 0),
+ lambda: self.assert_(genericObject1.numberValue == 200),
+ lambda: self.assert_(genericObject2.pointValue == (100, 200)),
+ lambda: self.assert_(genericObject3.numberValue == 42)
))
+ anim1 = None
+ anim2 = None
+ anim3 = None
+ anim4 = None
+ genericObject1 = None
+ genericObject2 = None
+ genericObject3 = None
def animTestSuite(tests):
@@ -425,7 +475,7 @@ def animTestSuite(tests):
"testParallelAnim",
"testParallelAnimRegistry",
"testStateAnim",
+ "testNonNodeAttrAnim"
)
return createAVGTestSuite(availableTests, AnimTestCase, tests)
-Player = avg.Player.get()
diff --git a/src/test/AppTest.py b/src/test/AppTest.py
new file mode 100644
index 0000000..547cf9a
--- /dev/null
+++ b/src/test/AppTest.py
@@ -0,0 +1,314 @@
+#!/usr/bin/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
+#
+# Original author of this file is OXullo Interecans <x at brainrapers dot org>
+
+
+import os
+import sys
+import tempfile
+import libavg
+from libavg import player
+from libavg.app import settings
+from libavg.app import keyboardmanager
+from libavg.app.settings import Option
+import testcase
+
+class SuppressOutput(object):
+ class Blackhole(object):
+ def write(self, *args):
+ pass
+
+ def __init__(self):
+ self.__savedStreams = [sys.stdout, sys.stderr]
+
+ def __enter__(self):
+ sys.stdout = self.Blackhole()
+ sys.stderr = self.Blackhole()
+
+ def __exit__(self, *args):
+ sys.stdout, sys.stderr = self.__savedStreams
+
+
+class TestApp(libavg.app.App):
+ CUSTOM_SETTINGS = {'app_resolution': '160x120', 'app_window_size': '160x120'}
+
+ def testRun(self, onFrameHandlersList=[], mainDiv=None, runtimeOptions={}):
+ assert type(onFrameHandlersList) == list
+ self.__onFrameHandlersList = onFrameHandlersList
+ player.subscribe(player.ON_FRAME, self.__onFrame)
+ player.setFramerate(10000)
+ player.assumePixelsPerMM(1)
+ for k, v in self.CUSTOM_SETTINGS.iteritems():
+ self.settings.set(k, v)
+
+ if mainDiv is None:
+ mainDiv = libavg.app.MainDiv()
+
+ self.run(mainDiv, **runtimeOptions)
+
+ def __onFrame(self):
+ if self.__onFrameHandlersList:
+ todo = self.__onFrameHandlersList.pop(0)
+ todo()
+ else:
+ player.stop()
+
+
+class AppTestCase(testcase.AVGTestCase):
+ def testSettingsOptions(self):
+ self.assertRaises(ValueError, lambda: settings.Option('test', 1))
+
+ self.assertRaises(RuntimeError, lambda: settings.Settings(
+ [Option('foo', 'bar'), Option('foo', 'bar')]))
+
+ s = settings.Settings([Option('foo', 'bar')])
+ self.assertRaises(RuntimeError, lambda: s.addOption(Option('foo', 'baz')))
+
+ def testSettingsTypes(self):
+ defaults = [
+ Option('test_boolean', 'True', 'help'),
+ Option('test_string', 'string'),
+ Option('another_value_int', '1234'),
+ Option('test_2d', '1280x1024'),
+ Option('test_2d_alt','1280,1024'),
+ Option('test_float','12.345'),
+ Option('test_json','[1, null,3 , "string", 12.345]')
+ ]
+
+ s = settings.Settings(defaults)
+
+ self.assertEquals(s.getBoolean('test_boolean'), True)
+
+ self.assertEquals(type(s.get('test_string')), str)
+ self.assertRaises(ValueError, lambda: s.getBoolean('test_string'))
+
+ self.assertEquals(s.getInt('another_value_int'), 1234)
+ self.assertRaises(ValueError, lambda: s.getInt('test_string'))
+ self.assertEquals(s.get('another_value_int'), '1234')
+
+ self.assertEquals(s.getPoint2D('test_2d'), libavg.Point2D(1280, 1024))
+ self.assertEquals(s.getPoint2D('test_2d_alt'), libavg.Point2D(1280, 1024))
+ self.assertRaises(ValueError, lambda: s.getInt('test_2d'))
+
+ self.assertEquals(s.getFloat('test_float'), 12.345)
+
+ self.assertEquals(s.getJson('test_json'), [1, None, 3, 'string', 12.345])
+
+ def testSettingsSet(self):
+ s = settings.Settings()
+ s.addOption(Option('test_value', ''))
+ self.assertRaises(ValueError, lambda: s.set('test_value', 1234))
+
+ s.set('test_value', '1234')
+ self.assertEquals(s.getInt('test_value'), 1234)
+
+ def testSettingsHasOption(self):
+ s = settings.Settings()
+ s.addOption(Option('test_value', ''))
+ self.assertEquals(s.hasOption('test_value'), True)
+ self.assertEquals(s.hasOption('test_value_foo'), False)
+
+ def testSettingsArgvExtender(self):
+ s = settings.Settings([Option('foo_bar', 'bar')])
+ e = settings.ArgvExtender('', args=['foo', '--foo-bar', 'baz', '-c', 'baz2'])
+ e.parser.add_option('-c')
+ s.applyExtender(e)
+ self.assertEquals(s.get('foo_bar'), 'baz')
+ self.assertEquals(e.parsedArgs[0].c, 'baz2')
+ self.assertEquals(e.parsedArgs[1], ['foo'])
+
+ e = settings.ArgvExtender('', args=['foo', '--foo-baxxx', 'baz'])
+ with SuppressOutput():
+ self.assertRaises(SystemExit, lambda: s.applyExtender(e))
+
+ def testSettingsKargsExtender(self):
+ s = settings.Settings([Option('foo_bar', 'bar')])
+ e = settings.KargsExtender({'foo_bar': 'baz'})
+ s.applyExtender(e)
+ self.assertEquals(s.get('foo_bar'), 'baz')
+
+ e = settings.KargsExtender({'foo_baxxx': 'baz'})
+ self.assertRaises(RuntimeError, lambda: s.applyExtender(e))
+
+ def testAppAdditionalSettings(self):
+ app = TestApp()
+ app.settings.addOption(Option('foo_bar', 'baz'))
+ app.settings.addOption(Option('bar_foo', 'baz'))
+ self.assertEquals(app.settings.get('foo_bar'), 'baz')
+
+ def testAppRuntimeSettings(self):
+ app = TestApp()
+ app.settings.addOption(Option('foo_bar', 'baz'))
+ app.testRun([
+ lambda: self.assertEquals(libavg.app.instance.settings.get('foo_bar'),
+ 'bar'),
+ ],
+ runtimeOptions={'foo_bar':'bar'})
+
+ def testAppRuntimeSettingsFail(self):
+ app = TestApp()
+ self.assertRaises(RuntimeError,
+ lambda: app.testRun(runtimeOptions={'foo_bar':'bar'}))
+
+ def testAppInstance(self):
+ app = TestApp()
+ self.assertEquals(app, libavg.app.instance)
+
+ def testAppResolution(self):
+ app = TestApp()
+ app.testRun([
+ lambda: self.assertEquals(player.getRootNode().size, (160, 120)),
+ lambda: self.assert_(not player.isFullscreen()),
+ ])
+
+ def testAppDefaultWindowSize(self):
+ app = TestApp()
+ app.CUSTOM_SETTINGS = {'app_resolution': '160x120'}
+ app.testRun()
+
+ def testAppFullscreen(self):
+ app = TestApp()
+ app.settings.set('app_fullscreen', 'true')
+ app.testRun([
+ lambda: self.assert_(player.isFullscreen()),
+ ])
+
+ def testAppRotation(self):
+ app = TestApp()
+ app.settings.set('app_rotation', 'left')
+ app.testRun([
+ lambda: self.assertEquals(player.getRootNode().size, (120, 160)),
+ ])
+
+ def testScreenshot(self):
+ tempDir = tempfile.gettempdir()
+ expectedFiles = map(lambda v: os.path.join(tempDir, v),
+ ['TestApp-001.png', 'TestApp-002.png'])
+
+ def removeFiles():
+ for file in expectedFiles:
+ if os.path.exists(file):
+ os.unlink(file)
+
+ def testScreenshots():
+ for file in expectedFiles:
+ self.assert_(os.path.exists(file))
+
+ removeFiles()
+ app = TestApp()
+ app.testRun([
+ lambda: app.takeScreenshot(tempDir),
+ lambda: app.takeScreenshot(tempDir),
+ testScreenshots,
+ removeFiles,
+ ])
+
+ def testKeyboardManagerPlain(self):
+ tester = lambda: self.__emuKeyPress(0, 97, 'a', 97, libavg.avg.KEYMOD_NONE)
+ self.__testKeyboardManager('a', libavg.avg.KEYMOD_NONE, tester)
+
+ def testKeyboardManagerPlainMod(self):
+ tester = lambda: self.__emuKeyPress(0, 97, 'a', 97, libavg.avg.KEYMOD_LSHIFT)
+ self.__testKeyboardManager('a', libavg.avg.KEYMOD_SHIFT, tester)
+
+ def testKeyboardManagerUnicodeBinary(self):
+ tester = lambda: self.__emuKeyPress(53, 164, 'ö', 246, libavg.avg.KEYMOD_NONE)
+ self.__testKeyboardManager('ö', libavg.avg.KEYMOD_NONE, tester)
+
+ def testKeyboardManagerUnicodeExplicit(self):
+ tester = lambda: self.__emuKeyPress(53, 164, 'ö', 246, libavg.avg.KEYMOD_NONE)
+ self.__testKeyboardManager(u'ö', libavg.avg.KEYMOD_NONE, tester)
+
+ def testKeyboardManagerUnicodeMod(self):
+ tester = lambda: self.__emuKeyPress(0, 65, 'A', 65, libavg.avg.KEYMOD_LSHIFT)
+ self.__testKeyboardManager(u'A', keyboardmanager.KEYMOD_ANY, tester)
+ self.tearDown()
+ self.__testKeyboardManager(u'A', libavg.avg.KEYMOD_SHIFT, tester)
+
+ def tearDown(self):
+ libavg.app.instance = None
+
+ def __testKeyboardManager(self, keyString, modifiers, tester):
+ self.statesRecords = [False, False]
+ def keyDownPressed():
+ self.statesRecords[0] = True
+
+ def keyUpPressed():
+ self.statesRecords[1] = True
+
+ def bindKeys():
+ keyboardmanager.bindKeyDown(keyString, keyDownPressed, '', modifiers)
+ keyboardmanager.bindKeyUp(keyString, keyUpPressed, '', modifiers)
+
+ def reset():
+ keyboardmanager.unbindKeyDown(keyString, modifiers)
+ keyboardmanager.unbindKeyUp(keyString, modifiers)
+ self.statesRecords = [False, False]
+
+ def cleanup():
+ del self.statesRecords
+
+ app = TestApp()
+ app.testRun([
+ bindKeys,
+ tester,
+ lambda: self.assert_(all(self.statesRecords)),
+ reset,
+ tester,
+ lambda: self.assert_(not any(self.statesRecords)),
+ cleanup,
+ ])
+
+ def __emuKeyPress(self, scanCode, keyCode, keyString, unicode_, modifiers):
+ helper = libavg.player.getTestHelper()
+ helper.fakeKeyEvent(libavg.avg.Event.KEY_DOWN, scanCode, keyCode, keyString,
+ unicode_, modifiers)
+ # Note: on up, unicode is always 0
+ helper.fakeKeyEvent(libavg.avg.Event.KEY_UP, scanCode, keyCode, keyString,
+ 0, modifiers)
+
+
+def appTestSuite(tests):
+ availableTests = (
+ 'testSettingsOptions',
+ 'testSettingsTypes',
+ 'testSettingsSet',
+ 'testSettingsHasOption',
+ 'testSettingsArgvExtender',
+ 'testSettingsKargsExtender',
+ 'testAppAdditionalSettings',
+ 'testAppRuntimeSettings',
+ 'testAppRuntimeSettingsFail',
+ 'testAppInstance',
+ 'testAppResolution',
+ 'testAppDefaultWindowSize',
+ 'testAppFullscreen',
+ 'testAppRotation',
+ 'testScreenshot',
+ 'testKeyboardManagerPlain',
+ 'testKeyboardManagerPlainMod',
+ 'testKeyboardManagerUnicodeBinary',
+ 'testKeyboardManagerUnicodeExplicit',
+ 'testKeyboardManagerUnicodeMod',
+ )
+ return testcase.createAVGTestSuite(availableTests, AppTestCase, tests)
+
diff --git a/src/test/DynamicsTest.py b/src/test/DynamicsTest.py
index cc247f4..522c2f0 100644
--- a/src/test/DynamicsTest.py
+++ b/src/test/DynamicsTest.py
@@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
# libavg - Media Playback Engine.
-# Copyright (C) 2003-2011 Ulrich von Zadow
+# 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
@@ -20,7 +20,7 @@
# Current versions can be found at www.libavg.de
#
-from libavg import avg
+from libavg import avg, player
from testcase import *
class DynamicsTestCase(AVGTestCase):
@@ -41,25 +41,26 @@ class DynamicsTestCase(AVGTestCase):
node.y = 20
self.root.appendChild(node)
self.assertException(setNodeID)
- self.assertEqual(self.root.indexOf(Player.getElementByID("nodeid1")), 0)
+ self.assertEqual(self.root.indexOf(player.getElementByID("nodeid1")), 0)
+ self.assertException(lambda: self.root.indexOf(self.root))
def createNode2(useXml):
node = createFunc(useXml)
node.id = "nodeid2"
- oldNode = Player.getElementByID("nodeid1")
+ oldNode = player.getElementByID("nodeid1")
self.root.insertChildBefore(node, oldNode)
def reorderNode():
self.root.reorderChild(0, 1)
- node = Player.getElementByID("nodeid1")
+ node = player.getElementByID("nodeid1")
self.root.reorderChild(node, 0)
def removeNodes():
- self.node = Player.getElementByID("nodeid1")
+ self.node = player.getElementByID("nodeid1")
self.root.removeChild(self.root.indexOf(self.node))
- node2 = Player.getElementByID("nodeid2")
+ node2 = player.getElementByID("nodeid2")
self.root.removeChild(node2)
- self.assertEqual(Player.getElementByID("nodeid1"), None)
+ self.assertEqual(player.getElementByID("nodeid1"), None)
def reAddNode():
self.root.appendChild(self.node)
@@ -68,34 +69,34 @@ class DynamicsTestCase(AVGTestCase):
self.node = None
def killNode():
- self.node = Player.getElementByID("nodeid1")
+ self.node = player.getElementByID("nodeid1")
self.node.unlink(True)
- gone = Player.getElementByID("nodeid1")
+ gone = player.getElementByID("nodeid1")
self.assertEqual(gone, None)
def removeAgain():
- node = Player.getElementByID("nodeid1")
+ node = player.getElementByID("nodeid1")
node.unlink()
- gone = Player.getElementByID("nodeid1")
+ gone = player.getElementByID("nodeid1")
self.assertEqual(gone, None)
def runTest(useXml):
self.root = self.loadEmptyScene()
createNode1(useXml)
- Player.stop()
+ player.stop()
self.root = self.loadEmptyScene()
- Player.setFakeFPS(25)
- self.start((
- lambda: createNode1(useXml),
- lambda: self.compareImage(testName+"1", warnOnImageDiff),
+ player.setFakeFPS(25)
+ self.start(warnOnImageDiff,
+ (lambda: createNode1(useXml),
+ lambda: self.compareImage(testName+"1"),
lambda: createNode2(useXml),
- lambda: self.compareImage(testName+"2", warnOnImageDiff),
+ lambda: self.compareImage(testName+"2"),
reorderNode,
- lambda: self.compareImage(testName+"3", warnOnImageDiff),
+ lambda: self.compareImage(testName+"3"),
removeNodes,
- lambda: self.compareImage(testName+"4", warnOnImageDiff),
+ lambda: self.compareImage(testName+"4"),
reAddNode,
- lambda: self.compareImage(testName+"5", warnOnImageDiff),
+ lambda: self.compareImage(testName+"5"),
killNode,
reAddNode,
removeAgain
@@ -107,9 +108,9 @@ class DynamicsTestCase(AVGTestCase):
def testImgDynamics(self):
def createImg(useXml):
if useXml:
- node = Player.createNode("<image href='rgb24-64x64.png'/>")
+ node = player.createNode("<image href='rgb24-64x64.png'/>")
else:
- node = Player.createNode("image", {"href":"rgb24-64x64.png"})
+ node = player.createNode("image", {"href":"rgb24-64x64.png"})
return node
self.__runDynamicsTest(createImg, "testImgDynamics")
@@ -117,13 +118,11 @@ class DynamicsTestCase(AVGTestCase):
def testVideoDynamics(self):
def createVideo(useXml):
if useXml:
- node = Player.createNode(
- "<video href='../video/testfiles/mpeg1-48x48.mpg'"
- " threaded='false'/>")
+ node = player.createNode(
+ "<video href='mpeg1-48x48.mov' threaded='false'/>")
else:
- node = Player.createNode("video",
- {"href":"../video/testfiles/mpeg1-48x48.mpg",
- "threaded":False})
+ node = player.createNode("video",
+ {"href":"mpeg1-48x48.mov", "threaded":False})
node.play()
return node
@@ -132,9 +131,9 @@ class DynamicsTestCase(AVGTestCase):
def testWordsDynamics(self):
def createWords(useXml):
if useXml:
- node = Player.createNode("<words text='test'/>")
+ node = player.createNode("<words text='test'/>")
else:
- node = Player.createNode("words", {"text":"test"})
+ node = player.createNode("words", {"text":"test"})
node.font="Bitstream Vera Sans"
node.fontsize=12
node.width=200
@@ -142,33 +141,17 @@ class DynamicsTestCase(AVGTestCase):
self.__runDynamicsTest(createWords, "testWordsDynamics", False, True)
- def testPanoDynamics(self):
- def createPano(useXml):
- if useXml:
- node = Player.createNode("""
- <panoimage href='panoimage.png' sensorwidth='4.60'
- sensorheight='3.97' focallength='12'
- width='160' height='120'/>
- """)
- else:
- node = Player.createNode("panoimage",
- {"href":"panoimage.png", "sensorwidth":4.60, "sensorheight":3.97,
- "focallength":12, "width":160, "height":120})
- return node
-
- self.__runDynamicsTest(createPano, "testPanoDynamics")
-
def testDivDynamics(self):
def createDiv(useXml):
if useXml:
- node = Player.createNode("""
+ node = player.createNode("""
<div>
<image href='rgb24-64x64.png'/>
</div>
""")
else:
node = avg.DivNode()
- imgNode = avg.ImageNode(href="rgb24-64x64.png", parent=node)
+ avg.ImageNode(href="rgb24-64x64.png", parent=node)
return node
self.__runDynamicsTest(createDiv, "testDivDynamics")
@@ -178,8 +161,8 @@ class DynamicsTestCase(AVGTestCase):
avg.ImageNode(href="rgb24-64x64.png", id="testdup", parent=root)
self.assertException(lambda: avg.ImageNode(href="rgb24-64x64.png",
id="testdup", parent=root))
- self.start((
- self.assertException(lambda: avg.ImageNode(href="rgb24-64x64.png",
+ self.start(False,
+ (self.assertException(lambda: avg.ImageNode(href="rgb24-64x64.png",
id="testdup", parent=root)),
))
@@ -191,23 +174,23 @@ class DynamicsTestCase(AVGTestCase):
root = self.loadEmptyScene()
self.assertException(changeParent)
- self.start((self.assertException(changeParent),))
+ self.start(False, (self.assertException(changeParent),))
def testDynamicEventCapture(self):
# Tests if deleting a node that has events captured works.
def createImg():
parentNode = root
- node = Player.createNode("image", {"id": "img", "href":"rgb24-64x64.png"})
+ node = player.createNode("image", {"id": "img", "href":"rgb24-64x64.png"})
parentNode.appendChild(node)
- node.setEventHandler(avg.CURSORDOWN, avg.MOUSE, captureMouseDown)
- parentNode.setEventHandler(avg.CURSORUP, avg.MOUSE, mainMouseUp)
+ node.subscribe(avg.Node.CURSOR_DOWN, captureMouseDown)
+ parentNode.subscribe(avg.Node.CURSOR_UP, mainMouseUp)
def setEventCapture():
- Player.getElementByID("img").setEventCapture()
+ player.getElementByID("img").setEventCapture()
def deleteImg():
parentNode = root
- node = Player.getElementByID("img")
+ node = player.getElementByID("img")
parentNode.removeChild(parentNode.indexOf(node))
def captureMouseDown(event):
@@ -216,19 +199,16 @@ class DynamicsTestCase(AVGTestCase):
def mainMouseUp(event):
self.mainMouseUpCalled = True
- Helper = Player.getTestHelper()
self.captureMouseDownCalled = False
self.mainMouseUpCalled = False
root = self.loadEmptyScene()
- self.start((
- createImg,
+ self.start(False,
+ (createImg,
setEventCapture,
- lambda: Helper.fakeMouseEvent(avg.CURSORDOWN, True, False, False,
- 100, 10, 1),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_DOWN, 100, 10),
lambda: self.assert_(self.captureMouseDownCalled),
deleteImg,
- lambda: Helper.fakeMouseEvent(avg.CURSORUP, True, False, False,
- 100, 10, 1),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_UP, 100, 10),
lambda: self.assert_(self.mainMouseUpCalled)
))
@@ -242,21 +222,21 @@ class DynamicsTestCase(AVGTestCase):
return True
def setHandler (node, s, swallow = False):
- node.setEventHandler(avg.CURSORDOWN, avg.MOUSE,
+ node.setEventHandler(avg.Event.CURSOR_DOWN, avg.Event.MOUSE,
lambda e: appendEventString(s) and swallow)
parentNode = root
- node = Player.createNode("div", {'x':0,'y':0,'width':50, 'height':50})
+ node = player.createNode("div", {'x':0,'y':0,'width':50, 'height':50})
setHandler (node, 'a')
parentNode.appendChild(node)
- node = Player.createNode("div", {'x':0,'y':0,'width':100, 'height':100})
+ node = player.createNode("div", {'x':0,'y':0,'width':100, 'height':100})
setHandler (node, 'b')
parentNode.insertChild(node,0)
parentNode = node
- node = Player.createNode("div", {'x':40,'y':40,'width':30, 'height':30})
+ node = player.createNode("div", {'x':40,'y':40,'width':30, 'height':30})
setHandler (node, 'c')
parentNode.appendChild(node)
- node = Player.createNode("div", {'x':60,'y':40,'width':30, 'height':30})
+ node = player.createNode("div", {'x':60,'y':40,'width':30, 'height':30})
setHandler (node, 'd', True)
parentNode.appendChild(node)
@@ -264,17 +244,17 @@ class DynamicsTestCase(AVGTestCase):
self.__eventString = ''
root = self.loadEmptyScene()
- self.start((
- createNodes,
- resetEventString,
- lambda: click (10,10),
- lambda: self.assertEqual(self.__eventString, 'a'),
- resetEventString,
- lambda: click (55,55),
- lambda: self.assertEqual(self.__eventString, 'cb'),
- resetEventString,
- lambda: click (65,55),
- lambda: self.assertEqual(self.__eventString, 'd'),
+ self.start(False,
+ (createNodes,
+ resetEventString,
+ lambda: click (10,10),
+ lambda: self.assertEqual(self.__eventString, 'a'),
+ resetEventString,
+ lambda: click (55,55),
+ lambda: self.assertEqual(self.__eventString, 'cb'),
+ resetEventString,
+ lambda: click (65,55),
+ lambda: self.assertEqual(self.__eventString, 'd'),
))
def testComplexDiv(self):
@@ -282,17 +262,17 @@ class DynamicsTestCase(AVGTestCase):
imgNode.id = "imageid"
def createDiv():
- imgNode = Player.createNode("image",
+ imgNode = player.createNode("image",
{"id":"imageid", "href":"rgb24-64x64.png"})
- node = Player.createNode("div", {"id":"divid"})
+ node = player.createNode("div", {"id":"divid"})
node.appendChild(imgNode)
imgNode.id = "imageid"
root.appendChild(node)
self.assertException(lambda: setImageID(imgNode))
def removeDiv():
- node = Player.getElementByID("divid")
- imgNode = Player.getElementByID("imageid")
+ node = player.getElementByID("divid")
+ imgNode = player.getElementByID("imageid")
node.unlink()
imgNode.id = "imageid"
imgNode.unlink()
@@ -303,22 +283,22 @@ class DynamicsTestCase(AVGTestCase):
root = self.loadEmptyScene()
createDiv()
removeDiv()
- Player.stop()
+ player.stop()
root = self.loadEmptyScene()
- Player.setFakeFPS(25)
- self.start((
- createDiv,
- lambda: self.compareImage("testComplexDiv1", False),
+ player.setFakeFPS(25)
+ self.start(False,
+ (createDiv,
+ lambda: self.compareImage("testComplexDiv1"),
removeDiv,
- lambda: self.compareImage("testComplexDiv1", False),
+ lambda: self.compareImage("testComplexDiv1"),
))
def testNodeCustomization(self):
def testNodePythonAttribute():
- node1 = Player.createNode("image", {"id":"foo", "pos":(23, 42)})
+ node1 = player.createNode("image", {"id":"foo", "pos":(23, 42)})
root.appendChild(node1)
node1.customAttribute = "bbb"
- node2 = Player.getElementByID("foo")
+ node2 = player.getElementByID("foo")
self.assertEqual(node1, node2)
self.assertEqual(node2.customAttribute, "bbb")
node1.unlink(True)
@@ -328,8 +308,7 @@ class DynamicsTestCase(AVGTestCase):
class CustomImageNode(avg.ImageNode):
def __init__(self, p, parent=None, **kwargs):
avg.ImageNode.__init__(self, pos=p, href="rgb24-64x64.png", **kwargs)
- if parent:
- parent.appendChild(self)
+ self.registerInstance(self, parent)
def customMethod(self):
pass
@@ -337,28 +316,31 @@ class DynamicsTestCase(AVGTestCase):
class CustomDivNode(avg.DivNode):
def __init__(self, parent=None, **kwargs):
avg.DivNode.__init__(self, **kwargs)
- if parent:
- parent.appendChild(self)
+ self.registerInstance(self, parent)
CustomImageNode((23,42), parent=self)
- customNode = avg.ImageNode(id="foo")
- self.assertEqual(customNode.id, "foo")
- CustomImageNode((23, 42), parent=root)
+ customNode = CustomImageNode((23, 42), parent=root)
retrievedImage = root.getChild(0)
self.assertEqual(type(retrievedImage), CustomImageNode)
self.assertEqual(retrievedImage.pos, (23,42))
self.assertEqual(retrievedImage.href, "rgb24-64x64.png")
retrievedImage.customMethod()
+ customNode.unlink(True)
- CustomDivNode(parent=Player.getRootNode())
- retrievedDiv = Player.getRootNode().getChild(1)
+ CustomDivNode(parent=player.getRootNode())
+ retrievedDiv = player.getRootNode().getChild(0)
self.assertEqual(type(retrievedDiv), CustomDivNode)
retrievedImage = retrievedDiv.getChild(0)
self.assertEqual(type(retrievedImage), CustomImageNode)
-# retrievedDiv = retrievedImage.getParent()
-# print type(retrievedDiv)
-# self.assertEqual(type(retrievedDiv), CustomDivNode)
+ retrievedDiv = retrievedImage.parent
+ self.assertEqual(type(retrievedDiv), CustomDivNode)
+ retrievedDiv.unlink(True)
+
+ customNode = CustomImageNode((23,42))
+ root.appendChild(customNode)
+ retrievedImage = root.getChild(0)
+ self.assertEqual(type(retrievedImage), CustomImageNode)
root = self.loadEmptyScene()
testNodePythonAttribute()
@@ -370,13 +352,13 @@ class DynamicsTestCase(AVGTestCase):
root = self.loadEmptyScene()
root.mediadir="testmediadir"
- imageNode1 = Player.createNode("image", {"href": "rgb24-64x64a.png"})
- imageNode2 = Player.createNode("image", {"href": "rgb24-64x64a.png", "x":30})
+ imageNode1 = player.createNode("image", {"href": "rgb24-64x64a.png"})
+ imageNode2 = player.createNode("image", {"href": "rgb24-64x64a.png", "x":30})
root.appendChild(imageNode2)
- self.start((
- lambda: self.compareImage("testDynamicMediaDir1", False),
+ self.start(False,
+ (lambda: self.compareImage("testDynamicMediaDir1"),
attachNode,
- lambda: self.compareImage("testDynamicMediaDir2", False)
+ lambda: self.compareImage("testDynamicMediaDir2")
))
@@ -385,7 +367,6 @@ def dynamicsTestSuite(tests):
"testImgDynamics",
"testVideoDynamics",
"testWordsDynamics",
- # "testPanoDynamics",
"testDivDynamics",
"testEventBubbling",
"testDuplicateID",
@@ -393,9 +374,7 @@ def dynamicsTestSuite(tests):
"testDynamicEventCapture",
"testComplexDiv",
"testNodeCustomization",
- "testDynamicMediaDir"
+ "testDynamicMediaDir",
)
return createAVGTestSuite(availableTests, DynamicsTestCase, tests)
-
-Player = avg.Player.get()
diff --git a/src/test/EventTest.py b/src/test/EventTest.py
index 8287be5..afdfe94 100644
--- a/src/test/EventTest.py
+++ b/src/test/EventTest.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# libavg - Media Playback Engine.
-# Copyright (C) 2003-2011 Ulrich von Zadow
+# 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
@@ -19,13 +19,7 @@
# Current versions can be found at www.libavg.de
#
-import unittest
-
-import time
-import math
-import sys
-
-from libavg import avg
+from libavg import avg, player
from testcase import *
def dumpMouseEvent(Event):
@@ -42,12 +36,12 @@ mainMouseDownCalled = False
def mainMouseUp(Event):
global mainMouseUpCalled
- assert (Event.type == avg.CURSORUP)
+ assert (Event.type == avg.Event.CURSOR_UP)
mainMouseUpCalled = True
def mainMouseDown(Event):
global mainMouseDownCalled
- assert (Event.type == avg.CURSORDOWN)
+ assert (Event.type == avg.Event.CURSOR_DOWN)
mainMouseDownCalled = True
@@ -56,28 +50,37 @@ class EventTestCase(AVGTestCase):
AVGTestCase.__init__(self, testFuncName)
def testKeyEvents(self):
- def onKeyDown(Event):
- if Event.keystring == 'A' and Event.keycode == 65 and Event.unicode == 65:
+ def onKeyDown(event):
+ if event.keystring == 'A' and event.keycode == 65 and event.unicode == 65:
self.keyDownCalled = True
- def onKeyUp(Event):
- if Event.keystring == 'A' and Event.keycode == 65 and Event.unicode == 65:
+ def onKeyUp(event):
+ if event.keystring == 'A' and event.keycode == 65 and event.unicode == 65:
self.keyUpCalled = True
-
+
+ def onSubscribeKeyDown(event):
+ self.subscribeKeyDownCalled = True
+
+ def onSubscribeKeyUp(event):
+ self.subscribeKeyUpCalled = True
+
root = self.loadEmptyScene()
- root.setEventHandler(avg.KEYDOWN, avg.NONE, onKeyDown)
- root.setEventHandler(avg.KEYUP, avg.NONE, onKeyUp)
- self.start((
- lambda: Helper.fakeKeyEvent(avg.KEYDOWN, 65, 65, "A", 65,
+ root.setEventHandler(avg.Event.KEY_DOWN, avg.Event.NONE, onKeyDown)
+ root.setEventHandler(avg.Event.KEY_UP, avg.Event.NONE, onKeyUp)
+ player.subscribe(avg.Player.KEY_DOWN, onSubscribeKeyDown)
+ player.subscribe(avg.Player.KEY_UP, onSubscribeKeyUp)
+ self.start(False,
+ (lambda: Helper.fakeKeyEvent(avg.Event.KEY_DOWN, 65, 65, "A", 65,
+ avg.KEYMOD_NONE),
+ lambda: self.assert_(self.keyDownCalled and self.subscribeKeyDownCalled),
+ lambda: Helper.fakeKeyEvent(avg.Event.KEY_UP, 65, 65, "A", 65,
avg.KEYMOD_NONE),
- lambda: self.assert_(self.keyDownCalled),
- lambda: Helper.fakeKeyEvent(avg.KEYUP, 65, 65, "A", 65, avg.KEYMOD_NONE),
- lambda: self.assert_(self.keyUpCalled)
+ lambda: self.assert_(self.keyUpCalled and self.subscribeKeyUpCalled)
))
def testSimpleEvents(self):
def getMouseState():
- Event = Player.getMouseState()
+ Event = player.getMouseState()
self.assertEqual(Event.pos, avg.Point2D(10,10))
root = self.loadEmptyScene()
@@ -87,45 +90,47 @@ class EventTestCase(AVGTestCase):
img2 = avg.ImageNode(pos=(64,0), href="rgb24-65x65.png", parent=root)
handlerTester2 = NodeHandlerTester(self, img2)
- self.start((
- # down, getMouseState(), move, up.
+ self.start(False,
+ (# down, getMouseState(), move, up.
# events are inside img1 but outside img2.
- lambda: self.assert_(not(Player.isMultitouchAvailable())),
- lambda: Helper.fakeMouseEvent(avg.CURSORDOWN, True, False, False,
- 10, 10, 1),
+ lambda: self.assert_(not(player.isMultitouchAvailable())),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_DOWN, 10, 10),
lambda: handlerTester1.assertState(
- down=True, up=False, over=True, out=False, move=False),
- lambda: handlerTester2.assertState(
- down=False, up=False, over=False, out=False, move=False),
+ (avg.Node.CURSOR_DOWN, avg.Node.CURSOR_OVER)),
+ lambda: handlerTester2.assertState(()),
getMouseState,
- lambda: Helper.fakeMouseEvent(avg.CURSORMOTION, True, False, False,
- 12, 12, 1),
- lambda: handlerTester1.assertState(
- down=False, up=False, over=False, out=False, move=True),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_MOTION, 12, 12),
+ lambda: handlerTester1.assertState((avg.Node.CURSOR_MOTION,)),
- lambda: Helper.fakeMouseEvent(avg.CURSORUP, False, False, False,
- 12, 12, 1),
- lambda: handlerTester1.assertState(
- down=False, up=True, over=False, out=False, move=False)
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_UP, 12, 12),
+ lambda: handlerTester1.assertState((avg.Node.CURSOR_UP,))
))
def testTilted(self):
root = self.loadEmptyScene()
- root = root
img = avg.ImageNode(pos=(0,0), href="rgb24-65x65.png", angle=0.785, parent=root)
handlerTester = NodeHandlerTester(self, img)
- self.start((
- lambda: Helper.fakeMouseEvent(avg.CURSORDOWN, True, False, False,
- 32, 32, 1),
+ self.start(False,
+ (lambda: self._sendMouseEvent(avg.Event.CURSOR_DOWN, 32, 32),
lambda: handlerTester.assertState(
- down=True, up=False, over=True, out=False, move=False),
- lambda: Helper.fakeMouseEvent(avg.CURSORUP, False, False, False,
- 0, 0, 1),
+ (avg.Node.CURSOR_DOWN, avg.Node.CURSOR_OVER)),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_UP, 0, 0),
+ lambda: handlerTester.assertState((avg.Node.CURSOR_OUT,)),
+ ))
+
+ def testWordsClicks(self):
+ root = self.loadEmptyScene()
+ words = avg.WordsNode(pos=(40,40), alignment="right", text="test", parent=root)
+ handlerTester = NodeHandlerTester(self, words)
+ self.start(False,
+ (lambda: self._sendMouseEvent(avg.Event.CURSOR_DOWN, 45, 45),
+ lambda: handlerTester.assertState(()),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_UP, 35, 45),
lambda: handlerTester.assertState(
- down=False, up=False, over=False, out=True, move=False),
+ (avg.Node.CURSOR_UP, avg.Node.CURSOR_OVER)),
))
def testDivEvents(self):
@@ -136,31 +141,66 @@ class EventTestCase(AVGTestCase):
img = avg.ImageNode(pos=(0,0), href="rgb24-65x65.png", parent=div)
imgHandlerTester = NodeHandlerTester(self, img)
- self.start((
- # down, move, up.
+ self.start(False,
+ (# down, move, up.
# events are inside img and therefore should bubble to div.
- lambda: Helper.fakeMouseEvent(avg.CURSORDOWN, True, False, False,
- 10, 10, 1),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_DOWN, 10, 10),
lambda: divHandlerTester.assertState(
- down=True, up=False, over=True, out=False, move=False),
+ (avg.Node.CURSOR_DOWN, avg.Node.CURSOR_OVER)),
lambda: imgHandlerTester.assertState(
- down=True, up=False, over=True, out=False, move=False),
+ (avg.Node.CURSOR_DOWN, avg.Node.CURSOR_OVER)),
- lambda: Helper.fakeMouseEvent(avg.CURSORMOTION, True, False, False,
- 12, 12, 1),
- lambda: divHandlerTester.assertState(
- down=False, up=False, over=False, out=False, move=True),
- lambda: imgHandlerTester.assertState(
- down=False, up=False, over=False, out=False, move=True),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_MOTION, 12, 12),
+ lambda: divHandlerTester.assertState((avg.Node.CURSOR_MOTION,)),
+ lambda: imgHandlerTester.assertState((avg.Node.CURSOR_MOTION,)),
- lambda: Helper.fakeMouseEvent(avg.CURSORUP, False, False, False,
- 12, 12, 1),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_UP, 12, 12),
+ lambda: divHandlerTester.assertState((avg.Node.CURSOR_UP,)),
+ lambda: imgHandlerTester.assertState((avg.Node.CURSOR_UP,))
+ ))
+
+ def testDivNegativePos(self):
+ root = self.loadEmptyScene()
+ div = avg.DivNode(pos=(10,10), parent=root)
+ divHandlerTester = NodeHandlerTester(self, div)
+
+ img = avg.ImageNode(pos=(-10,-10), href="rgb24-65x65.png", parent=div)
+ imgHandlerTester = NodeHandlerTester(self, img)
+
+ self.start(False,
+ (lambda: self._sendMouseEvent(avg.Event.CURSOR_DOWN, 1, 1),
lambda: divHandlerTester.assertState(
- down=False, up=True, over=False, out=False, move=False),
+ (avg.Node.CURSOR_DOWN, avg.Node.CURSOR_OVER)),
lambda: imgHandlerTester.assertState(
- down=False, up=True, over=False, out=False, move=False)
+ (avg.Node.CURSOR_DOWN, avg.Node.CURSOR_OVER)),
))
+ def testUnlinkInHandler(self):
+ def onImgDown(event):
+ self.__imgDownCalled = True
+ self.div.unlink(True)
+
+ def onDivDown(event):
+ self.__divDownCalled = True
+
+ def checkState():
+ self.assert_(self.__imgDownCalled and not(self.__divDownCalled))
+
+ self.__imgDownCalled = False
+ self.__divDownCalled = False
+ root = self.loadEmptyScene()
+ self.div = avg.DivNode(pos=(0,0), parent=root)
+ self.div.connectEventHandler(avg.Event.CURSOR_DOWN, avg.Event.MOUSE, self,
+ onDivDown)
+
+ img = avg.ImageNode(pos=(0,0), href="rgb24-65x65.png", parent=self.div)
+ img.connectEventHandler(avg.Event.CURSOR_DOWN, avg.Event.MOUSE, self, onImgDown)
+
+ self.start(False,
+ (lambda: self._sendMouseEvent(avg.Event.CURSOR_DOWN, 10, 10),
+ checkState))
+
+
def testConnectHandler(self):
def onDown1(event):
self.down1Called = True
@@ -173,13 +213,17 @@ class EventTestCase(AVGTestCase):
self.down2Called = False
def connectTwoHandlers():
- self.img.connectEventHandler(avg.CURSORDOWN, avg.MOUSE, self, onDown1)
- self.img.connectEventHandler(avg.CURSORDOWN, avg.MOUSE, self, onDown2)
+ self.img.connectEventHandler(avg.Event.CURSOR_DOWN, avg.Event.MOUSE, self,
+ onDown1)
+ self.img.connectEventHandler(avg.Event.CURSOR_DOWN, avg.Event.MOUSE, self,
+ onDown2)
def connectUnlinkHandler():
self.img.disconnectEventHandler(self)
- self.img.connectEventHandler(avg.CURSORDOWN, avg.MOUSE, self, unlinkHandler)
- self.img.connectEventHandler(avg.CURSORDOWN, avg.MOUSE, self, onDown2)
+ self.img.connectEventHandler(avg.Event.CURSOR_DOWN, avg.Event.MOUSE, self,
+ unlinkHandler)
+ self.img.connectEventHandler(avg.Event.CURSOR_DOWN, avg.Event.MOUSE, self,
+ onDown2)
def unlinkHandler(event):
self.img.disconnectEventHandler(self)
@@ -193,8 +237,8 @@ class EventTestCase(AVGTestCase):
self.img.disconnectEventHandler(self)
resetDownCalled()
- self.start((
- connectTwoHandlers,
+ self.start(False,
+ (connectTwoHandlers,
lambda: self.fakeClick(10,10),
lambda: self.assert_(self.down1Called and self.down2Called),
resetDownCalled,
@@ -205,6 +249,195 @@ class EventTestCase(AVGTestCase):
lambda: self.fakeClick(10,10),
))
+ def testPublisher(self):
+ def onDown(event):
+ self.assert_(event.type == avg.Event.CURSOR_DOWN)
+ curEvent = player.getCurrentEvent()
+ self.assert_(curEvent.type == avg.Event.CURSOR_DOWN)
+ self.assert_(curEvent.when == event.when)
+ self.downCalled = True
+
+ def unsubscribe():
+ self.assert_(self.img.isSubscribed(avg.Node.CURSOR_DOWN, onDown))
+ self.img.unsubscribe(avg.Node.CURSOR_DOWN, onDown)
+ self.assert_(not(self.img.isSubscribed(avg.Node.CURSOR_DOWN, onDown)))
+ self.assert_(self.img.getNumSubscribers(avg.Node.CURSOR_DOWN) == 0)
+ self.downCalled = False
+ self.assertException(
+ lambda: self.img.unsubscribe(avg.Node.CURSOR_DOWN, onDown))
+
+ def initUnsubscribeInEvent(useMessageID):
+ self.subscriberID = self.img.subscribe(avg.Node.CURSOR_DOWN,
+ lambda event: onDownUnsubscribe(event, useMessageID))
+
+ def onDownUnsubscribe(event, useMessageID):
+ if useMessageID:
+ self.img.unsubscribe(avg.Node.CURSOR_DOWN, self.subscriberID)
+ self.assertException(lambda:
+ self.img.unsubscribe(avg.Node.CURSOR_DOWN, self.subscriberID))
+ else:
+ self.img.unsubscribe(self.subscriberID)
+ self.assertException(lambda: self.img.unsubscribe(self.subscriberID))
+
+ self.downCalled = True
+
+ def onFrame():
+ self.onFrameCalled = True
+
+ self.downCalled = False
+ self.onFrameCalled = False
+ root = self.loadEmptyScene()
+ player.subscribe(player.ON_FRAME, onFrame)
+ self.img = avg.ImageNode(pos=(0,0), href="rgb24-65x65.png", parent=root)
+ self.img.subscribe(avg.Node.CURSOR_DOWN, onDown)
+ self.assertException(lambda: self.img.subscribe(23, onDown))
+ self.assertException(lambda: self.img.unsubscribe(avg.Node.CURSOR_DOWN, 23))
+ self.start(False,
+ (lambda: self.fakeClick(10,10),
+ lambda: self.assert_(self.downCalled),
+ lambda: self.assert_(self.onFrameCalled),
+
+ unsubscribe,
+ lambda: self.fakeClick(10,10),
+ lambda: self.assert_(not(self.downCalled)),
+
+ lambda: initUnsubscribeInEvent(True),
+ lambda: self.fakeClick(10,10),
+ lambda: self.assert_(self.downCalled),
+
+ lambda: initUnsubscribeInEvent(False),
+ lambda: self.fakeClick(10,10),
+ lambda: self.assert_(self.downCalled),
+ ))
+
+ def testComplexPublisher(self):
+ def setupUnsubscribe():
+ self.downCalled = [False, False]
+ self.msgIDs = []
+ for i in range(0,2):
+ self.msgIDs.append(self.img.subscribe(avg.Node.CURSOR_DOWN,
+ lambda event, i=i: onUnsubscribeDown(i)))
+
+ def onUnsubscribeDown(i):
+ self.downCalled[i] = True
+ for j in range(0,2):
+ self.img.unsubscribe(avg.Node.CURSOR_DOWN, self.msgIDs[j])
+
+ def assertCorrectUnsubscribe():
+ # Exactly one of the two callbacks should have been invoked
+ self.assert_(self.downCalled[0] != self.downCalled[1])
+
+ def setupSubscribe():
+ self.downCalled = [False, False]
+ self.msgIDs = []
+ self.msgIDs.append(self.img.subscribe(avg.Node.CURSOR_DOWN,
+ lambda event: onSubscribeDown()))
+
+ def onSubscribeDown():
+ self.downCalled[0] = True
+ self.msgIDs.append(self.img.subscribe(avg.Node.CURSOR_DOWN,
+ lambda event: onSecondSubscribeDown()))
+
+ def onSecondSubscribeDown():
+ self.downCalled[1] = True
+
+ def assertDownsCalled(expectedState):
+ self.assert_(self.downCalled == expectedState)
+
+ root = self.loadEmptyScene()
+ self.img = avg.ImageNode(pos=(0,0), href="rgb24-65x65.png", parent=root)
+
+ self.start(False,
+ (# Subscribe twice to an event, unsubscribe both during processing of the
+ # first. Second shouldn't be called anymore.
+ lambda: setupUnsubscribe(),
+ lambda: self.fakeClick(10,10),
+ assertCorrectUnsubscribe,
+
+ # Subscribe to an event, subscribe again during event processing.
+ # The second one shouldn't be called immediately.
+ lambda: setupSubscribe(),
+ lambda: self.fakeClick(10,10),
+ lambda: assertDownsCalled([True, False]),
+ lambda: self.fakeClick(10,10),
+ lambda: assertDownsCalled([True, True]),
+ ))
+
+ def testPublisherAutoDelete(self):
+
+ class TestSubscriber():
+ def __init__(self):
+ self.__downCalled = False
+
+ def subscribe(self, node):
+ node.subscribe(avg.Node.CURSOR_DOWN, self.onDown)
+
+ def subscribeLambda(self, node):
+ node.subscribe(avg.Node.CURSOR_DOWN, lambda event: self.onDown(event))
+
+ def onDown(self, event):
+ self.__downCalled = True
+
+ def hasClicked(self):
+ return self.__downCalled
+
+ def removeSubscriber():
+ del self.subscriber;
+
+ root = self.loadEmptyScene()
+ self.img = avg.ImageNode(pos=(0,0), href="rgb24-65x65.png", parent=root)
+ self.subscriber = TestSubscriber()
+ self.subscriber.subscribe(self.img)
+ self.start(False,
+ (lambda: self.fakeClick(10,10),
+ lambda: self.assert_(self.subscriber.hasClicked()),
+ removeSubscriber,
+ lambda: self.fakeClick(10,10),
+ lambda: self.assert_(
+ self.img.getNumSubscribers(avg.Node.CURSOR_DOWN) == 0)
+ ))
+
+
+ def testPublisherNestedUnsubscribe(self):
+
+ class TestPublisher(avg.Publisher):
+
+ OUTER_EVENT = avg.Publisher.genMessageID()
+ INNER_EVENT = avg.Publisher.genMessageID()
+
+ def __init__(self):
+ super(TestPublisher, self).__init__()
+ self.publish(TestPublisher.OUTER_EVENT)
+ self.publish(TestPublisher.INNER_EVENT)
+
+ def generateEvent(self):
+ self.notifySubscribers(TestPublisher.OUTER_EVENT, [])
+
+ def generateInnerEvent(self):
+ self.notifySubscribers(TestPublisher.INNER_EVENT, [])
+
+ def onEvent():
+ self.publisher.generateInnerEvent()
+
+ def onEvent2():
+ self.event2Called = True;
+
+ def onInnerEvent():
+ self.publisher.unsubscribe(TestPublisher.OUTER_EVENT, onEvent)
+ self.publisher.unsubscribe(TestPublisher.OUTER_EVENT, onEvent2)
+
+ self.loadEmptyScene()
+ self.publisher = TestPublisher()
+ self.publisher.subscribe(TestPublisher.OUTER_EVENT, onEvent2)
+ self.publisher.subscribe(TestPublisher.OUTER_EVENT, onEvent)
+ self.publisher.subscribe(TestPublisher.INNER_EVENT, onInnerEvent)
+ self.event2Called = False
+ self.start(False,
+ (self.publisher.generateEvent,
+ ))
+ self.assert_(not(self.event2Called))
+
+
def testObscuringEvents(self):
root = self.loadEmptyScene()
img1 = avg.ImageNode(pos=(0,0), href="rgb24-65x65.png", parent=root)
@@ -212,29 +445,21 @@ class EventTestCase(AVGTestCase):
img2 = avg.ImageNode(pos=(0,0), href="rgb24-65x65.png", parent=root)
handlerTester2 = NodeHandlerTester(self, img2)
- self.start((
- # down, move, up.
+ self.start(False,
+ (# down, move, up.
# events should only arrive at img2 because img1 is obscured by img1.
- lambda: Helper.fakeMouseEvent(avg.CURSORDOWN, True, False, False,
- 10, 10, 1),
- lambda: handlerTester1.assertState(
- down=False, up=False, over=False, out=False, move=False),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_DOWN, 10, 10),
+ lambda: handlerTester1.assertState(()),
lambda: handlerTester2.assertState(
- down=True, up=False, over=True, out=False, move=False),
+ (avg.Node.CURSOR_DOWN, avg.Node.CURSOR_OVER)),
- lambda: Helper.fakeMouseEvent(avg.CURSORMOTION, True, False, False,
- 12, 12, 1),
- lambda: handlerTester1.assertState(
- down=False, up=False, over=False, out=False, move=False),
- lambda: handlerTester2.assertState(
- down=False, up=False, over=False, out=False, move=True),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_MOTION, 12, 12),
+ lambda: handlerTester1.assertState(()),
+ lambda: handlerTester2.assertState((avg.Node.CURSOR_MOTION,)),
- lambda: Helper.fakeMouseEvent(avg.CURSORUP, False, False, False,
- 12, 12, 1),
- lambda: handlerTester1.assertState(
- down=False, up=False, over=False, out=False, move=False),
- lambda: handlerTester2.assertState(
- down=False, up=True, over=False, out=False, move=False)
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_UP, 12, 12),
+ lambda: handlerTester1.assertState(()),
+ lambda: handlerTester2.assertState((avg.Node.CURSOR_UP,))
))
def testSensitive(self):
@@ -254,23 +479,18 @@ class EventTestCase(AVGTestCase):
handlerTester = NodeHandlerTester(self, self.img)
activateNode(self.img, useSensitiveAttr, False)
- self.start((
- # Node is inactive -> no events.
- lambda: Helper.fakeMouseEvent(avg.CURSORDOWN, True, False, False,
- 10, 10, 1),
- lambda: handlerTester.assertState(
- down=False, up=False, over=False, out=False, move=False),
- lambda: Helper.fakeMouseEvent(avg.CURSORUP, False, False, False,
- 10, 10, 1),
+ self.start(False,
+ (# Node is inactive -> no events.
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_DOWN, 10, 10),
+ lambda: handlerTester.assertState(()),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_UP, 10, 10),
# Activate the node -> events arrive.
lambda: activateNode(self.img, useSensitiveAttr, True),
- lambda: Helper.fakeMouseEvent(avg.CURSORDOWN, True, False, False,
- 10, 10, 1),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_DOWN, 10, 10),
lambda: handlerTester.assertState(
- down=True, up=False, over=True, out=False, move=False),
- lambda: Helper.fakeMouseEvent(avg.CURSORUP, False, False, False,
- 10, 10, 1),
+ (avg.Node.CURSOR_DOWN, avg.Node.CURSOR_OVER)),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_UP, 10, 10),
))
self.img = None
@@ -278,34 +498,31 @@ class EventTestCase(AVGTestCase):
root = self.loadEmptyScene()
self.img1 = avg.ImageNode(pos=(0,0), href="rgb24-65x65.png", parent=root)
self.img2 = avg.ImageNode(pos=(64,0), href="rgb24-65x65.png", parent=root)
- self.img1.connectEventHandler(avg.CURSORDOWN, avg.TOUCH, self,
+ self.img1.connectEventHandler(avg.Event.CURSOR_DOWN, avg.Event.TOUCH, self,
lambda event: activateNode(self.img2, useSensitiveAttr, False))
- self.img2.connectEventHandler(avg.CURSORDOWN, avg.TOUCH, self, onNode2Down)
+ self.img2.connectEventHandler(avg.Event.CURSOR_DOWN, avg.Event.TOUCH, self,
+ onNode2Down)
self.__node2Down = False
- self.start((
- lambda: self._sendTouchEvents((
- (1, avg.CURSORDOWN, 10, 10),
- (2, avg.CURSORDOWN, 80, 10),)),
- lambda: self.assert_(not(self.__node2Down)),
- ))
+ self.start(False,
+ (lambda: self._sendTouchEvents((
+ (1, avg.Event.CURSOR_DOWN, 10, 10),
+ (2, avg.Event.CURSOR_DOWN, 80, 10),)),
+ lambda: self.assert_(not(self.__node2Down)),
+ ))
def testChangingHandlers(self):
root = self.loadEmptyScene()
img = avg.ImageNode(pos=(0,0), href="rgb24-65x65.png", parent=root)
handlerTester = NodeHandlerTester(self, img)
- self.start((
- lambda: handlerTester.clearHandlers(),
- lambda: Helper.fakeMouseEvent(avg.CURSORDOWN, True, False, False,
- 10, 10, 1),
- lambda: handlerTester.assertState(
- down=False, up=False, over=False, out=False, move=False),
+ self.start(False,
+ (lambda: handlerTester.clearHandlers(),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_DOWN, 10, 10),
+ lambda: handlerTester.assertState(()),
lambda: handlerTester.setHandlers(),
- lambda: Helper.fakeMouseEvent(avg.CURSORUP, False, False, False,
- 10, 10, 1),
- lambda: handlerTester.assertState(
- down=False, up=True, over=False, out=False, move=False),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_UP, 10, 10),
+ lambda: handlerTester.assertState((avg.Node.CURSOR_UP,)),
))
def testEventCapture(self):
@@ -340,38 +557,30 @@ class EventTestCase(AVGTestCase):
self.mainMouseDownCalled = False
root = self.loadEmptyScene()
- root.setEventHandler(avg.CURSORDOWN, avg.MOUSE, onMainMouseDown)
+ root.setEventHandler(avg.Event.CURSOR_DOWN, avg.Event.MOUSE, onMainMouseDown)
self.img = avg.ImageNode(pos=(0,0), href="rgb24-65x65.png", parent=root)
- self.img.setEventHandler(avg.CURSORDOWN, avg.MOUSE, onMouseDown)
+ self.img.setEventHandler(avg.Event.CURSOR_DOWN, avg.Event.MOUSE, onMouseDown)
- self.start((
- lambda: Helper.fakeMouseEvent(avg.CURSORDOWN, True, False, False,
- 10, 10, 1),
+ self.start(False,
+ (lambda: self._sendMouseEvent(avg.Event.CURSOR_DOWN, 10, 10),
lambda: self.assert_(self.mouseDownCalled),
- lambda: Helper.fakeMouseEvent(avg.CURSORUP, False, False, False,
- 10, 10, 1),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_UP, 10, 10),
captureEvent,
- lambda: Helper.fakeMouseEvent(avg.CURSORDOWN, True, False, False,
- 100, 10, 1),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_DOWN, 100, 10),
lambda: self.assert_(self.mouseDownCalled and
self.mainMouseDownCalled),
- lambda: Helper.fakeMouseEvent(avg.CURSORUP, False, False, False,
- 100, 10, 1),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_UP, 100, 10),
noCaptureEvent,
- lambda: Helper.fakeMouseEvent(avg.CURSORDOWN, True, False, False,
- 100, 10, 1),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_DOWN, 100, 10),
lambda: self.assert_(not(self.mouseDownCalled) and
self.mainMouseDownCalled),
- lambda: Helper.fakeMouseEvent(avg.CURSORUP, False, False, False,
- 100, 10, 1),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_UP, 100, 10),
doubleCaptureEvent,
- lambda: Helper.fakeMouseEvent(avg.CURSORDOWN, True, False, False,
- 100, 10, 1),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_DOWN, 100, 10),
lambda: self.assert_(self.mouseDownCalled and
self.mainMouseDownCalled),
releaseTooMuch,
- lambda: Helper.fakeMouseEvent(avg.CURSORUP, False, False, False,
- 100, 10, 1),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_UP, 100, 10),
))
self.img = None
@@ -412,26 +621,24 @@ class EventTestCase(AVGTestCase):
self.img1MouseOverCalled = False
def killNodeUnderCursor():
- Parent = img1.getParent()
+ Parent = img1.parent
Parent.removeChild(Parent.indexOf(img1))
- Helper = Player.getTestHelper()
root = self.loadEmptyScene()
img1 = avg.ImageNode(href="rgb24-65x65.png", parent=root)
div = avg.DivNode(pos=(65,0), parent=root)
img3 = avg.ImageNode(href="rgb24-65x65.png", parent=div)
img2 = avg.ImageNode(pos=(0,65), href="rgb24-65x65.png", parent=div)
- img2.setEventHandler(avg.CURSOROVER, avg.MOUSE, onImg2MouseOver)
- img2.setEventHandler(avg.CURSOROUT, avg.MOUSE, onImg2MouseOut)
- div.setEventHandler(avg.CURSOROVER, avg.MOUSE, onDivMouseOver)
- div.setEventHandler(avg.CURSOROUT, avg.MOUSE, onDivMouseOut)
- root.setEventHandler(avg.CURSOROVER, avg.MOUSE, onAVGMouseOver)
- img1.setEventHandler(avg.CURSOROVER, avg.MOUSE, onImg1MouseOver)
- self.start((
- resetState,
- lambda: Helper.fakeMouseEvent(avg.CURSORDOWN, True, False, False,
- 70, 70, 1),
+ img2.setEventHandler(avg.Event.CURSOR_OVER, avg.Event.MOUSE, onImg2MouseOver)
+ img2.setEventHandler(avg.Event.CURSOR_OUT, avg.Event.MOUSE, onImg2MouseOut)
+ div.setEventHandler(avg.Event.CURSOR_OVER, avg.Event.MOUSE, onDivMouseOver)
+ div.setEventHandler(avg.Event.CURSOR_OUT, avg.Event.MOUSE, onDivMouseOut)
+ root.setEventHandler(avg.Event.CURSOR_OVER, avg.Event.MOUSE, onAVGMouseOver)
+ img1.setEventHandler(avg.Event.CURSOR_OVER, avg.Event.MOUSE, onImg1MouseOver)
+ self.start(False,
+ (resetState,
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_DOWN, 70, 70),
lambda: self.assert_(
self.img2MouseOverCalled and
self.divMouseOverCalled and
@@ -439,11 +646,9 @@ class EventTestCase(AVGTestCase):
not(self.img2MouseOutCalled) and
not(self.divMouseOutCalled) and
not(self.img1MouseOverCalled)),
- lambda: Helper.fakeMouseEvent(avg.CURSORUP, False, False, False,
- 70, 70, 1),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_UP, 70, 70),
resetState,
- lambda: Helper.fakeMouseEvent(avg.CURSORDOWN, True, False, False,
- 70, 10, 1),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_DOWN, 70, 10),
lambda: self.assert_(
not(self.img2MouseOverCalled) and
not(self.divMouseOverCalled) and
@@ -451,12 +656,10 @@ class EventTestCase(AVGTestCase):
self.img2MouseOutCalled and
not(self.divMouseOutCalled) and
not(self.img1MouseOverCalled)),
- lambda: Helper.fakeMouseEvent(avg.CURSORUP, False, False, False,
- 70, 10, 1),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_UP, 70, 10),
resetState,
- lambda: Helper.fakeMouseEvent(avg.CURSORDOWN, True, False, False,
- 10, 10, 1),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_DOWN, 10, 10),
lambda: self.assert_(
not(self.img2MouseOverCalled) and
not(self.divMouseOverCalled) and
@@ -467,8 +670,7 @@ class EventTestCase(AVGTestCase):
resetState,
killNodeUnderCursor,
- lambda: Helper.fakeMouseEvent(avg.CURSORUP, False, False, False,
- 10, 10, 1),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_UP, 10, 10),
lambda: self.assert_(
not(self.img2MouseOverCalled) and
not(self.divMouseOverCalled) and
@@ -477,12 +679,10 @@ class EventTestCase(AVGTestCase):
not(self.divMouseOutCalled) and
not(self.img1MouseOverCalled)),
- lambda: Helper.fakeMouseEvent(avg.CURSORDOWN, True, False, False,
- 10, 10, 1),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_DOWN, 10, 10),
resetState,
lambda: img2.setEventCapture(),
- lambda: Helper.fakeMouseEvent(avg.CURSORUP, False, False, False,
- 70, 70, 1),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_UP, 70, 70),
lambda: self.assert_(
self.img2MouseOverCalled and
self.divMouseOverCalled and
@@ -491,11 +691,9 @@ class EventTestCase(AVGTestCase):
not(self.divMouseOutCalled) and
not(self.img1MouseOverCalled)),
- lambda: Helper.fakeMouseEvent(avg.CURSORDOWN, True, False, False,
- 70, 70, 1),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_DOWN, 70, 70),
resetState,
- lambda: Helper.fakeMouseEvent(avg.CURSORUP, False, False, False,
- 10, 10, 1),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_UP, 10, 10),
lambda: self.assert_(
not(self.img2MouseOverCalled) and
not(self.divMouseOverCalled) and
@@ -505,17 +703,45 @@ class EventTestCase(AVGTestCase):
not(self.img1MouseOverCalled))
))
+ def testMouseDisable(self):
+ def checkMouseWorking(working):
+ if working:
+ downTestEvents = (avg.Node.CURSOR_DOWN, avg.Node.CURSOR_OVER)
+ upTestEvents = (avg.Node.CURSOR_UP,)
+ else:
+ downTestEvents = ()
+ upTestEvents = ()
+
+ return (lambda: self._sendMouseEvent(avg.Event.CURSOR_DOWN, 10, 10),
+ lambda: handlerTester.assertState(downTestEvents),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_UP, 10, 10),
+ lambda: handlerTester.assertState(upTestEvents)
+ )
+
+ root = self.loadEmptyScene()
+ img = avg.ImageNode(pos=(0,0), href="rgb24-65x65.png", parent=root)
+ handlerTester = NodeHandlerTester(self, img)
+ player.enableMouse(False)
+
+ self.start(False,
+ (checkMouseWorking(False),
+ lambda: player.enableMouse(True),
+ checkMouseWorking(True),
+ lambda: player.enableMouse(False),
+ checkMouseWorking(False),
+ lambda: player.enableMouse(True),
+ ))
+
def testEventErr(self):
def onErrMouseOver(Event):
undefinedFunction()
root = self.loadEmptyScene()
- root.setEventHandler(avg.CURSORDOWN, avg.MOUSE, onErrMouseOver)
+ root.setEventHandler(avg.Event.CURSOR_DOWN, avg.Event.MOUSE, onErrMouseOver)
self.assertException(lambda:
- self.start((
- lambda: Helper.fakeMouseEvent(avg.CURSORDOWN,
- False, False, False, 10, 10, 0),
- )))
+ self.start(False,
+ (lambda: self._sendMouseEvent(avg.Event.CURSOR_DOWN, 10, 10),
+ )))
def testEventHook(self):
def resetState():
@@ -524,32 +750,32 @@ class EventTestCase(AVGTestCase):
def cleanup():
resetState()
- Player.setEventHook(None)
+ player.setEventHook(None)
def handleEvent(event):
- if isinstance(event, avg.MouseEvent) and event.source == avg.MOUSE:
- if event.type == avg.CURSORDOWN:
+ if isinstance(event, avg.MouseEvent) and event.source == avg.Event.MOUSE:
+ if event.type == avg.Event.CURSOR_DOWN:
self.ehookMouseEvent = True
elif isinstance(event, avg.KeyEvent):
self.ehookKeyboardEvent = True
else:
self.fail()
- root = self.loadEmptyScene()
+ self.loadEmptyScene()
resetState()
- Player.setEventHook(handleEvent)
- self.start((
- lambda: self.fakeClick(10, 10),
+ player.setEventHook(handleEvent)
+ self.start(False,
+ (lambda: self.fakeClick(10, 10),
lambda: self.assert_(self.ehookMouseEvent),
- lambda: Helper.fakeKeyEvent(avg.KEYDOWN, 65, 65, "A", 65, 0),
+ lambda: Helper.fakeKeyEvent(avg.Event.KEY_DOWN, 65, 65, "A", 65, 0),
lambda: self.assert_(self.ehookKeyboardEvent),
cleanup,
lambda: self.fakeClick(10, 10),
lambda: self.assert_(not self.ehookMouseEvent),
- lambda: Helper.fakeKeyEvent(avg.KEYDOWN, 65, 65, "A", 65, 0),
+ lambda: Helper.fakeKeyEvent(avg.Event.KEY_DOWN, 65, 65, "A", 65, 0),
lambda: self.assert_(not self.ehookKeyboardEvent),
- ))
+ ))
def testException(self):
@@ -560,17 +786,17 @@ class EventTestCase(AVGTestCase):
raise TestException
rect = avg.RectNode(size = (50, 50))
- rect.setEventHandler(avg.CURSORDOWN, avg.MOUSE, throwException)
+ rect.setEventHandler(avg.Event.CURSOR_DOWN, avg.Event.MOUSE, throwException)
root = self.loadEmptyScene()
root.appendChild(rect)
self.__exceptionThrown = False
try:
- self.start((
- lambda: Helper.fakeMouseEvent(avg.CURSORDOWN, True, False, False, 10,
- 10, 0),
- lambda: None))
+ self.start(False,
+ (lambda: self._sendMouseEvent(avg.Event.CURSOR_DOWN, 10, 10),
+ lambda: None
+ ))
except TestException:
self.__exceptionThrown = True
@@ -589,6 +815,8 @@ class EventTestCase(AVGTestCase):
self.assertEqual(contact.events[0].pos, event.pos)
self.assertEqual(len(contact.events), 1)
contact.connectListener(onMotion, onUp)
+ contact.subscribe(avg.Contact.CURSOR_MOTION, onMotionSubscribe)
+ contact.subscribe(avg.Contact.CURSOR_UP, onUpSubscribe)
def onMotion(event):
contact = event.contact
@@ -614,6 +842,12 @@ class EventTestCase(AVGTestCase):
self.assert_(len(contact.events) > 1)
self.numContactCallbacks += 1
+ def onMotionSubscribe(event):
+ self.motionCalled = True
+
+ def onUpSubscribe(event):
+ self.upCalled = True
+
def onOver(event):
self.numOverCallbacks += 1
self.assertEqual(event.cursorid, event.contact.id)
@@ -623,31 +857,34 @@ class EventTestCase(AVGTestCase):
self.assertEqual(event.cursorid, event.contact.id)
root = self.loadEmptyScene()
- root.connectEventHandler(avg.CURSORDOWN, avg.TOUCH, self, onDown)
+ root.subscribe(avg.Node.CURSOR_DOWN, onDown)
self.numContactCallbacks = 0
rect = avg.RectNode(pos=(5,5), size=(10,10), parent=root)
- rect.connectEventHandler(avg.CURSOROVER, avg.TOUCH, self, onOver)
+ rect.subscribe(avg.Node.CURSOR_OVER, onOver)
self.numOverCallbacks = 0
- rect.connectEventHandler(avg.CURSOROUT, avg.TOUCH, self, onOut)
+ rect.subscribe(avg.Node.CURSOR_OUT, onOut)
self.numOutCallbacks = 0
- Player.setFakeFPS(25)
- self.start((
- lambda: Helper.fakeTouchEvent(1, avg.CURSORDOWN, avg.TOUCH, (10,10)),
- lambda: Helper.fakeTouchEvent(1, avg.CURSORMOTION, avg.TOUCH, (20,10)),
- lambda: Helper.fakeTouchEvent(1, avg.CURSORUP, avg.TOUCH, (10,10)),
- ))
+ player.setFakeFPS(25)
+ self.motionCalled = False
+ self.upCalled = False
+ self.start(False,
+ (lambda: self._sendTouchEvent(1, avg.Event.CURSOR_DOWN, 10, 10),
+ lambda: self._sendTouchEvent(1, avg.Event.CURSOR_MOTION, 20, 10),
+ lambda: self._sendTouchEvent(1, avg.Event.CURSOR_UP, 10, 10),
+ ))
self.assertEqual(self.numContactCallbacks, 2)
self.assertEqual(self.numOverCallbacks, 2)
self.assertEqual(self.numOutCallbacks, 2)
+ self.assert_(self.motionCalled and self.upCalled)
root = self.loadEmptyScene()
- root.connectEventHandler(avg.CURSORDOWN, avg.MOUSE, self, onDown)
+ root.subscribe(avg.Node.CURSOR_DOWN, onDown)
self.numContactCallbacks = 0
- self.start((
- lambda: Helper.fakeMouseEvent(avg.CURSORDOWN, 1, 0, 0, 10, 10, 0),
- lambda: Helper.fakeMouseEvent(avg.CURSORMOTION, 1, 0, 0, 20, 10, 0),
- lambda: Helper.fakeMouseEvent(avg.CURSORUP, 0, 0, 0, 10, 10, 0),
- ))
+ self.start(False,
+ (lambda: self._sendMouseEvent(avg.Event.CURSOR_DOWN, 10, 10),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_MOTION, 20, 10),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_UP, 10, 10),
+ ))
self.assertEqual(self.numContactCallbacks, 2)
def testContactRegistration(self):
@@ -658,28 +895,29 @@ class EventTestCase(AVGTestCase):
def onMotion(event):
contact = event.contact
- self.contactID = contact.connectListener(onContactMotion, None)
+ self.contactID = contact.subscribe(avg.Contact.CURSOR_MOTION, onContactMotion)
self.numMotionCallbacks += 1
- root.disconnectEventHandler(self)
+ root.unsubscribe(avg.Node.CURSOR_DOWN, onDown)
+ root.unsubscribe(avg.Node.CURSOR_MOTION, onMotion)
def onContactMotion(event):
contact = event.contact
- contact.disconnectListener(self.contactID)
- self.assertException(lambda: contact.disconnectListener(self.contactID))
+ contact.unsubscribe(self.contactID)
+ self.assertException(lambda: contact.unsubscribe(self.contactID))
self.numContactCallbacks += 1
root = self.loadEmptyScene()
- root.connectEventHandler(avg.CURSORDOWN, avg.TOUCH, self, onDown)
+ root.subscribe(avg.Node.CURSOR_DOWN, onDown)
self.numMotionCallbacks = 0
- root.connectEventHandler(avg.CURSORMOTION, avg.TOUCH, self, onMotion)
+ root.subscribe(avg.Node.CURSOR_MOTION, onMotion)
self.numContactCallbacks = 0
- Player.setFakeFPS(25)
- self.start((
- lambda: Helper.fakeTouchEvent(1, avg.CURSORDOWN, avg.TOUCH, (10,10)),
- lambda: Helper.fakeTouchEvent(1, avg.CURSORMOTION, avg.TOUCH, (20,10)),
- lambda: Helper.fakeTouchEvent(1, avg.CURSORMOTION, avg.TOUCH, (30,10)),
- lambda: Helper.fakeTouchEvent(1, avg.CURSORMOTION, avg.TOUCH, (40,10)),
- ))
+ player.setFakeFPS(25)
+ self.start(False,
+ (lambda: self._sendTouchEvent(1, avg.Event.CURSOR_DOWN, 10, 10),
+ lambda: self._sendTouchEvent(1, avg.Event.CURSOR_MOTION, 20, 10),
+ lambda: self._sendTouchEvent(1, avg.Event.CURSOR_MOTION, 30, 10),
+ lambda: self._sendTouchEvent(1, avg.Event.CURSOR_MOTION, 40, 10),
+ ))
self.assertEqual(self.numContactCallbacks, 1)
self.assertEqual(self.numMotionCallbacks, 1)
@@ -687,12 +925,15 @@ class EventTestCase(AVGTestCase):
def onDown(event):
contact = event.contact
- self.contactid = contact.connectListener(onContact2, onContact2)
- contact.connectListener(onContact1, onContact1)
+ self.motionListenerID = contact.subscribe(avg.Contact.CURSOR_MOTION, onContact2)
+ self.upListenerID = contact.subscribe(avg.Contact.CURSOR_UP, onContact2)
+ contact.subscribe(avg.Contact.CURSOR_MOTION, onContact1)
+ contact.subscribe(avg.Contact.CURSOR_UP, onContact1)
def onContact1(event):
if self.numContact1Callbacks == 0:
- event.contact.disconnectListener(self.contactid)
+ event.contact.unsubscribe(self.motionListenerID)
+ event.contact.unsubscribe(self.upListenerID)
self.numContact1Callbacks += 1
def onContact2(event):
@@ -700,40 +941,146 @@ class EventTestCase(AVGTestCase):
self.numContact2Callbacks += 1
root = self.loadEmptyScene()
- root.connectEventHandler(avg.CURSORDOWN, avg.TOUCH, self, onDown)
- Player.setFakeFPS(25)
+ root.subscribe(avg.Node.CURSOR_DOWN, onDown)
+ player.setFakeFPS(25)
self.numContact1Callbacks = 0
self.numContact2Callbacks = 0
- self.start((
- lambda: Helper.fakeTouchEvent(1, avg.CURSORDOWN, avg.TOUCH, (10,10)),
- lambda: Helper.fakeTouchEvent(1, avg.CURSORMOTION, avg.TOUCH, (20,10)),
- lambda: Helper.fakeTouchEvent(1, avg.CURSORUP, avg.TOUCH, (10,10)),
- ))
+ self.start(False,
+ (lambda: self._sendTouchEvent(1, avg.Event.CURSOR_DOWN, 10, 10),
+ lambda: self._sendTouchEvent(1, avg.Event.CURSOR_MOTION, 20, 10),
+ lambda: self._sendTouchEvent(1, avg.Event.CURSOR_UP, 10, 10),
+ ))
self.assertEqual(self.numContact1Callbacks, 2)
# The order of callbacks is unspecified, so onContact2 might be called once.
self.assert_(self.numContact2Callbacks <= 1)
+ def testPlaybackMessages(self):
+
+ self.loadEmptyScene()
+ messageTester = MessageTester(player,
+ [avg.Player.PLAYBACK_START, avg.Player.PLAYBACK_END], self)
+ self.start(False,
+ (lambda: messageTester.assertState([avg.Player.PLAYBACK_START]),
+ ))
+ messageTester.assertState([avg.Player.PLAYBACK_END])
+
+ def testImageSizeChanged(self):
+ def onResize(newSize):
+ self.assert_(newSize == self.sizeExpected)
+ self.messageReceived = True
+
+ def changeHref():
+ self.messageReceived = False
+ self.sizeExpected = (32,32)
+ self.image.href="rgb24-32x32.png"
+ self.assert_(self.messageReceived)
+
+ def explicitChangeSize():
+ self.messageReceived = False
+ self.sizeExpected = (64,64)
+ self.image.size = self.sizeExpected
+ self.assert_(self.messageReceived)
+
+ def changeWidth():
+ self.messageReceived = False
+ self.sizeExpected = (32,64)
+ self.image.width = 32
+ self.assert_(self.messageReceived)
+
+ def move():
+ self.messageReceived = False
+ self.image.x = 4
+ self.assert_(not(self.messageReceived))
+
+ root = self.loadEmptyScene()
+ self.image = avg.ImageNode(href="rgb24-64x64.png", parent=root)
+ self.image.subscribe(avg.AreaNode.SIZE_CHANGED, onResize)
+ self.sizeExpected = (64, 64)
+ self.start(False,
+ (changeHref,
+ explicitChangeSize,
+ changeWidth,
+ move,
+ ))
+
+ def testWordsSizeChanged(self):
+ def onResize(newSize):
+ self.messageReceived = True
+
+ def checkMessageReceived():
+ self.assert_(self.messageReceived)
+ self.messageReceived = False
+
+ def changeText():
+ self.words.text="NewText"
+ checkMessageReceived()
+
+ self.messageReceived = False
+ root = self.loadEmptyScene()
+ self.words = avg.WordsNode(text="Test", parent=root)
+ self.words.subscribe(self.words.SIZE_CHANGED, onResize)
+ self.start(False,
+ (checkMessageReceived,
+ changeText,
+ ))
+
+ def testVideoSizeChanged(self):
+
+ def onResize(newSize):
+ self.messageReceived = True
+
+ self.messageReceived = False
+ root = self.loadEmptyScene()
+ self.video = avg.VideoNode(href="mpeg1-48x48.mov", parent=root)
+ self.video.subscribe(self.video.SIZE_CHANGED, onResize)
+ self.video.play()
+ self.assert_(self.messageReceived)
+
+ def testRectSizeChanged(self):
+
+ def onResize(newSize):
+ self.messageReceived = True
+
+ self.messageReceived = False
+ root = self.loadEmptyScene()
+ self.rect = avg.RectNode(size=(10,10), parent=root)
+ self.rect.subscribe(self.rect.SIZE_CHANGED, onResize)
+ self.rect.size=(100,100)
+ self.assert_(self.messageReceived)
+
def eventTestSuite(tests):
availableTests = (
"testKeyEvents",
"testSimpleEvents",
"testTilted",
+ "testWordsClicks",
"testDivEvents",
+ "testDivNegativePos",
+ "testUnlinkInHandler",
"testConnectHandler",
+ "testPublisher",
+ "testComplexPublisher",
+ "testPublisherAutoDelete",
+ "testPublisherNestedUnsubscribe",
"testObscuringEvents",
"testSensitive",
"testChangingHandlers",
"testEventCapture",
"testMouseOver",
+ "testMouseDisable",
"testEventErr",
"testEventHook",
"testException",
"testContacts",
"testContactRegistration",
"testMultiContactRegistration",
+ "testPlaybackMessages",
+ "testImageSizeChanged",
+ "testWordsSizeChanged",
+ "testVideoSizeChanged",
+ "testRectSizeChanged",
)
return createAVGTestSuite(availableTests, EventTestCase, tests)
-Player = avg.Player.get()
-Helper = Player.getTestHelper()
+Helper = player.getTestHelper()
diff --git a/src/test/FXTest.py b/src/test/FXTest.py
index 043a5b2..de677a0 100644
--- a/src/test/FXTest.py
+++ b/src/test/FXTest.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# libavg - Media Playback Engine.
-# Copyright (C) 2003-2011 Ulrich von Zadow
+# 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
@@ -20,9 +20,10 @@
# Current versions can be found at www.libavg.de
#
-from libavg import avg, utils
+from libavg import avg, utils, player
from testcase import *
+
class FXTestCase(AVGTestCase):
def __init__(self, testFuncName):
AVGTestCase.__init__(self, testFuncName)
@@ -44,6 +45,10 @@ class FXTestCase(AVGTestCase):
fillcolor="FFFFFF")
root.insertChild(node, 0)
+ def emptyImageFX():
+ node = avg.ImageNode(parent=root, href="", pos=(64,0))
+ node.setEffect(avg.NullFXNode())
+
# Initial setup is 3x2 images:
# rows: no alpha, alpha, alpha & opacity 0.6
# cols: no FX, FX
@@ -67,27 +72,28 @@ class FXTestCase(AVGTestCase):
opacity=0.6)
configureNode(node, fx)
- self.start((
- lambda: self.compareImage("testImageNullFX1", False),
+ self.start(False,
+ (lambda: self.compareImage("testImageNullFX1"),
addBgNode,
- lambda: self.compareImage("testImageNullFX2", False),
+ lambda: self.compareImage("testImageNullFX2"),
activateFX,
- lambda: self.compareImage("testImageNullFX2", False),
+ lambda: self.compareImage("testImageNullFX2"),
newNode,
- lambda: self.compareImage("testImageNullFX3", False),
+ lambda: self.compareImage("testImageNullFX3"),
newFX,
- lambda: self.compareImage("testImageNullFX3", False),
+ lambda: self.compareImage("testImageNullFX3"),
+ emptyImageFX,
lambda: utils.initFXCache(10),
))
def testVideoNullFX(self):
root = self.loadEmptyScene()
- Player.setFakeFPS(25)
- node = avg.VideoNode(parent=root, href="../video/testfiles/mjpeg-48x48.avi",
+ player.setFakeFPS(25)
+ node = avg.VideoNode(parent=root, href="mjpeg-48x48.avi",
threaded=False)
node.setEffect(avg.NullFXNode())
node.play()
- self.start((lambda: self.compareImage("testVideoNullFX", False),))
+ self.start(False, (lambda: self.compareImage("testVideoNullFX"),))
def testWordsNullFX(self):
root = self.loadEmptyScene()
@@ -95,22 +101,28 @@ class FXTestCase(AVGTestCase):
node.setEffect(avg.NullFXNode())
node = avg.WordsNode(parent=root, text="testtext", pos=(0,20),
font="Bitstream Vera Sans")
- self.start((
- lambda: self.compareImage("testWordsNullFX", True),
+ self.start(True,
+ (lambda: self.compareImage("testWordsNullFX"),
))
def testCanvasNullFX(self):
- def setOpacity():
+ def setOuterOpacity():
node.opacity=0.6
+ def setInnerOpacity():
+ innerNode = canvas.getElementByID("test")
+ innerNode.opacity = 0.0
+
root = self.loadEmptyScene()
- self.__createOffscreenCanvas()
+ canvas = self.__createOffscreenCanvas()
node = avg.ImageNode(parent=root, href="canvas:offscreen")
node.setEffect(avg.NullFXNode())
- self.start((
- lambda: self.compareImage("testCanvasNullFX1", False),
- setOpacity,
- lambda: self.compareImage("testCanvasNullFX2", False),
+ self.start(False,
+ (lambda: self.compareImage("testCanvasNullFX1"),
+ setOuterOpacity,
+ lambda: self.compareImage("testCanvasNullFX2"),
+ setInnerOpacity,
+ lambda: self.compareImage("testCanvasNullFX3"),
))
def testNodeInCanvasNullFX(self):
@@ -123,20 +135,22 @@ class FXTestCase(AVGTestCase):
fillopacity=1)
canvas.getRootNode().insertChild(rect, 0)
- self.start((
- lambda: self.compareImage("testNodeInCanvasNullFX1", False),
+ self.start(False,
+ (lambda: self.compareImage("testNodeInCanvasNullFX1"),
))
def testRenderPipeline(self):
- print
+ sys.stderr.write("\n")
for useSrcCanvas in (False, True):
for useDestCanvas in (False, True):
for useFX in (False, True):
for useColorConv in (False, True):
- print " ", useSrcCanvas, useDestCanvas, useFX, useColorConv
+ sys.stderr.write(" "+str(useSrcCanvas)+" "+str(useDestCanvas)+
+ " "+str(useFX)+" "+str(useColorConv)+"\n")
root = self.loadEmptyScene()
if useSrcCanvas:
- srcCanvas = Player.createCanvas(id="src", size=(160,120))
+ srcCanvas = player.createCanvas(id="src", size=(160,120),
+ mediadir="media")
avg.ImageNode(href="rgb24alpha-64x64.png",
parent=srcCanvas.getRootNode())
srcImg = avg.ImageNode(href="canvas:src")
@@ -147,17 +161,18 @@ class FXTestCase(AVGTestCase):
if useColorConv:
srcImg.contrast = (1.01, 1.0, 1.0)
if useDestCanvas:
- destCanvas = Player.createCanvas(id="dest", size=(160,120))
+ destCanvas = player.createCanvas(id="dest",
+ size=(160,120), mediadir="media")
destCanvas.getRootNode().appendChild(srcImg)
- destImg = avg.ImageNode(href="canvas:dest", parent=root)
+ avg.ImageNode(href="canvas:dest", parent=root)
else:
root.appendChild(srcImg)
- self.start((
- lambda: self.compareImage("testRenderPipeline", False),
+ self.start(False,
+ (lambda: self.compareImage("testRenderPipeline"),
))
def testBlurFX(self):
-
+
def setRadius(radius):
self.effect.radius = radius
@@ -168,25 +183,26 @@ class FXTestCase(AVGTestCase):
self.node.setEffect(self.effect)
def addNewFX():
- effect = avg.BlurFXNode()
- effect.radius = 8
+ effect = avg.BlurFXNode(8)
self.node.setEffect(effect)
root = self.loadEmptyScene()
self.node = avg.ImageNode(parent=root, pos=(10,10), href="rgb24-64x64.png")
self.effect = avg.BlurFXNode()
- self.node.setEffect(self.effect)
- self.start((
- lambda: self.compareImage("testBlurFX1", False),
+ self.start(False,
+ (self.skipIfMinimalShader,
+ lambda: self.node.setEffect(self.effect),
+ lambda: self.compareImage("testBlurFX1"),
lambda: setRadius(8),
- lambda: self.compareImage("testBlurFX2", False),
+ lambda: self.compareImage("testBlurFX2"),
removeFX,
- lambda: self.compareImage("testBlurFX3", False),
+ lambda: self.compareImage("testBlurFX3"),
reAddFX,
- lambda: self.compareImage("testBlurFX2", False),
+ lambda: self.compareImage("testBlurFX2"),
removeFX,
addNewFX,
- lambda: self.compareImage("testBlurFX2", False),
+ lambda: self.compareImage("testBlurFX2"),
+ lambda: setRadius(300),
))
def testHueSatFX(self):
@@ -202,20 +218,21 @@ class FXTestCase(AVGTestCase):
root = self.loadEmptyScene()
self.node = avg.ImageNode(parent=root, pos=(10,10), href="rgb24alpha-64x64.png")
resetFX()
- self.start((
- lambda: self.compareImage("testHueSatFX1", False),
- lambda: setParam('saturation', -50),
- lambda: self.compareImage("testHueSatFX2", False),
- lambda: setParam('saturation', -100),
- lambda: self.compareImage("testHueSatFX3", False),
- lambda: setParam('saturation', -150),
- lambda: self.compareImage("testHueSatFX3", False),
- resetFX,
- lambda: setParam('hue', 180),
- lambda: self.compareImage("testHueSatFX4", False),
- lambda: setParam('hue', -180),
- lambda: self.compareImage("testHueSatFX4", False),
- ))
+ self.start(False,
+ (self.skipIfMinimalShader,
+ lambda: self.compareImage("testHueSatFX1"),
+ lambda: setParam('saturation', -50),
+ lambda: self.compareImage("testHueSatFX2"),
+ lambda: setParam('saturation', -100),
+ lambda: self.compareImage("testHueSatFX3"),
+ lambda: setParam('saturation', -150),
+ lambda: self.compareImage("testHueSatFX3"),
+ resetFX,
+ lambda: setParam('hue', 180),
+ lambda: self.compareImage("testHueSatFX4"),
+ lambda: setParam('hue', -180),
+ lambda: self.compareImage("testHueSatFX4"),
+ ))
def testInvertFX(self):
@@ -227,18 +244,18 @@ class FXTestCase(AVGTestCase):
self.redRect = avg.RectNode(parent=self.root, pos=(5, 5), fillcolor='FF0000',
fillopacity=1, opacity=0, size=(72, 72))
self.node = avg.ImageNode(parent=self.root, pos=(10,10),
- href="../graphics/testfiles/rgb24alpha-64x64.png")
+ href="rgb24alpha-64x64.png")
resetFX()
self.root = self.loadEmptyScene()
- self.node = avg.ImageNode(parent=self.root, pos=(10,10),
- href="../graphics/testfiles/hsl.png")
+ self.node = avg.ImageNode(parent=self.root, pos=(10,10), href="hsl.png")
resetFX()
- self.start((
- lambda: self.compareImage("testInvertFX1", False),
- redAlphaScene,
- lambda: self.compareImage("testInvertFX2", False),
- ))
+ self.start(False,
+ (self.skipIfMinimalShader,
+ lambda: self.compareImage("testInvertFX1"),
+ redAlphaScene,
+ lambda: self.compareImage("testInvertFX2"),
+ ))
def testShadowFX(self):
@@ -252,33 +269,42 @@ class FXTestCase(AVGTestCase):
rect = avg.RectNode(parent=root, pos=(9.5,9.5), color="0000FF")
node = avg.ImageNode(parent=root, pos=(10,10), href="shadow.png")
rect.size = node.size + (1, 1)
- effect = avg.ShadowFXNode()
- node.setEffect(effect)
- self.start((
- lambda: self.compareImage("testShadowFX1", False),
+ effect = avg.ShadowFXNode((0,0), 1, 1, "FFFFFF")
+ self.start(False,
+ (self.skipIfMinimalShader,
+ lambda: node.setEffect(effect),
+ lambda: self.compareImage("testShadowFX1"),
lambda: setParams((0,0), 3, 2, "00FFFF"),
- lambda: self.compareImage("testShadowFX2", False),
+ lambda: self.compareImage("testShadowFX2"),
lambda: setParams((2,2), 0.1, 1, "FFFFFF"),
- lambda: self.compareImage("testShadowFX3", False),
+ lambda: self.compareImage("testShadowFX3"),
lambda: setParams((-2,-2), 0.1, 1, "FFFFFF"),
- lambda: self.compareImage("testShadowFX4", False),
+ lambda: self.compareImage("testShadowFX4"),
lambda: setParams((-2,-2), 3, 1, "FFFFFF"),
- lambda: self.compareImage("testShadowFX5", False),
+ lambda: self.compareImage("testShadowFX5"),
lambda: setParams((0,0), 0, 1, "FFFFFF"),
- lambda: self.compareImage("testShadowFX6", False),
+ lambda: self.compareImage("testShadowFX6"),
))
def testWordsShadowFX(self):
+
+ def setParams(offset, radius, opacity, color):
+ effect.offset = offset
+ effect.radius = radius
+ effect.opacity = opacity
+ effect.color = color
+
root = self.loadEmptyScene()
node = avg.WordsNode(parent=root, pos=(10,10), text="testtext",
font="Bitstream Vera Sans")
effect = avg.ShadowFXNode()
- effect.setParams((0,0), 1.5, 1.5, "FF0000")
- node.setEffect(effect)
- self.start((
- lambda: self.compareImage("testWordsShadowFX1", True),
- lambda: effect.setParams((2,2), 2, 2, "00FFFF"),
- lambda: self.compareImage("testWordsShadowFX2", True),
+ setParams((0,0), 1.5, 1.5, "FF0000")
+ self.start(True,
+ (self.skipIfMinimalShader,
+ lambda: node.setEffect(effect),
+ lambda: self.compareImage("testWordsShadowFX1"),
+ lambda: setParams((2,2), 2, 2, "00FFFF"),
+ lambda: self.compareImage("testWordsShadowFX2"),
))
def testGamma(self):
@@ -288,11 +314,11 @@ class FXTestCase(AVGTestCase):
root = self.loadEmptyScene()
node = avg.ImageNode(parent=root, href="colorramp.png", gamma=(0.5,0.5,0.5))
self.assertEqual(node.gamma, (0.5,0.5,0.5))
- self.start((
- lambda: self.compareImage("testGamma1", False),
+ self.start(False,
+ (lambda: self.compareImage("testGamma1"),
lambda: setGamma((1.5,2.0,2.5)),
lambda: self.assertEqual(node.gamma, (1.5,2.0,2.5)),
- lambda: self.compareImage("testGamma2", False),
+ lambda: self.compareImage("testGamma2"),
))
def testIntensity(self):
@@ -302,32 +328,34 @@ class FXTestCase(AVGTestCase):
def showVideo():
node.unlink(True)
self.videoNode = avg.VideoNode(parent=root, size=(96,96), threaded=False,
- href="../video/testfiles/mpeg1-48x48.mpg", intensity=(0.5,0.5,0.5))
+ href="mpeg1-48x48.mov", intensity=(0.5,0.5,0.5))
self.videoNode.play()
- def showText():
- self.videoNode.unlink(True)
- textNode = avg.WordsNode(parent=root, fontsize=24, font="Bitstream Vera Sans",
- intensity=(0.5,0.5,0.5), text="Half-brightness text.",
- width=140)
-
root = self.loadEmptyScene()
node = avg.ImageNode(parent=root, href="colorramp.png", intensity=(0.5,0.5,0.5))
self.assertEqual(node.intensity, (0.5,0.5,0.5))
- Player.setFakeFPS(10)
- self.start((
- lambda: self.compareImage("testIntensity1", False),
+ player.setFakeFPS(10)
+ self.start(False,
+ (lambda: self.compareImage("testIntensity1"),
lambda: setIntensity((1.5,2.0,2.5)),
lambda: self.assertEqual(node.intensity, (1.5,2.0,2.5)),
- lambda: self.compareImage("testIntensity2", False),
+ lambda: self.compareImage("testIntensity2"),
showVideo,
- lambda: self.compareImage("testIntensity3", False),
- showText,
- lambda: self.compareImage("testIntensity4", False),
+ lambda: self.compareImage("testIntensity3"),
))
- Player.setFakeFPS(-1)
+ player.setFakeFPS(-1)
self.videoNode = None
+ def testWordsIntensity(self):
+ root = self.loadEmptyScene()
+ avg.WordsNode(parent=root, fontsize=24, font="Bitstream Vera Sans",
+ intensity=(0.5,0.5,0.5), text="brightness",
+ width=140)
+ self.start(True,
+ (lambda: self.compareImage("testWordsIntensity"),
+ ))
+
+
def testContrast(self):
def setContrast(val):
node.contrast = val
@@ -335,22 +363,22 @@ class FXTestCase(AVGTestCase):
def showVideo():
node.unlink(True)
videoNode = avg.VideoNode(parent=root, size=(96,96), threaded=False,
- href="../video/testfiles/mpeg1-48x48.mpg", contrast=(0.5,0.5,0.5))
+ href="mpeg1-48x48.mov", contrast=(0.5,0.5,0.5))
videoNode.play()
root = self.loadEmptyScene()
node = avg.ImageNode(parent=root, href="colorramp.png", contrast=(0.5,0.5,0.5))
self.assertEqual(node.contrast, (0.5,0.5,0.5))
- Player.setFakeFPS(10)
- self.start((
- lambda: self.compareImage("testContrast1", False),
+ player.setFakeFPS(10)
+ self.start(False,
+ (lambda: self.compareImage("testContrast1"),
lambda: setContrast((1.5,2.0,2.5)),
lambda: self.assertEqual(node.contrast, (1.5,2.0,2.5)),
- lambda: self.compareImage("testContrast2", False),
+ lambda: self.compareImage("testContrast2"),
showVideo,
- lambda: self.compareImage("testContrast3", False),
+ lambda: self.compareImage("testContrast3"),
))
- Player.setFakeFPS(-1)
+ player.setFakeFPS(-1)
def testFXUpdate(self):
# This tests if the FX render-on-demand functionality doesn't forget updates.
@@ -372,7 +400,7 @@ class FXTestCase(AVGTestCase):
def addVideo():
node.unlink(True)
videoNode = avg.VideoNode(parent=root, threaded=False, size=(96,96),
- href="../video/testfiles/mpeg1-48x48.mpg")
+ href="mpeg1-48x48.mov")
effect = avg.BlurFXNode()
effect.radius = 0
videoNode.setEffect(effect)
@@ -382,69 +410,74 @@ class FXTestCase(AVGTestCase):
node = avg.ImageNode(parent=root, href="rgb24alpha-64x64.png")
effect = avg.BlurFXNode()
effect.radius = 0
- node.setEffect(effect)
- Player.setFakeFPS(25)
- self.start((
+ player.setFakeFPS(25)
+ self.start(False,
+ (self.skipIfMinimalShader,
+ lambda: node.setEffect(effect),
changeTexture,
- lambda: self.compareImage("testFXUpdateTex", False),
+ lambda: self.compareImage("testFXUpdateTex"),
addMaskTex,
- lambda: self.compareImage("testFXUpdateMaskTex1", False),
+ lambda: self.compareImage("testFXUpdateMaskTex1"),
changeMaskTex,
- lambda: self.compareImage("testFXUpdateMaskTex2", False),
+ lambda: self.compareImage("testFXUpdateMaskTex2"),
changeMaskPos,
- lambda: self.compareImage("testFXUpdateMaskPos", False),
+ lambda: self.compareImage("testFXUpdateMaskPos"),
changeFX,
- lambda: self.compareImage("testFXUpdateFX", False),
+ lambda: self.compareImage("testFXUpdateFX"),
addVideo,
None,
- lambda: self.compareImage("testFXUpdateVideo", False),
+ lambda: self.compareImage("testFXUpdateVideo"),
+ ))
+
+ def testChromaKeyFX(self):
+
+ def setParams(htol, ltol, stol):
+ effect.htolerance = htol
+ effect.ltolerance = ltol
+ effect.stolerance = stol
+
+ root = self.loadEmptyScene()
+ node = avg.ImageNode(parent=root, href="rgb24-64x64.png")
+ effect = avg.ChromaKeyFXNode()
+ setParams(0.01, 0.01, 0.01)
+ self.start(False,
+ (self.skipIfMinimalShader,
+ lambda: node.setEffect(effect),
+ lambda: self.compareImage("testChromaKeyFX1"),
+ lambda: setParams(0.2, 0.2, 0.2),
+ lambda: self.compareImage("testChromaKeyFX2"),
+ lambda: effect.__setattr__("color", "FF0000"),
+ lambda: self.compareImage("testChromaKeyFX3"),
+ lambda: effect.__setattr__("spillthreshold", 1),
+ lambda: self.compareImage("testChromaKeyFX4"),
))
def __createOffscreenCanvas(self):
- canvas = Player.createCanvas(id="offscreen", size=(160,120))
+ canvas = player.createCanvas(id="offscreen", size=(160,120), mediadir="media")
root = canvas.getRootNode()
avg.ImageNode(href="rgb24-32x32.png", parent=root)
avg.ImageNode(id="test", pos=(32,0), href="rgb24alpha-32x32.png", parent=root)
return canvas
-def areFXSupported():
- sceneString = """<avg id="avg" width="160" height="120"/>"""
- Player.loadString(sceneString)
- root = Player.getRootNode()
- # XXX: The second of the following two lines prevent an opengl error in
- # testImageNullFX on the Mac (Snow Leopard) for some reason.
- node = avg.ImageNode(href="rgb24-65x65.png", parent=root)
- node = avg.ImageNode(href="rgb24-65x65.png", parent=root)
- node.setEffect(avg.BlurFXNode())
- Player.setTimeout(0, Player.stop)
- try:
- Player.play()
- return True
- except RuntimeError:
- return False
-
def fxTestSuite(tests):
- if areFXSupported():
- availableTests = [
- "testImageNullFX",
- "testVideoNullFX",
- "testWordsNullFX",
- "testCanvasNullFX",
- "testNodeInCanvasNullFX",
- "testRenderPipeline",
- "testBlurFX",
- "testHueSatFX",
- "testInvertFX",
- "testShadowFX",
- "testWordsShadowFX",
- "testGamma",
- "testIntensity",
- "testContrast",
- "testFXUpdate",
- ]
- else:
- availableTests = []
+ availableTests = [
+ "testImageNullFX",
+ "testVideoNullFX",
+ "testWordsNullFX",
+ "testCanvasNullFX",
+ "testNodeInCanvasNullFX",
+ "testRenderPipeline",
+ "testBlurFX",
+ "testHueSatFX",
+ "testInvertFX",
+ "testShadowFX",
+ "testWordsShadowFX",
+ "testGamma",
+ "testIntensity",
+ "testWordsIntensity",
+ "testContrast",
+ "testFXUpdate",
+ "testChromaKeyFX",
+ ]
return createAVGTestSuite(availableTests, FXTestCase, tests)
-
-Player = avg.Player.get()
diff --git a/src/test/GestureTest.py b/src/test/GestureTest.py
new file mode 100644
index 0000000..4c1a792
--- /dev/null
+++ b/src/test/GestureTest.py
@@ -0,0 +1,1048 @@
+# -*- 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
+#
+
+from libavg import avg, gesture, player
+
+import math
+from testcase import *
+
+class GestureTestCase(AVGTestCase):
+
+ def __init__(self, testFuncName):
+ AVGTestCase.__init__(self, testFuncName)
+
+ def testTapRecognizer(self):
+
+ def abort():
+ self.__tapRecognizer.abort()
+
+ def enable(isEnabled):
+ self.__tapRecognizer.enable(isEnabled)
+
+ self.__initImageScene()
+ self.__tapRecognizer = gesture.TapRecognizer(self.image)
+ self.messageTester = MessageTester(self.__tapRecognizer,
+ [gesture.Recognizer.POSSIBLE, gesture.Recognizer.DETECTED,
+ gesture.Recognizer.FAILED], self)
+ player.setFakeFPS(10)
+ self.start(False,
+ (# Down-up: recognized as tap.
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 30, 30,
+ [gesture.Recognizer.POSSIBLE]),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 30, 30,
+ [gesture.Recognizer.DETECTED]),
+ # Down-small move-up: recognized as tap.
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 30, 30,
+ [gesture.Recognizer.POSSIBLE]),
+ self._genMouseEventFrames(avg.Event.CURSOR_MOTION, 31, 30, []),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 30, 30,
+ [gesture.Recognizer.DETECTED]),
+
+ # Down-small down-second up-second up-first: recognized as tap
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 30, 30,
+ [gesture.Recognizer.POSSIBLE]),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_DOWN, 31, 30, btn=2),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_UP, 31, 30, btn=2),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_DOWN, 31, 30, btn=2),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_UP, 31, 30, btn=2),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 30, 30,
+ [gesture.Recognizer.DETECTED]),
+
+ # Down-big move-up: fail
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 30, 30,
+ [gesture.Recognizer.POSSIBLE]),
+ self._genMouseEventFrames(avg.Event.CURSOR_MOTION, 80, 80,
+ [gesture.Recognizer.FAILED]),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 30, 30, []),
+ # Down-Abort-Up: not recognized as tap
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 30, 30,
+ [gesture.Recognizer.POSSIBLE]),
+ abort,
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 30, 30, []),
+ # Abort-Down-Up: recognized as tap
+ abort,
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 30, 30,
+ [gesture.Recognizer.POSSIBLE]),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 30, 30,
+ [gesture.Recognizer.DETECTED]),
+ # Down-Abort-Up-Down-Up: recognized as tap
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 30, 30,
+ [gesture.Recognizer.POSSIBLE]),
+ abort,
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 30, 30, []),
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 30, 30,
+ [gesture.Recognizer.POSSIBLE]),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 30, 30,
+ [gesture.Recognizer.DETECTED]),
+ # Disable-Down-Up-Enable: not recognized as tap
+ lambda: enable(False),
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 30, 30, []),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 30, 30, []),
+ lambda: enable(True),
+ # Down-Disable-Enable-Up: not recognized as tap
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 30, 30,
+ [gesture.Recognizer.POSSIBLE]),
+ lambda: enable(False),
+ lambda: enable(True),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 30, 30, []),
+ # Down-Disable-Up-Enable-Down-Up: recognized as tap
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 30, 30,
+ [gesture.Recognizer.POSSIBLE]),
+ lambda: enable(False),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 30, 30, []),
+ lambda: enable(True),
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 30, 30,
+ [gesture.Recognizer.POSSIBLE]),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 30, 30,
+ [gesture.Recognizer.DETECTED]),
+ # Abort-Disable-Abort-Enable-Abort-Down-Up: recognized as tap
+ abort,
+ lambda: enable(False),
+ abort,
+ lambda: enable(True),
+ abort,
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 30, 30,
+ [gesture.Recognizer.POSSIBLE]),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 30, 30,
+ [gesture.Recognizer.DETECTED]),
+
+ # Remove node while tap is in progress.
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 30, 30,
+ [gesture.Recognizer.POSSIBLE]),
+ self.__killImageNode,
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 30, 30, []),
+ ))
+
+ def testHoldRecognizer(self):
+
+ def abort():
+ self.__holdRecognizer.abort()
+
+ def enable(isEnabled):
+ self.__holdRecognizer.enable(isEnabled)
+
+ player.setFakeFPS(20)
+ self.__initImageScene()
+ self.__holdRecognizer = gesture.HoldRecognizer(self.image,
+ delay=1000)
+ self.messageTester = MessageTester(self.__holdRecognizer,
+ [gesture.Recognizer.POSSIBLE, gesture.Recognizer.DETECTED,
+ gesture.Recognizer.FAILED, gesture.Recognizer.END], self)
+ self.start(False,
+ (# Standard down-hold-up sequence.
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 30, 30,
+ [gesture.Recognizer.POSSIBLE]),
+ lambda: self.delay(1100),
+ lambda: self.messageTester.assertState([gesture.Recognizer.DETECTED]),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 30, 30,
+ [gesture.Recognizer.END]),
+
+ # down-up sequence, hold not long enough.
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 30, 30,
+ [gesture.Recognizer.POSSIBLE]),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 30, 30,
+ [gesture.Recognizer.FAILED]),
+
+ # down-move-up sequence, should fail.
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 1, 1,
+ [gesture.Recognizer.POSSIBLE]),
+ self._genMouseEventFrames(avg.Event.CURSOR_MOTION, 150, 50,
+ [gesture.Recognizer.FAILED]),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 30, 30, []),
+
+ # down-hold-abort-up, should be recognized, no end event.
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 30, 30,
+ [gesture.Recognizer.POSSIBLE]),
+ lambda: self.delay(1100),
+ lambda: self.messageTester.assertState([gesture.Recognizer.DETECTED]),
+ abort,
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 30, 30, []),
+
+ # down-abort-hold-up, should not be recognized
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 30, 30,
+ [gesture.Recognizer.POSSIBLE]),
+ abort,
+ lambda: self.delay(1100),
+ lambda: self.messageTester.assertState([]),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 30, 30, []),
+
+ # down-hold-disabled-up-enabled, should be recognized, no end event.
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 30, 30,
+ [gesture.Recognizer.POSSIBLE]),
+ lambda: self.delay(1100),
+ lambda: self.messageTester.assertState([gesture.Recognizer.DETECTED]),
+ lambda: enable(False),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 30, 30, []),
+ lambda: enable(True),
+
+ # down-disabled-enabled-hold-up, should not be recognized
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 30, 30,
+ [gesture.Recognizer.POSSIBLE]),
+ lambda: enable(False),
+ lambda: enable(True),
+ lambda: self.delay(1100),
+ lambda: self.messageTester.assertState([]),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 30, 30, []),
+
+ # Remove node while hold is in progress.
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 30, 30,
+ [gesture.Recognizer.POSSIBLE]),
+ self.__killImageNode,
+ lambda: self.delay(1100),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 30, 30, []),
+ ))
+ player.setFakeFPS(-1)
+
+
+ def testDoubletapRecognizer(self):
+
+ def abort():
+ self.__tapRecognizer.abort()
+
+ def enable(isEnabled):
+ self.__tapRecognizer.enable(isEnabled)
+
+ root = self.loadEmptyScene()
+ image = avg.ImageNode(parent=root, href="rgb24-64x64.png", size=(128,128))
+ self.__tapRecognizer = gesture.DoubletapRecognizer(image)
+ self.messageTester = MessageTester(self.__tapRecognizer,
+ [gesture.Recognizer.POSSIBLE, gesture.Recognizer.DETECTED,
+ gesture.Recognizer.FAILED, gesture.Recognizer.END], self)
+ player.setFakeFPS(20)
+ self.start(False,
+ (# Down, up, down, up: click
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 30, 30,
+ [gesture.Recognizer.POSSIBLE]),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 30, 30, []),
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 30, 30, []),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 30, 30,
+ [gesture.Recognizer.DETECTED]),
+ # Down, move: stop
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 0, 30,
+ [gesture.Recognizer.POSSIBLE]),
+ self._genMouseEventFrames(avg.Event.CURSOR_MOTION, 80, 30,
+ [gesture.Recognizer.FAILED]),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 0, 30, []),
+ # Down, up, move: stop
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 0, 30,
+ [gesture.Recognizer.POSSIBLE]),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 0, 30, []),
+ self._genMouseEventFrames(avg.Event.CURSOR_MOTION, 80, 30, []),
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 80, 30,
+ [gesture.Recognizer.FAILED]),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 0, 30, []),
+ # Down, up, down, move: stop
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 0, 30,
+ [gesture.Recognizer.POSSIBLE]),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 0, 30, []),
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 0, 30, []),
+ self._genMouseEventFrames(avg.Event.CURSOR_MOTION, 80, 30,
+ [gesture.Recognizer.FAILED]),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 0, 30, []),
+ # Down,delay: stop
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 30, 30,
+ [gesture.Recognizer.POSSIBLE]),
+ lambda: self.delay(1000),
+ lambda: self.messageTester.assertState([gesture.Recognizer.FAILED]),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 30, 30,
+ []),
+ # Down, up, delay: stop
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 30, 30,
+ [gesture.Recognizer.POSSIBLE]),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 30, 30, []),
+ lambda: self.delay(1000),
+ lambda: self.messageTester.assertState([gesture.Recognizer.FAILED]),
+ # Down, up, down, delay: stop
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 30, 30,
+ [gesture.Recognizer.POSSIBLE]),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 30, 30, []),
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 30, 30, []),
+ lambda: self.delay(1000),
+ lambda: self.messageTester.assertState([gesture.Recognizer.FAILED]),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 30, 30,
+ []),
+ # Down, abort, up, down, up, delay: just one click
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 30, 30,
+ [gesture.Recognizer.POSSIBLE]),
+ abort,
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 30, 30, []),
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 30, 30,
+ [gesture.Recognizer.POSSIBLE]),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 30, 30, []),
+ lambda: self.delay(1000),
+ lambda: self.messageTester.assertState([gesture.Recognizer.FAILED]),
+ # Down, up, abort, down, up, delay: two clicks but no double-click
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 30, 30,
+ [gesture.Recognizer.POSSIBLE]),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 30, 30, []),
+ abort,
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 30, 30,
+ [gesture.Recognizer.POSSIBLE]),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 30, 30, []),
+ lambda: self.delay(1000),
+ lambda: self.messageTester.assertState([gesture.Recognizer.FAILED]),
+ # Down, up, down, abort, up: just one click
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 30, 30,
+ [gesture.Recognizer.POSSIBLE]),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 30, 30, []),
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 30, 30, []),
+ abort,
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 30, 30, []),
+ # Down, abort, up, down, up, down up: first aborted then recognized
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 30, 30,
+ [gesture.Recognizer.POSSIBLE]),
+ abort,
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 30, 30, []),
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 30, 30,
+ [gesture.Recognizer.POSSIBLE]),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 30, 30, []),
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 30, 30, []),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 30, 30,
+ [gesture.Recognizer.DETECTED]),
+ # Disabled, down, up, down, up, enabled: nothing
+ lambda: enable(False),
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 30, 30, []),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 30, 30, []),
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 30, 30, []),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 30, 30, []),
+ lambda: enable(True),
+ # Down, disabled up, down, up, enabled: just one down
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 30, 30,
+ [gesture.Recognizer.POSSIBLE]),
+ lambda: enable(False),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 30, 30, []),
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 30, 30, []),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 30, 30, []),
+ lambda: enable(True),
+ # Down, up, disabled, down, up, enabled: just one click
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 30, 30,
+ [gesture.Recognizer.POSSIBLE]),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 30, 30, []),
+ lambda: enable(False),
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 30, 30, []),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 30, 30, []),
+ lambda: enable(True),
+ # Down, up, down, disabled, up, enabled: just one click
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 30, 30,
+ [gesture.Recognizer.POSSIBLE]),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 30, 30, []),
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 30, 30, []),
+ lambda: enable(False),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 30, 30, []),
+ lambda: enable(True),
+ # Down, disabled, enabled, up, down, up, down, up: recognized
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 30, 30,
+ [gesture.Recognizer.POSSIBLE]),
+ lambda: enable(False),
+ lambda: enable(True),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 30, 30, []),
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 30, 30,
+ [gesture.Recognizer.POSSIBLE]),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 30, 30, []),
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 30, 30, []),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 30, 30,
+ [gesture.Recognizer.DETECTED]),
+ ))
+
+
+ def testSwipeRecognizer(self):
+
+ # One finger
+ for direction, xdir in (
+ (gesture.SwipeRecognizer.RIGHT, 1), (gesture.SwipeRecognizer.LEFT, -1)):
+ self.__initImageScene()
+ swipeRecognizer = gesture.SwipeRecognizer(self.image, minDist=20,
+ direction=direction)
+ self.messageTester = MessageTester(swipeRecognizer,
+ [gesture.Recognizer.POSSIBLE, gesture.Recognizer.DETECTED,
+ gesture.Recognizer.FAILED],
+ self)
+ self.start(False,
+ (self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 30, 30,
+ [gesture.Recognizer.POSSIBLE]),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 30+xdir*30, 30,
+ [gesture.Recognizer.DETECTED]),
+ # Check angle tolerance
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 30, 30,
+ [gesture.Recognizer.POSSIBLE]),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 30+xdir*30, 25,
+ [gesture.Recognizer.DETECTED]),
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 30, 30,
+ [gesture.Recognizer.POSSIBLE]),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 30+xdir*30, 35,
+ [gesture.Recognizer.DETECTED]),
+ # Not far enough -> fail
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 30, 30,
+ [gesture.Recognizer.POSSIBLE]),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 30+xdir*10, 30,
+ [gesture.Recognizer.FAILED]),
+ # Wrong direction -> fail
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 30, 30,
+ [gesture.Recognizer.POSSIBLE]),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 30+xdir*30, 60,
+ [gesture.Recognizer.FAILED]),
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 30, 30,
+ [gesture.Recognizer.POSSIBLE]),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 30+xdir*30, 5,
+ [gesture.Recognizer.FAILED]),
+ ))
+
+
+ def testSwipeRecognizerTwoFingers(self):
+ self.__initImageScene()
+ swipeRecognizer = gesture.SwipeRecognizer(self.image, minDist=20, numContacts=2,
+ maxContactDist=15, direction=gesture.SwipeRecognizer.RIGHT)
+ self.messageTester = MessageTester(swipeRecognizer,
+ [gesture.Recognizer.POSSIBLE, gesture.Recognizer.DETECTED,
+ gesture.Recognizer.FAILED],
+ self)
+ self.start(False,
+ (self._genTouchEventFrames(
+ [(0, avg.Event.CURSOR_DOWN, 30, 30,),],
+ []),
+ self._genTouchEventFrames(
+ [(1, avg.Event.CURSOR_DOWN, 40, 30,),],
+ [gesture.Recognizer.POSSIBLE]),
+ self._genTouchEventFrames(
+ [(1, avg.Event.CURSOR_UP, 70, 30,),],
+ []),
+ self._genTouchEventFrames(
+ [(0, avg.Event.CURSOR_UP, 60, 30,),],
+ [gesture.Recognizer.DETECTED]),
+ # Not enough fingers -> not recognized
+ self._genTouchEventFrames(
+ [(0, avg.Event.CURSOR_DOWN, 30, 30,),],
+ []),
+ self._genTouchEventFrames(
+ [(0, avg.Event.CURSOR_UP, 60, 30,),],
+ []),
+ # Fail first finger
+ self._genTouchEventFrames(
+ [(0, avg.Event.CURSOR_DOWN, 30, 30,),],
+ []),
+ self._genTouchEventFrames(
+ [(1, avg.Event.CURSOR_DOWN, 40, 30,),],
+ [gesture.Recognizer.POSSIBLE]),
+ self._genTouchEventFrames(
+ [(1, avg.Event.CURSOR_UP, 35, 30,),],
+ [gesture.Recognizer.FAILED]),
+ self._genTouchEventFrames(
+ [(0, avg.Event.CURSOR_UP, 60, 30,),],
+ []),
+ # Fail second finger
+ self._genTouchEventFrames(
+ [(0, avg.Event.CURSOR_DOWN, 30, 30,),],
+ []),
+ self._genTouchEventFrames(
+ [(1, avg.Event.CURSOR_DOWN, 40, 30,),],
+ [gesture.Recognizer.POSSIBLE]),
+ self._genTouchEventFrames(
+ [(1, avg.Event.CURSOR_UP, 70, 30,),],
+ []),
+ self._genTouchEventFrames(
+ [(0, avg.Event.CURSOR_UP, 35, 30,),],
+ [gesture.Recognizer.FAILED]),
+ # Fingers too far apart
+ self._genTouchEventFrames(
+ [(0, avg.Event.CURSOR_DOWN, 30, 30,),],
+ []),
+ self._genTouchEventFrames(
+ [(1, avg.Event.CURSOR_DOWN, 50, 30,),],
+ [gesture.Recognizer.FAILED]),
+ self._genTouchEventFrames(
+ [(1, avg.Event.CURSOR_UP, 70, 30,),
+ (0, avg.Event.CURSOR_UP, 60, 30,),],
+ []),
+ ))
+
+ def testDragRecognizer(self):
+
+ def onMove(offset):
+ if self.friction == -1:
+ self.assertEqual(offset, (40,40))
+ self.messageTester.setMessageReceived(gesture.Recognizer.MOTION)
+
+ def onUp(offset):
+ if self.friction == -1:
+ self.assertEqual(offset, (10,-10))
+ self.messageTester.setMessageReceived(gesture.Recognizer.UP)
+
+ def enable(isEnabled):
+ dragRecognizer.enable(isEnabled)
+
+ def abort():
+ dragRecognizer.abort()
+
+ def setupRecognizer(friction, moveHandler=onMove, minDragDist=0,
+ direction=gesture.DragRecognizer.ANY_DIRECTION, **kargs):
+ self.__initImageScene()
+ dragRecognizer = gesture.DragRecognizer(self.image, moveHandler=moveHandler,
+ upHandler=onUp, friction=friction, minDragDist=minDragDist,
+ direction=direction, **kargs)
+ messageTester = MessageTester(dragRecognizer, [gesture.Recognizer.POSSIBLE,
+ gesture.Recognizer.DETECTED, gesture.Recognizer.FAILED,
+ gesture.Recognizer.END],
+ self)
+ return (dragRecognizer, messageTester)
+
+ player.setFakeFPS(100)
+ sys.stderr.write("\n")
+ for self.friction in (-1, 100):
+ if self.friction == -1:
+ sys.stderr.write(" Simple drag, no inertia\n")
+ else:
+ sys.stderr.write(" Simple drag, inertia\n")
+ dragRecognizer, self.messageTester = setupRecognizer(friction=self.friction)
+ self.start(False,
+ (self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 30, 30,
+ [gesture.Recognizer.DETECTED]),
+ self._genMouseEventFrames(avg.Event.CURSOR_MOTION, 70, 70,
+ [gesture.Recognizer.MOTION]),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 40, 20,
+ [gesture.Recognizer.UP, gesture.Recognizer.END]),
+ lambda: enable(False),
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 30, 30, []),
+ lambda: dragRecognizer.enable(True),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 30, 30, []),
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 30, 30,
+ [gesture.Recognizer.DETECTED]),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 40, 20,
+ [gesture.Recognizer.UP, gesture.Recognizer.END]),
+
+ # Remove node during drag.
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 30, 30,
+ [gesture.Recognizer.DETECTED]),
+ self.__killImageNode,
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 30, 30, []),
+ ))
+
+ # Test with constraint.
+ def onVertMove(offset):
+ if self.friction == -1:
+ self.assertEqual(offset, (0,40))
+ self.messageTester.setMessageReceived(gesture.Recognizer.MOTION)
+
+ for self.friction in (-1, 100):
+ if self.friction == -1:
+ sys.stderr.write(" Drag with constraint, no inertia\n")
+ else:
+ sys.stderr.write(" Drag with constraint, inertia\n")
+ dragRecognizer, self.messageTester = setupRecognizer(moveHandler=onVertMove,
+ friction=self.friction, direction=gesture.DragRecognizer.VERTICAL,
+ minDragDist=5)
+ self.start(False,
+ (self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 30, 30,
+ [gesture.Recognizer.POSSIBLE]),
+ self._genMouseEventFrames(avg.Event.CURSOR_MOTION, 35, 30, []),
+ self._genMouseEventFrames(avg.Event.CURSOR_MOTION, 30, 70,
+ [gesture.Recognizer.DETECTED, gesture.Recognizer.MOTION]),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 40, 20,
+ [gesture.Recognizer.UP, gesture.Recognizer.END]),
+ # Wrong direction -> stop.
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 30, 30,
+ [gesture.Recognizer.POSSIBLE]),
+ self._genMouseEventFrames(avg.Event.CURSOR_MOTION, 70, 30,
+ [gesture.Recognizer.FAILED]),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 70, 30, []),
+
+ # No movement -> stop.
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 30, 30,
+ [gesture.Recognizer.POSSIBLE]),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 30, 30,
+ [gesture.Recognizer.FAILED]),
+
+ # Down, Abort, Motion, Motion, Up -> not recognized
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 30, 30,
+ [gesture.Recognizer.POSSIBLE]),
+ abort,
+ self._genMouseEventFrames(avg.Event.CURSOR_MOTION, 35, 30, []),
+ self._genMouseEventFrames(avg.Event.CURSOR_MOTION, 30, 70, []),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 40, 20, []),
+
+ # Down, Motion, Abort, Motion, Up -> not Recognized
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 30, 30,
+ [gesture.Recognizer.POSSIBLE]),
+ self._genMouseEventFrames(avg.Event.CURSOR_MOTION, 35, 30, []),
+ abort,
+ self._genMouseEventFrames(avg.Event.CURSOR_MOTION, 30, 70, []),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 40, 20, []),
+
+ # Down, Motion, Motion, Abort, Up -> not recognized
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 30, 30,
+ [gesture.Recognizer.POSSIBLE]),
+ self._genMouseEventFrames(avg.Event.CURSOR_MOTION, 35, 30, []),
+ self._genMouseEventFrames(avg.Event.CURSOR_MOTION, 30, 70,
+ [gesture.Recognizer.DETECTED, gesture.Recognizer.MOTION]),
+ abort,
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 40, 20, []),
+
+ # Down, Motion, Abort, Up, Down, Motion, Motion, Up -> Recognized
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 30, 30,
+ [gesture.Recognizer.POSSIBLE]),
+ self._genMouseEventFrames(avg.Event.CURSOR_MOTION, 35, 30, []),
+ abort,
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 40, 20, []),
+
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 30, 30,
+ [gesture.Recognizer.POSSIBLE]),
+ self._genMouseEventFrames(avg.Event.CURSOR_MOTION, 35, 30, []),
+ self._genMouseEventFrames(avg.Event.CURSOR_MOTION, 30, 70,
+ [gesture.Recognizer.DETECTED, gesture.Recognizer.MOTION]),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 40, 20,
+ [gesture.Recognizer.UP, gesture.Recognizer.END]),
+ ))
+
+ # Test second down during inertia.
+ sys.stderr.write(" Down during inertia\n")
+ dragRecognizer, self.messageTester = setupRecognizer(friction=0.01)
+ self.start(False,
+ (lambda: self._sendMouseEvent(avg.Event.CURSOR_DOWN, 30, 30),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_UP, 40, 20),
+ self.messageTester.reset,
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 40, 20,
+ [gesture.Recognizer.END, gesture.Recognizer.DETECTED,
+ gesture.Recognizer.MOTION]),
+ ))
+
+ # Test node delete during inertia
+ sys.stderr.write(" Delete during inertia\n")
+ dragRecognizer, self.messageTester = setupRecognizer(friction=0.01)
+ self.start(False,
+ (self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 30, 30,
+ [gesture.Recognizer.DETECTED]),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 40, 20,
+ [gesture.Recognizer.MOTION, gesture.Recognizer.UP]),
+ self.__killImageNode,
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 40, 20,
+ [gesture.Recognizer.MOTION]),
+ ))
+
+ # Test second down during inertia, constrained recognizer
+ sys.stderr.write(" Down during inertia, constrained recognizer\n")
+ dragRecognizer, self.messageTester = setupRecognizer(friction=0.01,
+ direction=gesture.DragRecognizer.VERTICAL, minDragDist=5)
+ self.start(False,
+ (lambda: self._sendMouseEvent(avg.Event.CURSOR_DOWN, 30, 30),
+ self._genMouseEventFrames(avg.Event.CURSOR_MOTION, 30, 70,
+ [gesture.Recognizer.DETECTED, gesture.Recognizer.MOTION,
+ gesture.Recognizer.POSSIBLE]),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 30, 70,
+ [gesture.Recognizer.MOTION, gesture.Recognizer.UP]),
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 30, 30,
+ [gesture.Recognizer.END, gesture.Recognizer.POSSIBLE,
+ gesture.Recognizer.MOTION]),
+ ))
+
+ # Test abort in possible handler
+ for self.friction in (-1, 100):
+ if self.friction == -1:
+ sys.stderr.write(" Abort in possible handler, no inertia\n")
+ else:
+ sys.stderr.write(" Abort in possible handler, inertia\n")
+ dragRecognizer, self.messageTester = setupRecognizer(friction=self.friction,
+ minDragDist=5, possibleHandler=abort)
+ self.start(False,
+ (self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 30, 30,
+ [gesture.Recognizer.POSSIBLE]),
+ self._genMouseEventFrames(avg.Event.CURSOR_MOTION, 70, 70, []),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 70, 70, []),
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 30, 30,
+ [gesture.Recognizer.POSSIBLE]),
+ ))
+
+ player.setFakeFPS(-1)
+
+
+ def testDragRecognizerRelCoords(self):
+
+ def onDrag(offset):
+ self.assertAlmostEqual(offset, (-40,-40))
+ self.__onDragCalled = True
+
+ player.setFakeFPS(100)
+ self.__onDragCalled = False
+ for self.friction in (-1, 100):
+ root = self.loadEmptyScene()
+ div = avg.DivNode(pos=(64,64), angle=math.pi, parent=root)
+ image = avg.ImageNode(parent=div, href="rgb24-64x64.png")
+ dragRecognizer = gesture.DragRecognizer(image, moveHandler=onDrag,
+ friction=self.friction)
+ self.start(False,
+ (lambda: self._sendMouseEvent(avg.Event.CURSOR_DOWN, 30, 30),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_MOTION, 70, 70),
+ ))
+ player.setFakeFPS(-1)
+ assert(self.__onDragCalled)
+
+
+ def testDragRecognizerInitialEvent(self):
+
+ def onMotion(offset):
+ gesture.DragRecognizer(self.image,
+ detectedHandler=onDragStart, moveHandler=onDrag,
+ initialEvent=player.getCurrentEvent())
+ self.image.unsubscribe(avg.Node.CURSOR_MOTION, onMotion)
+
+ def onDragStart():
+ self.__dragStartCalled = True
+
+ def onDrag(offset):
+ self.assertEqual(offset, (10,0))
+
+ self.__initImageScene()
+ self.image.subscribe(avg.Node.CURSOR_MOTION, onMotion)
+ self.__dragStartCalled = False
+ self.start(False,
+ (lambda: self._sendMouseEvent(avg.Event.CURSOR_DOWN, 30, 30),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_MOTION, 40, 30),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_MOTION, 50, 30),
+ ))
+ assert(self.__dragStartCalled)
+
+
+ def testDragRecognizerCoordSysNode(self):
+
+ def onDrag(offset):
+ self.assertEqual(offset, (40,40))
+ self.__dragRecognizerCalled = True
+
+ root = self.loadEmptyScene()
+ div = avg.DivNode(pos=(64,64), angle=math.pi, parent=root)
+ image = avg.ImageNode(parent=div, href="rgb24-64x64.png")
+ dragRecognizer = gesture.DragRecognizer(image, moveHandler=onDrag,
+ coordSysNode=div, friction=-1)
+ self.__dragRecognizerCalled = False
+ self.start(False,
+ (lambda: self._sendMouseEvent(avg.Event.CURSOR_DOWN, 30, 30),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_MOTION, 70, 70),
+ ))
+ assert(self.__dragRecognizerCalled)
+
+
+ def testDragRecognizerCoordSysNodeParentUnlink(self):
+
+ def onDrag(offset):
+ self.assertEqual(offset, (40,40))
+ self.__dragRecognizerCalled = True
+
+ def onUp(offset):
+ self.__upRecognizerCalled = True
+
+ root = self.loadEmptyScene()
+ div = avg.DivNode(pos=(64,64), angle=math.pi, parent=root)
+ image = avg.ImageNode(parent=div, href="rgb24-64x64.png")
+ dragRecognizer = gesture.DragRecognizer(image, moveHandler=onDrag,
+ coordSysNode=div, friction=-1)
+ self.__dragRecognizerCalled = False
+ self.__upRecognizerCalled = False
+ self.start(False,
+ (lambda: self._sendMouseEvent(avg.Event.CURSOR_DOWN, 30, 30),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_MOTION, 70, 70),
+ lambda: div.unlink(False),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_UP, 70, 70),
+ ))
+ assert(self.__dragRecognizerCalled)
+ assert(not self.__upRecognizerCalled)
+
+
+ def testDragRecognizerMinDist(self):
+
+ def onMove(offset):
+ self.messageTester.setMessageReceived(gesture.Recognizer.MOTION)
+
+ self.__initImageScene()
+ dragRecognizer = gesture.DragRecognizer(self.image, moveHandler=onMove,
+ minDragDist=10, friction=-1)
+ self.messageTester = MessageTester(dragRecognizer, [gesture.Recognizer.DETECTED],
+ self)
+ self.start(False,
+ (lambda: self._sendMouseEvent(avg.Event.CURSOR_DOWN, 30, 30),
+ self._genMouseEventFrames(avg.Event.CURSOR_MOTION, 30, 35,
+ []),
+ self._genMouseEventFrames(avg.Event.CURSOR_MOTION, 30, 50,
+ [gesture.Recognizer.DETECTED, gesture.Recognizer.MOTION]),
+ ))
+
+
+ def testTransformRecognizer(self):
+
+ def onDetected():
+ pass
+
+ def onMove(transform):
+ self.transform = transform
+
+ def onUp(transform):
+ self.transform = transform
+
+ def checkTransform(expectedTransform):
+# print self.transform
+# print expectedTransform
+# print
+ self.assertAlmostEqual(self.transform.trans, expectedTransform.trans)
+ self.assertAlmostEqual(self.transform.rot, expectedTransform.rot)
+ self.assertAlmostEqual(self.transform.scale, expectedTransform.scale)
+ if expectedTransform.rot != 0 or expectedTransform.scale != 1:
+ self.assertAlmostEqual(self.transform.pivot, expectedTransform.pivot)
+
+ def createTransTestFrames():
+ return (
+ lambda: self._sendTouchEvent(1, avg.Event.CURSOR_DOWN, 10, 10),
+ lambda: self._sendTouchEvent(1, avg.Event.CURSOR_UP, 20, 10),
+ lambda: checkTransform(gesture.Transform((10,0))),
+ )
+
+ def createRotTestFrames(expectedTransform):
+ return (
+ lambda: self._sendTouchEvents((
+ (1, avg.Event.CURSOR_DOWN, 0, 10),
+ (2, avg.Event.CURSOR_DOWN, 0, 20))),
+ lambda: self._sendTouchEvents((
+ (1, avg.Event.CURSOR_MOTION, 0, 20),
+ (2, avg.Event.CURSOR_MOTION, 0, 10))),
+ lambda: checkTransform(expectedTransform),
+ lambda: self._sendTouchEvents((
+ (1, avg.Event.CURSOR_UP, 0, 20),
+ (2, avg.Event.CURSOR_UP, 0, 10))),
+ )
+
+ def createScaleTestFrames(expectedTransform):
+ return (
+ lambda: self._sendTouchEvent(1, avg.Event.CURSOR_DOWN, 0, 10),
+ lambda: self._sendTouchEvent(2, avg.Event.CURSOR_DOWN, 0, 20),
+ lambda: self._sendTouchEvent(1, avg.Event.CURSOR_MOTION, 0, 10),
+ lambda: self._sendTouchEvent(2, avg.Event.CURSOR_MOTION, 0, 30),
+ lambda: checkTransform(expectedTransform),
+ lambda: self._sendTouchEvent(1, avg.Event.CURSOR_UP, 0, 10),
+ lambda: self._sendTouchEvent(2, avg.Event.CURSOR_UP, 0, 30),
+ )
+
+ player.setFakeFPS(100)
+ self.__initImageScene()
+ # Turn off the jitter filter.
+ gesture.TransformRecognizer.FILTER_MIN_CUTOFF = None
+ gesture.TransformRecognizer.FILTER_BETA = None
+
+ self.__transformRecognizer = gesture.TransformRecognizer(self.image,
+ friction=-1,
+ detectedHandler=onDetected, moveHandler=onMove, upHandler=onUp)
+ self.start(False,
+ (# Check up/down handling
+ lambda: self._sendTouchEvent(1, avg.Event.CURSOR_DOWN, 10, 10),
+ lambda: checkTransform(gesture.Transform((0,0))),
+ lambda: self._sendTouchEvent(1, avg.Event.CURSOR_MOTION, 20, 10),
+ lambda: checkTransform(gesture.Transform((10,0))),
+ lambda: self._sendTouchEvent(2, avg.Event.CURSOR_DOWN, 20, 20),
+ lambda: checkTransform(gesture.Transform((0,0))),
+ lambda: self._sendTouchEvents((
+ (1, avg.Event.CURSOR_MOTION, 30, 10),
+ (2, avg.Event.CURSOR_MOTION, 30, 20))),
+ lambda: checkTransform(gesture.Transform((10,0))),
+ lambda: self._sendTouchEvent(2, avg.Event.CURSOR_UP, 30, 20),
+ lambda: checkTransform(gesture.Transform((0,0))),
+ lambda: self._sendTouchEvent(1, avg.Event.CURSOR_MOTION, 40, 10),
+ lambda: checkTransform(gesture.Transform((10,0))),
+ lambda: self._sendTouchEvent(1, avg.Event.CURSOR_UP, 50, 10),
+ lambda: checkTransform(gesture.Transform((10,0))),
+
+ createRotTestFrames(gesture.Transform((0,0), math.pi, 1, (0,15))),
+
+ createScaleTestFrames(gesture.Transform((0,5), 0, 2, (0,20))),
+
+ # Delete node during transform
+ lambda: self._sendTouchEvents((
+ (1, avg.Event.CURSOR_DOWN, 30, 10),
+ (2, avg.Event.CURSOR_DOWN, 30, 20))),
+ self.__killImageNode,
+ lambda: self._sendTouchEvents((
+ (1, avg.Event.CURSOR_UP, 30, 10),
+ (2, avg.Event.CURSOR_UP, 30, 20))),
+ ))
+
+ # Test rel. coords.
+ root = self.loadEmptyScene()
+ div = avg.DivNode(parent=root, pos=(0,10))
+ image = avg.ImageNode(parent=div, href="rgb24-64x64.png")
+ self.__transformRecognizer = gesture.TransformRecognizer(image, friction=-1,
+ detectedHandler=onDetected, moveHandler=onMove, upHandler=onUp)
+ self.start(False,
+ (createTransTestFrames(),
+ createRotTestFrames(gesture.Transform((0,0), math.pi, 1, (0,5))),
+ createScaleTestFrames(gesture.Transform((0,5), 0, 2, (0,10))),
+ ))
+
+ # Test coordSysNode.
+ root = self.loadEmptyScene()
+ div = avg.DivNode(parent=root, pos=(0,10))
+ image = avg.ImageNode(parent=div, href="rgb24-64x64.png")
+ self.__transformRecognizer = gesture.TransformRecognizer(image, coordSysNode=div,
+ friction=-1,
+ detectedHandler=onDetected, moveHandler=onMove, upHandler=onUp)
+ self.start(False,
+ (createTransTestFrames(),
+ createRotTestFrames(gesture.Transform((0,0), math.pi, 1, (0,15))),
+ createScaleTestFrames(gesture.Transform((0,5), 0, 2, (0,20))),
+ ))
+
+ # Test friction
+ root = self.loadEmptyScene()
+ div = avg.DivNode(parent=root, pos=(0,10))
+ image = avg.ImageNode(parent=div, href="rgb24-64x64.png")
+ self.__transformRecognizer = gesture.TransformRecognizer(image, friction=0.01,
+ detectedHandler=onDetected, moveHandler=onMove, upHandler=onUp)
+ self.start(False,
+ (lambda: self._sendTouchEvent(1, avg.Event.CURSOR_DOWN, 10, 10),
+ lambda: self._sendTouchEvent(1, avg.Event.CURSOR_UP, 20, 10),
+ lambda: self._sendTouchEvent(1, avg.Event.CURSOR_DOWN, 10, 10),
+ lambda: self._sendTouchEvent(1, avg.Event.CURSOR_UP, 20, 10),
+ ))
+
+ # Test abort
+ self.__initImageScene()
+ self.__transformRecognizer = gesture.TransformRecognizer(self.image,
+ detectedHandler=onDetected, moveHandler=onMove, upHandler=onUp)
+ self.start(False,
+ (self.__transformRecognizer.abort,
+ lambda: self._sendTouchEvent(1, avg.Event.CURSOR_DOWN, 10, 10),
+ self.__transformRecognizer.abort,
+ lambda: self._sendTouchEvent(1, avg.Event.CURSOR_MOTION, 20, 10),
+ lambda: self._sendTouchEvent(1, avg.Event.CURSOR_UP, 30, 10),
+ lambda: checkTransform(gesture.Transform((0,0))),
+ self.__transformRecognizer.abort,
+ ))
+
+ # Test enable/disable
+ self.__initImageScene()
+ self.__transformRecognizer = gesture.TransformRecognizer(self.image, friction=-1,
+ detectedHandler=onDetected, moveHandler=onMove, upHandler=onUp)
+ self.start(False,
+ (# Regular disable
+ lambda: self.__transformRecognizer.enable(False),
+ lambda: self._sendTouchEvent(1, avg.Event.CURSOR_DOWN, 10, 10),
+ lambda: self._sendTouchEvent(1, avg.Event.CURSOR_MOTION, 20, 10),
+ lambda: self._sendTouchEvent(1, avg.Event.CURSOR_UP, 30, 10),
+ lambda: checkTransform(gesture.Transform((0,0))),
+ # Re-enable
+ lambda: self.__transformRecognizer.enable(True),
+ lambda: self._sendTouchEvent(1, avg.Event.CURSOR_DOWN, 10, 10),
+ lambda: self._sendTouchEvent(1, avg.Event.CURSOR_UP, 20, 10),
+ lambda: checkTransform(gesture.Transform((10,0))),
+ # Disable during gesture
+ lambda: self._sendTouchEvent(1, avg.Event.CURSOR_DOWN, 10, 10),
+ lambda: self.__transformRecognizer.enable(False),
+ lambda: self._sendTouchEvent(1, avg.Event.CURSOR_UP, 20, 10),
+ lambda: checkTransform(gesture.Transform((0,0))),
+ lambda: self.__transformRecognizer.enable(True),
+ ))
+
+ # Test enable/disable, friction
+ def disableDuringEnd():
+ self.__transformRecognizer.enable(False)
+
+ self.__initImageScene()
+ self.__transformRecognizer = gesture.TransformRecognizer(self.image, friction=1,
+ detectedHandler=onDetected, moveHandler=onMove, upHandler=onUp)
+ self.start(False,
+ (# Disable during end event
+ lambda: self._sendTouchEvent(1, avg.Event.CURSOR_DOWN, 10, 10),
+ lambda: self.__transformRecognizer.subscribe(gesture.Recognizer.END,
+ disableDuringEnd),
+ lambda: self._sendTouchEvent(1, avg.Event.CURSOR_UP, 10, 10),
+ None,
+ ))
+
+ # Test second down during inertia.
+ self.__initImageScene()
+ self.__transformRecognizer = gesture.TransformRecognizer(self.image,
+ friction=0.01, detectedHandler=onDetected, moveHandler=onMove,
+ upHandler=onUp)
+ self.start(False,
+ (
+ lambda: self._sendTouchEvent(1, avg.Event.CURSOR_DOWN, 10, 10),
+ lambda: self._sendTouchEvent(1, avg.Event.CURSOR_UP, 30, 10),
+ lambda: self._sendTouchEvent(1, avg.Event.CURSOR_DOWN, 30, 10),
+ ))
+ player.setFakeFPS(-1)
+
+ def testKMeans(self):
+ pts = [avg.Point2D(0,0), avg.Point2D(0,1)]
+ means = gesture.calcKMeans(pts)
+ self.assertEqual(means, ([0], [1]))
+
+ pts.append (avg.Point2D(0,4))
+ means = gesture.calcKMeans(pts)
+ self.assertEqual(means, ([0,1], [2]))
+
+
+ def testMat3x3(self):
+ t = gesture.Mat3x3.translate([1,0,1])
+ v = [1,0,1]
+ self.assertEqual(t.applyVec(v), [2,0,1])
+ r = gesture.Mat3x3.rotate(math.pi/2)
+ self.assertAlmostEqual(r.applyVec(v), [0,1,1])
+ self.assertAlmostEqual(t.applyMat(t).m, gesture.Mat3x3.translate([2,0,1]).m)
+ self.assertAlmostEqual(t.applyMat(r).m, gesture.Mat3x3([0,-1,1],[1,0,0]).m)
+ self.assertAlmostEqual(r.applyMat(t).m, gesture.Mat3x3([0,-1,0],[1,0,1]).m)
+ self.assertAlmostEqual(gesture.Mat3x3().m, gesture.Mat3x3().inverse().m)
+ m = gesture.Mat3x3([-1, 3, -3],
+ [ 0, -6, 5],
+ [-5, -3, 1])
+ im = gesture.Mat3x3([3./2, 1., -1./2],
+ [-25./6, -8./3, 5./6],
+ [-5., -3., 1.])
+ self.assertAlmostEqual(m.inverse().m, im.m)
+
+ image = avg.ImageNode(pos=(10,20), size=(30,40), angle=1.57,
+ href="rgb24alpha-64x64.png")
+ mat = gesture.Mat3x3.fromNode(image)
+ mat.setNodeTransform(image)
+ self.assertAlmostEqual(image.pos, (10,20))
+ self.assertAlmostEqual(image.size, (30,40))
+ self.assertAlmostEqual(image.angle, 1.57)
+
+ def __initImageScene(self):
+ root = self.loadEmptyScene()
+ self.image = avg.ImageNode(parent=root, href="rgb24-64x64.png")
+
+ def __killImageNode(self):
+ self.image.unlink(True)
+ self.image = None
+
+
+def gestureTestSuite(tests):
+ availableTests = (
+ "testTapRecognizer",
+ "testHoldRecognizer",
+ "testDoubletapRecognizer",
+ "testSwipeRecognizer",
+ "testSwipeRecognizerTwoFingers",
+ "testDragRecognizer",
+ "testDragRecognizerRelCoords",
+ "testDragRecognizerInitialEvent",
+ "testDragRecognizerCoordSysNode",
+ "testDragRecognizerCoordSysNodeParentUnlink",
+ "testDragRecognizerMinDist",
+ "testTransformRecognizer",
+ "testKMeans",
+ "testMat3x3",
+ )
+
+ return createAVGTestSuite(availableTests, GestureTestCase, tests)
diff --git a/src/test/ImageTest.py b/src/test/ImageTest.py
index 5939656..f59d4ad 100644
--- a/src/test/ImageTest.py
+++ b/src/test/ImageTest.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# libavg - Media Playback Engine.
-# Copyright (C) 2003-2011 Ulrich von Zadow
+# 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
@@ -23,18 +23,16 @@
import shutil
-from libavg import avg
+from libavg import avg, player
from testcase import *
-g_IsMaskSupported = None
-
class ImageTestCase(AVGTestCase):
def __init__(self, testFuncName):
AVGTestCase.__init__(self, testFuncName)
def testImageHRef(self):
def createXmlNode(pos):
- node = Player.createNode(
+ node = player.createNode(
"""<image pos="%s" href="rgb24-32x32.png"/>"""%str(pos))
self.assertEqual(node.getMediaSize(), avg.Point2D(32, 32))
return node
@@ -46,7 +44,6 @@ class ImageTestCase(AVGTestCase):
return node
def addNodes(y):
-
xmlNode = createXmlNode((16, y))
root.appendChild(xmlNode)
@@ -68,29 +65,29 @@ class ImageTestCase(AVGTestCase):
if self._isCurrentDirWriteable():
# Can't check unicode filenames into svn or the windows client breaks.
# So we rename the file locally.
- shutil.copyfile("oe.png", u"ö.png")
+ shutil.copyfile("media/oe.png", u"media/ö.png")
node = createXmlNode((16, 16))
root.appendChild(node)
node.href = u"ö.png"
- os.remove(u"ö.png")
+ os.remove(u"media/ö.png")
def compareUnicode():
if self._isCurrentDirWriteable():
- self.compareImage("testImgHRef3", False)
+ self.compareImage("testImgHRef3")
root = self.loadEmptyScene()
addNodes(16)
- self.start((
- lambda: self.compareImage("testImgHRef1", False),
+ self.start(False,
+ (lambda: self.compareImage("testImgHRef1"),
lambda: addNodes(48),
- lambda: self.compareImage("testImgHRef2", False),
+ lambda: self.compareImage("testImgHRef2"),
setUnicodeHref,
compareUnicode
))
def testImagePos(self):
def createXmlNode(pos):
- return Player.createNode(
+ return player.createNode(
"""<image pos="%s" href="rgb24-32x32.png"/>"""%str(pos))
def createDictNode(root, p):
@@ -115,15 +112,15 @@ class ImageTestCase(AVGTestCase):
root = self.loadEmptyScene()
addNodes(16)
- self.start((
- lambda: self.compareImage("testImgPos1", False),
+ self.start(False,
+ (lambda: self.compareImage("testImgPos1"),
lambda: addNodes(48),
- lambda: self.compareImage("testImgPos2", False),
+ lambda: self.compareImage("testImgPos2"),
))
def testImageSize(self):
def createXmlNode(pos, size):
- return Player.createNode(
+ return player.createNode(
"""<image pos="%s" size="%s" href="rgb24-64x64.png"/>"""
%(str(pos), str(size)))
@@ -148,10 +145,10 @@ class ImageTestCase(AVGTestCase):
root = self.loadEmptyScene()
addNodes(16)
- self.start((
- lambda: self.compareImage("testImgSize1", False),
+ self.start(False,
+ (lambda: self.compareImage("testImgSize1"),
lambda: addNodes(48),
- lambda: self.compareImage("testImgSize2", False),
+ lambda: self.compareImage("testImgSize2"),
))
def testImageWarp(self):
@@ -171,15 +168,24 @@ class ImageTestCase(AVGTestCase):
node.unlink()
def addNode():
- node = createNode((16, 16))
- root.appendChild(node)
- moveVertex(node)
-
+ self.node = createNode((16, 16))
+ root.appendChild(self.node)
+ moveVertex(self.node)
+
+ def changeHref():
+ self.node.href = "rgb24-65x65.png"
+ grid = self.node.getWarpedVertexCoords()
+ self.assert_(len(grid) == 10)
+ self.assert_(len(grid[0]) == 6)
+
+
root = self.loadEmptyScene()
testEarlyAccessException()
- self.start((
- lambda: addNode(),
- lambda: self.compareImage("testImgWarp1", False),
+ self.start(False,
+ (lambda: addNode(),
+ lambda: self.compareImage("testImgWarp1"),
+ lambda: changeHref(),
+ lambda: self.compareImage("testImgWarp2"),
))
def testBitmap(self):
@@ -193,35 +199,57 @@ class ImageTestCase(AVGTestCase):
def loadFromBitmap(p, orighref):
node = avg.ImageNode(pos=p, size=(32, 32), href=orighref)
- bmp = avg.Bitmap('rgb24-65x65.png')
+ bmp = avg.Bitmap('media/rgb24-65x65.png')
self.assertEqual(bmp.getSize(), (65,65))
node.setBitmap(bmp)
self.assertEqual(node.getMediaSize(), (65,65))
root.appendChild(node)
def testStringConversion():
- bmp = avg.Bitmap('rgb24-65x65.png')
+ bmp = avg.Bitmap('media/rgb24-65x65.png')
s = bmp.getPixels()
- bmp1 = avg.Bitmap(bmp.getSize(), avg.B8G8R8X8, "sample")
+ bmp1 = avg.Bitmap(bmp.getSize(), bmp.getFormat(), "sample")
bmp1.setPixels(s)
self.assert_(self.areSimilarBmps(bmp, bmp1, 0.01, 0.01))
+ def testCropRect():
+ bmp = avg.Bitmap('media/rgb24-65x65.png')
+ bmp1 = avg.Bitmap(bmp, (32,32), (64,64))
+ self.assert_(bmp1.getSize() == (32,32))
+ node = avg.ImageNode(pos=(96,0), parent=root)
+ node.setBitmap(bmp1)
+
+ def testBlt():
+ srcBmp = avg.Bitmap('media/rgb24-65x65.png')
+ destBmp = avg.Bitmap((65,65), srcBmp.getFormat(), "bmp")
+ destBmp.blt(srcBmp, (0,0))
+ destBmp.blt(srcBmp, (32,32))
+ node = avg.ImageNode(pos=(96,32), size=(32,32), parent=root)
+ node.setBitmap(destBmp)
+
+ def testResize():
+ srcBmp = avg.Bitmap('media/rgb24-32x32.png')
+ destBmp = srcBmp.getResized((64,64))
+ self.assert_(destBmp.getSize() == (64,64))
+ node = avg.ImageNode(pos=(128,0), size=(32,32), parent=root)
+ node.setBitmap(destBmp)
+
def testUnicode():
if self._isCurrentDirWriteable():
# Can't check unicode filenames into svn or the windows client breaks.
# So we rename the file locally.
- shutil.copyfile("oe.png", u"ö.png")
- bmp = avg.Bitmap(u"ö.png")
- os.remove(u"ö.png")
+ shutil.copyfile("media/oe.png", u"media/ö.png")
+ avg.Bitmap(u"media/ö.png")
+ os.remove(u"media/ö.png")
def testGetPixel():
- bmp = avg.Bitmap('rgb24-65x65.png')
+ bmp = avg.Bitmap('media/rgb24-65x65.png')
self.assertEqual(bmp.getPixel((1,1)), (255,0,0,255))
self.assertEqual(bmp.getPixel((33,1)), (0,255,0,255))
- bmp = avg.Bitmap('rgb24alpha-64x64.png')
+ bmp = avg.Bitmap('media/rgb24alpha-64x64.png')
self.assertEqual(bmp.getPixel((1,1)), (0,0,0,0))
self.assertEqual(bmp.getPixel((63,1)), (83,255,83,142))
- bmp = avg.Bitmap('greyscale.png')
+ bmp = avg.Bitmap('media/greyscale.png')
self.assertEqual(bmp.getPixel((1,1)), (255,255,255,255))
self.assertEqual(bmp.getPixel((1,63)), (0,0,0,255))
self.assertException(lambda: bmp.getPixel((64,0)))
@@ -229,7 +257,13 @@ class ImageTestCase(AVGTestCase):
def setNullBitmap():
node.setBitmap(None)
- node = avg.ImageNode(href="rgb24-65x65.png", size=(32, 32))
+ def testSubBitmap():
+ srcBmp = avg.Bitmap('media/rgb24-32x32.png')
+ destBmp = avg.Bitmap(srcBmp, (16,16), (32,32))
+ self.assertEqual(srcBmp.getPixel((16,16)), destBmp.getPixel((0,0)))
+ self.assertException(lambda: avg.Bitmap(srcBmp, (16,16), (16,32)))
+
+ node = avg.ImageNode(href="media/rgb24-65x65.png", size=(32, 32))
getBitmap(node)
root = self.loadEmptyScene()
@@ -241,13 +275,20 @@ class ImageTestCase(AVGTestCase):
loadFromBitmap((64,0), "rgb24alpha-64x64.png")
testStringConversion()
testUnicode()
- self.start((
- lambda: getBitmap(node),
+ self.start(False,
+ (lambda: getBitmap(node),
lambda: loadFromBitmap((32,32), ""),
lambda: loadFromBitmap((64,32), "rgb24alpha-64x64.png"),
- lambda: self.compareImage("testBitmap1", False),
+ lambda: self.compareImage("testBitmap1"),
+ testCropRect,
+ lambda: self.compareImage("testBitmap2"),
+ testBlt,
+ lambda: self.compareImage("testBitmap3"),
+ testResize,
+ lambda: self.compareImage("testBitmap4"),
testGetPixel,
- lambda: self.assertException(setNullBitmap)
+ lambda: self.assertException(setNullBitmap),
+ testSubBitmap,
))
def testBitmapManager(self):
@@ -262,17 +303,27 @@ class ImageTestCase(AVGTestCase):
def loadValidBitmap():
def validBitmapCb(bitmap):
self.assert_(not isinstance(bitmap, Exception))
- Player.setTimeout(0, loadUnexistentBitmap)
+ player.setTimeout(0, loadBitmapWithPixelFormat)
+
+ avg.BitmapManager.get().loadBitmap("media/rgb24alpha-64x64.png",
+ validBitmapCb)
+
+ def loadBitmapWithPixelFormat():
+ def validBitmapCb(bitmap):
+ self.assert_(not isinstance(bitmap, Exception))
+ self.assert_(bitmap.getFormat() == avg.B5G6R5)
+ player.setTimeout(0, loadUnexistentBitmap)
- avg.BitmapManager.get().loadBitmap("rgb24alpha-64x64.png", validBitmapCb)
+ avg.BitmapManager.get().loadBitmap("media/rgb24alpha-64x64.png",
+ validBitmapCb, avg.B5G6R5)
def loadUnexistentBitmap():
avg.BitmapManager.get().loadBitmap("nonexistent.png",
lambda bmp: expectException(
returnValue=bmp,
- nextAction=lambda: Player.setTimeout(0, loadBrokenImage)))
+ nextAction=lambda: player.setTimeout(0, loadBrokenBitmap)))
- def loadBrokenImage():
+ def loadBrokenBitmap():
import tempfile
tempFileName = os.path.join(tempfile.gettempdir(),
"broken.png")
@@ -280,27 +331,55 @@ class ImageTestCase(AVGTestCase):
def cleanupAndTestReturnValue(returnValue):
os.unlink(tempFileName)
- expectException(returnValue=returnValue, nextAction=Player.stop)
+ expectException(returnValue=returnValue, nextAction=player.stop)
avg.BitmapManager.get().loadBitmap(tempFileName,
cleanupAndTestReturnValue)
-
+
def reportStuck():
raise RuntimeError("BitmapManager didn't reply "
"within %dms timeout" % WAIT_TIMEOUT)
- Player.stop()
+ player.stop()
- root = self.loadEmptyScene()
-
- Player.setTimeout(WAIT_TIMEOUT, reportStuck)
- Player.setResolution(0, 0, 0, 0)
- loadValidBitmap()
- Player.play()
+ for multithread in [False, True]:
+ self.loadEmptyScene()
+ if multithread:
+ avg.BitmapManager.get().setNumThreads(2)
+ player.setTimeout(WAIT_TIMEOUT, reportStuck)
+ player.setResolution(0, 0, 0, 0)
+ loadValidBitmap()
+ player.play()
+ avg.BitmapManager.get().setNumThreads(1)
+ def testBitmapManagerException(self):
+ def bitmapCb(bitmap):
+ raise RuntimeError
+
+ self.loadEmptyScene()
+ avg.BitmapManager.get().loadBitmap("rgb24alpha-64x64.png", bitmapCb),
+ self.assertException(player.play)
+
def testBlendMode(self):
+ def isBlendMinMaxSupported():
+ def tryInsertNode():
+ try:
+ avg.ImageNode(href="rgb24-65x65.png", blendmode="min", parent=root)
+ except RuntimeError:
+ self.supported = False
+ root = self.loadEmptyScene()
+ self.supported = True
+ self.start(False,
+ (tryInsertNode,
+ ))
+ return self.supported
+
+
def setBlendMode():
blendNode.blendmode="add"
+ if not(isBlendMinMaxSupported()):
+ self.skip("Blend modes min and max not supported.")
+ return
root = self.loadEmptyScene()
avg.ImageNode(href="freidrehen.jpg", parent=root)
blendNode = avg.ImageNode(opacity=0.6, href="rgb24-65x65.png", parent=root)
@@ -311,10 +390,10 @@ class ImageTestCase(AVGTestCase):
avg.ImageNode(pos=(48,48), opacity=1, href="rgb24-65x65.png", blendmode="max",
parent=root)
- self.start((
- lambda: self.compareImage("testBlend1", False),
+ self.start(False,
+ (lambda: self.compareImage("testBlend1"),
setBlendMode,
- lambda: self.compareImage("testBlend2", False)
+ lambda: self.compareImage("testBlend2")
))
def testImageMask(self):
@@ -342,34 +421,31 @@ class ImageTestCase(AVGTestCase):
def setMaskNotFound():
node.maskhref = "nonexistentmask.png"
- if not(self._hasShaderSupport()):
- return
root = self.loadEmptyScene()
createNode((0,0))
node = root.getChild(0)
setNoAttach((32,0))
setAttach((64,0))
- self.start((
- lambda: createNode((0, 32)),
+ self.start(False,
+ (lambda: createNode((0, 32)),
lambda: setNoAttach((32,32)),
lambda: setAttach((64,32)),
- lambda: self.compareImage("testImgMask1", False),
+ lambda: self.compareImage("testImgMask1"),
changeHRef,
- lambda: self.compareImage("testImgMask2", False),
+ lambda: self.compareImage("testImgMask2"),
changeBaseHRef,
- lambda: self.compareImage("testImgMask3", False),
+ lambda: self.compareImage("testImgMask3"),
setMaskNotFound
))
def testImageMaskCanvas(self):
- if not(self._hasShaderSupport()):
- return
root = self.loadEmptyScene()
- canvas = Player.createCanvas(id="testcanvas", size=(64,64))
+ canvas = player.createCanvas(id="testcanvas", size=(64,64), mediadir="media")
avg.ImageNode(href="rgb24-64x64.png", parent=canvas.getRootNode())
avg.RectNode(size=(160,120), fillcolor="FFFFFF", fillopacity=1, parent=root)
- node = avg.ImageNode(href="canvas:testcanvas", maskhref="mask.png", parent=root)
- self.start([lambda: self.compareImage("testImgMaskCanvas", False)])
+ avg.ImageNode(href="canvas:testcanvas", maskhref="mask.png", parent=root)
+ self.start(False,
+ (lambda: self.compareImage("testImgMaskCanvas"),))
def testImageMaskPos(self):
def createNode(p):
@@ -390,16 +466,14 @@ class ImageTestCase(AVGTestCase):
node.maskpos = (32, 32)
root = self.loadEmptyScene()
- if not(self._hasShaderSupport()):
- return
createNode((0,0))
setNoAttach((32,0))
setAttach((64,0))
- self.start((
- lambda: createNode((0, 32)),
+ self.start(False,
+ (lambda: createNode((0, 32)),
lambda: setNoAttach((32,32)),
lambda: setAttach((64,32)),
- lambda: self.compareImage("testImgMaskPos", False)
+ lambda: self.compareImage("testImgMaskPos")
))
def testImageMaskSize(self):
@@ -426,33 +500,30 @@ class ImageTestCase(AVGTestCase):
node.masksize = (0, 0)
root = self.loadEmptyScene()
- if not(self._hasShaderSupport()):
- return
createNode((0,0))
node = root.getChild(0)
setNoAttach((32,0))
setAttach((64,0))
- self.start((
- lambda: createNode((0, 32)),
+ self.start(False,
+ (lambda: createNode((0, 32)),
lambda: setNoAttach((32,32)),
lambda: setAttach((64,32)),
- lambda: self.compareImage("testImgMaskSize1", False),
+ lambda: self.compareImage("testImgMaskSize1"),
setPos,
- lambda: self.compareImage("testImgMaskSize2", False),
+ lambda: self.compareImage("testImgMaskSize2"),
resetPos,
- lambda: self.compareImage("testImgMaskSize3", False)
+ lambda: self.compareImage("testImgMaskSize3")
))
def testImageMipmap(self):
root = self.loadEmptyScene()
- avg.ImageNode(size=(64,64), href="checker.png", parent=root)
- avg.ImageNode(pos=(64,0), size=(64,64), href="checker.png", mipmap=True,
- parent=root)
- self.start([lambda: self.compareImage("testMipmap", False)])
+ avg.ImageNode(size=(64,64), href="checker.png", mipmap=True, parent=root)
+ self.start(False,
+ (lambda: self.compareImage("testMipmap"),))
def testImageCompression(self):
def loadBitmap():
- bmp = avg.Bitmap("colorramp.png")
+ bmp = avg.Bitmap("media/colorramp.png")
self.image.setBitmap(bmp)
def relink():
@@ -466,15 +537,30 @@ class ImageTestCase(AVGTestCase):
self.image = avg.ImageNode(href="rgb24-64x64.png", compression="B5G6R5",
parent=root)
self.assertEqual(self.image.compression, "B5G6R5")
- self.start([
- lambda: self.compareImage("testTexCompression1", False),
+ self.start(False,
+ [lambda: self.compareImage("testTexCompression1"),
loadBitmap,
- lambda: self.compareImage("testTexCompression2", False),
+ lambda: self.compareImage("testTexCompression2"),
relink,
- lambda: self.compareImage("testTexCompression2", False),
+ lambda: self.compareImage("testTexCompression2"),
checkAlpha,
])
+ def testSpline(self):
+ spline = avg.CubicSpline([(0,3),(1,2),(2,1),(3,0)])
+ self.assertAlmostEqual(spline.interpolate(0), 3)
+ self.assertAlmostEqual(spline.interpolate(0.5), 2.5)
+ self.assertAlmostEqual(spline.interpolate(1), 2)
+ self.assertAlmostEqual(spline.interpolate(-1), 4)
+ self.assertAlmostEqual(spline.interpolate(4), -1)
+
+ spline = avg.CubicSpline([(2,0),(4,1),(6,3),(8,6)])
+ self.assertAlmostEqual(spline.interpolate(2), 0)
+ self.assert_(spline.interpolate(3) < 0.5)
+ self.assert_(spline.interpolate(3) > 0.0)
+ self.assert_(spline.interpolate(7) < 4.5)
+ self.assert_(spline.interpolate(7) > 4)
+
def imageTestSuite(tests):
availableTests = (
@@ -484,6 +570,7 @@ def imageTestSuite(tests):
"testImageWarp",
"testBitmap",
"testBitmapManager",
+ "testBitmapManagerException",
"testBlendMode",
"testImageMask",
"testImageMaskCanvas",
@@ -491,8 +578,6 @@ def imageTestSuite(tests):
"testImageMaskSize",
"testImageMipmap",
"testImageCompression",
+ "testSpline",
)
return createAVGTestSuite(availableTests, ImageTestCase, tests)
-
-Player = avg.Player.get()
-
diff --git a/src/test/InputDeviceTest.py b/src/test/InputDeviceTest.py
index f0bb935..c6350cb 100644
--- a/src/test/InputDeviceTest.py
+++ b/src/test/InputDeviceTest.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# libavg - Media Playback Engine.
-# Copyright (C) 2003-2011 Ulrich von Zadow
+# 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
@@ -19,12 +19,19 @@
# Current versions can be found at www.libavg.de
#
-import unittest
-
-from libavg import avg
+from libavg import avg, player
from testcase import *
+class CustomMouseEvent(avg.TouchEvent):
+ def __init__(self, eventId, eventType, pos, source):
+ super(CustomMouseEvent, self).__init__(eventId, eventType, pos, source)
+ self.customAttribute = None
+
+ def customMethod(self):
+ pass
+
+
class CustomInputDevice(avg.InputDevice):
def __init__(self, eventReceiverNode=None):
if eventReceiverNode:
@@ -57,7 +64,7 @@ class AnonymousInputDevice(avg.InputDevice):
def pollEvents(self):
if self.__isInitialized: return []
self.__isInitialized = True
- return [ avg.Event(avg.CUSTOMEVENT, avg.CUSTOM) ]
+ return [ avg.Event(avg.Event.CUSTOM_EVENT, avg.Event.CUSTOM) ]
class EventTestCase(AVGTestCase):
@@ -69,13 +76,20 @@ class EventTestCase(AVGTestCase):
class DerivedEvent(avg.Event):
def __init__(self):
- super(DerivedEvent, self).__init__(avg.CUSTOMEVENT, avg.NONE)
+ super(DerivedEvent, self).__init__(avg.Event.CUSTOM_EVENT, avg.Event.NONE)
self.property = True
+ class CustomMouseEvent(avg.TouchEvent):
+ def __init__(self):
+ super(CustomMouseEvent, self).__init__(42, avg.Event.CURSOR_DOWN,
+ (10, 10), avg.Event.TOUCH)
+ self.customAttribute = None
+
self.hasEventHandlerBeenCalled = False
self.isCustomInputDeviceSet = False
self.isCustomInputDeviceNameSet = False
self.hasCustomEventProperty = False
+ self.customMouseEventHandlerCalled = False
def eventHandler(event):
self.hasEventHandlerBeenCalled = True
@@ -85,7 +99,11 @@ class EventTestCase(AVGTestCase):
def customEventEventHandler(event):
self.hasCustomEventProperty = event.property
-
+
+ def customMouseEventHandler(event):
+ self.customMouseEventHandlerCalled = True
+ self.assert_(hasattr(event, "customAttribute"))
+
def checkAndResetResults():
if not self.hasEventHandlerBeenCalled: return False
if not self.isCustomInputDeviceSet: return False
@@ -97,17 +115,18 @@ class EventTestCase(AVGTestCase):
return True
rectNode = avg.RectNode(parent=root, pos=(0, 0), size=(50, 50))
- rectNode.setEventHandler(avg.CURSORDOWN, avg.MOUSE|avg.TOUCH, eventHandler)
+ rectNode.subscribe(avg.Node.CURSOR_DOWN, eventHandler)
- root.setEventHandler(avg.CURSORDOWN, avg.NONE, eventHandler)
- root.setEventHandler(avg.CUSTOMEVENT, avg.NONE, customEventEventHandler)
+ root.subscribe(avg.Node.CURSOR_DOWN, eventHandler)
+ root.setEventHandler(avg.Event.CUSTOM_EVENT, avg.Event.NONE,
+ customEventEventHandler)
self.customInputDevice = CustomInputDevice()
- Player.addInputDevice(self.customInputDevice)
+ player.addInputDevice(self.customInputDevice)
- self.start((
- lambda: self.customInputDevice.feedEvent(
- avg.Event(avg.CURSORDOWN, avg.NONE)),
+ self.start(False,
+ (lambda: self.customInputDevice.feedEvent(
+ avg.Event(avg.Event.CURSOR_DOWN, avg.Event.MOUSE)),
lambda: self.assert_(checkAndResetResults()),
lambda: self.customInputDevice.feedEvent(
@@ -115,14 +134,20 @@ class EventTestCase(AVGTestCase):
lambda: self.assert_(self.hasCustomEventProperty),
lambda: self.customInputDevice.feedEvent(
- avg.MouseEvent(avg.CURSORDOWN, False, False, False, (5, 5), 0)),
+ avg.MouseEvent(avg.Event.CURSOR_DOWN, False, False, False,
+ (5, 5), 0)),
lambda: self.assert_(checkAndResetResults()),
lambda: self.customInputDevice.feedEvent(
- avg.TouchEvent(300, avg.CURSORDOWN, (5, 5), avg.TOUCH, (10,10))),
- lambda: self.assert_(checkAndResetResults())
- ))
-
+ avg.TouchEvent(300, avg.Event.CURSOR_DOWN, (5, 5),
+ avg.Event.TOUCH, (10,10))),
+ lambda: self.assert_(checkAndResetResults()),
+
+ lambda: root.subscribe(avg.Node.CURSOR_DOWN, customMouseEventHandler),
+ lambda: self.customInputDevice.feedEvent(CustomMouseEvent()),
+ lambda: self.assert_(self.customMouseEventHandlerCalled),
+ ))
+
def testAnonymousInputDevice(self):
root = self.loadEmptyScene()
@@ -139,14 +164,14 @@ class EventTestCase(AVGTestCase):
self.hasEventHandlerBeenCalled = False
return True
- root.setEventHandler(avg.CUSTOMEVENT, avg.CUSTOM, eventHandler)
- Player.addInputDevice(AnonymousInputDevice())
+ root.setEventHandler(avg.Event.CUSTOM_EVENT, avg.Event.CUSTOM, eventHandler)
+ player.addInputDevice(AnonymousInputDevice())
- self.start((
- lambda: None,
+ self.start(False,
+ (lambda: None,
lambda: None,
lambda: self.assert_(checkAndResetResults())
- ))
+ ))
def testInputDeviceEventReceiverNode(self):
root = self.loadEmptyScene()
@@ -155,36 +180,33 @@ class EventTestCase(AVGTestCase):
rectNode = avg.RectNode(id="rect", size=(50, 50), parent=root)
self.customInputDevice = CustomInputDevice(divNode)
- Player.addInputDevice(self.customInputDevice)
+ player.addInputDevice(self.customInputDevice)
handlerTester = NodeHandlerTester(self, divNode)
- self.start((
- lambda: self.customInputDevice.feedEvent(
- avg.MouseEvent(avg.CURSORDOWN, True, False, False, (10, 10), 1)),
+ self.start(False,
+ (lambda: self.customInputDevice.feedEvent(
+ avg.MouseEvent(avg.Event.CURSOR_DOWN, True, False, False,
+ (10, 10), 1)),
lambda: handlerTester.assertState(
- down=True, up=False, over=True, out=False, move=False),
+ (avg.Node.CURSOR_DOWN, avg.Node.CURSOR_OVER)),
lambda: self.customInputDevice.feedEvent(avg.MouseEvent(
- avg.CURSORMOTION, True, False, False, (12, 12), 1)),
- lambda: handlerTester.assertState(
- down=False, up=False, over=False, out=False, move=True),
+ avg.Event.CURSOR_MOTION, True, False, False, (12, 12), 1)),
+ lambda: handlerTester.assertState((avg.Node.CURSOR_MOTION,)),
lambda: self.customInputDevice.feedEvent(avg.MouseEvent(
- avg.CURSORMOTION, True, False, False, (100, 100), 1)),
- lambda: handlerTester.assertState(
- down=False, up=False, over=False, out=True, move=False),
+ avg.Event.CURSOR_MOTION, True, False, False, (100, 100), 1)),
+ lambda: handlerTester.assertState((avg.Node.CURSOR_OUT,)),
lambda: self.customInputDevice.feedEvent(avg.MouseEvent(
- avg.CURSORMOTION, True, False, False, (12, 12), 1)),
+ avg.Event.CURSOR_MOTION, True, False, False, (12, 12), 1)),
lambda: handlerTester.assertState(
- down=False, up=False, over=True, out=False, move=True),
+ (avg.Node.CURSOR_OVER, avg.Node.CURSOR_MOTION)),
lambda: self.customInputDevice.feedEvent(avg.MouseEvent(
- avg.CURSORUP, False, False, False, (12, 12), 1)),
- lambda: handlerTester.assertState(
- down=False, up=True, over=False, out=False, move=False)
-
+ avg.Event.CURSOR_UP, False, False, False, (12, 12), 1)),
+ lambda: handlerTester.assertState((avg.Node.CURSOR_UP,)),
))
def inputDeviceTestSuite(tests):
@@ -194,6 +216,3 @@ def inputDeviceTestSuite(tests):
"testInputDeviceEventReceiverNode"
)
return createAVGTestSuite(availableTests, EventTestCase, tests)
-
-Player = avg.Player.get()
-Helper = Player.getTestHelper()
diff --git a/src/test/LoggerTest.py b/src/test/LoggerTest.py
new file mode 100644
index 0000000..9848dcd
--- /dev/null
+++ b/src/test/LoggerTest.py
@@ -0,0 +1,96 @@
+# -*- 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
+#
+
+import StringIO
+import logging
+
+from libavg import logger
+
+from testcase import *
+
+
+class LoggerTestCase(AVGTestCase):
+ def __init__(self, testFuncName):
+ AVGTestCase.__init__(self, testFuncName)
+ self.testMsg = u'ç¦ means good fortune'
+
+ def setUp(self):
+ self.stream = StringIO.StringIO()
+ self.hdlr = logging.StreamHandler(self.stream)
+ self.pyLogger = logging.getLogger(__name__)
+ self.pyLogger.addHandler(self.hdlr)
+ self.pyLogger.propagate = False
+ self.pyLogger.level = logging.DEBUG
+ logger.addSink(self.pyLogger)
+ logger.removeStdLogSink()
+
+ def tearDown(self):
+ self.pyLogger.removeHandler(self.hdlr)
+
+ def _assertMsg(self):
+ self.stream.flush()
+ self.assert_(self.stream.getvalue().decode('utf8').find(self.testMsg) != -1)
+ self.stream.close()
+
+ def _assertNoMsg(self):
+ self.stream.flush()
+ self.assert_(self.stream.getvalue().decode('utf8').find(self.testMsg) == -1)
+ self.stream.close()
+
+ def testRemoveSink(self):
+ logger.removeSink(self.pyLogger)
+ logger.info(self.testMsg)
+ self._assertNoMsg()
+
+ def testConfigureCategory(self):
+ snowmanCategory = logger.configureCategory(u'☃ Category')
+ logger.warning(self.testMsg, snowmanCategory)
+ self._assertMsg()
+
+ def testReconfigureCategory(self):
+ snowmanCategory = logger.configureCategory(u'☃ Category', logger.Severity.INFO)
+ logger.info(self.testMsg, snowmanCategory)
+ self._assertMsg()
+
+ def testOmitCategory(self):
+ logger.configureCategory(logger.Category.APP, logger.Severity.CRIT)
+ logger.info(self.testMsg)
+ self._assertNoMsg()
+
+ def testLogCategory(self):
+ logger.configureCategory(logger.Category.APP, logger.Severity.INFO)
+ logger.info(self.testMsg)
+ self._assertMsg()
+
+ def testUnknownCategoryWarning(self):
+ self.assertException(lambda: logger.error("Foo", "Bar"))
+
+
+def loggerTestSuite(tests):
+ availableTests = (
+ "testRemoveSink",
+ "testConfigureCategory",
+ "testReconfigureCategory",
+ "testOmitCategory",
+ "testLogCategory",
+ "testUnknownCategoryWarning",
+ )
+ return createAVGTestSuite(availableTests, LoggerTestCase, tests)
diff --git a/src/test/Makefile.am b/src/test/Makefile.am
index 215ce67..27b0e90 100644
--- a/src/test/Makefile.am
+++ b/src/test/Makefile.am
@@ -3,7 +3,7 @@ SUBDIRS = plugin
pkgpyexec_PYTHON = testcase.py testapp.py
EXTRA_DIST = $(wildcard *.avg) $(wildcard *.png) $(wildcard *.jpg) $(wildcard *.tif) \
- $(wildcard *.py) $(wildcard baseline/*.png) $(wildcard testmediadir/*) \
- $(wildcard extrafonts) $(wildcard fonts) $(wildcard *.svg)
+ $(wildcard *.py) $(wildcard baseline/*.png) $(wildcard testmediadir/*) \
+ $(wildcard extrafonts) $(wildcard fonts) $(wildcard *.svg) $(wildcard media/*)
-TESTS= Test.py
+TESTS = Test.py
diff --git a/src/test/Makefile.in b/src/test/Makefile.in
index 550dc45..321e19d 100644
--- a/src/test/Makefile.in
+++ b/src/test/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# Makefile.in generated by automake 1.11.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
-# Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -41,22 +41,23 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ac_cxx_namespaces.m4 \
$(top_srcdir)/m4/ac_path_generic.m4 \
$(top_srcdir)/m4/ax_boost_thread.m4 \
- $(top_srcdir)/m4/ax_check_gl.m4 $(top_srcdir)/m4/libtool.m4 \
- $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
- $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
- $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/m4/python_dev.m4 \
- $(top_srcdir)/configure.in
+ $(top_srcdir)/m4/ax_check_gl.m4 \
+ $(top_srcdir)/m4/ax_python_devel.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/pkg.m4 \
+ $(top_srcdir)/m4/avg_version.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/src/avgconfig.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
-AM_V_GEN = $(am__v_GEN_$(V))
-am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
-AM_V_at = $(am__v_at_$(V))
-am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
SOURCES =
DIST_SOURCES =
@@ -88,6 +89,13 @@ am__nobase_list = $(am__nobase_strip_setup); \
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
+am__py_compile = PYTHON=$(PYTHON) $(SHELL) $(py_compile)
am__installdirs = "$(DESTDIR)$(pkgpyexecdir)"
py_compile = $(top_srcdir)/py-compile
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
@@ -135,7 +143,7 @@ AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BOOST_PYTHON_LIBS = @BOOST_PYTHON_LIBS@
-BOOST_THREAD_LIB = @BOOST_THREAD_LIB@
+BOOST_THREAD_LIBS = @BOOST_THREAD_LIBS@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
@@ -150,6 +158,7 @@ DC1394_2_CFLAGS = @DC1394_2_CFLAGS@
DC1394_2_LIBS = @DC1394_2_LIBS@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
@@ -190,6 +199,7 @@ LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
MTDEV_CFLAGS = @MTDEV_CFLAGS@
MTDEV_LIBS = @MTDEV_LIBS@
@@ -219,11 +229,13 @@ PTHREAD_CC = @PTHREAD_CC@
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
PTHREAD_LIBS = @PTHREAD_LIBS@
PYTHON = @PYTHON@
+PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@
PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
-PYTHON_INCLUDES = @PYTHON_INCLUDES@
-PYTHON_LIBS = @PYTHON_LIBS@
+PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@
+PYTHON_LDFLAGS = @PYTHON_LDFLAGS@
PYTHON_PLATFORM = @PYTHON_PLATFORM@
PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_SITE_PKG = @PYTHON_SITE_PKG@
PYTHON_VERSION = @PYTHON_VERSION@
RANLIB = @RANLIB@
SDL_CFLAGS = @SDL_CFLAGS@
@@ -246,6 +258,7 @@ abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
@@ -280,7 +293,6 @@ libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
@@ -307,8 +319,8 @@ top_srcdir = @top_srcdir@
SUBDIRS = plugin
pkgpyexec_PYTHON = testcase.py testapp.py
EXTRA_DIST = $(wildcard *.avg) $(wildcard *.png) $(wildcard *.jpg) $(wildcard *.tif) \
- $(wildcard *.py) $(wildcard baseline/*.png) $(wildcard testmediadir/*) \
- $(wildcard extrafonts) $(wildcard fonts) $(wildcard *.svg)
+ $(wildcard *.py) $(wildcard baseline/*.png) $(wildcard testmediadir/*) \
+ $(wildcard extrafonts) $(wildcard fonts) $(wildcard *.svg) $(wildcard media/*)
TESTS = Test.py
all: all-recursive
@@ -368,11 +380,8 @@ install-pkgpyexecPYTHON: $(pkgpyexec_PYTHON)
$(INSTALL_DATA) $$files "$(DESTDIR)$(pkgpyexecdir)" || exit $$?; \
done || exit $$?; \
if test -n "$$dlist"; then \
- if test -z "$(DESTDIR)"; then \
- PYTHON=$(PYTHON) $(py_compile) --basedir "$(pkgpyexecdir)" $$dlist; \
- else \
- PYTHON=$(PYTHON) $(py_compile) --destdir "$(DESTDIR)" --basedir "$(pkgpyexecdir)" $$dlist; \
- fi; \
+ $(am__py_compile) --destdir "$(DESTDIR)" \
+ --basedir "$(pkgpyexecdir)" $$dlist; \
else :; fi
uninstall-pkgpyexecPYTHON:
@@ -380,14 +389,14 @@ uninstall-pkgpyexecPYTHON:
@list='$(pkgpyexec_PYTHON)'; test -n "$(pkgpyexecdir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
test -n "$$files" || exit 0; \
+ dir='$(DESTDIR)$(pkgpyexecdir)'; \
filesc=`echo "$$files" | sed 's|$$|c|'`; \
fileso=`echo "$$files" | sed 's|$$|o|'`; \
- echo " ( cd '$(DESTDIR)$(pkgpyexecdir)' && rm -f" $$files ")"; \
- cd "$(DESTDIR)$(pkgpyexecdir)" && rm -f $$files || exit $$?; \
- echo " ( cd '$(DESTDIR)$(pkgpyexecdir)' && rm -f" $$filesc ")"; \
- cd "$(DESTDIR)$(pkgpyexecdir)" && rm -f $$filesc || exit $$?; \
- echo " ( cd '$(DESTDIR)$(pkgpyexecdir)' && rm -f" $$fileso ")"; \
- cd "$(DESTDIR)$(pkgpyexecdir)" && rm -f $$fileso
+ st=0; \
+ for files in "$$files" "$$filesc" "$$fileso"; do \
+ $(am__uninstall_files_from_dir) || st=$$?; \
+ done; \
+ exit $$st
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
@@ -605,14 +614,15 @@ check-TESTS: $(TESTS)
fi; \
dashes=`echo "$$dashes" | sed s/./=/g`; \
if test "$$failed" -eq 0; then \
- echo "$$grn$$dashes"; \
+ col="$$grn"; \
else \
- echo "$$red$$dashes"; \
+ col="$$red"; \
fi; \
- echo "$$banner"; \
- test -z "$$skipped" || echo "$$skipped"; \
- test -z "$$report" || echo "$$report"; \
- echo "$$dashes$$std"; \
+ echo "$${col}$$dashes$${std}"; \
+ echo "$${col}$$banner$${std}"; \
+ test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \
+ test -z "$$report" || echo "$${col}$$report$${std}"; \
+ echo "$${col}$$dashes$${std}"; \
test "$$failed" -eq 0; \
else :; fi
@@ -693,10 +703,15 @@ install-am: all-am
installcheck: installcheck-recursive
install-strip:
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- `test -z '$(STRIP)' || \
- echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
mostlyclean-generic:
clean-generic:
diff --git a/src/test/OffscreenTest.py b/src/test/OffscreenTest.py
index 2ea6e6b..76bff52 100644
--- a/src/test/OffscreenTest.py
+++ b/src/test/OffscreenTest.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# libavg - Media Playback Engine.
-# Copyright (C) 2003-2011 Ulrich von Zadow
+# 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
@@ -19,9 +19,7 @@
# Current versions can be found at www.libavg.de
#
-import unittest
-
-from libavg import avg
+from libavg import avg, player
from testcase import *
import gc
@@ -43,7 +41,7 @@ class OffscreenTestCase(AVGTestCase):
self.canvas2 = canvas
def unlink():
- self.node = Player.getElementByID("imagenode")
+ self.node = player.getElementByID("imagenode")
self.node.unlink()
self.assertEqual(self.canvas1.getNumDependentCanvases(), 0)
gc.collect()
@@ -54,61 +52,61 @@ class OffscreenTestCase(AVGTestCase):
self.assertEqual(self.canvas1.getNumDependentCanvases(), 1)
def changeHRef(href):
- Player.getElementByID("imagenode").href = href
+ player.getElementByID("imagenode").href = href
def setBitmap():
- bitmap = avg.Bitmap("rgb24-65x65.png")
- Player.getElementByID("imagenode").setBitmap(bitmap)
+ bitmap = avg.Bitmap("media/rgb24-65x65.png")
+ player.getElementByID("imagenode").setBitmap(bitmap)
def deleteCanvases():
changeHRef("")
firstNode.href = ""
- Player.deleteCanvas("testcanvas1")
+ player.deleteCanvas("testcanvas1")
# self.assertException(lambda: changeHRef("canvas:testcanvas1"))
changeHRef("canvas:testcanvas2")
-# self.assertException(lambda: Player.deleteCanvas("testcanvas2"))
+# self.assertException(lambda: player.deleteCanvas("testcanvas2"))
changeHRef("")
- Player.deleteCanvas("testcanvas2")
-# self.assertException(lambda: Player.deleteCanvas("foo"))
+ player.deleteCanvas("testcanvas2")
+# self.assertException(lambda: player.deleteCanvas("foo"))
root = self.loadEmptyScene()
+ root.mediadir = "media"
createCanvas(True, "testcanvas1", 0)
- firstNode = Player.getElementByID("imagenode")
- self.start((
- lambda: self.compareImage("testOffscreen1", False),
+ firstNode = player.getElementByID("imagenode")
+ self.start(False,
+ (lambda: self.compareImage("testOffscreen1"),
unlink,
- lambda: self.compareImage("testOffscreen2", False),
+ lambda: self.compareImage("testOffscreen2"),
relink,
- lambda: self.compareImage("testOffscreen1", False),
+ lambda: self.compareImage("testOffscreen1"),
unlink,
lambda: createCanvas(False, "testcanvas2", 80),
- lambda: self.compareImage("testOffscreen3", False),
+ lambda: self.compareImage("testOffscreen3"),
lambda: changeHRef("canvas:testcanvas1"),
lambda: self.assertEqual(self.canvas1.getNumDependentCanvases(), 1),
lambda: self.assertEqual(self.canvas2.getNumDependentCanvases(), 0),
- lambda: self.compareImage("testOffscreen1", False),
+ lambda: self.compareImage("testOffscreen1"),
lambda: changeHRef("rgb24-65x65.png"),
lambda: self.assertEqual(self.canvas1.getNumDependentCanvases(), 0),
- lambda: self.compareImage("testOffscreen4", False),
+ lambda: self.compareImage("testOffscreen4"),
lambda: changeHRef("canvas:testcanvas1"),
lambda: self.assertEqual(self.canvas1.getNumDependentCanvases(), 1),
- lambda: self.compareImage("testOffscreen1", False),
+ lambda: self.compareImage("testOffscreen1"),
setBitmap,
- lambda: self.compareImage("testOffscreen4", False),
+ lambda: self.compareImage("testOffscreen4"),
deleteCanvases,
- lambda: self.compareImage("testOffscreen5", False),
+ lambda: self.compareImage("testOffscreen5"),
))
def testCanvasLoadAfterPlay(self):
def createOffscreenCanvas():
- offscreenCanvas = self.__createOffscreenCanvas("offscreencanvas", False)
- self.node = avg.ImageNode(parent=root,
- href="canvas:offscreencanvas")
+ self.__createOffscreenCanvas("offscreencanvas", False)
+ self.node = avg.ImageNode(parent=root, href="canvas:offscreencanvas")
root = self.loadEmptyScene()
- self.start((
- createOffscreenCanvas,
- lambda: self.compareImage("testOffscreen1", False),
+ self.start(False,
+ (createOffscreenCanvas,
+ lambda: self.compareImage("testOffscreen1"),
))
def testCanvasResize(self):
@@ -116,46 +114,46 @@ class OffscreenTestCase(AVGTestCase):
self.node.size = (80, 60)
mainCanvas, offscreenCanvas = self.__setupCanvas(False)
- self.start((
- setSize,
- lambda: self.compareImage("testCanvasResize", False)
+ self.start(False,
+ (setSize,
+ lambda: self.compareImage("testCanvasResize")
))
def testCanvasErrors(self):
self.loadEmptyScene()
# Missing size
self.assertException(
- lambda: Player.createCanvas(id="foo"))
+ lambda: player.createCanvas(id="foo"))
# Duplicate canvas id
- Player.createCanvas(id="foo", size=(160, 120))
+ player.createCanvas(id="foo", size=(160, 120))
self.assertException(
- lambda: Player.createCanvas(id="foo", size=(160, 120)))
+ lambda: player.createCanvas(id="foo", size=(160, 120)))
def testCanvasAPI(self):
def checkMainScreenshot():
- bmp1 = Player.screenshot()
+ bmp1 = player.screenshot()
bmp2 = mainCanvas.screenshot()
self.assert_(self.areSimilarBmps(bmp1, bmp2, 0.01, 0.01))
def checkCanvasScreenshot():
bmp = offscreenCanvas.screenshot()
- self.compareBitmapToFile(bmp, "testOffscreenScreenshot", False)
+ self.compareBitmapToFile(bmp, "testOffscreenScreenshot")
def createCompressed():
avg.ImageNode(href="canvas:offscreencanvas", compression="B5G6R5",
parent=root)
root = self.loadEmptyScene()
- mainCanvas = Player.getMainCanvas()
+ mainCanvas = player.getMainCanvas()
self.assertEqual(mainCanvas.getRootNode(), root)
offscreenCanvas = self.__createOffscreenCanvas("offscreencanvas", False)
- self.assertEqual(offscreenCanvas, Player.getCanvas("offscreencanvas"))
+ self.assertEqual(offscreenCanvas, player.getCanvas("offscreencanvas"))
self.assertEqual(offscreenCanvas.getElementByID("test1").href, "rgb24-65x65.png")
self.assertEqual(offscreenCanvas.getElementByID("missingnode"), None)
- self.assertException(Player.screenshot)
+ self.assertException(player.screenshot)
self.assertException(createCompressed)
- self.start((
- checkMainScreenshot,
+ self.start(False,
+ (checkMainScreenshot,
checkCanvasScreenshot))
def testCanvasEvents(self):
@@ -175,12 +173,12 @@ class OffscreenTestCase(AVGTestCase):
mainCanvas, offscreenCanvas = self.__setupCanvas(True)
offscreenImage = offscreenCanvas.getElementByID("test1")
- offscreenImage.setEventHandler(avg.CURSORDOWN, avg.MOUSE, onOffscreenImageDown)
- Player.getRootNode().setEventHandler(avg.CURSORDOWN, avg.MOUSE, onMainDown)
+ offscreenImage.subscribe(avg.Node.CURSOR_DOWN, onOffscreenImageDown)
+ player.getRootNode().subscribe(avg.Node.CURSOR_DOWN, onMainDown)
self.__offscreenImageDownCalled = False
self.__mainDownCalled = False
- self.start((
- lambda: self.fakeClick(10, 10),
+ self.start(False,
+ (lambda: self.fakeClick(10, 10),
lambda: self.assert_(self.__offscreenImageDownCalled),
reset,
lambda: self.fakeClick(80, 10),
@@ -207,20 +205,18 @@ class OffscreenTestCase(AVGTestCase):
mainCanvas, offscreenCanvas = self.__setupCanvas(True)
offscreenImage = offscreenCanvas.getElementByID("test1")
- offscreenImage.setEventHandler(avg.CURSORDOWN, avg.MOUSE, onOffscreenImageDown);
- helper = Player.getTestHelper()
+ offscreenImage.subscribe(avg.Node.CURSOR_DOWN, onOffscreenImageDown);
self.__offscreenImageDownCalled = False
offscreenImage.setEventCapture()
- self.start((
- lambda: helper.fakeMouseEvent(avg.CURSORDOWN, True, False, False,
- 80, 10, 1),
+ self.start(False,
+ (lambda: self._sendMouseEvent(avg.Event.CURSOR_DOWN, 80, 10),
lambda: self.assert_(self.__offscreenImageDownCalled),
))
def testCanvasRender(self):
def createCanvas():
- canvas = Player.createCanvas(id="testcanvas", size=(160,120),
- autorender=False)
+ canvas = player.createCanvas(id="testcanvas", size=(160,120),
+ mediadir="media", autorender=False)
avg.ImageNode(id="test", href="rgb24-65x65.png", parent=canvas.getRootNode())
return canvas
@@ -230,10 +226,10 @@ class OffscreenTestCase(AVGTestCase):
def renderCanvas():
self.__offscreenCanvas.render()
bmp = self.__offscreenCanvas.screenshot()
- self.compareBitmapToFile(bmp, "testOffscreenScreenshot", False)
+ self.compareBitmapToFile(bmp, "testOffscreenScreenshot")
def deleteCanvas():
- Player.deleteCanvas("testcanvas")
+ player.deleteCanvas("testcanvas")
self.__offscreenCanvas = None
def recreateCanvas():
@@ -242,8 +238,8 @@ class OffscreenTestCase(AVGTestCase):
self.loadEmptyScene()
self.__offscreenCanvas = createCanvas()
self.assertException(renderCanvas)
- self.start((
- testEarlyScreenshotException,
+ self.start(False,
+ (testEarlyScreenshotException,
renderCanvas,
deleteCanvas,
recreateCanvas,
@@ -267,41 +263,43 @@ class OffscreenTestCase(AVGTestCase):
root = self.loadEmptyScene()
self.__offscreenCanvas = createCanvas()
- self.start((
- lambda: self.assert_(self.__offscreenCanvas.autorender),
- lambda: self.compareImage("testOffscreenAutoRender1", False),
+ self.start(False,
+ (lambda: self.assert_(self.__offscreenCanvas.autorender),
+ lambda: self.compareImage("testOffscreenAutoRender1"),
disableAutoRender,
lambda: self.assert_(not(self.__offscreenCanvas.autorender)),
changeContent,
- lambda: self.compareImage("testOffscreenAutoRender1", False),
+ lambda: self.compareImage("testOffscreenAutoRender1"),
enableAutoRender,
lambda: self.assert_(self.__offscreenCanvas.autorender),
- lambda: self.compareImage("testOffscreenAutoRender2", False)
+ lambda: self.compareImage("testOffscreenAutoRender2")
))
def testCanvasCrop(self):
root = self.loadEmptyScene()
- canvas = Player.createCanvas(id="testcanvas", size=(160,120))
+ canvas = player.createCanvas(id="testcanvas", size=(160,120),
+ mediadir="media")
div = avg.DivNode(pos=(40,30), size=(80,60), crop=True,
parent=canvas.getRootNode())
avg.ImageNode(id="test1", pos=(-32, -32), href="rgb24-65x65.png", parent=div)
avg.ImageNode(parent=root, href="canvas:testcanvas")
- self.start((lambda: self.compareImage("testCanvasCrop", False),))
+ self.start(False, (lambda: self.compareImage("testCanvasCrop"),))
def testCanvasAlpha(self):
root = self.loadEmptyScene()
- canvas = Player.createCanvas(id="testcanvas", size=(80,120))
+ canvas = player.createCanvas(id="testcanvas", size=(80,120), mediadir="media")
avg.ImageNode(id="test1", href="rgb24alpha-64x64.png",
parent=canvas.getRootNode())
avg.RectNode(parent=root, fillcolor="FFFFFF",
pos=(0.5, 0.5), size=(160, 48), fillopacity=1)
avg.ImageNode(parent=root, href="canvas:testcanvas")
avg.ImageNode(parent=root, x=64, href="rgb24alpha-64x64.png")
- self.start((lambda: self.compareImage("testCanvasAlpha", False),))
+ self.start(False, (lambda: self.compareImage("testCanvasAlpha"),))
def testCanvasBlendModes(self):
def createBaseCanvas():
- canvas = Player.createCanvas(id="testcanvas", size=(64,64))
+ canvas = player.createCanvas(id="testcanvas", size=(64,64),
+ mediadir="media")
avg.ImageNode(href="rgb24alpha-64x64.png", parent=canvas.getRootNode())
return canvas
@@ -316,53 +314,55 @@ class OffscreenTestCase(AVGTestCase):
blendmode="add")
avg.ImageNode(parent=root, pos=(64,64), href="canvas:testcanvas",
opacity=0.6, blendmode="add")
- self.start((lambda: self.compareImage("testCanvasBlendModes", False),))
+ self.start(False, (lambda: self.compareImage("testCanvasBlendModes"),))
def testCanvasMultisampling(self):
- def testIllegalSamples():
- self.canvas = Player.createCanvas(id="brokencanvas", size=(160,120),
- multisamplesamples=42)
+ def testIllegalSamples(numSamples):
+ self.canvas = player.createCanvas(id="brokencanvas", size=(160,120),
+ multisamplesamples=numSamples)
def screenshot():
bmp = self.canvas.screenshot()
- self.compareBitmapToFile(bmp, "testOffscreenMultisampleScreenshot", False)
+ self.compareBitmapToFile(bmp, "testOffscreenMultisampleScreenshot")
def createCanvas():
if not(avg.OffscreenCanvas.isMultisampleSupported()):
self.skip("Offscreen multisampling not supported")
- Player.stop()
+ player.stop()
return
try:
- self.canvas = Player.createCanvas(id="testcanvas", size=(160,120),
- multisamplesamples=2)
+ self.canvas = player.createCanvas(id="testcanvas", size=(160,120),
+ mediadir="media", multisamplesamples=2)
avg.ImageNode(id="test1", href="rgb24-65x65.png", angle=0.1,
parent=self.canvas.getRootNode())
except RuntimeError:
self.skip("Offscreen multisampling init failed")
- Player.stop()
+ player.stop()
return
self.assertEqual(self.canvas.multisamplesamples, 2)
avg.ImageNode(parent=root, href="canvas:testcanvas")
root = self.loadEmptyScene()
- self.start((
- createCanvas,
- lambda: self.compareImage("testCanvasMultisample", False),
+ self.start(False,
+ (createCanvas,
+ lambda: self.compareImage("testCanvasMultisample"),
screenshot,
- lambda: self.assertException(testIllegalSamples),
+ lambda: self.assertException(lambda: testIllegalSamples(42)),
+ lambda: self.assertException(lambda: testIllegalSamples(0)),
))
self.canvas = None
def testCanvasMipmap(self):
root = self.loadEmptyScene()
- canvas = Player.createCanvas(id="testcanvas", size=(80,120), mipmap=True)
+ canvas = player.createCanvas(id="testcanvas", size=(80,120), mediadir="media",
+ mipmap=True)
avg.ImageNode(id="test1", href="rgb24alpha-64x64.png",
parent=canvas.getRootNode())
avg.ImageNode(parent=root, size=(40, 30), href="canvas:testcanvas")
try:
- self.start((lambda: self.compareImage("testCanvasMipmap", False),))
+ self.start(False, (lambda: self.compareImage("testCanvasMipmap"),))
except RuntimeError:
self.skip("Offscreen mipmap init failed.")
return
@@ -393,11 +393,11 @@ class OffscreenTestCase(AVGTestCase):
self.node.href = "canvas:offscreencanvas2"
def loadCanvasDepString():
- Player.createCanvas(id="canvas1", size=(160, 120))
- canvas2 = Player.createCanvas(id="canvas2", size=(160, 120))
+ player.createCanvas(id="canvas1", size=(160, 120))
+ canvas2 = player.createCanvas(id="canvas2", size=(160, 120))
avg.ImageNode(href="canvas:canvas1", parent=canvas2.getRootNode())
- Player.deleteCanvas('canvas2')
- Player.deleteCanvas('canvas1')
+ player.deleteCanvas('canvas2')
+ player.deleteCanvas('canvas1')
root = self.loadEmptyScene()
createTwoCanvases()
@@ -406,29 +406,30 @@ class OffscreenTestCase(AVGTestCase):
self.offscreen2 = None
self.node.href = ""
self.node = None
- Player.deleteCanvas("offscreencanvas1")
- Player.deleteCanvas("offscreencanvas2")
- self.start((
- createTwoCanvases,
- lambda: self.compareImage("testCanvasDependencies1", False),
- exchangeCanvases,
- lambda: self.compareImage("testCanvasDependencies2", False),
- lambda: self.assertException(makeCircularRef),
- lambda: self.assertException(makeSelfRef1),
- lambda: self.assertException(makeSelfRef2),
- loadCanvasDepString,
- ))
+ player.deleteCanvas("offscreencanvas1")
+ player.deleteCanvas("offscreencanvas2")
+ self.start(False,
+ (createTwoCanvases,
+ lambda: self.compareImage("testCanvasDependencies1"),
+ exchangeCanvases,
+ lambda: self.compareImage("testCanvasDependencies2"),
+ lambda: self.assertException(makeCircularRef),
+ lambda: self.assertException(makeSelfRef1),
+ lambda: self.assertException(makeSelfRef2),
+ loadCanvasDepString,
+ ))
def __setupCanvas(self, handleEvents):
root = self.loadEmptyScene()
- mainCanvas = Player.getMainCanvas()
+ mainCanvas = player.getMainCanvas()
offscreenCanvas = self.__createOffscreenCanvas("offscreencanvas", handleEvents)
self.node = avg.ImageNode(parent=root, href="canvas:offscreencanvas")
return (mainCanvas, offscreenCanvas)
def __createOffscreenCanvas(self, canvasName, handleEvents):
- canvas=Player.createCanvas(id=canvasName, size=(160,120),
+ canvas = player.createCanvas(id=canvasName, size=(160,120),
handleevents=handleEvents)
+ canvas.getRootNode().mediadir = "media"
avg.ImageNode(id="test1", href="rgb24-65x65.png", parent=canvas.getRootNode())
return canvas
@@ -437,13 +438,13 @@ def isOffscreenSupported():
def testOffscreenSupported():
global offscreenSupported
offscreenSupported = avg.OffscreenCanvas.isSupported()
- Player.stop()
+ player.stop()
global offscreenSupported
sceneString = """<avg id="avg" width="160" height="120"/>"""
- Player.loadString(sceneString)
- Player.setTimeout(0, testOffscreenSupported)
- Player.play()
+ player.loadString(sceneString)
+ player.setTimeout(0, testOffscreenSupported)
+ player.play()
return offscreenSupported
def offscreenTestSuite(tests):
@@ -467,8 +468,5 @@ def offscreenTestSuite(tests):
)
return createAVGTestSuite(availableTests, OffscreenTestCase, tests)
else:
- print "Skipping offscreen tests - no canvas support with this graphics configuration."
- return lambda x: None
-
-
-Player = avg.Player.get()
+ sys.stderr.write("Skipping offscreen tests - no canvas support with this graphics configuration.\n")
+ return unittest.TestSuite()
diff --git a/src/test/PlayerTest.py b/src/test/PlayerTest.py
index e43e204..2443759 100644
--- a/src/test/PlayerTest.py
+++ b/src/test/PlayerTest.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# libavg - Media Playback Engine.
-# Copyright (C) 2003-2011 Ulrich von Zadow
+# 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
@@ -19,10 +19,10 @@
# Current versions can be found at www.libavg.de
#
-import time
import math
+import threading
-from libavg import avg
+from libavg import avg, player
from testcase import *
class PlayerTestCase(AVGTestCase):
@@ -37,12 +37,25 @@ class PlayerTestCase(AVGTestCase):
ptMap[avg.Point2D(0,0)] = 2
self.assertEqual(len(ptMap), 2)
self.assertEqual(ptMap[avg.Point2D(0,0)], 2)
+
+ def testToTupleConversion():
+ pt = avg.Point2D(10, 20)
+ tpl = tuple(pt)
+ self.assertEqual(pt.x, tpl[0])
+ self.assertEqual(pt.y, tpl[1])
+
+ def testFromTupleConversion():
+ tpl = (15, 20)
+ pt = avg.Point2D(tpl)
+ self.assertEqual(pt.x, tpl[0])
+ self.assertEqual(pt.y, tpl[1])
pt = avg.Point2D()
self.assertEqual(pt, avg.Point2D(0,0))
- pt = avg.Point2D(10, 10)
+ pt = avg.Point2D(10, 20)
self.assertEqual(pt[0], pt.x)
self.assertEqual(pt[1], pt.y)
+ pt = avg.Point2D(10, 10)
self.assertEqual(pt, avg.Point2D(10, 10))
self.assertEqual(pt, (10, 10))
self.assertEqual(pt, avg.Point2D([10, 10]))
@@ -51,6 +64,8 @@ class PlayerTestCase(AVGTestCase):
pt2 = eval(repr(pt))
self.assertEqual(pt2, pt)
testHash()
+ testFromTupleConversion()
+ testToTupleConversion()
self.assertAlmostEqual(avg.Point2D(10,0).getNormalized(), avg.Point2D(1,0))
self.assertAlmostEqual(pt.getRotated(math.pi, (5,5)), avg.Point2D(0,0))
self.assertEqual(-pt, (-10, -10))
@@ -88,36 +103,46 @@ class PlayerTestCase(AVGTestCase):
def testBasics(self):
def getFramerate():
- framerate = Player.getEffectiveFramerate()
+ framerate = player.getEffectiveFramerate()
self.assert_(framerate > 0)
def invalidCreateNode():
avg.ImageNode(1, 2, 3)
- Player.showCursor(0)
- Player.showCursor(1)
+ player.showCursor(0)
+ player.showCursor(1)
root = self.loadEmptyScene()
- node = Player.createNode("""<image id="test1" href="rgb24-65x65.png"/>""")
- root.appendChild(node)
+ avg.ImageNode(href="rgb24-65x65.png", parent=root)
self.assertException(invalidCreateNode)
- self.start((
- getFramerate,
- lambda: self.compareImage("testbasics", False),
- lambda: Player.setGamma(0.3, 0.3, 0.3),
- lambda: Player.showCursor(0),
- lambda: Player.showCursor(1),
- ))
+ self.start(False,
+ (getFramerate,
+ lambda: self.compareImage("testbasics"),
+ lambda: player.setGamma(0.3, 0.3, 0.3),
+ lambda: player.showCursor(0),
+ lambda: player.showCursor(1),
+ ))
+
+ def testColorParse(self):
+ def setColor(colorName):
+ node.color = colorName
+
+ node = avg.LineNode(pos1=(0.5, 0), pos2=(0.5, 50), color="FF0000")
+ setColor("ff00ff")
+ self.assertException(lambda: setColor("foo"))
+ self.assertException(lambda: setColor("ff00f"))
+ self.assertException(lambda: setColor("ff00ffx"))
+ self.assertException(lambda: setColor("ff00fx"))
def testFakeTime(self):
def checkTime():
- self.assertEqual(Player.getFrameTime(), 50)
- self.assertEqual(Player.getFrameDuration(), 50)
- self.assertEqual(Player.getEffectiveFramerate(), 20)
+ self.assertEqual(player.getFrameTime(), 50)
+ self.assertEqual(player.getFrameDuration(), 50)
+ self.assertEqual(player.getEffectiveFramerate(), 20)
self.loadEmptyScene()
- Player.setFakeFPS(20)
- self.start((
- checkTime,
+ player.setFakeFPS(20)
+ self.start(False,
+ (checkTime,
))
def testDivResize(self):
@@ -136,10 +161,10 @@ class PlayerTestCase(AVGTestCase):
node.height = h
self.__initDefaultScene()
- node = Player.getElementByID('nestedavg')
+ node = player.getElementByID('nestedavg')
- self.start((
- lambda: checkSize(128, 32),
+ self.start(False,
+ (lambda: checkSize(128, 32),
lambda: setSize((14,15)),
lambda: checkSize(14,15),
lambda: setWidth(23),
@@ -153,14 +178,14 @@ class PlayerTestCase(AVGTestCase):
self.onOuterDownCalled = True
def fakeRotate():
- Player.getElementByID("outer").angle += 0.1
- Player.getElementByID("inner").angle -= 0.1
+ player.getElementByID("outer").angle += 0.1
+ player.getElementByID("inner").angle -= 0.1
def testCoordConversions():
- innerNode = Player.getElementByID("inner")
+ innerNode = player.getElementByID("inner")
relPos = innerNode.getRelPos((90, 80))
self.assertAlmostEqual(relPos, (10, 10))
- outerNode = Player.getElementByID("outer")
+ outerNode = player.getElementByID("outer")
relPos = outerNode.getRelPos((90, 80))
self.assertAlmostEqual(relPos[0], 12.332806394528092)
self.assertAlmostEqual(relPos[1], 6.9211188716194592)
@@ -170,36 +195,26 @@ class PlayerTestCase(AVGTestCase):
self.assertEqual(outerNode.getElementByPos((0, 10)), outerNode)
self.assertEqual(outerNode.getElementByPos((-10, -110)), None)
- def sendEvent(type, x, y):
- Helper = Player.getTestHelper()
- if type == avg.CURSORUP:
- button = False
- else:
- button = True
- Helper.fakeMouseEvent(type, button, False, False,
- x, y, 1)
-
def disableCrop():
- Player.getElementByID("outer").crop = False
- Player.getElementByID("inner").crop = False
+ player.getElementByID("outer").crop = False
+ player.getElementByID("inner").crop = False
self.__initDefaultRotateScene()
- Player.getElementByID("outer").setEventHandler(
- avg.CURSORDOWN, avg.MOUSE, onOuterDown)
+ player.getElementByID("outer").subscribe(avg.Node.CURSOR_DOWN, onOuterDown)
self.onOuterDownCalled = False
- self.start((
- lambda: self.compareImage("testRotate1", False),
+ self.start(False,
+ (lambda: self.compareImage("testRotate1"),
testCoordConversions,
fakeRotate,
- lambda: self.compareImage("testRotate1a", False),
- lambda: sendEvent(avg.CURSORDOWN, 85, 70),
- lambda: sendEvent(avg.CURSORUP, 85, 70),
+ lambda: self.compareImage("testRotate1a"),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_DOWN, 85, 70),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_UP, 85, 70),
lambda: self.assert_(not(self.onOuterDownCalled)),
- lambda: sendEvent(avg.CURSORDOWN, 85, 75),
- lambda: sendEvent(avg.CURSORUP, 85, 75),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_DOWN, 85, 75),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_UP, 85, 75),
lambda: self.assert_(self.onOuterDownCalled),
disableCrop,
- lambda: self.compareImage("testRotate1b", False),
+ lambda: self.compareImage("testRotate1b"),
))
def testRotate2(self):
@@ -212,7 +227,7 @@ class PlayerTestCase(AVGTestCase):
crop=True, parent=div1)
avg.ImageNode(pos=(0,0), size=(16,16), href="rgb24-65x65.png", parent=div2)
avg.ImageNode(pos=(30,-6), size=(16,16), href="rgb24-65x65.png", parent=div2)
- self.start([lambda: self.compareImage("testRotate2", False)])
+ self.start(False, [lambda: self.compareImage("testRotate2")])
def testRotatePivot(self):
def setPivot (pos):
@@ -228,27 +243,47 @@ class PlayerTestCase(AVGTestCase):
crop=True, parent=node)
avg.ImageNode(pos=(-10,-10), size=(128,128), href="rgb24-65x65.png", parent=div)
avg.ImageNode(pos=(0,10), size=(32,32), href="rgb24-65x65.png", parent=node)
- self.start((
- lambda: self.compareImage("testRotatePivot1", False),
- lambda: setPivot((10, 10)),
- lambda: self.compareImage("testRotatePivot2", False),
- lambda: addPivot((-8, 0)),
- lambda: self.compareImage("testRotatePivot3", False),
- ))
+ self.start(False,
+ (lambda: self.compareImage("testRotatePivot1"),
+ lambda: setPivot((10, 10)),
+ lambda: self.compareImage("testRotatePivot2"),
+ lambda: addPivot((-8, 0)),
+ lambda: self.compareImage("testRotatePivot3"),
+ ))
+
+ def testOpacity(self):
+ root = self.loadEmptyScene()
+ avg.ImageNode(pos=(0,0), href="rgb24-65x65.png", opacity=0.5, parent=root)
+ avg.RectNode(pos=(0,64), size=(64,64), opacity=0.5, fillopacity=0.5,
+ fillcolor="FF0000", strokewidth=2, parent=root)
+ div = avg.DivNode(pos=(80,0), opacity=0.5, parent=root)
+ avg.ImageNode(pos=(0,0), href="rgb24-65x65.png", parent=div)
+ avg.RectNode(pos=(0,64), size=(64,64), opacity=1, fillopacity=1,
+ fillcolor="FF0000", strokewidth=2, parent=div)
+ self.start(False,
+ (lambda: self.compareImage("testOpacity"),
+ ))
def testOutlines(self):
root = self.__initDefaultRotateScene()
root.elementoutlinecolor = "FFFFFF"
- Player.getElementByID("inner").width = 100000
- Player.getElementByID("inner").height = 100000
- self.start([lambda: self.compareImage("testOutlines", False)])
+ innerDiv = player.getElementByID("inner")
+ innerDiv.size = (0, 0)
+ innerDiv.getChild(0).elementoutlinecolor = "00FF00"
+ self.start(False, [lambda: self.compareImage("testOutlines")])
+
+ def testWordsOutlines(self):
+ root = self.loadEmptyScene()
+ root.elementoutlinecolor = "FFFFFF"
+ avg.WordsNode(pos=(40,40), alignment="center", text="test", parent=root)
+ self.start(True, [lambda: self.compareImage("testWordsOutlines")])
def testError(self):
self.initDefaultImageScene()
- Player.setTimeout(1, lambda: undefinedFunction)
- Player.setTimeout(50, Player.stop)
+ player.setTimeout(1, lambda: undefinedFunction)
+ player.setTimeout(50, player.stop)
try:
- Player.play()
+ player.play()
except NameError:
self.assert_(1)
else:
@@ -260,7 +295,7 @@ class PlayerTestCase(AVGTestCase):
try:
self.initDefaultImageScene()
- self.start([throwException])
+ self.start(False, [throwException])
except ZeroDivisionError:
self.assert_(1)
else:
@@ -273,7 +308,7 @@ class PlayerTestCase(AVGTestCase):
root = self.loadEmptyScene()
div = avg.DivNode(active=False, parent=root)
avg.ImageNode(href="filedoesntexist.png", parent=div)
- self.start([activateNode])
+ self.start(False, [activateNode])
def testInvalidVideoFilename(self):
def tryplay():
@@ -281,8 +316,8 @@ class PlayerTestCase(AVGTestCase):
root = self.loadEmptyScene()
video = avg.VideoNode(href="filedoesntexist.avi", parent=root)
- self.start((
- lambda: tryplay,
+ self.start(False,
+ (lambda: tryplay,
lambda: video.stop()
))
@@ -291,13 +326,18 @@ class PlayerTestCase(AVGTestCase):
pass
def timeout1():
- Player.clearInterval(self.timeout1ID)
- Player.clearInterval(self.timeout2ID)
+ player.clearInterval(self.timeout1ID)
+ player.clearInterval(self.timeout2ID)
self.timeout1called = True
def timeout2():
self.timeout2called = True
-
+
+ def onFrame():
+ self.numOnFramesCalled += 1
+ if self.numOnFramesCalled == 3:
+ player.clearInterval(self.intervalID)
+
def wait():
pass
@@ -305,67 +345,66 @@ class PlayerTestCase(AVGTestCase):
raise TestException
def initException():
- self.timeout3ID = Player.setTimeout(0, throwException)
+ self.timeout3ID = player.setTimeout(0, throwException)
def setupTimeouts():
- self.timeout1ID = Player.setTimeout(0, timeout1)
- self.timeout2ID = Player.setTimeout(1, timeout2)
+ self.timeout1ID = player.setTimeout(0, timeout1)
+ self.timeout2ID = player.setTimeout(1, timeout2)
+ self.intervalID = player.setOnFrameHandler(onFrame)
self.timeout1called = False
self.timeout2called = False
self.__exceptionThrown = False
+ self.numOnFramesCalled = 0
try:
self.initDefaultImageScene()
- self.start((
- setupTimeouts,
- wait,
+ self.start(False,
+ (setupTimeouts,
+ None,
lambda: self.assert_(self.timeout1called),
lambda: self.assert_(not(self.timeout2called)),
+ lambda: self.assert_(self.numOnFramesCalled == 3),
lambda: initException(),
- wait,
- wait,
- wait,
- wait,
- wait))
+ lambda: self.delay(10),
+ ))
except TestException:
self.__exceptionThrown = True
self.assert_(self.__exceptionThrown)
- Player.clearInterval(self.timeout3ID)
+ player.clearInterval(self.timeout3ID)
- def testPanoImage(self):
- def changeProperties():
- node = Player.getElementByID("pano")
- node.sensorheight=10
- node.sensorwidth=15
- node.focallength=25
-
- def loadImage():
- node = Player.getElementByID("pano")
- node.href = "rgb24-65x65.png"
+ def testCallFromThread(self):
- root = self.loadEmptyScene()
- avg.ImageNode(size=(320,240), href="rgb24-65x65.png", parent=root)
- avg.PanoImageNode(id="pano", size=(160,120), href="panoimage.png",
- sensorwidth=4.60, sensorheight=3.97, focallength=12, parent=root)
- avg.ImageNode(pos=(120,0), size=(40,40), href="rgb24-65x65.png", parent=root)
- self.start((
- lambda: self.compareImage("testPanoImage", False),
- lambda: time.sleep,
- changeProperties,
- loadImage
+ def onAsyncCall():
+ self.asyncCalled = True
+
+ def threadFunc():
+ player.setTimeout(0, onAsyncCall)
+
+ def startThread():
+ self.thread = threading.Thread(target=threadFunc)
+ self.thread.start()
+
+ self.initDefaultImageScene()
+ self.asyncCalled = False
+ player.setFakeFPS(-1)
+ self.start(False,
+ (startThread,
+ lambda: self.thread.join(),
+ None,
+ lambda: self.assert_(self.asyncCalled),
))
def testAVGFile(self):
- Player.loadFile("image.avg")
- self.start((
- lambda: self.compareImage("testAVGFile", False),
+ player.loadFile("image.avg")
+ self.start(False,
+ (lambda: self.compareImage("testAVGFile"),
))
- self.assertException(lambda: Player.loadFile("filedoesntexist.avg"))
+ self.assertException(lambda: player.loadFile("filedoesntexist.avg"))
def testBroken(self):
def testBrokenString(string):
- self.assertException(lambda: Player.loadString(string))
+ self.assertException(lambda: player.loadString(string))
# This isn't xml
testBrokenString("""
@@ -383,55 +422,55 @@ class PlayerTestCase(AVGTestCase):
def testMove(self):
def moveit():
- node = Player.getElementByID("nestedimg1")
+ node = player.getElementByID("nestedimg1")
node.x += 50
node.opacity -= 0.7
- node = Player.getElementByID("nestedavg")
+ node = player.getElementByID("nestedavg")
node.x += 50
def checkRelPos():
- RelPos = Player.getElementByID("obscured").getRelPos((50,52))
+ RelPos = player.getElementByID("obscured").getRelPos((50,52))
self.assertEqual(RelPos, (0, 0))
self.__initDefaultScene()
- self.start((
- lambda: self.compareImage("testMove1", False),
+ self.start(False,
+ (lambda: self.compareImage("testMove1"),
moveit,
checkRelPos
))
def testCropImage(self):
def moveTLCrop():
- node = Player.getElementByID("img")
+ node = player.getElementByID("img")
node.x = -20
node.y = -20
def moveBRCrop():
- node = Player.getElementByID("img")
+ node = player.getElementByID("img")
node.x = 60
node.y = 40
def moveTLNegative():
- node = Player.getElementByID("img")
+ node = player.getElementByID("img")
node.x = -60
node.y = -50
def moveBRGone():
- node = Player.getElementByID("img")
+ node = player.getElementByID("img")
node.x = 140
node.y = 100
def rotate():
- node = Player.getElementByID("img")
+ node = player.getElementByID("img")
node.x = 10
node.y = 10
- Player.getElementByID("nestedavg").angle = 1.0
- Player.getElementByID("bkgd").angle = 1.0
+ player.getElementByID("nestedavg").angle = 1.0
+ player.getElementByID("bkgd").angle = 1.0
root = self.loadEmptyScene()
avg.ImageNode(id="bkgd", href="crop_bkgd.png", parent=root)
root.appendChild(
- Player.createNode("""
+ player.createNode("""
<div id="nestedavg" x="40" y="30" width="80" height="60" crop="True">
<div id="nestedavg2" crop="True">
<div id="nestedavg3" crop="True">
@@ -441,94 +480,94 @@ class PlayerTestCase(AVGTestCase):
</div>
</div>
"""))
- self.start((
- lambda: self.compareImage("testCropImage1", False),
+ self.start(False,
+ (lambda: self.compareImage("testCropImage1"),
moveTLCrop,
- lambda: self.compareImage("testCropImage2", False),
+ lambda: self.compareImage("testCropImage2"),
moveBRCrop,
- lambda: self.compareImage("testCropImage3", False),
+ lambda: self.compareImage("testCropImage3"),
moveTLNegative,
- lambda: self.compareImage("testCropImage4", False),
+ lambda: self.compareImage("testCropImage4"),
moveBRGone,
- lambda: self.compareImage("testCropImage5", False),
+ lambda: self.compareImage("testCropImage5"),
rotate,
- lambda: self.compareImage("testCropImage6", False),
+ lambda: self.compareImage("testCropImage6"),
moveTLCrop,
- lambda: self.compareImage("testCropImage7", False),
+ lambda: self.compareImage("testCropImage7"),
moveBRCrop,
- lambda: self.compareImage("testCropImage8", False),
+ lambda: self.compareImage("testCropImage8"),
moveTLNegative,
- lambda: self.compareImage("testCropImage9", False),
+ lambda: self.compareImage("testCropImage9"),
moveBRGone,
- lambda: self.compareImage("testCropImage10", False)
+ lambda: self.compareImage("testCropImage10")
))
def testCropMovie(self):
def playMovie():
- node = Player.getElementByID("movie")
+ node = player.getElementByID("movie")
node.play()
def moveTLCrop():
- node = Player.getElementByID("movie")
+ node = player.getElementByID("movie")
node.x = -20
node.y = -20
def moveBRCrop():
- node = Player.getElementByID("movie")
+ node = player.getElementByID("movie")
node.x = 60
node.y = 40
def moveTLNegative():
- node = Player.getElementByID("movie")
+ node = player.getElementByID("movie")
node.x = -60
node.y = -50
def moveBRGone():
- node = Player.getElementByID("movie")
+ node = player.getElementByID("movie")
node.x = 140
node.y = 100
def rotate():
- node = Player.getElementByID("movie")
+ node = player.getElementByID("movie")
node.x = 10
node.y = 10
- Player.getElementByID("nestedavg").angle = 1.0
- Player.getElementByID("bkgd").angle = 1.0
+ player.getElementByID("nestedavg").angle = 1.0
+ player.getElementByID("bkgd").angle = 1.0
- Player.setFakeFPS(30)
+ player.setFakeFPS(30)
root = self.loadEmptyScene()
avg.ImageNode(id="bkgd", href="crop_bkgd.png", parent=root)
root.appendChild(
- Player.createNode("""
+ player.createNode("""
<div id="nestedavg" x="40" y="30" width="80" height="60" crop="True">
<video id="movie" x="10" y="10" width="40" height="40"
- threaded="false" href="../video/testfiles/mpeg1-48x48.mpg"
+ threaded="false" href="mpeg1-48x48.mov"
fps="30"/>
</div>
"""))
- self.start((
- playMovie,
- lambda: self.compareImage("testCropMovie1", False),
+ self.start(False,
+ (playMovie,
+ lambda: self.compareImage("testCropMovie1"),
moveTLCrop,
- lambda: self.compareImage("testCropMovie2", False),
+ lambda: self.compareImage("testCropMovie2"),
moveBRCrop,
- lambda: self.compareImage("testCropMovie3", False),
+ lambda: self.compareImage("testCropMovie3"),
moveTLNegative,
- lambda: self.compareImage("testCropMovie4", False),
+ lambda: self.compareImage("testCropMovie4"),
moveBRGone,
- lambda: self.compareImage("testCropMovie5", False),
+ lambda: self.compareImage("testCropMovie5"),
rotate,
- lambda: self.compareImage("testCropMovie6", False),
+ lambda: self.compareImage("testCropMovie6"),
moveTLCrop,
- lambda: self.compareImage("testCropMovie7", False),
+ lambda: self.compareImage("testCropMovie7"),
moveBRCrop,
- lambda: self.compareImage("testCropMovie8", False),
+ lambda: self.compareImage("testCropMovie8"),
moveTLNegative,
- lambda: self.compareImage("testCropMovie9", False),
+ lambda: self.compareImage("testCropMovie9"),
moveBRGone,
- lambda: self.compareImage("testCropMovie10", False)
+ lambda: self.compareImage("testCropMovie10")
))
def testWarp(self):
@@ -550,19 +589,18 @@ class PlayerTestCase(AVGTestCase):
image = avg.ImageNode(href="rgb24-64x64.png",
maxtilewidth=32, maxtileheight=16, parent=root)
video = avg.VideoNode(pos=(40,0), size=(80,80), opacity=0.5, loop=True,
- href="../video/testfiles/mpeg1-48x48.mpg", threaded=False, fps=30,
- parent=root)
+ href="mpeg1-48x48.mov", threaded=False, fps=30, parent=root)
self.assertException(image.getOrigVertexCoords)
self.assertException(image.getWarpedVertexCoords)
- Player.setFakeFPS(30)
- self.start((
- lambda: video.play(),
- lambda: self.compareImage("testWarp1", False),
+ player.setFakeFPS(30)
+ self.start(False,
+ (lambda: video.play(),
+ lambda: self.compareImage("testWarp1"),
moveVertex,
- lambda: self.compareImage("testWarp2", False),
+ lambda: self.compareImage("testWarp2"),
flip,
- lambda: self.compareImage("testWarp3", False)
+ lambda: self.compareImage("testWarp3")
))
def testMediaDir(self):
@@ -583,7 +621,7 @@ class PlayerTestCase(AVGTestCase):
self.assertEqual(node.size, avg.Point2D(64,64))
def setDir():
- div.mediadir="../video/testfiles"
+ div.mediadir=""
def setAbsDir():
def absDir():
@@ -593,19 +631,19 @@ class PlayerTestCase(AVGTestCase):
self.assertException(absDir)
def createNode():
- node = avg.VideoNode(href="mjpeg1-48x48.avi", fps=30)
+ avg.VideoNode(href="mjpeg1-48x48.avi", fps=30)
root = self.loadEmptyScene()
- div = avg.DivNode(mediadir="testmediadir", parent=root)
+ div = avg.DivNode(mediadir="../testmediadir", parent=root)
image = avg.ImageNode(pos=(0,30), href="rgb24-64x64a.png", parent=div)
video = avg.VideoNode(href="mjpeg-48x48.avi", threaded=False, parent=div)
- self.start((
- createImageNode,
+ self.start(False,
+ (createImageNode,
lambda: video.play(),
- lambda: self.compareImage("testMediaDir1", False),
+ lambda: self.compareImage("testMediaDir1"),
setDir,
lambda: video.play(),
- lambda: self.compareImage("testMediaDir2", False),
+ lambda: self.compareImage("testMediaDir2"),
lambda: self.assertEqual(image.width, 0),
createNode,
setAbsDir
@@ -616,24 +654,24 @@ class PlayerTestCase(AVGTestCase):
def testStopOnEscape(self):
def pressEscape():
- Helper = Player.getTestHelper()
+ Helper = player.getTestHelper()
escape = 27
- Helper.fakeKeyEvent(avg.KEYDOWN, escape, escape, "escape", escape,
+ Helper.fakeKeyEvent(avg.Event.KEY_DOWN, escape, escape, "escape", escape,
avg.KEYMOD_NONE),
- Helper.fakeKeyEvent(avg.KEYUP, escape, escape, "escape", escape,
+ Helper.fakeKeyEvent(avg.Event.KEY_UP, escape, escape, "escape", escape,
avg.KEYMOD_NONE),
def testEscape1():
- Player.stopOnEscape(False)
+ player.stopOnEscape(False)
pressEscape()
def testEscape2():
- Player.stopOnEscape(True)
- Player.stopOnEscape(False)
+ player.stopOnEscape(True)
+ player.stopOnEscape(False)
pressEscape()
def testEscape3():
- Player.stopOnEscape(True)
+ player.stopOnEscape(True)
pressEscape()
def setAlive():
@@ -641,54 +679,51 @@ class PlayerTestCase(AVGTestCase):
self.testStopOnEscapeAlive = False
self.__initDefaultScene()
- self.start((
- testEscape1,
+ self.start(False,
+ (testEscape1,
testEscape2,
setAlive
))
self.assert_(self.testStopOnEscapeAlive)
self.__initDefaultScene()
- self.start((
- testEscape3, # this should exit the player
+ self.start(False,
+ (testEscape3, # this should exit the player
lambda: self.fail(),
))
- # Not executed due to bug #145 - hangs with some window managers.
- def testWindowFrame(self):
- def revertWindowFrame():
- Player.setWindowFrame(True)
-
- Player.setWindowFrame(False)
- self.__initDefaultScene()
- self.start([revertWindowFrame])
-
def testScreenDimensions(self):
- res = Player.getScreenResolution()
- self.assert_(res.x > 0 and res.y > 0 and res.x < 10000 and res.y < 10000)
- ppmm = Player.getPixelsPerMM()
- self.assert_(ppmm > 0 and ppmm < 10000)
- mm = Player.getPhysicalScreenDimensions()
- self.assert_(mm.x > 0 and mm.y > 0 and mm.x < 10000 and mm.y < 10000)
- print res, ppmm, mm
- Player.assumePixelsPerMM(ppmm)
- newPPMM = Player.getPixelsPerMM()
- newMM = Player.getPhysicalScreenDimensions()
- self.assertAlmostEqual(newPPMM, ppmm)
- self.assertEqual(newMM, mm)
+ def queryDimensions():
+ res = player.getScreenResolution()
+ self.assert_(res.x > 0 and res.y > 0 and res.x < 10000 and res.y < 10000)
+ ppmm = player.getPixelsPerMM()
+ self.assert_(ppmm > 0 and ppmm < 10000)
+ mm = player.getPhysicalScreenDimensions()
+ self.assert_(mm.x > 0 and mm.y > 0 and mm.x < 10000 and mm.y < 10000)
+ player.assumePixelsPerMM(ppmm)
+ newPPMM = player.getPixelsPerMM()
+ self.assertAlmostEqual(newPPMM, ppmm)
+ newMM = player.getPhysicalScreenDimensions()
+ self.assertEqual(newMM, mm)
+
+ queryDimensions()
+ self.__initDefaultScene()
+ self.start(False,
+ (queryDimensions,
+ ))
def testSVG(self):
- svgFile = avg.SVG("rect.svg", False)
+ svgFile = avg.SVG("media/rect.svg", False)
# renderElement
bmp = svgFile.renderElement("rect")
- self.compareBitmapToFile(bmp, "testSvgBmp", False)
+ self.compareBitmapToFile(bmp, "testSvgBmp")
self.assertEqual(svgFile.getElementSize("rect"), avg.Point2D(22,12))
bmp = svgFile.renderElement("pos_rect")
- self.compareBitmapToFile(bmp, "testSvgPosBmp", False)
+ self.compareBitmapToFile(bmp, "testSvgPosBmp")
bmp = svgFile.renderElement("rect", 5)
- self.compareBitmapToFile(bmp, "testSvgScaleBmp1", False)
+ self.compareBitmapToFile(bmp, "testSvgScaleBmp1")
bmp = svgFile.renderElement("rect", (20,20))
- self.compareBitmapToFile(bmp, "testSvgScaleBmp2", False)
+ self.compareBitmapToFile(bmp, "testSvgScaleBmp2")
# error handling
self.assertException(lambda: avg.SVG("filedoesntexist.svg", False))
@@ -700,17 +735,63 @@ class PlayerTestCase(AVGTestCase):
# createImageNode
root = self.loadEmptyScene()
- self.start((
- lambda: svgFile.createImageNode("rect", {"pos":(10,10), "parent":root}),
- lambda: self.compareImage("testSvgNode", False),
+ self.start(False,
+ (lambda: svgFile.createImageNode("rect", {"pos":(10,10), "parent":root}),
+ lambda: self.compareImage("testSvgNode"),
lambda: svgFile.createImageNode("rect", {"pos":(5,5), "parent":root},
5),
- lambda: self.compareImage("testSvgScaledNode1", False),
+ lambda: self.compareImage("testSvgScaledNode1"),
lambda: svgFile.createImageNode("rect", {"pos":(1,1), "parent":root},
(40,40)),
- lambda: self.compareImage("testSvgScaledNode2", False)
+ lambda: self.compareImage("testSvgScaledNode2")
))
+ def testGetConfigOption(self):
+ self.assert_(len(player.getConfigOption("scr", "bpp")) > 0)
+ self.assertException(lambda: player.getConfigOption("scr", "illegalOption"))
+ self.assertException(lambda:
+ player.getConfigOption("illegalGroup", "illegalOption"))
+
+ def testValidateXml(self):
+ schema = """<?xml version="1.0" encoding="UTF-8"?>
+ <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
+
+ <xs:element name="shiporder">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="orderperson" type="xs:string"/>
+ </xs:sequence>
+ <xs:attribute name="orderid" type="xs:string" use="required"/>
+ </xs:complexType>
+ </xs:element>
+
+ </xs:schema>
+ """
+ xmlString = """<?xml version="1.0" encoding="UTF-8"?>
+
+ <shiporder orderid="889923">
+ <orderperson>John Smith</orderperson>
+ </shiporder>
+ """
+ avg.validateXml(xmlString, schema, "shiporder.xml", "shiporder.xsd")
+
+ brokenSchema = "ff"+schema
+ self.assertException(lambda: avg.validateXml(xmlString, brokenSchema,
+ "shiporder.xml", "shiporder.xsd"))
+
+ brokenXml = xmlString+"ff"
+ self.assertException(lambda: avg.validateXml(brokenXml, schema,
+ "shiporder.xml", "shiporder.xsd"))
+
+ # Not executed due to bug #145 - hangs with some window managers.
+ def testWindowFrame(self):
+ def revertWindowFrame():
+ player.setWindowFrame(True)
+
+ player.setWindowFrame(False)
+ self.__initDefaultScene()
+ self.start(False, [revertWindowFrame])
+
def __initDefaultScene(self):
root = self.loadEmptyScene()
avg.ImageNode(id="mainimg", size=(100, 75), href="rgb24-65x65.png", parent=root)
@@ -739,18 +820,21 @@ def playerTestSuite(tests):
availableTests = (
"testPoint",
"testBasics",
+ "testColorParse",
"testFakeTime",
"testDivResize",
"testRotate",
"testRotate2",
"testRotatePivot",
+ "testOpacity",
"testOutlines",
+ "testWordsOutlines",
"testError",
"testExceptionInTimeout",
"testInvalidImageFilename",
"testInvalidVideoFilename",
"testTimeouts",
- "testPanoImage",
+ "testCallFromThread",
"testAVGFile",
"testBroken",
"testMove",
@@ -762,8 +846,8 @@ def playerTestSuite(tests):
"testStopOnEscape",
"testScreenDimensions",
"testSVG",
+ "testGetConfigOption",
+ "testValidateXml",
# "testWindowFrame",
)
return createAVGTestSuite(availableTests, PlayerTestCase, tests)
-
-Player = avg.Player.get()
diff --git a/src/test/PluginTest.py b/src/test/PluginTest.py
index a9bd3db..186f7e4 100644
--- a/src/test/PluginTest.py
+++ b/src/test/PluginTest.py
@@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
# libavg - Media Playback Engine.
-# Copyright (C) 2003-2011 Ulrich von Zadow
+# 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
@@ -22,7 +22,7 @@
import platform
-from libavg import avg
+from libavg import player
from testcase import *
class PluginTestCase(AVGTestCase):
@@ -32,41 +32,34 @@ class PluginTestCase(AVGTestCase):
def testColorNodePlugin(self):
def loadPlugin():
if platform.system() != 'Windows':
- if os.getenv('srcdir') in ('.', None):
- # make check or ./Test.py
- addpth = './'
- else:
+ if not(os.getenv('srcdir') in ('.', None)):
# make distcheck
- addpth = '../../_build/src/test/'
-
- Player.pluginPath += ":"+addpth+"plugin/.libs"
- Player.loadPlugin("colorplugin")
+ player.pluginPath += ":../../_build/src/test/plugin/.libs"
+ player.loadPlugin("colorplugin")
def usePlugin1():
node = colorplugin.ColorNode(fillcolor="7f7f00", id="mynode1")
root.appendChild(node)
- mynode = Player.getElementByID("mynode1")
+ mynode = player.getElementByID("mynode1")
self.assertEqual(mynode.fillcolor, "7f7f00")
def usePlugin2():
- node = Player.createNode('<colornode fillcolor="0f3f7f" id="mynode2" />')
+ node = player.createNode('<colornode fillcolor="0f3f7f" id="mynode2" />')
root.appendChild(node)
- mynode = Player.getElementByID("mynode2")
+ mynode = player.getElementByID("mynode2")
self.assertEqual(mynode.fillcolor, "0f3f7f")
root = self.loadEmptyScene()
- self.start((
- loadPlugin,
- usePlugin1,
- lambda: self.compareImage("testplugin1", False),
- usePlugin2,
- lambda: self.compareImage("testplugin2", False),
- ))
+ self.start(False,
+ (loadPlugin,
+ usePlugin1,
+ lambda: self.compareImage("testplugin1"),
+ usePlugin2,
+ lambda: self.compareImage("testplugin2"),
+ ))
def pluginTestSuite (tests):
availableTests = ("testColorNodePlugin",)
return createAVGTestSuite(availableTests, PluginTestCase, tests)
-
-Player = avg.Player.get()
diff --git a/src/test/PythonTest.py b/src/test/PythonTest.py
index e002ffb..f4c5db3 100644
--- a/src/test/PythonTest.py
+++ b/src/test/PythonTest.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# libavg - Media Playback Engine.
-# Copyright (C) 2003-2011 Ulrich von Zadow
+# 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
@@ -19,264 +19,22 @@
# Current versions can be found at www.libavg.de
#
-from libavg import avg, anim, draggable, geom, statemachine
+import os
+import time
+import tempfile
+
+from libavg import geom, statemachine, persist
from testcase import *
+def getTempFileName():
+ return os.path.join(tempfile.gettempdir(), 'libavg.%d' % time.time())
+
+
class PythonTestCase(AVGTestCase):
def __init__(self, testFuncName):
AVGTestCase.__init__(self, testFuncName)
- def testAnimType(self, curAnim, imgBaseName):
- def onStop():
- self.__onStopCalled = True
-
- def startAnim():
- self.__onStopCalled = False
- node = Player.getElementByID("test")
- self.__anim.start()
-
- def startKeepAttr():
- node = Player.getElementByID("test")
- node.x = 25
- self.__anim.start(keepAttr=True)
-
- def abortAnim():
- self.__anim.abort()
-
- self.__anim = curAnim
- self.__anim.setHandler(onStop, None)
- self.__onStopCalled = False
- Player.setFakeFPS(10)
- self.start((
- startAnim,
- lambda: self.compareImage(imgBaseName+"1", False),
- lambda: self.assertEqual(anim.getNumRunningAnims(), 1),
- None,
- None,
- lambda: self.assert_(self.__onStopCalled),
- lambda: self.assert_(self.__anim.isDone()),
- lambda: self.compareImage(imgBaseName+"2", False),
- lambda: self.assertEqual(Player.getElementByID("test").x, 100),
- startAnim,
- lambda: self.compareImage(imgBaseName+"1", False),
- abortAnim,
- lambda: self.assertEqual(anim.getNumRunningAnims(), 0),
- lambda: self.compareImage(imgBaseName+"3", False),
- lambda: self.assert_(self.__anim.isDone()),
- None,
- lambda: self.assert_(not(self.__onStopCalled)),
- startAnim,
- startKeepAttr,
- lambda: self.assertEqual(anim.getNumRunningAnims(), 1),
- abortAnim
- ))
- self.__anim = None
-
- def testLinearAnim(self):
- self.initDefaultImageScene()
- node = Player.getElementByID("test")
- curAnim = anim.LinearAnim(node, "x", 200, 0, 100, False)
- self.testAnimType(curAnim, "testLinearAnim")
-
- def testLinearAnimZeroDuration(self):
- def onStop():
- self.__onStopCalled = True
-
- def startAnim():
- self.__onStopCalled = False
- node = Player.getElementByID("test")
- self.__anim.start()
-
- self.initDefaultImageScene()
- node = Player.getElementByID("test")
- self.__anim = anim.LinearAnim(node, "x", 0, 0, 100, False)
- self.__anim.setHandler(onStop, None)
- self.__onStopCalled = False
- Player.setFakeFPS(10)
- self.start((
- startAnim,
- lambda: self.compareImage("testLinearAnimZeroDuration1", False),
- lambda: self.assertEqual(anim.getNumRunningAnims(), 0),
- lambda: self.assert_(self.__onStopCalled),
- lambda: self.assert_(self.__anim.isDone())
- ))
- self.__anim = None
-
- def testEaseInOutAnim(self):
- self.initDefaultImageScene()
- node = Player.getElementByID("test")
- curAnim = anim.EaseInOutAnim(node, "x", 400, 0, 100, 100, 100, False)
- self.testAnimType(curAnim, "testEaseInOutAnim")
-
- def testSplineAnim(self):
- self.initDefaultImageScene()
- node = Player.getElementByID("test")
- curAnim = anim.SplineAnim(node, "x", 300, 0, 0, 100, 0, False)
- self.testAnimType(curAnim, "testSplineAnim")
-
- def testContinuousAnim(self):
- def onStart():
- Player.setTimeout(10,startAnim)
- Player.setTimeout(100,lambda:self.compareImage("testContAnim1", False))
- Player.setTimeout(200,startAnim2)
- Player.setTimeout(400,lambda:self.compareImage("testContAnim2", False))
- Player.setTimeout(450,startAnim3)
- Player.setTimeout(700,lambda:self.compareImage("testContAnim3", False))
- Player.setTimeout(800,stopAnim)
- Player.setTimeout(900,lambda:self.compareImage("testContAnim4", False))
- Player.setTimeout(1000,Player.stop)
-
- def startAnim():
- node=Player.getElementByID("testtiles")
- self.anim=anim.ContinuousAnim(node,"angle",0,1,0)
- self.anim.start()
-
- def startAnim2():
- node=Player.getElementByID("test")
- self.anim2=anim.ContinuousAnim(node,"width",0,50,0)
- self.anim2.start()
-
- def startAnim3():
- node=Player.getElementByID("test1")
- self.anim3=anim.ContinuousAnim(node,"x",0,50,0)
- self.anim3.start()
-
- def stopAnim():
- self.anim.abort()
- self.anim2.abort()
- self.anim3.abort()
- self.anim = None
- self.anim2 = None
- self.anim3 = None
-
- Player.setFakeFPS(25)
- anim.init(avg)
- self.initDefaultImageScene()
- Player.setTimeout(1, onStart)
- Player.play()
-
- def testWaitAnim(self):
- def animStopped():
- self.__endCalled = True
-
- def startAnim():
- self.anim = anim.WaitAnim(200, animStopped, False)
- self.anim.start()
-
- anim.init(avg)
- Player.setFakeFPS(10)
- self.__endCalled = False
- self.initDefaultImageScene()
- self.start((
- startAnim,
- lambda: self.assert_(not(self.anim.isDone())),
- None,
- None,
- lambda: self.assert_(self.anim.isDone()),
- lambda: self.assert_(self.__endCalled)
- ))
-
- def testStateAnim(self):
- def state2Callback():
- self.__state2CallbackCalled = True
-
- def makeAnim():
- node = Player.getElementByID("test")
- self.anim = anim.StateAnim(
- {"STATE1": anim.LinearAnim(node, "x", 200, 64, 128),
- "STATE2": anim.LinearAnim(node, "x", 200, 128, 64),
- "STATE3": anim.WaitAnim()},
- {"STATE1": anim.AnimTransition("STATE2", state2Callback),
- "STATE2": anim.AnimTransition("STATE3")})
- anim.init(avg)
- Player.setFakeFPS(10)
- self.__state2CallbackCalled = False
- self.initDefaultImageScene()
- self.start((
- makeAnim,
- lambda: self.compareImage("testStateAnim1", False),
- lambda: self.anim.setState("STATE1"),
- None,
- lambda: self.compareImage("testStateAnim2", False),
- lambda: self.anim.getState() == "STATE2",
- lambda: self.compareImage("testStateAnim3", False),
- lambda: self.assert_(self.__state2CallbackCalled),
- lambda: self.anim.getState() == "STATE3",
- lambda: self.compareImage("testStateAnim4", False),
- lambda: self.anim.setState("STATE1"),
- lambda: self.assertEqual(anim.getNumRunningAnims(), 1),
- lambda: self.compareImage("testStateAnim5", False)
- ))
-
- def testParallelAnim(self):
- def animStopped():
- self.__endCalled = True
-
- def startAnim():
- node0 = Player.getElementByID("mainimg")
- node1 = Player.getElementByID("test")
- node2 = Player.getElementByID("test1")
- self.anim = anim.ParallelAnim(
- [ anim.SplineAnim(node1, "x", 400, 0, 40, 0, 0),
- anim.EaseInOutAnim(node2, "x", 300, 129, 99, 100, 100)
- ], animStopped)
- self.anim.start()
-
- anim.init(avg)
- self.__endCalled = False
- Player.setFakeFPS(10)
- self.initDefaultImageScene()
- self.start((
- startAnim,
- lambda: self.assertEqual(anim.getNumRunningAnims(), 2),
- lambda: self.assert_(not(self.anim.isDone())),
- lambda: self.compareImage("testParallelAnims1", False),
- None,
- None,
- lambda: self.compareImage("testParallelAnims2", False),
- lambda: self.assert_(self.anim.isDone()),
- lambda: self.assert_(self.__endCalled)
- ))
-
- def testDraggable(self):
- def onDragStart(event):
- self.__dragStartCalled = True
-
- def onDragEnd(event):
- self.__dragEndCalled = True
-
- def startDrag():
- Helper.fakeMouseEvent(avg.CURSORDOWN, True, False, False, 140, 40, 1)
-
- def move():
- Helper.fakeMouseEvent(avg.CURSORMOTION, True, False, False, 150, 50, 1)
-
- def stop():
- Helper.fakeMouseEvent(avg.CURSORUP, False, False, False, 140, 40, 1)
-
- self.__dragEndCalled = False
- self.__dragStartCalled = False
- Helper = Player.getTestHelper()
- self.initDefaultImageScene()
- draggable.init(avg)
- dragger = draggable.Draggable(Player.getElementByID("test1"),
- onDragStart, onDragEnd)
- dragger.enable()
- self.start((
- startDrag,
- lambda: self.assert_(self.__dragStartCalled),
- move,
- lambda: self.compareImage("testDraggable1", False),
- stop,
- lambda: self.assert_(self.__dragEndCalled),
- lambda: self.compareImage("testDraggable2", False),
- dragger.disable,
- startDrag,
- move,
- lambda: self.compareImage("testDraggable2", False)
- ))
-
def testRoundedRect(self):
def setPos():
self.rect.pos = (20.5, 3.5)
@@ -293,24 +51,25 @@ class PythonTestCase(AVGTestCase):
def createDegenRect():
self.rect.unlink(True)
- geom.RoundedRect(parent=root, pos=(10.5,10.5), size=(10,10), radius=6,
+ rect = geom.RoundedRect(parent=root, pos=(10.5,10.5), size=(10,10), radius=6,
fillopacity=0.5, color="FFFFFF")
+ self.assert_(rect.radius == 6)
root = self.loadEmptyScene()
self.rect = geom.RoundedRect(parent=root, pos=(2.5,2.5),
size=(64,64), radius=5, color="FF0000")
- self.start((
- lambda: self.compareImage("testRoundedRect1", True),
+ self.start(False,
+ (lambda: self.compareImage("testRoundedRect1"),
setPos,
- lambda: self.compareImage("testRoundedRect2", True),
+ lambda: self.compareImage("testRoundedRect2"),
setSize,
- lambda: self.compareImage("testRoundedRect3", True),
+ lambda: self.compareImage("testRoundedRect3"),
lambda: setRadius(10),
- lambda: self.compareImage("testRoundedRect4", True),
+ lambda: self.compareImage("testRoundedRect4"),
setFill,
- lambda: self.compareImage("testRoundedRect5", True),
+ lambda: self.compareImage("testRoundedRect5"),
createDegenRect,
- lambda: self.compareImage("testRoundedRect6", True),
+ lambda: self.compareImage("testRoundedRect6"),
))
def testPieSlice(self):
@@ -329,12 +88,12 @@ class PythonTestCase(AVGTestCase):
self.pieSlice = geom.PieSlice(parent=root, pos=(20.5,20.5),
radius=40, startangle=0, endangle=1.57, color="FF0000")
- self.start((
- lambda: self.compareImage("testPieSlice1", True),
+ self.start(False,
+ (lambda: self.compareImage("testPieSlice1"),
changeAttrs,
- lambda: self.compareImage("testPieSlice2", True),
+ lambda: self.compareImage("testPieSlice2"),
makeSmall,
- lambda: self.compareImage("testPieSlice3", True),
+ lambda: self.compareImage("testPieSlice3"),
))
def testArc(self):
@@ -348,22 +107,24 @@ class PythonTestCase(AVGTestCase):
self.arc = geom.Arc(parent=root, pos=(20.5,20.5),
radius=40, startangle=0, endangle=1.57, color="FF0000")
- self.start((
- lambda: self.compareImage("testArc1", True),
+ self.start(False,
+ (lambda: self.compareImage("testArc1"),
changeAttrs,
- lambda: self.compareImage("testArc2", True),
+ lambda: self.compareImage("testArc2"),
))
+ def btoa(self):
+ # Test for member function handling in StateMachine.
+ self.btoaCalled = True
+
def testStateMachine(self):
def atob(oldState, newState):
self.atobCalled = True
- def btoc():
+ def btoc(dummy):
+ # Dummy argument so we can test handling of lambda expressions.
self.btocCalled = True
- def btoa(oldState, newState):
- self.btoaCalled = True
-
def aEntered():
self.aEnteredCalled = True
@@ -377,7 +138,7 @@ class PythonTestCase(AVGTestCase):
self.aEnteredCalled = False
machine = statemachine.StateMachine("testmachine", 'A')
machine.addState('A', {'B': atob, 'nostate': atob}, aEntered, aLeft)
- machine.addState('B', {'C': btoc, 'A': btoa})
+ machine.addState('B', {'C': lambda: btoc("dummy"), 'A': self.btoa})
machine.addState('C', {'A': None})
self.assertException(lambda: machine.addState('C', {'A': None}))
self.assertException(lambda: machine.changeState('C'))
@@ -393,6 +154,8 @@ class PythonTestCase(AVGTestCase):
self.assert_(self.btocCalled)
machine.changeState('A')
self.assertEqual(machine.state, 'A')
+# machine.dump()
+
self.assertException(lambda: machine.addState('illegal', {}))
# Create a machine without transition callbacks
@@ -407,25 +170,66 @@ class PythonTestCase(AVGTestCase):
kaputtMachine.addState('A', {'B': None})
self.assertException(lambda: kaputtMachine.changeState('B'))
+ def testStateMachineDiagram(self):
+ def aEntered():
+ pass
+
+ if not(self._isCurrentDirWriteable()):
+ self.skip("Current dir not writeable")
+ return
+
+ machine = statemachine.StateMachine("testmachine", 'A')
+ machine.addState('A', {'B': None, 'nostate': None}, aEntered)
+ machine.addState('B', {'C': None, 'A': self.btoa})
+ machine.addState('C', {'A': None})
+
+ imageFName = AVGTestCase.imageResultDirectory + "/stateMachineGraphViz.png"
+ try:
+ machine.makeDiagram(imageFName)
+ except RuntimeError:
+ self.skip("graphviz not installed.")
+
+ def testPersistStore(self):
+ testFile = getTempFileName()
+ p = persist.Persist(testFile, {})
+ self.assertEqual(p.storeFile, testFile)
+ self.assertEqual(p.data, {})
+ p.data['test'] = 1
+ p.commit()
+ p = persist.Persist(testFile, {})
+ self.assert_('test' in p.data)
+ self.assertEqual(p.data['test'], 1)
+ os.unlink(testFile)
+
+ def testPersistCorrupted(self):
+ testFile = getTempFileName()
+ f = open(testFile, 'w')
+ f.write('garbage')
+ f.close()
+ p = persist.Persist(testFile, {})
+ self.assertEqual(p.data, {})
+ os.unlink(testFile)
+
+ def testPersistValidation(self):
+ testFile = getTempFileName()
+ p = persist.Persist(testFile, {'test': 1})
+ p.commit()
+ p = persist.Persist(testFile, [], validator=lambda v: isinstance(v, list))
+ self.assertEqual(p.data, [])
+ os.unlink(testFile)
+
def pythonTestSuite(tests):
availableTests = (
- "testLinearAnim",
- "testLinearAnimZeroDuration",
- "testEaseInOutAnim",
- "testSplineAnim",
- "testContinuousAnim",
- "testWaitAnim",
- "testParallelAnim",
- "testStateAnim",
- "testDraggable",
"testRoundedRect",
"testPieSlice",
"testArc",
"testStateMachine",
+ "testStateMachineDiagram",
+ "testPersistStore",
+ "testPersistCorrupted",
+ "testPersistValidation",
)
return createAVGTestSuite(availableTests, PythonTestCase, tests)
-Player = avg.Player.get()
-anim.init(avg)
diff --git a/src/test/Test.py b/src/test/Test.py
index 929b398..4c4de8f 100755
--- a/src/test/Test.py
+++ b/src/test/Test.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# libavg - Media Playback Engine.
-# Copyright (C) 2003-2011 Ulrich von Zadow
+# 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
@@ -36,7 +36,7 @@ import atexit
def cleanup(folder):
if os.path.isdir(folder):
- print 'Wiping out directory: %s' % folder
+ sys.stderr.write('Wiping out directory: %s\n' % folder)
shutil.rmtree(folder)
def symtree(src, dest):
@@ -45,7 +45,7 @@ def symtree(src, dest):
fpath = os.path.join(src, f)
if (f and f[0] != '.' and
(os.path.isdir(fpath) or
- (os.path.isfile(fpath) and os.path.splitext(f)[1] == '.py'))):
+ (os.path.isfile(fpath) and os.path.splitext(f)[1] in ('.py', '.glsl')))):
os.symlink(os.path.join(os.pardir, src, f), os.path.join(dest, f))
@@ -65,18 +65,20 @@ if sys.platform != 'win32':
try:
symtree('../python', 'libavg')
+ os.symlink('../../graphics/shaders', 'libavg/shaders')
except OSError:
pass
else:
# Running make distcheck
symtree('../../../../src/python', 'libavg')
+ os.symlink('../../../../../src/graphics/shaders', 'libavg/shaders')
# distcheck doesn't want leftovers (.pyc files)
atexit.register(lambda tempPackageDir=tempPackageDir: cleanup(tempPackageDir))
if os.path.exists('../wrapper/.libs/avg.so'):
# Normal case: use the local version (not the installed one)
- os.symlink('../../wrapper/.libs/avg.so', 'libavg/avg.so')
+ shutil.copy2('../wrapper/.libs/avg.so', 'libavg/avg.so')
elif os.path.exists('../../avg.so'):
# Mac version after installer dmg
pass
@@ -91,13 +93,17 @@ if sys.platform != 'win32':
# Meaningful only for distcheck
os.chdir(srcDir)
- import libavg
- libavg.avg.Logger.get().trace(libavg.avg.Logger.APP, "Using libavg from: "+
- os.path.dirname(libavg.__file__))
+import libavg
+libavg.logger.configureCategory(libavg.Logger.Category.APP, libavg.Logger.Severity.INFO)
+libavg.logger.info("Using libavg from: "+ os.path.dirname(libavg.__file__),
+ libavg.Logger.Category.APP)
+# Ensure mouse is activated
+libavg.player.enableMouse(True)
+import testapp
+
+libavg.Player.get().keepWindowOpen()
-import testapp
-
import PluginTest
import PlayerTest
import OffscreenTest
@@ -112,7 +118,10 @@ import AnimTest
import EventTest
import InputDeviceTest
import AVGAppTest
-import UITest
+import WidgetTest
+import GestureTest
+import LoggerTest
+import AppTest
app = testapp.TestApp()
@@ -129,8 +138,11 @@ app.registerSuiteFactory('python', PythonTest.pythonTestSuite)
app.registerSuiteFactory('anim', AnimTest.animTestSuite)
app.registerSuiteFactory('event', EventTest.eventTestSuite)
app.registerSuiteFactory('inputdevice', InputDeviceTest.inputDeviceTestSuite)
-app.registerSuiteFactory('ui', UITest.uiTestSuite)
+app.registerSuiteFactory('widget', WidgetTest.widgetTestSuite)
+app.registerSuiteFactory('gesture', GestureTest.gestureTestSuite)
app.registerSuiteFactory('avgapp', AVGAppTest.avgAppTestSuite)
+app.registerSuiteFactory('logger', LoggerTest.loggerTestSuite)
+app.registerSuiteFactory('app', AppTest.appTestSuite)
app.run()
diff --git a/src/test/UITest.py b/src/test/UITest.py
deleted file mode 100644
index 18f6678..0000000
--- a/src/test/UITest.py
+++ /dev/null
@@ -1,1370 +0,0 @@
-# -*- coding: utf-8 -*-
-# libavg - Media Playback Engine.
-# Copyright (C) 2003-2011 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
-#
-
-from libavg import avg, textarea, ui
-
-import math
-from testcase import *
-
-class UITestCase(AVGTestCase):
- def __init__(self, testFuncName):
- AVGTestCase.__init__(self, testFuncName)
-
- def testKeyboard(self):
- def setup():
- keyDefs = [
- [("a", "A"), ( 5, 5), (30, 30)],
- [(1, ), (35, 5), (30, 30)],
- ["SHIFT", (65, 5), (50, 30)]]
- kbNoShift = ui.Keyboard("keyboard_bg.png", "keyboard_ovl.png", keyDefs, None,
- pos=(10, 10), parent = root)
- kbNoShift.setKeyHandler(onKeyDown, onKeyUp)
- kbShift = ui.Keyboard("keyboard_bg.png", "keyboard_ovl.png", keyDefs, "SHIFT",
- pos=(10, 60), parent = root)
- kbShift.setKeyHandler(onKeyDown, onKeyUp)
-
- def onKeyDown(event, char, cmd):
- self.__keyDown = True
- self.__keyUp = False
- self.__char = char
- self.__cmd = cmd
-
- def onKeyUp(event, char, cmd):
- self.__keyDown = False
- self.__keyUp = True
- self.__char = char
- self.__cmd = cmd
-
- root = self.loadEmptyScene()
-
- self.__keyDown = False
- self.__keyUp = True
- self.__char = "foo"
- self.__cmd = "bar"
- self.start((
- setup,
- lambda: self.compareImage("testUIKeyboard", False),
- # test character key
- lambda: self._sendMouseEvent(avg.CURSORDOWN, 30, 30),
- lambda: self.assert_(self.__keyDown and not self.__keyUp),
- lambda: self.assert_(self.__char == "a" and self.__cmd is None),
- lambda: self.compareImage("testUIKeyboardDownA1", False),
- lambda: self._sendMouseEvent(avg.CURSORUP, 30, 30),
- lambda: self.assert_(not self.__keyDown and self.__keyUp),
- lambda: self.assert_(self.__char == "a" and self.__cmd is None),
- lambda: self.compareImage("testUIKeyboard", False),
- # test command key
- lambda: self._sendMouseEvent(avg.CURSORDOWN, 100, 30),
- lambda: self.assert_(self.__keyDown and not self.__keyUp),
- lambda: self.assert_(self.__char is None and self.__cmd == "SHIFT"),
- lambda: self.compareImage("testUIKeyboardDownS1", False),
- lambda: self._sendMouseEvent(avg.CURSORUP, 100, 30),
- lambda: self.assert_(not self.__keyDown and self.__keyUp),
- lambda: self.assert_(self.__char is None and self.__cmd == "SHIFT"),
- lambda: self.compareImage("testUIKeyboard", False),
- # test shift key (no shift key support)
- lambda: self._sendTouchEvent(1, avg.CURSORDOWN, 100, 30),
- lambda: self._sendTouchEvent(2, avg.CURSORDOWN, 30, 30),
- lambda: self.assert_(self.__char == "a" and self.__cmd is None),
- lambda: self._sendTouchEvent(3, avg.CURSORDOWN, 60, 30),
- lambda: self.assert_(self.__char == 1 and self.__cmd is None),
- lambda: self.compareImage("testUIKeyboardDownA111S1", False),
- lambda: self._sendTouchEvent(2, avg.CURSORUP, 30, 30),
- lambda: self.assert_(self.__char == "a" and self.__cmd is None),
- lambda: self._sendTouchEvent(3, avg.CURSORUP, 60, 30),
- lambda: self.assert_(self.__char == 1 and self.__cmd is None),
- lambda: self._sendTouchEvent(1, avg.CURSORUP, 100, 30),
- lambda: self.compareImage("testUIKeyboard", False),
- # test shift key (with shift key support)
- lambda: self._sendTouchEvent(1, avg.CURSORDOWN, 100, 80),
- lambda: self._sendTouchEvent(2, avg.CURSORDOWN, 30, 80),
- lambda: self.assert_(self.__char == "A" and self.__cmd is None),
- lambda: self._sendTouchEvent(3, avg.CURSORDOWN, 60, 80),
- lambda: self.assert_(self.__char == 1 and self.__cmd is None),
- lambda: self.compareImage("testUIKeyboardDownA212S2", False),
- lambda: self._sendTouchEvent(2, avg.CURSORUP, 30, 80),
- lambda: self.assert_(self.__char == "A" and self.__cmd is None),
- lambda: self._sendTouchEvent(3, avg.CURSORUP, 60, 80),
- lambda: self.assert_(self.__char == 1 and self.__cmd is None),
- lambda: self._sendTouchEvent(1, avg.CURSORUP, 100, 80),
- lambda: self.compareImage("testUIKeyboard", False)
- ))
-
- def testTextArea(self):
- def setup():
- self.ta1 = textarea.TextArea(Player.getElementByID('ph1'), id='ta1')
- self.ta1.setStyle(font='Bitstream Vera Sans', variant='Roman',
- fontsize=16, multiline=True, color='FFFFFF')
- self.ta1.setText('Lorem ipsum')
- self.ta1.setFocus(True) # TODO: REMOVE
-
- self.ta2 = textarea.TextArea(Player.getElementByID('ph2'), id='ta2')
- self.ta2.setStyle(font='Bitstream Vera Sans', variant='Roman',
- fontsize=14, multiline=False, color='FFFFFF')
- self.ta2.setText('sit dolor')
- self.ta2.setFocus(True) # TODO: REMOVE
-
- def setAndCheck(ta, text):
- ta.setText(text)
- self.assertEqual(ta.getText(), text)
-
- def clear(ta):
- ta.onKeyDown(textarea.KEYCODE_FORMFEED)
- self.assertEqual(ta.getText(), '')
-
- def testUnicode():
- self.ta1.setText(u'some ùnìcöde')
- self.ta1.onKeyDown(textarea.KEYCODES_BACKSPACE[0])
- self.assertEqual(self.ta1.getText(), u'some ùnìcöd')
- self.ta1.onKeyDown(textarea.KEYCODES_BACKSPACE[1])
- self.ta1.onKeyDown(textarea.KEYCODES_BACKSPACE[0])
- self.assertEqual(self.ta1.getText(), u'some ùnìc')
- self.ta1.onKeyDown(ord(u'Ä'))
- self.assertEqual(self.ta1.getText(), u'some ùnìcÄ')
-
- def testSpecialChars():
- clear(self.ta1)
- self.ta1.onKeyDown(ord(u'&'))
- self.ta1.onKeyDown(textarea.KEYCODES_BACKSPACE[0])
- self.assertEqual(self.ta1.getText(), '')
-
- def checkSingleLine():
- text = ''
- self.ta2.setText('')
- while True:
- self.assert_(len(text) < 20)
- self.ta2.onKeyDown(ord(u'A'))
- text = text + 'A'
- if text != self.ta2.getText():
- self.assertEqual(len(text), 16)
- break
-
- root = self.loadEmptyScene()
- avg.DivNode(id="ph1", pos=(2,2), size=(156, 96), parent=root)
- avg.DivNode(id="ph2", pos=(2,100), size=(156, 18), parent=root)
-
- textarea.init(avg, False)
- self.start((
- setup,
- lambda: self.assertEqual(self.ta1.getText(), 'Lorem ipsum'),
- lambda: setAndCheck(self.ta1, ''),
- lambda: setAndCheck(self.ta2, 'Lorem Ipsum'),
- testUnicode,
- lambda: self.compareImage("testTextArea1", True),
- testSpecialChars,
- checkSingleLine,
- lambda: self.compareImage("testTextArea2", True),
- ))
-
-
- def testTapRecognizer(self):
-
- def onPossible(event):
- self.__possible = True
-
- def onDetected(event):
- self.__detected = True
-
- def onFail(event):
- self.__failed = True
-
- def initState():
- self.__possible = False
- self.__detected = False
- self.__failed = False
-
- def assertEvents(possible, detected, failed):
-# print (self.__possible, self.__detected, self.__failed)
- self.assert_(self.__possible == possible and
- self.__detected == detected and
- self.__failed == failed)
-
- root = self.loadEmptyScene()
- image = avg.ImageNode(parent=root, href="rgb24-64x64.png")
- self.__tapRecognizer = ui.TapRecognizer(image,
- possibleHandler=onPossible,
- detectedHandler=onDetected,
- failHandler=onFail)
- initState()
- Player.setFakeFPS(10)
- self.start((
- # Down-up: recognized as tap.
- lambda: self._sendMouseEvent(avg.CURSORDOWN, 30, 30),
- lambda: assertEvents(True, False, False),
- lambda: self._sendMouseEvent(avg.CURSORUP, 30, 30),
- lambda: assertEvents(True, True, False),
- # Down-small move-up: recognized as tap.
- initState,
- lambda: self._sendMouseEvent(avg.CURSORDOWN, 30, 30),
- lambda: self._sendMouseEvent(avg.CURSORMOTION, 31, 30),
- lambda: assertEvents(True, False, False),
- lambda: self._sendMouseEvent(avg.CURSORUP, 30, 30),
- lambda: assertEvents(True, True, False),
- # Down-big move-up: fail
- initState,
- lambda: self._sendMouseEvent(avg.CURSORDOWN, 1, 1),
- lambda: self._sendMouseEvent(avg.CURSORMOTION, 150, 50),
- lambda: assertEvents(True, False, True),
- lambda: self._sendMouseEvent(avg.CURSORUP, 1, 1),
- lambda: assertEvents(True, False, True),
- # Down-delay: fail
- lambda: self._sendMouseEvent(avg.CURSORDOWN, 30, 30),
- lambda: self.delay(600),
- lambda: assertEvents(True, False, True),
- lambda: self._sendMouseEvent(avg.CURSORUP, 30, 30),
- lambda: assertEvents(True, False, True),
- ))
-
-
- def testHoldRecognizer(self):
-
- def onPossible(event):
- self.__possible = True
-
- def onDetected(event):
- self.__detected = True
-
- def onFail(event):
- self.__failed = True
-
- def onStop(event):
- self.__stopped = True
-
- def initState():
- self.__possible = False
- self.__detected = False
- self.__failed = False
- self.__stopped = False
-
- def assertEvents(possible, detected, failed, stopped):
-# print (self.__possible, self.__detected, self.__failed, self.__stopped)
- self.assert_(self.__possible == possible and
- self.__detected == detected and
- self.__failed == failed and
- self.__stopped == stopped)
-
- Player.setFakeFPS(2)
- root = self.loadEmptyScene()
- image = avg.ImageNode(parent=root, href="rgb24-64x64.png")
- self.__holdRecognizer = ui.HoldRecognizer(image,
- delay=1000,
- possibleHandler=onPossible,
- detectedHandler=onDetected,
- failHandler=onFail,
- stopHandler=onStop)
- initState()
- self.start((
- # Standard down-hold-up sequence.
- lambda: self._sendMouseEvent(avg.CURSORDOWN, 30, 30),
- lambda: assertEvents(True, False, False, False),
- None,
- lambda: assertEvents(True, True, False, False),
- None,
- lambda: self._sendMouseEvent(avg.CURSORUP, 30, 30),
- lambda: assertEvents(True, True, False, True),
-
- # down-up sequence, hold not long enough.
- initState,
- lambda: self._sendMouseEvent(avg.CURSORDOWN, 30, 30),
- lambda: self._sendMouseEvent(avg.CURSORUP, 30, 30),
- lambda: assertEvents(True, False, True, False),
-
- # down-move-up sequence, should abort.
- initState,
- lambda: self._sendMouseEvent(avg.CURSORDOWN, 1, 1),
- lambda: self._sendMouseEvent(avg.CURSORMOTION, 150, 50),
- lambda: assertEvents(True, False, True, False),
- lambda: self._sendMouseEvent(avg.CURSORUP, 150, 50),
- lambda: assertEvents(True, False, True, False),
- ))
- Player.setFakeFPS(-1)
-
-
- def testDoubletapRecognizer(self):
-
- def onPossible(event):
- self.__possible = True
-
- def onDetected(event):
- self.__detected = True
-
- def onFail(event):
- self.__failed = True
-
- def initState():
- self.__possible = False
- self.__detected = False
- self.__failed = False
-
- def assertEvents(possible, detected, failed):
- self.assert_(self.__possible == possible and
- self.__detected == detected and
- self.__failed == failed)
-
- root = self.loadEmptyScene()
- image = avg.ImageNode(parent=root, href="rgb24-64x64.png", size=(128,128))
- self.__tapRecognizer = ui.DoubletapRecognizer(image,
- possibleHandler=onPossible,
- detectedHandler=onDetected,
- failHandler=onFail)
- initState()
- Player.setFakeFPS(10)
- self.start((
- # Down, up, down, up: click
- lambda: self._sendMouseEvent(avg.CURSORDOWN, 30, 30),
- lambda: assertEvents(True, False, False),
- lambda: self._sendMouseEvent(avg.CURSORUP, 30, 30),
- lambda: assertEvents(True, False, False),
- lambda: self._sendMouseEvent(avg.CURSORDOWN, 30, 30),
- lambda: assertEvents(True, False, False),
- lambda: self._sendMouseEvent(avg.CURSORUP, 30, 30),
- lambda: assertEvents(True, True, False),
- # Down, move: abort
- initState,
- lambda: self._sendMouseEvent(avg.CURSORDOWN, 0, 30),
- lambda: self._sendMouseEvent(avg.CURSORMOTION, 80, 30),
- lambda: assertEvents(True, False, True),
- lambda: self._sendMouseEvent(avg.CURSORUP, 0, 30),
- lambda: assertEvents(True, False, True),
- # Down, up, move: abort
- initState,
- lambda: self._sendMouseEvent(avg.CURSORDOWN, 0, 30),
- lambda: self._sendMouseEvent(avg.CURSORUP, 0, 30),
- lambda: self._sendMouseEvent(avg.CURSORMOTION, 80, 30),
- lambda: self._sendMouseEvent(avg.CURSORDOWN, 80, 30),
- lambda: assertEvents(True, False, True),
- lambda: self._sendMouseEvent(avg.CURSORUP, 0, 30),
- lambda: assertEvents(True, False, True),
- # Down, up, down, move: abort
- initState,
- lambda: self._sendMouseEvent(avg.CURSORDOWN, 0, 30),
- lambda: self._sendMouseEvent(avg.CURSORUP, 0, 30),
- lambda: self._sendMouseEvent(avg.CURSORDOWN, 0, 30),
- lambda: self._sendMouseEvent(avg.CURSORMOTION, 80, 30),
- lambda: assertEvents(True, False, True),
- lambda: self._sendMouseEvent(avg.CURSORUP, 0, 30),
- lambda: assertEvents(True, False, True),
- # Down,delay: abort
- lambda: self._sendMouseEvent(avg.CURSORDOWN, 30, 30),
- lambda: self.delay(600),
- lambda: assertEvents(True, False, True),
- lambda: self._sendMouseEvent(avg.CURSORUP, 30, 30),
- lambda: assertEvents(True, False, True),
- # Down, up, delay: abort
- lambda: self._sendMouseEvent(avg.CURSORDOWN, 30, 30),
- lambda: self._sendMouseEvent(avg.CURSORUP, 30, 30),
- lambda: self.delay(600),
- lambda: assertEvents(True, False, True),
- # Down, up, down, delay: abort
- lambda: self._sendMouseEvent(avg.CURSORDOWN, 30, 30),
- lambda: self._sendMouseEvent(avg.CURSORUP, 30, 30),
- lambda: self._sendMouseEvent(avg.CURSORDOWN, 30, 30),
- lambda: self.delay(600),
- lambda: assertEvents(True, False, True),
- lambda: self._sendMouseEvent(avg.CURSORUP, 30, 30),
- ))
-
-
- def testDragRecognizer(self):
-
- def onDetected(event):
- self.__detected = True
-
- def onMove(event, offset):
- if self.friction == -1:
- self.assertEqual(offset, (40,40))
- self.__moved = True
-
- def onUp(event, offset):
- if self.friction == -1:
- self.assertEqual(offset, (10,-10))
- self.__up = True
-
- def onEnd(event):
- self.__ended = True
-
- def disable():
- dragRecognizer.enable(False)
- initState()
-
- def initState():
- self.__detected = False
- self.__moved = False
- self.__up = False
- self.__ended = False
-
- self.__possible = False
- self.__failed = False
-
- def assertDragEvents(detected, moved, up, ended, possible=False, failed=False):
-# print (self.__detected, self.__moved, self.__up,
-# self.__ended, self.__possible, self.__failed)
- self.assert_(self.__detected == detected and self.__moved == moved and
- self.__up == up and self.__ended == ended and
- self.__possible == possible and self.__failed == failed)
-
- Player.setFakeFPS(100)
- for self.friction in (-1, 100):
- root = self.loadEmptyScene()
- image = avg.ImageNode(parent=root, href="rgb24-64x64.png")
- dragRecognizer = ui.DragRecognizer(image,
- detectedHandler=onDetected, moveHandler=onMove, upHandler=onUp,
- endHandler=onEnd, friction=self.friction)
- initState()
- self.start((
- lambda: self._sendMouseEvent(avg.CURSORDOWN, 30, 30),
- lambda: assertDragEvents(True, False, False, False),
- lambda: self._sendMouseEvent(avg.CURSORMOTION, 70, 70),
- lambda: assertDragEvents(True, True, False, False),
- lambda: self._sendMouseEvent(avg.CURSORUP, 40, 20),
- lambda: assertDragEvents(True, True, True, True),
- disable,
- lambda: self._sendMouseEvent(avg.CURSORDOWN, 30, 30),
- lambda: assertDragEvents(False, False, False, False),
- lambda: dragRecognizer.enable(True),
- lambda: self._sendMouseEvent(avg.CURSORUP, 30, 30),
- lambda: self._sendMouseEvent(avg.CURSORDOWN, 30, 30),
- lambda: assertDragEvents(True, False, False, False),
- ))
-
- # Test with constraint.
- def onPossible(event):
- self.__possible = True
-
- def onFail(event):
- self.__failed = True
-
- def onVertMove(event, offset):
- if self.friction == -1:
- self.assertEqual(offset, (0,40))
- self.__moved = True
-
- for friction in (-1, 100):
- root = self.loadEmptyScene()
- image = avg.ImageNode(parent=root, href="rgb24-64x64.png")
- dragRecognizer = ui.DragRecognizer(image,
- possibleHandler=onPossible, failHandler=onFail,
- detectedHandler=onDetected,
- moveHandler=onVertMove, upHandler=onUp, endHandler=onEnd,
- friction=self.friction, direction=ui.DragRecognizer.VERTICAL)
- initState()
- self.start((
- lambda: self._sendMouseEvent(avg.CURSORDOWN, 30, 30),
- lambda: assertDragEvents(False, False, False, False, True, False),
- lambda: self._sendMouseEvent(avg.CURSORMOTION, 35, 30),
- lambda: assertDragEvents(False, False, False, False, True, False),
- lambda: self._sendMouseEvent(avg.CURSORMOTION, 30, 70),
- lambda: assertDragEvents(True, True, False, False, True, False),
- lambda: self._sendMouseEvent(avg.CURSORUP, 40, 20),
- lambda: assertDragEvents(True, True, True, True, True, False),
- initState,
- # Wrong direction -> abort.
- lambda: self._sendMouseEvent(avg.CURSORDOWN, 30, 30),
- lambda: self._sendMouseEvent(avg.CURSORMOTION, 70, 30),
- lambda: assertDragEvents(False, False, False, False, True, True),
- lambda: self._sendMouseEvent(avg.CURSORUP, 70, 30),
- lambda: assertDragEvents(False, False, False, False, True, True),
-
- # No movement -> abort.
- lambda: self._sendMouseEvent(avg.CURSORDOWN, 30, 30),
- lambda: self._sendMouseEvent(avg.CURSORUP, 30, 30),
- lambda: assertDragEvents(False, False, False, False, True, True),
- ))
-
- Player.setFakeFPS(-1)
-
-
- def testDragRecognizerRelCoords(self):
-
- def onDrag(event, offset):
- self.assertAlmostEqual(offset, (-40,-40))
-
- Player.setFakeFPS(100)
- for self.friction in (-1, 100):
- root = self.loadEmptyScene()
- div = avg.DivNode(pos=(64,64), angle=math.pi, parent=root)
- image = avg.ImageNode(parent=div, href="rgb24-64x64.png")
- ui.DragRecognizer(image, moveHandler=onDrag, friction=self.friction)
- self.start((
- lambda: self._sendMouseEvent(avg.CURSORDOWN, 30, 30),
- lambda: self._sendMouseEvent(avg.CURSORMOTION, 70, 70),
- ))
- Player.setFakeFPS(-1)
-
-
- def testDragRecognizerInitialEvent(self):
-
- def onMotion(event):
- ui.DragRecognizer(self.image,
- detectedHandler=onDragStart, moveHandler=onDrag, initialEvent=event)
- self.image.disconnectEventHandler(self)
-
- def onDragStart(event):
- self.__dragStartCalled = True
-
- def onDrag(event, offset):
- self.assertEqual(offset, (10,0))
-
- root = self.loadEmptyScene()
- self.image = avg.ImageNode(parent=root, href="rgb24-64x64.png")
- self.image.connectEventHandler(avg.CURSORMOTION, avg.MOUSE, self, onMotion)
- self.__dragStartCalled = False
- self.start((
- lambda: self._sendMouseEvent(avg.CURSORDOWN, 30, 30),
- lambda: self._sendMouseEvent(avg.CURSORMOTION, 40, 30),
- lambda: self._sendMouseEvent(avg.CURSORMOTION, 50, 30),
- ))
- assert(self.__dragStartCalled)
-
-
- def testDragRecognizerCoordSysNode(self):
-
- def onDrag(event, offset):
- self.assertEqual(offset, (40,40))
-
- root = self.loadEmptyScene()
- div = avg.DivNode(pos=(64,64), angle=math.pi, parent=root)
- image = avg.ImageNode(parent=div, href="rgb24-64x64.png")
- ui.DragRecognizer(image, moveHandler=onDrag, coordSysNode=div, friction=-1)
- self.start((
- lambda: self._sendMouseEvent(avg.CURSORDOWN, 30, 30),
- lambda: self._sendMouseEvent(avg.CURSORMOTION, 70, 70),
- ))
-
-
- def testTransformRecognizer(self):
-
- def onDetected(event):
- pass
-
- def onMove(transform):
- self.transform = transform
-
- def onUp(transform):
- self.transform = transform
-
- def checkTransform(expectedTransform):
-# print self.transform
-# print expectedTransform
-# print
- self.assertAlmostEqual(self.transform.trans, expectedTransform.trans)
- self.assertAlmostEqual(self.transform.rot, expectedTransform.rot)
- self.assertAlmostEqual(self.transform.scale, expectedTransform.scale)
- if expectedTransform.rot != 0 or expectedTransform.scale != 1:
- self.assertAlmostEqual(self.transform.pivot, expectedTransform.pivot)
-
- def createTransTestFrames():
- return (
- lambda: self._sendTouchEvent(1, avg.CURSORDOWN, 10, 10),
- lambda: self._sendTouchEvent(1, avg.CURSORUP, 20, 10),
- lambda: checkTransform(ui.Transform((10,0))),
- )
-
- def createRotTestFrames(expectedTransform):
- return (
- lambda: self._sendTouchEvents((
- (1, avg.CURSORDOWN, 0, 10),
- (2, avg.CURSORDOWN, 0, 20))),
- lambda: self._sendTouchEvents((
- (1, avg.CURSORMOTION, 0, 20),
- (2, avg.CURSORMOTION, 0, 10))),
- lambda: checkTransform(expectedTransform),
- lambda: self._sendTouchEvents((
- (1, avg.CURSORUP, 0, 20),
- (2, avg.CURSORUP, 0, 10))),
- )
-
- def createScaleTestFrames(expectedTransform):
- return (
- lambda: self._sendTouchEvent(1, avg.CURSORDOWN, 0, 10),
- lambda: self._sendTouchEvent(2, avg.CURSORDOWN, 0, 20),
- lambda: self._sendTouchEvent(1, avg.CURSORMOTION, 0, 10),
- lambda: self._sendTouchEvent(2, avg.CURSORMOTION, 0, 30),
- lambda: checkTransform(expectedTransform),
- lambda: self._sendTouchEvent(1, avg.CURSORUP, 0, 10),
- lambda: self._sendTouchEvent(2, avg.CURSORUP, 0, 30),
- )
-
- root = self.loadEmptyScene()
- image = avg.ImageNode(parent=root, href="rgb24-64x64.png")
- self.__transformRecognizer = ui.TransformRecognizer(image,
- detectedHandler=onDetected, moveHandler=onMove, upHandler=onUp)
- self.start((
- # Check up/down handling
- lambda: self._sendTouchEvent(1, avg.CURSORDOWN, 10, 10),
- lambda: checkTransform(ui.Transform((0,0))),
- lambda: self._sendTouchEvent(1, avg.CURSORMOTION, 20, 10),
- lambda: checkTransform(ui.Transform((10,0))),
- lambda: self._sendTouchEvent(2, avg.CURSORDOWN, 20, 20),
- lambda: checkTransform(ui.Transform((0,0))),
- lambda: self._sendTouchEvents((
- (1, avg.CURSORMOTION, 30, 10),
- (2, avg.CURSORMOTION, 30, 20))),
- lambda: checkTransform(ui.Transform((10,0))),
- lambda: self._sendTouchEvent(2, avg.CURSORUP, 30, 20),
- lambda: checkTransform(ui.Transform((0,0))),
- lambda: self._sendTouchEvent(1, avg.CURSORMOTION, 40, 10),
- lambda: checkTransform(ui.Transform((10,0))),
- lambda: self._sendTouchEvent(1, avg.CURSORUP, 50, 10),
- lambda: checkTransform(ui.Transform((10,0))),
-
- createRotTestFrames(ui.Transform((0,0), math.pi, 1, (0,15))),
-
- createScaleTestFrames(ui.Transform((0,5), 0, 2, (0,20)))
- ))
-
- # Test rel. coords.
- root = self.loadEmptyScene()
- div = avg.DivNode(parent=root, pos=(0,10))
- image = avg.ImageNode(parent=div, href="rgb24-64x64.png")
- self.__transformRecognizer = ui.TransformRecognizer(image,
- detectedHandler=onDetected, moveHandler=onMove, upHandler=onUp)
- self.start((
- createTransTestFrames(),
- createRotTestFrames(ui.Transform((0,0), math.pi, 1, (0,5))),
- createScaleTestFrames(ui.Transform((0,5), 0, 2, (0,10))),
- ))
-
- # Test coordSysNode.
- root = self.loadEmptyScene()
- div = avg.DivNode(parent=root, pos=(0,10))
- image = avg.ImageNode(parent=div, href="rgb24-64x64.png")
- self.__transformRecognizer = ui.TransformRecognizer(image, coordSysNode=div,
- detectedHandler=onDetected, moveHandler=onMove, upHandler=onUp)
- self.start((
- createTransTestFrames(),
- createRotTestFrames(ui.Transform((0,0), math.pi, 1, (0,15))),
- createScaleTestFrames(ui.Transform((0,5), 0, 2, (0,20))),
- ))
-
-
- def testKMeans(self):
- pts = [avg.Point2D(0,0), avg.Point2D(0,1)]
- means = ui.calcKMeans(pts)
- self.assertEqual(means, ([0], [1]))
-
- pts.append (avg.Point2D(0,4))
- means = ui.calcKMeans(pts)
- self.assertEqual(means, ([0,1], [2]))
-
-
- def testMat3x3(self):
- t = ui.Mat3x3.translate([1,0,1])
- v = [1,0,1]
- self.assertEqual(t.applyVec(v), [2,0,1])
- r = ui.Mat3x3.rotate(math.pi/2)
- self.assertAlmostEqual(r.applyVec(v), [0,1,1])
- t2 = t.applyMat(t)
- self.assertAlmostEqual(t.applyMat(t).m, ui.Mat3x3.translate([2,0,1]).m)
- self.assertAlmostEqual(t.applyMat(r).m, ui.Mat3x3([0,-1,1],[1,0,0]).m)
- self.assertAlmostEqual(r.applyMat(t).m, ui.Mat3x3([0,-1,0],[1,0,1]).m)
- self.assertAlmostEqual(ui.Mat3x3().m, ui.Mat3x3().inverse().m)
- m = ui.Mat3x3([-1, 3, -3],
- [ 0, -6, 5],
- [-5, -3, 1])
- im = ui.Mat3x3([3./2, 1., -1./2],
- [-25./6, -8./3, 5./6],
- [-5., -3., 1.])
- self.assertAlmostEqual(m.inverse().m, im.m)
-
- image = avg.ImageNode(pos=(10,20), size=(30,40), angle=1.57,
- href="rgb24alpha-64x64.png")
- mat = ui.Mat3x3.fromNode(image)
- mat.setNodeTransform(image)
- self.assertAlmostEqual(image.pos, (10,20))
- self.assertAlmostEqual(image.size, (30,40))
- self.assertAlmostEqual(image.angle, 1.57)
-
-
- def testFocusContext(self):
- def setup():
- textarea.init(avg)
- self.ctx1 = textarea.FocusContext()
- self.ctx2 = textarea.FocusContext()
-
- self.ta1 = textarea.TextArea(Player.getElementByID('ph1'),
- self.ctx1, id='ta1')
- self.ta1.setStyle(font='Bitstream Vera Sans', variant='Roman',
- fontsize=16, multiline=True, color='FFFFFF')
- self.ta1.setText('Lorem ipsum')
-
- self.ta2 = textarea.TextArea(Player.getElementByID('ph2'),
- self.ctx1, id='ta2')
- self.ta2.setStyle(font='Bitstream Vera Sans', variant='Roman',
- fontsize=14, multiline=False, color='FFFFFF')
- self.ta2.setText('dolor')
-
- self.ta3 = textarea.TextArea(Player.getElementByID('ph3'),
- self.ctx2, disableMouseFocus=True, id='ta3')
- self.ta3.setStyle(font='Bitstream Vera Sans', variant='Roman',
- fontsize=14, multiline=True, color='FFFFFF')
- self.ta3.setText('dolor sit amet')
-
- textarea.setActiveFocusContext(self.ctx1)
-
- def writeChar():
- helper = Player.getTestHelper()
- helper.fakeKeyEvent(avg.KEYDOWN, 65, 65, "A", 65, 0)
- helper.fakeKeyEvent(avg.KEYUP, 65, 65, "A", 65, 0)
- helper.fakeKeyEvent(avg.KEYDOWN, 66, 66, "B", 66, 0)
- helper.fakeKeyEvent(avg.KEYUP, 66, 66, "B", 66, 0)
- helper.fakeKeyEvent(avg.KEYDOWN, 67, 67, "C", 67, 0)
- helper.fakeKeyEvent(avg.KEYUP, 67, 67, "C", 67, 0)
-
- def switchFocus():
- self.ctx1.cycleFocus()
-
- def clearFocused():
- self.ctx1.clear()
-
- def clickForFocus():
- self._sendMouseEvent(avg.CURSORDOWN, 20, 70)
- self._sendMouseEvent(avg.CURSORUP, 20, 70)
-
- root = self.loadEmptyScene()
- avg.DivNode(id="ph1", pos=(2,2), size=(156,54), parent=root)
- avg.DivNode(id="ph2", pos=(2,58), size=(76,54), parent=root)
- div3 = avg.DivNode(id="ph3", pos=(80,58), size=(76,54), parent=root)
- avg.ImageNode(href="1x1_white.png", size=(76,54), parent=div3)
- self.start((
- setup,
- lambda: self.compareImage("testFocusContext1", True),
- writeChar,
- lambda: self.compareImage("testFocusContext2", True),
- switchFocus,
- writeChar,
- lambda: self.compareImage("testFocusContext3", True),
- switchFocus,
- clearFocused,
- lambda: self.compareImage("testFocusContext4", True),
- clickForFocus,
- clearFocused,
- lambda: self.compareImage("testFocusContext5", True),
- ))
-
- def testButton(self):
- def onDown(event):
- self.__down = True
-
- def onClick(event):
- self.__clicked = True
-
- def reset():
- self.__down = False
- self.__clicked = False
-
- def printAddress(obj):
- print obj
-
- def setObjectActive(obj, active):
- obj.active = active
-
- root = self.loadEmptyScene()
-
- b = ui.Button(
- parent = root,
- upNode = avg.ImageNode(href="button_up.png"),
- downNode = avg.ImageNode(href="button_down.png"),
- disabledNode = avg.ImageNode(href="button_disabled.png"),
- pressHandler = onDown,
- clickHandler = onClick)
-
- b1 = ui.Button(parent=root,
- active=False,
- pressHandler=onDown,
- clickHandler=onClick)
-
- b.pos = (0, 0)
- yOutDistance = int(b.height * 2)
-
- self.__down = False
- self.__clicked = False
-
- self.start((
- # Normal click: Down & up over button
- lambda: self.compareImage("testUIButtonUp", False),
- lambda: self._sendMouseEvent(avg.CURSORDOWN, 0, 0),
- lambda: self.compareImage("testUIButtonDown", False),
- lambda: self.assert_(self.__down and not(self.__clicked)),
- lambda: self._sendMouseEvent(avg.CURSORUP, 0, 0),
- lambda: self.compareImage("testUIButtonUp", False),
- lambda: self.assert_(self.__clicked),
- reset,
-
- # Down, move away from button, move over button, up
- # ==> click
- lambda: self._sendMouseEvent(avg.CURSORDOWN, 0, 0),
- lambda: self._sendMouseEvent(avg.CURSORMOTION, 0, yOutDistance),
- lambda: self.compareImage("testUIButtonUp", False),
- lambda: self._sendMouseEvent(avg.CURSORMOTION, 0, 0),
- lambda: self.compareImage("testUIButtonDown", False),
- lambda: self._sendMouseEvent(avg.CURSORUP, 0, 0),
- lambda: self.assert_(self.__down and self.__clicked),
- reset,
-
- # Down, move away from button, up ==> no click
- lambda: self._sendMouseEvent(avg.CURSORDOWN, 0, 0),
- lambda: self.compareImage("testUIButtonDown", False),
- lambda: self._sendMouseEvent(avg.CURSORMOTION, 0, yOutDistance),
- lambda: self.compareImage("testUIButtonUp", False),
- lambda: self._sendMouseEvent(avg.CURSORUP, 0, yOutDistance),
- lambda: self.assert_(self.__down and not(self.__clicked)),
- reset,
-
- # Move away from button, down, mover over button, up
- # ==> no click
- lambda: self._sendMouseEvent(avg.CURSORDOWN, 0, yOutDistance),
- lambda: self._sendMouseEvent(avg.CURSORMOTION, 0, 0),
- lambda: self.compareImage("testUIButtonUp", False),
- lambda: self._sendMouseEvent(avg.CURSORUP, 0, 0),
- lambda: self.compareImage("testUIButtonUp", False),
- lambda: self.assert_(not(self.__down) and not(self.__clicked)),
- reset,
-
- # Move away from button, down, mover over button, move away from button, up
- # ==> no click
- lambda: self._sendMouseEvent(avg.CURSORDOWN, 0, yOutDistance),
- lambda: self._sendMouseEvent(avg.CURSORMOTION, 0, 0),
- lambda: self.compareImage("testUIButtonUp", False),
- lambda: self._sendMouseEvent(avg.CURSORMOTION, 0, yOutDistance),
- lambda: self.compareImage("testUIButtonUp", False),
- lambda: self._sendMouseEvent(avg.CURSORUP, 0, yOutDistance),
- lambda: self.assert_(not(self.__down) and not(self.__clicked)),
- reset,
-
- # Check checkable button
- # Set checkable, down, up => pressed, down, up ==> click
- lambda: b.setCheckable(True),
- lambda: self.compareImage("testUIButtonUp", False),
- lambda: self._sendMouseEvent(avg.CURSORDOWN, 0, 0),
- lambda: self.assert_(self.__down and not(self.__clicked)),
- lambda: self.compareImage("testUIButtonDown", False),
- lambda: self._sendMouseEvent(avg.CURSORUP, 0, 0),
- lambda: self.compareImage("testUIButtonDown", False),
- lambda: self.assert_(self.__down and self.__clicked),
- reset,
- lambda: self._sendMouseEvent(avg.CURSORDOWN, 0, 0),
- lambda: self.compareImage("testUIButtonDown", False),
- lambda: self._sendMouseEvent(avg.CURSORUP, 0, 0),
- lambda: self.compareImage("testUIButtonUp", False),
- lambda: self.assert_(self.__down and self.__clicked),
- reset,
-
- # not checked, down, out, in, up ==> pressed, click
- lambda: b.setCheckable(True),
- lambda: b.setChecked(False),
- lambda: self.compareImage("testUIButtonUp", False),
- lambda: self._sendMouseEvent(avg.CURSORDOWN, 0, 0),
- lambda: self.assert_(self.__down and not(self.__clicked)),
- lambda: self.compareImage("testUIButtonDown", False),
- lambda: self._sendMouseEvent(avg.CURSORMOTION, 0, yOutDistance),
- lambda: self.compareImage("testUIButtonUp", False),
- lambda: self._sendMouseEvent(avg.CURSORMOTION, 0, 0),
- lambda: self.compareImage("testUIButtonDown", False),
- lambda: self._sendMouseEvent(avg.CURSORUP, 0, 0),
- lambda: self.compareImage("testUIButtonDown", False),
- lambda: self.assert_(self.__down and self.__clicked),
- reset,
-
- # not checked, down, out, up ==> pressed, no click
- lambda: b.setCheckable(True),
- lambda: b.setChecked(False),
- lambda: self.compareImage("testUIButtonUp", False),
- lambda: self._sendMouseEvent(avg.CURSORDOWN, 0, 0),
- lambda: self.assert_(self.__down and not(self.__clicked)),
- lambda: self.compareImage("testUIButtonDown", False),
- lambda: self._sendMouseEvent(avg.CURSORMOTION, 0, yOutDistance),
- lambda: self.compareImage("testUIButtonUp", False),
- lambda: self._sendMouseEvent(avg.CURSORUP, 0, yOutDistance),
- lambda: self.compareImage("testUIButtonUp", False),
- lambda: self.assert_(self.__down and not(self.__clicked)),
- reset,
-
- # not checked, down, out, up ==> pressed, no click
- lambda: b.setCheckable(True),
- lambda: b.setChecked(True),
- lambda: self.compareImage("testUIButtonDown", False),
- lambda: self._sendMouseEvent(avg.CURSORDOWN, 0, 0),
- lambda: self.assert_(self.__down and not(self.__clicked)),
- lambda: self.compareImage("testUIButtonDown", False),
- lambda: self._sendMouseEvent(avg.CURSORMOTION, 0, yOutDistance),
- lambda: self.compareImage("testUIButtonDown", False),
- lambda: self._sendMouseEvent(avg.CURSORUP, 0, yOutDistance),
- lambda: self.compareImage("testUIButtonDown", False),
- lambda: self.assert_(self.__down and not(self.__clicked)),
- reset,
-
- # checked, down, out, in, up ==> pressed, clicked
- lambda: b.setCheckable(True),
- lambda: b.setChecked(True),
- lambda: self.compareImage("testUIButtonDown", False),
- lambda: self._sendMouseEvent(avg.CURSORDOWN, 0, 0),
- lambda: self.assert_(self.__down),
- lambda: self.compareImage("testUIButtonDown", False),
- lambda: self._sendMouseEvent(avg.CURSORMOTION, 0, yOutDistance),
- lambda: self.compareImage("testUIButtonDown", False),
- lambda: self._sendMouseEvent(avg.CURSORMOTION, 0, 0),
- lambda: self.compareImage("testUIButtonDown", False),
- lambda: self._sendMouseEvent(avg.CURSORUP, 0, 0),
- lambda: self.compareImage("testUIButtonUp", False),
- lambda: self.assert_(self.__down and self.__clicked),
- reset,
-
- # Test public interface
- lambda: b.setCheckable(False),
- lambda: self.compareImage("testUIButtonUp", False),
- lambda: self.assert_(b.isEnabled()),
- lambda: self.assert_(not(b.isCheckable())),
- lambda: b.setCheckable(True),
- lambda: self.assert_(b.isCheckable()),
- lambda: b.setChecked(True),
- lambda: self.assert_(b.isChecked()),
- lambda: b.setEnabled(False),
- lambda: self.assert_(not(b.isEnabled())),
- lambda: self.assert_(not(self.__down) and not(self.__clicked)),
- lambda: b.setEnabled(True),
- lambda: b.setChecked(False),
- reset,
-
- # Disable: Various up/down combinations have no effect
- lambda: b.setEnabled(False),
- lambda: self._sendMouseEvent(avg.CURSORDOWN, 0, 0),
- lambda: self._sendMouseEvent(avg.CURSORUP, 0, 0),
- lambda: self.compareImage("testUIButtonDisabled", False),
- lambda: self.assert_(not(self.__down) and not(self.__clicked)),
- lambda: self._sendMouseEvent(avg.CURSORDOWN, 0, 0),
- lambda: self.compareImage("testUIButtonDisabled", False),
- lambda: self._sendMouseEvent(avg.CURSORUP, 0, 0),
- lambda: self.compareImage("testUIButtonDisabled", False),
- lambda: self.assert_(not(self.__down) and not(self.__clicked)),
- lambda: self._sendMouseEvent(avg.CURSORDOWN, 0, 0),
- lambda: self.compareImage("testUIButtonDisabled", False),
- lambda: b.setEnabled(True),
- lambda: self._sendMouseEvent(avg.CURSORUP, 0, 0),
- lambda: self.compareImage("testUIButtonUp", False),
- lambda: self.assert_(not(self.__down)),
- lambda: self.assert_(not(self.__clicked)),
- reset,
-
- # Checking functionality while resetting the visible nodes
- lambda: b.setNodes(upNode = avg.ImageNode(href="button_up.png"),
- downNode = avg.ImageNode(href="button_down.png"),
- disabledNode = avg.ImageNode(href="button_disabled.png")),
- lambda: self.compareImage("testUIButtonUp", False),
- lambda: self._sendMouseEvent(avg.CURSORDOWN, 0, 0),
- lambda: self._sendMouseEvent(avg.CURSORUP, 0, 0),
- lambda: self.assert_(self.__down and self.__clicked),
- reset,
-
- lambda: b.setEnabled(False),
- lambda: b.setNodes(upNode = avg.ImageNode(href="button_up.png"),
- downNode = avg.ImageNode(href="button_down.png"),
- disabledNode = avg.ImageNode(href="button_disabled.png")),
- lambda: self.compareImage("testUIButtonDisabled", False),
- lambda: self._sendMouseEvent(avg.CURSORDOWN, 0, 0),
- lambda: self._sendMouseEvent(avg.CURSORUP, 0, 0),
- lambda: self.assert_(not(self.__down) and not(self.__clicked)),
- reset,
-
- lambda: b.setEnabled(True),
- lambda: b.setNodes(upNode = avg.ImageNode(href="button_up.png"),
- downNode = avg.ImageNode(href="button_down.png"),
- disabledNode = None),
- lambda: self.compareImage("testUIButtonUp", False),
- lambda: self._sendMouseEvent(avg.CURSORDOWN, 0, 0),
- lambda: self._sendMouseEvent(avg.CURSORUP, 0, 0),
- lambda: self.assert_(self.__down and self.__clicked),
- reset,
-
- # resetting the nodes on an empty button
- lambda: setObjectActive(b, False),
- lambda: setObjectActive(b1, True),
- lambda: b1.setNodes(upNode = avg.ImageNode(href="button_up.png"),
- downNode = avg.ImageNode(href="button_down.png"),
- disabledNode = avg.ImageNode(href="button_disabled.png")),
- lambda: self.compareImage("testUIButtonUp", False),
- lambda: self._sendMouseEvent(avg.CURSORDOWN, 0, 0),
- lambda: self._sendMouseEvent(avg.CURSORUP, 0, 0),
- lambda: self.assert_(self.__down and self.__clicked),
- ))
-
-
- def testMultitouchButton(self):
- def onDown(event):
- self.__down = True
-
- def onClick(event):
- self.__clicked = True
-
- def reset():
- self.__down = False
- self.__clicked = False
-
- root = self.loadEmptyScene()
- b = ui.Button(
- parent = root,
- upNode = avg.ImageNode(href="button_up.png"),
- downNode = avg.ImageNode(href="button_down.png"),
- disabledNode = avg.ImageNode(href="button_disabled.png"),
- pressHandler = onDown,
- clickHandler = onClick,
- )
- b.pos = (0,0)
- yOutDistance = b.height * 2
-
- self.__down = False
- self.__clicked = False
- self.start((
- # Two downs, two ups ==> click after second up.
- lambda: self._sendTouchEvent(1, avg.CURSORDOWN, 0, 0),
- lambda: self._sendTouchEvent(2, avg.CURSORDOWN, 0, 0),
- lambda: self.compareImage("testUIButtonDown", False),
- lambda: self.assert_(self.__down and not(self.__clicked)),
- lambda: self._sendTouchEvent(1, avg.CURSORUP, 0, 0),
- lambda: self.compareImage("testUIButtonDown", False),
- lambda: self.assert_(self.__down and not(self.__clicked)),
- lambda: self._sendTouchEvent(2, avg.CURSORUP, 0, 0),
- lambda: self.compareImage("testUIButtonUp", False),
- lambda: self.assert_(self.__clicked),
- reset,
-
- # Two downs, one out, out up, in up ==> click
- lambda: self._sendTouchEvent(1, avg.CURSORDOWN, 0, 0),
- lambda: self._sendTouchEvent(2, avg.CURSORDOWN, 0, 0),
- lambda: self.compareImage("testUIButtonDown", False),
- lambda: self._sendTouchEvent(2, avg.CURSORMOTION, 0, yOutDistance),
- lambda: self._sendTouchEvent(2, avg.CURSORUP, 0, 50),
- lambda: self.compareImage("testUIButtonDown", False),
- lambda: self.assert_(self.__down and not(self.__clicked)),
- lambda: self._sendTouchEvent(1, avg.CURSORUP, 0, 0),
- lambda: self.compareImage("testUIButtonUp", False),
- lambda: self.assert_(self.__down and self.__clicked),
- reset,
-
- # Two down, both out, both in, both up ==> click
- lambda: self._sendTouchEvent(1, avg.CURSORDOWN, 0, 0),
- lambda: self._sendTouchEvent(2, avg.CURSORDOWN, 0, 0),
- lambda: self.compareImage("testUIButtonDown", False),
- lambda: self._sendTouchEvent(1, avg.CURSORMOTION, 0, yOutDistance),
- lambda: self.compareImage("testUIButtonDown", False),
- lambda: self._sendTouchEvent(2, avg.CURSORMOTION, 0, yOutDistance),
- lambda: self.compareImage("testUIButtonUp", False),
- lambda: self.assert_(self.__down and not(self.__clicked)),
- lambda: self._sendTouchEvent(1, avg.CURSORMOTION, 0, 0),
- lambda: self.compareImage("testUIButtonDown", False),
- lambda: self._sendTouchEvent(2, avg.CURSORMOTION, 0, 0),
- lambda: self.compareImage("testUIButtonDown", False),
- lambda: self._sendTouchEvent(1, avg.CURSORUP, 0, 0),
- lambda: self._sendTouchEvent(2, avg.CURSORUP, 0, 0),
- lambda: self.compareImage("testUIButtonUp", False),
- lambda: self.assert_(self.__down and self.__clicked),
- reset,
-
- # Two down both out, both up ==> no click
- lambda: self._sendTouchEvent(1, avg.CURSORDOWN, 0, 0),
- lambda: self._sendTouchEvent(2, avg.CURSORDOWN, 0, 0),
- lambda: self.compareImage("testUIButtonDown", False),
- lambda: self._sendTouchEvent(1, avg.CURSORMOTION, 0, yOutDistance),
- lambda: self.compareImage("testUIButtonDown", False),
- lambda: self._sendTouchEvent(2, avg.CURSORMOTION, 0, yOutDistance),
- lambda: self.compareImage("testUIButtonUp", False),
- lambda: self._sendTouchEvent(1, avg.CURSORUP, 0, yOutDistance),
- lambda: self._sendTouchEvent(2, avg.CURSORUP, 0, yOutDistance),
- lambda: self.compareImage("testUIButtonUp", False),
- lambda: self.assert_(self.__down and not(self.__clicked)),
- reset,
-
- # Two downs, one out, in up, out up ==> no click
- lambda: self._sendTouchEvent(1, avg.CURSORDOWN, 0, 0),
- lambda: self._sendTouchEvent(2, avg.CURSORDOWN, 0, 0),
- lambda: self.compareImage("testUIButtonDown", False),
- lambda: self._sendTouchEvent(2, avg.CURSORMOTION, 0, yOutDistance),
- lambda: self._sendTouchEvent(1, avg.CURSORUP, 0, yOutDistance),
- lambda: self.compareImage("testUIButtonUp", False),
- lambda: self.assert_(self.__down and not(self.__clicked)),
- lambda: self._sendTouchEvent(2, avg.CURSORUP, 0, yOutDistance),
- lambda: self.compareImage("testUIButtonUp", False),
- lambda: self.assert_(self.__down and not(self.__clicked)),
- reset,
-
- # Check checkable multitouch button
- # 2 down, 2 up ==> pressed, clicked,
- # 2 down, 2 up ==> pressed, clicked
- lambda: b.setCheckable(True),
- lambda: self.compareImage("testUIButtonUp", False),
- lambda: self._sendTouchEvent(1, avg.CURSORDOWN, 0, 0),
- lambda: self._sendTouchEvent(2, avg.CURSORDOWN, 0, 0),
- lambda: self.compareImage("testUIButtonDown", False),
- lambda: self.assert_(self.__down and not(self.__clicked)),
- lambda: self._sendTouchEvent(1, avg.CURSORUP, 0, 0),
- lambda: self.compareImage("testUIButtonDown", False),
- lambda: self._sendTouchEvent(2, avg.CURSORUP, 0, 0),
- lambda: self.compareImage("testUIButtonDown", False),
- lambda: self.assert_(self.__down and self.__clicked),
- reset,
- lambda: self.compareImage("testUIButtonDown", False),
- lambda: self._sendTouchEvent(1, avg.CURSORDOWN, 0, 0),
- lambda: self._sendTouchEvent(2, avg.CURSORDOWN, 0, 0),
- lambda: self.compareImage("testUIButtonDown", False),
- lambda: self.assert_(self.__down and not(self.__clicked)),
- lambda: self._sendTouchEvent(1, avg.CURSORUP, 0, 0),
- lambda: self._sendTouchEvent(2, avg.CURSORUP, 0, 0),
- lambda: self.compareImage("testUIButtonUp", False),
- lambda: self.assert_(self.__down and self.__clicked),
- reset,
-
- # not checked, 2 down, 2 out, 2 in, first up, second up
- # ==> pressed, clicked
- lambda: b.setChecked(False),
- lambda: self.compareImage("testUIButtonUp", False),
- lambda: self._sendTouchEvent(1, avg.CURSORDOWN, 0, 0),
- lambda: self._sendTouchEvent(2, avg.CURSORDOWN, 0, 0),
- lambda: self.compareImage("testUIButtonDown", False),
- lambda: self.assert_(self.__down and not(self.__clicked)),
- lambda: self._sendTouchEvent(1, avg.CURSORMOTION, 0, yOutDistance),
- lambda: self.compareImage("testUIButtonDown", False),
- lambda: self._sendTouchEvent(2, avg.CURSORMOTION, 0, yOutDistance),
- lambda: self.compareImage("testUIButtonUp", False),
- lambda: self._sendTouchEvent(1, avg.CURSORMOTION, 0, 0),
- lambda: self.compareImage("testUIButtonDown", False),
- lambda: self._sendTouchEvent(2, avg.CURSORMOTION, 0, 0),
- lambda: self.compareImage("testUIButtonDown", False),
- lambda: self._sendTouchEvent(1, avg.CURSORUP, 0, 0),
- lambda: self.compareImage("testUIButtonDown", False),
- lambda: self.assert_(self.__down and not(self.__clicked)),
- lambda: self._sendTouchEvent(2, avg.CURSORUP, 0, 0),
- lambda: self.compareImage("testUIButtonDown", False),
- lambda: self.assert_(self.__down and self.__clicked),
- reset,
-
- # checked, 2 down, 2 out, 2 in, first up, second up
- # ==> pressed, clicked
- lambda: b.setCheckable(True),
- lambda: b.setChecked(True),
- lambda: self.compareImage("testUIButtonDown", False),
- lambda: self._sendTouchEvent(1, avg.CURSORDOWN, 0, 0),
- lambda: self._sendTouchEvent(2, avg.CURSORDOWN, 0, 0),
- lambda: self.compareImage("testUIButtonDown", False),
- lambda: self.assert_(self.__down and not(self.__clicked)),
- lambda: self._sendTouchEvent(1, avg.CURSORMOTION, 0, yOutDistance),
- lambda: self.compareImage("testUIButtonDown", False),
- lambda: self._sendTouchEvent(2, avg.CURSORMOTION, 0, yOutDistance),
- lambda: self.compareImage("testUIButtonDown", False),
- lambda: self._sendTouchEvent(1, avg.CURSORMOTION, 0, 0),
- lambda: self.compareImage("testUIButtonDown", False),
- lambda: self._sendTouchEvent(2, avg.CURSORMOTION, 0, 0),
- lambda: self.compareImage("testUIButtonDown", False),
- lambda: self._sendTouchEvent(1, avg.CURSORUP, 0, 0),
- lambda: self.compareImage("testUIButtonDown", False),
- lambda: self.assert_(self.__down and not(self.__clicked)),
- lambda: self._sendTouchEvent(2, avg.CURSORUP, 0, 0),
- lambda: self.compareImage("testUIButtonUp", False),
- lambda: self.assert_(self.__down and self.__clicked),
- reset,
-
- # not checked, 2 down, 2 out, first up, second up
- # ==> pressed, not clicked
- lambda: b.setCheckable(True),
- lambda: b.setChecked(False),
- lambda: self.compareImage("testUIButtonUp", False),
- lambda: self._sendTouchEvent(1, avg.CURSORDOWN, 0, 0),
- lambda: self._sendTouchEvent(2, avg.CURSORDOWN, 0, 0),
- lambda: self.compareImage("testUIButtonDown", False),
- lambda: self.assert_(self.__down and not(self.__clicked)),
- lambda: self._sendTouchEvent(1, avg.CURSORMOTION, 0, yOutDistance),
- lambda: self.compareImage("testUIButtonDown", False),
- lambda: self._sendTouchEvent(2, avg.CURSORMOTION, 0, yOutDistance),
- lambda: self.compareImage("testUIButtonUp", False),
- lambda: self._sendTouchEvent(1, avg.CURSORUP, 0, yOutDistance),
- lambda: self.compareImage("testUIButtonUp", False),
- lambda: self.assert_(self.__down and not(self.__clicked)),
- lambda: self._sendTouchEvent(2, avg.CURSORUP, 0, yOutDistance),
- lambda: self.compareImage("testUIButtonUp", False),
- lambda: self.assert_(self.__down and not(self.__clicked)),
- reset,
-
- # checked, 2 down, 2 out, first up, second up
- # ==> pressed, not clicked
- lambda: b.setCheckable(True),
- lambda: b.setChecked(True),
- lambda: self.compareImage("testUIButtonDown", False),
- lambda: self._sendTouchEvent(1, avg.CURSORDOWN, 0, 0),
- lambda: self._sendTouchEvent(2, avg.CURSORDOWN, 0, 0),
- lambda: self.compareImage("testUIButtonDown", False),
- lambda: self.assert_(self.__down and not(self.__clicked)),
- lambda: self._sendTouchEvent(1, avg.CURSORMOTION, 0, yOutDistance),
- lambda: self.compareImage("testUIButtonDown", False),
- lambda: self._sendTouchEvent(2, avg.CURSORMOTION, 0, yOutDistance),
- lambda: self.compareImage("testUIButtonDown", False),
- lambda: self._sendTouchEvent(1, avg.CURSORUP, 0, yOutDistance),
- lambda: self.compareImage("testUIButtonDown", False),
- lambda: self.assert_(self.__down and not(self.__clicked)),
- lambda: self._sendTouchEvent(2, avg.CURSORUP, 0, yOutDistance),
- lambda: self.compareImage("testUIButtonDown", False),
- lambda: self.assert_(self.__down and not(self.__clicked)),
- reset,
- ))
-
-
- def testTouchButton(self):
-
- def onClick():
- self.clicked = True
-
- def reset():
- self.clicked = False
-
- def enable(enabled):
- button.enabled = enabled
-
- def createScene(**kwargs):
- root = self.loadEmptyScene()
- return ui.TouchButton(
- parent = root,
- upNode = avg.ImageNode(href="button_up.png"),
- downNode = avg.ImageNode(href="button_down.png"),
- disabledNode = avg.ImageNode(href="button_disabled.png"),
- clickHandler = onClick,
- **kwargs
- )
-
- def runTest():
- self.clicked = False
- self.start((
- # Standard down->up
- lambda: self._sendTouchEvent(1, avg.CURSORDOWN, 0, 0),
- lambda: self.assert_(not(self.clicked)),
- lambda: self.compareImage("testUIButtonDown", False),
- lambda: self._sendTouchEvent(1, avg.CURSORUP, 0, 0),
- lambda: self.assert_(self.clicked),
- lambda: self.compareImage("testUIButtonUp", False),
-
- # Disable, down, up -> no click
- reset,
- lambda: self.assert_(button.enabled),
- lambda: enable(False),
- lambda: self.assert_(not(button.enabled)),
- lambda: self.compareImage("testUIButtonDisabled", False),
- lambda: self._sendTouchEvent(2, avg.CURSORDOWN, 0, 0),
- lambda: self._sendTouchEvent(2, avg.CURSORUP, 0, 0),
- lambda: self.assert_(not(self.clicked)),
- lambda: enable(True),
- lambda: self.assert_(button.enabled),
-
- # Down, up further away -> no click
- reset,
- lambda: self._sendTouchEvent(3, avg.CURSORDOWN, 0, 0),
- lambda: self._sendTouchEvent(3, avg.CURSORUP, 100, 0),
- lambda: self.assert_(not(self.clicked)),
- lambda: self.compareImage("testUIButtonUp", False),
-
- # Down, move further away, up -> no click
- reset,
- lambda: self._sendTouchEvent(3, avg.CURSORDOWN, 0, 0),
- lambda: self._sendTouchEvent(3, avg.CURSORMOTION, 100, 0),
- lambda: self._sendTouchEvent(3, avg.CURSORUP, 100, 0),
- lambda: self.assert_(not(self.clicked)),
- lambda: self.compareImage("testUIButtonUp", False),
-
- # Test if button still reacts after abort
- lambda: self._sendTouchEvent(4, avg.CURSORDOWN, 0, 0),
- lambda: self.assert_(not(self.clicked)),
- lambda: self.compareImage("testUIButtonDown", False),
- lambda: self._sendTouchEvent(4, avg.CURSORUP, 0, 0),
- lambda: self.assert_(self.clicked),
- lambda: self.compareImage("testUIButtonUp", False),
- ))
-
- button = createScene()
- runTest()
-
- button = createScene(activeAreaNode = avg.CircleNode(r=5, opacity=0))
- runTest()
-
- button = createScene(fatFingerEnlarge = True)
- runTest()
-
- root = self.loadEmptyScene()
- button = ui.TouchButton.fromSrc(
- parent = root,
- upSrc = "button_up.png",
- downSrc = "button_down.png",
- disabledSrc = "button_disabled.png",
- clickHandler = onClick
- )
- runTest()
-
- def testScrollPane(self):
- def scrollLarge():
- scrollPane.contentpos = (-34, -34)
- self.assertEqual(scrollPane.contentpos, (-32,-32))
-
- def initSmallContent():
- scrollPane.size = (64, 64)
- contentArea.size = (32, 32)
- image.size = (32, 32)
- scrollPane.contentpos = (0, 0)
- self.assertEqual(scrollPane.getMaxContentPos(), (32,32))
-
- def scrollSmall():
- scrollPane.contentpos = (32, 32)
-
- root = self.loadEmptyScene()
- contentArea = avg.DivNode(size=(64,64))
- image = avg.ImageNode(href="rgb24-64x64.png", parent=contentArea)
- scrollPane = ui.ScrollPane(contentDiv=contentArea, size=(32,32), parent=root)
-
- self.start((
- lambda: self.compareImage("testScrollPane1", False),
- scrollLarge,
- lambda: self.compareImage("testScrollPane2", False),
- initSmallContent,
- lambda: self.compareImage("testScrollPane3", False),
- scrollSmall,
- lambda: self.compareImage("testScrollPane4", False),
- ))
-
-
-def uiTestSuite(tests):
- availableTests = (
- "testKeyboard",
- "testTextArea",
- "testFocusContext",
- "testTapRecognizer",
- "testHoldRecognizer",
- "testDoubletapRecognizer",
- "testDragRecognizer",
- "testDragRecognizerRelCoords",
- "testDragRecognizerInitialEvent",
- "testDragRecognizerCoordSysNode",
- "testTransformRecognizer",
- "testKMeans",
- "testMat3x3",
- "testButton",
- "testMultitouchButton",
- "testTouchButton",
- "testScrollPane"
- )
-
- return createAVGTestSuite(availableTests, UITestCase, tests)
-
-Player = avg.Player.get()
-
diff --git a/src/test/VectorTest.py b/src/test/VectorTest.py
index f408aa8..af0ddaf 100644
--- a/src/test/VectorTest.py
+++ b/src/test/VectorTest.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# libavg - Media Playback Engine.
-# Copyright (C) 2003-2011 Ulrich von Zadow
+# 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
@@ -19,9 +19,7 @@
# Current versions can be found at www.libavg.de
#
-import unittest
-
-from libavg import avg
+from libavg import avg, player
from testcase import *
class VectorTestCase(AVGTestCase):
@@ -36,7 +34,7 @@ class VectorTestCase(AVGTestCase):
def testLine(self):
def addLines():
def addLine(attribs):
- line = Player.createNode("line", attribs)
+ line = player.createNode("line", attribs)
canvas.appendChild(line)
addLine({"pos1":(2, 2.5), "pos2":(100, 2.5)})
@@ -65,14 +63,14 @@ class VectorTestCase(AVGTestCase):
canvas = self.makeEmptyCanvas()
addLines()
line = canvas.getChild(0)
- self.start((
- lambda: self.compareImage("testline1", False),
+ self.start(False,
+ (lambda: self.compareImage("testline1"),
changeLine,
- lambda: self.compareImage("testline2", False),
+ lambda: self.compareImage("testline2"),
moveLine,
- lambda: self.compareImage("testline3", False),
+ lambda: self.compareImage("testline3"),
blendMode,
- lambda: self.compareImage("testline4", False)
+ lambda: self.compareImage("testline4")
))
def testLotsOfLines(self):
@@ -83,9 +81,9 @@ class VectorTestCase(AVGTestCase):
canvas.appendChild(line)
canvas = self.makeEmptyCanvas()
- self.start((
- addLines,
- lambda: self.compareImage("testlotsoflines", False),
+ self.start(False,
+ (addLines,
+ lambda: self.compareImage("testlotsoflines"),
))
def testTexturedLine(self):
@@ -106,7 +104,7 @@ class VectorTestCase(AVGTestCase):
self.line.texcoord2 = 1.5
def bmpTexture():
- bmp = avg.Bitmap("rgb24alpha-64x64.png")
+ bmp = avg.Bitmap("media/rgb24alpha-64x64.png")
self.line.setBitmap(bmp)
def bmpNoTexture():
@@ -114,22 +112,22 @@ class VectorTestCase(AVGTestCase):
canvas = self.makeEmptyCanvas()
addLine()
- self.start((
- lambda: self.compareImage("testtexturedline1", False),
+ self.start(False,
+ (lambda: self.compareImage("testtexturedline1"),
removeLine,
- lambda: self.compareImage("testtexturedline2", False),
+ lambda: self.compareImage("testtexturedline2"),
addLine,
- lambda: self.compareImage("testtexturedline1", False),
+ lambda: self.compareImage("testtexturedline1"),
removeLine,
- lambda: self.compareImage("testtexturedline2", False),
+ lambda: self.compareImage("testtexturedline2"),
reAddLine,
- lambda: self.compareImage("testtexturedline1", False),
+ lambda: self.compareImage("testtexturedline1"),
moveTexture,
- lambda: self.compareImage("testtexturedline3", False),
+ lambda: self.compareImage("testtexturedline3"),
bmpTexture,
- lambda: self.compareImage("testtexturedline4", False),
+ lambda: self.compareImage("testtexturedline4"),
bmpNoTexture,
- lambda: self.compareImage("testtexturedline5", False),
+ lambda: self.compareImage("testtexturedline5"),
))
def testLineOpacity(self):
@@ -142,11 +140,11 @@ class VectorTestCase(AVGTestCase):
canvas.getChild(0).opacity = 0.25
canvas = self.makeEmptyCanvas()
- self.start((
- addLine,
- lambda: self.compareImage("testlineopacity1", False),
+ self.start(False,
+ (addLine,
+ lambda: self.compareImage("testlineopacity1"),
changeCanvasOpacity,
- lambda: self.compareImage("testlineopacity2", False),
+ lambda: self.compareImage("testlineopacity2"),
))
def testRect(self):
@@ -154,7 +152,7 @@ class VectorTestCase(AVGTestCase):
rect = avg.RectNode(pos=(2, 2), size=(50, 30), fillopacity=1,
strokewidth=0)
canvas.appendChild(rect)
- rect.setEventHandler(avg.CURSORDOWN, avg.MOUSE, onMouseDown)
+ rect.subscribe(avg.Node.CURSOR_DOWN, onMouseDown)
return rect
def moveRect():
@@ -180,20 +178,19 @@ class VectorTestCase(AVGTestCase):
self.__mouseDownCalled = False
canvas = self.makeEmptyCanvas()
rect = addRect()
- helper = Player.getTestHelper()
- self.start((
- lambda: self.compareImage("testRect1", False),
+ self.start(False,
+ (lambda: self.compareImage("testRect1"),
moveRect,
- lambda: self.compareImage("testRect2", False),
+ lambda: self.compareImage("testRect2"),
rotateRect,
- lambda: self.compareImage("testRect3", False),
+ lambda: self.compareImage("testRect3"),
addRect2,
- lambda: self.compareImage("testRect4", False),
+ lambda: self.compareImage("testRect4"),
lambda: self.fakeClick(100, 100),
lambda: self.assertEqual(self.__mouseDownCalled, False),
lambda: self.fakeClick(55, 50),
lambda: self.assertEqual(self.__mouseDownCalled, False),
- lambda: self.fakeClick(65, 60),
+ lambda: self.fakeClick(65, 65),
lambda: self.assert_(self.__mouseDownCalled)
))
@@ -207,7 +204,7 @@ class VectorTestCase(AVGTestCase):
def newRect():
self.rect.unlink()
- self.rect = Player.createNode(
+ self.rect = player.createNode(
"""<rect pos="(20, 20)" size="(50, 40)" fillopacity="1"
filltexcoord1="(1,1)" filltexcoord2="(0,0)"
texcoords="(0, 0.25, 0.5, 0.75, 1)"
@@ -227,7 +224,7 @@ class VectorTestCase(AVGTestCase):
self.rect.filltexcoord2 = (1.5, 1.5)
def setFillBitmap():
- bmp = avg.Bitmap("rgb24-64x64.png")
+ bmp = avg.Bitmap("media/rgb24-64x64.png")
self.rect.setFillBitmap(bmp)
def clearFillBitmap():
@@ -241,24 +238,24 @@ class VectorTestCase(AVGTestCase):
canvas = self.makeEmptyCanvas()
addRect()
- self.start((
- lambda: self.compareImage("testTexturedRect1", False),
+ self.start(False,
+ (lambda: self.compareImage("testTexturedRect1"),
newRect,
- lambda: self.compareImage("testTexturedRect2", False),
+ lambda: self.compareImage("testTexturedRect2"),
setTexCoords,
- lambda: self.compareImage("testTexturedRect3", False),
+ lambda: self.compareImage("testTexturedRect3"),
setFillTex,
- lambda: self.compareImage("testTexturedRect4", False),
+ lambda: self.compareImage("testTexturedRect4"),
setFillTexCoords,
- lambda: self.compareImage("testTexturedRect5", False),
+ lambda: self.compareImage("testTexturedRect5"),
setFillBitmap,
- lambda: self.compareImage("testTexturedRect6", False),
+ lambda: self.compareImage("testTexturedRect6"),
clearFillBitmap,
- lambda: self.compareImage("testTexturedRect7", False),
+ lambda: self.compareImage("testTexturedRect7"),
setFillBitmap,
- lambda: self.compareImage("testTexturedRect6", False),
+ lambda: self.compareImage("testTexturedRect6"),
# setTransparentBorder,
-# lambda: self.compareImage("testTexturedRect8", False),
+# lambda: self.compareImage("testTexturedRect8"),
))
def testCurve(self):
@@ -284,14 +281,18 @@ class VectorTestCase(AVGTestCase):
canvas = self.makeEmptyCanvas()
curve = addCurve()
- self.start((
- lambda: self.compareImage("testCurve1", False),
+ self.assertAlmostEqual(curve.length, 210)
+ self.assertAlmostEqual(curve.getPtOnCurve(0), (10.5,10))
+ self.assertAlmostEqual(curve.getPtOnCurve(1), (80.5,10))
+ self.assertAlmostEqual(curve.getPtOnCurve(0.5), (45.5,62.5))
+ self.start(False,
+ (lambda: self.compareImage("testCurve1"),
changeCurve,
- lambda: self.compareImage("testCurve2", False),
+ lambda: self.compareImage("testCurve2"),
moveCurve,
- lambda: self.compareImage("testCurve3", False),
+ lambda: self.compareImage("testCurve3"),
addCurve2,
- lambda: self.compareImage("testCurve4", False),
+ lambda: self.compareImage("testCurve4"),
))
def testTexturedCurve(self):
@@ -307,10 +308,10 @@ class VectorTestCase(AVGTestCase):
canvas = self.makeEmptyCanvas()
curve = addCurve()
- self.start((
- lambda: self.compareImage("testTexturedCurve1", False),
+ self.start(False,
+ (lambda: self.compareImage("testTexturedCurve1"),
setTexCoords,
- lambda: self.compareImage("testTexturedCurve2", False)
+ lambda: self.compareImage("testTexturedCurve2")
))
def testPolyLine(self):
@@ -331,7 +332,7 @@ class VectorTestCase(AVGTestCase):
polyline.linejoin = "miter"
def addPolyLine2():
- polyline2 = Player.createNode(
+ polyline2 = player.createNode(
"""<polyline strokewidth="2" color="FF00FF"
pos="((110,10), (100,50), (110,70))" />""")
canvas.insertChild(polyline2,0)
@@ -353,20 +354,20 @@ class VectorTestCase(AVGTestCase):
canvas = self.makeEmptyCanvas()
polyline = addPolyLine()
- self.start((
- lambda: self.compareImage("testPolyLine1", False),
+ self.start(False,
+ (lambda: self.compareImage("testPolyLine1"),
changePolyLine,
- lambda: self.compareImage("testPolyLine2", False),
+ lambda: self.compareImage("testPolyLine2"),
miterPolyLine,
- lambda: self.compareImage("testPolyLine3", False),
+ lambda: self.compareImage("testPolyLine3"),
addPolyLine2,
- lambda: self.compareImage("testPolyLine4", False),
+ lambda: self.compareImage("testPolyLine4"),
testEmptyPolyLine,
- lambda: self.compareImage("testPolyLine5", False),
+ lambda: self.compareImage("testPolyLine5"),
testAlmostEmptyPolyLine,
- lambda: self.compareImage("testPolyLine5", False),
+ lambda: self.compareImage("testPolyLine5"),
testAcutePolyLine,
- lambda: self.compareImage("testPolyLine6", False)
+ lambda: self.compareImage("testPolyLine6")
))
def testTexturedPolyLine(self):
@@ -389,21 +390,21 @@ class VectorTestCase(AVGTestCase):
canvas = self.makeEmptyCanvas()
polyline = texturePolyLine()
- self.start((
- lambda: self.compareImage("testTexturedPolyLine1", False),
+ self.start(False,
+ (lambda: self.compareImage("testTexturedPolyLine1"),
miter,
- lambda: self.compareImage("testTexturedPolyLine2", False),
+ lambda: self.compareImage("testTexturedPolyLine2"),
setTexCoords,
- lambda: self.compareImage("testTexturedPolyLine3", False),
+ lambda: self.compareImage("testTexturedPolyLine3"),
repeatTexCoords,
- lambda: self.compareImage("testTexturedPolyLine4", False)
+ lambda: self.compareImage("testTexturedPolyLine4")
))
def testPolygon(self):
def addPolygon():
polygon = avg.PolygonNode(strokewidth=2, color="FF00FF",
pos=((10,10), (50,10), (90,50), (90, 90)))
- polygon.setEventHandler(avg.CURSORDOWN, avg.MOUSE, onMouseDown)
+ polygon.subscribe(avg.Node.CURSOR_DOWN, onMouseDown)
canvas.appendChild(polygon)
return polygon
@@ -446,39 +447,65 @@ class VectorTestCase(AVGTestCase):
def addEmptyPolygon():
avg.PolygonNode(parent=canvas, fillopacity=1)
+ def createLeftOpenPolygon():
+ polygon.pos = ( (15,0), (35,0), (55,10), (65,30), (55,50), (35,60), (15,60),
+ (5,50), (15,40), (35,40), (35,30), (35,20), (15,20), (5,10) )
+ polygon.strokewidth = 2
+
+ def createUpOpenPolygon():
+ polygon.pos = ( (15,0), (25,10), (25,30), (35,30), (45,30), (45,10), (55,0),
+ (65,10), (65,30), (55,50), (35,60), (15,50), (5,30), (5,10) )
+
+ def createBottomOpenPolygon():
+ polygon.pos = ( (35,0), (55,10), (65,30), (65,50), (55,60), (45,50), (45,30),
+ (35,30), (25,30), (25,50), (15,60), (5,50), (5,30), (15,10) )
+
+ def createOneHole():
+ polygon.holes = ( [(35,10), (40,15), (35,20), (30,15)], )
+
+ def createMoreHoles():
+ newHoles = ( polygon.holes[0], [(20,35), (20,45), (10,40)],
+ [(50,35), (50,45), (60,40)], )
+ polygon.holes = newHoles
+
+ def clearCanvas():
+ for i in xrange(canvas.getNumChildren()-1):
+ dell = canvas.getChild(i)
+ canvas.removeChild(dell)
+
self.__mouseDownCalled = False
canvas = self.makeEmptyCanvas()
polygon = addPolygon()
- helper = Player.getTestHelper()
- self.start((
- lambda: self.compareImage("testPolygon1", True),
+ self.start(False,
+ (lambda: self.compareImage("testPolygon1"),
changePolygon,
- lambda: self.compareImage("testPolygon2", True),
+ lambda: self.compareImage("testPolygon2"),
fillPolygon,
- lambda: self.compareImage("testPolygon3", True),
+ lambda: self.compareImage("testPolygon3"),
addEmptyPoint,
- lambda: self.compareImage("testPolygon4", True),
+ lambda: self.compareImage("testPolygon4"),
addPolygon2,
- lambda: self.compareImage("testPolygon5", True),
+ lambda: self.compareImage("testPolygon5"),
miterPolygons,
- lambda: self.compareImage("testPolygon6", False),
+ lambda: self.compareImage("testPolygon6"),
lambda: self.fakeClick(50, 50),
lambda: self.assertEqual(self.__mouseDownCalled, False),
lambda: self.fakeClick(20, 87),
lambda: self.assert_(self.__mouseDownCalled),
- addEmptyPolygon
+ addEmptyPolygon,
+ clearCanvas,
+ createLeftOpenPolygon,
+ lambda: self.compareImage("testPolygon7"),
+ createUpOpenPolygon,
+ lambda: self.compareImage("testPolygon8"),
+ createBottomOpenPolygon,
+ lambda: self.compareImage("testPolygon9"),
+ createOneHole,
+ lambda: self.compareImage("testPolygonHole1"),
+ createMoreHoles,
+ lambda: self.compareImage("testPolygonHole2")
))
- def testSelfIntersectPolygon(self):
- def addPolygon():
- polygon = avg.PolygonNode(strokewidth=3, color="FF00FF",
- pos=((100.5, 10.5), (100.5, 30.5), (120.5, 10.5), (120.5, 30.5)),
- fillcolor="00FFFF", fillopacity=0.5)
- canvas.insertChild(polygon, 0)
-
- canvas = self.makeEmptyCanvas()
- self.assertException(lambda: self.start([addPolygon]))
-
def testTexturedPolygon(self):
def texturePolygon():
polygon = avg.PolygonNode(strokewidth=20, color="FF00FF",
@@ -507,18 +534,18 @@ class VectorTestCase(AVGTestCase):
canvas = self.makeEmptyCanvas()
polygon = texturePolygon()
- self.start((
- lambda: self.compareImage("testTexturedPolygon1", False),
+ self.start(False,
+ (lambda: self.compareImage("testTexturedPolygon1"),
miter,
- lambda: self.compareImage("testTexturedPolygon2", False),
+ lambda: self.compareImage("testTexturedPolygon2"),
setTexCoords,
- lambda: self.compareImage("testTexturedPolygon3", False),
+ lambda: self.compareImage("testTexturedPolygon3"),
repeatTexCoords,
- lambda: self.compareImage("testTexturedPolygon4", False),
+ lambda: self.compareImage("testTexturedPolygon4"),
setFillTex,
- lambda: self.compareImage("testTexturedPolygon5", False),
+ lambda: self.compareImage("testTexturedPolygon5"),
setFillTexCoords,
- lambda: self.compareImage("testTexturedPolygon6", False)
+ lambda: self.compareImage("testTexturedPolygon6")
))
def testPointInPolygon(self):
@@ -529,13 +556,13 @@ class VectorTestCase(AVGTestCase):
def testCircle(self):
def addCircle():
circle = avg.CircleNode(pos=(30, 30), r=20)
- circle.setEventHandler(avg.CURSORDOWN, avg.MOUSE, onMouseDown)
+ circle.subscribe(avg.Node.CURSOR_DOWN, onMouseDown)
canvas.appendChild(circle)
return circle
def changeCircle():
circle.color="FF0000"
- circle.fillcolor="FFFFFF"
+ circle.fillcolor=u"FFFFFF"
circle.fillopacity=0.5
circle.strokewidth=3
@@ -562,17 +589,16 @@ class VectorTestCase(AVGTestCase):
self.__mouseDownCalled = False
canvas = self.makeEmptyCanvas()
circle = addCircle()
- helper = Player.getTestHelper()
- self.start((
- lambda: self.compareImage("testCircle1", False),
+ self.start(False,
+ (lambda: self.compareImage("testCircle1"),
changeCircle,
- lambda: self.compareImage("testCircle2", False),
+ lambda: self.compareImage("testCircle2"),
textureCircle,
- lambda: self.compareImage("testCircle3", False),
+ lambda: self.compareImage("testCircle3"),
setFillTex,
- lambda: self.compareImage("testCircle4", False),
+ lambda: self.compareImage("testCircle4"),
setFillTexCoords,
- lambda: self.compareImage("testCircle5", False),
+ lambda: self.compareImage("testCircle5"),
lambda: self.fakeClick(32, 32),
lambda: self.assert_(self.__mouseDownCalled == False),
lambda: self.fakeClick(67, 50),
@@ -612,6 +638,16 @@ class VectorTestCase(AVGTestCase):
def setHref():
mesh.texhref = "rgb24alpha-64x64.png"
+
+ def setBackfaceCullTrue():
+ mesh.texhref="rgb24-64x64.png"
+ mesh.vertexcoords = ((0,0), (64,0), (0,64), (64, 64),(31.5, 32))
+ mesh.texcoords = ((0,0),(1,0),(0,1),(1,1),(0.5,0.5))
+ mesh.triangles = ((3,1,4),(1,3,4),(1,2,4),(2,0,4))
+ mesh.backfacecull = True
+
+ def setBackfaceCullFalse():
+ mesh.backfacecull = False
def setIllegalVertexes():
mesh.vertexcoords = ((0,0), (64,0), (0,64), (64, 64),(32, 32), (16,16))
@@ -627,18 +663,22 @@ class VectorTestCase(AVGTestCase):
self.assertException(setIllegalVertexes)
self.assertException(setIllegalTextures)
self.assertException(setIllegalIndexes)
- self.start((
- lambda: self.compareImage("testMesh1", False),
+ self.start(False,
+ (lambda: self.compareImage("testMesh1"),
setVertexCoords,
- lambda: self.compareImage("testMesh2", False),
+ lambda: self.compareImage("testMesh2"),
setTexCoords,
- lambda: self.compareImage("testMesh3", False),
+ lambda: self.compareImage("testMesh3"),
setTriangles,
- lambda: self.compareImage("testMesh4", False),
+ lambda: self.compareImage("testMesh4"),
setHref,
- lambda: self.compareImage("testMesh5", False),
+ lambda: self.compareImage("testMesh5"),
setTrianglesSameItem,
- lambda: self.compareImage("testMesh6", False)
+ lambda: self.compareImage("testMesh6"),
+ setBackfaceCullTrue,
+ lambda: self.compareImage("testMesh7"),
+ setBackfaceCullFalse,
+ lambda: self.compareImage("testMesh8")
))
def testInactiveVector(self):
@@ -649,7 +689,7 @@ class VectorTestCase(AVGTestCase):
def addFilledVectorNode():
node = avg.RectNode(pos=(2, 6), size=(50, 30), strokewidth=2)
- node.setEventHandler(avg.CURSORDOWN, avg.MOUSE, onDown)
+ node.subscribe(avg.Node.CURSOR_DOWN, onDown)
canvas.appendChild(node)
return node
@@ -658,16 +698,15 @@ class VectorTestCase(AVGTestCase):
fvNode.active = False
self.onDownCalled = not self.onDownCalled
- Helper = Player.getTestHelper()
canvas = self.makeEmptyCanvas()
vNode = addVectorNode()
fvNode = addFilledVectorNode()
self.onDownCalled = False
- self.start((
- lambda: self.compareImage("testInactiveVector1", False),
+ self.start(False,
+ (lambda: self.compareImage("testInactiveVector1"),
lambda: self.fakeClick(20, 20),
lambda: self.assert_(self.onDownCalled),
- lambda: self.compareImage("testInactiveVector2", False),
+ lambda: self.compareImage("testInactiveVector2"),
lambda: self.fakeClick(20, 20),
lambda: self.assert_(self.onDownCalled)
))
@@ -686,7 +725,6 @@ def vectorTestSuite(tests):
"testPolyLine",
"testTexturedPolyLine",
"testPolygon",
- "testSelfIntersectPolygon",
"testTexturedPolygon",
"testPointInPolygon",
"testCircle",
@@ -694,5 +732,3 @@ def vectorTestSuite(tests):
"testInactiveVector"
)
return createAVGTestSuite(availableTests, VectorTestCase, tests)
-
-Player = avg.Player.get()
diff --git a/src/test/WidgetTest.py b/src/test/WidgetTest.py
new file mode 100644
index 0000000..720171e
--- /dev/null
+++ b/src/test/WidgetTest.py
@@ -0,0 +1,900 @@
+# -*- 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
+#
+
+from libavg import avg, textarea, widget, player
+
+from testcase import *
+
+class WidgetTestCase(AVGTestCase):
+ def __init__(self, testFuncName):
+ AVGTestCase.__init__(self, testFuncName)
+
+ def testKeyboard(self):
+ def createKbd(pos, shiftKey=None, feedbackImage=None):
+ keyDefs = [
+ [("a", "A"), ( 5, 5), (30, 30), False],
+ [("1", ), (35, 5), (30, 30), False],
+ ["SHIFT", (65, 5), (50, 30), True]]
+ kbd = widget.Keyboard("keyboard_bg.png", "keyboard_down.png", keyDefs,
+ shiftKey, feedbackSrc=feedbackImage, pos=pos, parent=root)
+
+ for msg in (widget.Keyboard.DOWN, widget.Keyboard.UP, widget.Keyboard.CHAR):
+ kbd.subscribe(msg, lambda keyCode, msg=msg: onMessage(msg, keyCode))
+ return kbd
+
+ def onMessage(msg, keyCode):
+ self.__messageTester.setMessageReceived(msg)
+ self.__keyCode = keyCode
+
+ def assertState(msgs, keyCode, imageSrc):
+ self.__messageTester.assertState(msgs)
+ self.assert_(self.__keyCode == keyCode)
+ self.compareImage(imageSrc)
+
+ root = self.loadEmptyScene()
+ self.__keyCode = ""
+
+ # Keyboard without shift support, no feedback image.
+ kbNoShift = createKbd((10, 10))
+ self.__messageTester = MessageTester(kbNoShift, [], self)
+
+ self.start(False,
+ (lambda: self.compareImage("testUIKeyboard"),
+ # test character key
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_DOWN, 30, 30),
+ lambda: assertState((widget.Keyboard.DOWN,), "a", "testUIKeyboardA"),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_UP, 30, 30),
+ lambda: assertState((widget.Keyboard.CHAR,widget.Keyboard.UP),
+ "a", "testUIKeyboard"),
+ # test command key
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_DOWN, 100, 30),
+ lambda: assertState((widget.Keyboard.DOWN,), "SHIFT", "testUIKeyboardS"),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_UP, 100, 30),
+ lambda: assertState((widget.Keyboard.UP,), "SHIFT", "testUIKeyboard"),
+ # test multiple keys
+ lambda: self._sendTouchEvent(1, avg.Event.CURSOR_DOWN, 100, 30),
+ lambda: self._sendTouchEvent(2, avg.Event.CURSOR_DOWN, 30, 30),
+ lambda: assertState((widget.Keyboard.DOWN,), "a", "testUIKeyboardAS"),
+ lambda: self._sendTouchEvent(3, avg.Event.CURSOR_DOWN, 60, 30),
+ lambda: assertState((widget.Keyboard.DOWN,), "1", "testUIKeyboardA1S"),
+ lambda: self._sendTouchEvent(2, avg.Event.CURSOR_UP, 30, 30),
+ lambda: assertState((widget.Keyboard.CHAR,widget.Keyboard.UP),
+ "a", "testUIKeyboard1S"),
+ lambda: self._sendTouchEvent(3, avg.Event.CURSOR_UP, 60, 30),
+ lambda: assertState((widget.Keyboard.CHAR,widget.Keyboard.UP),
+ "1", "testUIKeyboardS"),
+ lambda: self._sendTouchEvent(1, avg.Event.CURSOR_UP, 100, 30),
+ lambda: assertState((widget.Keyboard.UP,), "SHIFT", "testUIKeyboard"),
+ ))
+
+ root = self.loadEmptyScene()
+ self.__keyCode = ""
+
+ # Keyboard with shift support, feedback image.
+ kbd = createKbd((10, 60), "SHIFT", "keyboard_feedback.png")
+ self.__messageTester = MessageTester(kbd, [], self)
+
+ self.start(False,
+ # test shift key
+ (lambda: self.compareImage("testUIKeyboardFB"),
+ lambda: self._sendTouchEvent(1, avg.Event.CURSOR_DOWN, 100, 80),
+ lambda: self._sendTouchEvent(2, avg.Event.CURSOR_DOWN, 30, 80),
+ lambda: assertState((widget.Keyboard.DOWN,), "a", "testUIKeyboardFBAS"),
+ lambda: self._sendTouchEvent(3, avg.Event.CURSOR_DOWN, 60, 80),
+ lambda: assertState((widget.Keyboard.DOWN,), "1", "testUIKeyboardFBA1S"),
+ lambda: self._sendTouchEvent(2, avg.Event.CURSOR_UP, 30, 80),
+ lambda: assertState((widget.Keyboard.CHAR,widget.Keyboard.UP),
+ "A", "testUIKeyboardNoFB1S"),
+ lambda: self._sendTouchEvent(3, avg.Event.CURSOR_UP, 60, 80),
+ lambda: assertState((widget.Keyboard.CHAR,widget.Keyboard.UP),
+ "1", "testUIKeyboardFBS"),
+ lambda: self._sendTouchEvent(1, avg.Event.CURSOR_UP, 100, 80),
+ lambda: assertState((widget.Keyboard.UP,), "SHIFT", "testUIKeyboardFB"),
+ # test drag over keys
+ lambda: self._sendTouchEvent(1, avg.Event.CURSOR_DOWN, 60, 80),
+ lambda: assertState((widget.Keyboard.DOWN,), "1", "testUIKeyboardFB1"),
+ lambda: self._sendTouchEvent(1, avg.Event.CURSOR_MOTION, 60, 50),
+ lambda: assertState((widget.Keyboard.UP,), "1", "testUIKeyboardFB"),
+ lambda: self._sendTouchEvent(1, avg.Event.CURSOR_MOTION, 100, 80),
+ lambda: assertState((widget.Keyboard.DOWN,), "SHIFT",
+ "testUIKeyboardFBS"),
+ lambda: self._sendTouchEvent(1, avg.Event.CURSOR_MOTION, 60, 80),
+ lambda: assertState((widget.Keyboard.DOWN,widget.Keyboard.UP),
+ "1", "testUIKeyboardFB1"),
+ lambda: self._sendTouchEvent(1, avg.Event.CURSOR_UP, 60, 80),
+ lambda: assertState((widget.Keyboard.CHAR,widget.Keyboard.UP),
+ "1", "testUIKeyboardFB"),
+ ))
+
+ def testTextArea(self):
+ def setup():
+ self.ta1 = textarea.TextArea(pos=(2,2), size=(156, 96), parent=root)
+ self.ta1.setStyle(font="Bitstream vera sans", variant="Roman", fontsize=16,
+ multiline=True, color='FFFFFF')
+ self.ta1.setText('Lorem ipsum')
+ self.ta1.setFocus(True) # TODO: REMOVE
+
+ self.ta2 = textarea.TextArea(pos=(2,100), size=(156, 18), parent=root)
+ self.ta2.setStyle(font="Bitstream vera sans", variant="Roman", fontsize=14,
+ multiline=False, color='4b94ef', cursorColor='FF0000',
+ flashingCursor=False)
+ self.ta2.setText('sit dolor')
+ self.ta2.showCursor(False)
+ self.ta2.setFocus(True) # TODO: REMOVE
+
+ def setAndCheck(ta, text):
+ ta.setText(text)
+ self.assertEqual(ta.getText(), text)
+
+ def clear(ta):
+ ta.onKeyDown(textarea.KEYCODE_FORMFEED)
+ self.assertEqual(ta.getText(), '')
+
+ def testUnicode():
+ self.ta1.setText(u'some ùnìcöde')
+ self.ta1.onKeyDown(textarea.KEYCODES_BACKSPACE[0])
+ self.assertEqual(self.ta1.getText(), u'some ùnìcöd')
+ self.ta1.onKeyDown(textarea.KEYCODES_BACKSPACE[1])
+ self.ta1.onKeyDown(textarea.KEYCODES_BACKSPACE[0])
+ self.assertEqual(self.ta1.getText(), u'some ùnìc')
+ self.ta1.onKeyDown(ord(u'Ä'))
+ self.assertEqual(self.ta1.getText(), u'some ùnìcÄ')
+
+ def testSpecialChars():
+ clear(self.ta1)
+ self.ta1.onKeyDown(ord(u'&'))
+ self.ta1.onKeyDown(textarea.KEYCODES_BACKSPACE[0])
+ self.assertEqual(self.ta1.getText(), '')
+
+ def checkSingleLine():
+ text = ''
+ self.ta2.setText('')
+ while True:
+ self.assert_(len(text) < 20)
+ self.ta2.onKeyDown(ord(u'A'))
+ text = text + 'A'
+ if text != self.ta2.getText():
+ break
+
+ root = self.loadEmptyScene()
+
+ player.setFakeFPS(20)
+ textarea.init(avg, False)
+ self.start(True,
+ (setup,
+ lambda: self.delay(200),
+ lambda: self.assertEqual(self.ta1.getText(), 'Lorem ipsum'),
+ lambda: setAndCheck(self.ta1, ''),
+ lambda: setAndCheck(self.ta2, 'Lorem Ipsum'),
+ testUnicode,
+ lambda: self.compareImage("testTextArea1"),
+ testSpecialChars,
+ checkSingleLine,
+ lambda: self.compareImage("testTextArea2"),
+ lambda: self.ta2.showCursor(True),
+ lambda: self.delay(200),
+ lambda: self._sendTouchEvent(1, avg.Event.CURSOR_DOWN, 30, 100),
+ lambda: self._sendTouchEvent(1, avg.Event.CURSOR_UP, 30, 100),
+ lambda: self.compareImage("testTextArea3"),
+ lambda: self._sendTouchEvent(2, avg.Event.CURSOR_DOWN, 130, 100),
+ lambda: self.delay(1100),
+ lambda: self.compareImage("testTextArea4"),
+ lambda: self._sendTouchEvent(2, avg.Event.CURSOR_MOTION, 30, 100),
+ lambda: self.compareImage("testTextArea5"),
+ lambda: self._sendTouchEvent(2, avg.Event.CURSOR_UP, 30, 100),
+ lambda: self.compareImage("testTextArea3"),
+ ))
+ player.setFakeFPS(-1)
+
+ def testFocusContext(self):
+ def setup():
+ textarea.init(avg)
+ self.ctx1 = textarea.FocusContext()
+ self.ctx2 = textarea.FocusContext()
+
+ self.ta1 = textarea.TextArea(self.ctx1, pos=(2,2), size=(156,54), parent=root)
+ self.ta1.setStyle(fontsize=16, multiline=True, color='FFFFFF')
+ self.ta1.setText('Lorem ipsum')
+
+ self.ta2 = textarea.TextArea(self.ctx1, pos=(2,58), size=(76,54), parent=root)
+ self.ta2.setStyle(fontsize=14, multiline=False, color='FFFFFF')
+ self.ta2.setText('dolor')
+
+ self.bgImage = avg.ImageNode(href="1x1_white.png", size=(76,54))
+ self.ta3 = textarea.TextArea(self.ctx2, disableMouseFocus=True, pos=(80,58),
+ size=(76,54), textBackgroundNode=self.bgImage, parent=root)
+ self.ta3.setStyle(fontsize=14, multiline=True, color='FFFFFF')
+ self.ta3.setText('dolor sit amet')
+
+ textarea.setActiveFocusContext(self.ctx1)
+
+ def writeChar():
+ helper = player.getTestHelper()
+ helper.fakeKeyEvent(avg.Event.KEY_DOWN, 65, 65, "A", 65, 0)
+ helper.fakeKeyEvent(avg.Event.KEY_UP, 65, 65, "A", 65, 0)
+ helper.fakeKeyEvent(avg.Event.KEY_DOWN, 66, 66, "B", 66, 0)
+ helper.fakeKeyEvent(avg.Event.KEY_UP, 66, 66, "B", 66, 0)
+ helper.fakeKeyEvent(avg.Event.KEY_DOWN, 67, 67, "C", 67, 0)
+ helper.fakeKeyEvent(avg.Event.KEY_UP, 67, 67, "C", 67, 0)
+
+ def switchFocus():
+ self.ctx1.cycleFocus()
+
+ def clearFocused():
+ self.ctx1.clear()
+
+ def clickForFocus():
+ self._sendMouseEvent(avg.Event.CURSOR_DOWN, 20, 70)
+ self._sendMouseEvent(avg.Event.CURSOR_UP, 20, 70)
+
+ root = self.loadEmptyScene()
+ self.start(True,
+ (setup,
+ lambda: self.compareImage("testFocusContext1"),
+ writeChar,
+ lambda: self.compareImage("testFocusContext2"),
+ switchFocus,
+ writeChar,
+ lambda: self.compareImage("testFocusContext3"),
+ switchFocus,
+ clearFocused,
+ lambda: self.compareImage("testFocusContext4"),
+ clickForFocus,
+ clearFocused,
+ lambda: self.compareImage("testFocusContext5"),
+ ))
+
+
+ def testButton(self):
+
+ def enable(enabled):
+ button.enabled = enabled
+
+ def createScene(**kwargs):
+ root = self.loadEmptyScene()
+ button = widget.Button(
+ parent = root,
+ upNode = avg.ImageNode(href="button_up.png"),
+ downNode = avg.ImageNode(href="button_down.png"),
+ disabledNode = avg.ImageNode(href="button_disabled.png"),
+ **kwargs
+ )
+ self.messageTester = MessageTester(button,
+ [widget.Button.CLICKED, widget.Button.PRESSED,
+ widget.Button.RELEASED], self)
+ return button
+
+ def runTest():
+ self.start(False,
+ (# Standard down->up
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 0, 0,
+ [widget.Button.PRESSED]),
+ lambda: self.compareImage("testUIButtonDown"),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 0, 0,
+ [widget.Button.CLICKED, widget.Button.RELEASED]),
+ lambda: self.compareImage("testUIButtonUp"),
+
+ # Disable, down, up -> no click
+ lambda: self.assert_(button.enabled),
+ lambda: enable(False),
+ lambda: self.assert_(not(button.enabled)),
+ lambda: self.compareImage("testUIButtonDisabled"),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_DOWN, 0, 0),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 0, 0, []),
+ lambda: enable(True),
+ lambda: self.assert_(button.enabled),
+
+ # Down, up further away -> no click
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_DOWN, 0, 0),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 100, 0,
+ [widget.Button.PRESSED, widget.Button.RELEASED]),
+ lambda: self.compareImage("testUIButtonUp"),
+
+ # Down, move further away, up -> no click
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_DOWN, 0, 0),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_MOTION, 100, 0),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 100, 0,
+ [widget.Button.PRESSED, widget.Button.RELEASED]),
+ lambda: self.compareImage("testUIButtonUp"),
+
+ # Test if button still reacts after abort
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 0, 0,
+ [widget.Button.PRESSED]),
+ lambda: self.compareImage("testUIButtonDown"),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 0, 0,
+ [widget.Button.CLICKED, widget.Button.RELEASED]),
+ lambda: self.compareImage("testUIButtonUp"),
+ ))
+
+ button = createScene()
+ runTest()
+
+ button = createScene(activeAreaNode=avg.CircleNode(r=5, opacity=0))
+ runTest()
+
+ button = createScene(fatFingerEnlarge=True)
+ runTest()
+
+ root = self.loadEmptyScene()
+ button = widget.BmpButton(
+ parent = root,
+ upSrc = "button_up.png",
+ downSrc = "button_down.png",
+ disabledSrc = "button_disabled.png",
+ )
+ self.messageTester = MessageTester(button,
+ [widget.Button.CLICKED, widget.Button.PRESSED, widget.Button.RELEASED],
+ self)
+ runTest()
+
+ button = createScene(enabled=False)
+ self.start(False,
+ (lambda: self.compareImage("testUIButtonDisabled"),
+ ))
+
+ def testTextButton(self):
+ root = self.loadEmptyScene()
+ button = widget.TextButton("text", parent=root, size=(50,42))
+ self.messageTester = MessageTester(button,
+ [widget.Button.CLICKED, widget.Button.PRESSED, widget.Button.RELEASED],
+ self)
+ self.start(True,
+ (# Standard down->up
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 0, 0,
+ [widget.Button.PRESSED]),
+ lambda: self.compareImage("testTextButtonDown"),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 0, 0,
+ [widget.Button.CLICKED, widget.Button.RELEASED]),
+ lambda: self.compareImage("testTextButtonUp"),
+
+ # Check disabled graphics
+ lambda: self.assert_(button.enabled),
+ lambda: button.setEnabled(False),
+ lambda: self.assert_(not(button.enabled)),
+ lambda: self.compareImage("testTextButtonDisabled"),
+ lambda: button.setEnabled(True),
+
+ # Change text
+ lambda: button.setText("newText"),
+ lambda: self.compareImage("testTextButtonUpNewText"),
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 0, 0,
+ [widget.Button.PRESSED]),
+ lambda: self.compareImage("testTextButtonDownNewText"),
+ ))
+
+
+ def testToggleButton(self):
+
+ def onToggled(isToggled):
+ self.messageTester.setMessageReceived(widget.ToggleButton.TOGGLED)
+ self.toggled = isToggled
+
+ def createScene(**kwargs):
+ root = self.loadEmptyScene()
+ button = widget.ToggleButton(
+ uncheckedUpNode = avg.ImageNode(href="toggle_unchecked_Up.png"),
+ uncheckedDownNode = avg.ImageNode(href="toggle_unchecked_Down.png"),
+ checkedUpNode = avg.ImageNode(href="toggle_checked_Up.png"),
+ checkedDownNode = avg.ImageNode(href="toggle_checked_Down.png"),
+ uncheckedDisabledNode =
+ avg.ImageNode(href="toggle_unchecked_Disabled.png"),
+ checkedDisabledNode =
+ avg.ImageNode(href="toggle_checked_Disabled.png"),
+ parent=root,
+ **kwargs
+ )
+ self.messageTester = MessageTester(button,
+ [widget.ToggleButton.PRESSED, widget.ToggleButton.RELEASED], self)
+
+ button.subscribe(widget.ToggleButton.TOGGLED, onToggled)
+ return button
+
+ def testToggle():
+ self.start(False,
+ (lambda: self.compareImage("testUIToggleUnchecked_Up"),
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 0, 0,
+ [widget.ToggleButton.PRESSED]),
+ lambda: self.assert_(not self.toggled),
+ lambda: self.compareImage("testUIToggleUnchecked_Down"),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 0, 0,
+ [widget.ToggleButton.RELEASED, widget.ToggleButton.TOGGLED]),
+ lambda: self.assert_(self.toggled),
+ lambda: self.compareImage("testUIToggleChecked_Up"),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_DOWN, 0, 0),
+ lambda: self.compareImage("testUIToggleChecked_Down"),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_UP, 0, 0),
+ lambda: self.assert_(not(self.toggled)),
+ lambda: self.compareImage("testUIToggleUnchecked_Up"),
+ ))
+
+ def testToggleAbort():
+ self.start(False,
+ (lambda: self.compareImage("testUIToggleUnchecked_Up"),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_DOWN, 0, 0),
+ lambda: self.compareImage("testUIToggleUnchecked_Down"),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 100, 0,
+ [widget.ToggleButton.PRESSED, widget.ToggleButton.RELEASED]),
+ lambda: self.assert_(not self.toggled),
+ lambda: self.compareImage("testUIToggleUnchecked_Up"),
+ lambda: button.setChecked(True),
+ lambda: self.compareImage("testUIToggleChecked_Up"),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_DOWN, 0, 0),
+ lambda: self.compareImage("testUIToggleChecked_Down"),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_UP, 100, 0),
+ lambda: self.assert_(not(self.toggled)),
+ lambda: self.compareImage("testUIToggleChecked_Up"),
+ ))
+
+ def testToggleDisable():
+ self.start(False,
+ (lambda: self.compareImage("testUIToggleUnchecked_Disabled"),
+ lambda: self._sendTouchEvent(1, avg.Event.CURSOR_DOWN, 0, 0),
+ lambda: self._sendTouchEvent(1, avg.Event.CURSOR_UP, 0, 0),
+ lambda: self.compareImage("testUIToggleUnchecked_Disabled"),
+ lambda: button.setEnabled(True),
+ lambda: self.compareImage("testUIToggleUnchecked_Up"),
+ lambda: self._sendTouchEvent(2, avg.Event.CURSOR_DOWN, 0, 0),
+ lambda: button.setEnabled(False),
+ lambda: self._sendTouchEvent(2, avg.Event.CURSOR_UP, 0, 0),
+ lambda: self.assert_(not(self.toggled)),
+ lambda: self.compareImage("testUIToggleUnchecked_Disabled"),
+
+ lambda: button.setEnabled(True),
+ lambda: self.compareImage("testUIToggleUnchecked_Up"),
+ lambda: button.setChecked(True),
+ lambda: self.compareImage("testUIToggleChecked_Up"),
+ lambda: button.setEnabled(False),
+ lambda: self.compareImage("testUIToggleChecked_Disabled"),
+ lambda: self._sendTouchEvent(3, avg.Event.CURSOR_DOWN, 0, 0),
+ lambda: self._sendTouchEvent(3, avg.Event.CURSOR_UP, 0, 0),
+ lambda: self.compareImage("testUIToggleChecked_Disabled"),
+ lambda: button.setEnabled(True),
+ lambda: self.compareImage("testUIToggleChecked_Up"),
+ lambda: self._sendTouchEvent(4, avg.Event.CURSOR_DOWN, 0, 0),
+ lambda: button.setEnabled(False),
+ lambda: self._sendTouchEvent(4, avg.Event.CURSOR_UP, 0, 0),
+ lambda: self.assert_(not(self.toggled)),
+ lambda: self.compareImage("testUIToggleChecked_Disabled"),
+ ))
+
+ def testFromSrc():
+ root = self.loadEmptyScene()
+ button = widget.BmpToggleButton(
+ uncheckedUpSrc="toggle_unchecked_Up.png",
+ uncheckedDownSrc="toggle_unchecked_Down.png",
+ checkedUpSrc="toggle_checked_Up.png",
+ checkedDownSrc="toggle_checked_Down.png",
+ uncheckedDisabledSrc="toggle_unchecked_Disabled.png",
+ checkedDisabledSrc="toggle_checked_Disabled.png",
+ parent=root)
+ button.subscribe(widget.ToggleButton.TOGGLED, onToggled)
+ self.start(False,
+ (lambda: self.compareImage("testUIToggleUnchecked_Up"),
+ lambda: button.setChecked(True),
+ lambda: self.compareImage("testUIToggleChecked_Up"),
+ lambda: button.setChecked(False),
+ lambda: button.setEnabled(False),
+ lambda: self.compareImage("testUIToggleUnchecked_Disabled"),
+ lambda: button.setChecked(True),
+ lambda: self.compareImage("testUIToggleChecked_Disabled"),
+ ))
+
+ self.toggled = False
+ button = createScene()
+ testToggle()
+
+ button = createScene()
+ testToggleAbort()
+
+ button = createScene(enabled = False)
+ testToggleDisable()
+
+ button = createScene(activeAreaNode = avg.CircleNode(r=5, opacity=0))
+ testToggle()
+
+ button = createScene(fatFingerEnlarge = True)
+ testToggle()
+
+ testFromSrc()
+
+
+ def testCheckBox(self):
+
+ root = self.loadEmptyScene()
+ avg.RectNode(size=(160,120), fillcolor="FFFFFF", fillopacity=1, parent=root)
+ checkBox = widget.CheckBox(text="checkboxtext", pos=(10,10), parent=root)
+
+ self.start(True,
+ (lambda: self.compareImage("testUICheckBoxUnchecked_Up"),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_DOWN, 15, 15),
+ lambda: self.compareImage("testUICheckBoxUnchecked_Down"),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_UP, 15, 15),
+ lambda: self.compareImage("testUICheckBoxChecked_Up"),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_DOWN, 15, 15),
+ lambda: self.compareImage("testUICheckBoxChecked_Down"),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_UP, 15, 15),
+ lambda: self.compareImage("testUICheckBoxUnchecked_Up"),
+ lambda: checkBox.setEnabled(False),
+ lambda: self.compareImage("testUICheckBoxUnchecked_Disabled"),
+ lambda: checkBox.setEnabled(True),
+ lambda: self.compareImage("testUICheckBoxUnchecked_Up"),
+ # Test click on text.
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_DOWN, 50, 15),
+ lambda: self.compareImage("testUICheckBoxUnchecked_Down"),
+ ))
+
+
+ def testScrollPane(self):
+ def scrollLarge():
+ scrollPane.contentpos = (34, 34)
+ self.assertEqual(scrollPane.contentpos, (32,32))
+
+ def initSmallContent():
+ scrollPane.size = (64, 64)
+ contentArea.size = (32, 32)
+ image.size = (32, 32)
+ scrollPane.contentpos = (0, 0)
+ self.assertEqual(scrollPane.getMaxContentPos(), (0,0))
+
+ def scrollSmall():
+ scrollPane.contentpos = (32, 32)
+
+ root = self.loadEmptyScene()
+ contentArea = avg.DivNode(size=(64,64))
+ image = avg.ImageNode(href="rgb24-64x64.png", parent=contentArea)
+ scrollPane = widget.ScrollPane(contentNode=contentArea, size=(32,32), parent=root)
+
+ self.start(False,
+ (lambda: self.compareImage("testScrollPane1"),
+ scrollLarge,
+ lambda: self.compareImage("testScrollPane2"),
+ initSmallContent,
+ lambda: self.compareImage("testScrollPane3"),
+ scrollSmall,
+ lambda: self.compareImage("testScrollPane3"),
+ ))
+
+ def testStretchNode(self):
+
+ def changeExtent():
+ if orientation == widget.Orientation.HORIZONTAL:
+ self.node.width = 100
+ else:
+ self.node.height = 100
+
+ def minExtent():
+ if orientation == widget.Orientation.HORIZONTAL:
+ self.node.width = 3
+ self.assert_(self.node.width == 31)
+ else:
+ self.node.height = 3
+ self.assert_(self.node.height == 31)
+
+ for orientation, orName in (
+ (widget.Orientation.HORIZONTAL,"Horiz"),
+ (widget.Orientation.VERTICAL, "Vert"),):
+ root = self.loadEmptyScene()
+ if orientation == widget.Orientation.HORIZONTAL:
+ self.node = widget.HStretchNode(src="media/rgb24-32x32.png",
+ endsExtent=15, size=(31,31), parent=root)
+ else:
+ self.node = widget.VStretchNode(src="media/rgb24-32x32.png",
+ endsExtent=15, size=(31,31), parent=root)
+ self.start(False,
+ (lambda: self.compareImage("testStretchNode"+orName+"1"),
+ changeExtent,
+ lambda: self.compareImage("testStretchNode"+orName+"2"),
+ minExtent,
+ lambda: self.compareImage("testStretchNode"+orName+"1"),
+ ))
+
+
+ def testHVStretchNode(self):
+
+ def changeSize():
+ self.node.size = (64, 64)
+ self.assert_(self.node.size == (64,64))
+
+ root = self.loadEmptyScene()
+ self.node = widget.HVStretchNode(src="media/rgb24-32x32.png", endsExtent=(5,5),
+ size=(31,31), parent=root)
+ self.start(False,
+ (lambda: self.compareImage("testHVStretchNode1"),
+ changeSize,
+ lambda: self.compareImage("testHVStretchNode2"),
+ ))
+
+
+ def testSlider(self):
+ def onThumbPosChanged(pos):
+ self.thumbPos = pos
+
+ def setSize():
+ if orientation == widget.Orientation.HORIZONTAL:
+ self.node.width=140
+ else:
+ self.node.height=60
+
+ sys.stderr.write("\n")
+ for orientation, orName in (
+ (widget.Orientation.HORIZONTAL, "Horiz"),
+ (widget.Orientation.VERTICAL, "Vert")):
+ for widgetType in ("Slider", "TimeSlider"):
+ sys.stderr.write(" "+widgetType+", "+orName+"\n")
+ root = self.loadEmptyScene()
+ if widgetType == "Slider":
+ self.node = widget.Slider(orientation=orientation, pos=(20,20),
+ width=100, height=100, parent=root)
+ else:
+ self.node = widget.TimeSlider(orientation=orientation, pos=(20,20),
+ width=100, height=100, parent=root)
+ self.start(False,
+ (lambda: self.compareImage("test"+widgetType+orName+"1"),
+ lambda: self.node.setThumbPos(0.25),
+ lambda: self.compareImage("test"+widgetType+orName+"2"),
+ lambda: self.node.setThumbPos(1),
+ lambda: self.compareImage("test"+widgetType+orName+"3"),
+ lambda: self.node.setRange((1,10)),
+ lambda: self.compareImage("test"+widgetType+orName+"1"),
+ lambda: self.node.setRange((10,1)),
+ lambda: self.compareImage("test"+widgetType+orName+"3"),
+ setSize,
+ lambda: self.compareImage("test"+widgetType+orName+"4"),
+ lambda: self.node.setEnabled(False),
+ lambda: self.compareImage("test"+widgetType+orName+"5"),
+ lambda: self.node.setEnabled(True),
+ lambda: self.compareImage("test"+widgetType+orName+"4"),
+ ))
+
+
+ def testScrollBar(self):
+
+ def onThumbPosChanged(pos):
+ self.thumbPos = pos
+
+ for orientation, orName in (
+ (widget.Orientation.HORIZONTAL, "Horiz"),
+ (widget.Orientation.VERTICAL, "Vert")):
+ root = self.loadEmptyScene()
+ self.node = widget.ScrollBar(orientation=orientation, pos=(20,20),
+ width=100, height=100, parent=root)
+ self.start(False,
+ (lambda: self.compareImage("testScrollBar"+orName+"1"),
+ lambda: self.node.setThumbExtent(0.5),
+ lambda: self.compareImage("testScrollBar"+orName+"2"),
+ lambda: self.node.setThumbPos(0.25),
+ lambda: self.compareImage("testScrollBar"+orName+"3"),
+ lambda: self.node.setThumbPos(5),
+ lambda: self.compareImage("testScrollBar"+orName+"4"),
+ lambda: self.node.setRange((0,10)),
+ lambda: self.node.setThumbPos(4.75),
+ lambda: self.compareImage("testScrollBar"+orName+"5"),
+ lambda: self.node.setRange((10,20)),
+ lambda: self.node.setThumbPos(14.75),
+ lambda: self.compareImage("testScrollBar"+orName+"5"),
+ lambda: self.node.setThumbExtent(10),
+ lambda: self.compareImage("testScrollBar"+orName+"6"),
+ lambda: self.node.setRange((10,0)),
+ lambda: self.node.setThumbExtent(0.5),
+ lambda: self.node.setThumbPos(4.75),
+ lambda: self.compareImage("testScrollBar"+orName+"5"),
+ ))
+
+ # Horizontal
+ root = self.loadEmptyScene()
+ self.node = widget.ScrollBar(orientation=widget.Orientation.HORIZONTAL,
+ pos=(20,5), width=100, parent=root)
+ self.messageTester = MessageTester(self.node,
+ [widget.Slider.PRESSED, widget.Slider.RELEASED], self)
+ self.start(False,
+ (lambda: self.node.setThumbExtent(0.5),
+ # User input
+ self._genMouseEventFrames(avg.Event.CURSOR_DOWN, 25, 10,
+ [widget.Slider.PRESSED]),
+ lambda: self.compareImage("testScrollBarHoriz7"),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_MOTION, 50, 10),
+ lambda: self.compareImage("testScrollBarHoriz8"),
+ lambda: self.assertAlmostEqual(self.node.getThumbPos(), 0.25),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_MOTION, 25, 10),
+ lambda: self.compareImage("testScrollBarHoriz9"),
+ lambda: self.assertAlmostEqual(self.node.getThumbPos(), 0),
+ self._genMouseEventFrames(avg.Event.CURSOR_UP, 0, 10,
+ [widget.Slider.RELEASED]),
+ lambda: self.compareImage("testScrollBarHoriz10"),
+ lambda: self.assertAlmostEqual(self.node.getThumbPos(), 0),
+
+ # Publish/Subscribe interface
+ lambda: self.node.subscribe(widget.ScrollBar.THUMB_POS_CHANGED,
+ onThumbPosChanged),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_DOWN, 25, 10),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_UP, 50, 10),
+ lambda: self.assertAlmostEqual(self.thumbPos, 0.25),
+
+ # Enable/disable
+ self.messageTester.reset,
+ lambda: self.node.setEnabled(False),
+ lambda: self.compareImage("testScrollBarHoriz11"),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_DOWN, 50, 10),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_UP, 25, 10),
+ lambda: self.messageTester.assertState([]),
+ lambda: self.assertAlmostEqual(self.thumbPos, 0.25),
+ lambda: self.node.setEnabled(True),
+ lambda: self.compareImage("testScrollBarHoriz12"),
+
+ # Disable after down: Drag aborted
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_DOWN, 50, 10),
+ lambda: self.node.setEnabled(False),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_UP, 25, 10),
+ lambda: self.assertAlmostEqual(self.thumbPos, 0.25),
+ lambda: self.node.setEnabled(True),
+ lambda: self.compareImage("testScrollBarHoriz12"),
+ ))
+
+ # Vertical: Don't need to test everything again, just make sure coords are
+ # calculated correctly.
+ root = self.loadEmptyScene()
+ self.node = widget.ScrollBar(orientation=widget.Orientation.VERTICAL, pos=(5,5),
+ height=100, parent=root)
+ self.start(False,
+ (lambda: self.node.setThumbExtent(0.5),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_DOWN, 10, 25),
+ lambda: self.compareImage("testScrollBarVert7"),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_MOTION, 10, 50),
+ lambda: self.compareImage("testScrollBarVert8"),
+ lambda: self.assertAlmostEqual(self.node.getThumbPos(), 0.25),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_UP, 10, 0),
+ lambda: self.compareImage("testScrollBarVert9"),
+ lambda: self.assertAlmostEqual(self.node.getThumbPos(), 0),
+ ))
+
+ def testProgressBar(self):
+
+ def setValue(value):
+ self.node.value = value
+
+ def setRange(range):
+ self.node.range = range
+
+ root = self.loadEmptyScene()
+ self.node = widget.ProgressBar(orientation=widget.Orientation.HORIZONTAL,
+ pos=(5,5), width=100, parent=root)
+ self.start(False,
+ (lambda: self.compareImage("testProgressBar1"),
+ lambda: setValue(0.5),
+ lambda: self.compareImage("testProgressBar2"),
+ lambda: setValue(1),
+ lambda: self.compareImage("testProgressBar3"),
+ lambda: setRange((23,42)),
+ lambda: self.compareImage("testProgressBar1"),
+ lambda: setValue(32.5),
+ lambda: self.compareImage("testProgressBar2"),
+ ))
+
+ def testMediaControl(self):
+
+ def onSeek(time):
+ self.messageTester.setMessageReceived(widget.MediaControl.SEEK_MOTION)
+
+ root = self.loadEmptyScene()
+ self.node = widget.MediaControl(size=(160,30), parent=root)
+ self.messageTester = MessageTester(self.node,
+ [widget.MediaControl.PLAY_CLICKED, widget.MediaControl.PAUSE_CLICKED,
+ widget.MediaControl.SEEK_PRESSED, widget.MediaControl.SEEK_RELEASED],
+ self)
+ self.node.subscribe(widget.MediaControl.SEEK_MOTION, onSeek)
+ self.start(True,
+ (lambda: self.compareImage("testMediaControl1"),
+ lambda: self.node.setDuration(60*1000),
+ lambda: self.compareImage("testMediaControl2"),
+ lambda: self.node.setTime(30*1000),
+ lambda: self.compareImage("testMediaControl3"),
+ lambda: self.node.setTime(60*1000),
+ lambda: self.compareImage("testMediaControl4"),
+ lambda: self.node.play(),
+ lambda: self.compareImage("testMediaControl5"),
+ lambda: self.node.pause(),
+ lambda: self.compareImage("testMediaControl4"),
+ self.messageTester.reset,
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_DOWN, 1, 1),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_UP, 1, 1),
+ lambda: self.messageTester.assertState(
+ [widget.MediaControl.PLAY_CLICKED,]),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_DOWN, 1, 1),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_UP, 1, 1),
+ lambda: self.messageTester.assertState(
+ [widget.MediaControl.PAUSE_CLICKED,]),
+ lambda: self.node.setTime(0),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_DOWN, 56, 5),
+ lambda: self.messageTester.assertState(
+ [widget.MediaControl.SEEK_PRESSED]),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_MOTION, 150, 5),
+ lambda: self.messageTester.assertState(
+ [widget.MediaControl.SEEK_MOTION,]),
+ lambda: self.compareImage("testMediaControl4"),
+ lambda: self._sendMouseEvent(avg.Event.CURSOR_UP, 150, 5),
+ lambda: self.messageTester.assertState(
+ [widget.MediaControl.SEEK_RELEASED,]),
+ ))
+
+ def testScrollArea(self):
+ def setSize(size):
+ self.node.size = size
+
+ root = self.loadEmptyScene()
+ image = avg.ImageNode(href="rgb24-64x64.png", size=(200,400))
+ self.node = widget.ScrollArea(contentNode=image, size=(80,80), parent=root)
+ self.start(False,
+ (lambda: self.compareImage("testScrollArea1"),
+ lambda: setSize((120,80)),
+ lambda: self.compareImage("testScrollArea2"),
+ ))
+
+ def testScrollAreaCustomSkin(self):
+ root = self.loadEmptyScene()
+ image = avg.ImageNode(href="rgb24-64x64.png", size=(200, 400))
+ pwdPath = os.path.dirname(os.path.realpath(__file__))
+ mediaPath = os.path.join(pwdPath, "media")
+ skin = widget.Skin("CustomSkin.xml", mediaPath)
+ self.node = widget.ScrollArea(contentNode=image, size=(80, 80), skinObj=skin,
+ parent=root)
+ self.start(False,
+ (lambda: self.compareImage("testScrollArea3"),))
+
+ def testCustomMediaDir(self):
+ root = self.loadEmptyScene()
+
+ pwdPath = os.path.dirname(os.path.realpath(__file__))
+ mediaPath = os.path.join(pwdPath, "media")
+ skin = widget.Skin("SimpleSkin.xml", mediaPath)
+ downBmpPath = skin.textButtonCfg[None]['downBmp'].getName()
+ upBmpPath = skin.textButtonCfg[None]['upBmp'].getName()
+ self.assert_(downBmpPath == os.path.join(mediaPath, 'button_bg_down.png'))
+ self.assert_(upBmpPath == os.path.join(mediaPath, 'button_bg_up.png'))
+
+ customSkinMediaPath = os.path.join(mediaPath, 'incompleteSkinMedia')
+ skin = widget.Skin("IncompleteSkin.xml", customSkinMediaPath)
+ self.node = widget.ScrollBar(orientation=widget.Orientation.HORIZONTAL,
+ pos=(20,5), width=100, parent=root, skinObj=skin)
+ self.start(False, ())
+
+
+def widgetTestSuite(tests):
+ availableTests = (
+ "testKeyboard",
+ "testTextArea",
+ "testFocusContext",
+ "testButton",
+ "testTextButton",
+ "testToggleButton",
+ "testCheckBox",
+ "testScrollPane",
+ "testStretchNode",
+ "testHVStretchNode",
+ "testSlider",
+ "testScrollBar",
+ "testProgressBar",
+ "testMediaControl",
+ "testScrollArea",
+ "testScrollAreaCustomSkin",
+ "testCustomMediaDir",
+ )
+
+ return createAVGTestSuite(availableTests, WidgetTestCase, tests)
diff --git a/src/test/WordsTest.py b/src/test/WordsTest.py
index 1fdbfd5..a5e856e 100644
--- a/src/test/WordsTest.py
+++ b/src/test/WordsTest.py
@@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
# libavg - Media Playback Engine.
-# Copyright (C) 2003-2011 Ulrich von Zadow
+# 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
@@ -22,20 +22,20 @@
import platform
-from libavg import avg
+from libavg import avg, player
from testcase import *
class WordsTestCase(AVGTestCase):
def __init__(self, testFuncName):
AVGTestCase.__init__(self, testFuncName)
-
+
def testSimpleWords(self):
def checkFont():
self.assertEqual(node.variant, "bold")
def checkUnicodeText():
node.text = u"föa"
- newNode = avg.WordsNode(text=u"öäü")
+ avg.WordsNode(text=u"öäü", font="Bitstream Vera Sans")
fontList = avg.WordsNode.getFontFamilies()
try:
@@ -47,12 +47,12 @@ class WordsTestCase(AVGTestCase):
root = self.loadEmptyScene()
avg.WordsNode (pos=(1,1), fontsize=12, font="Bitstream Vera Sans",
text="Bitstream Vera Sans", variant="roman", parent=root)
- node = avg.WordsNode (pos=(1,16), fontsize=12, font="Bitstream Vera Sans",
+ node = avg.WordsNode(pos=(1,16), fontsize=12, font="Bitstream Vera Sans",
text="Bold", variant="bold", parent=root)
self.assertNotEqual(node.size, (0,0))
- pos = node.getGlyphPos(0)
- self.start((
- lambda: self.compareImage("testSimpleWords", True),
+ node.getGlyphPos(0)
+ self.start(True,
+ (lambda: self.compareImage("testSimpleWords"),
checkFont,
checkUnicodeText,
))
@@ -64,11 +64,63 @@ class WordsTestCase(AVGTestCase):
node.text = newText
self.assertNotEqual(node.size, size)
+ def changeFont():
+ size = node.size
+ node.fontsize = 18
+ self.assertNotEqual(node.size, size)
+
root = self.loadEmptyScene()
node = avg.WordsNode(font="Bitstream Vera Sans", fontsize=12, text="foo",
parent=root)
changeText("foobar")
- self.start((lambda: changeText("bar"),))
+ self.start(True,
+ (lambda: changeText("bar"),
+ changeFont,
+ ))
+
+ def testFontStyle(self):
+
+ def setStyle(node, style):
+ node.fontstyle = style
+ self.assert_(node.fontsize == 15)
+
+ fontStyle = avg.FontStyle(font="Bitstream Vera Sans", variant="Roman",
+ fontsize=12)
+ self.assert_(fontStyle.font == "Bitstream Vera Sans")
+ root = self.loadEmptyScene()
+ words = avg.WordsNode(pos=(1,1), fontstyle=fontStyle, text="Bitstream Vera Sans",
+ parent=root)
+ avg.WordsNode (pos=(1,16), fontstyle=fontStyle, variant="bold", text="Bold",
+ parent=root)
+ otherFontStyle = fontStyle
+ otherFontStyle.fontsize = 15
+ self.start(True,
+ (lambda: self.compareImage("testFontStyle1"),
+ lambda: setStyle(words, otherFontStyle),
+ lambda: self.compareImage("testFontStyle2"),
+ ))
+
+ def testBaseStyle(self):
+ attrs = {"font": "Bitstream Vera Sans",
+ "variant": "Bold",
+ "color": "FF0000",
+ "aagamma": 0.5,
+ "fontsize": 20,
+ "indent": 1,
+ "linespacing": 2,
+ "alignment": "right",
+ "wrapmode": "char",
+ "justify": True,
+ "letterspacing": 3,
+ "hint": False}
+ defaultStyle = avg.FontStyle()
+ fontStyle1 = avg.FontStyle(basestyle=defaultStyle, **attrs)
+ for attrName in attrs.iterkeys():
+ self.assert_(getattr(fontStyle1, attrName) != getattr(defaultStyle, attrName))
+ self.assert_(getattr(fontStyle1, attrName) == attrs[attrName])
+ fontStyle2 = avg.FontStyle(basestyle=fontStyle1)
+ for attrName in attrs.iterkeys():
+ self.assert_(getattr(fontStyle2, attrName) == getattr(fontStyle1, attrName))
def testGlyphPos(self):
def posAlmostEqual(pos1, pos2):
@@ -107,14 +159,14 @@ class WordsTestCase(AVGTestCase):
font="Bitstream Vera Sans", linespacing=-4,
text="Paragraph with custom line spacing.",
parent=root)
- self.start([lambda: self.compareImage("testParaWords", True)])
+ self.start(True, [lambda: self.compareImage("testParaWords")])
def testJustify(self):
root = self.loadEmptyScene()
avg.WordsNode(pos=(1,1), fontsize=12, font="Bitstream Vera Sans",
variant="roman", justify=True, width=100,
text="Justified paragraph more than one line long.", parent=root)
- self.start([lambda: self.compareImage("testJustify", True)])
+ self.start(True, [lambda: self.compareImage("testJustify")])
def testWrapMode(self):
def setCharMode():
@@ -132,15 +184,15 @@ class WordsTestCase(AVGTestCase):
text="""Wrapped paragraph more than one line long.
Withaverylongpackedlinewithnobreaks""",
parent=root)
- self.start([
- lambda: self.compareImage("testWrapMode1", True),
- setCharMode,
- lambda: self.compareImage("testWrapMode2", True),
- setWordMode,
- lambda: self.compareImage("testWrapMode3", True),
- setWordCharMode,
- lambda: self.compareImage("testWrapMode4", True),
- ])
+ self.start(True,
+ (lambda: self.compareImage("testWrapMode1"),
+ setCharMode,
+ lambda: self.compareImage("testWrapMode2"),
+ setWordMode,
+ lambda: self.compareImage("testWrapMode3"),
+ setWordCharMode,
+ lambda: self.compareImage("testWrapMode4"),
+ ))
def testWordsMask(self):
def setMask():
@@ -148,7 +200,7 @@ class WordsTestCase(AVGTestCase):
node.maskhref = "mask1.png"
except RuntimeError:
self.skip("no shader support")
- Player.stop()
+ player.stop()
def setColor():
node.color = "FFFF00"
@@ -169,6 +221,12 @@ class WordsTestCase(AVGTestCase):
def setDefaultSize():
node.masksize = (0,0)
+ def setCentered():
+ node.alignment = "center"
+ node.masksize = (160, 120)
+ node.pos = (80,20)
+ node.maskpos = (0, -20)
+
root = self.loadEmptyScene()
node = avg.WordsNode(fontsize=8, linespacing=-4, font="Bitstream Vera Sans",
variant="roman", width=160,
@@ -182,19 +240,21 @@ class WordsTestCase(AVGTestCase):
Ulysses von James Joyce werden. Aber jetzt lohnt es sich noch nicht, \
mich weiterzulesen. Denn vorerst bin ich nur ein kleiner Blindtext.",
parent=root)
- self.start((
- setMask,
- lambda: self.compareImage("testWordsMask1", False),
+ self.start(True,
+ (setMask,
+ lambda: self.compareImage("testWordsMask1"),
setColor,
- lambda: self.compareImage("testWordsMask2", False),
+ lambda: self.compareImage("testWordsMask2"),
setOpacity,
- lambda: self.compareImage("testWordsMask3", False),
+ lambda: self.compareImage("testWordsMask3"),
setSize,
- lambda: self.compareImage("testWordsMask4", False),
+ lambda: self.compareImage("testWordsMask4"),
setPos,
- lambda: self.compareImage("testWordsMask5", False),
+ lambda: self.compareImage("testWordsMask5"),
setDefaultSize,
- lambda: self.compareImage("testWordsMask6", False),
+ lambda: self.compareImage("testWordsMask6"),
+ setCentered,
+ lambda: self.compareImage("testWordsMask7"),
))
def testHinting(self):
@@ -222,20 +282,20 @@ class WordsTestCase(AVGTestCase):
avg.WordsNode(pos=(1,15), fontsize=12, font="Bitstream Vera Sans",
variant="roman", hint=True, text="Lorem ipsum dolor (hinting)",
parent=root)
- self.start([checkPositions])
+ self.start(True, [checkPositions])
def testSpanWords(self):
def setTextAttrib():
- self.baselineBmp = Player.screenshot()
- Player.getElementByID("words").text = self.text
+ self.baselineBmp = player.screenshot()
+ player.getElementByID("words").text = self.text
def checkSameImage():
- bmp = Player.screenshot()
+ bmp = player.screenshot()
self.assert_(self.areSimilarBmps(bmp, self.baselineBmp, 0, 0))
def createUsingDict():
- Player.getElementByID("words").unlink()
+ player.getElementByID("words").unlink()
node = avg.WordsNode(id="words", pos=(1,1), fontsize=12, width=120,
font="Bitstream Vera Sans", variant="roman", text=self.text)
root.appendChild(node)
@@ -246,7 +306,7 @@ class WordsTestCase(AVGTestCase):
<i>italics</i>, <b>bold</b>
"""
root = self.loadEmptyScene()
- node = Player.createNode("""
+ node = player.createNode("""
<words id="words" x="1" y="1" fontsize="12" width="120"
font="Bitstream Vera Sans" variant="roman">
"""
@@ -255,13 +315,13 @@ class WordsTestCase(AVGTestCase):
</words>
""")
root.appendChild(node)
- self.start(
- [lambda: self.compareImage("testSpanWords", True),
+ self.start(True,
+ [lambda: self.compareImage("testSpanWords"),
setTextAttrib,
- lambda: self.compareImage("testSpanWords", True),
+ lambda: self.compareImage("testSpanWords"),
checkSameImage,
createUsingDict,
- lambda: self.compareImage("testSpanWords", True),
+ lambda: self.compareImage("testSpanWords"),
checkSameImage,
])
@@ -300,17 +360,17 @@ class WordsTestCase(AVGTestCase):
root = self.loadEmptyScene()
words = avg.WordsNode(pos=(1,1), fontsize=12, font="Bitstream Vera Sans",
text="foo", parent=root)
- self.start((
- lambda: self.compareImage("testDynamicWords1", True),
+ self.start(True,
+ (lambda: self.compareImage("testDynamicWords1"),
changeText,
changeHeight,
changeFont,
- lambda: self.compareImage("testDynamicWords2", True),
+ lambda: self.compareImage("testDynamicWords2"),
deactivateText,
- lambda: self.compareImage("testDynamicWords3", True),
+ lambda: self.compareImage("testDynamicWords3"),
activateText,
changeFont2,
- lambda: self.compareImage("testDynamicWords4", True),
+ lambda: self.compareImage("testDynamicWords4"),
changeTextWithInvalidTag
))
@@ -329,7 +389,7 @@ class WordsTestCase(AVGTestCase):
words = avg.WordsNode(pos=(1,24), fontsize=12, font="Bitstream Vera Sans",
text="foo", parent=root)
root.appendChild(
- Player.createNode("""
+ player.createNode("""
<words x="1" y="48" fontsize="12" font="Bitstream Vera Sans">
&amp;
</words>
@@ -337,12 +397,12 @@ class WordsTestCase(AVGTestCase):
avg.WordsNode(pos=(12,48), fontsize=12, font="Bitstream Vera Sans", text="&amp;",
rawtextmode=True, parent=root)
- self.start((
- lambda: self.compareImage("testI18NWords1", True),
+ self.start(True,
+ (lambda: self.compareImage("testI18NWords1"),
changeUnicodeText,
- lambda: self.compareImage("testI18NWords2", True),
+ lambda: self.compareImage("testI18NWords2"),
setNBSP,
- lambda: self.compareImage("testI18NWords3", True),
+ lambda: self.compareImage("testI18NWords3"),
))
def testRawText(self):
@@ -352,7 +412,7 @@ class WordsTestCase(AVGTestCase):
variant='roman', fontsize=12)
root.appendChild(self.dictdnode)
- self.xmldnode = Player.createNode("""
+ self.xmldnode = player.createNode("""
<words text="&lt;test dynattr&amp;" fontsize="12"
font="Bitstream Vera Sans" variant="roman" rawtextmode="true"
x="1" y="85"/>""")
@@ -380,36 +440,37 @@ class WordsTestCase(AVGTestCase):
root = self.loadEmptyScene()
attribNode = avg.WordsNode(text="ùnicòdé <b>bold</b>",
fontsize=12, pos=(1,5), font="Bitstream Vera Sans", parent=root)
- valNode = Player.createNode("""
+ valNode = player.createNode("""
<words id="nodeval" fontsize="10" x="1" y="25" font="Bitstream Vera Sans"><b>bold</b> ùnicòdé &lt;</words>""")
root.appendChild(valNode)
root.appendChild(
- Player.createNode("""
+ player.createNode("""
<words x="1" y="45" fontsize="15" font="Bitstream Vera Sans">
&amp;
</words>"""))
- self.start((
- lambda: self.compareImage("testRawText1", True),
+ self.start(True,
+ (lambda: self.compareImage("testRawText1"),
createDynNodes,
- lambda: self.compareImage("testRawText2", True),
+ lambda: self.compareImage("testRawText2"),
switchRawMode,
- lambda: self.compareImage("testRawText3", True),
+ lambda: self.compareImage("testRawText3"),
bombIt,
assignNewTexts,
- lambda: self.compareImage("testRawText4", True),
+ lambda: self.compareImage("testRawText4"),
))
def testWordsBR(self):
root = self.loadEmptyScene()
avg.WordsNode(pos=(1,1), fontsize=12, font="Bitstream Vera Sans", variant="roman",
text="paragraph 1<br/>paragraph 2", parent=root)
- self.start([lambda: self.compareImage("testWordsBR", True)])
+ self.start(True,
+ [lambda: self.compareImage("testWordsBR")])
def testLetterSpacing(self):
def setSpacing():
- Player.getElementByID("words1").letterspacing=-2
- Player.getElementByID("words2").letterspacing=-2
+ player.getElementByID("words1").letterspacing=-2
+ player.getElementByID("words2").letterspacing=-2
root = self.loadEmptyScene()
avg.WordsNode(id="words1", pos=(1,1), fontsize=12, font="Bitstream Vera Sans",
@@ -420,10 +481,10 @@ class WordsTestCase(AVGTestCase):
parent=root)
avg.WordsNode(id="words2", pos=(1,20), fontsize=12, font="Bitstream Vera Sans",
variant="roman", letterspacing=2, text="spaced", parent=root)
- self.start((
- lambda: self.compareImage("testLetterSpacing1", True),
+ self.start(True,
+ (lambda: self.compareImage("testLetterSpacing1"),
setSpacing,
- lambda: self.compareImage("testLetterSpacing2", True)
+ lambda: self.compareImage("testLetterSpacing2")
))
def testPositioning(self):
@@ -458,16 +519,14 @@ class WordsTestCase(AVGTestCase):
font="Bitstream Vera Sans", variant="roman", text="Centered",
parent=root)
for id in ["left", "center", "right"]:
- Player.getElementByID(id).setEventHandler(avg.CURSORDOWN, avg.MOUSE,
- onMouse)
+ player.getElementByID(id).subscribe(avg.Node.CURSOR_DOWN, onMouse)
self.clicked = False
- helper = Player.getTestHelper()
- leftWidth = Player.getElementByID("left").getMediaSize()[0]
- centerWidth = Player.getElementByID("center").getMediaSize()[0]
- rightWidth = Player.getElementByID("right").getMediaSize()[0]
+ leftWidth = player.getElementByID("left").getMediaSize()[0]
+ centerWidth = player.getElementByID("center").getMediaSize()[0]
+ rightWidth = player.getElementByID("right").getMediaSize()[0]
- self.start((
- lambda: self.compareImage("testPositioning", True),
+ self.start(True,
+ (lambda: self.compareImage("testPositioning"),
lambda: click((4,20)),
lambda: self.assert_(testInside(True)),
lambda: click((3,20)),
@@ -512,9 +571,9 @@ class WordsTestCase(AVGTestCase):
def assignInvalidColor3():
testColor('xxxxxx')
- root = self.loadEmptyScene()
- self.start((
- self.assertException(assignInvalidColor1),
+ self.loadEmptyScene()
+ self.start(True,
+ (self.assertException(assignInvalidColor1),
self.assertException(assignInvalidColor2),
self.assertException(assignInvalidColor3),
))
@@ -523,18 +582,20 @@ class WordsTestCase(AVGTestCase):
avg.WordsNode.addFontDir('extrafonts')
root = self.loadEmptyScene()
avg.WordsNode(font="testaddfontdir", fontsize=50, text="ABAAA", parent=root)
- self.start((lambda: self.compareImage("testFontDir", True),))
+ self.start(True,
+ (lambda: self.compareImage("testFontDir"),))
def testGetNumLines(self):
textNode = avg.WordsNode(text="paragraph 1<br/>paragraph 2<br/>paragraph 3")
self.assertEqual(textNode.getNumLines(), 3)
+ textNode.text = ""
+ self.assertEqual(textNode.getNumLines(), 0)
def testGetLineExtents(self):
textNode = avg.WordsNode(fontsize = 100,
font = "Bitstream Vera Sans",
text = "bla <br/> blabli <br/> blabliblabla")
self.assertEqual(textNode.getLineExtents(0), (184,117))
- textNode.parent = Player.getRootNode()
self.assertEqual(textNode.getLineExtents(1), (303,117))
def testGetCharIndexFromPos(self):
@@ -568,32 +629,52 @@ class WordsTestCase(AVGTestCase):
def testSize(p1, p2):
self.assert_(abs(p1.x - p2.x) < 5)
- self.assert_(abs(p1.y - p2.y) < 5)
+ self.assert_(abs(p1.y - p2.y) < 50)
testSize(textNode.size, avg.Point2D(630,13))
testSize(textNode.getMediaSize(), avg.Point2D(630,13))
mediaSize = textNode.getMediaSize()
def changeSize():
- textNode.width = 50
+ textNode.width = 50
testSize(textNode.size, avg.Point2D(50,182))
testSize(textNode.getMediaSize(), avg.Point2D(45,182))
self.assertNotEqual(mediaSize, textNode.getMediaSize())
- self.start([lambda: changeSize()])
+ self.start(True,
+ [lambda: changeSize()])
def testTooWide(self):
root = self.loadEmptyScene()
text = "42 " * 42 * 20
- node = avg.WordsNode(parent=root, text=text)
+ avg.WordsNode(parent=root, text=text)
self.assertException(
lambda: self.start((None, None))
)
+ def testWordsGamma(self):
+
+ def setGamma():
+ node.aagamma = 4
+
+ root = self.loadEmptyScene()
+ for i, gamma in enumerate((2, 1.5, 1)):
+ node = avg.WordsNode(pos=(1,i*20), fontsize=12, font="Bitstream Vera Sans",
+ variant="roman", aagamma=gamma, text="lorem ipsum dolor",
+ parent=root)
+ self.start(True,
+ (lambda: self.compareImage("testWordsGamma1"),
+ setGamma,
+ lambda: self.compareImage("testWordsGamma2"),
+ ))
+
+
def wordsTestSuite(tests):
availableTests = (
"testSimpleWords",
"testRedrawOnDemand",
+ "testFontStyle",
+ "testBaseStyle",
"testGlyphPos",
"testParaWords",
"testJustify",
@@ -615,7 +696,6 @@ def wordsTestSuite(tests):
"testGetTextAsDisplayed",
"testSetWidth",
"testTooWide",
+ "testWordsGamma",
)
return createAVGTestSuite(availableTests, WordsTestCase, tests)
-
-Player = avg.Player.get()
diff --git a/src/test/baseline/testBitmap2.png b/src/test/baseline/testBitmap2.png
new file mode 100644
index 0000000..f94b54e
--- /dev/null
+++ b/src/test/baseline/testBitmap2.png
Binary files differ
diff --git a/src/test/baseline/testBitmap3.png b/src/test/baseline/testBitmap3.png
new file mode 100644
index 0000000..7d0898d
--- /dev/null
+++ b/src/test/baseline/testBitmap3.png
Binary files differ
diff --git a/src/test/baseline/testBitmap4.png b/src/test/baseline/testBitmap4.png
new file mode 100644
index 0000000..5569133
--- /dev/null
+++ b/src/test/baseline/testBitmap4.png
Binary files differ
diff --git a/src/test/baseline/testCanvasNullFX3.png b/src/test/baseline/testCanvasNullFX3.png
new file mode 100644
index 0000000..56571a2
--- /dev/null
+++ b/src/test/baseline/testCanvasNullFX3.png
Binary files differ
diff --git a/src/test/baseline/testChromaKeyFX1.png b/src/test/baseline/testChromaKeyFX1.png
new file mode 100644
index 0000000..9f63ce5
--- /dev/null
+++ b/src/test/baseline/testChromaKeyFX1.png
Binary files differ
diff --git a/src/test/baseline/testChromaKeyFX2.png b/src/test/baseline/testChromaKeyFX2.png
new file mode 100644
index 0000000..65df5ea
--- /dev/null
+++ b/src/test/baseline/testChromaKeyFX2.png
Binary files differ
diff --git a/src/test/baseline/testChromaKeyFX3.png b/src/test/baseline/testChromaKeyFX3.png
new file mode 100644
index 0000000..1ab1b59
--- /dev/null
+++ b/src/test/baseline/testChromaKeyFX3.png
Binary files differ
diff --git a/src/test/baseline/testChromaKeyFX4.png b/src/test/baseline/testChromaKeyFX4.png
new file mode 100644
index 0000000..86efc70
--- /dev/null
+++ b/src/test/baseline/testChromaKeyFX4.png
Binary files differ
diff --git a/src/test/baseline/testFontStyle1.png b/src/test/baseline/testFontStyle1.png
new file mode 100644
index 0000000..3d773d6
--- /dev/null
+++ b/src/test/baseline/testFontStyle1.png
Binary files differ
diff --git a/src/test/baseline/testFontStyle2.png b/src/test/baseline/testFontStyle2.png
new file mode 100644
index 0000000..e67cfa4
--- /dev/null
+++ b/src/test/baseline/testFontStyle2.png
Binary files differ
diff --git a/src/test/baseline/testHVStretchNode1.png b/src/test/baseline/testHVStretchNode1.png
new file mode 100644
index 0000000..304c23e
--- /dev/null
+++ b/src/test/baseline/testHVStretchNode1.png
Binary files differ
diff --git a/src/test/baseline/testHVStretchNode2.png b/src/test/baseline/testHVStretchNode2.png
new file mode 100644
index 0000000..ca1f0f2
--- /dev/null
+++ b/src/test/baseline/testHVStretchNode2.png
Binary files differ
diff --git a/src/test/baseline/testImgWarp2.png b/src/test/baseline/testImgWarp2.png
new file mode 100644
index 0000000..514e6f4
--- /dev/null
+++ b/src/test/baseline/testImgWarp2.png
Binary files differ
diff --git a/src/test/baseline/testMediaControl1.png b/src/test/baseline/testMediaControl1.png
new file mode 100644
index 0000000..fd36c50
--- /dev/null
+++ b/src/test/baseline/testMediaControl1.png
Binary files differ
diff --git a/src/test/baseline/testMediaControl2.png b/src/test/baseline/testMediaControl2.png
new file mode 100644
index 0000000..fd01c50
--- /dev/null
+++ b/src/test/baseline/testMediaControl2.png
Binary files differ
diff --git a/src/test/baseline/testMediaControl3.png b/src/test/baseline/testMediaControl3.png
new file mode 100644
index 0000000..9f9c0ee
--- /dev/null
+++ b/src/test/baseline/testMediaControl3.png
Binary files differ
diff --git a/src/test/baseline/testMediaControl4.png b/src/test/baseline/testMediaControl4.png
new file mode 100644
index 0000000..53adc06
--- /dev/null
+++ b/src/test/baseline/testMediaControl4.png
Binary files differ
diff --git a/src/test/baseline/testMediaControl5.png b/src/test/baseline/testMediaControl5.png
new file mode 100644
index 0000000..37d7bf4
--- /dev/null
+++ b/src/test/baseline/testMediaControl5.png
Binary files differ
diff --git a/src/test/baseline/testMesh7.png b/src/test/baseline/testMesh7.png
new file mode 100644
index 0000000..a7e2493
--- /dev/null
+++ b/src/test/baseline/testMesh7.png
Binary files differ
diff --git a/src/test/baseline/testMesh8.png b/src/test/baseline/testMesh8.png
new file mode 100644
index 0000000..20e4fb1
--- /dev/null
+++ b/src/test/baseline/testMesh8.png
Binary files differ
diff --git a/src/test/baseline/testMipmap.png b/src/test/baseline/testMipmap.png
index 7068a7a..eb6185e 100644
--- a/src/test/baseline/testMipmap.png
+++ b/src/test/baseline/testMipmap.png
Binary files differ
diff --git a/src/test/baseline/testOpacity.png b/src/test/baseline/testOpacity.png
new file mode 100644
index 0000000..aab7cdb
--- /dev/null
+++ b/src/test/baseline/testOpacity.png
Binary files differ
diff --git a/src/test/baseline/testOutlines.png b/src/test/baseline/testOutlines.png
index 0ef64ad..36a7c14 100644
--- a/src/test/baseline/testOutlines.png
+++ b/src/test/baseline/testOutlines.png
Binary files differ
diff --git a/src/test/baseline/testPolygon7.png b/src/test/baseline/testPolygon7.png
new file mode 100644
index 0000000..5cb45e6
--- /dev/null
+++ b/src/test/baseline/testPolygon7.png
Binary files differ
diff --git a/src/test/baseline/testPolygon8.png b/src/test/baseline/testPolygon8.png
new file mode 100644
index 0000000..f926687
--- /dev/null
+++ b/src/test/baseline/testPolygon8.png
Binary files differ
diff --git a/src/test/baseline/testPolygon9.png b/src/test/baseline/testPolygon9.png
new file mode 100644
index 0000000..3e00de4
--- /dev/null
+++ b/src/test/baseline/testPolygon9.png
Binary files differ
diff --git a/src/test/baseline/testPolygonHole1.png b/src/test/baseline/testPolygonHole1.png
new file mode 100644
index 0000000..9c18ad1
--- /dev/null
+++ b/src/test/baseline/testPolygonHole1.png
Binary files differ
diff --git a/src/test/baseline/testPolygonHole2.png b/src/test/baseline/testPolygonHole2.png
new file mode 100644
index 0000000..d8199da
--- /dev/null
+++ b/src/test/baseline/testPolygonHole2.png
Binary files differ
diff --git a/src/test/baseline/testProgressBar1.png b/src/test/baseline/testProgressBar1.png
new file mode 100644
index 0000000..2b2c752
--- /dev/null
+++ b/src/test/baseline/testProgressBar1.png
Binary files differ
diff --git a/src/test/baseline/testProgressBar2.png b/src/test/baseline/testProgressBar2.png
new file mode 100644
index 0000000..6c1f56b
--- /dev/null
+++ b/src/test/baseline/testProgressBar2.png
Binary files differ
diff --git a/src/test/baseline/testProgressBar3.png b/src/test/baseline/testProgressBar3.png
new file mode 100644
index 0000000..d788f76
--- /dev/null
+++ b/src/test/baseline/testProgressBar3.png
Binary files differ
diff --git a/src/test/baseline/testScrollArea1.png b/src/test/baseline/testScrollArea1.png
new file mode 100644
index 0000000..4cb67e2
--- /dev/null
+++ b/src/test/baseline/testScrollArea1.png
Binary files differ
diff --git a/src/test/baseline/testScrollArea2.png b/src/test/baseline/testScrollArea2.png
new file mode 100644
index 0000000..7939cae
--- /dev/null
+++ b/src/test/baseline/testScrollArea2.png
Binary files differ
diff --git a/src/test/baseline/testScrollArea3.png b/src/test/baseline/testScrollArea3.png
new file mode 100644
index 0000000..1fc62df
--- /dev/null
+++ b/src/test/baseline/testScrollArea3.png
Binary files differ
diff --git a/src/test/baseline/testScrollBarHoriz1.png b/src/test/baseline/testScrollBarHoriz1.png
new file mode 100644
index 0000000..aedcb12
--- /dev/null
+++ b/src/test/baseline/testScrollBarHoriz1.png
Binary files differ
diff --git a/src/test/baseline/testScrollBarHoriz10.png b/src/test/baseline/testScrollBarHoriz10.png
new file mode 100644
index 0000000..0c8a5af
--- /dev/null
+++ b/src/test/baseline/testScrollBarHoriz10.png
Binary files differ
diff --git a/src/test/baseline/testScrollBarHoriz11.png b/src/test/baseline/testScrollBarHoriz11.png
new file mode 100644
index 0000000..da84ebc
--- /dev/null
+++ b/src/test/baseline/testScrollBarHoriz11.png
Binary files differ
diff --git a/src/test/baseline/testScrollBarHoriz12.png b/src/test/baseline/testScrollBarHoriz12.png
new file mode 100644
index 0000000..5e2f013
--- /dev/null
+++ b/src/test/baseline/testScrollBarHoriz12.png
Binary files differ
diff --git a/src/test/baseline/testScrollBarHoriz2.png b/src/test/baseline/testScrollBarHoriz2.png
new file mode 100644
index 0000000..b8a2dcd
--- /dev/null
+++ b/src/test/baseline/testScrollBarHoriz2.png
Binary files differ
diff --git a/src/test/baseline/testScrollBarHoriz3.png b/src/test/baseline/testScrollBarHoriz3.png
new file mode 100644
index 0000000..885b429
--- /dev/null
+++ b/src/test/baseline/testScrollBarHoriz3.png
Binary files differ
diff --git a/src/test/baseline/testScrollBarHoriz4.png b/src/test/baseline/testScrollBarHoriz4.png
new file mode 100644
index 0000000..8ceea4f
--- /dev/null
+++ b/src/test/baseline/testScrollBarHoriz4.png
Binary files differ
diff --git a/src/test/baseline/testScrollBarHoriz5.png b/src/test/baseline/testScrollBarHoriz5.png
new file mode 100644
index 0000000..4278825
--- /dev/null
+++ b/src/test/baseline/testScrollBarHoriz5.png
Binary files differ
diff --git a/src/test/baseline/testScrollBarHoriz6.png b/src/test/baseline/testScrollBarHoriz6.png
new file mode 100644
index 0000000..ee270d3
--- /dev/null
+++ b/src/test/baseline/testScrollBarHoriz6.png
Binary files differ
diff --git a/src/test/baseline/testScrollBarHoriz7.png b/src/test/baseline/testScrollBarHoriz7.png
new file mode 100644
index 0000000..0fefd7b
--- /dev/null
+++ b/src/test/baseline/testScrollBarHoriz7.png
Binary files differ
diff --git a/src/test/baseline/testScrollBarHoriz8.png b/src/test/baseline/testScrollBarHoriz8.png
new file mode 100644
index 0000000..138ec3a
--- /dev/null
+++ b/src/test/baseline/testScrollBarHoriz8.png
Binary files differ
diff --git a/src/test/baseline/testScrollBarHoriz9.png b/src/test/baseline/testScrollBarHoriz9.png
new file mode 100644
index 0000000..0fefd7b
--- /dev/null
+++ b/src/test/baseline/testScrollBarHoriz9.png
Binary files differ
diff --git a/src/test/baseline/testScrollBarVert1.png b/src/test/baseline/testScrollBarVert1.png
new file mode 100644
index 0000000..25c3098
--- /dev/null
+++ b/src/test/baseline/testScrollBarVert1.png
Binary files differ
diff --git a/src/test/baseline/testScrollBarVert2.png b/src/test/baseline/testScrollBarVert2.png
new file mode 100644
index 0000000..572fac9
--- /dev/null
+++ b/src/test/baseline/testScrollBarVert2.png
Binary files differ
diff --git a/src/test/baseline/testScrollBarVert3.png b/src/test/baseline/testScrollBarVert3.png
new file mode 100644
index 0000000..d1a893c
--- /dev/null
+++ b/src/test/baseline/testScrollBarVert3.png
Binary files differ
diff --git a/src/test/baseline/testScrollBarVert4.png b/src/test/baseline/testScrollBarVert4.png
new file mode 100644
index 0000000..a29849f
--- /dev/null
+++ b/src/test/baseline/testScrollBarVert4.png
Binary files differ
diff --git a/src/test/baseline/testScrollBarVert5.png b/src/test/baseline/testScrollBarVert5.png
new file mode 100644
index 0000000..ff40ef7
--- /dev/null
+++ b/src/test/baseline/testScrollBarVert5.png
Binary files differ
diff --git a/src/test/baseline/testScrollBarVert6.png b/src/test/baseline/testScrollBarVert6.png
new file mode 100644
index 0000000..edb3196
--- /dev/null
+++ b/src/test/baseline/testScrollBarVert6.png
Binary files differ
diff --git a/src/test/baseline/testScrollBarVert7.png b/src/test/baseline/testScrollBarVert7.png
new file mode 100644
index 0000000..115d8ca
--- /dev/null
+++ b/src/test/baseline/testScrollBarVert7.png
Binary files differ
diff --git a/src/test/baseline/testScrollBarVert8.png b/src/test/baseline/testScrollBarVert8.png
new file mode 100644
index 0000000..5e1e08b
--- /dev/null
+++ b/src/test/baseline/testScrollBarVert8.png
Binary files differ
diff --git a/src/test/baseline/testScrollBarVert9.png b/src/test/baseline/testScrollBarVert9.png
new file mode 100644
index 0000000..3a7ff70
--- /dev/null
+++ b/src/test/baseline/testScrollBarVert9.png
Binary files differ
diff --git a/src/test/baseline/testScrollPane4.png b/src/test/baseline/testScrollPane4.png
deleted file mode 100644
index 9daf9a5..0000000
--- a/src/test/baseline/testScrollPane4.png
+++ /dev/null
Binary files differ
diff --git a/src/test/baseline/testSeekAfterEOF.png b/src/test/baseline/testSeekAfterEOF.png
new file mode 100644
index 0000000..76e79c1
--- /dev/null
+++ b/src/test/baseline/testSeekAfterEOF.png
Binary files differ
diff --git a/src/test/baseline/testSliderHoriz1.png b/src/test/baseline/testSliderHoriz1.png
new file mode 100644
index 0000000..c30040d
--- /dev/null
+++ b/src/test/baseline/testSliderHoriz1.png
Binary files differ
diff --git a/src/test/baseline/testSliderHoriz2.png b/src/test/baseline/testSliderHoriz2.png
new file mode 100644
index 0000000..e22a32f
--- /dev/null
+++ b/src/test/baseline/testSliderHoriz2.png
Binary files differ
diff --git a/src/test/baseline/testSliderHoriz3.png b/src/test/baseline/testSliderHoriz3.png
new file mode 100644
index 0000000..bcf1690
--- /dev/null
+++ b/src/test/baseline/testSliderHoriz3.png
Binary files differ
diff --git a/src/test/baseline/testSliderHoriz4.png b/src/test/baseline/testSliderHoriz4.png
new file mode 100644
index 0000000..7c48e5a
--- /dev/null
+++ b/src/test/baseline/testSliderHoriz4.png
Binary files differ
diff --git a/src/test/baseline/testSliderHoriz5.png b/src/test/baseline/testSliderHoriz5.png
new file mode 100644
index 0000000..2b6534a
--- /dev/null
+++ b/src/test/baseline/testSliderHoriz5.png
Binary files differ
diff --git a/src/test/baseline/testSliderVert1.png b/src/test/baseline/testSliderVert1.png
new file mode 100644
index 0000000..d82d467
--- /dev/null
+++ b/src/test/baseline/testSliderVert1.png
Binary files differ
diff --git a/src/test/baseline/testSliderVert2.png b/src/test/baseline/testSliderVert2.png
new file mode 100644
index 0000000..294dae9
--- /dev/null
+++ b/src/test/baseline/testSliderVert2.png
Binary files differ
diff --git a/src/test/baseline/testSliderVert3.png b/src/test/baseline/testSliderVert3.png
new file mode 100644
index 0000000..4a00a8f
--- /dev/null
+++ b/src/test/baseline/testSliderVert3.png
Binary files differ
diff --git a/src/test/baseline/testSliderVert4.png b/src/test/baseline/testSliderVert4.png
new file mode 100644
index 0000000..f13d278
--- /dev/null
+++ b/src/test/baseline/testSliderVert4.png
Binary files differ
diff --git a/src/test/baseline/testSliderVert5.png b/src/test/baseline/testSliderVert5.png
new file mode 100644
index 0000000..a939fe0
--- /dev/null
+++ b/src/test/baseline/testSliderVert5.png
Binary files differ
diff --git a/src/test/baseline/testStretchNodeHoriz1.png b/src/test/baseline/testStretchNodeHoriz1.png
new file mode 100644
index 0000000..652ada8
--- /dev/null
+++ b/src/test/baseline/testStretchNodeHoriz1.png
Binary files differ
diff --git a/src/test/baseline/testStretchNodeHoriz2.png b/src/test/baseline/testStretchNodeHoriz2.png
new file mode 100644
index 0000000..fe123b0
--- /dev/null
+++ b/src/test/baseline/testStretchNodeHoriz2.png
Binary files differ
diff --git a/src/test/baseline/testStretchNodeVert1.png b/src/test/baseline/testStretchNodeVert1.png
new file mode 100644
index 0000000..a0e6fe3
--- /dev/null
+++ b/src/test/baseline/testStretchNodeVert1.png
Binary files differ
diff --git a/src/test/baseline/testStretchNodeVert2.png b/src/test/baseline/testStretchNodeVert2.png
new file mode 100644
index 0000000..ac7d496
--- /dev/null
+++ b/src/test/baseline/testStretchNodeVert2.png
Binary files differ
diff --git a/src/test/baseline/testTextArea1.png b/src/test/baseline/testTextArea1.png
index 53f03a1..7cf8ac1 100644
--- a/src/test/baseline/testTextArea1.png
+++ b/src/test/baseline/testTextArea1.png
Binary files differ
diff --git a/src/test/baseline/testTextArea2.png b/src/test/baseline/testTextArea2.png
index 07349af..6fe4c64 100644
--- a/src/test/baseline/testTextArea2.png
+++ b/src/test/baseline/testTextArea2.png
Binary files differ
diff --git a/src/test/baseline/testTextArea3.png b/src/test/baseline/testTextArea3.png
new file mode 100644
index 0000000..6577cf2
--- /dev/null
+++ b/src/test/baseline/testTextArea3.png
Binary files differ
diff --git a/src/test/baseline/testTextArea4.png b/src/test/baseline/testTextArea4.png
new file mode 100644
index 0000000..2fc48fe
--- /dev/null
+++ b/src/test/baseline/testTextArea4.png
Binary files differ
diff --git a/src/test/baseline/testTextArea5.png b/src/test/baseline/testTextArea5.png
new file mode 100644
index 0000000..a7c53e2
--- /dev/null
+++ b/src/test/baseline/testTextArea5.png
Binary files differ
diff --git a/src/test/baseline/testTextButtonDisabled.png b/src/test/baseline/testTextButtonDisabled.png
new file mode 100644
index 0000000..c859bfa
--- /dev/null
+++ b/src/test/baseline/testTextButtonDisabled.png
Binary files differ
diff --git a/src/test/baseline/testTextButtonDown.png b/src/test/baseline/testTextButtonDown.png
new file mode 100644
index 0000000..9122c33
--- /dev/null
+++ b/src/test/baseline/testTextButtonDown.png
Binary files differ
diff --git a/src/test/baseline/testTextButtonDownNewText.png b/src/test/baseline/testTextButtonDownNewText.png
new file mode 100644
index 0000000..9592a86
--- /dev/null
+++ b/src/test/baseline/testTextButtonDownNewText.png
Binary files differ
diff --git a/src/test/baseline/testTextButtonUp.png b/src/test/baseline/testTextButtonUp.png
new file mode 100644
index 0000000..c859bfa
--- /dev/null
+++ b/src/test/baseline/testTextButtonUp.png
Binary files differ
diff --git a/src/test/baseline/testTextButtonUpNewText.png b/src/test/baseline/testTextButtonUpNewText.png
new file mode 100644
index 0000000..ebb66bc
--- /dev/null
+++ b/src/test/baseline/testTextButtonUpNewText.png
Binary files differ
diff --git a/src/test/baseline/testTexturedPolyLine4.png b/src/test/baseline/testTexturedPolyLine4.png
index 83c0b4a..f063a2f 100644
--- a/src/test/baseline/testTexturedPolyLine4.png
+++ b/src/test/baseline/testTexturedPolyLine4.png
Binary files differ
diff --git a/src/test/baseline/testTimeSliderHoriz1.png b/src/test/baseline/testTimeSliderHoriz1.png
new file mode 100644
index 0000000..42c0eca
--- /dev/null
+++ b/src/test/baseline/testTimeSliderHoriz1.png
Binary files differ
diff --git a/src/test/baseline/testTimeSliderHoriz2.png b/src/test/baseline/testTimeSliderHoriz2.png
new file mode 100644
index 0000000..a42b8ca
--- /dev/null
+++ b/src/test/baseline/testTimeSliderHoriz2.png
Binary files differ
diff --git a/src/test/baseline/testTimeSliderHoriz3.png b/src/test/baseline/testTimeSliderHoriz3.png
new file mode 100644
index 0000000..4908be5
--- /dev/null
+++ b/src/test/baseline/testTimeSliderHoriz3.png
Binary files differ
diff --git a/src/test/baseline/testTimeSliderHoriz4.png b/src/test/baseline/testTimeSliderHoriz4.png
new file mode 100644
index 0000000..1371480
--- /dev/null
+++ b/src/test/baseline/testTimeSliderHoriz4.png
Binary files differ
diff --git a/src/test/baseline/testTimeSliderHoriz5.png b/src/test/baseline/testTimeSliderHoriz5.png
new file mode 100644
index 0000000..1371480
--- /dev/null
+++ b/src/test/baseline/testTimeSliderHoriz5.png
Binary files differ
diff --git a/src/test/baseline/testTimeSliderVert1.png b/src/test/baseline/testTimeSliderVert1.png
new file mode 100644
index 0000000..8b31bac
--- /dev/null
+++ b/src/test/baseline/testTimeSliderVert1.png
Binary files differ
diff --git a/src/test/baseline/testTimeSliderVert2.png b/src/test/baseline/testTimeSliderVert2.png
new file mode 100644
index 0000000..79be7d1
--- /dev/null
+++ b/src/test/baseline/testTimeSliderVert2.png
Binary files differ
diff --git a/src/test/baseline/testTimeSliderVert3.png b/src/test/baseline/testTimeSliderVert3.png
new file mode 100644
index 0000000..a3a8718
--- /dev/null
+++ b/src/test/baseline/testTimeSliderVert3.png
Binary files differ
diff --git a/src/test/baseline/testTimeSliderVert4.png b/src/test/baseline/testTimeSliderVert4.png
new file mode 100644
index 0000000..f64996b
--- /dev/null
+++ b/src/test/baseline/testTimeSliderVert4.png
Binary files differ
diff --git a/src/test/baseline/testTimeSliderVert5.png b/src/test/baseline/testTimeSliderVert5.png
new file mode 100644
index 0000000..f64996b
--- /dev/null
+++ b/src/test/baseline/testTimeSliderVert5.png
Binary files differ
diff --git a/src/test/baseline/testUICheckBoxChecked_Down.png b/src/test/baseline/testUICheckBoxChecked_Down.png
new file mode 100644
index 0000000..73818b9
--- /dev/null
+++ b/src/test/baseline/testUICheckBoxChecked_Down.png
Binary files differ
diff --git a/src/test/baseline/testUICheckBoxChecked_Up.png b/src/test/baseline/testUICheckBoxChecked_Up.png
new file mode 100644
index 0000000..a4af8c9
--- /dev/null
+++ b/src/test/baseline/testUICheckBoxChecked_Up.png
Binary files differ
diff --git a/src/test/baseline/testUICheckBoxUnchecked_Disabled.png b/src/test/baseline/testUICheckBoxUnchecked_Disabled.png
new file mode 100644
index 0000000..ebcb3ef
--- /dev/null
+++ b/src/test/baseline/testUICheckBoxUnchecked_Disabled.png
Binary files differ
diff --git a/src/test/baseline/testUICheckBoxUnchecked_Down.png b/src/test/baseline/testUICheckBoxUnchecked_Down.png
new file mode 100644
index 0000000..4967f44
--- /dev/null
+++ b/src/test/baseline/testUICheckBoxUnchecked_Down.png
Binary files differ
diff --git a/src/test/baseline/testUICheckBoxUnchecked_Up.png b/src/test/baseline/testUICheckBoxUnchecked_Up.png
new file mode 100644
index 0000000..1c102e7
--- /dev/null
+++ b/src/test/baseline/testUICheckBoxUnchecked_Up.png
Binary files differ
diff --git a/src/test/baseline/testUIKeyboard.png b/src/test/baseline/testUIKeyboard.png
index 9e1a4cd..87d23a2 100644
--- a/src/test/baseline/testUIKeyboard.png
+++ b/src/test/baseline/testUIKeyboard.png
Binary files differ
diff --git a/src/test/baseline/testUIKeyboard1S.png b/src/test/baseline/testUIKeyboard1S.png
new file mode 100644
index 0000000..d7f0606
--- /dev/null
+++ b/src/test/baseline/testUIKeyboard1S.png
Binary files differ
diff --git a/src/test/baseline/testUIKeyboardA.png b/src/test/baseline/testUIKeyboardA.png
new file mode 100644
index 0000000..0012b33
--- /dev/null
+++ b/src/test/baseline/testUIKeyboardA.png
Binary files differ
diff --git a/src/test/baseline/testUIKeyboardA1S.png b/src/test/baseline/testUIKeyboardA1S.png
new file mode 100644
index 0000000..f2ccd3a
--- /dev/null
+++ b/src/test/baseline/testUIKeyboardA1S.png
Binary files differ
diff --git a/src/test/baseline/testUIKeyboardAS.png b/src/test/baseline/testUIKeyboardAS.png
new file mode 100644
index 0000000..cd76aad
--- /dev/null
+++ b/src/test/baseline/testUIKeyboardAS.png
Binary files differ
diff --git a/src/test/baseline/testUIKeyboardDown11.png b/src/test/baseline/testUIKeyboardDown11.png
new file mode 100644
index 0000000..bfc8a50
--- /dev/null
+++ b/src/test/baseline/testUIKeyboardDown11.png
Binary files differ
diff --git a/src/test/baseline/testUIKeyboardDownA1.png b/src/test/baseline/testUIKeyboardDownA1.png
deleted file mode 100644
index 51c001e..0000000
--- a/src/test/baseline/testUIKeyboardDownA1.png
+++ /dev/null
Binary files differ
diff --git a/src/test/baseline/testUIKeyboardDownA111S1.png b/src/test/baseline/testUIKeyboardDownA111S1.png
deleted file mode 100644
index d05d7a6..0000000
--- a/src/test/baseline/testUIKeyboardDownA111S1.png
+++ /dev/null
Binary files differ
diff --git a/src/test/baseline/testUIKeyboardDownA212S2.png b/src/test/baseline/testUIKeyboardDownA212S2.png
index b7b5492..cd79feb 100644
--- a/src/test/baseline/testUIKeyboardDownA212S2.png
+++ b/src/test/baseline/testUIKeyboardDownA212S2.png
Binary files differ
diff --git a/src/test/baseline/testUIKeyboardDownA2S1.png b/src/test/baseline/testUIKeyboardDownA2S1.png
new file mode 100644
index 0000000..6c07214
--- /dev/null
+++ b/src/test/baseline/testUIKeyboardDownA2S1.png
Binary files differ
diff --git a/src/test/baseline/testUIKeyboardDownS1.png b/src/test/baseline/testUIKeyboardDownS1.png
deleted file mode 100644
index deef9fc..0000000
--- a/src/test/baseline/testUIKeyboardDownS1.png
+++ /dev/null
Binary files differ
diff --git a/src/test/baseline/testUIKeyboardFB.png b/src/test/baseline/testUIKeyboardFB.png
new file mode 100644
index 0000000..f4836a1
--- /dev/null
+++ b/src/test/baseline/testUIKeyboardFB.png
Binary files differ
diff --git a/src/test/baseline/testUIKeyboardFB1.png b/src/test/baseline/testUIKeyboardFB1.png
new file mode 100644
index 0000000..13a56aa
--- /dev/null
+++ b/src/test/baseline/testUIKeyboardFB1.png
Binary files differ
diff --git a/src/test/baseline/testUIKeyboardFBA1S.png b/src/test/baseline/testUIKeyboardFBA1S.png
new file mode 100644
index 0000000..e9e5534
--- /dev/null
+++ b/src/test/baseline/testUIKeyboardFBA1S.png
Binary files differ
diff --git a/src/test/baseline/testUIKeyboardFBAS.png b/src/test/baseline/testUIKeyboardFBAS.png
new file mode 100644
index 0000000..0e10aaf
--- /dev/null
+++ b/src/test/baseline/testUIKeyboardFBAS.png
Binary files differ
diff --git a/src/test/baseline/testUIKeyboardFBS.png b/src/test/baseline/testUIKeyboardFBS.png
new file mode 100644
index 0000000..9e0964a
--- /dev/null
+++ b/src/test/baseline/testUIKeyboardFBS.png
Binary files differ
diff --git a/src/test/baseline/testUIKeyboardNoFB1S.png b/src/test/baseline/testUIKeyboardNoFB1S.png
new file mode 100644
index 0000000..4c91d91
--- /dev/null
+++ b/src/test/baseline/testUIKeyboardNoFB1S.png
Binary files differ
diff --git a/src/test/baseline/testUIKeyboardS.png b/src/test/baseline/testUIKeyboardS.png
new file mode 100644
index 0000000..12a6c9f
--- /dev/null
+++ b/src/test/baseline/testUIKeyboardS.png
Binary files differ
diff --git a/src/test/baseline/testUIToggleChecked_Disabled.png b/src/test/baseline/testUIToggleChecked_Disabled.png
new file mode 100644
index 0000000..6a23dda
--- /dev/null
+++ b/src/test/baseline/testUIToggleChecked_Disabled.png
Binary files differ
diff --git a/src/test/baseline/testUIToggleChecked_Down.png b/src/test/baseline/testUIToggleChecked_Down.png
new file mode 100644
index 0000000..a17041f
--- /dev/null
+++ b/src/test/baseline/testUIToggleChecked_Down.png
Binary files differ
diff --git a/src/test/baseline/testUIToggleChecked_Up.png b/src/test/baseline/testUIToggleChecked_Up.png
new file mode 100644
index 0000000..03f2f41
--- /dev/null
+++ b/src/test/baseline/testUIToggleChecked_Up.png
Binary files differ
diff --git a/src/test/baseline/testUIToggleUnchecked_Disabled.png b/src/test/baseline/testUIToggleUnchecked_Disabled.png
new file mode 100644
index 0000000..8fccaa6
--- /dev/null
+++ b/src/test/baseline/testUIToggleUnchecked_Disabled.png
Binary files differ
diff --git a/src/test/baseline/testUIToggleUnchecked_Down.png b/src/test/baseline/testUIToggleUnchecked_Down.png
new file mode 100644
index 0000000..bbad224
--- /dev/null
+++ b/src/test/baseline/testUIToggleUnchecked_Down.png
Binary files differ
diff --git a/src/test/baseline/testUIToggleUnchecked_Up.png b/src/test/baseline/testUIToggleUnchecked_Up.png
new file mode 100644
index 0000000..a6f08f0
--- /dev/null
+++ b/src/test/baseline/testUIToggleUnchecked_Up.png
Binary files differ
diff --git a/src/test/baseline/testVideo-mpeg1-48x48.mpg1.png b/src/test/baseline/testVideo-mpeg1-48x48.mov1.png
index ad9dcf8..ad9dcf8 100644
--- a/src/test/baseline/testVideo-mpeg1-48x48.mpg1.png
+++ b/src/test/baseline/testVideo-mpeg1-48x48.mov1.png
Binary files differ
diff --git a/src/test/baseline/testVideo-mpeg4-48x48.avi1.png b/src/test/baseline/testVideo-mpeg4-48x48.avi1.png
new file mode 100644
index 0000000..5b6a337
--- /dev/null
+++ b/src/test/baseline/testVideo-mpeg4-48x48.avi1.png
Binary files differ
diff --git a/src/test/baseline/testWordsGamma1.png b/src/test/baseline/testWordsGamma1.png
new file mode 100644
index 0000000..9586c80
--- /dev/null
+++ b/src/test/baseline/testWordsGamma1.png
Binary files differ
diff --git a/src/test/baseline/testWordsGamma2.png b/src/test/baseline/testWordsGamma2.png
new file mode 100644
index 0000000..f5c2367
--- /dev/null
+++ b/src/test/baseline/testWordsGamma2.png
Binary files differ
diff --git a/src/test/baseline/testWordsIntensity.png b/src/test/baseline/testWordsIntensity.png
new file mode 100644
index 0000000..c49904e
--- /dev/null
+++ b/src/test/baseline/testWordsIntensity.png
Binary files differ
diff --git a/src/test/baseline/testWordsMask7.png b/src/test/baseline/testWordsMask7.png
new file mode 100644
index 0000000..6be97bc
--- /dev/null
+++ b/src/test/baseline/testWordsMask7.png
Binary files differ
diff --git a/src/test/baseline/testWordsOutlines.png b/src/test/baseline/testWordsOutlines.png
new file mode 100644
index 0000000..6187147
--- /dev/null
+++ b/src/test/baseline/testWordsOutlines.png
Binary files differ
diff --git a/src/test/baseline/testplugin1.png b/src/test/baseline/testplugin1.png
index e06639d..fd07f6c 100644
--- a/src/test/baseline/testplugin1.png
+++ b/src/test/baseline/testplugin1.png
Binary files differ
diff --git a/src/test/baseline/testplugin2.png b/src/test/baseline/testplugin2.png
index fc47a3c..2ec2e11 100644
--- a/src/test/baseline/testplugin2.png
+++ b/src/test/baseline/testplugin2.png
Binary files differ
diff --git a/src/test/camcfgs.py b/src/test/camcfgs.py
index ef0d5d6..5c65229 100644
--- a/src/test/camcfgs.py
+++ b/src/test/camcfgs.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# libavg - Media Playback Engine.
-# Copyright (C) 2003-2011 Ulrich von Zadow
+# 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
diff --git a/src/test/checkcamera.py b/src/test/checkcamera.py
index 936993d..1146679 100755
--- a/src/test/checkcamera.py
+++ b/src/test/checkcamera.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# libavg - Media Playback Engine.
-# Copyright (C) 2003-2011 Ulrich von Zadow
+# 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
@@ -28,8 +28,6 @@ import optparse
from testcase import *
-g_Player = avg.Player.get()
-
def parseCmdLine():
global g_TestParams
@@ -78,8 +76,8 @@ class CameraTestCase(AVGTestCase):
self.loadEmptyScene()
self.__openCamera()
self.actions = [None, None]
- g_Player.setOnFrameHandler(self.__onFrame)
- g_Player.play()
+ avg.player.setOnFrameHandler(self.__onFrame)
+ avg.player.play()
self.assertEqual(self.cam.framenum, 2)
self.cam = None
@@ -135,8 +133,8 @@ class CameraTestCase(AVGTestCase):
def checkCamImageChange(testCfg):
def saveCamImages():
- print
- print "Average image brightnesses: ",minAverages, medAverages, maxAverages
+# print
+# print "Average image brightnesses: ",minAverages, medAverages, maxAverages
dir = AVGTestCase.getImageResultDir()
for (i, category) in enumerate(("min", "med", "max")):
self.camBmps[i].save(dir+"/cam"+testCfg.name+category+".png")
@@ -165,10 +163,10 @@ class CameraTestCase(AVGTestCase):
self.loadEmptyScene()
self.__openCamera()
self.actions = buildParamActionList(testCfg)
- g_Player.setOnFrameHandler(self.__onFrame)
+ avg.player.setOnFrameHandler(self.__onFrame)
self.averages = []
self.camBmps = []
- g_Player.play()
+ avg.player.play()
self.cam = None
def __openCamera(self):
@@ -177,7 +175,7 @@ class CameraTestCase(AVGTestCase):
fw800=self.cameraCfg.fw800, framerate=self.fmt.framerate,
capturewidth=self.fmt.size[0], captureheight=self.fmt.size[1],
pixelformat=self.fmt.pixelformat,
- parent=g_Player.getRootNode())
+ parent=avg.player.getRootNode())
self.cam.play()
self.lastCameraFrame = -1
self.assert_(self.cam.isAvailable())
@@ -188,7 +186,7 @@ class CameraTestCase(AVGTestCase):
if self.cam.framenum != self.lastCameraFrame:
self.lastCameraFrame += 1
if len(self.actions) == self.lastCameraFrame:
- g_Player.stop()
+ avg.player.stop()
else:
action = self.actions[self.lastCameraFrame]
if action != None:
diff --git a/src/test/checkspeed.py b/src/test/checkspeed.py
deleted file mode 100755
index 0f72202..0000000
--- a/src/test/checkspeed.py
+++ /dev/null
@@ -1,105 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-# libavg - Media Playback Engine.
-# Copyright (C) 2003-2011 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 Robert Parcus <betoparcus@gmail.com>
-#
-
-from libavg import *
-import optparse
-import random
-
-g_Player = avg.Player.get()
-
-def parseCmdLine():
- parser = optparse.OptionParser(usage=
-"""%prog [option].
-Checks libavg performance by creating lots of nodes. Displays a frame time graph, executes for 20 secs and dumps profile statistics at the end of program execution.""")
- parser.add_option('--use-fx', '-f', dest='useFX', action='store_true', default=False,
- help='Display everything using a NullFX to test FX overhead.')
- parser.add_option('--video', '-v', dest='video', action='store_true', default=False,
- help='Show videos instead of images.')
- parser.add_option('--create-nodes', '-c', dest='createNodes', action='store_true',
- default=False,
- help='Destroy and recreate all nodes every 400 ms.')
- parser.add_option('--move', '-m', dest='move', action='store_true',
- default=False,
- help='Move nodes every frame.')
- parser.add_option('--vsync', '-s', dest='vsync', action='store_true',
- default=False,
- help='Sync output to vertical refresh.')
- parser.add_option('--num-objs', '-n', dest='numObjs', type='int', default=-1,
- help='Number of objects to create. Default is 200 images or 40 videos.')
-
- (options, args) = parser.parse_args()
-
- return options
-
-
-class SpeedApp(AVGApp):
- def init(self):
- self.__createNodes()
- self._starter.showFrameRate()
- if options.createNodes:
- g_Player.setInterval(400, self.__createNodes)
- g_Player.setTimeout(20000, g_Player.stop)
- if options.move:
- g_Player.setOnFrameHandler(self.__moveNodes)
-
- def __createNodes(self):
- self.__nodes = []
- for i in xrange(options.numObjs):
- pos = (random.randrange(800-64), random.randrange(600-64))
- if options.video:
- node = avg.VideoNode(pos=pos, href="../video/testfiles/mpeg1-48x48.mpg",
- loop=True, parent=self._parentNode)
- node.play()
- else:
- node = avg.ImageNode(pos=pos, href="rgb24alpha-64x64.png",
- parent=self._parentNode)
- if options.useFX:
- node.setEffect(avg.NullFXNode())
- self.__nodes.append(node)
- if options.createNodes:
- g_Player.setTimeout(300, self.__deleteNodes)
-
- def __deleteNodes(self):
- for node in self.__nodes:
- node.unlink(True)
- self.__nodes = []
-
- def __moveNodes(self):
- for node in self.__nodes:
- node.pos = (random.randrange(800-64), random.randrange(600-64))
-
-
-options = parseCmdLine()
-if not(options.vsync):
- g_Player.setFramerate(1000)
-if options.numObjs == -1:
- if options.video:
- options.numObjs = 40
- else:
- options.numObjs = 200
-
-log = avg.Logger.get()
-log.setCategories(log.PROFILE | log.CONFIG | log.WARNING | log.ERROR)
-SpeedApp.start(resolution=(800,600))
-
diff --git a/src/test/extrafonts/.svn/entries b/src/test/extrafonts/.svn/entries
deleted file mode 100644
index db28fcb..0000000
--- a/src/test/extrafonts/.svn/entries
+++ /dev/null
@@ -1,62 +0,0 @@
-10
-
-dir
-7007
-https://www.libavg.de/svn/branches/release1.7.x/src/test/extrafonts
-https://www.libavg.de/svn
-
-
-
-2009-05-18T18:25:22.096076Z
-3872
-coder
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-44470bb9-56e9-0310-a0f8-c586564d3dc6
-
-testaddfontdir.ttf
-file
-
-
-
-
-2011-12-07T12:58:46.191560Z
-f2b76dafe01a3f6316e5aa9d16854d57
-2009-05-18T18:25:22.096076Z
-3872
-coder
-has-props
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-1736
-
diff --git a/src/test/extrafonts/.svn/prop-base/testaddfontdir.ttf.svn-base b/src/test/extrafonts/.svn/prop-base/testaddfontdir.ttf.svn-base
deleted file mode 100644
index 5e9587e..0000000
--- a/src/test/extrafonts/.svn/prop-base/testaddfontdir.ttf.svn-base
+++ /dev/null
@@ -1,5 +0,0 @@
-K 13
-svn:mime-type
-V 24
-application/octet-stream
-END
diff --git a/src/test/extrafonts/.svn/text-base/testaddfontdir.ttf.svn-base b/src/test/extrafonts/.svn/text-base/testaddfontdir.ttf.svn-base
deleted file mode 100644
index d57eda6..0000000
--- a/src/test/extrafonts/.svn/text-base/testaddfontdir.ttf.svn-base
+++ /dev/null
Binary files differ
diff --git a/src/test/fonts/.svn/entries b/src/test/fonts/.svn/entries
deleted file mode 100644
index 01974a4..0000000
--- a/src/test/fonts/.svn/entries
+++ /dev/null
@@ -1,164 +0,0 @@
-10
-
-dir
-7007
-https://www.libavg.de/svn/branches/release1.7.x/src/test/fonts
-https://www.libavg.de/svn
-
-
-
-2008-06-21T14:08:49.239477Z
-2933
-coder
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-44470bb9-56e9-0310-a0f8-c586564d3dc6
-
-VeraBd.ttf
-file
-
-
-
-
-2011-12-07T12:58:17.713947Z
-4ebf664c986099acf6d151c62bdb24eb
-2008-06-21T14:08:49.239477Z
-2933
-coder
-has-props
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-58716
-
-VeraBI.ttf
-file
-
-
-
-
-2011-12-07T12:58:17.713947Z
-a99f3482bfc2d9c37b509e68d20d016a
-2008-06-21T14:08:49.239477Z
-2933
-coder
-has-props
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-63208
-
-VeraIt.ttf
-file
-
-
-
-
-2011-12-07T12:58:17.713947Z
-06ee45608b225ef0f22e94995bc981b2
-2008-06-21T14:08:49.239477Z
-2933
-coder
-has-props
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-63684
-
-Vera.ttf
-file
-
-
-
-
-2011-12-07T12:58:17.713947Z
-785d2fd45984c6548763ae6702d83e20
-2008-06-21T14:08:49.239477Z
-2933
-coder
-has-props
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-65932
-
diff --git a/src/test/fonts/.svn/prop-base/Vera.ttf.svn-base b/src/test/fonts/.svn/prop-base/Vera.ttf.svn-base
deleted file mode 100644
index 5e9587e..0000000
--- a/src/test/fonts/.svn/prop-base/Vera.ttf.svn-base
+++ /dev/null
@@ -1,5 +0,0 @@
-K 13
-svn:mime-type
-V 24
-application/octet-stream
-END
diff --git a/src/test/fonts/.svn/prop-base/VeraBI.ttf.svn-base b/src/test/fonts/.svn/prop-base/VeraBI.ttf.svn-base
deleted file mode 100644
index 5e9587e..0000000
--- a/src/test/fonts/.svn/prop-base/VeraBI.ttf.svn-base
+++ /dev/null
@@ -1,5 +0,0 @@
-K 13
-svn:mime-type
-V 24
-application/octet-stream
-END
diff --git a/src/test/fonts/.svn/prop-base/VeraBd.ttf.svn-base b/src/test/fonts/.svn/prop-base/VeraBd.ttf.svn-base
deleted file mode 100644
index 5e9587e..0000000
--- a/src/test/fonts/.svn/prop-base/VeraBd.ttf.svn-base
+++ /dev/null
@@ -1,5 +0,0 @@
-K 13
-svn:mime-type
-V 24
-application/octet-stream
-END
diff --git a/src/test/fonts/.svn/prop-base/VeraIt.ttf.svn-base b/src/test/fonts/.svn/prop-base/VeraIt.ttf.svn-base
deleted file mode 100644
index 5e9587e..0000000
--- a/src/test/fonts/.svn/prop-base/VeraIt.ttf.svn-base
+++ /dev/null
@@ -1,5 +0,0 @@
-K 13
-svn:mime-type
-V 24
-application/octet-stream
-END
diff --git a/src/test/fonts/.svn/text-base/Vera.ttf.svn-base b/src/test/fonts/.svn/text-base/Vera.ttf.svn-base
deleted file mode 100644
index 58cd6b5..0000000
--- a/src/test/fonts/.svn/text-base/Vera.ttf.svn-base
+++ /dev/null
Binary files differ
diff --git a/src/test/fonts/.svn/text-base/VeraBI.ttf.svn-base b/src/test/fonts/.svn/text-base/VeraBI.ttf.svn-base
deleted file mode 100644
index b55eee3..0000000
--- a/src/test/fonts/.svn/text-base/VeraBI.ttf.svn-base
+++ /dev/null
Binary files differ
diff --git a/src/test/fonts/.svn/text-base/VeraBd.ttf.svn-base b/src/test/fonts/.svn/text-base/VeraBd.ttf.svn-base
deleted file mode 100644
index 51d6111..0000000
--- a/src/test/fonts/.svn/text-base/VeraBd.ttf.svn-base
+++ /dev/null
Binary files differ
diff --git a/src/test/fonts/.svn/text-base/VeraIt.ttf.svn-base b/src/test/fonts/.svn/text-base/VeraIt.ttf.svn-base
deleted file mode 100644
index cc23c9e..0000000
--- a/src/test/fonts/.svn/text-base/VeraIt.ttf.svn-base
+++ /dev/null
Binary files differ
diff --git a/src/test/image.avg b/src/test/image.avg
index f2dbace..7fc4c13 100644
--- a/src/test/image.avg
+++ b/src/test/image.avg
@@ -1,4 +1,4 @@
-<avg id="imageavg" width="160" height="120">
+<avg id="imageavg" width="160" height="120" mediadir="media">
<image id="testtiles" pos="(0, 30)" size=" ( 65 , 65 ) "
opacity="1" href="rgb24-65x65.png" maxtilewidth="16" maxtileheight="32"/>
<image id="test" x="64" y="30"
diff --git a/src/test/1x1_white.png b/src/test/media/1x1_white.png
index 5800230..5800230 100644
--- a/src/test/1x1_white.png
+++ b/src/test/media/1x1_white.png
Binary files differ
diff --git a/src/video/testfiles/22.050Hz_16bit_mono.wav b/src/test/media/22.050Hz_16bit_mono.wav
index 1f86e64..1f86e64 100755
--- a/src/video/testfiles/22.050Hz_16bit_mono.wav
+++ b/src/test/media/22.050Hz_16bit_mono.wav
Binary files differ
diff --git a/src/video/testfiles/44.1kHz_16bit_6Chan.ogg b/src/test/media/44.1kHz_16bit_6Chan.ogg
index 7d190d1..7d190d1 100644
--- a/src/video/testfiles/44.1kHz_16bit_6Chan.ogg
+++ b/src/test/media/44.1kHz_16bit_6Chan.ogg
Binary files differ
diff --git a/src/video/testfiles/44.1kHz_16bit_mono.wav b/src/test/media/44.1kHz_16bit_mono.wav
index 8676a75..8676a75 100755
--- a/src/video/testfiles/44.1kHz_16bit_mono.wav
+++ b/src/test/media/44.1kHz_16bit_mono.wav
Binary files differ
diff --git a/src/video/testfiles/44.1kHz_16bit_stereo.aif b/src/test/media/44.1kHz_16bit_stereo.aif
index 0c9b5c7..0c9b5c7 100755
--- a/src/video/testfiles/44.1kHz_16bit_stereo.aif
+++ b/src/test/media/44.1kHz_16bit_stereo.aif
Binary files differ
diff --git a/src/video/testfiles/44.1kHz_16bit_stereo.wav b/src/test/media/44.1kHz_16bit_stereo.wav
index af5c2ee..af5c2ee 100755
--- a/src/video/testfiles/44.1kHz_16bit_stereo.wav
+++ b/src/test/media/44.1kHz_16bit_stereo.wav
Binary files differ
diff --git a/src/video/testfiles/44.1kHz_24bit_mono.wav b/src/test/media/44.1kHz_24bit_mono.wav
index fd2deed..fd2deed 100755
--- a/src/video/testfiles/44.1kHz_24bit_mono.wav
+++ b/src/test/media/44.1kHz_24bit_mono.wav
Binary files differ
diff --git a/src/video/testfiles/44.1kHz_24bit_stereo.aif b/src/test/media/44.1kHz_24bit_stereo.aif
index f569ded..f569ded 100755
--- a/src/video/testfiles/44.1kHz_24bit_stereo.aif
+++ b/src/test/media/44.1kHz_24bit_stereo.aif
Binary files differ
diff --git a/src/video/testfiles/44.1kHz_24bit_stereo.wav b/src/test/media/44.1kHz_24bit_stereo.wav
index 36c6aa7..36c6aa7 100755
--- a/src/video/testfiles/44.1kHz_24bit_stereo.wav
+++ b/src/test/media/44.1kHz_24bit_stereo.wav
Binary files differ
diff --git a/src/video/testfiles/44.1kHz_mono.ogg b/src/test/media/44.1kHz_mono.ogg
index 7bcb866..7bcb866 100755
--- a/src/video/testfiles/44.1kHz_mono.ogg
+++ b/src/test/media/44.1kHz_mono.ogg
Binary files differ
diff --git a/src/video/testfiles/44.1kHz_stereo.mp3 b/src/test/media/44.1kHz_stereo.mp3
index cbefc63..cbefc63 100644
--- a/src/video/testfiles/44.1kHz_stereo.mp3
+++ b/src/test/media/44.1kHz_stereo.mp3
Binary files differ
diff --git a/src/video/testfiles/44.1kHz_stereo.ogg b/src/test/media/44.1kHz_stereo.ogg
index f5ed4d0..f5ed4d0 100644
--- a/src/video/testfiles/44.1kHz_stereo.ogg
+++ b/src/test/media/44.1kHz_stereo.ogg
Binary files differ
diff --git a/src/video/testfiles/48kHz_16bit_mono.wav b/src/test/media/48kHz_16bit_mono.wav
index 0f817c9..0f817c9 100755
--- a/src/video/testfiles/48kHz_16bit_mono.wav
+++ b/src/test/media/48kHz_16bit_mono.wav
Binary files differ
diff --git a/src/video/testfiles/48kHz_16bit_stereo.aif b/src/test/media/48kHz_16bit_stereo.aif
index db3a381..db3a381 100755
--- a/src/video/testfiles/48kHz_16bit_stereo.aif
+++ b/src/test/media/48kHz_16bit_stereo.aif
Binary files differ
diff --git a/src/video/testfiles/48kHz_16bit_stereo.wav b/src/test/media/48kHz_16bit_stereo.wav
index 9fc52f1..9fc52f1 100755
--- a/src/video/testfiles/48kHz_16bit_stereo.wav
+++ b/src/test/media/48kHz_16bit_stereo.wav
Binary files differ
diff --git a/src/video/testfiles/48kHz_24bit_mono.wav b/src/test/media/48kHz_24bit_mono.wav
index 296ca11..296ca11 100755
--- a/src/video/testfiles/48kHz_24bit_mono.wav
+++ b/src/test/media/48kHz_24bit_mono.wav
Binary files differ
diff --git a/src/video/testfiles/48kHz_24bit_stereo.aif b/src/test/media/48kHz_24bit_stereo.aif
index 3ab7cf1..3ab7cf1 100755
--- a/src/video/testfiles/48kHz_24bit_stereo.aif
+++ b/src/test/media/48kHz_24bit_stereo.aif
Binary files differ
diff --git a/src/video/testfiles/48kHz_24bit_stereo.wav b/src/test/media/48kHz_24bit_stereo.wav
index af2c977..af2c977 100755
--- a/src/video/testfiles/48kHz_24bit_stereo.wav
+++ b/src/test/media/48kHz_24bit_stereo.wav
Binary files differ
diff --git a/src/video/testfiles/48kHz_stereo.mp3 b/src/test/media/48kHz_stereo.mp3
index 0eaa0f5..0eaa0f5 100644
--- a/src/video/testfiles/48kHz_stereo.mp3
+++ b/src/test/media/48kHz_stereo.mp3
Binary files differ
diff --git a/src/video/testfiles/48kHz_stereo.ogg b/src/test/media/48kHz_stereo.ogg
index 92d7b7b..92d7b7b 100644
--- a/src/video/testfiles/48kHz_stereo.ogg
+++ b/src/test/media/48kHz_stereo.ogg
Binary files differ
diff --git a/src/test/media/CustomSkin.xml b/src/test/media/CustomSkin.xml
new file mode 100644
index 0000000..3f21274
--- /dev/null
+++ b/src/test/media/CustomSkin.xml
@@ -0,0 +1,83 @@
+<skin>
+ <fontdef id="stdFont" font="Bitstream Vera Sans" variant="Roman" fontsize="12"
+ color="000000" letterspacing="0" linespacing="-1"/>
+ <fontdef id="downFont" baseid="stdFont" color="CCCCCC"/>
+ <fontdef id="disabledFont" baseid="stdFont" color="444444"/>
+ <textbutton
+ upSrc="button_bg_up.png"
+ downSrc="button_bg_down.png"
+ font="stdFont"
+ downFont="downFont"
+ disabledFont="disabledFont"
+ endsExtent="(7,7)"/>
+ <slider>
+ <horizontal
+ trackSrc="slider_horiz_track.png"
+ trackDisabledSrc="slider_horiz_track_disabled.png"
+ trackEndsExtent="6"
+ thumbUpSrc="slider_thumb_up.png"
+ thumbDownSrc="slider_thumb_down.png"/>
+ <vertical
+ trackSrc="slider_vert_track.png"
+ trackDisabledSrc="slider_vert_track_disabled.png"
+ trackEndsExtent="6"
+ thumbUpSrc="slider_thumb_up.png"
+ thumbDownSrc="slider_thumb_down.png"/>
+ </slider>
+ <scrollbar>
+ <horizontal
+ trackSrc="scrollbar_horiz_track.png"
+ trackDisabledSrc="scrollbar_horiz_track_disabled.png"
+ trackEndsExtent="2"
+ thumbUpSrc="scrollbar_horiz_thumb_up.png"
+ thumbDownSrc="scrollbar_horiz_thumb_down.png"
+ thumbEndsExtent="4"/>
+ <vertical
+ trackSrc="scrollbar_vert_track.png"
+ trackDisabledSrc="scrollbar_vert_track_disabled.png"
+ trackEndsExtent="2"
+ thumbUpSrc="scrollbar_vert_thumb_up.png"
+ thumbDownSrc="scrollbar_vert_thumb_down.png"
+ thumbEndsExtent="4"/>
+ </scrollbar>
+ <progressbar>
+ <horizontal
+ trackSrc="scrollbar_horiz_track.png"
+ trackEndsExtent="2"
+ thumbUpSrc="scrollbar_horiz_thumb_up.png"
+ thumbDisabledSrc="scrollbar_vert_thumb_down.png"
+ thumbEndsExtent="4"/>
+ <vertical
+ trackSrc="scrollbar_vert_track.png"
+ trackEndsExtent="2"
+ thumbUpSrc="scrollbar_vert_thumb_up.png"
+ thumbDisabledSrc="scrollbar_vert_thumb_down.png"
+ thumbEndsExtent="4"/>
+ </progressbar>
+ <scrollarea
+ borderSrc="scrollarea_border.png"
+ borderEndsExtent="(8,8)"
+ margins="(1,1,8,8)"
+ friction="-1"
+ sensitiveScrollBars="True"/>
+ <checkbox
+ uncheckedUpSrc="checkbox_unchecked_up.png"
+ uncheckedDownSrc="checkbox_unchecked_down.png"
+ uncheckedDisabledSrc="checkbox_unchecked_disabled.png"
+ checkedUpSrc="checkbox_checked_up.png"
+ checkedDownSrc="checkbox_checked_down.png"
+ checkedDisabledSrc="checkbox_checked_disabled.png"
+ font="stdFont"
+ downFont="stdFont"
+ disabledFont="disabledFont"/>
+ <mediacontrol
+ playUpSrc="play_button_up.png"
+ playDownSrc="play_button_down.png"
+ pauseUpSrc="pause_button_up.png"
+ pauseDownSrc="pause_button_down.png"
+ font="stdFont"
+ timePos="(15,0)"
+ timeLeftPos="(-42,0)"
+ barPos="(55,2)"
+ barRight="-45"/>
+</skin>
diff --git a/src/test/media/SimpleSkin.xml b/src/test/media/SimpleSkin.xml
new file mode 100644
index 0000000..3f21274
--- /dev/null
+++ b/src/test/media/SimpleSkin.xml
@@ -0,0 +1,83 @@
+<skin>
+ <fontdef id="stdFont" font="Bitstream Vera Sans" variant="Roman" fontsize="12"
+ color="000000" letterspacing="0" linespacing="-1"/>
+ <fontdef id="downFont" baseid="stdFont" color="CCCCCC"/>
+ <fontdef id="disabledFont" baseid="stdFont" color="444444"/>
+ <textbutton
+ upSrc="button_bg_up.png"
+ downSrc="button_bg_down.png"
+ font="stdFont"
+ downFont="downFont"
+ disabledFont="disabledFont"
+ endsExtent="(7,7)"/>
+ <slider>
+ <horizontal
+ trackSrc="slider_horiz_track.png"
+ trackDisabledSrc="slider_horiz_track_disabled.png"
+ trackEndsExtent="6"
+ thumbUpSrc="slider_thumb_up.png"
+ thumbDownSrc="slider_thumb_down.png"/>
+ <vertical
+ trackSrc="slider_vert_track.png"
+ trackDisabledSrc="slider_vert_track_disabled.png"
+ trackEndsExtent="6"
+ thumbUpSrc="slider_thumb_up.png"
+ thumbDownSrc="slider_thumb_down.png"/>
+ </slider>
+ <scrollbar>
+ <horizontal
+ trackSrc="scrollbar_horiz_track.png"
+ trackDisabledSrc="scrollbar_horiz_track_disabled.png"
+ trackEndsExtent="2"
+ thumbUpSrc="scrollbar_horiz_thumb_up.png"
+ thumbDownSrc="scrollbar_horiz_thumb_down.png"
+ thumbEndsExtent="4"/>
+ <vertical
+ trackSrc="scrollbar_vert_track.png"
+ trackDisabledSrc="scrollbar_vert_track_disabled.png"
+ trackEndsExtent="2"
+ thumbUpSrc="scrollbar_vert_thumb_up.png"
+ thumbDownSrc="scrollbar_vert_thumb_down.png"
+ thumbEndsExtent="4"/>
+ </scrollbar>
+ <progressbar>
+ <horizontal
+ trackSrc="scrollbar_horiz_track.png"
+ trackEndsExtent="2"
+ thumbUpSrc="scrollbar_horiz_thumb_up.png"
+ thumbDisabledSrc="scrollbar_vert_thumb_down.png"
+ thumbEndsExtent="4"/>
+ <vertical
+ trackSrc="scrollbar_vert_track.png"
+ trackEndsExtent="2"
+ thumbUpSrc="scrollbar_vert_thumb_up.png"
+ thumbDisabledSrc="scrollbar_vert_thumb_down.png"
+ thumbEndsExtent="4"/>
+ </progressbar>
+ <scrollarea
+ borderSrc="scrollarea_border.png"
+ borderEndsExtent="(8,8)"
+ margins="(1,1,8,8)"
+ friction="-1"
+ sensitiveScrollBars="True"/>
+ <checkbox
+ uncheckedUpSrc="checkbox_unchecked_up.png"
+ uncheckedDownSrc="checkbox_unchecked_down.png"
+ uncheckedDisabledSrc="checkbox_unchecked_disabled.png"
+ checkedUpSrc="checkbox_checked_up.png"
+ checkedDownSrc="checkbox_checked_down.png"
+ checkedDisabledSrc="checkbox_checked_disabled.png"
+ font="stdFont"
+ downFont="stdFont"
+ disabledFont="disabledFont"/>
+ <mediacontrol
+ playUpSrc="play_button_up.png"
+ playDownSrc="play_button_down.png"
+ pauseUpSrc="pause_button_up.png"
+ pauseDownSrc="pause_button_down.png"
+ font="stdFont"
+ timePos="(15,0)"
+ timeLeftPos="(-42,0)"
+ barPos="(55,2)"
+ barRight="-45"/>
+</skin>
diff --git a/src/test/media/button_bg_down.png b/src/test/media/button_bg_down.png
new file mode 100644
index 0000000..81cbb0f
--- /dev/null
+++ b/src/test/media/button_bg_down.png
Binary files differ
diff --git a/src/test/media/button_bg_up.png b/src/test/media/button_bg_up.png
new file mode 100644
index 0000000..91cfe04
--- /dev/null
+++ b/src/test/media/button_bg_up.png
Binary files differ
diff --git a/src/test/button_check.png b/src/test/media/button_check.png
index b0aa4a9..b0aa4a9 100644
--- a/src/test/button_check.png
+++ b/src/test/media/button_check.png
Binary files differ
diff --git a/src/test/button_disabled.png b/src/test/media/button_disabled.png
index dbf1309..dbf1309 100644
--- a/src/test/button_disabled.png
+++ b/src/test/media/button_disabled.png
Binary files differ
diff --git a/src/test/button_down.png b/src/test/media/button_down.png
index 88ee5f5..88ee5f5 100644
--- a/src/test/button_down.png
+++ b/src/test/media/button_down.png
Binary files differ
diff --git a/src/test/button_over.png b/src/test/media/button_over.png
index 0837e8e..0837e8e 100644
--- a/src/test/button_over.png
+++ b/src/test/media/button_over.png
Binary files differ
diff --git a/src/test/button_up.png b/src/test/media/button_up.png
index aa7d33a..aa7d33a 100644
--- a/src/test/button_up.png
+++ b/src/test/media/button_up.png
Binary files differ
diff --git a/src/test/media/checkbox_checked_disabled.png b/src/test/media/checkbox_checked_disabled.png
new file mode 100644
index 0000000..da58829
--- /dev/null
+++ b/src/test/media/checkbox_checked_disabled.png
Binary files differ
diff --git a/src/test/media/checkbox_checked_down.png b/src/test/media/checkbox_checked_down.png
new file mode 100644
index 0000000..4fbbd83
--- /dev/null
+++ b/src/test/media/checkbox_checked_down.png
Binary files differ
diff --git a/src/test/media/checkbox_checked_up.png b/src/test/media/checkbox_checked_up.png
new file mode 100644
index 0000000..ca901f4
--- /dev/null
+++ b/src/test/media/checkbox_checked_up.png
Binary files differ
diff --git a/src/test/media/checkbox_unchecked_disabled.png b/src/test/media/checkbox_unchecked_disabled.png
new file mode 100644
index 0000000..e8c2116
--- /dev/null
+++ b/src/test/media/checkbox_unchecked_disabled.png
Binary files differ
diff --git a/src/test/media/checkbox_unchecked_down.png b/src/test/media/checkbox_unchecked_down.png
new file mode 100644
index 0000000..69f8282
--- /dev/null
+++ b/src/test/media/checkbox_unchecked_down.png
Binary files differ
diff --git a/src/test/media/checkbox_unchecked_up.png b/src/test/media/checkbox_unchecked_up.png
new file mode 100644
index 0000000..e354492
--- /dev/null
+++ b/src/test/media/checkbox_unchecked_up.png
Binary files differ
diff --git a/src/test/checker.png b/src/test/media/checker.png
index 4f100c5..4f100c5 100644
--- a/src/test/checker.png
+++ b/src/test/media/checker.png
Binary files differ
diff --git a/src/graphics/testfiles/chromakey-median.png b/src/test/media/chromakey-median.png
index 5858c4b..5858c4b 100644
--- a/src/graphics/testfiles/chromakey-median.png
+++ b/src/test/media/chromakey-median.png
Binary files differ
diff --git a/src/graphics/testfiles/chromakey.png b/src/test/media/chromakey.png
index b2cfc2e..b2cfc2e 100644
--- a/src/graphics/testfiles/chromakey.png
+++ b/src/test/media/chromakey.png
Binary files differ
diff --git a/src/test/colorramp.png b/src/test/media/colorramp.png
index da12725..da12725 100644
--- a/src/test/colorramp.png
+++ b/src/test/media/colorramp.png
Binary files differ
diff --git a/src/test/media/core b/src/test/media/core
new file mode 100644
index 0000000..a3b4f7b
--- /dev/null
+++ b/src/test/media/core
Binary files differ
diff --git a/src/test/crop_bkgd.png b/src/test/media/crop_bkgd.png
index 89f9e95..89f9e95 100644
--- a/src/test/crop_bkgd.png
+++ b/src/test/media/crop_bkgd.png
Binary files differ
diff --git a/src/graphics/testfiles/dilation.png b/src/test/media/dilation.png
index 7981594..7981594 100644
--- a/src/graphics/testfiles/dilation.png
+++ b/src/test/media/dilation.png
Binary files differ
diff --git a/src/graphics/testfiles/erosion.png b/src/test/media/erosion.png
index 899e2c4..899e2c4 100644
--- a/src/graphics/testfiles/erosion.png
+++ b/src/test/media/erosion.png
Binary files differ
diff --git a/src/imaging/testfiles/filterwipeborder.png b/src/test/media/filterwipeborder.png
index 58ac84d..58ac84d 100644
--- a/src/imaging/testfiles/filterwipeborder.png
+++ b/src/test/media/filterwipeborder.png
Binary files differ
diff --git a/src/graphics/testfiles/flat.png b/src/test/media/flat.png
index 51d2c55..51d2c55 100644
--- a/src/graphics/testfiles/flat.png
+++ b/src/test/media/flat.png
Binary files differ
diff --git a/src/graphics/testfiles/floodfill.png b/src/test/media/floodfill.png
index 6a9e5b5..6a9e5b5 100644
--- a/src/graphics/testfiles/floodfill.png
+++ b/src/test/media/floodfill.png
Binary files differ
diff --git a/src/test/freidrehen.jpg b/src/test/media/freidrehen.jpg
index 7f93bf0..7f93bf0 100644
--- a/src/test/freidrehen.jpg
+++ b/src/test/media/freidrehen.jpg
Binary files differ
diff --git a/src/test/greyscale.png b/src/test/media/greyscale.png
index f86a18b..f86a18b 100644
--- a/src/test/greyscale.png
+++ b/src/test/media/greyscale.png
Binary files differ
diff --git a/src/video/testfiles/h264-48x48.h264 b/src/test/media/h264-48x48.h264
index d650960..d650960 100644
--- a/src/video/testfiles/h264-48x48.h264
+++ b/src/test/media/h264-48x48.h264
Binary files differ
diff --git a/src/graphics/testfiles/hsl.png b/src/test/media/hsl.png
index 9621451..9621451 100644
--- a/src/graphics/testfiles/hsl.png
+++ b/src/test/media/hsl.png
Binary files differ
diff --git a/src/graphics/testfiles/i8-64x64.png b/src/test/media/i8-64x64.png
index ec88c8c..ec88c8c 100644
--- a/src/graphics/testfiles/i8-64x64.png
+++ b/src/test/media/i8-64x64.png
Binary files differ
diff --git a/src/test/media/incompleteSkinMedia/IncompleteSkin.xml b/src/test/media/incompleteSkinMedia/IncompleteSkin.xml
new file mode 100644
index 0000000..019d702
--- /dev/null
+++ b/src/test/media/incompleteSkinMedia/IncompleteSkin.xml
@@ -0,0 +1,11 @@
+<skin>
+<scrollbar>
+ <horizontal
+ trackSrc="scrollbar_horiz_track.png"
+ trackDisabledSrc="scrollbar_horiz_track_disabled.png"
+ trackEndsExtent="2"
+ thumbUpSrc="scrollbar_horiz_thumb_up.png"
+ thumbDownSrc="scrollbar_horiz_thumb_down.png"
+ thumbEndsExtent="4"/>
+</scrollbar>
+</skin>
diff --git a/src/test/media/incompleteSkinMedia/scrollbar_horiz_thumb_down.png b/src/test/media/incompleteSkinMedia/scrollbar_horiz_thumb_down.png
new file mode 100644
index 0000000..6dc6fd1
--- /dev/null
+++ b/src/test/media/incompleteSkinMedia/scrollbar_horiz_thumb_down.png
Binary files differ
diff --git a/src/test/media/incompleteSkinMedia/scrollbar_horiz_thumb_up.png b/src/test/media/incompleteSkinMedia/scrollbar_horiz_thumb_up.png
new file mode 100644
index 0000000..eb6b005
--- /dev/null
+++ b/src/test/media/incompleteSkinMedia/scrollbar_horiz_thumb_up.png
Binary files differ
diff --git a/src/test/media/incompleteSkinMedia/scrollbar_horiz_track.png b/src/test/media/incompleteSkinMedia/scrollbar_horiz_track.png
new file mode 100644
index 0000000..d2f393b
--- /dev/null
+++ b/src/test/media/incompleteSkinMedia/scrollbar_horiz_track.png
Binary files differ
diff --git a/src/test/media/incompleteSkinMedia/scrollbar_horiz_track_disabled.png b/src/test/media/incompleteSkinMedia/scrollbar_horiz_track_disabled.png
new file mode 100644
index 0000000..7ac86fe
--- /dev/null
+++ b/src/test/media/incompleteSkinMedia/scrollbar_horiz_track_disabled.png
Binary files differ
diff --git a/src/test/keyboard_bg.png b/src/test/media/keyboard_bg.png
index a767d06..a767d06 100644
--- a/src/test/keyboard_bg.png
+++ b/src/test/media/keyboard_bg.png
Binary files differ
diff --git a/src/test/keyboard_ovl.png b/src/test/media/keyboard_down.png
index f3ead71..f3ead71 100644
--- a/src/test/keyboard_ovl.png
+++ b/src/test/media/keyboard_down.png
Binary files differ
diff --git a/src/test/media/keyboard_feedback.png b/src/test/media/keyboard_feedback.png
new file mode 100644
index 0000000..e519594
--- /dev/null
+++ b/src/test/media/keyboard_feedback.png
Binary files differ
diff --git a/src/test/mask.png b/src/test/media/mask.png
index 031b39a..031b39a 100644
--- a/src/test/mask.png
+++ b/src/test/media/mask.png
Binary files differ
diff --git a/src/test/mask1.png b/src/test/media/mask1.png
index ffe5618..ffe5618 100644
--- a/src/test/mask1.png
+++ b/src/test/media/mask1.png
Binary files differ
diff --git a/src/test/mask2.png b/src/test/media/mask2.png
index 92975df..92975df 100644
--- a/src/test/mask2.png
+++ b/src/test/media/mask2.png
Binary files differ
diff --git a/src/video/testfiles/mjpeg-48x48.avi b/src/test/media/mjpeg-48x48.avi
index 337df16..337df16 100644
--- a/src/video/testfiles/mjpeg-48x48.avi
+++ b/src/test/media/mjpeg-48x48.avi
Binary files differ
diff --git a/src/test/media/mpeg1-48x48-sound.avi b/src/test/media/mpeg1-48x48-sound.avi
new file mode 100644
index 0000000..be415db
--- /dev/null
+++ b/src/test/media/mpeg1-48x48-sound.avi
Binary files differ
diff --git a/src/test/media/mpeg1-48x48.mov b/src/test/media/mpeg1-48x48.mov
new file mode 100644
index 0000000..16ab499
--- /dev/null
+++ b/src/test/media/mpeg1-48x48.mov
Binary files differ
diff --git a/src/test/media/mpeg4-48x48.avi b/src/test/media/mpeg4-48x48.avi
new file mode 100644
index 0000000..a906b17
--- /dev/null
+++ b/src/test/media/mpeg4-48x48.avi
Binary files differ
diff --git a/src/test/oe.png b/src/test/media/oe.png
index 3527967..3527967 100644
--- a/src/test/oe.png
+++ b/src/test/media/oe.png
Binary files differ
diff --git a/src/test/media/pause_button_down.png b/src/test/media/pause_button_down.png
new file mode 100644
index 0000000..c06b34a
--- /dev/null
+++ b/src/test/media/pause_button_down.png
Binary files differ
diff --git a/src/test/media/pause_button_up.png b/src/test/media/pause_button_up.png
new file mode 100644
index 0000000..1a923b9
--- /dev/null
+++ b/src/test/media/pause_button_up.png
Binary files differ
diff --git a/src/test/media/play_button_down.png b/src/test/media/play_button_down.png
new file mode 100644
index 0000000..07b167b
--- /dev/null
+++ b/src/test/media/play_button_down.png
Binary files differ
diff --git a/src/test/media/play_button_up.png b/src/test/media/play_button_up.png
new file mode 100644
index 0000000..e16ec9e
--- /dev/null
+++ b/src/test/media/play_button_up.png
Binary files differ
diff --git a/src/test/rect.svg b/src/test/media/rect.svg
index 136b061..136b061 100644
--- a/src/test/rect.svg
+++ b/src/test/media/rect.svg
diff --git a/src/test/rectborder.png b/src/test/media/rectborder.png
index 1675688..1675688 100644
--- a/src/test/rectborder.png
+++ b/src/test/media/rectborder.png
Binary files differ
diff --git a/src/test/rgb24-32x32.png b/src/test/media/rgb24-32x32.png
index c5d6711..c5d6711 100644
--- a/src/test/rgb24-32x32.png
+++ b/src/test/media/rgb24-32x32.png
Binary files differ
diff --git a/src/graphics/testfiles/rgb24-64x64.png b/src/test/media/rgb24-64x64.png
index cca71fe..cca71fe 100644
--- a/src/graphics/testfiles/rgb24-64x64.png
+++ b/src/test/media/rgb24-64x64.png
Binary files differ
diff --git a/src/graphics/testfiles/rgb24-65x65.png b/src/test/media/rgb24-65x65.png
index ada2689..ada2689 100644
--- a/src/graphics/testfiles/rgb24-65x65.png
+++ b/src/test/media/rgb24-65x65.png
Binary files differ
diff --git a/src/test/rgb24alpha-32x32.png b/src/test/media/rgb24alpha-32x32.png
index 2e9e6af..2e9e6af 100644
--- a/src/test/rgb24alpha-32x32.png
+++ b/src/test/media/rgb24alpha-32x32.png
Binary files differ
diff --git a/src/test/rgb24alpha-64x64.png b/src/test/media/rgb24alpha-64x64.png
index 41b69c3..41b69c3 100644
--- a/src/test/rgb24alpha-64x64.png
+++ b/src/test/media/rgb24alpha-64x64.png
Binary files differ
diff --git a/src/video/testfiles/rgba-48x48.mov b/src/test/media/rgba-48x48.mov
index 7e311cc..7e311cc 100644
--- a/src/video/testfiles/rgba-48x48.mov
+++ b/src/test/media/rgba-48x48.mov
Binary files differ
diff --git a/src/test/media/scrollarea_border.png b/src/test/media/scrollarea_border.png
new file mode 100644
index 0000000..2e95f57
--- /dev/null
+++ b/src/test/media/scrollarea_border.png
Binary files differ
diff --git a/src/test/media/scrollbar_horiz_thumb_disabled.png b/src/test/media/scrollbar_horiz_thumb_disabled.png
new file mode 100644
index 0000000..4645372
--- /dev/null
+++ b/src/test/media/scrollbar_horiz_thumb_disabled.png
Binary files differ
diff --git a/src/test/media/scrollbar_horiz_thumb_down.png b/src/test/media/scrollbar_horiz_thumb_down.png
new file mode 100644
index 0000000..6dc6fd1
--- /dev/null
+++ b/src/test/media/scrollbar_horiz_thumb_down.png
Binary files differ
diff --git a/src/test/media/scrollbar_horiz_thumb_up.png b/src/test/media/scrollbar_horiz_thumb_up.png
new file mode 100644
index 0000000..eb6b005
--- /dev/null
+++ b/src/test/media/scrollbar_horiz_thumb_up.png
Binary files differ
diff --git a/src/test/media/scrollbar_horiz_track.png b/src/test/media/scrollbar_horiz_track.png
new file mode 100644
index 0000000..d2f393b
--- /dev/null
+++ b/src/test/media/scrollbar_horiz_track.png
Binary files differ
diff --git a/src/test/media/scrollbar_horiz_track_disabled.png b/src/test/media/scrollbar_horiz_track_disabled.png
new file mode 100644
index 0000000..7ac86fe
--- /dev/null
+++ b/src/test/media/scrollbar_horiz_track_disabled.png
Binary files differ
diff --git a/src/test/media/scrollbar_vert_thumb_disabled.png b/src/test/media/scrollbar_vert_thumb_disabled.png
new file mode 100644
index 0000000..f375a2b
--- /dev/null
+++ b/src/test/media/scrollbar_vert_thumb_disabled.png
Binary files differ
diff --git a/src/test/media/scrollbar_vert_thumb_down.png b/src/test/media/scrollbar_vert_thumb_down.png
new file mode 100644
index 0000000..c7b09d1
--- /dev/null
+++ b/src/test/media/scrollbar_vert_thumb_down.png
Binary files differ
diff --git a/src/test/media/scrollbar_vert_thumb_up.png b/src/test/media/scrollbar_vert_thumb_up.png
new file mode 100644
index 0000000..f6c2f88
--- /dev/null
+++ b/src/test/media/scrollbar_vert_thumb_up.png
Binary files differ
diff --git a/src/test/media/scrollbar_vert_track.png b/src/test/media/scrollbar_vert_track.png
new file mode 100644
index 0000000..58af284
--- /dev/null
+++ b/src/test/media/scrollbar_vert_track.png
Binary files differ
diff --git a/src/test/media/scrollbar_vert_track_disabled.png b/src/test/media/scrollbar_vert_track_disabled.png
new file mode 100644
index 0000000..695b112
--- /dev/null
+++ b/src/test/media/scrollbar_vert_track_disabled.png
Binary files differ
diff --git a/src/test/shadow.png b/src/test/media/shadow.png
index 0a4563f..0a4563f 100644
--- a/src/test/shadow.png
+++ b/src/test/media/shadow.png
Binary files differ
diff --git a/src/test/media/slider_horiz_track.png b/src/test/media/slider_horiz_track.png
new file mode 100644
index 0000000..6e233a5
--- /dev/null
+++ b/src/test/media/slider_horiz_track.png
Binary files differ
diff --git a/src/test/media/slider_horiz_track_disabled.png b/src/test/media/slider_horiz_track_disabled.png
new file mode 100644
index 0000000..01c880d
--- /dev/null
+++ b/src/test/media/slider_horiz_track_disabled.png
Binary files differ
diff --git a/src/test/media/slider_thumb_down.png b/src/test/media/slider_thumb_down.png
new file mode 100644
index 0000000..1f2acc2
--- /dev/null
+++ b/src/test/media/slider_thumb_down.png
Binary files differ
diff --git a/src/test/media/slider_thumb_up.png b/src/test/media/slider_thumb_up.png
new file mode 100644
index 0000000..885506d
--- /dev/null
+++ b/src/test/media/slider_thumb_up.png
Binary files differ
diff --git a/src/test/media/slider_vert_track.png b/src/test/media/slider_vert_track.png
new file mode 100644
index 0000000..51bac37
--- /dev/null
+++ b/src/test/media/slider_vert_track.png
Binary files differ
diff --git a/src/test/media/slider_vert_track_disabled.png b/src/test/media/slider_vert_track_disabled.png
new file mode 100644
index 0000000..bc8d7b6
--- /dev/null
+++ b/src/test/media/slider_vert_track_disabled.png
Binary files differ
diff --git a/src/graphics/testfiles/spike.png b/src/test/media/spike.png
index 958e95d..958e95d 100644
--- a/src/graphics/testfiles/spike.png
+++ b/src/test/media/spike.png
Binary files differ
diff --git a/src/test/media/toggle_checked_Disabled.png b/src/test/media/toggle_checked_Disabled.png
new file mode 100644
index 0000000..31372c0
--- /dev/null
+++ b/src/test/media/toggle_checked_Disabled.png
Binary files differ
diff --git a/src/test/media/toggle_checked_Down.png b/src/test/media/toggle_checked_Down.png
new file mode 100644
index 0000000..8c4afd2
--- /dev/null
+++ b/src/test/media/toggle_checked_Down.png
Binary files differ
diff --git a/src/test/media/toggle_checked_Up.png b/src/test/media/toggle_checked_Up.png
new file mode 100644
index 0000000..8214fcf
--- /dev/null
+++ b/src/test/media/toggle_checked_Up.png
Binary files differ
diff --git a/src/test/media/toggle_unchecked_Disabled.png b/src/test/media/toggle_unchecked_Disabled.png
new file mode 100644
index 0000000..6b90e0b
--- /dev/null
+++ b/src/test/media/toggle_unchecked_Disabled.png
Binary files differ
diff --git a/src/test/media/toggle_unchecked_Down.png b/src/test/media/toggle_unchecked_Down.png
new file mode 100644
index 0000000..f2e4272
--- /dev/null
+++ b/src/test/media/toggle_unchecked_Down.png
Binary files differ
diff --git a/src/test/media/toggle_unchecked_Up.png b/src/test/media/toggle_unchecked_Up.png
new file mode 100644
index 0000000..3a006ea
--- /dev/null
+++ b/src/test/media/toggle_unchecked_Up.png
Binary files differ
diff --git a/src/video/testfiles/vp6a-yuva-48x48.flv b/src/test/media/vp6a-yuva-48x48.flv
index 21866fe..21866fe 100644
--- a/src/video/testfiles/vp6a-yuva-48x48.flv
+++ b/src/test/media/vp6a-yuva-48x48.flv
Binary files differ
diff --git a/src/test/widebmp.jpg b/src/test/media/widebmp.jpg
index 8304e3d..8304e3d 100644
--- a/src/test/widebmp.jpg
+++ b/src/test/media/widebmp.jpg
Binary files differ
diff --git a/src/test/panoimage.png b/src/test/panoimage.png
deleted file mode 100644
index 118b573..0000000
--- a/src/test/panoimage.png
+++ /dev/null
Binary files differ
diff --git a/src/test/plugin/ColorNode.cpp b/src/test/plugin/ColorNode.cpp
index 7231c48..b98c98b 100644
--- a/src/test/plugin/ColorNode.cpp
+++ b/src/test/plugin/ColorNode.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -26,7 +26,7 @@
#include "../../player/Player.h"
#include "../../player/AreaNode.h"
-#include "../../player/NodeDefinition.h"
+#include "../../player/TypeDefinition.h"
#include "../../base/Logger.h"
#include "../../graphics/OGLHelper.h"
@@ -46,7 +46,7 @@ namespace avg {
class ColorNode : public AreaNode
{
public:
- static NodeDefinition createNodeDefinition();
+ static void registerType();
ColorNode(const ArgList& Args);
@@ -56,33 +56,34 @@ public:
float getFloat() const;
void setFloat(float f);
- virtual void maybeRender(const DRect& Rect);
- virtual void render (const DRect& Rect);
+ virtual void maybeRender(const glm::mat4& parentTransform);
+ virtual void render();
-protected:
- void parseColor(const std::string& sColorSreing);
-
+private:
std::string m_sFillColorName;
- float m_r, m_g, m_b;
+ Pixel32 m_Color;
float m_FloatParam;
};
-ColorNode::ColorNode(const ArgList& Args) :
- m_sFillColorName("FFFFFF")
+ColorNode::ColorNode(const ArgList& Args)
+ : m_sFillColorName("FFFFFF")
{
- AVG_TRACE(Logger::PLUGIN, "ColorNode c'tor gets Argument fillcolor= " << Args.getArgVal<string>("fillcolor"));
+ AVG_TRACE(Logger::category::PLUGIN, Logger::severity::INFO,
+ "ColorNode c'tor gets Argument fillcolor= " <<
+ Args.getArgVal<string>("fillcolor"));
Args.setMembers(this);
- AVG_TRACE(Logger::PLUGIN, "ColorNode constructed with " << m_sFillColorName);
-
- parseColor(m_sFillColorName);
+ AVG_TRACE(Logger::category::PLUGIN, Logger::severity::INFO,
+ "ColorNode constructed with " << m_sFillColorName);
+ m_Color = colorStringToColor(m_sFillColorName);
}
void ColorNode::setFillColor(const string& sFillColor)
{
- AVG_TRACE(Logger::PLUGIN, "setFillColor called with " << sFillColor);
+ AVG_TRACE(Logger::category::PLUGIN, Logger::severity::INFO,
+ "setFillColor called with " << sFillColor);
m_sFillColorName = sFillColor;
- parseColor(m_sFillColorName);
+ m_Color = colorStringToColor(m_sFillColorName);
}
const std::string& ColorNode::getFillColor() const
@@ -101,37 +102,29 @@ void ColorNode::setFloat(float f)
}
-void ColorNode::parseColor(const std::string& sColorSreing)
+void ColorNode::maybeRender(const glm::mat4& parentTransform)
{
- istringstream(sColorSreing.substr(0,2)) >> hex >> m_r;
- istringstream(sColorSreing.substr(2,2)) >> hex >> m_g;
- istringstream(sColorSreing.substr(4,2)) >> hex >> m_b;
+ render();
}
-
-void ColorNode::maybeRender(const DRect& rect)
+void ColorNode::render()
{
- render(rect);
-}
-
-void ColorNode::render(const DRect& rect)
-{
- //AVG_TRACE(Logger::PLUGIN, "ColorNode::render");
-
- glClearColor(m_r, m_g, m_b, 1.0);
+ glClearColor(m_Color.getR()/255., m_Color.getG()/255., m_Color.getB()/255., 1.0);
glClear(GL_COLOR_BUFFER_BIT);
}
char colorNodeName[] = "colornode";
-NodeDefinition ColorNode::createNodeDefinition()
+void ColorNode::registerType()
{
- return NodeDefinition("colornode", Node::buildNode<ColorNode>)
- .extendDefinition(AreaNode::createDefinition())
+ avg::TypeDefinition def = avg::TypeDefinition("colornode", "areanode",
+ ExportedObject::buildObject<ColorNode>)
.addArg(Arg<float>("floatparam", 0.0f, false,
offsetof(ColorNode, m_FloatParam)))
.addArg(Arg<string>("fillcolor", "0F0F0F", false,
offsetof(ColorNode, m_sFillColorName)));
+ const char* allowedParentNodeNames[] = {"avg", 0};
+ avg::TypeRegistry::get()->registerType(def, allowedParentNodeNames);
}
}
@@ -154,10 +147,7 @@ AVG_PLUGIN_API void registerPlugin()
object colorModule(handle<>(PyImport_ImportModule("colorplugin")));
mainModule.attr("colorplugin") = colorModule;
- avg::NodeDefinition myNodeDefinition = avg::ColorNode::createNodeDefinition();
- const char* allowedParentNodeNames[] = {"avg", 0};
+ avg::ColorNode::registerType();
- // Register this node type
- avg::Player::get()->registerNodeType(myNodeDefinition, allowedParentNodeNames);
}
diff --git a/src/test/plugin/Makefile.am b/src/test/plugin/Makefile.am
index 7d2cd34..9aa10b1 100644
--- a/src/test/plugin/Makefile.am
+++ b/src/test/plugin/Makefile.am
@@ -1,19 +1,19 @@
-
-INCLUDES = -I. -I../player \
- @XML2_CFLAGS@ @PTHREAD_CFLAGS@ @PANGOFT2_CFLAGS@ @PYTHON_INCLUDES@ @DC1394_2_CFLAGS@
+AM_CPPFLAGS = -I. -I../player \
+ @XML2_CFLAGS@ @PTHREAD_CFLAGS@ @PANGOFT2_CFLAGS@ \
+ @PYTHON_CPPFLAGS@ @DC1394_2_CFLAGS@
ALL_H =
if APPLE
XGL_LIBS =
- EXTRA_LDFLAGS=-read_only_relocs suppress
+ EXTRA_LDFLAGS = -read_only_relocs suppress
else
XGL_LIBS = -lXxf86vm
- EXTRA_LDFLAGS=-XCClinker ../../wrapper/.libs/avg.so
+ EXTRA_LDFLAGS = -XCClinker ../../wrapper/.libs/avg.so
endif
ALL_GL_LIBS = @GL_LIBS@ @SDL_LIBS@ $(XGL_LIBS)
pkgpyexec_LTLIBRARIES = colorplugin.la
-colorplugin_la_SOURCES = ColorNode.cpp
-colorplugin_la_LDFLAGS = $(EXTRA_LDFLAGS) -module
+colorplugin_la_SOURCES = ColorNode.cpp
+colorplugin_la_LDFLAGS = $(EXTRA_LDFLAGS) -module
diff --git a/src/test/plugin/Makefile.in b/src/test/plugin/Makefile.in
index adac1e9..5376384 100644
--- a/src/test/plugin/Makefile.in
+++ b/src/test/plugin/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# Makefile.in generated by automake 1.11.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
-# Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -41,11 +41,12 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ac_cxx_namespaces.m4 \
$(top_srcdir)/m4/ac_path_generic.m4 \
$(top_srcdir)/m4/ax_boost_thread.m4 \
- $(top_srcdir)/m4/ax_check_gl.m4 $(top_srcdir)/m4/libtool.m4 \
- $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
- $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
- $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/m4/python_dev.m4 \
- $(top_srcdir)/configure.in
+ $(top_srcdir)/m4/ax_check_gl.m4 \
+ $(top_srcdir)/m4/ax_python_devel.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/pkg.m4 \
+ $(top_srcdir)/m4/avg_version.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
@@ -73,13 +74,19 @@ am__nobase_list = $(am__nobase_strip_setup); \
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
am__installdirs = "$(DESTDIR)$(pkgpyexecdir)"
LTLIBRARIES = $(pkgpyexec_LTLIBRARIES)
colorplugin_la_LIBADD =
am_colorplugin_la_OBJECTS = ColorNode.lo
colorplugin_la_OBJECTS = $(am_colorplugin_la_OBJECTS)
-AM_V_lt = $(am__v_lt_$(V))
-am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
am__v_lt_0 = --silent
colorplugin_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \
@@ -95,21 +102,21 @@ LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CXXFLAGS) $(CXXFLAGS)
-AM_V_CXX = $(am__v_CXX_$(V))
-am__v_CXX_ = $(am__v_CXX_$(AM_DEFAULT_VERBOSITY))
+AM_V_CXX = $(am__v_CXX_@AM_V@)
+am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@)
am__v_CXX_0 = @echo " CXX " $@;
-AM_V_at = $(am__v_at_$(V))
-am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
CXXLD = $(CXX)
CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
$(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
-AM_V_CXXLD = $(am__v_CXXLD_$(V))
-am__v_CXXLD_ = $(am__v_CXXLD_$(AM_DEFAULT_VERBOSITY))
+AM_V_CXXLD = $(am__v_CXXLD_@AM_V@)
+am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@)
am__v_CXXLD_0 = @echo " CXXLD " $@;
-AM_V_GEN = $(am__v_GEN_$(V))
-am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
SOURCES = $(colorplugin_la_SOURCES)
DIST_SOURCES = $(colorplugin_la_SOURCES)
@@ -125,7 +132,7 @@ AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BOOST_PYTHON_LIBS = @BOOST_PYTHON_LIBS@
-BOOST_THREAD_LIB = @BOOST_THREAD_LIB@
+BOOST_THREAD_LIBS = @BOOST_THREAD_LIBS@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
@@ -140,6 +147,7 @@ DC1394_2_CFLAGS = @DC1394_2_CFLAGS@
DC1394_2_LIBS = @DC1394_2_LIBS@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
@@ -180,6 +188,7 @@ LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
MTDEV_CFLAGS = @MTDEV_CFLAGS@
MTDEV_LIBS = @MTDEV_LIBS@
@@ -209,11 +218,13 @@ PTHREAD_CC = @PTHREAD_CC@
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
PTHREAD_LIBS = @PTHREAD_LIBS@
PYTHON = @PYTHON@
+PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@
PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
-PYTHON_INCLUDES = @PYTHON_INCLUDES@
-PYTHON_LIBS = @PYTHON_LIBS@
+PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@
+PYTHON_LDFLAGS = @PYTHON_LDFLAGS@
PYTHON_PLATFORM = @PYTHON_PLATFORM@
PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_SITE_PKG = @PYTHON_SITE_PKG@
PYTHON_VERSION = @PYTHON_VERSION@
RANLIB = @RANLIB@
SDL_CFLAGS = @SDL_CFLAGS@
@@ -236,6 +247,7 @@ abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
@@ -270,7 +282,6 @@ libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
@@ -294,8 +305,9 @@ target_vendor = @target_vendor@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-INCLUDES = -I. -I../player \
- @XML2_CFLAGS@ @PTHREAD_CFLAGS@ @PANGOFT2_CFLAGS@ @PYTHON_INCLUDES@ @DC1394_2_CFLAGS@
+AM_CPPFLAGS = -I. -I../player \
+ @XML2_CFLAGS@ @PTHREAD_CFLAGS@ @PANGOFT2_CFLAGS@ \
+ @PYTHON_CPPFLAGS@ @DC1394_2_CFLAGS@
ALL_H =
@APPLE_FALSE@XGL_LIBS = -lXxf86vm
@@ -304,8 +316,8 @@ ALL_H =
@APPLE_TRUE@EXTRA_LDFLAGS = -read_only_relocs suppress
ALL_GL_LIBS = @GL_LIBS@ @SDL_LIBS@ $(XGL_LIBS)
pkgpyexec_LTLIBRARIES = colorplugin.la
-colorplugin_la_SOURCES = ColorNode.cpp
-colorplugin_la_LDFLAGS = $(EXTRA_LDFLAGS) -module
+colorplugin_la_SOURCES = ColorNode.cpp
+colorplugin_la_LDFLAGS = $(EXTRA_LDFLAGS) -module
all: all-am
.SUFFIXES:
@@ -371,7 +383,7 @@ clean-pkgpyexecLTLIBRARIES:
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
-colorplugin.la: $(colorplugin_la_OBJECTS) $(colorplugin_la_DEPENDENCIES)
+colorplugin.la: $(colorplugin_la_OBJECTS) $(colorplugin_la_DEPENDENCIES) $(EXTRA_colorplugin_la_DEPENDENCIES)
$(AM_V_CXXLD)$(colorplugin_la_LINK) -rpath $(pkgpyexecdir) $(colorplugin_la_OBJECTS) $(colorplugin_la_LIBADD) $(LIBS)
mostlyclean-compile:
@@ -385,26 +397,23 @@ distclean-compile:
.cpp.o:
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $<
.cpp.obj:
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
.cpp.lo:
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
-@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
@@ -511,10 +520,15 @@ install-am: all-am
installcheck: installcheck-am
install-strip:
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- `test -z '$(STRIP)' || \
- echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
mostlyclean-generic:
clean-generic:
diff --git a/src/test/rgb24-64x64.png b/src/test/rgb24-64x64.png
deleted file mode 100644
index cca71fe..0000000
--- a/src/test/rgb24-64x64.png
+++ /dev/null
Binary files differ
diff --git a/src/test/rgb24-65x65.png b/src/test/rgb24-65x65.png
deleted file mode 100644
index ada2689..0000000
--- a/src/test/rgb24-65x65.png
+++ /dev/null
Binary files differ
diff --git a/src/test/rgb24alpha.tif b/src/test/rgb24alpha.tif
deleted file mode 100644
index b37829d..0000000
--- a/src/test/rgb24alpha.tif
+++ /dev/null
Binary files differ
diff --git a/src/test/testapp.py b/src/test/testapp.py
index e5bc46d..251ab47 100644
--- a/src/test/testapp.py
+++ b/src/test/testapp.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# libavg - Media Playback Engine.
-# Copyright (C) 2003-2011 Ulrich von Zadow
+# 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
@@ -24,12 +24,13 @@ import unittest
import optparse
import os
+import sys
-import libavg
+from libavg import avg, player
import testcase
-class TestApp:
+class TestApp(object):
EXIT_OK = 0
EXIT_FAILURE = 1
@@ -45,7 +46,7 @@ class TestApp:
self.__testSuite = unittest.TestSuite()
self.__optionParser = None
self.__commandlineOptions = None
- self.__player = libavg.avg.Player.get()
+ player.keepWindowOpen()
def getSuiteFactory(self, name):
return self.__registerdSuiteFactoriesDict[name]
@@ -80,7 +81,7 @@ class TestApp:
yield self.__RegisterdSuitesDict[name]
def __runVideoTest(self):
- self.__player.loadFile("image.avg")
+ player.loadFile("image.avg")
def __run(self):
testRunner = unittest.TextTestRunner(verbosity = 2)
@@ -92,7 +93,12 @@ class TestApp:
for test in suite:
if test.skipped():
numSkipped += 1
- print "Skipped", numSkipped, "tests."
+ if numSkipped > 0:
+ sys.stderr.write("Skipped "+str(numSkipped)+" tests:\n")
+ for suite in self.__testSuite:
+ for test in suite:
+ if test.skipped():
+ print " " + str(test) + ": " + test.skipReason()
if testResult.wasSuccessful():
self.__exitOk = TestApp.EXIT_OK
@@ -105,43 +111,57 @@ class TestApp:
self.__populateTestSuite()
def __setupGlobalPlayerOptions(self):
- self.__player.setOGLOptions(self.__commandlineOptions.usepow2textures,
- self.__commandlineOptions.useshaders,
- self.__commandlineOptions.usepixelbuffers,
- 1)
-
+ if self.__commandlineOptions.shaderusage == "FULL":
+ shaderUsage = avg.SHADERUSAGE_FULL
+ elif self.__commandlineOptions.shaderusage == "MINIMAL":
+ shaderUsage = avg.SHADERUSAGE_MINIMAL
+ elif self.__commandlineOptions.shaderusage == "FRAGMENT_ONLY":
+ shaderUsage = avg.SHADERUSAGE_FRAGMENT_ONLY
+ elif self.__commandlineOptions.shaderusage == "AUTO":
+ shaderUsage = avg.SHADERUSAGE_AUTO
+ else:
+ sys.stderr.write("\nUnknown value for --shaderusage command-line parameter.\n")
+ self.__optionParser.print_help()
+ sys.exit(-1)
+
+ player.setOGLOptions(self.__commandlineOptions.usepow2textures,
+ self.__commandlineOptions.usepixelbuffers, 1, shaderUsage, True)
+
def __setupCommandlineParser(self):
self.__optionParser = optparse.OptionParser(
usage = '%prog [options] [<suite> [testcase] [testcase] [...]]')
-
+
self.__optionParser.add_option("--usepow2textures",
- dest = "usepow2textures",
- action = 'store_true',
- default = False,
- help = "Use power of 2 textures")
+ dest = "usepow2textures",
+ action = 'store_true',
+ default = False,
+ help = "Use power of 2 textures")
- self.__optionParser.add_option("--noshaders",
- dest = "useshaders",
- action = 'store_false',
- default = True,
- help = "Use shaders")
-
self.__optionParser.add_option("--nopixelbuffers",
- dest = "usepixelbuffers",
- action = 'store_false',
- default = True,
- help = "Use pixel buffers")
+ dest = "usepixelbuffers",
+ action = 'store_false',
+ default = True,
+ help = "Use pixel buffers")
+
+ self.__optionParser.add_option("--shaderusage",
+ dest = "shaderusage",
+ default = "AUTO",
+ help = "Configure usage of shaders. Valid values are FULL, MINIMAL, FRAGMENT_ONLY and AUTO.")
def __parseCommandline(self):
self.__commandlineOptions, args = self.__optionParser.parse_args()
-
+
+ # MFX 2013-11-10: cleanup argv consuming testapp args to avoid clashes
+ # with libavg.app.App ArgvExtender
+ sys.argv = [sys.argv[0]]
+
if len(args): # suite
suiteFactory = args.pop(0)
if not(self.isSuiteFactoryRegistered(suiteFactory)):
- print "Unknown test suite, registered suites:"
+ sys.stderr.write("Unknown test suite, registered suites:\n")
for factory in self.getSuiteFactoryNames():
- print factory
- print ''
+ sys.stderr.write(factory+"\n")
+ sys.stderr.write("\n")
self.__optionParser.print_usage()
self.__suitesToRun.append(self.getSuiteFactory(suiteFactory))
@@ -155,14 +175,17 @@ class TestApp:
self.__testSuite.addTest(suite(self.__suitesTestSubsets))
def __dumpConfig(self):
- log = libavg.avg.Logger.get()
- log.pushCategories()
- log.setCategories(log.APP | log.WARNING | log.CONFIG | 0)
- self.__player.loadString("""
+ player.enableGLErrorChecks(True)
+ cats = avg.logger.getCategories()
+ for cat in [avg.logger.Category.APP, avg.logger.Category.CONFIG,
+ avg.logger.Category.DEPREC]:
+ avg.logger.configureCategory(cat, avg.logger.Severity.INFO)
+ player.loadString("""
<avg id="avg" width="160" height="120">
</avg>
""")
- self.__player.setTimeout(0, self.__player.stop)
- self.__player.setFramerate(10000)
- self.__player.play()
- log.popCategories()
+ player.setTimeout(0, player.stop)
+ player.setFramerate(10000)
+ player.play()
+ for cat, severity in cats.iteritems():
+ avg.logger.configureCategory(cat, severity)
diff --git a/src/test/testcase.py b/src/test/testcase.py
index f9044a3..7e07279 100644
--- a/src/test/testcase.py
+++ b/src/test/testcase.py
@@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
# libavg - Media Playback Engine.
-# Copyright (C) 2003-2011 Ulrich von Zadow
+# 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
@@ -26,9 +26,7 @@ import sys
import os
import math
-from libavg import avg
-
-g_HasShaderSupport = None
+from libavg import avg, player
def almostEqual(a, b, epsilon):
try:
@@ -56,6 +54,22 @@ def flatten(l):
return ltype(l)
+class MouseEmulator(object):
+ def __init__(self):
+ self.btnStates = [False, False, False]
+
+ def sendMouseEvent(self, type_, x, y, btn=1):
+ helper = player.getTestHelper()
+ index = btn-1
+ if type_ == avg.Event.CURSOR_UP:
+ self.btnStates[index] = False
+ if type_ == avg.Event.CURSOR_DOWN:
+ self.btnStates[index] = True
+
+ helper.fakeMouseEvent(type_, self.btnStates[0], self.btnStates[1],
+ self.btnStates[2], x, y, btn)
+
+
class AVGTestCase(unittest.TestCase):
imageResultDirectory = "resultimages"
baselineImageResultDirectory = "baseline"
@@ -63,14 +77,16 @@ class AVGTestCase(unittest.TestCase):
def __init__(self, testFuncName):
unittest.TestCase.__init__(self, testFuncName)
- self.__player = avg.Player.get()
+ player.enableGLErrorChecks(True)
self.__testFuncName = testFuncName
- self.__logger = avg.Logger.get()
+ self.__logger = avg.logger
self.__skipped = False
+ self.__warnOnImageDiff = False
+ self.__mouseEmulator = None
def __setupPlayer(self):
- self.__player.setMultiSampleSamples(1)
- self.__player.setResolution(0, 0, 0, 0)
+ player.setMultiSampleSamples(1)
+ player.setResolution(0, 0, 0, 0)
@staticmethod
def setImageResultDirectory(name):
@@ -93,64 +109,57 @@ class AVGTestCase(unittest.TestCase):
except OSError:
pass
- @staticmethod
- def setBaselineImageDirectory(name):
- AVGTestCase.baselineImageResultDirectory = name
-
- @staticmethod
- def getBaselineImageDir():
- return AVGTestCase.baselineImageResultDirectory
-
- def start(self, actions):
+ def start(self, warnOnImageDiff, actions):
self.__setupPlayer()
self.__dumpTestFrames = (os.getenv("AVG_DUMP_TEST_FRAMES") != None)
self.__delaying = False
+ self.__warnOnImageDiff = warnOnImageDiff
- self.assert_(self.__player.isPlaying() == 0)
+ self.assert_(player.isPlaying() == 0)
self.actions = flatten(actions)
self.curFrame = 0
- self.__player.setOnFrameHandler(self.__nextAction)
- self.__player.setFramerate(10000)
- self.__player.play()
- self.assert_(self.__player.isPlaying() == 0)
+ player.subscribe(player.ON_FRAME, self.__nextAction)
+ player.setFramerate(10000)
+ player.assumePixelsPerMM(1)
+ player.play()
+ self.assert_(player.isPlaying() == 0)
def delay(self, time):
def timeout():
self.__delaying = False
self.__delaying = True
- self.__player.setTimeout(time, timeout)
+ player.setTimeout(time, timeout)
- def compareImage(self, fileName, warn):
- bmp = self.__player.screenshot()
- self.compareBitmapToFile(bmp, fileName, warn)
+ def compareImage(self, fileName):
+ bmp = player.screenshot()
+ self.compareBitmapToFile(bmp, fileName)
- def compareBitmapToFile(self, bmp, fileName, warn):
+ def compareBitmapToFile(self, bmp, fileName):
try:
- baselineBmp = avg.Bitmap(AVGTestCase.getBaselineImageDir() + "/" + fileName
- + ".png")
- diffBmp = bmp.subtract(baselineBmp)
- average = diffBmp.getAvg()
- stdDev = diffBmp.getStdDev()
- if (average > 0.1 or stdDev > 0.5):
- if self._isCurrentDirWriteable():
- bmp.save(AVGTestCase.getImageResultDir() + "/" + fileName + ".png")
- baselineBmp.save(AVGTestCase.getImageResultDir() + "/" + fileName
- + "_baseline.png")
- diffBmp.save(AVGTestCase.getImageResultDir() + "/" + fileName
- + "_diff.png")
- if (average > 2 or stdDev > 6):
- msg = (" "+fileName+
- ": Difference image has avg=%(avg).2f, std dev=%(stddev).2f"%
- {'avg':average, 'stddev':stdDev})
- if warn:
- print msg
- else:
- self.fail(msg)
+ baselineBmp = avg.Bitmap(AVGTestCase.baselineImageResultDirectory + "/"
+ + fileName + ".png")
except RuntimeError:
bmp.save(AVGTestCase.getImageResultDir()+"/"+fileName+".png")
- self.__logger.trace(self.__logger.WARNING,
- "Could not load image "+fileName+".png")
+ self.__logger.warning("Could not load image "+fileName+".png")
raise
+ diffBmp = bmp.subtract(baselineBmp)
+ average = diffBmp.getAvg()
+ stdDev = diffBmp.getStdDev()
+ if (average > 0.1 or stdDev > 0.5):
+ if self._isCurrentDirWriteable():
+ bmp.save(AVGTestCase.getImageResultDir() + "/" + fileName + ".png")
+ baselineBmp.save(AVGTestCase.getImageResultDir() + "/" + fileName
+ + "_baseline.png")
+ diffBmp.save(AVGTestCase.getImageResultDir() + "/" + fileName
+ + "_diff.png")
+ if (average > 2 or stdDev > 6):
+ msg = (" "+fileName+
+ ": Difference image has avg=%(avg).2f, std dev=%(stddev).2f"%
+ {'avg':average, 'stddev':stdDev})
+ if self.__warnOnImageDiff:
+ sys.stderr.write("\n"+msg+"\n")
+ else:
+ self.fail(msg)
def areSimilarBmps(self, bmp1, bmp2, maxAvg, maxStdDev):
diffBmp = bmp1.subtract(bmp2)
@@ -164,16 +173,19 @@ class AVGTestCase(unittest.TestCase):
code()
except:
exceptionRaised = True
+
self.assert_(exceptionRaised)
- def assertAlmostEqual(self, a, b, epsilon=0.000001):
+ def assertAlmostEqual(self, a, b, epsilon=0.00001):
if not(almostEqual(a, b, epsilon)):
msg = "almostEqual: " + str(a) + " != " + str(b)
self.fail(msg)
def loadEmptyScene(self, resolution=(160,120)):
- self.__player.createMainCanvas(size=resolution)
- return self.__player.getRootNode()
+ player.createMainCanvas(size=resolution)
+ root = player.getRootNode()
+ root.mediadir = "media"
+ return root
def initDefaultImageScene(self):
root = self.loadEmptyScene()
@@ -184,58 +196,62 @@ class AVGTestCase(unittest.TestCase):
avg.ImageNode(id="test1", pos=(129,30), href="rgb24-65x65.png", parent=root)
def fakeClick(self, x, y):
- helper = self.__player.getTestHelper()
- helper.fakeMouseEvent(avg.CURSORDOWN, True, False, False, x, y, 1)
- helper.fakeMouseEvent(avg.CURSORUP, False, False, False, x, y, 1)
+ helper = player.getTestHelper()
+ helper.fakeMouseEvent(avg.Event.CURSOR_DOWN, True, False, False, x, y, 1)
+ helper.fakeMouseEvent(avg.Event.CURSOR_UP, False, False, False, x, y, 1)
def skip(self, message):
+ self.__skipReason = str(message)
sys.stderr.write("skipping: " + str(message) + " ... ")
self.__skipped = True
def skipped(self):
return self.__skipped
- def _sendMouseEvent(self, type, x, y):
- helper = self.__player.getTestHelper()
- if type == avg.CURSORUP:
- button = False
- else:
- button = True
- helper.fakeMouseEvent(type, button, False, False, x, y, 1)
+ def skipReason(self):
+ return self.__skipReason
+
+ def skipIfMinimalShader(self):
+ if not(player.areFullShadersSupported()):
+ self.skip("Not supported if ShaderUsage == MINIMAL")
+ player.stop()
+ return
+
+ def _sendMouseEvent(self, type, x, y, btn=1):
+ if not self.__mouseEmulator:
+ self.__mouseEmulator = MouseEmulator()
+ self.__mouseEmulator.sendMouseEvent(type, x, y, btn)
def _sendTouchEvent(self, id, type, x, y):
- helper = self.__player.getTestHelper()
- helper.fakeTouchEvent(id, type, avg.TOUCH, avg.Point2D(x, y))
+ helper = player.getTestHelper()
+ helper.fakeTouchEvent(id, type, avg.Event.TOUCH, avg.Point2D(x, y))
def _sendTouchEvents(self, eventData):
- helper = self.__player.getTestHelper()
+ helper = player.getTestHelper()
for (id, type, x, y) in eventData:
- helper.fakeTouchEvent(id, type, avg.TOUCH, avg.Point2D(x, y))
+ helper.fakeTouchEvent(id, type, avg.Event.TOUCH, avg.Point2D(x, y))
+
+ def _genMouseEventFrames(self, type, x, y, expectedEvents):
+ return [
+ lambda: self._sendMouseEvent(type, x, y),
+ lambda: self.messageTester.assertState(expectedEvents),
+ ]
+ def _genTouchEventFrames(self, eventData, expectedEvents):
+ return [
+ lambda: self._sendTouchEvents(eventData),
+ lambda: self.messageTester.assertState(expectedEvents),
+ ]
def _isCurrentDirWriteable(self):
return bool(os.access('.', os.W_OK))
- def _hasShaderSupport(self):
- # XXX Duplicated code with FXTest.areFXSupported()
- def checkShaderSupport():
- global g_HasShaderSupport
- g_HasShaderSupport = self.__player.isUsingShaders()
-
- global g_HasShaderSupport
- if g_HasShaderSupport == None:
- self.loadEmptyScene()
- self.start([checkShaderSupport,])
- if not(g_HasShaderSupport):
- self.skip("no shader support")
- return g_HasShaderSupport
-
def __nextAction(self):
if not(self.__delaying):
if self.__dumpTestFrames:
- self.__logger.trace(self.__logger.APP, "Frame "+str(self.curFrame))
+ self.__logger.log("Frame "+str(self.curFrame))
if len(self.actions) == self.curFrame:
- self.__player.stop()
+ player.stop()
else:
action = self.actions[self.curFrame]
if action != None:
@@ -250,7 +266,7 @@ def createAVGTestSuite(availableTests, AVGTestCaseClass, testSubset):
if testName in availableTests:
testNames.append(testName)
else:
- print "no test named %s" % testName
+ sys.stderr.write(("No test named %s"%testName) + "\n")
sys.exit(1)
else:
testNames = availableTests
@@ -262,66 +278,74 @@ def createAVGTestSuite(availableTests, AVGTestCaseClass, testSubset):
return suite
-class NodeHandlerTester:
+class NodeHandlerTester(object):
def __init__(self, testCase, node):
- self.__testCase=testCase
+ self.__testCase = testCase
self.reset()
self.__node = node
+ self.__subscriberIDs = set()
self.setHandlers()
+ self.__messagesReceived = set()
- def assertState(self, down, up, over, out, move):
- self.__testCase.assert_(down == self.__downCalled)
- self.__testCase.assert_(up == self.__upCalled)
- self.__testCase.assert_(over == self.__overCalled)
- self.__testCase.assert_(out == self.__outCalled)
- self.__testCase.assert_(move == self.__moveCalled)
- self.__testCase.assert_(not(self.__touchDownCalled))
+ def assertState(self, expectedMessages):
+ self.__testCase.assert_(self.isState(expectedMessages))
self.reset()
+ def isState(self, expectedMessages):
+ expectedMessages = set(expectedMessages)
+ if expectedMessages != self.__messagesReceived:
+ sys.stderr.write("\nState expected: "+str(expectedMessages)+"\n")
+ sys.stderr.write("Actual state: "+str(self.__messagesReceived)+"\n")
+ return False
+ else:
+ return True
+
def reset(self):
- self.__upCalled=False
- self.__downCalled=False
- self.__overCalled=False
- self.__outCalled=False
- self.__moveCalled=False
- self.__touchDownCalled=False
+ self.__messagesReceived = set()
def setHandlers(self):
- self.__node.setEventHandler(avg.CURSORDOWN, avg.MOUSE, self.__onDown)
- self.__node.setEventHandler(avg.CURSORUP, avg.MOUSE, self.__onUp)
- self.__node.setEventHandler(avg.CURSOROVER, avg.MOUSE, self.__onOver)
- self.__node.setEventHandler(avg.CURSOROUT, avg.MOUSE, self.__onOut)
- self.__node.setEventHandler(avg.CURSORMOTION, avg.MOUSE, self.__onMove)
- self.__node.setEventHandler(avg.CURSORDOWN, avg.TOUCH, self.__onTouchDown)
+ messageIDs = [avg.Node.CURSOR_DOWN, avg.Node.CURSOR_UP, avg.Node.CURSOR_OVER,
+ avg.Node.CURSOR_OUT, avg.Node.CURSOR_MOTION]
+ for messageID in messageIDs:
+ subscriberID = self.__node.subscribe(messageID,
+ lambda event, messageID=messageID:
+ self.setMessageReceived(messageID, event))
+ self.__subscriberIDs.add(subscriberID)
def clearHandlers(self):
- self.__node.setEventHandler(avg.CURSORDOWN, avg.MOUSE, None)
- self.__node.setEventHandler(avg.CURSORUP, avg.MOUSE, None)
- self.__node.setEventHandler(avg.CURSOROVER, avg.MOUSE, None)
- self.__node.setEventHandler(avg.CURSOROUT, avg.MOUSE, None)
- self.__node.setEventHandler(avg.CURSORMOTION, avg.MOUSE, None)
- self.__node.setEventHandler(avg.CURSORDOWN, avg.TOUCH, None)
-
- def __onDown(self, Event):
- self.__testCase.assert_(Event.type == avg.CURSORDOWN)
- self.__downCalled = True
-
- def __onUp(self, Event):
- self.__testCase.assert_(Event.type == avg.CURSORUP)
- self.__upCalled = True
+ for subscriber in self.__subscriberIDs:
+ self.__node.unsubscribe(subscriber)
+ self.__subscriberIDs = set()
- def __onOver(self, Event):
- self.__testCase.assert_(Event.type == avg.CURSOROVER)
- self.__overCalled = True
+ def setMessageReceived(self, messageID, event):
+ self.__messagesReceived.add(messageID)
- def __onOut(self, Event):
- self.__testCase.assert_(Event.type == avg.CURSOROUT)
- self.__outCalled = True
-
- def __onMove(self, Event):
- self.__testCase.assert_(Event.type == avg.CURSORMOTION)
- self.__moveCalled = True
-
- def __onTouchDown(self, Event):
- self.__touchDownCalled = True
+
+class MessageTester(object):
+
+ def __init__(self, publisher, messageIDs, testCase=None):
+ for messageID in messageIDs:
+ publisher.subscribe(messageID,
+ lambda messageID=messageID: self.setMessageReceived(messageID))
+ self.__messagesReceived = set()
+ self.__testCase = testCase
+
+ def assertState(self, expectedMessages):
+ self.__testCase.assert_(self.isState(expectedMessages))
+ self.reset()
+
+ def isState(self, expectedMessages):
+ expectedMessages = set(expectedMessages)
+ if expectedMessages != self.__messagesReceived:
+ sys.stderr.write("\nState expected: "+str(expectedMessages)+"\n")
+ sys.stderr.write("Actual state: "+str(self.__messagesReceived)+"\n")
+ return False
+ else:
+ return True
+
+ def setMessageReceived(self, messageID):
+ self.__messagesReceived.add(messageID)
+
+ def reset(self):
+ self.__messagesReceived = set()
diff --git a/src/utils/Makefile.am b/src/utils/Makefile.am
index f9e96c7..7527ad7 100644
--- a/src/utils/Makefile.am
+++ b/src/utils/Makefile.am
@@ -1,5 +1,5 @@
-
bin_SCRIPTS = avg_audioplayer.py avg_chromakey.py avg_showcamera.py avg_showfile.py \
avg_showfont.py avg_videoinfo.py avg_videoplayer.py avg_checkvsync.py \
- avg_checktouch.py avg_showsvg.py
+ avg_checktouch.py avg_showsvg.py avg_checkspeed.py \
+ avg_checkpolygonspeed.py avg_jitterfilter.py
pkgpyexec_PYTHON = $(bin_SCRIPTS)
diff --git a/src/utils/Makefile.in b/src/utils/Makefile.in
index 09d062d..2196b9f 100644
--- a/src/utils/Makefile.in
+++ b/src/utils/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# Makefile.in generated by automake 1.11.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
-# Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -42,11 +42,12 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ac_cxx_namespaces.m4 \
$(top_srcdir)/m4/ac_path_generic.m4 \
$(top_srcdir)/m4/ax_boost_thread.m4 \
- $(top_srcdir)/m4/ax_check_gl.m4 $(top_srcdir)/m4/libtool.m4 \
- $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
- $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
- $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/m4/python_dev.m4 \
- $(top_srcdir)/configure.in
+ $(top_srcdir)/m4/ax_check_gl.m4 \
+ $(top_srcdir)/m4/ax_python_devel.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/pkg.m4 \
+ $(top_srcdir)/m4/avg_version.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
@@ -74,16 +75,23 @@ am__nobase_list = $(am__nobase_strip_setup); \
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(pkgpyexecdir)"
SCRIPTS = $(bin_SCRIPTS)
-AM_V_GEN = $(am__v_GEN_$(V))
-am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
-AM_V_at = $(am__v_at_$(V))
-am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
SOURCES =
DIST_SOURCES =
+am__py_compile = PYTHON=$(PYTHON) $(SHELL) $(py_compile)
py_compile = $(top_srcdir)/py-compile
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
@@ -95,7 +103,7 @@ AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BOOST_PYTHON_LIBS = @BOOST_PYTHON_LIBS@
-BOOST_THREAD_LIB = @BOOST_THREAD_LIB@
+BOOST_THREAD_LIBS = @BOOST_THREAD_LIBS@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
@@ -110,6 +118,7 @@ DC1394_2_CFLAGS = @DC1394_2_CFLAGS@
DC1394_2_LIBS = @DC1394_2_LIBS@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
@@ -150,6 +159,7 @@ LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
MTDEV_CFLAGS = @MTDEV_CFLAGS@
MTDEV_LIBS = @MTDEV_LIBS@
@@ -179,11 +189,13 @@ PTHREAD_CC = @PTHREAD_CC@
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
PTHREAD_LIBS = @PTHREAD_LIBS@
PYTHON = @PYTHON@
+PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@
PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
-PYTHON_INCLUDES = @PYTHON_INCLUDES@
-PYTHON_LIBS = @PYTHON_LIBS@
+PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@
+PYTHON_LDFLAGS = @PYTHON_LDFLAGS@
PYTHON_PLATFORM = @PYTHON_PLATFORM@
PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_SITE_PKG = @PYTHON_SITE_PKG@
PYTHON_VERSION = @PYTHON_VERSION@
RANLIB = @RANLIB@
SDL_CFLAGS = @SDL_CFLAGS@
@@ -206,6 +218,7 @@ abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
@@ -240,7 +253,6 @@ libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
@@ -266,7 +278,8 @@ top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
bin_SCRIPTS = avg_audioplayer.py avg_chromakey.py avg_showcamera.py avg_showfile.py \
avg_showfont.py avg_videoinfo.py avg_videoplayer.py avg_checkvsync.py \
- avg_checktouch.py avg_showsvg.py
+ avg_checktouch.py avg_showsvg.py avg_checkspeed.py \
+ avg_checkpolygonspeed.py avg_jitterfilter.py
pkgpyexec_PYTHON = $(bin_SCRIPTS)
all: all-am
@@ -333,9 +346,7 @@ uninstall-binSCRIPTS:
@list='$(bin_SCRIPTS)'; test -n "$(bindir)" || exit 0; \
files=`for p in $$list; do echo "$$p"; done | \
sed -e 's,.*/,,;$(transform)'`; \
- test -n "$$list" || exit 0; \
- echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
- cd "$(DESTDIR)$(bindir)" && rm -f $$files
+ dir='$(DESTDIR)$(bindir)'; $(am__uninstall_files_from_dir)
mostlyclean-libtool:
-rm -f *.lo
@@ -360,11 +371,8 @@ install-pkgpyexecPYTHON: $(pkgpyexec_PYTHON)
$(INSTALL_DATA) $$files "$(DESTDIR)$(pkgpyexecdir)" || exit $$?; \
done || exit $$?; \
if test -n "$$dlist"; then \
- if test -z "$(DESTDIR)"; then \
- PYTHON=$(PYTHON) $(py_compile) --basedir "$(pkgpyexecdir)" $$dlist; \
- else \
- PYTHON=$(PYTHON) $(py_compile) --destdir "$(DESTDIR)" --basedir "$(pkgpyexecdir)" $$dlist; \
- fi; \
+ $(am__py_compile) --destdir "$(DESTDIR)" \
+ --basedir "$(pkgpyexecdir)" $$dlist; \
else :; fi
uninstall-pkgpyexecPYTHON:
@@ -372,14 +380,14 @@ uninstall-pkgpyexecPYTHON:
@list='$(pkgpyexec_PYTHON)'; test -n "$(pkgpyexecdir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
test -n "$$files" || exit 0; \
+ dir='$(DESTDIR)$(pkgpyexecdir)'; \
filesc=`echo "$$files" | sed 's|$$|c|'`; \
fileso=`echo "$$files" | sed 's|$$|o|'`; \
- echo " ( cd '$(DESTDIR)$(pkgpyexecdir)' && rm -f" $$files ")"; \
- cd "$(DESTDIR)$(pkgpyexecdir)" && rm -f $$files || exit $$?; \
- echo " ( cd '$(DESTDIR)$(pkgpyexecdir)' && rm -f" $$filesc ")"; \
- cd "$(DESTDIR)$(pkgpyexecdir)" && rm -f $$filesc || exit $$?; \
- echo " ( cd '$(DESTDIR)$(pkgpyexecdir)' && rm -f" $$fileso ")"; \
- cd "$(DESTDIR)$(pkgpyexecdir)" && rm -f $$fileso
+ st=0; \
+ for files in "$$files" "$$filesc" "$$fileso"; do \
+ $(am__uninstall_files_from_dir) || st=$$?; \
+ done; \
+ exit $$st
tags: TAGS
TAGS:
@@ -434,10 +442,15 @@ install-am: all-am
installcheck: installcheck-am
install-strip:
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- `test -z '$(STRIP)' || \
- echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
mostlyclean-generic:
clean-generic:
diff --git a/src/utils/avg_audioplayer.py b/src/utils/avg_audioplayer.py
index 3f587a6..1355bbf 100755
--- a/src/utils/avg_audioplayer.py
+++ b/src/utils/avg_audioplayer.py
@@ -1,8 +1,8 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-#
+
# libavg - Media Playback Engine.
-# Copyright (C) 2003-2011 Ulrich von Zadow
+# 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
@@ -19,33 +19,31 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# Current versions can be found at www.libavg.de
-#
import sys
-from libavg import avg, AVGApp
-import time
+from libavg import avg, app, player
+
-g_Player = avg.Player.get()
+class AudioPlayerDiv(app.MainDiv):
+ def onArgvParserCreated(self, parser):
+ parser.set_usage("%prog <filename>")
-def onFrame():
- curTime = node.getCurTime()
- g_Player.getElementByID("curtime").text = "Time: "+str(curTime/1000.0)
+ def onArgvParsed(self, options, args, parser):
+ if len(args) != 1:
+ parser.print_help()
+ sys.exit(1)
+ self._audioFName = args[0]
-class AudioPlayer(AVGApp):
- def init(self):
- global node
- self._parentNode.appendChild(node)
- avg.WordsNode(parent=self._parentNode, id="curtime", pos=(10, 22),
- font="arial", fontsize=10)
+ def onInit(self):
+ self._node = avg.SoundNode(parent=self, href=self._audioFName)
+ self._node.play()
+ self._words = avg.WordsNode(parent=self, pos=(10, 22), fontsize=10)
- g_Player.setOnFrameHandler(onFrame)
-
+ def onFrame(self):
+ curTime = self._node.getCurTime()
+ self._words.text = "Time: "+str(curTime/1000.0)
-if len(sys.argv) ==1:
- print "Usage: avg_audioplayer.py <filename>"
- sys.exit(1)
-node = avg.SoundNode(href=sys.argv[1])
-node.play()
-AudioPlayer.start(resolution=(320,200))
+if __name__ == "__main__":
+ app.App().run(AudioPlayerDiv(), app_resolution="320x200")
diff --git a/src/utils/avg_checkpolygonspeed.py b/src/utils/avg_checkpolygonspeed.py
new file mode 100755
index 0000000..409d3a3
--- /dev/null
+++ b/src/utils/avg_checkpolygonspeed.py
@@ -0,0 +1,145 @@
+#!/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
+#
+# Original author of this file is Robert Parcus <betoparcus@gmail.com>
+
+from libavg import *
+
+import random
+import math
+import time
+
+R = 40.0
+g_Trigger = True
+
+
+class SpeedDiv(app.MainDiv):
+ def onArgvParserCreated(self, parser):
+ usage = '%prog [options]\n' \
+ 'Checks libavg performance by creating lots of polygon nodes. ' \
+ 'Displays a frame time graph and executes for 20 secs.'
+ parser.set_usage(usage)
+
+ parser.add_option('--hole-polygon', '-y', dest='hole',
+ action='store_true', default=False,
+ help='generate polygons with holes')
+ parser.add_option('--create-nodes', '-c', dest='create',
+ action='store_true', default=False,
+ help='destroy and recreate all nodes every 400 ms')
+ parser.add_option('--move', '-m', dest='move',
+ action='store_true', default=False,
+ help='move nodes every frame')
+ parser.add_option('--vsync', '-s', dest='vsync',
+ action='store_true', default=False,
+ help='sync output to vertical refresh')
+ parser.add_option('--num-objs', '-n', dest='numObjs',
+ type='int', default=40,
+ help='number of polygons to create [Default: 40]')
+ parser.add_option('--num-points', '-x', dest='numPoints',
+ type='int', default=10,
+ help='number of points in each polygon [Default: 10]')
+ parser.add_option('--profile', '-p', dest='profile',
+ action='store_true', default=False,
+ help='enable profiling output, note that profiling makes things slower')
+
+ def onArgvParsed(self, options, args, parser):
+ self.__optHole = options.hole
+ self.__optCreate = options.create
+ self.__optMove = options.move
+ self.__optVsync = options.vsync
+ self.__optNumObjs = options.numObjs
+ if self.__optNumObjs < 1:
+ self.__optNumObjs = 40
+ self.__optNumPoints = options.numPoints
+ if self.__optNumPoints < 10:
+ self.__optNumPoints = 10
+ elif self.__optNumPoints % 2 != 0:
+ self.__optNumPoints -= 1
+
+ log = avg.logger
+ log.configureCategory(log.Category.CONFIG, log.Severity.DBG)
+ if options.profile:
+ log.configureCategory(log.Category.PROFILE, log.Severity.DBG)
+
+ def onInit(self):
+ if not self.__optVsync:
+ player.setFramerate(1000)
+
+ tstart = time.time()
+ self.__createNodes()
+ print 'Time to create nodes: %f' % (time.time()-tstart)
+ app.instance.debugPanel.toggleWidget(app.debugpanel.FrametimeGraphWidget)
+ if self.__optCreate:
+ player.setInterval(400, self.__createNodes)
+ # Ignore the first frame for the 20 sec-limit so long startup times don't
+ # break things.
+ player.setTimeout(0, lambda: player.setTimeout(20000, player.stop))
+
+ def onFrame(self):
+ if self.__optMove:
+ self.__moveNodes()
+
+ def __createNodes(self):
+ self.__nodes = []
+ for i in xrange(self.__optNumObjs):
+ pos = (random.randrange(800-64), random.randrange(600-64))
+ polyPos = self.__calPolyCords(pos, R)
+ holes = []
+ if self.__optHole:
+ holes = (self.__calPolyCords(pos, R/2), )
+ node = avg.PolygonNode(parent=self, pos=polyPos, fillopacity=1, holes=holes)
+ self.__nodes.append(node)
+ if self.__optCreate:
+ player.setTimeout(300, self.__deleteNodes)
+
+ def __deleteNodes(self):
+ for node in self.__nodes:
+ node.unlink(True)
+ self.__nodes = []
+
+ def __moveNodes(self):
+ global g_Trigger
+ for node in self.__nodes:
+ newPos = []
+ if g_Trigger:
+ newPos = [(i[0]+1, i[1]+1) for i in node.pos]
+ else:
+ newPos = [(i[0]-1, i[1]-1) for i in node.pos]
+ node.pos = newPos
+ g_Trigger = not g_Trigger
+
+ def __calPolyCords(self, offset, r):
+ r2 = r/2
+ alpha = math.radians(360.0 / (self.__optNumPoints/2))
+ beta = alpha/2
+ result = []
+ for i in xrange(self.__optNumPoints/2):
+ result.append((r*math.cos(i*alpha) + offset[0],
+ r*math.sin(i*alpha) + offset[1]))
+ result.append((r2*math.cos(i*alpha+beta) + offset[0],
+ r2*math.sin(i*alpha+beta) + offset[1]))
+ return result
+
+
+if __name__ == '__main__':
+ app.App().run(SpeedDiv(), app_resolution='800x600')
+
diff --git a/src/utils/avg_checkspeed.py b/src/utils/avg_checkspeed.py
new file mode 100755
index 0000000..87619df
--- /dev/null
+++ b/src/utils/avg_checkspeed.py
@@ -0,0 +1,141 @@
+#!/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
+#
+# Original author of this file is Robert Parcus <betoparcus@gmail.com>
+
+from libavg import *
+
+import random
+
+
+class SpeedDiv(app.MainDiv):
+ def onArgvParserCreated(self, parser):
+ usage = '%prog [options]\n' \
+ 'Checks libavg performance by creating lots of nodes. ' \
+ 'Displays a frame time graph and executes for 20 secs.'
+ parser.set_usage(usage)
+
+ parser.add_option('--use-fx', '-f', dest='useFX',
+ action='store_true', default=False,
+ help='display everything using a NullFX to test FX overhead')
+ parser.add_option('--video', '-i', dest='video',
+ action='store_true', default=False,
+ help='show videos instead of images')
+ parser.add_option('--audio', '-a', dest='audio',
+ action='store_true', default=False,
+ help='when showing videos, use videos with an audio channel')
+ parser.add_option('--create-nodes', '-c', dest='create',
+ action='store_true', default=False,
+ help='destroy and recreate all nodes every 400 ms')
+ parser.add_option('--move', '-m', dest='move',
+ action='store_true', default=False,
+ help='move nodes every frame')
+ parser.add_option('--blur', '-b', dest='blur',
+ action='store_true', default=False,
+ help='apply a BlurFXNode to the nodes')
+ parser.add_option('--color', '-o', dest='color',
+ action='store_true', default=False,
+ help='apply gamma to the nodes, causing the color correction shader to activate')
+ parser.add_option('--vsync', '-s', dest='vsync',
+ action='store_true', default=False,
+ help='sync output to vertical refresh')
+ parser.add_option('--num-objs', '-n', dest='numObjs',
+ type='int', default=-1,
+ help='number of objects to create [Default: 200 images or 40 videos]')
+ parser.add_option('--profile', '-p', dest='profile',
+ action='store_true', default=False,
+ help='enable profiling output, note that profiling makes things slower')
+
+ def onArgvParsed(self, options, args, parser):
+ self.__optUseFX = options.useFX
+ self.__optVideo = options.video
+ self.__optAudio = options.audio
+ self.__optCreate = options.create
+ self.__optMove = options.move
+ self.__optBlur = options.blur
+ self.__optColor = options.color
+ self.__optVsync = options.vsync
+ self.__optNumObjs = options.numObjs
+ if self.__optNumObjs < 1:
+ if self.__optVideo:
+ self.__optNumObjs = 40
+ else:
+ self.__optNumObjs = 200
+
+ log = avg.logger
+ log.configureCategory(log.Category.CONFIG, log.Severity.DBG)
+ if options.profile:
+ log.configureCategory(log.Category.PROFILE, log.Severity.DBG)
+
+ def onInit(self):
+ if not self.__optVsync:
+ player.setFramerate(1000)
+
+ self.mediadir = utils.getMediaDir(None, 'data')
+ self.__createNodes()
+ app.instance.debugPanel.toggleWidget(app.debugpanel.FrametimeGraphWidget)
+ if self.__optCreate:
+ player.setInterval(400, self.__createNodes)
+ # Ignore the first frame for the 20 sec-limit so long startup times don't
+ # break things.
+ player.setTimeout(0, lambda: player.setTimeout(20000, player.stop))
+
+ def onFrame(self):
+ if self.__optMove:
+ self.__moveNodes()
+
+ def __createNodes(self):
+ self.__nodes = []
+ for i in xrange(self.__optNumObjs):
+ pos = (random.randrange(800-64), random.randrange(600-64))
+ if self.__optVideo:
+ if self.__optAudio:
+ fname = "mpeg1-48x48-sound.avi"
+ else:
+ fname = "mpeg1-48x48.mov"
+ node = avg.VideoNode(pos=pos, href=fname, loop=True, parent=self)
+ node.play()
+ else:
+ node = avg.ImageNode(pos=pos, href="rgb24alpha-64x64.png", parent=self)
+ if self.__optUseFX:
+ node.setEffect(avg.NullFXNode())
+ if self.__optBlur:
+ node.setEffect(avg.BlurFXNode(10))
+ if self.__optColor:
+ node.gamma = (1.1, 1.1, 1.1)
+ self.__nodes.append(node)
+ if self.__optCreate:
+ player.setTimeout(300, self.__deleteNodes)
+
+ def __deleteNodes(self):
+ for node in self.__nodes:
+ node.unlink(True)
+ self.__nodes = []
+
+ def __moveNodes(self):
+ for node in self.__nodes:
+ node.pos = (random.randrange(800-64), random.randrange(600-64))
+
+
+if __name__ == '__main__':
+ app.App().run(SpeedDiv(), app_resolution='800x600')
+
diff --git a/src/utils/avg_checktouch.py b/src/utils/avg_checktouch.py
index 35b40da..15c0ccd 100755
--- a/src/utils/avg_checktouch.py
+++ b/src/utils/avg_checktouch.py
@@ -1,7 +1,8 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
+
# libavg - Media Playback Engine.
-# Copyright (C) 2003-2011 Ulrich von Zadow
+# 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
@@ -18,27 +19,27 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# Current versions can be found at www.libavg.de
-#
from libavg import *
-g_player = avg.Player.get()
-class TouchApp(AVGApp):
- multitouch = True
+class TouchApp(app.MainDiv):
+ def onArgvParsed(self, options, args, parser):
+ if self.settings.getBoolean("app_fullscreen"):
+ self.settings.set("app_resolution", "") # use screen resolution
+
+ def onInit(self):
+ self.subscribe(avg.Node.CURSOR_DOWN, self.__onDown)
+ app.instance.debugPanel.toggleTouchVisualization()
- def init(self):
- self._parentNode.connectEventHandler(avg.CURSORDOWN, avg.MOUSE|avg.TOUCH, self,
- self.__onDown)
- self.getStarter().setTouchVisualization(apphelpers.TouchVisualization)
-
def __onDown(self, event):
# if event.source == avg.MOUSE:
# print event.type, event.button
# else:
# print event.type
if (event.contact):
- event.contact.connectListener(self.__onContact, self.__onContact)
+ event.contact.subscribe(avg.Contact.CURSOR_MOTION, self.__onContact)
+ event.contact.subscribe(avg.Contact.CURSOR_UP, self.__onContact)
contact = event.contact
# print "new contact: ", contact.id, event.pos, contact.age, \
# contact.distancefromstart, contact.motionangle, contact.motionvec, \
@@ -50,5 +51,7 @@ class TouchApp(AVGApp):
# contact.distancefromstart, contact.motionangle, contact.motionvec, \
# contact.distancetravelled, event.speed
-TouchApp.start(resolution=(1280,800))
+
+if __name__ == "__main__":
+ app.App().run(TouchApp(), app_resolution="800x600", multitouch_enabled="true")
diff --git a/src/utils/avg_checkvsync.py b/src/utils/avg_checkvsync.py
index 576c59a..5dc89ce 100755
--- a/src/utils/avg_checkvsync.py
+++ b/src/utils/avg_checkvsync.py
@@ -1,7 +1,8 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
+
# libavg - Media Playback Engine.
-# Copyright (C) 2003-2011 Ulrich von Zadow
+# 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
@@ -20,25 +21,24 @@
# Current versions can be found at www.libavg.de
#
# Original author of this file is Robert Parcus <betoparcus@gmail.com>
-#
-from libavg import *
-g_Player = avg.Player.get()
+from libavg import avg, app
+
-class VSyncApp(AVGApp):
-
- def init(self):
- self.__line = avg.LineNode(pos1=(0,0), pos2=(0,1199), color="FFFFFF",
- parent=self._parentNode)
+class VSyncDiv(app.MainDiv):
+ def onInit(self):
+ self.__line = avg.LineNode(color='FFFFFF', parent=self)
self.__x = 0
- g_Player.setOnFrameHandler(self.onFrame)
def onFrame(self):
self.__x += 1
- if self.__x == 800:
+ if self.__x == self.width:
self.__x = 0
self.__line.pos1 = (self.__x, 0)
- self.__line.pos2 = (self.__x, 599)
-
-VSyncApp.start(resolution=(800,600))
+ self.__line.pos2 = (self.__x, self.height)
+
+
+if __name__ == '__main__':
+ app.App().run(VSyncDiv(), app_resolution='800x600')
+
diff --git a/src/utils/avg_chromakey.py b/src/utils/avg_chromakey.py
index 7676c58..f572488 100755
--- a/src/utils/avg_chromakey.py
+++ b/src/utils/avg_chromakey.py
@@ -1,8 +1,8 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-#
+
# libavg - Media Playback Engine.
-# Copyright (C) 2003-2011 Ulrich von Zadow
+# 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
@@ -19,140 +19,81 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# Current versions can be found at www.libavg.de
-#
-import optparse
-from libavg import avg, AVGApp
-from libavg.ui import button
+from libavg import avg, app, widget
from libavg import parsecamargs
-GUI_SIZE=(300, 200)
-
-g_Player = avg.Player.get()
-
-class Slider(avg.DivNode):
- def __init__(self, width, min, max, onChange, **kwargs):
- avg.DivNode.__init__(self, **kwargs)
- self.__onChange = onChange
- self.size = (width, 20)
- self.__min = min
- self.__max = max
- self.__val = min
- avg.LineNode(pos1=(7,14), pos2=(width-7,14), color="FFFFFF", strokewidth=2,
- parent=self)
- self.__slider = avg.DivNode(pos=(0,0), size=(14,20), parent=self)
- avg.PolygonNode(pos=((1,0), (13,0), (7,18)), fillopacity=1, fillcolor="FFFFFF",
- color="808080", parent=self.__slider)
- self.__slider.setEventHandler(avg.CURSORDOWN, avg.MOUSE,
- self.__onSliderDown)
- self.setEventHandler(avg.CURSORDOWN, avg.MOUSE, self.__onBarDown)
- self.__isDragging = False
-
- def getVal(self):
- return self.__val
-
- def setVal(self, val):
- self.__val = val
- self.__positionSlider()
-
- val = property(getVal, setVal)
-
- def __onSliderDown(self, event):
- self.__slider.setEventCapture()
- self.__slider.setEventHandler(avg.CURSORMOTION, avg.MOUSE, self.__onSliderMove)
- self.__slider.setEventHandler(avg.CURSORUP, avg.MOUSE, self.__onSliderUp)
- self.__sliderDownPos = event.pos
- self.__isDragging = True
- self.__dragStartVal = self.__val
-
- def __onSliderMove(self, event):
- numPixelsMoved = float(event.pos.x-self.__sliderDownPos.x)
- self.__val = (self.__dragStartVal+numPixelsMoved/(self.size.x-14)
- *(self.__max-self.__min))
- self.__positionSlider()
-
- def __onSliderUp(self, event):
- self.__onSliderMove(event)
- self.__slider.releaseEventCapture()
- self.__slider.setEventHandler(avg.CURSORMOTION, avg.MOUSE, None)
- self.__slider.setEventHandler(avg.CURSORUP, avg.MOUSE, None)
- self.__isDragging = False
-
- def __onBarDown(self, event):
- if not(self.__isDragging):
- localPos = self.getRelPos(event.pos)
- ratio = (localPos.x-7)/(self.size.x-14)
- self.__val = self.__min+ratio*(self.__max-self.__min)
- print localPos, ", ", ratio, ", ", self.__val
- self.__positionSlider()
-
- def __positionSlider(self):
- if self.__val < self.__min:
- self.__val = self.__min
- elif self.__val > self.__max:
- self.__val = self.__max
- ratio = ((self.__val-self.__min)/(self.__max-self.__min))
- self.__slider.pos = (ratio*(self.size.x-14), 0)
- self.__onChange()
+GUI_SIZE=(300, 526)
class FXSlider(avg.DivNode):
- def __init__(self, row, min, max, fxNode, fxAttrName, caption, isInt, **kwargs):
- avg.DivNode.__init__(self, **kwargs)
- avg.RectNode(pos=(0,8), size=(280,38), color="808080", strokewidth=2,
- parent=self)
+ def __init__(self, row, min, max, fxNode, fxAttrName, caption, isInt, parent=None,
+ **kwargs):
+ super(FXSlider, self).__init__(**kwargs)
+ if parent:
+ parent.appendChild(self)
+ avg.RectNode(pos=(0,8), size=(280,38), color="808080", strokewidth=2, parent=self)
textBgRect = avg.RectNode(pos=(8,2), fillcolor="000000", fillopacity=1,
strokewidth=0, parent=self)
caption = avg.WordsNode(pos=(10,0), text=caption, parent=self)
- textBgRect.size = caption.getMediaSize()+(4, 2)
+ textBgRect.size = caption.getMediaSize() + (4,2)
self.__words = avg.WordsNode(pos=(240,23), parent=self)
- self.__slider = Slider(220, min, max, self.__onSliderMove, pos=(15,20),
- parent=self)
+ self.__slider = widget.Slider(width=220, range=(min,max), pos=(15,20), parent=self)
+ self.__slider.subscribe(self.__slider.THUMB_POS_CHANGED, self.__onSliderMove)
self.pos = (0, row*46)
self.__fxNode = fxNode
self.__fxAttrName = fxAttrName
self.__caption = caption
self.__isInt = isInt
- self.__slider.val = getattr(self.__fxNode, fxAttrName)
+ self.__slider.thumbPos = getattr(self.__fxNode, fxAttrName)
+ self.__onSliderMove(self.__slider.thumbPos)
- def __onSliderMove(self):
+ def __onSliderMove(self, thumbPos):
if self.__isInt:
- setattr(self.__fxNode, self.__fxAttrName, int(self.__slider.val))
- self.__words.text = "%i"%self.__slider.val
+ setattr(self.__fxNode, self.__fxAttrName, int(thumbPos))
+ self.__words.text = "%i"%thumbPos
else:
- setattr(self.__fxNode, self.__fxAttrName, self.__slider.val)
- self.__words.text = "%.2f"%self.__slider.val
-
-
-class TextButton(button.Button):
- def __init__(self, text, **kwargs):
- size = kwargs["size"]
- upNode = avg.DivNode()
- avg.RectNode(size=size, fillcolor="FFFFFF", fillopacity=1, color="FFFFFF",
- parent=upNode)
- avg.WordsNode(pos=(4,3), text=text, color="000000", parent=upNode)
- downNode = avg.DivNode()
- avg.RectNode(size=size, fillcolor="000000", fillopacity=1, color="FFFFFF",
- parent=downNode)
- avg.WordsNode(pos=(4,3), text=text, color="FFFFFF", parent=downNode)
- kwargs["upNode"] = upNode
- kwargs["downNode"] = downNode
- button.Button.__init__(self, **kwargs)
+ setattr(self.__fxNode, self.__fxAttrName, thumbPos)
+ self.__words.text = "%.2f"%thumbPos
def colorToString(colorTuple):
s = "%02X%02X%02X"%colorTuple[:-1]
return s
-class Chromakey(AVGApp):
- def init(self):
- avg.RectNode(size=(options.width,options.height), fillcolor="FF0000",
- fillopacity=1, strokewidth=0, parent=self._parentNode)
- self.__camNode = avg.CameraNode(driver=options.driver, device=options.device,
- unit=options.unit, fw800=options.fw800,
- capturewidth=options.width, captureheight=options.height,
- pixelformat=options.pixelFormat, framerate=options.framerate,
- width=options.width, height=options.height, parent=self._parentNode)
+
+class Chromakey(app.MainDiv):
+ def onArgvParserCreated(self, parser):
+ parser.set_usage(usage)
+ parsecamargs.addOptions(parser)
+
+ def onArgvParsed(self, options, args, parser):
+ if options.driver is None:
+ parser.print_help()
+ print
+ print "ERROR: at least '--driver' must be specified"
+ exit(1)
+
+ self.__optWidth = options.width
+ self.__optHeight = options.height
+ self.__optsCam = {
+ "driver": options.driver,
+ "device": options.device,
+ "unit": options.unit,
+ "fw800": options.fw800,
+ "pixelformat": options.pixelFormat,
+ "framerate": options.framerate}
+
+ self.settings.set("app_resolution", "%dx%d"
+ %(GUI_SIZE[0]+options.width, max(GUI_SIZE[1], options.height)))
+
+ def onInit(self):
+ avg.RectNode(size=(self.__optWidth,self.__optHeight), fillcolor="FF0000",
+ fillopacity=1, strokewidth=0, parent=self)
+ self.__camNode = avg.CameraNode(
+ capturewidth=self.__optWidth, captureheight=self.__optHeight,
+ width=self.__optWidth, height=self.__optHeight, parent=self,
+ **self.__optsCam)
self.__camNode.play()
self.__filter = avg.ChromaKeyFXNode()
self.__camNode.setEffect(self.__filter)
@@ -165,15 +106,14 @@ class Chromakey(AVGApp):
self.__createGUI()
def __createGUI(self):
- self.__guiDiv = avg.DivNode(pos=(options.width+10,10), parent=self._parentNode)
+ self.__guiDiv = avg.DivNode(pos=(self.__optWidth+10,10), parent=self)
self.__colorWords = avg.WordsNode(pos=(0,14), parent=self.__guiDiv)
self.__colorWords.text = "Key Color: "+self.__filter.color
self.__colorRect = avg.RectNode(pos=(200,12), size=(20, 20),
fillcolor=self.__filter.color, fillopacity=1,
color="FFFFFF", parent=self.__guiDiv)
- self.__camNode.setEventHandler(avg.CURSORDOWN, avg.MOUSE,
- self.__onColorDown)
+ self.__camNode.subscribe(avg.Node.CURSOR_DOWN, self.__onColorDown)
FXSlider(1, 0.0, 1.0, self.__filter, "htolerance", "Hue Tolerance",
False, parent=self.__guiDiv)
@@ -188,17 +128,18 @@ class Chromakey(AVGApp):
FXSlider(6, 0.0, 1.0, self.__filter, "spillthreshold", "Spill Suppression",
False, parent=self.__guiDiv)
- TextButton(pos=(0,332), text="Whitebalance", size=(100,22),
- clickHandler=self.__onWhitebalance, parent=self.__guiDiv)
- TextButton(pos=(110,332), text="Dump Config", size=(100,22),
- clickHandler=self.__dumpConfig, parent=self.__guiDiv)
+ button = widget.TextButton(pos=(0,332), text="Whitebalance", size=(100,22),
+ parent=self.__guiDiv)
+ button.subscribe(button.CLICKED, self.__onWhitebalance)
+ button = widget.TextButton(pos=(110,332), text="Dump Config", size=(100,22),
+ parent=self.__guiDiv)
+ button.subscribe(button.CLICKED, self.__dumpConfig)
FXSlider(9, 0, 500, self.__camNode, "shutter", "Shutter",
True, parent=self.__guiDiv)
FXSlider(10, 128, 1023, self.__camNode, "gain", "Gain",
True, parent=self.__guiDiv)
-
def __onColorDown(self, event):
pos = self.__camNode.getRelPos(event.pos)
bmp = self.__camNode.getBitmap()
@@ -208,12 +149,12 @@ class Chromakey(AVGApp):
self.__colorWords.text = "Key Color: "+colorString
self.__colorRect.fillcolor = colorString
- def __onWhitebalance(self, event):
+ def __onWhitebalance(self):
self.__camNode.setWhitebalance(
self.__camNode.getWhitebalanceU(), self.__camNode.getWhitebalanceV())
self.__camNode.doOneShotWhitebalance()
- def __dumpConfig(self, event):
+ def __dumpConfig(self):
print "Camera:"
print " device=", self.__camNode.device
print " shutter=", self.__camNode.shutter
@@ -230,17 +171,19 @@ class Chromakey(AVGApp):
print " erosion=", self.__filter.erosion
print " spillthreshold=", self.__filter.spillthreshold
-parser = optparse.OptionParser()
-parsecamargs.addOptions(parser)
-(options, args) = parser.parse_args()
-if options.driver is None:
- parser.print_help()
- print
- print "ERROR: at least '--driver' must be specified"
- exit()
+usage = """%prog [options]
+
+avg_chromakey.py is a configuration utility for the libavg chromakey filter.
+The chromakey filter allows implementation of green- or bluescreens with
+libavg.
+
+This utility shows a camera image with chromakey applied to it and allows the
+user to adjust the camera and filter parameters. The parameters can be dumped
+to the console for easy inclusion in libavg scripts.
+"""
-resolution=(GUI_SIZE[0]+options.width, max(GUI_SIZE[1],options.height))
-Chromakey.start(resolution=resolution)
+if __name__ == "__main__":
+ app.App().run(Chromakey())
diff --git a/src/utils/avg_jitterfilter.py b/src/utils/avg_jitterfilter.py
new file mode 100755
index 0000000..6b0f2cb
--- /dev/null
+++ b/src/utils/avg_jitterfilter.py
@@ -0,0 +1,111 @@
+#!/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
+
+from libavg import avg, app, player, filter, widget
+
+
+class LabledSlider(avg.DivNode):
+ def __init__(self, label, range, formatStr, parent=None, **kwargs):
+ super(LabledSlider, self).__init__(**kwargs)
+ self.registerInstance(self, parent)
+ self.__formatStr = formatStr
+
+ fontStyle = widget.Skin.default.fonts["stdFont"]
+ avg.WordsNode(text=label, fontstyle=fontStyle, color="FFFFFF", parent=self)
+ self.__slider = widget.Slider(width=300, range=range, pos=(15,20), parent=self)
+ self.__slider.subscribe(self.__slider.THUMB_POS_CHANGED, self.__onSliderMove)
+ self.__valueDisplay = avg.WordsNode(pos=(320, 18), fontstyle=fontStyle,
+ color="FFFFFF", parent=self)
+ self.__valueDisplay.text = self.__formatStr%self.__slider.thumbPos
+
+ self.publish(widget.Slider.THUMB_POS_CHANGED)
+
+ def getThumbPos(self):
+ return self.__slider.thumbPos
+ thumbPos = property(getThumbPos)
+
+ def __onSliderMove(self, thumbPos):
+ self.notifySubscribers(widget.Slider.THUMB_POS_CHANGED, [thumbPos,])
+ self.__valueDisplay.text = self.__formatStr%thumbPos
+
+
+class JitterFilter(app.MainDiv):
+ def onArgvParsed(self, options, args, parser):
+ if self.settings.getBoolean("app_fullscreen"):
+ self.settings.set("app_resolution", "") # use screen resolution
+
+ def onInit(self):
+ self.__minCutoffSlider = LabledSlider(label="Minimum Cutoff", range=(0.3, 8.0),
+ formatStr="%.1f", pos=(10,10), parent=self)
+ self.__minCutoffSlider.subscribe(widget.Slider.THUMB_POS_CHANGED,
+ self.__onSliderMove)
+ self.__cutoffSlopeSlider = LabledSlider(label="Cutoff Slope", range=(0.0, 0.05),
+ formatStr="%.3f", pos=(10,50), parent=self)
+ self.__minCutoffSlider.subscribe(widget.Slider.THUMB_POS_CHANGED,
+ self.__onSliderMove)
+ self.__onSliderMove(avg.Point2D(0,0))
+
+ self.subscribe(avg.Node.CURSOR_DOWN, self.__onDown)
+ self.__contact = None
+ self.__rawContactCircle = avg.CircleNode(r=7*player.getPixelsPerMM(),
+ color="FF0000", opacity=0, parent=self)
+ self.__filteredContactCircle = avg.CircleNode(r=7*player.getPixelsPerMM(),
+ color="00FF00", opacity=0, parent=self)
+ self.__filters = None
+
+ def __onSliderMove(self, pos):
+ self.__minCutoff = self.__minCutoffSlider.thumbPos
+ self.__cutoffSlope = self.__cutoffSlopeSlider.thumbPos
+
+ def __onDown(self, event):
+ if self.__contact is None:
+ self.__contact = event.contact
+ event.contact.subscribe(avg.Contact.CURSOR_UP, self.__onUp)
+ self.__rawContactCircle.opacity = 1
+ self.__filteredContactCircle.opacity = 1
+ self.__filters = [
+ filter.OneEuroFilter(self.__minCutoff,self.__cutoffSlope),
+ filter.OneEuroFilter(self.__minCutoff,self.__cutoffSlope)]
+ self.__onFrame = player.subscribe(player.ON_FRAME, self.__moveContact)
+
+ def __onUp(self, event):
+ self.__rawContactCircle.opacity = 0
+ self.__filteredContactCircle.opacity = 0
+ self.__contact = None
+ self.__filters = None
+ player.unsubscribe(self.__onFrame)
+
+ def __moveContact(self):
+ time = player.getFrameTime()
+ rawPos = self.__contact.events[-1].pos
+ self.__rawContactCircle.pos = rawPos
+ filteredPos = avg.Point2D(self.__filters[0].apply(rawPos.x, time),
+ self.__filters[1].apply(rawPos.y, time))
+ self.__filteredContactCircle.pos = filteredPos
+
+
+if __name__ == "__main__":
+ app.App().run(JitterFilter(),
+ app_resolution="800x600",
+ app_show_cursor="true",
+ multitouch_enabled="true")
+
diff --git a/src/utils/avg_showcamera.py b/src/utils/avg_showcamera.py
index 817d80d..4c2cc18 100755
--- a/src/utils/avg_showcamera.py
+++ b/src/utils/avg_showcamera.py
@@ -1,8 +1,8 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-#
+
# libavg - Media Playback Engine.
-# Copyright (C) 2003-2011 Ulrich von Zadow
+# 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
@@ -19,147 +19,183 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# Current versions can be found at www.libavg.de
-#
-import optparse
import time
-from libavg import avg
+from libavg import avg, player
from libavg import parsecamargs
-
-def checkCamera():
- if not(camNode.isAvailable()):
- Log.trace(Log.APP, "Could not open camera")
- exit(1)
-
-
-def onKey(event):
- def addWhitebalance(du = 0, dv = 0):
- camNode.setWhitebalance(camNode.getWhitebalanceU() + du,
- camNode.getWhitebalanceV() + dv)
- print "u:", camNode.getWhitebalanceU(), "v:", camNode.getWhitebalanceV()
-
- def addGain(gain):
- camNode.gain += gain
- print "gain:", camNode.gain
-
- def addShutter(shutter):
- camNode.shutter += shutter
- print "shutter:", camNode.shutter
-
- if event.keystring == "w":
- print "Setting Whitebalance"
- camNode.doOneShotWhitebalance()
-
- elif event.keystring == "1":
- addWhitebalance(du = -1)
-
- elif event.keystring == "2":
- addWhitebalance(du = 1)
-
- elif event.keystring == "3":
- addWhitebalance(dv = -1)
-
- elif event.keystring == "4":
- addWhitebalance(dv = 1)
+from libavg import app
+
+usage = """%prog [options]
+
+avg_showcamera.py shows the images captured by a camera attached to the
+system. Its main use is to find out which parameters - device names,
+image formats, framerates, etc. can be used with the camera(s)."""
+
+
+class ShowCamera(app.MainDiv):
+ def onArgvParserCreated(self, parser):
+ parser.set_usage(usage)
+ parsecamargs.addOptions(parser)
+ parser.add_option("-l", "--list", dest="list",
+ action="store_true", default=False,
+ help="lists informations about detected cameras")
+ parser.add_option("-s", "--noinfo", dest="noinfo",
+ action="store_true", default=False,
+ help="don't show any info overlayed on the screen")
+ parser.add_option("-r", "--resetbus", dest="resetbus",
+ action="store_true", default=False,
+ help="reset the firewire bus")
+
+ def onArgvParsed(self, options, args, parser):
+ if options.list:
+ infoList = list()
+ infoList = avg.CameraNode.getCamerasInfos()
+ if (len(infoList) <= 0):
+ print "No camera available!"
+ for info in infoList:
+ print ""
+ print "##################",info.driver,"##################"
+ print "Device ID:", info.deviceID
+ print ""
+ print "----------------- FORMATS ------------------"
+ formatsList = list()
+ formatsList = info.imageFormats
+ for format in formatsList:
+ print "++++"
+ print "Pixelformat:", format.pixelFormat
+ print "Resolution:", format.size
+ print "Framerates: |",
+ framerateList = list()
+ framerateList = format.framerates
+ for framerate in framerateList:
+ print framerate, "|",
+ print ""
+ print ""
+ print "----------------- CONTROLS -----------------"
+ controlsList = list()
+ controlsList = info.controls
+ for control in controlsList:
+ print "++++", control.controlName
+ print "Min:" , control.min, "| Max:", control.max,
+ print "| Default:", control.default
+ print ""
+ exit(0)
+
+ if options.resetbus:
+ avg.logger.info("Resetting firewire bus.")
+ avg.CameraNode.resetFirewireBus()
+ time.sleep(1)
+ if not options.driver:
+ exit(0)
+
+ if options.driver is None and not options.list and not options.resetbus:
+ parser.print_help()
+ print
+ print "ERROR: at least '--driver', '--list' or '--resetbus' options " \
+ "must be specified"
+ exit(1)
+
+ self.optdict = {}
+ for attr in dir(options):
+ if attr[0] != '_':
+ self.optdict[attr] = eval("options.%s" %attr)
+
+ self.settings.set("app_resolution", "%dx%d" %(options.width, options.height))
+
+ def onInit(self):
+ self.curFrame = 0
+
+ avg.logger.info("Creating camera:")
+ avg.logger.info("driver=%(driver)s device=%(device)s" %self.optdict)
+ avg.logger.info(
+ "width=%(width)d height=%(height)d pixelformat=%(pixelFormat)s"
+ %self.optdict)
+ avg.logger.info("unit=%(unit)d framerate=%(framerate)d fw800=%(fw800)s"
+ %self.optdict)
+
+ self.camNode = avg.CameraNode(driver=self.optdict["driver"],
+ device=self.optdict["device"], unit=self.optdict["unit"],
+ fw800=self.optdict["fw800"], framerate=self.optdict["framerate"],
+ capturewidth=self.optdict["width"], captureheight=self.optdict["height"],
+ pixelformat=self.optdict["pixelFormat"], parent=self)
+
+ if not self.optdict["noinfo"]:
+ self.infoText = ("Driver=%(driver)s (dev=%(device)s unit=%(unit)d) "
+ "%(width)dx%(height)d@%(framerate)f" %self.optdict)
+ avg.WordsNode(text=self.infoText, color="ff3333", pos=(5,5), fontsize=14,
+ rawtextmode=True, parent=self)
+ self.frameText = avg.WordsNode(color="ff3333", pos=(5,25), fontsize=14,
+ parent=self)
+ else:
+ self.frameText = None
+
+ self.setupKeys()
+
+ self.camNode.play()
+ player.setTimeout(100, self.checkCamera)
+
+ def onFrame(self):
+ if self.frameText:
+ self.curFrame += 1
+ self.frameText.text = "%(cam)d/%(app)d" \
+ %{"cam":self.camNode.framenum, "app":self.curFrame}
+
+ def checkCamera(self):
+ if not(self.camNode.isAvailable()):
+ avg.logger.error("Could not open camera")
+ exit(1)
+
+ def setupKeys(self):
+ def setWhitebalance():
+ print "Setting whitebalance"
+ self.camNode.doOneShotWhitebalance()
+
+ def addWhitebalance(du = 0, dv = 0):
+ self.camNode.setWhitebalance(self.camNode.getWhitebalanceU() + du,
+ self.camNode.getWhitebalanceV() + dv)
+ print ("u:", self.camNode.getWhitebalanceU(), "v:",
+ self.camNode.getWhitebalanceV())
- elif event.keystring == "s":
- print "Saving camera image to camimage.png"
- camNode.getBitmap().save("camimage.png")
-
- elif event.keystring == "left":
- addShutter(shutter = -1)
+ def addGain(gain):
+ self.camNode.gain += gain
+ print "gain:", self.camNode.gain
- elif event.keystring == "right":
- addShutter(shutter = 1)
-
- elif event.keystring == "up":
- addGain(gain = 1)
-
- elif event.keystring == "down":
- addGain(gain = -1)
-
-curFrame = 0
-
-def updateFrameDisplay(node):
- global curFrame
- curFrame += 1
- node.text = "%(cam)d/%(player)d"%{"cam":camNode.framenum, "player":curFrame}
-
-parser = optparse.OptionParser()
-parsecamargs.addOptions(parser)
-parser.add_option("-l", "--dump", dest="dump", action="store_true", default=False,
- help="dump a list of detected cameras")
-parser.add_option("-s", "--noinfo", dest="noinfo", action="store_true", default=False,
- help="don't show any info overlayed on the screen")
-parser.add_option("-r", "--resetbus", dest="resetbus", action="store_true", default=False,
- help="reset the firewire bus.")
-
-(options, args) = parser.parse_args()
-
-if options.driver is None and not options.dump and not options.resetbus:
- parser.print_help()
- print
- print "Keys available when image is being displayed:"
- print " w: Execute whitebalance."
- print " 1/2: Decrease/Increase whitebalance u."
- print " 3/4: Decrease/Increase whitebalance v."
- print " s: Take screenshot."
- print
- print "ERROR: at least '--driver', '--dump' or '--resetbus' options must be specified"
- exit()
-
-optdict = {}
-for attr in dir(options):
- if attr[0] != '_':
- optdict[attr] = eval("options.%s" %attr)
-
-Log = avg.Logger.get()
-
-Player = avg.Player.get()
-
-Player.loadString("""
-<?xml version="1.0"?>
-<!DOCTYPE avg SYSTEM "../../doc/avg.dtd">
-<avg width="%(width)d" height="%(height)d">
-</avg>
-""" %optdict)
-Player.getRootNode().setEventHandler(avg.KEYDOWN, avg.NONE, onKey)
-
-if options.dump:
- avg.CameraNode.dumpCameras()
- exit(0)
-
-if options.resetbus:
- Log.trace(Log.APP, "Resetting firewire bus.")
- avg.CameraNode.resetFirewireBus()
- time.sleep(1)
- if not options.driver:
- exit(0)
-
-Log.trace(Log.APP, "Creating camera:")
-Log.trace(Log.APP, "driver=%(driver)s device=%(device)s" %optdict)
-Log.trace(Log.APP, "width=%(width)d height=%(height)d pixelformat=%(pixelFormat)s"
- %optdict)
-Log.trace(Log.APP, "unit=%(unit)d framerate=%(framerate)d fw800=%(fw800)s" %optdict)
-
-camNode = Player.createNode("camera",
- {"driver": options.driver, "device": options.device, "unit": options.unit,
- "fw800": options.fw800,
- "capturewidth": options.width, "captureheight": options.height,
- "pixelformat": options.pixelFormat, "framerate": options.framerate,
- "width": options.width, "height": options.height})
-
-Player.getRootNode().appendChild(camNode)
-
-if not options.noinfo:
- infoText = "Driver=%(driver)s (dev=%(device)s unit=%(unit)d) %(width)dx%(height)d@%(framerate)f" %optdict
- avg.WordsNode(text=infoText, color="ff3333", pos=(5,5), fontsize=14,
- parent=Player.getRootNode())
- frameText = avg.WordsNode(color="ff3333", pos=(5,25), fontsize=14,
- parent=Player.getRootNode())
- Player.setOnFrameHandler(lambda:updateFrameDisplay(frameText))
-
-camNode.play()
-Player.setTimeout(100, checkCamera)
-Player.play()
+ def addShutter(shutter):
+ self.camNode.shutter += shutter
+ print "shutter:", self.camNode.shutter
+
+ app.keyboardmanager.bindKeyDown(keystring="w",
+ handler=setWhitebalance,
+ help="Execute whitebalance")
+
+ app.keyboardmanager.bindKeyDown(keystring="1",
+ handler=lambda: addWhitebalance(du = -1),
+ help="Decrease whitebalance u")
+ app.keyboardmanager.bindKeyDown(keystring="2",
+ handler=lambda: addWhitebalance(du = 1),
+ help="Increase whitebalance u")
+ app.keyboardmanager.bindKeyDown(keystring="3",
+ handler=lambda: addWhitebalance(dv = -1),
+ help="Decrease whitebalance v")
+ app.keyboardmanager.bindKeyDown(keystring="4",
+ handler=lambda: addWhitebalance(dv = 1),
+ help="Increase whitebalance v")
+
+ app.keyboardmanager.bindKeyDown(keystring="left",
+ handler=lambda: addShutter(shutter = -1),
+ help="Decrease shutter")
+ app.keyboardmanager.bindKeyDown(keystring="right",
+ handler=lambda: addShutter(shutter = 1),
+ help="Increase shutter")
+
+ app.keyboardmanager.bindKeyDown(keystring="up",
+ handler=lambda: addGain(gain = 1),
+ help="Increase gain")
+ app.keyboardmanager.bindKeyDown(keystring="down",
+ handler=lambda: addGain(gain = -1),
+ help="Decrease gain")
+
+
+if __name__ == "__main__":
+ app.App().run(ShowCamera())
diff --git a/src/utils/avg_showfile.py b/src/utils/avg_showfile.py
index 3890584..748037c 100755
--- a/src/utils/avg_showfile.py
+++ b/src/utils/avg_showfile.py
@@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
#
# libavg - Media Playback Engine.
-# Copyright (C) 2003-2011 Ulrich von Zadow
+# 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
@@ -22,19 +22,17 @@
#
import sys
-from libavg import avg
-import time
-
-Player = avg.Player.get()
+from libavg import player
if len(sys.argv) ==1:
print
+ print "avg_showfile.py displays the contents of an avg file."
+ print
print "Usage: avg_showfile.py <avgfile>"
print
sys.exit(1)
-Player.loadFile(sys.argv[1])
-Player.setVBlankFramerate(1)
-Player.play()
+player.loadFile(sys.argv[1])
+player.play()
diff --git a/src/utils/avg_showfont.py b/src/utils/avg_showfont.py
index 23bf9ac..fa4c562 100755
--- a/src/utils/avg_showfont.py
+++ b/src/utils/avg_showfont.py
@@ -1,8 +1,8 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-#
+
# libavg - Media Playback Engine.
-# Copyright (C) 2003-2011 Ulrich von Zadow
+# 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
@@ -19,56 +19,50 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# Current versions can be found at www.libavg.de
-#
-import sys
-from libavg import avg
-import time
+from libavg import avg, app
+
+
+class ShowFont(app.MainDiv):
+ def onArgvParserCreated(self, parser):
+ self._usage = 'Usage: %s [<fontname> [<text>]] [options]\n\n' \
+ ' Shows all available variants of a font.\n' \
+ ' If <text> is given, displays the text.\n' \
+ ' If <fontname> is not given, dumps a list of all fonts available.' \
+ %parser.get_prog_name()
+ parser.set_usage(self._usage)
+
+ def onArgvParsed(self, options, args, parser):
+ if len(args) == 0:
+ fontList = avg.WordsNode.getFontFamilies()
+ print 'Available fonts:'
+ print fontList
+ print
+ print self._usage
+ print ' Option -h or --help gives a full help.'
+ exit()
+
+ self._fontname = args[0]
+ if len(args) > 1:
+ self._displayText = args[1]
+ else:
+ self._displayText = None
+
+ def onInit(self):
+ variants = avg.WordsNode.getFontVariants(self._fontname)
+ print variants
-Player = avg.Player.get()
+ y = 10
+ for variant in variants:
+ if self._displayText:
+ text = self._displayText
+ else:
+ text = self._fontname + ": " + variant
+ avg.WordsNode(text=text, font=self._fontname, variant=variant, fontsize=24,
+ pos=(10, y), parent=self)
+ y += 50
-Player.loadString("""
-<?xml version="1.0"?>
-<!DOCTYPE avg SYSTEM "../../doc/avg.dtd">
-<avg width="640" height="480">
-</avg>
-""")
-if len(sys.argv) ==1:
- print "Available fonts: "
- fontList = avg.WordsNode.getFontFamilies()
- print fontList
- print
- print "Usage: showfont.py <fontname> [<text>]"
- print
- print " Shows all available variants of a font. If <text> is given, displays the"
- print " text. If <fontname> is not given, dumps a list of all fonts available."
- sys.exit(1)
-else:
- fontname=sys.argv[1]
- if len(sys.argv) > 2:
- displayText=sys.argv[2]
- else:
- displayText=""
-variants = avg.WordsNode.getFontVariants(fontname)
-print variants
-rootNode = Player.getRootNode()
-y = 10
-for variant in variants:
- if displayText == "":
- text = fontname+": "+variant
- else:
- text = displayText
- node = Player.createNode("words",
- { "text": text,
- "font": fontname,
- "variant": variant,
- "fontsize": 24,
- "x": 10,
- "y": y
- })
- rootNode.appendChild(node)
- y += 50
-Player.setVBlankFramerate(1)
-Player.play()
+if __name__ == '__main__':
+ app.App().run(ShowFont())
diff --git a/src/utils/avg_showsvg.py b/src/utils/avg_showsvg.py
index 0c16b27..915ae40 100755
--- a/src/utils/avg_showsvg.py
+++ b/src/utils/avg_showsvg.py
@@ -1,7 +1,8 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
+
# libavg - Media Playback Engine.
-# Copyright (C) 2003-2011 Ulrich von Zadow
+# 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
@@ -20,39 +21,43 @@
# Current versions can be found at www.libavg.de
#
-import optparse
import sys
-from libavg import avg, AVGApp
-
-g_player = avg.Player.get()
-g_log = avg.Logger.get()
-
-parser = optparse.OptionParser("Usage: %prog <svgFileName> <elementID> [options]")
-parser.add_option("-s", "--size", action="store", type="float", dest="size", default=1,
- help="Specify a factor for the size of the element.")
-parser.add_option("--save-image", action="store_true", dest="saveImage", default=False,
- help="Save the image rendered to a png file.")
-
-(options, args) = parser.parse_args()
-if len(args) < 2:
- parser.print_help()
- sys.exit(1)
-svgFName = args[0]
-svgID = args[1]
-
-class ShowSVG(AVGApp):
- def init(self):
- self.svg = avg.SVG(svgFName, True)
- img = self.svg.createImageNode(svgID, {"pos":(1,1), "parent":self._parentNode},
- options.size)
- rect = avg.RectNode(fillcolor="808080", color="FFFFFF", fillopacity=1,
+from libavg import avg, app
+
+
+class ShowSVG(app.MainDiv):
+ def onArgvParserCreated(self, parser):
+ parser.set_usage("%prog [options] <svgFileName> <elementID>")
+
+ parser.add_option("-s", "--size", dest="size",
+ type="float", default=1.0,
+ help="specify a factor for the size of the element [Default: 1.0]")
+ parser.add_option("--save-image", dest="saveImage",
+ action="store_true", default=False,
+ help="save the image rendered to a png file")
+
+ def onArgvParsed(self, options, args, parser):
+ if len(args) != 2:
+ parser.print_help()
+ sys.exit(1)
+ self._svgFName = args[0]
+ self._svgID = args[1]
+ self._size = options.size
+ self._saveImage = options.saveImage
+
+ def onInit(self):
+ self.svg = avg.SVG(self._svgFName, True)
+ img = self.svg.createImageNode(self._svgID, {"pos":(1,1), "parent":self},
+ self._size)
+ rect = avg.RectNode(fillcolor="808080", color="FFFFFF", fillopacity=1,
pos=(0.5, 0.5), size=img.size+(1,1))
- self._parentNode.insertChild(rect, 0)
- if options.saveImage:
- bmp = self.svg.renderElement(svgID, options.size)
- bmp.save(svgID+".png")
+ self.insertChild(rect, 0)
+ if self._saveImage:
+ bmp = self.svg.renderElement(self._svgID, self._size)
+ bmp.save(self._svgID+".png")
+
-if __name__ == '__main__':
- ShowSVG.start(resolution=(1024, 768))
+if __name__ == "__main__":
+ app.App().run(ShowSVG(), app_resolution="1024x768")
diff --git a/src/utils/avg_videoinfo.py b/src/utils/avg_videoinfo.py
index 41fb51d..1d7c41a 100755
--- a/src/utils/avg_videoinfo.py
+++ b/src/utils/avg_videoinfo.py
@@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
#
# libavg - Media Playback Engine.
-# Copyright (C) 2003-2011 Ulrich von Zadow
+# 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
@@ -21,199 +21,255 @@
# Current versions can be found at www.libavg.de
#
-from optparse import OptionParser, OptionValueError
-import sys, traceback
+from optparse import OptionParser
+import sys
from libavg import avg
-import time
from xml.dom import minidom
-from xml import dom
import os
-parser = OptionParser("usage: %prog <videofilename> [options]")
-parser.add_option("-x", "--xml", dest = "xml", action="store_true",
- help = "Set to enable output as xml")
-parser.add_option("-c", "--csv", dest = "csv", action="store_true",
- help = "Set to enable output as csv")
+parser = OptionParser(usage="%prog filename(s) [options]")
+parser.add_option("-x", "--xml", dest = "xml", action = "store_true",
+ help = "Output in XML format")
+parser.add_option("-c", "--csv", dest = "csv", action = "store_true",
+ help = "Output in csv format")
+parser.add_option("-r", "--recursion", dest = "recursion", action = "store_true",
+ help = "Recurse into subdirectories")
options, args = parser.parse_args()
-Player = avg.Player.get()
-
-Player.loadString("""
- <?xml version="1.0"?>
- <!DOCTYPE avg SYSTEM "../../doc/avg.dtd">
- <avg width="1280" height="720">
- <video id="video" x="0" y="0" threaded="true"/>
- </avg>
-""")
-node = Player.getElementByID("video")
-impl = minidom.getDOMImplementation()
-doc = impl.createDocument(None, "videodict", None)
-rootElement = doc.documentElement
-CSV_video = ''
-VideoList = []
-len_filename = 0
-
-def appendXMLChild(node):
- node.play()
- videoinfo = doc.createElement("videoinfo")
- videoinfo.setAttribute("file", node.href)
- videoinfo.setAttribute("duration", str(node.getDuration()/1000.))
- videoinfo.setAttribute("bitrate", str(node.getBitrate()))
- rootElement.appendChild(videoinfo)
- videoNode = doc.createElement("video")
- videoNode.setAttribute("codec", node.getVideoCodec())
- videoNode.setAttribute("size", str(node.getMediaSize()))
- videoNode.setAttribute("pixelformat", node.getStreamPixelFormat())
- videoNode.setAttribute("fps", str(node.fps))
- videoinfo.appendChild(videoNode)
- if node.hasAudio():
- audioNode = doc.createElement("audio")
- audioNode.setAttribute("codec", node.getAudioCodec())
- audioNode.setAttribute("samplerate", str(node.getAudioSampleRate()))
- audioNode.setAttribute("channels", str(node.getNumAudioChannels()))
- videoinfo.appendChild(audioNode)
-
-def singleVideoInfo(node):
- node.play()
- print "File: " + node.href
- print ("Duration: " + str(node.getDuration()/1000.) + " s ("
- + str(node.getNumFrames()) + " frames)")
- print "Bitrate: " + str(node.getBitrate()) + " b/s"
- print "Video stream: "
- print " Codec: " + node.getVideoCodec()
- print " Size: " + str(node.getMediaSize()) + " pixels"
- print " Pixel format: " + node.getStreamPixelFormat()
- print " FPS: " + str(node.fps)
- if node.hasAudio():
- print "Audio stream: "
- print " Codec: " + node.getAudioCodec()
- print " Sample rate: " + str(node.getAudioSampleRate()) + " Hz"
- print " Number of channels: " + str(node.getNumAudioChannels())
-
-def CSVtable(node):
- global CSV_video
-
- node.play()
- if CSV_video == '':
- CSV_head = ("File\tDuration\tBitrate\tVideoCodec\t" + \
- "VideoSize\tPixel format\tFPS\tAudioCodec\t" + \
- "Audio Sample rate\t Audio channels"+"\n")
- CSV_video = CSV_head
- CSV_video += \
- str(node.href)+'\t'+\
- str(node.getDuration()/1000.) + " s (" + str(node.getNumFrames()) + \
- " frames)"+'\t'+\
- str(node.getBitrate()) + " b/s" + '\t' + \
- str(node.getVideoCodec()) + '\t' + \
- str(node.getMediaSize()) + " pixels" + '\t' + \
- str(node.getStreamPixelFormat()) + '\t' + \
- str(node.fps) + '\t'
- if node.hasAudio():
- CSV_video += \
- str(node.getAudioCodec()) + '\t' + \
- str(node.getAudioSampleRate()) + " Hz" + '\t' + \
- str(node.getNumAudioChannels()) + '\n'
+def sortByName(a, b):
+ if a < b:
+ return -1
else:
- CSV_video += ' \t \t \n'
+ return 1
+
+class OutputHandler(object):
-def showInfo(node):
- global len_filename
- node.play()
- if node.hasAudio():
- vFile = os.path.basename(node.href).ljust(len_filename+2)
- vDuration = str(node.getDuration()/1000.).ljust(12)
- vBitrate = str(node.getBitrate()).ljust(15)
- vVideoCodec = str(node.getVideoCodec()).ljust(13)
- vVideoSize = str(node.getMediaSize()).ljust(11)
- vPixel = str(node.getStreamPixelFormat()).ljust(14)
- vFPS = str(round(node.fps, 2)).ljust(10)
- vAudioCodec = str(node.getAudioCodec()).ljust(12)
- vSampleRate = str(node.getAudioSampleRate()).ljust(13)
- vChannels = str(node.getNumAudioChannels()).ljust(8)
-
- info = vFile + vDuration + vVideoCodec + vVideoSize + vPixel + vFPS + vAudioCodec + vSampleRate + vChannels
-
- print info
- else:
- vFile = os.path.basename(node.href).ljust(len_filename+2)
- vDuration = str(node.getDuration()/1000.).ljust(12)
- vBitrate = str(node.getBitrate()).ljust(15)
- vVideoCodec = str(node.getVideoCodec()).ljust(13)
- vVideoSize = str(node.getMediaSize()).ljust(11)
- vPixel = str(node.getStreamPixelFormat()).ljust(14)
- vFPS = str(round(node.fps,2)).ljust(10)
- vAudioCodec = "".ljust(12)
- vSampleRate = "".ljust(13)
- vChannels = "".ljust(8)
-
- info = vFile + vDuration + vVideoCodec + vVideoSize + vPixel + vFPS + vAudioCodec + vSampleRate + vChannels
-
- print info
-
+ def __init__(self, args):
+ self._node = avg.VideoNode()
+ self.__getFileNames(args)
+
+ def __getFileNames(self, args):
+ self._fileNameList = []
+ filePaths = []
+ for arg in args:
+ if arg == ".":
+ filePaths.extend(os.listdir(os.curdir))
+ if options.recursion:
+ for folder in filePaths:
+ if os.path.isdir(folder):
+ filePaths.extend(self.__getFilesInFolder(folder))
+ elif arg == ".." or os.path.isdir(arg):
+ filePaths.extend(self.__getFilesInFolder(arg))
+ else:
+ if os.path.isfile(arg):
+ filePaths.append(arg)
+
+ for file in filePaths:
+ try:
+ if os.path.isfile(file):
+ self._node.href = str(file)
+ self._node.play()
+ self._fileNameList.append(self._node.href)
+ except RuntimeError, err:
+ sys.stderr.write(str(err) + "\n")
+ self._node = avg.VideoNode()
+ self._fileNameList.sort(cmp=sortByName)
+
+ def __getFilesInFolder(self, folder):
+ folderFiles = []
+ newFiles = os.listdir(folder)
+ for newfile in newFiles:
+ if folder == "..":
+ testFile = "../"+newfile
+ else:
+ testFile = str(folder)+"/"+newfile
+ if os.path.isfile(testFile):
+ folderFiles.append(testFile)
+ if options.recursion and os.path.isdir(testFile):
+ folderFiles.extend(self.__getFilesInFolder(testFile))
+ return folderFiles
+
+
+class ConsoleOutputHandler(OutputHandler):
-
-if len(sys.argv) ==1:
- parser.print_help()
- sys.exit(1)
+ def __init__(self, args):
+ super(ConsoleOutputHandler, self).__init__(args)
+ if self._fileNameList == []:
+ print "No valid video files found."
+ printHelp()
-if len(args) == 1:
- node.href = sys.argv[1]
- if options.xml:
- appendXMLChild(node)
- print doc.toprettyxml(indent=" ",encoding="utf-8")
- elif options.csv:
- CSVtable(node)
- print CSV_video
- else:
- singleVideoInfo(node)
+ def output(self):
+ if len(self._fileNameList) == 1:
+ self.__outputSingleFile(self._fileNameList[0])
+ else:
+ self.__outputTable()
+
+ def __outputSingleFile(self, filename):
+ self._node.href = filename
+ print "File: " + self._node.href
+ print ("Duration: " + str(self._node.getDuration()/1000.) + " s ("
+ + str(self._node.getNumFrames()) + " frames)")
+ print "Bitrate: " + str(self._node.getBitrate()) + " b/s"
+ print "Video stream: "
+ print " Codec: " + self._node.getVideoCodec()
+ print " Size: " + str(self._node.getMediaSize())
+ print " Pixel format: " + self._node.getStreamPixelFormat()
+ print " FPS: " + str(self._node.fps)
+ print " Duration: " + str(self._node.getVideoDuration()/1000.) + " s"
+ if self._node.hasAudio():
+ print "Audio stream: "
+ print " Codec: " + self._node.getAudioCodec()
+ print " Sample rate: " + str(self._node.getAudioSampleRate()) + " Hz"
+ print " Channels: " + str(self._node.getNumAudioChannels())
+ print " Duration: " + str(self._node.getAudioDuration()/1000.) + " s"
+
+ def __outputTable(self):
+ self.__filenameLen = 8
+ self.__videoCodecLen = 5
+ self.__videoFormatLen = 6
+ self.__audioCodecLen = 5
+
+ for filename in self._fileNameList:
+ self._node.href = filename
+ self._node.play()
+ self.__filenameLen = max(self.__filenameLen, len(filename))
+ curLen = len(self._node.getVideoCodec())
+ self.__videoCodecLen = max(self.__videoCodecLen, curLen)
+ curLen = len(self._node.getStreamPixelFormat())
+ self.__videoFormatLen = max(self.__videoFormatLen, curLen)
+ if self._node.hasAudio():
+ curLen = len(self._node.getAudioCodec())
+ self.__audioCodecLen = max(self.__audioCodecLen, curLen)
-else:
- for file in args:
- try:
- node.href = str(os.path.abspath(str(file)))
- #node.href = str(os.path.join(os.path.normpath(os.getcwd() + "/" +str(file))))
- node.play()
- VideoList.append(node.href)
- except:
- sys.stderr.write("Error in getting Videoinfo: " + str(node.href) + "\n")
-
- for i in xrange(0, len(VideoList)):
- curLen = len(os.path.basename(VideoList[i]))
- if len_filename < curLen:
- len_filename = curLen
-
- for i in xrange(0, len(VideoList)):
- node.href = VideoList[i]
- if options.xml:
- appendXMLChild(node)
- elif options.csv:
- CSVtable(node)
+ self.__outputTableHeader()
+
+ for filename in self._fileNameList:
+ self._node.href = filename
+ self.__outputTableLine(self._node)
+
+ def __outputTableHeader(self):
+ vFile = "Filename".ljust(self.__filenameLen+1)
+ vDuration = "Duration".ljust(9)
+ vVideoCodec = "Codec".ljust(self.__videoCodecLen +1)
+ vVideoSize = "Size".ljust(13)
+ vPixel = "Pixels".ljust(self.__videoFormatLen+1)
+ vFPS = "FPS".ljust(6)
+ vAudioCodec = "Codec".ljust(self.__audioCodecLen+1)
+ vSampleRate = "Rate".ljust(6)
+ vChannels = "Channels".ljust(8)
+
+ videoPropWidth = self.__videoFormatLen+self.__videoCodecLen+30
+ print ("| ".rjust(self.__filenameLen + 3) +
+ "Video properties".center(videoPropWidth) +
+ "| " +
+ "Audio properties".center((self.__audioCodecLen+17)))
+ print (vFile + "| " + vDuration + vVideoCodec +
+ vVideoSize + vPixel + vFPS + "| " + vAudioCodec +
+ vSampleRate + vChannels )
+ print ("| ".rjust(self.__filenameLen+3) +
+ "|".rjust(videoPropWidth+1))
+
+ def __outputTableLine(self, node):
+ vFile = node.href.ljust(self.__filenameLen + 1)
+ vDuration = str(node.getDuration()/1000.).ljust(9)
+ vVideoCodec = str(node.getVideoCodec()).ljust(self.__videoCodecLen + 1)
+ vVideoSize = str(node.getMediaSize()).ljust(13)
+ vPixel = str(node.getStreamPixelFormat()).ljust(self.__videoFormatLen + 1)
+ if node.fps%1 < 0.0000001:
+ vFPS = str(int(node.fps)).ljust(6)
else:
- if i == 0:
- vFile = "File".ljust(len_filename+2)
- vDuration = "Duration[s]".ljust(12)
- vBitrate = "Bitrate [b/s]".ljust(15)
- vVideoCodec = "VideoCodec".ljust(13)
- vVideoSize = "VideoSize".ljust(11)
- vPixel = "Pixel format".ljust(14)
- vFPS = "FPS".ljust(10)
- vAudioCodec = "AudioCodec".ljust(12)
- vSampleRate = "Sample rate".ljust(13)
- vChannels = "Channels".ljust(8)
-
- title = vFile + vDuration + vVideoCodec + vVideoSize + vPixel + vFPS + vAudioCodec + vSampleRate + vChannels
-
- print title
-
- showInfo(node)
- else:
- showInfo(node)
- if options.xml:
- print doc.toprettyxml(indent=" ",encoding="utf-8")
+ vFPS = str(round(node.fps, 2)).ljust(6)
+
+ if node.hasAudio():
+ vAudioCodec = str(node.getAudioCodec()).ljust(self.__audioCodecLen + 1)
+ vSampleRate = str(node.getAudioSampleRate()).ljust(6)
+ vChannels = str(node.getNumAudioChannels()).ljust(8)
+ else:
+ vAudioCodec = "no audio"
+ vSampleRate = ""
+ vChannels = ""
+
+ info = (vFile + "| " + vDuration + vVideoCodec + vVideoSize + vPixel +
+ vFPS + "| " + vAudioCodec + vSampleRate + vChannels)
+ print info
+
+class XMLOutputHandler(OutputHandler):
+
+ def __init__(self, args):
+ super(XMLOutputHandler, self).__init__(args)
+ self.__impl = minidom.getDOMImplementation()
+ self.__doc = self.__impl.createDocument(None, "videodict", None)
+ self.__rootElement = self.__doc.documentElement
+
+ def output(self):
+ for filename in self._fileNameList:
+ self._node.href = str(filename)
+ self.__appendXMLChild(self._node)
+ print self.__doc.toprettyxml(indent=" ",encoding="utf-8")
- elif options.csv:
- print CSV_video
+ def __appendXMLChild(self, node):
+ node.play()
+ videoinfo = self.__doc.createElement("videoinfo")
+ videoinfo.setAttribute("file", node.href)
+ videoinfo.setAttribute("duration", str(node.getDuration()/1000.))
+ videoinfo.setAttribute("bitrate", str(node.getBitrate()))
+ self.__rootElement.appendChild(videoinfo)
+ videoNode = self.__doc.createElement("video")
+ videoNode.setAttribute("codec", node.getVideoCodec())
+ videoNode.setAttribute("size", str(node.getMediaSize()))
+ videoNode.setAttribute("pixelformat", node.getStreamPixelFormat())
+ videoNode.setAttribute("fps", str(node.fps))
+ videoinfo.appendChild(videoNode)
+ if node.hasAudio():
+ audioNode = self.__doc.createElement("audio")
+ audioNode.setAttribute("codec", node.getAudioCodec())
+ audioNode.setAttribute("samplerate", str(node.getAudioSampleRate()))
+ audioNode.setAttribute("channels", str(node.getNumAudioChannels()))
+ videoinfo.appendChild(audioNode)
+
+class CSVOutputHandler(OutputHandler):
+ def __init__(self, args):
+ super(CSVOutputHandler, self).__init__(args)
+
+ def output(self):
+ print ("File\tDuration(sec)\tNumber of Frames\tBitrate(b/s)\tVideo Codec\t" +
+ "Width\tHeight\tPixel format\tFPS\tAudio Codec\t" +
+ "Audio Sample rate(Hz)\t Audio channels")
+ for filename in self._fileNameList:
+ self._node.href = str(filename)
+ self.__outputNode(self._node)
+
+ def __outputNode(self, node):
+ s = (str(node.href)+'\t'+
+ str(node.getDuration()/1000.)+'\t' +
+ str(node.getNumFrames())+"\t" +
+ str(node.getBitrate()) + '\t' +
+ str(node.getVideoCodec()) + '\t' +
+ str(node.getMediaSize()[0]) + '\t' +
+ str(node.getMediaSize()[1]) + '\t' +
+ str(node.getStreamPixelFormat()) + '\t' +
+ str(node.fps) + '\t')
+ if node.hasAudio():
+ s += (
+ str(node.getAudioCodec()) + '\t' +
+ str(node.getAudioSampleRate()) + '\t' +
+ str(node.getNumAudioChannels()))
+ else:
+ s += ' \t \t'
+ print s
+def printHelp():
+ parser.print_help()
+ sys.exit(1)
-
+if len(sys.argv) == 1:
+ printHelp()
+
+if options.xml:
+ outputHandler = XMLOutputHandler(args)
+elif options.csv:
+ outputHandler = CSVOutputHandler(args)
+else:
+ outputHandler = ConsoleOutputHandler(args)
+outputHandler.output()
diff --git a/src/utils/avg_videoplayer.py b/src/utils/avg_videoplayer.py
index 029d562..17268ca 100755
--- a/src/utils/avg_videoplayer.py
+++ b/src/utils/avg_videoplayer.py
@@ -1,8 +1,8 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-#
+
# libavg - Media Playback Engine.
-# Copyright (C) 2003-2011 Ulrich von Zadow
+# 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
@@ -19,37 +19,67 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# Current versions can be found at www.libavg.de
-#
import sys
-import optparse
-from libavg import avg, AVGApp
+from libavg import avg, app, player, widget
+
+
+class VideoPlayer(app.MainDiv):
+ CONTROL_WIDTH=240
+
+ def onArgvParserCreated(self, parser):
+ parser.set_usage("%prog [options] <filename>")
+ parser.add_option("-d", "--disable-accel", dest="disableAccel",
+ action="store_true", default=False,
+ help="disable vdpau acceleration")
-g_Player = avg.Player.get()
+ def onArgvParsed(self, options, args, parser):
+ if len(args) != 1:
+ parser.print_help()
+ sys.exit(1)
-class VideoPlayer(AVGApp):
+ self.node = avg.VideoNode(href=args[0], accelerated=not(options.disableAccel))
+ self.node.pause()
- def __init__(self, parentNode):
- if options.fullscreen:
- g_Player.setResolution(True, 1920, 1200, 0)
- AVGApp.__init__(self, parentNode)
+ mediaSize = self.node.getMediaSize()
+ size = avg.Point2D(max(mediaSize.x, 320), max(mediaSize.y, 120))
+ screenSize = player.getScreenResolution()
+ size = avg.Point2D(min(size.x, screenSize.x), min(size.y, screenSize.y-80))
+ self.settings.set("app_resolution", "%dx%d" %(size.x, size.y))
- def init(self):
- self.node = avg.VideoNode(href=args[0], loop=True,
- accelerated=not(options.disableAccel))
+ def onInit(self):
self.node.play()
+
+ mediaSize = self.node.getMediaSize()
+ canvasSize = self.size
+ sizeRatio = min(mediaSize.x/canvasSize.x, mediaSize.y/canvasSize.y)
+ self.node.size /= sizeRatio
+
+ self.node.x = (self.width-self.node.width)/2
+ self.node.y = (self.height-self.node.height)/2
+ self.node.subscribe(avg.VideoNode.END_OF_FILE, self.onEOF)
+
if self.node.hasAlpha():
self.__makeAlphaBackground()
- self._parentNode.appendChild(self.node)
- avg.WordsNode(parent=self._parentNode, id="curframe", pos=(10, 10),
- font="arial", fontsize=10)
- avg.WordsNode(parent=self._parentNode, id="curtime", pos=(10, 22),
- font="arial", fontsize=10)
- avg.WordsNode(parent=self._parentNode, id="framesqueued", pos=(10, 34),
- font="arial", fontsize=10)
-
- g_Player.setOnFrameHandler(self.onFrame)
-
+ self.appendChild(self.node)
+ self.curFrameWords = avg.WordsNode(parent=self, pos=(10, 10), fontsize=10)
+ self.framesQueuedWords = avg.WordsNode(parent=self, pos=(10, 22), fontsize=10)
+
+ controlPos = ((self.width-VideoPlayer.CONTROL_WIDTH)/2, self.height-25)
+ self.videoControl = widget.MediaControl(pos=controlPos,
+ size=(VideoPlayer.CONTROL_WIDTH, 20),
+ duration=self.node.getDuration(),
+ parent=self)
+ self.videoControl.play()
+ self.videoControl.subscribe(widget.MediaControl.PLAY_CLICKED, self.onPlay)
+ self.videoControl.subscribe(widget.MediaControl.PAUSE_CLICKED, self.onPause)
+ self.videoControl.subscribe(widget.MediaControl.SEEK_PRESSED, self.onSeekStart)
+ self.videoControl.subscribe(widget.MediaControl.SEEK_RELEASED, self.onSeekEnd)
+ self.videoControl.subscribe(widget.MediaControl.SEEK_MOTION, self.onSeek)
+
+ self.isSeeking = False
+ self.isPaused = False
+
def onKeyDown(self, event):
curTime = self.node.getCurTime()
if event.keystring == "right":
@@ -64,38 +94,50 @@ class VideoPlayer(AVGApp):
def onFrame(self):
curFrame = self.node.getCurFrame()
numFrames = self.node.getNumFrames()
- g_Player.getElementByID("curframe").text = "Frame: %i/%i"%(curFrame, numFrames)
- curVideoTime = self.node.getCurTime()
- g_Player.getElementByID("curtime").text = "Time: "+str(curVideoTime/1000.0)
+ self.curFrameWords.text = "Frame: %i/%i"%(curFrame, numFrames)
framesQueued = self.node.getNumFramesQueued()
- g_Player.getElementByID("framesqueued").text = "Frames queued: "+str(framesQueued)
+ self.framesQueuedWords.text = "Frames queued: "+str(framesQueued)
+ if not(self.isSeeking):
+ self.videoControl.time = self.node.getCurTime()
+
+ def onEOF(self):
+ self.videoControl.pause()
+ self.isPaused = True
+
+ def onPlay(self):
+ self.node.play()
+ self.isPaused = False
+
+ def onPause(self):
+ self.node.pause()
+ self.isPaused = True
+
+ def onSeekStart(self):
+ self.node.pause()
+ self.isSeeking = True
+
+ def onSeekEnd(self):
+ if not(self.isPaused):
+ self.node.play()
+ self.isSeeking = False
+
+ def onSeek(self, time):
+ self.node.seekToTime(int(time))
def __makeAlphaBackground(self):
SQUARESIZE=40
size = self.node.getMediaSize()
- avg.RectNode(parent=self._parentNode, size=self.node.getMediaSize(),
+ avg.RectNode(parent=self, size=self.node.getMediaSize(),
strokewidth=0, fillcolor="FFFFFF", fillopacity=1)
for y in xrange(0, int(size.y)/SQUARESIZE):
for x in xrange(0, int(size.x)/(SQUARESIZE*2)):
pos = avg.Point2D(x*SQUARESIZE*2, y*SQUARESIZE)
if y%2==1:
pos += (SQUARESIZE, 0)
- avg.RectNode(parent=self._parentNode, pos=pos,
- size=(SQUARESIZE, SQUARESIZE), strokewidth=0, fillcolor="C0C0C0",
- fillopacity=1)
-
-parser = optparse.OptionParser("Usage: %prog <filename> [options]")
-parser.add_option("-d", "--disable-accel", dest="disableAccel", action="store_true",
- default=False, help="disable vdpau acceleration")
-parser.add_option("-f", "--fullscreen", dest="fullscreen", action="store_true",
- default=False)
-(options, args) = parser.parse_args()
-
-if len(args) == 0:
- parser.print_help()
- sys.exit(1)
-
-argsNode = avg.VideoNode(href=args[0], loop=True, accelerated=False)
-argsNode.pause()
-VideoPlayer.start(resolution=argsNode.getMediaSize())
+ avg.RectNode(parent=self, pos=pos, size=(SQUARESIZE, SQUARESIZE),
+ strokewidth=0, fillcolor="C0C0C0", fillopacity=1)
+
+
+if __name__ == "__main__":
+ app.App().run(VideoPlayer())
diff --git a/src/version.h b/src/version.h
new file mode 100644
index 0000000..746a904
--- /dev/null
+++ b/src/version.h
@@ -0,0 +1,12 @@
+// version.h
+// This file is automatically generated by CreateVersionFile.py
+
+#define AVG_VERSION_RELEASE "1.8.0"
+#define AVG_VERSION_FULL "1.8.0-trunk/r9555"
+#define AVG_VERSION_BRANCH_URL "https://www.libavg.de/svn/trunk/libavg"
+#define AVG_VERSION_BUILDER "uzadow@Lagavulin Linux-3.2.0-58-generic-x86_64-with-Ubuntu-12.04-precise"
+#define AVG_VERSION_BUILDTIME "2014-02-15T16:41:29.075812"
+#define AVG_VERSION_REVISION 9555
+#define AVG_VERSION_MAJOR "1"
+#define AVG_VERSION_MINOR "8"
+#define AVG_VERSION_MICRO "0"
diff --git a/src/video/AsyncDemuxer.cpp b/src/video/AsyncDemuxer.cpp
deleted file mode 100644
index 9dd5d12..0000000
--- a/src/video/AsyncDemuxer.cpp
+++ /dev/null
@@ -1,152 +0,0 @@
-//
-// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 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 "AsyncDemuxer.h"
-
-#include "../base/ScopeTimer.h"
-#include "../base/Exception.h"
-#include "../base/ObjectCounter.h"
-
-#include <boost/bind.hpp>
-
-#include <iostream>
-
-#define PACKET_QUEUE_LENGTH 50
-
-using namespace std;
-
-typedef boost::mutex::scoped_lock scoped_lock;
-
-namespace avg {
-
-AsyncDemuxer::AsyncDemuxer(AVFormatContext * pFormatContext, vector<int> streamIndexes)
- : m_pCmdQ(new VideoDemuxerThread::CQueue),
- m_bSeekPending(false),
- m_pFormatContext(pFormatContext)
-{
- ObjectCounter::get()->incRef(&typeid(*this));
- for (unsigned i = 0; i < streamIndexes.size(); ++i) {
- enableStream(streamIndexes[i]);
- }
- m_pDemuxThread = new boost::thread(VideoDemuxerThread(*m_pCmdQ, m_pFormatContext,
- m_PacketQs));
-}
-
-AsyncDemuxer::~AsyncDemuxer()
-{
- if (m_pDemuxThread) {
- waitForSeekDone();
- m_pCmdQ->pushCmd(boost::bind(&VideoDemuxerThread::stop, _1));
- map<int, VideoPacketQueuePtr>::iterator it;
- for (it = m_PacketQs.begin(); it != m_PacketQs.end(); ++it) {
- // If the Queue is full, this breaks the lock in the thread.
- PacketVideoMsgPtr pPacketMsg;
- pPacketMsg = it->second->pop(false);
- if (pPacketMsg) {
- pPacketMsg->freePacket();
- }
- }
- m_pDemuxThread->join();
- delete m_pDemuxThread;
- m_pDemuxThread = 0;
- for (it = m_PacketQs.begin(); it != m_PacketQs.end(); it++) {
- VideoPacketQueuePtr pPacketQ = it->second;
- PacketVideoMsgPtr pPacketMsg;
- pPacketMsg = pPacketQ->pop(false);
- while (pPacketMsg) {
- pPacketMsg->freePacket();
- pPacketMsg = pPacketQ->pop(false);
- }
- }
- }
- ObjectCounter::get()->decRef(&typeid(*this));
-}
-
-AVPacket * AsyncDemuxer::getPacket(int streamIndex)
-{
- waitForSeekDone();
- // TODO: This blocks if there is no packet. Is that ok?
- PacketVideoMsgPtr pPacketMsg = m_PacketQs[streamIndex]->pop(true);
- AVG_ASSERT(!pPacketMsg->isSeekDone());
-
- return pPacketMsg->getPacket();
-}
-
-void AsyncDemuxer::seek(double destTime)
-{
- // TODO: There is a (theoretical) race condition here - getPacket() and seek() can
- // be called from different threads. Among other things, this can cause the assert in
- // getPacket() to trigger.
- waitForSeekDone();
- scoped_lock Lock(m_SeekMutex);
- m_pCmdQ->pushCmd(boost::bind(&VideoDemuxerThread::seek, _1, destTime));
- m_bSeekPending = true;
- bool bAllSeeksDone = true;
- map<int, VideoPacketQueuePtr>::iterator it;
- for (it = m_PacketQs.begin(); it != m_PacketQs.end(); it++) {
- VideoPacketQueuePtr pPacketQ = it->second;
- PacketVideoMsgPtr pPacketMsg;
- map<int, bool>::iterator itSeekDone = m_bSeekDone.find(it->first);
- itSeekDone->second = false;
- pPacketMsg = pPacketQ->pop(false);
- while (pPacketMsg && !itSeekDone->second) {
- itSeekDone->second = pPacketMsg->isSeekDone();
- pPacketMsg->freePacket();
- if (!itSeekDone->second) {
- pPacketMsg = pPacketQ->pop(false);
- }
- }
- if (!itSeekDone->second) {
- bAllSeeksDone = false;
- }
- }
- if (bAllSeeksDone) {
- m_bSeekPending = false;
- }
-}
-
-void AsyncDemuxer::enableStream(int streamIndex)
-{
- VideoPacketQueuePtr pPacketQ(new VideoPacketQueue(PACKET_QUEUE_LENGTH));
- m_PacketQs[streamIndex] = pPacketQ;
- m_bSeekDone[streamIndex] = true;
-}
-
-void AsyncDemuxer::waitForSeekDone()
-{
- scoped_lock Lock(m_SeekMutex);
- if (m_bSeekPending) {
- m_bSeekPending = false;
- map<int, VideoPacketQueuePtr>::iterator it;
- for (it = m_PacketQs.begin(); it != m_PacketQs.end(); it++) {
- VideoPacketQueuePtr pPacketQ = it->second;
- PacketVideoMsgPtr pPacketMsg;
- map<int, bool>::iterator itSeekDone = m_bSeekDone.find(it->first);
- while (!itSeekDone->second) {
- pPacketMsg = pPacketQ->pop(true);
- itSeekDone->second = pPacketMsg->isSeekDone();
- pPacketMsg->freePacket();
- }
- }
- }
-}
-
-}
diff --git a/src/video/AsyncDemuxer.h b/src/video/AsyncDemuxer.h
deleted file mode 100644
index ced2ca3..0000000
--- a/src/video/AsyncDemuxer.h
+++ /dev/null
@@ -1,63 +0,0 @@
-//
-// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 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 _AsyncDemuxer_H_
-#define _AsyncDemuxer_H_
-
-#include "../avgconfigwrapper.h"
-#include "IDemuxer.h"
-#include "VideoDemuxerThread.h"
-
-#include <map>
-#include <vector>
-
-#include <boost/shared_ptr.hpp>
-#include <boost/thread.hpp>
-
-namespace avg {
-
- class AVG_API AsyncDemuxer: public IDemuxer {
- public:
- AsyncDemuxer(AVFormatContext * pFormatContext,
- std::vector<int> streamIndexes);
- virtual ~AsyncDemuxer();
-
- AVPacket * getPacket(int streamIndex);
- void seek(double destTime);
-
- private:
- void enableStream(int streamIndex);
- void waitForSeekDone();
-
- boost::thread* m_pDemuxThread;
-
- VideoDemuxerThread::CQueuePtr m_pCmdQ;
- std::map<int, VideoPacketQueuePtr> m_PacketQs;
- std::map<int, bool> m_bSeekDone;
-
- bool m_bSeekPending;
- AVFormatContext * m_pFormatContext;
- boost::mutex m_SeekMutex;
- };
- typedef boost::shared_ptr<AsyncDemuxer> AsyncDemuxerPtr;
-}
-
-#endif
diff --git a/src/video/AsyncVideoDecoder.cpp b/src/video/AsyncVideoDecoder.cpp
index 98be6ec..4ba7033 100644
--- a/src/video/AsyncVideoDecoder.cpp
+++ b/src/video/AsyncVideoDecoder.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -21,10 +21,14 @@
#include "AsyncVideoDecoder.h"
+#ifdef AVG_ENABLE_VDPAU
+#include "VDPAUDecoder.h"
+#include "VDPAUHelper.h"
+#endif
+
#include "../base/ObjectCounter.h"
#include "../base/Exception.h"
#include "../base/ScopeTimer.h"
-#include "FFMpegDecoder.h"
#include <boost/thread/thread.hpp>
#include <boost/bind.hpp>
@@ -32,24 +36,22 @@
#include <math.h>
#include <iostream>
-using namespace boost;
using namespace std;
+using boost::dynamic_pointer_cast;
+
+#define AUDIO_MSG_QUEUE_LENGTH 50
+#define AUDIO_STATUS_QUEUE_LENGTH -1
+#define PACKET_QUEUE_LENGTH 50
namespace avg {
-AsyncVideoDecoder::AsyncVideoDecoder(VideoDecoderPtr pSyncDecoder, int queueLength)
- : m_State(CLOSED),
- m_pSyncDecoder(pSyncDecoder),
- m_QueueLength(queueLength),
+AsyncVideoDecoder::AsyncVideoDecoder(int queueLength)
+ : m_QueueLength(queueLength),
+ m_pDemuxThread(0),
m_pVDecoderThread(0),
m_pADecoderThread(0),
- m_PF(NO_PIXELFORMAT),
- m_bAudioEOF(false),
- m_bVideoEOF(false),
- m_bSeekPending(false),
- m_Volume(1.0),
- m_LastVideoFrameTime(-1),
- m_LastAudioFrameTime(-1)
+ m_bUseStreamFPS(true),
+ m_FPS(0)
{
ObjectCounter::get()->incRef(&typeid(*this));
}
@@ -62,125 +64,104 @@ AsyncVideoDecoder::~AsyncVideoDecoder()
ObjectCounter::get()->decRef(&typeid(*this));
}
-void AsyncVideoDecoder::open(const std::string& sFilename, bool bThreadedDemuxer,
- bool bUseHardwareAccelleration)
+void AsyncVideoDecoder::open(const std::string& sFilename, bool bUseHardwareAcceleration,
+ bool bEnableSound)
{
+ m_NumSeeksSent = 0;
+ m_NumVSeeksDone = 0;
+ m_NumASeeksDone = 0;
m_bAudioEOF = false;
m_bVideoEOF = false;
- m_bSeekPending = false;
- m_sFilename = sFilename;
-
- m_pSyncDecoder->open(m_sFilename, bThreadedDemuxer, bUseHardwareAccelleration);
- m_VideoInfo = m_pSyncDecoder->getVideoInfo();
- // Temporary pf - always assumes shaders will be available.
- m_PF = m_pSyncDecoder->getPixelFormat();
- m_State = OPENED;
+ m_bWasVSeeking = false;
+ m_bWasSeeking = false;
+ m_CurVideoFrameTime = -1;
+
+ VideoDecoder::open(sFilename, bUseHardwareAcceleration, bEnableSound);
+
+ if (getVideoInfo().m_bHasVideo && m_bUseStreamFPS) {
+ m_FPS = getStreamFPS();
+ }
}
void AsyncVideoDecoder::startDecoding(bool bDeliverYCbCr, const AudioParams* pAP)
{
- AVG_ASSERT(m_State == OPENED);
- m_pSyncDecoder->setVolume(m_Volume);
- m_pSyncDecoder->startDecoding(bDeliverYCbCr, pAP);
- m_VideoInfo = m_pSyncDecoder->getVideoInfo();
- if (m_VideoInfo.m_bHasVideo) {
+ VideoDecoder::startDecoding(bDeliverYCbCr, pAP);
+
+ AVG_ASSERT(!m_pDemuxThread);
+ vector<int> streamIndexes;
+ if (getVStreamIndex() >= 0) {
+ streamIndexes.push_back(getVStreamIndex());
+ }
+ if (getAStreamIndex() >= 0) {
+ streamIndexes.push_back(getAStreamIndex());
+ }
+ setupDemuxer(streamIndexes);
+
+ if (getVideoInfo().m_bHasVideo) {
m_LastVideoFrameTime = -1;
- m_PF = m_pSyncDecoder->getPixelFormat();
+ m_CurVideoFrameTime = -1;
+ if (m_bUseStreamFPS) {
+ m_FPS = getStreamFPS();
+ }
m_pVCmdQ = VideoDecoderThread::CQueuePtr(new VideoDecoderThread::CQueue);
m_pVMsgQ = VideoMsgQueuePtr(new VideoMsgQueue(m_QueueLength));
- m_pVDecoderThread = new boost::thread(
- VideoDecoderThread(*m_pVCmdQ, *m_pVMsgQ, m_pSyncDecoder));
+ VideoMsgQueue& packetQ = *m_PacketQs[getVStreamIndex()];
+
+ m_pVDecoderThread = new boost::thread(VideoDecoderThread(
+ *m_pVCmdQ, *m_pVMsgQ, packetQ, getVideoStream(),
+ getSize(), getPixelFormat(), usesVDPAU()));
}
- if (m_VideoInfo.m_bHasAudio) {
+ if (getVideoInfo().m_bHasAudio) {
m_pACmdQ = AudioDecoderThread::CQueuePtr(new AudioDecoderThread::CQueue);
- m_pAMsgQ = VideoMsgQueuePtr(new VideoMsgQueue(8));
+ m_pAMsgQ = AudioMsgQueuePtr(new AudioMsgQueue(AUDIO_MSG_QUEUE_LENGTH));
+ m_pAStatusQ = AudioMsgQueuePtr(new AudioMsgQueue(AUDIO_STATUS_QUEUE_LENGTH));
+ VideoMsgQueue& packetQ = *m_PacketQs[getAStreamIndex()];
m_pADecoderThread = new boost::thread(
- AudioDecoderThread(*m_pACmdQ, *m_pAMsgQ, m_pSyncDecoder, *pAP));
- m_AudioMsgData = 0;
- m_AudioMsgSize = 0;
+ AudioDecoderThread(*m_pACmdQ, *m_pAMsgQ, packetQ, getAudioStream(), *pAP));
m_LastAudioFrameTime = 0;
}
- m_State = DECODING;
}
void AsyncVideoDecoder::close()
{
- AVG_ASSERT(m_State != CLOSED);
+ AVG_ASSERT(getState() != CLOSED);
+
+ if (m_pDemuxThread) {
+ m_pDemuxCmdQ->pushCmd(boost::bind(&VideoDemuxerThread::close, _1));
+ m_pDemuxThread->join();
+ }
+
if (m_pVDecoderThread) {
- m_pVCmdQ->pushCmd(boost::bind(&VideoDecoderThread::stop, _1));
- getNextBmps(false); // If the Queue is full, this breaks the lock in the thread.
+ m_pVMsgQ->clear();
m_pVDecoderThread->join();
delete m_pVDecoderThread;
m_pVDecoderThread = 0;
m_pVMsgQ = VideoMsgQueuePtr();
}
- {
- scoped_lock lock1(m_AudioMutex);
- if (m_pADecoderThread) {
- m_pACmdQ->pushCmd(boost::bind(&AudioDecoderThread::stop, _1));
- m_pAMsgQ->pop(false);
- m_pAMsgQ->pop(false);
- m_pADecoderThread->join();
- delete m_pADecoderThread;
- m_pADecoderThread = 0;
- m_pAMsgQ = VideoMsgQueuePtr();
- }
- m_pSyncDecoder->close();
- }
-}
-
-VideoDecoder::DecoderState AsyncVideoDecoder::getState() const
-{
- return m_State;
-}
-
-VideoInfo AsyncVideoDecoder::getVideoInfo() const
-{
- AVG_ASSERT(m_State != CLOSED);
- return m_VideoInfo;
+ if (m_pADecoderThread) {
+ m_pAMsgQ->clear();
+ m_pAStatusQ->clear();
+ m_pADecoderThread->join();
+ delete m_pADecoderThread;
+ m_pADecoderThread = 0;
+ m_pAStatusQ = AudioMsgQueuePtr();
+ m_pAMsgQ = AudioMsgQueuePtr();
+ }
+ VideoDecoder::close();
+ if (m_pDemuxThread) {
+ deleteDemuxer();
+ }
}
-void AsyncVideoDecoder::seek(double destTime)
+void AsyncVideoDecoder::seek(float destTime)
{
- AVG_ASSERT(m_State == DECODING);
- waitForSeekDone();
- scoped_lock lock1(m_AudioMutex);
- scoped_lock Lock2(m_SeekMutex);
+ AVG_ASSERT(getState() == DECODING);
m_bAudioEOF = false;
m_bVideoEOF = false;
- m_bSeekPending = false;
- m_bSeekPending = true;
- if (m_pVCmdQ) {
- m_pVCmdQ->pushCmd(boost::bind(&VideoDecoderThread::seek, _1, destTime));
- } else {
- m_pACmdQ->pushCmd(boost::bind(&AudioDecoderThread::seek, _1, destTime));
- }
- bool bDone = false;
- while (!bDone && m_bSeekPending) {
- VideoMsgPtr pMsg;
- if (m_pVCmdQ) {
- pMsg = m_pVMsgQ->pop(false);
- } else {
- pMsg = m_pAMsgQ->pop(false);
- }
- if (pMsg) {
- switch (pMsg->getType()) {
- case VideoMsg::SEEK_DONE:
- m_bSeekPending = false;
- m_LastVideoFrameTime = pMsg->getSeekVideoFrameTime();
- m_LastAudioFrameTime = pMsg->getSeekAudioFrameTime();
- break;
- case VideoMsg::FRAME:
- returnFrame(pMsg);
- break;
- default:
- break;
- }
- } else {
- bDone = true;
- }
- }
+ m_NumSeeksSent++;
+ m_pDemuxCmdQ->pushCmd(boost::bind(&VideoDemuxerThread::seek, _1, m_NumSeeksSent,
+ destTime));
}
void AsyncVideoDecoder::loop()
@@ -188,104 +169,73 @@ void AsyncVideoDecoder::loop()
m_LastVideoFrameTime = -1;
m_bAudioEOF = false;
m_bVideoEOF = false;
- if (getVideoInfo().m_bHasAudio) {
- seek(0);
- }
-}
-
-IntPoint AsyncVideoDecoder::getSize() const
-{
- AVG_ASSERT(m_State != CLOSED);
- return m_VideoInfo.m_Size;
+ seek(0);
}
int AsyncVideoDecoder::getCurFrame() const
{
- AVG_ASSERT(m_State != CLOSED);
- return int(getCurTime(SS_VIDEO)*m_VideoInfo.m_StreamFPS+0.5);
+ AVG_ASSERT(getState() != CLOSED);
+ return int(getCurTime()*getVideoInfo().m_StreamFPS+0.5);
}
int AsyncVideoDecoder::getNumFramesQueued() const
{
- AVG_ASSERT(m_State == DECODING);
+ AVG_ASSERT(getState() == DECODING);
return m_pVMsgQ->size();
}
-double AsyncVideoDecoder::getCurTime(StreamSelect stream) const
+float AsyncVideoDecoder::getCurTime() const
{
- AVG_ASSERT(m_State != CLOSED);
- switch (stream) {
- case SS_DEFAULT:
- case SS_VIDEO:
- AVG_ASSERT(m_VideoInfo.m_bHasVideo);
- return m_LastVideoFrameTime;
- break;
- case SS_AUDIO:
- AVG_ASSERT(m_VideoInfo.m_bHasAudio);
- return m_LastAudioFrameTime;
- break;
- default:
- AVG_ASSERT(false);
+ AVG_ASSERT(getState() != CLOSED);
+ if (getVideoInfo().m_bHasVideo) {
+ return m_CurVideoFrameTime;
+ } else {
+ return m_LastAudioFrameTime;
}
- return -1;
}
-double AsyncVideoDecoder::getNominalFPS() const
+float AsyncVideoDecoder::getFPS() const
{
- AVG_ASSERT(m_State != CLOSED);
- return m_VideoInfo.m_StreamFPS;
+ AVG_ASSERT(getState() != CLOSED);
+ return m_FPS;
}
-double AsyncVideoDecoder::getFPS() const
-{
- AVG_ASSERT(m_State != CLOSED);
- return m_VideoInfo.m_FPS;
-}
-
-void AsyncVideoDecoder::setFPS(double fps)
+void AsyncVideoDecoder::setFPS(float fps)
{
AVG_ASSERT(!m_pADecoderThread);
m_pVCmdQ->pushCmd(boost::bind(&VideoDecoderThread::setFPS, _1, fps));
- if (fps != 0) {
- m_VideoInfo.m_FPS = fps;
- }
-}
-
-double AsyncVideoDecoder::getVolume() const
-{
- AVG_ASSERT(m_State != CLOSED);
- return m_Volume;
-}
-
-void AsyncVideoDecoder::setVolume(double volume)
-{
- m_Volume = volume;
- if (m_State != CLOSED && m_VideoInfo.m_bHasAudio && m_pACmdQ) {
- m_pACmdQ->pushCmd(boost::bind(&AudioDecoderThread::setVolume, _1, volume));
+ m_bUseStreamFPS = (fps == 0);
+ if (m_bUseStreamFPS) {
+ m_FPS = getVideoInfo().m_StreamFPS;
+ } else {
+ m_FPS = fps;
}
}
-PixelFormat AsyncVideoDecoder::getPixelFormat() const
-{
- AVG_ASSERT(m_State != CLOSED);
- return m_PF;
-}
-
-static ProfilingZoneID VDPAUDecodeProfilingZone("AsyncVideoDecoder: VDPAU");
+static ProfilingZoneID VDPAUDecodeProfilingZone("AsyncVideoDecoder: VDPAU", true);
FrameAvailableCode AsyncVideoDecoder::renderToBmps(vector<BitmapPtr>& pBmps,
- double timeWanted)
+ float timeWanted)
{
- AVG_ASSERT(m_State == DECODING);
+ AVG_ASSERT(getState() == DECODING);
FrameAvailableCode frameAvailable;
- VideoMsgPtr pFrameMsg = getBmpsForTime(timeWanted, frameAvailable);
+ VideoMsgPtr pFrameMsg;
+ if (timeWanted == -1) {
+ waitForSeekDone();
+ pFrameMsg = getNextBmps(true);
+ frameAvailable = FA_NEW_FRAME;
+ } else {
+ pFrameMsg = getBmpsForTime(timeWanted, frameAvailable);
+ }
if (frameAvailable == FA_NEW_FRAME) {
AVG_ASSERT(pFrameMsg);
+ m_LastVideoFrameTime = pFrameMsg->getFrameTime();
+ m_CurVideoFrameTime = m_LastVideoFrameTime;
if (pFrameMsg->getType() == VideoMsg::VDPAU_FRAME) {
#ifdef AVG_ENABLE_VDPAU
ScopeTimer timer(VDPAUDecodeProfilingZone);
vdpau_render_state* pRenderState = pFrameMsg->getRenderState();
- if (pixelFormatIsPlanar(m_PF)) {
+ if (pixelFormatIsPlanar(getPixelFormat())) {
getPlanesFromVDPAU(pRenderState, pBmps[0], pBmps[1], pBmps[2]);
} else {
getBitmapFromVDPAU(pRenderState, pBmps[0]);
@@ -301,137 +251,136 @@ FrameAvailableCode AsyncVideoDecoder::renderToBmps(vector<BitmapPtr>& pBmps,
return frameAvailable;
}
-bool AsyncVideoDecoder::isEOF(StreamSelect stream) const
+void AsyncVideoDecoder::updateAudioStatus()
{
- AVG_ASSERT(m_State == DECODING);
- switch(stream) {
- case SS_AUDIO:
- return (!m_VideoInfo.m_bHasAudio || m_bAudioEOF);
- case SS_VIDEO:
- return (!m_VideoInfo.m_bHasVideo || m_bVideoEOF);
- case SS_ALL:
- return isEOF(SS_VIDEO) && isEOF(SS_AUDIO);
- default:
- return false;
+ if (m_pAStatusQ) {
+ AudioMsgPtr pMsg = m_pAStatusQ->pop(false);
+ while (pMsg) {
+ handleAudioMsg(pMsg);
+ pMsg = m_pAStatusQ->pop(false);
+ }
+ }
+}
+
+bool AsyncVideoDecoder::isEOF() const
+{
+ AVG_ASSERT(getState() == DECODING);
+ bool bEOF = true;
+ if (getVideoInfo().m_bHasAudio && !m_bAudioEOF) {
+ bEOF = false;
+ }
+ if (getVideoInfo().m_bHasVideo && !m_bVideoEOF) {
+ bEOF = false;
}
+ return bEOF;
}
-void AsyncVideoDecoder::throwAwayFrame(double timeWanted)
+void AsyncVideoDecoder::throwAwayFrame(float timeWanted)
{
- AVG_ASSERT(m_State == DECODING);
+ AVG_ASSERT(getState() == DECODING);
FrameAvailableCode frameAvailable;
VideoMsgPtr pFrameMsg = getBmpsForTime(timeWanted, frameAvailable);
}
-int AsyncVideoDecoder::fillAudioBuffer(AudioBufferPtr pBuffer)
+AudioMsgQueuePtr AsyncVideoDecoder::getAudioMsgQ()
{
- AVG_ASSERT(m_State == DECODING);
- AVG_ASSERT (m_pADecoderThread);
- if (m_bAudioEOF) {
- return 0;
+ return m_pAMsgQ;
+}
+
+AudioMsgQueuePtr AsyncVideoDecoder::getAudioStatusQ() const
+{
+ return m_pAStatusQ;
+}
+
+void AsyncVideoDecoder::setupDemuxer(vector<int> streamIndexes)
+{
+ m_pDemuxCmdQ = VideoDemuxerThread::CQueuePtr(new VideoDemuxerThread::CQueue());
+ for (unsigned i = 0; i < streamIndexes.size(); ++i) {
+ VideoMsgQueuePtr pPacketQ(new VideoMsgQueue(PACKET_QUEUE_LENGTH));
+ m_PacketQs[streamIndexes[i]] = pPacketQ;
}
- scoped_lock lock(m_AudioMutex);
- waitForSeekDone();
-
- unsigned char* pDest = (unsigned char *)(pBuffer->getData());
- int bufferLeftToFill = pBuffer->getNumBytes();
- VideoMsgPtr pMsg;
- while (bufferLeftToFill > 0) {
- while (m_AudioMsgSize > 0 && bufferLeftToFill > 0) {
- int copyBytes = min(bufferLeftToFill, m_AudioMsgSize);
- memcpy(pDest, m_AudioMsgData, copyBytes);
- m_AudioMsgSize -= copyBytes;
- m_AudioMsgData += copyBytes;
- bufferLeftToFill -= copyBytes;
- pDest += copyBytes;
-
- m_LastAudioFrameTime += copyBytes /
- (pBuffer->getFrameSize() * pBuffer->getRate());
- }
- if (bufferLeftToFill != 0) {
- pMsg = m_pAMsgQ->pop(false);
- if (pMsg) {
- if (pMsg->getType() == VideoMsg::END_OF_FILE) {
- m_bAudioEOF = true;
- return pBuffer->getNumFrames()-bufferLeftToFill/
- pBuffer->getFrameSize();
- }
- AVG_ASSERT(pMsg->getType() == VideoMsg::AUDIO);
+ m_pDemuxThread = new boost::thread(VideoDemuxerThread(*m_pDemuxCmdQ,
+ getFormatContext(), m_PacketQs));
+}
- m_AudioMsgSize = pMsg->getAudioBuffer()->getNumFrames()
- *pBuffer->getFrameSize();
- m_AudioMsgData = (unsigned char *)(pMsg->getAudioBuffer()->getData());
- m_LastAudioFrameTime = pMsg->getAudioTime();
- } else {
- return pBuffer->getNumFrames()-bufferLeftToFill/pBuffer->getFrameSize();
- }
+void AsyncVideoDecoder::deleteDemuxer()
+{
+ delete m_pDemuxThread;
+ m_pDemuxThread = 0;
+ map<int, VideoMsgQueuePtr>::iterator it;
+ for (it = m_PacketQs.begin(); it != m_PacketQs.end(); it++) {
+ VideoMsgQueuePtr pPacketQ = it->second;
+ VideoMsgPtr pPacketMsg;
+ pPacketMsg = pPacketQ->pop(false);
+ while (pPacketMsg) {
+ pPacketMsg->freePacket();
+ pPacketMsg = pPacketQ->pop(false);
}
}
- return pBuffer->getNumFrames();
}
-
-VideoMsgPtr AsyncVideoDecoder::getBmpsForTime(double timeWanted,
+
+VideoMsgPtr AsyncVideoDecoder::getBmpsForTime(float timeWanted,
FrameAvailableCode& frameAvailable)
{
- if (timeWanted < 0 && timeWanted != -1) {
+ if (timeWanted < 0) {
cerr << "Illegal timeWanted: " << timeWanted << endl;
AVG_ASSERT(false);
}
- // XXX: This code is sort-of duplicated in FFMpegDecoder::readFrameForTime()
- double frameTime = -1;
VideoMsgPtr pFrameMsg;
- if (timeWanted == -1) {
- pFrameMsg = getNextBmps(true);
- frameAvailable = FA_NEW_FRAME;
+ float timePerFrame = 1.0f/getFPS();
+
+ checkForSeekDone();
+ bool bVSeekDone = (!isVSeeking() && m_bWasVSeeking);
+ m_bWasVSeeking = isVSeeking();
+
+ if (!isSeeking() && m_bWasSeeking) {
+// cerr << "timeWanted: " << timeWanted << ", audio: " << m_LastAudioFrameTime
+// << ", diff: " << timeWanted-m_LastAudioFrameTime << endl;
+ }
+ m_bWasSeeking = isSeeking();
+ if ((!bVSeekDone &&
+ (isVSeeking() ||
+ fabs(float(timeWanted-m_LastVideoFrameTime)) < 0.5*timePerFrame ||
+ m_LastVideoFrameTime > timeWanted+timePerFrame)) ||
+ m_bVideoEOF)
+ {
+ // The last frame is still current. Display it again.
+ frameAvailable = FA_USE_LAST_FRAME;
+ return VideoMsgPtr();
} else {
- double timePerFrame = 1.0/getFPS();
- if (fabs(double(timeWanted-m_LastVideoFrameTime)) < 0.5*timePerFrame ||
- m_LastVideoFrameTime > timeWanted+timePerFrame) {
- // The last frame is still current. Display it again.
- frameAvailable = FA_USE_LAST_FRAME;
- return VideoMsgPtr();
- } else {
- if (m_bVideoEOF) {
- frameAvailable = FA_USE_LAST_FRAME;
- return VideoMsgPtr();
- }
- while (frameTime-timeWanted < -0.5*timePerFrame && !m_bVideoEOF) {
- if (pFrameMsg) {
- if (pFrameMsg->getType() == VideoMsg::FRAME) {
- returnFrame(pFrameMsg);
- } else {
+ float frameTime = -1;
+ while (frameTime-timeWanted < -0.5*timePerFrame && !m_bVideoEOF) {
+ if (pFrameMsg) {
+ if (pFrameMsg->getType() == VideoMsg::FRAME) {
+ returnFrame(pFrameMsg);
+ } else {
#if AVG_ENABLE_VDPAU
- vdpau_render_state* pRenderState = pFrameMsg->getRenderState();
- VDPAU::unlockSurface(pRenderState);
+ vdpau_render_state* pRenderState = pFrameMsg->getRenderState();
+ unlockVDPAUSurface(pRenderState);
#endif
- }
- }
- pFrameMsg = getNextBmps(false);
- if (pFrameMsg) {
- frameTime = pFrameMsg->getFrameTime();
- } else {
- frameAvailable = FA_STILL_DECODING;
- return VideoMsgPtr();
}
}
- if (!pFrameMsg) {
- cerr << "frameTime=" << frameTime << ", timeWanted=" << timeWanted
- << ", timePerFrame=" << timePerFrame << ", m_bVideoEOF="
- << m_bVideoEOF << endl;
- AVG_ASSERT(false);
+ pFrameMsg = getNextBmps(false);
+ if (pFrameMsg) {
+ frameTime = pFrameMsg->getFrameTime();
+ } else {
+ frameAvailable = FA_STILL_DECODING;
+ return VideoMsgPtr();
}
- frameAvailable = FA_NEW_FRAME;
}
- }
- if (pFrameMsg) {
- m_LastVideoFrameTime = pFrameMsg->getFrameTime();
+ if (!pFrameMsg) {
+ cerr << "frameTime=" << frameTime << ", timeWanted=" << timeWanted
+ << ", timePerFrame=" << timePerFrame << ", m_bVideoEOF="
+ << m_bVideoEOF << endl;
+ AVG_ASSERT(false);
+ }
+ frameAvailable = FA_NEW_FRAME;
}
return pFrameMsg;
}
VideoMsgPtr AsyncVideoDecoder::getNextBmps(bool bWait)
{
- waitForSeekDone();
VideoMsgPtr pMsg = m_pVMsgQ->pop(bWait);
if (pMsg) {
switch (pMsg->getType()) {
@@ -439,11 +388,15 @@ VideoMsgPtr AsyncVideoDecoder::getNextBmps(bool bWait)
case VideoMsg::VDPAU_FRAME:
return pMsg;
case VideoMsg::END_OF_FILE:
+ m_NumVSeeksDone = m_NumSeeksSent;
m_bVideoEOF = true;
return VideoMsgPtr();
case VideoMsg::ERROR:
m_bVideoEOF = true;
return VideoMsgPtr();
+ case AudioMsg::SEEK_DONE:
+ handleVSeekDone(pMsg);
+ return getNextBmps(bWait);
default:
// Unhandled message type.
AVG_ASSERT(false);
@@ -453,42 +406,100 @@ VideoMsgPtr AsyncVideoDecoder::getNextBmps(bool bWait)
return pMsg;
}
}
-
void AsyncVideoDecoder::waitForSeekDone()
{
- scoped_lock lock(m_SeekMutex);
- if (m_bSeekPending) {
+ while (isVSeeking()) {
+ VideoMsgPtr pMsg = m_pVMsgQ->pop(true);
+ handleVSeekMsg(pMsg);
+ }
+}
+
+void AsyncVideoDecoder::checkForSeekDone()
+{
+ if (isVSeeking()) {
+ VideoMsgPtr pMsg;
do {
- VideoMsgPtr pMsg;
- if (m_pVCmdQ) {
- pMsg = m_pVMsgQ->pop(true);
- } else {
- pMsg = m_pAMsgQ->pop(true);
+ pMsg = m_pVMsgQ->pop(false);
+ if (pMsg) {
+ handleVSeekMsg(pMsg);
}
- switch (pMsg->getType()) {
- case VideoMsg::SEEK_DONE:
- m_bSeekPending = false;
- m_LastVideoFrameTime = pMsg->getSeekVideoFrameTime();
- m_LastAudioFrameTime = pMsg->getSeekAudioFrameTime();
- break;
- case VideoMsg::FRAME:
- returnFrame(pMsg);
- break;
- case VideoMsg::VDPAU_FRAME:
- break;
- default:
- // TODO: Handle ERROR messages here.
- break;
+ } while (pMsg && isVSeeking());
+ }
+}
+
+void AsyncVideoDecoder::handleVSeekMsg(VideoMsgPtr pMsg)
+{
+ switch (pMsg->getType()) {
+ case AudioMsg::SEEK_DONE:
+ handleVSeekDone(pMsg);
+ break;
+ case VideoMsg::FRAME:
+ returnFrame(dynamic_pointer_cast<VideoMsg>(pMsg));
+ break;
+ case VideoMsg::VDPAU_FRAME:
+#ifdef AVG_ENABLE_VDPAU
+ unlockVDPAUSurface(pMsg->getRenderState());
+#endif
+ break;
+ case VideoMsg::END_OF_FILE:
+ m_NumVSeeksDone = m_NumSeeksSent;
+ m_bVideoEOF = true;
+ break;
+ default:
+ // TODO: Handle ERROR messages here.
+ AVG_ASSERT(false);
+ }
+}
+
+void AsyncVideoDecoder::handleVSeekDone(AudioMsgPtr pMsg)
+{
+ m_LastVideoFrameTime = pMsg->getSeekTime() - 1/m_FPS;
+ if (m_NumVSeeksDone < pMsg->getSeekSeqNum()) {
+ m_NumVSeeksDone = pMsg->getSeekSeqNum();
+ }
+}
+
+void AsyncVideoDecoder::handleAudioMsg(AudioMsgPtr pMsg)
+{
+ switch (pMsg->getType()) {
+ case AudioMsg::END_OF_FILE:
+ case AudioMsg::ERROR:
+ m_bAudioEOF = true;
+ break;
+ case AudioMsg::SEEK_DONE:
+// pMsg->dump();
+ m_bAudioEOF = false;
+ m_LastAudioFrameTime = pMsg->getSeekTime();
+ if (m_NumASeeksDone < pMsg->getSeekSeqNum()) {
+ m_NumASeeksDone = pMsg->getSeekSeqNum();
}
- } while (m_bSeekPending);
+ break;
+ case AudioMsg::AUDIO_TIME:
+ m_LastAudioFrameTime = pMsg->getAudioTime();
+ break;
+ default:
+ // Unhandled message type.
+ pMsg->dump();
+ AVG_ASSERT(false);
}
}
-void AsyncVideoDecoder::returnFrame(VideoMsgPtr& pFrameMsg)
+void AsyncVideoDecoder::returnFrame(VideoMsgPtr pFrameMsg)
{
if (pFrameMsg) {
+ AVG_ASSERT(pFrameMsg->getType() == VideoMsg::FRAME);
m_pVCmdQ->pushCmd(boost::bind(&VideoDecoderThread::returnFrame, _1, pFrameMsg));
}
}
+bool AsyncVideoDecoder::isSeeking() const
+{
+ return (m_NumSeeksSent > m_NumVSeeksDone || m_NumSeeksSent > m_NumASeeksDone);
+}
+
+bool AsyncVideoDecoder::isVSeeking() const
+{
+ return m_NumSeeksSent > m_NumVSeeksDone;
+}
+
}
diff --git a/src/video/AsyncVideoDecoder.h b/src/video/AsyncVideoDecoder.h
index b90c35b..7773831 100644
--- a/src/video/AsyncVideoDecoder.h
+++ b/src/video/AsyncVideoDecoder.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -24,6 +24,7 @@
#include "../api.h"
#include "VideoDecoder.h"
+#include "VideoDemuxerThread.h"
#include "VideoDecoderThread.h"
#include "AudioDecoderThread.h"
#include "VideoMsg.h"
@@ -40,76 +41,77 @@ namespace avg {
class AVG_API AsyncVideoDecoder: public VideoDecoder
{
public:
- AsyncVideoDecoder(VideoDecoderPtr pSyncDecoder, int queueLength);
+ AsyncVideoDecoder(int queueLength);
virtual ~AsyncVideoDecoder();
- virtual void open(const std::string& sFilename, bool bSyncDemuxer,
- bool bUseHardwareAccelleration);
+ virtual void open(const std::string& sFilename, bool bUseHardwareAcceleration,
+ bool bEnableSound);
virtual void startDecoding(bool bDeliverYCbCr, const AudioParams* pAP);
virtual void close();
- virtual DecoderState getState() const;
- virtual VideoInfo getVideoInfo() const;
- virtual void seek(double destTime);
+ virtual void seek(float destTime);
virtual void loop();
- virtual IntPoint getSize() const;
virtual int getCurFrame() const;
virtual int getNumFramesQueued() const;
- virtual double getCurTime(StreamSelect stream = SS_DEFAULT) const;
- virtual double getNominalFPS() const;
- virtual double getFPS() const;
- virtual void setFPS(double fps);
- virtual double getVolume() const;
- virtual void setVolume(double volume);
- virtual PixelFormat getPixelFormat() const;
+ virtual float getCurTime() const;
+ virtual float getFPS() const;
+ virtual void setFPS(float fps);
virtual FrameAvailableCode renderToBmps(std::vector<BitmapPtr>& pBmps,
- double timeWanted);
- virtual bool isEOF(StreamSelect stream = SS_ALL) const;
- virtual void throwAwayFrame(double timeWanted);
-
- virtual int fillAudioBuffer(AudioBufferPtr pBuffer);
-
+ float timeWanted);
+ void updateAudioStatus();
+ virtual bool isEOF() const;
+ virtual void throwAwayFrame(float timeWanted);
+
+ AudioMsgQueuePtr getAudioMsgQ();
+ AudioMsgQueuePtr getAudioStatusQ() const;
+
private:
- VideoMsgPtr getBmpsForTime(double timeWanted, FrameAvailableCode& frameAvailable);
+ void setupDemuxer(std::vector<int> streamIndexes);
+ void deleteDemuxer();
+ VideoMsgPtr getBmpsForTime(float timeWanted, FrameAvailableCode& frameAvailable);
VideoMsgPtr getNextBmps(bool bWait);
void waitForSeekDone();
- void returnFrame(VideoMsgPtr& pFrameMsg);
+ void checkForSeekDone();
+ void handleVSeekMsg(VideoMsgPtr pMsg);
+ void handleVSeekDone(AudioMsgPtr pMsg);
+ void handleAudioMsg(AudioMsgPtr pMsg);
+ void returnFrame(VideoMsgPtr pFrameMsg);
+ bool isSeeking() const;
+ bool isVSeeking() const;
- DecoderState m_State;
- VideoDecoderPtr m_pSyncDecoder;
- std::string m_sFilename;
int m_QueueLength;
+ boost::thread* m_pDemuxThread;
+ std::map<int, VideoMsgQueuePtr> m_PacketQs;
+ VideoDemuxerThread::CQueuePtr m_pDemuxCmdQ;
+
boost::thread* m_pVDecoderThread;
VideoDecoderThread::CQueuePtr m_pVCmdQ;
VideoMsgQueuePtr m_pVMsgQ;
boost::thread* m_pADecoderThread;
- boost::mutex m_AudioMutex;
AudioDecoderThread::CQueuePtr m_pACmdQ;
- VideoMsgQueuePtr m_pAMsgQ;
- VideoMsgPtr m_pAudioMsg;
- unsigned char* m_AudioMsgData;
- int m_AudioMsgSize;
+ AudioMsgQueuePtr m_pAMsgQ;
+ AudioMsgQueuePtr m_pAStatusQ;
- VideoInfo m_VideoInfo;
-
- IntPoint m_Size;
- int m_NumFrames;
bool m_bUseStreamFPS;
- PixelFormat m_PF;
+ float m_FPS;
+ int m_NumSeeksSent;
+ int m_NumVSeeksDone;
+ int m_NumASeeksDone;
+ bool m_bWasVSeeking;
+ bool m_bWasSeeking;
+
bool m_bAudioEOF;
bool m_bVideoEOF;
- bool m_bSeekPending;
- boost::mutex m_SeekMutex;
- double m_Volume;
- double m_LastVideoFrameTime;
- double m_LastAudioFrameTime;
-
- bool m_bUsesVDPAU;
+ float m_LastVideoFrameTime;
+ float m_CurVideoFrameTime;
+ float m_LastAudioFrameTime;
};
+typedef boost::shared_ptr<AsyncVideoDecoder> AsyncVideoDecoderPtr;
+
}
#endif
diff --git a/src/video/AudioDecoderThread.cpp b/src/video/AudioDecoderThread.cpp
index 495b0da..e704383 100644
--- a/src/video/AudioDecoderThread.cpp
+++ b/src/video/AudioDecoderThread.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -25,69 +25,300 @@
#include "../base/Logger.h"
#include "../base/TimeSource.h"
+#include "../base/ScopeTimer.h"
-// In Audio frames.
-#define AUDIO_BUFFER_SIZE 256
+#if AVUTIL_VERSION_INT > AV_VERSION_INT(52, 0, 0)
+#include <libavutil/samplefmt.h>
+#endif
+
+#ifndef AVCODEC_MAX_AUDIO_FRAME_SIZE
+ #define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000
+#endif
using namespace std;
namespace avg {
-AudioDecoderThread::AudioDecoderThread(CQueue& cmdQ, VideoMsgQueue& msgQ,
- VideoDecoderPtr pDecoder, const AudioParams& ap)
+AudioDecoderThread::AudioDecoderThread(CQueue& cmdQ, AudioMsgQueue& msgQ,
+ VideoMsgQueue& packetQ, AVStream* pStream, const AudioParams& ap)
: WorkerThread<AudioDecoderThread>(string("AudioDecoderThread"), cmdQ),
m_MsgQ(msgQ),
- m_pDecoder(pDecoder),
- m_AP(ap)
+ m_PacketQ(packetQ),
+ m_AP(ap),
+ m_pStream(pStream),
+ m_pResampleContext(0),
+ m_State(DECODING)
{
+ m_LastFrameTime = 0;
+ m_AudioStartTimestamp = 0;
+
+ if (m_pStream->start_time != (long long)AV_NOPTS_VALUE) {
+ m_AudioStartTimestamp = float(av_q2d(m_pStream->time_base)*m_pStream->start_time);
+ }
+ m_InputSampleRate = (int)(m_pStream->codec->sample_rate);
+ m_InputSampleFormat = m_pStream->codec->sample_fmt;
}
AudioDecoderThread::~AudioDecoderThread()
{
+ if (m_pResampleContext) {
+ audio_resample_close(m_pResampleContext);
+ m_pResampleContext = 0;
+ }
}
+static ProfilingZoneID DecoderProfilingZone("Audio Decoder Thread", true);
+static ProfilingZoneID PacketWaitProfilingZone("Audio Wait for packet", true);
+
bool AudioDecoderThread::work()
{
- if (m_pDecoder->isEOF(SS_AUDIO)) {
- // replace this with waitForMessage()
- msleep(10);
- } else {
- AudioBufferPtr pBuffer(new AudioBuffer(AUDIO_BUFFER_SIZE, m_AP));
- int framesWritten = m_pDecoder->fillAudioBuffer(pBuffer);
- if (framesWritten != AUDIO_BUFFER_SIZE) {
- AudioBufferPtr pOldBuffer = pBuffer;
- pBuffer = AudioBufferPtr(new AudioBuffer(framesWritten, m_AP));
- memcpy(pBuffer->getData(), pOldBuffer->getData(),
- framesWritten*m_AP.m_Channels*sizeof(short));
- }
- VideoMsgPtr pVMsg = VideoMsgPtr(new VideoMsg());
- pVMsg->setAudio(pBuffer, m_pDecoder->getCurTime(SS_AUDIO));
- m_MsgQ.push(pVMsg);
- if (m_pDecoder->isEOF(SS_AUDIO)) {
- VideoMsgPtr pVMsg = VideoMsgPtr(new VideoMsg());
- pVMsg->setEOF();
- m_MsgQ.push(pVMsg);
+ ScopeTimer timer(DecoderProfilingZone);
+ VideoMsgPtr pMsg;
+ {
+ ScopeTimer timer(PacketWaitProfilingZone);
+ pMsg = m_PacketQ.pop(true);
+ }
+ switch (pMsg->getType()) {
+ case VideoMsg::PACKET: {
+ AVPacket* pPacket = pMsg->getPacket();
+ switch(m_State) {
+ case DECODING:
+ decodePacket(pPacket);
+ break;
+ case SEEK_DONE:
+ handleSeekDone(pPacket);
+ break;
+ case DISCARDING:
+ discardPacket(pPacket);
+ break;
+ default:
+ AVG_ASSERT(false);
+ }
+ av_free_packet(pPacket);
+ delete pPacket;
+ break;
}
- ThreadProfiler::get()->reset();
+ case VideoMsg::SEEK_DONE:
+ m_State = SEEK_DONE;
+ m_SeekSeqNum = pMsg->getSeekSeqNum();
+ m_SeekTime = pMsg->getSeekTime();
+ break;
+ case VideoMsg::END_OF_FILE:
+ pushEOF();
+ break;
+ case VideoMsg::CLOSED:
+ m_MsgQ.clear();
+ stop();
+ break;
+ default:
+ pMsg->dump();
+ AVG_ASSERT(false);
}
+ ThreadProfiler::get()->reset();
return true;
}
-void AudioDecoderThread::seek(double destTime)
+void AudioDecoderThread::decodePacket(AVPacket* pPacket)
+{
+ char* pDecodedData = (char*)av_malloc(AVCODEC_MAX_AUDIO_FRAME_SIZE +
+ FF_INPUT_BUFFER_PADDING_SIZE);
+ AVPacket* pTempPacket = new AVPacket;
+ av_init_packet(pTempPacket);
+ pTempPacket->data = pPacket->data;
+ pTempPacket->size = pPacket->size;
+ while (pTempPacket->size > 0) {
+ int bytesDecoded = AVCODEC_MAX_AUDIO_FRAME_SIZE;
+#if LIBAVCODEC_VERSION_INT > AV_VERSION_INT(52, 31, 0)
+ int bytesConsumed = avcodec_decode_audio3(m_pStream->codec, (short*)pDecodedData,
+ &bytesDecoded, pTempPacket);
+#else
+ int bytesConsumed = avcodec_decode_audio2(m_pStream->codec, (short*)pDecodedData,
+ &bytesDecoded, pTempPacket->data, pTempPacket->size);
+#endif
+// This is triggered for some strange/broken videos.
+// AVG_ASSERT(bytesConsumed != 0);
+ if (bytesConsumed < 0) {
+ // Error decoding -> throw away current packet.
+ bytesDecoded = 0;
+ pTempPacket->size = 0;
+ } else {
+ pTempPacket->data += bytesConsumed;
+ pTempPacket->size -= bytesConsumed;
+ }
+ if (bytesDecoded > 0) {
+ int framesDecoded = bytesDecoded/(m_pStream->codec->channels*
+ getBytesPerSample(m_InputSampleFormat));
+ AudioBufferPtr pBuffer;
+ bool bNeedsResample = (m_InputSampleRate != m_AP.m_SampleRate ||
+ m_InputSampleFormat != SAMPLE_FMT_S16 ||
+ m_pStream->codec->channels != m_AP.m_Channels);
+ bool bIsPlanar = false;
+#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(51, 27, 0)
+ bIsPlanar = av_sample_fmt_is_planar((SampleFormat)m_InputSampleFormat);
+ if (bIsPlanar) {
+ char* pPackedData = (char*)av_malloc(AVCODEC_MAX_AUDIO_FRAME_SIZE +
+ FF_INPUT_BUFFER_PADDING_SIZE);
+ planarToInterleaved(pPackedData, pDecodedData, m_pStream->codec->channels,
+ m_pStream->codec->frame_size);
+ pBuffer = resampleAudio(pPackedData, framesDecoded,
+ av_get_packed_sample_fmt((SampleFormat)m_InputSampleFormat));
+ av_free(pPackedData);
+ bNeedsResample = false;
+ }
+#endif
+ if (bNeedsResample) {
+ pBuffer = resampleAudio(pDecodedData, framesDecoded,
+ m_InputSampleFormat);
+ } else if (!bIsPlanar) {
+ pBuffer = AudioBufferPtr(new AudioBuffer(framesDecoded, m_AP));
+ memcpy(pBuffer->getData(), pDecodedData, bytesDecoded);
+ }
+ m_LastFrameTime += float(pBuffer->getNumFrames())/m_AP.m_SampleRate;
+ pushAudioMsg(pBuffer, m_LastFrameTime);
+ }
+ }
+ av_free(pDecodedData);
+ delete pTempPacket;
+}
+
+void AudioDecoderThread::handleSeekDone(AVPacket* pPacket)
+{
+ m_MsgQ.clear();
+ m_LastFrameTime = float(pPacket->dts*av_q2d(m_pStream->time_base))
+ - m_AudioStartTimestamp;
+
+ if (fabs(m_LastFrameTime - m_SeekTime) < 0.01) {
+ pushSeekDone(m_LastFrameTime, m_SeekSeqNum);
+ decodePacket(pPacket);
+ m_State = DECODING;
+ } else {
+ if (m_LastFrameTime-0.01f < m_SeekTime) {
+ // Received frame that's earlier than the destination, so throw away frames
+ // until the time is correct.
+ m_State = DISCARDING;
+ } else {
+ // Received frame that's too late, so insert a buffer of silence to
+ // compensate.
+ insertSilence(m_LastFrameTime - m_SeekTime);
+ m_LastFrameTime = m_SeekTime;
+ pushSeekDone(m_LastFrameTime, m_SeekSeqNum);
+ decodePacket(pPacket);
+ m_State = DECODING;
+ }
+ }
+}
+
+void AudioDecoderThread::discardPacket(AVPacket* pPacket)
+{
+ m_LastFrameTime = float(pPacket->dts*av_q2d(m_pStream->time_base))
+ - m_AudioStartTimestamp;
+ if (m_LastFrameTime-0.01f > m_SeekTime) {
+ pushSeekDone(m_LastFrameTime, m_SeekSeqNum);
+ m_State = DECODING;
+ }
+}
+
+AudioBufferPtr AudioDecoderThread::resampleAudio(char* pDecodedData, int framesDecoded,
+ int currentSampleFormat)
+{
+ if (!m_pResampleContext) {
+#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(52, 24, 0)
+ m_pResampleContext = av_audio_resample_init(m_AP.m_Channels,
+ m_pStream->codec->channels, m_AP.m_SampleRate, m_InputSampleRate,
+ SAMPLE_FMT_S16, (SampleFormat)currentSampleFormat, 16, 10, 0, 0.8);
+#else
+ m_pResampleContext = audio_resample_init(m_AP.m_Channels,
+ m_pStream->codec->channels, m_AP.m_SampleRate, m_InputSampleRate);
+#endif
+ AVG_ASSERT(m_pResampleContext);
+ }
+
+ short pResampledData[AVCODEC_MAX_AUDIO_FRAME_SIZE/2];
+ int framesResampled = audio_resample(m_pResampleContext, pResampledData,
+ (short*)pDecodedData, framesDecoded);
+ AudioBufferPtr pBuffer(new AudioBuffer(framesResampled, m_AP));
+ memcpy(pBuffer->getData(), pResampledData,
+ framesResampled*m_AP.m_Channels*sizeof(short));
+ return pBuffer;
+}
+
+void AudioDecoderThread::planarToInterleaved(char* pOutput, char* pInput, int numChannels,
+ int numSamples)
{
- while (!m_MsgQ.empty()) {
- m_MsgQ.pop(false);
+ AVG_ASSERT(numChannels <= 8);
+ if (numSamples == 0) {
+ // Fishy, some ogg files have no proper frame_size set. But outputBufferSamples
+ // worked for sample ogg file.
+ numSamples = m_AP.m_OutputBufferSamples;
+ }
+ int i, j;
+ int bytesPerSample = getBytesPerSample(m_InputSampleFormat);
+ char * pPlanes[8] = {};
+ for (i=0; i<numChannels; i++) {
+ pPlanes[i] = pInput + i*(numSamples*bytesPerSample);
+ }
+ for (i=0; i<numSamples; i++) {
+ for (j=0; j<numChannels; j++) {
+ memcpy(pOutput, pPlanes[j], bytesPerSample);
+ pOutput += bytesPerSample;
+ pPlanes[j] += bytesPerSample;
+ }
}
-
- m_pDecoder->seek(destTime);
- VideoMsgPtr pVMsg = VideoMsgPtr(new VideoMsg());
- pVMsg->setSeekDone(-1, m_pDecoder->getCurTime(SS_AUDIO));
- m_MsgQ.push(pVMsg);
}
-void AudioDecoderThread::setVolume(double volume)
+void AudioDecoderThread::insertSilence(float duration)
{
- m_pDecoder->setVolume(volume);
+ int numDelaySamples = int(duration*m_AP.m_SampleRate);
+ AudioBufferPtr pBuffer(new AudioBuffer(numDelaySamples, m_AP));
+ pBuffer->clear();
+ pushAudioMsg(pBuffer, m_LastFrameTime);
+}
+
+void AudioDecoderThread::pushAudioMsg(AudioBufferPtr pBuffer, float time)
+{
+ VideoMsgPtr pMsg(new VideoMsg());
+ pMsg->setAudio(pBuffer, time);
+ m_MsgQ.push(pMsg);
+}
+
+void AudioDecoderThread::pushSeekDone(float time, int seqNum)
+{
+ VideoMsgPtr pMsg(new VideoMsg());
+ pMsg->setSeekDone(seqNum, time);
+ m_MsgQ.push(pMsg);
+}
+
+void AudioDecoderThread::pushEOF()
+{
+ VideoMsgPtr pMsg(new VideoMsg());
+ pMsg->setEOF();
+ m_MsgQ.push(pMsg);
+}
+
+int AudioDecoderThread::getBytesPerSample(int sampleFormat)
+{
+ switch (sampleFormat) {
+ case SAMPLE_FMT_U8:
+ return 1;
+ case SAMPLE_FMT_S16:
+ return 2;
+ case SAMPLE_FMT_S32:
+ return 4;
+ case SAMPLE_FMT_FLT:
+ return 4;
+ case SAMPLE_FMT_DBL:
+ return 8;
+#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(52, 3, 0)
+ case SAMPLE_FMT_S16P:
+ return 2;
+ case SAMPLE_FMT_FLTP:
+ return 4;
+#endif
+ default:
+ AVG_LOG_ERROR("Unknown SampleFormat: " << sampleFormat << "\n");
+ AVG_ASSERT(false);
+ return 0;
+ }
}
}
diff --git a/src/video/AudioDecoderThread.h b/src/video/AudioDecoderThread.h
index 71a5d7b..f932c75 100644
--- a/src/video/AudioDecoderThread.h
+++ b/src/video/AudioDecoderThread.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -25,13 +25,14 @@
#define _AudioDecoderThread_H_
#include "../avgconfigwrapper.h"
-#include "VideoDecoder.h"
#include "VideoMsg.h"
#include "../base/WorkerThread.h"
#include "../base/Command.h"
#include "../audio/AudioParams.h"
+#include "WrapFFMpeg.h"
+
#include <boost/thread.hpp>
#include <string>
@@ -40,18 +41,42 @@ namespace avg {
class AVG_API AudioDecoderThread : public WorkerThread<AudioDecoderThread> {
public:
- AudioDecoderThread(CQueue& cmdQ, VideoMsgQueue& msgQ,
- VideoDecoderPtr pDecoder, const AudioParams& ap);
+ AudioDecoderThread(CQueue& cmdQ, AudioMsgQueue& msgQ, VideoMsgQueue& packetQ,
+ AVStream* pStream, const AudioParams& ap);
virtual ~AudioDecoderThread();
bool work();
- void seek(double destTime);
- void setVolume(double volume);
private:
- VideoMsgQueue& m_MsgQ;
- VideoDecoderPtr m_pDecoder;
+ void decodePacket(AVPacket* pPacket);
+ void handleSeekDone(AVPacket* pPacket);
+ void discardPacket(AVPacket* pPacket);
+ AudioBufferPtr resampleAudio(char* pDecodedData, int framesDecoded,
+ int currentSampleFormat);
+ void insertSilence(float duration);
+ void planarToInterleaved(char* pOutput, char* pInput, int numChannels,
+ int numSamples);
+ void pushAudioMsg(AudioBufferPtr pBuffer, float time);
+ void pushSeekDone(float time, int seqNum);
+ void pushEOF();
+ int getBytesPerSample(int sampleFormat);
+
+ AudioMsgQueue& m_MsgQ;
+ VideoMsgQueue& m_PacketQ;
AudioParams m_AP;
+
+ AVStream * m_pStream;
+
+ int m_InputSampleRate;
+ int m_InputSampleFormat;
+ ReSampleContext * m_pResampleContext;
+ float m_AudioStartTimestamp;
+ float m_LastFrameTime;
+
+ enum State {DECODING, SEEK_DONE, DISCARDING};
+ State m_State;
+ int m_SeekSeqNum;
+ float m_SeekTime;
};
}
diff --git a/src/video/FFMpegDecoder.cpp b/src/video/FFMpegDecoder.cpp
deleted file mode 100644
index f705375..0000000
--- a/src/video/FFMpegDecoder.cpp
+++ /dev/null
@@ -1,1208 +0,0 @@
-//
-// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 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 "FFMpegDecoder.h"
-#include "AsyncDemuxer.h"
-#include "FFMpegDemuxer.h"
-
-#include "../base/Exception.h"
-#include "../base/Logger.h"
-#include "../base/ScopeTimer.h"
-#include "../base/ObjectCounter.h"
-
-#include "../graphics/Filterflipuv.h"
-#include "../graphics/Filterfliprgba.h"
-
-#include <iostream>
-#include <sstream>
-#ifndef _WIN32
-#include <unistd.h>
-#endif
-#include <errno.h>
-
-using namespace std;
-using namespace boost;
-
-#define SAMPLE_BUFFER_SIZE ((AVCODEC_MAX_AUDIO_FRAME_SIZE*3))
-#define VOLUME_FADE_SAMPLES 100
-
-namespace avg {
-
-bool FFMpegDecoder::s_bInitialized = false;
-mutex FFMpegDecoder::s_OpenMutex;
-
-FFMpegDecoder::FFMpegDecoder()
- : m_State(CLOSED),
- m_pFormatContext(0),
- m_PF(NO_PIXELFORMAT),
- m_pSwsContext(0),
- m_Size(0,0),
- m_bUseStreamFPS(true),
- m_AStreamIndex(-1),
- m_pSampleBuffer(0),
- m_pResampleBuffer(0),
- m_pAudioResampleContext(0),
- m_Volume(1.0),
- m_LastVolume(1.0),
- m_pDemuxer(0),
- m_pVStream(0),
- m_pAStream(0),
-#ifdef AVG_ENABLE_VDPAU
- m_VDPAU(),
- m_Opaque(&m_VDPAU),
-#endif
- m_VStreamIndex(-1),
- m_bFirstPacket(false),
- m_VideoStartTimestamp(-1),
- m_LastVideoFrameTime(-1),
- m_FPS(0)
-{
- ObjectCounter::get()->incRef(&typeid(*this));
- initVideoSupport();
-}
-
-FFMpegDecoder::~FFMpegDecoder()
-{
- if (m_pFormatContext) {
- close();
- }
- ObjectCounter::get()->decRef(&typeid(*this));
-}
-
-void avcodecError(const string& sFilename, int err)
-{
-#if LIBAVFORMAT_VERSION_MAJOR > 52
- char buf[256];
- av_strerror(err, buf, 256);
- throw Exception(AVG_ERR_VIDEO_INIT_FAILED, sFilename + ": " + buf);
-#else
- switch(err) {
- case AVERROR_NUMEXPECTED:
- throw Exception(AVG_ERR_VIDEO_INIT_FAILED,
- sFilename + ": Incorrect image filename syntax (use %%d to specify the image number:");
- case AVERROR_INVALIDDATA:
- throw Exception(AVG_ERR_VIDEO_INIT_FAILED,
- sFilename + ": Error while parsing header");
- case AVERROR_NOFMT:
- throw Exception(AVG_ERR_VIDEO_INIT_FAILED,
- sFilename + ": Unknown format");
- default:
- stringstream s;
- s << "'" << sFilename << "': Error while opening file (Num:" << err << ")";
- throw Exception(AVG_ERR_VIDEO_INIT_FAILED, s.str());
- }
-#endif
-}
-
-int FFMpegDecoder::openCodec(int streamIndex, bool bUseHardwareAcceleration)
-{
- AVCodecContext* pContext;
- pContext = m_pFormatContext->streams[streamIndex]->codec;
-// pContext->debug = 0x0001; // see avcodec.h
-
- AVCodec * pCodec = 0;
-#ifdef AVG_ENABLE_VDPAU
- if (bUseHardwareAcceleration) {
- pContext->opaque = &m_Opaque;
- pCodec = m_VDPAU.openCodec(pContext);
- } else {
- pCodec = avcodec_find_decoder(pContext->codec_id);
- }
-#else
- pCodec = avcodec_find_decoder(pContext->codec_id);
-#endif
- if (!pCodec || avcodec_open(pContext, pCodec) < 0) {
- return -1;
- }
- return 0;
-}
-
-void FFMpegDecoder::open(const string& sFilename, bool bThreadedDemuxer,
- bool bUseHardwareAcceleration)
-{
- mutex::scoped_lock lock(s_OpenMutex);
- m_bThreadedDemuxer = bThreadedDemuxer;
- m_bAudioEOF = false;
- m_bVideoEOF = false;
- m_bEOFPending = false;
- m_VideoStartTimestamp = -1;
- int err;
- m_sFilename = sFilename;
-
- AVG_TRACE(Logger::MEMORY, "Opening " << sFilename);
-#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(53,2,0)
- err = avformat_open_input(&m_pFormatContext, sFilename.c_str(), 0, 0);
-#else
- AVFormatParameters params;
- memset(&params, 0, sizeof(params));
- err = av_open_input_file(&m_pFormatContext, sFilename.c_str(),
- 0, 0, &params);
-#endif
- if (err < 0) {
- m_sFilename = "";
- avcodecError(sFilename, err);
- }
-
- err = av_find_stream_info(m_pFormatContext);
- if (err < 0) {
- throw Exception(AVG_ERR_VIDEO_INIT_FAILED,
- sFilename + ": Could not find codec parameters.");
- }
-// dump_format(m_pFormatContext, 0, sFilename.c_str(), false);
- av_read_play(m_pFormatContext);
-
- // Find audio and video streams in the file
- m_VStreamIndex = -1;
- m_AStreamIndex = -1;
- for (unsigned i = 0; i < m_pFormatContext->nb_streams; i++) {
- AVCodecContext* pContext = m_pFormatContext->streams[i]->codec;
- switch (pContext->codec_type) {
- case AVMEDIA_TYPE_VIDEO:
- if (m_VStreamIndex < 0) {
- m_VStreamIndex = i;
- }
- break;
- case AVMEDIA_TYPE_AUDIO:
- // Ignore the audio stream if we're using sync demuxing.
- if (m_AStreamIndex < 0 && bThreadedDemuxer) {
- m_AStreamIndex = i;
- }
- break;
- default:
- break;
- }
- }
-
- // Enable video stream demuxing
- if (m_VStreamIndex >= 0) {
- m_pVStream = m_pFormatContext->streams[m_VStreamIndex];
- m_State = OPENED;
-
- // Set video parameters
- m_TimeUnitsPerSecond = 1.0/av_q2d(m_pVStream->time_base);
- if (m_bUseStreamFPS) {
- m_FPS = getNominalFPS();
- }
- m_Size = IntPoint(m_pVStream->codec->width, m_pVStream->codec->height);
- m_bFirstPacket = true;
- m_sFilename = sFilename;
- m_LastVideoFrameTime = -1;
-
- int rc = openCodec(m_VStreamIndex, bUseHardwareAcceleration);
- if (rc == -1) {
- m_VStreamIndex = -1;
- char szBuf[256];
- avcodec_string(szBuf, sizeof(szBuf), m_pVStream->codec, 0);
- throw Exception(AVG_ERR_VIDEO_INIT_FAILED,
- sFilename + ": unsupported codec ("+szBuf+").");
- }
- m_PF = calcPixelFormat(true);
- }
- // Enable audio stream demuxing.
- if (m_AStreamIndex >= 0) {
- m_pAStream = m_pFormatContext->streams[m_AStreamIndex];
-
- m_AudioPacket = 0;
- m_AudioPacketData = 0;
- m_AudioPacketSize = 0;
-
- m_LastAudioFrameTime = 0;
- m_AudioStartTimestamp = 0;
-
- if ((unsigned long long)m_pAStream->start_time != AV_NOPTS_VALUE) {
- m_AudioStartTimestamp = double(av_q2d(m_pAStream->time_base))
- *m_pAStream->start_time;
- }
- m_EffectiveSampleRate = (int)(m_pAStream->codec->sample_rate);
- int rc = openCodec(m_AStreamIndex, bUseHardwareAcceleration);
- if (rc == -1) {
- m_AStreamIndex = -1;
- char szBuf[256];
- avcodec_string(szBuf, sizeof(szBuf), m_pAStream->codec, 0);
- m_pAStream = 0;
- AVG_TRACE(Logger::WARNING,
- sFilename + ": unsupported codec ("+szBuf+"). Disabling audio.");
- }
- if (m_pAStream->codec->sample_fmt != SAMPLE_FMT_S16) {
- m_AStreamIndex = -1;
- m_pAStream = 0;
- AVG_TRACE(Logger::WARNING,
- sFilename + ": unsupported sample format (!= S16). Disabling audio.");
- }
- }
-
- m_State = OPENED;
-}
-
-void FFMpegDecoder::startDecoding(bool bDeliverYCbCr, const AudioParams* pAP)
-{
-#ifdef AVG_ENABLE_VDPAU
- m_VDPAU.init();
-#endif
- AVG_ASSERT(m_State == OPENED);
- if (m_VStreamIndex >= 0) {
- m_PF = calcPixelFormat(bDeliverYCbCr);
- }
- bool bAudioEnabled = (pAP && m_bThreadedDemuxer);
- if (bAudioEnabled) {
- m_AP = *pAP;
- } else {
- m_AStreamIndex = -1;
- if (m_pAStream) {
- avcodec_close(m_pAStream->codec);
- }
- m_pAStream = 0;
- }
-
- if (m_AStreamIndex >= 0) {
- if (m_pAStream->codec->channels > m_AP.m_Channels) {
- AVG_TRACE(Logger::WARNING,
- m_sFilename << ": unsupported number of channels (" <<
- m_pAStream->codec->channels << "). Disabling audio.");
- m_AStreamIndex = -1;
- m_pAStream = 0;
- } else {
- m_pSampleBuffer = (char*)av_mallocz(SAMPLE_BUFFER_SIZE);
- m_SampleBufferStart = 0;
- m_SampleBufferEnd = 0;
- m_SampleBufferLeft = SAMPLE_BUFFER_SIZE;
-
- m_ResampleBufferSize = 0;
- m_pResampleBuffer = 0;
- m_ResampleBufferStart = 0;
- m_ResampleBufferEnd = 0;
- }
- }
-
- if (m_VStreamIndex < 0 && m_AStreamIndex < 0) {
- throw Exception(AVG_ERR_VIDEO_INIT_FAILED,
- m_sFilename + " does not contain any valid audio or video streams.");
- }
-
- // Create demuxer
- AVG_ASSERT(!m_pDemuxer);
- vector<int> streamIndexes;
- if (m_VStreamIndex >= 0) {
- streamIndexes.push_back(m_VStreamIndex);
- }
- if (m_AStreamIndex >= 0) {
- streamIndexes.push_back(m_AStreamIndex);
- }
- if (m_bThreadedDemuxer) {
- m_pDemuxer = new AsyncDemuxer(m_pFormatContext, streamIndexes);
- } else {
- m_pDemuxer = new FFMpegDemuxer(m_pFormatContext, streamIndexes);
- }
-
- m_State = DECODING;
-}
-
-void FFMpegDecoder::close()
-{
- mutex::scoped_lock lock(s_OpenMutex);
- mutex::scoped_lock lock2(m_AudioMutex);
- AVG_TRACE(Logger::MEMORY, "Closing " << m_sFilename);
-
- delete m_pDemuxer;
- m_pDemuxer = 0;
-
- // Close audio and video codecs
- if (m_pVStream) {
- avcodec_close(m_pVStream->codec);
- m_pVStream = 0;
- m_VStreamIndex = -1;
- }
-
- if (m_pAStream) {
- avcodec_close(m_pAStream->codec);
- if (m_AudioPacket) {
- av_free_packet(m_AudioPacket);
- delete m_AudioPacket;
- m_AudioPacket = 0;
- }
- if (m_pAudioResampleContext) {
- audio_resample_close(m_pAudioResampleContext);
- m_pAudioResampleContext = 0;
- }
-
- if (m_pSampleBuffer) {
- av_free(m_pSampleBuffer);
- m_pSampleBuffer = 0;
- }
- if (m_pResampleBuffer) {
- av_free(m_pResampleBuffer);
- m_pResampleBuffer = 0;
- }
-
- m_AudioPacketData = 0;
- m_AudioPacketSize = 0;
-
- m_SampleBufferStart = 0;
- m_SampleBufferEnd = 0;
- m_SampleBufferLeft = 0;
-
- m_ResampleBufferStart = 0;
- m_ResampleBufferEnd = 0;
- m_ResampleBufferSize = 0;
-
- m_LastAudioFrameTime = 0;
- m_AudioStartTimestamp = 0;
-
- m_pAStream = 0;
- m_AStreamIndex = -1;
- }
- if (m_pFormatContext) {
- av_close_input_file(m_pFormatContext);
- m_pFormatContext = 0;
- }
-
- if (m_pSwsContext) {
- sws_freeContext(m_pSwsContext);
- m_pSwsContext = 0;
- }
- m_State = CLOSED;
-}
-
-VideoDecoder::DecoderState FFMpegDecoder::getState() const
-{
- return m_State;
-}
-
-VideoInfo FFMpegDecoder::getVideoInfo() const
-{
- AVG_ASSERT(m_State != CLOSED);
- double duration = 0;
- if (m_pVStream || m_pAStream) {
- duration = getDuration();
- }
- VideoInfo info(duration, m_pFormatContext->bit_rate, m_pVStream != 0,
- m_pAStream != 0);
- if (m_pVStream) {
- info.setVideoData(m_Size, getStreamPF(), getNumFrames(), getNominalFPS(), m_FPS,
- m_pVStream->codec->codec->name, usesVDPAU());
- }
- if (m_pAStream) {
- AVCodecContext * pACodec = m_pAStream->codec;
- info.setAudioData(pACodec->codec->name, pACodec->sample_rate,
- pACodec->channels);
- }
- return info;
-}
-
-void FFMpegDecoder::seek(double destTime)
-{
- AVG_ASSERT(m_State == DECODING);
- if (m_bFirstPacket && m_pVStream) {
- AVFrame frame;
- readFrame(frame);
- }
- m_pDemuxer->seek(destTime + getStartTime());
- if (m_pVStream) {
- m_LastVideoFrameTime = destTime - 1.0/m_FPS;
- }
- if (m_pAStream) {
- mutex::scoped_lock lock(m_AudioMutex);
- m_LastAudioFrameTime = destTime;
- m_SampleBufferStart = m_SampleBufferEnd = 0;
- m_SampleBufferLeft = SAMPLE_BUFFER_SIZE;
- m_ResampleBufferStart = m_ResampleBufferEnd = 0;
- m_AudioPacketSize = 0;
- }
- m_bVideoEOF = false;
- m_bAudioEOF = false;
-}
-
-void FFMpegDecoder::loop()
-{
- seek(0);
-}
-
-IntPoint FFMpegDecoder::getSize() const
-{
- AVG_ASSERT(m_State != CLOSED);
- return m_Size;
-}
-
-int FFMpegDecoder::getCurFrame() const
-{
- AVG_ASSERT(m_State != CLOSED);
- return int(m_LastVideoFrameTime*getNominalFPS()+0.5);
-}
-
-int FFMpegDecoder::getNumFramesQueued() const
-{
- return 0;
-}
-
-double FFMpegDecoder::getCurTime(StreamSelect stream) const
-{
- AVG_ASSERT(m_State != CLOSED);
- switch(stream) {
- case SS_DEFAULT:
- case SS_VIDEO:
- AVG_ASSERT(m_pVStream);
- return m_LastVideoFrameTime;
- case SS_AUDIO:
- AVG_ASSERT(m_pAStream);
- return m_LastAudioFrameTime;
- default:
- return -1;
- }
-}
-
-double FFMpegDecoder::getDuration() const
-{
- AVG_ASSERT(m_State != CLOSED);
- long long duration;
- AVRational time_base;
- if (m_pVStream) {
- duration = m_pVStream->duration;
- time_base = m_pVStream->time_base;
- } else {
- duration = m_pAStream->duration;
- time_base = m_pAStream->time_base;
- }
- if (duration == AV_NOPTS_VALUE) {
- return 0;
- } else {
- return double(duration)*av_q2d(time_base);
- }
-}
-
-double FFMpegDecoder::getNominalFPS() const
-{
- AVG_ASSERT(m_State != CLOSED);
- return av_q2d(m_pVStream->r_frame_rate);
-}
-
-double FFMpegDecoder::getFPS() const
-{
- AVG_ASSERT(m_State != CLOSED);
- return m_FPS;
-}
-
-void FFMpegDecoder::setFPS(double fps)
-{
- m_bUseStreamFPS = (fps == 0);
- if (fps == 0) {
- m_FPS = calcStreamFPS();
- } else {
- m_FPS = fps;
- }
-}
-
-double FFMpegDecoder::getVolume() const
-{
- AVG_ASSERT(m_State != CLOSED);
- return m_Volume;
-}
-
-void FFMpegDecoder::setVolume(double volume)
-{
- m_Volume = volume;
- if (m_State != DECODING) {
- m_LastVolume = volume;
- }
-}
-
-void copyPlaneToBmp(BitmapPtr pBmp, unsigned char * pData, int stride)
-{
- unsigned char * pSrc=pData;
- unsigned char * pDest= pBmp->getPixels();
- int destStride = pBmp->getStride();
- int height = pBmp->getSize().y;
- int width = pBmp->getSize().x;
- for (int y = 0; y < height; y++) {
- memcpy(pDest, pSrc, width);
- pSrc += stride;
- pDest += destStride;
- }
-}
-
-static ProfilingZoneID RenderToBmpProfilingZone("FFMpeg: renderToBmp");
-static ProfilingZoneID CopyImageProfilingZone("FFMpeg: copy image");
-static ProfilingZoneID VDPAUCopyProfilingZone("FFMpeg: VDPAU copy");
-
-FrameAvailableCode FFMpegDecoder::renderToBmps(vector<BitmapPtr>& pBmps,
- double timeWanted)
-{
- AVG_ASSERT(m_State == DECODING);
- ScopeTimer timer(RenderToBmpProfilingZone);
- AVFrame frame;
- FrameAvailableCode frameAvailable;
- if (timeWanted == -1) {
- readFrame(frame);
- frameAvailable = FA_NEW_FRAME;
- } else {
- frameAvailable = readFrameForTime(frame, timeWanted);
- }
- if (!m_bVideoEOF && frameAvailable == FA_NEW_FRAME) {
- if (pixelFormatIsPlanar(m_PF)) {
-#ifdef AVG_ENABLE_VDPAU
- if (usesVDPAU()) {
- ScopeTimer timer(VDPAUCopyProfilingZone);
- vdpau_render_state* pRenderState = (vdpau_render_state *)frame.data[0];
- getPlanesFromVDPAU(pRenderState, pBmps[0], pBmps[1], pBmps[2]);
- } else {
- ScopeTimer timer(CopyImageProfilingZone);
- for (unsigned i = 0; i < pBmps.size(); ++i) {
- copyPlaneToBmp(pBmps[i], frame.data[i], frame.linesize[i]);
- }
- }
-#else
- ScopeTimer timer(CopyImageProfilingZone);
- for (unsigned i = 0; i < pBmps.size(); ++i) {
- copyPlaneToBmp(pBmps[i], frame.data[i], frame.linesize[i]);
- }
-#endif
- } else {
- convertFrameToBmp(frame, pBmps[0]);
- }
- return FA_NEW_FRAME;
- }
- return FA_USE_LAST_FRAME;
-}
-
-
-#ifdef AVG_ENABLE_VDPAU
-FrameAvailableCode FFMpegDecoder::renderToVDPAU(vdpau_render_state** ppRenderState)
-{
- AVG_ASSERT(m_State == DECODING);
- ScopeTimer timer(RenderToBmpProfilingZone);
- AVFrame frame;
- FrameAvailableCode frameAvailable;
- readFrame(frame);
- frameAvailable = FA_NEW_FRAME;
- if (!m_bVideoEOF && frameAvailable == FA_NEW_FRAME) {
- if (usesVDPAU()) {
- ScopeTimer timer(VDPAUCopyProfilingZone);
- vdpau_render_state *pRenderState = (vdpau_render_state *)frame.data[0];
- *ppRenderState = pRenderState;
- }
- return FA_NEW_FRAME;
- }
- return FA_USE_LAST_FRAME;
-}
-#endif
-
-void FFMpegDecoder::throwAwayFrame(double timeWanted)
-{
- AVG_ASSERT(m_State == DECODING);
- AVFrame frame;
- readFrameForTime(frame, timeWanted);
-}
-
-bool FFMpegDecoder::isEOF(StreamSelect stream) const
-{
- AVG_ASSERT(m_State == DECODING);
- switch(stream) {
- case SS_AUDIO:
- return (!m_pAStream || m_bAudioEOF);
- case SS_VIDEO:
- return (!m_pVStream || m_bVideoEOF);
- case SS_ALL:
- return isEOF(SS_VIDEO) && isEOF(SS_AUDIO);
- default:
- return false;
- }
-}
-
-int FFMpegDecoder::copyRawAudio(unsigned char* pBuffer, int size)
-{
- int bytesWritten = min(m_SampleBufferEnd - m_SampleBufferStart, size);
- memcpy(pBuffer, m_pSampleBuffer + m_SampleBufferStart, bytesWritten);
-
- m_SampleBufferStart += bytesWritten;
-
- if (m_SampleBufferStart == m_SampleBufferEnd) {
- m_SampleBufferStart = 0;
- m_SampleBufferEnd = 0;
- m_SampleBufferLeft = SAMPLE_BUFFER_SIZE;
- }
-
- return bytesWritten;
-}
-
-int FFMpegDecoder::copyResampledAudio(unsigned char* pBuffer, int size)
-{
- int bytesWritten = 0;
-
- // If there is no buffered resampled data, resample some more
- if (m_ResampleBufferStart >= m_ResampleBufferEnd) {
- resampleAudio();
- }
-
- // If we have some data in the resample buffer, copy it over
- if (m_ResampleBufferStart < m_ResampleBufferEnd) {
- bytesWritten = min(m_ResampleBufferEnd - m_ResampleBufferStart, size);
- memcpy(pBuffer, m_pResampleBuffer + m_ResampleBufferStart, bytesWritten);
-
- m_ResampleBufferStart += bytesWritten;
- if (m_ResampleBufferStart >= m_ResampleBufferEnd) {
- m_ResampleBufferStart = 0;
- m_ResampleBufferEnd = 0;
- }
-
- if (m_SampleBufferStart == m_SampleBufferEnd) {
- m_SampleBufferStart = 0;
- m_SampleBufferEnd = 0;
- m_SampleBufferLeft = SAMPLE_BUFFER_SIZE;
- }
- }
-
- return bytesWritten;
-}
-
-void FFMpegDecoder::resampleAudio()
-{
- if (!m_pAudioResampleContext) {
-#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(52, 24, 0)
- m_pAudioResampleContext = av_audio_resample_init(
- m_AP.m_Channels, m_pAStream->codec->channels,
- m_AP.m_SampleRate, m_EffectiveSampleRate,
- SAMPLE_FMT_S16, SAMPLE_FMT_S16,
- 16, 10, 0, 0.8);
-#else
- m_pAudioResampleContext = audio_resample_init(
- m_AP.m_Channels, m_pAStream->codec->channels,
- m_AP.m_SampleRate, m_EffectiveSampleRate);
-#endif
- }
-
- if (!m_pResampleBuffer) {
- m_ResampleBufferSize = (int)(SAMPLE_BUFFER_SIZE *
- ((double)m_AP.m_SampleRate / (double)m_EffectiveSampleRate));
- m_pResampleBuffer = (char*)av_mallocz(m_ResampleBufferSize);
- }
-
- int inputSamples =
- (m_SampleBufferEnd - m_SampleBufferStart) /
- (2 * m_pAStream->codec->channels);
-
- int outputSamples = audio_resample(m_pAudioResampleContext,
- (short*)m_pResampleBuffer,
- (short*)(m_pSampleBuffer + m_SampleBufferStart),
- inputSamples);
-
- // Adjust buffer pointers
- m_ResampleBufferEnd += outputSamples * 2 * m_AP.m_Channels;
- m_SampleBufferStart += inputSamples * 2 * m_pAStream->codec->channels;
-}
-
-int FFMpegDecoder::decodeAudio()
-{
- // Save current size of the audio buffer
- int lastSampleBufferSize = m_SampleBufferLeft;
-
- // Decode some data from packet into the audio buffer
-#if LIBAVCODEC_VERSION_INT > AV_VERSION_INT(52, 31, 0)
- AVPacket packet;
- av_init_packet(&packet);
- packet.data = m_AudioPacketData;
- packet.size = m_AudioPacketSize;
- int packetBytesDecoded = avcodec_decode_audio3(m_pAStream->codec,
- (short*)(m_pSampleBuffer + m_SampleBufferEnd), &m_SampleBufferLeft,
- &packet);
-#else
- int packetBytesDecoded = avcodec_decode_audio2(m_pAStream->codec,
- (short*)(m_pSampleBuffer + m_SampleBufferEnd), &m_SampleBufferLeft,
- m_AudioPacketData, m_AudioPacketSize);
-#endif
-
- // Skip frame on error
- if (packetBytesDecoded < 0) {
- return -1;
- }
-
- // Did not get any data, try again
- if (packetBytesDecoded == 0) {
- return 0;
- }
-
- // Adjust audio buffer pointers
- m_SampleBufferEnd += m_SampleBufferLeft;
- m_SampleBufferLeft = lastSampleBufferSize - m_SampleBufferLeft;
-
- // Adjust packet data pointers
- m_AudioPacketData += packetBytesDecoded;
- m_AudioPacketSize -= packetBytesDecoded;
- return packetBytesDecoded;
-}
-
-int FFMpegDecoder::fillAudioBuffer(AudioBufferPtr pBuffer)
-{
- AVG_ASSERT(m_State == DECODING);
- mutex::scoped_lock lock(m_AudioMutex);
-
- unsigned char* pOutputBuffer = (unsigned char*)(pBuffer->getData());
- int outputAudioBufferSize = pBuffer->getNumBytes();
-
- AVG_ASSERT (m_pAStream);
- if (m_bAudioEOF) {
- return 0;
- }
-
- int packetBytesDecoded;
- int bytesProduced;
- unsigned char* pCurBufferPos = pOutputBuffer;
- int bufferLeft = outputAudioBufferSize;
- bool bFormatMatch = (m_EffectiveSampleRate == m_AP.m_SampleRate &&
- m_pAStream->codec->channels == m_AP.m_Channels);
-
- while (true) {
- while (true) {
- // Consume any data left in the sample buffers
- while (m_SampleBufferStart < m_SampleBufferEnd ||
- m_ResampleBufferStart < m_ResampleBufferEnd)
- {
- // If the output format is different from the decoded format,
- // then convert it, else copy it over
- if (bFormatMatch) {
- bytesProduced = copyRawAudio(pCurBufferPos, bufferLeft);
- } else {
- bytesProduced = copyResampledAudio(pCurBufferPos, bufferLeft);
- }
-
- pCurBufferPos += bytesProduced;
- bufferLeft -= bytesProduced;
-
- m_LastAudioFrameTime += (double(bytesProduced) /
- (2 * m_AP.m_Channels * m_AP.m_SampleRate));
- if (bufferLeft == 0) {
- volumize(pBuffer);
- return pBuffer->getNumFrames();
- }
- }
-
- if (m_AudioPacketSize <= 0)
- break;
-
- packetBytesDecoded = decodeAudio();
-
- // Skip frame on error
- if (packetBytesDecoded < 0)
- break;
-
- // Did not get any data, try again
- if (packetBytesDecoded == 0)
- continue;
- }
-
- // We have decoded all data in the packet, free it
- if (m_AudioPacket) {
- av_free_packet(m_AudioPacket);
- delete m_AudioPacket;
- }
-
- // Get a new packet from the audio stream
- m_AudioPacket = m_pDemuxer->getPacket(m_AStreamIndex);
- if (!m_AudioPacket) {
- m_bAudioEOF = true;
- volumize(pBuffer);
- return pBuffer->getNumFrames()-bufferLeft/(pBuffer->getFrameSize());
- }
-
- // Initialize packet data pointers
- m_AudioPacketData = m_AudioPacket->data;
- m_AudioPacketSize = m_AudioPacket->size;
- }
-}
-
-PixelFormat FFMpegDecoder::calcPixelFormat(bool bUseYCbCr)
-{
- AVCodecContext const* pContext = getCodecContext();
- if (bUseYCbCr) {
- switch(pContext->pix_fmt) {
- case PIX_FMT_YUV420P:
-#ifdef AVG_ENABLE_VDPAU
- case PIX_FMT_VDPAU_H264:
- case PIX_FMT_VDPAU_MPEG1:
- case PIX_FMT_VDPAU_MPEG2:
- case PIX_FMT_VDPAU_WMV3:
- case PIX_FMT_VDPAU_VC1:
-#endif
- return YCbCr420p;
- case PIX_FMT_YUVJ420P:
- return YCbCrJ420p;
- case PIX_FMT_YUVA420P:
- return YCbCrA420p;
- default:
- break;
- }
- }
- if (pContext->pix_fmt == PIX_FMT_BGRA || pContext->pix_fmt == PIX_FMT_YUVA420P) {
- return B8G8R8A8;
- }
- return B8G8R8X8;
-}
-
-static ProfilingZoneID ConvertImageLibavgProfilingZone(
- "FFMpeg: colorspace conv (libavg)");
-static ProfilingZoneID ConvertImageSWSProfilingZone("FFMpeg: colorspace conv (SWS)");
-static ProfilingZoneID SetAlphaProfilingZone("FFMpeg: set alpha channel");
-
-void FFMpegDecoder::convertFrameToBmp(AVFrame& frame, BitmapPtr pBmp)
-{
- AVPicture destPict;
- unsigned char * pDestBits = pBmp->getPixels();
- destPict.data[0] = pDestBits;
- destPict.linesize[0] = pBmp->getStride();
- ::PixelFormat destFmt;
- switch (pBmp->getPixelFormat()) {
- case R8G8B8X8:
- case R8G8B8A8:
- // XXX: Unused and broken.
- destFmt = PIX_FMT_BGRA;
- break;
- case B8G8R8X8:
- case B8G8R8A8:
- destFmt = PIX_FMT_BGRA;
- break;
- case R8G8B8:
- destFmt = PIX_FMT_RGB24;
- break;
- case B8G8R8:
- destFmt = PIX_FMT_BGR24;
- break;
- case YCbCr422:
- destFmt = PIX_FMT_YUYV422;
- break;
- default:
- AVG_TRACE(Logger::ERROR, "FFMpegDecoder: Dest format "
- << pBmp->getPixelFormat() << " not supported.");
- AVG_ASSERT(false);
- destFmt = PIX_FMT_BGRA;
- }
- AVCodecContext const* pContext = getCodecContext();
- {
- if (destFmt == PIX_FMT_BGRA && (pContext->pix_fmt == PIX_FMT_YUV420P ||
- pContext->pix_fmt == PIX_FMT_YUVJ420P))
- {
- ScopeTimer timer(ConvertImageLibavgProfilingZone);
- BitmapPtr pBmpY(new Bitmap(pBmp->getSize(), I8, frame.data[0],
- frame.linesize[0], false));
- BitmapPtr pBmpU(new Bitmap(pBmp->getSize(), I8, frame.data[1],
- frame.linesize[1], false));
- BitmapPtr pBmpV(new Bitmap(pBmp->getSize(), I8, frame.data[2],
- frame.linesize[2], false));
- pBmp->copyYUVPixels(*pBmpY, *pBmpU, *pBmpV,
- pContext->pix_fmt == PIX_FMT_YUVJ420P);
-#ifdef AVG_ENABLE_VDPAU
- } else if (destFmt == PIX_FMT_BGRA && usesVDPAU()) {
- vdpau_render_state *pRenderState = (vdpau_render_state *)frame.data[0];
- getBitmapFromVDPAU(pRenderState, pBmp);
-#endif
- } else {
- if (!m_pSwsContext) {
- m_pSwsContext = sws_getContext(pContext->width, pContext->height,
- pContext->pix_fmt, pContext->width, pContext->height, destFmt,
- SWS_BICUBIC, 0, 0, 0);
- AVG_ASSERT(m_pSwsContext);
- }
- {
- ScopeTimer timer(ConvertImageSWSProfilingZone);
- sws_scale(m_pSwsContext, frame.data, frame.linesize, 0,
- pContext->height, destPict.data, destPict.linesize);
- }
- if (pBmp->getPixelFormat() == B8G8R8X8) {
- ScopeTimer timer(SetAlphaProfilingZone);
- // Make sure the alpha channel is white.
- // TODO: This is slow. Make OpenGL do it.
- unsigned char * pLine = pBmp->getPixels();
- IntPoint size = pBmp->getSize();
- for (int y = 0; y < size.y; ++y) {
- unsigned char * pPixel = pLine;
- for (int x = 0; x < size.x; ++x) {
- pPixel[3] = 0xFF;
- pPixel += 4;
- }
- pLine = pLine + pBmp->getStride();
- }
- }
- }
- }
-}
-
-PixelFormat FFMpegDecoder::getPixelFormat() const
-{
- AVG_ASSERT(m_State != CLOSED);
- return m_PF;
-}
-
-void FFMpegDecoder::initVideoSupport()
-{
- if (!s_bInitialized) {
- av_register_all();
- s_bInitialized = true;
- // Tune libavcodec console spam.
-// av_log_set_level(AV_LOG_DEBUG);
- av_log_set_level(AV_LOG_QUIET);
- }
-}
-
-bool FFMpegDecoder::usesVDPAU() const
-{
-#ifdef AVG_ENABLE_VDPAU
- AVCodecContext const* pContext = getCodecContext();
- return pContext->codec && (pContext->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU);
-#else
- return false;
-#endif
-}
-
-int FFMpegDecoder::getNumFrames() const
-{
- AVG_ASSERT(m_State != CLOSED);
- // This is broken for some videos, but the code here is correct.
- // So fix ffmpeg :-).
- int numFrames = int(m_pVStream->nb_frames);
- if (numFrames > 0) {
- return numFrames;
- } else {
- return int(getDuration() * calcStreamFPS());
- }
-}
-
-FrameAvailableCode FFMpegDecoder::readFrameForTime(AVFrame& frame, double timeWanted)
-{
- AVG_ASSERT(m_State == DECODING);
-// cerr << " readFrameForTime " << timeWanted << ", LastFrameTime= "
-// << m_LastVideoFrameTime << ", diff= " << m_LastVideoFrameTime-timeWanted
-// << endl;
- AVG_ASSERT(timeWanted != -1);
- double timePerFrame = 1.0/m_FPS;
- if (timeWanted-m_LastVideoFrameTime < 0.5*timePerFrame) {
-// cerr << "DISPLAY AGAIN." << endl;
- // The last frame is still current. Display it again.
- return FA_USE_LAST_FRAME;
- } else {
- bool bInvalidFrame = true;
- while (bInvalidFrame && !m_bVideoEOF) {
- double frameTime = readFrame(frame);
- bInvalidFrame = frameTime-timeWanted < -0.5*timePerFrame;
-#if AVG_ENABLE_VDPAU
- if (usesVDPAU() && bInvalidFrame && !m_bVideoEOF) {
- vdpau_render_state *pRenderState = (vdpau_render_state *)frame.data[0];
- VDPAU::unlockSurface(pRenderState);
- }
-#endif
-// cerr << " readFrame returned time " << frameTime << ", diff= " <<
-// frameTime-timeWanted << endl;
- }
-// cerr << "NEW FRAME." << endl;
- }
- return FA_NEW_FRAME;
-}
-
-static ProfilingZoneID DecodeProfilingZone("FFMpeg: decode");
-
-double FFMpegDecoder::readFrame(AVFrame& frame)
-{
- AVG_ASSERT(m_State == DECODING);
- ScopeTimer timer(DecodeProfilingZone);
-
- if (m_bEOFPending) {
- m_bVideoEOF = true;
- m_bEOFPending = false;
- return m_LastVideoFrameTime;
- }
- AVCodecContext* pContext = getCodecContext();
- int bGotPicture = 0;
- AVPacket* pPacket = 0;
- double frameTime = -1;
- while (!bGotPicture && !m_bVideoEOF) {
- pPacket = m_pDemuxer->getPacket(m_VStreamIndex);
- m_bFirstPacket = false;
- if (pPacket) {
-#ifdef AVG_ENABLE_VDPAU
- FrameAge age;
- m_Opaque.setFrameAge(&age);
-#endif
-#if LIBAVCODEC_VERSION_INT > AV_VERSION_INT(52, 31, 0)
- int len1 = avcodec_decode_video2(pContext, &frame, &bGotPicture, pPacket);
-#else
- int len1 = avcodec_decode_video(pContext, &frame, &bGotPicture, pPacket->data,
- pPacket->size);
-#endif
- if (len1 > 0) {
- AVG_ASSERT(len1 == pPacket->size);
- }
- else {
- }
- if (bGotPicture) {
- frameTime = getFrameTime(pPacket->dts);
- }
- av_free_packet(pPacket);
- delete pPacket;
- } else {
- // No more packets -> EOF. Decode the last data we got.
-#if LIBAVCODEC_VERSION_INT > AV_VERSION_INT(52, 31, 0)
- AVPacket packet;
- packet.data = 0;
- packet.size = 0;
- avcodec_decode_video2(pContext, &frame, &bGotPicture, &packet);
-#else
- avcodec_decode_video(pContext, &frame, &bGotPicture, 0, 0);
-#endif
- if (bGotPicture) {
- m_bEOFPending = true;
- } else {
- m_bVideoEOF = true;
- }
- // We don't have a timestamp for the last frame, so we'll
- // calculate it based on the frame before.
- frameTime = m_LastVideoFrameTime+1.0/m_FPS;
- m_LastVideoFrameTime = frameTime;
- }
- }
- AVG_ASSERT(frameTime != -1)
- return frameTime;
-/*
- cerr << "coded_picture_number: " << frame.coded_picture_number <<
- ", display_picture_number: " << frame.display_picture_number <<
- ", pts: " << frame.pts << endl;
-
- cerr << "key_frame: " << frame.key_frame <<
- ", pict_type: " << frame.pict_type << endl;
- AVFrac spts = m_pVStream->pts;
- cerr << "Stream.pts: " << spts.val + double(spts.num)/spts.den << endl;
-*/
-}
-
-double FFMpegDecoder::getFrameTime(long long dts)
-{
- if (m_VideoStartTimestamp == -1) {
- m_VideoStartTimestamp = double(dts)/m_TimeUnitsPerSecond;
- }
- double frameTime;
- if (m_bUseStreamFPS) {
- frameTime = double(dts)/m_TimeUnitsPerSecond-m_VideoStartTimestamp;
- } else {
- if (m_LastVideoFrameTime == -1) {
- frameTime = 0;
- } else {
- frameTime = m_LastVideoFrameTime + 1.0/m_FPS;
- }
- }
- m_LastVideoFrameTime = frameTime;
- return frameTime;
-}
-
-double FFMpegDecoder::getStartTime()
-{
- if (m_pVStream) {
- return m_VideoStartTimestamp;
- } else {
- return m_AudioStartTimestamp;
- }
-}
-
-double FFMpegDecoder::calcStreamFPS() const
-{
- return (m_pVStream->r_frame_rate.num/m_pVStream->r_frame_rate.den);
-}
-
-string FFMpegDecoder::getStreamPF() const
-{
- AVCodecContext const* pCodec = getCodecContext();
- ::PixelFormat pf = pCodec->pix_fmt;
- const char* psz = av_get_pix_fmt_name(pf);
- string s;
- if (psz) {
- s = psz;
- }
- return s;
-}
-
-// TODO: this should be logarithmic...
-void FFMpegDecoder::volumize(AudioBufferPtr pBuffer)
-{
- double curVol = m_Volume;
- double volDiff = m_LastVolume - curVol;
-
- if (curVol == 1.0 && volDiff == 0.0) {
- return;
- }
-
- short * pData = pBuffer->getData();
- for (int i = 0; i < pBuffer->getNumFrames()*pBuffer->getNumChannels(); i++) {
- double fadeVol = 0;
- if (volDiff != 0 && i < VOLUME_FADE_SAMPLES) {
- fadeVol = volDiff * (VOLUME_FADE_SAMPLES - i) / VOLUME_FADE_SAMPLES;
- }
-
- int s = int(pData[i] * (curVol + fadeVol));
-
- if (s < -32768)
- s = -32768;
- if (s > 32767)
- s = 32767;
-
- pData[i] = s;
- }
- m_LastVolume = curVol;
-}
-
-AVCodecContext const* FFMpegDecoder::getCodecContext() const
-{
- return m_pVStream->codec;
-}
-
-AVCodecContext* FFMpegDecoder::getCodecContext()
-{
- return m_pVStream->codec;
-}
-
-#ifdef AVG_ENABLE_VDPAU
-void getPlanesFromVDPAU(vdpau_render_state* pRenderState, BitmapPtr pBmpY,
- BitmapPtr pBmpU, BitmapPtr pBmpV)
-{
- VdpStatus status;
- void *dest[3] = {
- pBmpY->getPixels(),
- pBmpV->getPixels(),
- pBmpU->getPixels()
- };
- uint32_t pitches[3] = {
- pBmpY->getStride(),
- pBmpV->getStride(),
- pBmpU->getStride()
- };
- status = vdp_video_surface_get_bits_y_cb_cr(pRenderState->surface,
- VDP_YCBCR_FORMAT_YV12, dest, pitches);
- AVG_ASSERT(status == VDP_STATUS_OK);
- VDPAU::unlockSurface(pRenderState);
-}
-
-void getBitmapFromVDPAU(vdpau_render_state* pRenderState, BitmapPtr pBmpDest)
-{
- IntPoint YSize = pBmpDest->getSize();
- IntPoint UVSize(YSize.x>>1, YSize.y);
- BitmapPtr pBmpY(new Bitmap(YSize, I8));
- BitmapPtr pBmpU(new Bitmap(UVSize, I8));
- BitmapPtr pBmpV(new Bitmap(UVSize, I8));
- getPlanesFromVDPAU(pRenderState, pBmpY, pBmpU, pBmpV);
- pBmpDest->copyYUVPixels(*pBmpY, *pBmpU, *pBmpV, false);
-}
-#endif
-
-}
-
diff --git a/src/video/FFMpegDecoder.h b/src/video/FFMpegDecoder.h
deleted file mode 100644
index 4588dd5..0000000
--- a/src/video/FFMpegDecoder.h
+++ /dev/null
@@ -1,178 +0,0 @@
-//
-// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 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 _FFMpegDecoder_H_
-#define _FFMpegDecoder_H_
-
-#include "../avgconfigwrapper.h"
-#include "VideoDecoder.h"
-#include "IDemuxer.h"
-
-#include "../audio/AudioParams.h"
-#include "../base/ProfilingZone.h"
-#include "../avgconfigwrapper.h"
-
-#include "WrapFFMpeg.h"
-
-#ifdef AVG_ENABLE_VDPAU
-#include "VDPAU.h"
-#include "AVCCOpaque.h"
-#include "FrameAge.h"
-#include <libavcodec/vdpau.h>
-#endif
-
-#include <boost/thread/mutex.hpp>
-
-namespace avg {
-
-class AudioBuffer;
-
-class AVG_API FFMpegDecoder: public VideoDecoder
-{
- public:
- FFMpegDecoder();
- virtual ~FFMpegDecoder();
- virtual void open(const std::string& sFilename, bool bThreadedDemuxer,
- bool bUseHardwareAcceleration);
- virtual void startDecoding(bool bDeliverYCbCr, const AudioParams* pAP);
- virtual void close();
- virtual DecoderState getState() const;
- virtual VideoInfo getVideoInfo() const;
-
- virtual double getNominalFPS() const;
- virtual double getFPS() const;
- virtual double getVolume() const;
- virtual PixelFormat getPixelFormat() const;
-
- // Called from video thread.
- virtual IntPoint getSize() const;
- virtual int getCurFrame() const;
- virtual int getNumFramesQueued() const;
- virtual double getCurTime(StreamSelect stream = SS_DEFAULT) const;
- virtual void setFPS(double fps);
- virtual FrameAvailableCode renderToBmps(std::vector<BitmapPtr>& pBmps,
- double timeWanted);
-#ifdef AVG_ENABLE_VDPAU
- virtual FrameAvailableCode renderToVDPAU(vdpau_render_state** ppRenderState);
-#endif
- virtual void throwAwayFrame(double timeWanted);
-
- // Called from audio decoder thread
- virtual void setVolume(double volume);
- virtual int fillAudioBuffer(AudioBufferPtr pBuffer);
-
- // Called from video and audio threads
- virtual void seek(double destTime);
- virtual void loop();
- virtual bool isEOF(StreamSelect stream = SS_ALL) const;
-
- private:
- void initVideoSupport();
- bool usesVDPAU() const;
- int openCodec(int streamIndex, bool bUseHardwareAcceleration);
- PixelFormat calcPixelFormat(bool bUseYCbCr);
- virtual double getDuration() const;
- virtual int getNumFrames() const;
-
- DecoderState m_State;
- AVFormatContext * m_pFormatContext;
- PixelFormat m_PF;
- std::string m_sFilename;
- bool m_bThreadedDemuxer;
-
- // Used from video thread.
- FrameAvailableCode readFrameForTime(AVFrame& frame, double timeWanted);
- void convertFrameToBmp(AVFrame& frame, BitmapPtr pBmp);
- double getFrameTime(long long dts);
- double calcStreamFPS() const;
- std::string getStreamPF() const;
- AVCodecContext const * getCodecContext() const;
- AVCodecContext * getCodecContext();
-
- SwsContext * m_pSwsContext;
- IntPoint m_Size;
- double m_TimeUnitsPerSecond;
- bool m_bUseStreamFPS;
-
- // Used from audio thread.
- int copyRawAudio(unsigned char* buf, int size);
- int copyResampledAudio(unsigned char* buf, int size);
- void resampleAudio();
- int decodeAudio();
- void volumize(AudioBufferPtr pBuffer);
-
- int m_AStreamIndex;
- AudioParams m_AP;
- AVPacket * m_AudioPacket;
- unsigned char * m_AudioPacketData;
- int m_AudioPacketSize;
- char * m_pSampleBuffer;
- int m_SampleBufferStart;
- int m_SampleBufferEnd;
- int m_SampleBufferLeft;
- char * m_pResampleBuffer;
- int m_ResampleBufferEnd;
- int m_ResampleBufferStart;
- int m_ResampleBufferSize;
- int m_EffectiveSampleRate;
- ReSampleContext * m_pAudioResampleContext;
- double m_Volume;
- double m_LastVolume;
- double m_AudioStartTimestamp;
-
- // Used from video and audio threads.
- double readFrame(AVFrame& frame);
- double getStartTime();
-
- IDemuxer * m_pDemuxer;
- AVStream * m_pVStream;
- AVStream * m_pAStream;
-#ifdef AVG_ENABLE_VDPAU
- VDPAU m_VDPAU;
- AVCCOpaque m_Opaque;
-#endif
- int m_VStreamIndex;
- bool m_bEOFPending;
- bool m_bVideoEOF;
- bool m_bAudioEOF;
- boost::mutex m_AudioMutex;
- double m_LastAudioFrameTime;
- bool m_bFirstPacket;
- double m_VideoStartTimestamp;
- double m_LastVideoFrameTime;
-
- double m_FPS;
- double m_StreamTimeOffset;
-
- static bool s_bInitialized;
- // Prevents different decoder instances from executing open/close simultaneously
- static boost::mutex s_OpenMutex;
-};
-
-#ifdef AVG_ENABLE_VDPAU
-void getPlanesFromVDPAU(vdpau_render_state* pRenderState, BitmapPtr pBmpY,
- BitmapPtr pBmpU, BitmapPtr pBmpV);
-void getBitmapFromVDPAU(vdpau_render_state* pRenderState, BitmapPtr pBmpDest);
-#endif
-
-}
-#endif
-
diff --git a/src/video/FFMpegDemuxer.cpp b/src/video/FFMpegDemuxer.cpp
index 3c325f6..b092c7d 100644
--- a/src/video/FFMpegDemuxer.cpp
+++ b/src/video/FFMpegDemuxer.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -20,9 +20,11 @@
//
#include "FFMpegDemuxer.h"
+
#include "../base/ScopeTimer.h"
#include "../base/ObjectCounter.h"
#include "../base/Exception.h"
+#include "../base/Logger.h"
#include <cstring>
#include <iostream>
@@ -51,23 +53,36 @@ AVPacket * FFMpegDemuxer::getPacket(int streamIndex)
// Make sure enableStream was called on streamIndex.
AVG_ASSERT(m_PacketLists.size() > 0);
AVG_ASSERT(streamIndex > -1 && streamIndex < 10);
+
if (m_PacketLists.find(streamIndex) == m_PacketLists.end()) {
cerr << this << ": getPacket: Stream " << streamIndex << " not found." << endl;
dump();
AVG_ASSERT(false);
}
- PacketList & CurPacketList = m_PacketLists.find(streamIndex)->second;
- AVPacket * pPacket;
- if (!CurPacketList.empty()) {
- pPacket = CurPacketList.front();
- CurPacketList.pop_front();
+
+ PacketList& curPacketList = m_PacketLists.find(streamIndex)->second;
+ AVPacket* pPacket;
+ if (!curPacketList.empty()) {
+ // The stream has packets queued already.
+ pPacket = curPacketList.front();
+ curPacketList.pop_front();
} else {
+ // No packets queued for this stream -> read and queue packets until we get one
+ // that is meant for this stream.
do {
pPacket = new AVPacket;
memset(pPacket, 0, sizeof(AVPacket));
int err = av_read_frame(m_pFormatContext, pPacket);
- // TODO: Check url_ferror here too.
if (err < 0) {
+ // EOF or error
+#if LIBAVUTIL_VERSION_MAJOR > 50
+ if (err != int(AVERROR_EOF)) {
+ char sz[256];
+ av_strerror(err, sz, 256);
+ AVG_TRACE(Logger::category::PLAYER, Logger::severity::ERROR,
+ "Error decoding video: " << sz);
+ }
+#endif
av_free_packet(pPacket);
delete pPacket;
pPacket = 0;
@@ -75,27 +90,28 @@ AVPacket * FFMpegDemuxer::getPacket(int streamIndex)
}
if (pPacket->stream_index != streamIndex) {
if (m_PacketLists.find(pPacket->stream_index) != m_PacketLists.end()) {
+ // Relevant stream, but not ours
av_dup_packet(pPacket);
- PacketList& OtherPacketList =
+ PacketList& otherPacketList =
m_PacketLists.find(pPacket->stream_index)->second;
- OtherPacketList.push_back(pPacket);
+ otherPacketList.push_back(pPacket);
} else {
+ // Disabled stream
av_free_packet(pPacket);
delete pPacket;
pPacket = 0;
}
} else {
+ // Our stream
av_dup_packet(pPacket);
}
} while (!pPacket || pPacket->stream_index != streamIndex);
}
-// double timeBase = av_q2d(m_pFormatContext->streams[streamIndex]->time_base);
-// cerr << "FFMpegDemuxer: " << streamIndex << ": " << pPacket->dts*timeBase << endl;
return pPacket;
}
-
-void FFMpegDemuxer::seek(double destTime)
+
+void FFMpegDemuxer::seek(float destTime)
{
#if LIBAVFORMAT_BUILD <= 4616
av_seek_frame(m_pFormatContext, -1, destTime*1000000);
@@ -103,16 +119,11 @@ void FFMpegDemuxer::seek(double destTime)
#if LIBAVFORMAT_BUILD < ((49<<16)+(0<<8)+0)
av_seek_frame(m_pFormatContext, -1, destTime*1000000, 0);
#else
- av_seek_frame(m_pFormatContext, -1, (long long)(destTime*AV_TIME_BASE), AVSEEK_FLAG_BACKWARD);
+ av_seek_frame(m_pFormatContext, -1, (long long)(destTime*AV_TIME_BASE),
+ AVSEEK_FLAG_BACKWARD);
#endif
#endif
clearPacketCache();
- map<int, PacketList>::iterator it;
- for (it = m_PacketLists.begin(); it != m_PacketLists.end(); ++it) {
- int CurStreamIndex = it->first;
- AVStream * pStream = m_pFormatContext->streams[CurStreamIndex];
- avcodec_flush_buffers(pStream->codec);
- }
}
void FFMpegDemuxer::clearPacketCache()
@@ -120,12 +131,12 @@ void FFMpegDemuxer::clearPacketCache()
map<int, PacketList>::iterator it;
for (it = m_PacketLists.begin(); it != m_PacketLists.end(); ++it) {
PacketList::iterator it2;
- PacketList* thePacketList = &(it->second);
- for (it2 = thePacketList->begin(); it2 != thePacketList->end(); ++it2) {
+ PacketList* pPacketList = &(it->second);
+ for (it2 = pPacketList->begin(); it2 != pPacketList->end(); ++it2) {
av_free_packet(*it2);
delete *it2;
}
- thePacketList->clear();
+ pPacketList->clear();
}
}
diff --git a/src/video/FFMpegDemuxer.h b/src/video/FFMpegDemuxer.h
index b633fa1..b8219de 100644
--- a/src/video/FFMpegDemuxer.h
+++ b/src/video/FFMpegDemuxer.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -23,7 +23,6 @@
#define _FFMpegDemuxer_H_
#include "../avgconfigwrapper.h"
-#include "IDemuxer.h"
#include "WrapFFMpeg.h"
@@ -35,25 +34,25 @@
namespace avg {
- class AVG_API FFMpegDemuxer: public IDemuxer {
- public:
- FFMpegDemuxer(AVFormatContext * pFormatContext,
- std::vector<int> streamIndexes);
- virtual ~FFMpegDemuxer();
-
- AVPacket * getPacket(int streamIndex);
- void seek(double destTime);
- void dump();
-
- private:
- void clearPacketCache();
-
- typedef std::list<AVPacket *> PacketList;
- std::map<int, PacketList> m_PacketLists;
-
- AVFormatContext * m_pFormatContext;
- };
- typedef boost::shared_ptr<FFMpegDemuxer> FFMpegDemuxerPtr;
+class AVG_API FFMpegDemuxer {
+ public:
+ FFMpegDemuxer(AVFormatContext * pFormatContext, std::vector<int> streamIndexes);
+ virtual ~FFMpegDemuxer();
+
+ AVPacket * getPacket(int streamIndex);
+ void seek(float destTime);
+ void dump();
+
+ private:
+ void clearPacketCache();
+
+ // Packets that haven't been delivered yet.
+ typedef std::list<AVPacket *> PacketList;
+ std::map<int, PacketList> m_PacketLists;
+
+ AVFormatContext * m_pFormatContext;
+};
+typedef boost::shared_ptr<FFMpegDemuxer> FFMpegDemuxerPtr;
}
#endif
diff --git a/src/video/FFMpegFrameDecoder.cpp b/src/video/FFMpegFrameDecoder.cpp
new file mode 100644
index 0000000..bb7eddc
--- /dev/null
+++ b/src/video/FFMpegFrameDecoder.cpp
@@ -0,0 +1,266 @@
+//
+// 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 "FFMpegFrameDecoder.h"
+#include "FFMpegDemuxer.h"
+#include "VideoInfo.h"
+#ifdef AVG_ENABLE_VDPAU
+#include "VDPAUDecoder.h"
+#endif
+
+#include "../base/Exception.h"
+#include "../base/Logger.h"
+#include "../base/ScopeTimer.h"
+#include "../base/ObjectCounter.h"
+#include "../base/ProfilingZoneID.h"
+#include "../base/StringHelper.h"
+
+#include <iostream>
+#include <sstream>
+#ifndef _WIN32
+#include <unistd.h>
+#endif
+
+using namespace std;
+
+namespace avg {
+
+FFMpegFrameDecoder::FFMpegFrameDecoder(AVStream* pStream)
+ : m_pSwsContext(0),
+ m_pStream(pStream),
+ m_bEOF(false),
+ m_StartTimestamp(-1),
+ m_LastFrameTime(-1),
+ m_bUseStreamFPS(true)
+{
+ m_TimeUnitsPerSecond = float(1.0/av_q2d(pStream->time_base));
+ m_FPS = getStreamFPS(pStream);
+
+ ObjectCounter::get()->incRef(&typeid(*this));
+}
+
+FFMpegFrameDecoder::~FFMpegFrameDecoder()
+{
+ if (m_pSwsContext) {
+ sws_freeContext(m_pSwsContext);
+ m_pSwsContext = 0;
+ }
+ ObjectCounter::get()->decRef(&typeid(*this));
+}
+
+static ProfilingZoneID DecodePacketProfilingZone("Decode packet", true);
+
+bool FFMpegFrameDecoder::decodePacket(AVPacket* pPacket, AVFrame* pFrame,
+ bool bFrameAfterSeek)
+{
+ ScopeTimer timer(DecodePacketProfilingZone);
+ int bGotPicture = 0;
+ AVCodecContext* pContext = m_pStream->codec;
+ AVG_ASSERT(pPacket);
+#if LIBAVCODEC_VERSION_INT > AV_VERSION_INT(52, 31, 0)
+ avcodec_decode_video2(pContext, pFrame, &bGotPicture, pPacket);
+#else
+ avcodec_decode_video(pContext, pFrame, &bGotPicture, pPacket->data, pPacket->size);
+#endif
+ if (bGotPicture) {
+ m_LastFrameTime = getFrameTime(pPacket->dts, bFrameAfterSeek);
+ }
+ av_free_packet(pPacket);
+ delete pPacket;
+ return (bGotPicture != 0);
+}
+
+bool FFMpegFrameDecoder::decodeLastFrame(AVFrame* pFrame)
+{
+ // EOF. Decode the last data we got.
+ int bGotPicture = 0;
+ AVCodecContext* pContext = m_pStream->codec;
+#if LIBAVCODEC_VERSION_INT > AV_VERSION_INT(52, 31, 0)
+ AVPacket packet;
+ av_init_packet(&packet);
+ packet.data = 0;
+ packet.size = 0;
+ avcodec_decode_video2(pContext, pFrame, &bGotPicture, &packet);
+#else
+ avcodec_decode_video(pContext, pFrame, &bGotPicture, 0, 0);
+#endif
+ m_bEOF = true;
+
+ // We don't have a timestamp for the last frame, so we'll
+ // calculate it based on the frame before.
+ m_LastFrameTime += 1.0f/m_FPS;
+ return (bGotPicture != 0);
+}
+
+
+static ProfilingZoneID ConvertImageLibavgProfilingZone(
+ "FFMpeg: colorspace conv (libavg)", true);
+static ProfilingZoneID ConvertImageSWSProfilingZone(
+ "FFMpeg: colorspace conv (SWS)", true);
+static ProfilingZoneID SetAlphaProfilingZone("FFMpeg: set alpha channel", true);
+
+void FFMpegFrameDecoder::convertFrameToBmp(AVFrame* pFrame, BitmapPtr pBmp)
+{
+ AVPicture destPict;
+ unsigned char * pDestBits = pBmp->getPixels();
+ destPict.data[0] = pDestBits;
+ destPict.linesize[0] = pBmp->getStride();
+ AVPixelFormat destFmt;
+ switch (pBmp->getPixelFormat()) {
+ case R8G8B8X8:
+ case R8G8B8A8:
+ destFmt = PIX_FMT_RGBA;
+ break;
+ case B8G8R8X8:
+ case B8G8R8A8:
+ destFmt = PIX_FMT_BGRA;
+ break;
+ case R8G8B8:
+ destFmt = PIX_FMT_RGB24;
+ break;
+ case B8G8R8:
+ destFmt = PIX_FMT_BGR24;
+ break;
+ case YCbCr422:
+ destFmt = PIX_FMT_YUYV422;
+ break;
+ default:
+ AVG_ASSERT_MSG(false, (string("FFMpegFrameDecoder: Dest format ") +
+ toString(pBmp->getPixelFormat()) + " not supported.").c_str());
+ destFmt = PIX_FMT_BGRA;
+ }
+ AVCodecContext const* pContext = m_pStream->codec;
+ if (destFmt == PIX_FMT_BGRA && (pContext->pix_fmt == PIX_FMT_YUV420P ||
+ pContext->pix_fmt == PIX_FMT_YUVJ420P))
+ {
+ ScopeTimer timer(ConvertImageLibavgProfilingZone);
+ BitmapPtr pBmpY(new Bitmap(pBmp->getSize(), I8, pFrame->data[0],
+ pFrame->linesize[0], false));
+ BitmapPtr pBmpU(new Bitmap(pBmp->getSize(), I8, pFrame->data[1],
+ pFrame->linesize[1], false));
+ BitmapPtr pBmpV(new Bitmap(pBmp->getSize(), I8, pFrame->data[2],
+ pFrame->linesize[2], false));
+ pBmp->copyYUVPixels(*pBmpY, *pBmpU, *pBmpV,
+ pContext->pix_fmt == PIX_FMT_YUVJ420P);
+ } else {
+ if (!m_pSwsContext) {
+ m_pSwsContext = sws_getContext(pContext->width, pContext->height,
+ pContext->pix_fmt, pContext->width, pContext->height, destFmt,
+ SWS_BICUBIC, 0, 0, 0);
+ AVG_ASSERT(m_pSwsContext);
+ }
+ {
+ ScopeTimer timer(ConvertImageSWSProfilingZone);
+ sws_scale(m_pSwsContext, pFrame->data, pFrame->linesize, 0,
+ pContext->height, destPict.data, destPict.linesize);
+ }
+ if (pBmp->getPixelFormat() == B8G8R8X8 || pBmp->getPixelFormat() == R8G8B8X8) {
+ ScopeTimer timer(SetAlphaProfilingZone);
+ // Make sure the alpha channel is white.
+ // TODO: This is slow. Make OpenGL do it.
+ unsigned char * pLine = pBmp->getPixels();
+ IntPoint size = pBmp->getSize();
+ for (int y = 0; y < size.y; ++y) {
+ unsigned char * pPixel = pLine;
+ for (int x = 0; x < size.x; ++x) {
+ pPixel[3] = 0xFF;
+ pPixel += 4;
+ }
+ pLine = pLine + pBmp->getStride();
+ }
+ }
+ }
+}
+
+void FFMpegFrameDecoder::copyPlaneToBmp(BitmapPtr pBmp, unsigned char * pData, int stride)
+{
+ unsigned char * pSrc=pData;
+ unsigned char * pDest= pBmp->getPixels();
+ int destStride = pBmp->getStride();
+ int height = pBmp->getSize().y;
+ int width = pBmp->getSize().x;
+ for (int y = 0; y < height; y++) {
+ memcpy(pDest, pSrc, width);
+ pSrc += stride;
+ pDest += destStride;
+ }
+}
+
+void FFMpegFrameDecoder::handleSeek()
+{
+ m_LastFrameTime = -1.0f;
+ avcodec_flush_buffers(m_pStream->codec);
+ m_bEOF = false;
+ if (m_StartTimestamp == -1) {
+ m_StartTimestamp = 0;
+ }
+}
+
+float FFMpegFrameDecoder::getCurTime() const
+{
+ return m_LastFrameTime;
+}
+
+float FFMpegFrameDecoder::getFPS() const
+{
+ return m_FPS;
+}
+
+void FFMpegFrameDecoder::setFPS(float fps)
+{
+ m_bUseStreamFPS = (fps == 0);
+ if (fps == 0) {
+ m_FPS = getStreamFPS(m_pStream);
+ } else {
+ m_FPS = fps;
+ }
+}
+
+bool FFMpegFrameDecoder::isEOF() const
+{
+ return m_bEOF;
+}
+
+float FFMpegFrameDecoder::getFrameTime(long long dts, bool bFrameAfterSeek)
+{
+ bool bUseStreamFPS = m_bUseStreamFPS;
+ if (dts == (long long)AV_NOPTS_VALUE) {
+ bUseStreamFPS = false;
+ dts = 0;
+ }
+ if (m_StartTimestamp == -1) {
+ m_StartTimestamp = dts;
+ }
+ float frameTime;
+ if (bUseStreamFPS || bFrameAfterSeek) {
+ frameTime = float(dts-m_StartTimestamp)/m_TimeUnitsPerSecond;
+ } else {
+ if (m_LastFrameTime == -1) {
+ frameTime = 0;
+ } else {
+ frameTime = m_LastFrameTime + 1.0f/m_FPS;
+ }
+ }
+ return frameTime;
+}
+
+}
+
diff --git a/src/video/FFMpegFrameDecoder.h b/src/video/FFMpegFrameDecoder.h
new file mode 100644
index 0000000..51b875f
--- /dev/null
+++ b/src/video/FFMpegFrameDecoder.h
@@ -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
+//
+
+#ifndef _FFMpegFrameDecoder_H_
+#define _FFMpegFrameDecoder_H_
+
+#include "../avgconfigwrapper.h"
+
+#include "../graphics/Bitmap.h"
+
+#include "WrapFFMpeg.h"
+
+namespace avg {
+
+class AVG_API FFMpegFrameDecoder
+{
+ public:
+ FFMpegFrameDecoder(AVStream* pStream);
+ virtual ~FFMpegFrameDecoder();
+
+ bool decodePacket(AVPacket* pPacket, AVFrame* pFrame, bool bFrameAfterSeek);
+ bool decodeLastFrame(AVFrame* pFrame);
+ void convertFrameToBmp(AVFrame* pFrame, BitmapPtr pBmp);
+ void copyPlaneToBmp(BitmapPtr pBmp, unsigned char * pData, int stride);
+
+ void handleSeek();
+
+ virtual float getCurTime() const;
+ virtual float getFPS() const;
+ virtual void setFPS(float fps);
+
+ virtual bool isEOF() const;
+
+ private:
+ float getFrameTime(long long dts, bool bFrameAfterSeek);
+
+ SwsContext * m_pSwsContext;
+ AVStream* m_pStream;
+
+ bool m_bEOF;
+
+ float m_TimeUnitsPerSecond;
+ long long m_StartTimestamp;
+ float m_LastFrameTime;
+
+ bool m_bUseStreamFPS;
+ float m_FPS;
+};
+
+typedef boost::shared_ptr<FFMpegFrameDecoder> FFMpegFrameDecoderPtr;
+
+}
+#endif
+
diff --git a/src/video/Makefile.am b/src/video/Makefile.am
index 9b72552..fb5b411 100644
--- a/src/video/Makefile.am
+++ b/src/video/Makefile.am
@@ -1,47 +1,50 @@
+AM_CPPFLAGS = -I.. @XML2_CFLAGS@ @PTHREAD_CFLAGS@ @GDK_PIXBUF_CFLAGS@
-INCLUDES = -I.. @PTHREAD_CFLAGS@ @FFMPEG_CFLAGS@
-
if APPLE
- X_LIBS =
+ X_LIBS =
else
- X_LIBS = -lX11
+if ENABLE_RPI
+ X_LIBS = -lX11 -lGLESv2 -lEGL
+else
+if ENABLE_EGL
+ X_LIBS = -lXxf86vm -lX11 -lGLESv2 -lEGL
+else
+ X_LIBS = -lXxf86vm -lX11
+endif
+endif
endif
-ALL_H = FFMpegDemuxer.h VideoDemuxerThread.h FFMpegDecoder.h VideoDecoder.h \
- VideoDecoderThread.h AudioDecoderThread.h VideoMsg.h \
- PacketVideoMsg.h AsyncVideoDecoder.h VideoDecoderThread.h \
- IDemuxer.h AsyncDemuxer.h VideoInfo.h WrapFFMpeg.h
+ALL_H = FFMpegDemuxer.h VideoDemuxerThread.h VideoDecoder.h \
+ VideoDecoderThread.h AudioDecoderThread.h VideoMsg.h FFMpegFrameDecoder.h \
+ AsyncVideoDecoder.h VideoDecoderThread.h SyncVideoDecoder.h \
+ VideoInfo.h WrapFFMpeg.h
if USE_VDPAU_SRC
- ALL_H += VDPAU.h AVCCOpaque.h FrameAge.h
+ ALL_H += VDPAUDecoder.h VDPAUHelper.h
endif
-TESTS=testvideo
+TESTS = testvideo
-EXTRA_DIST = $(wildcard testfiles/*.mov) $(wildcard testfiles/*.mpg) \
- $(wildcard testfiles/*.avi) $(wildcard testfiles/*.h264) \
- $(wildcard testfiles/*.wav) $(wildcard testfiles/*.ogg) \
- $(wildcard testfiles/*.mp3) $(wildcard testfiles/*.aif) \
- $(wildcard testfiles/*.flv) $(wildcard baseline/*.png)
+EXTRA_DIST = $(wildcard baseline/*.png)
noinst_LTLIBRARIES = libvideo.la
-noinst_PROGRAMS=testvideo
+noinst_PROGRAMS = testvideo
-libvideo_la_SOURCES = FFMpegDemuxer.cpp VideoDemuxerThread.cpp FFMpegDecoder.cpp \
- VideoDecoderThread.cpp AudioDecoderThread.cpp VideoMsg.cpp VideoDecoder.cpp \
- PacketVideoMsg.cpp AsyncVideoDecoder.cpp AsyncDemuxer.cpp VideoInfo.cpp \
+libvideo_la_SOURCES = FFMpegDemuxer.cpp VideoDemuxerThread.cpp VideoDecoder.cpp \
+ VideoDecoderThread.cpp AudioDecoderThread.cpp VideoMsg.cpp \
+ AsyncVideoDecoder.cpp VideoInfo.cpp SyncVideoDecoder.cpp \
+ FFMpegFrameDecoder.cpp \
$(ALL_H)
if USE_VDPAU_SRC
- libvideo_la_SOURCES += AVCCOpaque.cpp FrameAge.cpp VDPAU.cpp
+ libvideo_la_SOURCES += VDPAUDecoder.cpp VDPAUHelper.cpp
endif
libvideo_la_LIBADD = @LIBVIDEO_LDADD@
testvideo_SOURCES = testvideo.cpp $(ALL_H)
testvideo_LDADD = ./libvideo.la ../audio/libaudio.la ../graphics/libgraphics.la \
- ../base/libbase.la \
- @XML2_LIBS@ -l@BOOST_THREAD_LIB@ -lboost_system @PTHREAD_LIBS@ \
- @LIBFFMPEG@ $(X_LIBS) \
- @GDK_PIXBUF_LIBS@
-
+ ../base/libbase.la ../base/triangulate/libtriangulate.la -ldl \
+ @GL_LIBS@ @GLU_LIBS@ @SDL_LIBS@ @XML2_LIBS@ \
+ @BOOST_THREAD_LIBS@ @PTHREAD_LIBS@ @LIBFFMPEG@ @GDK_PIXBUF_LIBS@ \
+ $(X_LIBS)
diff --git a/src/video/Makefile.in b/src/video/Makefile.in
index cfb48f2..df531d4 100644
--- a/src/video/Makefile.in
+++ b/src/video/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# Makefile.in generated by automake 1.11.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
-# Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -36,21 +36,22 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
-@USE_VDPAU_SRC_TRUE@am__append_1 = VDPAU.h AVCCOpaque.h FrameAge.h
+@USE_VDPAU_SRC_TRUE@am__append_1 = VDPAUDecoder.h VDPAUHelper.h
TESTS = testvideo$(EXEEXT)
noinst_PROGRAMS = testvideo$(EXEEXT)
-@USE_VDPAU_SRC_TRUE@am__append_2 = AVCCOpaque.cpp FrameAge.cpp VDPAU.cpp
+@USE_VDPAU_SRC_TRUE@am__append_2 = VDPAUDecoder.cpp VDPAUHelper.cpp
subdir = src/video
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ac_cxx_namespaces.m4 \
$(top_srcdir)/m4/ac_path_generic.m4 \
$(top_srcdir)/m4/ax_boost_thread.m4 \
- $(top_srcdir)/m4/ax_check_gl.m4 $(top_srcdir)/m4/libtool.m4 \
- $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
- $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
- $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/m4/python_dev.m4 \
- $(top_srcdir)/configure.in
+ $(top_srcdir)/m4/ax_check_gl.m4 \
+ $(top_srcdir)/m4/ax_python_devel.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/pkg.m4 \
+ $(top_srcdir)/m4/avg_version.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
@@ -60,39 +61,38 @@ CONFIG_CLEAN_VPATH_FILES =
LTLIBRARIES = $(noinst_LTLIBRARIES)
libvideo_la_DEPENDENCIES =
am__libvideo_la_SOURCES_DIST = FFMpegDemuxer.cpp \
- VideoDemuxerThread.cpp FFMpegDecoder.cpp \
- VideoDecoderThread.cpp AudioDecoderThread.cpp VideoMsg.cpp \
- VideoDecoder.cpp PacketVideoMsg.cpp AsyncVideoDecoder.cpp \
- AsyncDemuxer.cpp VideoInfo.cpp FFMpegDemuxer.h \
- VideoDemuxerThread.h FFMpegDecoder.h VideoDecoder.h \
+ VideoDemuxerThread.cpp VideoDecoder.cpp VideoDecoderThread.cpp \
+ AudioDecoderThread.cpp VideoMsg.cpp AsyncVideoDecoder.cpp \
+ VideoInfo.cpp SyncVideoDecoder.cpp FFMpegFrameDecoder.cpp \
+ FFMpegDemuxer.h VideoDemuxerThread.h VideoDecoder.h \
VideoDecoderThread.h AudioDecoderThread.h VideoMsg.h \
- PacketVideoMsg.h AsyncVideoDecoder.h IDemuxer.h AsyncDemuxer.h \
- VideoInfo.h WrapFFMpeg.h VDPAU.h AVCCOpaque.h FrameAge.h \
- AVCCOpaque.cpp FrameAge.cpp VDPAU.cpp
+ FFMpegFrameDecoder.h AsyncVideoDecoder.h SyncVideoDecoder.h \
+ VideoInfo.h WrapFFMpeg.h VDPAUDecoder.h VDPAUHelper.h \
+ VDPAUDecoder.cpp VDPAUHelper.cpp
am__objects_1 =
am__objects_2 = $(am__objects_1)
-@USE_VDPAU_SRC_TRUE@am__objects_3 = AVCCOpaque.lo FrameAge.lo VDPAU.lo
+@USE_VDPAU_SRC_TRUE@am__objects_3 = VDPAUDecoder.lo VDPAUHelper.lo
am_libvideo_la_OBJECTS = FFMpegDemuxer.lo VideoDemuxerThread.lo \
- FFMpegDecoder.lo VideoDecoderThread.lo AudioDecoderThread.lo \
- VideoMsg.lo VideoDecoder.lo PacketVideoMsg.lo \
- AsyncVideoDecoder.lo AsyncDemuxer.lo VideoInfo.lo \
- $(am__objects_2) $(am__objects_3)
+ VideoDecoder.lo VideoDecoderThread.lo AudioDecoderThread.lo \
+ VideoMsg.lo AsyncVideoDecoder.lo VideoInfo.lo \
+ SyncVideoDecoder.lo FFMpegFrameDecoder.lo $(am__objects_2) \
+ $(am__objects_3)
libvideo_la_OBJECTS = $(am_libvideo_la_OBJECTS)
-AM_V_lt = $(am__v_lt_$(V))
-am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
am__v_lt_0 = --silent
PROGRAMS = $(noinst_PROGRAMS)
am__testvideo_SOURCES_DIST = testvideo.cpp FFMpegDemuxer.h \
- VideoDemuxerThread.h FFMpegDecoder.h VideoDecoder.h \
- VideoDecoderThread.h AudioDecoderThread.h VideoMsg.h \
- PacketVideoMsg.h AsyncVideoDecoder.h IDemuxer.h AsyncDemuxer.h \
- VideoInfo.h WrapFFMpeg.h VDPAU.h AVCCOpaque.h FrameAge.h
+ VideoDemuxerThread.h VideoDecoder.h VideoDecoderThread.h \
+ AudioDecoderThread.h VideoMsg.h FFMpegFrameDecoder.h \
+ AsyncVideoDecoder.h SyncVideoDecoder.h VideoInfo.h \
+ WrapFFMpeg.h VDPAUDecoder.h VDPAUHelper.h
am_testvideo_OBJECTS = testvideo.$(OBJEXT) $(am__objects_2)
testvideo_OBJECTS = $(am_testvideo_OBJECTS)
am__DEPENDENCIES_1 =
testvideo_DEPENDENCIES = ./libvideo.la ../audio/libaudio.la \
../graphics/libgraphics.la ../base/libbase.la \
- $(am__DEPENDENCIES_1)
+ ../base/triangulate/libtriangulate.la $(am__DEPENDENCIES_1)
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@@ -103,18 +103,18 @@ LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CXXFLAGS) $(CXXFLAGS)
-AM_V_CXX = $(am__v_CXX_$(V))
-am__v_CXX_ = $(am__v_CXX_$(AM_DEFAULT_VERBOSITY))
+AM_V_CXX = $(am__v_CXX_@AM_V@)
+am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@)
am__v_CXX_0 = @echo " CXX " $@;
-AM_V_at = $(am__v_at_$(V))
-am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
CXXLD = $(CXX)
CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
$(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
-AM_V_CXXLD = $(am__v_CXXLD_$(V))
-am__v_CXXLD_ = $(am__v_CXXLD_$(AM_DEFAULT_VERBOSITY))
+AM_V_CXXLD = $(am__v_CXXLD_@AM_V@)
+am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@)
am__v_CXXLD_0 = @echo " CXXLD " $@;
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@@ -122,18 +122,18 @@ LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
-AM_V_CC = $(am__v_CC_$(V))
-am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
+AM_V_CC = $(am__v_CC_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
am__v_CC_0 = @echo " CC " $@;
CCLD = $(CC)
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
-AM_V_CCLD = $(am__v_CCLD_$(V))
-am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
-AM_V_GEN = $(am__v_GEN_$(V))
-am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
SOURCES = $(libvideo_la_SOURCES) $(testvideo_SOURCES)
DIST_SOURCES = $(am__libvideo_la_SOURCES_DIST) \
@@ -152,7 +152,7 @@ AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BOOST_PYTHON_LIBS = @BOOST_PYTHON_LIBS@
-BOOST_THREAD_LIB = @BOOST_THREAD_LIB@
+BOOST_THREAD_LIBS = @BOOST_THREAD_LIBS@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
@@ -167,6 +167,7 @@ DC1394_2_CFLAGS = @DC1394_2_CFLAGS@
DC1394_2_LIBS = @DC1394_2_LIBS@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
@@ -207,6 +208,7 @@ LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
MTDEV_CFLAGS = @MTDEV_CFLAGS@
MTDEV_LIBS = @MTDEV_LIBS@
@@ -236,11 +238,13 @@ PTHREAD_CC = @PTHREAD_CC@
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
PTHREAD_LIBS = @PTHREAD_LIBS@
PYTHON = @PYTHON@
+PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@
PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
-PYTHON_INCLUDES = @PYTHON_INCLUDES@
-PYTHON_LIBS = @PYTHON_LIBS@
+PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@
+PYTHON_LDFLAGS = @PYTHON_LDFLAGS@
PYTHON_PLATFORM = @PYTHON_PLATFORM@
PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_SITE_PKG = @PYTHON_SITE_PKG@
PYTHON_VERSION = @PYTHON_VERSION@
RANLIB = @RANLIB@
SDL_CFLAGS = @SDL_CFLAGS@
@@ -263,6 +267,7 @@ abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
@@ -297,7 +302,6 @@ libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
@@ -321,33 +325,29 @@ target_vendor = @target_vendor@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-INCLUDES = -I.. @PTHREAD_CFLAGS@ @FFMPEG_CFLAGS@
-@APPLE_FALSE@X_LIBS = -lX11
+AM_CPPFLAGS = -I.. @XML2_CFLAGS@ @PTHREAD_CFLAGS@ @GDK_PIXBUF_CFLAGS@
+@APPLE_FALSE@@ENABLE_EGL_FALSE@@ENABLE_RPI_FALSE@X_LIBS = -lXxf86vm -lX11
+@APPLE_FALSE@@ENABLE_EGL_TRUE@@ENABLE_RPI_FALSE@X_LIBS = -lXxf86vm -lX11 -lGLESv2 -lEGL
+@APPLE_FALSE@@ENABLE_RPI_TRUE@X_LIBS = -lX11 -lGLESv2 -lEGL
@APPLE_TRUE@X_LIBS =
-ALL_H = FFMpegDemuxer.h VideoDemuxerThread.h FFMpegDecoder.h \
- VideoDecoder.h VideoDecoderThread.h AudioDecoderThread.h \
- VideoMsg.h PacketVideoMsg.h AsyncVideoDecoder.h \
- VideoDecoderThread.h IDemuxer.h AsyncDemuxer.h VideoInfo.h \
- WrapFFMpeg.h $(am__append_1)
-EXTRA_DIST = $(wildcard testfiles/*.mov) $(wildcard testfiles/*.mpg) \
- $(wildcard testfiles/*.avi) $(wildcard testfiles/*.h264) \
- $(wildcard testfiles/*.wav) $(wildcard testfiles/*.ogg) \
- $(wildcard testfiles/*.mp3) $(wildcard testfiles/*.aif) \
- $(wildcard testfiles/*.flv) $(wildcard baseline/*.png)
-
+ALL_H = FFMpegDemuxer.h VideoDemuxerThread.h VideoDecoder.h \
+ VideoDecoderThread.h AudioDecoderThread.h VideoMsg.h \
+ FFMpegFrameDecoder.h AsyncVideoDecoder.h VideoDecoderThread.h \
+ SyncVideoDecoder.h VideoInfo.h WrapFFMpeg.h $(am__append_1)
+EXTRA_DIST = $(wildcard baseline/*.png)
noinst_LTLIBRARIES = libvideo.la
libvideo_la_SOURCES = FFMpegDemuxer.cpp VideoDemuxerThread.cpp \
- FFMpegDecoder.cpp VideoDecoderThread.cpp \
- AudioDecoderThread.cpp VideoMsg.cpp VideoDecoder.cpp \
- PacketVideoMsg.cpp AsyncVideoDecoder.cpp AsyncDemuxer.cpp \
- VideoInfo.cpp $(ALL_H) $(am__append_2)
+ VideoDecoder.cpp VideoDecoderThread.cpp AudioDecoderThread.cpp \
+ VideoMsg.cpp AsyncVideoDecoder.cpp VideoInfo.cpp \
+ SyncVideoDecoder.cpp FFMpegFrameDecoder.cpp $(ALL_H) \
+ $(am__append_2)
libvideo_la_LIBADD = @LIBVIDEO_LDADD@
testvideo_SOURCES = testvideo.cpp $(ALL_H)
testvideo_LDADD = ./libvideo.la ../audio/libaudio.la ../graphics/libgraphics.la \
- ../base/libbase.la \
- @XML2_LIBS@ -l@BOOST_THREAD_LIB@ @PTHREAD_LIBS@ \
- @LIBFFMPEG@ $(X_LIBS) \
- @GDK_PIXBUF_LIBS@
+ ../base/libbase.la ../base/triangulate/libtriangulate.la -ldl \
+ @GL_LIBS@ @GLU_LIBS@ @SDL_LIBS@ @XML2_LIBS@ \
+ @BOOST_THREAD_LIBS@ @PTHREAD_LIBS@ @LIBFFMPEG@ @GDK_PIXBUF_LIBS@ \
+ $(X_LIBS)
all: all-am
@@ -392,7 +392,7 @@ clean-noinstLTLIBRARIES:
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
-libvideo.la: $(libvideo_la_OBJECTS) $(libvideo_la_DEPENDENCIES)
+libvideo.la: $(libvideo_la_OBJECTS) $(libvideo_la_DEPENDENCIES) $(EXTRA_libvideo_la_DEPENDENCIES)
$(AM_V_CXXLD)$(CXXLINK) $(libvideo_la_OBJECTS) $(libvideo_la_LIBADD) $(LIBS)
clean-noinstPROGRAMS:
@@ -403,7 +403,7 @@ clean-noinstPROGRAMS:
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
echo " rm -f" $$list; \
rm -f $$list
-testvideo$(EXEEXT): $(testvideo_OBJECTS) $(testvideo_DEPENDENCIES)
+testvideo$(EXEEXT): $(testvideo_OBJECTS) $(testvideo_DEPENDENCIES) $(EXTRA_testvideo_DEPENDENCIES)
@rm -f testvideo$(EXEEXT)
$(AM_V_CXXLD)$(CXXLINK) $(testvideo_OBJECTS) $(testvideo_LDADD) $(LIBS)
@@ -413,15 +413,13 @@ mostlyclean-compile:
distclean-compile:
-rm -f *.tab.c
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/AVCCOpaque.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/AsyncDemuxer.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/AsyncVideoDecoder.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/AudioDecoderThread.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FFMpegDecoder.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FFMpegDemuxer.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FrameAge.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PacketVideoMsg.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/VDPAU.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FFMpegFrameDecoder.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SyncVideoDecoder.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/VDPAUDecoder.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/VDPAUHelper.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/VideoDecoder.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/VideoDecoderThread.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/VideoDemuxerThread.Plo@am__quote@
@@ -432,26 +430,23 @@ distclean-compile:
.cpp.o:
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $<
.cpp.obj:
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
.cpp.lo:
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
-@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
@@ -592,14 +587,15 @@ check-TESTS: $(TESTS)
fi; \
dashes=`echo "$$dashes" | sed s/./=/g`; \
if test "$$failed" -eq 0; then \
- echo "$$grn$$dashes"; \
+ col="$$grn"; \
else \
- echo "$$red$$dashes"; \
+ col="$$red"; \
fi; \
- echo "$$banner"; \
- test -z "$$skipped" || echo "$$skipped"; \
- test -z "$$report" || echo "$$report"; \
- echo "$$dashes$$std"; \
+ echo "$${col}$$dashes$${std}"; \
+ echo "$${col}$$banner$${std}"; \
+ test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \
+ test -z "$$report" || echo "$${col}$$report$${std}"; \
+ echo "$${col}$$dashes$${std}"; \
test "$$failed" -eq 0; \
else :; fi
@@ -648,10 +644,15 @@ install-am: all-am
installcheck: installcheck-am
install-strip:
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- `test -z '$(STRIP)' || \
- echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
mostlyclean-generic:
clean-generic:
diff --git a/src/video/PacketVideoMsg.h b/src/video/PacketVideoMsg.h
deleted file mode 100644
index 766ac68..0000000
--- a/src/video/PacketVideoMsg.h
+++ /dev/null
@@ -1,55 +0,0 @@
-//
-// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 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 _PacketVideoMsg_H_
-#define _PacketVideoMsg_H_
-
-#include "../avgconfigwrapper.h"
-#include "../base/Queue.h"
-#include "../graphics/Bitmap.h"
-
-#include "WrapFFMpeg.h"
-
-#include <vector>
-
-namespace avg {
-
-class AVG_API PacketVideoMsg {
- public:
- PacketVideoMsg(AVPacket * pPacket, bool bSeekDone);
- virtual ~PacketVideoMsg();
-
- void freePacket();
- AVPacket * getPacket();
- bool isSeekDone();
-
- private:
- AVPacket * m_pPacket;
- bool m_bSeekDone;
-};
-
-typedef boost::shared_ptr<PacketVideoMsg> PacketVideoMsgPtr;
-typedef Queue<PacketVideoMsg> VideoPacketQueue;
-typedef boost::shared_ptr<VideoPacketQueue> VideoPacketQueuePtr;
-
-}
-#endif
-
diff --git a/src/video/SyncVideoDecoder.cpp b/src/video/SyncVideoDecoder.cpp
new file mode 100644
index 0000000..a0c62ce
--- /dev/null
+++ b/src/video/SyncVideoDecoder.cpp
@@ -0,0 +1,261 @@
+//
+// 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 "SyncVideoDecoder.h"
+#include "FFMpegDemuxer.h"
+
+#include "../base/Exception.h"
+#include "../base/Logger.h"
+#include "../base/ScopeTimer.h"
+#include "../base/ObjectCounter.h"
+#include "../base/ProfilingZoneID.h"
+#include "../base/StringHelper.h"
+
+#include "../graphics/BitmapLoader.h"
+
+#include <iostream>
+#include <sstream>
+#ifndef _WIN32
+#include <unistd.h>
+#endif
+
+using namespace std;
+
+namespace avg {
+
+SyncVideoDecoder::SyncVideoDecoder()
+ : m_pDemuxer(0),
+ m_bFirstPacket(false),
+ m_bUseStreamFPS(true),
+ m_FPS(0)
+{
+ ObjectCounter::get()->incRef(&typeid(*this));
+}
+
+SyncVideoDecoder::~SyncVideoDecoder()
+{
+ ObjectCounter::get()->decRef(&typeid(*this));
+}
+
+void SyncVideoDecoder::open(const string& sFilename, bool bUseHardwareAcceleration,
+ bool bEnableSound)
+{
+ m_bProcessingLastFrames = false;
+ VideoDecoder::open(sFilename, false, false);
+
+ if (getVStreamIndex() >= 0) {
+ if (m_bUseStreamFPS) {
+ m_FPS = getStreamFPS();
+ }
+ m_bFirstPacket = true;
+ m_bVideoSeekDone = false;
+ }
+}
+
+void SyncVideoDecoder::startDecoding(bool bDeliverYCbCr, const AudioParams* pAP)
+{
+ VideoDecoder::startDecoding(bDeliverYCbCr, 0);
+
+ AVG_ASSERT(!m_pDemuxer);
+ vector<int> streamIndexes;
+ streamIndexes.push_back(getVStreamIndex());
+ m_pDemuxer = new FFMpegDemuxer(getFormatContext(), streamIndexes);
+
+ m_pFrameDecoder = FFMpegFrameDecoderPtr(new FFMpegFrameDecoder(getVideoStream()));
+ m_pFrameDecoder->setFPS(m_FPS);
+#if LIBAVCODEC_VERSION_INT > AV_VERSION_INT(54, 28, 0)
+ m_pFrame = avcodec_alloc_frame();
+#else
+ m_pFrame = new AVFrame;
+#endif
+}
+
+void SyncVideoDecoder::close()
+{
+ delete m_pDemuxer;
+ m_pDemuxer = 0;
+
+ m_pFrameDecoder = FFMpegFrameDecoderPtr();
+ VideoDecoder::close();
+#if LIBAVCODEC_VERSION_INT > AV_VERSION_INT(54, 28, 0)
+ avcodec_free_frame(&m_pFrame);
+#else
+ delete m_pFrame;
+#endif
+}
+
+void SyncVideoDecoder::seek(float destTime)
+{
+ AVG_ASSERT(getState() == DECODING);
+
+ if (m_bFirstPacket) {
+ readFrame(m_pFrame);
+ }
+ m_pDemuxer->seek(destTime);
+ m_bVideoSeekDone = true;
+ m_pFrameDecoder->handleSeek();
+}
+
+void SyncVideoDecoder::loop()
+{
+ seek(0);
+}
+
+int SyncVideoDecoder::getCurFrame() const
+{
+ return int(getCurTime()*getStreamFPS()+0.49);
+}
+
+int SyncVideoDecoder::getNumFramesQueued() const
+{
+ return 0;
+}
+
+float SyncVideoDecoder::getCurTime() const
+{
+ AVG_ASSERT(getState() != CLOSED);
+ if (m_pFrameDecoder) {
+ return m_pFrameDecoder->getCurTime();
+ } else {
+ return 0;
+ }
+}
+
+float SyncVideoDecoder::getFPS() const
+{
+ AVG_ASSERT(getState() != CLOSED);
+ return m_FPS;
+}
+
+void SyncVideoDecoder::setFPS(float fps)
+{
+ m_bUseStreamFPS = (fps == 0);
+ if (fps == 0) {
+ m_FPS = getStreamFPS();
+ } else {
+ m_FPS = fps;
+ }
+ if (m_pFrameDecoder) {
+ m_pFrameDecoder->setFPS(m_FPS);
+ }
+}
+
+static ProfilingZoneID RenderToBmpProfilingZone("FFMpeg: renderToBmp", true);
+static ProfilingZoneID CopyImageProfilingZone("FFMpeg: copy image", true);
+
+FrameAvailableCode SyncVideoDecoder::renderToBmps(vector<BitmapPtr>& pBmps,
+ float timeWanted)
+{
+ AVG_ASSERT(getState() == DECODING);
+ ScopeTimer timer(RenderToBmpProfilingZone);
+ FrameAvailableCode frameAvailable;
+ if (timeWanted == -1) {
+ readFrame(m_pFrame);
+ frameAvailable = FA_NEW_FRAME;
+ } else {
+ frameAvailable = readFrameForTime(m_pFrame, timeWanted);
+ }
+ if (frameAvailable == FA_USE_LAST_FRAME || isEOF()) {
+ return FA_USE_LAST_FRAME;
+ } else {
+ if (pixelFormatIsPlanar(getPixelFormat())) {
+ ScopeTimer timer(CopyImageProfilingZone);
+ for (unsigned i = 0; i < pBmps.size(); ++i) {
+ m_pFrameDecoder->copyPlaneToBmp(pBmps[i], m_pFrame->data[i],
+ m_pFrame->linesize[i]);
+ }
+ } else {
+ m_pFrameDecoder->convertFrameToBmp(m_pFrame, pBmps[0]);
+ }
+ return FA_NEW_FRAME;
+ }
+}
+
+void SyncVideoDecoder::throwAwayFrame(float timeWanted)
+{
+ AVG_ASSERT(getState() == DECODING);
+ readFrameForTime(m_pFrame, timeWanted);
+}
+
+bool SyncVideoDecoder::isEOF() const
+{
+ AVG_ASSERT(getState() == DECODING);
+ return m_pFrameDecoder->isEOF() && !m_bProcessingLastFrames;
+}
+
+FrameAvailableCode SyncVideoDecoder::readFrameForTime(AVFrame* pFrame, float timeWanted)
+{
+ AVG_ASSERT(getState() == DECODING);
+ float timePerFrame = 1.0f/m_FPS;
+ if (!m_bVideoSeekDone && timeWanted-m_pFrameDecoder->getCurTime() < 0.5f*timePerFrame)
+ {
+ // The last frame is still current. Display it again.
+ return FA_USE_LAST_FRAME;
+ } else {
+ bool bInvalidFrame = true;
+ while (bInvalidFrame && !isEOF()) {
+ readFrame(pFrame);
+ bInvalidFrame = m_pFrameDecoder->getCurTime()-timeWanted < -0.5f*timePerFrame;
+ }
+ }
+ if (m_bVideoSeekDone) {
+ m_bVideoSeekDone = false;
+ }
+ return FA_NEW_FRAME;
+}
+
+static ProfilingZoneID DecodeProfilingZone("FFMpeg: decode", true);
+
+void SyncVideoDecoder::readFrame(AVFrame* pFrame)
+{
+ AVG_ASSERT(getState() == DECODING);
+ ScopeTimer timer(DecodeProfilingZone);
+
+ if (m_bProcessingLastFrames) {
+ // EOF received, but last frames still need to be decoded.
+ bool bGotPicture = m_pFrameDecoder->decodeLastFrame(pFrame);
+ if (!bGotPicture) {
+ m_bProcessingLastFrames = false;
+ }
+ } else {
+ bool bDone = false;
+ while (!bDone) {
+ AVPacket* pPacket = m_pDemuxer->getPacket(getVStreamIndex());
+ m_bFirstPacket = false;
+ bool bGotPicture;
+ if (pPacket) {
+ bGotPicture = m_pFrameDecoder->decodePacket(pPacket, pFrame,
+ m_bVideoSeekDone);
+ } else {
+ bGotPicture = m_pFrameDecoder->decodeLastFrame(pFrame);
+ }
+ if (bGotPicture && m_pFrameDecoder->isEOF()) {
+ m_bProcessingLastFrames = true;
+ }
+ if (bGotPicture || m_pFrameDecoder->isEOF()) {
+ bDone = true;
+ }
+ }
+ }
+}
+
+}
+
diff --git a/src/video/SyncVideoDecoder.h b/src/video/SyncVideoDecoder.h
new file mode 100644
index 0000000..345e8f6
--- /dev/null
+++ b/src/video/SyncVideoDecoder.h
@@ -0,0 +1,77 @@
+//
+// 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 _SyncVideoDecoder_H_
+#define _SyncVideoDecoder_H_
+
+#include "../avgconfigwrapper.h"
+#include "VideoDecoder.h"
+#include "FFMpegDemuxer.h"
+#include "FFMpegFrameDecoder.h"
+
+namespace avg {
+
+class AVG_API SyncVideoDecoder: public VideoDecoder
+{
+ public:
+ SyncVideoDecoder();
+ virtual ~SyncVideoDecoder();
+ virtual void open(const std::string& sFilename, bool bUseHardwareAcceleration,
+ bool bEnableSound);
+ virtual void startDecoding(bool bDeliverYCbCr, const AudioParams* pAP);
+ virtual void close();
+
+
+ virtual int getCurFrame() const;
+ virtual int getNumFramesQueued() const;
+ virtual float getCurTime() const;
+ virtual float getFPS() const;
+ virtual void setFPS(float fps);
+ virtual FrameAvailableCode renderToBmps(std::vector<BitmapPtr>& pBmps,
+ float timeWanted);
+ virtual void throwAwayFrame(float timeWanted);
+
+ virtual void seek(float destTime);
+ virtual void loop();
+ virtual bool isEOF() const;
+
+ private:
+ FrameAvailableCode readFrameForTime(AVFrame* pFrame, float timeWanted);
+ void readFrame(AVFrame* pFrame);
+
+ FFMpegFrameDecoderPtr m_pFrameDecoder;
+ bool m_bVideoSeekDone;
+
+ FFMpegDemuxer * m_pDemuxer;
+
+ bool m_bProcessingLastFrames;
+ bool m_bFirstPacket;
+
+ bool m_bUseStreamFPS;
+ float m_FPS;
+ AVFrame* m_pFrame;
+};
+
+typedef boost::shared_ptr<SyncVideoDecoder> SyncVideoDecoderPtr;
+
+}
+#endif
+
diff --git a/src/video/VDPAU.cpp b/src/video/VDPAU.cpp
deleted file mode 100644
index c6d83a0..0000000
--- a/src/video/VDPAU.cpp
+++ /dev/null
@@ -1,393 +0,0 @@
-//
-// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 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 "VDPAU.h"
-#include "FrameAge.h"
-#include "AVCCOpaque.h"
-#include "../base/Exception.h"
-#include <iostream>
-
-using namespace std;
-
-namespace avg {
-
-VdpGetProcAddress* vdp_get_proc_address;
-VdpDeviceDestroy* vdp_device_destroy;
-VdpVideoSurfaceCreate* vdp_video_surface_create;
-VdpVideoSurfaceDestroy* vdp_video_surface_destroy;
-VdpDecoderCreate* vdp_decoder_create;
-VdpDecoderDestroy* vdp_decoder_destroy;
-VdpDecoderRender* vdp_decoder_render;
-VdpOutputSurfaceCreate* vdp_output_surface_create;
-VdpOutputSurfaceDestroy* vdp_output_surface_destroy;
-VdpOutputSurfaceGetBitsNative* vdp_output_surface_get_bits_native;
-VdpOutputSurfaceGetParameters* vdp_output_surface_get_parameters;
-VdpVideoSurfaceGetBitsYCbCr* vdp_video_surface_get_bits_y_cb_cr;
-VdpVideoMixerCreate* vdp_video_mixer_create;
-VdpVideoMixerDestroy* vdp_video_mixer_destroy;
-VdpVideoMixerRender* vdp_video_mixer_render;
-VdpPresentationQueueCreate* vdp_presentation_queue_create;
-VdpPresentationQueueDestroy* vdp_presentation_queue_destroy;
-VdpPresentationQueueGetTime* vdp_presentation_queue_get_time;
-VdpPresentationQueueTargetCreateX11* vdp_presentation_queue_target_create_x11;
-VdpPresentationQueueQuerySurfaceStatus* vdp_presentation_queue_query_surface_status;
-VdpPresentationQueueDisplay* vdp_presentation_queue_display;
-VdpPresentationQueueBlockUntilSurfaceIdle*
- vdp_presentation_queue_block_until_surface_idle;
-VdpVideoSurfaceGetParameters* vdp_video_surface_get_parameters;
-
-
-VdpDevice VDPAU::s_VDPDevice = 0;
-Display* VDPAU::s_pXDisplay = 0;
-bool VDPAU::s_bInitFailed = false;
-
-VDPAU::VDPAU()
- : m_VDPDecoder(VDP_INVALID_HANDLE),
- m_VDPMixer(VDP_INVALID_HANDLE),
- m_PixFmt(PIX_FMT_NONE),
- m_Size(-1,-1)
-{
- for (int i = 0; i < N_VIDEO_SURFACES; i++) {
- m_VideoSurfaces[i].m_Surface = VDP_INVALID_HANDLE;
- }
-}
-
-VDPAU::~VDPAU()
-{
- if (m_VDPMixer != VDP_INVALID_HANDLE) {
- vdp_video_mixer_destroy(m_VDPMixer);
- }
- if (m_VDPDecoder != VDP_INVALID_HANDLE) {
- vdp_decoder_destroy(m_VDPDecoder);
- }
- for (int i = 0; i < N_VIDEO_SURFACES; i++) {
- if (m_VideoSurfaces[i].m_Surface != VDP_INVALID_HANDLE) {
- vdp_video_surface_destroy(m_VideoSurfaces[i].m_Surface);
- }
- }
-}
-
-void VDPAU::safeGetProcAddress(VdpFuncId functionId, void** functionPointer)
-{
- VdpStatus status;
- status = vdp_get_proc_address(s_VDPDevice, functionId, functionPointer);
- AVG_ASSERT(status == VDP_STATUS_OK);
-}
-
-Display* VDPAU::getDisplay()
-{
- return s_pXDisplay;
-}
-
-bool VDPAU::staticInit()
-{
- if (s_VDPDevice) {
- return true;
- }
-
- if (s_bInitFailed) {
- return false;
- }
-
- s_pXDisplay = XOpenDisplay(0);
- if (!s_pXDisplay) {
- s_bInitFailed = true;
- return false;
- }
-
- VdpStatus status;
- status = vdp_device_create_x11(s_pXDisplay, DefaultScreen(s_pXDisplay),
- &s_VDPDevice, &vdp_get_proc_address);
- if (status != VDP_STATUS_OK) {
- s_bInitFailed = true;
- return false;
- }
-
- safeGetProcAddress(VDP_FUNC_ID_DEVICE_DESTROY, (void**)&vdp_device_destroy);
- safeGetProcAddress(VDP_FUNC_ID_OUTPUT_SURFACE_CREATE,
- (void**)&vdp_output_surface_create);
- safeGetProcAddress(VDP_FUNC_ID_OUTPUT_SURFACE_DESTROY,
- (void**)&vdp_output_surface_destroy);
- safeGetProcAddress(VDP_FUNC_ID_OUTPUT_SURFACE_GET_BITS_NATIVE,
- (void**)&vdp_output_surface_get_bits_native);
- safeGetProcAddress(VDP_FUNC_ID_VIDEO_SURFACE_CREATE,
- (void**)&vdp_video_surface_create);
- safeGetProcAddress(VDP_FUNC_ID_VIDEO_SURFACE_DESTROY,
- (void**)&vdp_video_surface_destroy);
- safeGetProcAddress(VDP_FUNC_ID_DECODER_CREATE, (void**)&vdp_decoder_create);
- safeGetProcAddress(VDP_FUNC_ID_DECODER_DESTROY, (void**)&vdp_decoder_destroy);
- safeGetProcAddress(VDP_FUNC_ID_DECODER_RENDER, (void**)&vdp_decoder_render);
- safeGetProcAddress(VDP_FUNC_ID_VIDEO_SURFACE_GET_BITS_Y_CB_CR,
- (void**)&vdp_video_surface_get_bits_y_cb_cr);
- safeGetProcAddress(VDP_FUNC_ID_VIDEO_MIXER_CREATE,
- (void**)&vdp_video_mixer_create);
- safeGetProcAddress(VDP_FUNC_ID_VIDEO_MIXER_DESTROY,
- (void**)&vdp_video_mixer_destroy);
- safeGetProcAddress(VDP_FUNC_ID_VIDEO_MIXER_RENDER,
- (void**)&vdp_video_mixer_render);
- safeGetProcAddress(VDP_FUNC_ID_PRESENTATION_QUEUE_CREATE,
- (void**)&vdp_presentation_queue_create);
- safeGetProcAddress(VDP_FUNC_ID_PRESENTATION_QUEUE_DESTROY,
- (void**)&vdp_presentation_queue_destroy);
- safeGetProcAddress(VDP_FUNC_ID_PRESENTATION_QUEUE_TARGET_CREATE_X11,
- (void**)&vdp_presentation_queue_target_create_x11);
- safeGetProcAddress(VDP_FUNC_ID_PRESENTATION_QUEUE_QUERY_SURFACE_STATUS,
- (void**)&vdp_presentation_queue_query_surface_status);
- safeGetProcAddress(VDP_FUNC_ID_PRESENTATION_QUEUE_DISPLAY,
- (void**)&vdp_presentation_queue_display);
- safeGetProcAddress(VDP_FUNC_ID_PRESENTATION_QUEUE_GET_TIME,
- (void**)&vdp_presentation_queue_get_time);
- safeGetProcAddress(VDP_FUNC_ID_PRESENTATION_QUEUE_BLOCK_UNTIL_SURFACE_IDLE,
- (void**)&vdp_presentation_queue_block_until_surface_idle);
- safeGetProcAddress(VDP_FUNC_ID_VIDEO_SURFACE_GET_PARAMETERS,
- (void**)&vdp_video_surface_get_parameters);
- safeGetProcAddress(VDP_FUNC_ID_OUTPUT_SURFACE_GET_PARAMETERS,
- (void**)&vdp_output_surface_get_parameters);
- return true;
-}
-
-void VDPAU::init()
-{
- if (!staticInit()) {
- return;
- }
- for (int i = 0; i < N_VIDEO_SURFACES; i++) {
- memset(&m_VideoSurfaces[i].m_RenderState, 0, sizeof(vdpau_render_state));
- m_VideoSurfaces[i].m_RenderState.surface = VDP_INVALID_HANDLE;
- m_VideoSurfaces[i].m_Size = IntPoint(-1,-1);
- }
-}
-
-bool VDPAU::isAvailable()
-{
- staticInit();
- return s_VDPDevice;
-}
-
-AVCodec* VDPAU::openCodec(AVCodecContext* pContext)
-{
- staticInit();
-
- AVCodec* pCodec = 0;
- switch (pContext->codec_id) {
- case CODEC_ID_MPEG1VIDEO:
- pCodec = avcodec_find_decoder_by_name("mpeg1video_vdpau");
- pCodec->id = CODEC_ID_MPEG1VIDEO;
- break;
- case CODEC_ID_MPEG2VIDEO:
- pCodec = avcodec_find_decoder_by_name("mpegvideo_vdpau");
- break;
- case CODEC_ID_H264:
- pCodec = avcodec_find_decoder_by_name("h264_vdpau");
- break;
- case CODEC_ID_WMV3:
- pCodec = avcodec_find_decoder_by_name("wmv3_vdpau");
- break;
- case CODEC_ID_VC1:
- pCodec = avcodec_find_decoder_by_name("vc1_vdpau");
- break;
- default:
- pCodec = 0;
- }
- if (!pCodec || !s_VDPDevice) {
- pCodec = avcodec_find_decoder(pContext->codec_id);
- } else {
- pContext->get_buffer = VDPAU::getBuffer;
- pContext->release_buffer = VDPAU::releaseBuffer;
- pContext->draw_horiz_band = VDPAU::drawHorizBand;
- pContext->get_format = VDPAU::getFormat;
- pContext->slice_flags = SLICE_FLAG_CODED_ORDER | SLICE_FLAG_ALLOW_FIELD;
- }
- return pCodec;
-}
-
-int VDPAU::getBuffer(AVCodecContext* pContext, AVFrame* pFrame)
-{
- AVCCOpaque* pOpaque = (AVCCOpaque*)pContext->opaque;
- FrameAge* pAge = pOpaque->getFrameAge();
- VDPAU* pVDPAU = pOpaque->getVDPAU();
- return pVDPAU->getBufferInternal(pContext, pFrame, pAge);
-}
-
-int VDPAU::getFreeSurfaceIndex()
-{
- for (int i = 0; i < N_VIDEO_SURFACES; i++) {
- vdpau_render_state* pRenderState = &m_VideoSurfaces[i].m_RenderState;
- if (!(pRenderState->state & FF_VDPAU_STATE_USED_FOR_REFERENCE)) {
- return i;
- }
- }
- AVG_ASSERT(false);
- return -1;
-}
-
-int VDPAU::getBufferInternal(AVCodecContext* pContext, AVFrame* pFrame,
- FrameAge* pAge)
-{
- VdpStatus status;
- int surfaceIndex = getFreeSurfaceIndex();
-
- VideoSurface* pVideoSurface = &m_VideoSurfaces[surfaceIndex];
- vdpau_render_state* pRenderState = &pVideoSurface->m_RenderState;
- pFrame->data[0] = (uint8_t*)pRenderState;
- pFrame->type = FF_BUFFER_TYPE_USER;
-
- if (pFrame->reference) { //I-P frame
- pFrame->age = pAge->m_IPAge0;
- pAge->m_IPAge0 = pAge->m_IPAge1;
- pAge->m_IPAge1 = 1;
- pAge->m_Age++;
- } else {
- pFrame->age = pAge->m_Age;
- pAge->m_IPAge0++;
- pAge->m_IPAge1++;
- pAge->m_Age = 1;
- }
- pRenderState->state |= FF_VDPAU_STATE_USED_FOR_REFERENCE;
-
- if (pVideoSurface->m_Size.x != pContext->width ||
- pVideoSurface->m_Size.y != pContext->height)
- {
- // allocate a new surface, freeing the old one, if any
- if (pVideoSurface->m_Surface != VDP_INVALID_HANDLE) {
- status = vdp_video_surface_destroy(pVideoSurface->m_Surface);
- AVG_ASSERT(status == VDP_STATUS_OK);
- }
- status = vdp_video_surface_create(s_VDPDevice, VDP_CHROMA_TYPE_420,
- pContext->width, pContext->height, &pVideoSurface->m_Surface);
- AVG_ASSERT(status == VDP_STATUS_OK);
- pVideoSurface->m_Size.x = pContext->width;
- pVideoSurface->m_Size.y = pContext->height;
- pVideoSurface->m_RenderState.surface = pVideoSurface->m_Surface;
- }
- return 0;
-}
-
-// does not release the render structure, that will be unlocked after getting data
-void VDPAU::releaseBuffer(struct AVCodecContext* pContext, AVFrame* pFrame)
-{
- pFrame->data[0] = 0;
-}
-
-
-// main rendering routine
-void VDPAU::drawHorizBand(struct AVCodecContext* pContext, const AVFrame* src,
- int offset[4], int y, int type, int height)
-{
- AVCCOpaque* pOpaque = (AVCCOpaque*)pContext->opaque;
- VDPAU* pVDPAU = pOpaque->getVDPAU();
- pVDPAU->render(pContext, src);
-}
-
-::PixelFormat VDPAU::getFormat(AVCodecContext* pContext, const ::PixelFormat* pFmt)
-{
- switch (pContext->codec_id) {
- case CODEC_ID_H264:
- return PIX_FMT_VDPAU_H264;
- case CODEC_ID_MPEG1VIDEO:
- return PIX_FMT_VDPAU_MPEG1;
- case CODEC_ID_MPEG2VIDEO:
- return PIX_FMT_VDPAU_MPEG2;
- case CODEC_ID_WMV3:
- return PIX_FMT_VDPAU_WMV3;
- case CODEC_ID_VC1:
- return PIX_FMT_VDPAU_VC1;
- default:
- return pFmt[0];
- }
-}
-
-void VDPAU::render(AVCodecContext* pContext, const AVFrame* pFrame)
-{
- vdpau_render_state* pRenderState = (vdpau_render_state*)pFrame->data[0];
- VdpStatus status;
- IntPoint size(pContext->width, pContext->height);
-
- if (pContext->pix_fmt != m_PixFmt || size != m_Size) {
- VdpDecoderProfile profile = 0;
- switch (pContext->pix_fmt) {
- case PIX_FMT_VDPAU_MPEG1:
- profile = VDP_DECODER_PROFILE_MPEG1;
- break;
- case PIX_FMT_VDPAU_MPEG2:
- profile = VDP_DECODER_PROFILE_MPEG2_MAIN;
- break;
- case PIX_FMT_VDPAU_H264:
- profile = VDP_DECODER_PROFILE_H264_HIGH;
- break;
- case PIX_FMT_VDPAU_WMV3:
- profile = VDP_DECODER_PROFILE_VC1_SIMPLE;
- break;
- case PIX_FMT_VDPAU_VC1:
- profile = VDP_DECODER_PROFILE_VC1_SIMPLE;
- break;
- default:
- AVG_ASSERT(false);
- }
- if (m_VDPMixer != VDP_INVALID_HANDLE) {
- status = vdp_video_mixer_destroy(m_VDPMixer);
- AVG_ASSERT(status == VDP_STATUS_OK);
- m_VDPMixer = VDP_INVALID_HANDLE;
- }
- if (m_VDPDecoder != VDP_INVALID_HANDLE) {
- status = vdp_decoder_destroy(m_VDPDecoder);
- AVG_ASSERT(status == VDP_STATUS_OK);
- m_VDPDecoder = VDP_INVALID_HANDLE;
- }
- status = vdp_decoder_create(s_VDPDevice, profile, size.x, size.y, 16,
- &m_VDPDecoder);
- AVG_ASSERT(status == VDP_STATUS_OK);
-
- m_PixFmt = pContext->pix_fmt;
- m_Size = size;
-
- VdpVideoMixerFeature features[] = {
- VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL,
- VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL_SPATIAL,
- };
- VdpVideoMixerParameter params[] = {
- VDP_VIDEO_MIXER_PARAMETER_VIDEO_SURFACE_WIDTH,
- VDP_VIDEO_MIXER_PARAMETER_VIDEO_SURFACE_HEIGHT,
- VDP_VIDEO_MIXER_PARAMETER_CHROMA_TYPE,
- VDP_VIDEO_MIXER_PARAMETER_LAYERS
- };
- VdpChromaType chroma = VDP_CHROMA_TYPE_420;
- int numLayers = 0;
- void const* paramValues [] = { &m_Size.x, &m_Size.y, &chroma, &numLayers };
-
- status = vdp_video_mixer_create(s_VDPDevice, 2, features, 4, params, paramValues,
- &m_VDPMixer);
- AVG_ASSERT(status == VDP_STATUS_OK);
- }
-
- status = vdp_decoder_render(m_VDPDecoder, pRenderState->surface,
- (VdpPictureInfo const*)&(pRenderState->info),
- pRenderState->bitstream_buffers_used, pRenderState->bitstream_buffers);
- AVG_ASSERT(status == VDP_STATUS_OK);
-}
-
-void VDPAU::unlockSurface(vdpau_render_state* pRenderState)
-{
- pRenderState->state &= ~FF_VDPAU_STATE_USED_FOR_REFERENCE;
-}
-
-}
-
-
diff --git a/src/video/VDPAUDecoder.cpp b/src/video/VDPAUDecoder.cpp
new file mode 100644
index 0000000..e678857
--- /dev/null
+++ b/src/video/VDPAUDecoder.cpp
@@ -0,0 +1,249 @@
+//
+// 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 "VDPAUDecoder.h"
+#include "VDPAUHelper.h"
+
+#include "../base/Exception.h"
+
+#include <iostream>
+
+/*
+Notes on adding Render-to-texture support:
+- For every Surface, call
+ VDPAURegisterSurfaceNV()
+ VDPAUSurfaceAccessNV(..., READ)
+- VideoNode: Create OGLSurface and GLTexture objs each frame from texids,
+ map VDPAU surfaces while textures exist.
+- New OGLSurface pixel format VDPAU_INTERLACED
+- Support new OGLSurface pixel format in shader
+*/
+
+using namespace std;
+
+namespace avg {
+
+VDPAUDecoder::VDPAUDecoder()
+ : m_VDPDecoder(VDP_INVALID_HANDLE),
+ m_VDPMixer(VDP_INVALID_HANDLE),
+ m_PixFmt(PIX_FMT_NONE),
+ m_Size(-1,-1)
+{
+}
+
+VDPAUDecoder::~VDPAUDecoder()
+{
+ if (m_VDPMixer != VDP_INVALID_HANDLE) {
+ vdp_video_mixer_destroy(m_VDPMixer);
+ }
+ if (m_VDPDecoder != VDP_INVALID_HANDLE) {
+ vdp_decoder_destroy(m_VDPDecoder);
+ }
+ for (unsigned i = 0; i < m_RenderStates.size(); i++) {
+ vdp_video_surface_destroy(m_RenderStates[i]->surface);
+ delete m_RenderStates[i];
+ }
+}
+
+AVCodec* VDPAUDecoder::openCodec(AVCodecContext* pContext)
+{
+ if (!isAvailable()) {
+ return 0;
+ }
+
+ AVCodec* pCodec = 0;
+ switch (pContext->codec_id) {
+ case CODEC_ID_MPEG1VIDEO:
+ pCodec = avcodec_find_decoder_by_name("mpeg1video_vdpau");
+ pCodec->id = CODEC_ID_MPEG1VIDEO;
+ break;
+ case CODEC_ID_MPEG2VIDEO:
+ pCodec = avcodec_find_decoder_by_name("mpegvideo_vdpau");
+ break;
+ case CODEC_ID_H264:
+ pCodec = avcodec_find_decoder_by_name("h264_vdpau");
+ break;
+ case CODEC_ID_WMV3:
+ pCodec = avcodec_find_decoder_by_name("wmv3_vdpau");
+ break;
+ case CODEC_ID_VC1:
+ pCodec = avcodec_find_decoder_by_name("vc1_vdpau");
+ break;
+ default:
+ pCodec = 0;
+ }
+ if (pCodec) {
+ pContext->get_buffer = VDPAUDecoder::getBuffer;
+ pContext->release_buffer = VDPAUDecoder::releaseBuffer;
+ pContext->draw_horiz_band = VDPAUDecoder::drawHorizBand;
+ pContext->get_format = VDPAUDecoder::getFormat;
+ pContext->slice_flags = SLICE_FLAG_CODED_ORDER | SLICE_FLAG_ALLOW_FIELD;
+ m_Size = IntPoint(pContext->width, pContext->height);
+ }
+ return pCodec;
+}
+
+bool VDPAUDecoder::isAvailable()
+{
+#if LIBAVCODEC_VERSION_INT > AV_VERSION_INT(53, 34, 0)
+ return getVDPAUDevice() != 0;
+#else
+ return false;
+#endif
+}
+
+int VDPAUDecoder::getBuffer(AVCodecContext* pContext, AVFrame* pFrame)
+{
+ VDPAUDecoder* pVDPAUDecoder = (VDPAUDecoder*)pContext->opaque;
+ return pVDPAUDecoder->getBufferInternal(pContext, pFrame);
+}
+
+// does not release the render structure, that will be unlocked after getting data
+void VDPAUDecoder::releaseBuffer(struct AVCodecContext* pContext, AVFrame* pFrame)
+{
+ pFrame->data[0] = 0;
+}
+
+
+// main rendering routine
+void VDPAUDecoder::drawHorizBand(struct AVCodecContext* pContext, const AVFrame* src,
+ int offset[4], int y, int type, int height)
+{
+ VDPAUDecoder* pVDPAUDecoder = (VDPAUDecoder*)pContext->opaque;
+ pVDPAUDecoder->render(pContext, src);
+}
+
+AVPixelFormat VDPAUDecoder::getFormat(AVCodecContext* pContext, const AVPixelFormat* pFmt)
+{
+ switch (pContext->codec_id) {
+ case CODEC_ID_H264:
+ return PIX_FMT_VDPAU_H264;
+ case CODEC_ID_MPEG1VIDEO:
+ return PIX_FMT_VDPAU_MPEG1;
+ case CODEC_ID_MPEG2VIDEO:
+ return PIX_FMT_VDPAU_MPEG2;
+ case CODEC_ID_WMV3:
+ return PIX_FMT_VDPAU_WMV3;
+ case CODEC_ID_VC1:
+ return PIX_FMT_VDPAU_VC1;
+ default:
+ return pFmt[0];
+ }
+}
+
+vdpau_render_state* VDPAUDecoder::getFreeRenderState()
+{
+ for (unsigned i = 0; i < m_RenderStates.size(); i++) {
+ vdpau_render_state* pRenderState = m_RenderStates[i];
+ if (!(pRenderState->state & FF_VDPAU_STATE_USED_FOR_REFERENCE)) {
+ return m_RenderStates[i];
+ }
+ }
+
+ // No free surfaces available -> create new surface
+ vdpau_render_state* pRenderState = new vdpau_render_state;
+ m_RenderStates.push_back(pRenderState);
+ memset(pRenderState, 0, sizeof(vdpau_render_state));
+ pRenderState->surface = VDP_INVALID_HANDLE;
+ VdpStatus status = vdp_video_surface_create(getVDPAUDevice(), VDP_CHROMA_TYPE_420,
+ m_Size.x, m_Size.y, &pRenderState->surface);
+ AVG_ASSERT(status == VDP_STATUS_OK);
+
+ return pRenderState;
+}
+
+int VDPAUDecoder::getBufferInternal(AVCodecContext* pContext, AVFrame* pFrame)
+{
+ vdpau_render_state* pRenderState = getFreeRenderState();
+ pFrame->data[0] = (uint8_t*)pRenderState;
+ pFrame->type = FF_BUFFER_TYPE_USER;
+
+ pRenderState->state |= FF_VDPAU_STATE_USED_FOR_REFERENCE;
+ return 0;
+}
+
+void VDPAUDecoder::render(AVCodecContext* pContext, const AVFrame* pFrame)
+{
+ vdpau_render_state* pRenderState = (vdpau_render_state*)pFrame->data[0];
+
+ if (m_VDPDecoder == VDP_INVALID_HANDLE) {
+ setupDecoder(pContext);
+ }
+
+ VdpStatus status = vdp_decoder_render(m_VDPDecoder, pRenderState->surface,
+ (VdpPictureInfo const*)&(pRenderState->info),
+ pRenderState->bitstream_buffers_used, pRenderState->bitstream_buffers);
+ AVG_ASSERT(status == VDP_STATUS_OK);
+}
+
+void VDPAUDecoder::setupDecoder(AVCodecContext* pContext)
+{
+ VdpStatus status;
+
+ // Create new decoder and mixer.
+ VdpDecoderProfile profile = 0;
+ switch (pContext->pix_fmt) {
+ case PIX_FMT_VDPAU_MPEG1:
+ profile = VDP_DECODER_PROFILE_MPEG1;
+ break;
+ case PIX_FMT_VDPAU_MPEG2:
+ profile = VDP_DECODER_PROFILE_MPEG2_MAIN;
+ break;
+ case PIX_FMT_VDPAU_H264:
+ profile = VDP_DECODER_PROFILE_H264_HIGH;
+ break;
+ case PIX_FMT_VDPAU_WMV3:
+ profile = VDP_DECODER_PROFILE_VC1_SIMPLE;
+ break;
+ case PIX_FMT_VDPAU_VC1:
+ profile = VDP_DECODER_PROFILE_VC1_SIMPLE;
+ break;
+ default:
+ AVG_ASSERT(false);
+ }
+ status = vdp_decoder_create(getVDPAUDevice(), profile, m_Size.x, m_Size.y, 16,
+ &m_VDPDecoder);
+ AVG_ASSERT(status == VDP_STATUS_OK);
+
+ m_PixFmt = pContext->pix_fmt;
+
+ VdpVideoMixerFeature features[] = {
+ VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL,
+ VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL_SPATIAL,
+ };
+ VdpVideoMixerParameter params[] = {
+ VDP_VIDEO_MIXER_PARAMETER_VIDEO_SURFACE_WIDTH,
+ VDP_VIDEO_MIXER_PARAMETER_VIDEO_SURFACE_HEIGHT,
+ VDP_VIDEO_MIXER_PARAMETER_CHROMA_TYPE,
+ VDP_VIDEO_MIXER_PARAMETER_LAYERS
+ };
+ VdpChromaType chroma = VDP_CHROMA_TYPE_420;
+ int numLayers = 0;
+ void const* paramValues [] = { &m_Size.x, &m_Size.y, &chroma, &numLayers };
+
+ status = vdp_video_mixer_create(getVDPAUDevice(), 2, features, 4, params,
+ paramValues, &m_VDPMixer);
+ AVG_ASSERT(status == VDP_STATUS_OK);
+
+}
+
+}
+
+
diff --git a/src/video/VDPAUDecoder.h b/src/video/VDPAUDecoder.h
new file mode 100644
index 0000000..15dc5b4
--- /dev/null
+++ b/src/video/VDPAUDecoder.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 _VDPAUDecoder_H_
+#define _VDPAUDecoder_H_
+
+
+#include "../avgconfigwrapper.h"
+#include "../base/GLMHelper.h"
+
+#include "WrapFFMpeg.h"
+
+#include <vdpau/vdpau.h>
+#include <libavcodec/vdpau.h>
+
+namespace avg {
+
+class VDPAUDecoder
+{
+public:
+ VDPAUDecoder();
+ ~VDPAUDecoder();
+ AVCodec* openCodec(AVCodecContext* pCodec);
+
+ static bool isAvailable();
+
+private:
+ // Callbacks
+ static int getBuffer(AVCodecContext* pContext, AVFrame* pFrame);
+ static void releaseBuffer(struct AVCodecContext* pContext, AVFrame* pFrame);
+ static void drawHorizBand(AVCodecContext* pContext, const AVFrame* pFrame,
+ int offset[4], int y, int type, int height);
+ static AVPixelFormat getFormat(AVCodecContext* pContext, const AVPixelFormat* pFmt);
+
+ vdpau_render_state* getFreeRenderState();
+ int getBufferInternal(AVCodecContext* pContext, AVFrame* pFrame);
+ void render(AVCodecContext* pContext, const AVFrame* pFrame);
+ void setupDecoder(AVCodecContext* pContext);
+
+ VdpDecoder m_VDPDecoder;
+ VdpVideoMixer m_VDPMixer;
+ AVPixelFormat m_PixFmt;
+ IntPoint m_Size;
+ std::vector<vdpau_render_state*> m_RenderStates;
+
+};
+
+}
+#endif
+
diff --git a/src/video/VDPAUHelper.cpp b/src/video/VDPAUHelper.cpp
new file mode 100644
index 0000000..36d8a9f
--- /dev/null
+++ b/src/video/VDPAUHelper.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 "VDPAUHelper.h"
+
+#include "../base/Exception.h"
+#include "../base/ConfigMgr.h"
+
+#include "../graphics/Bitmap.h"
+
+#include <dlfcn.h>
+
+using namespace std;
+
+namespace avg {
+
+VdpGetProcAddress* vdp_get_proc_address;
+
+VdpVideoSurfaceGetParameters* vdp_video_surface_get_parameters;
+VdpVideoSurfaceGetBitsYCbCr* vdp_video_surface_get_bits_y_cb_cr;
+VdpVideoSurfaceCreate* vdp_video_surface_create;
+VdpVideoSurfaceDestroy* vdp_video_surface_destroy;
+
+VdpDeviceDestroy* vdp_device_destroy;
+
+VdpDecoderCreate* vdp_decoder_create;
+VdpDecoderDestroy* vdp_decoder_destroy;
+VdpDecoderRender* vdp_decoder_render;
+
+VdpOutputSurfaceCreate* vdp_output_surface_create;
+VdpOutputSurfaceDestroy* vdp_output_surface_destroy;
+VdpOutputSurfaceGetBitsNative* vdp_output_surface_get_bits_native;
+VdpOutputSurfaceGetParameters* vdp_output_surface_get_parameters;
+
+VdpVideoMixerCreate* vdp_video_mixer_create;
+VdpVideoMixerDestroy* vdp_video_mixer_destroy;
+VdpVideoMixerRender* vdp_video_mixer_render;
+
+VdpPresentationQueueCreate* vdp_presentation_queue_create;
+VdpPresentationQueueDestroy* vdp_presentation_queue_destroy;
+VdpPresentationQueueGetTime* vdp_presentation_queue_get_time;
+VdpPresentationQueueTargetCreateX11* vdp_presentation_queue_target_create_x11;
+VdpPresentationQueueQuerySurfaceStatus* vdp_presentation_queue_query_surface_status;
+VdpPresentationQueueDisplay* vdp_presentation_queue_display;
+VdpPresentationQueueBlockUntilSurfaceIdle*
+ vdp_presentation_queue_block_until_surface_idle;
+
+
+void safeGetProcAddress(VdpFuncId functionId, void** functionPointer)
+{
+ VdpStatus status;
+ status = vdp_get_proc_address(getVDPAUDevice(), functionId, functionPointer);
+ AVG_ASSERT(status == VDP_STATUS_OK);
+}
+
+VdpDevice getVDPAUDevice()
+{
+ static VdpDevice vdpDevice = 0;
+ static bool bInitFailed = false;
+
+ if (vdpDevice) {
+ return vdpDevice;
+ }
+
+ if (bInitFailed) {
+ return 0;
+ }
+
+ Display* pXDisplay = XOpenDisplay(0);
+ AVG_ASSERT(pXDisplay);
+
+ if (!(ConfigMgr::get()->getBoolOption("scr", "videoaccel", true))) {
+ bInitFailed = true;
+ return 0;
+ }
+ VdpStatus status;
+ status = vdp_device_create_x11(pXDisplay, DefaultScreen(pXDisplay), &vdpDevice,
+ &vdp_get_proc_address);
+ if (status != VDP_STATUS_OK)
+ {
+ bInitFailed = true;
+ return 0;
+ }
+
+ safeGetProcAddress(VDP_FUNC_ID_DEVICE_DESTROY, (void**)&vdp_device_destroy);
+ safeGetProcAddress(VDP_FUNC_ID_OUTPUT_SURFACE_CREATE,
+ (void**)&vdp_output_surface_create);
+ safeGetProcAddress(VDP_FUNC_ID_OUTPUT_SURFACE_DESTROY,
+ (void**)&vdp_output_surface_destroy);
+ safeGetProcAddress(VDP_FUNC_ID_OUTPUT_SURFACE_GET_BITS_NATIVE,
+ (void**)&vdp_output_surface_get_bits_native);
+ safeGetProcAddress(VDP_FUNC_ID_VIDEO_SURFACE_CREATE,
+ (void**)&vdp_video_surface_create);
+ safeGetProcAddress(VDP_FUNC_ID_VIDEO_SURFACE_DESTROY,
+ (void**)&vdp_video_surface_destroy);
+ safeGetProcAddress(VDP_FUNC_ID_DECODER_CREATE, (void**)&vdp_decoder_create);
+ safeGetProcAddress(VDP_FUNC_ID_DECODER_DESTROY, (void**)&vdp_decoder_destroy);
+ safeGetProcAddress(VDP_FUNC_ID_DECODER_RENDER, (void**)&vdp_decoder_render);
+ safeGetProcAddress(VDP_FUNC_ID_VIDEO_SURFACE_GET_BITS_Y_CB_CR,
+ (void**)&vdp_video_surface_get_bits_y_cb_cr);
+ safeGetProcAddress(VDP_FUNC_ID_VIDEO_MIXER_CREATE,
+ (void**)&vdp_video_mixer_create);
+ safeGetProcAddress(VDP_FUNC_ID_VIDEO_MIXER_DESTROY,
+ (void**)&vdp_video_mixer_destroy);
+ safeGetProcAddress(VDP_FUNC_ID_VIDEO_MIXER_RENDER,
+ (void**)&vdp_video_mixer_render);
+ safeGetProcAddress(VDP_FUNC_ID_PRESENTATION_QUEUE_CREATE,
+ (void**)&vdp_presentation_queue_create);
+ safeGetProcAddress(VDP_FUNC_ID_PRESENTATION_QUEUE_DESTROY,
+ (void**)&vdp_presentation_queue_destroy);
+ safeGetProcAddress(VDP_FUNC_ID_PRESENTATION_QUEUE_TARGET_CREATE_X11,
+ (void**)&vdp_presentation_queue_target_create_x11);
+ safeGetProcAddress(VDP_FUNC_ID_PRESENTATION_QUEUE_QUERY_SURFACE_STATUS,
+ (void**)&vdp_presentation_queue_query_surface_status);
+ safeGetProcAddress(VDP_FUNC_ID_PRESENTATION_QUEUE_DISPLAY,
+ (void**)&vdp_presentation_queue_display);
+ safeGetProcAddress(VDP_FUNC_ID_PRESENTATION_QUEUE_GET_TIME,
+ (void**)&vdp_presentation_queue_get_time);
+ safeGetProcAddress(VDP_FUNC_ID_PRESENTATION_QUEUE_BLOCK_UNTIL_SURFACE_IDLE,
+ (void**)&vdp_presentation_queue_block_until_surface_idle);
+ safeGetProcAddress(VDP_FUNC_ID_VIDEO_SURFACE_GET_PARAMETERS,
+ (void**)&vdp_video_surface_get_parameters);
+ safeGetProcAddress(VDP_FUNC_ID_OUTPUT_SURFACE_GET_PARAMETERS,
+ (void**)&vdp_output_surface_get_parameters);
+ return vdpDevice;
+}
+
+void getPlanesFromVDPAU(vdpau_render_state* pRenderState, BitmapPtr pBmpY,
+ BitmapPtr pBmpU, BitmapPtr pBmpV)
+{
+ VdpStatus status;
+ void *dest[3] = {
+ pBmpY->getPixels(),
+ pBmpV->getPixels(),
+ pBmpU->getPixels()
+ };
+ uint32_t pitches[3] = {
+ uint32_t(pBmpY->getStride()),
+ uint32_t(pBmpV->getStride()),
+ uint32_t(pBmpU->getStride())
+ };
+ status = vdp_video_surface_get_bits_y_cb_cr(pRenderState->surface,
+ VDP_YCBCR_FORMAT_YV12, dest, pitches);
+ AVG_ASSERT(status == VDP_STATUS_OK);
+ unlockVDPAUSurface(pRenderState);
+}
+
+void getBitmapFromVDPAU(vdpau_render_state* pRenderState, BitmapPtr pBmpDest)
+{
+ IntPoint YSize = pBmpDest->getSize();
+ IntPoint UVSize(YSize.x/2, YSize.y/2);
+ BitmapPtr pBmpY(new Bitmap(YSize, I8));
+ BitmapPtr pBmpU(new Bitmap(UVSize, I8));
+ BitmapPtr pBmpV(new Bitmap(UVSize, I8));
+ getPlanesFromVDPAU(pRenderState, pBmpY, pBmpU, pBmpV);
+ pBmpDest->copyYUVPixels(*pBmpY, *pBmpU, *pBmpV, false);
+}
+
+void unlockVDPAUSurface(vdpau_render_state* pRenderState)
+{
+ pRenderState->state &= ~FF_VDPAU_STATE_USED_FOR_REFERENCE;
+}
+
+}
diff --git a/src/video/VDPAU.h b/src/video/VDPAUHelper.h
index b2d8a1b..8767520 100644
--- a/src/video/VDPAU.h
+++ b/src/video/VDPAUHelper.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -18,51 +18,43 @@
//
// Current versions can be found at www.libavg.de
//
-#ifndef _VDPAU_H_
-#define _VDPAU_H_
+#ifndef _VDPAUHelper_H_
+#define _VDPAUHelper_H_
#include "../avgconfigwrapper.h"
-#include "../graphics/GL/glx.h"
-
-#include "WrapFFMpeg.h"
-#include "../base/Point.h"
#include <vdpau/vdpau.h>
#include <libavcodec/vdpau.h>
-
+#include <boost/shared_ptr.hpp>
namespace avg {
-#define N_VIDEO_SURFACES 64
+class Bitmap;
+typedef boost::shared_ptr<Bitmap> BitmapPtr;
-struct FrameAge;
-
-struct VideoSurface
-{
- struct vdpau_render_state m_RenderState;
- VdpVideoSurface m_Surface;
- IntPoint m_Size;
-};
+extern VdpGetProcAddress* vdp_get_proc_address;
extern VdpVideoSurfaceGetParameters* vdp_video_surface_get_parameters;
extern VdpVideoSurfaceGetBitsYCbCr* vdp_video_surface_get_bits_y_cb_cr;
-extern VdpOutputSurfaceDestroy* vdp_output_surface_destroy;
-extern VdpGetProcAddress* vdp_get_proc_address;
-extern VdpDeviceDestroy* vdp_device_destroy;
extern VdpVideoSurfaceCreate* vdp_video_surface_create;
extern VdpVideoSurfaceDestroy* vdp_video_surface_destroy;
+
+extern VdpDeviceDestroy* vdp_device_destroy;
+
extern VdpDecoderCreate* vdp_decoder_create;
extern VdpDecoderDestroy* vdp_decoder_destroy;
extern VdpDecoderRender* vdp_decoder_render;
+
extern VdpOutputSurfaceCreate* vdp_output_surface_create;
extern VdpOutputSurfaceDestroy* vdp_output_surface_destroy;
extern VdpOutputSurfaceGetBitsNative* vdp_output_surface_get_bits_native;
extern VdpOutputSurfaceGetParameters* vdp_output_surface_get_parameters;
-extern VdpVideoSurfaceGetBitsYCbCr* vdp_video_surface_get_bits_y_cb_cr;
+
extern VdpVideoMixerCreate* vdp_video_mixer_create;
extern VdpVideoMixerDestroy* vdp_video_mixer_destroy;
extern VdpVideoMixerRender* vdp_video_mixer_render;
+
extern VdpPresentationQueueCreate* vdp_presentation_queue_create;
extern VdpPresentationQueueDestroy* vdp_presentation_queue_destroy;
extern VdpPresentationQueueGetTime* vdp_presentation_queue_get_time;
@@ -72,43 +64,14 @@ extern VdpPresentationQueueQuerySurfaceStatus*
extern VdpPresentationQueueDisplay* vdp_presentation_queue_display;
extern VdpPresentationQueueBlockUntilSurfaceIdle*
vdp_presentation_queue_block_until_surface_idle;
-extern VdpVideoSurfaceGetParameters* vdp_video_surface_get_parameters;
-class VDPAU
-{
-public:
- VDPAU();
- ~VDPAU();
- AVCodec* openCodec(AVCodecContext* pCodec);
- void init();
- Display* getDisplay();
- static void unlockSurface(vdpau_render_state* pRenderState);
- static bool isAvailable();
-
-private:
- static bool staticInit();
- static int getBuffer(AVCodecContext* pContext, AVFrame* pFrame);
- int getFreeSurfaceIndex();
- int getBufferInternal(AVCodecContext* pContext, AVFrame* pFrame, FrameAge* pAge);
- static void releaseBuffer(struct AVCodecContext* pContext, AVFrame* pFrame);
- static void drawHorizBand(AVCodecContext* pContext, const AVFrame* pFrame,
- int offset[4], int y, int type, int height);
- static ::PixelFormat getFormat(AVCodecContext* pContext, const ::PixelFormat* pFmt);
- void render(AVCodecContext* pContext, const AVFrame* pFrame);
- static void safeGetProcAddress(VdpFuncId function_id, void** function_pointer);
-
- static VdpDevice s_VDPDevice;
- static Display* s_pXDisplay;
- static bool s_bInitFailed;
-
- VdpDecoder m_VDPDecoder;
- VdpVideoMixer m_VDPMixer;
- ::PixelFormat m_PixFmt;
- IntPoint m_Size;
- VideoSurface m_VideoSurfaces[N_VIDEO_SURFACES];
-
-};
+VdpDevice getVDPAUDevice();
+
+void getPlanesFromVDPAU(vdpau_render_state* pRenderState, BitmapPtr pBmpY,
+ BitmapPtr pBmpU, BitmapPtr pBmpV);
+void getBitmapFromVDPAU(vdpau_render_state* pRenderState, BitmapPtr pBmpDest);
+void unlockVDPAUSurface(vdpau_render_state* pRenderState);
}
#endif
diff --git a/src/video/VideoDecoder.cpp b/src/video/VideoDecoder.cpp
index e18fa73..d99c892 100644
--- a/src/video/VideoDecoder.cpp
+++ b/src/video/VideoDecoder.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -20,21 +20,492 @@
//
#include "VideoDecoder.h"
+#ifdef AVG_ENABLE_VDPAU
+#include "VDPAUDecoder.h"
+#endif
+
#include "../base/Exception.h"
+#include "../base/Logger.h"
+#include "../base/ObjectCounter.h"
+#include "../base/StringHelper.h"
+
+#include "../graphics/Bitmap.h"
+#include "../graphics/BitmapLoader.h"
+#include "../graphics/GLTexture.h"
+
+#include <string>
+
+#include "WrapFFMpeg.h"
+
+using namespace std;
+using namespace boost;
namespace avg {
-FrameAvailableCode VideoDecoder::renderToBmp(BitmapPtr pBmp, double timeWanted)
+bool VideoDecoder::s_bInitialized = false;
+boost::mutex VideoDecoder::s_OpenMutex;
+
+
+VideoDecoder::VideoDecoder()
+ : m_State(CLOSED),
+ m_pFormatContext(0),
+ m_VStreamIndex(-1),
+ m_pVStream(0),
+ m_PF(NO_PIXELFORMAT),
+ m_Size(0,0),
+#ifdef AVG_ENABLE_VDPAU
+ m_pVDPAUDecoder(0),
+#endif
+ m_AStreamIndex(-1),
+ m_pAStream(0)
+{
+ ObjectCounter::get()->incRef(&typeid(*this));
+ initVideoSupport();
+}
+
+VideoDecoder::~VideoDecoder()
+{
+ if (m_pFormatContext) {
+ close();
+ }
+#ifdef AVG_ENABLE_VDPAU
+ if (m_pVDPAUDecoder) {
+ delete m_pVDPAUDecoder;
+ }
+#endif
+ ObjectCounter::get()->decRef(&typeid(*this));
+}
+
+void VideoDecoder::open(const string& sFilename, bool bUseHardwareAcceleration,
+ bool bEnableSound)
+{
+ lock_guard lock(s_OpenMutex);
+ int err;
+ m_sFilename = sFilename;
+
+ AVG_TRACE(Logger::category::MEMORY, Logger::severity::INFO, "Opening " << sFilename);
+#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(53,2,0)
+ err = avformat_open_input(&m_pFormatContext, sFilename.c_str(), 0, 0);
+#else
+ AVFormatParameters params;
+ memset(&params, 0, sizeof(params));
+ err = av_open_input_file(&m_pFormatContext, sFilename.c_str(), 0, 0, &params);
+#endif
+ if (err < 0) {
+ m_sFilename = "";
+ m_pFormatContext = 0;
+ avcodecError(sFilename, err);
+ }
+
+#if LIBAVCODEC_VERSION_INT > AV_VERSION_INT(53, 8, 0)
+ err = avformat_find_stream_info(m_pFormatContext, 0);
+#else
+ err = av_find_stream_info(m_pFormatContext);
+#endif
+
+ if (err < 0) {
+ m_sFilename = "";
+ m_pFormatContext = 0;
+ throw Exception(AVG_ERR_VIDEO_INIT_FAILED,
+ sFilename + ": Could not find codec parameters.");
+ }
+ if (strcmp(m_pFormatContext->iformat->name, "image2") == 0) {
+ m_sFilename = "";
+ m_pFormatContext = 0;
+ throw Exception(AVG_ERR_VIDEO_INIT_FAILED,
+ sFilename + ": Image files not supported as videos.");
+ }
+ av_read_play(m_pFormatContext);
+
+ // Find audio and video streams in the file
+ m_VStreamIndex = -1;
+ m_AStreamIndex = -1;
+ for (unsigned i = 0; i < m_pFormatContext->nb_streams; i++) {
+ AVCodecContext* pContext = m_pFormatContext->streams[i]->codec;
+ switch (pContext->codec_type) {
+ case AVMEDIA_TYPE_VIDEO:
+ if (m_VStreamIndex < 0) {
+ m_VStreamIndex = i;
+ }
+ break;
+ case AVMEDIA_TYPE_AUDIO:
+ if (m_AStreamIndex < 0 && bEnableSound) {
+ m_AStreamIndex = i;
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ // Enable video stream demuxing
+ if (m_VStreamIndex >= 0) {
+ m_pVStream = m_pFormatContext->streams[m_VStreamIndex];
+
+ m_Size = IntPoint(m_pVStream->codec->width, m_pVStream->codec->height);
+
+ char szCodec[256];
+ avcodec_string(szCodec, sizeof(szCodec), m_pVStream->codec, 0);
+ int rc = openCodec(m_VStreamIndex, bUseHardwareAcceleration);
+ if (rc == -1) {
+ m_VStreamIndex = -1;
+ m_pVStream = 0;
+ throw Exception(AVG_ERR_VIDEO_INIT_FAILED,
+ sFilename + ": unsupported video codec ("+szCodec+").");
+ }
+ m_PF = calcPixelFormat(true);
+ }
+ // Enable audio stream demuxing.
+ if (m_AStreamIndex >= 0) {
+ m_pAStream = m_pFormatContext->streams[m_AStreamIndex];
+ char szCodec[256];
+ avcodec_string(szCodec, sizeof(szCodec), m_pAStream->codec, 0);
+ int rc = openCodec(m_AStreamIndex, false);
+ if (rc == -1) {
+ m_AStreamIndex = -1;
+ m_pAStream = 0;
+ throw Exception(AVG_ERR_VIDEO_INIT_FAILED,
+ sFilename + ": unsupported audio codec ("+szCodec+").");
+ }
+ }
+ if (!m_pVStream && !m_pAStream) {
+ throw Exception(AVG_ERR_VIDEO_INIT_FAILED,
+ sFilename + ": no usable streams found.");
+ }
+
+ m_State = OPENED;
+}
+
+void VideoDecoder::startDecoding(bool bDeliverYCbCr, const AudioParams* pAP)
+{
+ AVG_ASSERT(m_State == OPENED);
+ if (m_VStreamIndex >= 0) {
+ m_PF = calcPixelFormat(bDeliverYCbCr);
+ }
+ bool bAudioEnabled = (pAP!=0);
+ if (!bAudioEnabled) {
+ m_AStreamIndex = -1;
+ if (m_pAStream) {
+ avcodec_close(m_pAStream->codec);
+ }
+ m_pAStream = 0;
+ }
+
+ if (m_AStreamIndex >= 0) {
+ if (m_pAStream->codec->channels > pAP->m_Channels) {
+ throw Exception(AVG_ERR_VIDEO_INIT_FAILED,
+ m_sFilename + ": unsupported number of audio channels (" +
+ toString(m_pAStream->codec->channels) + ").");
+ m_AStreamIndex = -1;
+ m_pAStream = 0;
+ }
+ }
+
+ if (!m_pVStream && !m_pAStream) {
+ throw Exception(AVG_ERR_VIDEO_INIT_FAILED,
+ m_sFilename + ": no usable streams found.");
+ }
+
+ m_State = DECODING;
+}
+
+void VideoDecoder::close()
+{
+ lock_guard lock(s_OpenMutex);
+ AVG_TRACE(Logger::category::MEMORY, Logger::severity::INFO, "Closing " << m_sFilename);
+
+ // Close audio and video codecs
+ if (m_pVStream) {
+ avcodec_close(m_pVStream->codec);
+ m_pVStream = 0;
+ m_VStreamIndex = -1;
+ }
+
+ if (m_pAStream) {
+ avcodec_close(m_pAStream->codec);
+ m_pAStream = 0;
+ m_AStreamIndex = -1;
+ }
+ if (m_pFormatContext) {
+#if LIBAVCODEC_VERSION_INT > AV_VERSION_INT(53, 21, 0)
+ avformat_close_input(&m_pFormatContext);
+#else
+ av_close_input_file(m_pFormatContext);
+ m_pFormatContext = 0;
+#endif
+ }
+
+ m_State = CLOSED;
+}
+
+VideoDecoder::DecoderState VideoDecoder::getState() const
+{
+ return m_State;
+}
+
+VideoInfo VideoDecoder::getVideoInfo() const
+{
+ AVG_ASSERT(m_State != CLOSED);
+ AVG_ASSERT(m_pVStream || m_pAStream);
+ float duration = getDuration(SS_DEFAULT);
+
+ VideoInfo info(m_pFormatContext->iformat->name, duration, m_pFormatContext->bit_rate,
+ m_pVStream != 0, m_pAStream != 0);
+ if (m_pVStream) {
+ info.setVideoData(m_Size, getStreamPF(), getNumFrames(), getStreamFPS(),
+ m_pVStream->codec->codec->name, usesVDPAU(), getDuration(SS_VIDEO));
+ }
+ if (m_pAStream) {
+ AVCodecContext * pACodec = m_pAStream->codec;
+ info.setAudioData(pACodec->codec->name, pACodec->sample_rate,
+ pACodec->channels, getDuration(SS_AUDIO));
+ }
+ return info;
+}
+
+PixelFormat VideoDecoder::getPixelFormat() const
+{
+ AVG_ASSERT(m_State != CLOSED);
+ return m_PF;
+}
+
+IntPoint VideoDecoder::getSize() const
+{
+ AVG_ASSERT(m_State != CLOSED);
+ return m_Size;
+}
+
+float VideoDecoder::getStreamFPS() const
+{
+ AVG_ASSERT(m_State != CLOSED);
+ return avg::getStreamFPS(m_pVStream);
+}
+
+FrameAvailableCode VideoDecoder::renderToBmp(BitmapPtr pBmp, float timeWanted)
{
std::vector<BitmapPtr> pBmps;
pBmps.push_back(pBmp);
return renderToBmps(pBmps, timeWanted);
}
-FrameAvailableCode VideoDecoder::renderToVDPAU(vdpau_render_state** ppRenderState)
+FrameAvailableCode VideoDecoder::renderToTexture(GLTexturePtr pTextures[4],
+ float timeWanted)
+{
+ std::vector<BitmapPtr> pBmps;
+ for (unsigned i=0; i<getNumPixelFormatPlanes(m_PF); ++i) {
+ pBmps.push_back(pTextures[i]->lockStreamingBmp());
+ }
+ FrameAvailableCode frameAvailable;
+ if (pixelFormatIsPlanar(m_PF)) {
+ frameAvailable = renderToBmps(pBmps, timeWanted);
+ } else {
+ frameAvailable = renderToBmp(pBmps[0], timeWanted);
+ }
+ for (unsigned i=0; i<getNumPixelFormatPlanes(m_PF); ++i) {
+ pTextures[i]->unlockStreamingBmp(frameAvailable == FA_NEW_FRAME);
+ }
+ return frameAvailable;
+}
+
+void VideoDecoder::logConfig()
+{
+ bool bVDPAUAvailable = false;
+#ifdef AVG_ENABLE_VDPAU
+ bVDPAUAvailable = VDPAUDecoder::isAvailable();
+#endif
+ if (bVDPAUAvailable) {
+ AVG_TRACE(Logger::category::CONFIG, Logger::severity::INFO,
+ "Hardware video acceleration: VDPAU");
+ } else {
+ AVG_TRACE(Logger::category::CONFIG, Logger::severity::INFO,
+ "Hardware video acceleration: Off");
+ }
+}
+
+int VideoDecoder::getNumFrames() const
+{
+ AVG_ASSERT(m_State != CLOSED);
+ int numFrames = int(m_pVStream->nb_frames);
+ if (numFrames > 0) {
+ return numFrames;
+ } else {
+ return int(getDuration(SS_VIDEO) * getStreamFPS());
+ }
+}
+
+AVFormatContext* VideoDecoder::getFormatContext()
+{
+ AVG_ASSERT(m_pFormatContext);
+ return m_pFormatContext;
+}
+
+bool VideoDecoder::usesVDPAU() const
+{
+#ifdef AVG_ENABLE_VDPAU
+ AVCodecContext const* pContext = getCodecContext();
+ return pContext->codec && (pContext->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU);
+#else
+ return false;
+#endif
+}
+
+AVCodecContext const* VideoDecoder::getCodecContext() const
+{
+ return m_pVStream->codec;
+}
+
+AVCodecContext* VideoDecoder::getCodecContext()
+{
+ return m_pVStream->codec;
+}
+
+int VideoDecoder::getVStreamIndex() const
+{
+ return m_VStreamIndex;
+}
+
+AVStream* VideoDecoder::getVideoStream() const
+{
+ return m_pVStream;
+}
+
+int VideoDecoder::getAStreamIndex() const
+{
+ return m_AStreamIndex;
+}
+
+AVStream* VideoDecoder::getAudioStream() const
+{
+ return m_pAStream;
+}
+
+void VideoDecoder::initVideoSupport()
+{
+ if (!s_bInitialized) {
+ av_register_all();
+ s_bInitialized = true;
+ // Tune libavcodec console spam.
+// av_log_set_level(AV_LOG_DEBUG);
+ av_log_set_level(AV_LOG_QUIET);
+ }
+}
+
+int VideoDecoder::openCodec(int streamIndex, bool bUseHardwareAcceleration)
+{
+ AVCodecContext* pContext;
+ pContext = m_pFormatContext->streams[streamIndex]->codec;
+// pContext->debug = 0x0001; // see avcodec.h
+
+ AVCodec * pCodec = 0;
+#ifdef AVG_ENABLE_VDPAU
+ if (bUseHardwareAcceleration) {
+ m_pVDPAUDecoder = new VDPAUDecoder();
+ pContext->opaque = m_pVDPAUDecoder;
+ pCodec = m_pVDPAUDecoder->openCodec(pContext);
+ }
+#endif
+ if (!pCodec) {
+ pCodec = avcodec_find_decoder(pContext->codec_id);
+ }
+ if (!pCodec) {
+ return -1;
+ }
+#if LIBAVCODEC_VERSION_INT > AV_VERSION_INT(53, 8, 0)
+ int rc = avcodec_open2(pContext, pCodec, 0);
+#else
+ int rc = avcodec_open(pContext, pCodec);
+#endif
+
+ if (rc < 0) {
+ return -1;
+ }
+ return 0;
+}
+
+float VideoDecoder::getDuration(StreamSelect streamSelect) const
+{
+ AVG_ASSERT(m_State != CLOSED);
+ long long duration;
+ AVRational time_base;
+ if (streamSelect == SS_DEFAULT) {
+ if (m_pVStream) {
+ streamSelect = SS_VIDEO;
+ } else {
+ streamSelect = SS_AUDIO;
+ }
+ }
+ if (streamSelect == SS_VIDEO) {
+ duration = m_pVStream->duration;
+ time_base = m_pVStream->time_base;
+ } else {
+ duration = m_pAStream->duration;
+ time_base = m_pAStream->time_base;
+ }
+ if (duration == (long long)AV_NOPTS_VALUE) {
+ return 0;
+ } else {
+ return float(duration)*float(av_q2d(time_base));
+ }
+}
+
+PixelFormat VideoDecoder::calcPixelFormat(bool bUseYCbCr)
+{
+ AVCodecContext const* pContext = getCodecContext();
+ if (bUseYCbCr) {
+ switch(pContext->pix_fmt) {
+ case PIX_FMT_YUV420P:
+#ifdef AVG_ENABLE_VDPAU
+ case PIX_FMT_VDPAU_H264:
+ case PIX_FMT_VDPAU_MPEG1:
+ case PIX_FMT_VDPAU_MPEG2:
+ case PIX_FMT_VDPAU_WMV3:
+ case PIX_FMT_VDPAU_VC1:
+#endif
+ return YCbCr420p;
+ case PIX_FMT_YUVJ420P:
+ return YCbCrJ420p;
+ case PIX_FMT_YUVA420P:
+ return YCbCrA420p;
+ default:
+ break;
+ }
+ }
+ bool bAlpha = (pContext->pix_fmt == PIX_FMT_BGRA ||
+ pContext->pix_fmt == PIX_FMT_YUVA420P);
+ return BitmapLoader::get()->getDefaultPixelFormat(bAlpha);
+}
+
+string VideoDecoder::getStreamPF() const
+{
+ AVCodecContext const* pCodec = getCodecContext();
+ AVPixelFormat pf = pCodec->pix_fmt;
+ const char* psz = av_get_pix_fmt_name(pf);
+ string s;
+ if (psz) {
+ s = psz;
+ }
+ return s;
+}
+
+void avcodecError(const string& sFilename, int err)
{
- AVG_ASSERT(false);
- return FA_NEW_FRAME; // Silence compiler warning.
+#if LIBAVFORMAT_VERSION_MAJOR > 52
+ char buf[256];
+ av_strerror(err, buf, 256);
+ throw Exception(AVG_ERR_VIDEO_INIT_FAILED, sFilename + ": " + buf);
+#else
+ switch(err) {
+ case AVERROR_INVALIDDATA:
+ throw Exception(AVG_ERR_VIDEO_INIT_FAILED,
+ sFilename + ": Error while parsing header");
+ case AVERROR_NOFMT:
+ throw Exception(AVG_ERR_VIDEO_INIT_FAILED, sFilename + ": Unknown format");
+ default:
+ stringstream s;
+ s << "'" << sFilename << "': Error while opening file (Num:" << err << ")";
+ throw Exception(AVG_ERR_VIDEO_INIT_FAILED, s.str());
+ }
+#endif
}
}
diff --git a/src/video/VideoDecoder.h b/src/video/VideoDecoder.h
index 60fdea4..6d99da8 100644
--- a/src/video/VideoDecoder.h
+++ b/src/video/VideoDecoder.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -23,64 +23,116 @@
#define _VideoDecoder_H_
#include "../api.h"
+#include "../avgconfigwrapper.h"
#include "VideoInfo.h"
-#include "../graphics/Bitmap.h"
-#include "../audio/IAudioSource.h"
+#include "../audio/AudioParams.h"
+#include "../graphics/PixelFormat.h"
+
+#include "WrapFFMpeg.h"
#include <string>
+#include <boost/shared_ptr.hpp>
+#include <boost/thread/mutex.hpp>
struct vdpau_render_state;
namespace avg {
+class Bitmap;
+typedef boost::shared_ptr<Bitmap> BitmapPtr;
+class GLTexture;
+typedef boost::shared_ptr<GLTexture> GLTexturePtr;
+class VDPAUDecoder;
+
enum FrameAvailableCode {
FA_NEW_FRAME, FA_USE_LAST_FRAME, FA_STILL_DECODING
};
enum StreamSelect {
- SS_AUDIO, SS_VIDEO, SS_DEFAULT, SS_ALL
+ SS_AUDIO, SS_VIDEO, SS_DEFAULT
};
class AVG_API VideoDecoder
{
public:
enum DecoderState {CLOSED, OPENED, DECODING};
- virtual ~VideoDecoder() {};
- virtual void open(const std::string& sFilename, bool bSyncDemuxer,
- bool bUseHardwareAcceleration = true) = 0;
- virtual void startDecoding(bool bDeliverYCbCr, const AudioParams* pAP) = 0;
- virtual void close() = 0;
- virtual DecoderState getState() const = 0;
- virtual VideoInfo getVideoInfo() const = 0;
-
- virtual void seek(double destTime) = 0;
+ VideoDecoder();
+ virtual ~VideoDecoder();
+ virtual void open(const std::string& sFilename, bool bUseHardwareAcceleration,
+ bool bEnableSound);
+ virtual void startDecoding(bool bDeliverYCbCr, const AudioParams* pAP);
+ virtual void close();
+ virtual DecoderState getState() const;
+ VideoInfo getVideoInfo() const;
+ PixelFormat getPixelFormat() const;
+ IntPoint getSize() const;
+ float getStreamFPS() const;
+
+ virtual void seek(float destTime) = 0;
virtual void loop() = 0;
- virtual IntPoint getSize() const = 0;
virtual int getCurFrame() const = 0;
virtual int getNumFramesQueued() const = 0;
- virtual double getCurTime(StreamSelect stream = SS_DEFAULT) const = 0;
- virtual double getNominalFPS() const = 0;
- virtual double getFPS() const = 0;
- virtual void setFPS(double fps) = 0;
- virtual double getVolume() const = 0;
- virtual void setVolume(double volume) = 0;
- virtual PixelFormat getPixelFormat() const = 0;
-
- virtual FrameAvailableCode renderToBmp(BitmapPtr pBmp,
- double timeWanted);
+ virtual float getCurTime() const = 0;
+ virtual float getFPS() const = 0;
+ virtual void setFPS(float fps) = 0;
+
+ virtual FrameAvailableCode renderToBmp(BitmapPtr pBmp, float timeWanted);
virtual FrameAvailableCode renderToBmps(std::vector<BitmapPtr>& pBmps,
- double timeWanted) = 0;
- virtual FrameAvailableCode renderToVDPAU(vdpau_render_state** ppRenderState);
- virtual bool isEOF(StreamSelect stream = SS_ALL) const = 0;
- virtual void throwAwayFrame(double timeWanted) = 0;
+ float timeWanted) = 0;
+ virtual FrameAvailableCode renderToTexture(GLTexturePtr pTextures[4],
+ float timeWanted);
+ virtual bool isEOF() const = 0;
+ virtual void throwAwayFrame(float timeWanted) = 0;
+
+ static void logConfig();
+
+ protected:
+ int getNumFrames() const;
+ AVFormatContext* getFormatContext();
+ bool usesVDPAU() const;
+ AVCodecContext const * getCodecContext() const;
+ AVCodecContext * getCodecContext();
+
+ int getVStreamIndex() const;
+ AVStream* getVideoStream() const;
+ int getAStreamIndex() const;
+ AVStream* getAudioStream() const;
+
+ private:
+ void initVideoSupport();
+ int openCodec(int streamIndex, bool bUseHardwareAcceleration);
+ float getDuration(StreamSelect streamSelect) const;
+ PixelFormat calcPixelFormat(bool bUseYCbCr);
+ std::string getStreamPF() const;
+
+ DecoderState m_State;
+ AVFormatContext * m_pFormatContext;
+ std::string m_sFilename;
+
+ // Video
+ int m_VStreamIndex;
+ AVStream * m_pVStream;
+ PixelFormat m_PF;
+ IntPoint m_Size;
+#ifdef AVG_ENABLE_VDPAU
+ VDPAUDecoder* m_pVDPAUDecoder;
+#endif
+
+ // Audio
+ int m_AStreamIndex;
+ AVStream * m_pAStream;
- virtual int fillAudioBuffer(AudioBufferPtr pBuffer) = 0;
+ static bool s_bInitialized;
+ // Prevents different decoder instances from executing open/close simultaneously
+ static boost::mutex s_OpenMutex;
};
typedef boost::shared_ptr<VideoDecoder> VideoDecoderPtr;
+void avcodecError(const std::string& sFilename, int err);
+
}
#endif
diff --git a/src/video/VideoDecoderThread.cpp b/src/video/VideoDecoderThread.cpp
index 59d7d10..d1c701c 100644
--- a/src/video/VideoDecoderThread.cpp
+++ b/src/video/VideoDecoderThread.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -20,6 +20,7 @@
//
#include "VideoDecoderThread.h"
+#include "FFMpegFrameDecoder.h"
#include "../base/Logger.h"
#include "../base/Exception.h"
@@ -34,118 +35,168 @@ using namespace std;
namespace avg {
VideoDecoderThread::VideoDecoderThread(CQueue& cmdQ, VideoMsgQueue& msgQ,
- VideoDecoderPtr pDecoder)
+ VideoMsgQueue& packetQ, AVStream* pStream, const IntPoint& size, PixelFormat pf,
+ bool bUseVDPAU)
: WorkerThread<VideoDecoderThread>(string("Video Decoder"), cmdQ,
- Logger::PROFILE_VIDEO),
+ Logger::category::PROFILE_VIDEO),
m_MsgQ(msgQ),
- m_pDecoder(pDecoder),
+ m_PacketQ(packetQ),
m_pBmpQ(new BitmapQueue()),
- m_pHalfBmpQ(new BitmapQueue())
+ m_pHalfBmpQ(new BitmapQueue()),
+ m_Size(size),
+ m_PF(pf),
+ m_bUseVDPAU(bUseVDPAU),
+ m_bSeekDone(false),
+ m_bProcessingLastFrames(false)
{
+ m_pFrameDecoder = FFMpegFrameDecoderPtr(new FFMpegFrameDecoder(pStream));
}
VideoDecoderThread::~VideoDecoderThread()
{
}
-static ProfilingZoneID DecoderProfilingZone("DecoderThread");
-static ProfilingZoneID PushMsgProfilingZone("DecoderThread: push message");
+bool VideoDecoderThread::init()
+{
+#if LIBAVCODEC_VERSION_INT > AV_VERSION_INT(54, 28, 0)
+ m_pFrame = avcodec_alloc_frame();
+#else
+ m_pFrame = new AVFrame;
+#endif
+ return true;
+}
+
+void VideoDecoderThread::deinit()
+{
+#if LIBAVCODEC_VERSION_INT > AV_VERSION_INT(54, 28, 0)
+ avcodec_free_frame(&m_pFrame);
+#else
+ delete m_pFrame;
+#endif
+}
+
+static ProfilingZoneID DecoderProfilingZone("Video Decoder Thread", true);
+static ProfilingZoneID PacketWaitProfilingZone("Video wait for packet", true);
bool VideoDecoderThread::work()
{
- if (m_pDecoder->isEOF(SS_VIDEO)) {
- if (!m_pDecoder->getVideoInfo().m_bHasAudio) {
- m_pDecoder->seek(0);
- } else {
- // TODO: Replace this with waitForMessage()
- msleep(10);
- }
+ ScopeTimer timer(DecoderProfilingZone);
+ if (m_bProcessingLastFrames) {
+ // EOF received, but last frames still need to be decoded.
+ handleEOF();
} else {
- ScopeTimer timer(DecoderProfilingZone);
- vdpau_render_state* pRenderState = 0;
- FrameAvailableCode frameAvailable;
- vector<BitmapPtr> pBmps;
- bool usesVDPAU = m_pDecoder->getVideoInfo().m_bUsesVDPAU;
- if (usesVDPAU) {
-#ifdef AVG_ENABLE_VDPAU
- frameAvailable = m_pDecoder->renderToVDPAU(&pRenderState);
-#else
- frameAvailable = FA_NEW_FRAME; // Never executed - silences compiler warning.
-#endif
- } else {
- IntPoint size = m_pDecoder->getSize();
- IntPoint halfSize(size.x/2, size.y/2);
- PixelFormat pf = m_pDecoder->getPixelFormat();
- if (pixelFormatIsPlanar(pf)) {
- pBmps.push_back(getBmp(m_pBmpQ, size, I8));
- pBmps.push_back(getBmp(m_pHalfBmpQ, halfSize, I8));
- pBmps.push_back(getBmp(m_pHalfBmpQ, halfSize, I8));
- if (pf == YCbCrA420p) {
- pBmps.push_back(getBmp(m_pBmpQ, size, I8));
- }
- } else {
- pBmps.push_back(getBmp(m_pBmpQ, size, pf));
- }
- frameAvailable = m_pDecoder->renderToBmps(pBmps, -1);
+ // Standard decoding.
+ VideoMsgPtr pMsg;
+ {
+ ScopeTimer timer(PacketWaitProfilingZone);
+ pMsg = m_PacketQ.pop(true);
}
- if (m_pDecoder->isEOF(SS_VIDEO)) {
- VideoMsgPtr pMsg(new VideoMsg());
- pMsg->setEOF();
- m_MsgQ.push(pMsg);
- } else {
- ScopeTimer timer(PushMsgProfilingZone);
- AVG_ASSERT(frameAvailable == FA_NEW_FRAME);
- VideoMsgPtr pMsg(new VideoMsg());
- if (usesVDPAU) {
- pMsg->setVDPAUFrame(pRenderState, m_pDecoder->getCurTime(SS_VIDEO));
- } else {
- pMsg->setFrame(pBmps, m_pDecoder->getCurTime(SS_VIDEO));
- }
- m_MsgQ.push(pMsg);
- msleep(0);
+ switch (pMsg->getType()) {
+ case VideoMsg::PACKET:
+ decodePacket(pMsg->getPacket());
+ break;
+ case VideoMsg::END_OF_FILE:
+ handleEOF();
+ m_bProcessingLastFrames = true;
+ break;
+ case VideoMsg::SEEK_DONE:
+ handleSeekDone(pMsg);
+ break;
+ case VideoMsg::CLOSED:
+ close();
+ break;
+ default:
+ pMsg->dump();
+ AVG_ASSERT(false);
}
- ThreadProfiler::get()->reset();
}
+ ThreadProfiler::get()->reset();
return true;
}
-void VideoDecoderThread::seek(double destTime)
+void VideoDecoderThread::setFPS(float fps)
+{
+ m_pFrameDecoder->setFPS(fps);
+}
+
+void VideoDecoderThread::returnFrame(VideoMsgPtr pMsg)
{
- while (!m_MsgQ.empty()) {
- m_MsgQ.pop(false);
+ m_pBmpQ->push(pMsg->getFrameBitmap(0));
+ if (pixelFormatIsPlanar(m_PF)) {
+ m_pHalfBmpQ->push(pMsg->getFrameBitmap(1));
+ m_pHalfBmpQ->push(pMsg->getFrameBitmap(2));
+ if (m_PF == YCbCrA420p) {
+ m_pBmpQ->push(pMsg->getFrameBitmap(3));
+ }
}
+}
- double VideoFrameTime = -1;
- double AudioFrameTime = -1;
- m_pDecoder->seek(destTime);
- if (m_pDecoder->getVideoInfo().m_bHasVideo) {
- VideoFrameTime = m_pDecoder->getCurTime(SS_VIDEO);
+void VideoDecoderThread::decodePacket(AVPacket* pPacket)
+{
+ bool bGotPicture = m_pFrameDecoder->decodePacket(pPacket, m_pFrame, m_bSeekDone);
+ if (bGotPicture) {
+ m_bSeekDone = false;
+ sendFrame(m_pFrame);
}
- if (m_pDecoder->getVideoInfo().m_bHasAudio) {
- AudioFrameTime = m_pDecoder->getCurTime(SS_AUDIO);
+}
+
+void VideoDecoderThread::handleEOF()
+{
+ bool bGotPicture = m_pFrameDecoder->decodeLastFrame(m_pFrame);
+ if (bGotPicture) {
+ sendFrame(m_pFrame);
+ } else {
+ m_bProcessingLastFrames = false;
+ VideoMsgPtr pMsg(new VideoMsg());
+ pMsg->setEOF();
+ pushMsg(pMsg);
}
-
- VideoMsgPtr pMsg(new VideoMsg());
- pMsg->setSeekDone(VideoFrameTime, AudioFrameTime);
- m_MsgQ.push(pMsg);
}
-void VideoDecoderThread::setFPS(double fps)
+void VideoDecoderThread::handleSeekDone(VideoMsgPtr pMsg)
{
- m_pDecoder->setFPS(fps);
+ m_pFrameDecoder->handleSeek();
+ m_bSeekDone = true;
+ m_MsgQ.clear();
+ pushMsg(pMsg);
}
-void VideoDecoderThread::returnFrame(VideoMsgPtr pMsg)
+static ProfilingZoneID CopyImageProfilingZone("Copy image", true);
+
+void VideoDecoderThread::sendFrame(AVFrame* pFrame)
{
- m_pBmpQ->push(pMsg->getFrameBitmap(0));
- PixelFormat pf = m_pDecoder->getPixelFormat();
- if (pixelFormatIsPlanar(pf)) {
- m_pHalfBmpQ->push(pMsg->getFrameBitmap(1));
- m_pHalfBmpQ->push(pMsg->getFrameBitmap(2));
- if (pf == YCbCrA420p) {
- m_pBmpQ->push(pMsg->getFrameBitmap(3));
+ VideoMsgPtr pMsg(new VideoMsg());
+ if (m_bUseVDPAU) {
+ vdpau_render_state *pRenderState = (vdpau_render_state *)pFrame->data[0];
+ pMsg->setVDPAUFrame(pRenderState, m_pFrameDecoder->getCurTime());
+ } else {
+ vector<BitmapPtr> pBmps;
+ if (pixelFormatIsPlanar(m_PF)) {
+ ScopeTimer timer(CopyImageProfilingZone);
+ IntPoint halfSize(m_Size.x/2, m_Size.y/2);
+ pBmps.push_back(getBmp(m_pBmpQ, m_Size, I8));
+ pBmps.push_back(getBmp(m_pHalfBmpQ, halfSize, I8));
+ pBmps.push_back(getBmp(m_pHalfBmpQ, halfSize, I8));
+ if (m_PF == YCbCrA420p) {
+ pBmps.push_back(getBmp(m_pBmpQ, m_Size, I8));
+ }
+ for (unsigned i = 0; i < pBmps.size(); ++i) {
+ m_pFrameDecoder->copyPlaneToBmp(pBmps[i], pFrame->data[i],
+ pFrame->linesize[i]);
+ }
+ } else {
+ pBmps.push_back(getBmp(m_pBmpQ, m_Size, m_PF));
+ m_pFrameDecoder->convertFrameToBmp(pFrame, pBmps[0]);
}
+ pMsg->setFrame(pBmps, m_pFrameDecoder->getCurTime());
}
+ pushMsg(pMsg);
+}
+
+void VideoDecoderThread::close()
+{
+ m_MsgQ.clear();
+ stop();
}
BitmapPtr VideoDecoderThread::getBmp(BitmapQueuePtr pBmpQ, const IntPoint& size,
@@ -160,4 +211,12 @@ BitmapPtr VideoDecoderThread::getBmp(BitmapQueuePtr pBmpQ, const IntPoint& size,
}
}
+static ProfilingZoneID PushMsgProfilingZone("Push message", true);
+
+void VideoDecoderThread::pushMsg(VideoMsgPtr pMsg)
+{
+ ScopeTimer timer(PushMsgProfilingZone);
+ m_MsgQ.push(pMsg);
+}
+
}
diff --git a/src/video/VideoDecoderThread.h b/src/video/VideoDecoderThread.h
index 2e1f940..c03e7cb 100644
--- a/src/video/VideoDecoderThread.h
+++ b/src/video/VideoDecoderThread.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -23,43 +23,59 @@
#define _VideoDecoderThread_H_
#include "../api.h"
-#include "VideoDecoder.h"
#include "VideoMsg.h"
#include "../base/WorkerThread.h"
#include "../base/Command.h"
#include "../base/Queue.h"
-#include <boost/thread.hpp>
+#include "WrapFFMpeg.h"
-#include <string>
+#include <boost/thread.hpp>
namespace avg {
typedef Queue<Bitmap> BitmapQueue;
typedef boost::shared_ptr<BitmapQueue> BitmapQueuePtr;
+class FFMpegFrameDecoder;
+typedef boost::shared_ptr<FFMpegFrameDecoder> FFMpegFrameDecoderPtr;
+
class AVG_API VideoDecoderThread: public WorkerThread<VideoDecoderThread> {
public:
- VideoDecoderThread(CQueue& cmdQ, VideoMsgQueue& msgQ,
- VideoDecoderPtr pDecoder);
+ VideoDecoderThread(CQueue& cmdQ, VideoMsgQueue& msgQ, VideoMsgQueue& packetQ,
+ AVStream* pStream, const IntPoint& size, PixelFormat pf, bool bUseVDPAU);
virtual ~VideoDecoderThread();
+ virtual bool init();
+ virtual void deinit();
bool work();
- void seek(double destTime);
- void setFPS(double fps);
+ void setFPS(float fps);
void returnFrame(VideoMsgPtr pMsg);
private:
- BitmapPtr getBmp(BitmapQueuePtr pBmpQ, const IntPoint& size,
- PixelFormat pf);
+ void decodePacket(AVPacket* pPacket);
+ void handleEOF();
+ void handleSeekDone(VideoMsgPtr pMsg);
+ void sendFrame(AVFrame* pFrame);
+ void close();
+ BitmapPtr getBmp(BitmapQueuePtr pBmpQ, const IntPoint& size, PixelFormat pf);
+ void pushMsg(VideoMsgPtr pMsg);
+
VideoMsgQueue& m_MsgQ;
- VideoDecoderPtr m_pDecoder;
+ FFMpegFrameDecoderPtr m_pFrameDecoder;
+ VideoMsgQueue& m_PacketQ;
BitmapQueuePtr m_pBmpQ;
BitmapQueuePtr m_pHalfBmpQ;
-// ProfilingZone * m_pPushMsgProfilingZone;
+ IntPoint m_Size;
+ PixelFormat m_PF;
+ bool m_bUseVDPAU;
+
+ bool m_bSeekDone;
+ bool m_bProcessingLastFrames;
+ AVFrame* m_pFrame;
};
}
diff --git a/src/video/VideoDemuxerThread.cpp b/src/video/VideoDemuxerThread.cpp
index 2a9e029..370e237 100644
--- a/src/video/VideoDemuxerThread.cpp
+++ b/src/video/VideoDemuxerThread.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -21,27 +21,24 @@
#include "VideoDemuxerThread.h"
-#include "../base/Logger.h"
#include "../base/TimeSource.h"
-#include <climits>
-
using namespace std;
namespace avg {
-VideoDemuxerThread::VideoDemuxerThread(CQueue& cmdQ, AVFormatContext * pFormatContext,
- const map<int, VideoPacketQueuePtr>& packetQs)
+VideoDemuxerThread::VideoDemuxerThread(CQueue& cmdQ, AVFormatContext* pFormatContext,
+ const map<int, VideoMsgQueuePtr>& packetQs)
: WorkerThread<VideoDemuxerThread>("VideoDemuxer", cmdQ),
m_PacketQs(packetQs),
m_bEOF(false),
m_pFormatContext(pFormatContext),
m_pDemuxer()
{
- map<int, VideoPacketQueuePtr>::iterator it;
+ map<int, VideoMsgQueuePtr>::iterator it;
for (it = m_PacketQs.begin(); it != m_PacketQs.end(); it++) {
int streamIndex = it->first;
- m_PacketQbEOF[streamIndex] = false;
+ m_PacketQEOFMap[streamIndex] = false;
}
}
@@ -51,7 +48,7 @@ VideoDemuxerThread::~VideoDemuxerThread()
bool VideoDemuxerThread::init()
{
- map<int, VideoPacketQueuePtr>::iterator it;
+ map<int, VideoMsgQueuePtr>::iterator it;
vector<int> streamIndexes;
for (it = m_PacketQs.begin(); it != m_PacketQs.end(); it++) {
streamIndexes.push_back(it->first);
@@ -62,16 +59,16 @@ bool VideoDemuxerThread::init()
bool VideoDemuxerThread::work()
{
- if (m_PacketQs.empty() || m_bEOF) {
+ if (m_bEOF) {
waitForCommand();
} else {
- map<int, VideoPacketQueuePtr>::iterator it;
+ map<int, VideoMsgQueuePtr>::iterator it;
int shortestQ = -1;
int shortestLength = INT_MAX;
for (it = m_PacketQs.begin(); it != m_PacketQs.end(); it++) {
if (it->second->size() < shortestLength &&
it->second->size() < it->second->getMaxSize() &&
- !m_PacketQbEOF[it->first])
+ !m_PacketQEOFMap[it->first])
{
shortestLength = it->second->size();
shortestQ = it->first;
@@ -80,51 +77,81 @@ bool VideoDemuxerThread::work()
if (shortestQ < 0) {
// All queues are at their max capacity. Take a nap and try again later.
+ // Note that we can't wait on the queue. If decoding is paused, the queues can
+ // remain full indefinitely and commands from the application (seek() and
+ // close() must still be processed.
msleep(10);
return true;
}
-
+
AVPacket * pPacket = m_pDemuxer->getPacket(shortestQ);
+ VideoMsgPtr pMsg(new VideoMsg);
if (pPacket == 0) {
onStreamEOF(shortestQ);
+ pMsg->setEOF();
+ } else {
+ pMsg->setPacket(pPacket);
}
-
- // On EOF, we send a message which has pPacket=0
- m_PacketQs[shortestQ]->push(PacketVideoMsgPtr(
- new PacketVideoMsg(pPacket, false)));
+ m_PacketQs[shortestQ]->push(pMsg);
msleep(0);
}
return true;
}
-void VideoDemuxerThread::deinit()
+void VideoDemuxerThread::seek(int seqNum, float destTime)
{
-}
-
-void VideoDemuxerThread::seek(double destTime)
-{
- map<int, VideoPacketQueuePtr>::iterator it;
+ map<int, VideoMsgQueuePtr>::iterator it;
m_pDemuxer->seek(destTime);
for (it = m_PacketQs.begin(); it != m_PacketQs.end(); it++) {
- VideoPacketQueuePtr pPacketQ = it->second;
- pPacketQ->push(PacketVideoMsgPtr(new PacketVideoMsg(0, true)));
- m_PacketQbEOF[it->first] = false;
+ VideoMsgQueuePtr pPacketQ = it->second;
+ clearQueue(pPacketQ);
+
+ // send SEEK_DONE
+ VideoMsgPtr pMsg(new VideoMsg);
+ pMsg->setSeekDone(seqNum, destTime);
+ pPacketQ->push(pMsg);
+ m_PacketQEOFMap[it->first] = false;
}
m_bEOF = false;
}
+
+void VideoDemuxerThread::close()
+{
+ map<int, VideoMsgQueuePtr>::iterator it;
+ for (it = m_PacketQs.begin(); it != m_PacketQs.end(); it++) {
+ VideoMsgQueuePtr pPacketQ = it->second;
+ clearQueue(pPacketQ);
+ VideoMsgPtr pMsg(new VideoMsg);
+ pMsg->setClosed();
+ pPacketQ->push(pMsg);
+ m_PacketQEOFMap[it->first] = false;
+ }
+ stop();
+}
+
void VideoDemuxerThread::onStreamEOF(int streamIndex)
{
- m_PacketQbEOF[streamIndex] = true;
-
+ m_PacketQEOFMap[streamIndex] = true;
m_bEOF = true;
map<int, bool>::iterator it;
- for (it = m_PacketQbEOF.begin(); it != m_PacketQbEOF.end(); it++) {
+ for (it = m_PacketQEOFMap.begin(); it != m_PacketQEOFMap.end(); it++) {
if (!it->second) {
m_bEOF = false;
break;
}
}
}
+
+void VideoDemuxerThread::clearQueue(VideoMsgQueuePtr pPacketQ)
+{
+ VideoMsgPtr pMsg;
+ do {
+ pMsg = pPacketQ->pop(false);
+ if (pMsg) {
+ pMsg->freePacket();
+ }
+ } while (pMsg);
+}
}
diff --git a/src/video/VideoDemuxerThread.h b/src/video/VideoDemuxerThread.h
index 5bd669b..b89e58c 100644
--- a/src/video/VideoDemuxerThread.h
+++ b/src/video/VideoDemuxerThread.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -24,7 +24,7 @@
#include "../api.h"
#include "FFMpegDemuxer.h"
-#include "PacketVideoMsg.h"
+#include "VideoMsg.h"
#include "../base/WorkerThread.h"
#include "../base/Command.h"
@@ -38,23 +38,23 @@ namespace avg {
class AVG_API VideoDemuxerThread: public WorkerThread<VideoDemuxerThread> {
public:
- VideoDemuxerThread(CQueue& cmdQ, AVFormatContext * pFormatContext,
- const std::map<int, VideoPacketQueuePtr>& m_PacketQs);
+ VideoDemuxerThread(CQueue& cmdQ, AVFormatContext* pFormatContext,
+ const std::map<int, VideoMsgQueuePtr>& packetQs);
virtual ~VideoDemuxerThread();
bool init();
bool work();
- void deinit();
- void enableStream(VideoPacketQueuePtr pPacketQ, int streamIndex);
- void seek(double DestTime);
+ void seek(int seqNum, float DestTime);
+ void close();
private:
void onStreamEOF(int streamIndex);
-
- std::map<int, VideoPacketQueuePtr> m_PacketQs;
- std::map<int, bool> m_PacketQbEOF;
+ void clearQueue(VideoMsgQueuePtr pPacketQ);
+
+ std::map<int, VideoMsgQueuePtr> m_PacketQs;
+ std::map<int, bool> m_PacketQEOFMap;
bool m_bEOF;
- AVFormatContext * m_pFormatContext;
+ AVFormatContext* m_pFormatContext;
FFMpegDemuxerPtr m_pDemuxer;
};
diff --git a/src/video/VideoInfo.cpp b/src/video/VideoInfo.cpp
index ac48107..e49c050 100644
--- a/src/video/VideoInfo.cpp
+++ b/src/video/VideoInfo.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -31,8 +31,10 @@ VideoInfo::VideoInfo()
{
}
-VideoInfo::VideoInfo(double duration, int bitrate, bool bHasVideo, bool bHasAudio)
- : m_Duration(duration),
+VideoInfo::VideoInfo(string sContainerFormat, float duration, int bitrate, bool bHasVideo,
+ bool bHasAudio)
+ : m_sContainerFormat(sContainerFormat),
+ m_Duration(duration),
m_Bitrate(bitrate),
m_bHasVideo(bHasVideo),
m_bHasAudio(bHasAudio)
@@ -40,25 +42,55 @@ VideoInfo::VideoInfo(double duration, int bitrate, bool bHasVideo, bool bHasAudi
}
void VideoInfo::setVideoData(const IntPoint& size, const string& sPixelFormat,
- int numFrames, double streamFPS, double FPS, const string& sVCodec,
- bool bUsesVDPAU)
+ int numFrames, float streamFPS, const string& sVCodec,
+ bool bUsesVDPAU, float duration)
{
AVG_ASSERT(m_bHasVideo);
m_Size = size;
m_sPixelFormat = sPixelFormat;
m_NumFrames = numFrames;
m_StreamFPS = streamFPS;
- m_FPS = FPS;
m_sVCodec = sVCodec;
m_bUsesVDPAU = bUsesVDPAU;
+ m_VideoDuration = duration;
}
-void VideoInfo::setAudioData(const string& sACodec, int sampleRate, int numAudioChannels)
+void VideoInfo::setAudioData(const string& sACodec, int sampleRate, int numAudioChannels,
+ float duration)
{
AVG_ASSERT(m_bHasAudio);
m_sACodec = sACodec;
m_SampleRate = sampleRate;
m_NumAudioChannels = numAudioChannels;
+ m_AudioDuration = duration;
+}
+
+float getStreamFPS(AVStream* pStream)
+{
+ float fps;
+#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(52, 42, 0)
+ if (pStream->avg_frame_rate.den != 0) {
+ fps = float(av_q2d(pStream->avg_frame_rate));
+ } else {
+#endif
+ if (pStream->r_frame_rate.den != 0) {
+ fps = float(av_q2d(pStream->r_frame_rate));
+ } else {
+ float duration = float(pStream->duration)*float(av_q2d(pStream->time_base));
+ fps = pStream->nb_frames/duration;
+ }
+#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(52, 42, 0)
+ }
+#endif
+ AVG_ASSERT(fps < 10000);
+/*
+ cerr << "getStreamFPS: fps= " << fps << endl;
+ cerr << " r_frame_rate num: " << m_pVStream->r_frame_rate.num << ", den: " << m_pVStream->r_frame_rate.den << endl;
+ cerr << " avg_frame_rate: num: " << m_pVStream->avg_frame_rate.num << ", den: " << m_pVStream->avg_frame_rate.den << endl;
+ cerr << " numFrames= " << getNumFrames() << ", duration= "
+ << getDuration(SS_VIDEO) << endl;
+*/
+ return fps;
}
}
diff --git a/src/video/VideoInfo.h b/src/video/VideoInfo.h
index 663dcc7..f2c1311 100644
--- a/src/video/VideoInfo.h
+++ b/src/video/VideoInfo.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -24,7 +24,9 @@
#include "../api.h"
-#include "../base/Point.h"
+#include "WrapFFMpeg.h"
+
+#include "../base/GLMHelper.h"
#include <string>
@@ -33,31 +35,37 @@ namespace avg {
struct AVG_API VideoInfo
{
VideoInfo();
- VideoInfo(double duration, int bitrate, bool bHasVideo, bool bHasAudio);
+ VideoInfo(std::string sContainerFormat, float duration, int bitrate, bool bHasVideo,
+ bool bHasAudio);
void setVideoData(const IntPoint& size, const std::string& sPixelFormat,
- int numFrames, double streamFPS, double FPS, const std::string& sVCodec,
- bool bUsesVDPAU);
+ int numFrames, float streamFPS, const std::string& sVCodec,
+ bool bUsesVDPAU, float duration);
- void setAudioData(const std::string& sACodec, int sampleRate, int numAudioChannels);
+ void setAudioData(const std::string& sACodec, int sampleRate, int numAudioChannels,
+ float duration);
- double m_Duration;
+ std::string m_sContainerFormat;
+ float m_Duration;
int m_Bitrate;
bool m_bHasVideo;
IntPoint m_Size;
std::string m_sPixelFormat;
int m_NumFrames;
- double m_StreamFPS;
- double m_FPS;
+ float m_StreamFPS;
std::string m_sVCodec;
bool m_bUsesVDPAU;
+ float m_VideoDuration;
bool m_bHasAudio;
std::string m_sACodec;
int m_SampleRate;
int m_NumAudioChannels;
+ float m_AudioDuration;
};
+float getStreamFPS(AVStream* pStream);
+
}
#endif
diff --git a/src/video/VideoMsg.cpp b/src/video/VideoMsg.cpp
index 585e237..6e3be26 100644
--- a/src/video/VideoMsg.cpp
+++ b/src/video/VideoMsg.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -20,6 +20,7 @@
//
#include "VideoMsg.h"
+#include "WrapFFMpeg.h"
#include "../base/ObjectCounter.h"
#include "../base/Exception.h"
@@ -27,113 +28,65 @@
namespace avg {
VideoMsg::VideoMsg()
- : m_MsgType(NONE)
{
- ObjectCounter::get()->incRef(&typeid(*this));
}
VideoMsg::~VideoMsg()
{
- ObjectCounter::get()->decRef(&typeid(*this));
}
-void VideoMsg::setAudio(AudioBufferPtr pAudioBuffer, double audioTime)
+void VideoMsg::setFrame(const std::vector<BitmapPtr>& pBmps, float frameTime)
{
- AVG_ASSERT(m_MsgType == NONE);
- AVG_ASSERT(pAudioBuffer);
- m_MsgType = AUDIO;
- m_pAudioBuffer = pAudioBuffer;
- m_AudioTime = audioTime;
-}
-
-void VideoMsg::setEOF()
-{
- AVG_ASSERT(m_MsgType == NONE);
- m_MsgType = END_OF_FILE;
-}
-
-void VideoMsg::setError(const Exception& ex)
-{
- AVG_ASSERT(m_MsgType == NONE);
- m_MsgType = ERROR;
- m_pEx = new Exception(ex);
-}
-
-void VideoMsg::setFrame(const std::vector<BitmapPtr>& pBmps, double frameTime)
-{
- AVG_ASSERT(m_MsgType == NONE);
AVG_ASSERT(pBmps.size() == 1 || pBmps.size() == 3 || pBmps.size() == 4);
- m_MsgType = FRAME;
+ setType(FRAME);
m_pBmps = pBmps;
m_FrameTime = frameTime;
}
-void VideoMsg::setVDPAUFrame(vdpau_render_state* pRenderState, double frameTime)
+void VideoMsg::setVDPAUFrame(vdpau_render_state* pRenderState, float frameTime)
{
- AVG_ASSERT(m_MsgType == NONE);
- m_MsgType = VDPAU_FRAME;
+ setType(VDPAU_FRAME);
m_pRenderState = pRenderState;
m_FrameTime = frameTime;
}
-
-void VideoMsg::setSeekDone(double seekVideoFrameTime, double seekAudioFrameTime)
-{
- AVG_ASSERT(m_MsgType == NONE);
- m_MsgType = SEEK_DONE;
- m_SeekVideoFrameTime = seekVideoFrameTime;
- m_SeekAudioFrameTime = seekAudioFrameTime;
-}
-
-VideoMsg::MsgType VideoMsg::getType()
-{
- return m_MsgType;
-}
-
-AudioBufferPtr VideoMsg::getAudioBuffer() const
+
+void VideoMsg::setPacket(AVPacket* pPacket)
{
- AVG_ASSERT(m_MsgType == AUDIO);
- return m_pAudioBuffer;
+ setType(PACKET);
+ AVG_ASSERT(pPacket);
+ m_pPacket = pPacket;
}
-double VideoMsg::getAudioTime() const
+AVPacket * VideoMsg::getPacket()
{
- AVG_ASSERT(m_MsgType == AUDIO);
- return m_AudioTime;
+ AVG_ASSERT(getType() == PACKET);
+ return m_pPacket;
}
-const Exception& VideoMsg::getException() const
+void VideoMsg::freePacket()
{
- AVG_ASSERT(m_MsgType == ERROR);
- return *m_pEx;
+ if (getType() == PACKET) {
+ av_free_packet(m_pPacket);
+ delete m_pPacket;
+ m_pPacket = 0;
+ }
}
BitmapPtr VideoMsg::getFrameBitmap(int i)
{
- AVG_ASSERT(m_MsgType == FRAME);
+ AVG_ASSERT(getType() == FRAME);
return m_pBmps[i];
}
-double VideoMsg::getFrameTime()
+float VideoMsg::getFrameTime()
{
- AVG_ASSERT(m_MsgType == FRAME || m_MsgType == VDPAU_FRAME);
+ AVG_ASSERT(getType() == FRAME || getType() == VDPAU_FRAME);
return m_FrameTime;
}
-double VideoMsg::getSeekVideoFrameTime()
-{
- AVG_ASSERT(m_MsgType == SEEK_DONE);
- return m_SeekVideoFrameTime;
-}
-
-double VideoMsg::getSeekAudioFrameTime()
-{
- AVG_ASSERT(m_MsgType == SEEK_DONE);
- return m_SeekAudioFrameTime;
-}
-
vdpau_render_state* VideoMsg::getRenderState()
{
- AVG_ASSERT(m_MsgType == VDPAU_FRAME);
+ AVG_ASSERT(getType() == VDPAU_FRAME);
return m_pRenderState;
}
diff --git a/src/video/VideoMsg.h b/src/video/VideoMsg.h
index b1dbfbb..15a6007 100644
--- a/src/video/VideoMsg.h
+++ b/src/video/VideoMsg.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -26,63 +26,41 @@
#include "../base/Queue.h"
#include "../graphics/Bitmap.h"
-#include "../audio/AudioBuffer.h"
+#include "../audio/AudioMsg.h"
#include <boost/shared_ptr.hpp>
struct vdpau_render_state;
+struct AVPacket;
namespace avg {
-class AVG_API VideoMsg {
+class AVG_API VideoMsg: public AudioMsg {
public:
- enum MsgType {NONE, AUDIO, END_OF_FILE, ERROR, FRAME, SEEK_DONE, VDPAU_FRAME};
VideoMsg();
- void setAudio(AudioBufferPtr pAudioBuffer, double audioTime);
- void setEOF();
- void setError(const Exception& ex);
- void setFrame(const std::vector<BitmapPtr>& pBmps, double frameTime);
- void setVDPAUFrame(vdpau_render_state* m_pRenderState, double frameTime);
- void setSeekDone(double seekVideoFrameTime, double seekAudioFrameTime);
+ void setFrame(const std::vector<BitmapPtr>& pBmps, float frameTime);
+ void setVDPAUFrame(vdpau_render_state* pRenderState, float frameTime);
+ void setPacket(AVPacket* pPacket);
virtual ~VideoMsg();
- MsgType getType();
-
- AudioBufferPtr getAudioBuffer() const;
- double getAudioTime() const;
-
- const Exception& getException() const;
-
BitmapPtr getFrameBitmap(int i);
- double getFrameTime();
-
- double getSeekVideoFrameTime();
- double getSeekAudioFrameTime();
+ float getFrameTime();
+ AVPacket* getPacket();
+ void freePacket();
vdpau_render_state* getRenderState();
private:
- MsgType m_MsgType;
-
- // AUDIO
- AudioBufferPtr m_pAudioBuffer;
- double m_AudioTime;
-
- // ERROR
- Exception* m_pEx;
-
// FRAME
std::vector<BitmapPtr> m_pBmps;
- double m_FrameTime;
+ float m_FrameTime;
// VDPAU_FRAME
vdpau_render_state* m_pRenderState;
-
- // SEEK_DONE
- double m_SeekVideoFrameTime;
- double m_SeekAudioFrameTime;
-
+
+ // PACKET
+ AVPacket * m_pPacket;
};
typedef boost::shared_ptr<VideoMsg> VideoMsgPtr;
diff --git a/src/video/WrapFFMpeg.h b/src/video/WrapFFMpeg.h
index c2176b4..4e8c9ac 100644
--- a/src/video/WrapFFMpeg.h
+++ b/src/video/WrapFFMpeg.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -55,6 +55,28 @@ extern "C" {
#define AVMEDIA_TYPE_AUDIO CODEC_TYPE_AUDIO
#endif
+#if LIBAVFORMAT_VERSION_MAJOR > 52
+ #define SAMPLE_FMT_S16 AV_SAMPLE_FMT_S16
+ #define SAMPLE_FMT_FLT AV_SAMPLE_FMT_FLT
+ #define SAMPLE_FMT_DBL AV_SAMPLE_FMT_DBL
+ #define SAMPLE_FMT_S32 AV_SAMPLE_FMT_S32
+ #define SAMPLE_FMT_U8 AV_SAMPLE_FMT_U8
+ #define SAMPLE_FMT_S16P AV_SAMPLE_FMT_S16P
+ #define SAMPLE_FMT_FLTP AV_SAMPLE_FMT_FLTP
+ #define SampleFormat AVSampleFormat
+#endif
+
+#ifndef URL_WRONLY
+ #define url_fopen avio_open
+ #define url_fclose avio_close
+ #define URL_WRONLY AVIO_FLAG_WRITE
+#endif
}
+#ifdef PixelFormat
+#undef PixelFormat
+#else
+#define AVPixelFormat ::PixelFormat
+#endif
+
#endif
diff --git a/src/video/baseline/mpeg1-48x48.mov_1.png b/src/video/baseline/mpeg1-48x48.mov_1.png
new file mode 100644
index 0000000..f14e25b
--- /dev/null
+++ b/src/video/baseline/mpeg1-48x48.mov_1.png
Binary files differ
diff --git a/src/video/baseline/mpeg1-48x48.mov_2.png b/src/video/baseline/mpeg1-48x48.mov_2.png
new file mode 100644
index 0000000..0c0aa5a
--- /dev/null
+++ b/src/video/baseline/mpeg1-48x48.mov_2.png
Binary files differ
diff --git a/src/video/baseline/mpeg1-48x48.mov_end.png b/src/video/baseline/mpeg1-48x48.mov_end.png
new file mode 100644
index 0000000..07efff2
--- /dev/null
+++ b/src/video/baseline/mpeg1-48x48.mov_end.png
Binary files differ
diff --git a/src/video/baseline/mpeg1-48x48.mov_loop.png b/src/video/baseline/mpeg1-48x48.mov_loop.png
new file mode 100644
index 0000000..f14e25b
--- /dev/null
+++ b/src/video/baseline/mpeg1-48x48.mov_loop.png
Binary files differ
diff --git a/src/video/baseline/mpeg1-48x48.mpg_1.png b/src/video/baseline/mpeg1-48x48.mpg_1.png
deleted file mode 100644
index 73e856b..0000000
--- a/src/video/baseline/mpeg1-48x48.mpg_1.png
+++ /dev/null
Binary files differ
diff --git a/src/video/baseline/mpeg1-48x48.mpg_2.png b/src/video/baseline/mpeg1-48x48.mpg_2.png
deleted file mode 100644
index 9ff7f5e..0000000
--- a/src/video/baseline/mpeg1-48x48.mpg_2.png
+++ /dev/null
Binary files differ
diff --git a/src/video/baseline/mpeg1-48x48.mpg_end.png b/src/video/baseline/mpeg1-48x48.mpg_end.png
deleted file mode 100644
index eb9dab8..0000000
--- a/src/video/baseline/mpeg1-48x48.mpg_end.png
+++ /dev/null
Binary files differ
diff --git a/src/video/baseline/mpeg1-48x48.mpg_loop.png b/src/video/baseline/mpeg1-48x48.mpg_loop.png
deleted file mode 100644
index 64ceb53..0000000
--- a/src/video/baseline/mpeg1-48x48.mpg_loop.png
+++ /dev/null
Binary files differ
diff --git a/src/video/baseline/mpeg4-48x48.avi_1.png b/src/video/baseline/mpeg4-48x48.avi_1.png
new file mode 100644
index 0000000..e5fbb82
--- /dev/null
+++ b/src/video/baseline/mpeg4-48x48.avi_1.png
Binary files differ
diff --git a/src/video/baseline/mpeg4-48x48.avi_2.png b/src/video/baseline/mpeg4-48x48.avi_2.png
new file mode 100644
index 0000000..a7b91fe
--- /dev/null
+++ b/src/video/baseline/mpeg4-48x48.avi_2.png
Binary files differ
diff --git a/src/video/baseline/mpeg4-48x48.avi_end.png b/src/video/baseline/mpeg4-48x48.avi_end.png
new file mode 100644
index 0000000..ff00790
--- /dev/null
+++ b/src/video/baseline/mpeg4-48x48.avi_end.png
Binary files differ
diff --git a/src/video/baseline/mpeg4-48x48.avi_loop.png b/src/video/baseline/mpeg4-48x48.avi_loop.png
new file mode 100644
index 0000000..e5fbb82
--- /dev/null
+++ b/src/video/baseline/mpeg4-48x48.avi_loop.png
Binary files differ
diff --git a/src/video/testfiles/mpeg1-48x48.mpg b/src/video/testfiles/mpeg1-48x48.mpg
deleted file mode 100644
index d62180a..0000000
--- a/src/video/testfiles/mpeg1-48x48.mpg
+++ /dev/null
Binary files differ
diff --git a/src/video/testvideo.cpp b/src/video/testvideo.cpp
index a304cb9..0bca650 100644
--- a/src/video/testvideo.cpp
+++ b/src/video/testvideo.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -19,21 +19,16 @@
// Current versions can be found at www.libavg.de
//
-#include "FFMpegDecoder.h"
-
-#ifdef _WIN32
-#pragma warning(push)
-#pragma warning(disable:4251)
-#endif
-#ifdef _WIN32
-#pragma warning(pop)
-#endif
-
#include "AsyncVideoDecoder.h"
+#include "SyncVideoDecoder.h"
+#ifdef AVG_ENABLE_VDPAU
+#include "VDPAUDecoder.h"
+#endif
#include "../graphics/Filterfliprgba.h"
#include "../graphics/Filterfliprgb.h"
#include "../graphics/GraphicsTest.h"
+#include "../graphics/BitmapLoader.h"
#include "../base/StringHelper.h"
#include "../base/TimeSource.h"
@@ -47,25 +42,26 @@
#include <sstream>
#include <cmath>
+#include <glib-object.h>
+
using namespace avg;
using namespace std;
-
+using namespace boost;
class DecoderTest: public GraphicsTest {
public:
- DecoderTest(const string& sClassName, bool bThreadedDecoder,
- bool bThreadedDemuxer, bool bUseHardwareAcceleration)
- : GraphicsTest(sClassName+getDecoderName(bThreadedDecoder,
- bThreadedDemuxer), 2),
- m_bThreadedDecoder(bThreadedDecoder),
- m_bThreadedDemuxer(bThreadedDemuxer),
+ DecoderTest(const string& sClassName, bool bThreaded,
+ bool bUseHardwareAcceleration)
+ : GraphicsTest(sClassName+getDecoderName(bThreaded, bUseHardwareAcceleration),
+ 2),
+ m_bThreaded(bThreaded),
m_bUseHardwareAcceleration(bUseHardwareAcceleration)
{}
protected:
- bool isDemuxerThreaded()
+ bool isThreaded()
{
- return m_bThreadedDemuxer;
+ return m_bThreaded;
}
bool useHardwareAcceleration()
@@ -76,16 +72,13 @@ class DecoderTest: public GraphicsTest {
VideoDecoderPtr createDecoder()
{
VideoDecoderPtr pDecoder;
- pDecoder = VideoDecoderPtr(new FFMpegDecoder());
- if (m_bThreadedDecoder) {
- pDecoder = VideoDecoderPtr(new AsyncVideoDecoder(pDecoder, 8));
+ if (m_bThreaded) {
+ pDecoder = VideoDecoderPtr(new AsyncVideoDecoder(8));
+ } else {
+ pDecoder = VideoDecoderPtr(new SyncVideoDecoder());
}
- return pDecoder;
- }
- AudioBufferPtr createAudioBuffer(int numFrames)
- {
- return AudioBufferPtr(new AudioBuffer(numFrames, *getAudioParams()));
+ return pDecoder;
}
const AudioParams* getAudioParams()
@@ -94,54 +87,99 @@ class DecoderTest: public GraphicsTest {
return &AP;
}
+ int processAudioMsg(AudioMsgQueuePtr pMsgQ, AudioMsgQueuePtr pStatusQ)
+ {
+ AudioMsgPtr pMsg = pMsgQ->pop(false);
+ if (pMsg) {
+ switch (pMsg->getType()) {
+ case AudioMsg::AUDIO: {
+ AudioBufferPtr pBuffer = pMsg->getAudioBuffer();
+ AudioMsgPtr pStatusMsg(new AudioMsg);
+ pStatusMsg->setAudioTime(pMsg->getAudioTime());
+ pStatusQ->push(AudioMsgPtr(pStatusMsg));
+ return pBuffer->getNumFrames();
+ }
+ case AudioMsg::SEEK_DONE: {
+ AudioMsgPtr pStatusMsg(new AudioMsg);
+ pStatusMsg->setSeekDone(pMsg->getSeekSeqNum(),
+ pMsg->getSeekTime());
+ pStatusQ->push(AudioMsgPtr(pStatusMsg));
+ return -1;
+ }
+ default:
+ pStatusQ->push(pMsg);
+ return 0;
+ }
+ } else {
+ return 0;
+ }
+ }
+
+ void processAudioSeek(AudioMsgQueuePtr pMsgQ, AudioMsgQueuePtr pStatusQ)
+ {
+ int framesDecoded = 0;
+ while (framesDecoded != -1) {
+ // The real AudioSource blocks on pMsgQ->pop()
+ msleep(10);
+ framesDecoded = processAudioMsg(pMsgQ, pStatusQ);
+ }
+ }
+
virtual void testEqual(Bitmap& resultBmp, const std::string& sFName,
- avg::PixelFormat pf = NO_PIXELFORMAT, double maxAverage=1.0,
- double maxStdDev=1.0)
+ avg::PixelFormat pf = NO_PIXELFORMAT, float maxAverage=1.0,
+ float maxStdDev=1.0)
{
GraphicsTest::testEqual(resultBmp, sFName, pf, maxAverage, maxStdDev);
}
void testEqual(Bitmap& resultBmp, Bitmap& BaselineBmp,
- const std::string& sFName, double maxAverage=1.0, double maxStdDev=1.0)
+ const std::string& sFName, float maxAverage=1.0f, float maxStdDev=1.0f)
{
GraphicsTest::testEqual(resultBmp, BaselineBmp, sFName,
maxAverage, maxStdDev);
}
+ string getMediaLoc(const string& sFilename)
+ {
+ return getSrcDirName()+"../test/media/"+sFilename;
+ }
+
private:
- string getDecoderName(bool bThreadedDecoder, bool bThreadedDemuxer)
+ string getDecoderName(bool bThreaded, bool bUseHardwareAcceleration)
{
string sName = "(";
- if (bThreadedDecoder) {
- sName += "Threaded decoder, ";
+ if (bThreaded) {
+ sName += "Threaded";
} else {
- sName += "Sync decoder, ";
+ sName += "Sync";
}
- if (bThreadedDemuxer) {
- return sName+string("Threaded demuxer)");
+ if (bUseHardwareAcceleration) {
+ sName += ", VDPAU)";
} else {
- return sName+string("Sync demuxer)");
+ sName += ")";
}
+ return sName;
}
- bool m_bThreadedDecoder;
- bool m_bThreadedDemuxer;
+ bool m_bThreaded;
bool m_bUseHardwareAcceleration;
};
class VideoDecoderTest: public DecoderTest {
public:
- VideoDecoderTest(bool bThreadedDecoder, bool bThreadedDemuxer,
- bool bUseHardwareAcceleration)
- : DecoderTest("VideoDecoderTest", bThreadedDecoder, bThreadedDemuxer,
- bUseHardwareAcceleration)
+ VideoDecoderTest(bool bThreaded, bool bUseHardwareAcceleration)
+ : DecoderTest("VideoDecoderTest", bThreaded, bUseHardwareAcceleration)
{}
void runTests()
{
- basicFileTest("mpeg1-48x48.mpg", 30);
+ basicFileTest("mpeg1-48x48.mov", 30);
+#ifndef AVG_ENABLE_RPI
basicFileTest("mjpeg-48x48.avi", 202);
testSeeks("mjpeg-48x48.avi");
+#else
+ cerr << "Skipping mjpeg tests: SW decoding too slow on RaspberryPi." << endl;
+#endif
}
private:
@@ -151,12 +189,13 @@ class VideoDecoderTest: public DecoderTest {
cerr << " Testing " << sFilename << endl;
VideoDecoderPtr pDecoder = createDecoder();
- pDecoder->open(getSrcDirName()+"testfiles/"+sFilename,
- isDemuxerThreaded(), useHardwareAcceleration());
+ pDecoder->open(getMediaLoc(sFilename), useHardwareAcceleration(), true);
IntPoint frameSize = pDecoder->getSize();
TEST(frameSize == IntPoint(48, 48));
TEST(pDecoder->getVideoInfo().m_bHasVideo);
- TEST(pDecoder->getNominalFPS() != 0);
+ TEST(pDecoder->getVideoInfo().m_Duration != 0);
+ TEST(pDecoder->getStreamFPS() != 0);
+ TEST(pDecoder->getFPS() != 0);
pDecoder->startDecoding(false, getAudioParams());
TEST(pDecoder->getPixelFormat() == B8G8R8X8);
BitmapPtr pBmp(new Bitmap(frameSize, B8G8R8X8));
@@ -164,6 +203,9 @@ class VideoDecoderTest: public DecoderTest {
// Test first two frames.
pDecoder->renderToBmp(pBmp, -1);
testEqual(*pBmp, sFilename+"_1", B8G8R8X8);
+ TEST(pDecoder->getCurFrame() == 0);
+ TEST(pDecoder->getCurTime() == 0);
+
pDecoder->renderToBmp(pBmp, -1);
testEqual(*pBmp, sFilename+"_2", B8G8R8X8);
pDecoder->close();
@@ -182,8 +224,7 @@ class VideoDecoderTest: public DecoderTest {
cerr << " Testing " << sFilename << " (seek)" << endl;
VideoDecoderPtr pDecoder = createDecoder();
- pDecoder->open(getSrcDirName()+"testfiles/"+sFilename, isDemuxerThreaded(),
- useHardwareAcceleration());
+ pDecoder->open(getMediaLoc(sFilename), useHardwareAcceleration(), true);
pDecoder->startDecoding(false, getAudioParams());
// Seek forward
@@ -201,25 +242,24 @@ class VideoDecoderTest: public DecoderTest {
IntPoint frameSize = pDecoder->getSize();
BitmapPtr pBmp(new Bitmap(frameSize, B8G8R8X8));
- pDecoder->seek(double(frameNum)/pDecoder->getNominalFPS());
+ pDecoder->seek(float(frameNum)/pDecoder->getStreamFPS());
pDecoder->renderToBmp(pBmp, -1);
testEqual(*pBmp, sFilename+"_"+toString(frameNum), B8G8R8X8);
}
- void readWholeFile(const string& sFilename, double speedFactor,
+ void readWholeFile(const string& sFilename, float speedFactor,
int expectedNumFrames)
{
// Read whole file, test last image.
VideoDecoderPtr pDecoder = createDecoder();
- pDecoder->open(getSrcDirName()+"testfiles/"+sFilename, isDemuxerThreaded(),
- useHardwareAcceleration());
+ pDecoder->open(getMediaLoc(sFilename), useHardwareAcceleration(), true);
IntPoint frameSize = pDecoder->getSize();
- double timePerFrame = (1.0/pDecoder->getFPS())*speedFactor;
+ float timePerFrame = (1.0f/pDecoder->getFPS())*speedFactor;
pDecoder->startDecoding(false, getAudioParams());
BitmapPtr pBmp(new Bitmap(frameSize, B8G8R8X8));
int numFrames = 0;
- double curTime = 0;
+ float curTime = 0;
while (!pDecoder->isEOF()) {
FrameAvailableCode frameAvailable = pDecoder->renderToBmp(pBmp, curTime);
@@ -241,7 +281,9 @@ class VideoDecoderTest: public DecoderTest {
// cerr << "numFrames: " << numFrames <<
// ", expectedNumFrames: " << expectedNumFrames << endl;
TEST(numFrames == expectedNumFrames);
- if (speedFactor == 1) {
+ if (speedFactor == 1 && !useHardwareAcceleration()) {
+ // The last frame is broken with VDPAU sometimes. Not sure why this is,
+ // possibly a libav bug.
testEqual(*pBmp, sFilename+"_end", B8G8R8X8);
}
@@ -257,12 +299,13 @@ class VideoDecoderTest: public DecoderTest {
class AudioDecoderTest: public DecoderTest {
public:
- AudioDecoderTest(bool bThreadedDecoder, bool bThreadedDemuxer)
- : DecoderTest("AudioDecoderTest", bThreadedDecoder, bThreadedDemuxer, true)
+ AudioDecoderTest()
+ : DecoderTest("AudioDecoderTest", true, false)
{}
void runTests()
{
+
testOneFile("22.050Hz_16bit_mono.wav");
testOneFile("44.1kHz_16bit_mono.wav");
@@ -287,38 +330,36 @@ class AudioDecoderTest: public DecoderTest {
{
cerr << " Reading complete file." << endl;
- VideoDecoderPtr pDecoder = createDecoder();
- pDecoder->open(getSrcDirName()+"testfiles/"+sFilename,
- isDemuxerThreaded(), useHardwareAcceleration());
+ AsyncVideoDecoderPtr pDecoder =
+ dynamic_pointer_cast<AsyncVideoDecoder>(createDecoder());
+ pDecoder->open(getMediaLoc(sFilename), useHardwareAcceleration(), true);
TEST(pDecoder->getVideoInfo().m_bHasAudio);
- pDecoder->setVolume(0.5);
- TEST(pDecoder->getVolume() == 0.5);
pDecoder->startDecoding(false, getAudioParams());
+ AudioMsgQueuePtr pMsgQ = pDecoder->getAudioMsgQ();
+ AudioMsgQueuePtr pStatusQ = pDecoder->getAudioStatusQ();
int totalFramesDecoded = 0;
- bool bCheckTimestamps = (sFilename.find(".ogg") == string::npos &&
- sFilename.find(".mp3") == string::npos);
- readAudioToEOF(pDecoder, totalFramesDecoded, bCheckTimestamps);
+ readAudioToEOF(pDecoder, pMsgQ, pStatusQ, totalFramesDecoded, true);
// Check if we've decoded the whole file.
int framesInDuration = int(pDecoder->getVideoInfo().m_Duration*44100);
// cerr << "framesInDuration: " << framesInDuration << endl;
+// cerr << "framesDecoded: " << totalFramesDecoded << endl;
TEST(abs(totalFramesDecoded-framesInDuration) < 65);
}
{
cerr << " Seek test." << endl;
- VideoDecoderPtr pDecoder = createDecoder();
- pDecoder->open(getSrcDirName()+"testfiles/"+sFilename,
- isDemuxerThreaded(), useHardwareAcceleration());
- double duration = pDecoder->getVideoInfo().m_Duration;
+ AsyncVideoDecoderPtr pDecoder =
+ dynamic_pointer_cast<AsyncVideoDecoder>(createDecoder());
+ pDecoder->open(getMediaLoc(sFilename), useHardwareAcceleration(), true);
+ float duration = pDecoder->getVideoInfo().m_Duration;
pDecoder->startDecoding(false, getAudioParams());
+ AudioMsgQueuePtr pMsgQ = pDecoder->getAudioMsgQ();
+ AudioMsgQueuePtr pStatusQ = pDecoder->getAudioStatusQ();
pDecoder->seek(duration/2);
- AudioBufferPtr pAudioBuffer = createAudioBuffer(4);
- pDecoder->fillAudioBuffer(pAudioBuffer);
- // 60 ms accuracy for seeks.
- TEST(abs(duration/2-pDecoder->getCurTime(SS_AUDIO)) < 0.06);
- int totalFramesDecoded = 4;
+ processAudioSeek(pMsgQ, pStatusQ);
+ int totalFramesDecoded = 0;
- readAudioToEOF(pDecoder, totalFramesDecoded, false);
+ readAudioToEOF(pDecoder, pMsgQ, pStatusQ, totalFramesDecoded, false);
if (sFilename.find(".mp3") == string::npos) {
// Check if we've decoded half the file.
// TODO: Find out why there are problems with this
@@ -329,7 +370,6 @@ class AudioDecoderTest: public DecoderTest {
// cerr << "framesInDuration: " << framesInDuration << endl;
TEST(abs(totalFramesDecoded-framesInDuration/2) < 65);
}
-
}
} catch (Exception & ex) {
@@ -338,24 +378,24 @@ class AudioDecoderTest: public DecoderTest {
}
}
- void readAudioToEOF(VideoDecoderPtr pDecoder, int& totalFramesDecoded,
+ void readAudioToEOF(AsyncVideoDecoderPtr pDecoder, AudioMsgQueuePtr pMsgQ,
+ AudioMsgQueuePtr pStatusQ, int& totalFramesDecoded,
bool bCheckTimestamps)
{
int numWrongTimestamps = 0;
while (!pDecoder->isEOF()) {
- AudioBufferPtr pBuffer = createAudioBuffer(256);
int framesDecoded = 0;
while (framesDecoded == 0 && !pDecoder->isEOF()) {
- framesDecoded = pDecoder->fillAudioBuffer(pBuffer);
-// cerr << "framesDecoded: " << framesDecoded << endl;
+ framesDecoded = processAudioMsg(pMsgQ, pStatusQ);
+ AVG_ASSERT(framesDecoded != -1);
+ pDecoder->updateAudioStatus();
msleep(0);
}
totalFramesDecoded += framesDecoded;
- double curTime = double(totalFramesDecoded)/44100;
- if (abs(curTime-pDecoder->getCurTime(SS_AUDIO)) > 0.02) {
+ float curTime = float(totalFramesDecoded)/44100;
+ if (abs(curTime-pDecoder->getCurTime()) > 0.02f) {
numWrongTimestamps++;
}
-// cerr << curTime << "->" << pDecoder->getCurTime(SS_AUDIO) << endl;
}
if (bCheckTimestamps) {
if (numWrongTimestamps>0) {
@@ -365,12 +405,11 @@ class AudioDecoderTest: public DecoderTest {
}
};
+
class AVDecoderTest: public DecoderTest {
public:
- AVDecoderTest(bool bThreadedDecoder, bool bThreadedDemuxer,
- bool bUseHardwareAcceleration)
- : DecoderTest("AVDecoderTest", bThreadedDecoder, bThreadedDemuxer,
- bUseHardwareAcceleration)
+ AVDecoderTest(bool bUseHardwareAcceleration)
+ : DecoderTest("AVDecoderTest", true, bUseHardwareAcceleration)
{}
void runTests()
@@ -382,19 +421,23 @@ class AVDecoderTest: public DecoderTest {
void basicFileTest(const string& sFilename, int expectedNumFrames)
{
VideoDecoderPtr pDecoder = createDecoder();
- pDecoder->open(getSrcDirName()+"testfiles/"+sFilename, isDemuxerThreaded(),
- useHardwareAcceleration());
+ pDecoder->open(getMediaLoc(sFilename), useHardwareAcceleration(), true);
TEST(pDecoder->getVideoInfo().m_bHasVideo);
- TEST(pDecoder->getNominalFPS() != 0);
+ TEST(pDecoder->getStreamFPS() != 0);
pDecoder->startDecoding(false, getAudioParams());
- if (isDemuxerThreaded()) {
- TEST(pDecoder->getVideoInfo().m_bHasAudio);
- }
+ AudioMsgQueuePtr pMsgQ;
+ AudioMsgQueuePtr pStatusQ;
+
+ pMsgQ = dynamic_pointer_cast<AsyncVideoDecoder>(pDecoder) ->getAudioMsgQ();
+ pStatusQ = dynamic_pointer_cast<AsyncVideoDecoder>(pDecoder)
+ ->getAudioStatusQ();
+ TEST(pDecoder->getVideoInfo().m_bHasAudio);
+
IntPoint frameSize = pDecoder->getSize();
BitmapPtr pBmp(new Bitmap(frameSize, B8G8R8X8));
int numFrames = 0;
int totalFramesDecoded = 0;
- double curTime = 0;
+ float curTime = 0;
while (!pDecoder->isEOF()) {
FrameAvailableCode frameAvailable;
@@ -404,38 +447,28 @@ class AVDecoderTest: public DecoderTest {
} while (frameAvailable == FA_STILL_DECODING);
if (frameAvailable == FA_NEW_FRAME) {
// stringstream ss;
-// ss << "testfiles/result/" << sFilename << numFrames << ".png";
+// ss << sFilename << numFrames << ".png";
// pBmp->save(ss.str());
numFrames++;
}
- if (isDemuxerThreaded()) {
- AudioBufferPtr pBuffer = createAudioBuffer(256);
- int framesDecoded = 0;
- while (framesDecoded == 0 && !pDecoder->isEOF(SS_AUDIO)) {
- framesDecoded = pDecoder->fillAudioBuffer(pBuffer);
- msleep(0);
- }
- totalFramesDecoded += framesDecoded;
-// cerr << "framesDecoded: " << framesDecoded << endl;
+ int framesDecoded = 0;
+ while (framesDecoded == 0 && !pDecoder->isEOF()) {
+ framesDecoded = processAudioMsg(pMsgQ, pStatusQ);
+ dynamic_pointer_cast<AsyncVideoDecoder>(pDecoder)
+ ->updateAudioStatus();
+ msleep(0);
}
- curTime += 1.0/pDecoder->getFPS();
+ totalFramesDecoded += framesDecoded;
+
+ curTime += 1.0f/pDecoder->getFPS();
}
- TEST(pDecoder->isEOF(SS_VIDEO));
-// cerr << "numFrames: " << numFrames << endl;
+ TEST(pDecoder->isEOF());
TEST(numFrames == expectedNumFrames);
testEqual(*pBmp, sFilename+"_end", B8G8R8X8);
- if (isDemuxerThreaded()) {
- // Check if audio length was ok.
- // TODO: Currently, getDuration() is the duration of the video stream.
- // This causes the test to fail.
- //int framesInDuration = int(pDecoder->getDuration()*44100);
- //cerr << "framesDecoded: " << totalFramesDecoded << ", framesInDuration: " << framesInDuration << endl;
- //TEST (abs(totalFramesDecoded-framesInDuration) < 45);
- }
-
// Test loop.
pDecoder->seek(0);
+ processAudioSeek(pMsgQ, pStatusQ);
pDecoder->renderToBmp(pBmp, -1);
testEqual(*pBmp, sFilename+"_loop", B8G8R8X8);
@@ -452,70 +485,48 @@ public:
addAudioTests();
addVideoTests(false);
#ifdef AVG_ENABLE_VDPAU
- if (VDPAU::isAvailable()) {
+ if (VDPAUDecoder::isAvailable()) {
addVideoTests(true);
+ } else {
+ cerr << "Skipping VDPAU tests: VDPAU configured but not available." << endl;
}
+#else
+ cerr << "Skipping VDPAU tests: VDPAU not configured." << endl;
#endif
}
private:
void addAudioTests()
{
- addTest(TestPtr(new AudioDecoderTest(false, true)));
- addTest(TestPtr(new AudioDecoderTest(true, true)));
+ addTest(TestPtr(new AudioDecoderTest()));
}
void addVideoTests(bool bUseHardwareAcceleration)
{
- addTest(TestPtr(new VideoDecoderTest(false, false, bUseHardwareAcceleration)));
- addTest(TestPtr(new VideoDecoderTest(false, true, bUseHardwareAcceleration)));
- addTest(TestPtr(new VideoDecoderTest(true, true, bUseHardwareAcceleration)));
+ addTest(TestPtr(new VideoDecoderTest(false, bUseHardwareAcceleration)));
+ addTest(TestPtr(new VideoDecoderTest(true, bUseHardwareAcceleration)));
- addTest(TestPtr(new AVDecoderTest(false, false, bUseHardwareAcceleration)));
- addTest(TestPtr(new AVDecoderTest(false, true, bUseHardwareAcceleration)));
- addTest(TestPtr(new AVDecoderTest(true, true, bUseHardwareAcceleration)));
+ addTest(TestPtr(new AVDecoderTest(bUseHardwareAcceleration)));
}
};
-void deleteOldResultImages()
-{
- string sDirName("resultimages");
- Directory dir(sDirName);
- int err = dir.open(true);
- if (err) {
- cerr << "Creating directory " << sDirName << " failed." << strerror(err) << endl;
- } else {
- cerr << "Deleting files in " << sDirName << endl;
- DirEntryPtr pEntry = dir.getNextEntry();
- while (pEntry) {
- if (pEntry->getName()[0] != '.') {
- pEntry->remove();
- }
- pEntry = dir.getNextEntry();
- }
- }
-}
-
int main(int nargs, char** args)
{
- ThreadProfilerPtr pProfiler = ThreadProfiler::get();
+ ThreadProfiler* pProfiler = ThreadProfiler::get();
pProfiler->setName("main");
- deleteOldResultImages();
+ GraphicsTest::createResultImgDir();
+ BitmapLoader::init(true);
VideoTestSuite suite;
bool bOk;
suite.runTests();
bOk = suite.isOk();
- if (bOk) {
- return 0;
- } else {
- return 1;
- }
/*
- while(true) {
+ for (int i=0; i<300; ++i) {
+// while(true) {
suite.runTests();
bOk = suite.isOk();
if (!bOk) {
@@ -523,5 +534,10 @@ int main(int nargs, char** args)
}
}
*/
+ if (bOk) {
+ return 0;
+ } else {
+ return 1;
+ }
}
diff --git a/src/wrapper/Makefile.am b/src/wrapper/Makefile.am
index fdb3f17..06c5fe5 100644
--- a/src/wrapper/Makefile.am
+++ b/src/wrapper/Makefile.am
@@ -1,16 +1,24 @@
-
-INCLUDES = -I. -I../player \
- @XML2_CFLAGS@ @PTHREAD_CFLAGS@ @PANGOFT2_CFLAGS@ @PYTHON_INCLUDES@ \
+AM_CPPFLAGS = -I. -I../player \
+ @XML2_CFLAGS@ @PTHREAD_CFLAGS@ @PANGOFT2_CFLAGS@ @PYTHON_CPPFLAGS@ \
@DC1394_2_CFLAGS@ @LIBRSVG_CFLAGS@ @FONTCONFIG_CFLAGS@
ALL_H = WrapHelper.h raw_constructor.hpp
if APPLE
XGL_LIBS =
- APPLE_LDFLAGS=-read_only_relocs suppress -F/System/Library/PrivateFrameworks -framework MultitouchSupport
+ APPLE_LDFLAGS = -read_only_relocs suppress -F/System/Library/PrivateFrameworks \
+ -framework MultitouchSupport
+else
+if ENABLE_RPI
+ XGL_LIBS = -lXxf86vm -lX11 -lGLESv2 -lEGL
+else
+if ENABLE_EGL
+ XGL_LIBS = -lX11 -lGLESv2 -lEGL
else
- XGL_LIBS = -lXxf86vm
- APPLE_LDFLAGS=
+ XGL_LIBS = -lXxf86vm -lX11
+endif
+endif
+ APPLE_LDFLAGS =
endif
ALL_GL_LIBS = @GL_LIBS@ @SDL_LIBS@ $(XGL_LIBS)
@@ -18,22 +26,20 @@ ALL_GL_LIBS = @GL_LIBS@ @SDL_LIBS@ $(XGL_LIBS)
pkgpyexec_LTLIBRARIES = avg.la
avg_la_SOURCES = WrapHelper.cpp avg_wrap.cpp node_wrap.cpp raster_wrap.cpp \
event_wrap.cpp fx_wrap.cpp \
- device_wrap.cpp bitmap_wrap.cpp anim_wrap.cpp $(ALL_H)
+ bitmap_wrap.cpp anim_wrap.cpp $(ALL_H)
avg_la_LDFLAGS = $(APPLE_LDFLAGS) -module -XCClinker
-avg_la_LIBADD = ../conradrelais/libconradrelais.la \
- ../player/libplayer.la \
+avg_la_LIBADD = ../player/libplayer.la \
../audio/libaudio.la \
../video/libvideo.la \
../graphics/libgraphics.la \
../base/libbase.la \
+ ../base/triangulate/libtriangulate.la \
../imaging/libimaging.la \
- ../parport/libparport.la \
../anim/libanim.la \
../lmfit/liblmfit.la \
../oscpack/liboscpack.la \
- @PANGOFT2_LIBS@ @LIBRSVG_LIBS@ $(BOOST_PYTHON_LIBS)\
- -l@BOOST_THREAD_LIB@ -lboost_system @XML2_LIBS@ \
+ @PANGOFT2_LIBS@ @LIBRSVG_LIBS@ $(BOOST_PYTHON_LIBS) \
+ @BOOST_THREAD_LIBS@ @XML2_LIBS@ \
@DC1394_2_LIBS@ @GLU_LIBS@ $(XI2_1_LIBS) $(XI2_2_LIBS) \
$(ALL_GL_LIBS) @LIBFFMPEG@ @PTHREAD_LIBS@ \
@GDK_PIXBUF_LIBS@ @FONTCONFIG_LIBS@
-
diff --git a/src/wrapper/Makefile.in b/src/wrapper/Makefile.in
index a5acc9a..db149c8 100644
--- a/src/wrapper/Makefile.in
+++ b/src/wrapper/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# Makefile.in generated by automake 1.11.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
-# Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -41,11 +41,12 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ac_cxx_namespaces.m4 \
$(top_srcdir)/m4/ac_path_generic.m4 \
$(top_srcdir)/m4/ax_boost_thread.m4 \
- $(top_srcdir)/m4/ax_check_gl.m4 $(top_srcdir)/m4/libtool.m4 \
- $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
- $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
- $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/m4/python_dev.m4 \
- $(top_srcdir)/configure.in
+ $(top_srcdir)/m4/ax_check_gl.m4 \
+ $(top_srcdir)/m4/ax_python_devel.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/pkg.m4 \
+ $(top_srcdir)/m4/avg_version.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
@@ -73,25 +74,30 @@ am__nobase_list = $(am__nobase_strip_setup); \
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
am__installdirs = "$(DESTDIR)$(pkgpyexecdir)"
LTLIBRARIES = $(pkgpyexec_LTLIBRARIES)
am__DEPENDENCIES_1 =
am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1)
-avg_la_DEPENDENCIES = ../conradrelais/libconradrelais.la \
- ../player/libplayer.la ../audio/libaudio.la \
+avg_la_DEPENDENCIES = ../player/libplayer.la ../audio/libaudio.la \
../video/libvideo.la ../graphics/libgraphics.la \
- ../base/libbase.la ../imaging/libimaging.la \
- ../parport/libparport.la ../anim/libanim.la \
+ ../base/libbase.la ../base/triangulate/libtriangulate.la \
+ ../imaging/libimaging.la ../anim/libanim.la \
../lmfit/liblmfit.la ../oscpack/liboscpack.la \
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
am__objects_1 =
am_avg_la_OBJECTS = WrapHelper.lo avg_wrap.lo node_wrap.lo \
- raster_wrap.lo event_wrap.lo fx_wrap.lo device_wrap.lo \
- bitmap_wrap.lo anim_wrap.lo $(am__objects_1)
+ raster_wrap.lo event_wrap.lo fx_wrap.lo bitmap_wrap.lo \
+ anim_wrap.lo $(am__objects_1)
avg_la_OBJECTS = $(am_avg_la_OBJECTS)
-AM_V_lt = $(am__v_lt_$(V))
-am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
am__v_lt_0 = --silent
avg_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
@@ -106,18 +112,18 @@ LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CXXFLAGS) $(CXXFLAGS)
-AM_V_CXX = $(am__v_CXX_$(V))
-am__v_CXX_ = $(am__v_CXX_$(AM_DEFAULT_VERBOSITY))
+AM_V_CXX = $(am__v_CXX_@AM_V@)
+am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@)
am__v_CXX_0 = @echo " CXX " $@;
-AM_V_at = $(am__v_at_$(V))
-am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
CXXLD = $(CXX)
CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
$(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
-AM_V_CXXLD = $(am__v_CXXLD_$(V))
-am__v_CXXLD_ = $(am__v_CXXLD_$(AM_DEFAULT_VERBOSITY))
+AM_V_CXXLD = $(am__v_CXXLD_@AM_V@)
+am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@)
am__v_CXXLD_0 = @echo " CXXLD " $@;
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@@ -125,18 +131,18 @@ LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
-AM_V_CC = $(am__v_CC_$(V))
-am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
+AM_V_CC = $(am__v_CC_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
am__v_CC_0 = @echo " CC " $@;
CCLD = $(CC)
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
-AM_V_CCLD = $(am__v_CCLD_$(V))
-am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
-AM_V_GEN = $(am__v_GEN_$(V))
-am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
SOURCES = $(avg_la_SOURCES)
DIST_SOURCES = $(avg_la_SOURCES)
@@ -152,7 +158,7 @@ AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BOOST_PYTHON_LIBS = @BOOST_PYTHON_LIBS@
-BOOST_THREAD_LIB = @BOOST_THREAD_LIB@
+BOOST_THREAD_LIBS = @BOOST_THREAD_LIBS@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
@@ -167,6 +173,7 @@ DC1394_2_CFLAGS = @DC1394_2_CFLAGS@
DC1394_2_LIBS = @DC1394_2_LIBS@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
@@ -207,6 +214,7 @@ LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
MTDEV_CFLAGS = @MTDEV_CFLAGS@
MTDEV_LIBS = @MTDEV_LIBS@
@@ -236,11 +244,13 @@ PTHREAD_CC = @PTHREAD_CC@
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
PTHREAD_LIBS = @PTHREAD_LIBS@
PYTHON = @PYTHON@
+PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@
PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
-PYTHON_INCLUDES = @PYTHON_INCLUDES@
-PYTHON_LIBS = @PYTHON_LIBS@
+PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@
+PYTHON_LDFLAGS = @PYTHON_LDFLAGS@
PYTHON_PLATFORM = @PYTHON_PLATFORM@
PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_SITE_PKG = @PYTHON_SITE_PKG@
PYTHON_VERSION = @PYTHON_VERSION@
RANLIB = @RANLIB@
SDL_CFLAGS = @SDL_CFLAGS@
@@ -263,6 +273,7 @@ abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
@@ -297,7 +308,6 @@ libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
@@ -321,35 +331,38 @@ target_vendor = @target_vendor@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-INCLUDES = -I. -I../player \
- @XML2_CFLAGS@ @PTHREAD_CFLAGS@ @PANGOFT2_CFLAGS@ @PYTHON_INCLUDES@ \
+AM_CPPFLAGS = -I. -I../player \
+ @XML2_CFLAGS@ @PTHREAD_CFLAGS@ @PANGOFT2_CFLAGS@ @PYTHON_CPPFLAGS@ \
@DC1394_2_CFLAGS@ @LIBRSVG_CFLAGS@ @FONTCONFIG_CFLAGS@
ALL_H = WrapHelper.h raw_constructor.hpp
-@APPLE_FALSE@XGL_LIBS = -lXxf86vm
+@APPLE_FALSE@@ENABLE_EGL_FALSE@@ENABLE_RPI_FALSE@XGL_LIBS = -lXxf86vm -lX11
+@APPLE_FALSE@@ENABLE_EGL_TRUE@@ENABLE_RPI_FALSE@XGL_LIBS = -lX11 -lGLESv2 -lEGL
+@APPLE_FALSE@@ENABLE_RPI_TRUE@XGL_LIBS = -lXxf86vm -lX11 -lGLESv2 -lEGL
@APPLE_TRUE@XGL_LIBS =
@APPLE_FALSE@APPLE_LDFLAGS =
-@APPLE_TRUE@APPLE_LDFLAGS = -read_only_relocs suppress -F/System/Library/PrivateFrameworks -framework MultitouchSupport
+@APPLE_TRUE@APPLE_LDFLAGS = -read_only_relocs suppress -F/System/Library/PrivateFrameworks \
+@APPLE_TRUE@ -framework MultitouchSupport
+
ALL_GL_LIBS = @GL_LIBS@ @SDL_LIBS@ $(XGL_LIBS)
pkgpyexec_LTLIBRARIES = avg.la
avg_la_SOURCES = WrapHelper.cpp avg_wrap.cpp node_wrap.cpp raster_wrap.cpp \
event_wrap.cpp fx_wrap.cpp \
- device_wrap.cpp bitmap_wrap.cpp anim_wrap.cpp $(ALL_H)
+ bitmap_wrap.cpp anim_wrap.cpp $(ALL_H)
avg_la_LDFLAGS = $(APPLE_LDFLAGS) -module -XCClinker
-avg_la_LIBADD = ../conradrelais/libconradrelais.la \
- ../player/libplayer.la \
+avg_la_LIBADD = ../player/libplayer.la \
../audio/libaudio.la \
../video/libvideo.la \
../graphics/libgraphics.la \
../base/libbase.la \
+ ../base/triangulate/libtriangulate.la \
../imaging/libimaging.la \
- ../parport/libparport.la \
../anim/libanim.la \
../lmfit/liblmfit.la \
../oscpack/liboscpack.la \
- @PANGOFT2_LIBS@ @LIBRSVG_LIBS@ $(BOOST_PYTHON_LIBS)\
- -l@BOOST_THREAD_LIB@ @XML2_LIBS@ \
+ @PANGOFT2_LIBS@ @LIBRSVG_LIBS@ $(BOOST_PYTHON_LIBS) \
+ @BOOST_THREAD_LIBS@ @XML2_LIBS@ \
@DC1394_2_LIBS@ @GLU_LIBS@ $(XI2_1_LIBS) $(XI2_2_LIBS) \
$(ALL_GL_LIBS) @LIBFFMPEG@ @PTHREAD_LIBS@ \
@GDK_PIXBUF_LIBS@ @FONTCONFIG_LIBS@
@@ -419,7 +432,7 @@ clean-pkgpyexecLTLIBRARIES:
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
-avg.la: $(avg_la_OBJECTS) $(avg_la_DEPENDENCIES)
+avg.la: $(avg_la_OBJECTS) $(avg_la_DEPENDENCIES) $(EXTRA_avg_la_DEPENDENCIES)
$(AM_V_CXXLD)$(avg_la_LINK) -rpath $(pkgpyexecdir) $(avg_la_OBJECTS) $(avg_la_LIBADD) $(LIBS)
mostlyclean-compile:
@@ -432,7 +445,6 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/anim_wrap.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/avg_wrap.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bitmap_wrap.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/device_wrap.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/event_wrap.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fx_wrap.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/node_wrap.Plo@am__quote@
@@ -441,26 +453,23 @@ distclean-compile:
.cpp.o:
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $<
.cpp.obj:
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
.cpp.lo:
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
-@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
@@ -567,10 +576,15 @@ install-am: all-am
installcheck: installcheck-am
install-strip:
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- `test -z '$(STRIP)' || \
- echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
mostlyclean-generic:
clean-generic:
diff --git a/src/wrapper/WrapHelper.cpp b/src/wrapper/WrapHelper.cpp
index 093cd70..258a094 100644
--- a/src/wrapper/WrapHelper.cpp
+++ b/src/wrapper/WrapHelper.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -21,7 +21,13 @@
#include "WrapHelper.h"
+#include "../base/Logger.h"
#include "../base/Exception.h"
+#include "../base/MathHelper.h"
+#include "../base/ObjectCounter.h"
+
+#include "../player/PythonLogSink.h"
+#include "../player/PublisherDefinitionRegistry.h"
#include <boost/version.hpp>
@@ -29,29 +35,29 @@ using namespace avg;
using namespace std;
using namespace boost::python;
-namespace DPointHelper
+namespace Vec2Helper
{
- int len(const DPoint&)
+ int len(const glm::vec2&)
{
return 2;
}
- double getX(const DPoint& pt)
+ float getX(const glm::vec2& pt)
{
return pt.x;
}
- double getY(const DPoint& pt)
+ float getY(const glm::vec2& pt)
{
return pt.y;
}
- void setX(DPoint& pt, double val)
+ void setX(glm::vec2& pt, float val)
{
pt.x = val;
}
- void setY(DPoint& pt, double val)
+ void setY(glm::vec2& pt, float val)
{
pt.y = val;
}
@@ -62,7 +68,7 @@ namespace DPointHelper
}
}
- double getItem(const DPoint& pt, int i)
+ float getItem(const glm::vec2& pt, int i)
{
checkItemRange(i);
if (i==0) {
@@ -72,7 +78,7 @@ namespace DPointHelper
}
}
- void setItem(DPoint& pt, int i, double val)
+ void setItem(glm::vec2& pt, int i, float val)
{
checkItemRange(i);
if (i==0) {
@@ -82,44 +88,68 @@ namespace DPointHelper
}
}
- string str(const DPoint& pt)
+ string str(const glm::vec2& pt)
{
stringstream st;
st << "(" << pt.x << "," << pt.y << ")";
return st.str();
}
- string repr(const DPoint& pt)
+ string repr(const glm::vec2& pt)
{
stringstream st;
st << "avg.Point2D(" << pt.x << "," << pt.y << ")";
return st.str();
}
- long getHash(const DPoint& pt)
+ long getHash(const glm::vec2& pt)
{
// Wild guess at what could constitute a good hash function.
// Will generate very bad hashes if most values are in a range < 0.1,
// but this is meant for pixel values anyway, right? ;-).
return long(pt.x*42+pt.y*23);
}
+
+ glm::vec2 safeGetNormalized(const glm::vec2& pt)
+ {
+ if (pt.x==0 && pt.y==0) {
+ throw Exception(AVG_ERR_OUT_OF_RANGE, "Can't normalize (0,0).");
+ } else {
+ float invNorm = 1/sqrt(pt.x*pt.x+pt.y*pt.y);
+ return glm::vec2(pt.x*invNorm, pt.y*invNorm);
+ }
+ }
+
+ float getNorm(const glm::vec2& pt)
+ {
+ return glm::length(pt);
+ }
+
+ float vecAngle(const glm::vec2& pt1, const glm::vec2& pt2)
+ {
+ float angle = fmod((atan2(pt1.y, pt1.x) - atan2(pt2.y, pt2.x)), float(2*M_PI));
+ if (angle < 0) {
+ angle += 2*M_PI;
+ }
+ return angle;
+ }
}
-// The ConstDPoint stuff is there so that DPoint attributes behave sensibly. That is,
+// The ConstVec2 stuff is there so that vec2 attributes behave sensibly. That is,
// node.pos.x = 30 causes an error instead of failing silently.
-ConstDPoint::ConstDPoint()
+ConstVec2::ConstVec2()
{
}
-ConstDPoint::ConstDPoint(const DPoint& other)
+ConstVec2::ConstVec2(const glm::vec2& other)
{
x = other.x;
y = other.y;
}
-ConstDPoint::operator DPoint() const
+glm::vec2 ConstVec2::toVec2() const
{
- return DPoint(x,y);
+ return glm::vec2(x,y);
}
void checkEmptyArgs(const boost::python::tuple &args, int numArgs)
@@ -130,42 +160,31 @@ void checkEmptyArgs(const boost::python::tuple &args, int numArgs)
}
}
-template<class NUM>
-struct Point_to_python_tuple
-{
- static PyObject* convert (avg::Point<NUM> pt)
- {
- return boost::python::incref(boost::python::make_tuple(pt.x, pt.y).ptr());
- }
-};
-
-struct Exception_to_python_exception
+template<class VEC2>
+struct Vec2_to_python_tuple
{
- static PyObject* convert (avg::Exception ex)
+ static PyObject* convert (VEC2 v)
{
- PyObject *arglist = boost::python::incref(Py_BuildValue("(s)", ex.getStr().c_str()));
-
- return boost::python::incref(
- PyObject_CallObject(PyExc_RuntimeError, arglist));
+ return boost::python::incref(boost::python::make_tuple(v.x, v.y).ptr());
}
};
-template<class NUM>
-struct Triple_to_python_tuple
+template<class VEC3>
+struct Vec3_to_python_tuple
{
- static PyObject* convert (avg::Triple<NUM> t)
+ static PyObject* convert (VEC3 v)
{
- return boost::python::incref(boost::python::make_tuple(t.x,t.y,t.z).ptr());
+ return boost::python::incref(boost::python::make_tuple(v.x, v.y, v.z).ptr());
}
};
-template<class POINT, class ATTR>
-struct point_from_python
+template<class VEC2, class ATTR>
+struct vec2_from_python
{
- point_from_python()
+ vec2_from_python()
{
boost::python::converter::registry::push_back(
- &convertible, &construct, boost::python::type_id<POINT>());
+ &convertible, &construct, boost::python::type_id<VEC2>());
}
static void* convertible(PyObject* obj_ptr)
@@ -183,7 +202,7 @@ struct point_from_python
static void construct(PyObject* obj_ptr,
boost::python::converter::rvalue_from_python_stage1_data* data)
{
- POINT pt;
+ VEC2 pt;
PyObject * pEntry = PySequence_GetItem(obj_ptr, 0);
pt.x = (ATTR)PyFloat_AsDouble(pEntry);
Py_DECREF(pEntry);
@@ -191,20 +210,20 @@ struct point_from_python
pt.y = (ATTR)PyFloat_AsDouble(pEntry);
Py_DECREF(pEntry);
void* storage = (
- (boost::python::converter::rvalue_from_python_storage<POINT>*)data)
+ (boost::python::converter::rvalue_from_python_storage<VEC2>*)data)
->storage.bytes;
- new (storage) POINT(pt);
+ new (storage) VEC2(pt);
data->convertible = storage;
}
};
-template<class NUM>
-struct triple_from_python
+template<class VEC3, class ATTR>
+struct vec3_from_python
{
- triple_from_python()
+ vec3_from_python()
{
boost::python::converter::registry::push_back(
- &convertible, &construct, boost::python::type_id<Triple<NUM> >());
+ &convertible, &construct, boost::python::type_id<VEC3>());
}
static void* convertible(PyObject* obj_ptr)
@@ -221,29 +240,24 @@ struct triple_from_python
static void construct(PyObject* obj_ptr,
boost::python::converter::rvalue_from_python_stage1_data* data)
{
- avg::Triple<NUM> t;
+ VEC3 t;
PyObject * pEntry = PySequence_GetItem(obj_ptr, 0);
- t.x = (NUM)PyFloat_AsDouble(pEntry);
+ t.x = (ATTR)PyFloat_AsDouble(pEntry);
Py_DECREF(pEntry);
pEntry = PySequence_GetItem(obj_ptr, 1);
- t.y = (NUM)PyFloat_AsDouble(pEntry);
+ t.y = (ATTR)PyFloat_AsDouble(pEntry);
Py_DECREF(pEntry);
pEntry = PySequence_GetItem(obj_ptr, 2);
- t.z = (NUM)PyFloat_AsDouble(pEntry);
+ t.z = (ATTR)PyFloat_AsDouble(pEntry);
Py_DECREF(pEntry);
void* storage = (
- (boost::python::converter::rvalue_from_python_storage<Triple<NUM> >*)
+ (boost::python::converter::rvalue_from_python_storage<VEC3>*)
data)->storage.bytes;
- new (storage) Triple<NUM>(t);
+ new (storage) VEC3(t);
data->convertible = storage;
}
};
-void exception_translator(Exception const & e)
-{
- PyErr_SetString(PyExc_RuntimeError, e.getStr().c_str());
-}
-
struct UTF8String_to_unicode
{
static PyObject *convert(const UTF8String & s)
@@ -272,7 +286,6 @@ struct UTF8String_from_unicode
static void construct(PyObject* obj_ptr,
boost::python::converter::rvalue_from_python_stage1_data* data)
{
- UTF8String s;
PyObject * pPyUTF8 = PyUnicode_AsUTF8String(obj_ptr);
char * psz = PyString_AsString(pPyUTF8);
void* storage = (
@@ -280,6 +293,7 @@ struct UTF8String_from_unicode
->storage.bytes;
new (storage) UTF8String(psz);
data->convertible = storage;
+ Py_DECREF(pPyUTF8);
}
};
@@ -302,8 +316,7 @@ struct UTF8String_from_string
static void construct(PyObject* obj_ptr,
boost::python::converter::rvalue_from_python_stage1_data* data)
{
- UTF8String s;
- char * psz = PyString_AsString(obj_ptr);
+ const char * psz = PyString_AsString(obj_ptr);
void* storage = (
(boost::python::converter::rvalue_from_python_storage<UTF8String>*)data)
->storage.bytes;
@@ -312,34 +325,104 @@ struct UTF8String_from_string
}
};
+void exportMessages(object& nodeClass, const string& sClassName)
+{
+ PublisherDefinitionPtr pPubDef = PublisherDefinitionRegistry::get()
+ ->getDefinition(sClassName);
+ const vector<MessageID>& messageIDs = pPubDef->getMessageIDs();
+ for (unsigned i=0; i<messageIDs.size(); ++i) {
+ string sName = messageIDs[i].m_sName;
+ nodeClass.attr(sName.c_str()) = messageIDs[i];
+ }
+};
+
+struct type_info_to_string{
+ static PyObject* convert(const std::type_info& info)
+ {
+ boost::python::object result(ObjectCounter::get()->demangle(info.name()));
+ return boost::python::incref(result.ptr());
+ }
+};
+
+
void export_base()
{
-#if (BOOST_VERSION / 100000) > 1 || ((BOOST_VERSION / 100) % 1000) >= 33
- register_exception_translator<Exception>(exception_translator);
-#endif
- to_python_converter<Exception, Exception_to_python_exception>();
- to_python_converter<IntPoint, Point_to_python_tuple<int> >();
- to_python_converter<DTriple, Triple_to_python_tuple<double> >();
- point_from_python<DPoint, double>();
- point_from_python<ConstDPoint, double>();
- point_from_python<IntPoint, int>();
-
- triple_from_python<double>();
- triple_from_python<int>();
-
- to_python_converter<vector<DPoint>, to_list<vector<DPoint> > >();
- to_python_converter<vector<string>, to_list<vector<string> > >();
+ // Exceptions
+
+ translateException<exception>(PyExc_RuntimeError);
+ translateException<out_of_range>(PyExc_IndexError);
+ translateException<Exception>(PyExc_RuntimeError);
+ to_python_converter< exception, Exception_to_python_exception<exception> >();
+ to_python_converter< Exception, Exception_to_python_exception<Exception> >();
+
+ // vec2
+ to_python_converter<IntPoint, Vec2_to_python_tuple<IntPoint> >();
+ vec2_from_python<IntPoint, int>();
+ vec2_from_python<glm::vec2, float>();
+ vec2_from_python<ConstVec2, float>();
- from_python_sequence<vector<DPoint>, variable_capacity_policy>();
+ // vector<vec2>
+ to_python_converter<vector<glm::vec2>, to_list<vector<glm::vec2> > >();
from_python_sequence<vector<IntPoint>, variable_capacity_policy>();
- from_python_sequence<vector<string>, variable_capacity_policy>();
-
- from_python_sequence<vector<IntTriple>, variable_capacity_policy>();
- from_python_sequence<vector<DTriple>, variable_capacity_policy>();
- from_python_sequence<vector<double>, variable_capacity_policy>();
+ from_python_sequence<vector<glm::vec2>, variable_capacity_policy>();
+
+ // vec3
+ to_python_converter<glm::ivec3, Vec3_to_python_tuple<glm::ivec3> >();
+ to_python_converter<glm::vec3, Vec3_to_python_tuple<glm::vec3> >();
+ vec3_from_python<glm::ivec3, int>();
+ vec3_from_python<glm::vec3, float>();
+ // vector<vec3>
+ to_python_converter<vector<glm::ivec3>, to_list<vector<glm::ivec3> > >();
+ to_python_converter<vector<glm::vec3>, to_list<vector<glm::vec3> > >();
+ from_python_sequence<vector<glm::ivec3>, variable_capacity_policy>();
+ from_python_sequence<vector<glm::vec3>, variable_capacity_policy>();
+
+ // string
to_python_converter<UTF8String, UTF8String_to_unicode>();
UTF8String_from_unicode();
UTF8String_from_string();
+
+ to_python_converter<vector<string>, to_list<vector<string> > >();
+ from_python_sequence<vector<string>, variable_capacity_policy>();
+
+ from_python_sequence<vector<float>, variable_capacity_policy>();
+ from_python_sequence<vector<int>, variable_capacity_policy>();
+
+ to_python_converter<std::type_info, type_info_to_string>();
+ //Maps
+ to_python_converter<TypeMap, to_dict<TypeMap> >();
+ to_python_converter<CatToSeverityMap, to_dict<CatToSeverityMap> >();
+}
+
+namespace {
+ std::map<PyObject *, LogSinkPtr> m_pyObjectMap;
+}
+
+void addPythonLogger(PyObject * self, PyObject * pyLogger)
+{
+ Logger * logger = Logger::get();
+ LogSinkPtr logSink(new PythonLogSink(pyLogger));
+ logger->addLogSink(logSink);
+ m_pyObjectMap[pyLogger] = logSink;
+}
+
+void removePythonLogger(PyObject * self, PyObject * pyLogger)
+{
+ Logger* logger = Logger::get();
+ std::map<PyObject *, LogSinkPtr>::iterator it;
+ it = m_pyObjectMap.find(pyLogger);
+ if( it !=m_pyObjectMap.end() ){
+ logger->removeLogSink(it->second);
+ m_pyObjectMap.erase(it);
+ }
+}
+
+void pytrace(PyObject * self, const avg::category_t& category, const UTF8String& sMsg,
+ avg::severity_t severity)
+{
+ avgDeprecationWarning(string("1.8"), "logger.trace",
+ "any of the logging convenience functions");
+ Logger::get()->trace(sMsg, category, severity);
}
diff --git a/src/wrapper/WrapHelper.h b/src/wrapper/WrapHelper.h
index 5ca9457..cd86439 100644
--- a/src/wrapper/WrapHelper.h
+++ b/src/wrapper/WrapHelper.h
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -23,15 +23,18 @@
#define _WrapHelper_H_
#include "../api.h"
-#include "../base/Point.h"
-#include "../base/Triple.h"
+#include "../base/GLMHelper.h"
#include "../base/Exception.h"
+#include "../base/ILogSink.h"
#include "../player/BoostPython.h"
#include "../player/Player.h"
+#include "../player/TypeRegistry.h"
#include <string>
+template<typename T> const T copyObject(const T& v) { return v; }
+
template <typename ContainerType>
struct to_tuple
{
@@ -64,6 +67,21 @@ struct to_list
static const PyTypeObject* get_pytype() { return &PyList_Type; }
};
+template <typename MapType>
+struct to_dict
+{
+ static PyObject* convert(MapType const& a)
+ {
+ boost::python::dict result;
+ typedef typename MapType::const_iterator const_iter;
+ for(const_iter p=a.begin();p!=a.end();p++){
+ result[p->first] = p->second;
+ }
+ return boost::python::incref(boost::python::dict(result).ptr());
+ }
+ static const PyTypeObject* get_pytype() { return &PyDict_Type; }
+};
+
struct default_policy
{
static bool check_convertibility_per_element() { return false; }
@@ -273,48 +291,107 @@ struct from_python_sequence
};
template<class T>
-double deprecatedGet(T& node)
+float deprecatedGet(T& node)
{
throw avg::Exception(AVG_ERR_DEPRECATED, "Attribute has been removed from libavg.");
}
template<class T>
-void deprecatedSet(T& node, double d)
+void deprecatedSet(T& node, float d)
{
throw avg::Exception(AVG_ERR_DEPRECATED, "Attribute has been removed from libavg.");
}
-namespace DPointHelper
+namespace Vec2Helper
{
- int len(const avg::DPoint&);
- double getX(const avg::DPoint& pt);
- double getY(const avg::DPoint& pt);
- void setX(avg::DPoint& pt, double val);
- void setY(avg::DPoint& pt, double val);
+ int len(const glm::vec2&);
+ float getX(const glm::vec2& pt);
+ float getY(const glm::vec2& pt);
+ void setX(glm::vec2& pt, float val);
+ void setY(glm::vec2& pt, float val);
void checkItemRange(int i);
- double getItem(const avg::DPoint& pt, int i);
- void setItem(avg::DPoint& pt, int i, double val);
- std::string str(const avg::DPoint& pt);
- std::string repr(const avg::DPoint& pt);
- long getHash(const avg::DPoint& pt);
+ float getItem(const glm::vec2& pt, int i);
+ void setItem(glm::vec2& pt, int i, float val);
+ std::string str(const glm::vec2& pt);
+ std::string repr(const glm::vec2& pt);
+ long getHash(const glm::vec2& pt);
+ glm::vec2 safeGetNormalized(const glm::vec2& pt);
+ float getNorm(const glm::vec2& pt);
+ float vecAngle(const glm::vec2& pt1, const glm::vec2& pt2);
}
-class ConstDPoint: public avg::DPoint
+class ConstVec2: public glm::vec2
{
public:
- ConstDPoint();
- ConstDPoint(const avg::DPoint& other);
- operator avg::DPoint() const;
+ ConstVec2();
+ ConstVec2(const glm::vec2& other);
+ glm::vec2 toVec2() const;
+ //operator glm::vec2() const;
};
-AVG_API void checkEmptyArgs(const boost::python::tuple &args, int numArgs=0);
+AVG_API void checkEmptyArgs(const boost::python::tuple &args, int numArgs=1);
+
+template<const char * pszType>
+avg::ExportedObjectPtr createExportedObject(const boost::python::tuple &args,
+ const boost::python::dict &attrs)
+{
+ checkEmptyArgs(args);
+ return avg::TypeRegistry::get()->createObject(pszType, attrs);
+}
template<const char * pszType>
avg::NodePtr createNode(const boost::python::tuple &args,
const boost::python::dict &attrs)
{
checkEmptyArgs(args);
- return avg::Player::get()->createNode(pszType, attrs);
+ return avg::Player::get()->createNode(pszType, attrs, args[0]);
+};
+
+template <typename T>struct Exception_to_python_exception
+{
+ static PyObject* convert (const T& ex)
+ {
+ PyObject *arglist = boost::python::incref(
+ Py_BuildValue("(s)", ex.what()));
+ return boost::python::incref(
+ PyObject_CallObject(PyExc_RuntimeError, arglist));
+ }
+};
+
+
+template<typename T> struct ExceptionTranslator
+{
+public:
+ void operator()(const T& ex) const
+ {
+ PyErr_SetString(m_PyExcept, ex.what());
+ }
+
+ ExceptionTranslator(PyObject* py_except): m_PyExcept(py_except)
+ {
+ boost::python::register_exception_translator<T>(*this);
+ }
+
+ ExceptionTranslator(const ExceptionTranslator& other):m_PyExcept(other.m_PyExcept)
+ {
+ }
+
+ private:
+
+ PyObject* m_PyExcept;
+
+};
+
+template <typename T> void translateException(PyObject* e) {
+ ExceptionTranslator<T> my_translator(e);
}
+void exportMessages(boost::python::object& nodeClass, const std::string& sClassName);
+
+void addPythonLogger(PyObject * self, PyObject * pyLogger);
+void removePythonLogger(PyObject * self, PyObject * pyLogger);
+
+void pytrace(PyObject * self, const avg::category_t& category, const avg::UTF8String& sMsg,
+ avg::severity_t severity);
+
#endif
diff --git a/src/wrapper/anim_wrap.cpp b/src/wrapper/anim_wrap.cpp
index 7e22f07..0dfadf2 100644
--- a/src/wrapper/anim_wrap.cpp
+++ b/src/wrapper/anim_wrap.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -32,8 +32,8 @@
#include "../player/BoostPython.h"
using namespace boost::python;
-using namespace std;
using namespace avg;
+namespace bp = boost::python;
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(start_overloads, start, 0, 1);
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(setState_overloads, StateAnim::setState, 1, 2);
@@ -42,8 +42,8 @@ BOOST_PYTHON_FUNCTION_OVERLOADS(fadeOut_overloads, fadeOut, 2, 3);
void export_anim()
{
- from_python_sequence<vector<AnimPtr>, variable_capacity_policy>();
- from_python_sequence<vector<AnimState>, variable_capacity_policy>();
+ from_python_sequence<std::vector<AnimPtr>, variable_capacity_policy>();
+ from_python_sequence<std::vector<AnimState>, variable_capacity_policy>();
def("getNumRunningAnims", AttrAnim::getNumRunningAnims);
@@ -64,49 +64,68 @@ void export_anim()
;
class_<LinearAnim, boost::shared_ptr<LinearAnim>, bases<SimpleAnim>,
- boost::noncopyable>
- ("LinearAnim", init<const object&, const string&, long long, const object&,
- const object&, optional<bool, const object&, const object&> >())
+ boost::noncopyable>("LinearAnim", no_init)
+ .def(init<const object&, const std::string&, long long, const object&,
+ const object&, optional<bool, const object&, const object&> >
+ ((bp::arg("node"), bp::arg("attrName"), bp::arg("duration"),
+ bp::arg("startValue"), bp::arg("endValue"), bp::arg("useInt")=false,
+ bp::arg("startCallback")=object(), bp::arg("stopCallback")=object())))
;
-
+
class_<EaseInOutAnim, boost::shared_ptr<EaseInOutAnim>, bases<SimpleAnim>,
- boost::noncopyable>
- ("EaseInOutAnim", init<const object&, const string&, long long, const object&,
- const object&, long long, long long,
- optional<bool, const object&, const object&> >())
+ boost::noncopyable>("EaseInOutAnim", no_init)
+ .def(init<const object&, const std::string&, long long, const object&,
+ const object&, long long, long long,
+ optional<bool, const object&, const object&> >
+ ((bp::arg("node"), bp::arg("attrName"), bp::arg("duration"),
+ bp::arg("startValue"), bp::arg("endValue"), bp::arg("easeInDuration"),
+ bp::arg("easeOutDuration"), bp::arg("useInt")=false,
+ bp::arg("startCallback")=object(), bp::arg("stopCallback")=object())))
;
class_<ContinuousAnim, boost::shared_ptr<ContinuousAnim>, bases<AttrAnim>,
- boost::noncopyable>(
- "ContinuousAnim", init<const object&, const string&,
- const object&, const object&,
- optional<bool, const object&, const object&> >())
+ boost::noncopyable>("ContinuousAnim", no_init)
+ .def(init<const object&, const std::string&, const object&, const object&,
+ optional<bool, const object&, const object&> >
+ ((bp::arg("node"), bp::arg("attrName"), bp::arg("duration"),
+ bp::arg("startValue"), bp::arg("speed"), bp::arg("useInt")=false,
+ bp::arg("startCallback")=object(), bp::arg("stopCallback")=object())))
;
class_<WaitAnim, boost::shared_ptr<WaitAnim>, bases<Anim>, boost::noncopyable>(
- "WaitAnim", init<optional<long long, const object&, const object&> >())
- .def("start", &WaitAnim::start, start_overloads(args("bKeepAttr")))
+ "WaitAnim", no_init)
+ .def(init<optional<long long, const object&, const object&> >
+ ((bp::arg("duration")=-1, bp::arg("startCallback")=object(),
+ bp::arg("stopCallback")=object())))
+ .def("start", &WaitAnim::start, start_overloads(bp::args("bKeepAttr")))
;
class_<ParallelAnim, boost::shared_ptr<ParallelAnim>, bases<Anim>,
- boost::noncopyable>("ParallelAnim", init<const vector<AnimPtr>&,
- optional<const object&, const object&, long long> >())
+ boost::noncopyable>("ParallelAnim", no_init)
+ .def(init<const std::vector<AnimPtr>&,
+ optional<const object&, const object&, long long> >
+ ((bp::arg("anims"), bp::arg("startCallback")=object(),
+ bp::arg("stopCallback")=object(), bp::arg("maxAge")=-1)))
.def("start", &ParallelAnim::start, start_overloads(args("bKeepAttr")))
;
- class_<AnimState, boost::noncopyable>("AnimState",
- init<const string&, AnimPtr, optional<const string&> >())
+ class_<AnimState, boost::noncopyable>("AnimState", no_init)
+ .def(init<const std::string&, AnimPtr, optional<const std::string&> >
+ ((bp::arg("name"), bp::arg("anim"), bp::arg("nextName")="")))
;
class_<StateAnim, boost::shared_ptr<StateAnim>, bases<Anim>,
- boost::noncopyable>("StateAnim", init<const vector<AnimState>&>())
+ boost::noncopyable>("StateAnim", init<const std::vector<AnimState>&>())
.def("setState", &StateAnim::setState, setState_overloads(args("bKeepAttr")))
.def("getState", make_function(&StateAnim::getState,
return_value_policy<copy_const_reference>()))
.def("setDebug", &StateAnim::setDebug)
;
- def("fadeIn", fadeIn, fadeIn_overloads(args("max", "stopCallback")));
+ def("fadeIn", fadeIn, (bp::arg("node"), bp::arg("duration"), bp::arg("max")=1.0,
+ bp::arg("stopCallback")=object()));
+
+ def("fadeOut", fadeOut, (bp::arg("node"), bp::arg("duration"),
+ bp::arg("stopCallback")=object()));
- def("fadeOut", fadeOut, fadeOut_overloads(args("stopCallback")));
}
diff --git a/src/wrapper/avg_wrap.cpp b/src/wrapper/avg_wrap.cpp
index cecd675..acdc525 100644
--- a/src/wrapper/avg_wrap.cpp
+++ b/src/wrapper/avg_wrap.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -22,16 +22,15 @@
void export_base();
void export_node();
void export_event();
-#ifndef WIN32
-void export_devices();
-#endif
void export_anim();
#include "WrapHelper.h"
+#include "raw_constructor.hpp"
#include "../base/Logger.h"
#include "../base/OSHelper.h"
#include "../base/GeomHelper.h"
+#include "../base/XMLHelper.h"
#include "../player/Player.h"
#include "../player/AVGNode.h"
#include "../player/DivNode.h"
@@ -43,6 +42,8 @@ void export_anim();
#include "../player/OffscreenCanvas.h"
#include "../player/VideoWriter.h"
#include "../player/SVG.h"
+#include "../player/VersionInfo.h"
+#include "../player/ExportedObject.h"
#include <boost/version.hpp>
#include <boost/shared_ptr.hpp>
@@ -52,9 +53,12 @@ using namespace boost::python;
using namespace avg;
using namespace std;
+namespace bp = boost::python;
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(TestHelper_fakeTouchEvent_overloads,
fakeTouchEvent, 4, 5)
+BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(Player_createNode_overloads,
+ createNode, 2, 3)
OffscreenCanvasPtr createCanvas(const boost::python::tuple &args,
const boost::python::dict& params)
@@ -70,191 +74,282 @@ CanvasPtr createMainCanvas(const boost::python::tuple &args,
return extract<Player&>(args[0])().createMainCanvas(params);
}
+class SeverityScopeHelper{};
+class CategoryScopeHelper{};
BOOST_PYTHON_MODULE(avg)
{
- docstring_options doc_options(true, false);
+ try {
+ docstring_options doc_options(true, false);
- export_base();
+ Player::get();
+ PyEval_InitThreads();
+ export_base();
- register_ptr_to_python<DivNodePtr>();
- register_ptr_to_python<CanvasNodePtr>();
- register_ptr_to_python<AVGNodePtr>();
- register_ptr_to_python<EventPtr>();
- register_ptr_to_python<MouseEventPtr>();
- register_ptr_to_python<TouchEventPtr>();
+ register_ptr_to_python<DivNodePtr>();
+ register_ptr_to_python<CanvasNodePtr>();
+ register_ptr_to_python<AVGNodePtr>();
+ register_ptr_to_python<EventPtr>();
+ register_ptr_to_python<MouseEventPtr>();
+ register_ptr_to_python<TouchEventPtr>();
- def("getMemoryUsage", getMemoryUsage);
+ def("getMemoryUsage", getMemoryUsage);
- def("pointInPolygon", pointInPolygon);
+ def("pointInPolygon", pointInPolygon);
+ def("validateXml", validateXml);
- class_<Logger>("Logger", no_init)
- .def("get", &Logger::get,
- return_value_policy<reference_existing_object>())
- .staticmethod("get")
- .def("setCategories", &Logger::setCategories)
- .def("pushCategories", &Logger::pushCategories)
- .def("popCategories", &Logger::popCategories)
- .def("trace", &Logger::trace)
- .def_readonly("NONE", &Logger::NONE)
- .def_readonly("BLTS", &Logger::BLTS)
- .def_readonly("PROFILE", &Logger::PROFILE)
- .def_readonly("PROFILE_LATEFRAMES", &Logger::PROFILE_LATEFRAMES)
- .def_readonly("PROFILE_VIDEO", &Logger::PROFILE_VIDEO)
- .def_readonly("EVENTS", &Logger::EVENTS)
- .def_readonly("EVENTS2", &Logger::EVENTS2)
- .def_readonly("CONFIG", &Logger::CONFIG)
- .def_readonly("WARNING", &Logger::WARNING)
- .def_readonly("ERROR", &Logger::ERROR)
- .def_readonly("MEMORY", &Logger::MEMORY)
- .def_readonly("APP", &Logger::APP)
- .def_readonly("PLUGIN", &Logger::PLUGIN)
- .def_readonly("PLAYER", &Logger::PLAYER)
- ;
+ class_<MessageID>("MessageID", no_init)
+ .def("__repr__", &MessageID::getRepr)
+ ;
+
+ {
+ scope loggerScope = class_<Logger, boost::noncopyable>("Logger", no_init)
+ .def("addSink", addPythonLogger)
+ .def("removeSink", removePythonLogger)
+ .def("removeStdLogSink", &Logger::removeStdLogSink)
+ .def("configureCategory", &Logger::configureCategory,
+ (bp::arg("severity")=Logger::severity::NONE))
+ .def("getCategories", &Logger::getCategories)
+ .def("trace", pytrace,
+ (bp::arg("severity")=Logger::severity::INFO))
+ .def("debug", &Logger::logDebug,
+ (bp::arg("category")=Logger::category::APP))
+ .def("info", &Logger::logInfo,
+ (bp::arg("category")=Logger::category::APP))
+ .def("warning", &Logger::logWarning,
+ (bp::arg("category")=Logger::category::APP))
+ .def("error", &Logger::logError,
+ (bp::arg("category")=Logger::category::APP))
+ .def("critical", &Logger::logCritical,
+ (bp::arg("category")=Logger::category::APP))
+ .def("log", &Logger::log,
+ (bp::arg("category")=Logger::category::APP,
+ bp::arg("severity")=Logger::severity::INFO))
+ ;
+ {
+ scope severityScope = class_<SeverityScopeHelper>("Severity");
+ severityScope.attr("CRIT") = Logger::severity::CRITICAL;
+ severityScope.attr("ERR") = Logger::severity::ERROR;
+ severityScope.attr("WARN") = Logger::severity::WARNING;
+ severityScope.attr("INFO") = Logger::severity::INFO;
+ severityScope.attr("DBG") = Logger::severity::DEBUG;
+ severityScope.attr("NONE") = Logger::severity::NONE;
+ }
+ {
+ scope categoryScope = class_<CategoryScopeHelper>("Category");
+ categoryScope.attr("APP") = Logger::category::APP;
+ categoryScope.attr("CONFIG") = Logger::category::CONFIG;
+ categoryScope.attr("DEPREC") = Logger::category::DEPRECATION;
+ categoryScope.attr("EVENTS") = Logger::category::EVENTS;
+ categoryScope.attr("MEMORY") = Logger::category::MEMORY;
+ categoryScope.attr("NONE") = Logger::category::NONE;
+ categoryScope.attr("PROFILE") = Logger::category::PROFILE;
+ categoryScope.attr("PROFILE_V") = Logger::category::PROFILE_VIDEO;
+ categoryScope.attr("PLUGIN") = Logger::category::PLUGIN;
+ categoryScope.attr("PLAYER") = Logger::category::PLAYER;
+ categoryScope.attr("SHADER") = Logger::category::SHADER;
+ }
+ }
+
+ scope().attr("logger") = boost::python::ptr(Logger::get());
-#ifndef WIN32
- export_devices();
-#endif
- export_event();
- export_node();
- export_anim();
+ class_<ExportedObject, boost::shared_ptr<ExportedObject>, boost::noncopyable>
+ ("ExportedObject", no_init)
+ .def(self == self)
+ .def(self != self)
+ .def("__hash__", &ExportedObject::getHash)
+ ;
- class_<TestHelper>("TestHelper", no_init)
- .def("fakeMouseEvent", &TestHelper::fakeMouseEvent)
- .def("fakeTouchEvent", &TestHelper::fakeTouchEvent,
- TestHelper_fakeTouchEvent_overloads())
- .def("fakeKeyEvent", &TestHelper::fakeKeyEvent)
- .def("dumpObjects", &TestHelper::dumpObjects)
- ;
+ class_<Publisher, bases<ExportedObject>, boost::noncopyable>("Publisher")
+ .def("subscribe", &Publisher::subscribe)
+ .def("unsubscribe", &Publisher::unsubscribeCallable)
+ .def("unsubscribe", &Publisher::unsubscribe)
+ .def("unsubscribe", &Publisher::unsubscribe1)
+ .def("isSubscribed", &Publisher::isSubscribedCallable)
+ .def("isSubscribed", &Publisher::isSubscribed)
+ .def("getNumSubscribers", &Publisher::getNumSubscribers)
+ .def("publish", &Publisher::publish)
+ .def("notifySubscribers", &Publisher::notifySubscribersPy)
+ .def("genMessageID", &Publisher::genMessageID)
+ .staticmethod("genMessageID")
+ ;
- class_<Player>("Player")
- .def("get", &Player::get,
- return_value_policy<reference_existing_object>())
- .staticmethod("get")
- .def("setResolution", &Player::setResolution)
- .def("isFullscreen", &Player::isFullscreen)
- .def("setWindowFrame", &Player::setWindowFrame)
- .def("setWindowPos", &Player::setWindowPos)
- .def("setOGLOptions", &Player::setOGLOptions)
- .def("setMultiSampleSamples", &Player::setMultiSampleSamples)
- .def("getScreenResolution", &Player::getScreenResolution)
- .def("getPixelsPerMM", &Player::getPixelsPerMM)
- .def("getPhysicalScreenDimensions", &Player::getPhysicalScreenDimensions)
- .def("assumePixelsPerMM", &Player::assumePixelsPerMM)
- .def("loadFile", &Player::loadFile)
- .def("loadString", &Player::loadString)
- .def("loadCanvasFile", &Player::loadCanvasFile)
- .def("loadCanvasString", &Player::loadCanvasString)
- .def("createMainCanvas", raw_function(createMainCanvas))
- .def("createCanvas", raw_function(createCanvas))
- .def("deleteCanvas", &Player::deleteCanvas)
- .def("getMainCanvas", &Player::getMainCanvas)
- .def("getCanvas", &Player::getCanvas)
- .def("play", &Player::play)
- .def("stop", &Player::stop)
- .def("isPlaying", &Player::isPlaying)
- .def("setFramerate", &Player::setFramerate)
- .def("setVBlankFramerate", &Player::setVBlankFramerate)
- .def("getEffectiveFramerate", &Player::getEffectiveFramerate)
- .def("getTestHelper", &Player::getTestHelper,
- return_value_policy<reference_existing_object>())
- .def("setFakeFPS", &Player::setFakeFPS)
- .def("getFrameTime", &Player::getFrameTime)
- .def("getFrameDuration", &Player::getFrameDuration)
- .def("createNode", &Player::createNodeFromXmlString)
- .def("createNode", &Player::createNode)
- .def("addTracker", &Player::addTracker,
- return_value_policy<reference_existing_object>())
- .def("enableMultitouch", &Player::enableMultitouch)
- .def("isMultitouchAvailable", &Player::isMultitouchAvailable)
- .def("getTracker", &Player::getTracker,
- return_value_policy<reference_existing_object>())
- .def("setInterval", &Player::setInterval)
- .def("setTimeout", &Player::setTimeout)
- .def("setOnFrameHandler", &Player::setOnFrameHandler)
- .def("clearInterval", &Player::clearInterval)
- .def("addInputDevice", &Player::addInputDevice)
- .def("getMouseState", &Player::getMouseState)
- .def("getKeyModifierState", &Player::getKeyModifierState)
- .def("screenshot", &Player::screenshot)
- .def("stopOnEscape", &Player::setStopOnEscape)
- .def("showCursor", &Player::showCursor)
- .def("setCursor", &Player::setCursor)
- .def("getElementByID", &Player::getElementByID)
- .def("getRootNode", &Player::getRootNode)
- .def("getFramerate", &Player::getFramerate)
- .def("getVideoRefreshRate", &Player::getVideoRefreshRate)
- .def("isUsingShaders", &Player::isUsingShaders)
- .def("setGamma", &Player::setGamma)
- .def("setMousePos", &Player::setMousePos)
- .def("loadPlugin", &Player::loadPlugin)
- .def("setEventHook", &Player::setEventHook)
- .def("getEventHook", &Player::getEventHook)
- .add_property("pluginPath", &Player::getPluginPath, &Player::setPluginPath)
- .add_property("volume", &Player::getVolume, &Player::setVolume)
- ;
+ export_event();
+ export_node();
+ export_anim();
- class_<Canvas, boost::shared_ptr<Canvas>, boost::noncopyable>("Canvas", no_init)
- .def(self == self)
- .def(self != self)
- .def("__hash__", &Canvas::getHash)
- .def("getRootNode", &Canvas::getRootNode)
- .def("getElementByID", &Canvas::getElementByID)
- .def("screenshot", &Canvas::screenshot)
- ;
+ class_<TestHelper>("TestHelper", no_init)
+ .def("fakeMouseEvent", &TestHelper::fakeMouseEvent)
+ .def("fakeTouchEvent", &TestHelper::fakeTouchEvent,
+ TestHelper_fakeTouchEvent_overloads())
+ .def("fakeKeyEvent", &TestHelper::fakeKeyEvent)
+ .def("dumpObjects", &TestHelper::dumpObjects)
+ .def("getObjectCount", &TestHelper::getObjectCount)
+ ;
- class_<OffscreenCanvas, boost::shared_ptr<OffscreenCanvas>, bases<Canvas>,
- boost::noncopyable>("OffscreenCanvas", no_init)
- .def("getID", &OffscreenCanvas::getID)
- .def("render", &OffscreenCanvas::manualRender)
- .def("registerCameraNode", &OffscreenCanvas::registerCameraNode)
- .def("unregisterCameraNode", &OffscreenCanvas::unregisterCameraNode)
- .add_property("handleevents", &OffscreenCanvas::getHandleEvents)
- .add_property("multisamplesamples", &OffscreenCanvas::getMultiSampleSamples)
- .add_property("mipmap", &OffscreenCanvas::getMipmap)
- .add_property("autorender", &OffscreenCanvas::getAutoRender,
- &OffscreenCanvas::setAutoRender)
- .def("getNumDependentCanvases", &OffscreenCanvas::getNumDependentCanvases)
- .def("isSupported", &OffscreenCanvas::isSupported)
- .staticmethod("isSupported")
- .def("isMultisampleSupported", &OffscreenCanvas::isMultisampleSupported)
- .staticmethod("isMultisampleSupported")
- ;
+ enum_<GLConfig::ShaderUsage>("ShaderUsage")
+ .value("SHADERUSAGE_FULL", GLConfig::FULL)
+ .value("SHADERUSAGE_MINIMAL", GLConfig::MINIMAL)
+ .value("SHADERUSAGE_AUTO", GLConfig::AUTO)
+ .export_values()
+ ;
- class_<VideoWriter, boost::shared_ptr<VideoWriter>, boost::noncopyable>
- ("VideoWriter", no_init)
- .def(init<CanvasPtr, const std::string&, int, int, int, bool>())
- .def(init<CanvasPtr, const std::string&, int, int, int>())
- .def(init<CanvasPtr, const std::string&, int>())
- .def("stop", &VideoWriter::stop)
- .def("pause", &VideoWriter::pause)
- .def("play", &VideoWriter::play)
- .add_property("filename", &VideoWriter::getFileName)
- .add_property("framerate", &VideoWriter::getFramerate)
- .add_property("qmin", &VideoWriter::getQMin)
- .add_property("qmax", &VideoWriter::getQMax)
- ;
+ object playerClass = class_<Player, bases<Publisher>, boost::noncopyable>
+ ("Player")
+ .def("get", &Player::get,
+ return_value_policy<reference_existing_object>())
+ .staticmethod("get")
+ .def("setResolution", &Player::setResolution)
+ .def("isFullscreen", &Player::isFullscreen)
+ .def("setWindowFrame", &Player::setWindowFrame)
+ .def("setWindowPos", &Player::setWindowPos)
+ .def("setWindowTitle", &Player::setWindowTitle)
+ .def("useGLES", &Player::useGLES)
+ .def("setOGLOptions", &Player::setOGLOptions)
+ .def("setMultiSampleSamples", &Player::setMultiSampleSamples)
+ .def("enableGLErrorChecks", &Player::enableGLErrorChecks)
+ .def("getScreenResolution", &Player::getScreenResolution)
+ .def("getPixelsPerMM", &Player::getPixelsPerMM)
+ .def("getPhysicalScreenDimensions", &Player::getPhysicalScreenDimensions)
+ .def("assumePixelsPerMM", &Player::assumePixelsPerMM)
+ .def("loadFile", &Player::loadFile)
+ .def("loadString", &Player::loadString)
+ .def("loadCanvasFile", &Player::loadCanvasFile)
+ .def("loadCanvasString", &Player::loadCanvasString)
+ .def("createMainCanvas", raw_function(createMainCanvas))
+ .def("createCanvas", raw_function(createCanvas))
+ .def("deleteCanvas", &Player::deleteCanvas)
+ .def("getMainCanvas", &Player::getMainCanvas)
+ .def("getCanvas", &Player::getCanvas)
+ .def("play", &Player::play)
+ .def("stop", &Player::stop)
+ .def("isPlaying", &Player::isPlaying)
+ .def("setFramerate", &Player::setFramerate)
+ .def("setVBlankFramerate", &Player::setVBlankFramerate)
+ .def("getEffectiveFramerate", &Player::getEffectiveFramerate)
+ .def("getTestHelper", &Player::getTestHelper,
+ return_value_policy<reference_existing_object>())
+ .def("setFakeFPS", &Player::setFakeFPS)
+ .def("getFrameTime", &Player::getFrameTime)
+ .def("getFrameDuration", &Player::getFrameDuration)
+ .def("createNode", &Player::createNodeFromXmlString)
+ .def("createNode", &Player::createNode, Player_createNode_overloads())
+ .def("enableMultitouch", &Player::enableMultitouch)
+ .def("enableMouse", &Player::enableMouse)
+ .def("isMultitouchAvailable", &Player::isMultitouchAvailable)
+ .def("getTracker", &Player::getTracker,
+ return_value_policy<reference_existing_object>())
+ .def("setInterval", &Player::setInterval)
+ .def("setTimeout", &Player::setTimeout)
+ .def("callFromThread", &Player::callFromThread)
+ .def("setOnFrameHandler", &Player::setOnFrameHandler)
+ .def("clearInterval", &Player::clearInterval)
+ .def("addInputDevice", &Player::addInputDevice)
+ .def("getMouseState", &Player::getMouseState)
+ .def("getCurrentEvent", &Player::getCurrentEvent)
+ .def("getKeyModifierState", &Player::getKeyModifierState)
+ .def("screenshot", &Player::screenshot)
+ .def("keepWindowOpen", &Player::keepWindowOpen)
+ .def("stopOnEscape", &Player::setStopOnEscape)
+ .def("showCursor", &Player::showCursor)
+ .def("isCursorShown", &Player::isCursorShown)
+ .def("setCursor", &Player::setCursor)
+ .def("getElementByID", &Player::getElementByID)
+ .def("getRootNode", &Player::getRootNode)
+ .def("getFramerate", &Player::getFramerate)
+ .def("getVideoRefreshRate", &Player::getVideoRefreshRate)
+ .def("getVideoMemInstalled", &Player::getVideoMemInstalled)
+ .def("getVideoMemUsed", &Player::getVideoMemUsed)
+ .def("setGamma", &Player::setGamma)
+ .def("setMousePos", &Player::setMousePos)
+ .def("loadPlugin", &Player::loadPlugin)
+ .def("setEventHook", &Player::setEventHook)
+ .def("getEventHook", &Player::getEventHook)
+ .def("getConfigOption", &Player::getConfigOption)
+ .def("isUsingGLES", &Player::isUsingGLES)
+ .def("areFullShadersSupported", &Player::areFullShadersSupported)
+ .add_property("pluginPath", &Player::getPluginPath, &Player::setPluginPath)
+ .add_property("volume", &Player::getVolume, &Player::setVolume)
+ ;
+ exportMessages(playerClass, "Player");
+
+ class_<Canvas, boost::shared_ptr<Canvas>, bases<ExportedObject>,
+ boost::noncopyable>("Canvas", no_init)
+ .def("getRootNode", &Canvas::getRootNode)
+ .def("getElementByID", &Canvas::getElementByID)
+ .def("screenshot", &Canvas::screenshot)
+ ;
- BitmapPtr (SVG::*renderElement1)(const UTF8String&) = &SVG::renderElement;
- BitmapPtr (SVG::*renderElement2)(const UTF8String&, const DPoint&) =
- &SVG::renderElement;
- BitmapPtr (SVG::*renderElement3)(const UTF8String&, double) =
- &SVG::renderElement;
- NodePtr (SVG::*createImageNode1)(const UTF8String&, const dict&) =
- &SVG::createImageNode;
- NodePtr (SVG::*createImageNode2)(const UTF8String&, const dict&, const DPoint&) =
- &SVG::createImageNode;
- NodePtr (SVG::*createImageNode3)(const UTF8String&, const dict&, double) =
- &SVG::createImageNode;
+ class_<OffscreenCanvas, boost::shared_ptr<OffscreenCanvas>, bases<Canvas>,
+ boost::noncopyable>("OffscreenCanvas", no_init)
+ .def("getID", &OffscreenCanvas::getID)
+ .def("render", &OffscreenCanvas::manualRender)
+ .def("registerCameraNode", &OffscreenCanvas::registerCameraNode)
+ .def("unregisterCameraNode", &OffscreenCanvas::unregisterCameraNode)
+ .add_property("handleevents", &OffscreenCanvas::getHandleEvents)
+ .add_property("multisamplesamples", &OffscreenCanvas::getMultiSampleSamples)
+ .add_property("mipmap", &OffscreenCanvas::getMipmap)
+ .add_property("autorender", &OffscreenCanvas::getAutoRender,
+ &OffscreenCanvas::setAutoRender)
+ .def("getNumDependentCanvases", &OffscreenCanvas::getNumDependentCanvases)
+ .def("isSupported", &OffscreenCanvas::isSupported)
+ .staticmethod("isSupported")
+ .def("isMultisampleSupported", &OffscreenCanvas::isMultisampleSupported)
+ .staticmethod("isMultisampleSupported")
+ ;
- class_<SVG, boost::noncopyable>("SVG", init<const UTF8String&, bool>())
- .def("renderElement", renderElement1)
- .def("renderElement", renderElement2)
- .def("renderElement", renderElement3)
- .def("createImageNode", createImageNode1)
- .def("createImageNode", createImageNode2)
- .def("createImageNode", createImageNode3)
- .def("getElementSize", &SVG::getElementSize)
+ class_<VideoWriter, boost::shared_ptr<VideoWriter>, boost::noncopyable>
+ ("VideoWriter", no_init)
+ .def(init<CanvasPtr, const std::string&, int, int, int, bool>())
+ .def(init<CanvasPtr, const std::string&, int, int, int>())
+ .def(init<CanvasPtr, const std::string&, int>())
+ .def("stop", &VideoWriter::stop)
+ .def("pause", &VideoWriter::pause)
+ .def("play", &VideoWriter::play)
+ .add_property("filename", &VideoWriter::getFileName)
+ .add_property("framerate", &VideoWriter::getFramerate)
+ .add_property("qmin", &VideoWriter::getQMin)
+ .add_property("qmax", &VideoWriter::getQMax)
;
+ BitmapPtr (SVG::*renderElement1)(const UTF8String&) = &SVG::renderElement;
+ BitmapPtr (SVG::*renderElement2)(const UTF8String&, const glm::vec2&) =
+ &SVG::renderElement;
+ BitmapPtr (SVG::*renderElement3)(const UTF8String&, float) =
+ &SVG::renderElement;
+ NodePtr (SVG::*createImageNode1)(const UTF8String&, const dict&) =
+ &SVG::createImageNode;
+ NodePtr (SVG::*createImageNode2)(const UTF8String&, const dict&, const glm::vec2&) =
+ &SVG::createImageNode;
+ NodePtr (SVG::*createImageNode3)(const UTF8String&, const dict&, float) =
+ &SVG::createImageNode;
+
+ class_<SVG, boost::noncopyable>("SVG", no_init)
+ .def(init<const UTF8String&>())
+ .def(init<const UTF8String&, bool>())
+ .def("renderElement", renderElement1)
+ .def("renderElement", renderElement2)
+ .def("renderElement", renderElement3)
+ .def("createImageNode", createImageNode1)
+ .def("createImageNode", createImageNode2)
+ .def("createImageNode", createImageNode3)
+ .def("getElementPos", &SVG::getElementPos)
+ .def("getElementSize", &SVG::getElementSize)
+ ;
+
+ class_<VersionInfo>("VersionInfo")
+ .add_property("full", &VersionInfo::getFull)
+ .add_property("release", &VersionInfo::getRelease)
+ .add_property("major", &VersionInfo::getMajor)
+ .add_property("minor", &VersionInfo::getMinor)
+ .add_property("micro", &VersionInfo::getMicro)
+ .add_property("revision", &VersionInfo::getRevision)
+ .add_property("branchurl", &VersionInfo::getBranchUrl)
+ .add_property("builder", &VersionInfo::getBuilder)
+ .add_property("buildtime", &VersionInfo::getBuildTime)
+ ;
+ } catch (const exception& e) {
+ PyErr_SetString(PyExc_RuntimeError, e.what());
+ throw error_already_set();
+ }
}
diff --git a/src/wrapper/bitmap_wrap.cpp b/src/wrapper/bitmap_wrap.cpp
index e9631e6..5f86fb9 100644
--- a/src/wrapper/bitmap_wrap.cpp
+++ b/src/wrapper/bitmap_wrap.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -22,11 +22,15 @@
#include "WrapHelper.h"
#include "../player/BoostPython.h"
+#include "../player/BitmapManager.h"
#include "../graphics/Bitmap.h"
-#include "../graphics/BitmapManager.h"
+#include "../graphics/BitmapLoader.h"
+#include "../graphics/FilterResizeBilinear.h"
-#include "../base/Point.h"
+#include "../base/CubicSpline.h"
+
+#include "../glm/gtx/vector_angle.hpp"
#include <vector>
#include <sstream>
@@ -39,17 +43,15 @@ template<class POINT>
class_<POINT> export_point(const string& sName)
{
return class_<POINT>(sName.c_str(), no_init)
- .def("__len__", &DPointHelper::len)
- .def("__getitem__", &DPointHelper::getItem)
- .def("__str__", &DPointHelper::str)
- .def("__repr__", &DPointHelper::repr)
- .def("__hash__", &DPointHelper::getHash)
- .def("getNormalized", &DPoint::safeGetNormalized)
- .def("getNorm", &DPoint::getNorm)
- .def("getRotated", &DPoint::getRotated)
- .def("getRotated", &DPoint::getRotatedPivot)
- .def("isNaN", &DPoint::isNaN)
- .def("isInf", &DPoint::isInf)
+ .def("__len__", &Vec2Helper::len)
+ .def("__getitem__", &Vec2Helper::getItem)
+ .def("__str__", &Vec2Helper::str)
+ .def("__repr__", &Vec2Helper::repr)
+ .def("__hash__", &Vec2Helper::getHash)
+ .def("getNormalized", &Vec2Helper::safeGetNormalized)
+ .def("getNorm", &Vec2Helper::getNorm)
+ .def("getRotated", &getRotated)
+ .def("getRotated", &getRotatedPivot)
.def(self == self)
.def(self != self)
.def(-self)
@@ -58,10 +60,10 @@ class_<POINT> export_point(const string& sName)
.def(float() * self)
.def(self * float())
.def(self / float())
- .def("getAngle", &DPoint::getAngle)
- .def("fromPolar", &DPoint::fromPolar)
+ .def("getAngle", &getAngle)
+ .def("fromPolar", &fromPolar)
.staticmethod("fromPolar")
- .def("angle", &vecAngle)
+ .def("angle", &Vec2Helper::vecAngle)
.staticmethod("angle")
;
}
@@ -75,33 +77,63 @@ struct Pixel32_to_python_tuple
}
};
-ConstDPoint Bitmap_getSize(Bitmap* This)
+ConstVec2 Bitmap_getSize(Bitmap* This)
{
- return (DPoint)(This->getSize());
+ return (glm::vec2)(This->getSize());
}
-DPoint* createPoint()
+BitmapPtr Bitmap_getResized(BitmapPtr This, const glm::vec2& size)
{
- return new DPoint(0,0);
+ return FilterResizeBilinear(IntPoint(size)).apply(This);
}
+glm::vec2* createPoint()
+{
+ return new glm::vec2(0,0);
+}
+
+BitmapPtr createBitmapFromFile(const UTF8String& sFName)
+{
+ return loadBitmap(sFName);
+}
+
+BitmapPtr createBitmapWithRect(BitmapPtr pBmp,
+ const glm::vec2& tlPos, const glm::vec2& brPos)
+{
+ if (tlPos.x >= brPos.x || tlPos.y >= brPos.y) {
+ throw Exception(AVG_ERR_OUT_OF_RANGE,
+ "Can't create a bitmap with zero or negative width/height.");
+ }
+ IntPoint size = pBmp->getSize();
+ if (tlPos.x < 0 || tlPos.y < 0 || brPos.x > size.x || brPos.y > size.y) {
+ throw Exception(AVG_ERR_OUT_OF_RANGE,
+ "Attempt to create a subbitmap that doesn't fit into the parent bitmap.");
+ }
+ IntRect rect = IntRect(IntPoint(tlPos), IntPoint(brPos));
+ return BitmapPtr(new Bitmap(*pBmp, rect));
+}
+
+BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(loadBitmap_overloads, BitmapManager::loadBitmapPy,
+ 2, 3);
+
void export_bitmap()
{
- export_point<DPoint>("Point2D")
+ export_point<glm::vec2>("Point2D")
.def("__init__", make_constructor(createPoint))
- .def(init<double, double>())
- .def(init<const DPoint&>())
- .def("__setitem__", &DPointHelper::setItem)
- .add_property("x", &DPointHelper::getX, &DPointHelper::setX,"")
- .add_property("y", &DPointHelper::getY, &DPointHelper::setY,"")
+ .def(init<float, float>())
+ .def(init<const glm::vec2&>())
+ .def("__setitem__", &Vec2Helper::setItem)
+ .add_property("x", &Vec2Helper::getX, &Vec2Helper::setX,"")
+ .add_property("y", &Vec2Helper::getY, &Vec2Helper::setY,"")
;
- export_point<ConstDPoint>("ConstPoint2D")
- .add_property("x", &DPointHelper::getX, "")
- .add_property("y", &DPointHelper::getY, "")
+
+ export_point<ConstVec2>("ConstPoint2D")
+ .add_property("x", &Vec2Helper::getX, "")
+ .add_property("y", &Vec2Helper::getY, "")
;
- implicitly_convertible<ConstDPoint, DPoint>();
- implicitly_convertible<DPoint, ConstDPoint>();
+ implicitly_convertible<ConstVec2, glm::vec2>();
+ implicitly_convertible<glm::vec2, ConstVec2>();
enum_<PixelFormat>("pixelformat")
.value("B5G6R5", B5G6R5)
@@ -123,6 +155,7 @@ void export_bitmap()
.value("YCbCr422", YCbCr422)
.value("YUYV422", YUYV422)
.value("YCbCr420p", YCbCr420p)
+ .value("YCbCrJ420p", YCbCrJ420p)
.value("YCbCrA420p", YCbCrA420p)
.value("BAYER8", BAYER8)
.value("BAYER8_RGGB", BAYER8_RGGB)
@@ -133,12 +166,17 @@ void export_bitmap()
.value("I32F", I32F)
.export_values();
+ def("getSupportedPixelFormats", &getSupportedPixelFormats);
+
to_python_converter<Pixel32, Pixel32_to_python_tuple>();
class_<Bitmap, boost::shared_ptr<Bitmap> >("Bitmap", no_init)
- .def(init<DPoint, PixelFormat, UTF8String>())
+ .def(init<glm::vec2, PixelFormat, UTF8String>())
.def(init<Bitmap>())
- .def(init<UTF8String>())
+ .def("__init__", make_constructor(createBitmapWithRect))
+ .def("__init__", make_constructor(createBitmapFromFile))
+ .def("blt", &Bitmap::blt)
+ .def("getResized", &Bitmap_getResized)
.def("save", &Bitmap::save)
.def("getSize", &Bitmap_getSize)
.def("getFormat", &Bitmap::getPixelFormat)
@@ -157,6 +195,13 @@ void export_bitmap()
.def("get", &BitmapManager::get,
return_value_policy<reference_existing_object>())
.staticmethod("get")
- .def("loadBitmap", &BitmapManager::loadBitmap)
+ .def("loadBitmap", &BitmapManager::loadBitmapPy, loadBitmap_overloads())
+ .def("setNumThreads", &BitmapManager::setNumThreads)
+ ;
+
+ class_<CubicSpline, boost::noncopyable>("CubicSpline", no_init)
+ .def(init<const vector<glm::vec2>&>())
+ .def(init<const vector<glm::vec2>&, bool>())
+ .def("interpolate", &CubicSpline::interpolate)
;
}
diff --git a/src/wrapper/device_wrap.cpp b/src/wrapper/device_wrap.cpp
deleted file mode 100644
index 02d964b..0000000
--- a/src/wrapper/device_wrap.cpp
+++ /dev/null
@@ -1,93 +0,0 @@
-//
-// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 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 "WrapHelper.h"
-
-#include "../avgconfigwrapper.h"
-#include "../parport/ParPort.h"
-#include "../conradrelais/ConradRelais.h"
-#ifdef AVG_ENABLE_PARPORT
-#include <linux/parport.h>
-#endif
-
-using namespace boost::python;
-using namespace avg;
-
-enum ControlLines {
- CONTROL_STROBE = PARPORT_CONTROL_STROBE,
- CONTROL_AUTOFD = PARPORT_CONTROL_AUTOFD,
- CONTROL_INIT = PARPORT_CONTROL_INIT,
- CONTROL_SELECT = PARPORT_CONTROL_SELECT
-};
-
-enum StatusLines {
- STATUS_ERROR = PARPORT_STATUS_ERROR,
- STATUS_SELECT = PARPORT_STATUS_SELECT,
- STATUS_PAPEROUT = PARPORT_STATUS_PAPEROUT,
- STATUS_ACK = PARPORT_STATUS_ACK,
- STATUS_BUSY = PARPORT_STATUS_BUSY
-};
-
-void export_devices()
-{
- enum_<ControlLines>("controllines")
- .value("CONTROL_STROBE", CONTROL_STROBE)
- .value("CONTROL_AUTOFD", CONTROL_AUTOFD)
- .value("CONTROL_INIT", CONTROL_INIT)
- .value("CONTROL_SELECT", CONTROL_SELECT)
- .export_values();
-
- enum_<StatusLines>("statuslines")
- .value("STATUS_ERROR", STATUS_ERROR)
- .value("STATUS_SELECT", STATUS_SELECT)
- .value("STATUS_PAPEROUT", STATUS_PAPEROUT)
- .value("STATUS_ACK", STATUS_ACK)
- .value("STATUS_BUSY", STATUS_BUSY)
- .export_values();
-
- enum_<ParPortData>("DataBits")
- .value("PARPORTDATA0", BIT0)
- .value("PARPORTDATA1", BIT1)
- .value("PARPORTDATA2", BIT2)
- .value("PARPORTDATA3", BIT3)
- .value("PARPORTDATA4", BIT4)
- .value("PARPORTDATA5", BIT5)
- .value("PARPORTDATA6", BIT6)
- .value("PARPORTDATA7", BIT7)
- .export_values();
-
- class_<ParPort>("ParPort")
- .def("init", &ParPort::init)
- .def("setControlLine", &ParPort::setControlLine)
- .def("getStatusLine", &ParPort::getStatusLine)
- .def("setDataLines", &ParPort::setDataLines)
- .def("clearDataLines", &ParPort::clearDataLines)
- .def("setAllDataLines", &ParPort::setDataLines)
- .def("isAvailable", &ParPort::isAvailable)
- ;
-
- class_<ConradRelais>("ConradRelais", init<Player*, int>())
- .def("getNumCards", &ConradRelais::getNumCards)
- .def("set", &ConradRelais::set)
- .def("get", &ConradRelais::get)
- ;
-}
-
diff --git a/src/wrapper/event_wrap.cpp b/src/wrapper/event_wrap.cpp
index 8fea62c..3b0dfba 100644
--- a/src/wrapper/event_wrap.cpp
+++ b/src/wrapper/event_wrap.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -26,6 +26,7 @@
#include "../player/TouchEvent.h"
#include "../player/Contact.h"
#include "../player/TrackerInputDevice.h"
+#include "../player/Publisher.h"
#include <boost/shared_ptr.hpp>
#include <string>
@@ -82,29 +83,6 @@ void export_event()
from_python_sequence<ContourSeq, variable_capacity_policy>();
from_python_sequence<vector<EventPtr>, variable_capacity_policy>();
- enum_<Event::Type>("Type")
- .value("KEYUP", Event::KEYUP)
- .value("KEYDOWN", Event::KEYDOWN)
- .value("CURSORMOTION", Event::CURSORMOTION)
- .value("CURSORUP", Event::CURSORUP)
- .value("CURSORDOWN", Event::CURSORDOWN)
- .value("CURSOROVER", Event::CURSOROVER)
- .value("CURSOROUT", Event::CURSOROUT)
- .value("CUSTOMEVENT", Event::CUSTOMEVENT)
- .value("RESIZE", Event::RESIZE)
- .value("QUIT", Event::QUIT)
- .export_values()
- ;
-
- enum_<CursorEvent::Source>("Source")
- .value("MOUSE", CursorEvent::MOUSE)
- .value("TOUCH", CursorEvent::TOUCH)
- .value("TRACK", CursorEvent::TRACK)
- .value("CUSTOM", Event::CUSTOM)
- .value("NONE", Event::NONE)
- .export_values()
- ;
-
enum_<int>("KeyModifier")
.value("KEYMOD_NONE", key::KEYMOD_NONE)
.value("KEYMOD_LSHIFT", key::KEYMOD_LSHIFT)
@@ -126,17 +104,41 @@ void export_event()
.export_values()
;
- class_<Event, boost::noncopyable>("Event", init<Event::Type, Event::Source,
- optional<int> >())
+ scope mainScope;
+
+ scope eventScope = class_<Event, boost::noncopyable>("Event", init<Event::Type,
+ Event::Source, optional<int> >())
.add_property("type", &Event::getType)
.add_property("source", &Event::getSource)
.add_property("when", &Event::getWhen)
.add_property("inputdevice", &Event::getInputDevice)
- .add_property("inputdevicename",
- make_function(&Event::getInputDeviceName,
- return_value_policy<copy_const_reference>()))
+ .add_property("inputdevicename", make_function(&Event::getInputDeviceName,
+ return_value_policy<copy_const_reference>()))
+ ;
+
+ enum_<Event::Type>("Type")
+ .value("KEY_UP", Event::KEY_UP)
+ .value("KEY_DOWN", Event::KEY_DOWN)
+ .value("CURSOR_MOTION", Event::CURSOR_MOTION)
+ .value("CURSOR_UP", Event::CURSOR_UP)
+ .value("CURSOR_DOWN", Event::CURSOR_DOWN)
+ .value("CURSOR_OVER", Event::CURSOR_OVER)
+ .value("CURSOR_OUT", Event::CURSOR_OUT)
+ .value("CUSTOM_EVENT", Event::CUSTOM_EVENT)
+ .export_values()
;
+ enum_<CursorEvent::Source>("Source")
+ .value("MOUSE", CursorEvent::MOUSE)
+ .value("TOUCH", CursorEvent::TOUCH)
+ .value("TRACK", CursorEvent::TRACK)
+ .value("CUSTOM", Event::CUSTOM)
+ .value("NONE", Event::NONE)
+ .export_values()
+ ;
+
+ scope oldScope1(mainScope);
+
class_<CursorEvent, boost::shared_ptr<CursorEvent>, bases<Event> >("CursorEvent",
no_init)
.add_property("source", &CursorEvent::getSource)
@@ -161,7 +163,7 @@ void export_event()
class_<MouseEvent, bases<CursorEvent> >("MouseEvent",
init<Event::Type, bool, bool, bool, const IntPoint&, int,
- optional<const DPoint&, int> >())
+ optional<const glm::vec2&, int> >())
.add_property("leftbuttonstate", &MouseEvent::getLeftButtonState)
.add_property("middlebuttonstate", &MouseEvent::getMiddleButtonState)
.add_property("rightbuttonstate", &MouseEvent::getRightButtonState)
@@ -169,7 +171,7 @@ void export_event()
;
class_<TouchEvent, bases<CursorEvent> >("TouchEvent", init<int, Event::Type,
- const IntPoint&, Event::Source, optional<const DPoint&> >())
+ const IntPoint&, Event::Source, optional<const glm::vec2&> >())
.add_property("area", &TouchEvent::getArea)
.add_property("orientation", &TouchEvent::getOrientation)
.add_property("eccentricity", &TouchEvent::getEccentricity)
@@ -184,7 +186,8 @@ void export_event()
.def("getContour", &TouchEvent::getContour)
;
- class_<Contact, boost::shared_ptr<Contact> >("Contact", no_init)
+ object contactClass = class_<Contact, boost::shared_ptr<Contact>, bases<Publisher> >
+ ("Contact", no_init)
.add_property("id", &Contact::getID)
.add_property("age", &Contact::getAge)
.add_property("distancefromstart", &Contact::getDistanceFromStart)
@@ -194,10 +197,8 @@ void export_event()
.add_property("events", &Contact::getEvents)
.def("connectListener", &Contact::connectListener)
.def("disconnectListener", &Contact::disconnectListener)
- .def("__hash__", &Contact::getHash)
- .def(self == self)
- .def(self != self)
;
+ exportMessages(contactClass, "Contact");
enum_<TrackerImageID>("TrackerImageID")
.value("IMG_CAMERA", TRACKER_IMG_CAMERA)
diff --git a/src/wrapper/fx_wrap.cpp b/src/wrapper/fx_wrap.cpp
index 4e2e77b..b3e2ca8 100644
--- a/src/wrapper/fx_wrap.cpp
+++ b/src/wrapper/fx_wrap.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -42,8 +42,7 @@ void export_fx()
;
class_<BlurFXNode, bases<FXNode>, boost::shared_ptr<BlurFXNode>,
- boost::noncopyable>("BlurFXNode")
- .def("setParam", &BlurFXNode::setParam)
+ boost::noncopyable>("BlurFXNode", init<optional<float> >())
.add_property("radius", &BlurFXNode::getRadius,
&BlurFXNode::setRadius)
;
@@ -69,7 +68,7 @@ void export_fx()
;
class_<HueSatFXNode, bases<FXNode>, boost::shared_ptr<HueSatFXNode>,
- boost::noncopyable > ("HueSatFXNode", init< optional<float, float, float,
+ boost::noncopyable > ("HueSatFXNode", init<optional<float, float, float,
bool> >())
.add_property("hue", &HueSatFXNode::getHue,
&HueSatFXNode::setHue)
@@ -82,8 +81,8 @@ void export_fx()
.def("__repr__", &HueSatFXNode::toString)
;
- class_<InvertFXNode, bases<FXNode>, boost::shared_ptr<InvertFXNode>, boost::noncopyable>(
- "InvertFXNode")
+ class_<InvertFXNode, bases<FXNode>, boost::shared_ptr<InvertFXNode>,
+ boost::noncopyable>("InvertFXNode")
;
class_<NullFXNode, bases<FXNode>, boost::shared_ptr<NullFXNode>, boost::noncopyable>(
@@ -91,8 +90,8 @@ void export_fx()
;
class_<ShadowFXNode, bases<FXNode>, boost::shared_ptr<ShadowFXNode>,
- boost::noncopyable>("ShadowFXNode")
- .def("setParams", &ShadowFXNode::setParams)
+ boost::noncopyable>("ShadowFXNode",
+ init<optional<glm::vec2, float, float, std::string> >())
.add_property("offset", &ShadowFXNode::getOffset, &ShadowFXNode::setOffset)
.add_property("radius", &ShadowFXNode::getRadius, &ShadowFXNode::setRadius)
.add_property("opacity", &ShadowFXNode::getOpacity, &ShadowFXNode::setOpacity)
diff --git a/src/wrapper/node_wrap.cpp b/src/wrapper/node_wrap.cpp
index 171e8fc..46ce021 100644
--- a/src/wrapper/node_wrap.cpp
+++ b/src/wrapper/node_wrap.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -36,7 +36,6 @@ void export_devices();
#include "../player/AVGNode.h"
#include "../player/CanvasNode.h"
#include "../player/DivNode.h"
-#include "../player/PanoImageNode.h"
#include "../player/SoundNode.h"
#include "../player/LineNode.h"
#include "../player/RectNode.h"
@@ -48,9 +47,11 @@ void export_devices();
#include <boost/version.hpp>
#include <boost/shared_ptr.hpp>
+#include <string>
using namespace boost::python;
using namespace avg;
+using namespace std;
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(unlink_overloads, Node::unlink, 0, 1);
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(disconnectEventHandler_overloads,
@@ -58,24 +59,24 @@ BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(disconnectEventHandler_overloads,
// These function templates essentially call functions such as AreaNode::getPos()
// and return a version of the result that don't allow setting of the individual
-// elements of the DPoint returned.
+// elements of the vec2 returned.
// Without this stuff, python code like node.pos.x=30 would fail silently. With it,
// it at least throws an exception.
-template<class CLASS, const DPoint& (CLASS::*FUNC)() const>
-ConstDPoint constPointGetterRef(const CLASS& node)
+template<class CLASS, const glm::vec2& (CLASS::*FUNC)() const>
+ConstVec2 constPointGetterRef(const CLASS& node)
{
return (node.*FUNC)();
}
-template<class CLASS, DPoint (CLASS::*FUNC)() const>
-ConstDPoint constPointGetter(const CLASS& node)
+template<class CLASS, glm::vec2 (CLASS::*FUNC)() const>
+ConstVec2 constPointGetter(const CLASS& node)
{
return (node.*FUNC)();
}
-ConstDPoint AreaNode_getMediaSize(AreaNode* This)
+ConstVec2 AreaNode_getMediaSize(AreaNode* This)
{
- return (DPoint)(This->getMediaSize());
+ return (glm::vec2)(This->getMediaSize());
}
char divNodeName[] = "div";
@@ -92,13 +93,15 @@ char meshNodeName[] = "mesh";
void export_node()
{
+ // vector< vector<vec2> > PolygonNode
+ to_python_converter<VectorVec2Vector, to_list<VectorVec2Vector> >();
+ from_python_sequence<VectorVec2Vector, variable_capacity_policy>();
- class_<Node, boost::shared_ptr<Node>, boost::noncopyable>("Node", no_init)
- .def(self == self)
- .def(self != self)
- .def("__hash__", &Node::getHash)
+ object nodeClass = class_<Node, boost::shared_ptr<Node>, bases<Publisher>,
+ boost::noncopyable>("Node", no_init)
.add_property("id", make_function(&Node::getID,
- return_value_policy<copy_const_reference>()), &Node::setID)
+ return_value_policy<copy_const_reference>()), &Node::setID)
+ .def("registerInstance", &Node::registerInstance)
.def("getParent", &Node::getParent)
.def("unlink", &Node::unlink, unlink_overloads(args("bKill")))
.def("setEventCapture", &Node::setMouseEventCapture)
@@ -112,14 +115,15 @@ void export_node()
.def("getAbsPos", &Node::getAbsPos)
.def("getRelPos", &Node::getRelPos)
.def("getElementByPos", &Node::getElementByPos)
+ .add_property("parent", &Node::getParent)
.add_property("active", &Node::getActive, &Node::setActive)
.add_property("sensitive", &Node::getSensitive, &Node::setSensitive)
.add_property("opacity", &Node::getOpacity, &Node::setOpacity)
;
+ exportMessages(nodeClass, "Node");
- class_<AreaNode, boost::shared_ptr<AreaNode>, bases<Node>, boost::noncopyable>(
- "AreaNode",
- no_init)
+ class_<AreaNode, boost::shared_ptr<AreaNode>, bases<Node>,
+ boost::noncopyable>("AreaNode", no_init)
.def("getMediaSize", &AreaNode_getMediaSize)
.add_property("x", &AreaNode::getX, &AreaNode::setX)
.add_property("y", &AreaNode::getY, &AreaNode::setY)
@@ -134,7 +138,13 @@ void export_node()
&AreaNode::setPivot)
.add_property("pivotx", &deprecatedGet<AreaNode>, &deprecatedSet<AreaNode>)
.add_property("pivoty", &deprecatedGet<AreaNode>, &deprecatedSet<AreaNode>)
+ .add_property("elementoutlinecolor",
+ make_function(&AreaNode::getElementOutlineColor,
+ return_value_policy<copy_const_reference>()),
+ make_function(&AreaNode::setElementOutlineColor,
+ return_value_policy<copy_const_reference>()))
;
+
export_bitmap();
export_fx();
export_raster();
@@ -142,11 +152,6 @@ void export_node()
class_<DivNode, bases<AreaNode>, boost::noncopyable>("DivNode", no_init)
.def("__init__", raw_constructor(createNode<divNodeName>))
.add_property("crop", &DivNode::getCrop, &DivNode::setCrop)
- .add_property("elementoutlinecolor",
- make_function(&DivNode::getElementOutlineColor,
- return_value_policy<copy_const_reference>()),
- make_function(&DivNode::setElementOutlineColor,
- return_value_policy<copy_const_reference>()))
.def("getNumChildren", &DivNode::getNumChildren)
.def("getChild", make_function(&DivNode::getChild,
return_value_policy<copy_const_reference>()))
@@ -191,23 +196,6 @@ void export_node()
.add_property("volume", &SoundNode::getVolume, &SoundNode::setVolume)
;
- class_<PanoImageNode, bases<AreaNode> >("PanoImageNode", no_init)
- .def("__init__", raw_constructor(createNode<panoImageNodeName>))
- .def("getScreenPosFromPanoPos", &PanoImageNode::getScreenPosFromPanoPos)
- .def("getScreenPosFromAngle", &PanoImageNode::getScreenPosFromAngle)
- .add_property("href", make_function(&PanoImageNode::getHRef,
- return_value_policy<copy_const_reference>()), &PanoImageNode::setHRef)
- .add_property("sensorwidth", &PanoImageNode::getSensorWidth,
- &PanoImageNode::setSensorWidth)
- .add_property("sensorheight", &PanoImageNode::getSensorHeight,
- &PanoImageNode::setSensorHeight)
- .add_property("focallength", &PanoImageNode::getFocalLength,
- &PanoImageNode::setFocalLength)
- .add_property("rotation", &PanoImageNode::getRotation,
- &PanoImageNode::setRotation)
- .add_property("maxrotation", &PanoImageNode::getMaxRotation)
- ;
-
class_<VectorNode, bases<Node>, boost::noncopyable>("VectorNode",
no_init)
.add_property("strokewidth", &VectorNode::getStrokeWidth,
@@ -294,6 +282,8 @@ void export_node()
.add_property("y4", &deprecatedGet<CurveNode>, &deprecatedSet<CurveNode>)
.add_property("texcoord1", &CurveNode::getTexCoord1, &CurveNode::setTexCoord1)
.add_property("texcoord2", &CurveNode::getTexCoord2, &CurveNode::setTexCoord2)
+ .add_property("length", &CurveNode::getCurveLen)
+ .def("getPtOnCurve", &CurveNode::getPtOnCurve)
;
class_<PolyLineNode, bases<VectorNode>, boost::noncopyable>("PolyLineNode", no_init)
@@ -313,6 +303,8 @@ void export_node()
.add_property("texcoords", make_function(&PolygonNode::getTexCoords,
return_value_policy<copy_const_reference>()), &PolygonNode::setTexCoords)
.add_property("linejoin", &PolygonNode::getLineJoin, &PolygonNode::setLineJoin)
+ .add_property("holes", make_function(&PolygonNode::getHoles,
+ return_value_policy<copy_const_reference>()), &PolygonNode::setHoles)
;
class_<CircleNode, bases<FilledVectorNode>, boost::noncopyable>("CircleNode",
@@ -335,6 +327,7 @@ void export_node()
return_value_policy<copy_const_reference>()), &MeshNode::setTexCoords)
.add_property("triangles", make_function(&MeshNode::getTriangles,
return_value_policy<copy_const_reference>()), &MeshNode::setTriangles)
+ .add_property("backfacecull", &MeshNode::getBackfaceCull, &MeshNode::setBackfaceCull)
;
}
diff --git a/src/wrapper/raster_wrap.cpp b/src/wrapper/raster_wrap.cpp
index 182064f..c0cdebb 100644
--- a/src/wrapper/raster_wrap.cpp
+++ b/src/wrapper/raster_wrap.cpp
@@ -1,6 +1,6 @@
//
// libavg - Media Playback Engine.
-// Copyright (C) 2003-2011 Ulrich von Zadow
+// 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
@@ -25,6 +25,7 @@
#include "../player/CameraNode.h"
#include "../player/ImageNode.h"
#include "../player/VideoNode.h"
+#include "../player/FontStyle.h"
#include "../player/WordsNode.h"
using namespace boost::python;
@@ -34,12 +35,11 @@ using namespace std;
char imageNodeName[] = "image";
char cameraNodeName[] = "camera";
char videoNodeName[] = "video";
+char fontStyleName[] = "fontstyle";
char wordsNodeName[] = "words";
void export_raster()
{
- to_python_converter<VertexGrid, to_list<VertexGrid> >();
- from_python_sequence<VertexGrid, variable_capacity_policy>();
class_<RasterNode, bases<AreaNode>, boost::noncopyable>("RasterNode", no_init)
.def("getOrigVertexCoords", &RasterNode::getOrigVertexCoords)
@@ -108,11 +108,44 @@ void export_raster()
.def("setWhitebalance", &CameraNode::setWhitebalance)
.def("doOneShotWhitebalance", &CameraNode::doOneShotWhitebalance)
.def("isAvailable", &CameraNode::isAvailable)
- .def("dumpCameras", make_function(&CameraNode::dumpCameras))
- .staticmethod("dumpCameras")
+ .def("getCamerasInfos", make_function(&CameraNode::getCamerasInfos))
+ .staticmethod("getCamerasInfos")
.def("resetFirewireBus", &CameraNode::resetFirewireBus)
.staticmethod("resetFirewireBus")
;
+
+ //Wrap std::vector from CameraInfo to Pyhton list
+ to_python_converter<CamerasInfosVector, to_list<CamerasInfosVector> >();
+ from_python_sequence<CamerasInfosVector, variable_capacity_policy>();
+
+ to_python_converter<CameraImageFormatsVector, to_list<CameraImageFormatsVector> >();
+ from_python_sequence<CameraImageFormatsVector, variable_capacity_policy>();
+
+ to_python_converter<CameraControlsVector, to_list<CameraControlsVector> >();
+ from_python_sequence<CameraControlsVector, variable_capacity_policy>();
+
+ to_python_converter<FrameratesVector, to_list<FrameratesVector> >();
+ from_python_sequence<FrameratesVector, variable_capacity_policy>();
+
+ class_<CameraImageFormat>("CameraImageFormat", no_init)
+ .add_property("size", &CameraImageFormat::getSize)
+ .add_property("pixelFormat", &CameraImageFormat::getPixelFormat)
+ .add_property("framerates", &CameraImageFormat::getFramerates)
+ ;
+
+ class_<CameraControl>("CameraControl", no_init)
+ .add_property("controlName", &CameraControl::getControlName)
+ .add_property("min", &CameraControl::getMin)
+ .add_property("max", &CameraControl::getMax)
+ .add_property("default", &CameraControl::getDefault)
+ ;
+
+ class_<CameraInfo>("CameraInfo", no_init)
+ .add_property("driver", &CameraInfo::getDriver)
+ .add_property("deviceID", &CameraInfo::getDeviceID)
+ .add_property("imageFormats", &CameraInfo::getImageFormats)
+ .add_property("controls", &CameraInfo::getControls)
+ ;
enum_<VideoNode::VideoAccelType>("VideoAccelType")
.value("NO_ACCELERATION", VideoNode::NONE)
@@ -131,7 +164,10 @@ void export_raster()
.def("seekToFrame", &VideoNode::seekToFrame)
.def("getStreamPixelFormat", &VideoNode::getStreamPixelFormat)
.def("getDuration", &VideoNode::getDuration)
+ .def("getVideoDuration", &VideoNode::getVideoDuration)
+ .def("getAudioDuration", &VideoNode::getAudioDuration)
.def("getBitrate", &VideoNode::getBitrate)
+ .def("getContainerFormat", &VideoNode::getContainerFormat)
.def("getVideoCodec", &VideoNode::getVideoCodec)
.def("getAudioCodec", &VideoNode::getAudioCodec)
.def("getAudioSampleRate", &VideoNode::getAudioSampleRate)
@@ -155,8 +191,43 @@ void export_raster()
.add_property("accelerated", &VideoNode::isAccelerated)
;
+ class_<FontStyle, bases<ExportedObject> >("FontStyle", no_init)
+ .def("__init__", raw_constructor(createExportedObject<fontStyleName>))
+ .def("__copy__", copyObject<FontStyle>)
+ .add_property("font",
+ make_function(&FontStyle::getFont,
+ return_value_policy<copy_const_reference>()),
+ make_function(&FontStyle::setFont,
+ return_value_policy<copy_const_reference>()))
+ .add_property("variant",
+ make_function(&FontStyle::getFontVariant,
+ return_value_policy<copy_const_reference>()),
+ make_function(&FontStyle::setFontVariant,
+ return_value_policy<copy_const_reference>()))
+ .add_property("color",
+ make_function(&FontStyle::getColor,
+ return_value_policy<copy_const_reference>()),
+ make_function(&FontStyle::setColor,
+ return_value_policy<copy_const_reference>()))
+ .add_property("aagamma", &FontStyle::getAAGamma, &FontStyle::setAAGamma)
+ .add_property("fontsize", &FontStyle::getFontSize, &FontStyle::setFontSize)
+ .add_property("indent", &FontStyle::getIndent, &FontStyle::setIndent)
+ .add_property("linespacing", &FontStyle::getLineSpacing,
+ &FontStyle::setLineSpacing)
+ .add_property("alignment", &FontStyle::getAlignment, &FontStyle::setAlignment)
+ .add_property("wrapmode", &FontStyle::getWrapMode, &FontStyle::setWrapMode)
+ .add_property("justify", &FontStyle::getJustify, &FontStyle::setJustify)
+ .add_property("letterspacing", &FontStyle::getLetterSpacing,
+ &FontStyle::setLetterSpacing)
+ .add_property("hint", &FontStyle::getHint, &FontStyle::setHint)
+ ;
+
class_<WordsNode, bases<RasterNode> >("WordsNode", no_init)
.def("__init__", raw_constructor(createNode<wordsNodeName>))
+ .add_property("fontstyle",
+ make_function(&WordsNode::getFontStyle,
+ return_value_policy<copy_const_reference>()),
+ &WordsNode::setFontStyle)
.add_property("font",
make_function(&WordsNode::getFont,
return_value_policy<copy_const_reference>()),
@@ -170,13 +241,13 @@ void export_raster()
.add_property("text",
make_function(&WordsNode::getText,
return_value_policy<copy_const_reference>()),
- make_function(&WordsNode::setText,
- return_value_policy<copy_const_reference>()))
+ &WordsNode::setText)
.add_property("color",
make_function(&WordsNode::getColor,
return_value_policy<copy_const_reference>()),
make_function(&WordsNode::setColor,
return_value_policy<copy_const_reference>()))
+ .add_property("aagamma", &WordsNode::getAAGamma, &WordsNode::setAAGamma)
.add_property("fontsize", &WordsNode::getFontSize, &WordsNode::setFontSize)
.add_property("parawidth", &deprecatedGet<WordsNode>, &deprecatedSet<WordsNode>)
.add_property("indent", &WordsNode::getIndent, &WordsNode::setIndent)
diff --git a/src/wrapper/raw_constructor.hpp b/src/wrapper/raw_constructor.hpp
index 8f6b3a4..69ee9ba 100644
--- a/src/wrapper/raw_constructor.hpp
+++ b/src/wrapper/raw_constructor.hpp
@@ -30,7 +30,7 @@ namespace detail {
object(
f(
object(a[0])
- , object(a.slice(1, len(a)))
+ , object(a.slice(0, len(a)))
, keywords ? dict(borrowed_reference(keywords)) : dict()
)
).ptr()